From: Markos Chandras <[email protected]> Hi,
New architectures in the Linux Kernel are required to use only the syscalls as defined in the asm-generic/unistd.h header. This means that old and deprecated syscalls are not defined for these architectures and they never will be. This patchset is based on the work that Jonas Bonn sent about a year ago[1] but never got merged in uClibc. However there are some differences compared to the patches Jonas sent back then. The following patches prefer the old system call if both syscalls are present. For example, if __NR_open and __NR_openat are defined, then open() will use the __NR_open syscall. If the __NR_open syscall is not defined, then open() will use __NR_openat internally. This way we "protect" existing architectures and preserve old behavior. The patch series is working for the Meta architecture that is currently being reviewed[2] for inclusion in the Linux kernel. I also compile tested this patch series on buildroot for x86 and ARM. [1] http://old.nabble.com/-RFC-PATCH-00-38--Support-for-Linux-asm-generic-unistd.h-td32406412.html [2] http://marc.info/?l=linux-arch&m=135170008522140&w=2 The patchset is also available on github: git://github.com/hwoarang/uClibc.git 0.9.33-syscalls-for-upstream https://github.com/hwoarang/uClibc.git The patches are based on the 0.9.33 uClibc branch Markos Chandras (46): chmod: Use fchmodat if arch does not have the chmod syscall access: Use faccessat if arch does not have the access syscall link: Use linkat if arch does not have the link syscall unlink: Use unlinkat if arch does not have the unlink syscall mknod: Use mknodat if arch does not have the mknod syscall chown: Use fchownat if arch does not have the chown syscall rmdir: Use unlinkat if arch does not have the rmdir syscall lchown: Use fchownat if arch does not have the lchown syscall mkdir: Use mkdirat if arch does not have the mkdir syscall rename: Use renameat if arch does not have the rename syscall readlink: Use readlinkat if arch does not have the readlink syscall symlink: Use symlinkat if arch does not have the symlink syscall utimes: Use utimesat if arch does not have the utimes syscall pipe: Use pipe2 if arch does not have the pipe syscall dup3: Add dup3 syscall dup2: Use dup3 if arch does not have the dup2 syscall epoll: Use epoll_create1 if arch does not have the epoll_create syscall epoll: Use epoll_pwait if arch does not have the epoll_wait syscall inotify_init: Use inotify_init1 if inotify_init syscall is not defined utime: Use utimensat if arch does not have the utime syscall vfork: Use clone if arch does not have the vfork syscall fork: Use clone if arch does not have the fork syscall ftruncate: Use ftruncate64 if arch does not have the ftruncate syscall truncate: Use truncate64 if arch does not have the truncate syscall sendfile: Use sendfile64 if arch does not have the sendfile syscall getdents: Use getdents64 if arch does not have the getdents syscall statfs: Use statfs64 if arch does not have the statfs syscall fstatat: Use newfstatat only for 64-bit operations fstatat64: Use newfstatat only for 64-bit operations stat64: Use fstatat64 if arch does not have the stat64 syscall lstat: Use fstatat64 if arch does not have the lstat syscall lstat64: Use fstatat64 if arch does not have the lstat64 syscall ustat: Return ENOSYS if ustat syscall is not defined stat: Use fstatat64 if arch does not have the stat syscall fstat: Use fstat64() if arch does not have the fstat syscall fstatfs: Add __libc_fstatfs wrapper fstatfs64: Prefer fstatfs64 system call instead of __libc_fstatfs llseek: Use the llseek system call if defined fcntl: Use fcntl64 is arch does not have the fcntl syscall openat: Add openat syscall for NPTL open64: Use openat if arch does not have the open syscall not-cancel.h: Use openat if arch does not have the open syscall open-wrapper: Use a wrapper for the open() symbol ldso: Use newer syscalls if arch does not have the deprecated syscalls libc/ipc: Don't pass IPC_64 to arches that don't need it Config.in: Introduce symbol for arches without deprecated syscalls extra/Configs/Config.in | 2 + extra/Configs/Config.in.arch | 18 ++++ include/unistd.h | 4 + ldso/include/dl-syscall.h | 88 ++++++++++++++++++++ ldso/include/ldso.h | 4 + libc/misc/statfs/fstatfs64.c | 14 +++ libc/misc/sysvipc/ipc.h | 8 ++ libc/misc/sysvipc/msgq.c | 3 +- libc/misc/sysvipc/sem.c | 4 +- libc/misc/sysvipc/shm.c | 4 +- libc/sysdeps/linux/common/Makefile.in | 2 +- libc/sysdeps/linux/common/__syscall_fcntl.c | 57 ++++++++++++- libc/sysdeps/linux/common/__syscall_fcntl64.c | 5 + libc/sysdeps/linux/common/access.c | 10 ++ libc/sysdeps/linux/common/chmod.c | 9 ++ libc/sysdeps/linux/common/chown.c | 9 ++ libc/sysdeps/linux/common/dup2.c | 8 ++- libc/sysdeps/linux/common/dup3.c | 17 ++++ libc/sysdeps/linux/common/epoll.c | 30 ++++++-- libc/sysdeps/linux/common/fork.c | 20 ++++- libc/sysdeps/linux/common/fstat.c | 20 ++++- libc/sysdeps/linux/common/fstatat.c | 2 +- libc/sysdeps/linux/common/fstatat64.c | 2 +- libc/sysdeps/linux/common/fstatfs.c | 43 +++++++++- libc/sysdeps/linux/common/ftruncate.c | 9 ++ libc/sysdeps/linux/common/getdents.c | 4 +- libc/sysdeps/linux/common/inotify.c | 14 ++- libc/sysdeps/linux/common/lchown.c | 11 +++ libc/sysdeps/linux/common/link.c | 9 ++ libc/sysdeps/linux/common/llseek.c | 7 ++- libc/sysdeps/linux/common/lstat.c | 17 ++++- libc/sysdeps/linux/common/lstat64.c | 14 +++- libc/sysdeps/linux/common/mkdir.c | 8 ++ libc/sysdeps/linux/common/mknod.c | 8 ++ libc/sysdeps/linux/common/not-cancel.h | 7 ++ libc/sysdeps/linux/common/open-wrapper.c | 77 +++++++++++++++++ libc/sysdeps/linux/common/open.c | 39 --------- libc/sysdeps/linux/common/open64.c | 9 ++- libc/sysdeps/linux/common/pipe.c | 8 ++ libc/sysdeps/linux/common/readlink.c | 8 ++ libc/sysdeps/linux/common/rename.c | 9 ++- libc/sysdeps/linux/common/rmdir.c | 8 ++ libc/sysdeps/linux/common/sendfile.c | 44 +++++++++- libc/sysdeps/linux/common/stat.c | 17 +++- libc/sysdeps/linux/common/stat64.c | 16 +++- libc/sysdeps/linux/common/statfs.c | 49 +++++++++++ libc/sysdeps/linux/common/symlink.c | 13 +++ libc/sysdeps/linux/common/truncate.c | 9 ++ libc/sysdeps/linux/common/unlink.c | 8 ++ libc/sysdeps/linux/common/ustat.c | 15 ++++ libc/sysdeps/linux/common/utime.c | 22 +++++- libc/sysdeps/linux/common/utimes.c | 23 +++++- libc/sysdeps/linux/common/vfork.c | 20 ++++- .../linuxthreads.old/sysdeps/pthread/not-cancel.h | 9 ++ libpthread/linuxthreads.old/wrapsyscall.c | 3 +- .../linuxthreads/sysdeps/pthread/not-cancel.h | 9 ++ .../sysdeps/unix/sysv/linux/Makefile.commonarch | 4 +- .../nptl/sysdeps/unix/sysv/linux/not-cancel.h | 9 ++ libpthread/nptl/sysdeps/unix/sysv/linux/open.S | 8 ++- libpthread/nptl/sysdeps/unix/sysv/linux/openat.S | 22 +++++ 60 files changed, 865 insertions(+), 84 deletions(-) create mode 100644 libc/sysdeps/linux/common/dup3.c create mode 100644 libc/sysdeps/linux/common/open-wrapper.c delete mode 100644 libc/sysdeps/linux/common/open.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/openat.S _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
