summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-07-21 13:02:11 +0000
committerkib <kib@FreeBSD.org>2012-07-21 13:02:11 +0000
commite04825c920221bef72b0adc4386073fe8e20a946 (patch)
treea58a2bd91bd7f63390dffff4655ddf9fa36192ab
parent7ed4ca833736cc3a06dfc656f7df505a24bacf6a (diff)
downloadFreeBSD-src-e04825c920221bef72b0adc4386073fe8e20a946.zip
FreeBSD-src-e04825c920221bef72b0adc4386073fe8e20a946.tar.gz
(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
-rw-r--r--lib/libc/sys/fcntl.c2
-rw-r--r--sys/kern/kern_descrip.c2
-rw-r--r--sys/sys/fcntl.h17
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c
index 470f8ab..480cc40 100644
--- a/lib/libc/sys/fcntl.c
+++ b/lib/libc/sys/fcntl.c
@@ -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;
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index b449846..53af37b 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -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;
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index d78d35d..f192d6c 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -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) */
OpenPOWER on IntegriCloud