diff options
Diffstat (limited to 'freebsd/sys/sys/resourcevar.h')
-rw-r--r-- | freebsd/sys/sys/resourcevar.h | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/freebsd/sys/sys/resourcevar.h b/freebsd/sys/sys/resourcevar.h index 3dead510..1d290aaa 100644 --- a/freebsd/sys/sys/resourcevar.h +++ b/freebsd/sys/sys/resourcevar.h @@ -47,21 +47,22 @@ * Locking key: * b - created at fork, never changes * c - locked by proc mtx - * j - locked by proc slock * k - only accessed by curthread + * w - locked by proc itim lock + * w2 - locked by proc prof lock */ struct pstats { #define pstat_startzero p_cru struct rusage p_cru; /* Stats for reaped children. */ - struct itimerval p_timer[3]; /* (j) Virtual-time timers. */ + struct itimerval p_timer[3]; /* (w) Virtual-time timers. */ #define pstat_endzero pstat_startcopy #define pstat_startcopy p_prof struct uprof { /* Profile arguments. */ - caddr_t pr_base; /* (c + j) Buffer base. */ - u_long pr_size; /* (c + j) Buffer size. */ - u_long pr_off; /* (c + j) PC offset. */ - u_long pr_scale; /* (c + j) PC scaling. */ + caddr_t pr_base; /* (c + w2) Buffer base. */ + u_long pr_size; /* (c + w2) Buffer size. */ + u_long pr_off; /* (c + w2) PC offset. */ + u_long pr_scale; /* (c + w2) PC scaling. */ } p_prof; #define pstat_endcopy p_start struct timeval p_start; /* (b) Starting time. */ @@ -89,7 +90,7 @@ struct racct; * Locking guide: * (a) Constant from inception * (b) Lockless, updated using atomics - * (c) Locked by global uihashtbl_mtx + * (c) Locked by global uihashtbl_lock * (d) Locked by the ui_vmsize_mtx */ struct uidinfo { @@ -99,9 +100,13 @@ struct uidinfo { long ui_sbsize; /* (b) socket buffer space consumed */ long ui_proccnt; /* (b) number of processes */ long ui_ptscnt; /* (b) number of pseudo-terminals */ + long ui_kqcnt; /* (b) number of kqueues */ + long ui_umtxcnt; /* (b) number of shared umtxs */ uid_t ui_uid; /* (a) uid */ u_int ui_ref; /* (b) reference count */ +#ifdef RACCT struct racct *ui_racct; /* (a) resource accounting */ +#endif }; #define UIDINFO_VMSIZE_LOCK(ui) mtx_lock(&((ui)->ui_vmsize_mtx)) @@ -115,6 +120,11 @@ void addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks); void addupc_task(struct thread *td, uintfptr_t pc, u_int ticks); void calccru(struct proc *p, struct timeval *up, struct timeval *sp); void calcru(struct proc *p, struct timeval *up, struct timeval *sp); +#ifndef __rtems__ +int chgkqcnt(struct uidinfo *uip, int diff, rlim_t max); +#else /* __rtems__ */ +#define chgkqcnt(uip, diff, max) 0 +#endif /* __rtems__ */ int chgproccnt(struct uidinfo *uip, int diff, rlim_t maxval); #ifndef __rtems__ int chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to, @@ -130,19 +140,23 @@ rtems_bsd_chgsbsize(u_int *hiwat, u_int to) #define chgsbsize(uip, hiwat, to, maxval) rtems_bsd_chgsbsize(hiwat, to) #endif /* __rtems__ */ int chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval); +int chgumtxcnt(struct uidinfo *uip, int diff, rlim_t maxval); int fuswintr(void *base); int kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which, struct rlimit *limp); struct plimit *lim_alloc(void); void lim_copy(struct plimit *dst, struct plimit *src); -rlim_t lim_cur(struct proc *p, int which); +rlim_t lim_cur(struct thread *td, int which); +rlim_t lim_cur_proc(struct proc *p, int which); void lim_fork(struct proc *p1, struct proc *p2); void lim_free(struct plimit *limp); struct plimit *lim_hold(struct plimit *limp); -rlim_t lim_max(struct proc *p, int which); -void lim_rlimit(struct proc *p, int which, struct rlimit *rlp); +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); +void lim_rlimit_proc(struct proc *p, int which, struct rlimit *rlp); void ruadd(struct rusage *ru, struct rusage_ext *rux, struct rusage *ru2, struct rusage_ext *rux2); void rucollect(struct rusage *ru, struct rusage *ru2); @@ -157,8 +171,11 @@ struct uidinfo void uifree(struct uidinfo *uip); void uihashinit(void); void uihold(struct uidinfo *uip); +#ifdef RACCT void ui_racct_foreach(void (*callback)(struct racct *racct, - void *arg2, void *arg3), void *arg2, void *arg3); + void *arg2, void *arg3), void (*pre)(void), void (*post)(void), + void *arg2, void *arg3); +#endif #endif /* _KERNEL */ #endif /* !_SYS_RESOURCEVAR_H_ */ |