mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Add lim_cowsync, similar to crcowsync
This commit is contained in:
parent
f0000eb41d
commit
8a0cb04df4
@ -1216,6 +1216,26 @@ lim_hold(struct plimit *limp)
|
||||
return (limp);
|
||||
}
|
||||
|
||||
struct plimit *
|
||||
lim_cowsync(void)
|
||||
{
|
||||
struct thread *td;
|
||||
struct proc *p;
|
||||
struct plimit *oldlimit;
|
||||
|
||||
td = curthread;
|
||||
p = td->td_proc;
|
||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||
|
||||
if (td->td_limit == p->p_limit)
|
||||
return (NULL);
|
||||
|
||||
oldlimit = td->td_limit;
|
||||
td->td_limit = lim_hold(p->p_limit);
|
||||
|
||||
return (oldlimit);
|
||||
}
|
||||
|
||||
void
|
||||
lim_fork(struct proc *p1, struct proc *p2)
|
||||
{
|
||||
|
@ -859,10 +859,7 @@ thread_cow_update(struct thread *td)
|
||||
oldlimit = NULL;
|
||||
PROC_LOCK(p);
|
||||
oldcred = crcowsync();
|
||||
if (td->td_limit != p->p_limit) {
|
||||
oldlimit = td->td_limit;
|
||||
td->td_limit = lim_hold(p->p_limit);
|
||||
}
|
||||
oldlimit = lim_cowsync();
|
||||
td->td_cowgen = p->p_cowgen;
|
||||
PROC_UNLOCK(p);
|
||||
if (oldcred != NULL)
|
||||
|
@ -148,6 +148,8 @@ void lim_free(struct plimit *limp);
|
||||
void lim_freen(struct plimit *limp, int n);
|
||||
struct plimit
|
||||
*lim_hold(struct plimit *limp);
|
||||
struct plimit
|
||||
*lim_cowsync(void);
|
||||
rlim_t lim_max(struct thread *td, int which);
|
||||
rlim_t lim_max_proc(struct proc *p, int which);
|
||||
void lim_rlimit(struct thread *td, int which, struct rlimit *rlp);
|
||||
|
Loading…
Reference in New Issue
Block a user