(Incomplete) fixes for symbols visibility issues and style in fcntl.h.

Append '__' prefix to the tag of struct oflock, and put it under BSD
namespace. Structure is needed both by libc and kernel, thus cannot be
hidden under #ifdef _KERNEL.

Move a set of non-standard F_* and O_* constants into BSD namespace.
SUSv4 explicitely allows implemenation to pollute F_* and O_* names
after fcntl.h is included, but it costs us nothing to adhere
to the specification if exact POSIX compliance level is requested by
user code.

Change some spaces after #define to tabs.

Noted by and discussed with:	     bde
MFC after:   1 week
This commit is contained in:
Konstantin Belousov 2012-07-21 13:02:11 +00:00
parent d17996abb0
commit a53cab2c6c
3 changed files with 14 additions and 7 deletions

View File

@ -41,7 +41,7 @@ __fcntl_compat(int fd, int cmd, ...)
{
va_list args;
long arg;
struct oflock ofl;
struct __oflock ofl;
struct flock *flp;
int res;

View File

@ -367,7 +367,7 @@ int
sys_fcntl(struct thread *td, struct fcntl_args *uap)
{
struct flock fl;
struct oflock ofl;
struct __oflock ofl;
intptr_t arg;
int error;
int cmd;

View File

@ -111,7 +111,7 @@ typedef __pid_t pid_t;
#if __BSD_VISIBLE
/* Attempt to bypass buffer cache */
#define O_DIRECT 0x00010000
#define O_DIRECT 0x00010000
#endif
/* Defined by POSIX Extended API Set Part 2 */
@ -213,18 +213,22 @@ typedef __pid_t pid_t;
#define F_SETFL 4 /* set file status flags */
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
#endif
#if __BSD_VISIBLE
#define F_OGETLK 7 /* get record locking information */
#define F_OSETLK 8 /* set record locking information */
#define F_OSETLKW 9 /* F_SETLK; wait if blocked */
#define F_DUP2FD 10 /* duplicate file descriptor to arg */
#endif
#define F_GETLK 11 /* get record locking information */
#define F_SETLK 12 /* set record locking information */
#define F_SETLKW 13 /* F_SETLK; wait if blocked */
#if __BSD_VISIBLE
#define F_SETLK_REMOTE 14 /* debugging support for remote locks */
#define F_READAHEAD 15 /* read ahead */
#define F_RDAHEAD 16 /* Darwin compatible read ahead */
#endif
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */
#endif
@ -236,14 +240,16 @@ typedef __pid_t pid_t;
#define F_RDLCK 1 /* shared or read lock */
#define F_UNLCK 2 /* unlock */
#define F_WRLCK 3 /* exclusive or write lock */
#if __BSD_VISIBLE
#define F_UNLCKSYS 4 /* purge locks for a given system ID */
#define F_CANCEL 5 /* cancel an async lock request */
#endif
#ifdef _KERNEL
#define F_WAIT 0x010 /* Wait until lock is granted */
#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */
#define F_POSIX 0x040 /* Use POSIX semantics for lock */
#define F_REMOTE 0x080 /* Lock owner is remote NFS client */
#define F_NOINTR 0x100 /* Ignore signals when waiting */
#define F_NOINTR 0x100 /* Ignore signals when waiting */
#endif
/*
@ -259,18 +265,19 @@ struct flock {
int l_sysid; /* remote system id or zero for local */
};
#if __BSD_VISIBLE
/*
* Old advisory file segment locking data type,
* before adding l_sysid.
*/
struct oflock {
struct __oflock {
off_t l_start; /* starting offset */
off_t l_len; /* len = 0 means until end of file */
pid_t l_pid; /* lock owner */
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
};
#endif
#if __BSD_VISIBLE
/* lock operations for flock(2) */