Stubbing out unavailable syscalls?

Bernhard Fischer rep.dot.nop at gmail.com
Tue May 27 16:56:12 UTC 2008


On Tue, May 20, 2008 at 07:48:58PM +0200, Bernhard Fischer wrote:

>I'm attaching a proposal that allows for conveniently adding stubs by

Updated patch:
http://uclibc.org/~aldot/uClibc/uClibc-0.9.29.syscall-stubs.02p3.diff

- adds several config-options to allow for turning off certain features
  like
  o UCLIBC_HAS_GNU_ERROR
  o UCLIBC_HAS_PTY
  o UCLIBC_HAS_GETPT (1)
  o UCLIBC_SYSCALL_STUBS
  o UCLIBC_SYSCALL_STUB_WARNING
  o UCLIBC_LINUX_SPECIFIC (2)
  o UCLIBC_BSD_SPECIFIC (3)
  o UCLIBC_NTP_LEGACY (4)
  o UCLIBC_SV4_DEPRECATED (5)
  o UCLIBC_HAVE_REALTIME (6)
  o UCLIBC_HAVE_ADVANCED_REALTIME (7)
  o UCLIBC_HAVE_EPOLL (8)
  o UCLIBC_HAVE_XATTR (9)
  o UCLIBC_HAVE_PROFILING (10)

(1) and implement posix_openpt
(2) fstatfs(), inotify_*(), ioperm(), iopl(), madvise(), modify_ldt(),
    personality()
    ppoll(), setresuid()
(3) mincore(), getdomainname(), setdomainname()
(4) ntp_adjtime(), ntp_gettime() aliases
(5) ustat() [use statfs(2) in your code instead]
(6) All marked as "(REALTIME)" in SUSv3
(7) All marked as "(ADVANCED REALTIME)" in SUSv3
(8) epoll_create(), epoll_ctl(), epoll_wait()
(9) all Extended Attributes
(10) helpers for gcc's -finstrument-functions

- Fixes missing dep on the script that generates sysnum.h
- Fixes _dl_exit()
- Implements sleep(3) for !UCLIBC_HAVE_REALTIME
- Implements usleep(3) for !UCLIBC_HAVE_REALTIME

i386 is already converted, perhaps i'll do alpha next, but alpha doesn't
look like it's really complete yet anyway.

