Skip to content

Commit

Permalink
ifdef RACCT ui_racct_foreach and struct uidinfo's ui_racct
Browse files Browse the repository at this point in the history
Change racct_ create and destroy to macros evaluating to nothing without RACCT
so that their callers passing ui_racct don't have to be ifdefed.
  • Loading branch information
mjguzik committed Nov 23, 2014
1 parent fb40256 commit a4324a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions sys/kern/kern_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@ uifree(struct uidinfo *uip)
free(uip, M_UIDINFO);
}

#ifdef RACCT
void
ui_racct_foreach(void (*callback)(struct racct *racct,
void *arg2, void *arg3), void *arg2, void *arg3)
Expand All @@ -1349,6 +1350,7 @@ ui_racct_foreach(void (*callback)(struct racct *racct,
}
rw_runlock(&uihashtbl_lock);
}
#endif

/*
* Change the count associated with number of processes
Expand Down
11 changes: 2 additions & 9 deletions sys/sys/racct.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,8 @@ racct_get_available(struct proc *p, int resource)
return (UINT64_MAX);
}

static inline void
racct_create(struct racct **racctp)
{
}

static inline void
racct_destroy(struct racct **racctp)
{
}
#define racct_create(x)
#define racct_destroy(x)

static inline int
racct_proc_fork(struct proc *parent, struct proc *child)
Expand Down
4 changes: 4 additions & 0 deletions sys/sys/resourcevar.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ struct uidinfo {
long ui_kqcnt; /* (b) number of kqueues */
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))
Expand Down Expand Up @@ -148,8 +150,10 @@ 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);
#endif

#endif /* _KERNEL */
#endif /* !_SYS_RESOURCEVAR_H_ */

0 comments on commit a4324a5

Please sign in to comment.