Date: Sat, 21 Jul 2012 13:02:12 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r238667 - in head: lib/libc/sys sys/kern sys/sys Message-ID: <201207211302.q6LD2Crb035566@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 21 13:02:11 2012 New Revision: 238667 URL: http://svn.freebsd.org/changeset/base/238667 Log: (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 Modified: head/lib/libc/sys/fcntl.c head/sys/kern/kern_descrip.c head/sys/sys/fcntl.h Modified: head/lib/libc/sys/fcntl.c ============================================================================== --- head/lib/libc/sys/fcntl.c Sat Jul 21 08:19:43 2012 (r238666) +++ head/lib/libc/sys/fcntl.c Sat Jul 21 13:02:11 2012 (r238667) @@ -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; Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Jul 21 08:19:43 2012 (r238666) +++ head/sys/kern/kern_descrip.c Sat Jul 21 13:02:11 2012 (r238667) @@ -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; Modified: head/sys/sys/fcntl.h ============================================================================== --- head/sys/sys/fcntl.h Sat Jul 21 08:19:43 2012 (r238666) +++ head/sys/sys/fcntl.h Sat Jul 21 13:02:11 2012 (r238667) @@ -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) */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207211302.q6LD2Crb035566>