This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 0/10] Tilera (and Linux asm-generic) support for glibc
- From: Chris Metcalf <cmetcalf at tilera dot com>
- To: Roland McGrath <roland at hack dot frob dot com>, libc-alpha at sourceware dot org
- Date: Sat, 3 Dec 2011 19:48:44 -0500
- Subject: Re: [PATCH v2 0/10] Tilera (and Linux asm-generic) support for glibc
- References: <201111100054.pAA0sf6u025585@farm-0002.internal.tilera.com> <CAOPLpQeYkCxui8-tfzrwRzu1fTe8qbMQ7k4Ar5mM+Ja2VoUp8g@mail.gmail.com> <4EBD94B4.4050009@tilera.com> <4EBD9A81.7030601@tilera.com> <20111111221503.333BA2C102@topped-with-meat.com>
On 11/11/2011 5:15 PM, Roland McGrath wrote:
>> I think there are two choices. We can duplicate the dozen-odd files
>> that use not-cancel.h in that directory into sysdeps/unix/sys/linux/generic,
>> or we can apply just one #ifdef to handle the case where we need
>> to use __NR_openat instead of __NR_open. I suspect the patch to
>> not-cancel.h is small enough that it's worth not duplicating the
>> dozen-odd C files (about 2,700 lines total).
> IMHO that change is fine enough. But I'd like it better if it used
> #elif defined (__NR_openat)
> #else
> # error "neither __NR_open nor __NR_openat available"
>
> for robustness.
Here's the revised version. Thanks.
2011-12-03 Chris Metcalf <cmetcalf@tilera.com>
* sysdeps/unix/sysv/linux/not-cancel.h (open_not_cancel,
open_not_cancel2): Use__NR_openat if __NR_open is not present.
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 80d33be..631de1f 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -1,5 +1,5 @@
/* Uncancelable versions of cancelable interfaces. Linux version.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -20,12 +20,24 @@
#include <sys/types.h>
#include <sysdep.h>
+#ifndef __NR_open
+# include <fcntl.h>
+#endif
/* Uncancelable open. */
-#define open_not_cancel(name, flags, mode) \
- INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode))
-#define open_not_cancel_2(name, flags) \
- INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
+#if defined (__NR_open)
+# define open_not_cancel(name, flags, mode) \
+ INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode))
+# define open_not_cancel_2(name, flags) \
+ INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
+#elif defined (__NR_openat)
+# define open_not_cancel(name, flags, mode) \
+ INLINE_SYSCALL (openat, 4, AT_FDCWD, (const char *) (name), (flags), (mode))
+# define open_not_cancel_2(name, flags) \
+ INLINE_SYSCALL (openat, 3, AT_FDCWD, (const char *) (name), (flags))
+#else
+# error "Neither __NR_open nor __NR_openat available."
+#endif
/* Uncancelable openat. */
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com