[Glibc-bsd-commits] r1615 - trunk/glibc-2.3-head/sysdeps/kfreebsd
Petr Salinger
ps-guest at costa.debian.org
Mon Jun 26 13:30:25 UTC 2006
Author: ps-guest
Date: 2006-06-26 13:30:24 +0000 (Mon, 26 Jun 2006)
New Revision: 1615
Added:
trunk/glibc-2.3-head/sysdeps/kfreebsd/openat.c
trunk/glibc-2.3-head/sysdeps/kfreebsd/openat64.c
Modified:
trunk/glibc-2.3-head/sysdeps/kfreebsd/not-cancel.h
Log:
* add openat_not_cancel group,
it is unused in 2.3.x
needed in io/ftw.c in 2.4
Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/not-cancel.h
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/not-cancel.h 2006-06-26 13:27:03 UTC (rev 1614)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/not-cancel.h 2006-06-26 13:30:24 UTC (rev 1615)
@@ -1,5 +1,5 @@
-/* Uncancelable versions of cancelable interfaces. Linux version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* Uncancelable versions of cancelable interfaces. kFreeBSD version.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper at redhat.com>, 2003.
@@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <sys/types.h>
#include <sysdep.h>
/* Uncancelable open. */
@@ -26,6 +27,28 @@
#define open_not_cancel_2(name, flags) \
INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
+/* Uncancelable openat. */
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+extern int __openat_nocancel (int fd, const char *fname, int oflag,
+ mode_t mode) attribute_hidden;
+extern int __openat64_nocancel (int fd, const char *fname, int oflag,
+ mode_t mode) attribute_hidden;
+#else
+# define __openat_nocancel(fd, fname, oflag, mode) \
+ openat (fd, fname, oflag, mode)
+# define __openat64_nocancel(fd, fname, oflag, mode) \
+ openat64 (fd, fname, oflag, mode)
+#endif
+
+#define openat_not_cancel(fd, fname, oflag, mode) \
+ __openat_nocancel (fd, fname, oflag, mode)
+#define openat_not_cancel_3(fd, fname, oflag) \
+ __openat_nocancel (fd, fname, oflag, 0)
+#define openat64_not_cancel(fd, fname, oflag, mode) \
+ __openat64_nocancel (fd, fname, oflag, mode)
+#define openat64_not_cancel_3(fd, fname, oflag) \
+ __openat64_nocancel (fd, fname, oflag, 0)
+
/* Uncancelable close. */
#define close_not_cancel(fd) \
INLINE_SYSCALL (close, 1, fd)
Added: trunk/glibc-2.3-head/sysdeps/kfreebsd/openat.c
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/openat.c 2006-06-26 13:27:03 UTC (rev 1614)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/openat.c 2006-06-26 13:30:24 UTC (rev 1615)
@@ -0,0 +1,91 @@
+/* Copyright (C) 2005, 2006 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. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
+
+int
+__openat_nocancel (fd, file, oflag, mode)
+ int fd;
+ const char *file;
+ int oflag;
+ mode_t mode;
+{
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ /* Check FD is associated with a directory. */
+ struct stat64 st;
+ if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ /* errno is already set correctly. */
+ return -1;
+
+ if (!S_ISDIR (st.st_mode))
+ __set_errno (ENOTDIR);
+ else
+ __set_errno (ENOSYS);
+ return -1;
+ }
+ return INLINE_SYSCALL (open, 3, file, oflag, mode);
+}
+
+
+/* Open FILE with access OFLAG. Interpret relative paths relative to
+ the directory associated with FD. If OFLAG includes O_CREAT, a
+ third argument is the file protection. */
+int
+__openat (fd, file, oflag)
+ int fd;
+ const char *file;
+ int oflag;
+{
+ mode_t mode = 0;
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, int);
+ va_end (arg);
+ }
+
+ if (SINGLE_THREAD_P)
+ return __openat_nocancel (fd, file, oflag, mode);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int res = __openat_nocancel (fd, file, oflag, mode);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
+libc_hidden_def (__openat)
+weak_alias (__openat, openat)
+
+/* openat64 is just the same as openat for us. */
+strong_alias (__openat, __openat64)
+strong_alias (__openat_nocancel, __openat64_nocancel)
+libc_hidden_weak (__openat64)
+weak_alias (__openat64, openat64)
Added: trunk/glibc-2.3-head/sysdeps/kfreebsd/openat64.c
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/openat64.c 2006-06-26 13:27:03 UTC (rev 1614)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/openat64.c 2006-06-26 13:30:24 UTC (rev 1615)
@@ -0,0 +1,2 @@
+/* 'openat64' is the same as 'open', because __off64_t == __off_t and
+ O_LARGEFILE == 0. */
More information about the Glibc-bsd-commits
mailing list