diff options
Diffstat (limited to 'libc/misc/file')
-rw-r--r-- | libc/misc/file/lockf.c | 20 | ||||
-rw-r--r-- | libc/misc/file/lockf64.c | 21 |
2 files changed, 23 insertions, 18 deletions
diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c index 2ba81de9a..6c1184be2 100644 --- a/libc/misc/file/lockf.c +++ b/libc/misc/file/lockf.c @@ -17,7 +17,6 @@ Boston, MA 02111-1307, USA. */ #include <features.h> -#undef __lockf #include <sys/types.h> #include <unistd.h> @@ -25,14 +24,19 @@ #include <errno.h> #include <string.h> +libc_hidden_proto(lockf) + +libc_hidden_proto(memset) +libc_hidden_proto(fcntl) +libc_hidden_proto(getpid) + /* lockf is a simplified interface to fcntl's locking facilities. */ -#undef lockf -int attribute_hidden __lockf (int fd, int cmd, off_t len) +int lockf (int fd, int cmd, off_t len) { struct flock fl; - __memset ((char *) &fl, '\0', sizeof (fl)); + memset ((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; @@ -45,9 +49,9 @@ int attribute_hidden __lockf (int fd, int cmd, off_t len) /* Test the lock: return 0 if FD is unlocked or locked by this process; return -1, set errno to EACCES, if another process holds the lock. */ fl.l_type = F_RDLCK; - if (__fcntl (fd, F_GETLK, &fl) < 0) + if (fcntl (fd, F_GETLK, &fl) < 0) return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) + if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) return 0; __set_errno(EACCES); return -1; @@ -70,6 +74,6 @@ int attribute_hidden __lockf (int fd, int cmd, off_t len) return -1; } - return __fcntl(fd, cmd, &fl); + return fcntl(fd, cmd, &fl); } -strong_alias(__lockf,lockf) +libc_hidden_def(lockf) diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c index 1e294d9a6..be5fc6c07 100644 --- a/libc/misc/file/lockf64.c +++ b/libc/misc/file/lockf64.c @@ -17,7 +17,6 @@ Boston, MA 02111-1307, USA. */ #include <features.h> -#undef __lockf64 #ifdef __UCLIBC_HAS_LFS__ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 @@ -43,17 +42,20 @@ #ifdef __NR_fcntl64 #define flock flock64 -#define fcntl __fcntl64 +#define fcntl fcntl64 #define F_GETLK F_GETLK64 #define F_SETLK F_SETLK64 -#else -#define fcntl __fcntl #endif +libc_hidden_proto(lockf64) + +libc_hidden_proto(memset) +libc_hidden_proto(fcntl) +libc_hidden_proto(getpid) + /* lockf is a simplified interface to fcntl's locking facilities. */ -#undef lockf64 -int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) +int lockf64 (int fd, int cmd, off64_t len64) { struct flock fl; off_t len = (off_t) len64; @@ -65,7 +67,7 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) return -1; } - __memset((char *) &fl, '\0', sizeof (fl)); + memset((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; @@ -80,7 +82,7 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) fl.l_type = F_RDLCK; if (fcntl (fd, F_GETLK, &fl) < 0) return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) + if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) return 0; __set_errno(EACCES); return -1; @@ -105,5 +107,4 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) return fcntl(fd, cmd, &fl); } - -strong_alias(__lockf64,lockf64) +libc_hidden_def(lockf64) |