[PATCH v2 0/10] Tilera (and Linux asm-generic) support for glibc

Chris Metcalf cmetcalf@tilera.com
Fri Nov 11 22:33:00 GMT 2011


On 11/11/2011 4:33 PM, Chris Metcalf wrote:
> On 11/11/2011 12:48 PM, Ulrich Drepper wrote:
>>  Nothing here belongs into the main version.  Stuff it in the ports
>>  tree.  I'm not modifying the existing files for this supposed
>>  "generic" architecture.
>
> The files in "PATCH v2 8/10" that I added #ifdefs to I've now moved
> into "ports" in my git tree, and we can just make sure they continue
> to track changes in the files they were derived from.
The not-cancel.h header in sysdeps/unix/sysv/linux does still remain
a problem, though, since many .c files in that directory do an
#include "not-cancel.h" and will pick up that version even if there is
one in ports that is nominally ahead of it on the search path.

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).

But, I'm certainly happy to follow the engineering instincts of
the maintainers.  The patch is basically this (modulo indentation):

  #include<sys/types.h>
  #include<sysdep.h>
+#ifndef __NR_open
+#include<fcntl.h>
+#endif

  /* Uncancelable open.  */
+#ifdef __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))
+#else
+#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))
+#endif

  /* Uncancelable openat.  */
  #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt


-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com



More information about the Libc-alpha mailing list