Index: sys/sys/fcntl.h =================================================================== --- sys/sys/fcntl.h +++ sys/sys/fcntl.h @@ -207,35 +207,56 @@ * Constants used for fcntl(2) */ +#define __fcntl_type_attr(type) __datatype_type_tag(fcntl, type) + /* command values */ -#define F_DUPFD 0 /* duplicate file descriptor */ -#define F_GETFD 1 /* get file descriptor flags */ -#define F_SETFD 2 /* set file descriptor flags */ -#define F_GETFL 3 /* get file status flags */ -#define F_SETFL 4 /* set file status flags */ +static const int __F_DUPFD __fcntl_type_attr(int) = 0; +#define F_DUPFD __F_DUPFD /* duplicate file descriptor */ +static const int __F_GETFD __fcntl_type_attr(void) = 1; +#define F_GETFD __F_GETFD /* get file descriptor flags */ +static const int __F_SETFD __fcntl_type_attr(int) = 2; +#define F_SETFD __F_SETFD /* set file descriptor flags */ +static const int __F_GETFL __fcntl_type_attr(void) = 3; +#define F_GETFL __F_GETFL /* get file status flags */ +static const int __F_SETFL __fcntl_type_attr(int) = 4; +#define F_SETFL __F_SETFL /* set file status flags */ #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 -#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ -#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ +static const int __F_GETOWN __fcntl_type_attr(pid_t) = 5; +#define F_GETOWN __F_GETOWN /* get SIGIO/SIGURG proc/pgrp */ +static const int __F_SETOWN __fcntl_type_attr(pid_t) = 6; +#define F_SETOWN __F_SETOWN /* 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 */ +static const int __F_OGETLK __fcntl_type_attr(int) = 7; +#define F_OGETLK __F_OGETLK /* get record locking information */ +static const int __F_OSETLK __fcntl_type_attr(int) = 8; +#define F_OSETLK __F_OSETLK /* set record locking information */ +static const int __F_OSETLKW __fcntl_type_attr(int) = 9; +#define F_OSETLKW __F_OSETLKW /* F_SETLK; wait if blocked */ +static const int __F_DUP2FD __fcntl_type_attr(int) = 10; +#define F_DUP2FD __F_DUP2FD /* 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 */ +static const int __F_GETLK __fcntl_type_attr(__intptr_t) = 11; +#define F_GETLK __F_GETLK /* get record locking information */ +static const int __F_SETLK __fcntl_type_attr(__intptr_t) = 12; +#define F_SETLK __F_SETLK /* set record locking information */ +static const int __F_SETLKW __fcntl_type_attr(__intptr_t) = 13; +#define F_SETLKW __F_SETLKW /* 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 */ +static const int __F_SETLK_REMOTE __fcntl_type_attr(__intptr_t) = 14; +#define F_SETLK_REMOTE __F_SETLK_REMOTE /* debugging support for remote locks */ +static const int __F_READAHEAD __fcntl_type_attr(int) = 15; +#define F_READAHEAD __F_READAHEAD /* read ahead */ +static const int __F_RDAHEAD __fcntl_type_attr(int) = 16; +#define F_RDAHEAD __F_RDAHEAD /* Darwin compatible read ahead */ #endif #if __POSIX_VISIBLE >= 200809 -#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ +static const int __F_DUPFD_CLOEXEC __fcntl_type_attr(int) = 17; +#define F_DUPFD_CLOEXEC __F_DUPFD_CLOEXEC /* Like F_DUPFD, but FD_CLOEXEC is set */ #endif #if __BSD_VISIBLE -#define F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ +static const int __F_DUP2FD_CLOEXEC __fcntl_type_attr(int) = 18; +#define F_DUP2FD_CLOEXEC __F_DUP2FD_CLOEXEC /* Like F_DUP2FD, but FD_CLOEXEC is set */ #endif /* file descriptor flags (F_GETFD, F_SETFD) */ @@ -308,7 +329,7 @@ __BEGIN_DECLS int open(const char *, int, ...); int creat(const char *, mode_t); -int fcntl(int, int, ...); +int fcntl(int, int, ...) __arg_type_tag(fcntl, 3, 2); #if __BSD_VISIBLE int flock(int, int); #endif