[RFC PATCH 00/38] Support for Linux asm-generic/unistd.h

Jonas Bonn jonas at southpole.se
Tue Sep 6 08:30:24 UTC 2011


The asm-generic/unistd.h header in Linux defines a reduced set of syscalls
where older and deprecated syscalls have been removed.  This patch set makes
some changes to the affected C functions so that they work with the generic
Linux header.

This patch set is, however, primarily an RFC because:

i)  The functions are generally made to prefer the "newer" syscall if they
exist... I'm not sure this is always valid.

ii)  I'm uncertain whether the changes to the fstat* functions and to fcntl
are correct.  I would, in particular, appreciate close review of these.

iii)  This has been tested for the OpenRISC architecture and compile tested
for x86.  Other architectures need to be checked.

I know that there have been other attempts to do these changes earlier.  The
patch sets for those, however, aren't easy to find.  So if I've reimplemented
something that somebody else already has or is working on, then please
point me their work so that I can collaborate with them to get this work done.

This work is currently of primary interest for the OpenRISC architecture
which was recently merged to the upstream Linux kernel with support for only
the asm-generic/unistd.y syscalls.  Four other architectures are expected to
be merged within the next 6-12 months that will all have the issue and will
benefit from these changes.

/Jonas

Jonas Bonn (38):
  chmod: prefer fchmodat syscall
  access: prefer faccessat syscall
  open: prefer openat syscall
  link: prefer linkat syscall
  unlink: prefer unlinkat syscall
  mknod: prefer mknodat syscall
  chown: prefer fchownat syscall
  mkdir: prefer mkdirat syscall
  rmdir: prefer unlinkat syscall
  lchown: prefer fchownat syscall
  rename: prefer renameat syscall
  readlink: prefer readlinkat syscall
  symlink: prefer symlinkat syscall
  utimes: prefer utimesat syscall
  pipe: prefer pipe2 syscall
  Add dup3 syscall
  dup2: prefer dup3 syscall
  epoll_create: prefer epoll_create1 syscall
  inotify_init: prefer inotify_init1 syscall
  vfork: prefer clone syscall
  utime: prefer utimensat syscall
  fork: prefer clone syscall
  ftruncate: prefer ftruncate64 syscall
  truncate: prefer truncate64 syscall
  sendfile: prefer sendfile64 syscall
  getdents: fall back to getdents64
  statfs: fall back to statfs64 syscall
  fstatat: use newfstatat for 64 bit only
  fstatat64: newfstatat is only for 64-bit systems
  fstat: prefer fstat64 syscall
  fstatfs: fall back to fstatfs64
  stat: prefer fstatat64 syscall
  stat64: prefer fstatat64
  lstat: prefer fstatat64 syscall
  lstat64: prefer fstatat64 syscall
  llseek: accept __NR_llseek
  fcntl: prefer fcntl64 syscall
  Fixup not_cancel versions of open

 include/unistd.h                                   |    4 ++
 libc/sysdeps/linux/common/__syscall_fcntl.c        |   49 +++++++++++++------
 libc/sysdeps/linux/common/__syscall_fcntl64.c      |    6 ++
 libc/sysdeps/linux/common/access.c                 |    9 ++++
 libc/sysdeps/linux/common/chmod.c                  |    9 ++++
 libc/sysdeps/linux/common/chown.c                  |   11 ++++-
 libc/sysdeps/linux/common/dup2.c                   |    6 ++
 libc/sysdeps/linux/common/dup3.c                   |   15 ++++++
 libc/sysdeps/linux/common/epoll.c                  |   17 ++++---
 libc/sysdeps/linux/common/fork.c                   |   19 +++++++-
 libc/sysdeps/linux/common/fstat.c                  |   23 +++++++++-
 libc/sysdeps/linux/common/fstatat.c                |    2 +-
 libc/sysdeps/linux/common/fstatat64.c              |    2 +-
 libc/sysdeps/linux/common/fstatfs.c                |    6 ++-
 libc/sysdeps/linux/common/ftruncate.c              |    9 ++++
 libc/sysdeps/linux/common/getdents.c               |    4 +-
 libc/sysdeps/linux/common/inotify.c                |   11 +++--
 libc/sysdeps/linux/common/lchown.c                 |   11 ++++
 libc/sysdeps/linux/common/link.c                   |   10 ++++
 libc/sysdeps/linux/common/llseek.c                 |    7 ++-
 libc/sysdeps/linux/common/lstat.c                  |   14 ++++++
 libc/sysdeps/linux/common/lstat64.c                |   19 ++++++--
 libc/sysdeps/linux/common/mkdir.c                  |    9 ++++
 libc/sysdeps/linux/common/mknod.c                  |   10 ++++
 libc/sysdeps/linux/common/not-cancel.h             |    6 ++
 libc/sysdeps/linux/common/open.c                   |    7 +++
 libc/sysdeps/linux/common/pipe.c                   |   10 ++++-
 libc/sysdeps/linux/common/readlink.c               |   10 ++++
 libc/sysdeps/linux/common/rename.c                 |   10 ++++
 libc/sysdeps/linux/common/rmdir.c                  |    8 +++
 libc/sysdeps/linux/common/sendfile.c               |   23 ++++++++-
 libc/sysdeps/linux/common/stat.c                   |   14 +++++-
 libc/sysdeps/linux/common/stat64.c                 |   16 ++++++-
 libc/sysdeps/linux/common/statfs.c                 |   36 ++++++++++++++
 libc/sysdeps/linux/common/symlink.c                |   14 +++++-
 libc/sysdeps/linux/common/truncate.c               |    9 ++++
 libc/sysdeps/linux/common/unlink.c                 |    9 ++++
 libc/sysdeps/linux/common/utime.c                  |   19 +++++++-
 libc/sysdeps/linux/common/utimes.c                 |   21 ++++++++-
 libc/sysdeps/linux/common/vfork.c                  |   20 ++++++++-
 .../linuxthreads.old/sysdeps/pthread/not-cancel.h  |    5 ++
 41 files changed, 468 insertions(+), 51 deletions(-)
 create mode 100644 libc/sysdeps/linux/common/dup3.c

-- 
1.7.5.4



More information about the uClibc mailing list