Jeffrey Altman <[EMAIL PROTECTED]> writes: > Are there any symbols from fcntl.h that are being used by anything other > than code within AFS_NT40_ENV ?
> I prefer to pull in as few headers as necessary to correctly compile > the code. It's a lot of this sort of nonsense: #ifdef AFS_NT40_ENV #include <fcntl.h> #else #include <sys/file.h> #include <unistd.h> #include <sys/stat.h> #if defined(AFS_SUN5_ENV) || defined(AFS_NBSD_ENV) #include <sys/fcntl.h> #include <sys/resource.h> #endif #endif (src/vol/ihandle.c). The way to write that would be: #include <fcntl.h> #ifndef AFS_NT40_ENV # include <sys/stat.h> # include <unistd.h> #endif #if defined(AFS_SUN5_ENV) || defined(AFS_NBSD_ENV) # include <sys/resource.h> #endif (Of course, even better would be to always use getrlimit and setrlimit for all Unix platforms, not just Solaris and NetBSD, but that's a larger change.) Including <sys/fcntl.h> instead of <fcntl.h> is always wrong. Including <sys/file.h> is always wrong unless the code is explicitly calling flock or referencing one of the LOCK_* constants. Also note the indentation after the #. This is valid C89 and even works in K&R compilers, and it makes this sort of thing *so* much easier to read. -- Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/> _______________________________________________ OpenAFS-devel mailing list [email protected] https://lists.openafs.org/mailman/listinfo/openafs-devel
