#include <sys/lock.h> and <sys/mutex.h>
bde at zeta.org.au
Tue Apr 1 04:26:23 PST 2003
On Tue, 1 Apr 2003, Poul-Henning Kamp wrote:
> As we progress down the path of SMPng we will need to include
> <sys/lock.h> and <sys/mutex.h> in more and more files.
> The current score, not counting nested include cases, they currently
> are included approx 16% and 19% of all .c files under /sys.
> My present predicament is that I will probably put a mutex in the
> bio queue which is defined in <sys/bio.h>, and so far, I've found
> 20 .c files where I need to add <sys/lock.h> and <sys/mutex.h> and
> I am not yet at a point where LINT compiles.
> Do we have a plan for these in the future ? I can see three obvious
We've mostly followed this plan for the last 23 months:
% RCS file: /home/ncvs/src/sys/sys/_mutex.h,v
% Working file: _mutex.h
% head: 1.9
% revision 1.1
% date: 2001/05/01 08:13:17; author: markm; state: Exp;
% Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
% other "system" header files.
% Also help the deprecation of lockmgr.h by making it a sub-include of
% sys/lock.h and removing sys/lockmgr.h form kernel .c files.
% Sort sys/*.h includes where possible in affected files.
% OK'ed by: bde (with reservations)
*.h should include <sys/_mutex.h> and its prerequisite <sys/_mutex.h> if
any mutexes are declared, and *.c should include <sys/mutex.h> and its
prerequisite <sys/mutex.h> if any mutext is used (other than to assign it).
*.h may hide some of the details using macros like PROC_LOCK(), but should
not include primary headers like <sys/mutex.h> to do so.
More information about the freebsd-arch