-/* Copyright (C) 2000,2002,2003,2004,2006,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2002-2004,2006,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <sys/syscall.h>
#include <kernel-features.h>
-#if __ASSUME_FCNTL64 == 0
+#ifndef __ASSUME_FCNTL64
/* This variable is shared with all files that check for fcntl64. */
int __have_no_fcntl64;
#endif
#ifdef __ASSUME_F_GETOWN_EX
# define miss_F_GETOWN_EX 0
-#else
+#elif !defined __ASSUME_FCNTL64
static int miss_F_GETOWN_EX;
#endif
-#if defined NO_CANCELLATION && __ASSUME_FCNTL64 == 0
+#if defined NO_CANCELLATION && !defined __ASSUME_FCNTL64
# define __fcntl_nocancel __libc_fcntl
#endif
-#if !defined NO_CANCELLATION || __ASSUME_FCNTL64 == 0
+#if !defined NO_CANCELLATION || !defined __ASSUME_FCNTL64
int
__fcntl_nocancel (int fd, int cmd, ...)
{
arg = va_arg (ap, void *);
va_end (ap);
-#if __ASSUME_FCNTL64 == 0
+#ifndef __ASSUME_FCNTL64
# ifdef __NR_fcntl64
if (! __have_no_fcntl64)
{
if (!INTERNAL_SYSCALL_ERROR_P (res, err))
return fex.type == F_OWNER_GID ? -fex.pid : fex.pid;
-#ifndef __ASSUME_F_GETOWN_EX
+# ifndef __ASSUME_F_GETOWN_EX
if (INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)
miss_F_GETOWN_EX = 1;
else
-#endif
+# endif
{
__set_errno (INTERNAL_SYSCALL_ERRNO (res, err));
return -1;
arg = va_arg (ap, void *);
va_end (ap);
-#if __ASSUME_FCNTL64 > 0
+# ifdef __ASSUME_FCNTL64
if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
int oldtype = LIBC_CANCEL_ASYNC ();
int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
-#else
+# else
if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
return __fcntl_nocancel (fd, cmd, arg);
int oldtype = LIBC_CANCEL_ASYNC ();
int result = __fcntl_nocancel (fd, cmd, arg);
-#endif
+# endif
LIBC_CANCEL_RESET (oldtype);