summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common/open64.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/open64.c')
-rw-r--r--libc/sysdeps/linux/common/open64.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index f577d9507..5c19d63b5 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -1,35 +1,30 @@
-/* Copyright (C) 1991, 1995-1997, 1999, 2000 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
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <features.h>
#include <fcntl.h>
#include <stdarg.h>
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <errno.h>
+#include <sysdep-cancel.h>
+#endif
+
+#ifdef __UCLIBC_HAS_LFS__
#ifndef O_LARGEFILE
-#define O_LARGEFILE 0100000
+# define O_LARGEFILE 0100000
#endif
-#ifdef __UCLIBC_HAS_LFS__
+extern __typeof(open64) __libc_open64;
+extern __typeof(open) __libc_open;
+libc_hidden_proto(__libc_open)
+
/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
a third argument is the file protection. */
-#undef open64
-int attribute_hidden __open64 (const char *file, int oflag, ...)
+int __libc_open64 (const char *file, int oflag, ...)
{
int mode = 0;
@@ -41,8 +36,22 @@ int attribute_hidden __open64 (const char *file, int oflag, ...)
va_end (arg);
}
- return __open(file, oflag | O_LARGEFILE, mode);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+#else
+ return __libc_open(file, oflag | O_LARGEFILE, mode);
+#endif
}
-strong_alias(__open64,open64)
-weak_alias(__open64,__libc_open64)
+libc_hidden_proto(open64)
+weak_alias(__libc_open64,open64)
+libc_hidden_weak(open64)
#endif /* __UCLIBC_HAS_LFS__ */