提交 671ffab7 编写于 作者: R Rich Felker

various header cleanups, some related to _BSD_SOURCE addition

there is no reason to avoid multiple identical macro definitions; this
is perfectly legal C, and even with the maximal warning options
enabled, gcc does not issue any warning for it.
上级 9f370fa9
...@@ -87,7 +87,6 @@ int posix_fallocate(int, off_t, off_t); ...@@ -87,7 +87,6 @@ int posix_fallocate(int, off_t, off_t);
#define FNONBLOCK O_NONBLOCK #define FNONBLOCK O_NONBLOCK
#define FNDELAY O_NDELAY #define FNDELAY O_NDELAY
#ifndef F_OK
#define F_OK 0 #define F_OK 0
#define R_OK 4 #define R_OK 4
#define W_OK 2 #define W_OK 2
...@@ -96,9 +95,9 @@ int posix_fallocate(int, off_t, off_t); ...@@ -96,9 +95,9 @@ int posix_fallocate(int, off_t, off_t);
#define F_LOCK 1 #define F_LOCK 1
#define F_TLOCK 2 #define F_TLOCK 2
#define F_TEST 3 #define F_TEST 3
int lockf(int, int, off_t); int lockf(int, int, off_t);
#endif #endif
#endif
#ifdef _LARGEFILE64_SOURCE #ifdef _LARGEFILE64_SOURCE
#define open64 open #define open64 open
......
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
extern "C" { extern "C" {
#endif #endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define LOCK_SH 1 #define LOCK_SH 1
#define LOCK_EX 2 #define LOCK_EX 2
#define LOCK_NB 4 #define LOCK_NB 4
#define LOCK_UN 8 #define LOCK_UN 8
int flock(int, int); #define L_SET 0
#define L_INCR 1
#define L_XTND 2
#endif int flock(int, int);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -9,17 +9,14 @@ extern "C" { ...@@ -9,17 +9,14 @@ extern "C" {
#define STDOUT_FILENO 1 #define STDOUT_FILENO 1
#define STDERR_FILENO 2 #define STDERR_FILENO 2
#undef SEEK_SET
#undef SEEK_CUR
#undef SEEK_END
#define SEEK_SET 0 #define SEEK_SET 0
#define SEEK_CUR 1 #define SEEK_CUR 1
#define SEEK_END 2 #define SEEK_END 2
#if defined(_BSD_SOURCE) && !defined(L_SET) #if defined(_BSD_SOURCE)
#define L_SET SEEK_SET #define L_SET 0
#define L_INCR SEEK_CUR #define L_INCR 1
#define L_XTND SEEK_END #define L_XTND 2
#endif #endif
#undef NULL #undef NULL
...@@ -69,12 +66,10 @@ int rmdir(const char *); ...@@ -69,12 +66,10 @@ int rmdir(const char *);
int truncate(const char *, off_t); int truncate(const char *, off_t);
int ftruncate(int, off_t); int ftruncate(int, off_t);
#ifndef F_OK
#define F_OK 0 #define F_OK 0
#define R_OK 4 #define R_OK 4
#define W_OK 2 #define W_OK 2
#define X_OK 1 #define X_OK 1
#endif
int access(const char *, int); int access(const char *, int);
int faccessat(int, const char *, int, int); int faccessat(int, const char *, int, int);
...@@ -136,12 +131,10 @@ long fpathconf(int, int); ...@@ -136,12 +131,10 @@ long fpathconf(int, int);
long sysconf(int); long sysconf(int);
size_t confstr(int, char *, size_t); size_t confstr(int, char *, size_t);
#ifndef F_ULOCK
#define F_ULOCK 0 #define F_ULOCK 0
#define F_LOCK 1 #define F_LOCK 1
#define F_TLOCK 2 #define F_TLOCK 2
#define F_TEST 3 #define F_TEST 3
#endif
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
int lockf(int, int, off_t); int lockf(int, int, off_t);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册