Statistics:

 extra/scripts/gen_bits_syscall_h.sh                  |    3 
 extra/Configs/Config.in                              |  200 +++++++++++++++++++
 include/sys/syscall.h                                |    3 
 Makerules                                            |    2 
 ldso/include/dl-syscall.h                            |    8 
 libutil/Makefile.in                                  |    4 
 libc/inet/resolv.c                                   |    6 
 libc/stdlib/Makefile.in                              |    7 
 libc/stdlib/getpt.c                                  |   40 ++-
 libc/stdlib/bsd_getpt.c                              |    2 
 libc/unistd/pathconf.c                               |    5 
 libc/unistd/sleep.c                                  |   55 +++++
 libc/unistd/fpathconf.c                              |    7 
 libc/unistd/usleep.c                                 |   14 +
 libc/sysdeps/linux/common/getgid.c                   |    1 
 libc/sysdeps/linux/common/mlock.c                    |    1 
 libc/sysdeps/linux/common/close.c                    |    1 
 libc/sysdeps/linux/common/poll.c                     |    3 
 libc/sysdeps/linux/common/setregid.c                 |    1 
 libc/sysdeps/linux/common/utimes.c                   |    1 
 libc/sysdeps/linux/common/munlock.c                  |    2 
 libc/sysdeps/linux/common/create_module.c            |   16 -
 libc/sysdeps/linux/common/read.c                     |    1 
 libc/sysdeps/linux/common/posix_fadvise64.c          |    7 
 libc/sysdeps/linux/common/getsid.c                   |    1 
 libc/sysdeps/linux/common/getpriority.c              |    1 
 libc/sysdeps/linux/common/getuid.c                   |    1 
 libc/sysdeps/linux/common/arch_prctl.c               |    6 
 libc/sysdeps/linux/common/setreuid.c                 |    1 
 libc/sysdeps/linux/common/wait4.c                    |    3 
 libc/sysdeps/linux/common/sched_get_priority_min.c   |    1 
 libc/sysdeps/linux/common/sysinfo.c                  |    5 
 libc/sysdeps/linux/common/ftruncate.c                |    1 
 libc/sysdeps/linux/common/alarm.c                    |    1 
 libc/sysdeps/linux/common/setpriority.c              |    1 
 libc/sysdeps/linux/common/readahead.c                |    1 
 libc/sysdeps/linux/common/time.c                     |    1 
 libc/sysdeps/linux/common/fchdir.c                   |    1 
 libc/sysdeps/linux/common/access.c                   |    6 
 libc/sysdeps/linux/common/xattr.c                    |  158 +++++----------
 libc/sysdeps/linux/common/iopl.c                     |    5 
 libc/sysdeps/linux/common/statfs.c                   |   17 +
 libc/sysdeps/linux/common/_exit.c                    |    1 
 libc/sysdeps/linux/common/vhangup.c                  |    1 
 libc/sysdeps/linux/common/clock_gettime.c            |    1 
 libc/sysdeps/linux/common/acct.c                     |    5 
 libc/sysdeps/linux/common/epoll.c                    |   37 +--
 libc/sysdeps/linux/common/bits/uClibc_syscall-stub.h |   96 +++++++++
 libc/sysdeps/linux/common/fstat.c                    |    1 
 libc/sysdeps/linux/common/sysctl.c                   |   19 +
 libc/sysdeps/linux/common/times.c                    |    1 
 libc/sysdeps/linux/common/sigsuspend.c               |    4 
 libc/sysdeps/linux/common/clock_settime.c            |    1 
 libc/sysdeps/linux/common/truncate.c                 |    1 
 libc/sysdeps/linux/common/getrusage.c                |    1 
 libc/sysdeps/linux/common/umount.c                   |    4 
 libc/sysdeps/linux/common/sendfile.c                 |    1 
 libc/sysdeps/linux/common/lchown.c                   |    1 
 libc/sysdeps/linux/common/write.c                    |    4 
 libc/sysdeps/linux/common/sched_setscheduler.c       |    1 
 libc/sysdeps/linux/common/sched_getparam.c           |    1 
 libc/sysdeps/linux/common/__syscall_fcntl64.c        |    1 
 libc/sysdeps/linux/common/sigaltstack.c              |    4 
 libc/sysdeps/linux/common/dup2.c                     |    1 
 libc/sysdeps/linux/common/stat.c                     |    1 
 libc/sysdeps/linux/common/getcwd.c                   |    1 
 libc/sysdeps/linux/common/chown.c                    |    1 
 libc/sysdeps/linux/common/llseek.c                   |    1 
 libc/sysdeps/linux/common/execve.c                   |    2 
 libc/sysdeps/linux/common/select.c                   |    4 
 libc/sysdeps/linux/common/inotify.c                  |   19 +
 libc/sysdeps/linux/common/fsync.c                    |    1 
 libc/sysdeps/linux/common/utime.c                    |    1 
 libc/sysdeps/linux/common/getdtablesize.c            |    3 
 libc/sysdeps/linux/common/bdflush.c                  |   13 -
 libc/sysdeps/linux/common/sethostname.c              |    1 
 libc/sysdeps/linux/common/fstat64.c                  |    1 
 libc/sysdeps/linux/common/settimeofday.c             |    1 
 libc/sysdeps/linux/common/klogctl.c                  |    1 
 libc/sysdeps/linux/common/truncate64.c               |    3 
 libc/sysdeps/linux/common/fchmod.c                   |    1 
 libc/sysdeps/linux/common/lstat64.c                  |    1 
 libc/sysdeps/linux/common/sbrk.c                     |    2 
 libc/sysdeps/linux/common/mount.c                    |    1 
 libc/sysdeps/linux/common/posix_fadvise.c            |    4 
 libc/sysdeps/linux/common/lseek.c                    |    1 
 libc/sysdeps/linux/common/sendfile64.c               |    1 
 libc/sysdeps/linux/common/mmap64.c                   |    1 
 libc/sysdeps/linux/common/swapoff.c                  |    7 
 libc/sysdeps/linux/common/query_module.c             |   14 -
 libc/sysdeps/linux/common/sync.c                     |    8 
 libc/sysdeps/linux/common/getdents.c                 |    2 
 libc/sysdeps/linux/common/vmsplice.c                 |   18 -
 libc/sysdeps/linux/common/sigprocmask.c              |    4 
 libc/sysdeps/linux/common/getpgid.c                  |    4 
 libc/sysdeps/linux/common/uselib.c                   |    4 
 libc/sysdeps/linux/common/ppoll.c                    |    3 
 libc/sysdeps/linux/common/dup.c                      |    1 
 libc/sysdeps/linux/common/chdir.c                    |    1 
 libc/sysdeps/linux/common/modify_ldt.c               |    3 
 libc/sysdeps/linux/common/ioperm.c                   |    6 
 libc/sysdeps/linux/common/mprotect.c                 |    3 
 libc/sysdeps/linux/common/__rt_sigtimedwait.c        |    2 
 libc/sysdeps/linux/common/mlockall.c                 |    1 
 libc/sysdeps/linux/common/setpgid.c                  |    4 
 libc/sysdeps/linux/common/ustat.c                    |    1 
 libc/sysdeps/linux/common/readv.c                    |    1 
 libc/sysdeps/linux/common/Makefile.in                |   48 ++++
 libc/sysdeps/linux/common/capget.c                   |   14 -
 libc/sysdeps/linux/common/adjtimex.c                 |    7 
 libc/sysdeps/linux/common/uname.c                    |    2 
 libc/sysdeps/linux/common/swapon.c                   |    7 
 libc/sysdeps/linux/common/getegid.c                  |    1 
 libc/sysdeps/linux/common/personality.c              |    6 
 libc/sysdeps/linux/common/ioctl.c                    |    2 
 libc/sysdeps/linux/common/fstatfs.c                  |   19 +
 libc/sysdeps/linux/common/getpid.c                   |    1 
 libc/sysdeps/linux/common/sched_yield.c              |    1 
 libc/sysdeps/linux/common/nice.c                     |    1 
 libc/sysdeps/linux/common/capset.c                   |   14 -
 libc/sysdeps/linux/common/setgid.c                   |    1 
 libc/sysdeps/linux/common/writev.c                   |    1 
 libc/sysdeps/linux/common/__socketcall.c             |    8 
 libc/sysdeps/linux/common/remap_file_pages.c         |    6 
 libc/sysdeps/linux/common/geteuid.c                  |    1 
 libc/sysdeps/linux/common/getdents64.c               |    1 
 libc/sysdeps/linux/common/sigpending.c               |    4 
 libc/sysdeps/linux/common/msync.c                    |    7 
 libc/sysdeps/linux/common/setsid.c                   |    1 
 libc/sysdeps/linux/common/sched_get_priority_max.c   |    1 
 libc/sysdeps/linux/common/quotactl.c                 |    7 
 libc/sysdeps/linux/common/munmap.c                   |    3 
 libc/sysdeps/linux/common/setuid.c                   |    1 
 libc/sysdeps/linux/common/munlockall.c               |    5 
 libc/sysdeps/linux/common/seteuid.c                  |    5 
 libc/sysdeps/linux/common/rename.c                   |    1 
 libc/sysdeps/linux/common/delete_module.c            |   14 -
 libc/sysdeps/linux/common/mknod.c                    |    1 
 libc/sysdeps/linux/common/getdomainname.c            |   12 -
 libc/sysdeps/linux/common/fdatasync.c                |    1 
 libc/sysdeps/linux/common/getresgid.c                |    1 
 libc/sysdeps/linux/common/tee.c                      |   18 -
 libc/sysdeps/linux/common/sched_getaffinity.c        |    5 
 libc/sysdeps/linux/common/umask.c                    |    1 
 libc/sysdeps/linux/common/mremap.c                   |    1 
 libc/sysdeps/linux/common/waitid.c                   |    8 
 libc/sysdeps/linux/common/prctl.c                    |    7 
 libc/sysdeps/linux/common/sched_getscheduler.c       |    1 
 libc/sysdeps/linux/common/setdomainname.c            |    1 
 libc/sysdeps/linux/common/lstat.c                    |    1 
 libc/sysdeps/linux/common/sigqueue.c                 |    3 
 libc/sysdeps/linux/common/madvise.c                  |    5 
 libc/sysdeps/linux/common/readlink.c                 |    1 
 libc/sysdeps/linux/common/setresgid.c                |    1 
 libc/sysdeps/linux/common/reboot.c                   |    5 
 libc/sysdeps/linux/common/chmod.c                    |    1 
 libc/sysdeps/linux/common/get_kernel_syms.c          |   12 -
 libc/sysdeps/linux/common/getresuid.c                |    1 
 libc/sysdeps/linux/common/sched_setaffinity.c        |    5 
 libc/sysdeps/linux/common/pipe.c                     |    1 
 libc/sysdeps/linux/common/flock.c                    |    1 
 libc/sysdeps/linux/common/getrlimit.c                |    3 
 libc/sysdeps/linux/common/unlink.c                   |    1 
 libc/sysdeps/linux/common/open.c                     |    1 
 libc/sysdeps/linux/common/fork.c                     |    1 
 libc/sysdeps/linux/common/ulimit.c                   |    1 
 libc/sysdeps/linux/common/pivot_root.c               |   13 -
 libc/sysdeps/linux/common/ftruncate64.c              |    1 
 libc/sysdeps/linux/common/setresuid.c                |    3 
 libc/sysdeps/linux/common/init_module.c              |   15 -
 libc/sysdeps/linux/common/__syscall_sigaction.c      |    1 
 libc/sysdeps/linux/common/setfsgid.c                 |    1 
 libc/sysdeps/linux/common/setrlimit.c                |    1 
 libc/sysdeps/linux/common/getgroups.c                |    1 
 libc/sysdeps/linux/common/splice.c                   |   17 -
 libc/sysdeps/linux/common/gettimeofday.c             |    1 
 libc/sysdeps/linux/common/stime.c                    |    2 
 libc/sysdeps/linux/common/sched_setparam.c           |    1 
 libc/sysdeps/linux/common/setfsuid.c                 |    1 
 libc/sysdeps/linux/common/wait3.c                    |    5 
 libc/sysdeps/linux/common/getitimer.c                |    1 
 libc/sysdeps/linux/common/kill.c                     |    1 
 libc/sysdeps/linux/common/setgroups.c                |    1 
 libc/sysdeps/linux/common/chroot.c                   |    5 
 libc/sysdeps/linux/common/__syscall_fcntl.c          |    1 
 libc/sysdeps/linux/common/clock_getres.c             |    1 
 libc/sysdeps/linux/common/pread_write.c              |    1 
 libc/sysdeps/linux/common/setitimer.c                |    1 
 libc/sysdeps/linux/common/mkdir.c                    |    1 
 libc/sysdeps/linux/common/sysfs.c                    |    9 
 libc/sysdeps/linux/common/getpgrp.c                  |    8 
 libc/sysdeps/linux/common/umount2.c                  |   15 -
 libc/sysdeps/linux/common/rmdir.c                    |    1 
 libc/sysdeps/linux/common/pause.c                    |    1 
 libc/sysdeps/linux/common/__syscall_rt_sigaction.c   |    9 
 libc/sysdeps/linux/common/ptrace.c                   |    3 
 libc/sysdeps/linux/common/nanosleep.c                |    4 
 libc/sysdeps/linux/common/fchown.c                   |    1 
 libc/sysdeps/linux/common/stat64.c                   |    1 
 libc/sysdeps/linux/common/symlink.c                  |    3 
 libc/sysdeps/linux/common/mmap.c                     |    1 
 libc/sysdeps/linux/common/mincore.c                  |    5 
 libc/sysdeps/linux/common/getppid.c                  |    1 
 libc/sysdeps/linux/common/sched_rr_get_interval.c    |    1 
 libc/sysdeps/linux/common/link.c                     |    1 
 libc/sysdeps/linux/i386/bits/syscalls.h              |   64 ------
 libc/misc/error/Makefile.in                          |    3 
 libc/misc/error/err.c                                |    3 
 libc/misc/sysvipc/__syscall_ipc.c                    |    1 
 libc/misc/sysvipc/sem.c                              |    6 
 libc/misc/statfs/fstatvfs.c                          |    5 
 libc/misc/statfs/statvfs.c                           |    5 
 libc/signal/sigwait.c                                |   62 +++++
 librt/mq_open.c                                      |    1 
 librt/timer_gettime.c                                |    1 
 librt/mq_close.c                                     |    1 
 librt/timer_delete.c                                 |    1 
 librt/timer_create.c                                 |    1 
 librt/mq_notify.c                                    |    1 
 librt/timer_settime.c                                |    1 
 librt/mq_receive.c                                   |    3 
 librt/mq_getsetattr.c                                |    1 
 librt/mq_send.c                                      |    2 
 librt/mq_unlink.c                                    |    1 
 librt/timer_getoverr.c                               |    1 
 225 files changed, 1119 insertions(+), 417 deletions(-)




More information about the uClibc mailing list