OSDN Git Service

Replace FSF snail mail address with URLs
[uclinux-h8/uClibc.git] / libc / misc / file / lockf64.c
index 23f88f1..8d950ed 100644 (file)
 
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   see <http://www.gnu.org/licenses/>.  */
 
-#include <features.h>
-
-#ifdef __UCLIBC_HAS_LFS__
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 
-#undef _FILE_OFFSET_BITS
-#define        _FILE_OFFSET_BITS   64
-#endif
-#ifndef __USE_FILE_OFFSET64
-# define __USE_FILE_OFFSET64   1
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64     1
-#endif
-#endif
-
-#define __USE_GNU
+#include <_lfs_64.h>
 
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/syscall.h>
 
 #ifdef __NR_fcntl64
-extern int fcntl64 (int fd, int cmd, ...);
 #define flock flock64
 #define fcntl fcntl64
+#undef F_GETLK
 #define F_GETLK F_GETLK64
+#undef F_SETLK
 #define F_SETLK F_SETLK64
+#else
 #endif
 
+
 /* lockf is a simplified interface to fcntl's locking facilities.  */
 
-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;
@@ -62,7 +49,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;
@@ -77,7 +64,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;
@@ -102,5 +89,3 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64)
 
     return fcntl(fd, cmd, &fl);
 }
-
-strong_alias(__lockf64,lockf64)