summaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /sysdeps/generic
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/Dist26
-rw-r--r--sysdeps/generic/Makefile18
-rw-r--r--sysdeps/generic/__longjmp.c36
-rw-r--r--sysdeps/generic/_exit.c36
-rw-r--r--sysdeps/generic/_strerror.c67
-rw-r--r--sysdeps/generic/abort.c140
-rw-r--r--sysdeps/generic/accept.c40
-rw-r--r--sysdeps/generic/access.c41
-rw-r--r--sysdeps/generic/acct.c34
-rw-r--r--sysdeps/generic/add_n.c62
-rw-r--r--sysdeps/generic/addmul_1.c65
-rw-r--r--sysdeps/generic/adjtime.c37
-rw-r--r--sysdeps/generic/aio_cancel.c44
-rw-r--r--sysdeps/generic/aio_fsync.c51
-rw-r--r--sysdeps/generic/aio_misc.c29
-rw-r--r--sysdeps/generic/aio_notify.c24
-rw-r--r--sysdeps/generic/aio_read.c36
-rw-r--r--sysdeps/generic/aio_read64.c2
-rw-r--r--sysdeps/generic/aio_sigqueue.c36
-rw-r--r--sysdeps/generic/aio_suspend.c46
-rw-r--r--sysdeps/generic/aio_write.c36
-rw-r--r--sysdeps/generic/aio_write64.c2
-rw-r--r--sysdeps/generic/alarm.c39
-rw-r--r--sysdeps/generic/allocrtsig.c96
-rw-r--r--sysdeps/generic/alphasort64.c27
-rw-r--r--sysdeps/generic/backtrace.c93
-rw-r--r--sysdeps/generic/backtracesyms.c58
-rw-r--r--sysdeps/generic/backtracesymsfd.c63
-rw-r--r--sysdeps/generic/bb_init_func.c54
-rw-r--r--sysdeps/generic/bcopy.c29
-rw-r--r--sysdeps/generic/bind.c36
-rw-r--r--sysdeps/generic/bits/atomic.h43
-rw-r--r--sysdeps/generic/bits/byteswap.h84
-rw-r--r--sysdeps/generic/bits/confname.h601
-rw-r--r--sysdeps/generic/bits/dirent.h37
-rw-r--r--sysdeps/generic/bits/dlfcn.h65
-rw-r--r--sysdeps/generic/bits/elfclass.h14
-rw-r--r--sysdeps/generic/bits/endian.h13
-rw-r--r--sysdeps/generic/bits/environments.h78
-rw-r--r--sysdeps/generic/bits/errno.h35
-rw-r--r--sysdeps/generic/bits/fcntl.h95
-rw-r--r--sysdeps/generic/bits/fenv.h56
-rw-r--r--sysdeps/generic/bits/fenvinline.h8
-rw-r--r--sysdeps/generic/bits/huge_val.h29
-rw-r--r--sysdeps/generic/bits/huge_valf.h29
-rw-r--r--sysdeps/generic/bits/huge_vall.h29
-rw-r--r--sysdeps/generic/bits/in.h82
-rw-r--r--sysdeps/generic/bits/inf.h33
-rw-r--r--sysdeps/generic/bits/ioctl-types.h114
-rw-r--r--sysdeps/generic/bits/ioctls.h5
-rw-r--r--sysdeps/generic/bits/ipc.h47
-rw-r--r--sysdeps/generic/bits/ipctypes.h37
-rw-r--r--sysdeps/generic/bits/libc-lock.h138
-rw-r--r--sysdeps/generic/bits/libc-tsd.h69
-rw-r--r--sysdeps/generic/bits/link.h4
-rw-r--r--sysdeps/generic/bits/local_lim.h3
-rw-r--r--sysdeps/generic/bits/mathdef.h43
-rw-r--r--sysdeps/generic/bits/mathinline.h12
-rw-r--r--sysdeps/generic/bits/mman.h91
-rw-r--r--sysdeps/generic/bits/mqueue.h31
-rw-r--r--sysdeps/generic/bits/msq.h45
-rw-r--r--sysdeps/generic/bits/nan.h5
-rw-r--r--sysdeps/generic/bits/netdb.h33
-rw-r--r--sysdeps/generic/bits/poll.h43
-rw-r--r--sysdeps/generic/bits/posix_opt.h2
-rw-r--r--sysdeps/generic/bits/pthreadtypes.h1
-rw-r--r--sysdeps/generic/bits/resource.h182
-rw-r--r--sysdeps/generic/bits/sched.h71
-rw-r--r--sysdeps/generic/bits/select.h35
-rw-r--r--sysdeps/generic/bits/sem.h62
-rw-r--r--sysdeps/generic/bits/setjmp.h7
-rw-r--r--sysdeps/generic/bits/shm.h58
-rw-r--r--sysdeps/generic/bits/sigaction.h78
-rw-r--r--sysdeps/generic/bits/sigcontext.h33
-rw-r--r--sysdeps/generic/bits/siginfo.h211
-rw-r--r--sysdeps/generic/bits/signum.h64
-rw-r--r--sysdeps/generic/bits/sigset.h83
-rw-r--r--sysdeps/generic/bits/sigstack.h55
-rw-r--r--sysdeps/generic/bits/sigthread.h35
-rw-r--r--sysdeps/generic/bits/sockaddr.h40
-rw-r--r--sysdeps/generic/bits/socket.h251
-rw-r--r--sysdeps/generic/bits/stat.h99
-rw-r--r--sysdeps/generic/bits/statfs.h70
-rw-r--r--sysdeps/generic/bits/statvfs.h84
-rw-r--r--sysdeps/generic/bits/stdio-lock.h58
-rw-r--r--sysdeps/generic/bits/string.h12
-rw-r--r--sysdeps/generic/bits/stropts.h231
-rw-r--r--sysdeps/generic/bits/sys_errlist.h24
-rw-r--r--sysdeps/generic/bits/termios.h256
-rw-r--r--sysdeps/generic/bits/time.h75
-rw-r--r--sysdeps/generic/bits/types.h199
-rw-r--r--sysdeps/generic/bits/typesizes.h66
-rw-r--r--sysdeps/generic/bits/uio.h32
-rw-r--r--sysdeps/generic/bits/ustat.h31
-rw-r--r--sysdeps/generic/bits/utmp.h50
-rw-r--r--sysdeps/generic/bits/utsname.h25
-rw-r--r--sysdeps/generic/bits/waitflags.h27
-rw-r--r--sysdeps/generic/bits/waitstatus.h106
-rw-r--r--sysdeps/generic/bits/wchar.h26
-rw-r--r--sysdeps/generic/bits/wordsize.h1
-rw-r--r--sysdeps/generic/bits/xtitypes.h34
-rw-r--r--sysdeps/generic/brdinit.c32
-rw-r--r--sysdeps/generic/brk.c37
-rw-r--r--sysdeps/generic/bsd-_setjmp.c35
-rw-r--r--sysdeps/generic/bsd-setjmp.c34
-rw-r--r--sysdeps/generic/bzero.c83
-rw-r--r--sysdeps/generic/cabsf.c29
-rw-r--r--sysdeps/generic/cargf.c29
-rw-r--r--sysdeps/generic/chdir.c40
-rw-r--r--sysdeps/generic/check_fds.c90
-rw-r--r--sysdeps/generic/check_pf.c50
-rw-r--r--sysdeps/generic/chflags.c43
-rw-r--r--sysdeps/generic/chmod.c42
-rw-r--r--sysdeps/generic/chown.c45
-rw-r--r--sysdeps/generic/chroot.c34
-rw-r--r--sysdeps/generic/cimagf.c28
-rw-r--r--sysdeps/generic/clock.c32
-rw-r--r--sysdeps/generic/clock_getcpuclockid.c39
-rw-r--r--sysdeps/generic/clock_getres.c30
-rw-r--r--sysdeps/generic/clock_gettime.c30
-rw-r--r--sysdeps/generic/clock_nanosleep.c39
-rw-r--r--sysdeps/generic/clock_settime.c30
-rw-r--r--sysdeps/generic/close.c40
-rw-r--r--sysdeps/generic/closedir.c35
-rw-r--r--sysdeps/generic/cmp.c56
-rwxr-xr-xsysdeps/generic/configure108
-rw-r--r--sysdeps/generic/configure.in6
-rw-r--r--sysdeps/generic/conjf.c28
-rw-r--r--sysdeps/generic/connect.c38
-rw-r--r--sysdeps/generic/console.c42
-rw-r--r--sysdeps/generic/crealf.c28
-rw-r--r--sysdeps/generic/creat.c36
-rw-r--r--sysdeps/generic/creat64.c31
-rw-r--r--sysdeps/generic/ctermid.c36
-rw-r--r--sysdeps/generic/cuserid.c35
-rw-r--r--sysdeps/generic/dbl2mpn.c32
-rw-r--r--sysdeps/generic/det_endian.c35
-rw-r--r--sysdeps/generic/dirfd.c33
-rw-r--r--sysdeps/generic/div.c86
-rw-r--r--sysdeps/generic/divmod_1.c208
-rw-r--r--sysdeps/generic/divrem.c245
-rw-r--r--sysdeps/generic/dl-brk.c5
-rw-r--r--sysdeps/generic/dl-cache.c311
-rw-r--r--sysdeps/generic/dl-cache.h8
-rw-r--r--sysdeps/generic/dl-environ.c86
-rw-r--r--sysdeps/generic/dl-execstack.c32
-rw-r--r--sysdeps/generic/dl-fptr.c323
-rw-r--r--sysdeps/generic/dl-fptr.h2
-rw-r--r--sysdeps/generic/dl-hash.h5
-rw-r--r--sysdeps/generic/dl-lookupcfg.h25
-rw-r--r--sysdeps/generic/dl-machine.h9
-rw-r--r--sysdeps/generic/dl-origin.c51
-rw-r--r--sysdeps/generic/dl-osinfo.h13
-rw-r--r--sysdeps/generic/dl-sbrk.c5
-rw-r--r--sysdeps/generic/dl-symaddr.c33
-rw-r--r--sysdeps/generic/dl-sysdep.c519
-rw-r--r--sysdeps/generic/dl-sysdep.h8
-rw-r--r--sysdeps/generic/dl-tls.c713
-rw-r--r--sysdeps/generic/dup.c34
-rw-r--r--sysdeps/generic/dup2.c48
-rw-r--r--sysdeps/generic/dwarf2.h32
-rw-r--r--sysdeps/generic/e_acoshl.c14
-rw-r--r--sysdeps/generic/e_acosl.c14
-rw-r--r--sysdeps/generic/e_asinl.c14
-rw-r--r--sysdeps/generic/e_atan2l.c14
-rw-r--r--sysdeps/generic/e_atanhl.c14
-rw-r--r--sysdeps/generic/e_coshl.c14
-rw-r--r--sysdeps/generic/e_exp10.c30
-rw-r--r--sysdeps/generic/e_exp10f.c30
-rw-r--r--sysdeps/generic/e_exp10l.c30
-rw-r--r--sysdeps/generic/e_exp2l.c14
-rw-r--r--sysdeps/generic/e_expl.c14
-rw-r--r--sysdeps/generic/e_fmodl.c14
-rw-r--r--sysdeps/generic/e_gammal_r.c15
-rw-r--r--sysdeps/generic/e_hypotl.c14
-rw-r--r--sysdeps/generic/e_j0l.c25
-rw-r--r--sysdeps/generic/e_j1l.c25
-rw-r--r--sysdeps/generic/e_jnl.c25
-rw-r--r--sysdeps/generic/e_lgammal_r.c17
-rw-r--r--sysdeps/generic/e_log10l.c14
-rw-r--r--sysdeps/generic/e_log2l.c14
-rw-r--r--sysdeps/generic/e_logl.c14
-rw-r--r--sysdeps/generic/e_powl.c14
-rw-r--r--sysdeps/generic/e_rem_pio2l.c15
-rw-r--r--sysdeps/generic/e_scalb.c71
-rw-r--r--sysdeps/generic/e_scalbf.c68
-rw-r--r--sysdeps/generic/e_scalbl.c75
-rw-r--r--sysdeps/generic/e_sinhl.c14
-rw-r--r--sysdeps/generic/e_sqrtl.c14
-rw-r--r--sysdeps/generic/elf/backtracesymsfd.c3
-rw-r--r--sysdeps/generic/enbl-secure.c37
-rw-r--r--sysdeps/generic/endutxent.c27
-rw-r--r--sysdeps/generic/environ.c12
-rw-r--r--sysdeps/generic/errlist.c41
-rw-r--r--sysdeps/generic/errno-loc.c37
-rw-r--r--sysdeps/generic/errno.c53
-rw-r--r--sysdeps/generic/euidaccess.c40
-rw-r--r--sysdeps/generic/exc2signal.c71
-rw-r--r--sysdeps/generic/execve.c44
-rw-r--r--sysdeps/generic/fattach.c33
-rw-r--r--sysdeps/generic/fchdir.c33
-rw-r--r--sysdeps/generic/fchflags.c43
-rw-r--r--sysdeps/generic/fchmod.c42
-rw-r--r--sysdeps/generic/fchown.c43
-rw-r--r--sysdeps/generic/fclrexcpt.c37
-rw-r--r--sysdeps/generic/fcntl.c41
-rw-r--r--sysdeps/generic/fdatasync.c28
-rw-r--r--sysdeps/generic/fdetach.c32
-rw-r--r--sysdeps/generic/fedisblxcpt.c30
-rw-r--r--sysdeps/generic/feenablxcpt.c30
-rw-r--r--sysdeps/generic/fegetenv.c38
-rw-r--r--sysdeps/generic/fegetexcept.c30
-rw-r--r--sysdeps/generic/fegetround.c29
-rw-r--r--sysdeps/generic/feholdexcpt.c29
-rw-r--r--sysdeps/generic/fesetenv.c38
-rw-r--r--sysdeps/generic/fesetround.c29
-rw-r--r--sysdeps/generic/feupdateenv.c37
-rw-r--r--sysdeps/generic/fexecve.c43
-rw-r--r--sysdeps/generic/ffs.c55
-rw-r--r--sysdeps/generic/ffsll.c42
-rw-r--r--sysdeps/generic/fgetexcptflg.c37
-rw-r--r--sysdeps/generic/fgetxattr.c31
-rw-r--r--sysdeps/generic/flistxattr.c30
-rw-r--r--sysdeps/generic/flock.c36
-rw-r--r--sysdeps/generic/flockfile.c30
-rw-r--r--sysdeps/generic/fork.c36
-rw-r--r--sysdeps/generic/fpathconf.c62
-rw-r--r--sysdeps/generic/fpu_control.c25
-rw-r--r--sysdeps/generic/fraiseexcpt.c38
-rw-r--r--sysdeps/generic/fremovexattr.c30
-rw-r--r--sysdeps/generic/fsetexcptflg.c37
-rw-r--r--sysdeps/generic/fsetxattr.c31
-rw-r--r--sysdeps/generic/fstatfs.c34
-rw-r--r--sysdeps/generic/fstatfs64.c32
-rw-r--r--sysdeps/generic/fstatvfs.c33
-rw-r--r--sysdeps/generic/fstatvfs64.c32
-rw-r--r--sysdeps/generic/fsync.c33
-rw-r--r--sysdeps/generic/ftestexcept.c29
-rw-r--r--sysdeps/generic/ftime.c43
-rw-r--r--sysdeps/generic/ftruncate.c36
-rw-r--r--sysdeps/generic/ftruncate64.c36
-rw-r--r--sysdeps/generic/ftrylockfile.c31
-rw-r--r--sysdeps/generic/funlockfile.c30
-rw-r--r--sysdeps/generic/futimes.c34
-rw-r--r--sysdeps/generic/fxstat.c50
-rw-r--r--sysdeps/generic/fxstat64.c49
-rw-r--r--sysdeps/generic/gai_sigqueue.c36
-rw-r--r--sysdeps/generic/gai_strerror.c29
-rw-r--r--sysdeps/generic/get_clockfreq.c28
-rw-r--r--sysdeps/generic/getaddrinfo.c41
-rw-r--r--sysdeps/generic/getclktck.c30
-rw-r--r--sysdeps/generic/getcontext.c32
-rw-r--r--sysdeps/generic/getcwd.c40
-rw-r--r--sysdeps/generic/getdents.c37
-rw-r--r--sysdeps/generic/getdents64.c36
-rw-r--r--sysdeps/generic/getdomain.c64
-rw-r--r--sysdeps/generic/getdtsz.c33
-rw-r--r--sysdeps/generic/getegid.c32
-rw-r--r--sysdeps/generic/getenv.c101
-rw-r--r--sysdeps/generic/geteuid.c33
-rw-r--r--sysdeps/generic/getgid.c33
-rw-r--r--sysdeps/generic/getgroups.c48
-rw-r--r--sysdeps/generic/gethostid.c32
-rw-r--r--sysdeps/generic/gethostname.c36
-rw-r--r--sysdeps/generic/getipv4sourcefilter.c32
-rw-r--r--sysdeps/generic/getitimer.c42
-rw-r--r--sysdeps/generic/getloadavg.c (renamed from sysdeps/generic/nfs/nfs.h)27
-rw-r--r--sysdeps/generic/getlogin.c33
-rw-r--r--sysdeps/generic/getlogin_r.c37
-rw-r--r--sysdeps/generic/getmsg.c35
-rw-r--r--sysdeps/generic/getpagesize.c33
-rw-r--r--sysdeps/generic/getpeername.c36
-rw-r--r--sysdeps/generic/getpgid.c33
-rw-r--r--sysdeps/generic/getpgrp.c27
-rw-r--r--sysdeps/generic/getpid.c34
-rw-r--r--sysdeps/generic/getpmsg.c36
-rw-r--r--sysdeps/generic/getppid.c33
-rw-r--r--sysdeps/generic/getpriority.c37
-rw-r--r--sysdeps/generic/getpt.c45
-rw-r--r--sysdeps/generic/getresgid.c34
-rw-r--r--sysdeps/generic/getresuid.c34
-rw-r--r--sysdeps/generic/getrlimit.c34
-rw-r--r--sysdeps/generic/getrlimit64.c43
-rw-r--r--sysdeps/generic/getrusage.c35
-rw-r--r--sysdeps/generic/getsid.c32
-rw-r--r--sysdeps/generic/getsockname.c36
-rw-r--r--sysdeps/generic/getsockopt.c38
-rw-r--r--sysdeps/generic/getsourcefilter.c33
-rw-r--r--sysdeps/generic/getsysstats.c69
-rw-r--r--sysdeps/generic/gettimeofday.c39
-rw-r--r--sysdeps/generic/getuid.c33
-rw-r--r--sysdeps/generic/getutmp.c46
-rw-r--r--sysdeps/generic/getutmpx.c48
-rw-r--r--sysdeps/generic/getutxent.c27
-rw-r--r--sysdeps/generic/getutxid.c27
-rw-r--r--sysdeps/generic/getutxline.c27
-rw-r--r--sysdeps/generic/getxattr.c31
-rw-r--r--sysdeps/generic/glob.c1558
-rw-r--r--sysdeps/generic/glob64.c54
-rw-r--r--sysdeps/generic/grantpt.c35
-rw-r--r--sysdeps/generic/group_member.c50
-rw-r--r--sysdeps/generic/gtty.c40
-rw-r--r--sysdeps/generic/herrno-loc.c34
-rw-r--r--sysdeps/generic/htonl.c36
-rw-r--r--sysdeps/generic/htons.c36
-rw-r--r--sysdeps/generic/if_index.c65
-rw-r--r--sysdeps/generic/ifaddrs.c46
-rw-r--r--sysdeps/generic/ifreq.c80
-rw-r--r--sysdeps/generic/init-first.c59
-rw-r--r--sysdeps/generic/init-posix.c27
-rw-r--r--sysdeps/generic/inlines.c3
-rw-r--r--sysdeps/generic/ioctl.c35
-rw-r--r--sysdeps/generic/isastream.c35
-rw-r--r--sysdeps/generic/isatty.c34
-rw-r--r--sysdeps/generic/isfdtype.c31
-rw-r--r--sysdeps/generic/jmp-unwind.c29
-rw-r--r--sysdeps/generic/k_cosl.c15
-rw-r--r--sysdeps/generic/k_rem_pio2l.c16
-rw-r--r--sysdeps/generic/k_sincosl.c1
-rw-r--r--sysdeps/generic/k_sinl.c15
-rw-r--r--sysdeps/generic/k_tanl.c15
-rw-r--r--sysdeps/generic/kill.c37
-rw-r--r--sysdeps/generic/killpg.c36
-rw-r--r--sysdeps/generic/labs.c29
-rw-r--r--sysdeps/generic/lchmod.c33
-rw-r--r--sysdeps/generic/lchown.c43
-rw-r--r--sysdeps/generic/ldbl2mpn.c1
-rw-r--r--sysdeps/generic/ldiv.c54
-rw-r--r--sysdeps/generic/ldsodefs.h295
-rw-r--r--sysdeps/generic/lgetxattr.c31
-rw-r--r--sysdeps/generic/libc-start.c241
-rw-r--r--sysdeps/generic/libc-tls.c273
-rw-r--r--sysdeps/generic/libc_fatal.c31
-rw-r--r--sysdeps/generic/link.c42
-rw-r--r--sysdeps/generic/lio_listio.c42
-rw-r--r--sysdeps/generic/lio_listio64.c2
-rw-r--r--sysdeps/generic/listen.c37
-rw-r--r--sysdeps/generic/listxattr.c30
-rw-r--r--sysdeps/generic/llabs.c31
-rw-r--r--sysdeps/generic/lldiv.c57
-rw-r--r--sysdeps/generic/llistxattr.c30
-rw-r--r--sysdeps/generic/local-setxid.h4
-rw-r--r--sysdeps/generic/lockf.c74
-rw-r--r--sysdeps/generic/lockf64.c79
-rw-r--r--sysdeps/generic/longjmp-ts.c32
-rw-r--r--sysdeps/generic/longjmp.c46
-rw-r--r--sysdeps/generic/lremovexattr.c30
-rw-r--r--sysdeps/generic/lseek.c53
-rw-r--r--sysdeps/generic/lseek64.c49
-rw-r--r--sysdeps/generic/lsetxattr.c31
-rw-r--r--sysdeps/generic/lshift.c87
-rw-r--r--sysdeps/generic/lutimes.c35
-rw-r--r--sysdeps/generic/lxstat.c27
-rw-r--r--sysdeps/generic/lxstat64.c39
-rw-r--r--sysdeps/generic/madvise.c33
-rw-r--r--sysdeps/generic/makecontext.c30
-rw-r--r--sysdeps/generic/math_ldbl_opt.h14
-rw-r--r--sysdeps/generic/memccpy.c46
-rw-r--r--sysdeps/generic/memchr.c215
-rw-r--r--sysdeps/generic/memcmp.c381
-rw-r--r--sysdeps/generic/memcpy.c65
-rw-r--r--sysdeps/generic/memcpy_chk.c66
-rw-r--r--sysdeps/generic/memmem.c58
-rw-r--r--sysdeps/generic/memmove.c112
-rw-r--r--sysdeps/generic/memmove_chk.c98
-rw-r--r--sysdeps/generic/mempcpy.c69
-rw-r--r--sysdeps/generic/mempcpy_chk.c67
-rw-r--r--sysdeps/generic/memrchr.c210
-rw-r--r--sysdeps/generic/memset.c91
-rw-r--r--sysdeps/generic/memset_chk.c92
-rw-r--r--sysdeps/generic/memusage.h18
-rw-r--r--sysdeps/generic/mig-reply.c53
-rw-r--r--sysdeps/generic/mincore.c30
-rw-r--r--sysdeps/generic/mkdir.c43
-rw-r--r--sysdeps/generic/mkfifo.c43
-rw-r--r--sysdeps/generic/mknod.c62
-rw-r--r--sysdeps/generic/mlock.c35
-rw-r--r--sysdeps/generic/mlockall.c36
-rw-r--r--sysdeps/generic/mmap.c41
-rw-r--r--sysdeps/generic/mmap64.c48
-rw-r--r--sysdeps/generic/mod_1.c197
-rw-r--r--sysdeps/generic/morecore.c54
-rw-r--r--sysdeps/generic/mp_clz_tab.c37
-rw-r--r--sysdeps/generic/mpn2dbl.c30
-rw-r--r--sysdeps/generic/mpn2flt.c30
-rw-r--r--sysdeps/generic/mpn2ldbl.c1
-rw-r--r--sysdeps/generic/mprotect.c36
-rw-r--r--sysdeps/generic/mq_close.c31
-rw-r--r--sysdeps/generic/mq_getattr.c30
-rw-r--r--sysdeps/generic/mq_notify.c31
-rw-r--r--sysdeps/generic/mq_open.c36
-rw-r--r--sysdeps/generic/mq_receive.c32
-rw-r--r--sysdeps/generic/mq_send.c31
-rw-r--r--sysdeps/generic/mq_setattr.c33
-rw-r--r--sysdeps/generic/mq_timedreceive.c34
-rw-r--r--sysdeps/generic/mq_timedsend.c33
-rw-r--r--sysdeps/generic/mq_unlink.c30
-rw-r--r--sysdeps/generic/msgctl.c37
-rw-r--r--sysdeps/generic/msgget.c36
-rw-r--r--sysdeps/generic/msgrcv.c42
-rw-r--r--sysdeps/generic/msgsnd.c41
-rw-r--r--sysdeps/generic/msync.c35
-rw-r--r--sysdeps/generic/mul.c152
-rw-r--r--sysdeps/generic/mul_1.c59
-rw-r--r--sysdeps/generic/mul_n.c401
-rw-r--r--sysdeps/generic/munlock.c34
-rw-r--r--sysdeps/generic/munlockall.c34
-rw-r--r--sysdeps/generic/munmap.c35
-rw-r--r--sysdeps/generic/nanosleep.c36
-rw-r--r--sysdeps/generic/nice.c33
-rw-r--r--sysdeps/generic/not-cancel.h10
-rw-r--r--sysdeps/generic/nscd_setup_thread.c28
-rw-r--r--sysdeps/generic/open.c54
-rw-r--r--sysdeps/generic/open64.c57
-rw-r--r--sysdeps/generic/opendir.c34
-rw-r--r--sysdeps/generic/opensock.c71
-rw-r--r--sysdeps/generic/pathconf.c41
-rw-r--r--sysdeps/generic/pause.c34
-rw-r--r--sysdeps/generic/pipe.c44
-rw-r--r--sysdeps/generic/poll.c39
-rw-r--r--sysdeps/generic/posix_fadvise.c31
-rw-r--r--sysdeps/generic/posix_fadvise64.c31
-rw-r--r--sysdeps/generic/posix_fallocate.c31
-rw-r--r--sysdeps/generic/posix_fallocate64.c31
-rw-r--r--sysdeps/generic/posix_madvise.c32
-rw-r--r--sysdeps/generic/pread.c46
-rw-r--r--sysdeps/generic/pread64.c46
-rw-r--r--sysdeps/generic/printf_fphex.c490
-rw-r--r--sysdeps/generic/prof-freq.c55
-rw-r--r--sysdeps/generic/profil.c42
-rw-r--r--sysdeps/generic/pselect.c88
-rw-r--r--sysdeps/generic/ptrace.c103
-rw-r--r--sysdeps/generic/ptsname.c47
-rw-r--r--sysdeps/generic/putenv.c72
-rw-r--r--sysdeps/generic/putmsg.c35
-rw-r--r--sysdeps/generic/putpmsg.c36
-rw-r--r--sysdeps/generic/pututxline.c27
-rw-r--r--sysdeps/generic/pwrite.c46
-rw-r--r--sysdeps/generic/pwrite64.c47
-rw-r--r--sysdeps/generic/raise.c34
-rw-r--r--sysdeps/generic/rawmemchr.c189
-rw-r--r--sysdeps/generic/read.c49
-rw-r--r--sysdeps/generic/readdir.c33
-rw-r--r--sysdeps/generic/readdir64.c32
-rw-r--r--sysdeps/generic/readdir64_r.c33
-rw-r--r--sysdeps/generic/readdir_r.c35
-rw-r--r--sysdeps/generic/readelflib.c220
-rw-r--r--sysdeps/generic/readlink.c37
-rw-r--r--sysdeps/generic/readonly-area.c34
-rw-r--r--sysdeps/generic/readv.c41
-rw-r--r--sysdeps/generic/reboot.c34
-rw-r--r--sysdeps/generic/recv.c37
-rw-r--r--sysdeps/generic/recvfrom.c41
-rw-r--r--sysdeps/generic/recvmsg.c37
-rw-r--r--sysdeps/generic/remap_file_pages.c35
-rw-r--r--sysdeps/generic/remove.c33
-rw-r--r--sysdeps/generic/removexattr.c30
-rw-r--r--sysdeps/generic/rename.c41
-rw-r--r--sysdeps/generic/res-state.c45
-rw-r--r--sysdeps/generic/revoke.c31
-rw-r--r--sysdeps/generic/rewinddir.c35
-rw-r--r--sysdeps/generic/rmdir.c41
-rw-r--r--sysdeps/generic/rshift.c88
-rw-r--r--sysdeps/generic/rtld-lowlevel.h1
-rw-r--r--sysdeps/generic/s_asinhl.c15
-rw-r--r--sysdeps/generic/s_atanl.c15
-rw-r--r--sysdeps/generic/s_cacos.c41
-rw-r--r--sysdeps/generic/s_cacosf.c39
-rw-r--r--sysdeps/generic/s_cacosh.c88
-rw-r--r--sysdeps/generic/s_cacoshf.c101
-rw-r--r--sysdeps/generic/s_cacoshl.c84
-rw-r--r--sysdeps/generic/s_cacosl.c37
-rw-r--r--sysdeps/generic/s_casin.c66
-rw-r--r--sysdeps/generic/s_casinf.c64
-rw-r--r--sysdeps/generic/s_casinh.c84
-rw-r--r--sysdeps/generic/s_casinhf.c82
-rw-r--r--sysdeps/generic/s_casinhl.c80
-rw-r--r--sysdeps/generic/s_casinl.c62
-rw-r--r--sysdeps/generic/s_catan.c89
-rw-r--r--sysdeps/generic/s_catanf.c87
-rw-r--r--sysdeps/generic/s_catanh.c84
-rw-r--r--sysdeps/generic/s_catanhf.c82
-rw-r--r--sysdeps/generic/s_catanhl.c80
-rw-r--r--sysdeps/generic/s_catanl.c85
-rw-r--r--sysdeps/generic/s_cbrtl.c15
-rw-r--r--sysdeps/generic/s_ccos.c80
-rw-r--r--sysdeps/generic/s_ccosf.c78
-rw-r--r--sysdeps/generic/s_ccosh.c105
-rw-r--r--sysdeps/generic/s_ccoshf.c103
-rw-r--r--sysdeps/generic/s_ccoshl.c101
-rw-r--r--sysdeps/generic/s_ccosl.c76
-rw-r--r--sysdeps/generic/s_cexp.c127
-rw-r--r--sysdeps/generic/s_cexpf.c125
-rw-r--r--sysdeps/generic/s_cexpl.c123
-rw-r--r--sysdeps/generic/s_clog.c65
-rw-r--r--sysdeps/generic/s_clog10.c65
-rw-r--r--sysdeps/generic/s_clog10f.c63
-rw-r--r--sysdeps/generic/s_clog10l.c61
-rw-r--r--sysdeps/generic/s_clogf.c63
-rw-r--r--sysdeps/generic/s_clogl.c61
-rw-r--r--sysdeps/generic/s_cpow.c34
-rw-r--r--sysdeps/generic/s_cpowf.c32
-rw-r--r--sysdeps/generic/s_cpowl.c30
-rw-r--r--sysdeps/generic/s_cproj.c51
-rw-r--r--sysdeps/generic/s_cprojf.c49
-rw-r--r--sysdeps/generic/s_cprojl.c48
-rw-r--r--sysdeps/generic/s_csin.c131
-rw-r--r--sysdeps/generic/s_csinf.c129
-rw-r--r--sysdeps/generic/s_csinh.c126
-rw-r--r--sysdeps/generic/s_csinhf.c124
-rw-r--r--sysdeps/generic/s_csinhl.c122
-rw-r--r--sysdeps/generic/s_csinl.c127
-rw-r--r--sysdeps/generic/s_csqrt.c114
-rw-r--r--sysdeps/generic/s_csqrtf.c112
-rw-r--r--sysdeps/generic/s_csqrtl.c110
-rw-r--r--sysdeps/generic/s_ctan.c74
-rw-r--r--sysdeps/generic/s_ctanf.c72
-rw-r--r--sysdeps/generic/s_ctanh.c74
-rw-r--r--sysdeps/generic/s_ctanhf.c72
-rw-r--r--sysdeps/generic/s_ctanhl.c70
-rw-r--r--sysdeps/generic/s_ctanl.c70
-rw-r--r--sysdeps/generic/s_erfl.c26
-rw-r--r--sysdeps/generic/s_expm1l.c16
-rw-r--r--sysdeps/generic/s_fdim.c40
-rw-r--r--sysdeps/generic/s_fdimf.c36
-rw-r--r--sysdeps/generic/s_fdiml.c36
-rw-r--r--sysdeps/generic/s_fma.c33
-rw-r--r--sysdeps/generic/s_fmaf.c28
-rw-r--r--sysdeps/generic/s_fmal.c28
-rw-r--r--sysdeps/generic/s_fmax.c33
-rw-r--r--sysdeps/generic/s_fmaxf.c29
-rw-r--r--sysdeps/generic/s_fmaxl.c29
-rw-r--r--sysdeps/generic/s_fmin.c33
-rw-r--r--sysdeps/generic/s_fminf.c29
-rw-r--r--sysdeps/generic/s_fminl.c29
-rw-r--r--sysdeps/generic/s_ldexp.c37
-rw-r--r--sysdeps/generic/s_ldexpf.c37
-rw-r--r--sysdeps/generic/s_ldexpl.c37
-rw-r--r--sysdeps/generic/s_log1pl.c15
-rw-r--r--sysdeps/generic/s_nan.c44
-rw-r--r--sysdeps/generic/s_nanf.c40
-rw-r--r--sysdeps/generic/s_nanl.c40
-rw-r--r--sysdeps/generic/s_nextafter.c100
-rw-r--r--sysdeps/generic/s_nexttowardf.c86
-rw-r--r--sysdeps/generic/s_nexttowardl.c1
-rw-r--r--sysdeps/generic/s_significand.c39
-rw-r--r--sysdeps/generic/s_significandf.c32
-rw-r--r--sysdeps/generic/s_significandl.c39
-rw-r--r--sysdeps/generic/s_tanhl.c15
-rw-r--r--sysdeps/generic/sbrk.c56
-rw-r--r--sysdeps/generic/scandir64.c30
-rw-r--r--sysdeps/generic/sched_getaffinity.c35
-rw-r--r--sysdeps/generic/sched_getp.c34
-rw-r--r--sysdeps/generic/sched_gets.c34
-rw-r--r--sysdeps/generic/sched_primax.c33
-rw-r--r--sysdeps/generic/sched_primin.c33
-rw-r--r--sysdeps/generic/sched_rr_gi.c34
-rw-r--r--sysdeps/generic/sched_setaffinity.c35
-rw-r--r--sysdeps/generic/sched_setp.c34
-rw-r--r--sysdeps/generic/sched_sets.c35
-rw-r--r--sysdeps/generic/sched_yield.c33
-rw-r--r--sysdeps/generic/seekdir.c41
-rw-r--r--sysdeps/generic/segfault.c214
-rw-r--r--sysdeps/generic/select.c43
-rw-r--r--sysdeps/generic/semctl.c34
-rw-r--r--sysdeps/generic/semget.c37
-rw-r--r--sysdeps/generic/semop.c36
-rw-r--r--sysdeps/generic/semtimedop.c37
-rw-r--r--sysdeps/generic/send.c37
-rw-r--r--sysdeps/generic/sendfile.c33
-rw-r--r--sysdeps/generic/sendfile64.c33
-rw-r--r--sysdeps/generic/sendmsg.c37
-rw-r--r--sysdeps/generic/sendto.c40
-rw-r--r--sysdeps/generic/setcontext.c32
-rw-r--r--sysdeps/generic/setdomain.c34
-rw-r--r--sysdeps/generic/setegid.c32
-rw-r--r--sysdeps/generic/setenv.c353
-rw-r--r--sysdeps/generic/seteuid.c32
-rw-r--r--sysdeps/generic/setfpucw.c37
-rw-r--r--sysdeps/generic/setgid.c37
-rw-r--r--sysdeps/generic/setgroups.c35
-rw-r--r--sysdeps/generic/sethostid.c34
-rw-r--r--sysdeps/generic/sethostname.c35
-rw-r--r--sysdeps/generic/setipv4sourcefilter.c33
-rw-r--r--sysdeps/generic/setitimer.c44
-rw-r--r--sysdeps/generic/setjmp.c37
-rw-r--r--sysdeps/generic/setlogin.c32
-rw-r--r--sysdeps/generic/setpgid.c37
-rw-r--r--sysdeps/generic/setpgrp.c25
-rw-r--r--sysdeps/generic/setpriority.c36
-rw-r--r--sysdeps/generic/setregid.c36
-rw-r--r--sysdeps/generic/setresgid.c35
-rw-r--r--sysdeps/generic/setresuid.c35
-rw-r--r--sysdeps/generic/setreuid.c36
-rw-r--r--sysdeps/generic/setrlimit.c37
-rw-r--r--sysdeps/generic/setrlimit64.c43
-rw-r--r--sysdeps/generic/setsid.c35
-rw-r--r--sysdeps/generic/setsockopt.c40
-rw-r--r--sysdeps/generic/setsourcefilter.c33
-rw-r--r--sysdeps/generic/settimeofday.c35
-rw-r--r--sysdeps/generic/setuid.c37
-rw-r--r--sysdeps/generic/setutxent.c27
-rw-r--r--sysdeps/generic/setxattr.c31
-rw-r--r--sysdeps/generic/shm_open.c31
-rw-r--r--sysdeps/generic/shm_unlink.c31
-rw-r--r--sysdeps/generic/shmat.c38
-rw-r--r--sysdeps/generic/shmctl.c36
-rw-r--r--sysdeps/generic/shmdt.c35
-rw-r--r--sysdeps/generic/shmget.c37
-rw-r--r--sysdeps/generic/shutdown.c39
-rw-r--r--sysdeps/generic/sigaction.c44
-rw-r--r--sysdeps/generic/sigaltstack.c34
-rw-r--r--sysdeps/generic/sigblock.c33
-rw-r--r--sysdeps/generic/sigfillset.c47
-rw-r--r--sysdeps/generic/sigignore.c33
-rw-r--r--sysdeps/generic/sigintr.c35
-rw-r--r--sysdeps/generic/sigjmp.c35
-rw-r--r--sysdeps/generic/siglist.c38
-rw-r--r--sysdeps/generic/signal.c38
-rw-r--r--sysdeps/generic/signame.c312
-rw-r--r--sysdeps/generic/signame.h67
-rw-r--r--sysdeps/generic/sigpause.c53
-rw-r--r--sysdeps/generic/sigpending.c40
-rw-r--r--sysdeps/generic/sigprocmask.c51
-rw-r--r--sysdeps/generic/sigqueue.c33
-rw-r--r--sysdeps/generic/sigreturn.c32
-rw-r--r--sysdeps/generic/sigset.c34
-rw-r--r--sysdeps/generic/sigsetmask.c32
-rw-r--r--sysdeps/generic/sigstack.c34
-rw-r--r--sysdeps/generic/sigsuspend.c37
-rw-r--r--sysdeps/generic/sigtimedwait.c34
-rw-r--r--sysdeps/generic/sigvec.c39
-rw-r--r--sysdeps/generic/sigwait.c32
-rw-r--r--sysdeps/generic/sigwaitinfo.c33
-rw-r--r--sysdeps/generic/sleep.c41
-rw-r--r--sysdeps/generic/sockatmark.c33
-rw-r--r--sysdeps/generic/socket.c38
-rw-r--r--sysdeps/generic/socketpair.c39
-rw-r--r--sysdeps/generic/spawni.c46
-rw-r--r--sysdeps/generic/speed.c72
-rw-r--r--sysdeps/generic/sprofil.c36
-rw-r--r--sysdeps/generic/sstk.c35
-rw-r--r--sysdeps/generic/start.c13
-rw-r--r--sysdeps/generic/statfs.c35
-rw-r--r--sysdeps/generic/statfs64.c32
-rw-r--r--sysdeps/generic/statvfs.c34
-rw-r--r--sysdeps/generic/statvfs64.c32
-rw-r--r--sysdeps/generic/stdint.h6
-rw-r--r--sysdeps/generic/stime.c40
-rw-r--r--sysdeps/generic/stpcpy.c55
-rw-r--r--sysdeps/generic/stpcpy_chk.c45
-rw-r--r--sysdeps/generic/stpncpy.c100
-rw-r--r--sysdeps/generic/strcasecmp.c74
-rw-r--r--sysdeps/generic/strcasecmp_l.c23
-rw-r--r--sysdeps/generic/strcasestr.c142
-rw-r--r--sysdeps/generic/strcat.c52
-rw-r--r--sysdeps/generic/strcat_chk.c58
-rw-r--r--sysdeps/generic/strchr.c190
-rw-r--r--sysdeps/generic/strchrnul.c170
-rw-r--r--sysdeps/generic/strcmp.c47
-rw-r--r--sysdeps/generic/strcpy.c50
-rw-r--r--sysdeps/generic/strcpy_chk.c68
-rw-r--r--sysdeps/generic/strcspn.c51
-rw-r--r--sysdeps/generic/string-inlines.c35
-rw-r--r--sysdeps/generic/strlen.c153
-rw-r--r--sysdeps/generic/strncase.c76
-rw-r--r--sysdeps/generic/strncase_l.c25
-rw-r--r--sysdeps/generic/strncat.c85
-rw-r--r--sysdeps/generic/strncat_chk.c100
-rw-r--r--sysdeps/generic/strncmp.c73
-rw-r--r--sysdeps/generic/strncpy.c87
-rw-r--r--sysdeps/generic/strncpy_chk.c89
-rw-r--r--sysdeps/generic/strnlen.c160
-rw-r--r--sysdeps/generic/strpbrk.c46
-rw-r--r--sysdeps/generic/strrchr.c50
-rw-r--r--sysdeps/generic/strsep.c70
-rw-r--r--sysdeps/generic/strspn.c47
-rw-r--r--sysdeps/generic/strstr.c123
-rw-r--r--sysdeps/generic/strtoimax.c1
-rw-r--r--sysdeps/generic/strtok.c66
-rw-r--r--sysdeps/generic/strtok_r.c79
-rw-r--r--sysdeps/generic/strtol.c111
-rw-r--r--sysdeps/generic/strtol_l.c557
-rw-r--r--sysdeps/generic/strtold_l.c58
-rw-r--r--sysdeps/generic/strtoll.c34
-rw-r--r--sysdeps/generic/strtoll_l.c28
-rw-r--r--sysdeps/generic/strtoul.c21
-rw-r--r--sysdeps/generic/strtoul_l.c28
-rw-r--r--sysdeps/generic/strtoull.c34
-rw-r--r--sysdeps/generic/strtoull_l.c29
-rw-r--r--sysdeps/generic/strtoumax.c1
-rw-r--r--sysdeps/generic/strtsupp.c28
-rw-r--r--sysdeps/generic/stty.c40
-rw-r--r--sysdeps/generic/sub_n.c62
-rw-r--r--sysdeps/generic/submul_1.c65
-rw-r--r--sysdeps/generic/swapcontext.c33
-rw-r--r--sysdeps/generic/swapoff.c31
-rw-r--r--sysdeps/generic/swapon.c34
-rw-r--r--sysdeps/generic/symlink.c42
-rw-r--r--sysdeps/generic/sync.c31
-rw-r--r--sysdeps/generic/syscall.c35
-rw-r--r--sysdeps/generic/sysconf.c273
-rw-r--r--sysdeps/generic/sysdep-cancel.h1
-rw-r--r--sysdeps/generic/sysdep.c2
-rw-r--r--sysdeps/generic/sysdep.h2
-rw-r--r--sysdeps/generic/system.c38
-rw-r--r--sysdeps/generic/sysv_signal.c43
-rw-r--r--sysdeps/generic/t_sincosl.c1
-rw-r--r--sysdeps/generic/tcdrain.c39
-rw-r--r--sysdeps/generic/tcflow.c53
-rw-r--r--sysdeps/generic/tcflush.c46
-rw-r--r--sysdeps/generic/tcgetattr.c46
-rw-r--r--sysdeps/generic/tcgetpgrp.c39
-rw-r--r--sysdeps/generic/tcsendbrk.c40
-rw-r--r--sysdeps/generic/tcsetattr.c108
-rw-r--r--sysdeps/generic/tcsetpgrp.c41
-rw-r--r--sysdeps/generic/telldir.c41
-rw-r--r--sysdeps/generic/tempname.c59
-rw-r--r--sysdeps/generic/time.c36
-rw-r--r--sysdeps/generic/timer_create.c30
-rw-r--r--sysdeps/generic/timer_delete.c30
-rw-r--r--sysdeps/generic/timer_getoverr.c30
-rw-r--r--sysdeps/generic/timer_gettime.c30
-rw-r--r--sysdeps/generic/timer_settime.c31
-rw-r--r--sysdeps/generic/times.c43
-rw-r--r--sysdeps/generic/tls-macros.h12
-rw-r--r--sysdeps/generic/tmpfile.c66
-rw-r--r--sysdeps/generic/tmpfile64.c3
-rw-r--r--sysdeps/generic/trampoline.c37
-rw-r--r--sysdeps/generic/truncate.c34
-rw-r--r--sysdeps/generic/truncate64.c35
-rw-r--r--sysdeps/generic/tst-audit.h11
-rw-r--r--sysdeps/generic/tst-timer.c33
-rw-r--r--sysdeps/generic/ttyname.c38
-rw-r--r--sysdeps/generic/ttyname_r.c37
-rw-r--r--sysdeps/generic/ualarm.c37
-rw-r--r--sysdeps/generic/udiv_qrnnd.c10
-rw-r--r--sysdeps/generic/ulimit.c39
-rw-r--r--sysdeps/generic/umask.c34
-rw-r--r--sysdeps/generic/uname.c66
-rw-r--r--sysdeps/generic/unlink.c41
-rw-r--r--sysdeps/generic/unlockpt.c35
-rw-r--r--sysdeps/generic/unsecvars.h18
-rw-r--r--sysdeps/generic/unwind-dw2-fde.c4
-rw-r--r--sysdeps/generic/unwind-dw2.c26
-rw-r--r--sysdeps/generic/updwtmp.c35
-rw-r--r--sysdeps/generic/updwtmpx.c27
-rw-r--r--sysdeps/generic/usleep.c32
-rw-r--r--sysdeps/generic/ustat.c33
-rw-r--r--sysdeps/generic/utime.c43
-rw-r--r--sysdeps/generic/utimes.c43
-rw-r--r--sysdeps/generic/utmp_file.c499
-rw-r--r--sysdeps/generic/utmpxname.c27
-rw-r--r--sysdeps/generic/versionsort64.c27
-rw-r--r--sysdeps/generic/vfork.c31
-rw-r--r--sysdeps/generic/vhangup.c33
-rw-r--r--sysdeps/generic/vlimit.c51
-rw-r--r--sysdeps/generic/vtimes.c65
-rw-r--r--sysdeps/generic/w_acos.c48
-rw-r--r--sysdeps/generic/w_acosf.c48
-rw-r--r--sysdeps/generic/w_acosh.c47
-rw-r--r--sysdeps/generic/w_acoshf.c48
-rw-r--r--sysdeps/generic/w_acoshl.c47
-rw-r--r--sysdeps/generic/w_acosl.c48
-rw-r--r--sysdeps/generic/w_asin.c49
-rw-r--r--sysdeps/generic/w_asinf.c49
-rw-r--r--sysdeps/generic/w_asinl.c49
-rw-r--r--sysdeps/generic/w_atan2.c47
-rw-r--r--sysdeps/generic/w_atan2f.c46
-rw-r--r--sysdeps/generic/w_atan2l.c47
-rw-r--r--sysdeps/generic/w_atanh.c52
-rw-r--r--sysdeps/generic/w_atanhf.c53
-rw-r--r--sysdeps/generic/w_atanhl.c52
-rw-r--r--sysdeps/generic/w_cosh.c47
-rw-r--r--sysdeps/generic/w_coshf.c47
-rw-r--r--sysdeps/generic/w_coshl.c47
-rw-r--r--sysdeps/generic/w_drem.c20
-rw-r--r--sysdeps/generic/w_dremf.c17
-rw-r--r--sysdeps/generic/w_dreml.c18
-rw-r--r--sysdeps/generic/w_exp10.c51
-rw-r--r--sysdeps/generic/w_exp10f.c46
-rw-r--r--sysdeps/generic/w_exp10l.c46
-rw-r--r--sysdeps/generic/w_exp2.c36
-rw-r--r--sysdeps/generic/w_exp2f.c32
-rw-r--r--sysdeps/generic/w_exp2l.c31
-rw-r--r--sysdeps/generic/w_expl.c13
-rw-r--r--sysdeps/generic/w_fmod.c48
-rw-r--r--sysdeps/generic/w_fmodf.c48
-rw-r--r--sysdeps/generic/w_fmodl.c48
-rw-r--r--sysdeps/generic/w_hypot.c48
-rw-r--r--sysdeps/generic/w_hypotf.c48
-rw-r--r--sysdeps/generic/w_hypotl.c48
-rw-r--r--sysdeps/generic/w_j0.c76
-rw-r--r--sysdeps/generic/w_j0f.c74
-rw-r--r--sysdeps/generic/w_j0l.c73
-rw-r--r--sysdeps/generic/w_j1.c77
-rw-r--r--sysdeps/generic/w_j1f.c75
-rw-r--r--sysdeps/generic/w_j1l.c74
-rw-r--r--sysdeps/generic/w_jn.c99
-rw-r--r--sysdeps/generic/w_jnf.c71
-rw-r--r--sysdeps/generic/w_jnl.c96
-rw-r--r--sysdeps/generic/w_lgamma.c60
-rw-r--r--sysdeps/generic/w_lgamma_r.c51
-rw-r--r--sysdeps/generic/w_lgammaf.c53
-rw-r--r--sysdeps/generic/w_lgammaf_r.c52
-rw-r--r--sysdeps/generic/w_lgammal.c58
-rw-r--r--sysdeps/generic/w_lgammal_r.c52
-rw-r--r--sysdeps/generic/w_log.c48
-rw-r--r--sysdeps/generic/w_log10.c51
-rw-r--r--sysdeps/generic/w_log10f.c52
-rw-r--r--sysdeps/generic/w_log10l.c51
-rw-r--r--sysdeps/generic/w_log2.c32
-rw-r--r--sysdeps/generic/w_log2f.c30
-rw-r--r--sysdeps/generic/w_log2l.c28
-rw-r--r--sysdeps/generic/w_logf.c49
-rw-r--r--sysdeps/generic/w_logl.c48
-rw-r--r--sysdeps/generic/w_pow.c70
-rw-r--r--sysdeps/generic/w_powf.c77
-rw-r--r--sysdeps/generic/w_powl.c68
-rw-r--r--sysdeps/generic/w_remainder.c47
-rw-r--r--sysdeps/generic/w_remainderf.c47
-rw-r--r--sysdeps/generic/w_remainderl.c48
-rw-r--r--sysdeps/generic/w_scalb.c65
-rw-r--r--sysdeps/generic/w_scalbf.c66
-rw-r--r--sysdeps/generic/w_scalbl.c65
-rw-r--r--sysdeps/generic/w_sinh.c47
-rw-r--r--sysdeps/generic/w_sinhf.c47
-rw-r--r--sysdeps/generic/w_sinhl.c47
-rw-r--r--sysdeps/generic/w_sqrt.c47
-rw-r--r--sysdeps/generic/w_sqrtf.c47
-rw-r--r--sysdeps/generic/w_sqrtl.c47
-rw-r--r--sysdeps/generic/w_tgamma.c56
-rw-r--r--sysdeps/generic/w_tgammaf.c53
-rw-r--r--sysdeps/generic/w_tgammal.c55
-rw-r--r--sysdeps/generic/wait.c33
-rw-r--r--sysdeps/generic/wait3.c43
-rw-r--r--sysdeps/generic/wait4.c33
-rw-r--r--sysdeps/generic/waitid.c35
-rw-r--r--sysdeps/generic/waitpid.c53
-rw-r--r--sysdeps/generic/wcstoimax.c1
-rw-r--r--sysdeps/generic/wcstol.c23
-rw-r--r--sysdeps/generic/wcstol_l.c30
-rw-r--r--sysdeps/generic/wcstoll.c25
-rw-r--r--sysdeps/generic/wcstoll_l.c30
-rw-r--r--sysdeps/generic/wcstoul.c23
-rw-r--r--sysdeps/generic/wcstoul_l.c30
-rw-r--r--sysdeps/generic/wcstoull.c25
-rw-r--r--sysdeps/generic/wcstoull_l.c31
-rw-r--r--sysdeps/generic/wcstoumax.c1
-rw-r--r--sysdeps/generic/wordcopy.c413
-rw-r--r--sysdeps/generic/wordexp.c2460
-rw-r--r--sysdeps/generic/write.c50
-rw-r--r--sysdeps/generic/writev.c41
-rw-r--r--sysdeps/generic/xmknod.c42
-rw-r--r--sysdeps/generic/xpg-strerror.c57
-rw-r--r--sysdeps/generic/xstat.c39
-rw-r--r--sysdeps/generic/xstat64.c38
857 files changed, 49488 insertions, 417 deletions
diff --git a/sysdeps/generic/Dist b/sysdeps/generic/Dist
new file mode 100644
index 0000000000..549b616fb5
--- /dev/null
+++ b/sysdeps/generic/Dist
@@ -0,0 +1,26 @@
+signame.c
+signame.h
+det_endian.c
+dl-brk.c
+dl-sbrk.c
+entry.h
+errno-loc.c
+getresgid.c
+getresuid.c
+endutxent.c
+getutxent.c
+getutxid.c
+getutxline.c
+pututxline.c
+setutxent.c
+updwtmpx.c
+utmpxname.c
+bits/libc-tsd.h
+siglist.h
+bp-semctl.h
+bp-checks.h
+bp-thunks.h
+bp-sym.h
+bp-start.h
+bits/link.h
+sysdep-cancel.h
diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index 972d469737..d741864b9c 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1992,93,94,95,96,97,99,2002,2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1992,93,94,95,96,97,99,2002 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +16,21 @@
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
+ifeq (,$(filter-out $(sysdep_dir)/generic/bits $(common-objpfx)/bits,\
+ $(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/endian.h))))))
+
+$(common-objpfx)bytesex.h: $(common-objpfx)det_endian
+ $(dir $<)$(notdir $<) > $@-tmp
+ mv $@-tmp $@
+
+$(common-objpfx)det_endian: $(sysdep_dir)/generic/det_endian.c
+ $(common-objdir-compile)
+
+before-compile := $(before-compile) $(common-objpfx)bits/endian.h
+common-generated := $(common-generated) bits/endian.h det_endian
+
+endif
+
ifeq ($(subdir),string)
CFLAGS-wordcopy.c += -Wno-uninitialized
endif
diff --git a/sysdeps/generic/__longjmp.c b/sysdeps/generic/__longjmp.c
new file mode 100644
index 0000000000..8a61ff6770
--- /dev/null
+++ b/sysdeps/generic/__longjmp.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <setjmp.h>
+
+
+/* Jump to the position specified by ENV, causing the
+ setjmp call there to return VAL, or 1 if VAL is 0. */
+void
+__longjmp (__jmp_buf env, int val)
+{
+ if (val == 0)
+ val = 1;
+
+ __set_errno (ENOSYS);
+ /* No way to signal failure. */
+}
+
+stub_warning (longjmp)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/_exit.c b/sysdeps/generic/_exit.c
new file mode 100644
index 0000000000..673667df30
--- /dev/null
+++ b/sysdeps/generic/_exit.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991,94,95,96,97,99,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <stdlib.h>
+
+/* The function `_exit' should take a status argument and simply
+ terminate program execution, using the low-order 8 bits of the
+ given integer as status. */
+void
+_exit (status)
+ int status;
+{
+ status &= 0xff;
+ abort ();
+}
+libc_hidden_def (_exit)
+weak_alias (_exit, _Exit)
+
+stub_warning (_exit)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c
new file mode 100644
index 0000000000..f6f16ff2af
--- /dev/null
+++ b/sysdeps/generic/_strerror.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 1991,93,95,96,97,98,2000,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <libintl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/param.h>
+#include <stdio-common/_itoa.h>
+
+/* It is critical here that we always use the `dcgettext' function for
+ the message translation. Since <libintl.h> only defines the macro
+ `dgettext' to use `dcgettext' for optimizing programs this is not
+ always guaranteed. */
+#ifndef dgettext
+# include <locale.h> /* We need LC_MESSAGES. */
+# define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
+#endif
+
+/* Return a string describing the errno code in ERRNUM. */
+char *
+__strerror_r (int errnum, char *buf, size_t buflen)
+{
+ if (errnum < 0 || errnum >= _sys_nerr_internal
+ || _sys_errlist_internal[errnum] == NULL)
+ {
+ /* Buffer we use to print the number in. For a maximum size for
+ `int' of 8 bytes we never need more than 20 digits. */
+ char numbuf[21];
+ const char *unk = _("Unknown error ");
+ const size_t unklen = strlen (unk);
+ char *p, *q;
+
+ numbuf[20] = '\0';
+ p = _itoa_word (errnum, &numbuf[20], 10, 0);
+
+ /* Now construct the result while taking care for the destination
+ buffer size. */
+ q = __mempcpy (buf, unk, MIN (unklen, buflen));
+ if (unklen < buflen)
+ memcpy (q, p, MIN ((size_t) (&numbuf[21] - p), buflen - unklen));
+
+ /* Terminate the string in any case. */
+ if (buflen > 0)
+ buf[buflen - 1] = '\0';
+
+ return buf;
+ }
+
+ return (char *) _(_sys_errlist_internal[errnum]);
+}
+weak_alias (__strerror_r, strerror_r)
+libc_hidden_def (__strerror_r)
diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c
new file mode 100644
index 0000000000..00788f22c7
--- /dev/null
+++ b/sysdeps/generic/abort.c
@@ -0,0 +1,140 @@
+/* Copyright (C) 1991,93,95,96,97,98,2001,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <bits/libc-lock.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Try to get a machine dependent instruction which will make the
+ program crash. This is used in case everything else fails. */
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+/* No such instruction is available. */
+# define ABORT_INSTRUCTION
+#endif
+
+#ifdef USE_IN_LIBIO
+# include <libio/libioP.h>
+# define fflush(s) _IO_flush_all_lockp (0)
+#endif
+
+/* We must avoid to run in circles. Therefore we remember how far we
+ already got. */
+static int stage;
+
+/* We should be prepared for multiple threads trying to run abort. */
+__libc_lock_define_initialized_recursive (static, lock);
+
+
+/* Cause an abnormal program termination with core-dump. */
+void
+abort (void)
+{
+ struct sigaction act;
+ sigset_t sigs;
+
+ /* First acquire the lock. */
+ __libc_lock_lock_recursive (lock);
+
+ /* Now it's for sure we are alone. But recursive calls are possible. */
+
+ /* Unlock SIGABRT. */
+ if (stage == 0)
+ {
+ ++stage;
+ if (__sigemptyset (&sigs) == 0 &&
+ __sigaddset (&sigs, SIGABRT) == 0)
+ __sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
+ }
+
+ /* Flush all streams. We cannot close them now because the user
+ might have registered a handler for SIGABRT. */
+ if (stage == 1)
+ {
+ ++stage;
+ fflush (NULL);
+ }
+
+ /* Send signal which possibly calls a user handler. */
+ if (stage == 2)
+ {
+ /* This stage is special: we must allow repeated calls of
+ `abort' when a user defined handler for SIGABRT is installed.
+ This is risky since the `raise' implementation might also
+ fail but I don't see another possibility. */
+ int save_stage = stage;
+
+ stage = 0;
+ __libc_lock_unlock_recursive (lock);
+
+ raise (SIGABRT);
+
+ __libc_lock_lock_recursive (lock);
+ stage = save_stage + 1;
+ }
+
+ /* There was a handler installed. Now remove it. */
+ if (stage == 3)
+ {
+ ++stage;
+ memset (&act, '\0', sizeof (struct sigaction));
+ act.sa_handler = SIG_DFL;
+ __sigfillset (&act.sa_mask);
+ act.sa_flags = 0;
+ __sigaction (SIGABRT, &act, NULL);
+ }
+
+ /* Now close the streams which also flushes the output the user
+ defined handler might has produced. */
+ if (stage == 4)
+ {
+ ++stage;
+ __fcloseall ();
+ }
+
+ /* Try again. */
+ if (stage == 5)
+ {
+ ++stage;
+ raise (SIGABRT);
+ }
+
+ /* Now try to abort using the system specific command. */
+ if (stage == 6)
+ {
+ ++stage;
+ ABORT_INSTRUCTION;
+ }
+
+ /* If we can't signal ourselves and the abort instruction failed, exit. */
+ if (stage == 7)
+ {
+ ++stage;
+ _exit (127);
+ }
+
+ /* If even this fails try to use the provided instruction to crash
+ or otherwise make sure we never return. */
+ while (1)
+ /* Try for ever and ever. */
+ ABORT_INSTRUCTION;
+}
+libc_hidden_def (abort)
diff --git a/sysdeps/generic/accept.c b/sysdeps/generic/accept.c
new file mode 100644
index 0000000000..dad34ceddd
--- /dev/null
+++ b/sysdeps/generic/accept.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+ peer and *ADDR_LEN to the address's actual length, and return the
+ new socket's descriptor, or -1 for errors. */
+int
+accept (fd, addr, addr_len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (accept)
+
+
+stub_warning (accept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/access.c b/sysdeps/generic/access.c
new file mode 100644
index 0000000000..c266e945a9
--- /dev/null
+++ b/sysdeps/generic/access.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+/* Test for access to FILE. */
+int
+__access (file, type)
+ const char *file;
+ int type;
+{
+ if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (access)
+
+weak_alias (__access, access)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/acct.c b/sysdeps/generic/acct.c
new file mode 100644
index 0000000000..b626b5d938
--- /dev/null
+++ b/sysdeps/generic/acct.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Turn accounting on if NAME is an existing file. The system will then write
+ a record for each process as it terminates, to this file. If NAME is NULL,
+ turn accounting off. This call is restricted to the super-user. */
+int
+acct (name)
+ const char *name;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (acct)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/add_n.c b/sysdeps/generic/add_n.c
new file mode 100644
index 0000000000..5fcb7e4835
--- /dev/null
+++ b/sysdeps/generic/add_n.c
@@ -0,0 +1,62 @@
+/* mpn_add_n -- Add two limb vectors of equal, non-zero length.
+
+Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+mp_limb_t
+#if __STDC__
+mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size)
+#else
+mpn_add_n (res_ptr, s1_ptr, s2_ptr, size)
+ register mp_ptr res_ptr;
+ register mp_srcptr s1_ptr;
+ register mp_srcptr s2_ptr;
+ mp_size_t size;
+#endif
+{
+ register mp_limb_t x, y, cy;
+ register mp_size_t j;
+
+ /* The loop counter and index J goes from -SIZE to -1. This way
+ the loop becomes faster. */
+ j = -size;
+
+ /* Offset the base pointers to compensate for the negative indices. */
+ s1_ptr -= j;
+ s2_ptr -= j;
+ res_ptr -= j;
+
+ cy = 0;
+ do
+ {
+ y = s2_ptr[j];
+ x = s1_ptr[j];
+ y += cy; /* add previous carry to one addend */
+ cy = (y < cy); /* get out carry from that addition */
+ y = x + y; /* add other addend */
+ cy = (y < x) + cy; /* get out carry from that add, combine */
+ res_ptr[j] = y;
+ }
+ while (++j != 0);
+
+ return cy;
+}
diff --git a/sysdeps/generic/addmul_1.c b/sysdeps/generic/addmul_1.c
new file mode 100644
index 0000000000..746ae31307
--- /dev/null
+++ b/sysdeps/generic/addmul_1.c
@@ -0,0 +1,65 @@
+/* mpn_addmul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR
+ by S2_LIMB, add the S1_SIZE least significant limbs of the product to the
+ limb vector pointed to by RES_PTR. Return the most significant limb of
+ the product, adjusted for carry-out from the addition.
+
+Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+mp_limb_t
+mpn_addmul_1 (res_ptr, s1_ptr, s1_size, s2_limb)
+ register mp_ptr res_ptr;
+ register mp_srcptr s1_ptr;
+ mp_size_t s1_size;
+ register mp_limb_t s2_limb;
+{
+ register mp_limb_t cy_limb;
+ register mp_size_t j;
+ register mp_limb_t prod_high, prod_low;
+ register mp_limb_t x;
+
+ /* The loop counter and index J goes from -SIZE to -1. This way
+ the loop becomes faster. */
+ j = -s1_size;
+
+ /* Offset the base pointers to compensate for the negative indices. */
+ res_ptr -= j;
+ s1_ptr -= j;
+
+ cy_limb = 0;
+ do
+ {
+ umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb);
+
+ prod_low += cy_limb;
+ cy_limb = (prod_low < cy_limb) + prod_high;
+
+ x = res_ptr[j];
+ prod_low = x + prod_low;
+ cy_limb += (prod_low < x);
+ res_ptr[j] = prod_low;
+ }
+ while (++j != 0);
+
+ return cy_limb;
+}
diff --git a/sysdeps/generic/adjtime.c b/sysdeps/generic/adjtime.c
new file mode 100644
index 0000000000..8645652188
--- /dev/null
+++ b/sysdeps/generic/adjtime.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/time.h>
+
+/* Adjust the current time of day by the amount in DELTA.
+ If OLDDELTA is not NULL, it is filled in with the amount
+ of time adjustment remaining to be done from the last `__adjtime' call.
+ This call is restricted to the super-user. */
+int
+__adjtime (delta, olddelta)
+ const struct timeval *delta;
+ struct timeval *olddelta;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (adjtime)
+
+weak_alias (__adjtime, adjtime)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_cancel.c b/sysdeps/generic/aio_cancel.c
new file mode 100644
index 0000000000..c24a2f7529
--- /dev/null
+++ b/sysdeps/generic/aio_cancel.c
@@ -0,0 +1,44 @@
+/* Cancel requests associated with given file descriptor. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating. The
+ implementation of aio_cancel and aio_cancel64 are identical and so
+ we want to avoid code duplication by using aliases. But gcc sees
+ the different parameter lists and prints a warning. We define here
+ a function so that aio_cancel64 has no prototype. */
+#define aio_cancel64 XXX
+#include <aio.h>
+/* And undo the hack. */
+#undef aio_cancel64
+
+#include <errno.h>
+
+int
+aio_cancel (int fildes, struct aiocb *aiocbp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (aio_cancel, aio_cancel64)
+
+stub_warning (aio_cancel)
+stub_warning (aio_cancel64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_fsync.c b/sysdeps/generic/aio_fsync.c
new file mode 100644
index 0000000000..bc23d75f69
--- /dev/null
+++ b/sysdeps/generic/aio_fsync.c
@@ -0,0 +1,51 @@
+/* Synchronize I/O in given file descriptor. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating. The
+ implementation of aio_fsync and aio_fsync64 are identical and so
+ we want to avoid code duplication by using aliases. But gcc sees
+ the different parameter lists and prints a warning. We define here
+ a function so that aio_fsync64 has no prototype. */
+#define aio_fsync64 XXX
+#include <aio.h>
+/* And undo the hack. */
+#undef aio_fsync64
+
+#include <errno.h>
+#include <fcntl.h>
+
+int
+aio_fsync (int op, struct aiocb *aiocbp)
+{
+ if (op != O_SYNC && op != O_DSYNC)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (aio_fsync, aio_fsync64)
+
+stub_warning (aio_fsync)
+stub_warning (aio_fsync64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_misc.c b/sysdeps/generic/aio_misc.c
new file mode 100644
index 0000000000..c29b8d0eae
--- /dev/null
+++ b/sysdeps/generic/aio_misc.c
@@ -0,0 +1,29 @@
+/* Handle general operations. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <aio.h>
+#include <aio_misc.h>
+
+/* This file is for internal code needed by the aio_* implementation. */
+
+void
+__aio_init (const struct aioinit *init)
+{
+}
+weak_alias (__aio_init, aio_init)
diff --git a/sysdeps/generic/aio_notify.c b/sysdeps/generic/aio_notify.c
new file mode 100644
index 0000000000..2c79ee6c2f
--- /dev/null
+++ b/sysdeps/generic/aio_notify.c
@@ -0,0 +1,24 @@
+/* Notify initiator of AIO request. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <aio.h>
+#include <aio_misc.h>
+
+/* This file contains only internal functions used by
+ the particular aio_* implementation code. */
diff --git a/sysdeps/generic/aio_read.c b/sysdeps/generic/aio_read.c
new file mode 100644
index 0000000000..db1d19f3d7
--- /dev/null
+++ b/sysdeps/generic/aio_read.c
@@ -0,0 +1,36 @@
+/* Asynchronous read. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <aio.h>
+#include <errno.h>
+
+#ifdef BE_AIO64
+#define aiocb aiocb64
+#define aio_read aio_read64
+#endif
+
+int
+aio_read (struct aiocb *aiocbp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (aio_read)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_read64.c b/sysdeps/generic/aio_read64.c
new file mode 100644
index 0000000000..c1292352af
--- /dev/null
+++ b/sysdeps/generic/aio_read64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include "aio_read.c"
diff --git a/sysdeps/generic/aio_sigqueue.c b/sysdeps/generic/aio_sigqueue.c
new file mode 100644
index 0000000000..e824c6b3de
--- /dev/null
+++ b/sysdeps/generic/aio_sigqueue.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <aio.h>
+#include <errno.h>
+#include <signal.h>
+
+#include "aio_misc.h"
+
+int
+__aio_sigqueue (sig, val, caller_pid)
+ int sig;
+ const union sigval val;
+ pid_t caller_pid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (__aio_sigqueue)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_suspend.c b/sysdeps/generic/aio_suspend.c
new file mode 100644
index 0000000000..0530f0019c
--- /dev/null
+++ b/sysdeps/generic/aio_suspend.c
@@ -0,0 +1,46 @@
+/* Suspend until termination of a requests. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating. The
+ implementations of aio_suspend and aio_suspend64 are identical and so
+ we want to avoid code duplication by using aliases. But gcc sees
+ the different parameter lists and prints a warning. We define here
+ a function so that aio_suspend64 has no prototype. */
+#define aio_suspend64 XXX
+#include <aio.h>
+/* And undo the hack. */
+#undef aio_suspend64
+
+#include <errno.h>
+#include <sys/time.h>
+
+
+int
+aio_suspend (const struct aiocb *const list[], int nent,
+ const struct timespec *timeout)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (aio_suspend, aio_suspend64)
+
+stub_warning (aio_suspend)
+stub_warning (aio_suspend64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_write.c b/sysdeps/generic/aio_write.c
new file mode 100644
index 0000000000..bc62fcb469
--- /dev/null
+++ b/sysdeps/generic/aio_write.c
@@ -0,0 +1,36 @@
+/* Asynchronous write. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <aio.h>
+#include <errno.h>
+
+#ifdef BE_AIO64
+#define aiocb aiocb64
+#define aio_write aio_write64
+#endif
+
+int
+aio_write (struct aiocb *aiocbp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (aio_write)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_write64.c b/sysdeps/generic/aio_write64.c
new file mode 100644
index 0000000000..bb1693eeee
--- /dev/null
+++ b/sysdeps/generic/aio_write64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include "aio_write.c"
diff --git a/sysdeps/generic/alarm.c b/sysdeps/generic/alarm.c
new file mode 100644
index 0000000000..1f0cceb58e
--- /dev/null
+++ b/sysdeps/generic/alarm.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991,95,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM.
+ If SECONDS is zero, any currently scheduled alarm will be cancelled.
+ The function returns the number of seconds remaining until the last
+ alarm scheduled would have signaled, or zero if there wasn't one.
+ There is no return value to indicate an error, but you can set `errno'
+ to 0 and check its value after calling `alarm', and this might tell you.
+ The signal may come late due to processor scheduling. */
+unsigned int
+alarm (seconds)
+ unsigned int seconds;
+{
+ __set_errno (ENOSYS);
+ return 0;
+}
+libc_hidden_def (alarm)
+
+stub_warning (alarm)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/allocrtsig.c b/sysdeps/generic/allocrtsig.c
new file mode 100644
index 0000000000..ac8d2b6bfe
--- /dev/null
+++ b/sysdeps/generic/allocrtsig.c
@@ -0,0 +1,96 @@
+/* Handle real-time signal allocation.
+ Copyright (C) 1997,98,99,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+
+/* In these variables we keep track of the used variables. If the
+ platform does not support any real-time signals we will define the
+ values to some unreasonable value which will signal failing of all
+ the functions below. */
+#ifndef __SIGRTMIN
+static int current_rtmin = -1;
+static int current_rtmax = -1;
+#else
+static int current_rtmin;
+static int current_rtmax;
+
+static int initialized;
+
+#include <testrtsig.h>
+
+static void
+init (void)
+{
+ if (!kernel_has_rtsig ())
+ {
+ current_rtmin = -1;
+ current_rtmax = -1;
+ }
+ else
+ {
+ current_rtmin = __SIGRTMIN;
+ current_rtmax = __SIGRTMAX;
+ }
+ initialized = 1;
+}
+#endif
+
+/* Return number of available real-time signal with highest priority. */
+int
+__libc_current_sigrtmin (void)
+{
+#ifdef __SIGRTMIN
+ if (!initialized)
+ init ();
+#endif
+ return current_rtmin;
+}
+libc_hidden_def (__libc_current_sigrtmin)
+
+/* Return number of available real-time signal with lowest priority. */
+int
+__libc_current_sigrtmax (void)
+{
+#ifdef __SIGRTMIN
+ if (!initialized)
+ init ();
+#endif
+ return current_rtmax;
+}
+libc_hidden_def (__libc_current_sigrtmax)
+
+/* Allocate real-time signal with highest/lowest available
+ priority. Please note that we don't use a lock since we assume
+ this function to be called at program start. */
+int
+__libc_allocate_rtsig (int high)
+{
+#ifndef __SIGRTMIN
+ return -1;
+#else
+ if (!initialized)
+ init ();
+ if (current_rtmin == -1 || current_rtmin > current_rtmax)
+ /* We don't have anymore signal available. */
+ return -1;
+
+ return high ? current_rtmin++ : current_rtmax--;
+#endif
+}
diff --git a/sysdeps/generic/alphasort64.c b/sysdeps/generic/alphasort64.c
new file mode 100644
index 0000000000..fe84aec2f1
--- /dev/null
+++ b/sysdeps/generic/alphasort64.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1992, 1997, 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <dirent.h>
+#include <string.h>
+
+int
+alphasort64 (const void *a, const void *b)
+{
+ return strcoll ((*(const struct dirent64 **) a)->d_name,
+ (*(const struct dirent64 **) b)->d_name);
+}
diff --git a/sysdeps/generic/backtrace.c b/sysdeps/generic/backtrace.c
new file mode 100644
index 0000000000..6a3336c6d2
--- /dev/null
+++ b/sysdeps/generic/backtrace.c
@@ -0,0 +1,93 @@
+/* Return backtrace of current program state. Generic version.
+ Copyright (C) 1998, 2000, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <execinfo.h>
+#include <signal.h>
+#include <frame.h>
+#include <sigcontextinfo.h>
+#include <bp-checks.h>
+#include <ldsodefs.h>
+
+/* This implementation assumes a stack layout that matches the defaults
+ used by gcc's `__builtin_frame_address' and `__builtin_return_address'
+ (FP is the frame pointer register):
+
+ +-----------------+ +-----------------+
+ FP -> | previous FP --------> | previous FP ------>...
+ | | | |
+ | return address | | return address |
+ +-----------------+ +-----------------+
+
+ */
+
+/* Get some notion of the current stack. Need not be exactly the top
+ of the stack, just something somewhere in the current frame. */
+#ifndef CURRENT_STACK_FRAME
+# define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
+#endif
+
+/* By default we assume that the stack grows downward. */
+#ifndef INNER_THAN
+# define INNER_THAN <
+#endif
+
+/* By default assume the `next' pointer in struct layout points to the
+ next struct layout. */
+#ifndef ADVANCE_STACK_FRAME
+# define ADVANCE_STACK_FRAME(next) BOUNDED_1 ((struct layout *) (next))
+#endif
+
+/* By default, the frame pointer is just what we get from gcc. */
+#ifndef FIRST_FRAME_POINTER
+# define FIRST_FRAME_POINTER __builtin_frame_address (0)
+#endif
+
+int
+__backtrace (array, size)
+ void **array;
+ int size;
+{
+ struct layout *current;
+ void *__unbounded top_frame;
+ void *__unbounded top_stack;
+ int cnt = 0;
+
+ top_frame = FIRST_FRAME_POINTER;
+ top_stack = CURRENT_STACK_FRAME;
+
+ /* We skip the call to this function, it makes no sense to record it. */
+ current = BOUNDED_1 ((struct layout *) top_frame);
+ while (cnt < size)
+ {
+ if ((void *) current INNER_THAN top_stack
+ || !((void *) current INNER_THAN __libc_stack_end))
+ /* This means the address is out of range. Note that for the
+ toplevel we see a frame pointer with value NULL which clearly is
+ out of range. */
+ break;
+
+ array[cnt++] = current->return_address;
+
+ current = ADVANCE_STACK_FRAME (current->next);
+ }
+
+ return cnt;
+}
+weak_alias (__backtrace, backtrace)
diff --git a/sysdeps/generic/backtracesyms.c b/sysdeps/generic/backtracesyms.c
new file mode 100644
index 0000000000..db7ba36d0f
--- /dev/null
+++ b/sysdeps/generic/backtracesyms.c
@@ -0,0 +1,58 @@
+/* Return list with names for address in backtrace.
+ Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <execinfo.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* Assume the worst for the width of an address. */
+#define WORD_WIDTH 16
+
+
+char **
+__backtrace_symbols (array, size)
+ void *const *array;
+ int size;
+{
+ int cnt;
+ size_t total = 0;
+ char **result;
+
+ /* We can compute the text size needed for the symbols since we print
+ them all as "[+0x<addr>]". */
+ total = size * (WORD_WIDTH + 6);
+
+ /* Allocate memory for the result. */
+ result = malloc (size * sizeof (char *) + total);
+ if (result != NULL)
+ {
+ char *last = (char *) (result + size);
+
+ for (cnt = 0; cnt < size; ++cnt)
+ {
+ result[cnt] = last;
+ last += 1 + sprintf (last, "[+%p]", array[cnt]);
+ }
+ }
+
+ return result;
+}
+weak_alias (__backtrace_symbols, backtrace_symbols)
diff --git a/sysdeps/generic/backtracesymsfd.c b/sysdeps/generic/backtracesymsfd.c
new file mode 100644
index 0000000000..c704362ec7
--- /dev/null
+++ b/sysdeps/generic/backtracesymsfd.c
@@ -0,0 +1,63 @@
+/* Write formatted list with names for addresses in backtrace to a file.
+ Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <execinfo.h>
+#include <string.h>
+#include <sys/uio.h>
+
+#include <stdio-common/_itoa.h>
+#include <not-cancel.h>
+
+#if __ELF_NATIVE_CLASS == 32
+# define WORD_WIDTH 8
+#else
+/* We assume 64bits. */
+# define WORD_WIDTH 16
+#endif
+
+
+void
+__backtrace_symbols_fd (array, size, fd)
+ void *const *array;
+ int size;
+ int fd;
+{
+ struct iovec iov[3];
+ int cnt;
+
+ for (cnt = 0; cnt < size; ++cnt)
+ {
+ char buf[WORD_WIDTH];
+
+ iov[0].iov_base = (void *) "[0x";
+ iov[0].iov_len = 3;
+
+ iov[1].iov_base = _itoa_word ((unsigned long int) array[cnt],
+ &buf[WORD_WIDTH], 16, 0);
+ iov[1].iov_len = &buf[WORD_WIDTH] - (char *) iov[1].iov_base;
+
+ iov[2].iov_base = (void *) "]\n";
+ iov[2].iov_len = 2;
+
+ /* We prefer to use the non-cancelable interface if it is available. */
+ writev_not_cancel_no_status (fd, iov, 3);
+ }
+}
+weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd)
diff --git a/sysdeps/generic/bb_init_func.c b/sysdeps/generic/bb_init_func.c
new file mode 100644
index 0000000000..19901d8d09
--- /dev/null
+++ b/sysdeps/generic/bb_init_func.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Mosberger (davidm@cs.arizona.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* __bb_init_func is invoked at the beginning of each function, before
+ any registers have been saved. This generic routine should work
+ provided that calling this function doesn't mangle the arguments
+ passed to the function being called. If that's not the case, a
+ system specific routine must be provided. */
+
+#include <sys/types.h>
+#include <sys/gmon.h>
+
+#include <stdlib.h>
+
+void
+__bb_init_func (struct __bb *bb)
+{
+ struct gmonparam *p = &_gmonparam;
+
+ if (bb->zero_word != 0)
+ {
+ return; /* handle common case quickly */
+ }
+
+ /* insert this basic-block into basic-block list: */
+ bb->zero_word = 1;
+ bb->next = __bb_head;
+ __bb_head = bb;
+
+ if (bb->next == 0 && p->state != GMON_PROF_ON)
+ {
+ /* we didn't register _mcleanup yet and pc profiling doesn't seem
+ to be active, so let's register it now: */
+ extern void *__dso_handle __attribute__ ((__weak__));
+ __cxa_atexit ((void (*) (void *)) _mcleanup, NULL,
+ &__dso_handle ? __dso_handle : NULL);
+ }
+}
diff --git a/sysdeps/generic/bcopy.c b/sysdeps/generic/bcopy.c
new file mode 100644
index 0000000000..3f16b884ac
--- /dev/null
+++ b/sysdeps/generic/bcopy.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+#define memmove bcopy
+#define rettype void
+#define RETURN(s) return
+#define a1 src
+#define a1const const
+#define a2 dest
+#define a2const
+
+#include <memmove.c>
diff --git a/sysdeps/generic/bind.c b/sysdeps/generic/bind.c
new file mode 100644
index 0000000000..382e29db16
--- /dev/null
+++ b/sysdeps/generic/bind.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Give the socket FD the local address ADDR (which is LEN bytes long). */
+int
+__bind (fd, addr, len)
+ int fd;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__bind, bind)
+
+stub_warning (bind)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/bits/atomic.h b/sysdeps/generic/bits/atomic.h
new file mode 100644
index 0000000000..6245130a91
--- /dev/null
+++ b/sysdeps/generic/bits/atomic.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_ATOMIC_H
+#define _BITS_ATOMIC_H 1
+
+/* We have by default no support for atomic operations. So define
+ them non-atomic. If this is a problem somebody will have to come
+ up with real definitions. */
+
+/* The only basic operation needed is compare and exchange. */
+#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+ ({ __typeof (mem) __gmemp = (mem); \
+ __typeof (*mem) __gret = *__gmemp; \
+ __typeof (*mem) __gnewval = (newval); \
+ \
+ if (__gret == (oldval)) \
+ *__gmemp = __gnewval; \
+ __gret; })
+
+#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+ ({ __typeof (mem) __gmemp = (mem); \
+ __typeof (*mem) __gnewval = (newval); \
+ \
+ *__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; })
+
+#endif /* bits/atomic.h */
diff --git a/sysdeps/generic/bits/byteswap.h b/sysdeps/generic/bits/byteswap.h
new file mode 100644
index 0000000000..38d8540130
--- /dev/null
+++ b/sysdeps/generic/bits/byteswap.h
@@ -0,0 +1,84 @@
+/* Macros to swap the order of bytes in integer values.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
+
+#ifndef _BITS_BYTESWAP_H
+#define _BITS_BYTESWAP_H 1
+
+/* Swap bytes in 16 bit value. */
+#ifdef __GNUC__
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ unsigned short int __bsx = (x); \
+ ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }))
+#else
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+ return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
+}
+#endif
+
+/* Swap bytes in 32 bit value. */
+#ifdef __GNUC__
+# define __bswap_32(x) \
+ (__extension__ \
+ ({ unsigned int __bsx = (x); \
+ ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | \
+ (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }))
+#else
+static __inline unsigned int
+__bswap_32 (unsigned int __bsx)
+{
+ return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
+ (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
+}
+#endif
+
+#if defined __GNUC__ && __GNUC__ >= 2
+/* Swap bytes in 64 bit value. */
+# define __bswap_constant_64(x) \
+ ((((x) & 0xff00000000000000ull) >> 56) \
+ | (((x) & 0x00ff000000000000ull) >> 40) \
+ | (((x) & 0x0000ff0000000000ull) >> 24) \
+ | (((x) & 0x000000ff00000000ull) >> 8) \
+ | (((x) & 0x00000000ff000000ull) << 8) \
+ | (((x) & 0x0000000000ff0000ull) << 24) \
+ | (((x) & 0x000000000000ff00ull) << 40) \
+ | (((x) & 0x00000000000000ffull) << 56))
+
+# define __bswap_64(x) \
+ (__extension__ \
+ ({ union { __extension__ unsigned long long int __ll; \
+ unsigned int __l[2]; } __w, __r; \
+ if (__builtin_constant_p (x)) \
+ __r.__ll = __bswap_constant_64 (x); \
+ else \
+ { \
+ __w.__ll = (x); \
+ __r.__l[0] = __bswap_32 (__w.__l[1]); \
+ __r.__l[1] = __bswap_32 (__w.__l[0]); \
+ } \
+ __r.__ll; }))
+#endif
+
+#endif /* _BITS_BYTESWAP_H */
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
new file mode 100644
index 0000000000..8947d48ed7
--- /dev/null
+++ b/sysdeps/generic/bits/confname.h
@@ -0,0 +1,601 @@
+/* `sysconf', `pathconf', and `confstr' NAME values. Generic version.
+ Copyright (C) 1993,1995-1998,2000,2001,2003,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UNISTD_H
+# error "Never use <bits/confname.h> directly; include <unistd.h> instead."
+#endif
+
+/* Values for the NAME argument to `pathconf' and `fpathconf'. */
+enum
+ {
+ _PC_LINK_MAX,
+#define _PC_LINK_MAX _PC_LINK_MAX
+ _PC_MAX_CANON,
+#define _PC_MAX_CANON _PC_MAX_CANON
+ _PC_MAX_INPUT,
+#define _PC_MAX_INPUT _PC_MAX_INPUT
+ _PC_NAME_MAX,
+#define _PC_NAME_MAX _PC_NAME_MAX
+ _PC_PATH_MAX,
+#define _PC_PATH_MAX _PC_PATH_MAX
+ _PC_PIPE_BUF,
+#define _PC_PIPE_BUF _PC_PIPE_BUF
+ _PC_CHOWN_RESTRICTED,
+#define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED
+ _PC_NO_TRUNC,
+#define _PC_NO_TRUNC _PC_NO_TRUNC
+ _PC_VDISABLE,
+#define _PC_VDISABLE _PC_VDISABLE
+ _PC_SYNC_IO,
+#define _PC_SYNC_IO _PC_SYNC_IO
+ _PC_ASYNC_IO,
+#define _PC_ASYNC_IO _PC_ASYNC_IO
+ _PC_PRIO_IO,
+#define _PC_PRIO_IO _PC_PRIO_IO
+ _PC_SOCK_MAXBUF,
+#define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF
+ _PC_FILESIZEBITS,
+#define _PC_FILESIZEBITS _PC_FILESIZEBITS
+ _PC_REC_INCR_XFER_SIZE,
+#define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE
+ _PC_REC_MAX_XFER_SIZE,
+#define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE
+ _PC_REC_MIN_XFER_SIZE,
+#define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE
+ _PC_REC_XFER_ALIGN,
+#define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN
+ _PC_ALLOC_SIZE_MIN,
+#define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN
+ _PC_SYMLINK_MAX,
+#define _PC_SYMLINK_MAX _PC_SYMLINK_MAX
+ _PC_2_SYMLINKS
+#define _PC_2_SYMLINKS _PC_2_SYMLINKS
+ };
+
+/* Values for the argument to `sysconf'. */
+enum
+ {
+ _SC_ARG_MAX,
+#define _SC_ARG_MAX _SC_ARG_MAX
+ _SC_CHILD_MAX,
+#define _SC_CHILD_MAX _SC_CHILD_MAX
+ _SC_CLK_TCK,
+#define _SC_CLK_TCK _SC_CLK_TCK
+ _SC_NGROUPS_MAX,
+#define _SC_NGROUPS_MAX _SC_NGROUPS_MAX
+ _SC_OPEN_MAX,
+#define _SC_OPEN_MAX _SC_OPEN_MAX
+ _SC_STREAM_MAX,
+#define _SC_STREAM_MAX _SC_STREAM_MAX
+ _SC_TZNAME_MAX,
+#define _SC_TZNAME_MAX _SC_TZNAME_MAX
+ _SC_JOB_CONTROL,
+#define _SC_JOB_CONTROL _SC_JOB_CONTROL
+ _SC_SAVED_IDS,
+#define _SC_SAVED_IDS _SC_SAVED_IDS
+ _SC_REALTIME_SIGNALS,
+#define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS
+ _SC_PRIORITY_SCHEDULING,
+#define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING
+ _SC_TIMERS,
+#define _SC_TIMERS _SC_TIMERS
+ _SC_ASYNCHRONOUS_IO,
+#define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO
+ _SC_PRIORITIZED_IO,
+#define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO
+ _SC_SYNCHRONIZED_IO,
+#define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO
+ _SC_FSYNC,
+#define _SC_FSYNC _SC_FSYNC
+ _SC_MAPPED_FILES,
+#define _SC_MAPPED_FILES _SC_MAPPED_FILES
+ _SC_MEMLOCK,
+#define _SC_MEMLOCK _SC_MEMLOCK
+ _SC_MEMLOCK_RANGE,
+#define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE
+ _SC_MEMORY_PROTECTION,
+#define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION
+ _SC_MESSAGE_PASSING,
+#define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING
+ _SC_SEMAPHORES,
+#define _SC_SEMAPHORES _SC_SEMAPHORES
+ _SC_SHARED_MEMORY_OBJECTS,
+#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS
+ _SC_AIO_LISTIO_MAX,
+#define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX
+ _SC_AIO_MAX,
+#define _SC_AIO_MAX _SC_AIO_MAX
+ _SC_AIO_PRIO_DELTA_MAX,
+#define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX
+ _SC_DELAYTIMER_MAX,
+#define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX
+ _SC_MQ_OPEN_MAX,
+#define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX
+ _SC_MQ_PRIO_MAX,
+#define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX
+ _SC_VERSION,
+#define _SC_VERSION _SC_VERSION
+ _SC_PAGESIZE,
+#define _SC_PAGESIZE _SC_PAGESIZE
+#define _SC_PAGE_SIZE _SC_PAGESIZE
+ _SC_RTSIG_MAX,
+#define _SC_RTSIG_MAX _SC_RTSIG_MAX
+ _SC_SEM_NSEMS_MAX,
+#define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX
+ _SC_SEM_VALUE_MAX,
+#define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX
+ _SC_SIGQUEUE_MAX,
+#define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX
+ _SC_TIMER_MAX,
+#define _SC_TIMER_MAX _SC_TIMER_MAX
+
+ /* Values for the argument to `sysconf'
+ corresponding to _POSIX2_* symbols. */
+ _SC_BC_BASE_MAX,
+#define _SC_BC_BASE_MAX _SC_BC_BASE_MAX
+ _SC_BC_DIM_MAX,
+#define _SC_BC_DIM_MAX _SC_BC_DIM_MAX
+ _SC_BC_SCALE_MAX,
+#define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX
+ _SC_BC_STRING_MAX,
+#define _SC_BC_STRING_MAX _SC_BC_STRING_MAX
+ _SC_COLL_WEIGHTS_MAX,
+#define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX
+ _SC_EQUIV_CLASS_MAX,
+#define _SC_EQUIV_CLASS_MAX _SC_EQUIV_CLASS_MAX
+ _SC_EXPR_NEST_MAX,
+#define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX
+ _SC_LINE_MAX,
+#define _SC_LINE_MAX _SC_LINE_MAX
+ _SC_RE_DUP_MAX,
+#define _SC_RE_DUP_MAX _SC_RE_DUP_MAX
+ _SC_CHARCLASS_NAME_MAX,
+#define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX
+
+ _SC_2_VERSION,
+#define _SC_2_VERSION _SC_2_VERSION
+ _SC_2_C_BIND,
+#define _SC_2_C_BIND _SC_2_C_BIND
+ _SC_2_C_DEV,
+#define _SC_2_C_DEV _SC_2_C_DEV
+ _SC_2_FORT_DEV,
+#define _SC_2_FORT_DEV _SC_2_FORT_DEV
+ _SC_2_FORT_RUN,
+#define _SC_2_FORT_RUN _SC_2_FORT_RUN
+ _SC_2_SW_DEV,
+#define _SC_2_SW_DEV _SC_2_SW_DEV
+ _SC_2_LOCALEDEF,
+#define _SC_2_LOCALEDEF _SC_2_LOCALEDEF
+
+ _SC_PII,
+#define _SC_PII _SC_PII
+ _SC_PII_XTI,
+#define _SC_PII_XTI _SC_PII_XTI
+ _SC_PII_SOCKET,
+#define _SC_PII_SOCKET _SC_PII_SOCKET
+ _SC_PII_INTERNET,
+#define _SC_PII_INTERNET _SC_PII_INTERNET
+ _SC_PII_OSI,
+#define _SC_PII_OSI _SC_PII_OSI
+ _SC_POLL,
+#define _SC_POLL _SC_POLL
+ _SC_SELECT,
+#define _SC_SELECT _SC_SELECT
+ _SC_UIO_MAXIOV,
+#define _SC_UIO_MAXIOV _SC_UIO_MAXIOV
+ _SC_IOV_MAX = _SC_UIO_MAXIOV,
+#define _SC_IOV_MAX _SC_IOV_MAX
+ _SC_PII_INTERNET_STREAM,
+#define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM
+ _SC_PII_INTERNET_DGRAM,
+#define _SC_PII_INTERNET_DGRAM _SC_PII_INTERNET_DGRAM
+ _SC_PII_OSI_COTS,
+#define _SC_PII_OSI_COTS _SC_PII_OSI_COTS
+ _SC_PII_OSI_CLTS,
+#define _SC_PII_OSI_CLTS _SC_PII_OSI_CLTS
+ _SC_PII_OSI_M,
+#define _SC_PII_OSI_M _SC_PII_OSI_M
+ _SC_T_IOV_MAX,
+#define _SC_T_IOV_MAX _SC_T_IOV_MAX
+
+ /* Values according to POSIX 1003.1c (POSIX threads). */
+ _SC_THREADS,
+#define _SC_THREADS _SC_THREADS
+ _SC_THREAD_SAFE_FUNCTIONS,
+#define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS
+ _SC_GETGR_R_SIZE_MAX,
+#define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX
+ _SC_GETPW_R_SIZE_MAX,
+#define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX
+ _SC_LOGIN_NAME_MAX,
+#define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX
+ _SC_TTY_NAME_MAX,
+#define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX
+ _SC_THREAD_DESTRUCTOR_ITERATIONS,
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS
+ _SC_THREAD_KEYS_MAX,
+#define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX
+ _SC_THREAD_STACK_MIN,
+#define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN
+ _SC_THREAD_THREADS_MAX,
+#define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX
+ _SC_THREAD_ATTR_STACKADDR,
+#define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR
+ _SC_THREAD_ATTR_STACKSIZE,
+#define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE
+ _SC_THREAD_PRIORITY_SCHEDULING,
+#define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING
+ _SC_THREAD_PRIO_INHERIT,
+#define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT
+ _SC_THREAD_PRIO_PROTECT,
+#define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT
+ _SC_THREAD_PROCESS_SHARED,
+#define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED
+
+ _SC_NPROCESSORS_CONF,
+#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF
+ _SC_NPROCESSORS_ONLN,
+#define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN
+ _SC_PHYS_PAGES,
+#define _SC_PHYS_PAGES _SC_PHYS_PAGES
+ _SC_AVPHYS_PAGES,
+#define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES
+ _SC_ATEXIT_MAX,
+#define _SC_ATEXIT_MAX _SC_ATEXIT_MAX
+ _SC_PASS_MAX,
+#define _SC_PASS_MAX _SC_PASS_MAX
+
+ _SC_XOPEN_VERSION,
+#define _SC_XOPEN_VERSION _SC_XOPEN_VERSION
+ _SC_XOPEN_XCU_VERSION,
+#define _SC_XOPEN_XCU_VERSION _SC_XOPEN_XCU_VERSION
+ _SC_XOPEN_UNIX,
+#define _SC_XOPEN_UNIX _SC_XOPEN_UNIX
+ _SC_XOPEN_CRYPT,
+#define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT
+ _SC_XOPEN_ENH_I18N,
+#define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N
+ _SC_XOPEN_SHM,
+#define _SC_XOPEN_SHM _SC_XOPEN_SHM
+
+ _SC_2_CHAR_TERM,
+#define _SC_2_CHAR_TERM _SC_2_CHAR_TERM
+ _SC_2_C_VERSION,
+#define _SC_2_C_VERSION _SC_2_C_VERSION
+ _SC_2_UPE,
+#define _SC_2_UPE _SC_2_UPE
+
+ _SC_XOPEN_XPG2,
+#define _SC_XOPEN_XPG2 _SC_XOPEN_XPG2
+ _SC_XOPEN_XPG3,
+#define _SC_XOPEN_XPG3 _SC_XOPEN_XPG3
+ _SC_XOPEN_XPG4,
+#define _SC_XOPEN_XPG4 _SC_XOPEN_XPG4
+
+ _SC_CHAR_BIT,
+#define _SC_CHAR_BIT _SC_CHAR_BIT
+ _SC_CHAR_MAX,
+#define _SC_CHAR_MAX _SC_CHAR_MAX
+ _SC_CHAR_MIN,
+#define _SC_CHAR_MIN _SC_CHAR_MIN
+ _SC_INT_MAX,
+#define _SC_INT_MAX _SC_INT_MAX
+ _SC_INT_MIN,
+#define _SC_INT_MIN _SC_INT_MIN
+ _SC_LONG_BIT,
+#define _SC_LONG_BIT _SC_LONG_BIT
+ _SC_WORD_BIT,
+#define _SC_WORD_BIT _SC_WORD_BIT
+ _SC_MB_LEN_MAX,
+#define _SC_MB_LEN_MAX _SC_MB_LEN_MAX
+ _SC_NZERO,
+#define _SC_NZERO _SC_NZERO
+ _SC_SSIZE_MAX,
+#define _SC_SSIZE_MAX _SC_SSIZE_MAX
+ _SC_SCHAR_MAX,
+#define _SC_SCHAR_MAX _SC_SCHAR_MAX
+ _SC_SCHAR_MIN,
+#define _SC_SCHAR_MIN _SC_SCHAR_MIN
+ _SC_SHRT_MAX,
+#define _SC_SHRT_MAX _SC_SHRT_MAX
+ _SC_SHRT_MIN,
+#define _SC_SHRT_MIN _SC_SHRT_MIN
+ _SC_UCHAR_MAX,
+#define _SC_UCHAR_MAX _SC_UCHAR_MAX
+ _SC_UINT_MAX,
+#define _SC_UINT_MAX _SC_UINT_MAX
+ _SC_ULONG_MAX,
+#define _SC_ULONG_MAX _SC_ULONG_MAX
+ _SC_USHRT_MAX,
+#define _SC_USHRT_MAX _SC_USHRT_MAX
+
+ _SC_NL_ARGMAX,
+#define _SC_NL_ARGMAX _SC_NL_ARGMAX
+ _SC_NL_LANGMAX,
+#define _SC_NL_LANGMAX _SC_NL_LANGMAX
+ _SC_NL_MSGMAX,
+#define _SC_NL_MSGMAX _SC_NL_MSGMAX
+ _SC_NL_NMAX,
+#define _SC_NL_NMAX _SC_NL_NMAX
+ _SC_NL_SETMAX,
+#define _SC_NL_SETMAX _SC_NL_SETMAX
+ _SC_NL_TEXTMAX,
+#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX
+
+ _SC_XBS5_ILP32_OFF32,
+#define _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFF32
+ _SC_XBS5_ILP32_OFFBIG,
+#define _SC_XBS5_ILP32_OFFBIG _SC_XBS5_ILP32_OFFBIG
+ _SC_XBS5_LP64_OFF64,
+#define _SC_XBS5_LP64_OFF64 _SC_XBS5_LP64_OFF64
+ _SC_XBS5_LPBIG_OFFBIG,
+#define _SC_XBS5_LPBIG_OFFBIG _SC_XBS5_LPBIG_OFFBIG
+
+ _SC_XOPEN_LEGACY,
+#define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY
+ _SC_XOPEN_REALTIME,
+#define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME
+ _SC_XOPEN_REALTIME_THREADS,
+#define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS
+
+ _SC_ADVISORY_INFO,
+#define _SC_ADVISORY_INFO _SC_ADVISORY_INFO
+ _SC_BARRIERS,
+#define _SC_BARRIERS _SC_BARRIERS
+ _SC_BASE,
+#define _SC_BASE _SC_BASE
+ _SC_C_LANG_SUPPORT,
+#define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT
+ _SC_C_LANG_SUPPORT_R,
+#define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R
+ _SC_CLOCK_SELECTION,
+#define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION
+ _SC_CPUTIME,
+#define _SC_CPUTIME _SC_CPUTIME
+ _SC_THREAD_CPUTIME,
+#define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME
+ _SC_DEVICE_IO,
+#define _SC_DEVICE_IO _SC_DEVICE_IO
+ _SC_DEVICE_SPECIFIC,
+#define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC
+ _SC_DEVICE_SPECIFIC_R,
+#define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R
+ _SC_FD_MGMT,
+#define _SC_FD_MGMT _SC_FD_MGMT
+ _SC_FIFO,
+#define _SC_FIFO _SC_FIFO
+ _SC_PIPE,
+#define _SC_PIPE _SC_PIPE
+ _SC_FILE_ATTRIBUTES,
+#define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES
+ _SC_FILE_LOCKING,
+#define _SC_FILE_LOCKING _SC_FILE_LOCKING
+ _SC_FILE_SYSTEM,
+#define _SC_FILE_SYSTEM _SC_FILE_SYSTEM
+ _SC_MONOTONIC_CLOCK,
+#define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK
+ _SC_MULTI_PROCESS,
+#define _SC_MULTI_PROCESS _SC_MULTI_PROCESS
+ _SC_SINGLE_PROCESS,
+#define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS
+ _SC_NETWORKING,
+#define _SC_NETWORKING _SC_NETWORKING
+ _SC_READER_WRITER_LOCKS,
+#define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS
+ _SC_SPIN_LOCKS,
+#define _SC_SPIN_LOCKS _SC_SPIN_LOCKS
+ _SC_REGEXP,
+#define _SC_REGEXP _SC_REGEXP
+ _SC_REGEX_VERSION,
+#define _SC_REGEX_VERSION _SC_REGEX_VERSION
+ _SC_SHELL,
+#define _SC_SHELL _SC_SHELL
+ _SC_SIGNALS,
+#define _SC_SIGNALS _SC_SIGNALS
+ _SC_SPAWN,
+#define _SC_SPAWN _SC_SPAWN
+ _SC_SPORADIC_SERVER,
+#define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER
+ _SC_THREAD_SPORADIC_SERVER,
+#define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER
+ _SC_SYSTEM_DATABASE,
+#define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE
+ _SC_SYSTEM_DATABASE_R,
+#define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R
+ _SC_TIMEOUTS,
+#define _SC_TIMEOUTS _SC_TIMEOUTS
+ _SC_TYPED_MEMORY_OBJECTS,
+#define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS
+ _SC_USER_GROUPS,
+#define _SC_USER_GROUPS _SC_USER_GROUPS
+ _SC_USER_GROUPS_R,
+#define _SC_USER_GROUPS_R _SC_USER_GROUPS_R
+ _SC_2_PBS,
+#define _SC_2_PBS _SC_2_PBS
+ _SC_2_PBS_ACCOUNTING,
+#define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING
+ _SC_2_PBS_LOCATE,
+#define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE
+ _SC_2_PBS_MESSAGE,
+#define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE
+ _SC_2_PBS_TRACK,
+#define _SC_2_PBS_TRACK _SC_2_PBS_TRACK
+ _SC_SYMLOOP_MAX,
+#define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX
+ _SC_STREAMS,
+#define _SC_STREAMS _SC_STREAMS
+ _SC_2_PBS_CHECKPOINT,
+#define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT
+
+ _SC_V6_ILP32_OFF32,
+#define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32
+ _SC_V6_ILP32_OFFBIG,
+#define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG
+ _SC_V6_LP64_OFF64,
+#define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64
+ _SC_V6_LPBIG_OFFBIG,
+#define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG
+
+ _SC_HOST_NAME_MAX,
+#define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX
+ _SC_TRACE,
+#define _SC_TRACE _SC_TRACE
+ _SC_TRACE_EVENT_FILTER,
+#define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER
+ _SC_TRACE_INHERIT,
+#define _SC_TRACE_INHERIT _SC_TRACE_INHERIT
+ _SC_TRACE_LOG,
+#define _SC_TRACE_LOG _SC_TRACE_LOG
+
+ _SC_LEVEL1_ICACHE_SIZE,
+#define _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_SIZE
+ _SC_LEVEL1_ICACHE_ASSOC,
+#define _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_ASSOC
+ _SC_LEVEL1_ICACHE_LINESIZE,
+#define _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_ICACHE_LINESIZE
+ _SC_LEVEL1_DCACHE_SIZE,
+#define _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_SIZE
+ _SC_LEVEL1_DCACHE_ASSOC,
+#define _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_ASSOC
+ _SC_LEVEL1_DCACHE_LINESIZE,
+#define _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL1_DCACHE_LINESIZE
+ _SC_LEVEL2_CACHE_SIZE,
+#define _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_SIZE
+ _SC_LEVEL2_CACHE_ASSOC,
+#define _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_ASSOC
+ _SC_LEVEL2_CACHE_LINESIZE,
+#define _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL2_CACHE_LINESIZE
+ _SC_LEVEL3_CACHE_SIZE,
+#define _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_SIZE
+ _SC_LEVEL3_CACHE_ASSOC,
+#define _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_ASSOC
+ _SC_LEVEL3_CACHE_LINESIZE,
+#define _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL3_CACHE_LINESIZE
+ _SC_LEVEL4_CACHE_SIZE,
+#define _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_SIZE
+ _SC_LEVEL4_CACHE_ASSOC,
+#define _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_ASSOC
+ _SC_LEVEL4_CACHE_LINESIZE,
+#define _SC_LEVEL4_CACHE_LINESIZE _SC_LEVEL4_CACHE_LINESIZE
+ /* Leave room here, maybe we need a few more cache levels some day. */
+
+ _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
+#define _SC_IPV6 _SC_IPV6
+ _SC_RAW_SOCKETS
+#define _SC_RAW_SOCKETS _SC_RAW_SOCKETS
+ };
+
+/* Values for the NAME argument to `confstr'. */
+enum
+ {
+ _CS_PATH, /* The default search path. */
+#define _CS_PATH _CS_PATH
+
+ _CS_V6_WIDTH_RESTRICTED_ENVS,
+# define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS
+
+ _CS_GNU_LIBC_VERSION,
+#define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION
+ _CS_GNU_LIBPTHREAD_VERSION,
+#define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION
+
+ _CS_LFS_CFLAGS = 1000,
+#define _CS_LFS_CFLAGS _CS_LFS_CFLAGS
+ _CS_LFS_LDFLAGS,
+#define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS
+ _CS_LFS_LIBS,
+#define _CS_LFS_LIBS _CS_LFS_LIBS
+ _CS_LFS_LINTFLAGS,
+#define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS
+ _CS_LFS64_CFLAGS,
+#define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS
+ _CS_LFS64_LDFLAGS,
+#define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS
+ _CS_LFS64_LIBS,
+#define _CS_LFS64_LIBS _CS_LFS64_LIBS
+ _CS_LFS64_LINTFLAGS,
+#define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS
+
+ _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
+#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS
+ _CS_XBS5_ILP32_OFF32_LDFLAGS,
+#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS
+ _CS_XBS5_ILP32_OFF32_LIBS,
+#define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS
+ _CS_XBS5_ILP32_OFF32_LINTFLAGS,
+#define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS
+ _CS_XBS5_ILP32_OFFBIG_CFLAGS,
+#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
+#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LIBS,
+#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS
+ _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
+#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+ _CS_XBS5_LP64_OFF64_CFLAGS,
+#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS
+ _CS_XBS5_LP64_OFF64_LDFLAGS,
+#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS
+ _CS_XBS5_LP64_OFF64_LIBS,
+#define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS
+ _CS_XBS5_LP64_OFF64_LINTFLAGS,
+#define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
+#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
+#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LIBS,
+#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS
+ _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
+#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+
+ _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
+#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS
+ _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
+#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+ _CS_POSIX_V6_ILP32_OFF32_LIBS,
+#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS
+ _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
+#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
+ _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
+#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+ _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
+#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+ _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
+#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS
+ _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
+#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
+ _CS_POSIX_V6_LP64_OFF64_CFLAGS,
+#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS
+ _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
+#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS
+ _CS_POSIX_V6_LP64_OFF64_LIBS,
+#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS
+ _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
+#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
+ _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
+#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+ _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+ _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+ _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+ };
diff --git a/sysdeps/generic/bits/dirent.h b/sysdeps/generic/bits/dirent.h
new file mode 100644
index 0000000000..3407ebd802
--- /dev/null
+++ b/sysdeps/generic/bits/dirent.h
@@ -0,0 +1,37 @@
+/* Directory entry structure `struct dirent'. Stub version.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
+struct dirent
+ {
+ char d_name[1]; /* Variable length. */
+ int d_fileno;
+ };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+ {
+ char d_name[1]; /* Variable length. */
+ int d_fileno;
+ };
+#endif
+
diff --git a/sysdeps/generic/bits/dlfcn.h b/sysdeps/generic/bits/dlfcn.h
new file mode 100644
index 0000000000..67fd96a22a
--- /dev/null
+++ b/sysdeps/generic/bits/dlfcn.h
@@ -0,0 +1,65 @@
+/* System dependent definitions for run-time dynamic loading.
+ Copyright (C) 1996-2001, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DLFCN_H
+# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
+#endif
+
+/* The MODE argument to `dlopen' contains one of the following: */
+#define RTLD_LAZY 0x00001 /* Lazy function call binding. */
+#define RTLD_NOW 0x00002 /* Immediate function call binding. */
+#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
+#define RTLD_NOLOAD 0x00004 /* Do not load the object. */
+#define RTLD_DEEPBIND 0x00008 /* Use deep binding. */
+
+/* If the following bit is set in the MODE argument to `dlopen',
+ the symbols of the loaded object and its dependencies are made
+ visible as if the object were linked directly into the program. */
+#define RTLD_GLOBAL 0x00100
+
+/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
+ The implementation does this by default and so we can define the
+ value to zero. */
+#define RTLD_LOCAL 0
+
+/* Do not delete object when closed. */
+#define RTLD_NODELETE 0x01000
+
+#ifdef __USE_GNU
+/* To support profiling of shared objects it is a good idea to call
+ the function found using `dlsym' using the following macro since
+ these calls do not use the PLT. But this would mean the dynamic
+ loader has no chance to find out when the function is called. The
+ macro applies the necessary magic so that profiling is possible.
+ Rewrite
+ foo = (*fctp) (arg1, arg2);
+ into
+ foo = DL_CALL_FCT (fctp, (arg1, arg2));
+*/
+# define DL_CALL_FCT(fctp, args) \
+ (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args)
+
+__BEGIN_DECLS
+
+/* This function calls the profiling functions. */
+extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW;
+
+__END_DECLS
+
+#endif
diff --git a/sysdeps/generic/bits/elfclass.h b/sysdeps/generic/bits/elfclass.h
new file mode 100644
index 0000000000..180227d9e7
--- /dev/null
+++ b/sysdeps/generic/bits/elfclass.h
@@ -0,0 +1,14 @@
+/* This file specifies the native word size of the machine, which indicates
+ the ELF file class used for executables and shared objects on this
+ machine. */
+
+#ifndef _LINK_H
+# error "Never use <bits/elfclass.h> directly; include <link.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#define __ELF_NATIVE_CLASS __WORDSIZE
+
+/* The entries in the .hash table always have a size of 32 bits. */
+typedef uint32_t Elf_Symndx;
diff --git a/sysdeps/generic/bits/endian.h b/sysdeps/generic/bits/endian.h
new file mode 100644
index 0000000000..45afd4ae47
--- /dev/null
+++ b/sysdeps/generic/bits/endian.h
@@ -0,0 +1,13 @@
+/* This file should define __BYTE_ORDER as appropriate for the machine
+ in question. See string/endian.h for how to define it.
+
+ If only the stub bits/endian.h applies to a particular configuration,
+ bytesex.h is generated by running a program on the host machine.
+ So if cross-compiling to a machine with a different byte order,
+ the bits/endian.h file for that machine must exist. */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#error Machine byte order unknown.
diff --git a/sysdeps/generic/bits/environments.h b/sysdeps/generic/bits/environments.h
new file mode 100644
index 0000000000..4617dc45f2
--- /dev/null
+++ b/sysdeps/generic/bits/environments.h
@@ -0,0 +1,78 @@
+/* Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly. Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+ situations. A value `1' means that the model is always supported,
+ `-1' means it is never supported. Undefined means it cannot be
+ statically decided.
+
+ _POSIX_V6_ILP32_OFF32 32bit int, long, pointers, and off_t type
+ _POSIX_V6_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type
+
+ _POSIX_V6_LP64_OFF32 64bit long and pointers and 32bit off_t type
+ _POSIX_V6_LPBIG_OFFBIG 64bit long and pointers and large off_t type
+
+ The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+ _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+ and are available only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* We can never provide environments with 32-bit wide pointers. */
+# define _POSIX_V6_ILP32_OFF32 -1
+# define _POSIX_V6_ILP32_OFFBIG -1
+# define _XBS5_ILP32_OFF32 -1
+# define _XBS5_ILP32_OFFBIG -1
+/* We also have no use (for now) for an environment with bigger pointers
+ and offsets. */
+# define _POSIX_V6_LPBIG_OFFBIG -1
+# define _XBS5_LPBIG_OFFBIG -1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'. */
+# define _POSIX_V6_LP64_OFF64 1
+# define _XBS5_LP64_OFF64 1
+
+#else /* __WORDSIZE == 32 */
+
+/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
+ and all platforms support LFS. */
+# define _POSIX_V6_ILP32_OFF32 1
+# define _POSIX_V6_ILP32_OFFBIG 1
+# define _XBS5_ILP32_OFF32 1
+# define _XBS5_ILP32_OFFBIG 1
+
+/* We optionally provide an environment with the above size but an 64-bit
+ side `off_t'. Therefore we don't define _XBS5_ILP32_OFFBIG. */
+
+/* We can never provide environments with 64-bit wide pointers. */
+# define _POSIX_V6_LP64_OFF64 -1
+# define _POSIX_V6_LPBIG_OFFBIG -1
+# define _XBS5_LP64_OFF64 -1
+# define _XBS5_LPBIG_OFFBIG -1
+
+/* CFLAGS. */
+#define __ILP32_OFFBIG_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
+#endif /* __WORDSIZE == 32 */
diff --git a/sysdeps/generic/bits/errno.h b/sysdeps/generic/bits/errno.h
new file mode 100644
index 0000000000..89a5cfddeb
--- /dev/null
+++ b/sysdeps/generic/bits/errno.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1994, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This file defines the `errno' constants. */
+
+#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
+#undef __need_Emath
+#define __Emath_defined 1
+
+# define EDOM XXX <--- fill in what is actually needed
+# define EILSEQ XXX <--- fill in what is actually needed
+# define ERANGE XXX <--- fill in what is actually needed
+#endif
+
+#ifdef _ERRNO_H
+# error "Define here all the missing error messages for the port. These"
+# error "must match the numbers of the kernel."
+# define Exxxx XXX
+...
+#endif
diff --git a/sysdeps/generic/bits/fcntl.h b/sysdeps/generic/bits/fcntl.h
new file mode 100644
index 0000000000..b397f812f1
--- /dev/null
+++ b/sysdeps/generic/bits/fcntl.h
@@ -0,0 +1,95 @@
+/* O_*, F_*, FD_* bit values for stub configuration.
+ Copyright (C) 1991, 1992, 1997, 2000, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* These values should be changed as appropriate for your system. */
+
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+/* File access modes for `open' and `fcntl'. */
+#define O_RDONLY 0 /* Open read-only. */
+#define O_WRONLY 1 /* Open write-only. */
+#define O_RDWR 2 /* Open read/write. */
+
+
+/* Bits OR'd into the second argument to open. */
+#define O_CREAT 0x0200 /* Create file if it doesn't exist. */
+#define O_EXCL 0x0800 /* Fail if file already exists. */
+#define O_TRUNC 0x0400 /* Truncate file to zero length. */
+#define O_NOCTTY 0x0100 /* Don't assign a controlling terminal. */
+
+/* File status flags for `open' and `fcntl'. */
+#define O_APPEND 0x0008 /* Writes append to the file. */
+#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */
+
+#ifdef __USE_BSD
+# define O_NDELAY O_NONBLOCK
+#endif
+
+/* Mask for file access modes. This is system-dependent in case
+ some system ever wants to define some other flavor of access. */
+#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#if defined __USE_BSD || defined __USE_UNIX98
+# define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
+# define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
+#endif
+#define F_GETLK 7 /* Get record locking info. */
+#define F_SETLK 8 /* Set record locking info. */
+#define F_SETLKW 9 /* Set record locking info, wait. */
+
+/* File descriptor flags used with F_GETFD and F_SETFD. */
+#define FD_CLOEXEC 1 /* Close on exec. */
+
+
+#include <bits/types.h>
+
+/* The structure describing an advisory lock. This is the type of the third
+ argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
+struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+
+/* Values for the `l_type' field of a `struct flock'. */
+#define F_RDLCK 1 /* Read lock. */
+#define F_WRLCK 2 /* Write lock. */
+#define F_UNLCK 3 /* Remove lock. */
+
+/* Advise to `posix_fadvise'. */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
+#endif
diff --git a/sysdeps/generic/bits/fenv.h b/sysdeps/generic/bits/fenv.h
new file mode 100644
index 0000000000..a9cb53b40e
--- /dev/null
+++ b/sysdeps/generic/bits/fenv.h
@@ -0,0 +1,56 @@
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+
+/* Here should be the exception be defined:
+ FE_INVALID
+ FE_DIVBYZERO
+ FE_OVERFLOW
+ FE_UNDERFLOW
+ FE_INEXACT
+ We define no macro which signals no exception is supported. */
+
+#define FE_ALL_EXCEPT 0
+
+
+/* Here should the rounding modes be defined:
+ FE_TONEAREST
+ FE_DOWNWARD
+ FE_UPWARD
+ FE_TOWARDZERO
+ We define no macro which signals no rounding mode is selectable. */
+
+
+/* Type representing exception flags. */
+typedef unsigned int fexcept_t;
+
+
+/* Type representing floating-point environment. */
+typedef struct
+ {
+ fexcept_t __excepts;
+ /* XXX I don't know what else we should save. */
+ }
+fenv_t;
+
+/* If the default argument is used we use this value. */
+#define FE_DFL_ENV ((__const fenv_t *) -1l)
diff --git a/sysdeps/generic/bits/fenvinline.h b/sysdeps/generic/bits/fenvinline.h
new file mode 100644
index 0000000000..42f77b5618
--- /dev/null
+++ b/sysdeps/generic/bits/fenvinline.h
@@ -0,0 +1,8 @@
+/* This file provides inline versions of floating-pint environment
+ handling functions. If there were any. */
+
+#ifndef __NO_MATH_INLINES
+
+/* Here is where the code would go. */
+
+#endif
diff --git a/sysdeps/generic/bits/huge_val.h b/sysdeps/generic/bits/huge_val.h
new file mode 100644
index 0000000000..e102ac3220
--- /dev/null
+++ b/sysdeps/generic/bits/huge_val.h
@@ -0,0 +1,29 @@
+/* Stub `HUGE_VAL' constant.
+ Used by <stdlib.h> and <math.h> functions for overflow.
+ Copyright (C) 1992, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
+#if __GNUC_PREREQ(3,3)
+# define HUGE_VAL (__builtin_huge_val())
+#else
+# define HUGE_VAL 1e37
+#endif
diff --git a/sysdeps/generic/bits/huge_valf.h b/sysdeps/generic/bits/huge_valf.h
new file mode 100644
index 0000000000..4cb5ebdfcb
--- /dev/null
+++ b/sysdeps/generic/bits/huge_valf.h
@@ -0,0 +1,29 @@
+/* Stub `HUGE_VALF' constant.
+ Used by <stdlib.h> and <math.h> functions for overflow.
+ Copyright (C) 1992, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/huge_valf.h> directly; include <math.h> instead."
+#endif
+
+#if __GNUC_PREREQ(3,3)
+# define HUGE_VALF (__builtin_huge_valf())
+#else
+# define HUGE_VALF 1e37f
+#endif
diff --git a/sysdeps/generic/bits/huge_vall.h b/sysdeps/generic/bits/huge_vall.h
new file mode 100644
index 0000000000..d5e8e2237b
--- /dev/null
+++ b/sysdeps/generic/bits/huge_vall.h
@@ -0,0 +1,29 @@
+/* Default `HUGE_VALL' constant.
+ Used by <stdlib.h> and <math.h> functions for overflow.
+ Copyright (C) 1992, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/huge_vall.h> directly; include <math.h> instead."
+#endif
+
+#if __GNUC_PREREQ(3,3)
+# define HUGE_VALL (__builtin_huge_vall())
+#else
+# define HUGE_VALL ((long double) HUGE_VAL)
+#endif
diff --git a/sysdeps/generic/bits/in.h b/sysdeps/generic/bits/in.h
new file mode 100644
index 0000000000..31eb0f9fcf
--- /dev/null
+++ b/sysdeps/generic/bits/in.h
@@ -0,0 +1,82 @@
+/* Copyright (C) 1997, 2000, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Generic version. */
+
+#ifndef _NETINET_IN_H
+# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
+#endif
+
+/* Options for use with `getsockopt' and `setsockopt' at the IP level.
+ The first word in the comment at the right is the data type used;
+ "bool" means a boolean value stored in an `int'. */
+#define IP_OPTIONS 1 /* ip_opts; IP per-packet options. */
+#define IP_HDRINCL 2 /* int; Header is included with data. */
+#define IP_TOS 3 /* int; IP type of service and precedence. */
+#define IP_TTL 4 /* int; IP time to live. */
+#define IP_RECVOPTS 5 /* bool; Receive all IP options w/datagram. */
+#define IP_RECVRETOPTS 6 /* bool; Receive IP options for response. */
+#define IP_RECVDSTADDR 7 /* bool; Receive IP dst addr w/datagram. */
+#define IP_RETOPTS 8 /* ip_opts; Set/get IP per-packet options. */
+#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
+#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
+#define IP_MULTICAST_LOOP 11 /* i_char; set/get IP multicast loopback */
+#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
+#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
+
+/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
+ The `ip_dst' field is used for the first-hop gateway when using a
+ source route (this gets put into the header proper). */
+struct ip_opts
+ {
+ struct in_addr ip_dst; /* First hop; zero without source route. */
+ char ip_opts[40]; /* Actually variable in size. */
+ };
+
+/* IPV6 socket options. */
+#define IPV6_ADDRFORM 1
+#define IPV6_RXINFO 2
+#define IPV6_HOPOPTS 3
+#define IPV6_DSTOPTS 4
+#define IPV6_RTHDR 5
+#define IPV6_PKTOPTIONS 6
+#define IPV6_CHECKSUM 7
+#define IPV6_HOPLIMIT 8
+
+#define IPV6_TXINFO IPV6_RXINFO
+#define SCM_SRCINFO IPV6_TXINFO
+#define SCM_SRCRT IPV6_RXSRCRT
+
+#define IPV6_UNICAST_HOPS 16
+#define IPV6_MULTICAST_IF 17
+#define IPV6_MULTICAST_HOPS 18
+#define IPV6_MULTICAST_LOOP 19
+#define IPV6_JOIN_GROUP 20
+#define IPV6_LEAVE_GROUP 21
+
+/* Obsolete synonyms for the above. */
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+#define IPV6_RXHOPOPTS IPV6_HOPOPTS
+#define IPV6_RXDSTOPTS IPV6_DSTOPTS
+
+/* Routing header options for IPv6. */
+#define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */
+#define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */
+
+#define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */
diff --git a/sysdeps/generic/bits/inf.h b/sysdeps/generic/bits/inf.h
new file mode 100644
index 0000000000..2d526adb23
--- /dev/null
+++ b/sysdeps/generic/bits/inf.h
@@ -0,0 +1,33 @@
+/* Default `INFINITY' constant.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/inf.h> directly; include <math.h> instead."
+#endif
+
+/* If we don't have real infinity, then we're supposed to produce a float
+ value that overflows at translation time, which is required to produce
+ a diagnostic. GCC's __builtin_inff produces a quite nice diagnostic
+ that tells the user that the target doesn't support infinities. */
+
+#if __GNUC_PREREQ(3,3)
+# define INFINITY (__builtin_inff())
+#else
+# define INFINITY (1e9999f)
+#endif
diff --git a/sysdeps/generic/bits/ioctl-types.h b/sysdeps/generic/bits/ioctl-types.h
new file mode 100644
index 0000000000..58b78a6af3
--- /dev/null
+++ b/sysdeps/generic/bits/ioctl-types.h
@@ -0,0 +1,114 @@
+/* Structure types for pre-termios terminal ioctls. Generic Unix version.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+#if defined TIOCGETC || defined TIOCSETC
+/* Type of ARG for TIOCGETC and TIOCSETC requests. */
+struct tchars
+{
+ char t_intrc; /* Interrupt character. */
+ char t_quitc; /* Quit character. */
+ char t_startc; /* Start-output character. */
+ char t_stopc; /* Stop-output character. */
+ char t_eofc; /* End-of-file character. */
+ char t_brkc; /* Input delimiter character. */
+};
+
+#define _IOT_tchars /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (char), 6, 0, 0, 0, 0)
+#endif
+
+#if defined TIOCGLTC || defined TIOCSLTC
+/* Type of ARG for TIOCGLTC and TIOCSLTC requests. */
+struct ltchars
+{
+ char t_suspc; /* Suspend character. */
+ char t_dsuspc; /* Delayed suspend character. */
+ char t_rprntc; /* Reprint-line character. */
+ char t_flushc; /* Flush-output character. */
+ char t_werasc; /* Word-erase character. */
+ char t_lnextc; /* Literal-next character. */
+};
+
+#define _IOT_ltchars /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (char), 6, 0, 0, 0, 0)
+#endif
+
+/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty). */
+struct sgttyb
+{
+ char sg_ispeed; /* Input speed. */
+ char sg_ospeed; /* Output speed. */
+ char sg_erase; /* Erase character. */
+ char sg_kill; /* Kill character. */
+ short int sg_flags; /* Mode flags. */
+};
+
+#define _IOT_sgttyb /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0)
+
+#if defined TIOCGWINSZ || defined TIOCSWINSZ
+/* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests. */
+struct winsize
+{
+ unsigned short int ws_row; /* Rows, in characters. */
+ unsigned short int ws_col; /* Columns, in characters. */
+
+ /* These are not actually used. */
+ unsigned short int ws_xpixel; /* Horizontal pixels. */
+ unsigned short int ws_ypixel; /* Vertical pixels. */
+};
+
+#define _IOT_winsize /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
+#endif
+
+#if defined TIOCGSIZE || defined TIOCSSIZE
+/* The BSD-style ioctl constructor macros use `sizeof', which can't be used
+ in a preprocessor conditional. Since the commands are always unique
+ regardless of the size bits, we can safely define away `sizeof' for the
+ purpose of the conditional. */
+# define sizeof(type) 0
+# if defined TIOCGWINSZ && TIOCGSIZE == TIOCGWINSZ
+/* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
+ compatibility with Sun; they define `struct ttysize' to have identical
+ layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
+ (likewise TIOCSSIZE and TIOCSWINSZ). */
+struct ttysize
+{
+ unsigned short int ts_lines;
+ unsigned short int ts_cols;
+ unsigned short int ts_xxx;
+ unsigned short int ts_yyy;
+};
+#define _IOT_ttysize _IOT_winsize
+# else
+/* Suns use a different layout for `struct ttysize', and TIOCGSIZE and
+ TIOCGWINSZ are separate commands that do the same thing with different
+ structures (likewise TIOCSSIZE and TIOCSWINSZ). */
+struct ttysize
+{
+ int ts_lines, ts_cols; /* Lines and columns, in characters. */
+};
+# endif
+# undef sizeof /* See above. */
+#endif
diff --git a/sysdeps/generic/bits/ioctls.h b/sysdeps/generic/bits/ioctls.h
new file mode 100644
index 0000000000..d3ecad9515
--- /dev/null
+++ b/sysdeps/generic/bits/ioctls.h
@@ -0,0 +1,5 @@
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+/* This space intentionally left blank. */
diff --git a/sysdeps/generic/bits/ipc.h b/sysdeps/generic/bits/ipc.h
new file mode 100644
index 0000000000..5ba227d36b
--- /dev/null
+++ b/sysdeps/generic/bits/ipc.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'. */
+#define IPC_CREAT 01000 /* create key if key does not exist */
+#define IPC_EXCL 02000 /* fail if key exists */
+#define IPC_NOWAIT 04000 /* return error on wait */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'. */
+#define IPC_RMID 0 /* remove identifier */
+#define IPC_SET 1 /* set `ipc_perm' options */
+#define IPC_STAT 2 /* get `ipc_perm' options */
+
+/* Special key values. */
+#define IPC_PRIVATE ((key_t) 0) /* private key */
+
+
+/* Data structure used to pass permission information to IPC operations. */
+struct ipc_perm
+ {
+ __uid_t uid; /* owner's user ID */
+ __gid_t gid; /* owner's group ID */
+ __uid_t cuid; /* creator's user ID */
+ __gid_t cgid; /* creator's group ID */
+ __mode_t mode; /* read/write permission */
+ };
diff --git a/sysdeps/generic/bits/ipctypes.h b/sysdeps/generic/bits/ipctypes.h
new file mode 100644
index 0000000000..b88ca1d87b
--- /dev/null
+++ b/sysdeps/generic/bits/ipctypes.h
@@ -0,0 +1,37 @@
+/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. Generic.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Never include <bits/ipctypes.h> directly.
+ */
+
+#ifndef _BITS_IPCTYPES_H
+#define _BITS_IPCTYPES_H 1
+
+#include <bits/types.h>
+
+/* Used in `struct shmid_ds'. */
+# if __WORDSIZE == 32
+typedef unsigned short int __ipc_pid_t;
+# else
+typedef int __ipc_pid_t;
+# endif
+
+
+#endif /* bits/ipctypes.h */
diff --git a/sysdeps/generic/bits/libc-lock.h b/sysdeps/generic/bits/libc-lock.h
new file mode 100644
index 0000000000..3f9c211e0a
--- /dev/null
+++ b/sysdeps/generic/bits/libc-lock.h
@@ -0,0 +1,138 @@
+/* libc-internal interface for mutex locks. Stub version.
+ Copyright (C) 1996,97,99,2000-2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_LIBC_LOCK_H
+#define _BITS_LIBC_LOCK_H 1
+
+
+/* Define a lock variable NAME with storage class CLASS. The lock must be
+ initialized with __libc_lock_init before it can be used (or define it
+ with __libc_lock_define_initialized, below). Use `extern' for CLASS to
+ declare a lock defined in another module. In public structure
+ definitions you must use a pointer to the lock structure (i.e., NAME
+ begins with a `*'), because its storage size will not be known outside
+ of libc. */
+#define __libc_lock_define(CLASS,NAME)
+#define __libc_lock_define_recursive(CLASS,NAME)
+#define __rtld_lock_define_recursive(CLASS,NAME)
+#define __libc_rwlock_define(CLASS,NAME)
+
+/* Define an initialized lock variable NAME with storage class CLASS. */
+#define __libc_lock_define_initialized(CLASS,NAME)
+#define __libc_rwlock_define_initialized(CLASS,NAME)
+
+/* Define an initialized recursive lock variable NAME with storage
+ class CLASS. */
+#define __libc_lock_define_initialized_recursive(CLASS,NAME)
+#define __rtld_lock_define_initialized_recursive(CLASS,NAME)
+
+/* Initialize the named lock variable, leaving it in a consistent, unlocked
+ state. */
+#define __libc_lock_init(NAME)
+#define __libc_rwlock_init(NAME)
+
+/* Same as last but this time we initialize a recursive mutex. */
+#define __libc_lock_init_recursive(NAME)
+#define __rtld_lock_init_recursive(NAME)
+
+/* Finalize the named lock variable, which must be locked. It cannot be
+ used again until __libc_lock_init is called again on it. This must be
+ called on a lock variable before the containing storage is reused. */
+#define __libc_lock_fini(NAME)
+#define __libc_rwlock_fini(NAME)
+
+/* Finalize recursive named lock. */
+#define __libc_lock_fini_recursive(NAME)
+
+/* Lock the named lock variable. */
+#define __libc_lock_lock(NAME)
+#define __libc_rwlock_rdlock(NAME)
+#define __libc_rwlock_wrlock(NAME)
+
+/* Lock the recursive named lock variable. */
+#define __libc_lock_lock_recursive(NAME)
+#define __rtld_lock_lock_recursive(NAME)
+
+/* Try to lock the named lock variable. */
+#define __libc_lock_trylock(NAME) 0
+#define __libc_rwlock_tryrdlock(NAME) 0
+#define __libc_rwlock_trywrlock(NAME) 0
+
+/* Try to lock the recursive named lock variable. */
+#define __libc_lock_trylock_recursive(NAME) 0
+
+/* Unlock the named lock variable. */
+#define __libc_lock_unlock(NAME)
+#define __libc_rwlock_unlock(NAME)
+
+/* Unlock the recursive named lock variable. */
+#define __libc_lock_unlock_recursive(NAME)
+#define __rtld_lock_unlock_recursive(NAME)
+
+
+/* Define once control variable. */
+#define __libc_once_define(CLASS, NAME) CLASS int NAME = 0
+
+/* Call handler iff the first call. */
+#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+ do { \
+ if ((ONCE_CONTROL) == 0) { \
+ INIT_FUNCTION (); \
+ (ONCE_CONTROL) = 1; \
+ } \
+ } while (0)
+
+
+/* Start a critical region with a cleanup function */
+#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
+{ \
+ typeof (***(FCT)) *__save_FCT = (DOIT) ? (FCT) : 0; \
+ typeof (ARG) __save_ARG = ARG; \
+ /* close brace is in __libc_cleanup_region_end below. */
+
+/* End a critical region started with __libc_cleanup_region_start. */
+#define __libc_cleanup_region_end(DOIT) \
+ if ((DOIT) && __save_FCT != 0) \
+ (*__save_FCT)(__save_ARG); \
+}
+
+/* Sometimes we have to exit the block in the middle. */
+#define __libc_cleanup_end(DOIT) \
+ if ((DOIT) && __save_FCT != 0) \
+ (*__save_FCT)(__save_ARG); \
+
+#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
+#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
+
+/* We need portable names for some of the functions. */
+#define __libc_mutex_unlock
+
+/* Type for key of thread specific data. */
+typedef int __libc_key_t;
+
+/* Create key for thread specific data. */
+#define __libc_key_create(KEY,DEST) -1
+
+/* Set thread-specific data associated with KEY to VAL. */
+#define __libc_setspecific(KEY,VAL) ((void)0)
+
+/* Get thread-specific data associated with KEY. */
+#define __libc_getspecific(KEY) 0
+
+#endif /* bits/libc-lock.h */
diff --git a/sysdeps/generic/bits/libc-tsd.h b/sysdeps/generic/bits/libc-tsd.h
new file mode 100644
index 0000000000..d39382952a
--- /dev/null
+++ b/sysdeps/generic/bits/libc-tsd.h
@@ -0,0 +1,69 @@
+/* libc-internal interface for thread-specific data. Stub or TLS version.
+ Copyright (C) 1998,2001,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _GENERIC_BITS_LIBC_TSD_H
+#define _GENERIC_BITS_LIBC_TSD_H 1
+
+/* This file defines the following macros for accessing a small fixed
+ set of thread-specific `void *' data used only internally by libc.
+
+ __libc_tsd_define(CLASS, KEY) -- Define or declare a `void *' datum
+ for KEY. CLASS can be `static' for
+ keys used in only one source file,
+ empty for global definitions, or
+ `extern' for global declarations.
+ __libc_tsd_address(KEY) -- Return the `void **' pointing to
+ the current thread's datum for KEY.
+ __libc_tsd_get(KEY) -- Return the `void *' datum for KEY.
+ __libc_tsd_set(KEY, VALUE) -- Set the datum for KEY to VALUE.
+
+ The set of available KEY's will usually be provided as an enum,
+ and contains (at least):
+ _LIBC_TSD_KEY_MALLOC
+ _LIBC_TSD_KEY_DL_ERROR
+ _LIBC_TSD_KEY_RPC_VARS
+ All uses must be the literal _LIBC_TSD_* name in the __libc_tsd_* macros.
+ Some implementations may not provide any enum at all and instead
+ using string pasting in the macros. */
+
+#include <tls.h>
+
+/* When full support for __thread variables is available, this interface is
+ just a trivial wrapper for it. Without TLS, this is the generic/stub
+ implementation for wholly single-threaded systems.
+
+ We don't define an enum for the possible key values, because the KEYs
+ translate directly into variables by macro magic. */
+
+#if USE___THREAD
+# define __libc_tsd_define(CLASS, KEY) \
+ CLASS __thread void *__libc_tsd_##KEY attribute_tls_model_ie;
+
+# define __libc_tsd_address(KEY) (&__libc_tsd_##KEY)
+# define __libc_tsd_get(KEY) (__libc_tsd_##KEY)
+# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY = (VALUE))
+#else
+# define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
+
+# define __libc_tsd_address(KEY) (&__libc_tsd_##KEY##_data)
+# define __libc_tsd_get(KEY) (__libc_tsd_##KEY##_data)
+# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY##_data = (VALUE))
+#endif
+
+#endif /* bits/libc-tsd.h */
diff --git a/sysdeps/generic/bits/link.h b/sysdeps/generic/bits/link.h
new file mode 100644
index 0000000000..470b4d3e5f
--- /dev/null
+++ b/sysdeps/generic/bits/link.h
@@ -0,0 +1,4 @@
+struct link_map_machine
+ {
+ /* empty by default */
+ };
diff --git a/sysdeps/generic/bits/local_lim.h b/sysdeps/generic/bits/local_lim.h
new file mode 100644
index 0000000000..42cc7ebbc9
--- /dev/null
+++ b/sysdeps/generic/bits/local_lim.h
@@ -0,0 +1,3 @@
+/* This file should define the implementation-specific limits described
+ in posix[12]_lim.h. If there are no useful values to give a limit,
+ don't define it. */
diff --git a/sysdeps/generic/bits/mathdef.h b/sysdeps/generic/bits/mathdef.h
new file mode 100644
index 0000000000..00c67241a0
--- /dev/null
+++ b/sysdeps/generic/bits/mathdef.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1997, 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF 1
+
+/* Normally, there is no long double type and the `float' and `double'
+ expressions are evaluated as `double'. */
+typedef double float_t; /* `float' expressions are evaluated as
+ `double'. */
+typedef double double_t; /* `double' expressions are evaluated as
+ `double'. */
+
+/* The values returned by `ilogb' for 0 and NaN respectively. */
+# define FP_ILOGB0 (-2147483647)
+# define FP_ILOGBNAN 2147483647
+
+#endif /* ISO C99 */
+
+#ifndef __NO_LONG_DOUBLE_MATH
+/* Signal that we do not really have a `long double'. The disables the
+ declaration of all the `long double' function variants. */
+# define __NO_LONG_DOUBLE_MATH 1
+#endif
diff --git a/sysdeps/generic/bits/mathinline.h b/sysdeps/generic/bits/mathinline.h
new file mode 100644
index 0000000000..5498af6b63
--- /dev/null
+++ b/sysdeps/generic/bits/mathinline.h
@@ -0,0 +1,12 @@
+/* This file should provide inline versions of math functions.
+
+ Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
+
+ This file should define __MATH_INLINES if functions are actually defined as
+ inlines. */
+
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+
+/* Here goes the real code. */
+
+#endif
diff --git a/sysdeps/generic/bits/mman.h b/sysdeps/generic/bits/mman.h
new file mode 100644
index 0000000000..a2ee064cae
--- /dev/null
+++ b/sysdeps/generic/bits/mman.h
@@ -0,0 +1,91 @@
+/* Definitions for BSD-style memory management.
+ Copyright (C) 1994-1998,2000,01,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* These are the bits used by 4.4 BSD and its derivatives. On systems
+ (such as GNU) where these facilities are not system services but can be
+ emulated in the C library, these are the definitions we emulate. */
+
+#ifndef _SYS_MMAN_H
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
+#endif
+
+/* Protections are chosen from these bits, OR'd together. The
+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
+ without PROT_READ. The only guarantees are that no writing will be
+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_NONE 0x00 /* No access. */
+#define PROT_READ 0x04 /* Pages can be read. */
+#define PROT_WRITE 0x02 /* Pages can be written. */
+#define PROT_EXEC 0x01 /* Pages can be executed. */
+
+/* Flags contain mapping type, sharing type and options. */
+
+/* Mapping type (must choose one and only one of these). */
+#ifdef __USE_BSD
+# define MAP_FILE 0x0001 /* Mapped from a file or device. */
+# define MAP_ANON 0x0002 /* Allocated from anonymous virtual memory. */
+# define MAP_TYPE 0x000f /* Mask for type field. */
+# ifdef __USE_MISC
+# define MAP_ANONYMOUS MAP_ANON /* Linux name. */
+# endif
+#endif
+
+/* Sharing types (must choose one and only one of these). */
+#ifdef __USE_BSD
+# define MAP_COPY 0x0020 /* Virtual copy of region at mapping time. */
+#endif
+#define MAP_SHARED 0x0010 /* Share changes. */
+#define MAP_PRIVATE 0x0000 /* Changes private; copy pages on write. */
+
+/* Other flags. */
+#define MAP_FIXED 0x0100 /* Map address must be exactly as requested. */
+#ifdef __USE_BSD
+# define MAP_NOEXTEND 0x0200 /* For MAP_FILE, don't change file size. */
+# define MAP_HASSEMPHORE 0x0400 /* Region may contain semaphores. */
+# define MAP_INHERIT 0x0800 /* Region is retained after exec. */
+#endif
+
+/* Advice to `madvise'. */
+#ifdef __USE_BSD
+# define MADV_NORMAL 0 /* No further special treatment. */
+# define MADV_RANDOM 1 /* Expect random page references. */
+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define MADV_WILLNEED 3 /* Will need these pages. */
+# define MADV_DONTNEED 4 /* Don't need these pages. */
+#endif
+
+/* The POSIX people had to invent similar names for the same things. */
+#ifdef __USE_XOPEN2K
+# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
+#endif
+
+/* Flags to `msync'. */
+#define MS_ASYNC 1 /* Sync memory asynchronously. */
+#define MS_SYNC 0 /* Synchronous memory sync. */
+#define MS_INVALIDATE 2 /* Invalidate the caches. */
+
+/* Flags for `mlockall' (can be OR'd together). */
+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
+#define MCL_FUTURE 2 /* Lock all additions to address
+ space. */
diff --git a/sysdeps/generic/bits/mqueue.h b/sysdeps/generic/bits/mqueue.h
new file mode 100644
index 0000000000..27bb4824b8
--- /dev/null
+++ b/sysdeps/generic/bits/mqueue.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MQUEUE_H
+# error "Never use <bits/mqueue.h> directly; include <mqueue.h> instead."
+#endif
+
+typedef int mqd_t;
+
+struct mq_attr
+{
+ long int mq_flags; /* Message queue flags. */
+ long int mq_maxmsg; /* Maximum number of messages. */
+ long int mq_msgsize; /* Maximum message size. */
+ long int mq_curmsgs; /* Number of messages currently queued. */
+};
diff --git a/sysdeps/generic/bits/msq.h b/sysdeps/generic/bits/msq.h
new file mode 100644
index 0000000000..0125c43dc3
--- /dev/null
+++ b/sysdeps/generic/bits/msq.h
@@ -0,0 +1,45 @@
+/* Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MSG_H
+#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Define options for message queue functions. */
+#define MSG_NOERROR 010000 /* no error if message is too big */
+
+/* Types used in the structure definition. */
+typedef unsigned short int msgqnum_t;
+typedef unsigned short int msglen_t;
+
+
+/* Structure of record for one message inside the kernel.
+ The type `struct __msg' is opaque. */
+struct msqid_ds
+{
+ struct ipc_perm msg_perm; /* structure describing operation permission */
+ __time_t msg_stime; /* time of last msgsnd command */
+ __time_t msg_rtime; /* time of last msgrcv command */
+ __time_t msg_ctime; /* time of last change */
+ msgqnum_t msg_qnum; /* number of messages currently on queue */
+ msglen_t msg_qbytes; /* max number of bytes allowed on queue */
+ __pid_t msg_lspid; /* pid of last msgsnd() */
+ __pid_t msg_lrpid; /* pid of last msgrcv() */
+};
diff --git a/sysdeps/generic/bits/nan.h b/sysdeps/generic/bits/nan.h
new file mode 100644
index 0000000000..ab38168ea4
--- /dev/null
+++ b/sysdeps/generic/bits/nan.h
@@ -0,0 +1,5 @@
+#ifndef _MATH_H
+#error "Never use <bits/nan.h> directly; include <math.h> instead."
+#endif
+
+/* This file should define `NAN' on machines that have such things. */
diff --git a/sysdeps/generic/bits/netdb.h b/sysdeps/generic/bits/netdb.h
new file mode 100644
index 0000000000..41dc731931
--- /dev/null
+++ b/sysdeps/generic/bits/netdb.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _NETDB_H
+# error "Never include <bits/netdb.h> directly; use <netdb.h> instead."
+#endif
+
+
+/* Description of data base entry for a single network. NOTE: here a
+ poor assumption is made. The network number is expected to fit
+ into an unsigned long int variable. */
+struct netent
+{
+ char *n_name; /* Official name of network. */
+ char **n_aliases; /* Alias list. */
+ int n_addrtype; /* Net address type. */
+ uint32_t n_net; /* Network number. */
+};
diff --git a/sysdeps/generic/bits/poll.h b/sysdeps/generic/bits/poll.h
new file mode 100644
index 0000000000..022a06cc1b
--- /dev/null
+++ b/sysdeps/generic/bits/poll.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
+
+/* Event types that can be polled for. These bits may be set in `events'
+ to indicate the interesting event types; they will appear in `revents'
+ to indicate the status of the file descriptor. */
+#define POLLIN 01 /* There is data to read. */
+#define POLLPRI 02 /* There is urgent data to read. */
+#define POLLOUT 04 /* Writing now will not block. */
+
+#ifdef __USE_XOPEN
+/* These values are defined in XPG4.2. */
+# define POLLRDNORM POLLIN /* Normal data may be read. */
+# define POLLRDBAND POLLPRI /* Priority data may be read. */
+# define POLLWRNORM POLLOUT /* Writing now will not block. */
+# define POLLWRBAND POLLOUT /* Priority data may be written. */
+#endif
+
+/* Event types always implicitly polled for. These bits need not be set in
+ `events', but they will appear in `revents' to indicate the status of
+ the file descriptor. */
+#define POLLERR 010 /* Error condition. */
+#define POLLHUP 020 /* Hung up. */
+#define POLLNVAL 040 /* Invalid polling request. */
diff --git a/sysdeps/generic/bits/posix_opt.h b/sysdeps/generic/bits/posix_opt.h
new file mode 100644
index 0000000000..54f5a79aa2
--- /dev/null
+++ b/sysdeps/generic/bits/posix_opt.h
@@ -0,0 +1,2 @@
+/* This file should define the POSIX options described in <unistd.h>,
+ or leave them undefined, as appropriate. */
diff --git a/sysdeps/generic/bits/pthreadtypes.h b/sysdeps/generic/bits/pthreadtypes.h
new file mode 100644
index 0000000000..0e26952c96
--- /dev/null
+++ b/sysdeps/generic/bits/pthreadtypes.h
@@ -0,0 +1 @@
+/* No thread support. */
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
new file mode 100644
index 0000000000..05b28dfccd
--- /dev/null
+++ b/sysdeps/generic/bits/resource.h
@@ -0,0 +1,182 @@
+/* Bit values & structures for resource limits. 4.4 BSD/generic GNU version.
+ Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* These are the values for 4.4 BSD and GNU. Earlier BSD systems have a
+ subset of these kinds of resource limit. In systems where `getrlimit'
+ and `setrlimit' are not system calls, these are the values used by the C
+ library to emulate them. */
+
+/* Kinds of resource limit. */
+enum __rlimit_resource
+ {
+ /* Per-process CPU limit, in seconds. */
+ RLIMIT_CPU,
+#define RLIMIT_CPU RLIMIT_CPU
+ /* Largest file that can be created, in bytes. */
+ RLIMIT_FSIZE,
+#define RLIMIT_FSIZE RLIMIT_FSIZE
+ /* Maximum size of data segment, in bytes. */
+ RLIMIT_DATA,
+#define RLIMIT_DATA RLIMIT_DATA
+ /* Maximum size of stack segment, in bytes. */
+ RLIMIT_STACK,
+#define RLIMIT_STACK RLIMIT_STACK
+ /* Largest core file that can be created, in bytes. */
+ RLIMIT_CORE,
+#define RLIMIT_CORE RLIMIT_CORE
+ /* Largest resident set size, in bytes.
+ This affects swapping; processes that are exceeding their
+ resident set size will be more likely to have physical memory
+ taken from them. */
+ RLIMIT_RSS,
+#define RLIMIT_RSS RLIMIT_RSS
+ /* Locked-in-memory address space. */
+ RLIMIT_MEMLOCK,
+#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
+ /* Number of processes. */
+ RLIMIT_NPROC,
+#define RLIMIT_NPROC RLIMIT_NPROC
+ /* Number of open files. */
+ RLIMIT_OFILE,
+ RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing. */
+#define RLIMIT_OFILE RLIMIT_OFILE
+#define RLIMIT_NOFILE RLIMIT_NOFILE
+
+ RLIMIT_NLIMITS, /* Number of limit flavors. */
+ RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same. */
+ };
+
+/* Value to indicate that there is no limit. */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY 0x7fffffff
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
+#endif
+
+
+/* Type for resource quantity measurement. */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
+struct rlimit
+ {
+ /* The current (soft) limit. */
+ rlim_t rlim_cur;
+ /* The hard limit. */
+ rlim_t rlim_max;
+ };
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+ {
+ /* The current (soft) limit. */
+ rlim64_t rlim_cur;
+ /* The hard limit. */
+ rlim64_t rlim_max;
+ };
+#endif
+
+/* Whose usage statistics do you want? */
+enum __rusage_who
+/* The macro definitions are necessary because some programs want
+ to test for operating system features with #ifdef RUSAGE_SELF.
+ In ISO C the reflexive definition is a no-op. */
+ {
+ /* The calling process. */
+ RUSAGE_SELF = 0,
+#define RUSAGE_SELF RUSAGE_SELF
+ /* All of its terminated child processes. */
+ RUSAGE_CHILDREN = -1
+#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+ };
+
+#define __need_timeval
+#include <bits/time.h> /* For `struct timeval'. */
+
+/* Structure which says how much of each resource has been used. */
+struct rusage
+ {
+ /* Total amount of user time used. */
+ struct timeval ru_utime;
+ /* Total amount of system time used. */
+ struct timeval ru_stime;
+ /* Maximum resident set size (in kilobytes). */
+ long int ru_maxrss;
+ /* Amount of sharing of text segment memory
+ with other processes (kilobyte-seconds). */
+ long int ru_ixrss;
+ /* Amount of data segment memory used (kilobyte-seconds). */
+ long int ru_idrss;
+ /* Amount of stack memory used (kilobyte-seconds). */
+ long int ru_isrss;
+ /* Number of soft page faults (i.e. those serviced by reclaiming
+ a page from the list of pages awaiting reallocation. */
+ long int ru_minflt;
+ /* Number of hard page faults (i.e. those that required I/O). */
+ long int ru_majflt;
+ /* Number of times a process was swapped out of physical memory. */
+ long int ru_nswap;
+ /* Number of input operations via the file system. Note: This
+ and `ru_oublock' do not include operations with the cache. */
+ long int ru_inblock;
+ /* Number of output operations via the file system. */
+ long int ru_oublock;
+ /* Number of IPC messages sent. */
+ long int ru_msgsnd;
+ /* Number of IPC messages received. */
+ long int ru_msgrcv;
+ /* Number of signals delivered. */
+ long int ru_nsignals;
+ /* Number of voluntary context switches, i.e. because the process
+ gave up the process before it had to (usually to wait for some
+ resource to be available). */
+ long int ru_nvcsw;
+ /* Number of involuntary context switches, i.e. a higher priority process
+ became runnable or the current process used up its time slice. */
+ long int ru_nivcsw;
+ };
+
+/* Priority limits. */
+#define PRIO_MIN -20 /* Minimum priority a process can have. */
+#define PRIO_MAX 20 /* Maximum priority a process can have. */
+
+/* The type of the WHICH argument to `getpriority' and `setpriority',
+ indicating what flavor of entity the WHO argument specifies. */
+enum __priority_which
+ {
+ PRIO_PROCESS = 0, /* WHO is a process ID. */
+ PRIO_PGRP = 1, /* WHO is a process group ID. */
+ PRIO_USER = 2 /* WHO is a user ID. */
+ };
diff --git a/sysdeps/generic/bits/sched.h b/sysdeps/generic/bits/sched.h
new file mode 100644
index 0000000000..91b6dca0ca
--- /dev/null
+++ b/sysdeps/generic/bits/sched.h
@@ -0,0 +1,71 @@
+/* Definitions of constants and data structure for POSIX 1003.1b-1993
+ scheduling interface.
+ Copyright (C) 1996, 1997, 2001, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SCHED_H
+# error "Never include <bits/sched.h> directly; use <sched.h> instead."
+#endif
+
+
+/* Scheduling algorithms. */
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+
+/* Data structure to describe a process' schedulability. */
+struct sched_param
+{
+ int __sched_priority;
+};
+
+
+#if defined _SCHED_H && !defined __cpu_set_t_defined
+# define __cpu_set_t_defined
+/* Size definition for CPU sets. */
+# define __CPU_SETSIZE 1024
+# define __NCPUBITS (8 * sizeof (__cpu_mask))
+
+/* Type for array elements in 'cpu_set'. */
+typedef unsigned long int __cpu_mask;
+
+/* Basic access functions. */
+# define __CPUELT(cpu) ((cpu) / __NCPUBITS)
+# define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
+
+/* Data structure to describe CPU mask. */
+typedef struct
+{
+ __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
+} cpu_set_t;
+
+/* Access functions for CPU masks. */
+# define __CPU_ZERO(cpusetp) \
+ do { \
+ unsigned int __i; \
+ cpu_set *__arr = (cpusetp); \
+ for (__i = 0; __i < sizeof (cpu_set) / sizeof (__cpu_mask); ++__i) \
+ __arr->__bits[__i] = 0; \
+ } while (0)
+# define __CPU_SET(cpu, cpusetp) \
+ ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu))
+# define __CPU_CLR(cpu, cpusetp) \
+ ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu))
+# define __CPU_ISSET(cpu, cpusetp) \
+ (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0)
+#endif
diff --git a/sysdeps/generic/bits/select.h b/sysdeps/generic/bits/select.h
new file mode 100644
index 0000000000..47e7dedc30
--- /dev/null
+++ b/sysdeps/generic/bits/select.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SELECT_H
+# error "Never use <bits/select.h> directly; include <sys/select.h> instead."
+#endif
+
+
+/* We don't use `memset' because this would require a prototype and
+ the array isn't too big. */
+#define __FD_ZERO(s) \
+ do { \
+ unsigned int __i; \
+ fd_set *__arr = (s); \
+ for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
+ __FDS_BITS (__arr)[__i] = 0; \
+ } while (0)
+#define __FD_SET(d, s) (__FDS_BITS (s)[__FDELT(d)] |= __FDMASK(d))
+#define __FD_CLR(d, s) (__FDS_BITS (s)[__FDELT(d)] &= ~__FDMASK(d))
+#define __FD_ISSET(d, s) ((__FDS_BITS (s)[__FDELT(d)] & __FDMASK(d)) != 0)
diff --git a/sysdeps/generic/bits/sem.h b/sysdeps/generic/bits/sem.h
new file mode 100644
index 0000000000..dcb1c3edf7
--- /dev/null
+++ b/sysdeps/generic/bits/sem.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 1995, 1996, 1997, 1998
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SEM_H
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
+#endif
+
+#include <sys/types.h>
+
+/* Flags for `semop'. */
+#define SEM_UNDO 0x1000 /* undo the operation on exit */
+
+/* Commands for `semctl'. */
+#define GETPID 11 /* get sempid */
+#define GETVAL 12 /* get semval */
+#define GETALL 13 /* get all semval's */
+#define GETNCNT 14 /* get semncnt */
+#define GETZCNT 15 /* get semzcnt */
+#define SETVAL 16 /* set semval */
+#define SETALL 17 /* set all semval's */
+
+
+/* Data structure describing a set of semaphores. */
+struct semid_ds
+{
+ struct ipc_perm sem_perm; /* operation permission struct */
+ __time_t sem_otime; /* last semop() time */
+ __time_t sem_ctime; /* last time changed by semctl() */
+ unsigned short int sem_nsems; /* number of semaphores in set */
+};
+
+/* The user should define a union like the following to use it for arguments
+ for `semctl'.
+
+ union semun
+ {
+ int val; <= value for SETVAL
+ struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
+ unsigned short int *array; <= array for GETALL & SETALL
+ struct seminfo *__buf; <= buffer for IPC_INFO
+ };
+
+ Previous versions of this file used to define this union but this is
+ incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
+ one must define the union or not. */
+#define _SEM_SEMUN_UNDEFINED 1
diff --git a/sysdeps/generic/bits/setjmp.h b/sysdeps/generic/bits/setjmp.h
new file mode 100644
index 0000000000..9150d8d764
--- /dev/null
+++ b/sysdeps/generic/bits/setjmp.h
@@ -0,0 +1,7 @@
+/* Define the machine-dependent type `jmp_buf'. Stub version. */
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+typedef int __jmp_buf[1];
diff --git a/sysdeps/generic/bits/shm.h b/sysdeps/generic/bits/shm.h
new file mode 100644
index 0000000000..746a863486
--- /dev/null
+++ b/sysdeps/generic/bits/shm.h
@@ -0,0 +1,58 @@
+/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Flags for `shmat'. */
+#define SHM_RDONLY 010000 /* attach read-only else read-write */
+#define SHM_RND 020000 /* round attach address to SHMLBA */
+#define SHM_REMAP 040000 /* take-over region on attach */
+
+/* Commands for `shmctl'. */
+#define SHM_LOCK 11 /* lock segment (root only) */
+#define SHM_UNLOCK 12 /* unlock segment (root only) */
+
+__BEGIN_DECLS
+
+/* Segment low boundary address multiple. */
+#define SHMLBA (__getpagesize ())
+extern int __getpagesize (void) __THROW __attribute__ ((__const__));
+
+
+/* Type to count number of attaches. */
+typedef unsigned short int shmatt_t;
+
+/* Data structure describing a set of semaphores. */
+struct shmid_ds
+ {
+ struct ipc_perm shm_perm; /* operation permission struct */
+ int shm_segsz; /* size of segment in bytes */
+ __time_t shm_atime; /* time of last shmat() */
+ __time_t shm_dtime; /* time of last shmdt() */
+ __time_t shm_ctime; /* time of last change by shmctl() */
+ __pid_t shm_cpid; /* pid of creator */
+ __pid_t shm_lpid; /* pid of last shmop */
+ shmatt_t shm_nattch; /* number of current attaches */
+ };
+
+__END_DECLS
diff --git a/sysdeps/generic/bits/sigaction.h b/sysdeps/generic/bits/sigaction.h
new file mode 100644
index 0000000000..adcc276cc8
--- /dev/null
+++ b/sysdeps/generic/bits/sigaction.h
@@ -0,0 +1,78 @@
+/* Copyright (C) 1991,92,96,97,98,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
+/* These definitions match those used by the 4.4 BSD kernel.
+ If the operating system has a `sigaction' system call that correctly
+ implements the POSIX.1 behavior, there should be a system-dependent
+ version of this file that defines `struct sigaction' and the `SA_*'
+ constants appropriately. */
+
+/* Structure describing the action to be taken when a signal arrives. */
+struct sigaction
+ {
+ /* Signal handler. */
+#ifdef __USE_POSIX199309
+ union
+ {
+ /* Used if SA_SIGINFO is not set. */
+ __sighandler_t sa_handler;
+ /* Used if SA_SIGINFO is set. */
+ void (*sa_sigaction) (int, siginfo_t *, void *);
+ }
+ __sigaction_handler;
+# define sa_handler __sigaction_handler.sa_handler
+# define sa_sigaction __sigaction_handler.sa_sigaction
+#else
+ __sighandler_t sa_handler;
+#endif
+
+ /* Additional set of signals to be blocked. */
+ __sigset_t sa_mask;
+
+ /* Special flags. */
+ int sa_flags;
+ };
+
+/* Bits in `sa_flags'. */
+#if defined __USE_UNIX98 || defined __USE_MISC
+# define SA_ONSTACK 0x0001 /* Take signal on signal stack. */
+# define SA_RESTART 0x0002 /* Restart syscall on signal return. */
+# define SA_NODEFER 0x0010 /* Don't automatically block the signal when
+ its handler is being executed. */
+# define SA_RESETHAND 0x0004 /* Reset to SIG_DFL on entry to handler. */
+#endif
+#define SA_NOCLDSTOP 0x0008 /* Don't send SIGCHLD when children stop. */
+
+#ifdef __USE_MISC
+# define SA_INTERRUPT 0 /* Historical no-op ("not SA_RESTART"). */
+
+/* Some aliases for the SA_ constants. */
+# define SA_NOMASK SA_NODEFER
+# define SA_ONESHOT SA_RESETHAND
+# define SA_STACK SA_ONSTACK
+#endif
+
+
+/* Values for the HOW argument to `sigprocmask'. */
+#define SIG_BLOCK 1 /* Block signals. */
+#define SIG_UNBLOCK 2 /* Unblock signals. */
+#define SIG_SETMASK 3 /* Set the set of blocked signals. */
diff --git a/sysdeps/generic/bits/sigcontext.h b/sysdeps/generic/bits/sigcontext.h
new file mode 100644
index 0000000000..7e90e78c4a
--- /dev/null
+++ b/sysdeps/generic/bits/sigcontext.h
@@ -0,0 +1,33 @@
+/* Structure describing state saved while handling a signal. Stub version.
+ Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+/* State of this thread when the signal was taken. */
+struct sigcontext
+ {
+ int sc_onstack;
+ __sigset_t sc_mask;
+
+ /* Registers and such. */
+ };
+
+/* Signal subcodes should be defined here. */
diff --git a/sysdeps/generic/bits/siginfo.h b/sysdeps/generic/bits/siginfo.h
new file mode 100644
index 0000000000..fe7b3b5f9c
--- /dev/null
+++ b/sysdeps/generic/bits/siginfo.h
@@ -0,0 +1,211 @@
+/* siginfo_t, sigevent and constants. Stub version.
+ Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _SIGNAL_H && !defined __need_siginfo_t \
+ && !defined __need_sigevent_t
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+#if (!defined __have_sigval_t \
+ && (defined _SIGNAL_H || defined __need_siginfo_t \
+ || defined __need_sigevent_t))
+# define __have_sigval_t 1
+
+/* Type for data associated with a signal. */
+typedef union sigval
+ {
+ int sival_int;
+ void *sival_ptr;
+ } sigval_t;
+#endif
+
+#if (!defined __have_siginfo_t \
+ && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t 1
+
+typedef struct siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_errno; /* If non-zero, an errno value associated with
+ this signal, as defined in <errno.h>. */
+ int si_code; /* Signal code. */
+ __pid_t si_pid; /* Sending process ID. */
+ __uid_t si_uid; /* Real user ID of sending process. */
+ void *si_addr; /* Address of faulting instruction. */
+ int si_status; /* Exit value or signal. */
+ long int si_band; /* Band event for SIGPOLL. */
+ union sigval si_value; /* Signal value. */
+ } siginfo_t;
+
+
+/* Values for `si_code'. Positive values are reserved for kernel-generated
+ signals. */
+enum
+{
+ SI_ASYNCIO = -4, /* Sent by AIO completion. */
+# define SI_ASYNCIO SI_ASYNCIO
+ SI_MESGQ, /* Sent by real time mesq state change. */
+# define SI_MESGQ SI_MESGQ
+ SI_TIMER, /* Sent by timer expiration. */
+# define SI_TIMER SI_TIMER
+ SI_QUEUE, /* Sent by sigqueue. */
+# define SI_QUEUE SI_QUEUE
+ SI_USER /* Sent by kill, sigsend, raise. */
+# define SI_USER SI_USER
+};
+
+
+/* `si_code' values for SIGILL signal. */
+enum
+{
+ ILL_ILLOPC = 1, /* Illegal opcode. */
+# define ILL_ILLOPC ILL_ILLOPC
+ ILL_ILL_OPN, /* Illegal operand. */
+# define ILL_ILLOPN ILL_ILLOPN
+ ILL_ILLADR, /* Illegal addressing mode. */
+# define ILL_ILLADR ILL_ILLADR
+ ILL_ILLTRP, /* Illegal trap. */
+# define ILL_ILLTRP ILL_ILLTRP
+ ILL_PRVOPC, /* Privileged opcode. */
+# define ILL_PRVOPC ILL_PRVOPC
+ ILL_PRVREG, /* Privileged register. */
+# define ILL_PRVREG ILL_PRVREG
+ ILL_COPROC, /* Coprocessor error. */
+# define ILL_COPROC ILL_COPROC
+ ILL_BADSTK /* Internal stack error. */
+# define ILL_BADSTK ILL_BADSTK
+};
+
+/* `si_code' values for SIGFPE signal. */
+enum
+{
+ FPE_INTDIV = 1, /* Integer divide by zero. */
+# define FPE_INTDIV FPE_INTDIV
+ FPE_INTOVF, /* Integer overflow. */
+# define FPE_INTOVF FPE_INTOVF
+ FPE_FLTDIV, /* Floating point divide by zero. */
+# define FPE_FLTDIV FPE_FLTDIV
+ FPE_FLTOVF, /* Floating point overflow. */
+# define FPE_FLTOVF FPE_FLTOVF
+ FPE_FLTUND, /* Floating point underflow. */
+# define FPE_FLTUND FPE_FLTUND
+ FPE_FLTRES, /* Floating point inexact result. */
+# define FPE_FLTRES FPE_FLTRES
+ FPE_FLTINV, /* Floating point invalid operation. */
+# define FPE_FLTINV FPE_FLTINV
+ FPE_FLTSUB /* Subscript out of range. */
+# define FPE_FLTSUB FPE_FLTSUB
+};
+
+/* `si_code' values for SIGSEGV signal. */
+enum
+{
+ SEGV_MAPERR = 1, /* Address not mapped to object. */
+# define SEGV_MAPERR SEGV_MAPERR
+ SEGV_ACCERR /* Invalid permissions for mapped object. */
+# define SEGV_ACCERR SEGV_ACCERR
+};
+
+/* `si_code' values for SIGBUS signal. */
+enum
+{
+ BUS_ADRALN = 1, /* Invalid address alignment. */
+# define BUS_ADRALN BUS_ADRALN
+ BUS_ADRERR, /* Non-existant physical address. */
+# define BUS_ADRERR BUS_ADRERR
+ BUS_OBJERR /* Object specific hardware error. */
+# define BUS_OBJERR BUS_OBJERR
+};
+
+/* `si_code' values for SIGTRAP signal. */
+enum
+{
+ TRAP_BRKPT = 1, /* Process breakpoint. */
+# define TRAP_BRKPT TRAP_BRKPT
+ TRAP_TRACE /* Process trace trap. */
+# define TRAP_TRACE TRAP_TRACE
+};
+
+/* `si_code' values for SIGCHLD signal. */
+enum
+{
+ CLD_EXITED = 1, /* Child has exited. */
+# define CLD_EXITED CLD_EXITED
+ CLD_KILLED, /* Child was killed. */
+# define CLD_KILLED CLD_KILLED
+ CLD_DUMPED, /* Child terminated abnormally. */
+# define CLD_DUMPED CLD_DUMPED
+ CLD_TRAPPED, /* Traced child has trapped. */
+# define CLD_TRAPPED CLD_TRAPPED
+ CLD_STOPPED, /* Child has stopped. */
+# define CLD_STOPPED CLD_STOPPED
+ CLD_CONTINUED /* Stopped child has continued. */
+# define CLD_CONTINUED CLD_CONTINUED
+};
+
+/* `si_code' values for SIGPOLL signal. */
+enum
+{
+ POLL_IN = 1, /* Data input available. */
+# define POLL_IN POLL_IN
+ POLL_OUT, /* Output buffers available. */
+# define POLL_OUT POLL_OUT
+ POLL_MSG, /* Input message available. */
+# define POLL_MSG POLL_MSG
+ POLL_ERR, /* I/O error. */
+# define POLL_ERR POLL_ERR
+ POLL_PRI, /* High priority input available. */
+# define POLL_PRI POLL_PRI
+ POLL_HUP /* Device disconnected. */
+# define POLL_HUP POLL_HUP
+};
+
+# undef __need_siginfo_t
+#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */
+
+
+#if (defined _SIGNAL_H || defined __need_sigevent_t) \
+ && !defined __have_sigevent_t
+# define __have_sigevent_t 1
+
+/* Structure to transport application-defined values with signals. */
+# define SIGEV_MAX_SIZE 64
+# define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE / sizeof (int)) - 3)
+
+typedef struct sigevent
+ {
+ sigval_t sigev_value;
+ int sigev_signo;
+ int sigev_notify;
+ void (*sigev_notify_function) (sigval_t); /* Function to start. */
+ void *sigev_notify_attributes; /* Really pthread_attr_t.*/
+ } sigevent_t;
+
+/* `sigev_notify' values. */
+enum
+{
+ SIGEV_SIGNAL = 0, /* Notify via signal. */
+# define SIGEV_SIGNAL SIGEV_SIGNAL
+ SIGEV_NONE, /* Other notification: meaningless. */
+# define SIGEV_NONE SIGEV_NONE
+ SIGEV_THREAD /* Deliver via thread creation. */
+# define SIGEV_THREAD SIGEV_THREAD
+};
+
+#endif /* have _SIGNAL_H. */
diff --git a/sysdeps/generic/bits/signum.h b/sysdeps/generic/bits/signum.h
new file mode 100644
index 0000000000..25331f943c
--- /dev/null
+++ b/sysdeps/generic/bits/signum.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 1991, 1993, 1996, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef _SIGNAL_H
+
+/* Fake signal functions. */
+
+#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
+#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
+#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+
+#ifdef __USE_UNIX98
+# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#endif
+
+/* Signals in the 1-15 range are defined with their historical numbers.
+ Signals in the 20-25 range are relatively new and have no ingrained
+ numbers. */
+
+/* ANSI signals. */
+#define SIGINT 2 /* Interactive attention signal. */
+#define SIGILL 4 /* Illegal instruction. */
+#define SIGABRT 6 /* Abnormal termination. */
+#define SIGFPE 8 /* Erroneous arithmetic operation. */
+#define SIGSEGV 11 /* Invalid access to storage. */
+#define SIGTERM 15 /* Termination request. */
+
+/* Historical signals specified by POSIX. */
+#define SIGHUP 1 /* Hangup. */
+#define SIGQUIT 3 /* Quit. */
+#define SIGKILL 9 /* Kill (cannot be blocked, caught, or ignored). */
+#define SIGPIPE 13 /* Broken pipe. */
+#define SIGALRM 14 /* Alarm clock. */
+
+/* New(er) POSIX signals. */
+#define SIGSTOP 20 /* Stop (cannot be blocked, caught, or ignored). */
+#define SIGCONT 21 /* Continue. */
+#define SIGTSTP 22 /* Keyboard stop. */
+#define SIGTTIN 23 /* Background read from control terminal. */
+#define SIGTTOU 24 /* Background write to control terminal. */
+#define SIGCHLD 25 /* Child terminated or stopped. */
+
+#define _NSIG 26
+
+/* Archaic names for compatibility. */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP11 */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+#endif /* <signal.h> included. */
diff --git a/sysdeps/generic/bits/sigset.h b/sysdeps/generic/bits/sigset.h
new file mode 100644
index 0000000000..5fc8692df0
--- /dev/null
+++ b/sysdeps/generic/bits/sigset.h
@@ -0,0 +1,83 @@
+/* __sig_atomic_t, __sigset_t, and related definitions. Generic/BSD version.
+ Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGSET_H_types
+#define _SIGSET_H_types 1
+
+typedef int __sig_atomic_t;
+
+/* A `sigset_t' has a bit for each signal. */
+typedef unsigned long int __sigset_t;
+
+#endif
+
+
+/* We only want to define these functions if <signal.h> was actually
+ included; otherwise we were included just to define the types. Since we
+ are namespace-clean, it wouldn't hurt to define extra macros. But
+ trouble can be caused by functions being defined (e.g., any global
+ register vars declared later will cause compilation errors). */
+
+#if !defined _SIGSET_H_fns && defined _SIGNAL_H
+#define _SIGSET_H_fns 1
+
+#ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE extern __inline
+#endif
+
+/* Return a mask that includes SIG only. The cast to `sigset_t' avoids
+ overflow if `sigset_t' is wider than `int'. */
+#define __sigmask(sig) (((__sigset_t) 1) << ((sig) - 1))
+
+#define __sigemptyset(set) ((*(set) = (__sigset_t) 0), 0)
+#define __sigfillset(set) ((*(set) = ~(__sigset_t) 0), 0)
+
+#ifdef _GNU_SOURCE
+# define __sigisemptyset(set) (*(set) == (__sigset_t) 0)
+# define __sigandset(dest, left, right) \
+ ((*(dest) = (*(left) & *(right))), 0)
+# define __sigorset(dest, left, right) \
+ ((*(dest) = (*(left) | *(right))), 0)
+#endif
+
+/* These functions needn't check for a bogus signal number -- error
+ checking is done in the non __ versions. */
+
+extern int __sigismember (__const __sigset_t *, int);
+extern int __sigaddset (__sigset_t *, int);
+extern int __sigdelset (__sigset_t *, int);
+
+#ifdef __USE_EXTERN_INLINES
+# define __SIGSETFN(NAME, BODY, CONST) \
+ _EXTERN_INLINE int \
+ NAME (CONST __sigset_t *__set, int __sig) \
+ { \
+ __sigset_t __mask = __sigmask (__sig); \
+ return BODY; \
+ }
+
+__SIGSETFN (__sigismember, (*__set & __mask) ? 1 : 0, __const)
+__SIGSETFN (__sigaddset, ((*__set |= __mask), 0), )
+__SIGSETFN (__sigdelset, ((*__set &= ~__mask), 0), )
+
+# undef __SIGSETFN
+#endif
+
+
+#endif /* ! _SIGSET_H_fns. */
diff --git a/sysdeps/generic/bits/sigstack.h b/sysdeps/generic/bits/sigstack.h
new file mode 100644
index 0000000000..de79c90afa
--- /dev/null
+++ b/sysdeps/generic/bits/sigstack.h
@@ -0,0 +1,55 @@
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ __ptr_t ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ __ptr_t ss_sp;
+ size_t ss_size;
+ int ss_flags;
+ } stack_t;
+
+
+/* Possible values for `ss_flags.'. */
+enum
+{
+ SS_ONSTACK = 0x0001,
+#define SS_ONSTACK SS_ONSTACK
+ SS_DISABLE = 0x0004
+#define SS_DISABLE SS_DISABLE
+};
+
+/* Minumum stack size for a signal handler. */
+#define MINSIGSTKSZ 8192
+
+/* System default stack size. */
+#define SIGSTKSZ (MINSIGSTKSZ + 32768)
diff --git a/sysdeps/generic/bits/sigthread.h b/sysdeps/generic/bits/sigthread.h
new file mode 100644
index 0000000000..2edb58cd51
--- /dev/null
+++ b/sysdeps/generic/bits/sigthread.h
@@ -0,0 +1,35 @@
+/* Signal handling function for threaded programs. Generic version.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_SIGTHREAD_H
+#define _BITS_SIGTHREAD_H 1
+
+#if !defined _SIGNAL_H && !defined _PTHREAD_H
+# error "Never include this file directly. Use <pthread.h> instead"
+#endif
+
+/* Modify the signal mask for the calling thread. The arguments have the
+ same meaning as for sigprocmask; in fact, this and sigprocmask might be
+ the same function. We declare this the same on all platforms, since it
+ doesn't use any thread-related types. */
+extern int pthread_sigmask (int __how, __const __sigset_t *__newmask,
+ __sigset_t *__oldmask) __THROW;
+
+
+#endif /* bits/sigthread.h */
diff --git a/sysdeps/generic/bits/sockaddr.h b/sysdeps/generic/bits/sockaddr.h
new file mode 100644
index 0000000000..3e1d1312d8
--- /dev/null
+++ b/sysdeps/generic/bits/sockaddr.h
@@ -0,0 +1,40 @@
+/* Definition of `struct sockaddr_*' common members. Generic/4.2 BSD version.
+ Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Never include this file directly; use <sys/socket.h> instead.
+ */
+
+#ifndef _BITS_SOCKADDR_H
+#define _BITS_SOCKADDR_H 1
+
+
+/* POSIX.1g specifies this type name for the `sa_family' member. */
+typedef unsigned short int sa_family_t;
+
+/* This macro is used to declare the initial common members
+ of the data types used for socket addresses, `struct sockaddr',
+ `struct sockaddr_in', `struct sockaddr_un', etc. */
+
+#define __SOCKADDR_COMMON(sa_prefix) \
+ sa_family_t sa_prefix##family
+
+#define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int))
+
+#endif /* bits/sockaddr.h */
diff --git a/sysdeps/generic/bits/socket.h b/sysdeps/generic/bits/socket.h
new file mode 100644
index 0000000000..20e6f0337f
--- /dev/null
+++ b/sysdeps/generic/bits/socket.h
@@ -0,0 +1,251 @@
+/* System-specific socket constants and types. Generic/4.3 BSD version.
+ Copyright (C) 1991,92,1994-1999,2000,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef __BITS_SOCKET_H
+#define __BITS_SOCKET_H 1
+
+#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+#include <limits.h>
+#include <bits/types.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+/* Type for length arguments in socket calls. */
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
+
+
+/* Types of sockets. */
+enum __socket_type
+{
+ SOCK_STREAM = 1, /* Sequenced, reliable, connection-based
+ byte streams. */
+#define SOCK_STREAM SOCK_STREAM
+ SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams
+ of fixed maximum length. */
+#define SOCK_DGRAM SOCK_DGRAM
+ SOCK_RAW = 3, /* Raw protocol interface. */
+#define SOCK_RAW SOCK_RAW
+ SOCK_RDM = 4, /* Reliably-delivered messages. */
+#define SOCK_RDM SOCK_RDM
+ SOCK_SEQPACKET = 5 /* Sequenced, reliable, connection-based,
+ datagrams of fixed maximum length. */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+};
+
+/* Protocol families. */
+#define PF_UNSPEC 0 /* Unspecified. */
+#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */
+#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */
+#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */
+#define PF_INET 2 /* IP protocol family. */
+#define PF_IMPLINK 3 /* ARPAnet IMP protocol. */
+#define PF_PUP 4 /* PUP protocols. */
+#define PF_CHAOS 5 /* MIT Chaos protocols. */
+#define PF_NS 6 /* Xerox NS protocols. */
+#define PF_ISO 7 /* ISO protocols. */
+#define PF_OSI PF_ISO
+#define PF_ECMA 8 /* ECMA protocols. */
+#define PF_DATAKIT 9 /* AT&T Datakit protocols. */
+#define PF_CCITT 10 /* CCITT protocols (X.25 et al). */
+#define PF_SNA 11 /* IBM SNA protocol. */
+#define PF_DECnet 12 /* DECnet protocols. */
+#define PF_DLI 13 /* Direct data link interface. */
+#define PF_LAT 14 /* DEC Local Area Transport protocol. */
+#define PF_HYLINK 15 /* NSC Hyperchannel protocol. */
+#define PF_APPLETALK 16 /* Don't use this. */
+#define PF_ROUTE 17 /* Internal Routing Protocol. */
+#define PF_LINK 18 /* Link layer interface. */
+#define PF_XTP 19 /* eXpress Transfer Protocol (no AF). */
+#define PF_COIP 20 /* Connection-oriented IP, aka ST II. */
+#define PF_CNT 21 /* Computer Network Technology. */
+#define PF_RTIP 22 /* Help Identify RTIP packets. **/
+#define PF_IPX 23 /* Novell Internet Protocol. */
+#define PF_SIP 24 /* Simple Internet Protocol. */
+#define PF_PIP 25 /* Help Identify PIP packets. */
+#define PF_INET6 26 /* IP version 6. */
+#define PF_MAX 27
+
+/* Address families. */
+#define AF_UNSPEC PF_UNSPEC
+#define AF_LOCAL PF_LOCAL
+#define AF_UNIX PF_UNIX
+#define AF_FILE PF_FILE
+#define AF_INET PF_INET
+#define AF_IMPLINK PF_IMPLINK
+#define AF_PUP PF_PUP
+#define AF_CHAOS PF_CHAOS
+#define AF_NS PF_NS
+#define AF_ISO PF_ISO
+#define AF_OSI PF_OSI
+#define AF_ECMA PF_ECMA
+#define AF_DATAKIT PF_DATAKIT
+#define AF_CCITT PF_CCITT
+#define AF_SNA PF_SNA
+#define AF_DECnet PF_DECnet
+#define AF_DLI PF_DLI
+#define AF_LAT PF_LAT
+#define AF_HYLINK PF_HYLINK
+#define AF_APPLETALK PF_APPLETALK
+#define AF_ROUTE PF_ROUTE
+#define AF_LINK PF_LINK
+#define pseudo_AF_XTP PF_XTP
+#define AF_COIP PF_COIP
+#define AF_CNT PF_CNT
+#define pseudo_AF_RTIP PF_RTIP
+#define AF_IPX PF_IPX
+#define AF_SIP PF_SIP
+#define pseudo_AF_PIP PF_PIP
+#define AF_INET6 PF_INET6
+#define AF_MAX PF_MAX
+
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address. */
+struct sockaddr
+ {
+ __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
+ char sa_data[14]; /* Address data. */
+ };
+
+
+/* Structure large enough to hold any socket address (with the historical
+ exception of AF_UNIX). We reserve 128 bytes. */
+#if ULONG_MAX > 0xffffffff
+# define __ss_aligntype __uint64_t
+#else
+# define __ss_aligntype __uint32_t
+#endif
+#define _SS_SIZE 128
+#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
+
+struct sockaddr_storage
+ {
+ __SOCKADDR_COMMON (ss_); /* Address family, etc. */
+ __ss_aligntype __ss_align; /* Force desired alignment. */
+ char __ss_padding[_SS_PADSIZE];
+ };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al. */
+enum
+ {
+ MSG_OOB = 0x01, /* Process out-of-band data. */
+#define MSG_OOB MSG_OOB
+ MSG_PEEK = 0x02, /* Peek at incoming messages. */
+#define MSG_PEEK MSG_PEEK
+ MSG_DONTROUTE = 0x04, /* Don't use local routing. */
+#define MSG_DONTROUTE MSG_DONTROUTE
+ MSG_EOR = 0x08, /* Data completes record. */
+#define MSG_EOR MSG_EOR
+ MSG_TRUNC = 0x10, /* Data discarded before delivery. */
+#define MSG_TRUNC MSG_TRUNC
+ MSG_CTRUNC = 0x20, /* Control data lost before delivery. */
+#define MSG_CTRUNC MSG_CTRUNC
+ MSG_WAITALL = 0x40, /* Wait for full request or error. */
+#define MSG_WAITALL MSG_WAITALL
+ MSG_DONTWAIT = 0x80 /* This message should be nonblocking. */
+#define MSG_DONTWAIT MSG_DONTWAIT
+ };
+
+
+/* Structure describing messages sent by
+ `sendmsg' and received by `recvmsg'. */
+struct msghdr
+ {
+ __ptr_t msg_name; /* Address to send to/receive from. */
+ socklen_t msg_namelen; /* Length of address data. */
+
+ struct iovec *msg_iov; /* Vector of data to send/receive into. */
+ int msg_iovlen; /* Number of elements in the vector. */
+
+ __ptr_t msg_accrights; /* Access rights information. */
+ socklen_t msg_accrightslen; /* Length of access rights information. */
+
+ int msg_flags; /* Flags in received message. */
+ };
+
+
+/* Protocol number used to manipulate socket-level options
+ with `getsockopt' and `setsockopt'. */
+#define SOL_SOCKET 0xffff
+
+/* Socket-level options for `getsockopt' and `setsockopt'. */
+enum
+ {
+ SO_DEBUG = 0x0001, /* Record debugging information. */
+#define SO_DEBUG SO_DEBUG
+ SO_ACCEPTCONN = 0x0002, /* Accept connections on socket. */
+#define SO_ACCEPTCONN SO_ACCEPTCONN
+ SO_REUSEADDR = 0x0004, /* Allow reuse of local addresses. */
+#define SO_REUSEADDR SO_REUSEADDR
+ SO_KEEPALIVE = 0x0008, /* Keep connections alive and send
+ SIGPIPE when they die. */
+#define SO_KEEPALIVE SO_KEEPALIVE
+ SO_DONTROUTE = 0x0010, /* Don't do local routing. */
+#define SO_DONTROUTE SO_DONTROUTE
+ SO_BROADCAST = 0x0020, /* Allow transmission of
+ broadcast messages. */
+#define SO_BROADCAST SO_BROADCAST
+ SO_USELOOPBACK = 0x0040, /* Use the software loopback to avoid
+ hardware use when possible. */
+#define SO_USELOOPBACK SO_USELOOPBACK
+ SO_LINGER = 0x0080, /* Block on close of a reliable
+ socket to transmit pending data. */
+#define SO_LINGER SO_LINGER
+ SO_OOBINLINE = 0x0100, /* Receive out-of-band data in-band. */
+#define SO_OOBINLINE SO_OOBINLINE
+ SO_REUSEPORT = 0x0200, /* Allow local address and port reuse. */
+#define SO_REUSEPORT SO_REUSEPORT
+ SO_SNDBUF = 0x1001, /* Send buffer size. */
+#define SO_SNDBUF SO_SNDBUF
+ SO_RCVBUF = 0x1002, /* Receive buffer. */
+#define SO_RCVBUF SO_RCVBUF
+ SO_SNDLOWAT = 0x1003, /* Send low-water mark. */
+#define SO_SNDLOWAT SO_SNDLOWAT
+ SO_RCVLOWAT = 0x1004, /* Receive low-water mark. */
+#define SO_RCVLOWAT SO_RCVLOWAT
+ SO_SNDTIMEO = 0x1005, /* Send timeout. */
+#define SO_SNDTIMEO SO_SNDTIMEO
+ SO_RCVTIMEO = 0x1006, /* Receive timeout. */
+#define SO_RCVTIMEO SO_RCVTIMEO
+ SO_ERROR = 0x1007, /* Get and clear error status. */
+#define SO_ERROR SO_ERROR
+ SO_STYLE = 0x1008, /* Get socket connection style. */
+#define SO_STYLE SO_STYLE
+ SO_TYPE = SO_STYLE /* Compatible name for SO_STYLE. */
+#define SO_TYPE SO_TYPE
+ };
+
+/* Structure used to manipulate the SO_LINGER option. */
+struct linger
+ {
+ int l_onoff; /* Nonzero to linger on close. */
+ int l_linger; /* Time to linger. */
+ };
+
+#endif /* bits/socket.h */
diff --git a/sysdeps/generic/bits/stat.h b/sysdeps/generic/bits/stat.h
new file mode 100644
index 0000000000..c8391fc87f
--- /dev/null
+++ b/sysdeps/generic/bits/stat.h
@@ -0,0 +1,99 @@
+/* Copyright (C) 1992, 1996, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+/* This structure needs to be defined in accordance with the
+ implementation of __stat, __fstat, and __lstat. */
+
+#include <bits/types.h>
+
+/* Structure describing file characteristics. */
+struct stat
+ {
+ /* These are the members that POSIX.1 requires. */
+
+ __mode_t st_mode; /* File mode. */
+#ifndef __USE_FILE_OFFSET64
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+ __dev_t st_dev; /* Device containing the file. */
+ __nlink_t st_nlink; /* Link count. */
+
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group. */
+#ifndef __USE_FILE_OFFSET64
+ __off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
+
+ __time_t st_atime; /* Time of last access. */
+ __time_t st_mtime; /* Time of last modification. */
+ __time_t st_ctime; /* Time of last status change. */
+
+ /* This should be defined if there is a `st_blksize' member. */
+#undef _STATBUF_ST_BLKSIZE
+ };
+
+/* Encoding of the file mode. These are the standard Unix values,
+ but POSIX.1 does not specify what values should be used. */
+
+#define __S_IFMT 0170000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0040000 /* Directory. */
+#define __S_IFCHR 0020000 /* Character device. */
+#define __S_IFBLK 0060000 /* Block device. */
+#define __S_IFREG 0100000 /* Regular file. */
+#define __S_IFIFO 0010000 /* FIFO. */
+
+/* POSIX.1b objects. */
+#define __S_TYPEISMQ(buf) 0
+#define __S_TYPEISSEM(buf) 0
+#define __S_TYPEISSHM(buf) 0
+
+/* Protection bits. */
+
+#define __S_ISUID 04000 /* Set user ID on execution. */
+#define __S_ISGID 02000 /* Set group ID on execution. */
+#define __S_IREAD 0400 /* Read by owner. */
+#define __S_IWRITE 0200 /* Write by owner. */
+#define __S_IEXEC 0100 /* Execute by owner. */
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __mode_t st_mode; /* File mode. */
+ __ino64_t st_ino; /* File serial number. */
+ __dev_t st_dev; /* Device. */
+ __nlink_t st_nlink; /* Link count. */
+
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __off64_t st_size; /* Size of file, in bytes. */
+
+ __time_t st_atime; /* Time of last access. */
+ __time_t st_mtime; /* Time of last modification. */
+ __time_t st_ctime; /* Time of last status change. */
+ };
+#endif
diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
new file mode 100644
index 0000000000..851e464fcc
--- /dev/null
+++ b/sysdeps/generic/bits/statfs.h
@@ -0,0 +1,70 @@
+/* Definition of `struct statfs', information about a filesystem.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* GNU Hurd NOTE: The size of this structure (16 ints) is known in
+ <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC. MiG
+ does not cope at all well with the passed C structure not being of the
+ expected size. There are some filler words at the end to allow for
+ future expansion. To increase the size of the structure used in the RPC
+ and retain binary compatibility, we would need to assign a new message
+ number. */
+
+struct statfs
+ {
+ unsigned int f_type;
+ unsigned int f_bsize;
+#ifndef __USE_FILE_OFFSET64
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_bavail;
+ __fsblkcnt_t f_files;
+ __fsblkcnt_t f_ffree;
+#else
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsblkcnt64_t f_files;
+ __fsblkcnt64_t f_ffree;
+#endif
+ __fsid_t f_fsid;
+ unsigned int f_namelen;
+ unsigned int f_spare[6];
+ };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+ {
+ unsigned int f_type;
+ unsigned int f_bsize;
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsblkcnt64_t f_files;
+ __fsblkcnt64_t f_ffree;
+ __fsid_t f_fsid;
+ unsigned int f_namelen;
+ unsigned int f_spare[6];
+ };
+#endif
diff --git a/sysdeps/generic/bits/statvfs.h b/sysdeps/generic/bits/statvfs.h
new file mode 100644
index 0000000000..66841bf09a
--- /dev/null
+++ b/sysdeps/generic/bits/statvfs.h
@@ -0,0 +1,84 @@
+/* Definition of `struct statvfs', information about a filesystem.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_STATVFS_H
+# error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* GNU Hurd NOTE: The size of this structure (16 ints) is known in
+ <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC. MiG
+ does not cope at all well with the passed C structure not being of the
+ expected size. There are some filler words at the end to allow for
+ future expansion. To increase the size of the structure used in the RPC
+ and retain binary compatibility, we would need to assign a new message
+ number. */
+
+struct statvfs
+ {
+ unsigned long int f_bsize;
+ unsigned long int f_frsize;
+#ifndef __USE_FILE_OFFSET64
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_bavail;
+ __fsfilcnt_t f_files;
+ __fsfilcnt_t f_ffree;
+ __fsfilcnt_t f_favail;
+#else
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsfilcnt64_t f_files;
+ __fsfilcnt64_t f_ffree;
+ __fsfilcnt64_t f_favail;
+#endif
+ __fsid_t f_fsid;
+ unsigned long int f_flag;
+ unsigned long int f_namemax;
+ unsigned int f_spare[6];
+ };
+
+#ifdef __USE_LARGEFILE64
+struct statvfs64
+ {
+ unsigned long int f_bsize;
+ unsigned long int f_frsize;
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsfilcnt64_t f_files;
+ __fsfilcnt64_t f_ffree;
+ __fsfilcnt64_t f_favail;
+ __fsid_t f_fsid;
+ unsigned long int f_flag;
+ unsigned long int f_namemax;
+ unsigned int f_spare[6];
+ };
+#endif
+
+/* Definitions for the flag in `f_flag'. */
+enum
+{
+ ST_RDONLY = 1,
+#define ST_RDONLY ST_RDONLY
+ ST_NOSUID = 2
+#define ST_NOSUID ST_NOSUID
+};
diff --git a/sysdeps/generic/bits/stdio-lock.h b/sysdeps/generic/bits/stdio-lock.h
new file mode 100644
index 0000000000..d7c1db0132
--- /dev/null
+++ b/sysdeps/generic/bits/stdio-lock.h
@@ -0,0 +1,58 @@
+/* Thread package specific definitions of stream lock type. Generic version.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_STDIO_LOCK_H
+#define _BITS_STDIO_LOCK_H 1
+
+#include <bits/libc-lock.h>
+
+__libc_lock_define_recursive (typedef, _IO_lock_t)
+
+/* We need recursive (counting) mutexes. */
+#ifdef _LIBC_LOCK_RECURSIVE_INITIALIZER
+# define _IO_lock_initializer _LIBC_LOCK_RECURSIVE_INITIALIZER
+#elif _IO_MTSAFE_IO
+ #error libio needs recursive mutexes for _IO_MTSAFE_IO
+#endif
+
+#define _IO_lock_init(_name) __libc_lock_init_recursive (_name)
+#define _IO_lock_fini(_name) __libc_lock_fini_recursive (_name)
+#define _IO_lock_lock(_name) __libc_lock_lock_recursive (_name)
+#define _IO_lock_trylock(_name) __libc_lock_trylock_recursive (_name)
+#define _IO_lock_unlock(_name) __libc_lock_unlock_recursive (_name)
+
+
+#define _IO_cleanup_region_start(_fct, _fp) \
+ __libc_cleanup_region_start (((_fp)->_flags & _IO_USER_LOCK) == 0, _fct, _fp)
+#define _IO_cleanup_region_start_noarg(_fct) \
+ __libc_cleanup_region_start (1, _fct, NULL)
+#define _IO_cleanup_region_end(_doit) \
+ __libc_cleanup_region_end (_doit)
+
+#if defined _LIBC && !defined NOT_IN_libc
+# define _IO_acquire_lock(_fp) \
+ _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \
+ _IO_flockfile (_fp)
+
+# define _IO_release_lock(_fp) \
+ _IO_funlockfile (_fp); \
+ _IO_cleanup_region_end (0)
+#endif
+
+#endif /* bits/stdio-lock.h */
diff --git a/sysdeps/generic/bits/string.h b/sysdeps/generic/bits/string.h
new file mode 100644
index 0000000000..ad68b038b6
--- /dev/null
+++ b/sysdeps/generic/bits/string.h
@@ -0,0 +1,12 @@
+/* This file should provide inline versions of string functions.
+
+ Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
+
+ This file should define __STRING_INLINES if functions are actually defined
+ as inlines. */
+
+#ifndef _BITS_STRING_H
+#define _BITS_STRING_H 1
+
+
+#endif /* bits/string.h */
diff --git a/sysdeps/generic/bits/stropts.h b/sysdeps/generic/bits/stropts.h
new file mode 100644
index 0000000000..c8e2c2c034
--- /dev/null
+++ b/sysdeps/generic/bits/stropts.h
@@ -0,0 +1,231 @@
+/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _STROPTS_H
+# error "Never include <bits/stropts.h> directly; use <stropts.h> instead."
+#endif
+
+#ifndef _BITS_STROPTS_H
+#define _BITS_STROPTS_H 1
+
+#include <bits/types.h>
+
+/* Macros used as `request' argument to `ioctl'. */
+#define __SID ('S' << 8)
+
+#define I_NREAD (__SID | 1) /* Counts the number of data bytes in the data
+ block in the first message. */
+#define I_PUSH (__SID | 2) /* Push STREAMS module onto top of the current
+ STREAM, just below the STREAM head. */
+#define I_POP (__SID | 3) /* Remove STREAMS module from just below the
+ STREAM head. */
+#define I_LOOK (__SID | 4) /* Retrieve the name of the module just below
+ the STREAM head and place it in a character
+ string. */
+#define I_FLUSH (__SID | 5) /* Flush all input and/or output. */
+#define I_SRDOPT (__SID | 6) /* Sets the read mode. */
+#define I_GRDOPT (__SID | 7) /* Returns the current read mode setting. */
+#define I_STR (__SID | 8) /* Construct an internal STREAMS `ioctl'
+ message and send that message downstream. */
+#define I_SETSIG (__SID | 9) /* Inform the STREAM head that the process
+ wants the SIGPOLL signal issued. */
+#define I_GETSIG (__SID |10) /* Return the events for which the calling
+ process is currently registered to be sent
+ a SIGPOLL signal. */
+#define I_FIND (__SID |11) /* Compares the names of all modules currently
+ present in the STREAM to the name pointed to
+ by `arg'. */
+#define I_LINK (__SID |12) /* Connect two STREAMs. */
+#define I_UNLINK (__SID |13) /* Disconnects the two STREAMs. */
+#define I_PEEK (__SID |15) /* Allows a process to retrieve the information
+ in the first message on the STREAM head read
+ queue without taking the message off the
+ queue. */
+#define I_FDINSERT (__SID |16) /* Create a message from the specified
+ buffer(s), adds information about another
+ STREAM, and send the message downstream. */
+#define I_SENDFD (__SID |17) /* Requests the STREAM associated with `fildes'
+ to send a message, containing a file
+ pointer, to the STREAM head at the other end
+ of a STREAMS pipe. */
+#define I_RECVFD (__SID |14) /* Non-EFT definition. */
+#define I_SWROPT (__SID |19) /* Set the write mode. */
+#define I_GWROPT (__SID |20) /* Return the current write mode setting. */
+#define I_LIST (__SID |21) /* List all the module names on the STREAM, up
+ to and including the topmost driver name. */
+#define I_PLINK (__SID |22) /* Connect two STREAMs with a persistent
+ link. */
+#define I_PUNLINK (__SID |23) /* Disconnect the two STREAMs that were
+ connected with a persistent link. */
+#define I_FLUSHBAND (__SID |28) /* Flush only band specified. */
+#define I_CKBAND (__SID |29) /* Check if the message of a given priority
+ band exists on the STREAM head read
+ queue. */
+#define I_GETBAND (__SID |30) /* Return the priority band of the first
+ message on the STREAM head read queue. */
+#define I_ATMARK (__SID |31) /* See if the current message on the STREAM
+ head read queue is "marked" by some module
+ downstream. */
+#define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when
+ a STREAM is closing and there is data on
+ the write queues. */
+#define I_GETCLTIME (__SID |33) /* Get current value for closing timeout. */
+#define I_CANPUT (__SID |34) /* Check if a certain band is writable. */
+
+
+/* Used in `I_LOOK' request. */
+#define FMNAMESZ 8 /* compatibility w/UnixWare/Solaris. */
+
+/* Flush options. */
+#define FLUSHR 0x01 /* Flush read queues. */
+#define FLUSHW 0x02 /* Flush write queues. */
+#define FLUSHRW 0x03 /* Flush read and write queues. */
+#ifdef __USE_GNU
+# define FLUSHBAND 0x04 /* Flush only specified band. */
+#endif
+
+/* Possible arguments for `I_SETSIG'. */
+#define S_INPUT 0x0001 /* A message, other than a high-priority
+ message, has arrived. */
+#define S_HIPRI 0x0002 /* A high-priority message is present. */
+#define S_OUTPUT 0x0004 /* The write queue for normal data is no longer
+ full. */
+#define S_MSG 0x0008 /* A STREAMS signal message that contains the
+ SIGPOLL signal reaches the front of the
+ STREAM head read queue. */
+#define S_ERROR 0x0010 /* Notification of an error condition. */
+#define S_HANGUP 0x0020 /* Notification of a hangup. */
+#define S_RDNORM 0x0040 /* A normal message has arrived. */
+#define S_WRNORM S_OUTPUT
+#define S_RDBAND 0x0080 /* A message with a non-zero priority has
+ arrived. */
+#define S_WRBAND 0x0100 /* The write queue for a non-zero priority
+ band is no longer full. */
+#define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND,
+ SIGURG is generated instead of SIGPOLL when
+ a priority message reaches the front of the
+ STREAM head read queue. */
+
+/* Option for `I_PEEK'. */
+#define RS_HIPRI 0x01 /* Only look for high-priority messages. */
+
+/* Options for `I_SRDOPT'. */
+#define RNORM 0x0000 /* Byte-STREAM mode, the default. */
+#define RMSGD 0x0001 /* Message-discard mode. */
+#define RMSGN 0x0002 /* Message-nondiscard mode. */
+#define RPROTDAT 0x0004 /* Deliver the control part of a message as
+ data. */
+#define RPROTDIS 0x0008 /* Discard the control part of a message,
+ delivering any data part. */
+#define RPROTNORM 0x0010 /* Fail `read' with EBADMSG if a message
+ containing a control part is at the front
+ of the STREAM head read queue. */
+#ifdef __USE_GNU
+# define RPROTMASK 0x001C /* The RPROT bits */
+#endif
+
+/* Possible mode for `I_SWROPT'. */
+#define SNDZERO 0x001 /* Send a zero-length message downstream when a
+ `write' of 0 bytes occurs. */
+#ifdef __USE_GNU
+# define SNDPIPE 0x002 /* Send SIGPIPE on write and putmsg if
+ sd_werror is set. */
+#endif
+
+/* Arguments for `I_ATMARK'. */
+#define ANYMARK 0x01 /* Check if the message is marked. */
+#define LASTMARK 0x02 /* Check if the message is the last one marked
+ on the queue. */
+
+/* Argument for `I_UNLINK'. */
+#ifdef __USE_GNU
+# define MUXID_ALL (-1) /* Unlink all STREAMs linked to the STREAM
+ associated with `fildes'. */
+#endif
+
+
+/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */
+#define MSG_HIPRI 0x01 /* Send/receive high priority message. */
+#define MSG_ANY 0x02 /* Receive any message. */
+#define MSG_BAND 0x04 /* Receive message from specified band. */
+
+/* Values returned by getmsg and getpmsg */
+#define MORECTL 1 /* More control information is left in
+ message. */
+#define MOREDATA 2 /* More data is left in message. */
+
+
+/* Structure used for the I_FLUSHBAND ioctl on streams. */
+struct bandinfo
+ {
+ unsigned char bi_pri;
+ int bi_flag;
+ };
+
+struct strbuf
+ {
+ int maxlen; /* Maximum buffer length. */
+ int len; /* Length of data. */
+ char *buf; /* Pointer to buffer. */
+ };
+
+struct strpeek
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
+ };
+
+struct strfdinsert
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
+ int fildes;
+ int offset;
+ };
+
+struct strioctl
+ {
+ int ic_cmd;
+ int ic_timout;
+ int ic_len;
+ char *ic_dp;
+ };
+
+struct strrecvfd
+ {
+ int fd;
+ uid_t uid;
+ gid_t gid;
+ char __fill[8]; /* UnixWare/Solaris compatibility */
+ };
+
+
+struct str_mlist
+ {
+ char l_name[FMNAMESZ + 1];
+ };
+
+struct str_list
+ {
+ int sl_nmods;
+ struct str_mlist *sl_modlist;
+ };
+
+#endif /* bits/stropts.h */
diff --git a/sysdeps/generic/bits/sys_errlist.h b/sysdeps/generic/bits/sys_errlist.h
new file mode 100644
index 0000000000..ab839b7073
--- /dev/null
+++ b/sysdeps/generic/bits/sys_errlist.h
@@ -0,0 +1,24 @@
+/* Declare sys_errlist and sys_nerr, or don't. Don't version.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _STDIO_H
+# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
+#endif
+
+/* sys_errlist and sys_nerr are deprecated. Use strerror instead. */
diff --git a/sysdeps/generic/bits/termios.h b/sysdeps/generic/bits/termios.h
new file mode 100644
index 0000000000..43bb1ce52d
--- /dev/null
+++ b/sysdeps/generic/bits/termios.h
@@ -0,0 +1,256 @@
+/* termios type and macro definitions. 4.4 BSD/generic GNU version.
+ Copyright (C) 1993,94,96,97,99,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
+
+/* These macros are also defined in some <bits/ioctls.h> files (with
+ numerically identical values), but this serves to shut up cpp's
+ complaining. */
+#ifdef __USE_BSD
+
+# ifdef MDMBUF
+# undef MDMBUF
+# endif
+# ifdef FLUSHO
+# undef FLUSHO
+# endif
+# ifdef PENDIN
+# undef PENDIN
+# endif
+
+#endif /* __USE_BSD */
+
+#ifdef ECHO
+# undef ECHO
+#endif
+#ifdef TOSTOP
+# undef TOSTOP
+#endif
+#ifdef NOFLSH
+# undef NOFLSH
+#endif
+
+
+/* These definitions match those used by the 4.4 BSD kernel.
+ If the operating system has termios system calls or ioctls that
+ correctly implement the POSIX.1 behavior, there should be a
+ system-dependent version of this file that defines `struct termios',
+ `tcflag_t', `cc_t', `speed_t' and the `TC*' constants appropriately. */
+
+/* Type of terminal control flag masks. */
+typedef unsigned long int tcflag_t;
+
+/* Type of control characters. */
+typedef unsigned char cc_t;
+
+/* Type of baud rate specifiers. */
+typedef long int speed_t;
+
+/* Terminal control structure. */
+struct termios
+{
+ /* Input modes. */
+ tcflag_t c_iflag;
+#define IGNBRK (1 << 0) /* Ignore break condition. */
+#define BRKINT (1 << 1) /* Signal interrupt on break. */
+#define IGNPAR (1 << 2) /* Ignore characters with parity errors. */
+#define PARMRK (1 << 3) /* Mark parity and framing errors. */
+#define INPCK (1 << 4) /* Enable input parity check. */
+#define ISTRIP (1 << 5) /* Strip 8th bit off characters. */
+#define INLCR (1 << 6) /* Map NL to CR on input. */
+#define IGNCR (1 << 7) /* Ignore CR. */
+#define ICRNL (1 << 8) /* Map CR to NL on input. */
+#define IXON (1 << 9) /* Enable start/stop output control. */
+#define IXOFF (1 << 10) /* Enable start/stop input control. */
+#ifdef __USE_BSD
+# define IXANY (1 << 11) /* Any character will restart after stop. */
+# define IMAXBEL (1 << 13) /* Ring bell when input queue is full. */
+#endif
+#ifdef __USE_GNU
+# define IUCLC (1 << 14) /* Translate upper case input to lower case. */
+#endif
+
+ /* Output modes. */
+ tcflag_t c_oflag;
+#define OPOST (1 << 0) /* Perform output processing. */
+#ifdef __USE_BSD
+# define ONLCR (1 << 1) /* Map NL to CR-NL on output. */
+# define OXTABS (1 << 2) /* Expand tabs to spaces. */
+# define ONOEOT (1 << 3) /* Discard EOT (^D) on output. */
+#endif
+#ifdef __USE_GNU
+# define OLCUC (1 << 9) /* Translate lower case output to upper case */
+#endif
+
+ /* Control modes. */
+ tcflag_t c_cflag;
+#ifdef __USE_BSD
+# define CIGNORE (1 << 0) /* Ignore these control flags. */
+#endif
+#define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */
+#define CS5 0 /* 5 bits per byte. */
+#define CS6 (1 << 8) /* 6 bits per byte. */
+#define CS7 (1 << 9) /* 7 bits per byte. */
+#define CS8 (CS6|CS7) /* 8 bits per byte. */
+#define CSTOPB (1 << 10) /* Two stop bits instead of one. */
+#define CREAD (1 << 11) /* Enable receiver. */
+#define PARENB (1 << 12) /* Parity enable. */
+#define PARODD (1 << 13) /* Odd parity instead of even. */
+#define HUPCL (1 << 14) /* Hang up on last close. */
+#define CLOCAL (1 << 15) /* Ignore modem status lines. */
+#ifdef __USE_BSD
+# define CCTS_OFLOW (1 << 16) /* CTS flow control of output. */
+# define CRTS_IFLOW (1 << 17) /* RTS flow control of input. */
+# define CRTSCTS (CCTS_OFLOW|CRTS_IFLOW) /* CTS/RTS flow control. */
+# define MDMBUF (1 << 20) /* Carrier flow control of output. */
+#endif
+
+ /* Local modes. */
+ tcflag_t c_lflag;
+#ifdef __USE_BSD
+# define ECHOKE (1 << 0) /* Visual erase for KILL. */
+#endif
+#define _ECHOE (1 << 1) /* Visual erase for ERASE. */
+#define ECHOE _ECHOE
+#define _ECHOK (1 << 2) /* Echo NL after KILL. */
+#define ECHOK _ECHOK
+#define _ECHO (1 << 3) /* Enable echo. */
+#define ECHO _ECHO
+#define _ECHONL (1 << 4) /* Echo NL even if ECHO is off. */
+#define ECHONL _ECHONL
+#ifdef __USE_BSD
+# define ECHOPRT (1 << 5) /* Hardcopy visual erase. */
+# define ECHOCTL (1 << 6) /* Echo control characters as ^X. */
+#endif
+#define _ISIG (1 << 7) /* Enable signals. */
+#define ISIG _ISIG
+#define _ICANON (1 << 8) /* Do erase and kill processing. */
+#define ICANON _ICANON
+#ifdef __USE_BSD
+# define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */
+#endif
+#define _IEXTEN (1 << 10) /* Enable DISCARD and LNEXT. */
+#define IEXTEN _IEXTEN
+#define EXTPROC (1 << 11) /* External processing. */
+#define _TOSTOP (1 << 22) /* Send SIGTTOU for background output. */
+#define TOSTOP _TOSTOP
+#ifdef __USE_BSD
+# define FLUSHO (1 << 23) /* Output being flushed (state). */
+# define NOKERNINFO (1 << 25) /* Disable VSTATUS. */
+# define PENDIN (1 << 29) /* Retype pending input (state). */
+#endif
+#define _NOFLSH (1 << 31) /* Disable flush after interrupt. */
+#define NOFLSH _NOFLSH
+
+ /* Control characters. */
+#define VEOF 0 /* End-of-file character [ICANON]. */
+#define VEOL 1 /* End-of-line character [ICANON]. */
+#ifdef __USE_BSD
+# define VEOL2 2 /* Second EOL character [ICANON]. */
+#endif
+#define VERASE 3 /* Erase character [ICANON]. */
+#ifdef __USE_BSD
+# define VWERASE 4 /* Word-erase character [ICANON]. */
+#endif
+#define VKILL 5 /* Kill-line character [ICANON]. */
+#ifdef __USE_BSD
+# define VREPRINT 6 /* Reprint-line character [ICANON]. */
+#endif
+#define VINTR 8 /* Interrupt character [ISIG]. */
+#define VQUIT 9 /* Quit character [ISIG]. */
+#define VSUSP 10 /* Suspend character [ISIG]. */
+#ifdef __USE_BSD
+# define VDSUSP 11 /* Delayed suspend character [ISIG]. */
+#endif
+#define VSTART 12 /* Start (X-ON) character [IXON, IXOFF]. */
+#define VSTOP 13 /* Stop (X-OFF) character [IXON, IXOFF]. */
+#ifdef __USE_BSD
+# define VLNEXT 14 /* Literal-next character [IEXTEN]. */
+# define VDISCARD 15 /* Discard character [IEXTEN]. */
+#endif
+#define VMIN 16 /* Minimum number of bytes read at once [!ICANON]. */
+#define VTIME 17 /* Time-out value (tenths of a second) [!ICANON]. */
+#ifdef __USE_BSD
+# define VSTATUS 18 /* Status character [ICANON]. */
+#endif
+#define NCCS 20 /* Value duplicated in <hurd/tioctl.defs>. */
+ cc_t c_cc[NCCS];
+
+ /* Input and output baud rates. */
+ speed_t __ispeed, __ospeed;
+#define B0 0 /* Hang up. */
+#define B50 50 /* 50 baud. */
+#define B75 75 /* 75 baud. */
+#define B110 110 /* 110 baud. */
+#define B134 134 /* 134.5 baud. */
+#define B150 150 /* 150 baud. */
+#define B200 200 /* 200 baud. */
+#define B300 300 /* 300 baud. */
+#define B600 600 /* 600 baud. */
+#define B1200 1200 /* 1200 baud. */
+#define B1800 1800 /* 1800 baud. */
+#define B2400 2400 /* 2400 baud. */
+#define B4800 4800 /* 4800 baud. */
+#define B9600 9600 /* 9600 baud. */
+#define B19200 19200 /* 19200 baud. */
+#define B38400 38400 /* 38400 baud. */
+#ifdef __USE_MISC
+# define EXTA 19200
+# define EXTB 38400
+#endif
+#define B57600 57600
+#define B115200 115200
+#define B230400 230400
+#define B460800 460800
+#define B500000 500000
+#define B576000 576000
+#define B921600 921600
+#define B1000000 1000000
+#define B1152000 1152000
+#define B1500000 1500000
+#define B2000000 2000000
+#define B2500000 2500000
+#define B3000000 3000000
+#define B3500000 3500000
+#define B4000000 4000000
+};
+
+#define _IOT_termios /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (tcflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
+
+/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
+#define TCSANOW 0 /* Change immediately. */
+#define TCSADRAIN 1 /* Change when pending output is written. */
+#define TCSAFLUSH 2 /* Flush pending input before changing. */
+#ifdef __USE_BSD
+# define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */
+#endif
+
+/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
+#define TCIFLUSH 1 /* Discard data received but not yet read. */
+#define TCOFLUSH 2 /* Discard data written but not yet sent. */
+#define TCIOFLUSH 3 /* Discard all pending data. */
+
+/* Values for the ACTION argument to `tcflow'. */
+#define TCOOFF 1 /* Suspend output. */
+#define TCOON 2 /* Restart suspended output. */
+#define TCIOFF 3 /* Send a STOP character. */
+#define TCION 4 /* Send a START character. */
diff --git a/sysdeps/generic/bits/time.h b/sysdeps/generic/bits/time.h
new file mode 100644
index 0000000000..b3184d1de9
--- /dev/null
+++ b/sysdeps/generic/bits/time.h
@@ -0,0 +1,75 @@
+/* System-dependent timing definitions. Generic version.
+ Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+# define _BITS_TIME_H 1
+
+/* ISO/IEC 9899:1990 7.12.1: <time.h>
+ The macro `CLOCKS_PER_SEC' is the number per second of the value
+ returned by the `clock' function. */
+/* CAE XSH, Issue 4, Version 2: <time.h>
+ The value of CLOCKS_PER_SEC is required to be 1 million on all
+ XSI-conformant systems. */
+# define CLOCKS_PER_SEC 1000000l
+
+# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
+/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
+ presents the real value for clock ticks per second for the system. */
+# include <bits/types.h>
+extern long int __sysconf (int);
+# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
+# endif
+
+# ifdef __USE_POSIX199309
+/* Identifier for system-wide realtime clock. */
+# define CLOCK_REALTIME 0
+/* Monotonic system-wide clock. */
+# define CLOCK_MONOTONIC 1
+/* High-resolution timer from the CPU. */
+# define CLOCK_PROCESS_CPUTIME_ID 2
+/* Thread-specific CPU-time clock. */
+# define CLOCK_THREAD_CPUTIME_ID 3
+
+/* Flag to indicate time is absolute. */
+# define TIMER_ABSTIME 1
+# endif
+
+# endif /* bits/time.h */
+#endif
+
+#ifdef __need_timeval
+# undef __need_timeval
+# ifndef _STRUCT_TIMEVAL
+# define _STRUCT_TIMEVAL 1
+# include <bits/types.h>
+
+/* A time value that is accurate to the nearest
+ microsecond but also has a range of years. */
+struct timeval
+ {
+ __time_t tv_sec; /* Seconds. */
+ __suseconds_t tv_usec; /* Microseconds. */
+ };
+# endif /* struct timeval */
+#endif /* need timeval */
diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h
new file mode 100644
index 0000000000..ce48964f14
--- /dev/null
+++ b/sysdeps/generic/bits/types.h
@@ -0,0 +1,199 @@
+/* bits/types.h -- definitions of __*_t types underlying *_t types.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef _BITS_TYPES_H
+#define _BITS_TYPES_H 1
+
+#include <features.h>
+#include <bits/wordsize.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+/* Convenience types. */
+typedef unsigned char __u_char;
+typedef unsigned short int __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long int __u_long;
+
+/* Fixed-size types, underlying types depend on word size and compiler. */
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#if __WORDSIZE == 64
+typedef signed long int __int64_t;
+typedef unsigned long int __uint64_t;
+#elif defined __GLIBC_HAVE_LONG_LONG
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+#endif
+
+/* quad_t is also 64 bits. */
+#if __WORDSIZE == 64
+typedef long int __quad_t;
+typedef unsigned long int __u_quad_t;
+#elif defined __GLIBC_HAVE_LONG_LONG
+__extension__ typedef long long int __quad_t;
+__extension__ typedef unsigned long long int __u_quad_t;
+#else
+typedef struct
+{
+ long __val[2];
+} __quad_t;
+typedef struct
+{
+ __u_long __val[2];
+} __u_quad_t;
+#endif
+
+
+/* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
+ macros for each of the OS types we define below. The definitions
+ of those macros must use the following macros for underlying types.
+ We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
+ variants of each of the following integer types on this machine.
+
+ 16 -- "natural" 16-bit type (always short)
+ 32 -- "natural" 32-bit type (always int)
+ 64 -- "natural" 64-bit type (long or long long)
+ LONG32 -- 32-bit type, traditionally long
+ QUAD -- 64-bit type, always long long
+ WORD -- natural type of __WORDSIZE bits (int or long)
+ LONGWORD -- type of __WORDSIZE bits, traditionally long
+
+ We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
+ conventional uses of `long' or `long long' type modifiers match the
+ types we define, even when a less-adorned type would be the same size.
+ This matters for (somewhat) portably writing printf/scanf formats for
+ these types, where using the appropriate l or ll format modifiers can
+ make the typedefs and the formats match up across all GNU platforms. If
+ we used `long' when it's 64 bits where `long long' is expected, then the
+ compiler would warn about the formats not matching the argument types,
+ and the programmer changing them to shut up the compiler would break the
+ program's portability.
+
+ Here we assume what is presently the case in all the GCC configurations
+ we support: long long is always 64 bits, long is always word/address size,
+ and int is always 32 bits. */
+
+#define __S16_TYPE short int
+#define __U16_TYPE unsigned short int
+#define __S32_TYPE int
+#define __U32_TYPE unsigned int
+#define __SLONGWORD_TYPE long int
+#define __ULONGWORD_TYPE unsigned long int
+#if __WORDSIZE == 32
+# define __SQUAD_TYPE __quad_t
+# define __UQUAD_TYPE __u_quad_t
+# define __SWORD_TYPE int
+# define __UWORD_TYPE unsigned int
+# define __SLONG32_TYPE long int
+# define __ULONG32_TYPE unsigned long int
+# define __S64_TYPE __quad_t
+# define __U64_TYPE __u_quad_t
+#elif __WORDSIZE == 64
+# define __SQUAD_TYPE long int
+# define __UQUAD_TYPE unsigned long int
+# define __SWORD_TYPE long int
+# define __UWORD_TYPE unsigned long int
+# define __SLONG32_TYPE int
+# define __ULONG32_TYPE unsigned int
+# define __S64_TYPE long int
+# define __U64_TYPE unsigned long int
+#else
+# error
+#endif
+#include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */
+
+/* We want __extension__ before typedef's that use nonstandard base types
+ such as `long long' in C89 mode. */
+#define __STD_TYPE __extension__ typedef
+
+
+__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */
+__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */
+__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */
+__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */
+__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/
+__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */
+__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */
+__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */
+__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */
+__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */
+__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */
+__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */
+__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */
+__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */
+__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
+__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
+__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
+__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
+
+__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
+__STD_TYPE __SWBLK_T_TYPE __swblk_t; /* Type of a swap block maybe? */
+__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */
+
+/* Clock ID used in clock and timer functions. */
+__STD_TYPE __CLOCKID_T_TYPE __clockid_t;
+
+/* Timer ID returned by `timer_create'. */
+__STD_TYPE __TIMER_T_TYPE __timer_t;
+
+/* Type to represent block size. */
+__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;
+
+/* Types from the Large File Support interface. */
+
+/* Type to count number of disk blocks. */
+__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t;
+__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t;
+
+/* Type to count file system blocks. */
+__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t;
+__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
+
+/* Type to count file system nodes. */
+__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t;
+__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
+
+__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */
+
+/* These few don't really vary by system, they always correspond
+ to one of the other defined types. */
+typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */
+typedef __quad_t *__qaddr_t;
+typedef char *__caddr_t;
+
+/* Duplicates info from stdint.h but this is used in unistd.h. */
+__STD_TYPE __SWORD_TYPE __intptr_t;
+
+/* Duplicate info from sys/socket.h. */
+__STD_TYPE __U32_TYPE __socklen_t;
+
+
+#undef __STD_TYPE
+
+#endif /* bits/types.h */
diff --git a/sysdeps/generic/bits/typesizes.h b/sysdeps/generic/bits/typesizes.h
new file mode 100644
index 0000000000..e9226c4174
--- /dev/null
+++ b/sysdeps/generic/bits/typesizes.h
@@ -0,0 +1,66 @@
+/* bits/typesizes.h -- underlying types for *_t. Generic version.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef _BITS_TYPESIZES_H
+#define _BITS_TYPESIZES_H 1
+
+/* See <bits/types.h> for the meaning of these macros. This file exists so
+ that <bits/types.h> need not vary across different GNU platforms. */
+
+#define __DEV_T_TYPE __UQUAD_TYPE
+#define __UID_T_TYPE __U32_TYPE
+#define __GID_T_TYPE __U32_TYPE
+#define __INO_T_TYPE __ULONGWORD_TYPE
+#define __INO64_T_TYPE __UQUAD_TYPE
+#define __MODE_T_TYPE __U32_TYPE
+#define __NLINK_T_TYPE __UWORD_TYPE
+#define __OFF_T_TYPE __SLONGWORD_TYPE
+#define __OFF64_T_TYPE __SQUAD_TYPE
+#define __PID_T_TYPE __S32_TYPE
+#define __RLIM_T_TYPE __ULONGWORD_TYPE
+#define __RLIM64_T_TYPE __UQUAD_TYPE
+#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
+#define __BLKCNT64_T_TYPE __SQUAD_TYPE
+#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
+#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
+#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
+#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
+#define __ID_T_TYPE __U32_TYPE
+#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+#define __TIME_T_TYPE __SLONGWORD_TYPE
+#define __USECONDS_T_TYPE __U32_TYPE
+#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __DADDR_T_TYPE __S32_TYPE
+#define __SWBLK_T_TYPE __SLONGWORD_TYPE
+#define __KEY_T_TYPE __S32_TYPE
+#define __CLOCKID_T_TYPE __S32_TYPE
+#define __TIMER_T_TYPE void *
+#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
+#define __FSID_T_TYPE struct { int __val[2]; }
+#define __SSIZE_T_TYPE __SWORD_TYPE
+
+/* Number of descriptors that can fit in an `fd_set'. */
+#define __FD_SETSIZE 1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/generic/bits/uio.h b/sysdeps/generic/bits/uio.h
new file mode 100644
index 0000000000..410ce2a98a
--- /dev/null
+++ b/sysdeps/generic/bits/uio.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_UIO_H
+# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
+#endif
+
+
+/* `struct iovec' -- Structure describing a section of memory. */
+
+struct iovec
+{
+ /* Starting address. */
+ __ptr_t iov_base;
+ /* Length in bytes. */
+ size_t iov_len;
+};
diff --git a/sysdeps/generic/bits/ustat.h b/sysdeps/generic/bits/ustat.h
new file mode 100644
index 0000000000..69c6b72270
--- /dev/null
+++ b/sysdeps/generic/bits/ustat.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_USTAT_H
+# error "Never include <bits/ustat.h> directly; use <sys/ustat.h> instead."
+#endif
+
+#include <sys/types.h>
+
+struct ustat
+ {
+ __daddr_t f_tfree; /* Number of free blocks. */
+ __ino_t f_tinode; /* Number of free inodes. */
+ char f_fname[6];
+ char f_fpack[6];
+ };
diff --git a/sysdeps/generic/bits/utmp.h b/sysdeps/generic/bits/utmp.h
new file mode 100644
index 0000000000..03a2b1f40b
--- /dev/null
+++ b/sysdeps/generic/bits/utmp.h
@@ -0,0 +1,50 @@
+/* The `struct utmp' type, describing entries in the utmp file. Generic/BSDish
+ Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UTMP_H
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
+#endif
+
+#include <paths.h>
+#include <time.h>
+
+
+#define UT_NAMESIZE 8
+#define UT_LINESIZE 8
+#define UT_HOSTSIZE 16
+
+
+struct lastlog
+ {
+ time_t ll_time;
+ char ll_line[UT_LINESIZE];
+ char ll_host[UT_HOSTSIZE];
+ };
+
+struct utmp
+ {
+ char ut_line[UT_LINESIZE];
+ char ut_user[UT_NAMESIZE];
+#define ut_name ut_user
+ char ut_host[UT_HOSTSIZE];
+ long int ut_time;
+ };
+
+
+#define _HAVE_UT_HOST 1 /* We have the ut_host field. */
diff --git a/sysdeps/generic/bits/utsname.h b/sysdeps/generic/bits/utsname.h
new file mode 100644
index 0000000000..48e8a8e9b6
--- /dev/null
+++ b/sysdeps/generic/bits/utsname.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
+/* The size of the character arrays used to hold the information
+ in a `struct utsname'. Enlarge this as necessary. */
+#define _UTSNAME_LENGTH 1024
diff --git a/sysdeps/generic/bits/waitflags.h b/sysdeps/generic/bits/waitflags.h
new file mode 100644
index 0000000000..157dd1211a
--- /dev/null
+++ b/sysdeps/generic/bits/waitflags.h
@@ -0,0 +1,27 @@
+/* Definitions of flag bits for `waitpid' et al.
+ Copyright (C) 1992, 1996, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
+# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
+#endif
+
+
+/* Bits in the third argument to `waitpid'. */
+#define WNOHANG 1 /* Don't block waiting. */
+#define WUNTRACED 2 /* Report status of stopped children. */
diff --git a/sysdeps/generic/bits/waitstatus.h b/sysdeps/generic/bits/waitstatus.h
new file mode 100644
index 0000000000..699c224989
--- /dev/null
+++ b/sysdeps/generic/bits/waitstatus.h
@@ -0,0 +1,106 @@
+/* Definitions of status bits for `wait' et al.
+ Copyright (C) 1992,1994,1996,1997,2000,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
+# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
+#endif
+
+
+/* Everything extant so far uses these same bits. */
+
+
+/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
+#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
+
+/* If WIFSIGNALED(STATUS), the terminating signal. */
+#define __WTERMSIG(status) ((status) & 0x7f)
+
+/* If WIFSTOPPED(STATUS), the signal that stopped the child. */
+#define __WSTOPSIG(status) __WEXITSTATUS(status)
+
+/* Nonzero if STATUS indicates normal termination. */
+#define __WIFEXITED(status) (__WTERMSIG(status) == 0)
+
+/* Nonzero if STATUS indicates termination by a signal. */
+#define __WIFSIGNALED(status) \
+ (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
+
+/* Nonzero if STATUS indicates the child is stopped. */
+#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
+
+/* Nonzero if STATUS indicates the child continued after a stop. We only
+ define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */
+#ifdef WCONTINUED
+# define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
+#endif
+
+/* Nonzero if STATUS indicates the child dumped core. */
+#define __WCOREDUMP(status) ((status) & __WCOREFLAG)
+
+/* Macros for constructing status values. */
+#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
+#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f)
+#define __W_CONTINUED 0xffff
+#define __WCOREFLAG 0x80
+
+
+#ifdef __USE_BSD
+
+# include <endian.h>
+
+union wait
+ {
+ int w_status;
+ struct
+ {
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int __w_termsig:7; /* Terminating signal. */
+ unsigned int __w_coredump:1; /* Set if dumped core. */
+ unsigned int __w_retcode:8; /* Return code if exited normally. */
+ unsigned int:16;
+# endif /* Little endian. */
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int:16;
+ unsigned int __w_retcode:8;
+ unsigned int __w_coredump:1;
+ unsigned int __w_termsig:7;
+# endif /* Big endian. */
+ } __wait_terminated;
+ struct
+ {
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int __w_stopval:8; /* W_STOPPED if stopped. */
+ unsigned int __w_stopsig:8; /* Stopping signal. */
+ unsigned int:16;
+# endif /* Little endian. */
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int:16;
+ unsigned int __w_stopsig:8; /* Stopping signal. */
+ unsigned int __w_stopval:8; /* W_STOPPED if stopped. */
+# endif /* Big endian. */
+ } __wait_stopped;
+ };
+
+# define w_termsig __wait_terminated.__w_termsig
+# define w_coredump __wait_terminated.__w_coredump
+# define w_retcode __wait_terminated.__w_retcode
+# define w_stopsig __wait_stopped.__w_stopsig
+# define w_stopval __wait_stopped.__w_stopval
+
+#endif /* Use BSD. */
diff --git a/sysdeps/generic/bits/wchar.h b/sysdeps/generic/bits/wchar.h
new file mode 100644
index 0000000000..ef1f56363a
--- /dev/null
+++ b/sysdeps/generic/bits/wchar.h
@@ -0,0 +1,26 @@
+/* wchar_t type related definitions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_WCHAR_H
+#define _BITS_WCHAR_H 1
+
+#define __WCHAR_MIN (-2147483647 - 1)
+#define __WCHAR_MAX (2147483647)
+
+#endif /* bits/wchar.h */
diff --git a/sysdeps/generic/bits/wordsize.h b/sysdeps/generic/bits/wordsize.h
new file mode 100644
index 0000000000..9ef0e8526a
--- /dev/null
+++ b/sysdeps/generic/bits/wordsize.h
@@ -0,0 +1 @@
+#error "This file must be written based on the data type sizes of the target"
diff --git a/sysdeps/generic/bits/xtitypes.h b/sysdeps/generic/bits/xtitypes.h
new file mode 100644
index 0000000000..c21bfb036c
--- /dev/null
+++ b/sysdeps/generic/bits/xtitypes.h
@@ -0,0 +1,34 @@
+/* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. Generic.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _STROPTS_H
+# error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead."
+#endif
+
+#ifndef _BITS_XTITYPES_H
+#define _BITS_XTITYPES_H 1
+
+#include <bits/types.h>
+
+/* This type is used by some structs in <bits/stropts.h>. */
+typedef __SLONGWORD_TYPE __t_scalar_t;
+typedef __ULONGWORD_TYPE __t_uscalar_t;
+
+
+#endif /* bits/xtitypes.h */
diff --git a/sysdeps/generic/brdinit.c b/sysdeps/generic/brdinit.c
new file mode 100644
index 0000000000..af96bcd12a
--- /dev/null
+++ b/sysdeps/generic/brdinit.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+ On-Line Applications Research Corporation.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <standalone.h>
+
+/* This file is only required when a "bare" board is configured. */
+
+/* _Board_Initialize
+
+This routine normally performs board specific initialization. */
+
+void
+_Board_Initialize ()
+{
+}
diff --git a/sysdeps/generic/brk.c b/sysdeps/generic/brk.c
new file mode 100644
index 0000000000..b951819f21
--- /dev/null
+++ b/sysdeps/generic/brk.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* sbrk.c expects this. */
+void *__curbrk;
+
+/* Set the end of the process's data space to ADDR.
+ Return 0 if successful, -1 if not. */
+int
+__brk (addr)
+ void *addr;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (brk)
+
+weak_alias (__brk, brk)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/bsd-_setjmp.c b/sysdeps/generic/bsd-_setjmp.c
new file mode 100644
index 0000000000..884a4da9b6
--- /dev/null
+++ b/sysdeps/generic/bsd-_setjmp.c
@@ -0,0 +1,35 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. Stub version.
+ Copyright (C) 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <setjmp.h>
+
+#undef _setjmp
+
+/* This implementation in C will not usually work, because the call
+ really needs to be a tail-call so __sigsetjmp saves the state of
+ the caller, not the state of this `setjmp' frame which then
+ immediate unwinds. */
+
+int
+_setjmp (jmp_buf env)
+{
+ return __sigsetjmp (env, 0);
+}
+libc_hidden_def (_setjmp)
diff --git a/sysdeps/generic/bsd-setjmp.c b/sysdeps/generic/bsd-setjmp.c
new file mode 100644
index 0000000000..15f3f153cc
--- /dev/null
+++ b/sysdeps/generic/bsd-setjmp.c
@@ -0,0 +1,34 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. Stub version.
+ Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <setjmp.h>
+
+#undef setjmp
+
+/* This implementation in C will not usually work, because the call
+ really needs to be a tail-call so __sigsetjmp saves the state of
+ the caller, not the state of this `setjmp' frame which then
+ immediate unwinds. */
+
+int
+setjmp (jmp_buf env)
+{
+ return __sigsetjmp (env, 1);
+}
diff --git a/sysdeps/generic/bzero.c b/sysdeps/generic/bzero.c
new file mode 100644
index 0000000000..c6ede14139
--- /dev/null
+++ b/sysdeps/generic/bzero.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+#undef __bzero
+
+/* Set N bytes of S to 0. */
+void
+__bzero (s, len)
+ void *s;
+ size_t len;
+{
+ long int dstp = (long int) s;
+ const op_t zero = 0;
+
+ if (len >= 8)
+ {
+ size_t xlen;
+
+ /* There are at least some bytes to zero. No need to test
+ for LEN == 0 in this alignment loop. */
+ while (dstp % OPSIZ != 0)
+ {
+ ((byte *) dstp)[0] = 0;
+ dstp += 1;
+ len -= 1;
+ }
+
+ /* Write 8 op_t per iteration until less than 8 op_t remain. */
+ xlen = len / (OPSIZ * 8);
+ while (xlen != 0)
+ {
+ ((op_t *) dstp)[0] = zero;
+ ((op_t *) dstp)[1] = zero;
+ ((op_t *) dstp)[2] = zero;
+ ((op_t *) dstp)[3] = zero;
+ ((op_t *) dstp)[4] = zero;
+ ((op_t *) dstp)[5] = zero;
+ ((op_t *) dstp)[6] = zero;
+ ((op_t *) dstp)[7] = zero;
+ dstp += 8 * OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ * 8;
+
+ /* Write 1 op_t per iteration until less than op_t remain. */
+ xlen = len / OPSIZ;
+ while (xlen != 0)
+ {
+ ((op_t *) dstp)[0] = zero;
+ dstp += OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ;
+ }
+
+ /* Write the last few bytes. */
+ while (len != 0)
+ {
+ ((byte *) dstp)[0] = 0;
+ dstp += 1;
+ len -= 1;
+ }
+}
+weak_alias (__bzero, bzero)
diff --git a/sysdeps/generic/cabsf.c b/sysdeps/generic/cabsf.c
new file mode 100644
index 0000000000..956db76ba1
--- /dev/null
+++ b/sysdeps/generic/cabsf.c
@@ -0,0 +1,29 @@
+/* Return the complex absolute value of float complex value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+float
+__cabsf (float _Complex z)
+{
+ return __hypotf (__real__ z, __imag__ z);
+}
+weak_alias (__cabsf, cabsf)
diff --git a/sysdeps/generic/cargf.c b/sysdeps/generic/cargf.c
new file mode 100644
index 0000000000..df1f20bc48
--- /dev/null
+++ b/sysdeps/generic/cargf.c
@@ -0,0 +1,29 @@
+/* Compute argument of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+float
+__cargf (__complex__ float x)
+{
+ return __atan2f (__imag__ x, __real__ x);
+}
+weak_alias (__cargf, cargf)
diff --git a/sysdeps/generic/chdir.c b/sysdeps/generic/chdir.c
new file mode 100644
index 0000000000..afaeef8787
--- /dev/null
+++ b/sysdeps/generic/chdir.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+/* Change the current directory to PATH. */
+int
+__chdir (path)
+ const char *path;
+{
+ if (path == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (chdir)
+
+weak_alias (__chdir, chdir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/check_fds.c b/sysdeps/generic/check_fds.c
new file mode 100644
index 0000000000..5ae3feee3e
--- /dev/null
+++ b/sysdeps/generic/check_fds.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+/* Try to get a machine dependent instruction which will make the
+ program crash. This is used in case everything else fails. */
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+/* No such instruction is available. */
+# define ABORT_INSTRUCTION
+#endif
+
+#include <device-nrs.h>
+#include <not-cancel.h>
+
+
+/* Should other OSes (e.g., Hurd) have different versions which can
+ be written in a better way? */
+static void
+check_one_fd (int fd, int mode)
+{
+ /* Note that fcntl() with this parameter is not a cancellation point. */
+ if (__builtin_expect (__libc_fcntl (fd, F_GETFD), 0) == -1
+ && errno == EBADF)
+ {
+ struct stat64 st;
+
+ /* Something is wrong with this descriptor, it's probably not
+ opened. Open /dev/null so that the SUID program we are
+ about to start does not accidently use this descriptor. */
+ int nullfd = open_not_cancel (_PATH_DEVNULL, mode, 0);
+ /* We are very paranoid here. With all means we try to ensure
+ that we are actually opening the /dev/null device and nothing
+ else.
+
+ Note that the following code assumes that STDIN_FILENO,
+ STDOUT_FILENO, STDERR_FILENO are the three lowest file
+ decsriptor numbers, in this order. */
+ if (__builtin_expect (nullfd != fd, 0)
+ || __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0
+ || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
+#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
+ || st.st_rdev != makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)
+#endif
+ )
+ /* We cannot even give an error message here since it would
+ run into the same problems. */
+ while (1)
+ /* Try for ever and ever. */
+ ABORT_INSTRUCTION;
+ }
+}
+
+
+void
+__libc_check_standard_fds (void)
+{
+ /* This is really paranoid but some people actually are. If /dev/null
+ should happen to be a symlink to somewhere else and not the device
+ commonly known as "/dev/null" we bail out. We can detect this with
+ the O_NOFOLLOW flag for open() but only on some system. */
+#ifndef O_NOFOLLOW
+# define O_NOFOLLOW 0
+#endif
+ /* Check all three standard file descriptors. */
+ check_one_fd (STDIN_FILENO, O_RDONLY | O_NOFOLLOW);
+ check_one_fd (STDOUT_FILENO, O_RDWR | O_NOFOLLOW);
+ check_one_fd (STDERR_FILENO, O_RDWR | O_NOFOLLOW);
+}
diff --git a/sysdeps/generic/check_pf.c b/sysdeps/generic/check_pf.c
new file mode 100644
index 0000000000..5d98c98aff
--- /dev/null
+++ b/sysdeps/generic/check_pf.c
@@ -0,0 +1,50 @@
+/* Determine protocol families for which interfaces exist. Generic version.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ifaddrs.h>
+#include <netdb.h>
+
+
+void
+attribute_hidden
+__check_pf (bool *seen_ipv4, bool *seen_ipv6)
+{
+ /* Get the interface list via getifaddrs. */
+ struct ifaddrs *ifa = NULL;
+ if (getifaddrs (&ifa) != 0)
+ {
+ /* We cannot determine what interfaces are available. Be
+ pessimistic. */
+ *seen_ipv4 = true;
+ *seen_ipv6 = true;
+ return;
+ }
+
+ *seen_ipv4 = false;
+ *seen_ipv6 = false;
+
+ struct ifaddrs *runp;
+ for (runp = ifa; runp != NULL; runp = runp->ifa_next)
+ if (runp->ifa_addr->sa_family == PF_INET)
+ *seen_ipv4 = true;
+ else if (runp->ifa_addr->sa_family == PF_INET6)
+ *seen_ipv6 = true;
+
+ (void) freeifaddrs (ifa);
+}
diff --git a/sysdeps/generic/chflags.c b/sysdeps/generic/chflags.c
new file mode 100644
index 0000000000..b678121265
--- /dev/null
+++ b/sysdeps/generic/chflags.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Change the flags of FILE to FLAGS. */
+
+int chflags (const char *file, int flags) __THROW;
+
+int
+chflags (file, flags)
+ const char *file;
+ int flags;
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (chflags)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/chmod.c b/sysdeps/generic/chmod.c
new file mode 100644
index 0000000000..38b05127c9
--- /dev/null
+++ b/sysdeps/generic/chmod.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* Change the protections of FILE to MODE. */
+int
+__chmod (file, mode)
+ const char *file;
+ mode_t mode;
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (chmod)
+
+weak_alias (__chmod, chmod)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/chown.c b/sysdeps/generic/chown.c
new file mode 100644
index 0000000000..0e368f2ac4
--- /dev/null
+++ b/sysdeps/generic/chown.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2002
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Change the owner and group of FILE. */
+int
+__chown (file, owner, group)
+ const char *file;
+ uid_t owner;
+ gid_t group;
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__chown)
+stub_warning (chown)
+
+weak_alias (__chown, chown)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/chroot.c b/sysdeps/generic/chroot.c
new file mode 100644
index 0000000000..f20ccf4c2b
--- /dev/null
+++ b/sysdeps/generic/chroot.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make PATH be the root directory (the starting point for absolute paths).
+ This call is restricted to the super-user. */
+int
+chroot (path)
+ const char *path;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (chroot)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/cimagf.c b/sysdeps/generic/cimagf.c
new file mode 100644
index 0000000000..d4e441e69f
--- /dev/null
+++ b/sysdeps/generic/cimagf.c
@@ -0,0 +1,28 @@
+/* Return imaginary part of complex float value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+
+float
+__cimagf (float _Complex z)
+{
+ return __imag__ z;
+}
+weak_alias (__cimagf, cimagf)
diff --git a/sysdeps/generic/clock.c b/sysdeps/generic/clock.c
new file mode 100644
index 0000000000..99dc5f47e0
--- /dev/null
+++ b/sysdeps/generic/clock.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/times.h>
+#include <time.h>
+#include <errno.h>
+
+/* Return the time used by the program so far (user time + system time). */
+clock_t
+clock ()
+{
+ __set_errno (ENOSYS);
+ return (clock_t) -1;
+}
+
+stub_warning (clock)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_getcpuclockid.c b/sysdeps/generic/clock_getcpuclockid.c
new file mode 100644
index 0000000000..39c7e55f66
--- /dev/null
+++ b/sysdeps/generic/clock_getcpuclockid.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+#include <unistd.h>
+
+int
+clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
+{
+ /* We don't allow any process ID but our own. */
+ if (pid != 0 && pid != getpid ())
+ return EPERM;
+
+#ifdef CLOCK_PROCESS_CPUTIME_ID
+ /* Store the number. */
+ *clock_id = CLOCK_PROCESS_CPUTIME_ID;
+
+ return 0;
+#else
+ /* We don't have a timer for that. */
+ return ENOENT;
+#endif
+}
diff --git a/sysdeps/generic/clock_getres.c b/sysdeps/generic/clock_getres.c
new file mode 100644
index 0000000000..f5978da380
--- /dev/null
+++ b/sysdeps/generic/clock_getres.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Get resolution of clock. */
+int
+clock_getres (clockid_t clock_id, struct timespec *res)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (clock_getres)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_gettime.c b/sysdeps/generic/clock_gettime.c
new file mode 100644
index 0000000000..85bb79c548
--- /dev/null
+++ b/sysdeps/generic/clock_gettime.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Get current value of CLOCK and store it in TP. */
+int
+clock_gettime (clockid_t clock_id, struct timespec *tp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (clock_gettime)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_nanosleep.c b/sysdeps/generic/clock_nanosleep.c
new file mode 100644
index 0000000000..cff1c2570a
--- /dev/null
+++ b/sysdeps/generic/clock_nanosleep.c
@@ -0,0 +1,39 @@
+/* High-resolution sleep with the specified clock. Stub version.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/time.h>
+
+
+int
+clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
+ struct timespec *rem)
+{
+ if (__builtin_expect (req->tv_nsec, 0) < 0
+ || __builtin_expect (req->tv_nsec, 0) >= 1000000000)
+ return EINVAL;
+
+ if (flags != TIMER_ABSTIME && flags != 0)
+ return EINVAL;
+
+ /* Not implemented. */
+ return ENOSYS;
+}
+stub_warning (clock_nanosleep)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_settime.c b/sysdeps/generic/clock_settime.c
new file mode 100644
index 0000000000..9d6a92e058
--- /dev/null
+++ b/sysdeps/generic/clock_settime.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Set CLOCK to value TP. */
+int
+clock_settime (clockid_t clock_id, const struct timespec *tp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (clock_settime)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/close.c b/sysdeps/generic/close.c
new file mode 100644
index 0000000000..0856ba851b
--- /dev/null
+++ b/sysdeps/generic/close.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Close the file descriptor FD. */
+int
+__close (fd)
+ int fd;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__close)
+stub_warning (close)
+
+weak_alias (__close, close)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/closedir.c b/sysdeps/generic/closedir.c
new file mode 100644
index 0000000000..4410f02fb3
--- /dev/null
+++ b/sysdeps/generic/closedir.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+
+/* Close the directory stream DIRP.
+ Return 0 if successful, -1 if not. */
+int
+__closedir (DIR *dirp)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__closedir, closedir)
+
+stub_warning (closedir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/cmp.c b/sysdeps/generic/cmp.c
new file mode 100644
index 0000000000..8e9792f54e
--- /dev/null
+++ b/sysdeps/generic/cmp.c
@@ -0,0 +1,56 @@
+/* mpn_cmp -- Compare two low-level natural-number integers.
+
+Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+/* Compare OP1_PTR/OP1_SIZE with OP2_PTR/OP2_SIZE.
+ There are no restrictions on the relative sizes of
+ the two arguments.
+ Return 1 if OP1 > OP2, 0 if they are equal, and -1 if OP1 < OP2. */
+
+int
+#if __STDC__
+mpn_cmp (mp_srcptr op1_ptr, mp_srcptr op2_ptr, mp_size_t size)
+#else
+mpn_cmp (op1_ptr, op2_ptr, size)
+ mp_srcptr op1_ptr;
+ mp_srcptr op2_ptr;
+ mp_size_t size;
+#endif
+{
+ mp_size_t i;
+ mp_limb_t op1_word, op2_word;
+
+ for (i = size - 1; i >= 0; i--)
+ {
+ op1_word = op1_ptr[i];
+ op2_word = op2_ptr[i];
+ if (op1_word != op2_word)
+ goto diff;
+ }
+ return 0;
+ diff:
+ /* This can *not* be simplified to
+ op2_word - op2_word
+ since that expression might give signed overflow. */
+ return (op1_word > op2_word) ? 1 : -1;
+}
diff --git a/sysdeps/generic/configure b/sysdeps/generic/configure
new file mode 100755
index 0000000000..47f9ec0d5e
--- /dev/null
+++ b/sysdeps/generic/configure
@@ -0,0 +1,108 @@
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+
+if test -z "$inhibit_glue"; then
+# For signame.c, used in make_siglist.
+
+
+for ac_func in psignal
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+fi
diff --git a/sysdeps/generic/configure.in b/sysdeps/generic/configure.in
new file mode 100644
index 0000000000..393bc307e8
--- /dev/null
+++ b/sysdeps/generic/configure.in
@@ -0,0 +1,6 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+
+if test -z "$inhibit_glue"; then
+# For signame.c, used in make_siglist.
+AC_CHECK_FUNCS(psignal)
+fi
diff --git a/sysdeps/generic/conjf.c b/sysdeps/generic/conjf.c
new file mode 100644
index 0000000000..7893891933
--- /dev/null
+++ b/sysdeps/generic/conjf.c
@@ -0,0 +1,28 @@
+/* Return complex conjugate of complex float value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+
+float _Complex
+__conjf (float _Complex z)
+{
+ return ~z;
+}
+weak_alias (__conjf, conjf)
diff --git a/sysdeps/generic/connect.c b/sysdeps/generic/connect.c
new file mode 100644
index 0000000000..55093313c9
--- /dev/null
+++ b/sysdeps/generic/connect.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
+ For connectionless socket types, just set the default address to send to
+ and the only address from which to accept transmissions.
+ Return 0 on success, -1 for errors. */
+int
+__connect (fd, addr, len)
+ int fd;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__connect, connect)
+
+stub_warning (connect)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/console.c b/sysdeps/generic/console.c
new file mode 100644
index 0000000000..326ebed4a1
--- /dev/null
+++ b/sysdeps/generic/console.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+ On-Line Applications Research Corporation.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <standalone.h>
+
+/* This file is only required when a "bare" board is configured. */
+
+/* These routines provide console IO routines for your embedded target. */
+
+int
+_Console_Putc (ch)
+ char ch;
+{
+ /* eat the character */
+
+ return 0;
+}
+
+int
+_Console_Getc (poll)
+ int poll;
+{
+ /* boring user, never types anything */
+ return -1;
+}
diff --git a/sysdeps/generic/crealf.c b/sysdeps/generic/crealf.c
new file mode 100644
index 0000000000..e3235a874f
--- /dev/null
+++ b/sysdeps/generic/crealf.c
@@ -0,0 +1,28 @@
+/* Return real part of complex float value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+
+float
+__crealf (float _Complex z)
+{
+ return __real__ z;
+}
+weak_alias (__crealf, crealf)
diff --git a/sysdeps/generic/creat.c b/sysdeps/generic/creat.c
new file mode 100644
index 0000000000..462882415c
--- /dev/null
+++ b/sysdeps/generic/creat.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sysdep-cancel.h>
+
+#undef creat
+
+/* Create FILE with protections MODE. */
+int
+__libc_creat (file, mode)
+ const char *file;
+ mode_t mode;
+{
+ return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
+}
+weak_alias (__libc_creat, creat)
+
+/* __open handles cancellation. */
+LIBC_CANCEL_HANDLED ();
diff --git a/sysdeps/generic/creat64.c b/sysdeps/generic/creat64.c
new file mode 100644
index 0000000000..39f4580571
--- /dev/null
+++ b/sysdeps/generic/creat64.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fcntl.h>
+#include <sys/types.h>
+
+#undef creat
+
+/* Create FILE with protections MODE. */
+int
+creat64 (file, mode)
+ const char *file;
+ mode_t mode;
+{
+ return __open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
+}
diff --git a/sysdeps/generic/ctermid.c b/sysdeps/generic/ctermid.c
new file mode 100644
index 0000000000..e4d94eada2
--- /dev/null
+++ b/sysdeps/generic/ctermid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdio.h>
+
+
+/* Return the name of the controlling terminal.
+ If S is not NULL, the name is copied into it (it should be at
+ least L_ctermid bytes long), otherwise a static buffer is used. */
+char *
+ctermid (s)
+ char *s;
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+
+
+stub_warning (ctermid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/cuserid.c b/sysdeps/generic/cuserid.c
new file mode 100644
index 0000000000..826972f4de
--- /dev/null
+++ b/sysdeps/generic/cuserid.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <errno.h>
+
+/* Return the username of the caller.
+ If S is not NULL, it points to a buffer of at least L_cuserid bytes
+ into which the name is copied; otherwise, a static buffer is used. */
+char *
+cuserid (s)
+ char *s;
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+
+
+stub_warning (cuserid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/dbl2mpn.c b/sysdeps/generic/dbl2mpn.c
new file mode 100644
index 0000000000..773ca4fd6a
--- /dev/null
+++ b/sysdeps/generic/dbl2mpn.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+/* Convert a `double' to a multi-precision integer representing the
+ significand scaled up by the highest possible number of significant bits
+ of fraction (DBL_MANT_DIG), and an integral power of two (MPN frexp). */
+
+mp_size_t
+__mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
+ int *expt, int *is_neg,
+ double value)
+{
+#error "__mpn_extract_double is not implemented for this floating point format"
+}
diff --git a/sysdeps/generic/det_endian.c b/sysdeps/generic/det_endian.c
new file mode 100644
index 0000000000..4c86be3a85
--- /dev/null
+++ b/sysdeps/generic/det_endian.c
@@ -0,0 +1,35 @@
+/* Determine the "endianness" of the CPU.
+ Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+main ()
+{
+ unsigned long int i;
+
+ if (sizeof (i) != 4)
+ puts ("#error \"Not a 32-bit machine!\"");
+
+ i = (((((('4' << 8) + '3') << 8) + '2') << 8) + '1');
+
+ printf ("#define __BYTE_ORDER %.4s\n", (char *) &i);
+
+ exit (0);
+}
diff --git a/sysdeps/generic/dirfd.c b/sysdeps/generic/dirfd.c
new file mode 100644
index 0000000000..06c0cde435
--- /dev/null
+++ b/sysdeps/generic/dirfd.c
@@ -0,0 +1,33 @@
+/* Return the file descriptor used by a DIR stream. Stub version.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <dirent.h>
+#include <dirstream.h>
+#include <errno.h>
+
+int
+dirfd (dirp)
+ DIR *dirp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (dirfd)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/div.c b/sysdeps/generic/div.c
new file mode 100644
index 0000000000..5268f4c494
--- /dev/null
+++ b/sysdeps/generic/div.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 1992, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Copyright (c) 1990 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+
+/* Return the `div_t' representation of NUMER over DENOM. */
+div_t
+div (numer, denom)
+ int numer, denom;
+{
+ div_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ /* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
+ NUMER / DENOM is to be computed in infinite precision. In
+ other words, we should always truncate the quotient towards
+ zero, never -infinity. Machine division and remainer may
+ work either way when one or both of NUMER or DENOM is
+ negative. If only one is negative and QUOT has been
+ truncated towards -infinity, REM will have the same sign as
+ DENOM and the opposite sign of NUMER; if both are negative
+ and QUOT has been truncated towards -infinity, REM will be
+ positive (will have the opposite sign of NUMER). These are
+ considered `wrong'. If both are NUM and DENOM are positive,
+ RESULT will always be positive. This all boils down to: if
+ NUMER >= 0, but REM < 0, we got the wrong answer. In that
+ case, to get the right answer, add 1 to QUOT and subtract
+ DENOM from REM. */
+
+ if (numer >= 0 && result.rem < 0)
+ {
+ ++result.quot;
+ result.rem -= denom;
+ }
+
+ return result;
+}
diff --git a/sysdeps/generic/divmod_1.c b/sysdeps/generic/divmod_1.c
new file mode 100644
index 0000000000..50b97db72f
--- /dev/null
+++ b/sysdeps/generic/divmod_1.c
@@ -0,0 +1,208 @@
+/* mpn_divmod_1(quot_ptr, dividend_ptr, dividend_size, divisor_limb) --
+ Divide (DIVIDEND_PTR,,DIVIDEND_SIZE) by DIVISOR_LIMB.
+ Write DIVIDEND_SIZE limbs of quotient at QUOT_PTR.
+ Return the single-limb remainder.
+ There are no constraints on the value of the divisor.
+
+ QUOT_PTR and DIVIDEND_PTR might point to the same limb.
+
+Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#ifndef UMUL_TIME
+#define UMUL_TIME 1
+#endif
+
+#ifndef UDIV_TIME
+#define UDIV_TIME UMUL_TIME
+#endif
+
+/* FIXME: We should be using invert_limb (or invert_normalized_limb)
+ here (not udiv_qrnnd). */
+
+mp_limb_t
+#if __STDC__
+mpn_divmod_1 (mp_ptr quot_ptr,
+ mp_srcptr dividend_ptr, mp_size_t dividend_size,
+ mp_limb_t divisor_limb)
+#else
+mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
+ mp_ptr quot_ptr;
+ mp_srcptr dividend_ptr;
+ mp_size_t dividend_size;
+ mp_limb_t divisor_limb;
+#endif
+{
+ mp_size_t i;
+ mp_limb_t n1, n0, r;
+ int dummy;
+
+ /* ??? Should this be handled at all? Rely on callers? */
+ if (dividend_size == 0)
+ return 0;
+
+ /* If multiplication is much faster than division, and the
+ dividend is large, pre-invert the divisor, and use
+ only multiplications in the inner loop. */
+
+ /* This test should be read:
+ Does it ever help to use udiv_qrnnd_preinv?
+ && Does what we save compensate for the inversion overhead? */
+ if (UDIV_TIME > (2 * UMUL_TIME + 6)
+ && (UDIV_TIME - (2 * UMUL_TIME + 6)) * dividend_size > UDIV_TIME)
+ {
+ int normalization_steps;
+
+ count_leading_zeros (normalization_steps, divisor_limb);
+ if (normalization_steps != 0)
+ {
+ mp_limb_t divisor_limb_inverted;
+
+ divisor_limb <<= normalization_steps;
+
+ /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The
+ result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
+ most significant bit (with weight 2**N) implicit. */
+
+ /* Special case for DIVISOR_LIMB == 100...000. */
+ if (divisor_limb << 1 == 0)
+ divisor_limb_inverted = ~(mp_limb_t) 0;
+ else
+ udiv_qrnnd (divisor_limb_inverted, dummy,
+ -divisor_limb, 0, divisor_limb);
+
+ n1 = dividend_ptr[dividend_size - 1];
+ r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
+
+ /* Possible optimization:
+ if (r == 0
+ && divisor_limb > ((n1 << normalization_steps)
+ | (dividend_ptr[dividend_size - 2] >> ...)))
+ ...one division less... */
+
+ for (i = dividend_size - 2; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd_preinv (quot_ptr[i + 1], r, r,
+ ((n1 << normalization_steps)
+ | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
+ divisor_limb, divisor_limb_inverted);
+ n1 = n0;
+ }
+ udiv_qrnnd_preinv (quot_ptr[0], r, r,
+ n1 << normalization_steps,
+ divisor_limb, divisor_limb_inverted);
+ return r >> normalization_steps;
+ }
+ else
+ {
+ mp_limb_t divisor_limb_inverted;
+
+ /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The
+ result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
+ most significant bit (with weight 2**N) implicit. */
+
+ /* Special case for DIVISOR_LIMB == 100...000. */
+ if (divisor_limb << 1 == 0)
+ divisor_limb_inverted = ~(mp_limb_t) 0;
+ else
+ udiv_qrnnd (divisor_limb_inverted, dummy,
+ -divisor_limb, 0, divisor_limb);
+
+ i = dividend_size - 1;
+ r = dividend_ptr[i];
+
+ if (r >= divisor_limb)
+ r = 0;
+ else
+ {
+ quot_ptr[i] = 0;
+ i--;
+ }
+
+ for (; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd_preinv (quot_ptr[i], r, r,
+ n0, divisor_limb, divisor_limb_inverted);
+ }
+ return r;
+ }
+ }
+ else
+ {
+ if (UDIV_NEEDS_NORMALIZATION)
+ {
+ int normalization_steps;
+
+ count_leading_zeros (normalization_steps, divisor_limb);
+ if (normalization_steps != 0)
+ {
+ divisor_limb <<= normalization_steps;
+
+ n1 = dividend_ptr[dividend_size - 1];
+ r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
+
+ /* Possible optimization:
+ if (r == 0
+ && divisor_limb > ((n1 << normalization_steps)
+ | (dividend_ptr[dividend_size - 2] >> ...)))
+ ...one division less... */
+
+ for (i = dividend_size - 2; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd (quot_ptr[i + 1], r, r,
+ ((n1 << normalization_steps)
+ | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
+ divisor_limb);
+ n1 = n0;
+ }
+ udiv_qrnnd (quot_ptr[0], r, r,
+ n1 << normalization_steps,
+ divisor_limb);
+ return r >> normalization_steps;
+ }
+ }
+ /* No normalization needed, either because udiv_qrnnd doesn't require
+ it, or because DIVISOR_LIMB is already normalized. */
+
+ i = dividend_size - 1;
+ r = dividend_ptr[i];
+
+ if (r >= divisor_limb)
+ r = 0;
+ else
+ {
+ quot_ptr[i] = 0;
+ i--;
+ }
+
+ for (; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd (quot_ptr[i], r, r, n0, divisor_limb);
+ }
+ return r;
+ }
+}
diff --git a/sysdeps/generic/divrem.c b/sysdeps/generic/divrem.c
new file mode 100644
index 0000000000..609f3d789c
--- /dev/null
+++ b/sysdeps/generic/divrem.c
@@ -0,0 +1,245 @@
+/* mpn_divrem -- Divide natural numbers, producing both remainder and
+ quotient.
+
+Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+/* Divide num (NP/NSIZE) by den (DP/DSIZE) and write
+ the NSIZE-DSIZE least significant quotient limbs at QP
+ and the DSIZE long remainder at NP. If QEXTRA_LIMBS is
+ non-zero, generate that many fraction bits and append them after the
+ other quotient limbs.
+ Return the most significant limb of the quotient, this is always 0 or 1.
+
+ Preconditions:
+ 0. NSIZE >= DSIZE.
+ 1. The most significant bit of the divisor must be set.
+ 2. QP must either not overlap with the input operands at all, or
+ QP + DSIZE >= NP must hold true. (This means that it's
+ possible to put the quotient in the high part of NUM, right after the
+ remainder in NUM.
+ 3. NSIZE >= DSIZE, even if QEXTRA_LIMBS is non-zero. */
+
+mp_limb_t
+#if __STDC__
+mpn_divrem (mp_ptr qp, mp_size_t qextra_limbs,
+ mp_ptr np, mp_size_t nsize,
+ mp_srcptr dp, mp_size_t dsize)
+#else
+mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
+ mp_ptr qp;
+ mp_size_t qextra_limbs;
+ mp_ptr np;
+ mp_size_t nsize;
+ mp_srcptr dp;
+ mp_size_t dsize;
+#endif
+{
+ mp_limb_t most_significant_q_limb = 0;
+
+ switch (dsize)
+ {
+ case 0:
+ /* We are asked to divide by zero, so go ahead and do it! (To make
+ the compiler not remove this statement, return the value.) */
+ return 1 / dsize;
+
+ case 1:
+ {
+ mp_size_t i;
+ mp_limb_t n1;
+ mp_limb_t d;
+
+ d = dp[0];
+ n1 = np[nsize - 1];
+
+ if (n1 >= d)
+ {
+ n1 -= d;
+ most_significant_q_limb = 1;
+ }
+
+ qp += qextra_limbs;
+ for (i = nsize - 2; i >= 0; i--)
+ udiv_qrnnd (qp[i], n1, n1, np[i], d);
+ qp -= qextra_limbs;
+
+ for (i = qextra_limbs - 1; i >= 0; i--)
+ udiv_qrnnd (qp[i], n1, n1, 0, d);
+
+ np[0] = n1;
+ }
+ break;
+
+ case 2:
+ {
+ mp_size_t i;
+ mp_limb_t n1, n0, n2;
+ mp_limb_t d1, d0;
+
+ np += nsize - 2;
+ d1 = dp[1];
+ d0 = dp[0];
+ n1 = np[1];
+ n0 = np[0];
+
+ if (n1 >= d1 && (n1 > d1 || n0 >= d0))
+ {
+ sub_ddmmss (n1, n0, n1, n0, d1, d0);
+ most_significant_q_limb = 1;
+ }
+
+ for (i = qextra_limbs + nsize - 2 - 1; i >= 0; i--)
+ {
+ mp_limb_t q;
+ mp_limb_t r;
+
+ if (i >= qextra_limbs)
+ np--;
+ else
+ np[0] = 0;
+
+ if (n1 == d1)
+ {
+ /* Q should be either 111..111 or 111..110. Need special
+ treatment of this rare case as normal division would
+ give overflow. */
+ q = ~(mp_limb_t) 0;
+
+ r = n0 + d1;
+ if (r < d1) /* Carry in the addition? */
+ {
+ add_ssaaaa (n1, n0, r - d0, np[0], 0, d0);
+ qp[i] = q;
+ continue;
+ }
+ n1 = d0 - (d0 != 0);
+ n0 = -d0;
+ }
+ else
+ {
+ udiv_qrnnd (q, r, n1, n0, d1);
+ umul_ppmm (n1, n0, d0, q);
+ }
+
+ n2 = np[0];
+ q_test:
+ if (n1 > r || (n1 == r && n0 > n2))
+ {
+ /* The estimated Q was too large. */
+ q--;
+
+ sub_ddmmss (n1, n0, n1, n0, 0, d0);
+ r += d1;
+ if (r >= d1) /* If not carry, test Q again. */
+ goto q_test;
+ }
+
+ qp[i] = q;
+ sub_ddmmss (n1, n0, r, n2, n1, n0);
+ }
+ np[1] = n1;
+ np[0] = n0;
+ }
+ break;
+
+ default:
+ {
+ mp_size_t i;
+ mp_limb_t dX, d1, n0;
+
+ np += nsize - dsize;
+ dX = dp[dsize - 1];
+ d1 = dp[dsize - 2];
+ n0 = np[dsize - 1];
+
+ if (n0 >= dX)
+ {
+ if (n0 > dX || mpn_cmp (np, dp, dsize - 1) >= 0)
+ {
+ mpn_sub_n (np, np, dp, dsize);
+ n0 = np[dsize - 1];
+ most_significant_q_limb = 1;
+ }
+ }
+
+ for (i = qextra_limbs + nsize - dsize - 1; i >= 0; i--)
+ {
+ mp_limb_t q;
+ mp_limb_t n1, n2;
+ mp_limb_t cy_limb;
+
+ if (i >= qextra_limbs)
+ {
+ np--;
+ n2 = np[dsize];
+ }
+ else
+ {
+ n2 = np[dsize - 1];
+ MPN_COPY_DECR (np + 1, np, dsize);
+ np[0] = 0;
+ }
+
+ if (n0 == dX)
+ /* This might over-estimate q, but it's probably not worth
+ the extra code here to find out. */
+ q = ~(mp_limb_t) 0;
+ else
+ {
+ mp_limb_t r;
+
+ udiv_qrnnd (q, r, n0, np[dsize - 1], dX);
+ umul_ppmm (n1, n0, d1, q);
+
+ while (n1 > r || (n1 == r && n0 > np[dsize - 2]))
+ {
+ q--;
+ r += dX;
+ if (r < dX) /* I.e. "carry in previous addition?" */
+ break;
+ n1 -= n0 < d1;
+ n0 -= d1;
+ }
+ }
+
+ /* Possible optimization: We already have (q * n0) and (1 * n1)
+ after the calculation of q. Taking advantage of that, we
+ could make this loop make two iterations less. */
+
+ cy_limb = mpn_submul_1 (np, dp, dsize, q);
+
+ if (n2 != cy_limb)
+ {
+ mpn_add_n (np, np, dp, dsize);
+ q--;
+ }
+
+ qp[i] = q;
+ n0 = np[dsize - 1];
+ }
+ }
+ }
+
+ return most_significant_q_limb;
+}
diff --git a/sysdeps/generic/dl-brk.c b/sysdeps/generic/dl-brk.c
new file mode 100644
index 0000000000..c37cdfec33
--- /dev/null
+++ b/sysdeps/generic/dl-brk.c
@@ -0,0 +1,5 @@
+/* We can use the normal code but we also know the __curbrk is not exported
+ from ld.so. */
+extern void *__curbrk attribute_hidden;
+
+#include <brk.c>
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
new file mode 100644
index 0000000000..29886e194a
--- /dev/null
+++ b/sysdeps/generic/dl-cache.c
@@ -0,0 +1,311 @@
+/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
+ Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <assert.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <sys/mman.h>
+#include <dl-cache.h>
+#include <dl-procinfo.h>
+
+#include <stdio-common/_itoa.h>
+
+#ifndef _DL_PLATFORMS_COUNT
+# define _DL_PLATFORMS_COUNT 0
+#endif
+
+/* This is the starting address and the size of the mmap()ed file. */
+static struct cache_file *cache;
+static struct cache_file_new *cache_new;
+static size_t cachesize;
+
+/* 1 if cache_data + PTR points into the cache. */
+#define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size)
+
+#define SEARCH_CACHE(cache) \
+/* We use binary search since the table is sorted in the cache file. \
+ The first matching entry in the table is returned. \
+ It is important to use the same algorithm as used while generating \
+ the cache file. */ \
+do \
+ { \
+ left = 0; \
+ right = cache->nlibs - 1; \
+ \
+ while (left <= right) \
+ { \
+ __typeof__ (cache->libs[0].key) key; \
+ \
+ middle = (left + right) / 2; \
+ \
+ key = cache->libs[middle].key; \
+ \
+ /* Make sure string table indices are not bogus before using \
+ them. */ \
+ if (! _dl_cache_verify_ptr (key)) \
+ { \
+ cmpres = 1; \
+ break; \
+ } \
+ \
+ /* Actually compare the entry with the key. */ \
+ cmpres = _dl_cache_libcmp (name, cache_data + key); \
+ if (__builtin_expect (cmpres == 0, 0)) \
+ { \
+ /* Found it. LEFT now marks the last entry for which we \
+ know the name is correct. */ \
+ left = middle; \
+ \
+ /* There might be entries with this name before the one we \
+ found. So we have to find the beginning. */ \
+ while (middle > 0) \
+ { \
+ __typeof__ (cache->libs[0].key) key; \
+ \
+ key = cache->libs[middle - 1].key; \
+ /* Make sure string table indices are not bogus before \
+ using them. */ \
+ if (! _dl_cache_verify_ptr (key) \
+ /* Actually compare the entry. */ \
+ || _dl_cache_libcmp (name, cache_data + key) != 0) \
+ break; \
+ --middle; \
+ } \
+ \
+ do \
+ { \
+ int flags; \
+ __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \
+ \
+ /* Only perform the name test if necessary. */ \
+ if (middle > left \
+ /* We haven't seen this string so far. Test whether the \
+ index is ok and whether the name matches. Otherwise \
+ we are done. */ \
+ && (! _dl_cache_verify_ptr (lib->key) \
+ || (_dl_cache_libcmp (name, cache_data + lib->key) \
+ != 0))) \
+ break; \
+ \
+ flags = lib->flags; \
+ if (_dl_cache_check_flags (flags) \
+ && _dl_cache_verify_ptr (lib->value)) \
+ { \
+ if (best == NULL || flags == GLRO(dl_correct_cache_id)) \
+ { \
+ HWCAP_CHECK; \
+ best = cache_data + lib->value; \
+ \
+ if (flags == GLRO(dl_correct_cache_id)) \
+ /* We've found an exact match for the shared \
+ object and no general `ELF' release. Stop \
+ searching. */ \
+ break; \
+ } \
+ } \
+ } \
+ while (++middle <= right); \
+ break; \
+ } \
+ \
+ if (cmpres < 0) \
+ left = middle + 1; \
+ else \
+ right = middle - 1; \
+ } \
+ } \
+while (0)
+
+
+int
+internal_function
+_dl_cache_libcmp (const char *p1, const char *p2)
+{
+ while (*p1 != '\0')
+ {
+ if (*p1 >= '0' && *p1 <= '9')
+ {
+ if (*p2 >= '0' && *p2 <= '9')
+ {
+ /* Must compare this numerically. */
+ int val1;
+ int val2;
+
+ val1 = *p1++ - '0';
+ val2 = *p2++ - '0';
+ while (*p1 >= '0' && *p1 <= '9')
+ val1 = val1 * 10 + *p1++ - '0';
+ while (*p2 >= '0' && *p2 <= '9')
+ val2 = val2 * 10 + *p2++ - '0';
+ if (val1 != val2)
+ return val1 - val2;
+ }
+ else
+ return 1;
+ }
+ else if (*p2 >= '0' && *p2 <= '9')
+ return -1;
+ else if (*p1 != *p2)
+ return *p1 - *p2;
+ else
+ {
+ ++p1;
+ ++p2;
+ }
+ }
+ return *p1 - *p2;
+}
+
+
+/* Look up NAME in ld.so.cache and return the file name stored there,
+ or null if none is found. */
+
+const char *
+internal_function
+_dl_load_cache_lookup (const char *name)
+{
+ int left, right, middle;
+ int cmpres;
+ const char *cache_data;
+ uint32_t cache_data_size;
+ const char *best;
+
+ /* Print a message if the loading of libs is traced. */
+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
+ _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
+
+ if (cache == NULL)
+ {
+ /* Read the contents of the file. */
+ void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize,
+ PROT_READ);
+
+ /* We can handle three different cache file formats here:
+ - the old libc5/glibc2.0/2.1 format
+ - the old format with the new format in it
+ - only the new format
+ The following checks if the cache contains any of these formats. */
+ if (file != MAP_FAILED && cachesize > sizeof *cache
+ && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0)
+ {
+ size_t offset;
+ /* Looks ok. */
+ cache = file;
+
+ /* Check for new version. */
+ offset = ALIGN_CACHE (sizeof (struct cache_file)
+ + cache->nlibs * sizeof (struct file_entry));
+
+ cache_new = (struct cache_file_new *) ((void *) cache + offset);
+ if (cachesize < (offset + sizeof (struct cache_file_new))
+ || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW,
+ sizeof CACHEMAGIC_VERSION_NEW - 1) != 0)
+ cache_new = (void *) -1;
+ }
+ else if (file != MAP_FAILED && cachesize > sizeof *cache_new
+ && memcmp (file, CACHEMAGIC_VERSION_NEW,
+ sizeof CACHEMAGIC_VERSION_NEW - 1) == 0)
+ {
+ cache_new = file;
+ cache = file;
+ }
+ else
+ {
+ if (file != MAP_FAILED)
+ __munmap (file, cachesize);
+ cache = (void *) -1;
+ }
+
+ assert (cache != NULL);
+ }
+
+ if (cache == (void *) -1)
+ /* Previously looked for the cache file and didn't find it. */
+ return NULL;
+
+ best = NULL;
+
+ if (cache_new != (void *) -1)
+ {
+ uint64_t platform;
+
+ /* This is where the strings start. */
+ cache_data = (const char *) cache_new;
+
+ /* Now we can compute how large the string table is. */
+ cache_data_size = (const char *) cache + cachesize - cache_data;
+
+ platform = _dl_string_platform (GLRO(dl_platform));
+ if (platform != (uint64_t) -1)
+ platform = 1ULL << platform;
+
+ /* Only accept hwcap if it's for the right platform. */
+#ifdef USE_TLS
+# define _DL_HWCAP_TLS_MASK (1LL << 63)
+#else
+# define _DL_HWCAP_TLS_MASK 0
+#endif
+#define HWCAP_CHECK \
+ if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \
+ continue; \
+ if (_DL_PLATFORMS_COUNT && platform != -1 \
+ && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \
+ && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \
+ continue; \
+ if (lib->hwcap \
+ & ~(GLRO(dl_hwcap) | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK)) \
+ continue
+ SEARCH_CACHE (cache_new);
+ }
+ else
+ {
+ /* This is where the strings start. */
+ cache_data = (const char *) &cache->libs[cache->nlibs];
+
+ /* Now we can compute how large the string table is. */
+ cache_data_size = (const char *) cache + cachesize - cache_data;
+
+#undef HWCAP_CHECK
+#define HWCAP_CHECK do {} while (0)
+ SEARCH_CACHE (cache);
+ }
+
+ /* Print our result if wanted. */
+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
+ && best != NULL)
+ _dl_debug_printf (" trying file=%s\n", best);
+
+ return best;
+}
+
+#ifndef MAP_COPY
+/* If the system does not support MAP_COPY we cannot leave the file open
+ all the time since this would create problems when the file is replaced.
+ Therefore we provide this function to close the file and open it again
+ once needed. */
+void
+_dl_unload_cache (void)
+{
+ if (cache != NULL && cache != (struct cache_file *) -1)
+ {
+ __munmap (cache, cachesize);
+ cache = NULL;
+ }
+}
+#endif
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index 7cc02d993b..c2b72874cf 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -36,14 +36,6 @@
# define add_system_dir(dir) add_dir (dir)
#endif
-#ifndef arch_startup
-# define arch_startup(argc, argv) do { } while (0)
-#endif
-
-#ifndef add_arch_dirs
-# define add_arch_dirs(config_file) do { } while (0)
-#endif
-
#define CACHEMAGIC "ld.so-1.7.0"
/* libc5 and glibc 2.0/2.1 use the same format. For glibc 2.2 another
diff --git a/sysdeps/generic/dl-environ.c b/sysdeps/generic/dl-environ.c
new file mode 100644
index 0000000000..089e89e6e7
--- /dev/null
+++ b/sysdeps/generic/dl-environ.c
@@ -0,0 +1,86 @@
+/* Environment handling for dynamic loader.
+ Copyright (C) 1995-1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+
+/* Walk through the environment of the process and return all entries
+ starting with `LD_'. */
+char *
+internal_function
+_dl_next_ld_env_entry (char ***position)
+{
+ char **current = *position;
+ char *result = NULL;
+
+ while (*current != NULL)
+ {
+ if (__builtin_expect ((*current)[0] == 'L', 0)
+ && (*current)[1] == 'D' && (*current)[2] == '_')
+ {
+ result = &(*current)[3];
+
+ /* Save current position for next visit. */
+ *position = ++current;
+
+ break;
+ }
+
+ ++current;
+ }
+
+ return result;
+}
+
+
+/* In ld.so __environ is not exported. */
+extern char **__environ attribute_hidden;
+
+int
+unsetenv (const char *name)
+{
+ char **ep;
+
+ ep = __environ;
+ while (*ep != NULL)
+ {
+ size_t cnt = 0;
+
+ while ((*ep)[cnt] == name[cnt] && name[cnt] != '\0')
+ ++cnt;
+
+ if (name[cnt] == '\0' && (*ep)[cnt] == '=')
+ {
+ /* Found it. Remove this pointer by moving later ones to
+ the front. */
+ char **dp = ep;
+
+ do
+ dp[0] = dp[1];
+ while (*dp++);
+ /* Continue the loop in case NAME appears again. */
+ }
+ else
+ ++ep;
+ }
+
+ return 0;
+}
diff --git a/sysdeps/generic/dl-execstack.c b/sysdeps/generic/dl-execstack.c
new file mode 100644
index 0000000000..6dce21e7a1
--- /dev/null
+++ b/sysdeps/generic/dl-execstack.c
@@ -0,0 +1,32 @@
+/* Stack executability handling for GNU dynamic linker. Stub version.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ldsodefs.h>
+#include <errno.h>
+
+/* There is no portable way to know the bounds of the initial thread's stack
+ so as to mprotect it. */
+
+int
+internal_function
+_dl_make_stack_executable (void **stack_endp)
+{
+ return ENOSYS;
+}
+rtld_hidden_def (_dl_make_stack_executable)
diff --git a/sysdeps/generic/dl-fptr.c b/sysdeps/generic/dl-fptr.c
new file mode 100644
index 0000000000..78beecfdcb
--- /dev/null
+++ b/sysdeps/generic/dl-fptr.c
@@ -0,0 +1,323 @@
+/* Manage function descriptors. Generic version.
+ Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <libintl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <link.h>
+#include <ldsodefs.h>
+#include <elf/dynamic-link.h>
+#include <dl-fptr.h>
+#include <atomic.h>
+
+#ifndef ELF_MACHINE_BOOT_FPTR_TABLE_LEN
+/* ELF_MACHINE_BOOT_FPTR_TABLE_LEN should be greater than the number of
+ dynamic symbols in ld.so. */
+# define ELF_MACHINE_BOOT_FPTR_TABLE_LEN 256
+#endif
+
+#ifndef ELF_MACHINE_LOAD_ADDRESS
+# error "ELF_MACHINE_LOAD_ADDRESS is not defined."
+#endif
+
+#ifndef COMPARE_AND_SWAP
+# define COMPARE_AND_SWAP(ptr, old, new) \
+ (atomic_compare_and_exchange_bool_acq (ptr, new, old) == 0)
+#endif
+
+ElfW(Addr) _dl_boot_fptr_table [ELF_MACHINE_BOOT_FPTR_TABLE_LEN];
+
+static struct local
+ {
+ struct fdesc_table *root;
+ struct fdesc *free_list;
+ unsigned int npages; /* # of pages to allocate */
+ /* the next to members MUST be consecutive! */
+ struct fdesc_table boot_table;
+ struct fdesc boot_fdescs[1024];
+ }
+local =
+ {
+ .root = &local.boot_table,
+ .npages = 2,
+ .boot_table =
+ {
+ .len = sizeof (local.boot_fdescs) / sizeof (local.boot_fdescs[0]),
+ .first_unused = 0
+ }
+ };
+
+/* Create a new fdesc table and return a pointer to the first fdesc
+ entry. The fdesc lock must have been acquired already. */
+
+static struct fdesc_table *
+new_fdesc_table (struct local *l, size_t *size)
+{
+ size_t old_npages = l->npages;
+ size_t new_npages = old_npages + old_npages;
+ struct fdesc_table *new_table;
+
+ /* If someone has just created a new table, we return NULL to tell
+ the caller to use the new table. */
+ if (! COMPARE_AND_SWAP (&l->npages, old_npages, new_npages))
+ return (struct fdesc_table *) NULL;
+
+ *size = old_npages * GLRO(dl_pagesize);
+ new_table = __mmap (NULL, *size,
+ PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
+ if (new_table == MAP_FAILED)
+ _dl_signal_error (errno, NULL, NULL,
+ N_("cannot map pages for fdesc table"));
+
+ new_table->len
+ = (*size - sizeof (*new_table)) / sizeof (struct fdesc);
+ new_table->first_unused = 1;
+ return new_table;
+}
+
+
+static ElfW(Addr)
+make_fdesc (ElfW(Addr) ip, ElfW(Addr) gp)
+{
+ struct fdesc *fdesc = NULL;
+ struct fdesc_table *root;
+ unsigned int old;
+ struct local *l;
+
+ ELF_MACHINE_LOAD_ADDRESS (l, local);
+
+ retry:
+ root = l->root;
+ while (1)
+ {
+ old = root->first_unused;
+ if (old >= root->len)
+ break;
+ else if (COMPARE_AND_SWAP (&root->first_unused, old, old + 1))
+ {
+ fdesc = &root->fdesc[old];
+ goto install;
+ }
+ }
+
+ if (l->free_list)
+ {
+ /* Get it from free-list. */
+ do
+ {
+ fdesc = l->free_list;
+ if (fdesc == NULL)
+ goto retry;
+ }
+ while (! COMPARE_AND_SWAP ((ElfW(Addr) *) &l->free_list,
+ (ElfW(Addr)) fdesc, fdesc->ip));
+ }
+ else
+ {
+ /* Create a new fdesc table. */
+ size_t size;
+ struct fdesc_table *new_table = new_fdesc_table (l, &size);
+
+ if (new_table == NULL)
+ goto retry;
+
+ new_table->next = root;
+ if (! COMPARE_AND_SWAP ((ElfW(Addr) *) &l->root,
+ (ElfW(Addr)) root,
+ (ElfW(Addr)) new_table))
+ {
+ /* Someone has just installed a new table. Return NULL to
+ tell the caller to use the new table. */
+ __munmap (new_table, size);
+ goto retry;
+ }
+
+ /* Note that the first entry was reserved while allocating the
+ memory for the new page. */
+ fdesc = &new_table->fdesc[0];
+ }
+
+ install:
+ fdesc->ip = ip;
+ fdesc->gp = gp;
+
+ return (ElfW(Addr)) fdesc;
+}
+
+
+static inline ElfW(Addr) * __attribute__ ((always_inline))
+make_fptr_table (struct link_map *map)
+{
+ const ElfW(Sym) *symtab
+ = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
+ const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+ ElfW(Addr) *fptr_table;
+ size_t size;
+ size_t len;
+
+ /* XXX Apparently the only way to find out the size of the dynamic
+ symbol section is to assume that the string table follows right
+ afterwards... */
+ len = ((strtab - (char *) symtab)
+ / map->l_info[DT_SYMENT]->d_un.d_val);
+ size = ((len * sizeof (fptr_table[0]) + GLRO(dl_pagesize) - 1)
+ & -GLRO(dl_pagesize));
+ /* XXX We don't support here in the moment systems without MAP_ANON.
+ There probably are none for IA-64. In case this is proven wrong
+ we will have to open /dev/null here and use the file descriptor
+ instead of the hard-coded -1. */
+ fptr_table = __mmap (NULL, size,
+ PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE,
+ -1, 0);
+ if (fptr_table == MAP_FAILED)
+ _dl_signal_error (errno, NULL, NULL,
+ N_("cannot map pages for fptr table"));
+
+ if (COMPARE_AND_SWAP ((ElfW(Addr) *) &map->l_mach.fptr_table,
+ (ElfW(Addr)) NULL, (ElfW(Addr)) fptr_table))
+ map->l_mach.fptr_table_len = len;
+ else
+ __munmap (fptr_table, len * sizeof (fptr_table[0]));
+
+ return map->l_mach.fptr_table;
+}
+
+
+ElfW(Addr)
+_dl_make_fptr (struct link_map *map, const ElfW(Sym) *sym,
+ ElfW(Addr) ip)
+{
+ ElfW(Addr) *ftab = map->l_mach.fptr_table;
+ const ElfW(Sym) *symtab;
+ Elf_Symndx symidx;
+ struct local *l;
+
+ if (__builtin_expect (ftab == NULL, 0))
+ ftab = make_fptr_table (map);
+
+ symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
+ symidx = sym - symtab;
+
+ if (symidx >= map->l_mach.fptr_table_len)
+ _dl_signal_error (0, NULL, NULL,
+ N_("internal error: symidx out of range of fptr table"));
+
+ while (ftab[symidx] == 0)
+ {
+ /* GOT has already been relocated in elf_get_dynamic_info -
+ don't try to relocate it again. */
+ ElfW(Addr) fdesc
+ = make_fdesc (ip, map->l_info[DT_PLTGOT]->d_un.d_ptr);
+
+ if (__builtin_expect (COMPARE_AND_SWAP (&ftab[symidx], (ElfW(Addr)) NULL,
+ fdesc), 1))
+ {
+ /* Noone has updated the entry and the new function
+ descriptor has been installed. */
+#if 0
+ const char *strtab
+ = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+
+ ELF_MACHINE_LOAD_ADDRESS (l, local);
+ if (l->root != &l->boot_table
+ || l->boot_table.first_unused > 20)
+ _dl_debug_printf ("created fdesc symbol `%s' at %lx\n",
+ strtab + sym->st_name, ftab[symidx]);
+#endif
+ break;
+ }
+ else
+ {
+ /* We created a duplicated function descriptor. We put it on
+ free-list. */
+ struct fdesc *f = (struct fdesc *) fdesc;
+
+ ELF_MACHINE_LOAD_ADDRESS (l, local);
+
+ do
+ f->ip = (ElfW(Addr)) l->free_list;
+ while (! COMPARE_AND_SWAP ((ElfW(Addr) *) &l->free_list,
+ f->ip, fdesc));
+ }
+ }
+
+ return ftab[symidx];
+}
+
+
+void
+_dl_unmap (struct link_map *map)
+{
+ ElfW(Addr) *ftab = map->l_mach.fptr_table;
+ struct fdesc *head = NULL, *tail = NULL;
+ size_t i;
+
+ __munmap ((void *) map->l_map_start,
+ map->l_map_end - map->l_map_start);
+
+ if (ftab == NULL)
+ return;
+
+ /* String together the fdesc structures that are being freed. */
+ for (i = 0; i < map->l_mach.fptr_table_len; ++i)
+ {
+ if (ftab[i])
+ {
+ *(struct fdesc **) ftab[i] = head;
+ head = (struct fdesc *) ftab[i];
+ if (tail == NULL)
+ tail = head;
+ }
+ }
+
+ /* Prepend the new list to the free_list: */
+ if (tail)
+ do
+ tail->ip = (ElfW(Addr)) local.free_list;
+ while (! COMPARE_AND_SWAP ((ElfW(Addr) *) &local.free_list,
+ tail->ip, (ElfW(Addr)) head));
+
+ __munmap (ftab, (map->l_mach.fptr_table_len
+ * sizeof (map->l_mach.fptr_table[0])));
+
+ map->l_mach.fptr_table = NULL;
+}
+
+
+ElfW(Addr)
+_dl_lookup_address (const void *address)
+{
+ ElfW(Addr) addr = (ElfW(Addr)) address;
+ struct fdesc_table *t;
+ unsigned long int i;
+
+ for (t = local.root; t != NULL; t = t->next)
+ {
+ i = (struct fdesc *) addr - &t->fdesc[0];
+ if (i < t->first_unused && addr == (ElfW(Addr)) &t->fdesc[i])
+ {
+ addr = t->fdesc[i].ip;
+ break;
+ }
+ }
+
+ return addr;
+}
diff --git a/sysdeps/generic/dl-fptr.h b/sysdeps/generic/dl-fptr.h
index d47fb7b635..8156981e6e 100644
--- a/sysdeps/generic/dl-fptr.h
+++ b/sysdeps/generic/dl-fptr.h
@@ -36,8 +36,6 @@ struct fdesc_table
struct fdesc fdesc[0];
};
-struct link_map;
-
extern ElfW(Addr) _dl_boot_fptr_table [];
extern ElfW(Addr) _dl_make_fptr (struct link_map *, const ElfW(Sym) *,
diff --git a/sysdeps/generic/dl-hash.h b/sysdeps/generic/dl-hash.h
index 243ae14b51..a84bf2416d 100644
--- a/sysdeps/generic/dl-hash.h
+++ b/sysdeps/generic/dl-hash.h
@@ -1,5 +1,5 @@
/* Compute hash value for given string according to ELF standard.
- Copyright (C) 1995,1996,1997,1998,2003,2005 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,9 +25,8 @@
first five operations no overflow is possible so we optimized it a
bit. */
static unsigned int
-_dl_elf_hash (const char *name_arg)
+_dl_elf_hash (const unsigned char *name)
{
- const unsigned char *name = (const unsigned char *) name_arg;
unsigned long int hash = 0;
if (*name != '\0')
{
diff --git a/sysdeps/generic/dl-lookupcfg.h b/sysdeps/generic/dl-lookupcfg.h
index 2b29989600..f48cb0a844 100644
--- a/sysdeps/generic/dl-lookupcfg.h
+++ b/sysdeps/generic/dl-lookupcfg.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,13 +17,16 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* The type of the return value of fixup/profile_fixup. */
-#define DL_FIXUP_VALUE_TYPE ElfW(Addr)
-/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address
- and a link map. */
-#define DL_FIXUP_MAKE_VALUE(map, addr) (addr)
-/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.
- */
-#define DL_FIXUP_VALUE_CODE_ADDR(value) (value)
-#define DL_FIXUP_VALUE_ADDR(value) (value)
-#define DL_FIXUP_ADDR_VALUE(addr) (addr)
+/* Some platforms need more information from the symbol lookup function
+ than just the address. But this is not generally the case.
+
+ However, because of how _dl_sym and _dl_tls_symaddr are written, every
+ platform needs it when we support TLS. */
+
+#include <tls.h> /* Defines USE_TLS (or doesn't). */
+
+#ifdef USE_TLS
+# define DL_LOOKUP_RETURNS_MAP
+#else
+# undef DL_LOOKUP_RETURNS_MAP
+#endif
diff --git a/sysdeps/generic/dl-machine.h b/sysdeps/generic/dl-machine.h
index c3459f5e32..8b4425cea4 100644
--- a/sysdeps/generic/dl-machine.h
+++ b/sysdeps/generic/dl-machine.h
@@ -1,6 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. Stub version.
- Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2005
- Free Software Foundation, Inc.
+ Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -65,8 +64,7 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t,
LOADADDR is the load address of the object; INFO is an array indexed
by DT_* of the .dynamic section info. */
-auto inline void
-__attribute__ ((always_inline))
+static inline void
elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
const Elf32_Rel *reloc, const Elf32_Sym *sym,
Elf32_Addr (*resolve) (const Elf32_Sym **ref,
@@ -89,8 +87,7 @@ elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
}
-auto inline Elf32_Addr
-__attribute__ ((always_inline))
+static inline Elf32_Addr
elf_machine_rela (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
const Elf32_Rel *reloc, const Elf32_Sym *sym,
Elf32_Addr (*resolve) (const Elf32_Sym **ref,
diff --git a/sysdeps/generic/dl-origin.c b/sysdeps/generic/dl-origin.c
new file mode 100644
index 0000000000..87619379bc
--- /dev/null
+++ b/sysdeps/generic/dl-origin.c
@@ -0,0 +1,51 @@
+/* Find path of executable.
+ Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/param.h>
+#include <ldsodefs.h>
+
+#include <dl-dst.h>
+
+
+const char *
+_dl_get_origin (void)
+{
+ char *result = (char *) -1;
+ /* We use the environment variable LD_ORIGIN_PATH. If it is set make
+ a copy and strip out trailing slashes. */
+ if (GLRO(dl_origin_path) != NULL)
+ {
+ size_t len = strlen (GLRO(dl_origin_path));
+ result = (char *) malloc (len + 1);
+ if (result == NULL)
+ result = (char *) -1;
+ else
+ {
+ char *cp = __mempcpy (result, GLRO(dl_origin_path), len);
+ while (cp > result + 1 && cp[-1] == '/')
+ --cp;
+ *cp = '\0';
+ }
+ }
+
+ return result;
+}
diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h
index 60b84a900d..b8e40d5a76 100644
--- a/sysdeps/generic/dl-osinfo.h
+++ b/sysdeps/generic/dl-osinfo.h
@@ -1,12 +1 @@
-#include <stdint.h>
-
-static inline uintptr_t __attribute__ ((always_inline))
-_dl_setup_stack_chk_guard (void)
-{
- uintptr_t ret = 0;
- unsigned char *p = (unsigned char *) &ret;
- p[sizeof (ret) - 1] = 255;
- p[sizeof (ret) - 2] = '\n';
- p[0] = 0;
- return ret;
-}
+/* Nothing needed in general. */
diff --git a/sysdeps/generic/dl-sbrk.c b/sysdeps/generic/dl-sbrk.c
new file mode 100644
index 0000000000..4713a92694
--- /dev/null
+++ b/sysdeps/generic/dl-sbrk.c
@@ -0,0 +1,5 @@
+/* We can use the normal code but we also know the __curbrk is not exported
+ from ld.so. */
+extern void *__curbrk attribute_hidden;
+
+#include <sbrk.c>
diff --git a/sysdeps/generic/dl-symaddr.c b/sysdeps/generic/dl-symaddr.c
new file mode 100644
index 0000000000..3c850ca835
--- /dev/null
+++ b/sysdeps/generic/dl-symaddr.c
@@ -0,0 +1,33 @@
+/* Get the symbol address. Generic version.
+ Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ldsodefs.h>
+#include <dl-fptr.h>
+
+void *
+_dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
+{
+ ElfW(Addr) value = (map ? map->l_addr : 0) + ref->st_value;
+
+ /* Return the pointer to function descriptor. */
+ if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC)
+ return (void *) _dl_make_fptr (map, ref, value);
+ else
+ return (void *) value;
+}
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
new file mode 100644
index 0000000000..34498a880c
--- /dev/null
+++ b/sysdeps/generic/dl-sysdep.c
@@ -0,0 +1,519 @@
+/* Operating system support for run-time dynamic linker. Generic Unix version.
+ Copyright (C) 1995-1998, 2000-2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <assert.h>
+#include <elf.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <ldsodefs.h>
+#include <stdio-common/_itoa.h>
+#include <fpu_control.h>
+
+#include <entry.h>
+#include <dl-machine.h>
+#include <dl-procinfo.h>
+#include <dl-osinfo.h>
+#include <hp-timing.h>
+#include <tls.h>
+
+extern char **_environ attribute_hidden;
+extern void _end attribute_hidden;
+
+/* Protect SUID program against misuse of file descriptors. */
+extern void __libc_check_standard_fds (void);
+
+#ifdef NEED_DL_BASE_ADDR
+ElfW(Addr) _dl_base_addr;
+#endif
+int __libc_enable_secure attribute_relro = 0;
+INTVARDEF(__libc_enable_secure)
+int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion
+ of init-first. */
+/* This variable contains the lowest stack address ever used. */
+void *__libc_stack_end attribute_relro = NULL;
+rtld_hidden_data_def(__libc_stack_end)
+static ElfW(auxv_t) *_dl_auxv attribute_relro;
+
+#ifndef DL_FIND_ARG_COMPONENTS
+# define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \
+ do { \
+ void **_tmp; \
+ (argc) = *(long int *) cookie; \
+ (argv) = (char **) ((long int *) cookie + 1); \
+ (envp) = (argv) + (argc) + 1; \
+ for (_tmp = (void **) (envp); *_tmp; ++_tmp) \
+ continue; \
+ (auxp) = (void *) ++_tmp; \
+ } while (0)
+#endif
+
+#ifndef DL_STACK_END
+# define DL_STACK_END(cookie) ((void *) (cookie))
+#endif
+
+ElfW(Addr)
+_dl_sysdep_start (void **start_argptr,
+ void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
+ ElfW(Addr) *user_entry))
+{
+ const ElfW(Phdr) *phdr = NULL;
+ ElfW(Word) phnum = 0;
+ ElfW(Addr) user_entry;
+ ElfW(auxv_t) *av;
+#ifdef HAVE_AUX_SECURE
+# define set_seen(tag) (tag) /* Evaluate for the side effects. */
+# define set_seen_secure() ((void) 0)
+#else
+ uid_t uid = 0;
+ gid_t gid = 0;
+ unsigned int seen = 0;
+# define set_seen_secure() (seen = -1)
+# ifdef HAVE_AUX_XID
+# define set_seen(tag) (tag) /* Evaluate for the side effects. */
+# else
+# define M(type) (1 << (type))
+# define set_seen(tag) seen |= M ((tag)->a_type)
+# endif
+#endif
+#ifdef NEED_DL_SYSINFO
+ uintptr_t new_sysinfo = 0;
+#endif
+
+ __libc_stack_end = DL_STACK_END (start_argptr);
+ DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, INTUSE(_dl_argv), _environ,
+ _dl_auxv);
+
+ user_entry = (ElfW(Addr)) ENTRY_POINT;
+ GLRO(dl_platform) = NULL; /* Default to nothing known about the platform. */
+
+ for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++))
+ switch (av->a_type)
+ {
+ case AT_PHDR:
+ phdr = av->a_un.a_ptr;
+ break;
+ case AT_PHNUM:
+ phnum = av->a_un.a_val;
+ break;
+ case AT_PAGESZ:
+ GLRO(dl_pagesize) = av->a_un.a_val;
+ break;
+ case AT_ENTRY:
+ user_entry = av->a_un.a_val;
+ break;
+#ifdef NEED_DL_BASE_ADDR
+ case AT_BASE:
+ _dl_base_addr = av->a_un.a_val;
+ break;
+#endif
+#ifndef HAVE_AUX_SECURE
+ case AT_UID:
+ case AT_EUID:
+ uid ^= av->a_un.a_val;
+ break;
+ case AT_GID:
+ case AT_EGID:
+ gid ^= av->a_un.a_val;
+ break;
+#endif
+ case AT_SECURE:
+#ifndef HAVE_AUX_SECURE
+ seen = -1;
+#endif
+ INTUSE(__libc_enable_secure) = av->a_un.a_val;
+ break;
+ case AT_PLATFORM:
+ GLRO(dl_platform) = av->a_un.a_ptr;
+ break;
+ case AT_HWCAP:
+ GLRO(dl_hwcap) = av->a_un.a_val;
+ break;
+ case AT_CLKTCK:
+ GLRO(dl_clktck) = av->a_un.a_val;
+ break;
+ case AT_FPUCW:
+ GLRO(dl_fpu_control) = av->a_un.a_val;
+ break;
+#ifdef NEED_DL_SYSINFO
+ case AT_SYSINFO:
+ new_sysinfo = av->a_un.a_val;
+ break;
+#endif
+#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
+ case AT_SYSINFO_EHDR:
+ GLRO(dl_sysinfo_dso) = av->a_un.a_ptr;
+ break;
+#endif
+#ifdef DL_PLATFORM_AUXV
+ DL_PLATFORM_AUXV
+#endif
+ }
+
+#ifdef DL_SYSDEP_OSCHECK
+ DL_SYSDEP_OSCHECK (dl_fatal);
+#endif
+
+#ifndef HAVE_AUX_SECURE
+ if (seen != -1)
+ {
+ /* Fill in the values we have not gotten from the kernel through the
+ auxiliary vector. */
+# ifndef HAVE_AUX_XID
+# define SEE(UID, var, uid) \
+ if ((seen & M (AT_##UID)) == 0) var ^= __get##uid ()
+ SEE (UID, uid, uid);
+ SEE (EUID, uid, euid);
+ SEE (GID, gid, gid);
+ SEE (EGID, gid, egid);
+# endif
+
+ /* If one of the two pairs of IDs does not match this is a setuid
+ or setgid run. */
+ INTUSE(__libc_enable_secure) = uid | gid;
+ }
+#endif
+
+#ifndef HAVE_AUX_PAGESIZE
+ if (GLRO(dl_pagesize) == 0)
+ GLRO(dl_pagesize) = __getpagesize ();
+#endif
+
+#if defined NEED_DL_SYSINFO
+ /* Only set the sysinfo value if we also have the vsyscall DSO. */
+ if (GLRO(dl_sysinfo_dso) != 0 && new_sysinfo)
+ GLRO(dl_sysinfo) = new_sysinfo;
+#endif
+
+#ifdef DL_SYSDEP_INIT
+ DL_SYSDEP_INIT;
+#endif
+
+#ifdef DL_PLATFORM_INIT
+ DL_PLATFORM_INIT;
+#endif
+
+ /* Determine the length of the platform name. */
+ if (GLRO(dl_platform) != NULL)
+ GLRO(dl_platformlen) = strlen (GLRO(dl_platform));
+
+ if (__sbrk (0) == &_end)
+ /* The dynamic linker was run as a program, and so the initial break
+ starts just after our bss, at &_end. The malloc in dl-minimal.c
+ will consume the rest of this page, so tell the kernel to move the
+ break up that far. When the user program examines its break, it
+ will see this new value and not clobber our data. */
+ __sbrk (GLRO(dl_pagesize)
+ - ((&_end - (void *) 0) & (GLRO(dl_pagesize) - 1)));
+
+ /* If this is a SUID program we make sure that FDs 0, 1, and 2 are
+ allocated. If necessary we are doing it ourself. If it is not
+ possible we stop the program. */
+ if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
+ __libc_check_standard_fds ();
+
+ (*dl_main) (phdr, phnum, &user_entry);
+ return user_entry;
+}
+
+void
+internal_function
+_dl_sysdep_start_cleanup (void)
+{
+}
+
+void
+internal_function
+_dl_show_auxv (void)
+{
+ char buf[64];
+ ElfW(auxv_t) *av;
+
+ /* Terminate string. */
+ buf[63] = '\0';
+
+ /* The following code assumes that the AT_* values are encoded
+ starting from 0 with AT_NULL, 1 for AT_IGNORE, and all other values
+ close by (otherwise the array will be too large). In case we have
+ to support a platform where these requirements are not fulfilled
+ some alternative implementation has to be used. */
+ for (av = _dl_auxv; av->a_type != AT_NULL; ++av)
+ {
+ static const struct
+ {
+ const char label[20];
+ enum { unknown = 0, dec, hex, str, ignore } form;
+ } auxvars[] =
+ {
+ [AT_EXECFD - 2] = { "AT_EXECFD: ", dec },
+ [AT_PHDR - 2] = { "AT_PHDR: 0x", hex },
+ [AT_PHENT - 2] = { "AT_PHENT: ", dec },
+ [AT_PHNUM - 2] = { "AT_PHNUM: ", dec },
+ [AT_PAGESZ - 2] = { "AT_PAGESZ: ", dec },
+ [AT_BASE - 2] = { "AT_BASE: 0x", hex },
+ [AT_FLAGS - 2] = { "AT_FLAGS: 0x", hex },
+ [AT_ENTRY - 2] = { "AT_ENTRY: 0x", hex },
+ [AT_NOTELF - 2] = { "AT_NOTELF: ", hex },
+ [AT_UID - 2] = { "AT_UID: ", dec },
+ [AT_EUID - 2] = { "AT_EUID: ", dec },
+ [AT_GID - 2] = { "AT_GID: ", dec },
+ [AT_EGID - 2] = { "AT_EGID: ", dec },
+ [AT_PLATFORM - 2] = { "AT_PLATFORM: ", str },
+ [AT_HWCAP - 2] = { "AT_HWCAP: ", hex },
+ [AT_CLKTCK - 2] = { "AT_CLKTCK: ", dec },
+ [AT_FPUCW - 2] = { "AT_FPUCW: ", hex },
+ [AT_DCACHEBSIZE - 2] = { "AT_DCACHEBSIZE: 0x", hex },
+ [AT_ICACHEBSIZE - 2] = { "AT_ICACHEBSIZE: 0x", hex },
+ [AT_UCACHEBSIZE - 2] = { "AT_UCACHEBSIZE: 0x", hex },
+ [AT_IGNOREPPC - 2] = { "AT_IGNOREPPC", ignore },
+ [AT_SECURE - 2] = { "AT_SECURE: ", dec },
+ [AT_SYSINFO - 2] = { "AT_SYSINFO: 0x", hex },
+ [AT_SYSINFO_EHDR - 2] = { "AT_SYSINFO_EHDR: 0x", hex },
+ };
+ unsigned int idx = (unsigned int) (av->a_type - 2);
+
+ if ((unsigned int) av->a_type < 2u || auxvars[idx].form == ignore)
+ continue;
+
+ assert (AT_NULL == 0);
+ assert (AT_IGNORE == 1);
+
+ if (av->a_type == AT_HWCAP)
+ {
+ /* This is handled special. */
+ if (_dl_procinfo (av->a_un.a_val) == 0)
+ continue;
+ }
+
+ if (idx < sizeof (auxvars) / sizeof (auxvars[0])
+ && auxvars[idx].form != unknown)
+ {
+ const char *val = av->a_un.a_ptr;
+
+ if (__builtin_expect (auxvars[idx].form, dec) == dec)
+ val = _itoa ((unsigned long int) av->a_un.a_val,
+ buf + sizeof buf - 1, 10, 0);
+ else if (__builtin_expect (auxvars[idx].form, hex) == hex)
+ val = _itoa ((unsigned long int) av->a_un.a_val,
+ buf + sizeof buf - 1, 16, 0);
+
+ _dl_printf ("%s%s\n", auxvars[idx].label, val);
+
+ continue;
+ }
+
+ /* Unknown value: print a generic line. */
+ char buf2[17];
+ buf[sizeof (buf2) - 1] = '\0';
+ const char *val2 = _itoa ((unsigned long int) av->a_un.a_val,
+ buf2 + sizeof buf2 - 1, 16, 0);
+ const char *val = _itoa ((unsigned long int) av->a_type,
+ buf + sizeof buf - 1, 16, 0);
+ _dl_printf ("AT_??? (0x%s): 0x%s\n", val, val2);
+ }
+}
+
+
+/* Return an array of useful/necessary hardware capability names. */
+const struct r_strlenpair *
+internal_function
+_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
+ size_t *max_capstrlen)
+{
+ /* Determine how many important bits are set. */
+ unsigned long int masked = GLRO(dl_hwcap) & GLRO(dl_hwcap_mask);
+ size_t cnt = platform != NULL;
+ size_t n, m;
+ size_t total;
+ struct r_strlenpair *temp;
+ struct r_strlenpair *result;
+ struct r_strlenpair *rp;
+ char *cp;
+
+ /* Count the number of bits set in the masked value. */
+ for (n = 0; (~((1UL << n) - 1) & masked) != 0; ++n)
+ if ((masked & (1UL << n)) != 0)
+ ++cnt;
+
+#ifdef USE_TLS
+ /* For TLS enabled builds always add 'tls'. */
+ ++cnt;
+#else
+ if (cnt == 0)
+ {
+ /* If we have platform name and no important capability we only have
+ the base directory to search. */
+ result = (struct r_strlenpair *) malloc (sizeof (*result));
+ if (result == NULL)
+ goto no_memory;
+
+ result[0].str = (char *) result; /* Does not really matter. */
+ result[0].len = 0;
+
+ *sz = 1;
+ return result;
+ }
+#endif
+
+ /* Create temporary data structure to generate result table. */
+ temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
+ m = 0;
+ for (n = 0; masked != 0; ++n)
+ if ((masked & (1UL << n)) != 0)
+ {
+ temp[m].str = _dl_hwcap_string (n);
+ temp[m].len = strlen (temp[m].str);
+ masked ^= 1UL << n;
+ ++m;
+ }
+ if (platform != NULL)
+ {
+ temp[m].str = platform;
+ temp[m].len = platform_len;
+ ++m;
+ }
+#ifdef USE_TLS
+ temp[m].str = "tls";
+ temp[m].len = 3;
+ ++m;
+#endif
+ assert (m == cnt);
+
+ /* Determine the total size of all strings together. */
+ if (cnt == 1)
+ total = temp[0].len + 1;
+ else
+ {
+ total = (1UL << (cnt - 2)) * (temp[0].len + temp[cnt - 1].len + 2);
+ for (n = 1; n + 1 < cnt; ++n)
+ total += (1UL << (cnt - 3)) * (temp[n].len + 1);
+ }
+
+ /* The result structure: we use a very compressed way to store the
+ various combinations of capability names. */
+ *sz = 1 << cnt;
+ result = (struct r_strlenpair *) malloc (*sz * sizeof (*result) + total);
+ if (result == NULL)
+ {
+#ifndef USE_TLS
+ no_memory:
+#endif
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create capability list"));
+ }
+
+ if (cnt == 1)
+ {
+ result[0].str = (char *) (result + *sz);
+ result[0].len = temp[0].len + 1;
+ result[1].str = (char *) (result + *sz);
+ result[1].len = 0;
+ cp = __mempcpy ((char *) (result + *sz), temp[0].str, temp[0].len);
+ *cp = '/';
+ *sz = 2;
+ *max_capstrlen = result[0].len;
+
+ return result;
+ }
+
+ /* Fill in the information. This follows the following scheme
+ (indeces from TEMP for four strings):
+ entry #0: 0, 1, 2, 3 binary: 1111
+ #1: 0, 1, 3 1101
+ #2: 0, 2, 3 1011
+ #3: 0, 3 1001
+ This allows the representation of all possible combinations of
+ capability names in the string. First generate the strings. */
+ result[1].str = result[0].str = cp = (char *) (result + *sz);
+#define add(idx) \
+ cp = __mempcpy (__mempcpy (cp, temp[idx].str, temp[idx].len), "/", 1);
+ if (cnt == 2)
+ {
+ add (1);
+ add (0);
+ }
+ else
+ {
+ n = 1 << (cnt - 1);
+ do
+ {
+ n -= 2;
+
+ /* We always add the last string. */
+ add (cnt - 1);
+
+ /* Add the strings which have the bit set in N. */
+ for (m = cnt - 2; m > 0; --m)
+ if ((n & (1 << m)) != 0)
+ add (m);
+
+ /* Always add the first string. */
+ add (0);
+ }
+ while (n != 0);
+ }
+#undef add
+
+ /* Now we are ready to install the string pointers and length. */
+ for (n = 0; n < (1UL << cnt); ++n)
+ result[n].len = 0;
+ n = cnt;
+ do
+ {
+ size_t mask = 1 << --n;
+
+ rp = result;
+ for (m = 1 << cnt; m > 0; ++rp)
+ if ((--m & mask) != 0)
+ rp->len += temp[n].len + 1;
+ }
+ while (n != 0);
+
+ /* The first half of the strings all include the first string. */
+ n = (1 << cnt) - 2;
+ rp = &result[2];
+ while (n != (1UL << (cnt - 1)))
+ {
+ if ((--n & 1) != 0)
+ rp[0].str = rp[-2].str + rp[-2].len;
+ else
+ rp[0].str = rp[-1].str;
+ ++rp;
+ }
+
+ /* The second have starts right after the first part of the string of
+ corresponding entry in the first half. */
+ do
+ {
+ rp[0].str = rp[-(1 << (cnt - 1))].str + temp[cnt - 1].len + 1;
+ ++rp;
+ }
+ while (--n != 0);
+
+ /* The maximum string length. */
+ *max_capstrlen = result[0].len;
+
+ return result;
+}
diff --git a/sysdeps/generic/dl-sysdep.h b/sysdeps/generic/dl-sysdep.h
index c99fd3ea36..565287027c 100644
--- a/sysdeps/generic/dl-sysdep.h
+++ b/sysdeps/generic/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Generic version.
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,8 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* No multiple inclusion protection need here because it's just macros.
- We don't want to use _DL_SYSDEP_H in case we are #include_next'd. */
+#ifndef _DL_SYSDEP_H
+#define _DL_SYSDEP_H 1
/* This macro must be defined to either 0 or 1.
@@ -33,3 +33,5 @@
#else
# define RTLD_PRIVATE_ERRNO 0
#endif
+
+#endif /* dl-sysdep.h */
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
new file mode 100644
index 0000000000..3382e3493c
--- /dev/null
+++ b/sysdeps/generic/dl-tls.c
@@ -0,0 +1,713 @@
+/* Thread-local storage handling in the ELF dynamic linker. Generic version.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <assert.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/param.h>
+
+#include <tls.h>
+
+/* We don't need any of this if TLS is not supported. */
+#ifdef USE_TLS
+
+# include <dl-tls.h>
+# include <ldsodefs.h>
+
+/* Amount of excess space to allocate in the static TLS area
+ to allow dynamic loading of modules defining IE-model TLS data. */
+# define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
+
+/* Value used for dtv entries for which the allocation is delayed. */
+# define TLS_DTV_UNALLOCATED ((void *) -1l)
+
+
+/* Out-of-memory handler. */
+# ifdef SHARED
+static void
+__attribute__ ((__noreturn__))
+oom (void)
+{
+ _dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
+}
+# endif
+
+
+
+size_t
+internal_function
+_dl_next_tls_modid (void)
+{
+ size_t result;
+
+ if (__builtin_expect (GL(dl_tls_dtv_gaps), false))
+ {
+ size_t disp = 0;
+ struct dtv_slotinfo_list *runp = GL(dl_tls_dtv_slotinfo_list);
+
+ /* Note that this branch will never be executed during program
+ start since there are no gaps at that time. Therefore it
+ does not matter that the dl_tls_dtv_slotinfo is not allocated
+ yet when the function is called for the first times. */
+ result = GL(dl_tls_static_nelem) + 1;
+ /* If the following would not be true we mustn't have assumed
+ there is a gap. */
+ assert (result <= GL(dl_tls_max_dtv_idx));
+ do
+ {
+ while (result - disp < runp->len)
+ {
+ if (runp->slotinfo[result - disp].map == NULL)
+ break;
+
+ ++result;
+ assert (result <= GL(dl_tls_max_dtv_idx) + 1);
+ }
+
+ if (result - disp < runp->len)
+ break;
+
+ disp += runp->len;
+ }
+ while ((runp = runp->next) != NULL);
+
+ if (result >= GL(dl_tls_max_dtv_idx))
+ {
+ /* The new index must indeed be exactly one higher than the
+ previous high. */
+ assert (result == GL(dl_tls_max_dtv_idx));
+
+ /* There is no gap anymore. */
+ GL(dl_tls_dtv_gaps) = false;
+
+ goto nogaps;
+ }
+ }
+ else
+ {
+ /* No gaps, allocate a new entry. */
+ nogaps:
+ result = ++GL(dl_tls_max_dtv_idx);
+ }
+
+ return result;
+}
+
+# ifdef SHARED
+
+void
+internal_function
+_dl_determine_tlsoffset (void)
+{
+ struct dtv_slotinfo *slotinfo;
+ size_t max_align = TLS_TCB_ALIGN;
+ size_t offset, freetop = 0, freebottom = 0;
+ size_t cnt;
+
+ /* The first element of the dtv slot info list is allocated. */
+ assert (GL(dl_tls_dtv_slotinfo_list) != NULL);
+ /* There is at this point only one element in the
+ dl_tls_dtv_slotinfo_list list. */
+ assert (GL(dl_tls_dtv_slotinfo_list)->next == NULL);
+
+ slotinfo = GL(dl_tls_dtv_slotinfo_list)->slotinfo;
+
+ /* Determining the offset of the various parts of the static TLS
+ block has several dependencies. In addition we have to work
+ around bugs in some toolchains.
+
+ Each TLS block from the objects available at link time has a size
+ and an alignment requirement. The GNU ld computes the alignment
+ requirements for the data at the positions *in the file*, though.
+ I.e, it is not simply possible to allocate a block with the size
+ of the TLS program header entry. The data is layed out assuming
+ that the first byte of the TLS block fulfills
+
+ p_vaddr mod p_align == &TLS_BLOCK mod p_align
+
+ This means we have to add artificial padding at the beginning of
+ the TLS block. These bytes are never used for the TLS data in
+ this module but the first byte allocated must be aligned
+ according to mod p_align == 0 so that the first byte of the TLS
+ block is aligned according to p_vaddr mod p_align. This is ugly
+ and the linker can help by computing the offsets in the TLS block
+ assuming the first byte of the TLS block is aligned according to
+ p_align.
+
+ The extra space which might be allocated before the first byte of
+ the TLS block need not go unused. The code below tries to use
+ that memory for the next TLS block. This can work if the total
+ memory requirement for the next TLS block is smaller than the
+ gap. */
+
+# if TLS_TCB_AT_TP
+ /* We simply start with zero. */
+ offset = 0;
+
+ for (cnt = 1; slotinfo[cnt].map != NULL; ++cnt)
+ {
+ assert (cnt < GL(dl_tls_dtv_slotinfo_list)->len);
+
+ size_t firstbyte = (-slotinfo[cnt].map->l_tls_firstbyte_offset
+ & (slotinfo[cnt].map->l_tls_align - 1));
+ size_t off;
+ max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
+
+ if (freebottom - freetop >= slotinfo[cnt].map->l_tls_blocksize)
+ {
+ off = roundup (freetop + slotinfo[cnt].map->l_tls_blocksize
+ - firstbyte, slotinfo[cnt].map->l_tls_align)
+ + firstbyte;
+ if (off <= freebottom)
+ {
+ freetop = off;
+
+ /* XXX For some architectures we perhaps should store the
+ negative offset. */
+ slotinfo[cnt].map->l_tls_offset = off;
+ continue;
+ }
+ }
+
+ off = roundup (offset + slotinfo[cnt].map->l_tls_blocksize - firstbyte,
+ slotinfo[cnt].map->l_tls_align) + firstbyte;
+ if (off > offset + slotinfo[cnt].map->l_tls_blocksize
+ + (freebottom - freetop))
+ {
+ freetop = offset;
+ freebottom = off - slotinfo[cnt].map->l_tls_blocksize;
+ }
+ offset = off;
+
+ /* XXX For some architectures we perhaps should store the
+ negative offset. */
+ slotinfo[cnt].map->l_tls_offset = off;
+ }
+
+ GL(dl_tls_static_used) = offset;
+ GL(dl_tls_static_size) = (roundup (offset + TLS_STATIC_SURPLUS, max_align)
+ + TLS_TCB_SIZE);
+# elif TLS_DTV_AT_TP
+ /* The TLS blocks start right after the TCB. */
+ offset = TLS_TCB_SIZE;
+
+ for (cnt = 1; slotinfo[cnt].map != NULL; ++cnt)
+ {
+ assert (cnt < GL(dl_tls_dtv_slotinfo_list)->len);
+
+ size_t firstbyte = (-slotinfo[cnt].map->l_tls_firstbyte_offset
+ & (slotinfo[cnt].map->l_tls_align - 1));
+ size_t off;
+ max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
+
+ if (slotinfo[cnt].map->l_tls_blocksize <= freetop - freebottom)
+ {
+ off = roundup (freebottom, slotinfo[cnt].map->l_tls_align);
+ if (off - freebottom < firstbyte)
+ off += slotinfo[cnt].map->l_tls_align;
+ if (off + slotinfo[cnt].map->l_tls_blocksize - firstbyte <= freetop)
+ {
+ slotinfo[cnt].map->l_tls_offset = off - firstbyte;
+ freebottom = off + slotinfo[cnt].map->l_tls_blocksize
+ - firstbyte;
+ continue;
+ }
+ }
+
+ off = roundup (offset, slotinfo[cnt].map->l_tls_align);
+ if (off - offset < firstbyte)
+ off += slotinfo[cnt].map->l_tls_align;
+
+ slotinfo[cnt].map->l_tls_offset = off - firstbyte;
+ if (off - firstbyte - offset > freetop - freebottom)
+ {
+ freebottom = offset;
+ freetop = off - firstbyte;
+ }
+
+ offset = off + slotinfo[cnt].map->l_tls_blocksize - firstbyte;
+ }
+
+ GL(dl_tls_static_used) = offset;
+ GL(dl_tls_static_size) = roundup (offset + TLS_STATIC_SURPLUS,
+ TLS_TCB_ALIGN);
+# else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+
+ /* The alignment requirement for the static TLS block. */
+ GL(dl_tls_static_align) = max_align;
+}
+
+
+/* This is called only when the data structure setup was skipped at startup,
+ when there was no need for it then. Now we have dynamically loaded
+ something needing TLS, or libpthread needs it. */
+int
+internal_function
+_dl_tls_setup (void)
+{
+ assert (GL(dl_tls_dtv_slotinfo_list) == NULL);
+ assert (GL(dl_tls_max_dtv_idx) == 0);
+
+ const size_t nelem = 2 + TLS_SLOTINFO_SURPLUS;
+
+ GL(dl_tls_dtv_slotinfo_list)
+ = calloc (1, (sizeof (struct dtv_slotinfo_list)
+ + nelem * sizeof (struct dtv_slotinfo)));
+ if (GL(dl_tls_dtv_slotinfo_list) == NULL)
+ return -1;
+
+ GL(dl_tls_dtv_slotinfo_list)->len = nelem;
+
+ /* Number of elements in the static TLS block. It can't be zero
+ because of various assumptions. The one element is null. */
+ GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx) = 1;
+
+ /* This initializes more variables for us. */
+ _dl_determine_tlsoffset ();
+
+ return 0;
+}
+rtld_hidden_def (_dl_tls_setup)
+# endif
+
+static void *
+internal_function
+allocate_dtv (void *result)
+{
+ dtv_t *dtv;
+ size_t dtv_length;
+
+ /* We allocate a few more elements in the dtv than are needed for the
+ initial set of modules. This should avoid in most cases expansions
+ of the dtv. */
+ dtv_length = GL(dl_tls_max_dtv_idx) + DTV_SURPLUS;
+ dtv = calloc (dtv_length + 2, sizeof (dtv_t));
+ if (dtv != NULL)
+ {
+ /* This is the initial length of the dtv. */
+ dtv[0].counter = dtv_length;
+
+ /* The rest of the dtv (including the generation counter) is
+ Initialize with zero to indicate nothing there. */
+
+ /* Add the dtv to the thread data structures. */
+ INSTALL_DTV (result, dtv);
+ }
+ else
+ result = NULL;
+
+ return result;
+}
+
+
+/* Get size and alignment requirements of the static TLS block. */
+void
+internal_function
+_dl_get_tls_static_info (size_t *sizep, size_t *alignp)
+{
+ *sizep = GL(dl_tls_static_size);
+ *alignp = GL(dl_tls_static_align);
+}
+
+
+void *
+internal_function
+_dl_allocate_tls_storage (void)
+{
+ void *result;
+ size_t size = GL(dl_tls_static_size);
+
+# if TLS_DTV_AT_TP
+ /* Memory layout is:
+ [ TLS_PRE_TCB_SIZE ] [ TLS_TCB_SIZE ] [ TLS blocks ]
+ ^ This should be returned. */
+ size += (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
+ & ~(GL(dl_tls_static_align) - 1);
+# endif
+
+ /* Allocate a correctly aligned chunk of memory. */
+ result = __libc_memalign (GL(dl_tls_static_align), size);
+ if (__builtin_expect (result != NULL, 1))
+ {
+ /* Allocate the DTV. */
+ void *allocated = result;
+
+# if TLS_TCB_AT_TP
+ /* The TCB follows the TLS blocks. */
+ result = (char *) result + size - TLS_TCB_SIZE;
+
+ /* Clear the TCB data structure. We can't ask the caller (i.e.
+ libpthread) to do it, because we will initialize the DTV et al. */
+ memset (result, 0, TLS_TCB_SIZE);
+# elif TLS_DTV_AT_TP
+ result = (char *) result + size - GL(dl_tls_static_size);
+
+ /* Clear the TCB data structure and TLS_PRE_TCB_SIZE bytes before it.
+ We can't ask the caller (i.e. libpthread) to do it, because we will
+ initialize the DTV et al. */
+ memset ((char *) result - TLS_PRE_TCB_SIZE, 0,
+ TLS_PRE_TCB_SIZE + TLS_TCB_SIZE);
+# endif
+
+ result = allocate_dtv (result);
+ if (result == NULL)
+ free (allocated);
+ }
+
+ return result;
+}
+
+
+void *
+internal_function
+_dl_allocate_tls_init (void *result)
+{
+ if (result == NULL)
+ /* The memory allocation failed. */
+ return NULL;
+
+ dtv_t *dtv = GET_DTV (result);
+ struct dtv_slotinfo_list *listp;
+ size_t total = 0;
+
+ /* We have to look prepare the dtv for all currently loaded
+ modules using TLS. For those which are dynamically loaded we
+ add the values indicating deferred allocation. */
+ listp = GL(dl_tls_dtv_slotinfo_list);
+ while (1)
+ {
+ size_t cnt;
+
+ for (cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt)
+ {
+ struct link_map *map;
+ void *dest;
+
+ /* Check for the total number of used slots. */
+ if (total + cnt > GL(dl_tls_max_dtv_idx))
+ break;
+
+ map = listp->slotinfo[cnt].map;
+ if (map == NULL)
+ /* Unused entry. */
+ continue;
+
+ if (map->l_tls_offset == NO_TLS_OFFSET)
+ {
+ /* For dynamically loaded modules we simply store
+ the value indicating deferred allocation. */
+ dtv[map->l_tls_modid].pointer = TLS_DTV_UNALLOCATED;
+ continue;
+ }
+
+ assert (map->l_tls_modid == cnt);
+ assert (map->l_tls_blocksize >= map->l_tls_initimage_size);
+# if TLS_TCB_AT_TP
+ assert ((size_t) map->l_tls_offset >= map->l_tls_blocksize);
+ dest = (char *) result - map->l_tls_offset;
+# elif TLS_DTV_AT_TP
+ dest = (char *) result + map->l_tls_offset;
+# else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+
+ /* Copy the initialization image and clear the BSS part. */
+ dtv[map->l_tls_modid].pointer = dest;
+ memset (__mempcpy (dest, map->l_tls_initimage,
+ map->l_tls_initimage_size), '\0',
+ map->l_tls_blocksize - map->l_tls_initimage_size);
+ }
+
+ total += cnt;
+ if (total >= GL(dl_tls_max_dtv_idx))
+ break;
+
+ listp = listp->next;
+ assert (listp != NULL);
+ }
+
+ return result;
+}
+rtld_hidden_def (_dl_allocate_tls_init)
+
+void *
+internal_function
+_dl_allocate_tls (void *mem)
+{
+ return _dl_allocate_tls_init (mem == NULL
+ ? _dl_allocate_tls_storage ()
+ : allocate_dtv (mem));
+}
+rtld_hidden_def (_dl_allocate_tls)
+
+
+void
+internal_function
+_dl_deallocate_tls (void *tcb, bool dealloc_tcb)
+{
+ dtv_t *dtv = GET_DTV (tcb);
+
+ /* The array starts with dtv[-1]. */
+#ifdef SHARED
+ if (dtv != GL(dl_initial_dtv))
+#endif
+ free (dtv - 1);
+
+ if (dealloc_tcb)
+ {
+# if TLS_TCB_AT_TP
+ /* The TCB follows the TLS blocks. Back up to free the whole block. */
+ tcb -= GL(dl_tls_static_size) - TLS_TCB_SIZE;
+# elif TLS_DTV_AT_TP
+ /* Back up the TLS_PRE_TCB_SIZE bytes. */
+ tcb -= (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
+ & ~(GL(dl_tls_static_align) - 1);
+# endif
+ free (tcb);
+ }
+}
+rtld_hidden_def (_dl_deallocate_tls)
+
+
+# ifdef SHARED
+/* The __tls_get_addr function has two basic forms which differ in the
+ arguments. The IA-64 form takes two parameters, the module ID and
+ offset. The form used, among others, on IA-32 takes a reference to
+ a special structure which contain the same information. The second
+ form seems to be more often used (in the moment) so we default to
+ it. Users of the IA-64 form have to provide adequate definitions
+ of the following macros. */
+# ifndef GET_ADDR_ARGS
+# define GET_ADDR_ARGS tls_index *ti
+# endif
+# ifndef GET_ADDR_MODULE
+# define GET_ADDR_MODULE ti->ti_module
+# endif
+# ifndef GET_ADDR_OFFSET
+# define GET_ADDR_OFFSET ti->ti_offset
+# endif
+
+
+static void *
+allocate_and_init (struct link_map *map)
+{
+ void *newp;
+
+ newp = __libc_memalign (map->l_tls_align, map->l_tls_blocksize);
+ if (newp == NULL)
+ oom ();
+
+ /* Initialize the memory. */
+ memset (__mempcpy (newp, map->l_tls_initimage, map->l_tls_initimage_size),
+ '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
+
+ return newp;
+}
+
+
+/* The generic dynamic and local dynamic model cannot be used in
+ statically linked applications. */
+void *
+__tls_get_addr (GET_ADDR_ARGS)
+{
+ dtv_t *dtv = THREAD_DTV ();
+ struct link_map *the_map = NULL;
+ void *p;
+
+ if (__builtin_expect (dtv[0].counter != GL(dl_tls_generation), 0))
+ {
+ struct dtv_slotinfo_list *listp;
+ size_t idx;
+
+ /* The global dl_tls_dtv_slotinfo array contains for each module
+ index the generation counter current when the entry was
+ created. This array never shrinks so that all module indices
+ which were valid at some time can be used to access it.
+ Before the first use of a new module index in this function
+ the array was extended appropriately. Access also does not
+ have to be guarded against modifications of the array. It is
+ assumed that pointer-size values can be read atomically even
+ in SMP environments. It is possible that other threads at
+ the same time dynamically load code and therefore add to the
+ slotinfo list. This is a problem since we must not pick up
+ any information about incomplete work. The solution to this
+ is to ignore all dtv slots which were created after the one
+ we are currently interested. We know that dynamic loading
+ for this module is completed and this is the last load
+ operation we know finished. */
+ idx = GET_ADDR_MODULE;
+ listp = GL(dl_tls_dtv_slotinfo_list);
+ while (idx >= listp->len)
+ {
+ idx -= listp->len;
+ listp = listp->next;
+ }
+
+ if (dtv[0].counter < listp->slotinfo[idx].gen)
+ {
+ /* The generation counter for the slot is higher than what
+ the current dtv implements. We have to update the whole
+ dtv but only those entries with a generation counter <=
+ the one for the entry we need. */
+ size_t new_gen = listp->slotinfo[idx].gen;
+ size_t total = 0;
+
+ /* We have to look through the entire dtv slotinfo list. */
+ listp = GL(dl_tls_dtv_slotinfo_list);
+ do
+ {
+ size_t cnt;
+
+ for (cnt = total = 0 ? 1 : 0; cnt < listp->len; ++cnt)
+ {
+ size_t gen = listp->slotinfo[cnt].gen;
+ struct link_map *map;
+ size_t modid;
+
+ if (gen > new_gen)
+ /* This is a slot for a generation younger than
+ the one we are handling now. It might be
+ incompletely set up so ignore it. */
+ continue;
+
+ /* If the entry is older than the current dtv layout
+ we know we don't have to handle it. */
+ if (gen <= dtv[0].counter)
+ continue;
+
+ /* If there is no map this means the entry is empty. */
+ map = listp->slotinfo[cnt].map;
+ if (map == NULL)
+ {
+ /* If this modid was used at some point the memory
+ might still be allocated. */
+ if (dtv[total + cnt].pointer != TLS_DTV_UNALLOCATED)
+ {
+ free (dtv[total + cnt].pointer);
+ dtv[total + cnt].pointer = TLS_DTV_UNALLOCATED;
+ }
+
+ continue;
+ }
+
+ /* Check whether the current dtv array is large enough. */
+ modid = map->l_tls_modid;
+ assert (total + cnt == modid);
+ if (dtv[-1].counter < modid)
+ {
+ /* Reallocate the dtv. */
+ dtv_t *newp;
+ size_t newsize = GL(dl_tls_max_dtv_idx) + DTV_SURPLUS;
+ size_t oldsize = dtv[-1].counter;
+
+ assert (map->l_tls_modid <= newsize);
+
+ if (dtv == GL(dl_initial_dtv))
+ {
+ /* This is the initial dtv that was allocated
+ during rtld startup using the dl-minimal.c
+ malloc instead of the real malloc. We can't
+ free it, we have to abandon the old storage. */
+
+ newp = malloc ((2 + newsize) * sizeof (dtv_t));
+ if (newp == NULL)
+ oom ();
+ memcpy (newp, &dtv[-1], oldsize * sizeof (dtv_t));
+ }
+ else
+ {
+ newp = realloc (&dtv[-1],
+ (2 + newsize) * sizeof (dtv_t));
+ if (newp == NULL)
+ oom ();
+ }
+
+ newp[0].counter = newsize;
+
+ /* Clear the newly allocated part. */
+ memset (newp + 2 + oldsize, '\0',
+ (newsize - oldsize) * sizeof (dtv_t));
+
+ /* Point dtv to the generation counter. */
+ dtv = &newp[1];
+
+ /* Install this new dtv in the thread data
+ structures. */
+ INSTALL_NEW_DTV (dtv);
+ }
+
+ /* If there is currently memory allocate for this
+ dtv entry free it. */
+ /* XXX Ideally we will at some point create a memory
+ pool. */
+ if (dtv[modid].pointer != TLS_DTV_UNALLOCATED)
+ /* Note that free is called for NULL is well. We
+ deallocate even if it is this dtv entry we are
+ supposed to load. The reason is that we call
+ memalign and not malloc. */
+ free (dtv[modid].pointer);
+
+ /* This module is loaded dynamically- We defer
+ memory allocation. */
+ dtv[modid].pointer = TLS_DTV_UNALLOCATED;
+
+ if (modid == GET_ADDR_MODULE)
+ the_map = map;
+ }
+
+ total += listp->len;
+ }
+ while ((listp = listp->next) != NULL);
+
+ /* This will be the new maximum generation counter. */
+ dtv[0].counter = new_gen;
+ }
+ }
+
+ p = dtv[GET_ADDR_MODULE].pointer;
+
+ if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
+ {
+ /* The allocation was deferred. Do it now. */
+ if (the_map == NULL)
+ {
+ /* Find the link map for this module. */
+ size_t idx = GET_ADDR_MODULE;
+ struct dtv_slotinfo_list *listp = GL(dl_tls_dtv_slotinfo_list);
+
+ while (idx >= listp->len)
+ {
+ idx -= listp->len;
+ listp = listp->next;
+ }
+
+ the_map = listp->slotinfo[idx].map;
+ }
+
+ p = dtv[GET_ADDR_MODULE].pointer = allocate_and_init (the_map);
+ }
+
+ return (char *) p + GET_ADDR_OFFSET;
+}
+# endif
+
+#endif /* use TLS */
diff --git a/sysdeps/generic/dup.c b/sysdeps/generic/dup.c
new file mode 100644
index 0000000000..5d5e1b4cd5
--- /dev/null
+++ b/sysdeps/generic/dup.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Duplicate FD, returning a new file descriptor open on the same file. */
+int
+__dup (fd)
+ int fd;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (dup)
+
+weak_alias (__dup, dup)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/dup2.c b/sysdeps/generic/dup2.c
new file mode 100644
index 0000000000..2b897896f6
--- /dev/null
+++ b/sysdeps/generic/dup2.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+
+/* Duplicate FD to FD2, closing the old FD2 and making FD2 be
+ open the same file as FD is. Return FD2 or -1. */
+int
+__dup2 (fd, fd2)
+ int fd;
+ int fd2;
+{
+ if (fd < 0 || fd2 < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ if (fd == fd2)
+ /* No way to check that they are valid. */
+ return fd2;
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__dup2)
+stub_warning (dup2)
+
+weak_alias (__dup2, dup2)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/dwarf2.h b/sysdeps/generic/dwarf2.h
index 9fca4c00e0..800bda2dc0 100644
--- a/sysdeps/generic/dwarf2.h
+++ b/sysdeps/generic/dwarf2.h
@@ -1,26 +1,26 @@
/* Declarations and definitions of codes relating to the DWARF2 symbolic
debugging information format.
- Copyright (C) 1992, 1993, 1995, 1996, 1997, 2000
- Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1995, 1996, 1997, 2000
+ Free Software Foundation, Inc.
Contributed by Gary Funck (gary@intrepid.com). Derived from the
DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
- This file is part of the GNU C Library.
+This file is part of GNU CC.
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
/* This file is derived from the DWARF specification (a public document)
Revision 2.0.0 (July 27, 1993) developed by the UNIX International
@@ -508,7 +508,7 @@ enum dwarf_call_frame_info
/* SGI/MIPS specific */
DW_CFA_MIPS_advance_loc8 = 0x1d,
-
+
/* GNU extensions */
DW_CFA_GNU_window_save = 0x2d,
DW_CFA_GNU_args_size = 0x2e,
diff --git a/sysdeps/generic/e_acoshl.c b/sysdeps/generic/e_acoshl.c
new file mode 100644
index 0000000000..2c2fbe8eb4
--- /dev/null
+++ b/sysdeps/generic/e_acoshl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_acoshl (long double x)
+{
+ fputs ("__ieee754_acoshl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (acoshl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_acosl.c b/sysdeps/generic/e_acosl.c
new file mode 100644
index 0000000000..d844d885b8
--- /dev/null
+++ b/sysdeps/generic/e_acosl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_acosl (long double x)
+{
+ fputs ("__ieee754_acosl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (acosl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_asinl.c b/sysdeps/generic/e_asinl.c
new file mode 100644
index 0000000000..3b26f030ef
--- /dev/null
+++ b/sysdeps/generic/e_asinl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_asinl (long double x)
+{
+ fputs ("__ieee754_asinl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (asinl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_atan2l.c b/sysdeps/generic/e_atan2l.c
new file mode 100644
index 0000000000..0caed8a32f
--- /dev/null
+++ b/sysdeps/generic/e_atan2l.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_atan2l (long double x, long double y)
+{
+ fputs ("__ieee754_atan2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (atan2l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_atanhl.c b/sysdeps/generic/e_atanhl.c
new file mode 100644
index 0000000000..625d42db31
--- /dev/null
+++ b/sysdeps/generic/e_atanhl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_atanhl (long double x)
+{
+ fputs ("__ieee754_atanhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_atanhl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_coshl.c b/sysdeps/generic/e_coshl.c
new file mode 100644
index 0000000000..0da319b785
--- /dev/null
+++ b/sysdeps/generic/e_coshl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_coshl (long double x)
+{
+ fputs ("__ieee754_coshl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_coshl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_exp10.c b/sysdeps/generic/e_exp10.c
new file mode 100644
index 0000000000..a3eccbb9e6
--- /dev/null
+++ b/sysdeps/generic/e_exp10.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include "math_private.h"
+
+
+double
+__ieee754_exp10 (double arg)
+{
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_exp (M_LN10 * arg);
+}
diff --git a/sysdeps/generic/e_exp10f.c b/sysdeps/generic/e_exp10f.c
new file mode 100644
index 0000000000..7d06d074b8
--- /dev/null
+++ b/sysdeps/generic/e_exp10f.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include "math_private.h"
+
+
+float
+__ieee754_exp10f (float arg)
+{
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expf (M_LN10 * arg);
+}
diff --git a/sysdeps/generic/e_exp10l.c b/sysdeps/generic/e_exp10l.c
new file mode 100644
index 0000000000..56f0cfec2f
--- /dev/null
+++ b/sysdeps/generic/e_exp10l.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include "math_private.h"
+
+
+long double
+__ieee754_exp10l (long double arg)
+{
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expl (M_LN10l * arg);
+}
diff --git a/sysdeps/generic/e_exp2l.c b/sysdeps/generic/e_exp2l.c
new file mode 100644
index 0000000000..64ef6d3d50
--- /dev/null
+++ b/sysdeps/generic/e_exp2l.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_exp2l (long double x)
+{
+ fputs ("__ieee754_exp2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (exp2l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_expl.c b/sysdeps/generic/e_expl.c
new file mode 100644
index 0000000000..f9467c38ab
--- /dev/null
+++ b/sysdeps/generic/e_expl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_expl (long double x)
+{
+ fputs ("__ieee754_expl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (expl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_fmodl.c b/sysdeps/generic/e_fmodl.c
new file mode 100644
index 0000000000..380da24e41
--- /dev/null
+++ b/sysdeps/generic/e_fmodl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_fmodl (long double x, long double y)
+{
+ fputs ("__ieee754_fmodl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (fmodl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_gammal_r.c b/sysdeps/generic/e_gammal_r.c
new file mode 100644
index 0000000000..1c45c8421b
--- /dev/null
+++ b/sysdeps/generic/e_gammal_r.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_gammal_r (long double x, int *signgamp)
+{
+ *signgamp = 0;
+ fputs ("__ieee754_gammal_r not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_gammal_r)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_hypotl.c b/sysdeps/generic/e_hypotl.c
new file mode 100644
index 0000000000..07df22eb36
--- /dev/null
+++ b/sysdeps/generic/e_hypotl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_hypotl (long double x, long double y)
+{
+ fputs ("__ieee754_hypotl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_hypotl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_j0l.c b/sysdeps/generic/e_j0l.c
new file mode 100644
index 0000000000..1bf0a1de73
--- /dev/null
+++ b/sysdeps/generic/e_j0l.c
@@ -0,0 +1,25 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_j0l (long double x)
+{
+ fputs ("__ieee754_j0l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (j0l)
+
+long double
+__ieee754_y0l (long double x)
+{
+ fputs ("__ieee754_y0l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (y0l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_j1l.c b/sysdeps/generic/e_j1l.c
new file mode 100644
index 0000000000..656abeba57
--- /dev/null
+++ b/sysdeps/generic/e_j1l.c
@@ -0,0 +1,25 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_j1l (long double x)
+{
+ fputs ("__ieee754_j1l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (j1l)
+
+long double
+__ieee754_y1l (long double x)
+{
+ fputs ("__ieee754_y1l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (y1l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_jnl.c b/sysdeps/generic/e_jnl.c
new file mode 100644
index 0000000000..1bfc0695a5
--- /dev/null
+++ b/sysdeps/generic/e_jnl.c
@@ -0,0 +1,25 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_jnl (int n, long double x)
+{
+ fputs ("__ieee754_jnl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (jnl)
+
+long double
+__ieee754_ynl (int n, long double x)
+{
+ fputs ("__ieee754_ynl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (ynl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_lgammal_r.c b/sysdeps/generic/e_lgammal_r.c
new file mode 100644
index 0000000000..1784b2663f
--- /dev/null
+++ b/sysdeps/generic/e_lgammal_r.c
@@ -0,0 +1,17 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__ieee754_lgammal_r (long double x, int *signgamp)
+{
+ *signgamp = 0;
+ fputs ("__ieee754_lgammal_r not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (lgammal)
+stub_warning (lgammal_r)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_log10l.c b/sysdeps/generic/e_log10l.c
new file mode 100644
index 0000000000..5bc264b32c
--- /dev/null
+++ b/sysdeps/generic/e_log10l.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_log10l (long double x)
+{
+ fputs ("__ieee754_log10l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (log10l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_log2l.c b/sysdeps/generic/e_log2l.c
new file mode 100644
index 0000000000..681904bfbb
--- /dev/null
+++ b/sysdeps/generic/e_log2l.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_log2l (long double x)
+{
+ fputs ("__ieee754_log2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (log2l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_logl.c b/sysdeps/generic/e_logl.c
new file mode 100644
index 0000000000..9ba9cfc799
--- /dev/null
+++ b/sysdeps/generic/e_logl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_logl (long double x)
+{
+ fputs ("__ieee754_logl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (logl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_powl.c b/sysdeps/generic/e_powl.c
new file mode 100644
index 0000000000..afc2248b6b
--- /dev/null
+++ b/sysdeps/generic/e_powl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_powl (long double x, long double y)
+{
+ fputs ("__ieee754_powl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (powl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_rem_pio2l.c b/sysdeps/generic/e_rem_pio2l.c
new file mode 100644
index 0000000000..617215516b
--- /dev/null
+++ b/sysdeps/generic/e_rem_pio2l.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+int
+__ieee754_rem_pio2l (long double x, long double *y)
+{
+ fputs ("__ieee754_rem_pio2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0;
+}
+
+stub_warning (__ieee754_rem_pio2l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_scalb.c b/sysdeps/generic/e_scalb.c
new file mode 100644
index 0000000000..a7664db546
--- /dev/null
+++ b/sysdeps/generic/e_scalb.c
@@ -0,0 +1,71 @@
+/* @(#)e_scalb.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $";
+#endif
+
+/*
+ * __ieee754_scalb(x, fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbn() instead.
+ */
+
+#include <fenv.h>
+#include "math.h"
+#include "math_private.h"
+
+#ifdef _SCALB_INT
+#ifdef __STDC__
+ double __ieee754_scalb(double x, int fn)
+#else
+ double __ieee754_scalb(x,fn)
+ double x; int fn;
+#endif
+#else
+#ifdef __STDC__
+ double __ieee754_scalb(double x, double fn)
+#else
+ double __ieee754_scalb(x,fn)
+ double x, fn;
+#endif
+#endif
+{
+#ifdef _SCALB_INT
+ return __scalbn(x,fn);
+#else
+ if (__isnan(x)||__isnan(fn)) return x*fn;
+ if (!__finite(fn)) {
+ if(fn>0.0) return x*fn;
+ else if (x == 0)
+ return x;
+ else if (!__finite (x))
+ {
+# ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+# endif
+ return __nan ("");
+ }
+ else return x/(-fn);
+ }
+ if (__rint(fn)!=fn)
+ {
+# ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+# endif
+ return __nan ("");
+ }
+ if ( fn > 65000.0) return __scalbn(x, 65000);
+ if (-fn > 65000.0) return __scalbn(x,-65000);
+ return __scalbn(x,(int)fn);
+#endif
+}
diff --git a/sysdeps/generic/e_scalbf.c b/sysdeps/generic/e_scalbf.c
new file mode 100644
index 0000000000..5c6326bc16
--- /dev/null
+++ b/sysdeps/generic/e_scalbf.c
@@ -0,0 +1,68 @@
+/* e_scalbf.c -- float version of e_scalb.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_scalbf.c,v 1.3 1995/05/10 20:46:12 jtc Exp $";
+#endif
+
+#include <fenv.h>
+#include "math.h"
+#include "math_private.h"
+
+#ifdef _SCALB_INT
+#ifdef __STDC__
+ float __ieee754_scalbf(float x, int fn)
+#else
+ float __ieee754_scalbf(x,fn)
+ float x; int fn;
+#endif
+#else
+#ifdef __STDC__
+ float __ieee754_scalbf(float x, float fn)
+#else
+ float __ieee754_scalbf(x,fn)
+ float x, fn;
+#endif
+#endif
+{
+#ifdef _SCALB_INT
+ return __scalbnf(x,fn);
+#else
+ if (__isnanf(x)||__isnanf(fn)) return x*fn;
+ if (!__finitef(fn)) {
+ if(fn>(float)0.0) return x*fn;
+ else if (x == 0)
+ return x;
+ else if (!__finitef (x))
+ {
+# ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+# endif
+ return __nanf ("");
+ }
+ else return x/(-fn);
+ }
+ if (__rintf(fn)!=fn)
+ {
+# ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+# endif
+ return __nanf ("");
+ }
+ if ( fn > (float)65000.0) return __scalbnf(x, 65000);
+ if (-fn > (float)65000.0) return __scalbnf(x,-65000);
+ return __scalbnf(x,(int)fn);
+#endif
+}
diff --git a/sysdeps/generic/e_scalbl.c b/sysdeps/generic/e_scalbl.c
new file mode 100644
index 0000000000..a34369c0b5
--- /dev/null
+++ b/sysdeps/generic/e_scalbl.c
@@ -0,0 +1,75 @@
+/* e_scalbl.c -- long double version of s_scalb.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * __ieee754_scalbl(x, fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbnl() instead.
+ */
+
+#include <fenv.h>
+#include "math.h"
+#include "math_private.h"
+
+#ifdef _SCALB_INT
+#ifdef __STDC__
+ long double __ieee754_scalbl(long double x, int fn)
+#else
+ long double __ieee754_scalbl(x,fn)
+ long double x; int fn;
+#endif
+#else
+#ifdef __STDC__
+ long double __ieee754_scalbl(long double x, long double fn)
+#else
+ long double __ieee754_scalbl(x,fn)
+ long double x, fn;
+#endif
+#endif
+{
+#ifdef _SCALB_INT
+ return __scalbnl(x,fn);
+#else
+ if (__isnanl(x)||__isnanl(fn)) return x*fn;
+ if (!__finitel(fn)) {
+ if(fn>0.0) return x*fn;
+ else if (x == 0)
+ return x;
+ else if (!__finitel (x))
+ {
+# ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+# endif
+ return __nanl ("");
+ }
+ else return x/(-fn);
+ }
+ if (__rintl(fn)!=fn)
+ {
+# ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+# endif
+ return __nanl ("");
+ }
+ if ( fn > 65000.0) return __scalbnl(x, 65000);
+ if (-fn > 65000.0) return __scalbnl(x,-65000);
+ return __scalbnl(x,(int)fn);
+#endif
+}
diff --git a/sysdeps/generic/e_sinhl.c b/sysdeps/generic/e_sinhl.c
new file mode 100644
index 0000000000..4cec79cb2d
--- /dev/null
+++ b/sysdeps/generic/e_sinhl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_sinhl (long double x)
+{
+ fputs ("__ieee754_sinhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__ieee754_sinhl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/e_sqrtl.c b/sysdeps/generic/e_sqrtl.c
new file mode 100644
index 0000000000..7680bdb145
--- /dev/null
+++ b/sysdeps/generic/e_sqrtl.c
@@ -0,0 +1,14 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__ieee754_sqrtl (long double x)
+{
+ fputs ("__ieee754_sqrtl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (sqrtl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/elf/backtracesymsfd.c b/sysdeps/generic/elf/backtracesymsfd.c
index 6754d145b0..16df53883c 100644
--- a/sysdeps/generic/elf/backtracesymsfd.c
+++ b/sysdeps/generic/elf/backtracesymsfd.c
@@ -1,5 +1,5 @@
/* Write formatted list with names for addresses in backtrace to a file.
- Copyright (C) 1998, 2000, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -107,4 +107,3 @@ __backtrace_symbols_fd (array, size, fd)
}
}
weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd)
-libc_hidden_def (__backtrace_symbols_fd)
diff --git a/sysdeps/generic/enbl-secure.c b/sysdeps/generic/enbl-secure.c
new file mode 100644
index 0000000000..fac3b9c527
--- /dev/null
+++ b/sysdeps/generic/enbl-secure.c
@@ -0,0 +1,37 @@
+/* Define and initialize the `__libc_enable_secure' flag. Generic version.
+ Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This file is used in the static libc. For the shared library,
+ dl-sysdep.c defines and initializes __libc_enable_secure. */
+
+#include <unistd.h>
+#include <libc-internal.h>
+
+/* If nonzero __libc_enable_secure is already set. */
+int __libc_enable_secure_decided;
+/* Safest assumption, if somehow the initializer isn't run. */
+int __libc_enable_secure = 1;
+
+void
+__libc_init_secure (void)
+{
+ if (__libc_enable_secure_decided == 0)
+ __libc_enable_secure = (__geteuid () != __getuid ()
+ || __getegid () != __getgid ());
+}
diff --git a/sysdeps/generic/endutxent.c b/sysdeps/generic/endutxent.c
new file mode 100644
index 0000000000..2a93081c83
--- /dev/null
+++ b/sysdeps/generic/endutxent.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+void
+endutxent (void)
+{
+ __endutent ();
+}
diff --git a/sysdeps/generic/environ.c b/sysdeps/generic/environ.c
new file mode 100644
index 0000000000..a0ed0d80ea
--- /dev/null
+++ b/sysdeps/generic/environ.c
@@ -0,0 +1,12 @@
+/* This file just defines the `__environ' variable (and alias `environ'). */
+
+#include <unistd.h>
+#include <stddef.h>
+
+/* This must be initialized; we cannot have a weak alias into bss. */
+char **__environ = NULL;
+weak_alias (__environ, environ)
+
+/* The SVR4 ABI says `_environ' will be the name to use
+ in case the user overrides the weak alias `environ'. */
+weak_alias (__environ, _environ)
diff --git a/sysdeps/generic/errlist.c b/sysdeps/generic/errlist.c
new file mode 100644
index 0000000000..6b459ee40a
--- /dev/null
+++ b/sysdeps/generic/errlist.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+
+#ifndef HAVE_GNU_LD
+#define _sys_errlist sys_errlist
+#define _sys_nerr sys_nerr
+#endif
+
+const char *const _sys_errlist[] =
+ {
+ "Error 0", /* 0 */
+ "Argument out of function's domain", /* 1 = EDOM */
+ "Result out of range", /* 2 = ERANGE */
+ "Operation not implemented", /* 3 = ENOSYS */
+ "Invalid argument", /* 4 = EINVAL */
+ "Illegal seek", /* 5 = ESPIPE */
+ "Bad file descriptor", /* 6 = EBADF */
+ "Cannot allocate memory", /* 7 = ENOMEM */
+ "Permission denied", /* 8 = EACCES */
+ "Too many open files in system", /* 9 = ENFILE */
+ "Too many open files", /* 10 = EMFILE */
+ };
+
+const int _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
diff --git a/sysdeps/generic/errno-loc.c b/sysdeps/generic/errno-loc.c
new file mode 100644
index 0000000000..633590f4f9
--- /dev/null
+++ b/sysdeps/generic/errno-loc.c
@@ -0,0 +1,37 @@
+/* MT support function to get address of `errno' variable, non-threaded
+ version.
+ Copyright (C) 1996, 1998, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <tls.h>
+
+#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
+#undef errno
+extern int errno;
+#endif
+
+int *
+#if ! USE___THREAD
+weak_const_function
+#endif
+__errno_location (void)
+{
+ return &errno;
+}
+libc_hidden_def (__errno_location)
diff --git a/sysdeps/generic/errno.c b/sysdeps/generic/errno.c
new file mode 100644
index 0000000000..03d661b717
--- /dev/null
+++ b/sysdeps/generic/errno.c
@@ -0,0 +1,53 @@
+/* Definition of `errno' variable. Canonical version.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <tls.h>
+#include <dl-sysdep.h>
+#undef errno
+
+#if RTLD_PRIVATE_ERRNO
+
+/* Code compiled for rtld refers only to this name. */
+int rtld_errno attribute_hidden;
+
+#elif USE___THREAD
+
+__thread int errno;
+extern __thread int __libc_errno __attribute__ ((alias ("errno")))
+ attribute_hidden;
+
+#else
+
+/* This differs from plain `int errno;' in that it doesn't create
+ a common definition, but a plain symbol that resides in .bss,
+ which can have an alias. */
+int errno __attribute__ ((nocommon));
+strong_alias (errno, _errno)
+
+/* We declare these with compat_symbol so that they are not visible at
+ link time. Programs must use the accessor functions. RTLD is special,
+ since it's not exported from there at any time. */
+# if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
+# include <shlib-compat.h>
+compat_symbol (libc, errno, errno, GLIBC_2_0);
+compat_symbol (libc, _errno, _errno, GLIBC_2_0);
+# endif
+
+#endif
diff --git a/sysdeps/generic/euidaccess.c b/sysdeps/generic/euidaccess.c
new file mode 100644
index 0000000000..028fe9085c
--- /dev/null
+++ b/sysdeps/generic/euidaccess.c
@@ -0,0 +1,40 @@
+/* Test for access to FILE using effective UID and GID. Stub version.
+ Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+int
+__euidaccess (file, type)
+ const char *file;
+ int type;
+{
+ if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__euidaccess, euidaccess)
+stub_warning (euidaccess)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/exc2signal.c b/sysdeps/generic/exc2signal.c
new file mode 100644
index 0000000000..de044bbcf4
--- /dev/null
+++ b/sysdeps/generic/exc2signal.c
@@ -0,0 +1,71 @@
+/* Translate Mach exception codes into signal numbers. Stub version.
+ Copyright (C) 1991, 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <hurd.h>
+
+/* This file must be modified with machine-dependent details. */
+#error "need to write sysdeps/mach/hurd/MACHINE/exc2signal.c"
+
+/* Translate the Mach exception codes, as received in an `exception_raise' RPC,
+ into a signal number and signal subcode. */
+
+void
+_hurd_exception2signal (int exception, int code, int subcode,
+ int *signo, int *sigcode, int *error)
+{
+ *error = 0;
+
+ switch (exception)
+ {
+ default:
+ *signo = SIGIOT;
+ *sigcode = exception;
+ break;
+
+ case EXC_BAD_ACCESS:
+ if (code == KERN_PROTECTION_FAILURE)
+ *signo = SIGSEGV;
+ else
+ *signo = SIGBUS;
+ *sigcode = subcode;
+ *error = code;
+ break;
+
+ case EXC_BAD_INSTRUCTION:
+ *signo = SIGILL;
+ *sigcode = 0;
+ break;
+
+ case EXC_ARITHMETIC:
+ *signo = SIGFPE;
+ *sigcode = 0;
+ break;
+
+ case EXC_EMULATION:
+ case EXC_SOFTWARE:
+ *signo = SIGEMT;
+ *sigcode = 0;
+ break;
+
+ case EXC_BREAKPOINT:
+ *signo = SIGTRAP;
+ *sigcode = 0;
+ break;
+ }
+}
diff --git a/sysdeps/generic/execve.c b/sysdeps/generic/execve.c
new file mode 100644
index 0000000000..2d756293ed
--- /dev/null
+++ b/sysdeps/generic/execve.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Replace the current process, executing PATH with arguments ARGV and
+ environment ENVP. ARGV and ENVP are terminated by NULL pointers. */
+int
+__execve (path, argv, envp)
+ const char *path;
+ char *const argv[];
+ char *const envp[];
+{
+ if (path == NULL || argv == NULL || envp == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (execve)
+
+weak_alias (__execve, execve)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fattach.c b/sysdeps/generic/fattach.c
new file mode 100644
index 0000000000..555e0b65e6
--- /dev/null
+++ b/sysdeps/generic/fattach.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+fattach (fildes, path)
+ int fildes;
+ const char *path;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (fattach)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fchdir.c b/sysdeps/generic/fchdir.c
new file mode 100644
index 0000000000..db1e4f8f35
--- /dev/null
+++ b/sysdeps/generic/fchdir.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+/* Change the current directory to FD. */
+int
+fchdir (fd)
+ int fd;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fchdir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fchflags.c b/sysdeps/generic/fchflags.c
new file mode 100644
index 0000000000..f191194c12
--- /dev/null
+++ b/sysdeps/generic/fchflags.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Change the flags of the file FD refers to to FLAGS. */
+
+int fchflags (int fd, int flags) __THROW;
+
+int
+fchflags (fd, flags)
+ int fd;
+ int flags;
+{
+ if (fd < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fchflags)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fchmod.c b/sysdeps/generic/fchmod.c
new file mode 100644
index 0000000000..4b5eacb3eb
--- /dev/null
+++ b/sysdeps/generic/fchmod.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* Change the protections of the file FD refers to to MODE. */
+int
+__fchmod (fd, mode)
+ int fd;
+ mode_t mode;
+{
+ if (fd < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fchmod)
+
+weak_alias (__fchmod, fchmod)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fchown.c b/sysdeps/generic/fchown.c
new file mode 100644
index 0000000000..e0d42dd293
--- /dev/null
+++ b/sysdeps/generic/fchown.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Change the owner and group of the file referred to by FD. */
+int
+__fchown (fd, owner, group)
+ int fd;
+ uid_t owner;
+ gid_t group;
+{
+ if (fd < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fchown)
+
+weak_alias (__fchown, fchown)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fclrexcpt.c b/sysdeps/generic/fclrexcpt.c
new file mode 100644
index 0000000000..560e326ee3
--- /dev/null
+++ b/sysdeps/generic/fclrexcpt.c
@@ -0,0 +1,37 @@
+/* Clear given exceptions in current floating-point environment.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <shlib-compat.h>
+
+int
+__feclearexcept (int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feclearexcept, __old_feclearexcept)
+compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
+
+stub_warning (feclearexcept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fcntl.c b/sysdeps/generic/fcntl.c
new file mode 100644
index 0000000000..db6fbc399c
--- /dev/null
+++ b/sysdeps/generic/fcntl.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+
+/* Perform file control operations on FD. */
+int
+__fcntl (fd, cmd)
+ int fd;
+ int cmd;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__fcntl)
+stub_warning (fcntl)
+
+weak_alias (__fcntl, fcntl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fdatasync.c b/sysdeps/generic/fdatasync.c
new file mode 100644
index 0000000000..3edeef0c9e
--- /dev/null
+++ b/sysdeps/generic/fdatasync.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+
+
+/* Synchronize at least the data part of a file with the underlying
+ media. */
+int
+fdatasync (int fildes)
+{
+ return fsync (fildes);
+}
diff --git a/sysdeps/generic/fdetach.c b/sysdeps/generic/fdetach.c
new file mode 100644
index 0000000000..431c92bbea
--- /dev/null
+++ b/sysdeps/generic/fdetach.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+fdetach (path)
+ const char *path;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (fdetach)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fedisblxcpt.c b/sysdeps/generic/fedisblxcpt.c
new file mode 100644
index 0000000000..e1e9065aac
--- /dev/null
+++ b/sysdeps/generic/fedisblxcpt.c
@@ -0,0 +1,30 @@
+/* Disable floating-point exceptions.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+fedisableexcept (int excepts)
+{
+ /* Signal failure. */
+ return -1;
+}
+stub_warning (fedisableexcept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/feenablxcpt.c b/sysdeps/generic/feenablxcpt.c
new file mode 100644
index 0000000000..678271f360
--- /dev/null
+++ b/sysdeps/generic/feenablxcpt.c
@@ -0,0 +1,30 @@
+/* Enable floating-point exceptions.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+feenableexcept (int excepts)
+{
+ /* Signal failure. */
+ return -1;
+}
+stub_warning (feenableexcept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fegetenv.c b/sysdeps/generic/fegetenv.c
new file mode 100644
index 0000000000..4a878cc41b
--- /dev/null
+++ b/sysdeps/generic/fegetenv.c
@@ -0,0 +1,38 @@
+/* Store current floating-point environment.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <shlib-compat.h>
+#include <bp-sym.h>
+
+int
+__fegetenv (fenv_t *envp)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetenv, __old_fegetenv)
+compat_symbol (libm, BP_SYM (__old_fegetenv), BP_SYM (fegetenv), GLIBC_2_1);
+#endif
+versioned_symbol (libm, BP_SYM (__fegetenv), BP_SYM (fegetenv), GLIBC_2_2);
+
+stub_warning (fegetenv)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fegetexcept.c b/sysdeps/generic/fegetexcept.c
new file mode 100644
index 0000000000..1870689e8d
--- /dev/null
+++ b/sysdeps/generic/fegetexcept.c
@@ -0,0 +1,30 @@
+/* Get floating-point exceptions.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+fegetexcept (void)
+{
+ /* Signal failure. */
+ return -1;
+}
+stub_warning (fegetexcept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fegetround.c b/sysdeps/generic/fegetround.c
new file mode 100644
index 0000000000..cf7a774929
--- /dev/null
+++ b/sysdeps/generic/fegetround.c
@@ -0,0 +1,29 @@
+/* Return current rounding direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+fegetround (void)
+{
+ return 0;
+}
+stub_warning (fegetround)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/feholdexcpt.c b/sysdeps/generic/feholdexcpt.c
new file mode 100644
index 0000000000..927a6dc95c
--- /dev/null
+++ b/sysdeps/generic/feholdexcpt.c
@@ -0,0 +1,29 @@
+/* Store current floating-point environment and clear exceptions.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+ return 1; /* Signal failure. */
+}
+stub_warning (feholdexcept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fesetenv.c b/sysdeps/generic/fesetenv.c
new file mode 100644
index 0000000000..936d6c121b
--- /dev/null
+++ b/sysdeps/generic/fesetenv.c
@@ -0,0 +1,38 @@
+/* Install given floating-point environment.
+ Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <shlib-compat.h>
+
+int
+__fesetenv (const fenv_t *envp)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetenv, __old_fesetenv)
+compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1);
+#endif
+libm_hidden_ver (__fesetenv, fesetenv)
+versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
+
+stub_warning (fesetenv)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fesetround.c b/sysdeps/generic/fesetround.c
new file mode 100644
index 0000000000..e5a27d2aa0
--- /dev/null
+++ b/sysdeps/generic/fesetround.c
@@ -0,0 +1,29 @@
+/* Set current rounding direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+fesetround (int round)
+{
+ return 1; /* Signal we are unable to set the direction. */
+}
+stub_warning (fesetround)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/feupdateenv.c b/sysdeps/generic/feupdateenv.c
new file mode 100644
index 0000000000..3e6aed4fdf
--- /dev/null
+++ b/sysdeps/generic/feupdateenv.c
@@ -0,0 +1,37 @@
+/* Install given floating-point environment and raise exceptions.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <shlib-compat.h>
+
+int
+__feupdateenv (const fenv_t *envp)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feupdateenv, __old_feupdateenv)
+compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
+
+stub_warning (feupdateenv)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fexecve.c b/sysdeps/generic/fexecve.c
new file mode 100644
index 0000000000..fceae9251a
--- /dev/null
+++ b/sysdeps/generic/fexecve.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Execute the file FD refers to, overlaying the running program image.
+ ARGV and ENVP are passed to the new program, as for `execve'. */
+int
+fexecve (fd, argv, envp)
+ int fd;
+ char *const argv[];
+ char *const envp[];
+{
+ if (fd < 0 || argv == NULL || envp == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fexecve)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ffs.c b/sysdeps/generic/ffs.c
new file mode 100644
index 0000000000..06a1542bd9
--- /dev/null
+++ b/sysdeps/generic/ffs.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 1991, 1992, 1997, 1998, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <limits.h>
+#define ffsl __something_else
+#include <string.h>
+
+#undef ffs
+
+/* Find the first bit set in I. */
+int
+__ffs (i)
+ int i;
+{
+ static const unsigned char table[] =
+ {
+ 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
+ };
+ unsigned int a;
+ unsigned int x = i & -i;
+
+ a = x <= 0xffff ? (x <= 0xff ? 0 : 8) : (x <= 0xffffff ? 16 : 24);
+
+ return table[x >> a] + a;
+}
+weak_alias (__ffs, ffs)
+libc_hidden_builtin_def (ffs)
+
+#if ULONG_MAX == UINT_MAX
+#undef ffsl
+weak_alias (__ffs, ffsl)
+#endif
diff --git a/sysdeps/generic/ffsll.c b/sysdeps/generic/ffsll.c
new file mode 100644
index 0000000000..9dd269afb7
--- /dev/null
+++ b/sysdeps/generic/ffsll.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <limits.h>
+#define ffsl __something_else
+#include <string.h>
+
+#undef ffsll
+
+/* Find the first bit set in I. */
+int
+ffsll (i)
+ long long int i;
+{
+ unsigned long long int x = i & -i;
+
+ if (x <= 0xffffffff)
+ return ffs (i);
+ else
+ return 32 + ffs (i >> 32);
+}
+
+#if ULONG_MAX != UINT_MAX
+#undef ffsl
+weak_alias (ffsll, ffsl)
+#endif
diff --git a/sysdeps/generic/fgetexcptflg.c b/sysdeps/generic/fgetexcptflg.c
new file mode 100644
index 0000000000..aea2e0ffaf
--- /dev/null
+++ b/sysdeps/generic/fgetexcptflg.c
@@ -0,0 +1,37 @@
+/* Store current representation for exceptions.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <shlib-compat.h>
+
+int
+__fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetexceptflag, __old_fegetexceptflag)
+compat_symbol (libm, __old_fegetexceptflag, fegetexceptflag, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __fegetexceptflag, fegetexceptflag, GLIBC_2_2);
+
+stub_warning (fegetexceptflag)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fgetxattr.c b/sysdeps/generic/fgetxattr.c
new file mode 100644
index 0000000000..610ed32d1f
--- /dev/null
+++ b/sysdeps/generic/fgetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+fgetxattr (int __fd, const char *__name,
+ void *__value, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fgetxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/flistxattr.c b/sysdeps/generic/flistxattr.c
new file mode 100644
index 0000000000..fc2863d31c
--- /dev/null
+++ b/sysdeps/generic/flistxattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+flistxattr (int __fd, char *__list, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (flistxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/flock.c b/sysdeps/generic/flock.c
new file mode 100644
index 0000000000..db3bfcfcbe
--- /dev/null
+++ b/sysdeps/generic/flock.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/file.h>
+
+/* Apply or remove an advisory lock, according to OPERATION,
+ on the file FD refers to. */
+int
+__flock (fd, operation)
+ int fd;
+ int operation;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__flock, flock)
+
+stub_warning (flock)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/flockfile.c b/sysdeps/generic/flockfile.c
new file mode 100644
index 0000000000..571930ee54
--- /dev/null
+++ b/sysdeps/generic/flockfile.c
@@ -0,0 +1,30 @@
+/* Lock I/O stream. Singlethreaded version.
+ Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+#undef _IO_flockfile
+
+void
+__flockfile (FILE *stream)
+{
+ /* Do nothing. Using this version does not do any locking. */
+}
+weak_alias (__flockfile, flockfile);
+weak_alias (__flockfile, _IO_flockfile)
diff --git a/sysdeps/generic/fork.c b/sysdeps/generic/fork.c
new file mode 100644
index 0000000000..c19fa656b3
--- /dev/null
+++ b/sysdeps/generic/fork.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+
+/* Clone the calling process, creating an exact copy.
+ Return -1 for errors, 0 to the new process,
+ and the process ID of the new process to the old process. */
+int
+__fork ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__fork)
+stub_warning (fork)
+
+weak_alias (__fork, fork)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fpathconf.c b/sysdeps/generic/fpathconf.c
new file mode 100644
index 0000000000..840460b04b
--- /dev/null
+++ b/sysdeps/generic/fpathconf.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Get file-specific information about descriptor FD. */
+long int
+__fpathconf (fd, name)
+ int fd;
+ int name;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ switch (name)
+ {
+ default:
+ __set_errno (EINVAL);
+ return -1;
+
+ case _PC_LINK_MAX:
+ case _PC_MAX_CANON:
+ case _PC_MAX_INPUT:
+ case _PC_NAME_MAX:
+ case _PC_PATH_MAX:
+ case _PC_PIPE_BUF:
+ case _PC_SOCK_MAXBUF:
+ case _PC_CHOWN_RESTRICTED:
+ case _PC_NO_TRUNC:
+ case _PC_VDISABLE:
+ break;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__fpathconf, fpathconf)
+
+stub_warning (fpathconf)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fpu_control.c b/sysdeps/generic/fpu_control.c
new file mode 100644
index 0000000000..cd8eeff99d
--- /dev/null
+++ b/sysdeps/generic/fpu_control.c
@@ -0,0 +1,25 @@
+/* Default FPU control word initialization.
+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fpu_control.h>
+
+/* This module defines `__fpu_control' with the default value. */
+
+fpu_control_t __fpu_control = _FPU_DEFAULT;
diff --git a/sysdeps/generic/fraiseexcpt.c b/sysdeps/generic/fraiseexcpt.c
new file mode 100644
index 0000000000..764634a3b1
--- /dev/null
+++ b/sysdeps/generic/fraiseexcpt.c
@@ -0,0 +1,38 @@
+/* Raise given exceptions.
+ Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <shlib-compat.h>
+
+int
+__feraiseexcept (int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feraiseexcept, __old_feraiseexcept)
+compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
+#endif
+libm_hidden_ver (__feraiseexcept, feraiseexcept)
+versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
+
+stub_warning (feraiseexcept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fremovexattr.c b/sysdeps/generic/fremovexattr.c
new file mode 100644
index 0000000000..9719d42d40
--- /dev/null
+++ b/sysdeps/generic/fremovexattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+fremovexattr (int __fd, const char *__name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fremovexattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fsetexcptflg.c b/sysdeps/generic/fsetexcptflg.c
new file mode 100644
index 0000000000..8d0f0ff64b
--- /dev/null
+++ b/sysdeps/generic/fsetexcptflg.c
@@ -0,0 +1,37 @@
+/* Set floating-point environment exception handling.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <shlib-compat.h>
+
+int
+__fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+ /* This always fails. */
+ return 1;
+}
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetexceptflag, __old_fesetexceptflag)
+compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);
+
+stub_warning (fesetexceptflag)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fsetxattr.c b/sysdeps/generic/fsetxattr.c
new file mode 100644
index 0000000000..8a52e72529
--- /dev/null
+++ b/sysdeps/generic/fsetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+fsetxattr (int __fd, const char *__name, const void *__value,
+ size_t __size, int __flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fsetxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatfs.c b/sysdeps/generic/fstatfs.c
new file mode 100644
index 0000000000..4a1a996cbc
--- /dev/null
+++ b/sysdeps/generic/fstatfs.c
@@ -0,0 +1,34 @@
+/* Return information about the filesystem on which FD resides.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FD resides. */
+int
+__fstatfs (int fd, struct statfs *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fstatfs)
+
+weak_alias (__fstatfs, fstatfs)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatfs64.c b/sysdeps/generic/fstatfs64.c
new file mode 100644
index 0000000000..249b97ea44
--- /dev/null
+++ b/sysdeps/generic/fstatfs64.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statfs.h>
+
+/* Return information about the filesystem on which FD resides. */
+int
+__fstatfs64 (int fd, struct statfs64 *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__fstatfs64, fstatfs64)
+
+stub_warning (fstatfs64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatvfs.c b/sysdeps/generic/fstatvfs.c
new file mode 100644
index 0000000000..c5f75a7c97
--- /dev/null
+++ b/sysdeps/generic/fstatvfs.c
@@ -0,0 +1,33 @@
+/* Return information about the filesystem on which FD resides.
+ Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statvfs.h>
+
+/* Return information about the filesystem on which FD resides. */
+int
+__fstatvfs (int fd, struct statvfs *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fstatvfs)
+weak_alias (__fstatvfs, fstatvfs)
+libc_hidden_weak (fstatvfs)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatvfs64.c b/sysdeps/generic/fstatvfs64.c
new file mode 100644
index 0000000000..47d4e266e2
--- /dev/null
+++ b/sysdeps/generic/fstatvfs64.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statvfs.h>
+
+/* Return information about the filesystem on which FD resides. */
+int
+__fstatvfs64 (int fd, struct statvfs64 *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__fstatvfs64, fstatvfs64)
+
+stub_warning (fstatvfs64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fsync.c b/sysdeps/generic/fsync.c
new file mode 100644
index 0000000000..e2a4d700d5
--- /dev/null
+++ b/sysdeps/generic/fsync.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make all changes done to FD actually appear on disk. */
+int
+fsync (fd)
+ int fd;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (fsync)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ftestexcept.c b/sysdeps/generic/ftestexcept.c
new file mode 100644
index 0000000000..4be3fb770f
--- /dev/null
+++ b/sysdeps/generic/ftestexcept.c
@@ -0,0 +1,29 @@
+/* Test exception in current environment.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+fetestexcept (int excepts)
+{
+ return 0;
+}
+stub_warning (fetestexcept)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ftime.c b/sysdeps/generic/ftime.c
new file mode 100644
index 0000000000..94dfbcc98b
--- /dev/null
+++ b/sysdeps/generic/ftime.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1994, 1996, 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+#include <sys/timeb.h>
+
+int
+ftime (timebuf)
+ struct timeb *timebuf;
+{
+ int save = errno;
+ struct tm tp;
+
+ __set_errno (0);
+ if (time (&timebuf->time) == (time_t) -1 && errno != 0)
+ return -1;
+ timebuf->millitm = 0;
+
+ if (__localtime_r (&timebuf->time, &tp) == NULL)
+ return -1;
+
+ timebuf->timezone = tp.tm_gmtoff / 60;
+ timebuf->dstflag = tp.tm_isdst;
+
+ __set_errno (save);
+ return 0;
+}
diff --git a/sysdeps/generic/ftruncate.c b/sysdeps/generic/ftruncate.c
new file mode 100644
index 0000000000..d4cca2e267
--- /dev/null
+++ b/sysdeps/generic/ftruncate.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+/* Truncate the file FD refers to to LENGTH bytes. */
+int
+__ftruncate (fd, length)
+ int fd;
+ off_t length;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__ftruncate, ftruncate)
+
+stub_warning (ftruncate)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ftruncate64.c b/sysdeps/generic/ftruncate64.c
new file mode 100644
index 0000000000..df84b7c3c1
--- /dev/null
+++ b/sysdeps/generic/ftruncate64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate the file FD refers to to LENGTH bytes. */
+int
+__ftruncate64 (fd, length)
+ int fd;
+ off64_t length;
+{
+ if ((off_t) length != length)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ return __ftruncate (fd, (off_t) length);
+}
+weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/generic/ftrylockfile.c b/sysdeps/generic/ftrylockfile.c
new file mode 100644
index 0000000000..7bd3e9b53b
--- /dev/null
+++ b/sysdeps/generic/ftrylockfile.c
@@ -0,0 +1,31 @@
+/* Try locking I/O stream. Singlethreaded version.
+ Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+#undef _IO_ftrylockfile
+
+int
+__ftrylockfile (FILE *stream)
+{
+ /* Do nothing. Using this version does not do any locking. */
+ return 1;
+}
+weak_alias (__ftrylockfile, ftrylockfile);
+weak_alias (__ftrylockfile, _IO_ftrylockfile)
diff --git a/sysdeps/generic/funlockfile.c b/sysdeps/generic/funlockfile.c
new file mode 100644
index 0000000000..902d29478d
--- /dev/null
+++ b/sysdeps/generic/funlockfile.c
@@ -0,0 +1,30 @@
+/* Unlock I/O stream. Singlethreaded version.
+ Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+#undef _IO_funlockfile
+
+void
+__funlockfile (FILE *stream)
+{
+ /* Do nothing. Using this version does not do any locking. */
+}
+weak_alias (__funlockfile, _IO_funlockfile)
+weak_alias (__funlockfile, funlockfile);
diff --git a/sysdeps/generic/futimes.c b/sysdeps/generic/futimes.c
new file mode 100644
index 0000000000..3378dbf416
--- /dev/null
+++ b/sysdeps/generic/futimes.c
@@ -0,0 +1,34 @@
+/* futimes -- change access and modification times of open file. Stub version.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <errno.h>
+
+/* Change the access time of FILE to TVP[0] and
+ the modification time of FILE to TVP[1], but do not follow symlinks. */
+int
+__futimes (int fd, const struct timeval tvp[2])
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__futimes, futimes)
+
+stub_warning (futimes)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fxstat.c b/sysdeps/generic/fxstat.c
new file mode 100644
index 0000000000..b750daca63
--- /dev/null
+++ b/sysdeps/generic/fxstat.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Get information about the file descriptor FD in BUF. */
+int
+__fxstat (int vers, int fd, struct stat *buf)
+{
+ if (vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ else if (buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (fstat)
+hidden_def (__fxstat)
+weak_alias (__fxstat, _fxstat)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/fxstat64.c b/sysdeps/generic/fxstat64.c
new file mode 100644
index 0000000000..865ba49484
--- /dev/null
+++ b/sysdeps/generic/fxstat64.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Get information about the file descriptor FD in BUF. */
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+ if (vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ else if (buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+hidden_def (__fxstat64)
+stub_warning (fstat64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/gai_sigqueue.c b/sysdeps/generic/gai_sigqueue.c
new file mode 100644
index 0000000000..2c91df6ddc
--- /dev/null
+++ b/sysdeps/generic/gai_sigqueue.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <aio.h>
+#include <errno.h>
+#include <signal.h>
+
+#include "gai_misc.h"
+
+int
+__gai_sigqueue (sig, val, caller_pid)
+ int sig;
+ const union sigval val;
+ pid_t caller_pid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (__gai_sigqueue)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/gai_strerror.c b/sysdeps/generic/gai_strerror.c
new file mode 100644
index 0000000000..932c5910df
--- /dev/null
+++ b/sysdeps/generic/gai_strerror.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996,97,2001,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <netdb.h>
+
+const char *
+gai_strerror (int code)
+{
+ static char buffer[128];
+ snprintf (buffer, sizeof buffer, "Unknown error (%d)", code);
+ return buffer;
+}
+libc_hidden_def (gai_strerror)
diff --git a/sysdeps/generic/get_clockfreq.c b/sysdeps/generic/get_clockfreq.c
new file mode 100644
index 0000000000..14375ec186
--- /dev/null
+++ b/sysdeps/generic/get_clockfreq.c
@@ -0,0 +1,28 @@
+/* Get frequency of the system processor.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <libc-internal.h>
+
+hp_timing_t
+__get_clockfreq (void)
+{
+ /* There is no generic way to find this out since we have in general
+ no counter register either. */
+ return 0;
+}
diff --git a/sysdeps/generic/getaddrinfo.c b/sysdeps/generic/getaddrinfo.c
new file mode 100644
index 0000000000..548c0b863e
--- /dev/null
+++ b/sysdeps/generic/getaddrinfo.c
@@ -0,0 +1,41 @@
+/* Stub version of getaddrinfo function.
+ Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <netdb.h>
+
+int
+getaddrinfo (const char *name, const char *service, const struct addrinfo *req,
+ struct addrinfo **pai)
+{
+ __set_errno (ENOSYS);
+ return EAI_SYSTEM;
+}
+stub_warning (getaddrinfo)
+libc_hidden_def (getaddrinfo)
+
+void
+freeaddrinfo (struct addrinfo *ai)
+{
+ /* Nothing. */
+}
+stub_warning (freeaddrinfo)
+libc_hidden_def (freeaddrinfo)
+
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getclktck.c b/sysdeps/generic/getclktck.c
new file mode 100644
index 0000000000..897c6a25ba
--- /dev/null
+++ b/sysdeps/generic/getclktck.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+
+/* Return frequency of times(). */
+int
+__getclktck ()
+{
+#ifdef CLK_TCK
+ return CLK_TCK;
+#else
+ return 60;
+#endif
+}
diff --git a/sysdeps/generic/getcontext.c b/sysdeps/generic/getcontext.c
new file mode 100644
index 0000000000..e417575a58
--- /dev/null
+++ b/sysdeps/generic/getcontext.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+int
+getcontext (ucp)
+ ucontext_t *ucp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getcontext)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getcwd.c b/sysdeps/generic/getcwd.c
new file mode 100644
index 0000000000..c472d1d7a6
--- /dev/null
+++ b/sysdeps/generic/getcwd.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+/* Get the pathname of the current working directory,
+ and put it in SIZE bytes of BUF. Returns NULL if the
+ directory couldn't be determined or SIZE was too small.
+ If successful, returns BUF. In GNU, if BUF is NULL,
+ an array is allocated with `malloc'; the array is SIZE
+ bytes long, unless SIZE <= 0, in which case it is as
+ big as necessary. */
+char *
+__getcwd (char *buf, size_t size)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__getcwd, getcwd)
+
+stub_warning (__getcwd)
+stub_warning (getcwd)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getdents.c b/sysdeps/generic/getdents.c
new file mode 100644
index 0000000000..1b1b7c7e8f
--- /dev/null
+++ b/sysdeps/generic/getdents.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+ssize_t
+__getdirentries (fd, buf, nbytes, basep)
+ int fd;
+ char *buf;
+ size_t nbytes;
+ off_t *basep;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__getdirentries, getdirentries)
+
+stub_warning (getdirentries)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getdents64.c b/sysdeps/generic/getdents64.c
new file mode 100644
index 0000000000..cb30e76545
--- /dev/null
+++ b/sysdeps/generic/getdents64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991,95,96,97,99,2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+ssize_t
+getdirentries64 (fd, buf, nbytes, basep)
+ int fd;
+ char *buf;
+ size_t nbytes;
+ off64_t *basep;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getdirentries64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getdomain.c b/sysdeps/generic/getdomain.c
new file mode 100644
index 0000000000..6074ccfb79
--- /dev/null
+++ b/sysdeps/generic/getdomain.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 1994,95,97,2000,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Put the name of the current YP domain in no more than LEN bytes of NAME.
+ The result is null-terminated if LEN is large enough for the full
+ name and the terminator. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/utsname.h>
+#include <string.h>
+
+#if _UTSNAME_DOMAIN_LENGTH
+/* The `uname' information includes the domain name. */
+
+int
+getdomainname (name, len)
+ char *name;
+ size_t len;
+{
+ struct utsname u;
+ size_t u_len;
+
+ if (uname (&u) < 0)
+ return -1;
+
+ u_len = strlen (u.domainname);
+ memcpy (name, u.domainname, MIN (u_len + 1, len));
+ return 0;
+}
+
+#else
+
+int
+getdomainname (name, len)
+ char *name;
+ size_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getdomainname)
+#include <stub-tag.h>
+
+#endif
+
+libc_hidden_def (getdomainname)
diff --git a/sysdeps/generic/getdtsz.c b/sysdeps/generic/getdtsz.c
new file mode 100644
index 0000000000..38b7577914
--- /dev/null
+++ b/sysdeps/generic/getdtsz.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the maximum number of file descriptors
+ the current process could possibly have. */
+int
+__getdtablesize ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getdtablesize)
+
+weak_alias (__getdtablesize, getdtablesize)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getegid.c b/sysdeps/generic/getegid.c
new file mode 100644
index 0000000000..d939d6ad64
--- /dev/null
+++ b/sysdeps/generic/getegid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Get the effective group ID of the calling process. */
+__gid_t
+__getegid ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getegid)
+
+weak_alias (__getegid, getegid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getenv.c b/sysdeps/generic/getenv.c
new file mode 100644
index 0000000000..d659f66022
--- /dev/null
+++ b/sysdeps/generic/getenv.c
@@ -0,0 +1,101 @@
+/* Copyright (C) 1991,92,94,96,98,99,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <endian.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef HAVE_GNU_LD
+#define __environ environ
+#endif
+
+/* Return the value of the environment variable NAME. This implementation
+ is tuned a bit in that it assumes no environment variable has an empty
+ name which of course should always be true. We have a special case for
+ one character names so that for the general case we can assume at least
+ two characters which we can access. By doing this we can avoid using the
+ `strncmp' most of the time. */
+char *
+getenv (name)
+ const char *name;
+{
+ size_t len = strlen (name);
+ char **ep;
+ uint16_t name_start;
+
+ if (__environ == NULL || name[0] == '\0')
+ return NULL;
+
+ if (name[1] == '\0')
+ {
+ /* The name of the variable consists of only one character. Therefore
+ the first two characters of the environment entry are this character
+ and a '=' character. */
+#if __BYTE_ORDER == __LITTLE_ENDIAN || !_STRING_ARCH_unaligned
+ name_start = ('=' << 8) | *(const unsigned char *) name;
+#else
+# if __BYTE_ORDER == __BIG_ENDIAN
+ name_start = '=' | ((*(const unsigned char *) name) << 8);
+# else
+ #error "Funny byte order."
+# endif
+#endif
+ for (ep = __environ; *ep != NULL; ++ep)
+ {
+#if _STRING_ARCH_unaligned
+ uint16_t ep_start = *(uint16_t *) *ep;
+#else
+ uint16_t ep_start = (((unsigned char *) *ep)[0]
+ | (((unsigned char *) *ep)[1] << 8));
+#endif
+ if (name_start == ep_start)
+ return &(*ep)[2];
+ }
+ }
+ else
+ {
+#if _STRING_ARCH_unaligned
+ name_start = *(const uint16_t *) name;
+#else
+ name_start = (((const unsigned char *) name)[0]
+ | (((const unsigned char *) name)[1] << 8));
+#endif
+ len -= 2;
+ name += 2;
+
+ for (ep = __environ; *ep != NULL; ++ep)
+ {
+#if _STRING_ARCH_unaligned
+ uint16_t ep_start = *(uint16_t *) *ep;
+#else
+ uint16_t ep_start = (((unsigned char *) *ep)[0]
+ | (((unsigned char *) *ep)[1] << 8));
+#endif
+
+ if (name_start == ep_start && !strncmp (*ep + 2, name, len)
+ && (*ep)[len + 2] == '=')
+ return &(*ep)[len + 3];
+ }
+ }
+
+ return NULL;
+}
+libc_hidden_def (getenv)
diff --git a/sysdeps/generic/geteuid.c b/sysdeps/generic/geteuid.c
new file mode 100644
index 0000000000..c67dbfd708
--- /dev/null
+++ b/sysdeps/generic/geteuid.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+
+/* Get the effective user ID of the calling process. */
+__uid_t
+__geteuid ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (geteuid)
+
+weak_alias (__geteuid, geteuid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getgid.c b/sysdeps/generic/getgid.c
new file mode 100644
index 0000000000..742c099fa2
--- /dev/null
+++ b/sysdeps/generic/getgid.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Get the real group ID of the calling process. */
+gid_t
+__getgid ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getgid)
+
+weak_alias (__getgid, getgid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getgroups.c b/sysdeps/generic/getgroups.c
new file mode 100644
index 0000000000..d9970f0e6d
--- /dev/null
+++ b/sysdeps/generic/getgroups.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <limits.h>
+
+
+/* If SIZE is zero, return the number of supplementary groups
+ the calling process is in. Otherwise, fill in the group IDs
+ of its supplementary groups in LIST and return the number written. */
+int
+__getgroups (size, list)
+ int size;
+ gid_t *list;
+{
+#if defined (NGROUPS_MAX) && NGROUPS_MAX == 0
+ /* The system has no supplementary groups. */
+ return 0;
+#endif
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+#if defined (HAVE_GNU_LD) && !(defined (NGROUPS_MAX) && NGROUPS_MAX == 0)
+stub_warning (getgroups);
+#endif
+
+weak_alias (__getgroups, getgroups)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/gethostid.c b/sysdeps/generic/gethostid.c
new file mode 100644
index 0000000000..01baf12230
--- /dev/null
+++ b/sysdeps/generic/gethostid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the current machine's Internet number. */
+long int
+gethostid ()
+{
+ __set_errno (ENOSYS);
+ return -1L;
+}
+
+
+stub_warning (gethostid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/gethostname.c b/sysdeps/generic/gethostname.c
new file mode 100644
index 0000000000..bc59ab57c6
--- /dev/null
+++ b/sysdeps/generic/gethostname.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991,1995,1996,1997,2000,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Put the name of the current host in no more than LEN bytes of NAME.
+ The result is null-terminated if LEN is large enough for the full
+ name and the terminator. */
+int
+__gethostname (name, len)
+ char *name;
+ size_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (gethostname)
+
+weak_alias (__gethostname, gethostname)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getipv4sourcefilter.c b/sysdeps/generic/getipv4sourcefilter.c
new file mode 100644
index 0000000000..e95697778a
--- /dev/null
+++ b/sysdeps/generic/getipv4sourcefilter.c
@@ -0,0 +1,32 @@
+/* Get source filter. Stub version.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+getipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+ uint32_t *fmode, uint32_t *numsrc, struct in_addr *slist)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getipv4sourcefilter)
diff --git a/sysdeps/generic/getitimer.c b/sysdeps/generic/getitimer.c
new file mode 100644
index 0000000000..d9f3063e1e
--- /dev/null
+++ b/sysdeps/generic/getitimer.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/time.h>
+
+/* Set *VALUE to the current setting of timer WHICH.
+ Return 0 on success, -1 on errors. */
+int
+__getitimer (which, value)
+ enum __itimer_which which;
+ struct itimerval *value;
+{
+ if (value == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getitimer)
+
+weak_alias (__getitimer, getitimer)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/nfs/nfs.h b/sysdeps/generic/getloadavg.c
index e83a874fe6..070c879fd5 100644
--- a/sysdeps/generic/nfs/nfs.h
+++ b/sysdeps/generic/getloadavg.c
@@ -1,4 +1,4 @@
-/* <nfs/nfs.h> -- ill-specified NFS-related definitions
+/* Get system load averages. Stub version.
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,16 +17,21 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _NFS_NFS_H
-#define _NFS_NFS_H 1
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
-/* This file is empty for now. Its contents do not seem to be
- standardized in any way. It exists solely for the sake of
- <rpcsvc/bootparam_prot.h> which insists on including <nfs/nfs.h>.
- For the time being, we just provide this file here to smooth building
- the libc distribution (i.e. librpcsvc). We do not install this file for
- users, since we haven't really figured out what the right thing to go
- here is. */
+/* Put the 1 minute, 5 minute and 15 minute load averages
+ into the first NELEM elements of LOADAVG.
+ Return the number written (never more than 3, but may be less than NELEM),
+ or -1 if an error occurred. */
-#endif /* nfs/nfs.h */
+int
+getloadavg (double loadavg[], int nelem)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getloadavg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getlogin.c b/sysdeps/generic/getlogin.c
new file mode 100644
index 0000000000..12b4283396
--- /dev/null
+++ b/sysdeps/generic/getlogin.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the login name of the user, or NULL if it can't be determined.
+ The returned pointer, if not NULL, is good only until the next call. */
+char *
+getlogin (void)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+
+stub_warning (getlogin)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getlogin_r.c b/sysdeps/generic/getlogin_r.c
new file mode 100644
index 0000000000..f2470ee032
--- /dev/null
+++ b/sysdeps/generic/getlogin_r.c
@@ -0,0 +1,37 @@
+/* Reentrant function to return the current login name. Stub version.
+ Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return at most NAME_LEN characters of the login name of the user in NAME.
+ If it cannot be determined or some other error occurred, return the error
+ code. Otherwise return 0. */
+int
+getlogin_r (name, name_len)
+ char *name;
+ size_t name_len;
+{
+ __set_errno (ENOSYS);
+ return errno;
+}
+libc_hidden_def (getlogin_r)
+
+stub_warning (getlogin_r)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getmsg.c b/sysdeps/generic/getmsg.c
new file mode 100644
index 0000000000..861a40f677
--- /dev/null
+++ b/sysdeps/generic/getmsg.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+getmsg (fildes, ctlptr, dataptr, flagsp)
+ int fildes;
+ struct strbuf *ctlptr;
+ struct strbuf *dataptr;
+ int *flagsp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getmsg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getpagesize.c b/sysdeps/generic/getpagesize.c
new file mode 100644
index 0000000000..40ed1ee2b1
--- /dev/null
+++ b/sysdeps/generic/getpagesize.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the system page size. */
+int
+__getpagesize ()
+{
+ __set_errno (ENOSYS);
+ return 0;
+}
+libc_hidden_def (__getpagesize)
+stub_warning (getpagesize)
+
+weak_alias (__getpagesize, getpagesize)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getpeername.c b/sysdeps/generic/getpeername.c
new file mode 100644
index 0000000000..6507387bd1
--- /dev/null
+++ b/sysdeps/generic/getpeername.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Put the address of the peer connected to socket FD into *ADDR
+ (which is *LEN bytes long), and its actual length into *LEN. */
+int
+getpeername (fd, addr, len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getpeername)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getpgid.c b/sysdeps/generic/getpgid.c
new file mode 100644
index 0000000000..ad46771d2f
--- /dev/null
+++ b/sysdeps/generic/getpgid.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Get the process group ID of process PID. */
+pid_t
+__getpgid (pid)
+ pid_t pid;
+{
+ return pid;
+}
+libc_hidden_def (__getpgid)
+weak_alias (__getpgid, getpgid)
+
+stub_warning (getpgid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getpgrp.c b/sysdeps/generic/getpgrp.c
new file mode 100644
index 0000000000..85efc2f215
--- /dev/null
+++ b/sysdeps/generic/getpgrp.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991, 1995, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Get the process group ID of the calling process. */
+pid_t
+getpgrp (void)
+{
+ return __getpgid (0);
+}
diff --git a/sysdeps/generic/getpid.c b/sysdeps/generic/getpid.c
new file mode 100644
index 0000000000..c1c91fede7
--- /dev/null
+++ b/sysdeps/generic/getpid.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Get the process ID of the calling process. */
+int
+__getpid ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__getpid)
+stub_warning (getpid)
+
+weak_alias (__getpid, getpid)
+libc_hidden_weak (getpid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getpmsg.c b/sysdeps/generic/getpmsg.c
new file mode 100644
index 0000000000..e6e9898e46
--- /dev/null
+++ b/sysdeps/generic/getpmsg.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+getpmsg (fildes, ctlptr, dataptr, bandp, flagsp)
+ int fildes;
+ struct strbuf *ctlptr;
+ struct strbuf *dataptr;
+ int *bandp;
+ int *flagsp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getpmsg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getppid.c b/sysdeps/generic/getppid.c
new file mode 100644
index 0000000000..e00c237496
--- /dev/null
+++ b/sysdeps/generic/getppid.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+
+/* Get the parent process ID of the calling process. */
+int
+__getppid ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getppid)
+
+weak_alias (__getppid, getppid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getpriority.c b/sysdeps/generic/getpriority.c
new file mode 100644
index 0000000000..501c92a08a
--- /dev/null
+++ b/sysdeps/generic/getpriority.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,95,96,97,2000,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/resource.h>
+
+/* Return the highest priority of any process specified by WHICH and WHO
+ (see <sys/resource.h>); if WHO is zero, the current process, process group,
+ or user (as specified by WHO) is used. A lower priority number means higher
+ priority. Priorities range from PRIO_MIN to PRIO_MAX. */
+int
+getpriority (which, who)
+ enum __priority_which which;
+ id_t who;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (getpriority)
+
+stub_warning (getpriority)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getpt.c b/sysdeps/generic/getpt.c
new file mode 100644
index 0000000000..cd7107e5d6
--- /dev/null
+++ b/sysdeps/generic/getpt.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <errno.h>
+
+/* Open the master side of a pseudoterminal and return its file
+ descriptor, or -1 on error. */
+int
+__getpt ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__getpt, getpt)
+
+/* We cannot define posix_openpt in general for BSD systems. */
+int
+__posix_openpt (oflag)
+ int oflag;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__posix_openpt, posix_openpt)
+
+stub_warning (getpt)
+stub_warning (posix_openpt)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getresgid.c b/sysdeps/generic/getresgid.c
new file mode 100644
index 0000000000..d6a9b52957
--- /dev/null
+++ b/sysdeps/generic/getresgid.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Fetch the effective group ID, real group ID, and saved-set group ID,
+ of the calling process. */
+int
+__getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__getresgid)
+stub_warning (getresgid)
+
+weak_alias (__getresgid, getresgid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getresuid.c b/sysdeps/generic/getresuid.c
new file mode 100644
index 0000000000..227d6b7ded
--- /dev/null
+++ b/sysdeps/generic/getresuid.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Fetch the effective user ID, real user ID, and saved-set user ID,
+ of the calling process. */
+int
+__getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__getresuid)
+stub_warning (getresuid)
+
+weak_alias (__getresuid, getresuid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getrlimit.c b/sysdeps/generic/getrlimit.c
new file mode 100644
index 0000000000..d4bcadd762
--- /dev/null
+++ b/sysdeps/generic/getrlimit.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+
+/* Put the soft and hard limits for RESOURCE in *RLIMITS.
+ Returns 0 if successful, -1 if not (and sets errno). */
+int
+__getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__getrlimit, getrlimit)
+
+stub_warning (getrlimit)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getrlimit64.c b/sysdeps/generic/getrlimit64.c
new file mode 100644
index 0000000000..dcd67cf56f
--- /dev/null
+++ b/sysdeps/generic/getrlimit64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+
+/* Put the soft and hard limits for RESOURCE in *RLIMITS.
+ Returns 0 if successful, -1 if not (and sets errno). */
+int
+getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
+{
+ struct rlimit rlimits32;
+
+ if (__getrlimit (resource, &rlimits32) < 0)
+ return -1;
+
+ if (rlimits32.rlim_cur == RLIM_INFINITY)
+ rlimits->rlim_cur = RLIM64_INFINITY;
+ else
+ rlimits->rlim_cur = rlimits32.rlim_cur;
+ if (rlimits32.rlim_max == RLIM_INFINITY)
+ rlimits->rlim_max = RLIM64_INFINITY;
+ else
+ rlimits->rlim_max = rlimits32.rlim_max;
+
+ return 0;
+}
diff --git a/sysdeps/generic/getrusage.c b/sysdeps/generic/getrusage.c
new file mode 100644
index 0000000000..c679855ace
--- /dev/null
+++ b/sysdeps/generic/getrusage.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/resource.h>
+#include <errno.h>
+
+/* Return resource usage information on process indicated by WHO
+ and put it in *USAGE. Returns 0 for success, -1 for failure. */
+int
+__getrusage (who, usage)
+ enum __rusage_who who;
+ struct rusage *usage;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getrusage)
+
+weak_alias (__getrusage, getrusage)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getsid.c b/sysdeps/generic/getsid.c
new file mode 100644
index 0000000000..eb7e60fa42
--- /dev/null
+++ b/sysdeps/generic/getsid.c
@@ -0,0 +1,32 @@
+/* getsid -- Return session ID of a process. Stub version.
+ Copyright (C) 1995,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+pid_t
+getsid (pid_t pid)
+{
+ __set_errno (ENOSYS);
+ return (pid_t) -1;
+}
+libc_hidden_def (getsid)
+stub_warning (getsid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getsockname.c b/sysdeps/generic/getsockname.c
new file mode 100644
index 0000000000..b698bdbb7a
--- /dev/null
+++ b/sysdeps/generic/getsockname.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Put the local address of FD into *ADDR and its length in *LEN. */
+int
+__getsockname (fd, addr, len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__getsockname, getsockname)
+
+stub_warning (getsockname)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getsockopt.c b/sysdeps/generic/getsockopt.c
new file mode 100644
index 0000000000..8f4fa89578
--- /dev/null
+++ b/sysdeps/generic/getsockopt.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
+ into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
+ actual length. Returns 0 on success, -1 for errors. */
+int
+getsockopt (fd, level, optname, optval, optlen)
+ int fd;
+ int level;
+ int optname;
+ void *optval;
+ socklen_t *optlen;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getsockopt)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getsourcefilter.c b/sysdeps/generic/getsourcefilter.c
new file mode 100644
index 0000000000..373550beb3
--- /dev/null
+++ b/sysdeps/generic/getsourcefilter.c
@@ -0,0 +1,33 @@
+/* Get source filter. Stub version.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+ socklen_t grouplen, uint32_t *fmode, uint32_t *numsrc,
+ struct sockaddr_storage *slist)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getsourcefilter)
diff --git a/sysdeps/generic/getsysstats.c b/sysdeps/generic/getsysstats.c
new file mode 100644
index 0000000000..bc67e23e79
--- /dev/null
+++ b/sysdeps/generic/getsysstats.c
@@ -0,0 +1,69 @@
+/* getsysstats - Determine various system internal values, stub version.
+ Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/sysinfo.h>
+
+int
+__get_nprocs_conf ()
+{
+ /* We don't know how to determine the number. Simply return always 1. */
+ return 1;
+}
+weak_alias (__get_nprocs_conf, get_nprocs_conf)
+
+link_warning (get_nprocs_conf, "warning: get_nprocs_conf will always return 1")
+
+
+
+int
+__get_nprocs ()
+{
+ /* We don't know how to determine the number. Simply return always 1. */
+ return 1;
+}
+weak_alias (__get_nprocs, get_nprocs)
+
+link_warning (get_nprocs, "warning: get_nprocs will always return 1")
+
+
+long int
+__get_phys_pages ()
+{
+ /* We have no general way to determine this value. */
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__get_phys_pages, get_phys_pages)
+
+stub_warning (get_phys_pages)
+
+
+long int
+__get_avphys_pages ()
+{
+ /* We have no general way to determine this value. */
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__get_avphys_pages, get_avphys_pages)
+
+stub_warning (get_avphys_pages)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/gettimeofday.c b/sysdeps/generic/gettimeofday.c
new file mode 100644
index 0000000000..f4a170c9e7
--- /dev/null
+++ b/sysdeps/generic/gettimeofday.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/time.h>
+
+#undef __gettimeofday
+
+/* Get the current time of day and timezone information,
+ putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
+ Returns 0 on success, -1 on errors. */
+int
+__gettimeofday (tv, tz)
+ struct timeval *tv;
+ struct timezone *tz;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (gettimeofday)
+
+INTDEF(__gettimeofday)
+weak_alias (__gettimeofday, gettimeofday)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getuid.c b/sysdeps/generic/getuid.c
new file mode 100644
index 0000000000..c4ea7e8c98
--- /dev/null
+++ b/sysdeps/generic/getuid.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Get the real user ID of the calling process. */
+uid_t
+__getuid ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getuid)
+
+weak_alias (__getuid, getuid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/getutmp.c b/sysdeps/generic/getutmp.c
new file mode 100644
index 0000000000..275c1a8738
--- /dev/null
+++ b/sysdeps/generic/getutmp.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <utmp.h>
+#include <utmpx.h>
+
+/* Copy the information in UTMPX to UTMP. */
+void
+getutmp (const struct utmpx *utmpx, struct utmp *utmp)
+{
+#if _HAVE_UT_TYPE - 0
+ utmp->ut_type = utmpx->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ utmp->ut_pid = utmpx->ut_pid;
+#endif
+ memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
+ memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
+#if _HAVE_UT_ID - 0
+ memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
+#endif
+#if _HAVE_UT_TV - 0
+ utmp->ut_tv = utmpx->ut_tv;
+#else
+ utmp->ut_time = utmpx->ut_time;
+#endif
+}
diff --git a/sysdeps/generic/getutmpx.c b/sysdeps/generic/getutmpx.c
new file mode 100644
index 0000000000..5f53f22e6c
--- /dev/null
+++ b/sysdeps/generic/getutmpx.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <utmp.h>
+#include <utmpx.h>
+
+/* Copy the information in UTMP to UTMPX. */
+void
+getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
+{
+ memset (utmpx, 0, sizeof (struct utmpx));
+
+#if _HAVE_UT_TYPE - 0
+ utmpx->ut_type = utmp->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ utmpx->ut_pid = utmp->ut_pid;
+#endif
+ memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
+ memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
+#if _HAVE_UT_ID - 0
+ memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
+#endif
+#if _HAVE_UT_TV - 0
+ utmpx->ut_tv = utmp->ut_tv;
+#else
+ utmpx->ut_time = utmp->ut_time;
+#endif
+}
diff --git a/sysdeps/generic/getutxent.c b/sysdeps/generic/getutxent.c
new file mode 100644
index 0000000000..4961dee051
--- /dev/null
+++ b/sysdeps/generic/getutxent.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+struct utmpx *
+getutxent (void)
+{
+ return (struct utmpx *) __getutent ();
+}
diff --git a/sysdeps/generic/getutxid.c b/sysdeps/generic/getutxid.c
new file mode 100644
index 0000000000..ba9d5b79d8
--- /dev/null
+++ b/sysdeps/generic/getutxid.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+struct utmpx *
+getutxid (const struct utmpx *id)
+{
+ return (struct utmpx *) __getutid ((const struct utmp *) id);
+}
diff --git a/sysdeps/generic/getutxline.c b/sysdeps/generic/getutxline.c
new file mode 100644
index 0000000000..74149534c4
--- /dev/null
+++ b/sysdeps/generic/getutxline.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+struct utmpx *
+getutxline (const struct utmpx *line)
+{
+ return (struct utmpx *) __getutline ((const struct utmp *) line);
+}
diff --git a/sysdeps/generic/getxattr.c b/sysdeps/generic/getxattr.c
new file mode 100644
index 0000000000..ebf7bf2b4d
--- /dev/null
+++ b/sysdeps/generic/getxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+getxattr (const char *__path, const char *__name,
+ void *__value, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
new file mode 100644
index 0000000000..c0e76b377e
--- /dev/null
+++ b/sysdeps/generic/glob.c
@@ -0,0 +1,1558 @@
+/* Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* AIX requires this to be the first thing in the file. */
+#if defined _AIX && !defined __GNUC__
+ #pragma alloca
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Enable GNU extensions in glob.h. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* Outcomment the following line for production quality code. */
+/* #define NDEBUG 1 */
+#include <assert.h>
+
+#include <stdio.h> /* Needed on stupid SunOS for assert. */
+
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C
+ Library, but also included in many other GNU distributions. Compiling
+ and linking in this code is a waste when using the GNU C library
+ (especially if it is a shared library). Rather than having every GNU
+ program understand `configure --with-gnu-libc' and omit the object files,
+ it is simpler to just do this in the source for each such file. */
+
+#define GLOB_INTERFACE_VERSION 1
+#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
+# include <gnu-versions.h>
+# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
+# define ELIDE_CODE
+# endif
+#endif
+
+#ifndef ELIDE_CODE
+#if !defined _LIBC || !defined GLOB_ONLY_P
+
+#if defined STDC_HEADERS || defined __GNU_LIBRARY__
+# include <stddef.h>
+#endif
+
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+# ifndef POSIX
+# ifdef _POSIX_VERSION
+# define POSIX
+# endif
+# endif
+#endif
+
+#if !defined _AMIGA && !defined VMS && !defined WINDOWS32
+# include <pwd.h>
+#endif
+
+#if !defined __GNU_LIBRARY__ && !defined STDC_HEADERS
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(val) errno = (val)
+#endif
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+
+#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+# ifdef HAVE_VMSDIR_H
+# include "vmsdir.h"
+# endif /* HAVE_VMSDIR_H */
+#endif
+
+
+/* In GNU systems, <dirent.h> defines this macro for us. */
+#ifdef _D_NAMLEN
+# undef NAMLEN
+# define NAMLEN(d) _D_NAMLEN(d)
+#endif
+
+/* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
+ if the `d_type' member for `struct dirent' is available. */
+#ifdef _DIRENT_HAVE_D_TYPE
+# define HAVE_D_TYPE 1
+#endif
+
+#if _LIBC
+# define HAVE_DIRENT64 1
+#endif
+
+/* If the system has the `struct dirent64' type we use it internally. */
+#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64
+# if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
+# define CONVERT_D_NAMLEN(d64, d32)
+# else
+# define CONVERT_D_NAMLEN(d64, d32) \
+ (d64)->d_namlen = (d32)->d_namlen;
+# endif
+
+# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
+# define CONVERT_D_INO(d64, d32)
+# else
+# define CONVERT_D_INO(d64, d32) \
+ (d64)->d_ino = (d32)->d_ino;
+# endif
+
+# ifdef HAVE_D_TYPE
+# define CONVERT_D_TYPE(d64, d32) \
+ (d64)->d_type = (d32)->d_type;
+# else
+# define CONVERT_D_TYPE(d64, d32)
+# endif
+
+# define CONVERT_DIRENT_DIRENT64(d64, d32) \
+ memcpy ((d64)->d_name, (d32)->d_name, NAMLEN (d32) + 1); \
+ CONVERT_D_NAMLEN (d64, d32) \
+ CONVERT_D_INO (d64, d32) \
+ CONVERT_D_TYPE (d64, d32)
+#endif
+
+
+#if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
+/* Posix does not require that the d_ino field be present, and some
+ systems do not provide it. */
+# define REAL_DIR_ENTRY(dp) 1
+#else
+# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
+#endif /* POSIX */
+
+#if defined STDC_HEADERS || defined __GNU_LIBRARY__
+# include <stdlib.h>
+# include <string.h>
+# define ANSI_STRING
+#else /* No standard headers. */
+
+extern char *getenv ();
+
+# ifdef HAVE_STRING_H
+# include <string.h>
+# define ANSI_STRING
+# else
+# include <strings.h>
+# endif
+# ifdef HAVE_MEMORY_H
+# include <memory.h>
+# endif
+
+extern char *malloc (), *realloc ();
+extern void free ();
+
+extern void qsort ();
+extern void abort (), exit ();
+
+#endif /* Standard headers. */
+
+/* NAME_MAX is usually defined in <dirent.h> or <limits.h>. */
+#if defined HAVE_LIMITS_H || defined __GNU_LIBRARY__
+# include <limits.h>
+#endif
+#ifndef NAME_MAX
+# define NAME_MAX (sizeof (((struct dirent *) 0)->d_name))
+#endif
+
+#ifndef ANSI_STRING
+
+# ifndef bzero
+extern void bzero ();
+# endif
+# ifndef bcopy
+extern void bcopy ();
+# endif
+
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define strrchr rindex
+/* memset is only used for zero here, but let's be paranoid. */
+# define memset(s, better_be_zero, n) \
+ ((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
+#endif /* Not ANSI_STRING. */
+
+#if !defined HAVE_STRCOLL && !defined _LIBC
+# define strcoll strcmp
+#endif
+
+#if !defined HAVE_MEMPCPY && __GLIBC__ - 0 == 2 && __GLIBC_MINOR__ >= 1
+# define HAVE_MEMPCPY 1
+# undef mempcpy
+# define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
+#endif
+
+#ifndef __GNU_LIBRARY__
+# ifdef __GNUC__
+__inline
+# endif
+# ifndef __SASC
+# ifdef WINDOWS32
+static void *
+# else
+static char *
+# endif
+my_realloc (p, n)
+ char *p;
+ unsigned int n;
+{
+ /* These casts are the for sake of the broken Ultrix compiler,
+ which warns of illegal pointer combinations otherwise. */
+ if (p == NULL)
+ return (char *) malloc (n);
+ return (char *) realloc (p, n);
+}
+# define realloc my_realloc
+# endif /* __SASC */
+#endif /* __GNU_LIBRARY__ */
+
+
+#if !defined __alloca && !defined __GNU_LIBRARY__
+
+# ifdef __GNUC__
+# undef alloca
+# define alloca(n) __builtin_alloca (n)
+# else /* Not GCC. */
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else /* Not HAVE_ALLOCA_H. */
+# ifndef _AIX
+# ifdef WINDOWS32
+# include <malloc.h>
+# else
+extern char *alloca ();
+# endif /* WINDOWS32 */
+# endif /* Not _AIX. */
+# endif /* sparc or HAVE_ALLOCA_H. */
+# endif /* GCC. */
+
+# define __alloca alloca
+
+#endif
+
+#ifndef __GNU_LIBRARY__
+# define __stat stat
+# ifdef STAT_MACROS_BROKEN
+# undef S_ISDIR
+# endif
+# ifndef S_ISDIR
+# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+# endif
+#endif
+
+#ifdef _LIBC
+# include <alloca.h>
+# undef strdup
+# define strdup(str) __strdup (str)
+# define sysconf(id) __sysconf (id)
+# define closedir(dir) __closedir (dir)
+# define opendir(name) __opendir (name)
+# define readdir(str) __readdir64 (str)
+# define getpwnam_r(name, bufp, buf, len, res) \
+ __getpwnam_r (name, bufp, buf, len, res)
+# ifndef __stat64
+# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
+# endif
+# define HAVE_STAT64 1
+#endif
+
+#ifndef HAVE_STAT64
+# define __stat64(fname, buf) __stat (fname, buf)
+/* This is the variable name we are using. */
+# define st64 st
+#endif
+
+#if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
+# undef size_t
+# define size_t unsigned int
+#endif
+
+/* Some system header files erroneously define these.
+ We want our own definitions from <fnmatch.h> to take precedence. */
+#ifndef __GNU_LIBRARY__
+# undef FNM_PATHNAME
+# undef FNM_NOESCAPE
+# undef FNM_PERIOD
+#endif
+#include <fnmatch.h>
+
+/* Some system header files erroneously define these.
+ We want our own definitions from <glob.h> to take precedence. */
+#ifndef __GNU_LIBRARY__
+# undef GLOB_ERR
+# undef GLOB_MARK
+# undef GLOB_NOSORT
+# undef GLOB_DOOFFS
+# undef GLOB_NOCHECK
+# undef GLOB_APPEND
+# undef GLOB_NOESCAPE
+# undef GLOB_PERIOD
+#endif
+#include <glob.h>
+
+#ifdef HAVE_GETLOGIN_R
+extern int getlogin_r (char *, size_t);
+#else
+extern char *getlogin (void);
+#endif
+
+static const char *next_brace_sub (const char *begin, int flags) __THROW;
+
+#endif /* GLOB_ONLY_P */
+
+static int glob_in_dir (const char *pattern, const char *directory,
+ int flags, int (*errfunc) (const char *, int),
+ glob_t *pglob);
+
+#if !defined _LIBC || !defined GLOB_ONLY_P
+static int prefix_array (const char *prefix, char **array, size_t n) __THROW;
+static int collated_compare (const __ptr_t, const __ptr_t) __THROW;
+
+
+/* Find the end of the sub-pattern in a brace expression. */
+static const char *
+next_brace_sub (cp, flags)
+ const char *cp;
+ int flags;
+{
+ unsigned int depth = 0;
+ while (*cp != '\0')
+ if ((flags & GLOB_NOESCAPE) == 0 && *cp == '\\')
+ {
+ if (*++cp == '\0')
+ break;
+ ++cp;
+ }
+ else
+ {
+ if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0))
+ break;
+
+ if (*cp++ == '{')
+ depth++;
+ }
+
+ return *cp != '\0' ? cp : NULL;
+}
+
+#endif /* !GLOB_ONLY_P */
+
+/* Do glob searching for PATTERN, placing results in PGLOB.
+ The bits defined above may be set in FLAGS.
+ If a directory cannot be opened or read and ERRFUNC is not nil,
+ it is called with the pathname that caused the error, and the
+ `errno' value from the failing call; if it returns non-zero
+ `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
+ If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
+ Otherwise, `glob' returns zero. */
+int
+#ifdef GLOB_ATTRIBUTE
+GLOB_ATTRIBUTE
+#endif
+glob (pattern, flags, errfunc, pglob)
+ const char *pattern;
+ int flags;
+ int (*errfunc) (const char *, int);
+ glob_t *pglob;
+{
+ const char *filename;
+ const char *dirname;
+ size_t dirlen;
+ int status;
+ size_t oldcount;
+
+ if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (!(flags & GLOB_DOOFFS))
+ /* Have to do this so `globfree' knows where to start freeing. It
+ also makes all the code that uses gl_offs simpler. */
+ pglob->gl_offs = 0;
+
+ if (flags & GLOB_BRACE)
+ {
+ const char *begin;
+
+ if (flags & GLOB_NOESCAPE)
+ begin = strchr (pattern, '{');
+ else
+ {
+ begin = pattern;
+ while (1)
+ {
+ if (*begin == '\0')
+ {
+ begin = NULL;
+ break;
+ }
+
+ if (*begin == '\\' && begin[1] != '\0')
+ ++begin;
+ else if (*begin == '{')
+ break;
+
+ ++begin;
+ }
+ }
+
+ if (begin != NULL)
+ {
+ /* Allocate working buffer large enough for our work. Note that
+ we have at least an opening and closing brace. */
+ size_t firstc;
+ char *alt_start;
+ const char *p;
+ const char *next;
+ const char *rest;
+ size_t rest_len;
+#ifdef __GNUC__
+ char onealt[strlen (pattern) - 1];
+#else
+ char *onealt = (char *) malloc (strlen (pattern) - 1);
+ if (onealt == NULL)
+ {
+ if (!(flags & GLOB_APPEND))
+ {
+ pglob->gl_pathc = 0;
+ pglob->gl_pathv = NULL;
+ }
+ return GLOB_NOSPACE;
+ }
+#endif
+
+ /* We know the prefix for all sub-patterns. */
+#ifdef HAVE_MEMPCPY
+ alt_start = mempcpy (onealt, pattern, begin - pattern);
+#else
+ memcpy (onealt, pattern, begin - pattern);
+ alt_start = &onealt[begin - pattern];
+#endif
+
+ /* Find the first sub-pattern and at the same time find the
+ rest after the closing brace. */
+ next = next_brace_sub (begin + 1, flags);
+ if (next == NULL)
+ {
+ /* It is an illegal expression. */
+#ifndef __GNUC__
+ free (onealt);
+#endif
+ return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
+ }
+
+ /* Now find the end of the whole brace expression. */
+ rest = next;
+ while (*rest != '}')
+ {
+ rest = next_brace_sub (rest + 1, flags);
+ if (rest == NULL)
+ {
+ /* It is an illegal expression. */
+#ifndef __GNUC__
+ free (onealt);
+#endif
+ return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
+ }
+ }
+ /* Please note that we now can be sure the brace expression
+ is well-formed. */
+ rest_len = strlen (++rest) + 1;
+
+ /* We have a brace expression. BEGIN points to the opening {,
+ NEXT points past the terminator of the first element, and END
+ points past the final }. We will accumulate result names from
+ recursive runs for each brace alternative in the buffer using
+ GLOB_APPEND. */
+
+ if (!(flags & GLOB_APPEND))
+ {
+ /* This call is to set a new vector, so clear out the
+ vector so we can append to it. */
+ pglob->gl_pathc = 0;
+ pglob->gl_pathv = NULL;
+ }
+ firstc = pglob->gl_pathc;
+
+ p = begin + 1;
+ while (1)
+ {
+ int result;
+
+ /* Construct the new glob expression. */
+#ifdef HAVE_MEMPCPY
+ mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len);
+#else
+ memcpy (alt_start, p, next - p);
+ memcpy (&alt_start[next - p], rest, rest_len);
+#endif
+
+ result = glob (onealt,
+ ((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC))
+ | GLOB_APPEND), errfunc, pglob);
+
+ /* If we got an error, return it. */
+ if (result && result != GLOB_NOMATCH)
+ {
+#ifndef __GNUC__
+ free (onealt);
+#endif
+ if (!(flags & GLOB_APPEND))
+ {
+ globfree (pglob);
+ pglob->gl_pathc = 0;
+ }
+ return result;
+ }
+
+ if (*next == '}')
+ /* We saw the last entry. */
+ break;
+
+ p = next + 1;
+ next = next_brace_sub (p, flags);
+ assert (next != NULL);
+ }
+
+#ifndef __GNUC__
+ free (onealt);
+#endif
+
+ if (pglob->gl_pathc != firstc)
+ /* We found some entries. */
+ return 0;
+ else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
+ return GLOB_NOMATCH;
+ }
+ }
+
+ /* Find the filename. */
+ filename = strrchr (pattern, '/');
+#if defined __MSDOS__ || defined WINDOWS32
+ /* The case of "d:pattern". Since `:' is not allowed in
+ file names, we can safely assume that wherever it
+ happens in pattern, it signals the filename part. This
+ is so we could some day support patterns like "[a-z]:foo". */
+ if (filename == NULL)
+ filename = strchr (pattern, ':');
+#endif /* __MSDOS__ || WINDOWS32 */
+ if (filename == NULL)
+ {
+ /* This can mean two things: a simple name or "~name". The latter
+ case is nothing but a notation for a directory. */
+ if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~')
+ {
+ dirname = pattern;
+ dirlen = strlen (pattern);
+
+ /* Set FILENAME to NULL as a special flag. This is ugly but
+ other solutions would require much more code. We test for
+ this special case below. */
+ filename = NULL;
+ }
+ else
+ {
+ filename = pattern;
+#ifdef _AMIGA
+ dirname = "";
+#else
+ dirname = ".";
+#endif
+ dirlen = 0;
+ }
+ }
+ else if (filename == pattern)
+ {
+ /* "/pattern". */
+ dirname = "/";
+ dirlen = 1;
+ ++filename;
+ }
+ else
+ {
+ char *newp;
+ dirlen = filename - pattern;
+#if defined __MSDOS__ || defined WINDOWS32
+ if (*filename == ':'
+ || (filename > pattern + 1 && filename[-1] == ':'))
+ {
+ char *drive_spec;
+
+ ++dirlen;
+ drive_spec = (char *) __alloca (dirlen + 1);
+#ifdef HAVE_MEMPCPY
+ *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0';
+#else
+ memcpy (drive_spec, pattern, dirlen);
+ drive_spec[dirlen] = '\0';
+#endif
+ /* For now, disallow wildcards in the drive spec, to
+ prevent infinite recursion in glob. */
+ if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE)))
+ return GLOB_NOMATCH;
+ /* If this is "d:pattern", we need to copy `:' to DIRNAME
+ as well. If it's "d:/pattern", don't remove the slash
+ from "d:/", since "d:" and "d:/" are not the same.*/
+ }
+#endif
+ newp = (char *) __alloca (dirlen + 1);
+#ifdef HAVE_MEMPCPY
+ *((char *) mempcpy (newp, pattern, dirlen)) = '\0';
+#else
+ memcpy (newp, pattern, dirlen);
+ newp[dirlen] = '\0';
+#endif
+ dirname = newp;
+ ++filename;
+
+ if (filename[0] == '\0'
+#if defined __MSDOS__ || defined WINDOWS32
+ && dirname[dirlen - 1] != ':'
+ && (dirlen < 3 || dirname[dirlen - 2] != ':'
+ || dirname[dirlen - 1] != '/')
+#endif
+ && dirlen > 1)
+ /* "pattern/". Expand "pattern", appending slashes. */
+ {
+ int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
+ if (val == 0)
+ pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
+ | (flags & GLOB_MARK));
+ return val;
+ }
+ }
+
+ if (!(flags & GLOB_APPEND))
+ {
+ pglob->gl_pathc = 0;
+ if (!(flags & GLOB_DOOFFS))
+ pglob->gl_pathv = NULL;
+ else
+ {
+ size_t i;
+ pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1)
+ * sizeof (char *));
+ if (pglob->gl_pathv == NULL)
+ return GLOB_NOSPACE;
+
+ for (i = 0; i <= pglob->gl_offs; ++i)
+ pglob->gl_pathv[i] = NULL;
+ }
+ }
+
+ oldcount = pglob->gl_pathc + pglob->gl_offs;
+
+#ifndef VMS
+ if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~')
+ {
+ if (dirname[1] == '\0' || dirname[1] == '/')
+ {
+ /* Look up home directory. */
+ const char *home_dir = getenv ("HOME");
+# ifdef _AMIGA
+ if (home_dir == NULL || home_dir[0] == '\0')
+ home_dir = "SYS:";
+# else
+# ifdef WINDOWS32
+ if (home_dir == NULL || home_dir[0] == '\0')
+ home_dir = "c:/users/default"; /* poor default */
+# else
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ int success;
+ char *name;
+# if defined HAVE_GETLOGIN_R || defined _LIBC
+ size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
+
+ if (buflen == 0)
+ /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try
+ a moderate value. */
+ buflen = 20;
+ name = (char *) __alloca (buflen);
+
+ success = getlogin_r (name, buflen) >= 0;
+# else
+ success = (name = getlogin ()) != NULL;
+# endif
+ if (success)
+ {
+ struct passwd *p;
+# if defined HAVE_GETPWNAM_R || defined _LIBC
+ long int pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+ char *pwtmpbuf;
+ struct passwd pwbuf;
+ int save = errno;
+
+# ifndef _LIBC
+ if (pwbuflen == -1)
+ /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
+ Try a moderate value. */
+ pwbuflen = 1024;
+# endif
+ pwtmpbuf = (char *) __alloca (pwbuflen);
+
+ while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
+ != 0)
+ {
+ if (errno != ERANGE)
+ {
+ p = NULL;
+ break;
+ }
+# ifdef _LIBC
+ pwtmpbuf = extend_alloca (pwtmpbuf, pwbuflen,
+ 2 * pwbuflen);
+# else
+ pwbuflen *= 2;
+ pwtmpbuf = (char *) __alloca (pwbuflen);
+# endif
+ __set_errno (save);
+ }
+# else
+ p = getpwnam (name);
+# endif
+ if (p != NULL)
+ home_dir = p->pw_dir;
+ }
+ }
+ if (home_dir == NULL || home_dir[0] == '\0')
+ {
+ if (flags & GLOB_TILDE_CHECK)
+ return GLOB_NOMATCH;
+ else
+ home_dir = "~"; /* No luck. */
+ }
+# endif /* WINDOWS32 */
+# endif
+ /* Now construct the full directory. */
+ if (dirname[1] == '\0')
+ dirname = home_dir;
+ else
+ {
+ char *newp;
+ size_t home_len = strlen (home_dir);
+ newp = (char *) __alloca (home_len + dirlen);
+# ifdef HAVE_MEMPCPY
+ mempcpy (mempcpy (newp, home_dir, home_len),
+ &dirname[1], dirlen);
+# else
+ memcpy (newp, home_dir, home_len);
+ memcpy (&newp[home_len], &dirname[1], dirlen);
+# endif
+ dirname = newp;
+ }
+ }
+# if !defined _AMIGA && !defined WINDOWS32
+ else
+ {
+ char *end_name = strchr (dirname, '/');
+ const char *user_name;
+ const char *home_dir;
+
+ if (end_name == NULL)
+ user_name = dirname + 1;
+ else
+ {
+ char *newp;
+ newp = (char *) __alloca (end_name - dirname);
+# ifdef HAVE_MEMPCPY
+ *((char *) mempcpy (newp, dirname + 1, end_name - dirname))
+ = '\0';
+# else
+ memcpy (newp, dirname + 1, end_name - dirname);
+ newp[end_name - dirname - 1] = '\0';
+# endif
+ user_name = newp;
+ }
+
+ /* Look up specific user's home directory. */
+ {
+ struct passwd *p;
+# if defined HAVE_GETPWNAM_R || defined _LIBC
+ long int buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+ char *pwtmpbuf;
+ struct passwd pwbuf;
+ int save = errno;
+
+# ifndef _LIBC
+ if (buflen == -1)
+ /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a
+ moderate value. */
+ buflen = 1024;
+# endif
+ pwtmpbuf = (char *) __alloca (buflen);
+
+ while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0)
+ {
+ if (errno != ERANGE)
+ {
+ p = NULL;
+ break;
+ }
+# ifdef _LIBC
+ pwtmpbuf = extend_alloca (pwtmpbuf, buflen, 2 * buflen);
+# else
+ buflen *= 2;
+ pwtmpbuf = __alloca (buflen);
+# endif
+ __set_errno (save);
+ }
+# else
+ p = getpwnam (user_name);
+# endif
+ if (p != NULL)
+ home_dir = p->pw_dir;
+ else
+ home_dir = NULL;
+ }
+ /* If we found a home directory use this. */
+ if (home_dir != NULL)
+ {
+ char *newp;
+ size_t home_len = strlen (home_dir);
+ size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
+ newp = (char *) __alloca (home_len + rest_len + 1);
+# ifdef HAVE_MEMPCPY
+ *((char *) mempcpy (mempcpy (newp, home_dir, home_len),
+ end_name, rest_len)) = '\0';
+# else
+ memcpy (newp, home_dir, home_len);
+ memcpy (&newp[home_len], end_name, rest_len);
+ newp[home_len + rest_len] = '\0';
+# endif
+ dirname = newp;
+ }
+ else
+ if (flags & GLOB_TILDE_CHECK)
+ /* We have to regard it as an error if we cannot find the
+ home directory. */
+ return GLOB_NOMATCH;
+ }
+# endif /* Not Amiga && not WINDOWS32. */
+ }
+#endif /* Not VMS. */
+
+ /* Now test whether we looked for "~" or "~NAME". In this case we
+ can give the answer now. */
+ if (filename == NULL)
+ {
+ struct stat st;
+#ifdef HAVE_STAT64
+ struct stat64 st64;
+#endif
+
+ /* Return the directory if we don't check for error or if it exists. */
+ if ((flags & GLOB_NOCHECK)
+ || (((flags & GLOB_ALTDIRFUNC)
+ ? ((*pglob->gl_stat) (dirname, &st) == 0
+ && S_ISDIR (st.st_mode))
+ : (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode)))))
+ {
+ int newcount = pglob->gl_pathc + pglob->gl_offs;
+ char **new_gl_pathv;
+
+ new_gl_pathv
+ = (char **) realloc (pglob->gl_pathv,
+ (newcount + 1 + 1) * sizeof (char *));
+ if (new_gl_pathv == NULL)
+ {
+ nospace:
+ free (pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ pglob->gl_pathc = 0;
+ return GLOB_NOSPACE;
+ }
+ pglob->gl_pathv = new_gl_pathv;
+
+#if defined HAVE_STRDUP || defined _LIBC
+ pglob->gl_pathv[newcount] = strdup (dirname);
+#else
+ {
+ size_t len = strlen (dirname) + 1;
+ char *dircopy = (char *) malloc (len);
+ if (dircopy != NULL)
+ pglob->gl_pathv[newcount] = memcpy (dircopy, dirname, len);
+ }
+#endif
+ if (pglob->gl_pathv[newcount] == NULL)
+ goto nospace;
+ pglob->gl_pathv[++newcount] = NULL;
+ ++pglob->gl_pathc;
+ pglob->gl_flags = flags;
+
+ return 0;
+ }
+
+ /* Not found. */
+ return GLOB_NOMATCH;
+ }
+
+ if (__glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE)))
+ {
+ /* The directory name contains metacharacters, so we
+ have to glob for the directory, and then glob for
+ the pattern in each directory found. */
+ glob_t dirs;
+ size_t i;
+
+ if ((flags & GLOB_ALTDIRFUNC) != 0)
+ {
+ /* Use the alternative access functions also in the recursive
+ call. */
+ dirs.gl_opendir = pglob->gl_opendir;
+ dirs.gl_readdir = pglob->gl_readdir;
+ dirs.gl_closedir = pglob->gl_closedir;
+ dirs.gl_stat = pglob->gl_stat;
+ dirs.gl_lstat = pglob->gl_lstat;
+ }
+
+ status = glob (dirname,
+ ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE
+ | GLOB_ALTDIRFUNC))
+ | GLOB_NOSORT | GLOB_ONLYDIR),
+ errfunc, &dirs);
+ if (status != 0)
+ return status;
+
+ /* We have successfully globbed the preceding directory name.
+ For each name we found, call glob_in_dir on it and FILENAME,
+ appending the results to PGLOB. */
+ for (i = 0; i < dirs.gl_pathc; ++i)
+ {
+ int old_pathc;
+
+#ifdef SHELL
+ {
+ /* Make globbing interruptible in the bash shell. */
+ extern int interrupt_state;
+
+ if (interrupt_state)
+ {
+ globfree (&dirs);
+ return GLOB_ABORTED;
+ }
+ }
+#endif /* SHELL. */
+
+ old_pathc = pglob->gl_pathc;
+ status = glob_in_dir (filename, dirs.gl_pathv[i],
+ ((flags | GLOB_APPEND)
+ & ~(GLOB_NOCHECK | GLOB_NOMAGIC)),
+ errfunc, pglob);
+ if (status == GLOB_NOMATCH)
+ /* No matches in this directory. Try the next. */
+ continue;
+
+ if (status != 0)
+ {
+ globfree (&dirs);
+ globfree (pglob);
+ pglob->gl_pathc = 0;
+ return status;
+ }
+
+ /* Stick the directory on the front of each name. */
+ if (prefix_array (dirs.gl_pathv[i],
+ &pglob->gl_pathv[old_pathc + pglob->gl_offs],
+ pglob->gl_pathc - old_pathc))
+ {
+ globfree (&dirs);
+ globfree (pglob);
+ pglob->gl_pathc = 0;
+ return GLOB_NOSPACE;
+ }
+ }
+
+ flags |= GLOB_MAGCHAR;
+
+ /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls.
+ But if we have not found any matching entry and the GLOB_NOCHECK
+ flag was set we must return the input pattern itself. */
+ if (pglob->gl_pathc + pglob->gl_offs == oldcount)
+ {
+ /* No matches. */
+ if (flags & GLOB_NOCHECK)
+ {
+ int newcount = pglob->gl_pathc + pglob->gl_offs;
+ char **new_gl_pathv;
+
+ new_gl_pathv = (char **) realloc (pglob->gl_pathv,
+ (newcount + 2)
+ * sizeof (char *));
+ if (new_gl_pathv == NULL)
+ {
+ globfree (&dirs);
+ return GLOB_NOSPACE;
+ }
+ pglob->gl_pathv = new_gl_pathv;
+
+ pglob->gl_pathv[newcount] = __strdup (pattern);
+ if (pglob->gl_pathv[newcount] == NULL)
+ {
+ globfree (&dirs);
+ globfree (pglob);
+ pglob->gl_pathc = 0;
+ return GLOB_NOSPACE;
+ }
+
+ ++pglob->gl_pathc;
+ ++newcount;
+
+ pglob->gl_pathv[newcount] = NULL;
+ pglob->gl_flags = flags;
+ }
+ else
+ {
+ globfree (&dirs);
+ return GLOB_NOMATCH;
+ }
+ }
+
+ globfree (&dirs);
+ }
+ else
+ {
+ int old_pathc = pglob->gl_pathc;
+
+ status = glob_in_dir (filename, dirname, flags, errfunc, pglob);
+ if (status != 0)
+ return status;
+
+ if (dirlen > 0)
+ {
+ /* Stick the directory on the front of each name. */
+ if (prefix_array (dirname,
+ &pglob->gl_pathv[old_pathc + pglob->gl_offs],
+ pglob->gl_pathc - old_pathc))
+ {
+ globfree (pglob);
+ pglob->gl_pathc = 0;
+ return GLOB_NOSPACE;
+ }
+ }
+ }
+
+ if (flags & GLOB_MARK)
+ {
+ /* Append slashes to directory names. */
+ size_t i;
+ struct stat st;
+#ifdef HAVE_STAT64
+ struct stat64 st64;
+#endif
+
+ for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; ++i)
+ if (((flags & GLOB_ALTDIRFUNC)
+ ? ((*pglob->gl_stat) (pglob->gl_pathv[i], &st) == 0
+ && S_ISDIR (st.st_mode))
+ : (__stat64 (pglob->gl_pathv[i], &st64) == 0
+ && S_ISDIR (st64.st_mode))))
+ {
+ size_t len = strlen (pglob->gl_pathv[i]) + 2;
+ char *new = realloc (pglob->gl_pathv[i], len);
+ if (new == NULL)
+ {
+ globfree (pglob);
+ pglob->gl_pathc = 0;
+ return GLOB_NOSPACE;
+ }
+ strcpy (&new[len - 2], "/");
+ pglob->gl_pathv[i] = new;
+ }
+ }
+
+ if (!(flags & GLOB_NOSORT))
+ {
+ /* Sort the vector. */
+ qsort ((__ptr_t) &pglob->gl_pathv[oldcount],
+ pglob->gl_pathc + pglob->gl_offs - oldcount,
+ sizeof (char *), collated_compare);
+ }
+
+ return 0;
+}
+#if defined _LIBC && !defined glob
+libc_hidden_def (glob)
+#endif
+
+
+#if !defined _LIBC || !defined GLOB_ONLY_P
+
+/* Free storage allocated in PGLOB by a previous `glob' call. */
+void
+globfree (pglob)
+ register glob_t *pglob;
+{
+ if (pglob->gl_pathv != NULL)
+ {
+ size_t i;
+ for (i = 0; i < pglob->gl_pathc; ++i)
+ if (pglob->gl_pathv[pglob->gl_offs + i] != NULL)
+ free ((__ptr_t) pglob->gl_pathv[pglob->gl_offs + i]);
+ free ((__ptr_t) pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ }
+}
+#if defined _LIBC && !defined globfree
+libc_hidden_def (globfree)
+#endif
+
+
+/* Do a collated comparison of A and B. */
+static int
+collated_compare (a, b)
+ const __ptr_t a;
+ const __ptr_t b;
+{
+ const char *const s1 = *(const char *const * const) a;
+ const char *const s2 = *(const char *const * const) b;
+
+ if (s1 == s2)
+ return 0;
+ if (s1 == NULL)
+ return 1;
+ if (s2 == NULL)
+ return -1;
+ return strcoll (s1, s2);
+}
+
+
+/* Prepend DIRNAME to each of N members of ARRAY, replacing ARRAY's
+ elements in place. Return nonzero if out of memory, zero if successful.
+ A slash is inserted between DIRNAME and each elt of ARRAY,
+ unless DIRNAME is just "/". Each old element of ARRAY is freed. */
+static int
+prefix_array (dirname, array, n)
+ const char *dirname;
+ char **array;
+ size_t n;
+{
+ register size_t i;
+ size_t dirlen = strlen (dirname);
+#if defined __MSDOS__ || defined WINDOWS32
+ int sep_char = '/';
+# define DIRSEP_CHAR sep_char
+#else
+# define DIRSEP_CHAR '/'
+#endif
+
+ if (dirlen == 1 && dirname[0] == '/')
+ /* DIRNAME is just "/", so normal prepending would get us "//foo".
+ We want "/foo" instead, so don't prepend any chars from DIRNAME. */
+ dirlen = 0;
+#if defined __MSDOS__ || defined WINDOWS32
+ else if (dirlen > 1)
+ {
+ if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
+ /* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */
+ --dirlen;
+ else if (dirname[dirlen - 1] == ':')
+ {
+ /* DIRNAME is "d:". Use `:' instead of `/'. */
+ --dirlen;
+ sep_char = ':';
+ }
+ }
+#endif
+
+ for (i = 0; i < n; ++i)
+ {
+ size_t eltlen = strlen (array[i]) + 1;
+ char *new = (char *) malloc (dirlen + 1 + eltlen);
+ if (new == NULL)
+ {
+ while (i > 0)
+ free ((__ptr_t) array[--i]);
+ return 1;
+ }
+
+#ifdef HAVE_MEMPCPY
+ {
+ char *endp = (char *) mempcpy (new, dirname, dirlen);
+ *endp++ = DIRSEP_CHAR;
+ mempcpy (endp, array[i], eltlen);
+ }
+#else
+ memcpy (new, dirname, dirlen);
+ new[dirlen] = DIRSEP_CHAR;
+ memcpy (&new[dirlen + 1], array[i], eltlen);
+#endif
+ free ((__ptr_t) array[i]);
+ array[i] = new;
+ }
+
+ return 0;
+}
+
+
+/* We must not compile this function twice. */
+#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
+/* Return nonzero if PATTERN contains any metacharacters.
+ Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
+int
+__glob_pattern_p (pattern, quote)
+ const char *pattern;
+ int quote;
+{
+ register const char *p;
+ int open = 0;
+
+ for (p = pattern; *p != '\0'; ++p)
+ switch (*p)
+ {
+ case '?':
+ case '*':
+ return 1;
+
+ case '\\':
+ if (quote && p[1] != '\0')
+ ++p;
+ break;
+
+ case '[':
+ open = 1;
+ break;
+
+ case ']':
+ if (open)
+ return 1;
+ break;
+ }
+
+ return 0;
+}
+# ifdef _LIBC
+weak_alias (__glob_pattern_p, glob_pattern_p)
+# endif
+#endif
+
+#endif /* !GLOB_ONLY_P */
+
+
+/* We put this in a separate function mainly to allow the memory
+ allocated with alloca to be recycled. */
+#if !defined _LIBC || !defined GLOB_ONLY_P
+static int
+link_exists_p (const char *dir, size_t dirlen, const char *fname,
+ glob_t *pglob, int flags)
+{
+ size_t fnamelen = strlen (fname);
+ char *fullname = (char *) __alloca (dirlen + 1 + fnamelen + 1);
+ struct stat st;
+ struct stat64 st64;
+
+# ifdef HAVE_MEMPCPY
+ mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1),
+ fname, fnamelen + 1);
+# else
+ memcpy (fullname, dir, dirlen);
+ fullname[dirlen] = '/';
+ memcpy (&fullname[dirlen + 1], fname, fnamelen + 1);
+# endif
+
+ return (((flags & GLOB_ALTDIRFUNC)
+ ? (*pglob->gl_stat) (fullname, &st)
+ : __stat64 (fullname, &st64)) == 0);
+}
+#endif
+
+
+/* Like `glob', but PATTERN is a final pathname component,
+ and matches are searched for in DIRECTORY.
+ The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
+ The GLOB_APPEND flag is assumed to be set (always appends). */
+static int
+glob_in_dir (pattern, directory, flags, errfunc, pglob)
+ const char *pattern;
+ const char *directory;
+ int flags;
+ int (*errfunc) (const char *, int);
+ glob_t *pglob;
+{
+ size_t dirlen = strlen (directory);
+ __ptr_t stream = NULL;
+ struct globlink
+ {
+ struct globlink *next;
+ char *name;
+ };
+ struct globlink *names = NULL;
+ size_t nfound;
+ int meta;
+ int save;
+
+ meta = __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE));
+ if (meta == 0 && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
+ {
+ /* We need not do any tests. The PATTERN contains no meta
+ characters and we must not return an error therefore the
+ result will always contain exactly one name. */
+ flags |= GLOB_NOCHECK;
+ nfound = 0;
+ }
+ else if (meta == 0 &&
+ ((flags & GLOB_NOESCAPE) || strchr (pattern, '\\') == NULL))
+ {
+ /* Since we use the normal file functions we can also use stat()
+ to verify the file is there. */
+ struct stat st;
+# ifdef HAVE_STAT64
+ struct stat64 st64;
+# endif
+ size_t patlen = strlen (pattern);
+ char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1);
+
+# ifdef HAVE_MEMPCPY
+ mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
+ "/", 1),
+ pattern, patlen + 1);
+# else
+ memcpy (fullname, directory, dirlen);
+ fullname[dirlen] = '/';
+ memcpy (&fullname[dirlen + 1], pattern, patlen + 1);
+# endif
+ if (((flags & GLOB_ALTDIRFUNC)
+ ? (*pglob->gl_stat) (fullname, &st)
+ : __stat64 (fullname, &st64)) == 0)
+ /* We found this file to be existing. Now tell the rest
+ of the function to copy this name into the result. */
+ flags |= GLOB_NOCHECK;
+
+ nfound = 0;
+ }
+ else
+ {
+ if (pattern[0] == '\0')
+ {
+ /* This is a special case for matching directories like in
+ "*a/". */
+ names = (struct globlink *) __alloca (sizeof (struct globlink));
+ names->name = (char *) malloc (1);
+ if (names->name == NULL)
+ goto memory_error;
+ names->name[0] = '\0';
+ names->next = NULL;
+ nfound = 1;
+ meta = 0;
+ }
+ else
+ {
+ stream = ((flags & GLOB_ALTDIRFUNC)
+ ? (*pglob->gl_opendir) (directory)
+ : (__ptr_t) opendir (directory));
+ if (stream == NULL)
+ {
+ if (errno != ENOTDIR
+ && ((errfunc != NULL && (*errfunc) (directory, errno))
+ || (flags & GLOB_ERR)))
+ return GLOB_ABORTED;
+ nfound = 0;
+ meta = 0;
+ }
+ else
+ {
+ int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
+ | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
+#if defined _AMIGA || defined VMS
+ | FNM_CASEFOLD
+#endif
+ );
+ nfound = 0;
+ flags |= GLOB_MAGCHAR;
+
+ while (1)
+ {
+ const char *name;
+ size_t len;
+#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64
+ struct dirent64 *d;
+ union
+ {
+ struct dirent64 d64;
+ char room [offsetof (struct dirent64, d_name[0])
+ + NAME_MAX + 1];
+ }
+ d64buf;
+
+ if (flags & GLOB_ALTDIRFUNC)
+ {
+ struct dirent *d32 = (*pglob->gl_readdir) (stream);
+ if (d32 != NULL)
+ {
+ CONVERT_DIRENT_DIRENT64 (&d64buf.d64, d32);
+ d = &d64buf.d64;
+ }
+ else
+ d = NULL;
+ }
+ else
+ d = __readdir64 ((DIR *) stream);
+#else
+ struct dirent *d = ((flags & GLOB_ALTDIRFUNC)
+ ? ((struct dirent *)
+ (*pglob->gl_readdir) (stream))
+ : __readdir ((DIR *) stream));
+#endif
+ if (d == NULL)
+ break;
+ if (! REAL_DIR_ENTRY (d))
+ continue;
+
+#ifdef HAVE_D_TYPE
+ /* If we shall match only directories use the information
+ provided by the dirent call if possible. */
+ if ((flags & GLOB_ONLYDIR)
+ && d->d_type != DT_UNKNOWN
+ && d->d_type != DT_DIR
+ && d->d_type != DT_LNK)
+ continue;
+#endif
+
+ name = d->d_name;
+
+ if (fnmatch (pattern, name, fnm_flags) == 0)
+ {
+ /* If the file we found is a symlink we have to
+ make sure the target file exists. */
+ if (
+#ifdef HAVE_D_TYPE
+ (d->d_type != DT_UNKNOWN && d->d_type != DT_LNK) ||
+#endif
+ link_exists_p (directory, dirlen, name, pglob,
+ flags))
+ {
+ struct globlink *new = (struct globlink *)
+ __alloca (sizeof (struct globlink));
+ len = NAMLEN (d);
+ new->name = (char *) malloc (len + 1);
+ if (new->name == NULL)
+ goto memory_error;
+#ifdef HAVE_MEMPCPY
+ *((char *) mempcpy ((__ptr_t) new->name, name, len))
+ = '\0';
+#else
+ memcpy ((__ptr_t) new->name, name, len);
+ new->name[len] = '\0';
+#endif
+ new->next = names;
+ names = new;
+ ++nfound;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (nfound == 0 && (flags & GLOB_NOCHECK))
+ {
+ size_t len = strlen (pattern);
+ nfound = 1;
+ names = (struct globlink *) __alloca (sizeof (struct globlink));
+ names->next = NULL;
+ names->name = (char *) malloc (len + 1);
+ if (names->name == NULL)
+ goto memory_error;
+#ifdef HAVE_MEMPCPY
+ *((char *) mempcpy (names->name, pattern, len)) = '\0';
+#else
+ memcpy (names->name, pattern, len);
+ names->name[len] = '\0';
+#endif
+ }
+
+ if (nfound != 0)
+ {
+ char **new_gl_pathv;
+
+ new_gl_pathv
+ = (char **) realloc (pglob->gl_pathv,
+ (pglob->gl_pathc + pglob->gl_offs + nfound + 1)
+ * sizeof (char *));
+ if (new_gl_pathv == NULL)
+ goto memory_error;
+ pglob->gl_pathv = new_gl_pathv;
+
+ for (; names != NULL; names = names->next)
+ pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = names->name;
+ pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
+
+ pglob->gl_flags = flags;
+ }
+
+ save = errno;
+ if (stream != NULL)
+ {
+ if (flags & GLOB_ALTDIRFUNC)
+ (*pglob->gl_closedir) (stream);
+ else
+ closedir ((DIR *) stream);
+ }
+ __set_errno (save);
+
+ return nfound == 0 ? GLOB_NOMATCH : 0;
+
+ memory_error:
+ {
+ int save = errno;
+ if (flags & GLOB_ALTDIRFUNC)
+ (*pglob->gl_closedir) (stream);
+ else
+ closedir ((DIR *) stream);
+ __set_errno (save);
+ }
+ while (names != NULL)
+ {
+ if (names->name != NULL)
+ free ((__ptr_t) names->name);
+ names = names->next;
+ }
+ return GLOB_NOSPACE;
+}
+
+#endif /* Not ELIDE_CODE. */
diff --git a/sysdeps/generic/glob64.c b/sysdeps/generic/glob64.c
new file mode 100644
index 0000000000..2bfab74074
--- /dev/null
+++ b/sysdeps/generic/glob64.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1998,99,2002,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <sys/types.h>
+#include <glob.h>
+#include <errno.h>
+
+/* Do glob searching for PATTERN, placing results in PGLOB.
+ The bits defined above may be set in FLAGS.
+ If a directory cannot be opened or read and ERRFUNC is not nil,
+ it is called with the pathname that caused the error, and the
+ `errno' value from the failing call; if it returns non-zero
+ `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
+ If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
+ Otherwise, `glob' returns zero. */
+int
+glob64 (const char *pattern, int flags,
+ int (*errfunc) (const char *, int), glob64_t *pglob)
+{
+ if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return GLOB_NOSYS;
+}
+libc_hidden_def (glob64)
+
+void
+globfree64 (glob64_t *pglob)
+{
+}
+libc_hidden_def (globfree64)
+
+stub_warning (glob64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/grantpt.c b/sysdeps/generic/grantpt.c
new file mode 100644
index 0000000000..65da95b308
--- /dev/null
+++ b/sysdeps/generic/grantpt.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <errno.h>
+
+/* Given a fd on a master pseudoterminal, chown the file associated
+ with the slave to the calling process, and set its group and
+ mode appropriately. Note that this is an unprivileged operation. */
+int
+grantpt (fd)
+ int fd __attribute__ ((unused));
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (grantpt)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/group_member.c b/sysdeps/generic/group_member.c
new file mode 100644
index 0000000000..7bd9c46ba2
--- /dev/null
+++ b/sysdeps/generic/group_member.c
@@ -0,0 +1,50 @@
+/* `group_member' -- test if process is in a given group.
+ Copyright (C) 1995, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX 16 /* First guess. */
+#endif
+
+int
+__group_member (gid)
+ gid_t gid;
+{
+ int n, size;
+ gid_t *groups;
+
+ size = NGROUPS_MAX;
+ do
+ {
+ groups = __alloca (size * sizeof *groups);
+ n = __getgroups (size, groups);
+ size *= 2;
+ } while (n == size / 2);
+
+ while (n >= 0)
+ if (groups[n--] == gid)
+ return 1;
+
+ return 0;
+}
+weak_alias (__group_member, group_member)
diff --git a/sysdeps/generic/gtty.c b/sysdeps/generic/gtty.c
new file mode 100644
index 0000000000..84e7fed55e
--- /dev/null
+++ b/sysdeps/generic/gtty.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sgtty.h>
+#include <stddef.h>
+
+/* Fill in *PARAMS with terminal parameters associated with FD. */
+int
+gtty (fd, params)
+ int fd;
+ struct sgttyb *params;
+{
+ if (params == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (gtty)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/herrno-loc.c b/sysdeps/generic/herrno-loc.c
new file mode 100644
index 0000000000..fd6deeb330
--- /dev/null
+++ b/sysdeps/generic/herrno-loc.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netdb.h>
+#include <tls.h>
+
+#if ! USE___THREAD
+# undef h_errno
+extern int h_errno;
+#endif
+
+/* When threaded, h_errno may be a per-thread variable. */
+int *
+weak_const_function
+__h_errno_location (void)
+{
+ return &h_errno;
+}
+libc_hidden_def (__h_errno_location)
diff --git a/sysdeps/generic/htonl.c b/sysdeps/generic/htonl.c
new file mode 100644
index 0000000000..dfee1b0545
--- /dev/null
+++ b/sysdeps/generic/htonl.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1993,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+
+#undef htonl
+#undef ntohl
+
+uint32_t
+htonl (x)
+ uint32_t x;
+{
+#if BYTE_ORDER == BIG_ENDIAN
+ return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+ return __bswap_32 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+weak_alias (htonl, ntohl)
diff --git a/sysdeps/generic/htons.c b/sysdeps/generic/htons.c
new file mode 100644
index 0000000000..95c94de8a3
--- /dev/null
+++ b/sysdeps/generic/htons.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1993,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+
+#undef htons
+#undef ntohs
+
+uint16_t
+htons (x)
+ uint16_t x;
+{
+#if BYTE_ORDER == BIG_ENDIAN
+ return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+ return __bswap_16 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+weak_alias (htons, ntohs)
diff --git a/sysdeps/generic/if_index.c b/sysdeps/generic/if_index.c
new file mode 100644
index 0000000000..f217f37642
--- /dev/null
+++ b/sysdeps/generic/if_index.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 1997,98,99,2000,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <net/if.h>
+#include <errno.h>
+#include <stddef.h>
+
+unsigned int
+if_nametoindex (const char *ifname)
+{
+ __set_errno (ENOSYS);
+ return 0;
+}
+libc_hidden_def (if_nametoindex)
+stub_warning (if_nametoindex)
+
+char *
+if_indextoname (unsigned int ifindex, char *ifname)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+libc_hidden_def (if_indextoname)
+stub_warning (if_indextoname)
+
+void
+if_freenameindex (struct if_nameindex *ifn)
+{
+}
+stub_warning (if_freenameindex)
+
+struct if_nameindex *
+if_nameindex (void)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+stub_warning (if_nameindex)
+#include <stub-tag.h>
+
+#if 0
+void
+internal_function
+__protocol_available (int *have_inet, int *have_inet6)
+{
+ /* By default we assume that IPv4 is available, IPv6 not. */
+ *have_inet = 1;
+ *have_inet6 = 0;
+}
+#endif
diff --git a/sysdeps/generic/ifaddrs.c b/sysdeps/generic/ifaddrs.c
new file mode 100644
index 0000000000..330aae3b39
--- /dev/null
+++ b/sysdeps/generic/ifaddrs.c
@@ -0,0 +1,46 @@
+/* getifaddrs -- get names and addresses of all network interfaces
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ifaddrs.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* Create a linked list of `struct ifaddrs' structures, one for each
+ network interface on the host machine. If successful, store the
+ list in *IFAP and return 0. On errors, return -1 and set `errno'. */
+int
+getifaddrs (struct ifaddrs **ifap)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (getifaddrs)
+stub_warning (getifaddrs)
+
+void
+freeifaddrs (struct ifaddrs *ifa)
+{
+ if (ifa == NULL)
+ return; /* a la free, why not? */
+
+ /* Can't be called properly if getifaddrs never succeeded. */
+ abort ();
+}
+libc_hidden_def (freeifaddrs)
+stub_warning (freeifaddrs)
diff --git a/sysdeps/generic/ifreq.c b/sysdeps/generic/ifreq.c
new file mode 100644
index 0000000000..55e833bdb3
--- /dev/null
+++ b/sysdeps/generic/ifreq.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "ifreq.h"
+
+
+void
+__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+{
+ int fd = sockfd;
+ struct ifconf ifc;
+ int rq_len;
+ int nifs;
+# define RQ_IFS 4
+
+ if (fd < 0)
+ fd = __opensock ();
+ if (fd < 0)
+ {
+ *num_ifs = 0;
+ *ifreqs = NULL;
+ return;
+ }
+
+ ifc.ifc_buf = NULL;
+ rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop. */
+ do
+ {
+ ifc.ifc_len = rq_len *= 2;
+ void *newp = realloc (ifc.ifc_buf, ifc.ifc_len);
+ if (newp == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
+ {
+ free (ifc.ifc_buf);
+
+ if (fd != sockfd)
+ __close (fd);
+ *num_ifs = 0;
+ *ifreqs = NULL;
+ return;
+ }
+ ifc.ifc_buf = newp;
+ }
+ while (rq_len < sizeof (struct ifreq) + ifc.ifc_len);
+
+ if (fd != sockfd)
+ __close (fd);
+
+#ifdef _HAVE_SA_LEN
+ struct ifreq *ifr = *ifreqs;
+ nifs = 0;
+ while ((char *) ifr < ifc.ifc_buf + ifc.ifc_len)
+ {
+ ++nifs;
+ ifr = __if_nextreq (ifr);
+ if (ifr == NULL)
+ break;
+ }
+#else
+ nifs = ifc.ifc_len / sizeof (struct ifreq);
+#endif
+
+ *num_ifs = nifs;
+ *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq));
+}
diff --git a/sysdeps/generic/init-first.c b/sysdeps/generic/init-first.c
new file mode 100644
index 0000000000..fa21274c73
--- /dev/null
+++ b/sysdeps/generic/init-first.c
@@ -0,0 +1,59 @@
+/* Initialization code run first thing by the ELF startup code. Stub version.
+ Copyright (C) 1995, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set nonzero if we have to be prepared for more then one libc being
+ used in the process. Safe assumption if initializer never runs. */
+int __libc_multiple_libcs attribute_hidden = 1;
+
+extern void __libc_init (int, char **, char **);
+#ifdef USE_NONOPTION_FLAGS
+extern void __getopt_clean_environment (char **);
+#endif
+
+#ifdef SHARED
+void
+__libc_init_first (void)
+{
+}
+#endif
+
+#ifdef SHARED
+/* NOTE! The linker notices the magical name `_init' and sets the DT_INIT
+ pointer in the dynamic section based solely on that. It is convention
+ for this function to be in the `.init' section, but the symbol name is
+ the only thing that really matters!! */
+void _init
+#else
+void __libc_init_first
+#endif
+(int argc, char *arg0, ...)
+{
+ char **argv = &arg0, **envp = &argv[argc + 1];
+
+ __environ = envp;
+ __libc_init (argc, argv, envp);
+
+#ifdef USE_NONOPTION_FLAGS
+ /* This is a hack to make the special getopt in GNU libc working. */
+ __getopt_clean_environment (envp);
+#endif
+}
diff --git a/sysdeps/generic/init-posix.c b/sysdeps/generic/init-posix.c
new file mode 100644
index 0000000000..ae9e1075d1
--- /dev/null
+++ b/sysdeps/generic/init-posix.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef HAVE_GNU_LD
+
+void
+__init_posix (void)
+{
+ return;
+}
+
+#endif
diff --git a/sysdeps/generic/inlines.c b/sysdeps/generic/inlines.c
new file mode 100644
index 0000000000..dca305e6e4
--- /dev/null
+++ b/sysdeps/generic/inlines.c
@@ -0,0 +1,3 @@
+#define _FORCE_INLINES
+#define _EXTERN_INLINE /* empty */
+#include "gmp.h"
diff --git a/sysdeps/generic/ioctl.c b/sysdeps/generic/ioctl.c
new file mode 100644
index 0000000000..3f71452cc1
--- /dev/null
+++ b/sysdeps/generic/ioctl.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/ioctl.h>
+
+/* Perform the I/O control operation specified by REQUEST on FD.
+ The actual type and use of ARG and the return value depend on REQUEST. */
+int
+__ioctl (fd, request)
+ int fd;
+ unsigned long int request;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (ioctl)
+
+weak_alias (__ioctl, ioctl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/isastream.c b/sysdeps/generic/isastream.c
new file mode 100644
index 0000000000..88dae299fc
--- /dev/null
+++ b/sysdeps/generic/isastream.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stropts.h>
+
+int
+isastream (fildes)
+ int fildes;
+{
+ /* In general we do not have a STREAMS implementation and therefore
+ return 0. But for invalid file descriptors we have to return an
+ error. */
+ if (__fcntl (fildes, F_GETFD) < 0)
+ return -1;
+
+ /* No STREAM. */
+ return 0;
+}
diff --git a/sysdeps/generic/isatty.c b/sysdeps/generic/isatty.c
new file mode 100644
index 0000000000..9b0410c614
--- /dev/null
+++ b/sysdeps/generic/isatty.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return 1 if FD is a terminal, 0 if not. */
+int
+__isatty (fd)
+ int fd;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__isatty, isatty)
+
+stub_warning (isatty)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/isfdtype.c b/sysdeps/generic/isfdtype.c
new file mode 100644
index 0000000000..ba10912c9f
--- /dev/null
+++ b/sysdeps/generic/isfdtype.c
@@ -0,0 +1,31 @@
+/* isfdtype - Determine whether descriptor has given property. Stub version.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/stat.h>
+
+
+int
+isfdtype (int fildes, int fdtype)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (isfdtype)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/jmp-unwind.c b/sysdeps/generic/jmp-unwind.c
new file mode 100644
index 0000000000..d2f76c62e7
--- /dev/null
+++ b/sysdeps/generic/jmp-unwind.c
@@ -0,0 +1,29 @@
+/* _longjmp_unwind -- Clean up stack frames unwound by longjmp. Stub version.
+ Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <setjmp.h>
+
+void
+_longjmp_unwind (jmp_buf env, int val)
+{
+
+ /* This function can perform any cleanups necessary to safely unwind the
+ stack frames around the current context which ENV unwinds past. */
+
+}
diff --git a/sysdeps/generic/k_cosl.c b/sysdeps/generic/k_cosl.c
new file mode 100644
index 0000000000..29b83d6273
--- /dev/null
+++ b/sysdeps/generic/k_cosl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__kernel_cosl (long double x, long double y)
+{
+ fputs ("__kernel_cosl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_cosl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/k_rem_pio2l.c b/sysdeps/generic/k_rem_pio2l.c
new file mode 100644
index 0000000000..236eb30dd9
--- /dev/null
+++ b/sysdeps/generic/k_rem_pio2l.c
@@ -0,0 +1,16 @@
+#include <math.h>
+#include <math_private.h>
+#include <stdio.h>
+#include <errno.h>
+
+int
+__kernel_rem_pio2l (long double *x, long double *y, int e0, int nx, int prec,
+ const int *ipio2)
+{
+ fputs ("__kernel_rem_pio2l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_rem_pio2l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/k_sincosl.c b/sysdeps/generic/k_sincosl.c
new file mode 100644
index 0000000000..aa038c26c4
--- /dev/null
+++ b/sysdeps/generic/k_sincosl.c
@@ -0,0 +1 @@
+/* Empty. Not needed. */
diff --git a/sysdeps/generic/k_sinl.c b/sysdeps/generic/k_sinl.c
new file mode 100644
index 0000000000..ea1d71f61b
--- /dev/null
+++ b/sysdeps/generic/k_sinl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__kernel_sinl (long double x, long double y, int iy)
+{
+ fputs ("__kernel_sinl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_sinl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/k_tanl.c b/sysdeps/generic/k_tanl.c
new file mode 100644
index 0000000000..9993c6b998
--- /dev/null
+++ b/sysdeps/generic/k_tanl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include "math_private.h"
+
+long double
+__kernel_tanl (long double x, long double y, int iy)
+{
+ fputs ("__kernel_tanl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+stub_warning (__kernel_tanl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/kill.c b/sysdeps/generic/kill.c
new file mode 100644
index 0000000000..1d81e45dde
--- /dev/null
+++ b/sysdeps/generic/kill.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Send signal SIG to process number PID. If PID is zero,
+ send SIG to all processes in the current process's process group.
+ If PID is < -1, send SIG to all processes in process group - PID. */
+int
+__kill (pid, sig)
+ int pid;
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (kill)
+
+weak_alias (__kill, kill)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/killpg.c b/sysdeps/generic/killpg.c
new file mode 100644
index 0000000000..ad9258dffc
--- /dev/null
+++ b/sysdeps/generic/killpg.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Send SIG to all processes in process group PGRP.
+ If PGRP is zero, send SIG to all processes in
+ the current process's process group. */
+int
+killpg (pgrp, sig)
+ __pid_t pgrp;
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (killpg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/labs.c b/sysdeps/generic/labs.c
new file mode 100644
index 0000000000..c568e44454
--- /dev/null
+++ b/sysdeps/generic/labs.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+
+#undef labs
+
+
+/* Return the absolute value of I. */
+long int
+labs (long int i)
+{
+ return i < 0 ? -i : i;
+}
diff --git a/sysdeps/generic/lchmod.c b/sysdeps/generic/lchmod.c
new file mode 100644
index 0000000000..524b24c1ed
--- /dev/null
+++ b/sysdeps/generic/lchmod.c
@@ -0,0 +1,33 @@
+/* lchmod -- Change the protections of a file or symbolic link. Stub version.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* Change the protections of FILE to MODE. */
+int
+lchmod (const char *file, mode_t mode)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lchmod)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lchown.c b/sysdeps/generic/lchown.c
new file mode 100644
index 0000000000..4e0330e526
--- /dev/null
+++ b/sysdeps/generic/lchown.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Change the owner and group of FILE. */
+int
+__lchown (file, owner, group)
+ const char *file;
+ uid_t owner;
+ gid_t group;
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (lchown)
+
+weak_alias (__lchown, lchown)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ldbl2mpn.c b/sysdeps/generic/ldbl2mpn.c
new file mode 100644
index 0000000000..450f9381cc
--- /dev/null
+++ b/sysdeps/generic/ldbl2mpn.c
@@ -0,0 +1 @@
+/* Empty. Not needed unless ldbl support is in. */
diff --git a/sysdeps/generic/ldiv.c b/sysdeps/generic/ldiv.c
new file mode 100644
index 0000000000..a7796d8e95
--- /dev/null
+++ b/sysdeps/generic/ldiv.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+
+
+/* Return the `ldiv_t' representation of NUMER over DENOM. */
+ldiv_t
+ldiv (long int numer, long int denom)
+{
+ ldiv_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ /* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
+ NUMER / DENOM is to be computed in infinite precision. In
+ other words, we should always truncate the quotient towards
+ zero, never -infinity. Machine division and remainer may
+ work either way when one or both of NUMER or DENOM is
+ negative. If only one is negative and QUOT has been
+ truncated towards -infinity, REM will have the same sign as
+ DENOM and the opposite sign of NUMER; if both are negative
+ and QUOT has been truncated towards -infinity, REM will be
+ positive (will have the opposite sign of NUMER). These are
+ considered `wrong'. If both are NUM and DENOM are positive,
+ RESULT will always be positive. This all boils down to: if
+ NUMER >= 0, but REM < 0, we got the wrong answer. In that
+ case, to get the right answer, add 1 to QUOT and subtract
+ DENOM from REM. */
+
+ if (numer >= 0 && result.rem < 0)
+ {
+ ++result.quot;
+ result.rem -= denom;
+ }
+
+ return result;
+}
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index eee6141c6a..ec68e1a565 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
- Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -52,17 +52,25 @@ __BEGIN_DECLS
most architectures the entry is already relocated - but for some not
and we need to relocate at access time. */
#ifdef DL_RO_DYN_SECTION
-# define D_PTR(map, i) ((map)->i->d_un.d_ptr + (map)->l_addr)
+# define D_PTR(map,i) (map->i->d_un.d_ptr + map->l_addr)
#else
-# define D_PTR(map, i) (map)->i->d_un.d_ptr
+# define D_PTR(map,i) map->i->d_un.d_ptr
#endif
-/* Result of the lookup functions and how to retrieve the base address. */
+/* On some platforms more information than just the address of the symbol
+ is needed from the lookup functions. In this case we return the whole
+ link map. */
+#ifdef DL_LOOKUP_RETURNS_MAP
typedef struct link_map *lookup_t;
-#define LOOKUP_VALUE(map) map
-#define LOOKUP_VALUE_ADDRESS(map) ((map) ? (map)->l_addr : 0)
+# define LOOKUP_VALUE(map) map
+# define LOOKUP_VALUE_ADDRESS(map) (map ? map->l_addr : 0)
+#else
+typedef ElfW(Addr) lookup_t;
+# define LOOKUP_VALUE(map) map->l_addr
+# define LOOKUP_VALUE_ADDRESS(address) address
+#endif
-/* On some architectures a pointer to a function is not just a pointer
+/* on some architectures a pointer to a function is not just a pointer
to the actual code of the function but rather an architecture
specific descriptor. */
#ifndef ELF_FUNCTION_PTR_IS_SPECIAL
@@ -73,14 +81,6 @@ typedef struct link_map *lookup_t;
# define DL_DT_FINI_ADDRESS(map, start) (start)
#endif
-/* On some architectures dladdr can't use st_size of all symbols this way. */
-#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
- ((ADDR) >= (L)->l_addr + (SYM)->st_value \
- && ((((SYM)->st_shndx == SHN_UNDEF || (SYM)->st_size == 0) \
- && (ADDR) == (L)->l_addr + (SYM)->st_value) \
- || (ADDR) < (L)->l_addr + (SYM)->st_value + (SYM)->st_size) \
- && ((MATCHSYM) == NULL || (MATCHSYM)->st_value < (SYM)->st_value))
-
/* Unmap a loaded object, called by _dl_close (). */
#ifndef DL_UNMAP_IS_SPECIAL
# define DL_UNMAP(map) \
@@ -182,156 +182,8 @@ enum allowmask
};
-/* Type for list of auditing interfaces. */
-struct La_i86_regs;
-struct La_i86_retval;
-struct La_x86_64_regs;
-struct La_x86_64_retval;
-struct La_ppc32_regs;
-struct La_ppc32_retval;
-struct La_ppc64_regs;
-struct La_ppc64_retval;
-struct La_sh_regs;
-struct La_sh_retval;
-struct La_alpha_regs;
-struct La_alpha_retval;
-struct La_s390_32_regs;
-struct La_s390_32_retval;
-struct La_s390_64_regs;
-struct La_s390_64_retval;
-struct La_ia64_regs;
-struct La_ia64_retval;
-struct La_sparc32_regs;
-struct La_sparc32_retval;
-struct La_sparc64_regs;
-struct La_sparc64_retval;
-
-struct audit_ifaces
-{
- void (*activity) (uintptr_t *, unsigned int);
- char *(*objsearch) (const char *, uintptr_t *, unsigned int);
- unsigned int (*objopen) (struct link_map *, Lmid_t, uintptr_t *);
- void (*preinit) (uintptr_t *);
- union
- {
- uintptr_t (*symbind32) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, unsigned int *, const char *);
- uintptr_t (*symbind64) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, unsigned int *, const char *);
- };
- union
- {
- Elf32_Addr (*i86_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_i86_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf64_Addr (*x86_64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_x86_64_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf32_Addr (*ppc32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_ppc32_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf64_Addr (*ppc64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_ppc64_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- uintptr_t (*sh_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, const struct La_sh_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf64_Addr (*alpha_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_alpha_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf32_Addr (*s390_32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_s390_32_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf64_Addr (*s390_64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_s390_64_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf64_Addr (*ia64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, struct La_ia64_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf32_Addr (*sparc32_gnu_pltenter) (Elf32_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_sparc32_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
- Elf64_Addr (*sparc64_gnu_pltenter) (Elf64_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_sparc64_regs *,
- unsigned int *, const char *name,
- long int *framesizep);
-#ifdef ARCH_PLTENTER_MEMBERS
- ARCH_PLTENTER_MEMBERS;
-#endif
- };
- union
- {
- unsigned int (*i86_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, const struct La_i86_regs *,
- struct La_i86_retval *, const char *);
- unsigned int (*x86_64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *,
- const struct La_x86_64_regs *,
- struct La_x86_64_retval *,
- const char *);
- unsigned int (*ppc32_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *,
- const struct La_ppc32_regs *,
- struct La_ppc32_retval *, const char *);
- unsigned int (*ppc64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *,
- const struct La_ppc64_regs *,
- struct La_ppc64_retval *, const char *);
- unsigned int (*sh_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
- uintptr_t *, const struct La_sh_regs *,
- struct La_sh_retval *, const char *);
- unsigned int (*alpha_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *,
- const struct La_alpha_regs *,
- struct La_alpha_retval *, const char *);
- unsigned int (*s390_32_gnu_pltexit) (Elf32_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_s390_32_regs *,
- struct La_s390_32_retval *,
- const char *);
- unsigned int (*s390_64_gnu_pltexit) (Elf64_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_s390_64_regs *,
- struct La_s390_64_retval *,
- const char *);
- unsigned int (*ia64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
- uintptr_t *,
- const struct La_ia64_regs *,
- struct La_ia64_retval *, const char *);
- unsigned int (*sparc32_gnu_pltexit) (Elf32_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_sparc32_regs *,
- struct La_sparc32_retval *,
- const char *);
- unsigned int (*sparc64_gnu_pltexit) (Elf64_Sym *, unsigned int,
- uintptr_t *, uintptr_t *,
- const struct La_sparc32_regs *,
- struct La_sparc32_retval *,
- const char *);
-#ifdef ARCH_PLTEXIT_MEMBERS
- ARCH_PLTEXIT_MEMBERS;
-#endif
- };
- unsigned int (*objclose) (uintptr_t *);
-
- struct audit_ifaces *next;
-};
-
-
/* Test whether given NAME matches any of the names of the given object. */
-extern int _dl_name_match_p (const char *__name, const struct link_map *__map)
+extern int _dl_name_match_p (const char *__name, struct link_map *__map)
internal_function;
/* Function used as argument for `_dl_receive_error' function. The
@@ -372,18 +224,18 @@ struct rtld_global
#endif
EXTERN struct link_namespaces
{
- /* A pointer to the map for the main map. */
+ /* And a pointer to the map for the main map. */
struct link_map *_ns_loaded;
/* Number of object in the _dl_loaded list. */
unsigned int _ns_nloaded;
+ /* Array representing global scope. */
+ struct r_scope_elem *_ns_global_scope[2];
/* Direct pointer to the searchlist of the main object. */
struct r_scope_elem *_ns_main_searchlist;
/* This is zero at program start to signal that the global scope map is
allocated by rtld. Later it keeps the size of the map. It might be
reset if in _dl_close if the last global object is removed. */
size_t _ns_global_scope_alloc;
- /* Keep track of changes to each namespace' list. */
- struct r_debug _ns_debug;
} _dl_ns[DL_NNS];
/* During the program run we must not modify the global data of
@@ -425,12 +277,8 @@ struct rtld_global
EXTERN void **(*_dl_error_catch_tsd) (void) __attribute__ ((const));
#endif
- /* Structure describing the dynamic linker itself. We need to
- reserve memory for the data the audit libraries need. */
+ /* Structure describing the dynamic linker itself. */
EXTERN struct link_map _dl_rtld_map;
-#ifdef SHARED
- struct auditstate audit_data[DL_NNS];
-#endif
#if defined SHARED && defined _LIBC_REENTRANT \
&& defined __rtld_lock_default_lock_recursive
@@ -438,23 +286,23 @@ struct rtld_global
EXTERN void (*_dl_rtld_unlock_recursive) (void *);
#endif
+ /* Prevailing state of the stack, PF_X indicating it's executable. */
+ EXTERN ElfW(Word) _dl_stack_flags;
+
/* If loading a shared object requires that we make the stack executable
when it was not, we do it by calling this function.
It returns an errno code or zero on success. */
EXTERN int (*_dl_make_stack_executable_hook) (void **) internal_function;
- /* Prevailing state of the stack, PF_X indicating it's executable. */
- EXTERN ElfW(Word) _dl_stack_flags;
-
/* Keep the conditional TLS members at the end so the layout of the
structure used by !USE_TLS code matches the prefix of the layout in
the USE_TLS rtld. Note that `struct link_map' is conditionally
defined as well, so _dl_rtld_map needs to be last before this. */
#ifdef USE_TLS
- /* Flag signalling whether there are gaps in the module ID allocation. */
- EXTERN bool _dl_tls_dtv_gaps;
/* Highest dtv index currently needed. */
EXTERN size_t _dl_tls_max_dtv_idx;
+ /* Flag signalling whether there are gaps in the module ID allocation. */
+ EXTERN bool _dl_tls_dtv_gaps;
/* Information about the dtv slots. */
EXTERN struct dtv_slotinfo_list
{
@@ -491,14 +339,6 @@ struct rtld_global
EXTERN void (*_dl_init_static_tls) (struct link_map *);
#endif
- EXTERN void (*_dl_wait_lookup_done) (void);
-
- /* Scopes to free after next THREAD_GSCOPE_WAIT (). */
- EXTERN struct dl_scope_free_list
- {
- size_t count;
- struct r_scope_elem **list[50];
- } *_dl_scope_free_list;
#ifdef SHARED
};
# define __rtld_global_attribute__
@@ -549,15 +389,15 @@ struct rtld_global_ro
#define DL_DEBUG_HELP (1 << 9)
#define DL_DEBUG_PRELINK (1 << 10)
+ /* Cached value of `getpagesize ()'. */
+ EXTERN size_t _dl_pagesize;
+
/* OS version. */
EXTERN unsigned int _dl_osversion;
/* Platform name. */
EXTERN const char *_dl_platform;
EXTERN size_t _dl_platformlen;
- /* Cached value of `getpagesize ()'. */
- EXTERN size_t _dl_pagesize;
-
/* Copy of the content of `_dl_main_searchlist' at startup time. */
EXTERN struct r_scope_elem _dl_initial_searchlist;
@@ -587,10 +427,10 @@ struct rtld_global_ro
EXTERN int _dl_correct_cache_id;
/* Mask for hardware capabilities that are available. */
- EXTERN uint64_t _dl_hwcap;
+ EXTERN unsigned long int _dl_hwcap;
/* Mask for important hardware capabilities we honour. */
- EXTERN uint64_t _dl_hwcap_mask;
+ EXTERN unsigned long int _dl_hwcap_mask;
/* Get architecture specific definitions. */
#define PROCINFO_DECL
@@ -636,10 +476,6 @@ struct rtld_global_ro
/* The vsyscall page is a virtual DSO pre-mapped by the kernel.
This points to its ELF header. */
EXTERN const ElfW(Ehdr) *_dl_sysinfo_dso;
-
- /* At startup time we set up the normal DSO data structure for it,
- and this points to it. */
- EXTERN struct link_map *_dl_sysinfo_map;
#endif
#ifdef SHARED
@@ -647,12 +483,32 @@ struct rtld_global_ro
call the function instead of going through the PLT. The result
is that we can avoid exporting the functions and we do not jump
PLT relocations in libc.so. */
+ const char *(*_dl_get_origin) (void);
+ size_t (*_dl_dst_count) (const char *, int);
+ char *(*_dl_dst_substitute) (struct link_map *, const char *, char *, int);
+ struct link_map *(internal_function *_dl_map_object) (struct link_map *,
+ const char *, int,
+ int, int, int, Lmid_t);
+ void (internal_function *_dl_map_object_deps) (struct link_map *,
+ struct link_map **,
+ unsigned int, int, int);
+ void (*_dl_relocate_object) (struct link_map *, struct r_scope_elem *[],
+ int, int);
+ int (internal_function *_dl_check_map_versions) (struct link_map *, int,
+ int);
+ void (internal_function *_dl_init) (struct link_map *, int, char **,
+ char **);
+ void (*_dl_debug_state) (void);
+#ifndef MAP_COPY
+ void (*_dl_unload_cache) (void);
+#endif
void (*_dl_debug_printf) (const char *, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
int (internal_function *_dl_catch_error) (const char **, const char **,
- bool *, void (*) (void *), void *);
+ void (*) (void *), void *);
void (internal_function *_dl_signal_error) (int, const char *, const char *,
const char *);
+ void (internal_function *_dl_start_profile) (void);
void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc);
lookup_t (internal_function *_dl_lookup_symbol_x) (const char *,
struct link_map *,
@@ -662,16 +518,7 @@ struct rtld_global_ro
int, int,
struct link_map *);
int (*_dl_check_caller) (const void *, enum allowmask);
- void *(*_dl_open) (const char *file, int mode, const void *caller_dlopen,
- Lmid_t nsid, int argc, char *argv[], char *env[]);
- void (*_dl_close) (void *map);
-
- /* List of auditing interfaces. */
- struct audit_ifaces *_dl_audit;
- unsigned int _dl_naudit;
- /* 0 if internal pointer values should not be guarded, 1 if they should. */
- EXTERN int _dl_pointer_guard;
};
# define __rtld_global_attribute__
# ifdef IS_IN_rtld
@@ -733,6 +580,13 @@ extern char **_dl_argv_internal attribute_hidden
# define rtld_progname _dl_argv[0]
#endif
+/* The array with message we print as a last resort. */
+extern const char _dl_out_of_memory[];
+#ifdef IS_IN_rtld
+/* XXX #ifdef should go away. */
+extern const char _dl_out_of_memory_internal[] attribute_hidden;
+#endif
+
/* Flag set at startup and cleared when the last initializer has run. */
extern int _dl_starting_up;
weak_extern (_dl_starting_up)
@@ -929,11 +783,6 @@ extern void _dl_init (struct link_map *main_map, int argc, char **argv,
initializer functions have completed. */
extern void _dl_fini (void) internal_function;
-/* Sort array MAPS according to dependencies of the contained objects. */
-extern void _dl_sort_fini (struct link_map *l, struct link_map **maps,
- size_t nmaps, char *used, Lmid_t ns)
- internal_function;
-
/* The dynamic linker calls this function before and having changing
any shared object mappings. The `r_state' member of `struct r_debug'
says what change is taking place. This function's address is
@@ -944,7 +793,7 @@ rtld_hidden_proto (_dl_debug_state)
/* Initialize `struct r_debug' if it has not already been done. The
argument is the run-time load address of the dynamic linker, to be put
in the `r_ldbase' member. Returns the address of the structure. */
-extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
+extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase)
internal_function;
/* Initialize the basic data structure for the search paths. */
@@ -1062,32 +911,6 @@ extern char *_dl_dst_substitute (struct link_map *l, const char *name,
extern int _dl_check_caller (const void *caller, enum allowmask mask)
attribute_hidden;
-/* Open the shared object NAME, relocate it, and run its initializer if it
- hasn't already been run. MODE is as for `dlopen' (see <dlfcn.h>). If
- the object is already opened, returns its existing map. */
-extern void *_dl_open (const char *name, int mode, const void *caller,
- Lmid_t nsid, int argc, char *argv[], char *env[])
- attribute_hidden;
-
-/* Free or queue for freeing scope OLD. If other threads might be
- in the middle of _dl_fixup, _dl_profile_fixup or dl*sym using the
- old scope, OLD can't be freed until no thread is using it. */
-extern int _dl_scope_free (struct r_scope_elem **old) attribute_hidden;
-
-/* Add module to slot information data. */
-extern void _dl_add_to_slotinfo (struct link_map *l) attribute_hidden;
-
-/* Update slot information data for at least the generation of the
- module with the given index. */
-extern struct link_map *_dl_update_slotinfo (unsigned long int req_modid);
-
-/* Look up the module's TLS block as for __tls_get_addr,
- but never touch anything. Return null if it's not allocated yet. */
-extern void *_dl_tls_get_addr_soft (struct link_map *l) internal_function;
-
-extern int _dl_addr_inside_object (struct link_map *l, const ElfW(Addr) addr)
- internal_function attribute_hidden;
-
__END_DECLS
#endif /* ldsodefs.h */
diff --git a/sysdeps/generic/lgetxattr.c b/sysdeps/generic/lgetxattr.c
new file mode 100644
index 0000000000..6adf1fdf04
--- /dev/null
+++ b/sysdeps/generic/lgetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+lgetxattr (const char *__path, const char *__name,
+ void *__value, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lgetxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
new file mode 100644
index 0000000000..fc9df40996
--- /dev/null
+++ b/sysdeps/generic/libc-start.c
@@ -0,0 +1,241 @@
+/* Copyright (C) 1998-2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <bp-start.h>
+#include <bp-sym.h>
+
+extern void __libc_init_first (int argc, char **argv, char **envp);
+
+extern int __libc_multiple_libcs;
+
+#include <tls.h>
+#ifndef SHARED
+# include <dl-osinfo.h>
+extern void __pthread_initialize_minimal (void)
+# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
+ __attribute__ ((weak))
+# endif
+ ;
+#endif
+
+#ifdef HAVE_PTR_NTHREADS
+/* We need atomic operations. */
+# include <atomic.h>
+#endif
+
+
+#ifdef LIBC_START_MAIN
+# ifdef LIBC_START_DISABLE_INLINE
+# define STATIC static
+# else
+# define STATIC static inline __attribute__ ((always_inline))
+# endif
+#else
+# define STATIC
+# define LIBC_START_MAIN BP_SYM (__libc_start_main)
+#endif
+
+#ifdef MAIN_AUXVEC_ARG
+/* main gets passed a pointer to the auxiliary. */
+# define MAIN_AUXVEC_DECL , void *
+# define MAIN_AUXVEC_PARAM , auxvec
+#else
+# define MAIN_AUXVEC_DECL
+# define MAIN_AUXVEC_PARAM
+#endif
+
+STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
+ MAIN_AUXVEC_DECL),
+ int argc,
+ char *__unbounded *__unbounded ubp_av,
+#ifdef LIBC_START_MAIN_AUXVEC_ARG
+ ElfW(auxv_t) *__unbounded auxvec,
+#endif
+#ifdef INIT_MAIN_ARGS
+ __typeof (main) init,
+#else
+ void (*init) (void),
+#endif
+ void (*fini) (void),
+ void (*rtld_fini) (void),
+ void *__unbounded stack_end)
+ __attribute__ ((noreturn));
+
+STATIC int
+LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
+ int argc, char *__unbounded *__unbounded ubp_av,
+#ifdef LIBC_START_MAIN_AUXVEC_ARG
+ ElfW(auxv_t) *__unbounded auxvec,
+#endif
+#ifdef INIT_MAIN_ARGS
+ __typeof (main) init,
+#else
+ void (*init) (void),
+#endif
+ void (*fini) (void),
+ void (*rtld_fini) (void), void *__unbounded stack_end)
+{
+ char *__unbounded *__unbounded ubp_ev = &ubp_av[argc + 1];
+#if __BOUNDED_POINTERS__
+ char **argv;
+#else
+# define argv ubp_av
+#endif
+
+ /* Result of the 'main' function. */
+ int result;
+
+ __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
+
+ INIT_ARGV_and_ENVIRON;
+
+#ifndef SHARED
+ /* Store the lowest stack address. This is done in ld.so if this is
+ the code for the DSO. */
+ __libc_stack_end = stack_end;
+
+# ifdef HAVE_AUX_VECTOR
+ /* First process the auxiliary vector since we need to find the
+ program header to locate an eventually present PT_TLS entry. */
+# ifndef LIBC_START_MAIN_AUXVEC_ARG
+ ElfW(auxv_t) *__unbounded auxvec;
+ {
+ char *__unbounded *__unbounded evp = ubp_ev;
+ while (*evp++ != NULL)
+ ;
+ auxvec = (ElfW(auxv_t) *__unbounded) evp;
+ }
+# endif
+ _dl_aux_init (auxvec);
+# endif
+# ifdef DL_SYSDEP_OSCHECK
+ if (!__libc_multiple_libcs)
+ {
+ /* This needs to run to initiliaze _dl_osversion before TLS
+ setup might check it. */
+ DL_SYSDEP_OSCHECK (__libc_fatal);
+ }
+# endif
+
+ /* Initialize the thread library at least a bit since the libgcc
+ functions are using thread functions if these are available and
+ we need to setup errno. If there is no thread library and we
+ handle TLS the function is defined in the libc to initialized the
+ TLS handling. */
+# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
+ if (__pthread_initialize_minimal)
+# endif
+ __pthread_initialize_minimal ();
+#endif
+
+ /* Register the destructor of the dynamic linker if there is any. */
+ if (__builtin_expect (rtld_fini != NULL, 1))
+ __cxa_atexit ((void (*) (void *)) rtld_fini, NULL, NULL);
+
+ /* Call the initializer of the libc. This is only needed here if we
+ are compiling for the static library in which case we haven't
+ run the constructors in `_dl_start_user'. */
+#ifndef SHARED
+ __libc_init_first (argc, argv, __environ);
+#endif
+
+ /* Register the destructor of the program, if any. */
+ if (fini)
+ __cxa_atexit ((void (*) (void *)) fini, NULL, NULL);
+
+#ifndef SHARED
+ /* Some security at this point. Prevent starting a SUID binary where
+ the standard file descriptors are not opened. We have to do this
+ only for statically linked applications since otherwise the dynamic
+ loader did the work already. */
+ if (__builtin_expect (__libc_enable_secure, 0))
+ __libc_check_standard_fds ();
+#endif
+
+ /* Call the initializer of the program, if any. */
+#ifdef SHARED
+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+ GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
+#endif
+ if (init)
+ (*init) (
+#ifdef INIT_MAIN_ARGS
+ argc, argv, __environ MAIN_AUXVEC_PARAM
+#endif
+ );
+
+#ifdef SHARED
+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+ GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
+#endif
+
+#ifdef HAVE_CLEANUP_JMP_BUF
+ /* Memory for the cancellation buffer. */
+ struct pthread_unwind_buf unwind_buf;
+
+ int not_first_call;
+ not_first_call = setjmp ((struct __jmp_buf_tag *) unwind_buf.cancel_jmp_buf);
+ if (__builtin_expect (! not_first_call, 1))
+ {
+ struct pthread *self = THREAD_SELF;
+
+ /* Store old info. */
+ unwind_buf.priv.data.prev = THREAD_GETMEM (self, cleanup_jmp_buf);
+ unwind_buf.priv.data.cleanup = THREAD_GETMEM (self, cleanup);
+
+ /* Store the new cleanup handler info. */
+ THREAD_SETMEM (self, cleanup_jmp_buf, &unwind_buf);
+
+ /* Run the program. */
+ result = main (argc, argv, __environ MAIN_AUXVEC_PARAM);
+ }
+ else
+ {
+ /* Remove the thread-local data. */
+# ifdef SHARED
+ __libc_pthread_functions.ptr__nptl_deallocate_tsd ();
+# else
+ extern void __nptl_deallocate_tsd (void) __attribute ((weak));
+ __nptl_deallocate_tsd ();
+# endif
+
+ /* One less thread. Decrement the counter. If it is zero we
+ terminate the entire process. */
+ result = 0;
+# ifdef SHARED
+ int *const ptr = __libc_pthread_functions.ptr_nthreads;
+# else
+ extern int __nptl_nthreads __attribute ((weak));
+ int *const ptr = &__nptl_nthreads;
+# endif
+
+ if (! atomic_decrement_and_test (ptr))
+ /* Not much left to do but to exit the thread, not the process. */
+ __exit_thread (0);
+ }
+#else
+ /* Nothing fancy, just call the function. */
+ result = main (argc, argv, __environ MAIN_AUXVEC_PARAM);
+#endif
+
+ exit (result);
+}
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
new file mode 100644
index 0000000000..b5ecc36436
--- /dev/null
+++ b/sysdeps/generic/libc-tls.c
@@ -0,0 +1,273 @@
+/* Initialization code for TLS in statically linked application.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <ldsodefs.h>
+#include <tls.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/param.h>
+
+
+#ifdef SHARED
+ #error makefile bug, this file is for static only
+#endif
+
+#ifdef USE_TLS
+extern ElfW(Phdr) *_dl_phdr;
+extern size_t _dl_phnum;
+
+
+/* DTV with just one element plus overhead. */
+static dtv_t static_dtv[3];
+
+
+static struct
+{
+ struct dtv_slotinfo_list si;
+ /* The dtv_slotinfo_list data structure does not include the actual
+ information since it is defined as an array of size zero. We define
+ here the necessary entries. Note that it is not important whether
+ there is padding or not since we will always access the information
+ through the 'si' element. */
+ struct dtv_slotinfo info[2 + TLS_SLOTINFO_SURPLUS];
+} static_slotinfo;
+
+/* Fake link map for the application. */
+static struct link_map static_map;
+
+
+/* Highest dtv index currently needed. */
+size_t _dl_tls_max_dtv_idx;
+/* Flag signalling whether there are gaps in the module ID allocation. */
+bool _dl_tls_dtv_gaps;
+/* Information about the dtv slots. */
+struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list;
+/* Number of modules in the static TLS block. */
+size_t _dl_tls_static_nelem;
+/* Size of the static TLS block. */
+size_t _dl_tls_static_size;
+/* Size actually allocated in the static TLS block. */
+size_t _dl_tls_static_used;
+/* Alignment requirement of the static TLS block. */
+size_t _dl_tls_static_align;
+
+/* Generation counter for the dtv. */
+size_t _dl_tls_generation;
+
+
+/* Additional definitions needed by TLS initialization. */
+#ifdef TLS_INIT_HELPER
+TLS_INIT_HELPER
+#endif
+
+static inline void
+init_slotinfo (void)
+{
+ /* Create the slotinfo list. */
+ static_slotinfo.si.len = (((char *) (&static_slotinfo + 1)
+ - (char *) &static_slotinfo.si.slotinfo[0])
+ / sizeof static_slotinfo.si.slotinfo[0]);
+ // static_slotinfo.si.next = NULL; already zero
+
+ /* The slotinfo list. Will be extended by the code doing dynamic
+ linking. */
+ GL(dl_tls_max_dtv_idx) = 1;
+ GL(dl_tls_dtv_slotinfo_list) = &static_slotinfo.si;
+}
+
+static inline void
+init_static_tls (size_t memsz, size_t align)
+{
+ /* That is the size of the TLS memory for this object. The initialized
+ value of _dl_tls_static_size is provided by dl-open.c to request some
+ surplus that permits dynamic loading of modules with IE-model TLS. */
+ GL(dl_tls_static_size) = roundup (memsz + GL(dl_tls_static_size),
+ TLS_TCB_ALIGN);
+ GL(dl_tls_static_used) = memsz;
+ /* The alignment requirement for the static TLS block. */
+ GL(dl_tls_static_align) = align;
+ /* Number of elements in the static TLS block. */
+ GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx);
+}
+
+void
+__libc_setup_tls (size_t tcbsize, size_t tcbalign)
+{
+ void *tlsblock;
+ size_t memsz = 0;
+ size_t filesz = 0;
+ void *initimage = NULL;
+ size_t align = 0;
+ size_t max_align = tcbalign;
+ size_t tcb_offset;
+ ElfW(Phdr) *phdr;
+
+ /* Look through the TLS segment if there is any. */
+ if (_dl_phdr != NULL)
+ for (phdr = _dl_phdr; phdr < &_dl_phdr[_dl_phnum]; ++phdr)
+ if (phdr->p_type == PT_TLS)
+ {
+ /* Remember the values we need. */
+ memsz = phdr->p_memsz;
+ filesz = phdr->p_filesz;
+ initimage = (void *) phdr->p_vaddr;
+ align = phdr->p_align;
+ if (phdr->p_align > max_align)
+ max_align = phdr->p_align;
+ break;
+ }
+
+#ifdef TLS_INIT_TP_EXPENSIVE
+ if (memsz == 0 && tcbsize <= TLS_INIT_TCB_SIZE)
+ {
+ /* We do not need a TLS block and no thread descriptor. */
+# ifdef NONTLS_INIT_TP
+ NONTLS_INIT_TP;
+# endif
+ return;
+ }
+#endif
+
+ /* We have to set up the TCB block which also (possibly) contains
+ 'errno'. Therefore we avoid 'malloc' which might touch 'errno'.
+ Instead we use 'sbrk' which would only uses 'errno' if it fails.
+ In this case we are right away out of memory and the user gets
+ what she/he deserves.
+
+ The initialized value of _dl_tls_static_size is provided by dl-open.c
+ to request some surplus that permits dynamic loading of modules with
+ IE-model TLS. */
+# if TLS_TCB_AT_TP
+ tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
+ tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
+# elif TLS_DTV_AT_TP
+ tcb_offset = roundup (tcbsize, align ?: 1);
+ tlsblock = __sbrk (tcb_offset + memsz + max_align
+ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
+ tlsblock += TLS_PRE_TCB_SIZE;
+# else
+ /* In case a model with a different layout for the TCB and DTV
+ is defined add another #elif here and in the following #ifs. */
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+
+ /* Align the TLS block. */
+ tlsblock = (void *) (((uintptr_t) tlsblock + max_align - 1)
+ & ~(max_align - 1));
+
+ /* Initialize the dtv. [0] is the length, [1] the generation counter. */
+ static_dtv[0].counter = 1;
+ // static_dtv[1].counter = 0; would be needed if not already done
+
+ /* Initialize the TLS block. */
+# if TLS_TCB_AT_TP
+ static_dtv[2].pointer = ((char *) tlsblock + tcb_offset
+ - roundup (memsz, align ?: 1));
+ static_map.l_tls_offset = roundup (memsz, align ?: 1);
+# elif TLS_DTV_AT_TP
+ static_dtv[2].pointer = (char *) tlsblock + tcb_offset;
+ static_map.l_tls_offset = tcb_offset;
+# else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+ /* sbrk gives us zero'd memory, so we don't need to clear the remainder. */
+ memcpy (static_dtv[2].pointer, initimage, filesz);
+
+ /* Install the pointer to the dtv. */
+
+ /* Initialize the thread pointer. */
+# if TLS_TCB_AT_TP
+ INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
+
+ const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
+# elif TLS_DTV_AT_TP
+ INSTALL_DTV (tlsblock, static_dtv);
+ const char *lossage = TLS_INIT_TP (tlsblock, 0);
+# else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+ if (__builtin_expect (lossage != NULL, 0))
+ __libc_fatal (lossage);
+
+ /* We have to create a fake link map which normally would be created
+ by the dynamic linker. It just has to have enough information to
+ make the TLS routines happy. */
+ static_map.l_tls_align = align;
+ static_map.l_tls_blocksize = memsz;
+ static_map.l_tls_initimage = initimage;
+ static_map.l_tls_initimage_size = filesz;
+ static_map.l_type = lt_executable;
+ static_map.l_tls_modid = 1;
+
+ init_slotinfo ();
+ // static_slotinfo.si.slotinfo[1].gen = 0; already zero
+ static_slotinfo.si.slotinfo[1].map = &static_map;
+
+ memsz = roundup (memsz, align ?: 1);
+
+# if TLS_TCB_AT_TP
+ memsz += tcbsize;
+# elif TLS_DTV_AT_TP
+ memsz += tcb_offset;
+# endif
+
+ init_static_tls (memsz, MAX (TLS_TCB_ALIGN, max_align));
+}
+
+/* This is called only when the data structure setup was skipped at startup,
+ when there was no need for it then. Now we have dynamically loaded
+ something needing TLS, or libpthread needs it. */
+int
+internal_function
+_dl_tls_setup (void)
+{
+ init_slotinfo ();
+ init_static_tls (
+# if TLS_TCB_AT_TP
+ TLS_TCB_SIZE,
+# else
+ 0,
+# endif
+ TLS_TCB_ALIGN);
+ return 0;
+}
+
+
+/* This is the minimal initialization function used when libpthread is
+ not used. */
+void
+__attribute__ ((weak))
+__pthread_initialize_minimal (void)
+{
+ __libc_setup_tls (TLS_INIT_TCB_SIZE, TLS_INIT_TCB_ALIGN);
+}
+
+#elif defined NONTLS_INIT_TP
+
+/* This is the minimal initialization function used when libpthread is
+ not used. */
+void
+__attribute__ ((weak))
+__pthread_initialize_minimal (void)
+{
+ NONTLS_INIT_TP;
+}
+
+#endif
diff --git a/sysdeps/generic/libc_fatal.c b/sysdeps/generic/libc_fatal.c
new file mode 100644
index 0000000000..be23849829
--- /dev/null
+++ b/sysdeps/generic/libc_fatal.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1993, 1995, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+/* Abort with an error message. */
+void
+__libc_fatal (message)
+ const char *message;
+{
+ /* This function should write MESSAGE out in the most reliable way.
+ It is called in situations like internal stdio lossage. */
+
+ abort ();
+}
+libc_hidden_def (__libc_fatal)
diff --git a/sysdeps/generic/link.c b/sysdeps/generic/link.c
new file mode 100644
index 0000000000..70c9949704
--- /dev/null
+++ b/sysdeps/generic/link.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Make a link to FROM called TO. */
+int
+__link (from, to)
+ const char *from;
+ const char *to;
+{
+ if (from == NULL || to == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (link)
+
+weak_alias (__link, link)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lio_listio.c b/sysdeps/generic/lio_listio.c
new file mode 100644
index 0000000000..d535594492
--- /dev/null
+++ b/sysdeps/generic/lio_listio.c
@@ -0,0 +1,42 @@
+/* Enqueue a list of read or write requests. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <aio.h>
+#include <errno.h>
+
+#ifdef BE_AIO64
+#define lio_listio lio_listio64
+#define aiocb aiocb64
+#define aio_read aio_read64
+#define aio_write aio_write64
+#define aio_suspend aio_suspend64
+#endif
+
+
+int
+lio_listio (int mode,
+ struct aiocb *const list[], int nent,
+ struct sigevent *sig)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lio_listio)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lio_listio64.c b/sysdeps/generic/lio_listio64.c
new file mode 100644
index 0000000000..2e72c46b0b
--- /dev/null
+++ b/sysdeps/generic/lio_listio64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include "lio_listio.c"
diff --git a/sysdeps/generic/listen.c b/sysdeps/generic/listen.c
new file mode 100644
index 0000000000..cbdd8b9d18
--- /dev/null
+++ b/sysdeps/generic/listen.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Prepare to accept connections on socket FD.
+ N connection requests will be queued before further requests are refused.
+ Returns 0 on success, -1 for errors. */
+int
+__listen (fd, n)
+ int fd;
+ int n;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__listen, listen)
+
+stub_warning (listen)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/listxattr.c b/sysdeps/generic/listxattr.c
new file mode 100644
index 0000000000..490a092b75
--- /dev/null
+++ b/sysdeps/generic/listxattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+listxattr (const char *__path, char *__list, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (listxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/llabs.c b/sysdeps/generic/llabs.c
new file mode 100644
index 0000000000..b15c347d32
--- /dev/null
+++ b/sysdeps/generic/llabs.c
@@ -0,0 +1,31 @@
+/* `long long int' absolute value.
+ Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+
+#undef llabs
+
+
+/* Return the absolute value of I. */
+long long int
+llabs (i)
+ long long int i;
+{
+ return i < 0 ? -i : i;
+}
diff --git a/sysdeps/generic/lldiv.c b/sysdeps/generic/lldiv.c
new file mode 100644
index 0000000000..28a016b744
--- /dev/null
+++ b/sysdeps/generic/lldiv.c
@@ -0,0 +1,57 @@
+/* `long long int' divison with remainder.
+ Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+
+
+/* Return the `lldiv_t' representation of NUMER over DENOM. */
+lldiv_t
+lldiv (numer, denom)
+ long long int numer;
+ long long int denom;
+{
+ lldiv_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ /* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
+ NUMER / DENOM is to be computed in infinite precision. In
+ other words, we should always truncate the quotient towards
+ zero, never -infinity. Machine division and remainer may
+ work either way when one or both of NUMER or DENOM is
+ negative. If only one is negative and QUOT has been
+ truncated towards -infinity, REM will have the same sign as
+ DENOM and the opposite sign of NUMER; if both are negative
+ and QUOT has been truncated towards -infinity, REM will be
+ positive (will have the opposite sign of NUMER). These are
+ considered `wrong'. If both are NUM and DENOM are positive,
+ RESULT will always be positive. This all boils down to: if
+ NUMER >= 0, but REM < 0, we got the wrong answer. In that
+ case, to get the right answer, add 1 to QUOT and subtract
+ DENOM from REM. */
+
+ if (numer >= 0 && result.rem < 0)
+ {
+ ++result.quot;
+ result.rem -= denom;
+ }
+
+ return result;
+}
diff --git a/sysdeps/generic/llistxattr.c b/sysdeps/generic/llistxattr.c
new file mode 100644
index 0000000000..1a7e1e4cfd
--- /dev/null
+++ b/sysdeps/generic/llistxattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+llistxattr (const char *__path, char *__list, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (llistxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/local-setxid.h b/sysdeps/generic/local-setxid.h
deleted file mode 100644
index b70d9ffb32..0000000000
--- a/sysdeps/generic/local-setxid.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* No special support. Fall back to the regular functions. */
-
-#define local_seteuid(id) seteuid (id)
-#define local_setegid(id) setegid (id)
diff --git a/sysdeps/generic/lockf.c b/sysdeps/generic/lockf.c
new file mode 100644
index 0000000000..7b23f66bc9
--- /dev/null
+++ b/sysdeps/generic/lockf.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 1994,1996,1997,1998,2000,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+
+/* lockf is a simplified interface to fcntl's locking facilities. */
+
+int
+lockf (int fd, int cmd, off_t len)
+{
+ struct flock fl;
+
+ memset ((char *) &fl, '\0', sizeof (fl));
+
+ /* lockf is always relative to the current file position. */
+ fl.l_whence = SEEK_CUR;
+ fl.l_start = 0;
+ fl.l_len = len;
+
+ switch (cmd)
+ {
+ case F_TEST:
+ /* Test the lock: return 0 if FD is unlocked or locked by this process;
+ return -1, set errno to EACCES, if another process holds the lock. */
+ fl.l_type = F_RDLCK;
+ if (__fcntl (fd, F_GETLK, &fl) < 0)
+ return -1;
+ if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ())
+ return 0;
+ __set_errno (EACCES);
+ return -1;
+
+ case F_ULOCK:
+ fl.l_type = F_UNLCK;
+ cmd = F_SETLK;
+ break;
+ case F_LOCK:
+ fl.l_type = F_WRLCK;
+ cmd = F_SETLKW;
+ break;
+ case F_TLOCK:
+ fl.l_type = F_WRLCK;
+ cmd = F_SETLK;
+ break;
+
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ /* lockf() is a cancellation point but so is fcntl() if F_SETLKW is
+ used. Therefore we don't have to care about cancellation here,
+ the fcntl() function will take care of it. */
+ return __fcntl (fd, cmd, &fl);
+}
diff --git a/sysdeps/generic/lockf64.c b/sysdeps/generic/lockf64.c
new file mode 100644
index 0000000000..e3b110cd3f
--- /dev/null
+++ b/sysdeps/generic/lockf64.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 1994,96,97,98,99,2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+
+/* lockf is a simplified interface to fcntl's locking facilities. */
+
+int
+lockf64 (int fd, int cmd, off64_t len64)
+{
+ struct flock fl;
+ off_t len = (off_t) len64;
+
+ if (len64 != (off64_t) len)
+ {
+ /* We can't represent the length. */
+ __set_errno (EOVERFLOW);
+ return -1;
+ }
+
+ memset ((char *) &fl, '\0', sizeof (fl));
+
+ /* lockf is always relative to the current file position. */
+ fl.l_whence = SEEK_CUR;
+ fl.l_start = 0;
+ fl.l_len = len;
+
+ switch (cmd)
+ {
+ case F_TEST:
+ /* Test the lock: return 0 if FD is unlocked or locked by this process;
+ return -1, set errno to EACCES, if another process holds the lock. */
+ fl.l_type = F_RDLCK;
+ if (__fcntl (fd, F_GETLK, &fl) < 0)
+ return -1;
+ if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ())
+ return 0;
+ __set_errno (EACCES);
+ return -1;
+
+ case F_ULOCK:
+ fl.l_type = F_UNLCK;
+ cmd = F_SETLK;
+ break;
+ case F_LOCK:
+ fl.l_type = F_WRLCK;
+ cmd = F_SETLKW;
+ break;
+ case F_TLOCK:
+ fl.l_type = F_WRLCK;
+ cmd = F_SETLK;
+ break;
+
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __fcntl (fd, cmd, &fl);
+}
diff --git a/sysdeps/generic/longjmp-ts.c b/sysdeps/generic/longjmp-ts.c
new file mode 100644
index 0000000000..e9c297a20b
--- /dev/null
+++ b/sysdeps/generic/longjmp-ts.c
@@ -0,0 +1,32 @@
+/* Perform a `longjmp' on a Mach thread_state. Stub version.
+ Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <setjmp.h>
+#include <mach/thread_status.h>
+
+/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'. */
+
+void
+_hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
+{
+ /* Set all the registers in *STATE to the values described by ENV and
+ RETVAL. After this, setting that thread's state to STATE should be
+ just like calling `longjmp (ENV, RETVAL)'. */
+ #error "Need to write sysdeps/mach/hurd/MACHINE/longjmp-ctx.c"
+}
diff --git a/sysdeps/generic/longjmp.c b/sysdeps/generic/longjmp.c
new file mode 100644
index 0000000000..9b1bda1caa
--- /dev/null
+++ b/sysdeps/generic/longjmp.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991,92,94,95,97,98,2000,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+
+
+/* Set the signal mask to the one specified in ENV, and jump
+ to the position specified in ENV, causing the setjmp
+ call there to return VAL, or 1 if VAL is 0. */
+void
+__libc_siglongjmp (sigjmp_buf env, int val)
+{
+ /* Perform any cleanups needed by the frames being unwound. */
+ _longjmp_unwind (env, val);
+
+ if (env[0].__mask_was_saved)
+ /* Restore the saved signal mask. */
+ (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+ (sigset_t *) NULL);
+
+ /* Call the machine-dependent function to restore machine state. */
+ __longjmp (env[0].__jmpbuf, val ?: 1);
+}
+
+strong_alias (__libc_siglongjmp, __libc_longjmp)
+libc_hidden_def (__libc_longjmp)
+weak_alias (__libc_siglongjmp, _longjmp)
+weak_alias (__libc_siglongjmp, longjmp)
+weak_alias (__libc_siglongjmp, siglongjmp)
diff --git a/sysdeps/generic/lremovexattr.c b/sysdeps/generic/lremovexattr.c
new file mode 100644
index 0000000000..fad64e5150
--- /dev/null
+++ b/sysdeps/generic/lremovexattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+lremovexattr (const char *__path, const char *__name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lremovexattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lseek.c b/sysdeps/generic/lseek.c
new file mode 100644
index 0000000000..6daf6ef154
--- /dev/null
+++ b/sysdeps/generic/lseek.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Seek to OFFSET on FD, starting from WHENCE. */
+off_t
+__lseek (fd, offset, whence)
+ int fd;
+ off_t offset;
+ int whence;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ switch (whence)
+ {
+ case SEEK_SET:
+ case SEEK_CUR:
+ case SEEK_END:
+ break;
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (lseek)
+libc_hidden_def (__lseek)
+
+weak_alias (__lseek, lseek)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lseek64.c b/sysdeps/generic/lseek64.c
new file mode 100644
index 0000000000..d0a8cff03e
--- /dev/null
+++ b/sysdeps/generic/lseek64.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1991,95,96,97,98,2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Seek to OFFSET on FD, starting from WHENCE. */
+off64_t
+__libc_lseek64 (int fd, off64_t offset, int whence)
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ switch (whence)
+ {
+ case SEEK_SET:
+ case SEEK_CUR:
+ case SEEK_END:
+ break;
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__libc_lseek64, __lseek64)
+weak_alias (__libc_lseek64, lseek64)
+stub_warning (lseek64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lsetxattr.c b/sysdeps/generic/lsetxattr.c
new file mode 100644
index 0000000000..6f8cdde1da
--- /dev/null
+++ b/sysdeps/generic/lsetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+lsetxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lsetxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lshift.c b/sysdeps/generic/lshift.c
new file mode 100644
index 0000000000..0b58389658
--- /dev/null
+++ b/sysdeps/generic/lshift.c
@@ -0,0 +1,87 @@
+/* mpn_lshift -- Shift left low level.
+
+Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+/* Shift U (pointed to by UP and USIZE digits long) CNT bits to the left
+ and store the USIZE least significant digits of the result at WP.
+ Return the bits shifted out from the most significant digit.
+
+ Argument constraints:
+ 1. 0 < CNT < BITS_PER_MP_LIMB
+ 2. If the result is to be written over the input, WP must be >= UP.
+*/
+
+mp_limb_t
+#if __STDC__
+mpn_lshift (register mp_ptr wp,
+ register mp_srcptr up, mp_size_t usize,
+ register unsigned int cnt)
+#else
+mpn_lshift (wp, up, usize, cnt)
+ register mp_ptr wp;
+ register mp_srcptr up;
+ mp_size_t usize;
+ register unsigned int cnt;
+#endif
+{
+ register mp_limb_t high_limb, low_limb;
+ register unsigned sh_1, sh_2;
+ register mp_size_t i;
+ mp_limb_t retval;
+
+#ifdef DEBUG
+ if (usize == 0 || cnt == 0)
+ abort ();
+#endif
+
+ sh_1 = cnt;
+#if 0
+ if (sh_1 == 0)
+ {
+ if (wp != up)
+ {
+ /* Copy from high end to low end, to allow specified input/output
+ overlapping. */
+ for (i = usize - 1; i >= 0; i--)
+ wp[i] = up[i];
+ }
+ return 0;
+ }
+#endif
+
+ wp += 1;
+ sh_2 = BITS_PER_MP_LIMB - sh_1;
+ i = usize - 1;
+ low_limb = up[i];
+ retval = low_limb >> sh_2;
+ high_limb = low_limb;
+ while (--i >= 0)
+ {
+ low_limb = up[i];
+ wp[i] = (high_limb << sh_1) | (low_limb >> sh_2);
+ high_limb = low_limb;
+ }
+ wp[i] = high_limb << sh_1;
+
+ return retval;
+}
diff --git a/sysdeps/generic/lutimes.c b/sysdeps/generic/lutimes.c
new file mode 100644
index 0000000000..34fc1838f0
--- /dev/null
+++ b/sysdeps/generic/lutimes.c
@@ -0,0 +1,35 @@
+/* lutimes -- change access and modification times of a symlink. Stub version.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time of FILE to TVP[0] and
+ the modification time of FILE to TVP[1], but do not follow symlinks. */
+int
+__lutimes (const char *file, const struct timeval tvp[2])
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__lutimes, lutimes)
+
+stub_warning (lutimes)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/lxstat.c b/sysdeps/generic/lxstat.c
new file mode 100644
index 0000000000..23d4442b5c
--- /dev/null
+++ b/sysdeps/generic/lxstat.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991,1992,1995,1996,1997,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/stat.h>
+
+int
+__lxstat (int version, const char *file, struct stat *buf)
+{
+ return __xstat (version, file, buf);
+}
+hidden_def (__lxstat)
+weak_alias (__lxstat, _lxstat)
diff --git a/sysdeps/generic/lxstat64.c b/sysdeps/generic/lxstat64.c
new file mode 100644
index 0000000000..596ecd2277
--- /dev/null
+++ b/sysdeps/generic/lxstat64.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Get file information about FILE in BUF.
+ If FILE is a symbolic link, do not follow it. */
+int
+__lxstat64 (int vers, const char *file, struct stat64 *buf)
+{
+ if (vers != _STAT_VER || file == NULL || buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+hidden_def (__lxstat64)
+stub_warning (__lxstat64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/madvise.c b/sysdeps/generic/madvise.c
new file mode 100644
index 0000000000..dbef959dd8
--- /dev/null
+++ b/sysdeps/generic/madvise.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Advise the system about particular usage patterns the program follows
+ for the region starting at ADDR and extending LEN bytes. */
+
+int
+madvise (__ptr_t addr, size_t len, int advice)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (madvise)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/makecontext.c b/sysdeps/generic/makecontext.c
new file mode 100644
index 0000000000..a65868827f
--- /dev/null
+++ b/sysdeps/generic/makecontext.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+void
+makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
+{
+ __set_errno (ENOSYS);
+}
+
+
+stub_warning (makecontext)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/math_ldbl_opt.h b/sysdeps/generic/math_ldbl_opt.h
deleted file mode 100644
index 8a5d8ba107..0000000000
--- a/sysdeps/generic/math_ldbl_opt.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -mlong-double-64 compatibility mode macros. Stub version.
-
- These macros are used by some math/ and sysdeps/ieee754/ code.
- These are the generic definitions for when no funny business is going on.
- sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h defines them differently
- for platforms where compatibility symbols are required for a previous
- ABI that defined long double functions as aliases for the double code. */
-
-#define LONG_DOUBLE_COMPAT(lib, introduced) 0
-#define long_double_symbol(lib, local, symbol)
-#define ldbl_hidden_def(local, name) libc_hidden_def (name)
-#define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
-#define ldbl_weak_alias(name, aliasname) weak_alias (name, aliasname)
-#define __ldbl_is_dbl 0
diff --git a/sysdeps/generic/memccpy.c b/sysdeps/generic/memccpy.c
new file mode 100644
index 0000000000..9ffdc335d4
--- /dev/null
+++ b/sysdeps/generic/memccpy.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1995, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+#undef __memccpy
+#undef memccpy
+
+/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
+ Return the position in DEST one byte past where C was copied, or
+ NULL if C was not found in the first N bytes of SRC. */
+void *
+__memccpy (dest, src, c, n)
+ void *dest;
+ const void *src;
+ int c;
+ size_t n;
+{
+ register const char *s = src;
+ register char *d = dest;
+ register const char x = c;
+ register size_t i = n;
+
+ while (i-- > 0)
+ if ((*d++ = *s++) == x)
+ return d;
+
+ return NULL;
+}
+
+weak_alias (__memccpy, memccpy)
diff --git a/sysdeps/generic/memchr.c b/sysdeps/generic/memchr.c
new file mode 100644
index 0000000000..f3098c775a
--- /dev/null
+++ b/sysdeps/generic/memchr.c
@@ -0,0 +1,215 @@
+/* Copyright (C) 1991,93,96,97,99,2000,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#undef __ptr_t
+#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
+# define __ptr_t void *
+#else /* Not C++ or ANSI C. */
+# define __ptr_t char *
+#endif /* C++ or ANSI C. */
+
+#if defined _LIBC
+# include <string.h>
+# include <memcopy.h>
+#else
+# define reg_char char
+#endif
+
+#if HAVE_STDLIB_H || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#if HAVE_LIMITS_H || defined _LIBC
+# include <limits.h>
+#endif
+
+#define LONG_MAX_32_BITS 2147483647
+
+#ifndef LONG_MAX
+#define LONG_MAX LONG_MAX_32_BITS
+#endif
+
+#include <sys/types.h>
+#if HAVE_BP_SYM_H || defined _LIBC
+#include <bp-sym.h>
+#else
+# define BP_SYM(sym) sym
+#endif
+
+#undef memchr
+#undef __memchr
+
+/* Search no more than N bytes of S for C. */
+__ptr_t
+__memchr (s, c_in, n)
+ const __ptr_t s;
+ int c_in;
+ size_t n;
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s;
+ n > 0 && ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ --n, ++char_ptr)
+ if (*char_ptr == c)
+ return (__ptr_t) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+
+ if (sizeof (longword) != 4 && sizeof (longword) != 8)
+ abort ();
+
+#if LONG_MAX <= LONG_MAX_32_BITS
+ magic_bits = 0x7efefeff;
+#else
+ magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+#endif
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+#if LONG_MAX > LONG_MAX_32_BITS
+ charmask |= charmask << 32;
+#endif
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (n >= sizeof (longword))
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++ ^ charmask;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C? If none of them were, it was
+ a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (cp[0] == c)
+ return (__ptr_t) cp;
+ if (cp[1] == c)
+ return (__ptr_t) &cp[1];
+ if (cp[2] == c)
+ return (__ptr_t) &cp[2];
+ if (cp[3] == c)
+ return (__ptr_t) &cp[3];
+#if LONG_MAX > 2147483647
+ if (cp[4] == c)
+ return (__ptr_t) &cp[4];
+ if (cp[5] == c)
+ return (__ptr_t) &cp[5];
+ if (cp[6] == c)
+ return (__ptr_t) &cp[6];
+ if (cp[7] == c)
+ return (__ptr_t) &cp[7];
+#endif
+ }
+
+ n -= sizeof (longword);
+ }
+
+ char_ptr = (const unsigned char *) longword_ptr;
+
+ while (n-- > 0)
+ {
+ if (*char_ptr == c)
+ return (__ptr_t) char_ptr;
+ else
+ ++char_ptr;
+ }
+
+ return 0;
+}
+#ifdef weak_alias
+weak_alias (__memchr, BP_SYM (memchr))
+#endif
+libc_hidden_builtin_def (memchr)
diff --git a/sysdeps/generic/memcmp.c b/sysdeps/generic/memcmp.c
new file mode 100644
index 0000000000..2f8cf344af
--- /dev/null
+++ b/sysdeps/generic/memcmp.c
@@ -0,0 +1,381 @@
+/* Copyright (C) 1991,1993,1995,1997,1998,2003,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#undef __ptr_t
+#if defined __cplusplus || (defined __STDC__ && __STDC__)
+# define __ptr_t void *
+#else /* Not C++ or ANSI C. */
+# undef const
+# define const
+# define __ptr_t char *
+#endif /* C++ or ANSI C. */
+
+#if defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#endif
+
+#undef memcmp
+
+#ifdef _LIBC
+
+# include <memcopy.h>
+# include <endian.h>
+
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define WORDS_BIGENDIAN
+# endif
+
+#else /* Not in the GNU C library. */
+
+# include <sys/types.h>
+
+/* Type to use for aligned memory operations.
+ This should normally be the biggest type supported by a single load
+ and store. Must be an unsigned type. */
+# define op_t unsigned long int
+# define OPSIZ (sizeof(op_t))
+
+/* Threshold value for when to enter the unrolled loops. */
+# define OP_T_THRES 16
+
+/* Type to use for unaligned operations. */
+typedef unsigned char byte;
+
+# ifndef WORDS_BIGENDIAN
+# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
+# else
+# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
+# endif
+
+#endif /* In the GNU C library. */
+
+#ifdef WORDS_BIGENDIAN
+# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
+#else
+# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
+#endif
+
+/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */
+
+/* The strategy of this memcmp is:
+
+ 1. Compare bytes until one of the block pointers is aligned.
+
+ 2. Compare using memcmp_common_alignment or
+ memcmp_not_common_alignment, regarding the alignment of the other
+ block after the initial byte operations. The maximum number of
+ full words (of type op_t) are compared in this way.
+
+ 3. Compare the few remaining bytes. */
+
+#ifndef WORDS_BIGENDIAN
+/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
+ A and B are known to be different.
+ This is needed only on little-endian machines. */
+
+static int memcmp_bytes (op_t, op_t) __THROW;
+
+# ifdef __GNUC__
+__inline
+# endif
+static int
+memcmp_bytes (a, b)
+ op_t a, b;
+{
+ long int srcp1 = (long int) &a;
+ long int srcp2 = (long int) &b;
+ op_t a0, b0;
+
+ do
+ {
+ a0 = ((byte *) srcp1)[0];
+ b0 = ((byte *) srcp2)[0];
+ srcp1 += 1;
+ srcp2 += 1;
+ }
+ while (a0 == b0);
+ return a0 - b0;
+}
+#endif
+
+static int memcmp_common_alignment (long, long, size_t) __THROW;
+
+/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
+ objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for
+ memory operations on `op_t's. */
+static int
+memcmp_common_alignment (srcp1, srcp2, len)
+ long int srcp1;
+ long int srcp2;
+ size_t len;
+{
+ op_t a0, a1;
+ op_t b0, b1;
+
+ switch (len % 4)
+ {
+ default: /* Avoid warning about uninitialized local variables. */
+ case 2:
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ srcp1 -= 2 * OPSIZ;
+ srcp2 -= 2 * OPSIZ;
+ len += 2;
+ goto do1;
+ case 3:
+ a1 = ((op_t *) srcp1)[0];
+ b1 = ((op_t *) srcp2)[0];
+ srcp1 -= OPSIZ;
+ srcp2 -= OPSIZ;
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return 0;
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ goto do3;
+ case 1:
+ a1 = ((op_t *) srcp1)[0];
+ b1 = ((op_t *) srcp2)[0];
+ srcp1 += OPSIZ;
+ srcp2 += OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ /* Fall through. */
+ }
+
+ do
+ {
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ if (a1 != b1)
+ return CMP_LT_OR_GT (a1, b1);
+
+ do3:
+ a1 = ((op_t *) srcp1)[1];
+ b1 = ((op_t *) srcp2)[1];
+ if (a0 != b0)
+ return CMP_LT_OR_GT (a0, b0);
+
+ do2:
+ a0 = ((op_t *) srcp1)[2];
+ b0 = ((op_t *) srcp2)[2];
+ if (a1 != b1)
+ return CMP_LT_OR_GT (a1, b1);
+
+ do1:
+ a1 = ((op_t *) srcp1)[3];
+ b1 = ((op_t *) srcp2)[3];
+ if (a0 != b0)
+ return CMP_LT_OR_GT (a0, b0);
+
+ srcp1 += 4 * OPSIZ;
+ srcp2 += 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ if (a1 != b1)
+ return CMP_LT_OR_GT (a1, b1);
+ return 0;
+}
+
+static int memcmp_not_common_alignment (long, long, size_t) __THROW;
+
+/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
+ `op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory
+ operations on `op_t', but SRCP1 *should be unaligned*. */
+static int
+memcmp_not_common_alignment (srcp1, srcp2, len)
+ long int srcp1;
+ long int srcp2;
+ size_t len;
+{
+ op_t a0, a1, a2, a3;
+ op_t b0, b1, b2, b3;
+ op_t x;
+ int shl, shr;
+
+ /* Calculate how to shift a word read at the memory operation
+ aligned srcp1 to make it aligned for comparison. */
+
+ shl = 8 * (srcp1 % OPSIZ);
+ shr = 8 * OPSIZ - shl;
+
+ /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t'
+ it points in the middle of. */
+ srcp1 &= -OPSIZ;
+
+ switch (len % 4)
+ {
+ default: /* Avoid warning about uninitialized local variables. */
+ case 2:
+ a1 = ((op_t *) srcp1)[0];
+ a2 = ((op_t *) srcp1)[1];
+ b2 = ((op_t *) srcp2)[0];
+ srcp1 -= 1 * OPSIZ;
+ srcp2 -= 2 * OPSIZ;
+ len += 2;
+ goto do1;
+ case 3:
+ a0 = ((op_t *) srcp1)[0];
+ a1 = ((op_t *) srcp1)[1];
+ b1 = ((op_t *) srcp2)[0];
+ srcp2 -= 1 * OPSIZ;
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return 0;
+ a3 = ((op_t *) srcp1)[0];
+ a0 = ((op_t *) srcp1)[1];
+ b0 = ((op_t *) srcp2)[0];
+ srcp1 += 1 * OPSIZ;
+ goto do3;
+ case 1:
+ a2 = ((op_t *) srcp1)[0];
+ a3 = ((op_t *) srcp1)[1];
+ b3 = ((op_t *) srcp2)[0];
+ srcp1 += 2 * OPSIZ;
+ srcp2 += 1 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ /* Fall through. */
+ }
+
+ do
+ {
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ x = MERGE(a2, shl, a3, shr);
+ if (x != b3)
+ return CMP_LT_OR_GT (x, b3);
+
+ do3:
+ a1 = ((op_t *) srcp1)[1];
+ b1 = ((op_t *) srcp2)[1];
+ x = MERGE(a3, shl, a0, shr);
+ if (x != b0)
+ return CMP_LT_OR_GT (x, b0);
+
+ do2:
+ a2 = ((op_t *) srcp1)[2];
+ b2 = ((op_t *) srcp2)[2];
+ x = MERGE(a0, shl, a1, shr);
+ if (x != b1)
+ return CMP_LT_OR_GT (x, b1);
+
+ do1:
+ a3 = ((op_t *) srcp1)[3];
+ b3 = ((op_t *) srcp2)[3];
+ x = MERGE(a1, shl, a2, shr);
+ if (x != b2)
+ return CMP_LT_OR_GT (x, b2);
+
+ srcp1 += 4 * OPSIZ;
+ srcp2 += 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ x = MERGE(a2, shl, a3, shr);
+ if (x != b3)
+ return CMP_LT_OR_GT (x, b3);
+ return 0;
+}
+
+int
+memcmp (s1, s2, len)
+ const __ptr_t s1;
+ const __ptr_t s2;
+ size_t len;
+{
+ op_t a0;
+ op_t b0;
+ long int srcp1 = (long int) s1;
+ long int srcp2 = (long int) s2;
+ op_t res;
+
+ if (len >= OP_T_THRES)
+ {
+ /* There are at least some bytes to compare. No need to test
+ for LEN == 0 in this alignment loop. */
+ while (srcp2 % OPSIZ != 0)
+ {
+ a0 = ((byte *) srcp1)[0];
+ b0 = ((byte *) srcp2)[0];
+ srcp1 += 1;
+ srcp2 += 1;
+ res = a0 - b0;
+ if (res != 0)
+ return res;
+ len -= 1;
+ }
+
+ /* SRCP2 is now aligned for memory operations on `op_t'.
+ SRCP1 alignment determines if we can do a simple,
+ aligned compare or need to shuffle bits. */
+
+ if (srcp1 % OPSIZ == 0)
+ res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ);
+ else
+ res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ);
+ if (res != 0)
+ return res;
+
+ /* Number of bytes remaining in the interval [0..OPSIZ-1]. */
+ srcp1 += len & -OPSIZ;
+ srcp2 += len & -OPSIZ;
+ len %= OPSIZ;
+ }
+
+ /* There are just a few bytes to compare. Use byte memory operations. */
+ while (len != 0)
+ {
+ a0 = ((byte *) srcp1)[0];
+ b0 = ((byte *) srcp2)[0];
+ srcp1 += 1;
+ srcp2 += 1;
+ res = a0 - b0;
+ if (res != 0)
+ return res;
+ len -= 1;
+ }
+
+ return 0;
+}
+libc_hidden_builtin_def(memcmp)
+#ifdef weak_alias
+# undef bcmp
+weak_alias (memcmp, bcmp)
+#endif
diff --git a/sysdeps/generic/memcpy.c b/sysdeps/generic/memcpy.c
new file mode 100644
index 0000000000..e167e85d7b
--- /dev/null
+++ b/sysdeps/generic/memcpy.c
@@ -0,0 +1,65 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied. Overlap is NOT handled correctly.
+ Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <pagecopy.h>
+
+#undef memcpy
+
+void *
+memcpy (dstpp, srcpp, len)
+ void *dstpp;
+ const void *srcpp;
+ size_t len;
+{
+ unsigned long int dstp = (long int) dstpp;
+ unsigned long int srcp = (long int) srcpp;
+
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
+ as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known alignment of
+ DSTP. Number of bytes remaining is put in the third argument,
+ i.e. in LEN. This number may vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+
+ return dstpp;
+}
+libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/generic/memcpy_chk.c b/sysdeps/generic/memcpy_chk.c
new file mode 100644
index 0000000000..638cd0e4fb
--- /dev/null
+++ b/sysdeps/generic/memcpy_chk.c
@@ -0,0 +1,66 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied with error checking. Overlap is NOT handled correctly.
+ Copyright (C) 1991, 1997, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <pagecopy.h>
+
+void *
+__memcpy_chk (dstpp, srcpp, len, dstlen)
+ void *dstpp;
+ const void *srcpp;
+ size_t len;
+ size_t dstlen;
+{
+ if (__builtin_expect (dstlen < len, 0))
+ __chk_fail ();
+
+ unsigned long int dstp = (long int) dstpp;
+ unsigned long int srcp = (long int) srcpp;
+
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
+ as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known alignment of
+ DSTP. Number of bytes remaining is put in the third argument,
+ i.e. in LEN. This number may vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+
+ return dstpp;
+}
diff --git a/sysdeps/generic/memmem.c b/sysdeps/generic/memmem.c
new file mode 100644
index 0000000000..c40462104a
--- /dev/null
+++ b/sysdeps/generic/memmem.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <string.h>
+
+#ifndef _LIBC
+# define __builtin_expect(expr, val) (expr)
+#endif
+
+#undef memmem
+
+/* Return the first occurrence of NEEDLE in HAYSTACK. */
+void *
+memmem (haystack, haystack_len, needle, needle_len)
+ const void *haystack;
+ size_t haystack_len;
+ const void *needle;
+ size_t needle_len;
+{
+ const char *begin;
+ const char *const last_possible
+ = (const char *) haystack + haystack_len - needle_len;
+
+ if (needle_len == 0)
+ /* The first occurrence of the empty string is deemed to occur at
+ the beginning of the string. */
+ return (void *) haystack;
+
+ /* Sanity check, otherwise the loop might search through the whole
+ memory. */
+ if (__builtin_expect (haystack_len < needle_len, 0))
+ return NULL;
+
+ for (begin = (const char *) haystack; begin <= last_possible; ++begin)
+ if (begin[0] == ((const char *) needle)[0] &&
+ !memcmp ((const void *) &begin[1],
+ (const void *) ((const char *) needle + 1),
+ needle_len - 1))
+ return (void *) begin;
+
+ return NULL;
+}
diff --git a/sysdeps/generic/memmove.c b/sysdeps/generic/memmove.c
new file mode 100644
index 0000000000..16671f7bb5
--- /dev/null
+++ b/sysdeps/generic/memmove.c
@@ -0,0 +1,112 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied. Overlap is handled correctly.
+ Copyright (C) 1991, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <pagecopy.h>
+
+/* All this is so that bcopy.c can #include
+ this file after defining some things. */
+#ifndef a1
+#define a1 dest /* First arg is DEST. */
+#define a1const
+#define a2 src /* Second arg is SRC. */
+#define a2const const
+#undef memmove
+#endif
+#if !defined(RETURN) || !defined(rettype)
+#define RETURN(s) return (s) /* Return DEST. */
+#define rettype void *
+#endif
+
+
+rettype
+memmove (a1, a2, len)
+ a1const void *a1;
+ a2const void *a2;
+ size_t len;
+{
+ unsigned long int dstp = (long int) dest;
+ unsigned long int srcp = (long int) src;
+
+ /* This test makes the forward copying code be used whenever possible.
+ Reduces the working set. */
+ if (dstp - srcp >= len) /* *Unsigned* compare! */
+ {
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address
+ manipulation, as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+ }
+ else
+ {
+ /* Copy from the end to the beginning. */
+ srcp += len;
+ dstp += len;
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= dstp % OPSIZ;
+ BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_BWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_BWD (dstp, srcp, len);
+ }
+
+ RETURN (dest);
+}
+#ifndef memmove
+libc_hidden_builtin_def (memmove)
+#endif
diff --git a/sysdeps/generic/memmove_chk.c b/sysdeps/generic/memmove_chk.c
new file mode 100644
index 0000000000..f3b74d23d9
--- /dev/null
+++ b/sysdeps/generic/memmove_chk.c
@@ -0,0 +1,98 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied with error checking. Overlap is handled correctly.
+ Copyright (C) 1991,1995,1996,1997,2003,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <pagecopy.h>
+
+void *
+__memmove_chk (dest, src, len, destlen)
+ void *dest;
+ const void *src;
+ size_t len;
+ size_t destlen;
+{
+ if (__builtin_expect (destlen < len, 0))
+ __chk_fail ();
+
+ unsigned long int dstp = (long int) dest;
+ unsigned long int srcp = (long int) src;
+
+ /* This test makes the forward copying code be used whenever possible.
+ Reduces the working set. */
+ if (dstp - srcp >= len) /* *Unsigned* compare! */
+ {
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address
+ manipulation, as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+ }
+ else
+ {
+ /* Copy from the end to the beginning. */
+ srcp += len;
+ dstp += len;
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= dstp % OPSIZ;
+ BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_BWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_BWD (dstp, srcp, len);
+ }
+
+ return dest;
+}
diff --git a/sysdeps/generic/mempcpy.c b/sysdeps/generic/mempcpy.c
new file mode 100644
index 0000000000..a72617e86f
--- /dev/null
+++ b/sysdeps/generic/mempcpy.c
@@ -0,0 +1,69 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied, return pointer to following byte.
+ Overlap is NOT handled correctly.
+ Copyright (C) 1991, 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <pagecopy.h>
+
+#undef mempcpy
+#undef __mempcpy
+
+void *
+__mempcpy (dstpp, srcpp, len)
+ void *dstpp;
+ const void *srcpp;
+ size_t len;
+{
+ unsigned long int dstp = (long int) dstpp;
+ unsigned long int srcp = (long int) srcpp;
+
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
+ as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known alignment of
+ DSTP. Number of bytes remaining is put in the third argument,
+ i.e. in LEN. This number may vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+
+ return (void *) dstp;
+}
+libc_hidden_def (__mempcpy)
+weak_alias (__mempcpy, mempcpy)
+libc_hidden_builtin_def (mempcpy)
diff --git a/sysdeps/generic/mempcpy_chk.c b/sysdeps/generic/mempcpy_chk.c
new file mode 100644
index 0000000000..5297bbab92
--- /dev/null
+++ b/sysdeps/generic/mempcpy_chk.c
@@ -0,0 +1,67 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied, return pointer to following byte, with error checking.
+ Overlap is NOT handled correctly.
+ Copyright (C) 1991, 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <pagecopy.h>
+
+void *
+__mempcpy_chk (dstpp, srcpp, len, dstlen)
+ void *dstpp;
+ const void *srcpp;
+ size_t len;
+ size_t dstlen;
+{
+ if (__builtin_expect (dstlen < len, 0))
+ __chk_fail ();
+
+ unsigned long int dstp = (long int) dstpp;
+ unsigned long int srcp = (long int) srcpp;
+
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
+ as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known alignment of
+ DSTP. Number of bytes remaining is put in the third argument,
+ i.e. in LEN. This number may vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+
+ return (void *) dstp;
+}
diff --git a/sysdeps/generic/memrchr.c b/sysdeps/generic/memrchr.c
new file mode 100644
index 0000000000..21662b1bd7
--- /dev/null
+++ b/sysdeps/generic/memrchr.c
@@ -0,0 +1,210 @@
+/* memrchr -- find the last occurrence of a byte in a memory block
+ Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#undef __ptr_t
+#if defined __cplusplus || (defined __STDC__ && __STDC__)
+# define __ptr_t void *
+#else /* Not C++ or ANSI C. */
+# define __ptr_t char *
+#endif /* C++ or ANSI C. */
+
+#if defined _LIBC
+# include <string.h>
+# include <memcopy.h>
+#else
+# define reg_char char
+#endif
+
+#if defined HAVE_LIMITS_H || defined _LIBC
+# include <limits.h>
+#endif
+
+#define LONG_MAX_32_BITS 2147483647
+
+#ifndef LONG_MAX
+# define LONG_MAX LONG_MAX_32_BITS
+#endif
+
+#include <sys/types.h>
+
+#undef __memrchr
+#undef memrchr
+
+#ifndef weak_alias
+# define __memrchr memrchr
+#endif
+
+/* Search no more than N bytes of S for C. */
+__ptr_t
+__memrchr (s, c_in, n)
+ const __ptr_t s;
+ int c_in;
+ size_t n;
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the last few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s + n;
+ n > 0 && ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ --n)
+ if (*--char_ptr == c)
+ return (__ptr_t) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (const unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+
+ if (sizeof (longword) != 4 && sizeof (longword) != 8)
+ abort ();
+
+#if LONG_MAX <= LONG_MAX_32_BITS
+ magic_bits = 0x7efefeff;
+#else
+ magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+#endif
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+#if LONG_MAX > LONG_MAX_32_BITS
+ charmask |= charmask << 32;
+#endif
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (n >= sizeof (longword))
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *--longword_ptr ^ charmask;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C? If none of them were, it was
+ a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) longword_ptr;
+
+#if LONG_MAX > 2147483647
+ if (cp[7] == c)
+ return (__ptr_t) &cp[7];
+ if (cp[6] == c)
+ return (__ptr_t) &cp[6];
+ if (cp[5] == c)
+ return (__ptr_t) &cp[5];
+ if (cp[4] == c)
+ return (__ptr_t) &cp[4];
+#endif
+ if (cp[3] == c)
+ return (__ptr_t) &cp[3];
+ if (cp[2] == c)
+ return (__ptr_t) &cp[2];
+ if (cp[1] == c)
+ return (__ptr_t) &cp[1];
+ if (cp[0] == c)
+ return (__ptr_t) cp;
+ }
+
+ n -= sizeof (longword);
+ }
+
+ char_ptr = (const unsigned char *) longword_ptr;
+
+ while (n-- > 0)
+ {
+ if (*--char_ptr == c)
+ return (__ptr_t) char_ptr;
+ }
+
+ return 0;
+}
+#ifdef weak_alias
+weak_alias (__memrchr, memrchr)
+#endif
diff --git a/sysdeps/generic/memset.c b/sysdeps/generic/memset.c
new file mode 100644
index 0000000000..592b11e435
--- /dev/null
+++ b/sysdeps/generic/memset.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+#undef memset
+
+void *
+memset (dstpp, c, len)
+ void *dstpp;
+ int c;
+ size_t len;
+{
+ long int dstp = (long int) dstpp;
+
+ if (len >= 8)
+ {
+ size_t xlen;
+ op_t cccc;
+
+ cccc = (unsigned char) c;
+ cccc |= cccc << 8;
+ cccc |= cccc << 16;
+ if (OPSIZ > 4)
+ /* Do the shift in two steps to avoid warning if long has 32 bits. */
+ cccc |= (cccc << 16) << 16;
+
+ /* There are at least some bytes to set.
+ No need to test for LEN == 0 in this alignment loop. */
+ while (dstp % OPSIZ != 0)
+ {
+ ((byte *) dstp)[0] = c;
+ dstp += 1;
+ len -= 1;
+ }
+
+ /* Write 8 `op_t' per iteration until less than 8 `op_t' remain. */
+ xlen = len / (OPSIZ * 8);
+ while (xlen > 0)
+ {
+ ((op_t *) dstp)[0] = cccc;
+ ((op_t *) dstp)[1] = cccc;
+ ((op_t *) dstp)[2] = cccc;
+ ((op_t *) dstp)[3] = cccc;
+ ((op_t *) dstp)[4] = cccc;
+ ((op_t *) dstp)[5] = cccc;
+ ((op_t *) dstp)[6] = cccc;
+ ((op_t *) dstp)[7] = cccc;
+ dstp += 8 * OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ * 8;
+
+ /* Write 1 `op_t' per iteration until less than OPSIZ bytes remain. */
+ xlen = len / OPSIZ;
+ while (xlen > 0)
+ {
+ ((op_t *) dstp)[0] = cccc;
+ dstp += OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ;
+ }
+
+ /* Write the last few bytes. */
+ while (len > 0)
+ {
+ ((byte *) dstp)[0] = c;
+ dstp += 1;
+ len -= 1;
+ }
+
+ return dstpp;
+}
+libc_hidden_builtin_def (memset)
diff --git a/sysdeps/generic/memset_chk.c b/sysdeps/generic/memset_chk.c
new file mode 100644
index 0000000000..c311914395
--- /dev/null
+++ b/sysdeps/generic/memset_chk.c
@@ -0,0 +1,92 @@
+/* Copyright (C) 1991, 1997, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+void *
+__memset_chk (dstpp, c, len, dstlen)
+ void *dstpp;
+ int c;
+ size_t len;
+ size_t dstlen;
+{
+ if (__builtin_expect (dstlen < len, 0))
+ __chk_fail ();
+
+ long int dstp = (long int) dstpp;
+
+ if (len >= 8)
+ {
+ size_t xlen;
+ op_t cccc;
+
+ cccc = (unsigned char) c;
+ cccc |= cccc << 8;
+ cccc |= cccc << 16;
+ if (OPSIZ > 4)
+ /* Do the shift in two steps to avoid warning if long has 32 bits. */
+ cccc |= (cccc << 16) << 16;
+
+ /* There are at least some bytes to set.
+ No need to test for LEN == 0 in this alignment loop. */
+ while (dstp % OPSIZ != 0)
+ {
+ ((byte *) dstp)[0] = c;
+ dstp += 1;
+ len -= 1;
+ }
+
+ /* Write 8 `op_t' per iteration until less than 8 `op_t' remain. */
+ xlen = len / (OPSIZ * 8);
+ while (xlen > 0)
+ {
+ ((op_t *) dstp)[0] = cccc;
+ ((op_t *) dstp)[1] = cccc;
+ ((op_t *) dstp)[2] = cccc;
+ ((op_t *) dstp)[3] = cccc;
+ ((op_t *) dstp)[4] = cccc;
+ ((op_t *) dstp)[5] = cccc;
+ ((op_t *) dstp)[6] = cccc;
+ ((op_t *) dstp)[7] = cccc;
+ dstp += 8 * OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ * 8;
+
+ /* Write 1 `op_t' per iteration until less than OPSIZ bytes remain. */
+ xlen = len / OPSIZ;
+ while (xlen > 0)
+ {
+ ((op_t *) dstp)[0] = cccc;
+ dstp += OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ;
+ }
+
+ /* Write the last few bytes. */
+ while (len > 0)
+ {
+ ((byte *) dstp)[0] = c;
+ dstp += 1;
+ len -= 1;
+ }
+
+ return dstpp;
+}
diff --git a/sysdeps/generic/memusage.h b/sysdeps/generic/memusage.h
index a1205cec52..3057beb6e7 100644
--- a/sysdeps/generic/memusage.h
+++ b/sysdeps/generic/memusage.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,9 +17,6 @@
02111-1307 USA. */
-#include <limits.h>
-#include <atomic.h>
-
#ifndef GETSP
# warning "GETSP is not defined for this architecture."
# define GETSP 0
@@ -36,16 +33,3 @@
high = usecs >> 32; \
}
#endif
-
-#if LONG_BIT == 32
-# define memusage_cntr_t uatomic32_t
-#else
-# define memusage_cntr_t uatomic64_t
-#endif
-#ifndef memusage_size_t
-# if LONG_BIT == 32
-# define memusage_size_t uatomic32_t
-# else
-# define memusage_size_t uatomic64_t
-# endif
-#endif
diff --git a/sysdeps/generic/mig-reply.c b/sysdeps/generic/mig-reply.c
new file mode 100644
index 0000000000..3b02028858
--- /dev/null
+++ b/sysdeps/generic/mig-reply.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <mach.h>
+
+/* These functions are called by MiG-generated code. */
+
+static mach_port_t reply_port;
+
+/* Called by MiG to get a reply port. */
+mach_port_t
+__mig_get_reply_port (void)
+{
+ if (reply_port == MACH_PORT_NULL)
+ reply_port = __mach_reply_port ();
+
+ return reply_port;
+}
+
+/* Called by MiG to deallocate the reply port. */
+void
+__mig_dealloc_reply_port (void)
+{
+ mach_port_t port = reply_port;
+ reply_port = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */
+ __mach_port_mod_refs (__mach_task_self (), port,
+ MACH_PORT_RIGHT_RECEIVE, -1);
+}
+
+
+/* Called at startup with CPROC == NULL. cthreads has a different version
+ of this function that is sometimes called with a `cproc_t' pointer. */
+void
+__mig_init (void *cproc)
+{
+ if (cproc == 0)
+ reply_port = MACH_PORT_NULL;
+}
diff --git a/sysdeps/generic/mincore.c b/sysdeps/generic/mincore.c
new file mode 100644
index 0000000000..804447e8f3
--- /dev/null
+++ b/sysdeps/generic/mincore.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/mman.h>
+#include <errno.h>
+
+int
+mincore (void *__start, size_t __len, unsigned char *__vec)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (mincore)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mkdir.c b/sysdeps/generic/mkdir.c
new file mode 100644
index 0000000000..8037dfb3ee
--- /dev/null
+++ b/sysdeps/generic/mkdir.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+
+/* Create a directory named PATH with protections MODE. */
+int
+__mkdir (path, mode)
+ const char *path;
+ mode_t mode;
+{
+ if (path == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (mkdir)
+
+weak_alias (__mkdir, mkdir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mkfifo.c b/sysdeps/generic/mkfifo.c
new file mode 100644
index 0000000000..614ebe97c3
--- /dev/null
+++ b/sysdeps/generic/mkfifo.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+
+/* Create a named pipe (FIFO) named PATH with protections MODE. */
+int
+mkfifo (path, mode)
+ const char *path;
+ mode_t mode;
+{
+ if (path == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (mkfifo)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mknod.c b/sysdeps/generic/mknod.c
new file mode 100644
index 0000000000..7d43593a25
--- /dev/null
+++ b/sysdeps/generic/mknod.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 1995, 1996, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The GNU Lesser General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ Note that people who make modified versions of this file are not
+ obligated to grant this special exception for their modified
+ versions; it is their choice whether to do so. The GNU Lesser
+ General Public License gives permission to release a modified
+ version without this exception; this exception also makes it
+ possible to release a modified version which carries forward this
+ exception.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* This definition is only used if inlining fails for this function; see
+ the last page of <sys/stat.h>. The real work is done by the `x'
+ function which is passed a version number argument. We arrange in the
+ makefile that when not inlined this function is always statically
+ linked; that way a dynamically-linked executable always encodes the
+ version number corresponding to the data structures it uses, so the `x'
+ functions in the shared library can adapt without needing to recompile
+ all callers. */
+
+int
+__mknod (const char *path, mode_t mode, dev_t dev)
+{
+ return __xmknod (_MKNOD_VER, path, mode, &dev);
+}
+
+weak_alias (__mknod, mknod)
+
+/* Hide the symbol so that no definition but the one locally in the
+ executable or DSO is used. */
+#ifdef HAVE_DOT_HIDDEN
+asm (".hidden\tmknod");
+asm (".hidden\t__mknod");
+#endif
diff --git a/sysdeps/generic/mlock.c b/sysdeps/generic/mlock.c
new file mode 100644
index 0000000000..fd8dc8bc9d
--- /dev/null
+++ b/sysdeps/generic/mlock.c
@@ -0,0 +1,35 @@
+/* mlock -- guarantee pages are resident in memory. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
+ be memory resident. */
+
+int
+mlock (const void *addr, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (mlock)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mlockall.c b/sysdeps/generic/mlockall.c
new file mode 100644
index 0000000000..3d3ed6736d
--- /dev/null
+++ b/sysdeps/generic/mlockall.c
@@ -0,0 +1,36 @@
+/* mlockall -- lock in core all the pages in this process. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Cause all currently mapped pages of the process to be memory resident
+ until unlocked by a call to the `munlockall', until the process exits,
+ or until the process calls `execve'. */
+
+int
+mlockall (int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (mlockall)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mmap.c b/sysdeps/generic/mmap.c
new file mode 100644
index 0000000000..43b25a06d2
--- /dev/null
+++ b/sysdeps/generic/mmap.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Map addresses starting near ADDR and extending for LEN bytes. From
+ OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
+ is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
+ set in FLAGS, the mapping will be at ADDR exactly (which must be
+ page-aligned); otherwise the system chooses a convenient nearby address.
+ The return value is the actual mapping address chosen or MAP_FAILED
+ for errors (in which case `errno' is set). A successful `mmap' call
+ deallocates any previous mapping for the affected region. */
+
+__ptr_t
+__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+{
+ __set_errno (ENOSYS);
+ return MAP_FAILED;
+}
+
+stub_warning (mmap)
+#include <stub-tag.h>
+weak_alias (__mmap, mmap)
diff --git a/sysdeps/generic/mmap64.c b/sysdeps/generic/mmap64.c
new file mode 100644
index 0000000000..2c8aac808b
--- /dev/null
+++ b/sysdeps/generic/mmap64.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+
+/* Map addresses starting near ADDR and extending for LEN bytes. From
+ OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
+ is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
+ set in FLAGS, the mapping will be at ADDR exactly (which must be
+ page-aligned); otherwise the system chooses a convenient nearby address.
+ The return value is the actual mapping address chosen or MAP_FAILED
+ for errors (in which case `errno' is set). A successful `mmap' call
+ deallocates any previous mapping for the affected region. */
+
+__ptr_t
+__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd,
+ __off64_t offset)
+{
+ off_t small_offset = (off_t) offset;
+
+ if (small_offset != offset)
+ {
+ /* We cannot do this since the offset is too large. */
+ __set_errno (EOVERFLOW);
+ return MAP_FAILED;
+ }
+
+ return __mmap (addr, len, prot, flags, fd, small_offset);
+}
+
+weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/generic/mod_1.c b/sysdeps/generic/mod_1.c
new file mode 100644
index 0000000000..90385d1e6a
--- /dev/null
+++ b/sysdeps/generic/mod_1.c
@@ -0,0 +1,197 @@
+/* mpn_mod_1(dividend_ptr, dividend_size, divisor_limb) --
+ Divide (DIVIDEND_PTR,,DIVIDEND_SIZE) by DIVISOR_LIMB.
+ Return the single-limb remainder.
+ There are no constraints on the value of the divisor.
+
+Copyright (C) 1991, 1993, 1994, Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#ifndef UMUL_TIME
+#define UMUL_TIME 1
+#endif
+
+#ifndef UDIV_TIME
+#define UDIV_TIME UMUL_TIME
+#endif
+
+/* FIXME: We should be using invert_limb (or invert_normalized_limb)
+ here (not udiv_qrnnd). */
+
+mp_limb_t
+#if __STDC__
+mpn_mod_1 (mp_srcptr dividend_ptr, mp_size_t dividend_size,
+ mp_limb_t divisor_limb)
+#else
+mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
+ mp_srcptr dividend_ptr;
+ mp_size_t dividend_size;
+ mp_limb_t divisor_limb;
+#endif
+{
+ mp_size_t i;
+ mp_limb_t n1, n0, r;
+ int dummy;
+
+ /* Botch: Should this be handled at all? Rely on callers? */
+ if (dividend_size == 0)
+ return 0;
+
+ /* If multiplication is much faster than division, and the
+ dividend is large, pre-invert the divisor, and use
+ only multiplications in the inner loop. */
+
+ /* This test should be read:
+ Does it ever help to use udiv_qrnnd_preinv?
+ && Does what we save compensate for the inversion overhead? */
+ if (UDIV_TIME > (2 * UMUL_TIME + 6)
+ && (UDIV_TIME - (2 * UMUL_TIME + 6)) * dividend_size > UDIV_TIME)
+ {
+ int normalization_steps;
+
+ count_leading_zeros (normalization_steps, divisor_limb);
+ if (normalization_steps != 0)
+ {
+ mp_limb_t divisor_limb_inverted;
+
+ divisor_limb <<= normalization_steps;
+
+ /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The
+ result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
+ most significant bit (with weight 2**N) implicit. */
+
+ /* Special case for DIVISOR_LIMB == 100...000. */
+ if (divisor_limb << 1 == 0)
+ divisor_limb_inverted = ~(mp_limb_t) 0;
+ else
+ udiv_qrnnd (divisor_limb_inverted, dummy,
+ -divisor_limb, 0, divisor_limb);
+
+ n1 = dividend_ptr[dividend_size - 1];
+ r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
+
+ /* Possible optimization:
+ if (r == 0
+ && divisor_limb > ((n1 << normalization_steps)
+ | (dividend_ptr[dividend_size - 2] >> ...)))
+ ...one division less... */
+
+ for (i = dividend_size - 2; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd_preinv (dummy, r, r,
+ ((n1 << normalization_steps)
+ | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
+ divisor_limb, divisor_limb_inverted);
+ n1 = n0;
+ }
+ udiv_qrnnd_preinv (dummy, r, r,
+ n1 << normalization_steps,
+ divisor_limb, divisor_limb_inverted);
+ return r >> normalization_steps;
+ }
+ else
+ {
+ mp_limb_t divisor_limb_inverted;
+
+ /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The
+ result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
+ most significant bit (with weight 2**N) implicit. */
+
+ /* Special case for DIVISOR_LIMB == 100...000. */
+ if (divisor_limb << 1 == 0)
+ divisor_limb_inverted = ~(mp_limb_t) 0;
+ else
+ udiv_qrnnd (divisor_limb_inverted, dummy,
+ -divisor_limb, 0, divisor_limb);
+
+ i = dividend_size - 1;
+ r = dividend_ptr[i];
+
+ if (r >= divisor_limb)
+ r = 0;
+ else
+ i--;
+
+ for (; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd_preinv (dummy, r, r,
+ n0, divisor_limb, divisor_limb_inverted);
+ }
+ return r;
+ }
+ }
+ else
+ {
+ if (UDIV_NEEDS_NORMALIZATION)
+ {
+ int normalization_steps;
+
+ count_leading_zeros (normalization_steps, divisor_limb);
+ if (normalization_steps != 0)
+ {
+ divisor_limb <<= normalization_steps;
+
+ n1 = dividend_ptr[dividend_size - 1];
+ r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
+
+ /* Possible optimization:
+ if (r == 0
+ && divisor_limb > ((n1 << normalization_steps)
+ | (dividend_ptr[dividend_size - 2] >> ...)))
+ ...one division less... */
+
+ for (i = dividend_size - 2; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd (dummy, r, r,
+ ((n1 << normalization_steps)
+ | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
+ divisor_limb);
+ n1 = n0;
+ }
+ udiv_qrnnd (dummy, r, r,
+ n1 << normalization_steps,
+ divisor_limb);
+ return r >> normalization_steps;
+ }
+ }
+ /* No normalization needed, either because udiv_qrnnd doesn't require
+ it, or because DIVISOR_LIMB is already normalized. */
+
+ i = dividend_size - 1;
+ r = dividend_ptr[i];
+
+ if (r >= divisor_limb)
+ r = 0;
+ else
+ i--;
+
+ for (; i >= 0; i--)
+ {
+ n0 = dividend_ptr[i];
+ udiv_qrnnd (dummy, r, r, n0, divisor_limb);
+ }
+ return r;
+ }
+}
diff --git a/sysdeps/generic/morecore.c b/sysdeps/generic/morecore.c
new file mode 100644
index 0000000000..0a66ef5a85
--- /dev/null
+++ b/sysdeps/generic/morecore.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1991,92,93,94,95,97,2002,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MALLOC_INTERNAL
+#define _MALLOC_INTERNAL
+#include <malloc.h>
+#endif
+
+#ifndef __GNU_LIBRARY__
+#define __sbrk sbrk
+#endif
+
+#ifdef __GNU_LIBRARY__
+/* It is best not to declare this and cast its result on foreign operating
+ systems with potentially hostile include files. */
+
+#include <stddef.h>
+#include <stdlib.h>
+extern __malloc_ptr_t __sbrk (ptrdiff_t increment) __THROW;
+libc_hidden_proto (__sbrk)
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Allocate INCREMENT more bytes of data space,
+ and return the start of data space, or NULL on errors.
+ If INCREMENT is negative, shrink data space. */
+__malloc_ptr_t
+__default_morecore (increment)
+ __malloc_ptrdiff_t increment;
+{
+ __malloc_ptr_t result = (__malloc_ptr_t) __sbrk (increment);
+ if (result == (__malloc_ptr_t) -1)
+ return NULL;
+ return result;
+}
+libc_hidden_def (__default_morecore)
diff --git a/sysdeps/generic/mp_clz_tab.c b/sysdeps/generic/mp_clz_tab.c
new file mode 100644
index 0000000000..520ea31930
--- /dev/null
+++ b/sysdeps/generic/mp_clz_tab.c
@@ -0,0 +1,37 @@
+/* __clz_tab -- support for longlong.h
+ Copyright (C) 1991, 1993, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library. Its master source is NOT part of
+ the C library, however. The master source lives in the GNU MP Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if 0
+#include "gmp.h"
+#include "gmp-impl.h"
+#endif
+
+const
+unsigned char __clz_tab[] =
+{
+ 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+};
diff --git a/sysdeps/generic/mpn2dbl.c b/sysdeps/generic/mpn2dbl.c
new file mode 100644
index 0000000000..ea1b7dc27f
--- /dev/null
+++ b/sysdeps/generic/mpn2dbl.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include <float.h>
+
+/* Convert a multi-precision integer of the needed number of bits and an
+ integral power of two to a `double'. */
+
+double
+__mpn_construct_double (mp_srcptr frac_ptr, int expt, int negative)
+{
+#error "__mpn_construct_double not implemented for this floating point format"
+}
diff --git a/sysdeps/generic/mpn2flt.c b/sysdeps/generic/mpn2flt.c
new file mode 100644
index 0000000000..16ec73c174
--- /dev/null
+++ b/sysdeps/generic/mpn2flt.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include <float.h>
+
+/* Convert a multi-precision integer of the needed number of bits and an
+ integral power of two to a `float'. */
+
+float
+__mpn_construct_float (mp_srcptr frac_ptr, int expt, int negative)
+{
+#error "__mpn_construct_float not implemented for this floating point format"
+}
diff --git a/sysdeps/generic/mpn2ldbl.c b/sysdeps/generic/mpn2ldbl.c
new file mode 100644
index 0000000000..450f9381cc
--- /dev/null
+++ b/sysdeps/generic/mpn2ldbl.c
@@ -0,0 +1 @@
+/* Empty. Not needed unless ldbl support is in. */
diff --git a/sysdeps/generic/mprotect.c b/sysdeps/generic/mprotect.c
new file mode 100644
index 0000000000..9fefdfce71
--- /dev/null
+++ b/sysdeps/generic/mprotect.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Change the memory protection of the region starting at ADDR and
+ extending LEN bytes to PROT. Returns 0 if successful, -1 for errors
+ (and sets errno). */
+
+int
+__mprotect (__ptr_t addr, size_t len, int prot)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__mprotect, mprotect)
+
+stub_warning (mprotect)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_close.c b/sysdeps/generic/mq_close.c
new file mode 100644
index 0000000000..8237a6438e
--- /dev/null
+++ b/sysdeps/generic/mq_close.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Removes the association between message queue descriptor MQDES and its
+ message queue. */
+int
+mq_close (mqd_t mqdes)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (mq_close)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_getattr.c b/sysdeps/generic/mq_getattr.c
new file mode 100644
index 0000000000..2d24b85d47
--- /dev/null
+++ b/sysdeps/generic/mq_getattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Query status and attributes of message queue MQDES. */
+int
+mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (mq_getattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_notify.c b/sysdeps/generic/mq_notify.c
new file mode 100644
index 0000000000..29de75a471
--- /dev/null
+++ b/sysdeps/generic/mq_notify.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Register notification upon message arrival to an empty message queue
+ MQDES. */
+int
+mq_notify (mqd_t mqdes, const struct sigevent *notification)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (mq_notify)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_open.c b/sysdeps/generic/mq_open.c
new file mode 100644
index 0000000000..dea5741d5a
--- /dev/null
+++ b/sysdeps/generic/mq_open.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Establish connection between a process and a message queue NAME and
+ return message queue descriptor or (mqd_t) -1 on error. OFLAG determines
+ the type of access used. If O_CREAT is on OFLAG, the third argument is
+ taken as a `mode_t', the mode of the created message queue, and the fourth
+ argument is taken as `struct mq_attr *', pointer to message queue
+ attributes. If the fourth argument is NULL, default attributes are
+ used. */
+mqd_t
+mq_open (const char *name, int oflag, ...)
+{
+ __set_errno (ENOSYS);
+ return (mqd_t) -1;
+}
+stub_warning (mq_open)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_receive.c b/sysdeps/generic/mq_receive.c
new file mode 100644
index 0000000000..527fd75963
--- /dev/null
+++ b/sysdeps/generic/mq_receive.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Receive the oldest from highest priority messages in message queue
+ MQDES. */
+ssize_t
+mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
+ unsigned int *msg_prio)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (mq_receive)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_send.c b/sysdeps/generic/mq_send.c
new file mode 100644
index 0000000000..8b7cd87f7f
--- /dev/null
+++ b/sysdeps/generic/mq_send.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Add message pointed by MSG_PTR to message queue MQDES. */
+int
+mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
+ unsigned int msg_prio)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (mq_send)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_setattr.c b/sysdeps/generic/mq_setattr.c
new file mode 100644
index 0000000000..57ee0759ab
--- /dev/null
+++ b/sysdeps/generic/mq_setattr.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Set attributes associated with message queue MQDES and if OMQSTAT is
+ not NULL also query its old attributes. */
+int
+mq_setattr (mqd_t mqdes, const struct mq_attr *__restrict mqstat,
+ struct mq_attr *__restrict omqstat)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+hidden_def (mq_setattr)
+stub_warning (mq_setattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_timedreceive.c b/sysdeps/generic/mq_timedreceive.c
new file mode 100644
index 0000000000..e4723f812a
--- /dev/null
+++ b/sysdeps/generic/mq_timedreceive.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Receive the oldest from highest priority messages in message queue
+ MQDES, stop waiting if ABS_TIMEOUT expires. */
+ssize_t
+mq_timedreceive (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len,
+ unsigned int *__restrict msg_prio,
+ const struct timespec *__restrict abs_timeout)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+hidden_def (mq_timedreceive)
+stub_warning (mq_timedreceive)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_timedsend.c b/sysdeps/generic/mq_timedsend.c
new file mode 100644
index 0000000000..5ccfe23b0a
--- /dev/null
+++ b/sysdeps/generic/mq_timedsend.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
+ on full message queue if ABS_TIMEOUT expires. */
+int
+mq_timedsend (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
+ unsigned int msg_prio, const struct timespec *abs_timeout)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+hidden_def (mq_timedsend)
+stub_warning (mq_timedsend)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_unlink.c b/sysdeps/generic/mq_unlink.c
new file mode 100644
index 0000000000..e947b84f3b
--- /dev/null
+++ b/sysdeps/generic/mq_unlink.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <mqueue.h>
+
+/* Remove message queue named NAME. */
+int
+mq_unlink (const char *name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (mq_unlink)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/msgctl.c b/sysdeps/generic/msgctl.c
new file mode 100644
index 0000000000..e4451ed368
--- /dev/null
+++ b/sysdeps/generic/msgctl.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/msg.h>
+#include <errno.h>
+
+/* Allows to control internal state and destruction of message queue
+ objects. */
+
+int
+msgctl (msqid, cmd, buf)
+ int msqid;
+ int cmd;
+ struct msqid_ds *buf;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (msgctl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/msgget.c b/sysdeps/generic/msgget.c
new file mode 100644
index 0000000000..75f8f1bc7f
--- /dev/null
+++ b/sysdeps/generic/msgget.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/msg.h>
+#include <errno.h>
+
+/* Return descriptor for message queue associated with KEY. The MSGFLG
+ parameter describes how to proceed with clashing of key values. */
+
+int
+msgget (key, msgflg)
+ key_t key;
+ int msgflg;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (msgget)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/msgrcv.c b/sysdeps/generic/msgrcv.c
new file mode 100644
index 0000000000..f366fa8170
--- /dev/null
+++ b/sysdeps/generic/msgrcv.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/msg.h>
+#include <errno.h>
+
+/* Read a message from the queue associated with the message queue
+ descriptor MSQID. At most MSGSZ bytes of the message are placed
+ in the buffer specified by the MSGP parameter. The MSGTYP parameter
+ describes which message is returned in MSGFLG describes the behaviour
+ in buffer overflow or queue underflow. */
+
+int
+msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
+ int msqid;
+ void *msgp;
+ size_t msgsz;
+ long msgtyp;
+ int msgflg;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (msgrcv)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/msgsnd.c b/sysdeps/generic/msgsnd.c
new file mode 100644
index 0000000000..fb4ca1aa56
--- /dev/null
+++ b/sysdeps/generic/msgsnd.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/msg.h>
+#include <errno.h>
+
+/* Send a message to the queue associated with the message queue
+ descriptor MSQID. The parameter MSGP points to a structure
+ describing messages where the parameter MSGSZ gives the length
+ of the text. The MSGFLG parameter describes the action taken
+ when the limit of the message queue length is reached. */
+
+int
+msgsnd (msqid, msgp, msgsz, msgflg)
+ int msqid;
+ const void *msgp;
+ size_t msgsz;
+ int msgflg;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (msgsnd)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/msync.c b/sysdeps/generic/msync.c
new file mode 100644
index 0000000000..0ffd5c04f6
--- /dev/null
+++ b/sysdeps/generic/msync.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Synchronize the region starting at ADDR and extending LEN bytes with the
+ file it maps. Filesystem operations on a file being mapped are
+ unpredictable before this is done. */
+
+int
+msync (__ptr_t addr, size_t len, int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (msync)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/mul.c b/sysdeps/generic/mul.c
new file mode 100644
index 0000000000..7678e72a0a
--- /dev/null
+++ b/sysdeps/generic/mul.c
@@ -0,0 +1,152 @@
+/* mpn_mul -- Multiply two natural numbers.
+
+Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+/* Multiply the natural numbers u (pointed to by UP, with USIZE limbs)
+ and v (pointed to by VP, with VSIZE limbs), and store the result at
+ PRODP. USIZE + VSIZE limbs are always stored, but if the input
+ operands are normalized. Return the most significant limb of the
+ result.
+
+ NOTE: The space pointed to by PRODP is overwritten before finished
+ with U and V, so overlap is an error.
+
+ Argument constraints:
+ 1. USIZE >= VSIZE.
+ 2. PRODP != UP and PRODP != VP, i.e. the destination
+ must be distinct from the multiplier and the multiplicand. */
+
+/* If KARATSUBA_THRESHOLD is not already defined, define it to a
+ value which is good on most machines. */
+#ifndef KARATSUBA_THRESHOLD
+#define KARATSUBA_THRESHOLD 32
+#endif
+
+mp_limb_t
+#if __STDC__
+mpn_mul (mp_ptr prodp,
+ mp_srcptr up, mp_size_t usize,
+ mp_srcptr vp, mp_size_t vsize)
+#else
+mpn_mul (prodp, up, usize, vp, vsize)
+ mp_ptr prodp;
+ mp_srcptr up;
+ mp_size_t usize;
+ mp_srcptr vp;
+ mp_size_t vsize;
+#endif
+{
+ mp_ptr prod_endp = prodp + usize + vsize - 1;
+ mp_limb_t cy;
+ mp_ptr tspace;
+ TMP_DECL (marker);
+
+ if (vsize < KARATSUBA_THRESHOLD)
+ {
+ /* Handle simple cases with traditional multiplication.
+
+ This is the most critical code of the entire function. All
+ multiplies rely on this, both small and huge. Small ones arrive
+ here immediately. Huge ones arrive here as this is the base case
+ for Karatsuba's recursive algorithm below. */
+ mp_size_t i;
+ mp_limb_t cy_limb;
+ mp_limb_t v_limb;
+
+ if (vsize == 0)
+ return 0;
+
+ /* Multiply by the first limb in V separately, as the result can be
+ stored (not added) to PROD. We also avoid a loop for zeroing. */
+ v_limb = vp[0];
+ if (v_limb <= 1)
+ {
+ if (v_limb == 1)
+ MPN_COPY (prodp, up, usize);
+ else
+ MPN_ZERO (prodp, usize);
+ cy_limb = 0;
+ }
+ else
+ cy_limb = mpn_mul_1 (prodp, up, usize, v_limb);
+
+ prodp[usize] = cy_limb;
+ prodp++;
+
+ /* For each iteration in the outer loop, multiply one limb from
+ U with one limb from V, and add it to PROD. */
+ for (i = 1; i < vsize; i++)
+ {
+ v_limb = vp[i];
+ if (v_limb <= 1)
+ {
+ cy_limb = 0;
+ if (v_limb == 1)
+ cy_limb = mpn_add_n (prodp, prodp, up, usize);
+ }
+ else
+ cy_limb = mpn_addmul_1 (prodp, up, usize, v_limb);
+
+ prodp[usize] = cy_limb;
+ prodp++;
+ }
+ return cy_limb;
+ }
+
+ TMP_MARK (marker);
+
+ tspace = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB);
+ MPN_MUL_N_RECURSE (prodp, up, vp, vsize, tspace);
+
+ prodp += vsize;
+ up += vsize;
+ usize -= vsize;
+ if (usize >= vsize)
+ {
+ mp_ptr tp = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB);
+ do
+ {
+ MPN_MUL_N_RECURSE (tp, up, vp, vsize, tspace);
+ cy = mpn_add_n (prodp, prodp, tp, vsize);
+ mpn_add_1 (prodp + vsize, tp + vsize, vsize, cy);
+ prodp += vsize;
+ up += vsize;
+ usize -= vsize;
+ }
+ while (usize >= vsize);
+ }
+
+ /* True: usize < vsize. */
+
+ /* Make life simple: Recurse. */
+
+ if (usize != 0)
+ {
+ mpn_mul (tspace, vp, vsize, up, usize);
+ cy = mpn_add_n (prodp, prodp, tspace, vsize);
+ mpn_add_1 (prodp + vsize, tspace + vsize, usize, cy);
+ }
+
+ TMP_FREE (marker);
+ return *prod_endp;
+}
diff --git a/sysdeps/generic/mul_1.c b/sysdeps/generic/mul_1.c
new file mode 100644
index 0000000000..1c36b5fb1f
--- /dev/null
+++ b/sysdeps/generic/mul_1.c
@@ -0,0 +1,59 @@
+/* mpn_mul_1 -- Multiply a limb vector with a single limb and
+ store the product in a second limb vector.
+
+Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+mp_limb_t
+mpn_mul_1 (res_ptr, s1_ptr, s1_size, s2_limb)
+ register mp_ptr res_ptr;
+ register mp_srcptr s1_ptr;
+ mp_size_t s1_size;
+ register mp_limb_t s2_limb;
+{
+ register mp_limb_t cy_limb;
+ register mp_size_t j;
+ register mp_limb_t prod_high, prod_low;
+
+ /* The loop counter and index J goes from -S1_SIZE to -1. This way
+ the loop becomes faster. */
+ j = -s1_size;
+
+ /* Offset the base pointers to compensate for the negative indices. */
+ s1_ptr -= j;
+ res_ptr -= j;
+
+ cy_limb = 0;
+ do
+ {
+ umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb);
+
+ prod_low += cy_limb;
+ cy_limb = (prod_low < cy_limb) + prod_high;
+
+ res_ptr[j] = prod_low;
+ }
+ while (++j != 0);
+
+ return cy_limb;
+}
diff --git a/sysdeps/generic/mul_n.c b/sysdeps/generic/mul_n.c
new file mode 100644
index 0000000000..2120cd4f59
--- /dev/null
+++ b/sysdeps/generic/mul_n.c
@@ -0,0 +1,401 @@
+/* mpn_mul_n -- Multiply two natural numbers of length n.
+
+Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+/* Multiply the natural numbers u (pointed to by UP) and v (pointed to by VP),
+ both with SIZE limbs, and store the result at PRODP. 2 * SIZE limbs are
+ always stored. Return the most significant limb.
+
+ Argument constraints:
+ 1. PRODP != UP and PRODP != VP, i.e. the destination
+ must be distinct from the multiplier and the multiplicand. */
+
+/* If KARATSUBA_THRESHOLD is not already defined, define it to a
+ value which is good on most machines. */
+#ifndef KARATSUBA_THRESHOLD
+#define KARATSUBA_THRESHOLD 32
+#endif
+
+/* The code can't handle KARATSUBA_THRESHOLD smaller than 2. */
+#if KARATSUBA_THRESHOLD < 2
+#undef KARATSUBA_THRESHOLD
+#define KARATSUBA_THRESHOLD 2
+#endif
+
+/* Handle simple cases with traditional multiplication.
+
+ This is the most critical code of multiplication. All multiplies rely
+ on this, both small and huge. Small ones arrive here immediately. Huge
+ ones arrive here as this is the base case for Karatsuba's recursive
+ algorithm below. */
+
+void
+#if __STDC__
+impn_mul_n_basecase (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
+#else
+impn_mul_n_basecase (prodp, up, vp, size)
+ mp_ptr prodp;
+ mp_srcptr up;
+ mp_srcptr vp;
+ mp_size_t size;
+#endif
+{
+ mp_size_t i;
+ mp_limb_t cy_limb;
+ mp_limb_t v_limb;
+
+ /* Multiply by the first limb in V separately, as the result can be
+ stored (not added) to PROD. We also avoid a loop for zeroing. */
+ v_limb = vp[0];
+ if (v_limb <= 1)
+ {
+ if (v_limb == 1)
+ MPN_COPY (prodp, up, size);
+ else
+ MPN_ZERO (prodp, size);
+ cy_limb = 0;
+ }
+ else
+ cy_limb = mpn_mul_1 (prodp, up, size, v_limb);
+
+ prodp[size] = cy_limb;
+ prodp++;
+
+ /* For each iteration in the outer loop, multiply one limb from
+ U with one limb from V, and add it to PROD. */
+ for (i = 1; i < size; i++)
+ {
+ v_limb = vp[i];
+ if (v_limb <= 1)
+ {
+ cy_limb = 0;
+ if (v_limb == 1)
+ cy_limb = mpn_add_n (prodp, prodp, up, size);
+ }
+ else
+ cy_limb = mpn_addmul_1 (prodp, up, size, v_limb);
+
+ prodp[size] = cy_limb;
+ prodp++;
+ }
+}
+
+void
+#if __STDC__
+impn_mul_n (mp_ptr prodp,
+ mp_srcptr up, mp_srcptr vp, mp_size_t size, mp_ptr tspace)
+#else
+impn_mul_n (prodp, up, vp, size, tspace)
+ mp_ptr prodp;
+ mp_srcptr up;
+ mp_srcptr vp;
+ mp_size_t size;
+ mp_ptr tspace;
+#endif
+{
+ if ((size & 1) != 0)
+ {
+ /* The size is odd, the code code below doesn't handle that.
+ Multiply the least significant (size - 1) limbs with a recursive
+ call, and handle the most significant limb of S1 and S2
+ separately. */
+ /* A slightly faster way to do this would be to make the Karatsuba
+ code below behave as if the size were even, and let it check for
+ odd size in the end. I.e., in essence move this code to the end.
+ Doing so would save us a recursive call, and potentially make the
+ stack grow a lot less. */
+
+ mp_size_t esize = size - 1; /* even size */
+ mp_limb_t cy_limb;
+
+ MPN_MUL_N_RECURSE (prodp, up, vp, esize, tspace);
+ cy_limb = mpn_addmul_1 (prodp + esize, up, esize, vp[esize]);
+ prodp[esize + esize] = cy_limb;
+ cy_limb = mpn_addmul_1 (prodp + esize, vp, size, up[esize]);
+
+ prodp[esize + size] = cy_limb;
+ }
+ else
+ {
+ /* Anatolij Alekseevich Karatsuba's divide-and-conquer algorithm.
+
+ Split U in two pieces, U1 and U0, such that
+ U = U0 + U1*(B**n),
+ and V in V1 and V0, such that
+ V = V0 + V1*(B**n).
+
+ UV is then computed recursively using the identity
+
+ 2n n n n
+ UV = (B + B )U V + B (U -U )(V -V ) + (B + 1)U V
+ 1 1 1 0 0 1 0 0
+
+ Where B = 2**BITS_PER_MP_LIMB. */
+
+ mp_size_t hsize = size >> 1;
+ mp_limb_t cy;
+ int negflg;
+
+ /*** Product H. ________________ ________________
+ |_____U1 x V1____||____U0 x V0_____| */
+ /* Put result in upper part of PROD and pass low part of TSPACE
+ as new TSPACE. */
+ MPN_MUL_N_RECURSE (prodp + size, up + hsize, vp + hsize, hsize, tspace);
+
+ /*** Product M. ________________
+ |_(U1-U0)(V0-V1)_| */
+ if (mpn_cmp (up + hsize, up, hsize) >= 0)
+ {
+ mpn_sub_n (prodp, up + hsize, up, hsize);
+ negflg = 0;
+ }
+ else
+ {
+ mpn_sub_n (prodp, up, up + hsize, hsize);
+ negflg = 1;
+ }
+ if (mpn_cmp (vp + hsize, vp, hsize) >= 0)
+ {
+ mpn_sub_n (prodp + hsize, vp + hsize, vp, hsize);
+ negflg ^= 1;
+ }
+ else
+ {
+ mpn_sub_n (prodp + hsize, vp, vp + hsize, hsize);
+ /* No change of NEGFLG. */
+ }
+ /* Read temporary operands from low part of PROD.
+ Put result in low part of TSPACE using upper part of TSPACE
+ as new TSPACE. */
+ MPN_MUL_N_RECURSE (tspace, prodp, prodp + hsize, hsize, tspace + size);
+
+ /*** Add/copy product H. */
+ MPN_COPY (prodp + hsize, prodp + size, hsize);
+ cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize);
+
+ /*** Add product M (if NEGFLG M is a negative number). */
+ if (negflg)
+ cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size);
+ else
+ cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size);
+
+ /*** Product L. ________________ ________________
+ |________________||____U0 x V0_____| */
+ /* Read temporary operands from low part of PROD.
+ Put result in low part of TSPACE using upper part of TSPACE
+ as new TSPACE. */
+ MPN_MUL_N_RECURSE (tspace, up, vp, hsize, tspace + size);
+
+ /*** Add/copy Product L (twice). */
+
+ cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size);
+ if (cy)
+ mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy);
+
+ MPN_COPY (prodp, tspace, hsize);
+ cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize);
+ if (cy)
+ mpn_add_1 (prodp + size, prodp + size, size, 1);
+ }
+}
+
+void
+#if __STDC__
+impn_sqr_n_basecase (mp_ptr prodp, mp_srcptr up, mp_size_t size)
+#else
+impn_sqr_n_basecase (prodp, up, size)
+ mp_ptr prodp;
+ mp_srcptr up;
+ mp_size_t size;
+#endif
+{
+ mp_size_t i;
+ mp_limb_t cy_limb;
+ mp_limb_t v_limb;
+
+ /* Multiply by the first limb in V separately, as the result can be
+ stored (not added) to PROD. We also avoid a loop for zeroing. */
+ v_limb = up[0];
+ if (v_limb <= 1)
+ {
+ if (v_limb == 1)
+ MPN_COPY (prodp, up, size);
+ else
+ MPN_ZERO (prodp, size);
+ cy_limb = 0;
+ }
+ else
+ cy_limb = mpn_mul_1 (prodp, up, size, v_limb);
+
+ prodp[size] = cy_limb;
+ prodp++;
+
+ /* For each iteration in the outer loop, multiply one limb from
+ U with one limb from V, and add it to PROD. */
+ for (i = 1; i < size; i++)
+ {
+ v_limb = up[i];
+ if (v_limb <= 1)
+ {
+ cy_limb = 0;
+ if (v_limb == 1)
+ cy_limb = mpn_add_n (prodp, prodp, up, size);
+ }
+ else
+ cy_limb = mpn_addmul_1 (prodp, up, size, v_limb);
+
+ prodp[size] = cy_limb;
+ prodp++;
+ }
+}
+
+void
+#if __STDC__
+impn_sqr_n (mp_ptr prodp,
+ mp_srcptr up, mp_size_t size, mp_ptr tspace)
+#else
+impn_sqr_n (prodp, up, size, tspace)
+ mp_ptr prodp;
+ mp_srcptr up;
+ mp_size_t size;
+ mp_ptr tspace;
+#endif
+{
+ if ((size & 1) != 0)
+ {
+ /* The size is odd, the code code below doesn't handle that.
+ Multiply the least significant (size - 1) limbs with a recursive
+ call, and handle the most significant limb of S1 and S2
+ separately. */
+ /* A slightly faster way to do this would be to make the Karatsuba
+ code below behave as if the size were even, and let it check for
+ odd size in the end. I.e., in essence move this code to the end.
+ Doing so would save us a recursive call, and potentially make the
+ stack grow a lot less. */
+
+ mp_size_t esize = size - 1; /* even size */
+ mp_limb_t cy_limb;
+
+ MPN_SQR_N_RECURSE (prodp, up, esize, tspace);
+ cy_limb = mpn_addmul_1 (prodp + esize, up, esize, up[esize]);
+ prodp[esize + esize] = cy_limb;
+ cy_limb = mpn_addmul_1 (prodp + esize, up, size, up[esize]);
+
+ prodp[esize + size] = cy_limb;
+ }
+ else
+ {
+ mp_size_t hsize = size >> 1;
+ mp_limb_t cy;
+
+ /*** Product H. ________________ ________________
+ |_____U1 x U1____||____U0 x U0_____| */
+ /* Put result in upper part of PROD and pass low part of TSPACE
+ as new TSPACE. */
+ MPN_SQR_N_RECURSE (prodp + size, up + hsize, hsize, tspace);
+
+ /*** Product M. ________________
+ |_(U1-U0)(U0-U1)_| */
+ if (mpn_cmp (up + hsize, up, hsize) >= 0)
+ {
+ mpn_sub_n (prodp, up + hsize, up, hsize);
+ }
+ else
+ {
+ mpn_sub_n (prodp, up, up + hsize, hsize);
+ }
+
+ /* Read temporary operands from low part of PROD.
+ Put result in low part of TSPACE using upper part of TSPACE
+ as new TSPACE. */
+ MPN_SQR_N_RECURSE (tspace, prodp, hsize, tspace + size);
+
+ /*** Add/copy product H. */
+ MPN_COPY (prodp + hsize, prodp + size, hsize);
+ cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize);
+
+ /*** Add product M (if NEGFLG M is a negative number). */
+ cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size);
+
+ /*** Product L. ________________ ________________
+ |________________||____U0 x U0_____| */
+ /* Read temporary operands from low part of PROD.
+ Put result in low part of TSPACE using upper part of TSPACE
+ as new TSPACE. */
+ MPN_SQR_N_RECURSE (tspace, up, hsize, tspace + size);
+
+ /*** Add/copy Product L (twice). */
+
+ cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size);
+ if (cy)
+ mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy);
+
+ MPN_COPY (prodp, tspace, hsize);
+ cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize);
+ if (cy)
+ mpn_add_1 (prodp + size, prodp + size, size, 1);
+ }
+}
+
+/* This should be made into an inline function in gmp.h. */
+void
+#if __STDC__
+mpn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
+#else
+mpn_mul_n (prodp, up, vp, size)
+ mp_ptr prodp;
+ mp_srcptr up;
+ mp_srcptr vp;
+ mp_size_t size;
+#endif
+{
+ TMP_DECL (marker);
+ TMP_MARK (marker);
+ if (up == vp)
+ {
+ if (size < KARATSUBA_THRESHOLD)
+ {
+ impn_sqr_n_basecase (prodp, up, size);
+ }
+ else
+ {
+ mp_ptr tspace;
+ tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB);
+ impn_sqr_n (prodp, up, size, tspace);
+ }
+ }
+ else
+ {
+ if (size < KARATSUBA_THRESHOLD)
+ {
+ impn_mul_n_basecase (prodp, up, vp, size);
+ }
+ else
+ {
+ mp_ptr tspace;
+ tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB);
+ impn_mul_n (prodp, up, vp, size, tspace);
+ }
+ }
+ TMP_FREE (marker);
+}
diff --git a/sysdeps/generic/munlock.c b/sysdeps/generic/munlock.c
new file mode 100644
index 0000000000..3c728c01d5
--- /dev/null
+++ b/sysdeps/generic/munlock.c
@@ -0,0 +1,34 @@
+/* munlock -- undo the effects of prior mlock calls. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Undo the effects on these whole pages of any prior mlock calls. */
+
+int
+munlock (const void *addr, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (munlock)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/munlockall.c b/sysdeps/generic/munlockall.c
new file mode 100644
index 0000000000..ca7198265f
--- /dev/null
+++ b/sysdeps/generic/munlockall.c
@@ -0,0 +1,34 @@
+/* munlockall -- undo the effects of all prior mlock calls. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Undo the effects of all prior mlock calls in this process. */
+
+int
+munlockall (void)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (munlockall)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/munmap.c b/sysdeps/generic/munmap.c
new file mode 100644
index 0000000000..4a78c324ad
--- /dev/null
+++ b/sysdeps/generic/munmap.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Deallocate any mapping for the region starting at ADDR and extending LEN
+ bytes. Returns 0 if successful, -1 for errors (and sets errno). */
+
+int
+__munmap (__ptr_t addr, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (munmap)
+#include <stub-tag.h>
+weak_alias (__munmap, munmap)
diff --git a/sysdeps/generic/nanosleep.c b/sysdeps/generic/nanosleep.c
new file mode 100644
index 0000000000..7a2138b6f1
--- /dev/null
+++ b/sysdeps/generic/nanosleep.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+
+/* Pause execution for a number of nanoseconds. */
+int
+__libc_nanosleep (const struct timespec *requested_time,
+ struct timespec *remaining)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (nanosleep)
+
+weak_alias (__libc_nanosleep, __nanosleep)
+libc_hidden_def (__nanosleep)
+weak_alias (__libc_nanosleep, nanosleep)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/nice.c b/sysdeps/generic/nice.c
new file mode 100644
index 0000000000..8561931af7
--- /dev/null
+++ b/sysdeps/generic/nice.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Increment the scheduling priority of the calling process by INCR.
+ The superuser may use a negative INCR to decrement the priority. */
+int
+nice (incr)
+ int incr;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (nice)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
index 427be6475f..396e0421f9 100644
--- a/sysdeps/generic/not-cancel.h
+++ b/sysdeps/generic/not-cancel.h
@@ -1,5 +1,5 @@
/* Uncancelable versions of cancelable interfaces. Generic version.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -23,14 +23,6 @@
__libc_open (name, flags, mode)
#define open_not_cancel_2(name, flags) \
__libc_open (name, flags)
-#define openat_not_cancel(fd, name, flags, mode) \
- __openat (fd, name, flags, mode)
-#define openat_not_cancel_3(fd, name, flags) \
- __openat (fd, name, flags, 0)
-#define openat64_not_cancel(fd, name, flags, mode) \
- __openat64 (fd, name, flags, mode)
-#define openat64_not_cancel_3(fd, name, flags) \
- __openat64 (fd, name, flags, 0)
#define close_not_cancel(fd) \
__close (fd)
#define close_not_cancel_no_status(fd) \
diff --git a/sysdeps/generic/nscd_setup_thread.c b/sysdeps/generic/nscd_setup_thread.c
new file mode 100644
index 0000000000..8ebc050b4a
--- /dev/null
+++ b/sysdeps/generic/nscd_setup_thread.c
@@ -0,0 +1,28 @@
+/* Setup of nscd worker threads. Stub verison.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <nscd.h>
+
+
+void
+setup_thread (struct database_dyn *db)
+{
+ /* Nothing. */
+}
diff --git a/sysdeps/generic/open.c b/sysdeps/generic/open.c
new file mode 100644
index 0000000000..188110b3f3
--- /dev/null
+++ b/sysdeps/generic/open.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+ a third argument is the file protection. */
+int
+__open (file, oflag)
+ const char *file;
+ int oflag;
+{
+ int mode;
+
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start(arg, oflag);
+ mode = va_arg(arg, int);
+ va_end(arg);
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__open)
+stub_warning (open)
+
+weak_alias (__open, open)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/open64.c b/sysdeps/generic/open64.c
new file mode 100644
index 0000000000..d9a38112ac
--- /dev/null
+++ b/sysdeps/generic/open64.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999, 2000, 2002
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <bp-sym.h>
+
+/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+ a third argument is the file protection. */
+int
+__libc_open64 (file, oflag)
+ const char *file;
+ int oflag;
+{
+ int mode;
+
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, int);
+ va_end (arg);
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+strong_alias (__libc_open64, __open64)
+libc_hidden_def (__open64)
+weak_alias (__libc_open64, BP_SYM (open64))
+
+stub_warning (open64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/opendir.c b/sysdeps/generic/opendir.c
new file mode 100644
index 0000000000..771013f6eb
--- /dev/null
+++ b/sysdeps/generic/opendir.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+
+/* Open a directory stream on NAME. */
+DIR *
+__opendir (const char *name)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__opendir, opendir)
+
+stub_warning (opendir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/opensock.c b/sysdeps/generic/opensock.c
new file mode 100644
index 0000000000..4a4d5dd385
--- /dev/null
+++ b/sysdeps/generic/opensock.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <sys/socket.h>
+#include <bits/libc-lock.h>
+
+/* Return a socket of any type. The socket can be used in subsequent
+ ioctl calls to talk to the kernel. */
+int internal_function
+__opensock (void)
+{
+ /* Cache the last AF that worked, to avoid many redundant calls to
+ socket(). */
+ static int sock_af = -1;
+ int fd = -1;
+ __libc_lock_define_initialized (static, lock);
+
+ if (sock_af != -1)
+ {
+ fd = __socket (sock_af, SOCK_DGRAM, 0);
+ if (fd != -1)
+ return fd;
+ }
+
+ __libc_lock_lock (lock);
+
+ if (sock_af != -1)
+ fd = __socket (sock_af, SOCK_DGRAM, 0);
+
+ if (fd == -1)
+ {
+#ifdef AF_INET
+ fd = __socket (sock_af = AF_INET, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_INET6
+ if (fd < 0)
+ fd = __socket (sock_af = AF_INET6, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_IPX
+ if (fd < 0)
+ fd = __socket (sock_af = AF_IPX, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_AX25
+ if (fd < 0)
+ fd = __socket (sock_af = AF_AX25, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_APPLETALK
+ if (fd < 0)
+ fd = __socket (sock_af = AF_APPLETALK, SOCK_DGRAM, 0);
+#endif
+ }
+
+ __libc_lock_unlock (lock);
+ return fd;
+}
diff --git a/sysdeps/generic/pathconf.c b/sysdeps/generic/pathconf.c
new file mode 100644
index 0000000000..6ac5d31902
--- /dev/null
+++ b/sysdeps/generic/pathconf.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Get file-specific information about PATH. */
+long int
+__pathconf (path, name)
+ const char *path;
+ int name;
+{
+ if (path == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ return __fpathconf (0, name);
+}
+
+weak_alias (__pathconf, pathconf)
+
+stub_warning (pathconf)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/pause.c b/sysdeps/generic/pause.c
new file mode 100644
index 0000000000..2e34b436f1
--- /dev/null
+++ b/sysdeps/generic/pause.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+
+/* Suspend the process until a signal arrives.
+ This is supposed to always return -1 and set errno to EINTR,
+ but rules were meant to be broken. */
+int
+pause ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (pause)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/pipe.c b/sysdeps/generic/pipe.c
new file mode 100644
index 0000000000..babaf9c24b
--- /dev/null
+++ b/sysdeps/generic/pipe.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1995, 1996, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+/* Create a one-way communication channel (__pipe).
+ If successful, two file descriptors are stored in PIPEDES;
+ bytes written on PIPEDES[1] can be read from PIPEDES[0].
+ Returns 0 if successful, -1 if not. */
+int
+__pipe (__pipedes)
+ int __pipedes[2];
+{
+ if (__pipedes == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__pipe)
+stub_warning (pipe)
+
+weak_alias (__pipe, pipe)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/poll.c b/sysdeps/generic/poll.c
new file mode 100644
index 0000000000..9f2f191764
--- /dev/null
+++ b/sysdeps/generic/poll.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1994, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/poll.h>
+#include <errno.h>
+
+/* Poll the file descriptors described by the NFDS structures starting at
+ FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
+ an event to occur; if TIMEOUT is -1, block until an event occurs.
+ Returns the number of file descriptors with events, zero if timed out,
+ or -1 for errors. */
+
+int
+poll (fds, nfds, timeout)
+ struct pollfd *fds;
+ nfds_t nfds;
+ int timeout;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (poll)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fadvise.c b/sysdeps/generic/posix_fadvise.c
new file mode 100644
index 0000000000..92f8bb8974
--- /dev/null
+++ b/sysdeps/generic/posix_fadvise.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+
+/* Advice the system about the expected behaviour of the application with
+ respect to the file associated with FD. */
+
+int
+posix_fadvise (int fd, __off_t offset, __off_t len, int advise)
+{
+ return ENOSYS;
+}
+stub_warning (posix_fadvise)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fadvise64.c b/sysdeps/generic/posix_fadvise64.c
new file mode 100644
index 0000000000..e7eae5e6e3
--- /dev/null
+++ b/sysdeps/generic/posix_fadvise64.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+
+/* Advice the system about the expected behaviour of the application with
+ respect to the file associated with FD. */
+
+int
+posix_fadvise64 (int fd, __off64_t offset, __off64_t len, int advise)
+{
+ return ENOSYS;
+}
+stub_warning (posix_fadvise64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fallocate.c b/sysdeps/generic/posix_fallocate.c
new file mode 100644
index 0000000000..218b4adbe3
--- /dev/null
+++ b/sysdeps/generic/posix_fallocate.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+
+/* Reserve storage for the data of the file associated with FD. */
+
+int
+posix_fallocate (int fd, __off_t offset, __off_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (posix_fallocate)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fallocate64.c b/sysdeps/generic/posix_fallocate64.c
new file mode 100644
index 0000000000..80c1cd385d
--- /dev/null
+++ b/sysdeps/generic/posix_fallocate64.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+
+/* Reserve storage for the data of the file associated with FD. */
+
+int
+posix_fallocate64 (int fd, __off64_t offset, __off64_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (posix_fallocate64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_madvise.c b/sysdeps/generic/posix_madvise.c
new file mode 100644
index 0000000000..6f8d60f55f
--- /dev/null
+++ b/sysdeps/generic/posix_madvise.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Advise the system about particular usage patterns the program follows
+ for the region starting at ADDR and extending LEN bytes. */
+
+int
+posix_madvise (__ptr_t addr, size_t len, int advice)
+{
+ return ENOSYS;
+}
+stub_warning (posix_madvise)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/pread.c b/sysdeps/generic/pread.c
new file mode 100644
index 0000000000..5c79dd526d
--- /dev/null
+++ b/sysdeps/generic/pread.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Read NBYTES into BUF from FD at the given position OFFSET without
+ changing the file pointer. Return the number read or -1. */
+ssize_t
+__libc_pread (int fd, void *buf, size_t nbytes, off_t offset)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || offset < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+strong_alias (__libc_pread, __pread)
+weak_alias (__libc_pread, pread)
+stub_warning (pread)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/pread64.c b/sysdeps/generic/pread64.c
new file mode 100644
index 0000000000..68316579c6
--- /dev/null
+++ b/sysdeps/generic/pread64.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Read NBYTES into BUF from FD at the given position OFFSET without
+ changing the file pointer. Return the number read or -1. */
+ssize_t
+__libc_pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || offset < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+strong_alias (__libc_pread64, __pread64)
+weak_alias (__libc_pread64, pread64)
+stub_warning (pread64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/printf_fphex.c b/sysdeps/generic/printf_fphex.c
new file mode 100644
index 0000000000..fd790d5bf3
--- /dev/null
+++ b/sysdeps/generic/printf_fphex.c
@@ -0,0 +1,490 @@
+/* Print floating point number in hexadecimal notation according to ISO C99.
+ Copyright (C) 1997-2002,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ctype.h>
+#include <ieee754.h>
+#include <math.h>
+#include <printf.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include "_itoa.h"
+#include "_itowa.h"
+#include <locale/localeinfo.h>
+
+/* #define NDEBUG 1*/ /* Undefine this for debugging assertions. */
+#include <assert.h>
+
+/* This defines make it possible to use the same code for GNU C library and
+ the GNU I/O library. */
+#ifdef USE_IN_LIBIO
+# include <libioP.h>
+# define PUT(f, s, n) _IO_sputn (f, s, n)
+# define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n))
+/* We use this file GNU C library and GNU I/O library. So make
+ names equal. */
+# undef putc
+# define putc(c, f) (wide \
+ ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
+# define size_t _IO_size_t
+# define FILE _IO_FILE
+#else /* ! USE_IN_LIBIO */
+# define PUT(f, s, n) fwrite (s, 1, n, f)
+# define PAD(f, c, n) __printf_pad (f, c, n)
+ssize_t __printf_pad (FILE *, char pad, int n) __THROW; /* In vfprintf.c. */
+#endif /* USE_IN_LIBIO */
+
+/* Macros for doing the actual output. */
+
+#define outchar(ch) \
+ do \
+ { \
+ register const int outc = (ch); \
+ if (putc (outc, fp) == EOF) \
+ return -1; \
+ ++done; \
+ } while (0)
+
+#define PRINT(ptr, wptr, len) \
+ do \
+ { \
+ register size_t outlen = (len); \
+ if (wide) \
+ while (outlen-- > 0) \
+ outchar (*wptr++); \
+ else \
+ while (outlen-- > 0) \
+ outchar (*ptr++); \
+ } while (0)
+
+#define PADN(ch, len) \
+ do \
+ { \
+ if (PAD (fp, ch, len) != len) \
+ return -1; \
+ done += len; \
+ } \
+ while (0)
+
+#ifndef MIN
+# define MIN(a,b) ((a)<(b)?(a):(b))
+#endif
+
+
+int
+__printf_fphex (FILE *fp,
+ const struct printf_info *info,
+ const void *const *args)
+{
+ /* The floating-point value to output. */
+ union
+ {
+ union ieee754_double dbl;
+ union ieee854_long_double ldbl;
+ }
+ fpnum;
+
+ /* Locale-dependent representation of decimal point. */
+ const char *decimal;
+ wchar_t decimalwc;
+
+ /* "NaN" or "Inf" for the special cases. */
+ const char *special = NULL;
+ const wchar_t *wspecial = NULL;
+
+ /* Buffer for the generated number string for the mantissa. The
+ maximal size for the mantissa is 128 bits. */
+ char numbuf[32];
+ char *numstr;
+ char *numend;
+ wchar_t wnumbuf[32];
+ wchar_t *wnumstr;
+ wchar_t *wnumend;
+ int negative;
+
+ /* The maximal exponent of two in decimal notation has 5 digits. */
+ char expbuf[5];
+ char *expstr;
+ wchar_t wexpbuf[5];
+ wchar_t *wexpstr;
+ int expnegative;
+ int exponent;
+
+ /* Non-zero is mantissa is zero. */
+ int zero_mantissa;
+
+ /* The leading digit before the decimal point. */
+ char leading;
+
+ /* Precision. */
+ int precision = info->prec;
+
+ /* Width. */
+ int width = info->width;
+
+ /* Number of characters written. */
+ int done = 0;
+
+ /* Nonzero if this is output on a wide character stream. */
+ int wide = info->wide;
+
+
+ /* Figure out the decimal point character. */
+ if (info->extra == 0)
+ {
+ decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+ decimalwc = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC);
+ }
+ else
+ {
+ decimal = _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
+ decimalwc = _NL_CURRENT_WORD (LC_MONETARY,
+ _NL_MONETARY_DECIMAL_POINT_WC);
+ }
+ /* The decimal point character must never be zero. */
+ assert (*decimal != '\0' && decimalwc != L'\0');
+
+
+ /* Fetch the argument value. */
+#ifndef __NO_LONG_DOUBLE_MATH
+ if (info->is_long_double && sizeof (long double) > sizeof (double))
+ {
+ fpnum.ldbl.d = *(const long double *) args[0];
+
+ /* Check for special values: not a number or infinity. */
+ if (__isnanl (fpnum.ldbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "NAN";
+ wspecial = L"NAN";
+ }
+ else
+ {
+ special = "nan";
+ wspecial = L"nan";
+ }
+ negative = 0;
+ }
+ else
+ {
+ if (__isinfl (fpnum.ldbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "INF";
+ wspecial = L"INF";
+ }
+ else
+ {
+ special = "inf";
+ wspecial = L"inf";
+ }
+ }
+
+ negative = signbit (fpnum.ldbl.d);
+ }
+ }
+ else
+#endif /* no long double */
+ {
+ fpnum.dbl.d = *(const double *) args[0];
+
+ /* Check for special values: not a number or infinity. */
+ if (__isnan (fpnum.dbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "NAN";
+ wspecial = L"NAN";
+ }
+ else
+ {
+ special = "nan";
+ wspecial = L"nan";
+ }
+ negative = 0;
+ }
+ else
+ {
+ if (__isinf (fpnum.dbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "INF";
+ wspecial = L"INF";
+ }
+ else
+ {
+ special = "inf";
+ wspecial = L"inf";
+ }
+ }
+
+ negative = signbit (fpnum.dbl.d);
+ }
+ }
+
+ if (special)
+ {
+ int width = info->width;
+
+ if (negative || info->showsign || info->space)
+ --width;
+ width -= 3;
+
+ if (!info->left && width > 0)
+ PADN (' ', width);
+
+ if (negative)
+ outchar ('-');
+ else if (info->showsign)
+ outchar ('+');
+ else if (info->space)
+ outchar (' ');
+
+ PRINT (special, wspecial, 3);
+
+ if (info->left && width > 0)
+ PADN (' ', width);
+
+ return done;
+ }
+
+ if (info->is_long_double == 0 || sizeof (double) == sizeof (long double))
+ {
+ /* We have 52 bits of mantissa plus one implicit digit. Since
+ 52 bits are representable without rest using hexadecimal
+ digits we use only the implicit digits for the number before
+ the decimal point. */
+ unsigned long long int num;
+
+ num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
+ | fpnum.dbl.ieee.mantissa1);
+
+ zero_mantissa = num == 0;
+
+ if (sizeof (unsigned long int) > 6)
+ {
+ wnumstr = _itowa_word (num, wnumbuf + (sizeof wnumbuf) / sizeof (wchar_t), 16,
+ info->spec == 'A');
+ numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+ info->spec == 'A');
+ }
+ else
+ {
+ wnumstr = _itowa (num, wnumbuf + sizeof wnumbuf / sizeof (wchar_t), 16,
+ info->spec == 'A');
+ numstr = _itoa (num, numbuf + sizeof numbuf, 16,
+ info->spec == 'A');
+ }
+
+ /* Fill with zeroes. */
+ while (wnumstr > wnumbuf + (sizeof wnumbuf - 52) / sizeof (wchar_t))
+ {
+ *--wnumstr = L'0';
+ *--numstr = '0';
+ }
+
+ leading = fpnum.dbl.ieee.exponent == 0 ? '0' : '1';
+
+ exponent = fpnum.dbl.ieee.exponent;
+
+ if (exponent == 0)
+ {
+ if (zero_mantissa)
+ expnegative = 0;
+ else
+ {
+ /* This is a denormalized number. */
+ expnegative = 1;
+ exponent = IEEE754_DOUBLE_BIAS - 1;
+ }
+ }
+ else if (exponent >= IEEE754_DOUBLE_BIAS)
+ {
+ expnegative = 0;
+ exponent -= IEEE754_DOUBLE_BIAS;
+ }
+ else
+ {
+ expnegative = 1;
+ exponent = -(exponent - IEEE754_DOUBLE_BIAS);
+ }
+ }
+#ifdef PRINT_FPHEX_LONG_DOUBLE
+ else
+ PRINT_FPHEX_LONG_DOUBLE;
+#endif
+
+ /* Look for trailing zeroes. */
+ if (! zero_mantissa)
+ {
+ wnumend = &wnumbuf[sizeof wnumbuf / sizeof wnumbuf[0]];
+ numend = &numbuf[sizeof numbuf / sizeof numbuf[0]];
+ while (wnumend[-1] == L'0')
+ {
+ --wnumend;
+ --numend;
+ }
+
+ if (precision == -1)
+ precision = numend - numstr;
+ else if (precision < numend - numstr
+ && (numstr[precision] > '8'
+ || (('A' < '0' || 'a' < '0')
+ && numstr[precision] < '0')
+ || (numstr[precision] == '8'
+ && (precision + 1 < numend - numstr
+ /* Round to even. */
+ || (precision > 0
+ && ((numstr[precision - 1] & 1)
+ ^ (isdigit (numstr[precision - 1]) == 0)))
+ || (precision == 0
+ && ((leading & 1)
+ ^ (isdigit (leading) == 0)))))))
+ {
+ /* Round up. */
+ int cnt = precision;
+ while (--cnt >= 0)
+ {
+ char ch = numstr[cnt];
+ /* We assume that the digits and the letters are ordered
+ like in ASCII. This is true for the rest of GNU, too. */
+ if (ch == '9')
+ {
+ wnumstr[cnt] = (wchar_t) info->spec;
+ numstr[cnt] = info->spec; /* This is tricky,
+ think about it! */
+ break;
+ }
+ else if (tolower (ch) < 'f')
+ {
+ ++numstr[cnt];
+ ++wnumstr[cnt];
+ break;
+ }
+ else
+ {
+ numstr[cnt] = '0';
+ wnumstr[cnt] = L'0';
+ }
+ }
+ if (cnt < 0)
+ {
+ /* The mantissa so far was fff...f Now increment the
+ leading digit. Here it is again possible that we
+ get an overflow. */
+ if (leading == '9')
+ leading = info->spec;
+ else if (tolower (leading) < 'f')
+ ++leading;
+ else
+ {
+ leading = 1;
+ if (expnegative)
+ {
+ exponent += 4;
+ if (exponent >= 0)
+ expnegative = 0;
+ }
+ else
+ exponent += 4;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (precision == -1)
+ precision = 0;
+ numend = numstr;
+ wnumend = wnumstr;
+ }
+
+ /* Now we can compute the exponent string. */
+ expstr = _itoa_word (exponent, expbuf + sizeof expbuf, 10, 0);
+ wexpstr = _itowa_word (exponent,
+ wexpbuf + sizeof wexpbuf / sizeof (wchar_t), 10, 0);
+
+ /* Now we have all information to compute the size. */
+ width -= ((negative || info->showsign || info->space)
+ /* Sign. */
+ + 2 + 1 + 0 + precision + 1 + 1
+ /* 0x h . hhh P ExpoSign. */
+ + ((expbuf + sizeof expbuf) - expstr));
+ /* Exponent. */
+
+ /* Count the decimal point.
+ A special case when the mantissa or the precision is zero and the `#'
+ is not given. In this case we must not print the decimal point. */
+ if (precision > 0 || info->alt)
+ width -= wide ? 1 : strlen (decimal);
+
+ if (!info->left && info->pad != '0' && width > 0)
+ PADN (' ', width);
+
+ if (negative)
+ outchar ('-');
+ else if (info->showsign)
+ outchar ('+');
+ else if (info->space)
+ outchar (' ');
+
+ outchar ('0');
+ if ('X' - 'A' == 'x' - 'a')
+ outchar (info->spec + ('x' - 'a'));
+ else
+ outchar (info->spec == 'A' ? 'X' : 'x');
+
+ if (!info->left && info->pad == '0' && width > 0)
+ PADN ('0', width);
+
+ outchar (leading);
+
+ if (precision > 0 || info->alt)
+ {
+ const wchar_t *wtmp = &decimalwc;
+ PRINT (decimal, wtmp, wide ? 1 : strlen (decimal));
+ }
+
+ if (precision > 0)
+ {
+ ssize_t tofill = precision - (numend - numstr);
+ PRINT (numstr, wnumstr, MIN (numend - numstr, precision));
+ if (tofill > 0)
+ PADN ('0', tofill);
+ }
+
+ if ('P' - 'A' == 'p' - 'a')
+ outchar (info->spec + ('p' - 'a'));
+ else
+ outchar (info->spec == 'A' ? 'P' : 'p');
+
+ outchar (expnegative ? '-' : '+');
+
+ PRINT (expstr, wexpstr, (expbuf + sizeof expbuf) - expstr);
+
+ if (info->left && info->pad != '0' && width > 0)
+ PADN (info->pad, width);
+
+ return done;
+}
diff --git a/sysdeps/generic/prof-freq.c b/sysdeps/generic/prof-freq.c
new file mode 100644
index 0000000000..ffcc67931b
--- /dev/null
+++ b/sysdeps/generic/prof-freq.c
@@ -0,0 +1,55 @@
+/* Return frequency of ticks reported by profil. Generic version. */
+/*-
+ * Copyright (c) 1983, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <libc-internal.h>
+
+int
+__profile_frequency (void)
+{
+ /*
+ * Discover the tick frequency of the machine if something goes wrong,
+ * we return 0, an impossible hertz.
+ */
+ struct itimerval tim;
+
+ tim.it_interval.tv_sec = 0;
+ tim.it_interval.tv_usec = 1;
+ tim.it_value.tv_sec = 0;
+ tim.it_value.tv_usec = 0;
+ __setitimer(ITIMER_REAL, &tim, 0);
+ __setitimer(ITIMER_REAL, 0, &tim);
+ if (tim.it_interval.tv_usec < 2)
+ return 0;
+ return (1000000 / tim.it_interval.tv_usec);
+}
+libc_hidden_def (__profile_frequency)
diff --git a/sysdeps/generic/profil.c b/sysdeps/generic/profil.c
new file mode 100644
index 0000000000..8736375858
--- /dev/null
+++ b/sysdeps/generic/profil.c
@@ -0,0 +1,42 @@
+/* Low-level statistical profiling support function. Stub version.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+/* Enable statistical profiling, writing samples of the PC into at most
+ SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
+ is enabled, the system examines the user PC and increments
+ SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero,
+ disable profiling. Returns zero on success, -1 on error. */
+
+int
+__profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
+{
+ if (scale == 0)
+ /* Disable profiling. */
+ return 0;
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__profil, profil)
+stub_warning (profil)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/pselect.c b/sysdeps/generic/pselect.c
new file mode 100644
index 0000000000..43b371cce7
--- /dev/null
+++ b/sysdeps/generic/pselect.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 1996,1997,1998,2001,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <stddef.h> /* For NULL. */
+#include <sys/time.h>
+#include <sys/select.h>
+#include <sysdep-cancel.h>
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+ readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+ (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
+ after waiting the interval specified therein. Additionally set the sigmask
+ SIGMASK for this call. Returns the number of ready descriptors, or -1 for
+ errors. */
+static int
+do_pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ struct timeval tval;
+ int retval;
+ sigset_t savemask;
+
+ /* Change nanosecond number to microseconds. This might mean losing
+ precision and therefore the `pselect` should be available. But
+ for now it is hardly found. */
+ if (timeout != NULL)
+ TIMESPEC_TO_TIMEVAL (&tval, timeout);
+
+ /* The setting and restoring of the signal mask and the select call
+ should be an atomic operation. This can't be done without kernel
+ help. */
+ if (sigmask != NULL)
+ __sigprocmask (SIG_SETMASK, sigmask, &savemask);
+
+ /* Note the pselect() is a cancellation point. But since we call
+ select() which itself is a cancellation point we do not have
+ to do anything here. */
+ retval = __select (nfds, readfds, writefds, exceptfds,
+ timeout != NULL ? &tval : NULL);
+
+ if (sigmask != NULL)
+ __sigprocmask (SIG_SETMASK, &savemask, NULL);
+
+ return retval;
+}
+
+
+int
+__pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask)
+ int nfds;
+ fd_set *readfds;
+ fd_set *writefds;
+ fd_set *exceptfds;
+ const struct timespec *timeout;
+ const sigset_t *sigmask;
+{
+ if (SINGLE_THREAD_P)
+ return do_pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = do_pselect (nfds, readfds, writefds, exceptfds, timeout,
+ sigmask);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
diff --git a/sysdeps/generic/ptrace.c b/sysdeps/generic/ptrace.c
new file mode 100644
index 0000000000..1825d57143
--- /dev/null
+++ b/sysdeps/generic/ptrace.c
@@ -0,0 +1,103 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/ptrace.h>
+#include <sys/types.h>
+#include <stdarg.h>
+
+/* Perform process tracing functions. REQUEST is one of the values
+ in <sys/ptrace.h>, and determines the action to be taken.
+ For all requests except PTRACE_TRACEME, PID specifies the process to be
+ traced.
+
+ PID and the other arguments described above for the various requests should
+ appear (those that are used for the particular request) as:
+ pid_t PID, void *ADDR, int DATA, void *ADDR2
+ after PID. */
+int
+ptrace (request)
+ enum __ptrace_request request;
+{
+ pid_t pid;
+ void *addr;
+ void *addr2;
+ int data;
+ va_list ap;
+
+ switch (request)
+ {
+ case PTRACE_TRACEME:
+ case PTRACE_CONT:
+ case PTRACE_KILL:
+ case PTRACE_SINGLESTEP:
+ case PTRACE_ATTACH:
+ case PTRACE_DETACH:
+ break;
+
+ case PTRACE_PEEKTEXT:
+ case PTRACE_PEEKDATA:
+ case PTRACE_PEEKUSER:
+ case PTRACE_GETREGS:
+ case PTRACE_SETREGS:
+#ifdef PTRACE_GETFPREGS
+ case PTRACE_GETFPGEGS:
+#endif
+ case PTRACE_SETFPREGS:
+ case PTRACE_GETFPAREGS:
+ case PTRACE_SETFPAREGS:
+ va_start(ap, request);
+ pid = va_arg(ap, pid_t);
+ addr = va_arg(ap, void *);
+ va_end(ap);
+ break;
+
+ case PTRACE_POKETEXT:
+ case PTRACE_POKEDATA:
+ case PTRACE_POKEUSER:
+ va_start(ap, request);
+ pid = va_arg(ap, pid_t);
+ addr = va_arg(ap, void *);
+ data = va_arg(ap, int);
+ va_end(ap);
+ break;
+
+ case PTRACE_READDATA:
+ case PTRACE_WRITEDATA:
+ case PTRACE_READTEXT:
+ case PTRACE_WRITETEXT:
+ va_start(ap, request);
+ pid = va_arg(ap, pid_t);
+ addr = va_arg(ap, void *);
+ data = va_arg(ap, int);
+ addr2 = va_arg(ap, void *);
+ va_end(ap);
+ break;
+
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (ptrace)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ptsname.c b/sysdeps/generic/ptsname.c
new file mode 100644
index 0000000000..c16e056a97
--- /dev/null
+++ b/sysdeps/generic/ptsname.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Given the file descriptor of a master pty, return the pathname
+ of the associated slave. */
+
+char *
+ptsname (fd)
+ int fd __attribute__ ((unused));
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+
+int
+__ptsname_r (fd, buf, len)
+ int fd __attribute__ ((unused));
+ char *buf __attribute__ ((unused));
+ size_t len __attribute__ ((unused));
+{
+ __set_errno (ENOSYS);
+ return ENOSYS;
+}
+weak_alias (__ptsname_r, ptsname_r)
+
+stub_warning(ptsname)
+stub_warning(ptsname_r)
diff --git a/sysdeps/generic/putenv.c b/sysdeps/generic/putenv.c
new file mode 100644
index 0000000000..4e8693403a
--- /dev/null
+++ b/sysdeps/generic/putenv.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 1991, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if defined _AIX && !defined __GNUC__
+ #pragma alloca
+#endif
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if _LIBC || HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if _LIBC || HAVE_STRING_H
+# include <string.h>
+#endif
+
+#if !__GNU_LIBRARY__ && !HAVE_STRCHR
+# define strchr index
+#endif
+
+#ifndef _LIBC
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef __GNUC__
+# define alloca __builtin_alloca
+# else
+extern char *alloca ();
+# endif /* __GNUC__ */
+# endif /* HAVE_ALLOCA_H */
+#endif /* _LIBC */
+
+
+/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
+int
+putenv (string)
+ char *string;
+{
+ const char *const name_end = strchr (string, '=');
+
+ if (name_end != NULL)
+ {
+#ifdef _LIBC
+ char *name = strndupa (string, name_end - string);
+#else
+ char *name = alloca (name_end - string + 1);
+ memcpy (name, string, name_end - string);
+ name[name_end - string] = '\0';
+#endif
+ return __add_to_environ (name, NULL, string, 1);
+ }
+
+ __unsetenv (string);
+ return 0;
+}
diff --git a/sysdeps/generic/putmsg.c b/sysdeps/generic/putmsg.c
new file mode 100644
index 0000000000..b84dd843ba
--- /dev/null
+++ b/sysdeps/generic/putmsg.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+putmsg (fildes, ctlptr, dataptr, flags)
+ int fildes;
+ const struct strbuf *ctlptr;
+ const struct strbuf *dataptr;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (putmsg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/putpmsg.c b/sysdeps/generic/putpmsg.c
new file mode 100644
index 0000000000..6e37036aac
--- /dev/null
+++ b/sysdeps/generic/putpmsg.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stropts.h>
+
+int
+putpmsg (fildes, ctlptr, dataptr, band, flags)
+ int fildes;
+ const struct strbuf *ctlptr;
+ const struct strbuf *dataptr;
+ int band;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (putpmsg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/pututxline.c b/sysdeps/generic/pututxline.c
new file mode 100644
index 0000000000..1ed5178862
--- /dev/null
+++ b/sysdeps/generic/pututxline.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+struct utmpx *
+pututxline (const struct utmpx *utmpx)
+{
+ return (struct utmpx *) __pututline ((const struct utmp *) utmpx);
+}
diff --git a/sysdeps/generic/pwrite.c b/sysdeps/generic/pwrite.c
new file mode 100644
index 0000000000..ec35ecea9c
--- /dev/null
+++ b/sysdeps/generic/pwrite.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Write NBYTES of BUF to FD at given position OFFSET without changing
+ the file position. Return the number written, or -1. */
+ssize_t
+__libc_pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || offset < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+strong_alias (__libc_pwrite, __pwrite)
+weak_alias (__libc_pwrite, pwrite)
+stub_warning (pwrite)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/pwrite64.c b/sysdeps/generic/pwrite64.c
new file mode 100644
index 0000000000..dd14aa0bd7
--- /dev/null
+++ b/sysdeps/generic/pwrite64.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991,1995,1996,1997,1999,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Write NBYTES of BUF to FD at given position OFFSET without changing
+ the file position. Return the number written, or -1. */
+ssize_t
+__libc_pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || offset < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+strong_alias (__libc_pwrite64, __pwrite64)
+libc_hidden_def (__pwrite64)
+weak_alias (__libc_pwrite64, pwrite64)
+stub_warning (pwrite64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/raise.c b/sysdeps/generic/raise.c
new file mode 100644
index 0000000000..c5a449f7bc
--- /dev/null
+++ b/sysdeps/generic/raise.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991,95,96,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <errno.h>
+
+/* Raise the signal SIG. */
+int
+raise (sig)
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (raise, gsignal)
+
+stub_warning (raise)
+stub_warning (gsignal)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/rawmemchr.c b/sysdeps/generic/rawmemchr.c
new file mode 100644
index 0000000000..cb00ad7e90
--- /dev/null
+++ b/sysdeps/generic/rawmemchr.c
@@ -0,0 +1,189 @@
+/* Copyright (C) 1991,93,96,97,99,2000,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#undef __ptr_t
+#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
+# define __ptr_t void *
+#else /* Not C++ or ANSI C. */
+# define __ptr_t char *
+#endif /* C++ or ANSI C. */
+
+#if defined (_LIBC)
+# include <string.h>
+# include <memcopy.h>
+# include <stdlib.h>
+#else
+# define reg_char char
+#endif
+
+#if defined (HAVE_LIMITS_H) || defined (_LIBC)
+# include <limits.h>
+#endif
+
+#define LONG_MAX_32_BITS 2147483647
+
+#ifndef LONG_MAX
+#define LONG_MAX LONG_MAX_32_BITS
+#endif
+
+#include <sys/types.h>
+
+#undef memchr
+
+
+/* Find the first occurrence of C in S. */
+__ptr_t
+__rawmemchr (s, c_in)
+ const __ptr_t s;
+ int c_in;
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s;
+ ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == c)
+ return (__ptr_t) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+
+ if (sizeof (longword) != 4 && sizeof (longword) != 8)
+ abort ();
+
+#if LONG_MAX <= LONG_MAX_32_BITS
+ magic_bits = 0x7efefeff;
+#else
+ magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+#endif
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+#if LONG_MAX > LONG_MAX_32_BITS
+ charmask |= charmask << 32;
+#endif
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (1)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++ ^ charmask;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C? If none of them were, it was
+ a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (cp[0] == c)
+ return (__ptr_t) cp;
+ if (cp[1] == c)
+ return (__ptr_t) &cp[1];
+ if (cp[2] == c)
+ return (__ptr_t) &cp[2];
+ if (cp[3] == c)
+ return (__ptr_t) &cp[3];
+#if LONG_MAX > 2147483647
+ if (cp[4] == c)
+ return (__ptr_t) &cp[4];
+ if (cp[5] == c)
+ return (__ptr_t) &cp[5];
+ if (cp[6] == c)
+ return (__ptr_t) &cp[6];
+ if (cp[7] == c)
+ return (__ptr_t) &cp[7];
+#endif
+ }
+ }
+}
+libc_hidden_def (__rawmemchr)
+weak_alias (__rawmemchr, rawmemchr)
diff --git a/sysdeps/generic/read.c b/sysdeps/generic/read.c
new file mode 100644
index 0000000000..3943edd689
--- /dev/null
+++ b/sysdeps/generic/read.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+/* Read NBYTES into BUF from FD. Return the number read or -1. */
+ssize_t
+__libc_read (int fd, void *buf, size_t nbytes)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__libc_read)
+stub_warning (read)
+
+weak_alias (__libc_read, __read)
+libc_hidden_weak (__read)
+weak_alias (__libc_read, read)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir.c b/sysdeps/generic/readdir.c
new file mode 100644
index 0000000000..893b246d41
--- /dev/null
+++ b/sysdeps/generic/readdir.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP. */
+struct dirent *
+__readdir (DIR *dirp)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__readdir, readdir)
+
+stub_warning (readdir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir64.c b/sysdeps/generic/readdir64.c
new file mode 100644
index 0000000000..0c18bd9440
--- /dev/null
+++ b/sysdeps/generic/readdir64.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP. */
+struct dirent64 *
+__readdir64 (DIR *dirp)
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+weak_alias (__readdir64, readdir64)
+stub_warning (readdir64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir64_r.c b/sysdeps/generic/readdir64_r.c
new file mode 100644
index 0000000000..cf9e952e1a
--- /dev/null
+++ b/sysdeps/generic/readdir64_r.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP, store result in ENTRY and return
+ pointer to result in *RESULT. */
+int
+readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
+{
+ __set_errno (ENOSYS);
+ *result = NULL;
+ return -1;
+}
+stub_warning (readdir64_r)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir_r.c b/sysdeps/generic/readdir_r.c
new file mode 100644
index 0000000000..ad45dfa504
--- /dev/null
+++ b/sysdeps/generic/readdir_r.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Read a directory entry from DIRP, store result in ENTRY and return
+ pointer to result in *RESULT. */
+int
+__readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+ __set_errno (ENOSYS);
+ *result = NULL;
+ return ENOSYS;
+}
+weak_alias (__readdir_r, readdir_r)
+
+stub_warning (readdir_r)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/readelflib.c b/sysdeps/generic/readelflib.c
new file mode 100644
index 0000000000..26444ad6b2
--- /dev/null
+++ b/sysdeps/generic/readelflib.c
@@ -0,0 +1,220 @@
+/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
+ Jakub Jelinek <jakub@redhat.com>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This code is a heavily simplified version of the readelf program
+ that's part of the current binutils development version. For architectures
+ which need to handle both 32bit and 64bit ELF libraries, this file is
+ included twice for each arch size. */
+
+/* check_ptr checks that a pointer is in the mmaped file and doesn't
+ point outside it. */
+#undef check_ptr
+#define check_ptr(ptr) \
+do \
+ { \
+ if ((void *)(ptr) < file_contents \
+ || (void *)(ptr) > (file_contents+file_length)) \
+ { \
+ error (0, 0, _("file %s is truncated\n"), file_name); \
+ return 1; \
+ } \
+ } \
+ while (0);
+
+/* Returns 0 if everything is ok, != 0 in case of error. */
+int
+process_elf_file (const char *file_name, const char *lib, int *flag,
+ unsigned int *osversion, char **soname, void *file_contents,
+ size_t file_length)
+{
+ int i;
+ unsigned int j;
+ ElfW(Addr) loadaddr;
+ unsigned int dynamic_addr;
+ size_t dynamic_size;
+ char *program_interpreter;
+
+ ElfW(Ehdr) *elf_header;
+ ElfW(Phdr) *elf_pheader, *segment;
+ ElfW(Dyn) *dynamic_segment, *dyn_entry;
+ char *dynamic_strings;
+
+ elf_header = (ElfW(Ehdr) *) file_contents;
+ *osversion = 0;
+
+ if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
+ {
+ if (opt_verbose)
+ {
+ if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
+ error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name);
+ else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)
+ error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name);
+ else
+ error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name);
+ }
+ return 1;
+ }
+
+ if (elf_header->e_type != ET_DYN)
+ {
+ error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
+ elf_header->e_type);
+ return 1;
+ }
+
+ /* Get information from elf program header. */
+ elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
+ check_ptr (elf_pheader);
+
+ /* The library is an elf library, now search for soname and
+ libc5/libc6. */
+ *flag = FLAG_ELF;
+
+ loadaddr = -1;
+ dynamic_addr = 0;
+ dynamic_size = 0;
+ program_interpreter = NULL;
+ for (i = 0, segment = elf_pheader;
+ i < elf_header->e_phnum; i++, segment++)
+ {
+ check_ptr (segment);
+
+ switch (segment->p_type)
+ {
+ case PT_LOAD:
+ if (loadaddr == (ElfW(Addr)) -1)
+ loadaddr = segment->p_vaddr - segment->p_offset;
+ break;
+
+ case PT_DYNAMIC:
+ if (dynamic_addr)
+ error (0, 0, _("more than one dynamic segment\n"));
+
+ dynamic_addr = segment->p_offset;
+ dynamic_size = segment->p_filesz;
+ break;
+
+ case PT_INTERP:
+ program_interpreter = (char *) (file_contents + segment->p_offset);
+ check_ptr (program_interpreter);
+
+ /* Check if this is enough to classify the binary. */
+ for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
+ ++j)
+ if (strcmp (program_interpreter, interpreters[j].soname) == 0)
+ {
+ *flag = interpreters[j].flag;
+ break;
+ }
+ break;
+
+ case PT_NOTE:
+ if (!*osversion && segment->p_filesz == 32 && segment->p_align >= 4)
+ {
+ ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents
+ + segment->p_offset);
+ if (abi_note [0] == 4 && abi_note [1] == 16 && abi_note [2] == 1
+ && memcmp (abi_note + 3, "GNU", 4) == 0)
+ *osversion = (abi_note [4] << 24) |
+ ((abi_note [5] & 0xff) << 16) |
+ ((abi_note [6] & 0xff) << 8) |
+ (abi_note [7] & 0xff);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ if (loadaddr == (ElfW(Addr)) -1)
+ {
+ /* Very strange. */
+ loadaddr = 0;
+ }
+
+ /* Now we can read the dynamic sections. */
+ if (dynamic_size == 0)
+ return 1;
+
+ dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr);
+ check_ptr (dynamic_segment);
+
+ /* Find the string table. */
+ dynamic_strings = NULL;
+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
+ ++dyn_entry)
+ {
+ check_ptr (dyn_entry);
+ if (dyn_entry->d_tag == DT_STRTAB)
+ {
+ dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
+ check_ptr (dynamic_strings);
+ break;
+ }
+ }
+
+ if (dynamic_strings == NULL)
+ return 1;
+
+ /* Now read the DT_NEEDED and DT_SONAME entries. */
+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
+ ++dyn_entry)
+ {
+ if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
+ {
+ char *name = dynamic_strings + dyn_entry->d_un.d_val;
+ check_ptr (name);
+
+ if (dyn_entry->d_tag == DT_NEEDED)
+ {
+
+ if (*flag == FLAG_ELF)
+ {
+ /* Check if this is enough to classify the binary. */
+ for (j = 0;
+ j < sizeof (known_libs) / sizeof (known_libs [0]);
+ ++j)
+ if (strcmp (name, known_libs [j].soname) == 0)
+ {
+ *flag = known_libs [j].flag;
+ break;
+ }
+ }
+ }
+
+ else if (dyn_entry->d_tag == DT_SONAME)
+ *soname = xstrdup (name);
+
+ /* Do we have everything we need? */
+ if (*soname && *flag != FLAG_ELF)
+ return 0;
+ }
+ }
+
+ /* We reach this point only if the file doesn't contain a DT_SONAME
+ or if we can't classify the library. If it doesn't have a
+ soname, return the name of the library. */
+ if (*soname == NULL)
+ *soname = xstrdup (lib);
+
+ return 0;
+}
diff --git a/sysdeps/generic/readlink.c b/sysdeps/generic/readlink.c
new file mode 100644
index 0000000000..779b809eaa
--- /dev/null
+++ b/sysdeps/generic/readlink.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Read the contents of the symbolic link PATH into no more than
+ LEN bytes of BUF. The contents are not null-terminated.
+ Returns the number of characters read, or -1 for errors. */
+int
+__readlink (path, buf, len)
+ const char *path;
+ char *buf;
+ size_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (readlink)
+
+weak_alias (__readlink, readlink)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/readonly-area.c b/sysdeps/generic/readonly-area.c
new file mode 100644
index 0000000000..4b8172f193
--- /dev/null
+++ b/sysdeps/generic/readonly-area.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+
+/* Return 1 if the whole area PTR .. PTR+SIZE is not writable.
+ Return -1 if it is writable. */
+
+int
+__readonly_area (const void *ptr, size_t size)
+{
+ /* We cannot determine in general whether memory is writable or not.
+ This must be handled in a system-dependent manner. to not
+ unconditionally break code we need to return here a positive
+ answer. This disables this security measure but that is the
+ price people have to pay for using systems without a real
+ implementation of this interface. */
+ return 1;
+}
diff --git a/sysdeps/generic/readv.c b/sysdeps/generic/readv.c
new file mode 100644
index 0000000000..b33444c036
--- /dev/null
+++ b/sysdeps/generic/readv.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Read data from file descriptor FD, and put the result in the
+ buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
+ The buffers are filled in the order specified.
+ Operates just like `read' (see <unistd.h>) except that data are
+ put in VECTOR instead of a contiguous buffer. */
+ssize_t
+__libc_readv (fd, vector, count)
+ int fd;
+ const struct iovec *vector;
+ int count;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+strong_alias (__libc_readv, __readv)
+weak_alias (__libc_readv, readv)
+
+stub_warning (readv)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/reboot.c b/sysdeps/generic/reboot.c
new file mode 100644
index 0000000000..6036726c1f
--- /dev/null
+++ b/sysdeps/generic/reboot.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/reboot.h>
+
+/* Reboot the system. */
+int
+reboot (howto)
+ int howto;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (reboot)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/recv.c b/sysdeps/generic/recv.c
new file mode 100644
index 0000000000..9c28b4b306
--- /dev/null
+++ b/sysdeps/generic/recv.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Read N bytes into BUF from socket FD.
+ Returns the number read or -1 for errors. */
+ssize_t
+recv (fd, buf, n, flags)
+ int fd;
+ void *buf;
+ size_t n;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (recv)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/recvfrom.c b/sysdeps/generic/recvfrom.c
new file mode 100644
index 0000000000..4f6a045077
--- /dev/null
+++ b/sysdeps/generic/recvfrom.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Read N bytes into BUF through socket FD from peer
+ at address ADDR (which is ADDR_LEN bytes long).
+ Returns the number read or -1 for errors. */
+ssize_t
+__recvfrom (fd, buf, n, flags, addr, addr_len)
+ int fd;
+ void *buf;
+ size_t n;
+ int flags;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__recvfrom, recvfrom)
+
+stub_warning (recvfrom)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/recvmsg.c b/sysdeps/generic/recvmsg.c
new file mode 100644
index 0000000000..419415cd75
--- /dev/null
+++ b/sysdeps/generic/recvmsg.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Receive a message as described by MESSAGE from socket FD.
+ Returns the number of bytes read or -1 for errors. */
+ssize_t
+__recvmsg (fd, message, flags)
+ int fd;
+ struct msghdr *message;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__recvmsg, recvmsg)
+
+stub_warning (recvmsg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/remap_file_pages.c b/sysdeps/generic/remap_file_pages.c
new file mode 100644
index 0000000000..0f15ea44c2
--- /dev/null
+++ b/sysdeps/generic/remap_file_pages.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Remap arbitrary pages of a shared backing store within an existing
+ VMA. */
+
+int
+__remap_file_pages (void *start, size_t size, int prot, size_t pgoff,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (remap_file_pages)
+#include <stub-tag.h>
+weak_alias (__remap_file_pages, remap_file_pages)
diff --git a/sysdeps/generic/remove.c b/sysdeps/generic/remove.c
new file mode 100644
index 0000000000..5dc0e9edf0
--- /dev/null
+++ b/sysdeps/generic/remove.c
@@ -0,0 +1,33 @@
+/* ANSI C `remove' function to delete a file or directory. Stub version.
+ Copyright (C) 1995,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdio.h>
+
+int
+remove (file)
+ const char *file;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (remove)
+
+stub_warning (remove)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/removexattr.c b/sysdeps/generic/removexattr.c
new file mode 100644
index 0000000000..8379ed10c8
--- /dev/null
+++ b/sysdeps/generic/removexattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+removexattr (const char *__path, const char *__name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (removexattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/rename.c b/sysdeps/generic/rename.c
new file mode 100644
index 0000000000..b7d8392179
--- /dev/null
+++ b/sysdeps/generic/rename.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <errno.h>
+
+
+/* Rename the file OLD to NEW. */
+int
+rename (old, new)
+ const char *old;
+ const char *new;
+{
+ if (old == NULL || new == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (rename)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/res-state.c b/sysdeps/generic/res-state.c
new file mode 100644
index 0000000000..e327e34f59
--- /dev/null
+++ b/sysdeps/generic/res-state.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1996, 97, 98, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <resolv.h>
+#include <tls.h>
+
+#if ! USE___THREAD
+
+# undef _res
+extern struct __res_state _res;
+
+/* When threaded, _res may be a per-thread variable. */
+struct __res_state *
+weak_const_function
+__res_state (void)
+{
+ return &_res;
+}
+
+#else
+
+struct __res_state *
+__res_state (void)
+{
+ return __resp;
+}
+
+#endif
+
+libc_hidden_def (__res_state)
diff --git a/sysdeps/generic/revoke.c b/sysdeps/generic/revoke.c
new file mode 100644
index 0000000000..fc757d80b4
--- /dev/null
+++ b/sysdeps/generic/revoke.c
@@ -0,0 +1,31 @@
+/* Revoke the access of all descriptors currently open on a file.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <errno.h>
+
+int
+revoke (file)
+ const char *file;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (revoke)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/rewinddir.c b/sysdeps/generic/rewinddir.c
new file mode 100644
index 0000000000..e78d316880
--- /dev/null
+++ b/sysdeps/generic/rewinddir.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+
+/* Rewind DIRP to the beginning of the directory. */
+void
+rewinddir (dirp)
+ DIR *dirp;
+{
+ __set_errno (ENOSYS);
+ /* No way to indicate failure. */
+}
+
+
+stub_warning (rewinddir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/rmdir.c b/sysdeps/generic/rmdir.c
new file mode 100644
index 0000000000..5a16fd4284
--- /dev/null
+++ b/sysdeps/generic/rmdir.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Remove the directory PATH. */
+int
+__rmdir (path)
+ const char *path;
+{
+ if (path == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (rmdir)
+
+weak_alias (__rmdir, rmdir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/rshift.c b/sysdeps/generic/rshift.c
new file mode 100644
index 0000000000..59caf73529
--- /dev/null
+++ b/sysdeps/generic/rshift.c
@@ -0,0 +1,88 @@
+/* mpn_rshift -- Shift right a low-level natural-number integer.
+
+Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+/* Shift U (pointed to by UP and USIZE limbs long) CNT bits to the right
+ and store the USIZE least significant limbs of the result at WP.
+ The bits shifted out to the right are returned.
+
+ Argument constraints:
+ 1. 0 < CNT < BITS_PER_MP_LIMB
+ 2. If the result is to be written over the input, WP must be <= UP.
+*/
+
+mp_limb_t
+#if __STDC__
+mpn_rshift (register mp_ptr wp,
+ register mp_srcptr up, mp_size_t usize,
+ register unsigned int cnt)
+#else
+mpn_rshift (wp, up, usize, cnt)
+ register mp_ptr wp;
+ register mp_srcptr up;
+ mp_size_t usize;
+ register unsigned int cnt;
+#endif
+{
+ register mp_limb_t high_limb, low_limb;
+ register unsigned sh_1, sh_2;
+ register mp_size_t i;
+ mp_limb_t retval;
+
+#ifdef DEBUG
+ if (usize == 0 || cnt == 0)
+ abort ();
+#endif
+
+ sh_1 = cnt;
+
+#if 0
+ if (sh_1 == 0)
+ {
+ if (wp != up)
+ {
+ /* Copy from low end to high end, to allow specified input/output
+ overlapping. */
+ for (i = 0; i < usize; i++)
+ wp[i] = up[i];
+ }
+ return usize;
+ }
+#endif
+
+ wp -= 1;
+ sh_2 = BITS_PER_MP_LIMB - sh_1;
+ high_limb = up[0];
+ retval = high_limb << sh_2;
+ low_limb = high_limb;
+
+ for (i = 1; i < usize; i++)
+ {
+ high_limb = up[i];
+ wp[i] = (low_limb >> sh_1) | (high_limb << sh_2);
+ low_limb = high_limb;
+ }
+ wp[i] = low_limb >> sh_1;
+
+ return retval;
+}
diff --git a/sysdeps/generic/rtld-lowlevel.h b/sysdeps/generic/rtld-lowlevel.h
deleted file mode 100644
index 353fad28d4..0000000000
--- a/sysdeps/generic/rtld-lowlevel.h
+++ /dev/null
@@ -1 +0,0 @@
-#error "Lowlevel primitives for ld.so not implemented"
diff --git a/sysdeps/generic/s_asinhl.c b/sysdeps/generic/s_asinhl.c
new file mode 100644
index 0000000000..1d5cf47a4f
--- /dev/null
+++ b/sysdeps/generic/s_asinhl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__asinhl(long double x)
+{
+ fputs ("__asinhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__asinhl, asinhl)
+stub_warning (asinhl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/s_atanl.c b/sysdeps/generic/s_atanl.c
new file mode 100644
index 0000000000..d9a7eb6f8f
--- /dev/null
+++ b/sysdeps/generic/s_atanl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__atanl (long double x)
+{
+ fputs ("__atanl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__atanl, atanl)
+
+stub_warning (atanl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/s_cacos.c b/sysdeps/generic/s_cacos.c
new file mode 100644
index 0000000000..07b6bdcb9c
--- /dev/null
+++ b/sysdeps/generic/s_cacos.c
@@ -0,0 +1,41 @@
+/* Return cosine of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+__complex__ double
+__cacos (__complex__ double x)
+{
+ __complex__ double y;
+ __complex__ double res;
+
+ y = __casin (x);
+
+ __real__ res = (double) M_PI_2 - __real__ y;
+ __imag__ res = -__imag__ y;
+
+ return res;
+}
+weak_alias (__cacos, cacos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cacos, __cacosl)
+weak_alias (__cacos, cacosl)
+#endif
diff --git a/sysdeps/generic/s_cacosf.c b/sysdeps/generic/s_cacosf.c
new file mode 100644
index 0000000000..265184e38d
--- /dev/null
+++ b/sysdeps/generic/s_cacosf.c
@@ -0,0 +1,39 @@
+/* Return cosine of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+__complex__ float
+__cacosf (__complex__ float x)
+{
+ __complex__ float y;
+ __complex__ float res;
+
+ y = __casinf (x);
+
+ __real__ res = (float) M_PI_2 - __real__ y;
+ __imag__ res = -__imag__ y;
+
+ return res;
+}
+#ifndef __cacosf
+weak_alias (__cacosf, cacosf)
+#endif
diff --git a/sysdeps/generic/s_cacosh.c b/sysdeps/generic/s_cacosh.c
new file mode 100644
index 0000000000..1ae8708d49
--- /dev/null
+++ b/sysdeps/generic/s_cacosh.c
@@ -0,0 +1,88 @@
+/* Return arc hyperbole cosine for double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cacosh (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VAL;
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nan ("");
+ else
+ __imag__ res = __copysign ((rcls == FP_INFINITE
+ ? (__real__ x < 0.0
+ ? M_PI - M_PI_4 : M_PI_4)
+ : M_PI_2), __imag__ x);
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VAL;
+
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0,
+ __imag__ x);
+ else
+ __imag__ res = __nan ("");
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysign (M_PI_2, __imag__ x);
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrt (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clog (y);
+ }
+
+ return res;
+}
+weak_alias (__cacosh, cacosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cacosh, __cacoshl)
+weak_alias (__cacosh, cacoshl)
+#endif
diff --git a/sysdeps/generic/s_cacoshf.c b/sysdeps/generic/s_cacoshf.c
new file mode 100644
index 0000000000..52c35505e0
--- /dev/null
+++ b/sysdeps/generic/s_cacoshf.c
@@ -0,0 +1,101 @@
+/* Return arc hyperbole cosine for float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+__complex__ float
+__cacoshf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALF;
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanf ("");
+ else
+ __imag__ res = __copysignf ((rcls == FP_INFINITE
+ ? (__real__ x < 0.0
+ ? M_PI - M_PI_4 : M_PI_4)
+ : M_PI_2), __imag__ x);
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALF;
+
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0,
+ __imag__ x);
+ else
+ __imag__ res = __nanf ("");
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignf (M_PI_2, __imag__ x);
+ }
+ else
+ {
+#if 1
+ __complex__ float y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtf (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogf (y);
+#else
+ float re2 = __real__ x * __real__ x;
+ float im2 = __imag__ x * __imag__ x;
+ float sq = re2 - im2 - 1.0;
+ float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2);
+ float a = __ieee754_sqrtf ((sq + ro) / 2.0);
+ float b = __ieee754_sqrtf ((-sq + ro) / 2.0);
+
+ __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a
+ + im2 + __imag__ x * 2 * b
+ + ro);
+ __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a);
+#endif
+ }
+
+ return res;
+}
+#ifndef __cacoshf
+weak_alias (__cacoshf, cacoshf)
+#endif
diff --git a/sysdeps/generic/s_cacoshl.c b/sysdeps/generic/s_cacoshl.c
new file mode 100644
index 0000000000..4e5e2b3e3e
--- /dev/null
+++ b/sysdeps/generic/s_cacoshl.c
@@ -0,0 +1,84 @@
+/* Return arc hyperbole cosine for long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cacoshl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALL;
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanl ("");
+ else
+ __imag__ res = __copysignl ((rcls == FP_INFINITE
+ ? (__real__ x < 0.0
+ ? M_PIl - M_PI_4l : M_PI_4l)
+ : M_PI_2l), __imag__ x);
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALL;
+
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0,
+ __imag__ x);
+ else
+ __imag__ res = __nanl ("");
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtl (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogl (y);
+ }
+
+ return res;
+}
+weak_alias (__cacoshl, cacoshl)
diff --git a/sysdeps/generic/s_cacosl.c b/sysdeps/generic/s_cacosl.c
new file mode 100644
index 0000000000..a7ceff891b
--- /dev/null
+++ b/sysdeps/generic/s_cacosl.c
@@ -0,0 +1,37 @@
+/* Return cosine of complex long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+__complex__ long double
+__cacosl (__complex__ long double x)
+{
+ __complex__ long double y;
+ __complex__ long double res;
+
+ y = __casinl (x);
+
+ __real__ res = M_PI_2l - __real__ y;
+ __imag__ res = -__imag__ y;
+
+ return res;
+}
+weak_alias (__cacosl, cacosl)
diff --git a/sysdeps/generic/s_casin.c b/sysdeps/generic/s_casin.c
new file mode 100644
index 0000000000..2d5b06cf78
--- /dev/null
+++ b/sysdeps/generic/s_casin.c
@@ -0,0 +1,66 @@
+/* Return arc sine of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__casin (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (isnan (__real__ x) || isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else if (__isinf (__real__ x) || __isinf (__imag__ x))
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __casinh (y);
+
+ __real__ res = __imag__ y;
+ __imag__ res = -__real__ y;
+ }
+
+ return res;
+}
+weak_alias (__casin, casin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casin, __casinl)
+weak_alias (__casin, casinl)
+#endif
diff --git a/sysdeps/generic/s_casinf.c b/sysdeps/generic/s_casinf.c
new file mode 100644
index 0000000000..5278dbbf78
--- /dev/null
+++ b/sysdeps/generic/s_casinf.c
@@ -0,0 +1,64 @@
+/* Return arc sine of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__casinf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (isnan (__real__ x) || isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else if (__isinff (__real__ x) || __isinff (__imag__ x))
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else
+ {
+ __complex__ float y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __casinhf (y);
+
+ __real__ res = __imag__ y;
+ __imag__ res = -__real__ y;
+ }
+
+ return res;
+}
+#ifndef __casinf
+weak_alias (__casinf, casinf)
+#endif
diff --git a/sysdeps/generic/s_casinh.c b/sysdeps/generic/s_casinh.c
new file mode 100644
index 0000000000..a574add70e
--- /dev/null
+++ b/sysdeps/generic/s_casinh.c
@@ -0,0 +1,84 @@
+/* Return arc hyperbole sine for double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__casinh (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysign (HUGE_VAL, __real__ x);
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nan ("");
+ else
+ __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+ __imag__ x);
+ }
+ else if (rcls <= FP_INFINITE)
+ {
+ __real__ res = __real__ x;
+ if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+ || (rcls == FP_NAN && icls == FP_ZERO))
+ __imag__ res = __copysign (0.0, __imag__ x);
+ else
+ __imag__ res = __nan ("");
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrt (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clog (y);
+ }
+
+ return res;
+}
+weak_alias (__casinh, casinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__casinh, __casinhl)
+weak_alias (__casinh, casinhl)
+#endif
diff --git a/sysdeps/generic/s_casinhf.c b/sysdeps/generic/s_casinhf.c
new file mode 100644
index 0000000000..7037ab937c
--- /dev/null
+++ b/sysdeps/generic/s_casinhf.c
@@ -0,0 +1,82 @@
+/* Return arc hyperbole sine for float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__casinhf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignf (HUGE_VALF, __real__ x);
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanf ("");
+ else
+ __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+ __imag__ x);
+ }
+ else if (rcls <= FP_INFINITE)
+ {
+ __real__ res = __real__ x;
+ if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+ || (rcls == FP_NAN && icls == FP_ZERO))
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ else
+ __imag__ res = __nanf ("");
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ __complex__ float y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtf (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogf (y);
+ }
+
+ return res;
+}
+#ifndef __casinhf
+weak_alias (__casinhf, casinhf)
+#endif
diff --git a/sysdeps/generic/s_casinhl.c b/sysdeps/generic/s_casinhl.c
new file mode 100644
index 0000000000..376b2347a0
--- /dev/null
+++ b/sysdeps/generic/s_casinhl.c
@@ -0,0 +1,80 @@
+/* Return arc hyperbole sine for long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__casinhl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignl (HUGE_VALL, __real__ x);
+
+ if (rcls == FP_NAN)
+ __imag__ res = __nanl ("");
+ else
+ __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l,
+ __imag__ x);
+ }
+ else if (rcls <= FP_INFINITE)
+ {
+ __real__ res = __real__ x;
+ if ((rcls == FP_INFINITE && icls >= FP_ZERO)
+ || (rcls == FP_NAN && icls == FP_ZERO))
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ else
+ __imag__ res = __nanl ("");
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
+ __imag__ y = 2.0 * __real__ x * __imag__ x;
+
+ y = __csqrtl (y);
+
+ __real__ y += __real__ x;
+ __imag__ y += __imag__ x;
+
+ res = __clogl (y);
+ }
+
+ return res;
+}
+weak_alias (__casinhl, casinhl)
diff --git a/sysdeps/generic/s_casinl.c b/sysdeps/generic/s_casinl.c
new file mode 100644
index 0000000000..f303c05ae6
--- /dev/null
+++ b/sysdeps/generic/s_casinl.c
@@ -0,0 +1,62 @@
+/* Return arc sine of complex long double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__casinl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (isnan (__real__ x) || isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else if (__isinfl (__real__ x) || __isinfl (__imag__ x))
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ y = __casinhl (y);
+
+ __real__ res = __imag__ y;
+ __imag__ res = -__real__ y;
+ }
+
+ return res;
+}
+weak_alias (__casinl, casinl)
diff --git a/sysdeps/generic/s_catan.c b/sysdeps/generic/s_catan.c
new file mode 100644
index 0000000000..1d0673ad6a
--- /dev/null
+++ b/sysdeps/generic/s_catan.c
@@ -0,0 +1,89 @@
+/* Return arc tangent of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__catan (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (rcls == FP_INFINITE)
+ {
+ __real__ res = __copysign (M_PI_2, __real__ x);
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else if (icls == FP_INFINITE)
+ {
+ if (rcls >= FP_ZERO)
+ __real__ res = __copysign (M_PI_2, __real__ x);
+ else
+ __real__ res = __nan ("");
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else if (icls == FP_ZERO || icls == FP_INFINITE)
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ double r2, num, den;
+
+ r2 = __real__ x * __real__ x;
+
+ den = 1 - r2 - __imag__ x * __imag__ x;
+
+ __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
+
+ num = __imag__ x + 1.0;
+ num = r2 + num * num;
+
+ den = __imag__ x - 1.0;
+ den = r2 + den * den;
+
+ __imag__ res = 0.25 * __ieee754_log (num / den);
+ }
+
+ return res;
+}
+weak_alias (__catan, catan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catan, __catanl)
+weak_alias (__catan, catanl)
+#endif
diff --git a/sysdeps/generic/s_catanf.c b/sysdeps/generic/s_catanf.c
new file mode 100644
index 0000000000..25eec2b1b5
--- /dev/null
+++ b/sysdeps/generic/s_catanf.c
@@ -0,0 +1,87 @@
+/* Return arc tangent of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__catanf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (rcls == FP_INFINITE)
+ {
+ __real__ res = __copysignf (M_PI_2, __real__ x);
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else if (icls == FP_INFINITE)
+ {
+ if (rcls >= FP_ZERO)
+ __real__ res = __copysignf (M_PI_2, __real__ x);
+ else
+ __real__ res = __nanf ("");
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else if (icls == FP_ZERO || icls == FP_INFINITE)
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ float r2, num, den;
+
+ r2 = __real__ x * __real__ x;
+
+ den = 1 - r2 - __imag__ x * __imag__ x;
+
+ __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den);
+
+ num = __imag__ x + 1.0;
+ num = r2 + num * num;
+
+ den = __imag__ x - 1.0;
+ den = r2 + den * den;
+
+ __imag__ res = 0.25 * __ieee754_logf (num / den);
+ }
+
+ return res;
+}
+#ifndef __catanf
+weak_alias (__catanf, catanf)
+#endif
diff --git a/sysdeps/generic/s_catanh.c b/sysdeps/generic/s_catanh.c
new file mode 100644
index 0000000000..e15c073f96
--- /dev/null
+++ b/sysdeps/generic/s_catanh.c
@@ -0,0 +1,84 @@
+/* Return arc hyperbole tangent for double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__catanh (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysign (0.0, __real__ x);
+ __imag__ res = __copysign (M_PI_2, __imag__ x);
+ }
+ else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+ {
+ __real__ res = __copysign (0.0, __real__ x);
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysign (M_PI_2, __imag__ x);
+ else
+ __imag__ res = __nan ("");
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ double i2, num, den;
+
+ i2 = __imag__ x * __imag__ x;
+
+ num = 1.0 + __real__ x;
+ num = i2 + num * num;
+
+ den = 1.0 - __real__ x;
+ den = i2 + den * den;
+
+ __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
+
+ den = 1 - __real__ x * __real__ x - i2;
+
+ __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
+ }
+
+ return res;
+}
+weak_alias (__catanh, catanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__catanh, __catanhl)
+weak_alias (__catanh, catanhl)
+#endif
diff --git a/sysdeps/generic/s_catanhf.c b/sysdeps/generic/s_catanhf.c
new file mode 100644
index 0000000000..d2422e6111
--- /dev/null
+++ b/sysdeps/generic/s_catanhf.c
@@ -0,0 +1,82 @@
+/* Return arc hyperbole tangent for float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__catanhf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignf (0.0, __real__ x);
+ __imag__ res = __copysignf (M_PI_2, __imag__ x);
+ }
+ else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+ {
+ __real__ res = __copysignf (0.0, __real__ x);
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignf (M_PI_2, __imag__ x);
+ else
+ __imag__ res = __nanf ("");
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ float i2, num, den;
+
+ i2 = __imag__ x * __imag__ x;
+
+ num = 1.0 + __real__ x;
+ num = i2 + num * num;
+
+ den = 1.0 - __real__ x;
+ den = i2 + den * den;
+
+ __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
+
+ den = 1 - __real__ x * __real__ x - i2;
+
+ __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
+ }
+
+ return res;
+}
+#ifndef __catanhf
+weak_alias (__catanhf, catanhf)
+#endif
diff --git a/sysdeps/generic/s_catanhl.c b/sysdeps/generic/s_catanhl.c
new file mode 100644
index 0000000000..c3fb0ce5ff
--- /dev/null
+++ b/sysdeps/generic/s_catanhl.c
@@ -0,0 +1,80 @@
+/* Return arc hyperbole tangent for long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__catanhl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = __copysignl (0.0, __real__ x);
+ __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+ }
+ else if (rcls == FP_INFINITE || rcls == FP_ZERO)
+ {
+ __real__ res = __copysignl (0.0, __real__ x);
+ if (icls >= FP_ZERO)
+ __imag__ res = __copysignl (M_PI_2l, __imag__ x);
+ else
+ __imag__ res = __nanl ("");
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ long double i2, num, den;
+
+ i2 = __imag__ x * __imag__ x;
+
+ num = 1.0 + __real__ x;
+ num = i2 + num * num;
+
+ den = 1.0 - __real__ x;
+ den = i2 + den * den;
+
+ __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));
+
+ den = 1 - __real__ x * __real__ x - i2;
+
+ __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den);
+ }
+
+ return res;
+}
+weak_alias (__catanhl, catanhl)
diff --git a/sysdeps/generic/s_catanl.c b/sysdeps/generic/s_catanl.c
new file mode 100644
index 0000000000..6cb45e5bee
--- /dev/null
+++ b/sysdeps/generic/s_catanl.c
@@ -0,0 +1,85 @@
+/* Return arc tangent of complex long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__catanl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (rcls == FP_INFINITE)
+ {
+ __real__ res = __copysignl (M_PI_2l, __real__ x);
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else if (icls == FP_INFINITE)
+ {
+ if (rcls >= FP_ZERO)
+ __real__ res = __copysignl (M_PI_2l, __real__ x);
+ else
+ __real__ res = __nanl ("");
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else if (icls == FP_ZERO || icls == FP_INFINITE)
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ res = x;
+ }
+ else
+ {
+ long double r2, num, den;
+
+ r2 = __real__ x * __real__ x;
+
+ den = 1 - r2 - __imag__ x * __imag__ x;
+
+ __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den);
+
+ num = __imag__ x + 1.0;
+ num = r2 + num * num;
+
+ den = __imag__ x - 1.0;
+ den = r2 + den * den;
+
+ __imag__ res = 0.25 * __ieee754_logl (num / den);
+ }
+
+ return res;
+}
+weak_alias (__catanl, catanl)
diff --git a/sysdeps/generic/s_cbrtl.c b/sysdeps/generic/s_cbrtl.c
new file mode 100644
index 0000000000..d668e377af
--- /dev/null
+++ b/sysdeps/generic/s_cbrtl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__cbrtl(long double x)
+{
+ fputs ("__cbrtl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__cbrtl, cbrtl)
+stub_warning (cbrtl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/s_ccos.c b/sysdeps/generic/s_ccos.c
new file mode 100644
index 0000000000..1b244d7079
--- /dev/null
+++ b/sysdeps/generic/s_ccos.c
@@ -0,0 +1,80 @@
+/* Return cosine of complex double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ double
+__ccos (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!isfinite (__real__ x) || __isnan (__imag__ x))
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = __nan ("");
+ __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else if (__isinf (__imag__ x))
+ {
+ __real__ res = HUGE_VAL;
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __complex__ double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = __ccosh (y);
+ }
+
+ return res;
+}
+weak_alias (__ccos, ccos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ccos, __ccosl)
+weak_alias (__ccos, ccosl)
+#endif
diff --git a/sysdeps/generic/s_ccosf.c b/sysdeps/generic/s_ccosf.c
new file mode 100644
index 0000000000..4b154deac5
--- /dev/null
+++ b/sysdeps/generic/s_ccosf.c
@@ -0,0 +1,78 @@
+/* Return cosine of complex float value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ float
+__ccosf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!isfinite (__real__ x) || __isnanf (__imag__ x))
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else if (__isinff (__imag__ x))
+ {
+ __real__ res = HUGE_VALF;
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __complex__ float y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = __ccoshf (y);
+ }
+
+ return res;
+}
+#ifndef __ccosf
+weak_alias (__ccosf, ccosf)
+#endif
diff --git a/sysdeps/generic/s_ccosh.c b/sysdeps/generic/s_ccosh.c
new file mode 100644
index 0000000000..f5b29db24b
--- /dev/null
+++ b/sysdeps/generic/s_ccosh.c
@@ -0,0 +1,105 @@
+/* Complex cosine hyperbole function for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ccosh (__complex__ double x)
+{
+ __complex__ double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinh_val = __ieee754_sinh (__real__ x);
+ double cosh_val = __ieee754_cosh (__real__ x);
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan ("");
+ __real__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __imag__ x * __copysign (1.0, __real__ x);
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (HUGE_VAL, cosix);
+ __imag__ retval = (__copysign (HUGE_VAL, sinix)
+ * __copysign (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+ }
+
+ return retval;
+}
+weak_alias (__ccosh, ccosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ccosh, __ccoshl)
+weak_alias (__ccosh, ccoshl)
+#endif
diff --git a/sysdeps/generic/s_ccoshf.c b/sysdeps/generic/s_ccoshf.c
new file mode 100644
index 0000000000..f400d34f0b
--- /dev/null
+++ b/sysdeps/generic/s_ccoshf.c
@@ -0,0 +1,103 @@
+/* Complex cosine hyperbole function for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ccoshf (__complex__ float x)
+{
+ __complex__ float retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinh_val = __ieee754_sinhf (__real__ x);
+ float cosh_val = __ieee754_coshf (__real__ x);
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf ("");
+ __real__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (HUGE_VALF, cosix);
+ __imag__ retval = (__copysignf (HUGE_VALF, sinix)
+ * __copysignf (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
+ }
+
+ return retval;
+}
+#ifndef __ccoshf
+weak_alias (__ccoshf, ccoshf)
+#endif
diff --git a/sysdeps/generic/s_ccoshl.c b/sysdeps/generic/s_ccoshl.c
new file mode 100644
index 0000000000..61ffb49ca0
--- /dev/null
+++ b/sysdeps/generic/s_ccoshl.c
@@ -0,0 +1,101 @@
+/* Complex cosine hyperbole function for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ccoshl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinh_val = __ieee754_sinhl (__real__ x);
+ long double cosh_val = __ieee754_coshl (__real__ x);
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * cosix;
+ __imag__ retval = sinh_val * sinix;
+ }
+ else
+ {
+ __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl ("");
+ __real__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x);
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (HUGE_VALL, cosix);
+ __imag__ retval = (__copysignl (HUGE_VALL, sinix)
+ * __copysignl (1.0, __real__ x));
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
+ }
+
+ return retval;
+}
+weak_alias (__ccoshl, ccoshl)
diff --git a/sysdeps/generic/s_ccosl.c b/sysdeps/generic/s_ccosl.c
new file mode 100644
index 0000000000..4ebe2c347d
--- /dev/null
+++ b/sysdeps/generic/s_ccosl.c
@@ -0,0 +1,76 @@
+/* Return cosine of complex long double value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+
+__complex__ long double
+__ccosl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!isfinite (__real__ x) || __isnanl (__imag__ x))
+ {
+ if (__real__ x == 0.0 || __imag__ x == 0.0)
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else if (__isinfl (__imag__ x))
+ {
+ __real__ res = HUGE_VALL;
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __complex__ long double y;
+
+ __real__ y = -__imag__ x;
+ __imag__ y = __real__ x;
+
+ res = __ccoshl (y);
+ }
+
+ return res;
+}
+weak_alias (__ccosl, ccosl)
diff --git a/sysdeps/generic/s_cexp.c b/sysdeps/generic/s_cexp.c
new file mode 100644
index 0000000000..5a299b7687
--- /dev/null
+++ b/sysdeps/generic/s_cexp.c
@@ -0,0 +1,127 @@
+/* Return value of complex exponential function for double complex value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__cexp (__complex__ double x)
+{
+ __complex__ double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double exp_val = __ieee754_exp (__real__ x);
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ if (isfinite (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = __copysign (exp_val, cosix);
+ __imag__ retval = __copysign (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
+
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (value, cosix);
+ __imag__ retval = __copysign (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = __copysign (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+
+ return retval;
+}
+weak_alias (__cexp, cexp)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cexp, __cexpl)
+weak_alias (__cexp, cexpl)
+#endif
diff --git a/sysdeps/generic/s_cexpf.c b/sysdeps/generic/s_cexpf.c
new file mode 100644
index 0000000000..7b68fc365c
--- /dev/null
+++ b/sysdeps/generic/s_cexpf.c
@@ -0,0 +1,125 @@
+/* Return value of complex exponential function for float complex value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__cexpf (__complex__ float x)
+{
+ __complex__ float retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float exp_val = __ieee754_expf (__real__ x);
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ if (isfinite (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = __copysignf (exp_val, cosix);
+ __imag__ retval = __copysignf (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
+
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (value, cosix);
+ __imag__ retval = __copysignf (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = __copysignf (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+
+ return retval;
+}
+#ifndef __cexpf
+weak_alias (__cexpf, cexpf)
+#endif
diff --git a/sysdeps/generic/s_cexpl.c b/sysdeps/generic/s_cexpl.c
new file mode 100644
index 0000000000..cf6bc974a9
--- /dev/null
+++ b/sysdeps/generic/s_cexpl.c
@@ -0,0 +1,123 @@
+/* Return value of complex exponential function for long double complex value.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__cexpl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double exp_val = __ieee754_expl (__real__ x);
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ if (isfinite (exp_val))
+ {
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ else
+ {
+ __real__ retval = __copysignl (exp_val, cosix);
+ __imag__ retval = __copysignl (exp_val, sinix);
+ }
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
+
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (value, cosix);
+ __imag__ retval = __copysignl (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = 0.0;
+ __imag__ retval = __copysignl (0.0, __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+
+ return retval;
+}
+weak_alias (__cexpl, cexpl)
diff --git a/sysdeps/generic/s_clog.c b/sysdeps/generic/s_clog.c
new file mode 100644
index 0000000000..f796024b47
--- /dev/null
+++ b/sysdeps/generic/s_clog.c
@@ -0,0 +1,65 @@
+/* Compute complex natural logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog (__complex__ double x)
+{
+ __complex__ double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysign (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabs (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log (__ieee754_hypot (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nan ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = __nan ("");
+ }
+
+ return result;
+}
+weak_alias (__clog, clog)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog, __clogl)
+weak_alias (__clog, clogl)
+#endif
diff --git a/sysdeps/generic/s_clog10.c b/sysdeps/generic/s_clog10.c
new file mode 100644
index 0000000000..62c2ca724a
--- /dev/null
+++ b/sysdeps/generic/s_clog10.c
@@ -0,0 +1,65 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog10 (__complex__ double x)
+{
+ __complex__ double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysign (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabs (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
+ __imag__ x));
+ __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nan ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = __nan ("");
+ }
+
+ return result;
+}
+weak_alias (__clog10, clog10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog10, __clog10l)
+weak_alias (__clog10, clog10l)
+#endif
diff --git a/sysdeps/generic/s_clog10f.c b/sysdeps/generic/s_clog10f.c
new file mode 100644
index 0000000000..eed81f368c
--- /dev/null
+++ b/sysdeps/generic/s_clog10f.c
@@ -0,0 +1,63 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clog10f (__complex__ float x)
+{
+ __complex__ float result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysignf (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsf (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
+ __imag__ x));
+ __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanf ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALF;
+ else
+ __real__ result = __nanf ("");
+ }
+
+ return result;
+}
+#ifndef __clog10f
+weak_alias (__clog10f, clog10f)
+#endif
diff --git a/sysdeps/generic/s_clog10l.c b/sysdeps/generic/s_clog10l.c
new file mode 100644
index 0000000000..f901543d05
--- /dev/null
+++ b/sysdeps/generic/s_clog10l.c
@@ -0,0 +1,61 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clog10l (__complex__ long double x)
+{
+ __complex__ long double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
+ __imag__ result = __copysignl (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsl (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
+ __imag__ x));
+ __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanl ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALL;
+ else
+ __real__ result = __nanl ("");
+ }
+
+ return result;
+}
+weak_alias (__clog10l, clog10l)
diff --git a/sysdeps/generic/s_clogf.c b/sysdeps/generic/s_clogf.c
new file mode 100644
index 0000000000..21e3b57b7f
--- /dev/null
+++ b/sysdeps/generic/s_clogf.c
@@ -0,0 +1,63 @@
+/* Compute complex natural logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clogf (__complex__ float x)
+{
+ __complex__ float result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysignf (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsf (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanf ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALF;
+ else
+ __real__ result = __nanf ("");
+ }
+
+ return result;
+}
+#ifndef __clogf
+weak_alias (__clogf, clogf)
+#endif
diff --git a/sysdeps/generic/s_clogl.c b/sysdeps/generic/s_clogl.c
new file mode 100644
index 0000000000..43118f768c
--- /dev/null
+++ b/sysdeps/generic/s_clogl.c
@@ -0,0 +1,61 @@
+/* Compute complex natural logarithm.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clogl (__complex__ long double x)
+{
+ __complex__ long double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
+ __imag__ result = __copysignl (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsl (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanl ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALL;
+ else
+ __real__ result = __nanl ("");
+ }
+
+ return result;
+}
+weak_alias (__clogl, clogl)
diff --git a/sysdeps/generic/s_cpow.c b/sysdeps/generic/s_cpow.c
new file mode 100644
index 0000000000..86536cc95b
--- /dev/null
+++ b/sysdeps/generic/s_cpow.c
@@ -0,0 +1,34 @@
+/* Complex power of double values.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cpow (__complex__ double x, __complex__ double c)
+{
+ return __cexp (c * __clog (x));
+}
+weak_alias (__cpow, cpow)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cpow, __cpowl)
+weak_alias (__cpow, cpowl)
+#endif
diff --git a/sysdeps/generic/s_cpowf.c b/sysdeps/generic/s_cpowf.c
new file mode 100644
index 0000000000..58eaa1aa06
--- /dev/null
+++ b/sysdeps/generic/s_cpowf.c
@@ -0,0 +1,32 @@
+/* Complex power of float values.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cpowf (__complex__ float x, __complex__ float c)
+{
+ return __cexpf (c * __clogf (x));
+}
+#ifndef __cpowf
+weak_alias (__cpowf, cpowf)
+#endif
diff --git a/sysdeps/generic/s_cpowl.c b/sysdeps/generic/s_cpowl.c
new file mode 100644
index 0000000000..4c358b3ebe
--- /dev/null
+++ b/sysdeps/generic/s_cpowl.c
@@ -0,0 +1,30 @@
+/* Complex power of long double values.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cpowl (__complex__ long double x, __complex__ long double c)
+{
+ return __cexpl (c * __clogl (x));
+}
+weak_alias (__cpowl, cpowl)
diff --git a/sysdeps/generic/s_cproj.c b/sysdeps/generic/s_cproj.c
new file mode 100644
index 0000000000..8e7ca41df8
--- /dev/null
+++ b/sysdeps/generic/s_cproj.c
@@ -0,0 +1,51 @@
+/* Compute projection of complex double value to Riemann sphere.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ double
+__cproj (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (isnan (__real__ x) && isnan (__imag__ x))
+ return x;
+ else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ __real__ res = INFINITY;
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else
+ {
+ double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+ __real__ res = (2.0 * __real__ x) / den;
+ __imag__ res = (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__cproj, cproj)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cproj, __cprojl)
+weak_alias (__cproj, cprojl)
+#endif
diff --git a/sysdeps/generic/s_cprojf.c b/sysdeps/generic/s_cprojf.c
new file mode 100644
index 0000000000..83df13cfa9
--- /dev/null
+++ b/sysdeps/generic/s_cprojf.c
@@ -0,0 +1,49 @@
+/* Compute projection of complex float value to Riemann sphere.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cprojf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (isnan (__real__ x) && isnan (__imag__ x))
+ return x;
+ else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ __real__ res = INFINITY;
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else
+ {
+ float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
+
+ __real__ res = (2.0 * __real__ x) / den;
+ __imag__ res = (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+#ifndef __cprojf
+weak_alias (__cprojf, cprojf)
+#endif
diff --git a/sysdeps/generic/s_cprojl.c b/sysdeps/generic/s_cprojl.c
new file mode 100644
index 0000000000..c70cdc47db
--- /dev/null
+++ b/sysdeps/generic/s_cprojl.c
@@ -0,0 +1,48 @@
+/* Compute projection of complex long double value to Riemann sphere.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cprojl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (isnan (__real__ x) && isnan (__imag__ x))
+ return x;
+ else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ __real__ res = INFINITY;
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else
+ {
+ long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x
+ + 1.0);
+
+ __real__ res = (2.0 * __real__ x) / den;
+ __imag__ res = (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__cprojl, cprojl)
diff --git a/sysdeps/generic/s_csin.c b/sysdeps/generic/s_csin.c
new file mode 100644
index 0000000000..eb380e2c3f
--- /dev/null
+++ b/sysdeps/generic/s_csin.c
@@ -0,0 +1,131 @@
+/* Complex sine function for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csin (__complex__ double x)
+{
+ __complex__ double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabs (__real__ x);
+
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ double sinh_val = __ieee754_sinh (__imag__ x);
+ double cosh_val = __ieee754_cosh (__imag__ x);
+ double sinix, cosix;
+
+ __sincos (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nan ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (icls == FP_INFINITE)
+ {
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ double sinix, cosix;
+
+ __sincos (__real__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (HUGE_VAL, sinix);
+ __imag__ retval = __copysign (HUGE_VAL, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nan ("");
+ __imag__ retval = HUGE_VAL;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+ }
+
+ return retval;
+}
+weak_alias (__csin, csin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csin, __csinl)
+weak_alias (__csin, csinl)
+#endif
diff --git a/sysdeps/generic/s_csinf.c b/sysdeps/generic/s_csinf.c
new file mode 100644
index 0000000000..8004743bd3
--- /dev/null
+++ b/sysdeps/generic/s_csinf.c
@@ -0,0 +1,129 @@
+/* Complex sine function for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csinf (__complex__ float x)
+{
+ __complex__ float retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsf (__real__ x);
+
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ float sinh_val = __ieee754_sinhf (__imag__ x);
+ float cosh_val = __ieee754_coshf (__imag__ x);
+ float sinix, cosix;
+
+ __sincosf (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (icls == FP_INFINITE)
+ {
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ float sinix, cosix;
+
+ __sincosf (__real__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (HUGE_VALF, sinix);
+ __imag__ retval = __copysignf (HUGE_VALF, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = HUGE_VALF;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+ }
+
+ return retval;
+}
+#ifndef __csinf
+weak_alias (__csinf, csinf)
+#endif
diff --git a/sysdeps/generic/s_csinh.c b/sysdeps/generic/s_csinh.c
new file mode 100644
index 0000000000..f0e0cc61f1
--- /dev/null
+++ b/sysdeps/generic/s_csinh.c
@@ -0,0 +1,126 @@
+/* Complex sine hyperbole function for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csinh (__complex__ double x)
+{
+ __complex__ double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabs (__real__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinh_val = __ieee754_sinh (__real__ x);
+ double cosh_val = __ieee754_cosh (__real__ x);
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+ __imag__ retval = __imag__ x;
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ double sinix, cosix;
+
+ __sincos (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysign (HUGE_VAL, cosix);
+ __imag__ retval = __copysign (HUGE_VAL, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VAL;
+ __imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+ }
+
+ return retval;
+}
+weak_alias (__csinh, csinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csinh, __csinhl)
+weak_alias (__csinh, csinhl)
+#endif
diff --git a/sysdeps/generic/s_csinhf.c b/sysdeps/generic/s_csinhf.c
new file mode 100644
index 0000000000..e4bb704268
--- /dev/null
+++ b/sysdeps/generic/s_csinhf.c
@@ -0,0 +1,124 @@
+/* Complex sine hyperbole function for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csinhf (__complex__ float x)
+{
+ __complex__ float retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsf (__real__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinh_val = __ieee754_sinhf (__real__ x);
+ float cosh_val = __ieee754_coshf (__real__ x);
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
+ __imag__ retval = __imag__ x;
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ float sinix, cosix;
+
+ __sincosf (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignf (HUGE_VALF, cosix);
+ __imag__ retval = __copysignf (HUGE_VALF, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALF;
+ __imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
+ }
+
+ return retval;
+}
+#ifndef __csinhf
+weak_alias (__csinhf, csinhf)
+#endif
diff --git a/sysdeps/generic/s_csinhl.c b/sysdeps/generic/s_csinhl.c
new file mode 100644
index 0000000000..226075634d
--- /dev/null
+++ b/sysdeps/generic/s_csinhl.c
@@ -0,0 +1,122 @@
+/* Complex sine hyperbole function for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csinhl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsl (__real__ x);
+
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinh_val = __ieee754_sinhl (__real__ x);
+ long double cosh_val = __ieee754_coshl (__real__ x);
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = sinh_val * cosix;
+ __imag__ retval = cosh_val * sinix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ /* Real part is infinite. */
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
+ __imag__ retval = __imag__ x;
+ }
+ else if (icls > FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ long double sinix, cosix;
+
+ __sincosl (__imag__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (HUGE_VALL, cosix);
+ __imag__ retval = __copysignl (HUGE_VALL, sinix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = HUGE_VALL;
+ __imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
+ }
+
+ return retval;
+}
+weak_alias (__csinhl, csinhl)
diff --git a/sysdeps/generic/s_csinl.c b/sysdeps/generic/s_csinl.c
new file mode 100644
index 0000000000..f7a1c43600
--- /dev/null
+++ b/sysdeps/generic/s_csinl.c
@@ -0,0 +1,127 @@
+/* Complex sine function for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csinl (__complex__ long double x)
+{
+ __complex__ long double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsl (__real__ x);
+
+ if (icls >= FP_ZERO)
+ {
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
+ {
+ /* Real part is finite. */
+ long double sinh_val = __ieee754_sinhl (__imag__ x);
+ long double cosh_val = __ieee754_coshl (__imag__ x);
+ long double sinix, cosix;
+
+ __sincosl (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ }
+ else if (icls == FP_INFINITE)
+ {
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ long double sinix, cosix;
+
+ __sincosl (__real__ x, &sinix, &cosix);
+
+ __real__ retval = __copysignl (HUGE_VALL, sinix);
+ __imag__ retval = __copysignl (HUGE_VALL, cosix);
+
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = HUGE_VALL;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+ }
+
+ return retval;
+}
+weak_alias (__csinl, csinl)
diff --git a/sysdeps/generic/s_csqrt.c b/sysdeps/generic/s_csqrt.c
new file mode 100644
index 0000000000..0bb6690b17
--- /dev/null
+++ b/sysdeps/generic/s_csqrt.c
@@ -0,0 +1,114 @@
+/* Complex square root of double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__csqrt (__complex__ double x)
+{
+ __complex__ double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VAL;
+ __imag__ res = __imag__ x;
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = icls == FP_NAN ? __nan ("") : 0;
+ __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (icls == FP_NAN
+ ? __nan ("") : __copysign (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+ }
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
+ __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabs (__ieee754_sqrt (__real__ x));
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ }
+ else if (rcls == FP_ZERO)
+ {
+ double r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
+
+ __real__ res = __copysign (r, __imag__ x);
+ __imag__ res = r;
+ }
+ else
+ {
+ double d, r, s;
+
+ d = __ieee754_hypot (__real__ x, __imag__ x);
+ /* Use the identity 2 Re res Im res = Im x
+ to avoid cancellation error in d +/- Re x. */
+ if (__real__ x > 0)
+ {
+ r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x);
+ s = (0.5 * __imag__ x) / r;
+ }
+ else
+ {
+ s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x);
+ r = fabs ((0.5 * __imag__ x) / s);
+ }
+
+ __real__ res = r;
+ __imag__ res = __copysign (s, __imag__ x);
+ }
+ }
+
+ return res;
+}
+weak_alias (__csqrt, csqrt)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__csqrt, __csqrtl)
+weak_alias (__csqrt, csqrtl)
+#endif
diff --git a/sysdeps/generic/s_csqrtf.c b/sysdeps/generic/s_csqrtf.c
new file mode 100644
index 0000000000..b02c605a37
--- /dev/null
+++ b/sysdeps/generic/s_csqrtf.c
@@ -0,0 +1,112 @@
+/* Complex square root of float value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__csqrtf (__complex__ float x)
+{
+ __complex__ float res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALF;
+ __imag__ res = __imag__ x;
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = icls == FP_NAN ? __nanf ("") : 0;
+ __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (icls == FP_NAN
+ ? __nanf ("") : __copysignf (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+ }
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x),
+ __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabsf (__ieee754_sqrtf (__real__ x));
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ }
+ else if (rcls == FP_ZERO)
+ {
+ float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x));
+
+ __real__ res = __copysignf (r, __imag__ x);
+ __imag__ res = r;
+ }
+ else
+ {
+ float d, r, s;
+
+ d = __ieee754_hypotf (__real__ x, __imag__ x);
+ /* Use the identity 2 Re res Im res = Im x
+ to avoid cancellation error in d +/- Re x. */
+ if (__real__ x > 0)
+ {
+ r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x);
+ s = (0.5f * __imag__ x) / r;
+ }
+ else
+ {
+ s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x);
+ r = fabsf ((0.5f * __imag__ x) / s);
+ }
+
+ __real__ res = r;
+ __imag__ res = __copysignf (s, __imag__ x);
+ }
+ }
+
+ return res;
+}
+#ifndef __csqrtf
+weak_alias (__csqrtf, csqrtf)
+#endif
diff --git a/sysdeps/generic/s_csqrtl.c b/sysdeps/generic/s_csqrtl.c
new file mode 100644
index 0000000000..8e27750a04
--- /dev/null
+++ b/sysdeps/generic/s_csqrtl.c
@@ -0,0 +1,110 @@
+/* Complex square root of long double value.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__csqrtl (__complex__ long double x)
+{
+ __complex__ long double res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = HUGE_VALL;
+ __imag__ res = __imag__ x;
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = icls == FP_NAN ? __nanl ("") : 0;
+ __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (icls == FP_NAN
+ ? __nanl ("") : __copysignl (0.0, __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+ }
+ }
+ else
+ {
+ if (icls == FP_ZERO)
+ {
+ if (__real__ x < 0.0)
+ {
+ __real__ res = 0.0;
+ __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x),
+ __imag__ x);
+ }
+ else
+ {
+ __real__ res = fabsl (__ieee754_sqrtl (__real__ x));
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ }
+ else if (rcls == FP_ZERO)
+ {
+ long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
+
+ __real__ res = __copysignl (r, __imag__ x);
+ __imag__ res = r;
+ }
+ else
+ {
+ long double d, r, s;
+
+ d = __ieee754_hypotl (__real__ x, __imag__ x);
+ /* Use the identity 2 Re res Im res = Im x
+ to avoid cancellation error in d +/- Re x. */
+ if (__real__ x > 0)
+ {
+ r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x);
+ s = (0.5L * __imag__ x) / r;
+ }
+ else
+ {
+ s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x);
+ r = fabsl ((0.5L * __imag__ x) / s);
+ }
+
+ __real__ res = r;
+ __imag__ res = __copysignl (s, __imag__ x);
+ }
+ }
+
+ return res;
+}
+weak_alias (__csqrtl, csqrtl)
diff --git a/sysdeps/generic/s_ctan.c b/sysdeps/generic/s_ctan.c
new file mode 100644
index 0000000000..6a09fe465b
--- /dev/null
+++ b/sysdeps/generic/s_ctan.c
@@ -0,0 +1,74 @@
+/* Complex tangent function for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ctan (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinf (__imag__ x))
+ {
+ __real__ res = __copysign (0.0, __real__ x);
+ __imag__ res = __copysign (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ double sin2rx, cos2rx;
+ double den;
+
+ __sincos (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+ den = cos2rx + __ieee754_cosh (2.0 * __imag__ x);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__ctan, ctan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctan, __ctanl)
+weak_alias (__ctan, ctanl)
+#endif
diff --git a/sysdeps/generic/s_ctanf.c b/sysdeps/generic/s_ctanf.c
new file mode 100644
index 0000000000..e02971dd44
--- /dev/null
+++ b/sysdeps/generic/s_ctanf.c
@@ -0,0 +1,72 @@
+/* Complex tangent function for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ctanf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinff (__imag__ x))
+ {
+ __real__ res = __copysignf (0.0, __real__ x);
+ __imag__ res = __copysignf (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ float sin2rx, cos2rx;
+ float den;
+
+ __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+ den = cos2rx + __ieee754_coshf (2.0 * __imag__ x);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+#ifndef __ctanf
+weak_alias (__ctanf, ctanf)
+#endif
diff --git a/sysdeps/generic/s_ctanh.c b/sysdeps/generic/s_ctanh.c
new file mode 100644
index 0000000000..971cd9040c
--- /dev/null
+++ b/sysdeps/generic/s_ctanh.c
@@ -0,0 +1,74 @@
+/* Complex hyperbole tangent for double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__ctanh (__complex__ double x)
+{
+ __complex__ double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinf (__real__ x))
+ {
+ __real__ res = __copysign (1.0, __real__ x);
+ __imag__ res = __copysign (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nan ("");
+ __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ double sin2ix, cos2ix;
+ double den;
+
+ __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+ den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix);
+
+ __real__ res = __ieee754_sinh (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
+weak_alias (__ctanh, ctanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ctanh, __ctanhl)
+weak_alias (__ctanh, ctanhl)
+#endif
diff --git a/sysdeps/generic/s_ctanhf.c b/sysdeps/generic/s_ctanhf.c
new file mode 100644
index 0000000000..cfcabab36a
--- /dev/null
+++ b/sysdeps/generic/s_ctanhf.c
@@ -0,0 +1,72 @@
+/* Complex hyperbole tangent for float.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__ctanhf (__complex__ float x)
+{
+ __complex__ float res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinff (__real__ x))
+ {
+ __real__ res = __copysignf (1.0, __real__ x);
+ __imag__ res = __copysignf (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanf ("");
+ __imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ float sin2ix, cos2ix;
+ float den;
+
+ __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+ den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix);
+
+ __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
+#ifndef __ctanhf
+weak_alias (__ctanhf, ctanhf)
+#endif
diff --git a/sysdeps/generic/s_ctanhl.c b/sysdeps/generic/s_ctanhl.c
new file mode 100644
index 0000000000..7bf6b39199
--- /dev/null
+++ b/sysdeps/generic/s_ctanhl.c
@@ -0,0 +1,70 @@
+/* Complex hyperbole tangent for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanhl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinfl (__real__ x))
+ {
+ __real__ res = __copysignl (1.0, __real__ x);
+ __imag__ res = __copysignl (0.0, __imag__ x);
+ }
+ else if (__imag__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ long double sin2ix, cos2ix;
+ long double den;
+
+ __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+ den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix);
+
+ __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
+ __imag__ res = sin2ix / den;
+ }
+
+ return res;
+}
+weak_alias (__ctanhl, ctanhl)
diff --git a/sysdeps/generic/s_ctanl.c b/sysdeps/generic/s_ctanl.c
new file mode 100644
index 0000000000..fa153e9b35
--- /dev/null
+++ b/sysdeps/generic/s_ctanl.c
@@ -0,0 +1,70 @@
+/* Complex tangent function for long double.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanl (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ {
+ if (__isinfl (__imag__ x))
+ {
+ __real__ res = __copysignl (0.0, __real__ x);
+ __imag__ res = __copysignl (1.0, __imag__ x);
+ }
+ else if (__real__ x == 0.0)
+ {
+ res = x;
+ }
+ else
+ {
+ __real__ res = __nanl ("");
+ __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ long double sin2rx, cos2rx;
+ long double den;
+
+ __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+ den = cos2rx + __ieee754_coshl (2.0 * __imag__ x);
+
+ __real__ res = sin2rx / den;
+ __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
+ }
+
+ return res;
+}
+weak_alias (__ctanl, ctanl)
diff --git a/sysdeps/generic/s_erfl.c b/sysdeps/generic/s_erfl.c
new file mode 100644
index 0000000000..f329d58809
--- /dev/null
+++ b/sysdeps/generic/s_erfl.c
@@ -0,0 +1,26 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__erfl (long double x)
+{
+ fputs ("__erfl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__erfl, erfl)
+
+stub_warning (erfl)
+
+long double
+__erfcl (long double x)
+{
+ fputs ("__erfcl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__erfcl, erfcl)
+
+stub_warning (erfcl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/s_expm1l.c b/sysdeps/generic/s_expm1l.c
new file mode 100644
index 0000000000..b69d6aeb97
--- /dev/null
+++ b/sysdeps/generic/s_expm1l.c
@@ -0,0 +1,16 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__expm1l (long double x)
+{
+ fputs ("__expm1l not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+libm_hidden_def (__expm1l)
+weak_alias (__expm1l, expm1l)
+
+stub_warning (expm1l)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/s_fdim.c b/sysdeps/generic/s_fdim.c
new file mode 100644
index 0000000000..5804e631c3
--- /dev/null
+++ b/sysdeps/generic/s_fdim.c
@@ -0,0 +1,40 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+double
+__fdim (double x, double y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x <= y ? 0 : x - y;
+}
+weak_alias (__fdim, fdim)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fdim, __fdiml)
+weak_alias (__fdim, fdiml)
+#endif
diff --git a/sysdeps/generic/s_fdimf.c b/sysdeps/generic/s_fdimf.c
new file mode 100644
index 0000000000..2f3ce303ae
--- /dev/null
+++ b/sysdeps/generic/s_fdimf.c
@@ -0,0 +1,36 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+float
+__fdimf (float x, float y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x <= y ? 0 : x - y;
+}
+weak_alias (__fdimf, fdimf)
diff --git a/sysdeps/generic/s_fdiml.c b/sysdeps/generic/s_fdiml.c
new file mode 100644
index 0000000000..70246bafbd
--- /dev/null
+++ b/sysdeps/generic/s_fdiml.c
@@ -0,0 +1,36 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+long double
+__fdiml (long double x, long double y)
+{
+ int clsx = fpclassify (x);
+ int clsy = fpclassify (y);
+
+ if (clsx == FP_NAN || clsy == FP_NAN
+ || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+ /* Raise invalid flag. */
+ return x - y;
+
+ return x <= y ? 0 : x - y;
+}
+weak_alias (__fdiml, fdiml)
diff --git a/sysdeps/generic/s_fma.c b/sysdeps/generic/s_fma.c
new file mode 100644
index 0000000000..e5ff5a7228
--- /dev/null
+++ b/sysdeps/generic/s_fma.c
@@ -0,0 +1,33 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+double
+__fma (double x, double y, double z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fma, fma)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fma, __fmal)
+weak_alias (__fmal, fmal)
+#endif
diff --git a/sysdeps/generic/s_fmaf.c b/sysdeps/generic/s_fmaf.c
new file mode 100644
index 0000000000..caa7f3afe8
--- /dev/null
+++ b/sysdeps/generic/s_fmaf.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+float
+__fmaf (float x, float y, float z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fmaf, fmaf)
diff --git a/sysdeps/generic/s_fmal.c b/sysdeps/generic/s_fmal.c
new file mode 100644
index 0000000000..b89e88b9a3
--- /dev/null
+++ b/sysdeps/generic/s_fmal.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+long double
+__fmal (long double x, long double y, long double z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fmal, fmal)
diff --git a/sysdeps/generic/s_fmax.c b/sysdeps/generic/s_fmax.c
new file mode 100644
index 0000000000..f93e14f28c
--- /dev/null
+++ b/sysdeps/generic/s_fmax.c
@@ -0,0 +1,33 @@
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+
+double
+__fmax (double x, double y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmax, fmax)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmax, __fmaxl)
+weak_alias (__fmax, fmaxl)
+#endif
diff --git a/sysdeps/generic/s_fmaxf.c b/sysdeps/generic/s_fmaxf.c
new file mode 100644
index 0000000000..6f368e18b0
--- /dev/null
+++ b/sysdeps/generic/s_fmaxf.c
@@ -0,0 +1,29 @@
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+
+float
+__fmaxf (float x, float y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxf, fmaxf)
diff --git a/sysdeps/generic/s_fmaxl.c b/sysdeps/generic/s_fmaxl.c
new file mode 100644
index 0000000000..68c7060f42
--- /dev/null
+++ b/sysdeps/generic/s_fmaxl.c
@@ -0,0 +1,29 @@
+/* Return maximum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+
+long double
+__fmaxl (long double x, long double y)
+{
+ return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxl, fmaxl)
diff --git a/sysdeps/generic/s_fmin.c b/sysdeps/generic/s_fmin.c
new file mode 100644
index 0000000000..78f02da74a
--- /dev/null
+++ b/sysdeps/generic/s_fmin.c
@@ -0,0 +1,33 @@
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+
+double
+__fmin (double x, double y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmin, fmin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmin, __fminl)
+weak_alias (__fmin, fminl)
+#endif
diff --git a/sysdeps/generic/s_fminf.c b/sysdeps/generic/s_fminf.c
new file mode 100644
index 0000000000..d6aa9ccf62
--- /dev/null
+++ b/sysdeps/generic/s_fminf.c
@@ -0,0 +1,29 @@
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+
+float
+__fminf (float x, float y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminf, fminf)
diff --git a/sysdeps/generic/s_fminl.c b/sysdeps/generic/s_fminl.c
new file mode 100644
index 0000000000..5c1610aa85
--- /dev/null
+++ b/sysdeps/generic/s_fminl.c
@@ -0,0 +1,29 @@
+/* Return minimum numeric value of X and Y.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+
+
+long double
+__fminl (long double x, long double y)
+{
+ return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminl, fminl)
diff --git a/sysdeps/generic/s_ldexp.c b/sysdeps/generic/s_ldexp.c
new file mode 100644
index 0000000000..12c336fad4
--- /dev/null
+++ b/sysdeps/generic/s_ldexp.c
@@ -0,0 +1,37 @@
+/* @(#)s_ldexp.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+#include <errno.h>
+
+#ifdef __STDC__
+ double __ldexp(double value, int exp)
+#else
+ double __ldexp(value, exp)
+ double value; int exp;
+#endif
+{
+ if(!__finite(value)||value==0.0) return value;
+ value = __scalbn(value,exp);
+ if(!__finite(value)||value==0.0) __set_errno (ERANGE);
+ return value;
+}
+weak_alias (__ldexp, ldexp)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__ldexp, __ldexpl)
+weak_alias (__ldexp, ldexpl)
+#endif
diff --git a/sysdeps/generic/s_ldexpf.c b/sysdeps/generic/s_ldexpf.c
new file mode 100644
index 0000000000..631db422a3
--- /dev/null
+++ b/sysdeps/generic/s_ldexpf.c
@@ -0,0 +1,37 @@
+/* s_ldexpf.c -- float version of s_ldexp.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+#include <errno.h>
+
+#ifdef __STDC__
+ float __ldexpf(float value, int exp)
+#else
+ float __ldexpf(value, exp)
+ float value; int exp;
+#endif
+{
+ if(!__finitef(value)||value==(float)0.0) return value;
+ value = __scalbnf(value,exp);
+ if(!__finitef(value)||value==(float)0.0) __set_errno (ERANGE);
+ return value;
+}
+INTDEF(__ldexpf)
+weak_alias (__ldexpf, ldexpf)
diff --git a/sysdeps/generic/s_ldexpl.c b/sysdeps/generic/s_ldexpl.c
new file mode 100644
index 0000000000..123a6b3b58
--- /dev/null
+++ b/sysdeps/generic/s_ldexpl.c
@@ -0,0 +1,37 @@
+/* s_ldexpl.c -- long double version of s_ldexp.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+#include <errno.h>
+
+#ifdef __STDC__
+ long double __ldexpl(long double value, int exp)
+#else
+ long double __ldexpl(value, exp)
+ long double value; int exp;
+#endif
+{
+ if(!__finitel(value)||value==0.0) return value;
+ value = __scalbnl(value,exp);
+ if(!__finitel(value)||value==0.0) __set_errno (ERANGE);
+ return value;
+}
+weak_alias (__ldexpl, ldexpl)
diff --git a/sysdeps/generic/s_log1pl.c b/sysdeps/generic/s_log1pl.c
new file mode 100644
index 0000000000..e5db9078bf
--- /dev/null
+++ b/sysdeps/generic/s_log1pl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__log1pl (long double x)
+{
+ fputs ("__log1pl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+weak_alias (__log1pl, log1pl)
+
+stub_warning (log1pl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/s_nan.c b/sysdeps/generic/s_nan.c
new file mode 100644
index 0000000000..9b2c50558b
--- /dev/null
+++ b/sysdeps/generic/s_nan.c
@@ -0,0 +1,44 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ieee754.h>
+
+
+double
+__nan (const char *tagp)
+{
+ if (tagp[0] != '\0')
+ {
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtod (buf, NULL);
+ }
+
+ return NAN;
+}
+weak_alias (__nan, nan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nan, __nanl)
+weak_alias (__nan, nanl)
+#endif
diff --git a/sysdeps/generic/s_nanf.c b/sysdeps/generic/s_nanf.c
new file mode 100644
index 0000000000..2e1b1eb911
--- /dev/null
+++ b/sysdeps/generic/s_nanf.c
@@ -0,0 +1,40 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ieee754.h>
+
+
+float
+__nanf (const char *tagp)
+{
+ if (tagp[0] != '\0')
+ {
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtof (buf, NULL);
+ }
+
+ return NAN;
+}
+weak_alias (__nanf, nanf)
diff --git a/sysdeps/generic/s_nanl.c b/sysdeps/generic/s_nanl.c
new file mode 100644
index 0000000000..9709b92383
--- /dev/null
+++ b/sysdeps/generic/s_nanl.c
@@ -0,0 +1,40 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ieee754.h>
+
+
+long double
+__nanl (const char *tagp)
+{
+ if (tagp[0] != '\0')
+ {
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtold (buf, NULL);
+ }
+
+ return NAN;
+}
+weak_alias (__nanl, nanl)
diff --git a/sysdeps/generic/s_nextafter.c b/sysdeps/generic/s_nextafter.c
new file mode 100644
index 0000000000..c2d799d5df
--- /dev/null
+++ b/sysdeps/generic/s_nextafter.c
@@ -0,0 +1,100 @@
+/* @(#)s_nextafter.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp $";
+#endif
+
+/* IEEE functions
+ * nextafter(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * Special cases:
+ */
+
+/* Ugly hack so that the aliasing works. */
+#define __nexttoward __internal___nexttoward
+#define nexttoward __internal_nexttoward
+
+#include "math.h"
+#include "math_private.h"
+#include <float.h>
+
+#ifdef __STDC__
+ double __nextafter(double x, double y)
+#else
+ double __nextafter(x,y)
+ double x,y;
+#endif
+{
+ int32_t hx,hy,ix,iy;
+ u_int32_t lx,ly;
+
+ EXTRACT_WORDS(hx,lx,x);
+ EXTRACT_WORDS(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffff; /* |y| */
+
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
+ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
+ return x+y;
+ if(x==y) return y; /* x=y, return y */
+ if((ix|lx)==0) { /* x == 0 */
+ INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */
+ y = x*x;
+ if(y==x) return y; else return x; /* raise underflow flag */
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x < y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ } else { /* x < 0 */
+ if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x > y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ }
+ hy = hx&0x7ff00000;
+ if(hy>=0x7ff00000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
+ asm ("" : "=m"(x) : "m"(x));
+ return x; /* overflow */
+ }
+ if(hy<0x00100000) { /* underflow */
+ y = x*x;
+ if(y!=x) { /* raise underflow flag */
+ INSERT_WORDS(y,hx,lx);
+ return y;
+ }
+ }
+ INSERT_WORDS(x,hx,lx);
+ return x;
+}
+weak_alias (__nextafter, nextafter)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nextafter, __nextafterl)
+weak_alias (__nextafter, nextafterl)
+strong_alias (__nextafter, __nexttowardl)
+weak_alias (__nexttowardl, nexttowardl)
+#undef __nexttoward
+strong_alias (__nextafter, __nexttoward)
+#undef nexttoward
+weak_alias (__nextafter, nexttoward)
+#endif
diff --git a/sysdeps/generic/s_nexttowardf.c b/sysdeps/generic/s_nexttowardf.c
new file mode 100644
index 0000000000..4f502c210e
--- /dev/null
+++ b/sysdeps/generic/s_nexttowardf.c
@@ -0,0 +1,86 @@
+/* Single precision version of nexttoward.c.
+ Conversion to IEEE single float by Jakub Jelinek, jj@ultra.linux.cz. */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* IEEE functions
+ * nexttowardf(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * This is for machines which use the same binary type for double and
+ * long double.
+ * Special cases:
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <float.h>
+
+#ifdef __STDC__
+ float __nexttowardf(float x, long double y)
+#else
+ float __nexttowardf(x,y)
+ float x;
+ long double y;
+#endif
+{
+ int32_t hx,hy,ix,iy;
+ u_int32_t ly;
+
+ GET_FLOAT_WORD(hx,x);
+ EXTRACT_WORDS(hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = hy&0x7fffffff; /* |y| */
+
+ if((ix>0x7f800000) || /* x is nan */
+ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float x2;
+ SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/
+ x2 = x*x;
+ if(x2==x) return x2; else return x; /* raise underflow flag */
+ }
+ if(hx>=0) { /* x > 0 */
+ if(hy<0||(ix>>23)>(iy>>20)-0x380
+ || ((ix>>23)==(iy>>20)-0x380
+ && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff))) /* x > y, x -= ulp */
+ hx -= 1;
+ else /* x < y, x += ulp */
+ hx += 1;
+ } else { /* x < 0 */
+ if(hy>=0||(ix>>23)>(iy>>20)-0x380
+ || ((ix>>23)==(iy>>20)-0x380
+ && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff))) /* x < y, x -= ulp */
+ hx -= 1;
+ else /* x > y, x += ulp */
+ hx += 1;
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "=m"(x) : "m"(x));
+ return x;
+ }
+ if(hy<0x00800000) { /* underflow */
+ float x2 = x*x;
+ if(x2!=x) { /* raise underflow flag */
+ SET_FLOAT_WORD(x2,hx);
+ return x2;
+ }
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+weak_alias (__nexttowardf, nexttowardf)
diff --git a/sysdeps/generic/s_nexttowardl.c b/sysdeps/generic/s_nexttowardl.c
new file mode 100644
index 0000000000..73c3610fc1
--- /dev/null
+++ b/sysdeps/generic/s_nexttowardl.c
@@ -0,0 +1 @@
+/* This function is the same as nextafterl so we use an alias there. */
diff --git a/sysdeps/generic/s_significand.c b/sysdeps/generic/s_significand.c
new file mode 100644
index 0000000000..4ab078c473
--- /dev/null
+++ b/sysdeps/generic/s_significand.c
@@ -0,0 +1,39 @@
+/* @(#)s_signif.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Exp $";
+#endif
+
+/*
+ * significand(x) computes just
+ * scalb(x, (double) -ilogb(x)),
+ * for exercising the fraction-part(F) IEEE 754-1985 test vector.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __significand(double x)
+#else
+ double __significand(x)
+ double x;
+#endif
+{
+ return __ieee754_scalb(x,(double) -ilogb(x));
+}
+weak_alias (__significand, significand)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__significand, __significandl)
+weak_alias (__significand, significandl)
+#endif
diff --git a/sysdeps/generic/s_significandf.c b/sysdeps/generic/s_significandf.c
new file mode 100644
index 0000000000..2893a4e1b7
--- /dev/null
+++ b/sysdeps/generic/s_significandf.c
@@ -0,0 +1,32 @@
+/* s_significandf.c -- float version of s_significand.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_significandf.c,v 1.3 1995/05/10 20:48:13 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __significandf(float x)
+#else
+ float __significandf(x)
+ float x;
+#endif
+{
+ return __ieee754_scalbf(x,(float) -ilogbf(x));
+}
+weak_alias (__significandf, significandf)
diff --git a/sysdeps/generic/s_significandl.c b/sysdeps/generic/s_significandl.c
new file mode 100644
index 0000000000..d84e806fdc
--- /dev/null
+++ b/sysdeps/generic/s_significandl.c
@@ -0,0 +1,39 @@
+/* s_significandl.c -- long double version of s_significand.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * significandl(x) computes just
+ * scalbl(x, (long double) -ilogbl(x)),
+ * for exercising the fraction-part(F) IEEE 754-1985 test vector.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __significandl(long double x)
+#else
+ long double __significandl(x)
+ long double x;
+#endif
+{
+ return __ieee754_scalbl(x,(long double) -ilogbl(x));
+}
+weak_alias (__significandl, significandl)
diff --git a/sysdeps/generic/s_tanhl.c b/sysdeps/generic/s_tanhl.c
new file mode 100644
index 0000000000..bc9a2d7f48
--- /dev/null
+++ b/sysdeps/generic/s_tanhl.c
@@ -0,0 +1,15 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__tanhl(long double x)
+{
+ fputs ("__tanhl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__tanhl, tanhl)
+stub_warning (tanhl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sbrk.c b/sysdeps/generic/sbrk.c
new file mode 100644
index 0000000000..0df60076cc
--- /dev/null
+++ b/sysdeps/generic/sbrk.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 1991,1995,1996,1997,2000,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <errno.h>
+
+/* Defined in brk.c. */
+extern void *__curbrk;
+extern int __brk (void *addr);
+
+/* Defined in init-first.c. */
+extern int __libc_multiple_libcs attribute_hidden;
+
+/* Extend the process's data space by INCREMENT.
+ If INCREMENT is negative, shrink data space by - INCREMENT.
+ Return start of new space allocated, or -1 for errors. */
+void *
+__sbrk (intptr_t increment)
+{
+ void *oldbrk;
+
+ /* If this is not part of the dynamic library or the library is used
+ via dynamic loading in a statically linked program update
+ __curbrk from the kernel's brk value. That way two separate
+ instances of __brk and __sbrk can share the heap, returning
+ interleaved pieces of it. */
+ if (__curbrk == NULL || __libc_multiple_libcs)
+ if (__brk (0) < 0) /* Initialize the break. */
+ return (void *) -1;
+
+ if (increment == 0)
+ return __curbrk;
+
+ oldbrk = __curbrk;
+ if (__brk (oldbrk + increment) < 0)
+ return (void *) -1;
+
+ return oldbrk;
+}
+libc_hidden_def (__sbrk)
+weak_alias (__sbrk, sbrk)
diff --git a/sysdeps/generic/scandir64.c b/sysdeps/generic/scandir64.c
new file mode 100644
index 0000000000..68608de9a0
--- /dev/null
+++ b/sysdeps/generic/scandir64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <dirent.h>
+
+#define SCANDIR scandir64
+#define READDIR __readdir64
+#define DIRENT_TYPE struct dirent64
+
+int scandir64 (__const char *__restrict __dir,
+ struct dirent64 ***__restrict __namelist,
+ int (*__selector) (__const struct dirent64 *),
+ int (*__cmp) (__const void *, __const void *));
+
+#include <dirent/scandir.c>
diff --git a/sysdeps/generic/sched_getaffinity.c b/sysdeps/generic/sched_getaffinity.c
new file mode 100644
index 0000000000..b2e452f879
--- /dev/null
+++ b/sysdeps/generic/sched_getaffinity.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sched.h>
+#include <sys/types.h>
+
+
+/* Retrieve the CPU affinity mask for a particular process. */
+int
+sched_getaffinity (pid, cpusetsize, cpuset)
+ pid_t pid;
+ size_t cpusetsize;
+ cpu_set_t *cpuset;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_getaffinity)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_getp.c b/sysdeps/generic/sched_getp.c
new file mode 100644
index 0000000000..1ca77893f4
--- /dev/null
+++ b/sysdeps/generic/sched_getp.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sched.h>
+
+
+/* Retrieve scheduling parameters for a particular process. */
+int
+__sched_getparam (pid_t pid, struct sched_param *param)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_getparam)
+
+weak_alias (__sched_getparam, sched_getparam)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_gets.c b/sysdeps/generic/sched_gets.c
new file mode 100644
index 0000000000..479b913f32
--- /dev/null
+++ b/sysdeps/generic/sched_gets.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sched.h>
+#include <sys/types.h>
+
+
+/* Retrieve scheduling algorithm for a particular purpose. */
+int
+__sched_getscheduler (pid_t pid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_getscheduler)
+
+weak_alias (__sched_getscheduler, sched_getscheduler)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_primax.c b/sysdeps/generic/sched_primax.c
new file mode 100644
index 0000000000..4b3c1cbe67
--- /dev/null
+++ b/sysdeps/generic/sched_primax.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sched.h>
+
+
+/* Get maximum priority value for a scheduler. */
+int
+__sched_get_priority_max (int algorithm)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_get_priority_max)
+
+weak_alias (__sched_get_priority_max, sched_get_priority_max)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_primin.c b/sysdeps/generic/sched_primin.c
new file mode 100644
index 0000000000..813b8f63ca
--- /dev/null
+++ b/sysdeps/generic/sched_primin.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sched.h>
+
+
+/* Get minimum priority value for a scheduler. */
+int
+__sched_get_priority_min (int algorithm)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_get_priority_min)
+
+weak_alias (__sched_get_priority_min, sched_get_priority_min)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_rr_gi.c b/sysdeps/generic/sched_rr_gi.c
new file mode 100644
index 0000000000..f8fec63617
--- /dev/null
+++ b/sysdeps/generic/sched_rr_gi.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sched.h>
+#include <sys/types.h>
+
+
+/* Get the SCHED_RR interval for the named process. */
+int
+__sched_rr_get_interval (pid_t pid, struct timespec *t)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_rr_get_interval)
+
+weak_alias (__sched_rr_get_interval, sched_rr_get_interval)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_setaffinity.c b/sysdeps/generic/sched_setaffinity.c
new file mode 100644
index 0000000000..652163db85
--- /dev/null
+++ b/sysdeps/generic/sched_setaffinity.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sched.h>
+
+
+/* Retrieve the CPU affinity mask for a particular process. */
+int
+sched_setaffinity (pid, cpusetsize, cpuset)
+ pid_t pid;
+ size_t cpusetsize;
+ const cpu_set_t *cpuset;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_setaffinity)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_setp.c b/sysdeps/generic/sched_setp.c
new file mode 100644
index 0000000000..cc451fc131
--- /dev/null
+++ b/sysdeps/generic/sched_setp.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sched.h>
+
+
+/* Set scheduling parameters for a process. */
+int
+__sched_setparam (pid_t pid, const struct sched_param *param)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_setparam)
+
+weak_alias (__sched_setparam, sched_setparam)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_sets.c b/sysdeps/generic/sched_sets.c
new file mode 100644
index 0000000000..631cac228b
--- /dev/null
+++ b/sysdeps/generic/sched_sets.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sched.h>
+#include <sys/types.h>
+
+
+/* Set scheduling algorithm and/or parameters for a process. */
+int
+__sched_setscheduler (pid_t pid, int policy, const struct sched_param *param)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sched_setscheduler)
+stub_warning (sched_setscheduler)
+
+weak_alias (__sched_setscheduler, sched_setscheduler)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_yield.c b/sysdeps/generic/sched_yield.c
new file mode 100644
index 0000000000..ce41ce9b6f
--- /dev/null
+++ b/sysdeps/generic/sched_yield.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sched.h>
+
+
+/* Yield the processor. */
+int
+__sched_yield (void)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_yield)
+
+weak_alias (__sched_yield, sched_yield)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/seekdir.c b/sysdeps/generic/seekdir.c
new file mode 100644
index 0000000000..c3828cde0f
--- /dev/null
+++ b/sysdeps/generic/seekdir.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Seek to position POS in DIRP. */
+void
+seekdir (dirp, pos)
+ DIR *dirp;
+ long int pos;
+{
+ if (dirp == NULL)
+ {
+ __set_errno (EINVAL);
+ return;
+ }
+
+ __set_errno (ENOSYS);
+}
+
+
+stub_warning (seekdir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c
new file mode 100644
index 0000000000..f141fff661
--- /dev/null
+++ b/sysdeps/generic/segfault.c
@@ -0,0 +1,214 @@
+/* Catch segmentation faults and print backtrace.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <alloca.h>
+#include <ctype.h>
+#include <errno.h>
+#include <execinfo.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdio-common/_itoa.h>
+#include <ldsodefs.h>
+
+#include <bp-checks.h>
+
+/* This file defines macros to access the content of the sigcontext element
+ passed up by the signal handler. */
+#include <sigcontextinfo.h>
+
+/* Get code to possibly dump the content of all registers. */
+#include <register-dump.h>
+
+/* We'll use tis a lot. */
+#define WRITE_STRING(s) write (fd, s, strlen (s))
+
+/* Name of the output file. */
+static const char *fname;
+
+
+/* We better should not use `strerror' since it can call far too many
+ other functions which might fail. Do it here ourselves. */
+static void
+write_strsignal (int fd, int signal)
+{
+ if (signal < 0 || signal >= _NSIG || _sys_siglist[signal] == NULL)
+ {
+ char buf[30];
+ char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
+ WRITE_STRING ("signal ");
+ write (fd, buf, &buf[sizeof (buf)] - ptr);
+ }
+ else
+ WRITE_STRING (_sys_siglist[signal]);
+}
+
+
+/* This function is called when a segmentation fault is caught. The system
+ is in an instable state now. This means especially that malloc() might
+ not work anymore. */
+static void
+catch_segfault (int signal, SIGCONTEXT ctx)
+{
+ int fd, cnt, i;
+ void **arr;
+ struct sigaction sa;
+ uintptr_t pc;
+
+ /* This is the name of the file we are writing to. If none is given
+ or we cannot write to this file write to stderr. */
+ fd = 2;
+ if (fname != NULL)
+ {
+ fd = open (fname, O_TRUNC | O_WRONLY | O_CREAT, 0666);
+ if (fd == -1)
+ fd = 2;
+ }
+
+ WRITE_STRING ("*** ");
+ write_strsignal (fd, signal);
+ WRITE_STRING ("\n");
+
+#ifdef REGISTER_DUMP
+ REGISTER_DUMP;
+#endif
+
+ WRITE_STRING ("\nBacktrace:\n");
+
+ /* Get the backtrace. */
+ arr = alloca (256 * sizeof (void *));
+ cnt = backtrace (arr, 256);
+
+ /* Now try to locate the PC from signal context in the backtrace.
+ Normally it will be found at arr[2], but it might appear later
+ if there were some signal handler wrappers. Allow a few bytes
+ difference to cope with as many arches as possible. */
+ pc = (uintptr_t) GET_PC (ctx);
+ for (i = 0; i < cnt; ++i)
+ if ((uintptr_t) arr[i] >= pc - 16 && (uintptr_t) arr[i] <= pc + 16)
+ break;
+
+ /* If we haven't found it, better dump full backtrace even including
+ the signal handler frames instead of not dumping anything. */
+ if (i == cnt)
+ i = 0;
+
+ /* Now generate nicely formatted output. */
+ __backtrace_symbols_fd (arr + i, cnt - i, fd);
+
+#ifdef HAVE_PROC_SELF
+ /* Now the link map. */
+ int mapfd = open ("/proc/self/maps", O_RDONLY);
+ if (mapfd != -1)
+ {
+ write (fd, "\nMemory map:\n\n", 14);
+
+ char buf[256];
+ ssize_t n;
+
+ while ((n = TEMP_FAILURE_RETRY (read (mapfd, buf, sizeof (buf)))) > 0)
+ TEMP_FAILURE_RETRY (write (fd, buf, n));
+
+ close (mapfd);
+ }
+#endif
+
+ /* Pass on the signal (so that a core file is produced). */
+ sa.sa_handler = SIG_DFL;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction (signal, &sa, NULL);
+ raise (signal);
+}
+
+
+static void
+__attribute__ ((constructor))
+install_handler (void)
+{
+ struct sigaction sa;
+ const char *sigs = getenv ("SEGFAULT_SIGNALS");
+ const char *name;
+
+ sa.sa_handler = (void *) catch_segfault;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = SA_RESTART;
+
+ /* Maybe we are expected to use an alternative stack. */
+ if (getenv ("SEGFAULT_USE_ALTSTACK") != 0)
+ {
+ void *stack_mem = malloc (2 * SIGSTKSZ);
+ struct sigaltstack ss;
+
+ if (stack_mem != NULL)
+ {
+ ss.ss_sp = stack_mem;
+ ss.ss_flags = 0;
+ ss.ss_size = 2 * SIGSTKSZ;
+
+ if (sigaltstack (&ss, NULL) == 0)
+ sa.sa_flags |= SA_ONSTACK;
+ }
+ }
+
+ if (sigs == NULL)
+ sigaction (SIGSEGV, &sa, NULL);
+ else if (sigs[0] == '\0')
+ /* Do not do anything. */
+ return;
+ else
+ {
+ const char *where;
+ int all = __strcasecmp (sigs, "all") == 0;
+
+#define INSTALL_FOR_SIG(sig, name) \
+ where = __strcasestr (sigs, name); \
+ if (all || (where != NULL \
+ && (where == sigs || !isalnum (where[-1])) \
+ && !isalnum (where[sizeof (name) - 1]))) \
+ sigaction (sig, &sa, NULL);
+
+ INSTALL_FOR_SIG (SIGSEGV, "segv");
+ INSTALL_FOR_SIG (SIGILL, "ill");
+#ifdef SIGBUS
+ INSTALL_FOR_SIG (SIGBUS, "bus");
+#endif
+#ifdef SIGSTKFLT
+ INSTALL_FOR_SIG (SIGSTKFLT, "stkflt");
+#endif
+ INSTALL_FOR_SIG (SIGABRT, "abrt");
+ INSTALL_FOR_SIG (SIGFPE, "fpe");
+ }
+
+ /* Preserve the output file name if there is any given. */
+ name = getenv ("SEGFAULT_OUTPUT_NAME");
+ if (name != NULL && name[0] != '\0')
+ {
+ int ret = access (name, R_OK | W_OK);
+
+ if (ret == 0 || (ret == -1 && errno == ENOENT))
+ fname = __strdup (name);
+ }
+}
diff --git a/sysdeps/generic/select.c b/sysdeps/generic/select.c
new file mode 100644
index 0000000000..124f26aff7
--- /dev/null
+++ b/sysdeps/generic/select.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <errno.h>
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+ readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+ (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
+ after waiting the interval specified therein. Returns the number of ready
+ descriptors, or -1 for errors. */
+int
+__select (nfds, readfds, writefds, exceptfds, timeout)
+ int nfds;
+ fd_set *readfds;
+ fd_set *writefds;
+ fd_set *exceptfds;
+ struct timeval *timeout;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__select)
+stub_warning (select)
+
+weak_alias (__select, select)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/semctl.c b/sysdeps/generic/semctl.c
new file mode 100644
index 0000000000..28a8f37387
--- /dev/null
+++ b/sysdeps/generic/semctl.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sem.h>
+#include <errno.h>
+
+/* Return identifier for array of NSEMS semaphores associated with
+ KEY. */
+
+int
+semctl (int semid, int semnum, int cmd, ...)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (semctl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/semget.c b/sysdeps/generic/semget.c
new file mode 100644
index 0000000000..a9db299000
--- /dev/null
+++ b/sysdeps/generic/semget.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sem.h>
+#include <errno.h>
+
+/* Return identifier for array of NSEMS semaphores associated with
+ KEY. */
+
+int
+semget (key, nsems, semflg)
+ key_t key;
+ int nsems;
+ int semflg;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (semget)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/semop.c b/sysdeps/generic/semop.c
new file mode 100644
index 0000000000..6ebcb98ba9
--- /dev/null
+++ b/sysdeps/generic/semop.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sem.h>
+#include <errno.h>
+
+/* Perform user-defined atomical operation of array of semaphores. */
+
+int
+semop (semid, sops, nsops)
+ int semid;
+ struct sembuf *sops;
+ size_t nsops;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (semop)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/semtimedop.c b/sysdeps/generic/semtimedop.c
new file mode 100644
index 0000000000..82c5682655
--- /dev/null
+++ b/sysdeps/generic/semtimedop.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sem.h>
+#include <errno.h>
+
+/* Perform user-defined atomical operation of array of semaphores. */
+
+int
+semtimedop (semid, sops, nsops, timeout)
+ int semid;
+ struct sembuf *sops;
+ size_t nsops;
+ const struct timespec *timeout;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (semtimedop)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/send.c b/sysdeps/generic/send.c
new file mode 100644
index 0000000000..7f94fbb093
--- /dev/null
+++ b/sysdeps/generic/send.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
+ssize_t
+__send (fd, buf, n, flags)
+ int fd;
+ __const __ptr_t buf;
+ size_t n;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__send)
+weak_alias (__send, send)
+
+stub_warning (send)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sendfile.c b/sysdeps/generic/sendfile.c
new file mode 100644
index 0000000000..98dc9a814d
--- /dev/null
+++ b/sysdeps/generic/sendfile.c
@@ -0,0 +1,33 @@
+/* sendfile -- copy data directly from one file descriptor to another
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sendfile.h>
+#include <errno.h>
+
+/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
+ descriptor OUT_FD. */
+ssize_t
+sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sendfile)
+
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sendfile64.c b/sysdeps/generic/sendfile64.c
new file mode 100644
index 0000000000..76b961e22a
--- /dev/null
+++ b/sysdeps/generic/sendfile64.c
@@ -0,0 +1,33 @@
+/* sendfile -- copy data directly from one file descriptor to another
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sendfile.h>
+#include <errno.h>
+
+/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
+ descriptor OUT_FD. */
+ssize_t
+sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sendfile64)
+
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sendmsg.c b/sysdeps/generic/sendmsg.c
new file mode 100644
index 0000000000..a4a3cea950
--- /dev/null
+++ b/sysdeps/generic/sendmsg.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Send a message described MESSAGE on socket FD.
+ Returns the number of bytes sent, or -1 for errors. */
+ssize_t
+__sendmsg (fd, message, flags)
+ int fd;
+ const struct msghdr *message;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__sendmsg, sendmsg)
+
+stub_warning (sendmsg)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sendto.c b/sysdeps/generic/sendto.c
new file mode 100644
index 0000000000..823c9dd1c7
--- /dev/null
+++ b/sysdeps/generic/sendto.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
+ ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
+ssize_t
+__sendto (fd, buf, n, flags, addr, addr_len)
+ int fd;
+ __const __ptr_t buf;
+ size_t n;
+ int flags;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t addr_len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__sendto, sendto)
+
+stub_warning (sendto)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setcontext.c b/sysdeps/generic/setcontext.c
new file mode 100644
index 0000000000..5841e20317
--- /dev/null
+++ b/sysdeps/generic/setcontext.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+int
+setcontext (ucp)
+ const ucontext_t *ucp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (setcontext)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setdomain.c b/sysdeps/generic/setdomain.c
new file mode 100644
index 0000000000..4d9cbb7cac
--- /dev/null
+++ b/sysdeps/generic/setdomain.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the name of the current YP domain to NAME, which is LEN bytes long.
+ This call is restricted to the super-user. */
+int
+setdomainname (name, len)
+ const char *name;
+ size_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (setdomainname)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setegid.c b/sysdeps/generic/setegid.c
new file mode 100644
index 0000000000..5b5e2cf4bb
--- /dev/null
+++ b/sysdeps/generic/setegid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992,1994,1995,1996,1997,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective group ID of the calling process to GID. */
+int
+setegid (gid)
+ __gid_t gid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (setegid)
+stub_warning (setegid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
new file mode 100644
index 0000000000..48aaecffe0
--- /dev/null
+++ b/sysdeps/generic/setenv.c
@@ -0,0 +1,353 @@
+/* Copyright (C) 1992,1995-2001,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <errno.h>
+#if !_LIBC
+# if !defined errno && !defined HAVE_ERRNO_DECL
+extern int errno;
+# endif
+# define __set_errno(ev) ((errno) = (ev))
+#endif
+
+#if _LIBC || HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if _LIBC || HAVE_STRING_H
+# include <string.h>
+#endif
+#if _LIBC || HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if !_LIBC
+# define __environ environ
+# ifndef HAVE_ENVIRON_DECL
+extern char **environ;
+# endif
+#endif
+
+#if _LIBC
+/* This lock protects against simultaneous modifications of `environ'. */
+# include <bits/libc-lock.h>
+__libc_lock_define_initialized (static, envlock)
+# define LOCK __libc_lock_lock (envlock)
+# define UNLOCK __libc_lock_unlock (envlock)
+#else
+# define LOCK
+# define UNLOCK
+#endif
+
+/* In the GNU C library we must keep the namespace clean. */
+#ifdef _LIBC
+# define setenv __setenv
+# define unsetenv __unsetenv
+# define clearenv __clearenv
+# define tfind __tfind
+# define tsearch __tsearch
+#endif
+
+/* In the GNU C library implementation we try to be more clever and
+ allow arbitrarily many changes of the environment given that the used
+ values are from a small set. Outside glibc this will eat up all
+ memory after a while. */
+#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
+ && defined __GNUC__)
+# define USE_TSEARCH 1
+# include <search.h>
+
+/* This is a pointer to the root of the search tree with the known
+ values. */
+static void *known_values;
+
+# define KNOWN_VALUE(Str) \
+ ({ \
+ void *value = tfind (Str, &known_values, (__compar_fn_t) strcmp); \
+ value != NULL ? *(char **) value : NULL; \
+ })
+# define STORE_VALUE(Str) \
+ tsearch (Str, &known_values, (__compar_fn_t) strcmp)
+
+#else
+# undef USE_TSEARCH
+
+# define KNOWN_VALUE(Str) NULL
+# define STORE_VALUE(Str) do { } while (0)
+
+#endif
+
+
+/* If this variable is not a null pointer we allocated the current
+ environment. */
+static char **last_environ;
+
+
+/* This function is used by `setenv' and `putenv'. The difference between
+ the two functions is that for the former must create a new string which
+ is then placed in the environment, while the argument of `putenv'
+ must be used directly. This is all complicated by the fact that we try
+ to reuse values once generated for a `setenv' call since we can never
+ free the strings. */
+int
+__add_to_environ (name, value, combined, replace)
+ const char *name;
+ const char *value;
+ const char *combined;
+ int replace;
+{
+ register char **ep;
+ register size_t size;
+ const size_t namelen = strlen (name);
+ const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
+
+ LOCK;
+
+ /* We have to get the pointer now that we have the lock and not earlier
+ since another thread might have created a new environment. */
+ ep = __environ;
+
+ size = 0;
+ if (ep != NULL)
+ {
+ for (; *ep != NULL; ++ep)
+ if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
+ break;
+ else
+ ++size;
+ }
+
+ if (ep == NULL || __builtin_expect (*ep == NULL, 1))
+ {
+ char **new_environ;
+
+ /* We allocated this space; we can extend it. */
+ new_environ = (char **) realloc (last_environ,
+ (size + 2) * sizeof (char *));
+ if (new_environ == NULL)
+ {
+ UNLOCK;
+ return -1;
+ }
+
+ /* If the whole entry is given add it. */
+ if (combined != NULL)
+ /* We must not add the string to the search tree since it belongs
+ to the user. */
+ new_environ[size] = (char *) combined;
+ else
+ {
+ /* See whether the value is already known. */
+#ifdef USE_TSEARCH
+# ifdef __GNUC__
+ char new_value[namelen + 1 + vallen];
+# else
+ char *new_value = (char *) alloca (namelen + 1 + vallen);
+# endif
+# ifdef _LIBC
+ __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+ value, vallen);
+# else
+ memcpy (new_value, name, namelen);
+ new_value[namelen] = '=';
+ memcpy (&new_value[namelen + 1], value, vallen);
+# endif
+
+ new_environ[size] = KNOWN_VALUE (new_value);
+ if (__builtin_expect (new_environ[size] == NULL, 1))
+#endif
+ {
+ new_environ[size] = (char *) malloc (namelen + 1 + vallen);
+ if (__builtin_expect (new_environ[size] == NULL, 0))
+ {
+ __set_errno (ENOMEM);
+ UNLOCK;
+ return -1;
+ }
+
+#ifdef USE_TSEARCH
+ memcpy (new_environ[size], new_value, namelen + 1 + vallen);
+#else
+ memcpy (new_environ[size], name, namelen);
+ new_environ[size][namelen] = '=';
+ memcpy (&new_environ[size][namelen + 1], value, vallen);
+#endif
+ /* And save the value now. We cannot do this when we remove
+ the string since then we cannot decide whether it is a
+ user string or not. */
+ STORE_VALUE (new_environ[size]);
+ }
+ }
+
+ if (__environ != last_environ)
+ memcpy ((char *) new_environ, (char *) __environ,
+ size * sizeof (char *));
+
+ new_environ[size + 1] = NULL;
+
+ last_environ = __environ = new_environ;
+ }
+ else if (replace)
+ {
+ char *np;
+
+ /* Use the user string if given. */
+ if (combined != NULL)
+ np = (char *) combined;
+ else
+ {
+#ifdef USE_TSEARCH
+# ifdef __GNUC__
+ char new_value[namelen + 1 + vallen];
+# else
+ char *new_value = (char *) alloca (namelen + 1 + vallen);
+# endif
+# ifdef _LIBC
+ __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
+ value, vallen);
+# else
+ memcpy (new_value, name, namelen);
+ new_value[namelen] = '=';
+ memcpy (&new_value[namelen + 1], value, vallen);
+# endif
+
+ np = KNOWN_VALUE (new_value);
+ if (__builtin_expect (np == NULL, 1))
+#endif
+ {
+ np = malloc (namelen + 1 + vallen);
+ if (__builtin_expect (np == NULL, 0))
+ {
+ UNLOCK;
+ return -1;
+ }
+
+#ifdef USE_TSEARCH
+ memcpy (np, new_value, namelen + 1 + vallen);
+#else
+ memcpy (np, name, namelen);
+ np[namelen] = '=';
+ memcpy (&np[namelen + 1], value, vallen);
+#endif
+ /* And remember the value. */
+ STORE_VALUE (np);
+ }
+ }
+
+ *ep = np;
+ }
+
+ UNLOCK;
+
+ return 0;
+}
+
+int
+setenv (name, value, replace)
+ const char *name;
+ const char *value;
+ int replace;
+{
+ if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __add_to_environ (name, value, NULL, replace);
+}
+
+int
+unsetenv (name)
+ const char *name;
+{
+ size_t len;
+ char **ep;
+
+ if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ len = strlen (name);
+
+ LOCK;
+
+ ep = __environ;
+ while (*ep != NULL)
+ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+ {
+ /* Found it. Remove this pointer by moving later ones back. */
+ char **dp = ep;
+
+ do
+ dp[0] = dp[1];
+ while (*dp++);
+ /* Continue the loop in case NAME appears again. */
+ }
+ else
+ ++ep;
+
+ UNLOCK;
+
+ return 0;
+}
+
+/* The `clearenv' was planned to be added to POSIX.1 but probably
+ never made it. Nevertheless the POSIX.9 standard (POSIX bindings
+ for Fortran 77) requires this function. */
+int
+clearenv ()
+{
+ LOCK;
+
+ if (__environ == last_environ && __environ != NULL)
+ {
+ /* We allocated this environment so we can free it. */
+ free (__environ);
+ last_environ = NULL;
+ }
+
+ /* Clear the environment pointer removes the whole environment. */
+ __environ = NULL;
+
+ UNLOCK;
+
+ return 0;
+}
+#ifdef _LIBC
+libc_freeres_fn (free_mem)
+{
+ /* Remove all traces. */
+ clearenv ();
+
+ /* Now remove the search tree. */
+ __tdestroy (known_values, free);
+ known_values = NULL;
+}
+
+# undef setenv
+# undef unsetenv
+# undef clearenv
+weak_alias (__setenv, setenv)
+weak_alias (__unsetenv, unsetenv)
+weak_alias (__clearenv, clearenv)
+#endif
diff --git a/sysdeps/generic/seteuid.c b/sysdeps/generic/seteuid.c
new file mode 100644
index 0000000000..689000f993
--- /dev/null
+++ b/sysdeps/generic/seteuid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective user ID of the calling process to UID. */
+int
+seteuid (uid)
+ __uid_t uid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (seteuid)
+stub_warning (seteuid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setfpucw.c b/sysdeps/generic/setfpucw.c
new file mode 100644
index 0000000000..cb50f9f3f1
--- /dev/null
+++ b/sysdeps/generic/setfpucw.c
@@ -0,0 +1,37 @@
+/* Set the FPU control word.
+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <fpu_control.h>
+
+void
+__setfpucw (fpu_control_t set)
+{
+ fpu_control_t cw;
+
+ /* Fetch the current control word. */
+ _FPU_GETCW (cw);
+
+ /* Preserve the reserved bits, and set the rest as the user
+ specified (or the default, if the user gave zero). */
+ cw &= _FPU_RESERVED;
+ cw |= set & ~_FPU_RESERVED;
+
+ _FPU_SETCW (cw);
+}
diff --git a/sysdeps/generic/setgid.c b/sysdeps/generic/setgid.c
new file mode 100644
index 0000000000..05c2cc6621
--- /dev/null
+++ b/sysdeps/generic/setgid.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the group ID of the calling process to GID.
+ If the calling process is the super-user, the real
+ and effective group IDs, and the saved set-group-ID to GID;
+ if not, the effective group ID is set to GID. */
+int
+__setgid (gid)
+ gid_t gid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setgid)
+
+weak_alias (__setgid, setgid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setgroups.c b/sysdeps/generic/setgroups.c
new file mode 100644
index 0000000000..74bae72974
--- /dev/null
+++ b/sysdeps/generic/setgroups.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991,95,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <grp.h>
+
+/* Set the group set for the current user to GROUPS (N of them). */
+int
+setgroups (n, groups)
+ size_t n;
+ const gid_t *groups;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (setgroups)
+
+stub_warning (setgroups)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sethostid.c b/sysdeps/generic/sethostid.c
new file mode 100644
index 0000000000..6f393de06a
--- /dev/null
+++ b/sysdeps/generic/sethostid.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the current machine's Internet number to ID.
+ This call is restricted to the super-user. */
+int
+sethostid (id)
+ long int id;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (sethostid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sethostname.c b/sysdeps/generic/sethostname.c
new file mode 100644
index 0000000000..1f65b1e759
--- /dev/null
+++ b/sysdeps/generic/sethostname.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the name of the current host to NAME, which is LEN bytes long.
+ This call is restricted to the super-user. */
+int
+sethostname (name, len)
+ const char *name;
+ size_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (sethostname)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setipv4sourcefilter.c b/sysdeps/generic/setipv4sourcefilter.c
new file mode 100644
index 0000000000..db2b8433bb
--- /dev/null
+++ b/sysdeps/generic/setipv4sourcefilter.c
@@ -0,0 +1,33 @@
+/* Set source filter. Stub version.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+setipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+ uint32_t fmode, uint32_t numsrc,
+ const struct in_addr *slist)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setipv4sourcefilter)
diff --git a/sysdeps/generic/setitimer.c b/sysdeps/generic/setitimer.c
new file mode 100644
index 0000000000..755fa06a7b
--- /dev/null
+++ b/sysdeps/generic/setitimer.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/time.h>
+
+/* Set the timer WHICH to *NEW. If OLD is not NULL,
+ set *OLD to the old value of timer WHICH.
+ Returns 0 on success, -1 on errors. */
+int
+__setitimer (which, new, old)
+ enum __itimer_which which;
+ const struct itimerval *new;
+ struct itimerval *old;
+{
+ if (new == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setitimer)
+
+weak_alias (__setitimer, setitimer)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setjmp.c b/sysdeps/generic/setjmp.c
new file mode 100644
index 0000000000..0676ff1396
--- /dev/null
+++ b/sysdeps/generic/setjmp.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <setjmp.h>
+
+
+/* Save the current program position in ENV and return 0. */
+int
+__libc_sigsetjmp (jmp_buf env, int savemask)
+{
+ /* Save the signal mask if requested. */
+ __sigjmp_save (env, savemask);
+
+ __set_errno (ENOSYS);
+ /* No way to signal failure. */
+ return 0;
+}
+
+weak_alias (__libc_sigsetjmp, __sigsetjmp)
+stub_warning (__sigsetjmp)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setlogin.c b/sysdeps/generic/setlogin.c
new file mode 100644
index 0000000000..c16e29dd9e
--- /dev/null
+++ b/sysdeps/generic/setlogin.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the login name returned by `getlogin'. */
+int
+setlogin (name)
+ const char *name;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (setlogin)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setpgid.c b/sysdeps/generic/setpgid.c
new file mode 100644
index 0000000000..cb2abf1159
--- /dev/null
+++ b/sysdeps/generic/setpgid.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the process group ID of the process matching PID to PGID.
+ If PID is zero, the current process's process group ID is set.
+ If PGID is zero, the process ID of the process is used. */
+int
+__setpgid (pid, pgid)
+ int pid;
+ int pgid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__setpgid)
+stub_warning (setpgid)
+
+weak_alias (__setpgid, setpgid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setpgrp.c b/sysdeps/generic/setpgrp.c
new file mode 100644
index 0000000000..8ceb159341
--- /dev/null
+++ b/sysdeps/generic/setpgrp.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+
+int
+setpgrp ()
+{
+ return __setpgid (0, 0);
+}
diff --git a/sysdeps/generic/setpriority.c b/sysdeps/generic/setpriority.c
new file mode 100644
index 0000000000..b2e6f8a059
--- /dev/null
+++ b/sysdeps/generic/setpriority.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991,95,96,97,2000,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/resource.h>
+
+/* Set the priority of all processes specified by WHICH and WHO
+ to PRIO. Returns 0 on success, -1 on errors. */
+int
+setpriority (which, who, prio)
+ enum __priority_which which;
+ id_t who;
+ int prio;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (setpriority)
+
+stub_warning (setpriority)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setregid.c b/sysdeps/generic/setregid.c
new file mode 100644
index 0000000000..f8f33d1da7
--- /dev/null
+++ b/sysdeps/generic/setregid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the real group ID of the calling process to RGID,
+ and the effective group ID of the calling process to EGID. */
+int
+__setregid (effective_gid, real_gid)
+ gid_t effective_gid;
+ gid_t real_gid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setregid)
+
+weak_alias (__setregid, setregid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setresgid.c b/sysdeps/generic/setresgid.c
new file mode 100644
index 0000000000..78e308c5d0
--- /dev/null
+++ b/sysdeps/generic/setresgid.c
@@ -0,0 +1,35 @@
+/* setresgid -- set effective group ID, real group ID, and saved-set group ID
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective group ID, real group ID, and saved-set group ID,
+ of the calling process to EGID, RGID, and SGID, respectively. */
+int
+__setresgid (gid_t egid, gid_t rgid, gid_t sgid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__setresgid)
+stub_warning (setresgid)
+
+weak_alias (__setresgid, setresgid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setresuid.c b/sysdeps/generic/setresuid.c
new file mode 100644
index 0000000000..430b63b2fd
--- /dev/null
+++ b/sysdeps/generic/setresuid.c
@@ -0,0 +1,35 @@
+/* setresuid -- set effective user ID, real user ID, and saved-set user ID
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective user ID, real user ID, and saved-set user ID,
+ of the calling process to EUID, RUID, and SUID, respectively. */
+int
+__setresuid (uid_t euid, uid_t ruid, uid_t suid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__setresuid)
+stub_warning (setresuid)
+
+weak_alias (__setresuid, setresuid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setreuid.c b/sysdeps/generic/setreuid.c
new file mode 100644
index 0000000000..cce2d9d52b
--- /dev/null
+++ b/sysdeps/generic/setreuid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the real user ID of the calling process to RUID,
+ and the effective user ID of the calling process to EUID. */
+int
+__setreuid (effective_uid, real_uid)
+ uid_t effective_uid;
+ uid_t real_uid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setreuid)
+
+weak_alias (__setreuid, setreuid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setrlimit.c b/sysdeps/generic/setrlimit.c
new file mode 100644
index 0000000000..c8f6e03ad3
--- /dev/null
+++ b/sysdeps/generic/setrlimit.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+
+/* Set the soft and hard limits for RESOURCE to *RLIMITS.
+ Only the super-user can increase hard limits.
+ Return 0 if successful, -1 if not (and sets errno). */
+int
+setrlimit (resource, rlimits)
+ enum __rlimit_resource resource;
+ const struct rlimit *rlimits;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (setrlimit)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setrlimit64.c b/sysdeps/generic/setrlimit64.c
new file mode 100644
index 0000000000..d4b4bfce0a
--- /dev/null
+++ b/sysdeps/generic/setrlimit64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+
+/* Set the soft and hard limits for RESOURCE to *RLIMITS.
+ Only the super-user can increase hard limits.
+ Return 0 if successful, -1 if not (and sets errno). */
+int
+setrlimit64 (resource, rlimits)
+ enum __rlimit_resource resource;
+ const struct rlimit64 *rlimits;
+{
+ struct rlimit rlimits32;
+
+ if (rlimits->rlim_cur >= RLIM_INFINITY)
+ rlimits32.rlim_cur = RLIM_INFINITY;
+ else
+ rlimits32.rlim_cur = rlimits->rlim_cur;
+ if (rlimits->rlim_max >= RLIM_INFINITY)
+ rlimits32.rlim_max = RLIM_INFINITY;
+ else
+ rlimits32.rlim_max = rlimits->rlim_max;
+
+ return __setrlimit (resource, &rlimits32);
+}
diff --git a/sysdeps/generic/setsid.c b/sysdeps/generic/setsid.c
new file mode 100644
index 0000000000..6a6712b9bd
--- /dev/null
+++ b/sysdeps/generic/setsid.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+
+/* Create a new session with the calling process as its leader.
+ The process group IDs of the session and the calling process
+ are set to the process ID of the calling process, which is returned. */
+int
+__setsid ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setsid)
+
+weak_alias (__setsid, setsid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setsockopt.c b/sysdeps/generic/setsockopt.c
new file mode 100644
index 0000000000..aca73623fe
--- /dev/null
+++ b/sysdeps/generic/setsockopt.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Set socket FD's option OPTNAME at protocol level LEVEL
+ to *OPTVAL (which is OPTLEN bytes long).
+ Returns 0 on success, -1 for errors. */
+int
+__setsockopt (fd, level, optname, optval, optlen)
+ int fd;
+ int level;
+ int optname;
+ const __ptr_t optval;
+ socklen_t optlen;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__setsockopt, setsockopt)
+
+stub_warning (setsockopt)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setsourcefilter.c b/sysdeps/generic/setsourcefilter.c
new file mode 100644
index 0000000000..870f5e2c38
--- /dev/null
+++ b/sysdeps/generic/setsourcefilter.c
@@ -0,0 +1,33 @@
+/* Set source filter. Stub version.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <netinet/in.h>
+
+
+int
+setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+ socklen_t grouplen, uint32_t fmode, uint32_t numsrc,
+ const struct sockaddr_storage *slist)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setsourcefilter)
diff --git a/sysdeps/generic/settimeofday.c b/sysdeps/generic/settimeofday.c
new file mode 100644
index 0000000000..abff6f92a1
--- /dev/null
+++ b/sysdeps/generic/settimeofday.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/time.h>
+
+/* Set the current time of day and timezone information.
+ This call is restricted to the super-user. */
+int
+__settimeofday (tv, tz)
+ const struct timeval *tv;
+ const struct timezone *tz;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (settimeofday)
+
+weak_alias (__settimeofday, settimeofday)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setuid.c b/sysdeps/generic/setuid.c
new file mode 100644
index 0000000000..96c3e01cb9
--- /dev/null
+++ b/sysdeps/generic/setuid.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the user ID of the calling process to UID.
+ If the calling process is the super-user, the real
+ and effective user IDs, and the saved set-user-ID to UID;
+ if not, the effective user ID is set to UID. */
+int
+__setuid (uid)
+ uid_t uid;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setuid)
+
+weak_alias (__setuid, setuid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/setutxent.c b/sysdeps/generic/setutxent.c
new file mode 100644
index 0000000000..b6cd282644
--- /dev/null
+++ b/sysdeps/generic/setutxent.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+void
+setutxent (void)
+{
+ return __setutent ();
+}
diff --git a/sysdeps/generic/setxattr.c b/sysdeps/generic/setxattr.c
new file mode 100644
index 0000000000..5b8743a7ce
--- /dev/null
+++ b/sysdeps/generic/setxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+setxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (setxattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/shm_open.c b/sysdeps/generic/shm_open.c
new file mode 100644
index 0000000000..6a53903a75
--- /dev/null
+++ b/sysdeps/generic/shm_open.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/mman.h>
+
+/* Open shared memory object. */
+int
+shm_open (const char *name, int oflag, mode_t mode)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (shm_open)
+
+#include <stub-tag.h>
diff --git a/sysdeps/generic/shm_unlink.c b/sysdeps/generic/shm_unlink.c
new file mode 100644
index 0000000000..28478b895b
--- /dev/null
+++ b/sysdeps/generic/shm_unlink.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/mman.h>
+
+/* Remove shared memory object. */
+int
+shm_unlink (const char *name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (shm_unlink)
+
+#include <stub-tag.h>
diff --git a/sysdeps/generic/shmat.c b/sysdeps/generic/shmat.c
new file mode 100644
index 0000000000..f418f3e774
--- /dev/null
+++ b/sysdeps/generic/shmat.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/shm.h>
+#include <errno.h>
+
+/* Attach the shared memory segment associated with SHMID to the data
+ segment of the calling process. SHMADDR and SHMFLG determine how
+ and where the segment is attached. */
+
+void *
+shmat (shmid, shmaddr, shmflg)
+ int shmid;
+ const void *shmaddr;
+ int shmflg;
+{
+ __set_errno (ENOSYS);
+ return (void *) -1;
+}
+
+stub_warning (shmat)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/shmctl.c b/sysdeps/generic/shmctl.c
new file mode 100644
index 0000000000..83374e4b92
--- /dev/null
+++ b/sysdeps/generic/shmctl.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/shm.h>
+#include <errno.h>
+
+/* Provide operations to control over shared memory segments. */
+
+int
+shmctl (shmid, cmd, buf)
+ int shmid;
+ int cmd;
+ struct shmid_ds *buf;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (shmctl)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/shmdt.c b/sysdeps/generic/shmdt.c
new file mode 100644
index 0000000000..e77f39daac
--- /dev/null
+++ b/sysdeps/generic/shmdt.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/shm.h>
+#include <errno.h>
+
+/* Detach shared memory segment starting at address specified by SHMADDR
+ from the caller's data segment. */
+
+int
+shmdt (shmaddr)
+ const void *shmaddr;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (shmdt)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/shmget.c b/sysdeps/generic/shmget.c
new file mode 100644
index 0000000000..7426de656d
--- /dev/null
+++ b/sysdeps/generic/shmget.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/shm.h>
+#include <errno.h>
+
+/* Return an identifier for an shared memory segment of at least size SIZE
+ which is associated with KEY. */
+
+int
+shmget (key, size, shmflg)
+ key_t key;
+ size_t size;
+ int shmflg;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (shmget)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/shutdown.c b/sysdeps/generic/shutdown.c
new file mode 100644
index 0000000000..6fb25a4bc1
--- /dev/null
+++ b/sysdeps/generic/shutdown.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Shut down all or part of the connection open on socket FD.
+ HOW determines what to shut down:
+ 0 = No more receptions;
+ 1 = No more transmissions;
+ 2 = No more receptions or transmissions.
+ Returns 0 on success, -1 for errors. */
+int
+shutdown (fd, how)
+ int fd;
+ int how;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (shutdown)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigaction.c b/sysdeps/generic/sigaction.c
new file mode 100644
index 0000000000..bf0a15bacb
--- /dev/null
+++ b/sysdeps/generic/sigaction.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+ If OACT is not NULL, put the old action for SIG in *OACT. */
+int
+__sigaction (sig, act, oact)
+ int sig;
+ const struct sigaction *act;
+ struct sigaction *oact;
+{
+ if (sig <= 0 || sig >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigaction)
+stub_warning (sigaction)
+
+weak_alias (__sigaction, sigaction)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigaltstack.c b/sysdeps/generic/sigaltstack.c
new file mode 100644
index 0000000000..17c7e06b35
--- /dev/null
+++ b/sysdeps/generic/sigaltstack.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Run signals handlers on the stack specified by SS (if not NULL).
+ If OSS is not NULL, it is filled in with the old signal stack status. */
+int
+sigaltstack (ss, oss)
+ const struct sigaltstack *ss;
+ struct sigaltstack *oss;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigaltstack)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigblock.c b/sysdeps/generic/sigblock.c
new file mode 100644
index 0000000000..81a4ff1447
--- /dev/null
+++ b/sysdeps/generic/sigblock.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Block signals in MASK, returning the old mask. */
+int
+__sigblock (mask)
+ int mask;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigblock)
+
+weak_alias (__sigblock, sigblock)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigfillset.c b/sysdeps/generic/sigfillset.c
new file mode 100644
index 0000000000..95d52cf0c0
--- /dev/null
+++ b/sysdeps/generic/sigfillset.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991,96,97,2002,2003,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+/* Set all signals in SET. */
+int
+sigfillset (set)
+ sigset_t *set;
+{
+ if (set == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ memset (set, 0xff, sizeof (sigset_t));
+
+ /* If the implementation uses a cancellation signal don't set the bit. */
+#ifdef SIGCANCEL
+ __sigdelset (set, SIGCANCEL);
+#endif
+ /* Likewise for the signal to implement setxid. */
+#ifdef SIGSETXID
+ __sigdelset (set, SIGSETXID);
+#endif
+
+ return 0;
+}
+libc_hidden_def (sigfillset)
diff --git a/sysdeps/generic/sigignore.c b/sysdeps/generic/sigignore.c
new file mode 100644
index 0000000000..734422dd81
--- /dev/null
+++ b/sysdeps/generic/sigignore.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the disposition for SIG to SIG_IGN. */
+int
+sigignore (sig)
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigignore)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigintr.c b/sysdeps/generic/sigintr.c
new file mode 100644
index 0000000000..9d4c2c8f58
--- /dev/null
+++ b/sysdeps/generic/sigintr.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
+ (causing them to fail with EINTR); if INTERRUPT is zero, make system
+ calls be restarted after signal SIG. */
+int
+siginterrupt (sig, interrupt)
+ int sig;
+ int interrupt;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (siginterrupt)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigjmp.c b/sysdeps/generic/sigjmp.c
new file mode 100644
index 0000000000..b23c547f5e
--- /dev/null
+++ b/sysdeps/generic/sigjmp.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+
+/* This function is called by the `sigsetjmp' macro
+ before doing a `__setjmp' on ENV[0].__jmpbuf.
+ Always return zero. */
+
+int
+__sigjmp_save (sigjmp_buf env, int savemask)
+{
+ env[0].__mask_was_saved = (savemask &&
+ __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
+ &env[0].__saved_mask) == 0);
+
+ return 0;
+}
diff --git a/sysdeps/generic/siglist.c b/sysdeps/generic/siglist.c
new file mode 100644
index 0000000000..80847cd491
--- /dev/null
+++ b/sysdeps/generic/siglist.c
@@ -0,0 +1,38 @@
+/* Define list of all signal numbers and their names.
+ Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <signal.h>
+#include <libintl.h>
+
+const char *const _sys_siglist[NSIG] =
+{
+#define init_sig(sig, abbrev, desc) [sig] = desc,
+#include <siglist.h>
+#undef init_sig
+};
+strong_alias (_sys_siglist, _sys_siglist_internal)
+
+
+const char *const _sys_sigabbrev[NSIG] =
+{
+#define init_sig(sig, abbrev, desc) [sig] = abbrev,
+#include <siglist.h>
+#undef init_sig
+};
diff --git a/sysdeps/generic/signal.c b/sysdeps/generic/signal.c
new file mode 100644
index 0000000000..6c1808bb15
--- /dev/null
+++ b/sysdeps/generic/signal.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the handler for the signal SIG to HANDLER,
+ returning the old handler, or SIG_ERR on error. */
+__sighandler_t
+signal (sig, handler)
+ int sig;
+ __sighandler_t handler;
+{
+ __set_errno (ENOSYS);
+ return SIG_ERR;
+}
+
+weak_alias (signal, ssignal)
+
+stub_warning (signal)
+stub_warning (ssignal)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/signame.c b/sysdeps/generic/signame.c
new file mode 100644
index 0000000000..6085532e28
--- /dev/null
+++ b/sysdeps/generic/signame.c
@@ -0,0 +1,312 @@
+/* Convert between signal names and numbers.
+ Copyright (C) 1990, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h> /* Some systems need this for <signal.h>. */
+#include <signal.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/* Some systems declare `sys_siglist in <unistd.h>; if
+ configure defined SYS_SIGLIST_DECLARED, it may expect
+ to find the declaration there. */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+
+/* Some systems do not define NSIG in <signal.h>. */
+#ifndef NSIG
+#ifdef _NSIG
+#define NSIG _NSIG
+#else
+#define NSIG 32
+#endif
+#endif
+
+#if !__STDC__
+#define const
+#endif
+
+#include "signame.h"
+
+#ifndef HAVE_SYS_SIGLIST
+/* There is too much variation in Sys V signal numbers and names, so
+ we must initialize them at runtime. */
+
+static const char undoc[] = "unknown signal";
+
+const char *sys_siglist[NSIG];
+
+#else /* HAVE_SYS_SIGLIST. */
+
+#ifndef SYS_SIGLIST_DECLARED
+extern char *sys_siglist[];
+#endif /* Not SYS_SIGLIST_DECLARED. */
+
+#endif /* Not HAVE_SYS_SIGLIST. */
+
+/* Table of abbreviations for signals. Note: A given number can
+ appear more than once with different abbreviations. */
+typedef struct
+ {
+ int number;
+ const char *abbrev;
+ } num_abbrev;
+static num_abbrev sig_table[NSIG*2];
+/* Number of elements of sig_table used. */
+static int sig_table_nelts = 0;
+
+/* Enter signal number NUMBER into the tables with ABBREV and NAME. */
+
+static void
+init_sig (number, abbrev, name)
+ int number;
+ const char *abbrev;
+ const char *name;
+{
+#ifndef HAVE_SYS_SIGLIST
+ sys_siglist[number] = name;
+#endif
+ sig_table[sig_table_nelts].number = number;
+ sig_table[sig_table_nelts++].abbrev = abbrev;
+}
+
+void
+signame_init ()
+{
+#ifndef HAVE_SYS_SIGLIST
+ int i;
+ /* Initialize signal names. */
+ for (i = 0; i < NSIG; i++)
+ sys_siglist[i] = undoc;
+#endif /* !HAVE_SYS_SIGLIST */
+
+ /* Initialize signal names. */
+#if defined (SIGHUP)
+ init_sig (SIGHUP, "HUP", "Hangup");
+#endif
+#if defined (SIGINT)
+ init_sig (SIGINT, "INT", "Interrupt");
+#endif
+#if defined (SIGQUIT)
+ init_sig (SIGQUIT, "QUIT", "Quit");
+#endif
+#if defined (SIGILL)
+ init_sig (SIGILL, "ILL", "Illegal Instruction");
+#endif
+#if defined (SIGTRAP)
+ init_sig (SIGTRAP, "TRAP", "Trace/breakpoint trap");
+#endif
+ /* If SIGIOT == SIGABRT, we want to print it as SIGABRT because
+ SIGABRT is in ANSI and POSIX.1 and SIGIOT isn't. */
+#if defined (SIGABRT)
+ init_sig (SIGABRT, "ABRT", "Aborted");
+#endif
+#if defined (SIGIOT)
+ init_sig (SIGIOT, "IOT", "IOT trap");
+#endif
+#if defined (SIGEMT)
+ init_sig (SIGEMT, "EMT", "EMT trap");
+#endif
+#if defined (SIGFPE)
+ init_sig (SIGFPE, "FPE", "Floating point exception");
+#endif
+#if defined (SIGKILL)
+ init_sig (SIGKILL, "KILL", "Killed");
+#endif
+#if defined (SIGBUS)
+ init_sig (SIGBUS, "BUS", "Bus error");
+#endif
+#if defined (SIGSEGV)
+ init_sig (SIGSEGV, "SEGV", "Segmentation fault");
+#endif
+#if defined (SIGSYS)
+ init_sig (SIGSYS, "SYS", "Bad system call");
+#endif
+#if defined (SIGPIPE)
+ init_sig (SIGPIPE, "PIPE", "Broken pipe");
+#endif
+#if defined (SIGALRM)
+ init_sig (SIGALRM, "ALRM", "Alarm clock");
+#endif
+#if defined (SIGTERM)
+ init_sig (SIGTERM, "TERM", "Terminated");
+#endif
+#if defined (SIGUSR1)
+ init_sig (SIGUSR1, "USR1", "User defined signal 1");
+#endif
+#if defined (SIGUSR2)
+ init_sig (SIGUSR2, "USR2", "User defined signal 2");
+#endif
+ /* If SIGCLD == SIGCHLD, we want to print it as SIGCHLD because that
+ is what is in POSIX.1. */
+#if defined (SIGCHLD)
+ init_sig (SIGCHLD, "CHLD", "Child exited");
+#endif
+#if defined (SIGCLD)
+ init_sig (SIGCLD, "CLD", "Child exited");
+#endif
+#if defined (SIGPWR)
+ init_sig (SIGPWR, "PWR", "Power failure");
+#endif
+#if defined (SIGTSTP)
+ init_sig (SIGTSTP, "TSTP", "Stopped");
+#endif
+#if defined (SIGTTIN)
+ init_sig (SIGTTIN, "TTIN", "Stopped (tty input)");
+#endif
+#if defined (SIGTTOU)
+ init_sig (SIGTTOU, "TTOU", "Stopped (tty output)");
+#endif
+#if defined (SIGSTOP)
+ init_sig (SIGSTOP, "STOP", "Stopped (signal)");
+#endif
+#if defined (SIGXCPU)
+ init_sig (SIGXCPU, "XCPU", "CPU time limit exceeded");
+#endif
+#if defined (SIGXFSZ)
+ init_sig (SIGXFSZ, "XFSZ", "File size limit exceeded");
+#endif
+#if defined (SIGVTALRM)
+ init_sig (SIGVTALRM, "VTALRM", "Virtual timer expired");
+#endif
+#if defined (SIGPROF)
+ init_sig (SIGPROF, "PROF", "Profiling timer expired");
+#endif
+#if defined (SIGWINCH)
+ /* "Window size changed" might be more accurate, but even if that
+ is all that it means now, perhaps in the future it will be
+ extended to cover other kinds of window changes. */
+ init_sig (SIGWINCH, "WINCH", "Window changed");
+#endif
+#if defined (SIGCONT)
+ init_sig (SIGCONT, "CONT", "Continued");
+#endif
+#if defined (SIGURG)
+ init_sig (SIGURG, "URG", "Urgent I/O condition");
+#endif
+#if defined (SIGIO)
+ /* "I/O pending" has also been suggested. A disadvantage is
+ that signal only happens when the process has
+ asked for it, not everytime I/O is pending. Another disadvantage
+ is the confusion from giving it a different name than under Unix. */
+ init_sig (SIGIO, "IO", "I/O possible");
+#endif
+#if defined (SIGWIND)
+ init_sig (SIGWIND, "WIND", "SIGWIND");
+#endif
+#if defined (SIGPHONE)
+ init_sig (SIGPHONE, "PHONE", "SIGPHONE");
+#endif
+#if defined (SIGPOLL)
+ init_sig (SIGPOLL, "POLL", "I/O possible");
+#endif
+#if defined (SIGLOST)
+ init_sig (SIGLOST, "LOST", "Resource lost");
+#endif
+#if defined (SIGDANGER)
+ init_sig (SIGDANGER, "DANGER", "Danger signal");
+#endif
+#if defined (SIGINFO)
+ init_sig (SIGINFO, "INFO", "Information request");
+#endif
+#if defined (SIGNOFP)
+ init_sig (SIGNOFP, "NOFP", "Floating point co-processor not available");
+#endif
+}
+
+/* Return the abbreviation for signal NUMBER. */
+
+char *
+sig_abbrev (number)
+ int number;
+{
+ int i;
+
+ if (sig_table_nelts == 0)
+ signame_init ();
+
+ for (i = 0; i < sig_table_nelts; i++)
+ if (sig_table[i].number == number)
+ return (char *)sig_table[i].abbrev;
+ return NULL;
+}
+
+/* Return the signal number for an ABBREV, or -1 if there is no
+ signal by that name. */
+
+int
+sig_number (abbrev)
+ const char *abbrev;
+{
+ int i;
+
+ if (sig_table_nelts == 0)
+ signame_init ();
+
+ /* Skip over "SIG" if present. */
+ if (abbrev[0] == 'S' && abbrev[1] == 'I' && abbrev[2] == 'G')
+ abbrev += 3;
+
+ for (i = 0; i < sig_table_nelts; i++)
+ if (abbrev[0] == sig_table[i].abbrev[0]
+ && strcmp (abbrev, sig_table[i].abbrev) == 0)
+ return sig_table[i].number;
+ return -1;
+}
+
+#ifndef HAVE_PSIGNAL
+/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
+ a colon, and followed by a newline. */
+
+void
+psignal (signal, message)
+ int signal;
+ const char *message;
+{
+ if (signal <= 0 || signal >= NSIG)
+ fprintf (stderr, "%s: unknown signal", message);
+ else
+ fprintf (stderr, "%s: %s\n", message, sys_siglist[signal]);
+}
+#endif
+
+#ifndef HAVE_STRSIGNAL
+/* Return the string associated with the signal number. */
+
+char *
+strsignal (signal)
+ int signal;
+{
+ static char buf[] = "Signal 12345678901234567890";
+
+ if (signal > 0 || signal < NSIG)
+ return (char *) sys_siglist[signal];
+
+ sprintf (buf, "Signal %d", signal);
+ return buf;
+}
+#endif
diff --git a/sysdeps/generic/signame.h b/sysdeps/generic/signame.h
new file mode 100644
index 0000000000..d829e860b4
--- /dev/null
+++ b/sysdeps/generic/signame.h
@@ -0,0 +1,67 @@
+/* Convert between signal names and numbers.
+ Copyright (C) 1990, 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if defined (__STDC__) && __STDC__
+
+/* Initialize `sys_siglist'. */
+void signame_init (void);
+
+/* Return the abbreviation (e.g. ABRT, FPE, etc.) for signal NUMBER.
+ Do not return this as a const char *. The caller might want to
+ assign it to a char *. */
+char *sig_abbrev (int number);
+
+/* Return the signal number for an ABBREV, or -1 if there is no
+ signal by that name. */
+int sig_number (const char *abbrev);
+
+/* Avoid conflicts with a system header file that might define these three. */
+
+#ifndef HAVE_PSIGNAL
+/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
+ a colon, and followed by a newline. */
+void psignal (int signal, const char *message);
+#endif
+
+#ifndef HAVE_STRSIGNAL
+/* Return the name of SIGNAL. */
+char *strsignal (int signal);
+#endif
+
+#if !defined (HAVE_SYS_SIGLIST)
+/* Names for signals from 0 to NSIG-1. */
+extern const char *sys_siglist[];
+#endif
+
+#else
+
+void signame_init ();
+char *sig_abbrev ();
+int sig_number ();
+#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_PSIGNAL)
+void psignal ();
+#endif
+#ifndef HAVE_STRSIGNAL
+char *strsignal ();
+#endif
+#if !defined (HAVE_SYS_SIGLIST)
+extern char *sys_siglist[];
+#endif
+
+#endif
diff --git a/sysdeps/generic/sigpause.c b/sysdeps/generic/sigpause.c
new file mode 100644
index 0000000000..bc598d070c
--- /dev/null
+++ b/sysdeps/generic/sigpause.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1991,95,96,2000,02,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define sigpause __rename_sigpause
+#include <errno.h>
+#include <signal.h>
+#undef sigpause
+
+int
+__sigpause (sig_or_mask, is_sig)
+ int sig_or_mask;
+ int is_sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (__sigpause)
+libc_hidden_def (__sigpause)
+
+int
+__attribute__ ((weak))
+__default_sigpause (int mask)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__default_sigpause, sigpause)
+stub_warning (sigpause)
+#include <stub-tag.h>
+
+
+int
+__attribute ((weak))
+__xpg___sigpause (int sig)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
diff --git a/sysdeps/generic/sigpending.c b/sysdeps/generic/sigpending.c
new file mode 100644
index 0000000000..80e16e588c
--- /dev/null
+++ b/sysdeps/generic/sigpending.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <signal.h>
+
+
+/* Store in SET all signals that are blocked and pending. */
+int
+sigpending (set)
+ sigset_t *set;
+{
+ if (set == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigpending)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigprocmask.c b/sysdeps/generic/sigprocmask.c
new file mode 100644
index 0000000000..472b3a4fa5
--- /dev/null
+++ b/sysdeps/generic/sigprocmask.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* If SET is not NULL, modify the current set of blocked signals
+ according to HOW, which may be SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK.
+ If OSET is not NULL, store the old set of blocked signals in *OSET. */
+int
+__sigprocmask (how, set, oset)
+ int how;
+ const sigset_t *set;
+ sigset_t *oset;
+{
+ switch (how)
+ {
+ case SIG_BLOCK:
+ case SIG_UNBLOCK:
+ case SIG_SETMASK:
+ break;
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+/* No stub warning because abort calls __sigprocmask,
+ and we don't want warnings for every use of abort on
+ a system without safe signals. */
+
+weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/generic/sigqueue.c b/sysdeps/generic/sigqueue.c
new file mode 100644
index 0000000000..c6e77c0a27
--- /dev/null
+++ b/sysdeps/generic/sigqueue.c
@@ -0,0 +1,33 @@
+/* Implementation of sigqueue function from POSIX.1b.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+
+int
+__sigqueue (pid_t pid, int sig, const union sigval val)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__sigqueue, sigqueue)
+
+stub_warning (sigqueue)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigreturn.c b/sysdeps/generic/sigreturn.c
new file mode 100644
index 0000000000..0239b0a98c
--- /dev/null
+++ b/sysdeps/generic/sigreturn.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <errno.h>
+
+int
+__sigreturn (context)
+ struct sigcontext *context;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigreturn)
+
+weak_alias (__sigreturn, sigreturn)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigset.c b/sysdeps/generic/sigset.c
new file mode 100644
index 0000000000..191a909158
--- /dev/null
+++ b/sysdeps/generic/sigset.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the disposition for SIG. */
+__sighandler_t
+sigset (sig, disp)
+ int sig;
+ __sighandler_t disp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigset)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigsetmask.c b/sysdeps/generic/sigsetmask.c
new file mode 100644
index 0000000000..602c0add40
--- /dev/null
+++ b/sysdeps/generic/sigsetmask.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigsetmask (mask)
+ int mask;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigsetmask)
+
+weak_alias (__sigsetmask, sigsetmask)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigstack.c b/sysdeps/generic/sigstack.c
new file mode 100644
index 0000000000..ca9c8018a4
--- /dev/null
+++ b/sysdeps/generic/sigstack.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Run signals handlers on the stack specified by SS (if not NULL).
+ If OSS is not NULL, it is filled in with the old signal stack status. */
+int
+sigstack (ss, oss)
+ struct sigstack *ss;
+ struct sigstack *oss;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigstack)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigsuspend.c b/sysdeps/generic/sigsuspend.c
new file mode 100644
index 0000000000..58452e334c
--- /dev/null
+++ b/sysdeps/generic/sigsuspend.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Change the set of blocked signals to SET,
+ wait until a signal arrives, and restore the set of blocked signals. */
+int
+__sigsuspend (set)
+ const sigset_t *set;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigsuspend)
+weak_alias (__sigsuspend, sigsuspend)
+
+stub_warning (sigsuspend)
+stub_warning (__sigsuspend)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigtimedwait.c b/sysdeps/generic/sigtimedwait.c
new file mode 100644
index 0000000000..7b114a3133
--- /dev/null
+++ b/sysdeps/generic/sigtimedwait.c
@@ -0,0 +1,34 @@
+/* Implementation of sigtimedwait function from POSIX.1b.
+ Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigtimedwait (const sigset_t *set, siginfo_t *info,
+ const struct timespec *timeout)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigtimedwait)
+weak_alias (__sigtimedwait, sigtimedwait)
+
+stub_warning (sigtimedwait)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigvec.c b/sysdeps/generic/sigvec.c
new file mode 100644
index 0000000000..148e9a0d85
--- /dev/null
+++ b/sysdeps/generic/sigvec.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <errno.h>
+
+/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
+ of VEC. The signals in `sv_mask' will be blocked while the handler runs.
+ If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
+ reset to SIG_DFL before `sv_handler' is entered. If OVEC is non-NULL,
+ it is filled in with the old information for SIG. */
+int
+__sigvec (sig, vec, ovec)
+ int sig;
+ const struct sigvec *vec;
+ struct sigvec *ovec;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigvec)
+
+weak_alias (__sigvec, sigvec)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigwait.c b/sysdeps/generic/sigwait.c
new file mode 100644
index 0000000000..016768553d
--- /dev/null
+++ b/sysdeps/generic/sigwait.c
@@ -0,0 +1,32 @@
+/* sigwait - implementation of sigwait function from POSIX.1c.
+ Copyright (C) 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigwait (const sigset_t *set, int *sig)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__sigwait, sigwait)
+
+stub_warning (sigwait)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sigwaitinfo.c b/sysdeps/generic/sigwaitinfo.c
new file mode 100644
index 0000000000..e0659b0243
--- /dev/null
+++ b/sysdeps/generic/sigwaitinfo.c
@@ -0,0 +1,33 @@
+/* Implementation of sigwaitinfo function from POSIX.1b.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigwaitinfo (const sigset_t *set, siginfo_t *info)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigwaitinfo)
+weak_alias (__sigwaitinfo, sigwaitinfo)
+
+stub_warning (sigwaitinfo)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sleep.c b/sysdeps/generic/sleep.c
new file mode 100644
index 0000000000..f9d2a6593f
--- /dev/null
+++ b/sysdeps/generic/sleep.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <time.h>
+#include <unistd.h>
+#include <errno.h>
+
+/* Make the process sleep for SECONDS seconds, or until a signal arrives
+ and is not ignored. The function returns the number of seconds less
+ than SECONDS which it actually slept (zero if it slept the full time).
+ If a signal handler does a `longjmp' or modifies the handling of the
+ SIGALRM signal while inside `sleep' call, the handling of the SIGALRM
+ signal afterwards is undefined. There is no return value to indicate
+ error, but if `sleep' returns SECONDS, it probably didn't work. */
+unsigned int
+__sleep (seconds)
+ unsigned int seconds;
+{
+ __set_errno (ENOSYS);
+ return seconds;
+}
+weak_alias (__sleep, sleep)
+
+stub_warning (sleep)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sockatmark.c b/sysdeps/generic/sockatmark.c
new file mode 100644
index 0000000000..402ef9b4d0
--- /dev/null
+++ b/sysdeps/generic/sockatmark.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Determine wheter socket is at a out-of-band mark. */
+int
+sockatmark (fd)
+ int fd;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (sockatmark)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/socket.c b/sysdeps/generic/socket.c
new file mode 100644
index 0000000000..94e70bc4ea
--- /dev/null
+++ b/sysdeps/generic/socket.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Create a new socket of type TYPE in domain DOMAIN, using
+ protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
+ Returns a file descriptor for the new socket, or -1 for errors. */
+int
+__socket (domain, type, protocol)
+ int domain;
+ int type;
+ int protocol;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+weak_alias (__socket, socket)
+stub_warning (socket)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/socketpair.c b/sysdeps/generic/socketpair.c
new file mode 100644
index 0000000000..ad277c00e5
--- /dev/null
+++ b/sysdeps/generic/socketpair.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Create two new sockets, of type TYPE in domain DOMAIN and using
+ protocol PROTOCOL, which are connected to each other, and put file
+ descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
+ one will be chosen automatically. Returns 0 on success, -1 for errors. */
+int
+socketpair (domain, type, protocol, fds)
+ int domain;
+ int type;
+ int protocol;
+ int fds[2];
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (socketpair)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/spawni.c b/sysdeps/generic/spawni.c
new file mode 100644
index 0000000000..c7d5f59ffc
--- /dev/null
+++ b/sysdeps/generic/spawni.c
@@ -0,0 +1,46 @@
+/* Guts of POSIX spawn interface. Stub version.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <spawn.h>
+#include "spawn_int.h"
+
+
+/* The Unix standard contains a long explanation of the way to signal
+ an error after the fork() was successful. Since no new wait status
+ was wanted there is no way to signal an error using one of the
+ available methods. The committee chose to signal an error by a
+ normal program exit with the exit code 127. */
+#define SPAWN_ERROR 127
+
+
+/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
+ Before running the process perform the actions described in FILE-ACTIONS. */
+int
+__spawni (pid_t *pid, const char *file,
+ const posix_spawn_file_actions_t *file_actions,
+ const posix_spawnattr_t *attrp, char *const argv[],
+ char *const envp[], int use_path)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (__spawni)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/speed.c b/sysdeps/generic/speed.c
new file mode 100644
index 0000000000..b4acd62230
--- /dev/null
+++ b/sysdeps/generic/speed.c
@@ -0,0 +1,72 @@
+/* `struct termios' speed frobnication functions. 4.4 BSD/generic GNU version.
+ Copyright (C) 1991,1992,1993,1996,1997,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <termios.h>
+
+/* Return the output baud rate stored in *TERMIOS_P. */
+speed_t
+cfgetospeed (termios_p)
+ const struct termios *termios_p;
+{
+ return termios_p->__ospeed;
+}
+
+/* Return the input baud rate stored in *TERMIOS_P. */
+speed_t
+cfgetispeed (termios_p)
+ const struct termios *termios_p;
+{
+ return termios_p->__ispeed;
+}
+
+/* Set the output baud rate stored in *TERMIOS_P to SPEED. */
+int
+cfsetospeed (termios_p, speed)
+ struct termios *termios_p;
+ speed_t speed;
+{
+ if (termios_p == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ termios_p->__ospeed = speed;
+ return 0;
+}
+libc_hidden_def (cfsetospeed)
+
+/* Set the input baud rate stored in *TERMIOS_P to SPEED. */
+int
+cfsetispeed (termios_p, speed)
+ struct termios *termios_p;
+ speed_t speed;
+{
+ if (termios_p == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ termios_p->__ispeed = speed;
+ return 0;
+}
+libc_hidden_def (cfsetispeed)
diff --git a/sysdeps/generic/sprofil.c b/sysdeps/generic/sprofil.c
new file mode 100644
index 0000000000..037ed4672e
--- /dev/null
+++ b/sysdeps/generic/sprofil.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+
+#include <sys/profil.h>
+#include <sys/time.h>
+
+int
+__sprofil (struct prof *profp, int profcnt, struct timeval *tvp,
+ unsigned int flags)
+{
+ if (profcnt == 0)
+ return 0;
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__sprofil, sprofil)
diff --git a/sysdeps/generic/sstk.c b/sysdeps/generic/sstk.c
new file mode 100644
index 0000000000..6cba9b7fba
--- /dev/null
+++ b/sysdeps/generic/sstk.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+
+/* Increase the size of the stack by INCREMENT,
+ and return the address of the bottom of the stack. */
+
+void *sstk (int increment) __THROW;
+
+void *
+sstk (increment)
+ int increment;
+{
+ __set_errno (ENOSYS);
+ return (void *) -1;
+}
+
+stub_warning (sstk)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/start.c b/sysdeps/generic/start.c
new file mode 100644
index 0000000000..08f985c482
--- /dev/null
+++ b/sysdeps/generic/start.c
@@ -0,0 +1,13 @@
+/* This file should define the low-level program entry point,
+ which should set up `__environ', and then do:
+ __libc_init(argc, argv, __environ);
+ exit(main(argc, argv, __environ));
+
+ This file should be prepared to be the first thing in the text section (on
+ Unix systems), or otherwise appropriately special. */
+
+/* The first piece of initialized data. */
+int __data_start = 0;
+#ifdef HAVE_WEAK_SYMBOLS
+weak_alias (__data_start, data_start)
+#endif
diff --git a/sysdeps/generic/statfs.c b/sysdeps/generic/statfs.c
new file mode 100644
index 0000000000..af4a9ea4e5
--- /dev/null
+++ b/sysdeps/generic/statfs.c
@@ -0,0 +1,35 @@
+/* statfs -- Return information about the filesystem on which FILE resides.
+ Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FILE resides. */
+int
+__statfs (const char *file, struct statfs *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__statfs)
+weak_alias (__statfs, statfs)
+
+stub_warning (statfs)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/statfs64.c b/sysdeps/generic/statfs64.c
new file mode 100644
index 0000000000..cf1a7d82a4
--- /dev/null
+++ b/sysdeps/generic/statfs64.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statfs.h>
+
+/* Return information about the filesystem on which FILE resides. */
+int
+__statfs64 (const char *file, struct statfs64 *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__statfs64, statfs64)
+
+stub_warning (statfs64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/statvfs.c b/sysdeps/generic/statvfs.c
new file mode 100644
index 0000000000..22e24cfeeb
--- /dev/null
+++ b/sysdeps/generic/statvfs.c
@@ -0,0 +1,34 @@
+/* Return information about the filesystem on which FILE resides.
+ Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statvfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FILE resides. */
+int
+__statvfs (const char *file, struct statvfs *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__statvfs, statvfs)
+libc_hidden_weak (statvfs)
+stub_warning (statvfs)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/statvfs64.c b/sysdeps/generic/statvfs64.c
new file mode 100644
index 0000000000..4424abdbea
--- /dev/null
+++ b/sysdeps/generic/statvfs64.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statvfs.h>
+
+/* Return information about the filesystem on which FILE resides. */
+int
+__statvfs64 (const char *file, struct statvfs64 *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__statvfs64, statvfs64)
+
+stub_warning (statvfs64)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 2c729ad2f1..c860030409 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -297,8 +297,8 @@ typedef unsigned long long int uintmax_t;
# endif
/* Unsigned. */
-# define UINT8_C(c) c
-# define UINT16_C(c) c
+# define UINT8_C(c) c ## U
+# define UINT16_C(c) c ## U
# define UINT32_C(c) c ## U
# if __WORDSIZE == 64
# define UINT64_C(c) c ## UL
diff --git a/sysdeps/generic/stime.c b/sysdeps/generic/stime.c
new file mode 100644
index 0000000000..5ed1b040e2
--- /dev/null
+++ b/sysdeps/generic/stime.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+#include <stddef.h>
+
+/* Set the system clock to *WHEN. */
+
+int
+stime (when)
+ const time_t *when;
+{
+ if (when == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (stime)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/stpcpy.c b/sysdeps/generic/stpcpy.c
new file mode 100644
index 0000000000..6e42911fde
--- /dev/null
+++ b/sysdeps/generic/stpcpy.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 1992, 1995, 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#undef __stpcpy
+#undef stpcpy
+
+#ifndef weak_alias
+# define __stpcpy stpcpy
+#endif
+
+/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
+char *
+__stpcpy (dest, src)
+ char *dest;
+ const char *src;
+{
+ register char *d = dest;
+ register const char *s = src;
+
+ do
+ *d++ = *s;
+ while (*s++ != '\0');
+
+ return d - 1;
+}
+#ifdef libc_hidden_def
+libc_hidden_def (__stpcpy)
+#endif
+#ifdef weak_alias
+weak_alias (__stpcpy, stpcpy)
+#endif
+#ifdef libc_hidden_builtin_def
+libc_hidden_builtin_def (stpcpy)
+#endif
diff --git a/sysdeps/generic/stpcpy_chk.c b/sysdeps/generic/stpcpy_chk.c
new file mode 100644
index 0000000000..dacda0115a
--- /dev/null
+++ b/sysdeps/generic/stpcpy_chk.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1992, 1995, 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+
+/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
+char *
+__stpcpy_chk (dest, src, destlen)
+ char *dest;
+ const char *src;
+ size_t destlen;
+{
+ register char *d = dest;
+ register const char *s = src;
+
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ *d++ = *s;
+ }
+ while (*s++ != '\0');
+
+ return d - 1;
+}
diff --git a/sysdeps/generic/stpncpy.c b/sysdeps/generic/stpncpy.c
new file mode 100644
index 0000000000..164d0f1747
--- /dev/null
+++ b/sysdeps/generic/stpncpy.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# include <string.h>
+#else
+# include <sys/types.h>
+#endif
+
+#ifndef weak_alias
+# define __stpncpy stpncpy
+#endif
+
+/* Copy no more than N characters of SRC to DEST, returning the address of
+ the terminating '\0' in DEST, if any, or else DEST + N. */
+char *
+__stpncpy (dest, src, n)
+ char *dest;
+ const char *src;
+ size_t n;
+{
+ char c;
+ char *s = dest;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+
+ for (;;)
+ {
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ if (--n4 == 0)
+ goto last_chars;
+ }
+ n -= dest - s;
+ goto zero_fill;
+ }
+
+ last_chars:
+ n &= 3;
+ if (n == 0)
+ return dest;
+
+ for (;;)
+ {
+ c = *src++;
+ --n;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ if (n == 0)
+ return dest;
+ }
+
+ zero_fill:
+ while (n-- > 0)
+ dest[n] = '\0';
+
+ return dest - 1;
+}
+#ifdef weak_alias
+libc_hidden_def (__stpncpy)
+weak_alias (__stpncpy, stpncpy)
+#endif
diff --git a/sysdeps/generic/strcasecmp.c b/sysdeps/generic/strcasecmp.c
new file mode 100644
index 0000000000..3ae3d67d04
--- /dev/null
+++ b/sysdeps/generic/strcasecmp.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 1991,1992,1995,1996,1997,2001,2002, 2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ctype.h>
+#include <string.h>
+
+#ifndef _LIBC
+# define __strcasecmp strcasecmp
+# define TOLOWER(Ch) tolower (Ch)
+#else
+# include <locale/localeinfo.h>
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define __strcasecmp __strcasecmp_l
+# endif
+# define TOLOWER(Ch) __tolower_l ((Ch), loc)
+#endif
+
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define LOCALE_PARAM , loc
+# define LOCALE_PARAM_DECL __locale_t loc;
+#else
+# define LOCALE_PARAM
+# define LOCALE_PARAM_DECL
+#endif
+
+/* Compare S1 and S2, ignoring case, returning less than, equal to or
+ greater than zero if S1 is lexicographically less than,
+ equal to or greater than S2. */
+int
+__strcasecmp (s1, s2 LOCALE_PARAM)
+ const char *s1;
+ const char *s2;
+ LOCALE_PARAM_DECL
+{
+#if defined _LIBC && !defined USE_IN_EXTENDED_LOCALE_MODEL
+ __locale_t loc = _NL_CURRENT_LOCALE;
+#endif
+ const unsigned char *p1 = (const unsigned char *) s1;
+ const unsigned char *p2 = (const unsigned char *) s2;
+ int result;
+
+ if (p1 == p2)
+ return 0;
+
+ while ((result = TOLOWER (*p1) - TOLOWER (*p2++)) == 0)
+ if (*p1++ == '\0')
+ break;
+
+ return result;
+}
+#ifndef __strcasecmp
+libc_hidden_def (__strcasecmp)
+weak_alias (__strcasecmp, strcasecmp)
+#endif
diff --git a/sysdeps/generic/strcasecmp_l.c b/sysdeps/generic/strcasecmp_l.c
new file mode 100644
index 0000000000..1cd3fe14c5
--- /dev/null
+++ b/sysdeps/generic/strcasecmp_l.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define USE_IN_EXTENDED_LOCALE_MODEL 1
+#include <sysdeps/generic/strcasecmp.c>
+
+libc_hidden_def (__strcasecmp_l)
+weak_alias (__strcasecmp_l, strcasecmp_l)
diff --git a/sysdeps/generic/strcasestr.c b/sysdeps/generic/strcasestr.c
new file mode 100644
index 0000000000..1dde43c606
--- /dev/null
+++ b/sysdeps/generic/strcasestr.c
@@ -0,0 +1,142 @@
+/* Return the offset of one string within another.
+ Copyright (C) 1994, 1996-2000, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * My personal strstr() implementation that beats most other algorithms.
+ * Until someone tells me otherwise, I assume that this is the
+ * fastest implementation of strstr() in C.
+ * I deliberately chose not to comment it. You should have at least
+ * as much fun trying to understand it, as I had to write it :-).
+ *
+ * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ctype.h>
+
+#if defined _LIBC || defined HAVE_STRING_H
+# include <string.h>
+#endif
+
+#ifdef _LIBC
+# include <locale/localeinfo.h>
+# define TOLOWER(c) __tolower_l ((unsigned char) c, loc)
+#else
+# define TOLOWER(c) _tolower (c)
+#endif
+
+typedef unsigned chartype;
+
+#undef strcasestr
+#undef __strcasestr
+
+char *
+__strcasestr (phaystack, pneedle)
+ const char *phaystack;
+ const char *pneedle;
+{
+ register const unsigned char *haystack, *needle;
+ register chartype b, c;
+#ifdef _LIBC
+ __locale_t loc = _NL_CURRENT_LOCALE;
+#endif
+
+ haystack = (const unsigned char *) phaystack;
+ needle = (const unsigned char *) pneedle;
+
+ b = TOLOWER (*needle);
+ if (b != '\0')
+ {
+ haystack--; /* possible ANSI violation */
+ do
+ {
+ c = *++haystack;
+ if (c == '\0')
+ goto ret0;
+ }
+ while (TOLOWER (c) != (int) b);
+
+ c = TOLOWER (*++needle);
+ if (c == '\0')
+ goto foundneedle;
+ ++needle;
+ goto jin;
+
+ for (;;)
+ {
+ register chartype a;
+ register const unsigned char *rhaystack, *rneedle;
+
+ do
+ {
+ a = *++haystack;
+ if (a == '\0')
+ goto ret0;
+ if (TOLOWER (a) == (int) b)
+ break;
+ a = *++haystack;
+ if (a == '\0')
+ goto ret0;
+shloop:
+ ;
+ }
+ while (TOLOWER (a) != (int) b);
+
+jin: a = *++haystack;
+ if (a == '\0')
+ goto ret0;
+
+ if (TOLOWER (a) != (int) c)
+ goto shloop;
+
+ rhaystack = haystack-- + 1;
+ rneedle = needle;
+ a = TOLOWER (*rneedle);
+
+ if (TOLOWER (*rhaystack) == (int) a)
+ do
+ {
+ if (a == '\0')
+ goto foundneedle;
+ ++rhaystack;
+ a = TOLOWER (*++needle);
+ if (TOLOWER (*rhaystack) != (int) a)
+ break;
+ if (a == '\0')
+ goto foundneedle;
+ ++rhaystack;
+ a = TOLOWER (*++needle);
+ }
+ while (TOLOWER (*rhaystack) == (int) a);
+
+ needle = rneedle; /* took the register-poor approach */
+
+ if (a == '\0')
+ break;
+ }
+ }
+foundneedle:
+ return (char*) haystack;
+ret0:
+ return 0;
+}
+
+weak_alias (__strcasestr, strcasestr)
diff --git a/sysdeps/generic/strcat.c b/sysdeps/generic/strcat.c
new file mode 100644
index 0000000000..eef22add36
--- /dev/null
+++ b/sysdeps/generic/strcat.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+#undef strcat
+
+/* Append SRC on the end of DEST. */
+char *
+strcat (dest, src)
+ char *dest;
+ const char *src;
+{
+ char *s1 = dest;
+ const char *s2 = src;
+ reg_char c;
+
+ /* Find the end of the string. */
+ do
+ c = *s1++;
+ while (c != '\0');
+
+ /* Make S1 point before the next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ s1 -= 2;
+
+ do
+ {
+ c = *s2++;
+ *++s1 = c;
+ }
+ while (c != '\0');
+
+ return dest;
+}
+libc_hidden_builtin_def (strcat)
diff --git a/sysdeps/generic/strcat_chk.c b/sysdeps/generic/strcat_chk.c
new file mode 100644
index 0000000000..b3fb3470b7
--- /dev/null
+++ b/sysdeps/generic/strcat_chk.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 1991, 1997, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+
+/* Append SRC on the end of DEST. */
+char *
+__strcat_chk (dest, src, destlen)
+ char *dest;
+ const char *src;
+ size_t destlen;
+{
+ char *s1 = dest;
+ const char *s2 = src;
+ reg_char c;
+
+ /* Find the end of the string. */
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *s1++;
+ }
+ while (c != '\0');
+
+ /* Make S1 point before the next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ ++destlen;
+ s1 -= 2;
+
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *s2++;
+ *++s1 = c;
+ }
+ while (c != '\0');
+
+ return dest;
+}
diff --git a/sysdeps/generic/strchr.c b/sysdeps/generic/strchr.c
new file mode 100644
index 0000000000..c8b7969e85
--- /dev/null
+++ b/sysdeps/generic/strchr.c
@@ -0,0 +1,190 @@
+/* Copyright (C) 1991,93,94,95,96,97,99,2000,03 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ bug fix and commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to strchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <stdlib.h>
+
+#undef strchr
+
+/* Find the first occurrence of C in S. */
+char *
+strchr (s, c_in)
+ const char *s;
+ int c_in;
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = s; ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == c)
+ return (void *) char_ptr;
+ else if (*char_ptr == '\0')
+ return NULL;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ switch (sizeof (longword))
+ {
+ case 4: magic_bits = 0x7efefeffL; break;
+ case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+ default:
+ abort ();
+ }
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+ if (sizeof (longword) > 4)
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ charmask |= (charmask << 16) << 16;
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ for (;;)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C as well as zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0 ||
+
+ /* That caught zeroes. Now test for C. */
+ ((((longword ^ charmask) + magic_bits) ^ ~(longword ^ charmask))
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C or zero?
+ If none of them were, it was a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (*cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (sizeof (longword) > 4)
+ {
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+#ifdef weak_alias
+#undef index
+weak_alias (strchr, index)
+#endif
+libc_hidden_builtin_def (strchr)
diff --git a/sysdeps/generic/strchrnul.c b/sysdeps/generic/strchrnul.c
new file mode 100644
index 0000000000..f04b303b82
--- /dev/null
+++ b/sysdeps/generic/strchrnul.c
@@ -0,0 +1,170 @@
+/* Copyright (C) 1991,93,94,95,96,97,99,2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ bug fix and commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to strchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+#include <stdlib.h>
+
+#undef __strchrnul
+#undef strchrnul
+
+/* Find the first occurrence of C in S or the final NUL byte. */
+char *
+__strchrnul (s, c_in)
+ const char *s;
+ int c_in;
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = s; ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == c || *char_ptr == '\0')
+ return (void *) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ switch (sizeof (longword))
+ {
+ case 4: magic_bits = 0x7efefeffL; break;
+ case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+ default:
+ abort ();
+ }
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+ if (sizeof (longword) > 4)
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ charmask |= (charmask << 16) << 16;
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ for (;;)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C as well as zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0 ||
+
+ /* That caught zeroes. Now test for C. */
+ ((((longword ^ charmask) + magic_bits) ^ ~(longword ^ charmask))
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C or zero?
+ If none of them were, it was a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (*cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (sizeof (longword) > 4)
+ {
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ }
+ }
+ }
+
+ /* This should never happen. */
+ return NULL;
+}
+
+weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/generic/strcmp.c b/sysdeps/generic/strcmp.c
new file mode 100644
index 0000000000..bd53c05c6e
--- /dev/null
+++ b/sysdeps/generic/strcmp.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+#undef strcmp
+
+/* Compare S1 and S2, returning less than, equal to or
+ greater than zero if S1 is lexicographically less than,
+ equal to or greater than S2. */
+int
+strcmp (p1, p2)
+ const char *p1;
+ const char *p2;
+{
+ register const unsigned char *s1 = (const unsigned char *) p1;
+ register const unsigned char *s2 = (const unsigned char *) p2;
+ unsigned reg_char c1, c2;
+
+ do
+ {
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0')
+ return c1 - c2;
+ }
+ while (c1 == c2);
+
+ return c1 - c2;
+}
+libc_hidden_builtin_def (strcmp)
diff --git a/sysdeps/generic/strcpy.c b/sysdeps/generic/strcpy.c
new file mode 100644
index 0000000000..c736a60762
--- /dev/null
+++ b/sysdeps/generic/strcpy.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1991, 1997, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <string.h>
+#include <memcopy.h>
+#include <bp-checks.h>
+
+#undef strcpy
+
+/* Copy SRC to DEST. */
+char *
+strcpy (dest, src)
+ char *dest;
+ const char *src;
+{
+ reg_char c;
+ char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src);
+ const ptrdiff_t off = CHECK_BOUNDS_LOW (dest) - s - 1;
+ size_t n;
+
+ do
+ {
+ c = *s++;
+ s[off] = c;
+ }
+ while (c != '\0');
+
+ n = s - src;
+ (void) CHECK_BOUNDS_HIGH (src + n);
+ (void) CHECK_BOUNDS_HIGH (dest + n);
+
+ return dest;
+}
+libc_hidden_builtin_def (strcpy)
diff --git a/sysdeps/generic/strcpy_chk.c b/sysdeps/generic/strcpy_chk.c
new file mode 100644
index 0000000000..a4d909feda
--- /dev/null
+++ b/sysdeps/generic/strcpy_chk.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1991, 1997, 2000, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <string.h>
+#include <memcopy.h>
+
+#undef strcpy
+
+/* Copy SRC to DEST with checking of destination buffer overflow. */
+char *
+__strcpy_chk (dest, src, destlen)
+ char *dest;
+ const char *src;
+ size_t destlen;
+{
+ reg_char c;
+ char *s = (char *) src;
+ const ptrdiff_t off = dest - s;
+
+ while (__builtin_expect (destlen >= 4, 0))
+ {
+ c = s[0];
+ s[off] = c;
+ if (c == '\0')
+ return dest;
+ c = s[1];
+ s[off + 1] = c;
+ if (c == '\0')
+ return dest;
+ c = s[2];
+ s[off + 2] = c;
+ if (c == '\0')
+ return dest;
+ c = s[3];
+ s[off + 3] = c;
+ if (c == '\0')
+ return dest;
+ destlen -= 4;
+ s += 4;
+ }
+
+ do
+ {
+ if (__builtin_expect (destlen-- == 0, 0))
+ __chk_fail ();
+ c = *s;
+ *(s++ + off) = c;
+ }
+ while (c != '\0');
+
+ return dest;
+}
diff --git a/sysdeps/generic/strcspn.c b/sysdeps/generic/strcspn.c
new file mode 100644
index 0000000000..f359d578f7
--- /dev/null
+++ b/sysdeps/generic/strcspn.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991, 1994, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined _LIBC || HAVE_STRING_H
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef strchr
+# define strchr index
+# endif
+#endif
+
+#undef strcspn
+
+/* Return the length of the maximum initial segment of S
+ which contains no characters from REJECT. */
+size_t
+strcspn (s, reject)
+ const char *s;
+ const char *reject;
+{
+ size_t count = 0;
+
+ while (*s != '\0')
+ if (strchr (reject, *s++) == NULL)
+ ++count;
+ else
+ return count;
+
+ return count;
+}
+libc_hidden_builtin_def (strcspn)
diff --git a/sysdeps/generic/string-inlines.c b/sysdeps/generic/string-inlines.c
new file mode 100644
index 0000000000..89a5baab5d
--- /dev/null
+++ b/sysdeps/generic/string-inlines.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* <bits/string.h> and <bits/string2.h> declare some extern inline
+ functions. These functions are declared additionally here if
+ inlining is not possible. */
+
+#undef __USE_STRING_INLINES
+#define __USE_STRING_INLINES
+#define _FORCE_INLINES
+#define __STRING_INLINE /* empty */
+#define __NO_INLINE__
+
+#include <string.h>
+#undef index
+#undef rindex
+
+#undef __NO_INLINE__
+#include <bits/string.h>
+#include <bits/string2.h>
diff --git a/sysdeps/generic/strlen.c b/sysdeps/generic/strlen.c
new file mode 100644
index 0000000000..9bc9db68f7
--- /dev/null
+++ b/sysdeps/generic/strlen.c
@@ -0,0 +1,153 @@
+/* Copyright (C) 1991, 1993, 1997, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se);
+ commentary by Jim Blandy (jimb@ai.mit.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <stdlib.h>
+
+#undef strlen
+
+/* Return the length of the null-terminated string STR. Scan for
+ the null terminator quickly by testing four bytes at a time. */
+size_t
+strlen (str)
+ const char *str;
+{
+ const char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, himagic, lomagic;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = str; ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == '\0')
+ return char_ptr - str;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ magic_bits = 0x7efefeffL;
+ himagic = 0x80808080L;
+ lomagic = 0x01010101L;
+ if (sizeof (longword) > 4)
+ {
+ /* 64-bit version of the magic. */
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+ himagic = ((himagic << 16) << 16) | himagic;
+ lomagic = ((lomagic << 16) << 16) | lomagic;
+ }
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ for (;;)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly. */
+
+ longword = *longword_ptr++;
+
+ if (
+#if 0
+ /* Add MAGIC_BITS to LONGWORD. */
+ (((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits)
+#else
+ ((longword - lomagic) & himagic)
+#endif
+ != 0)
+ {
+ /* Which of the bytes was the zero? If none of them were, it was
+ a misfire; continue the search. */
+
+ const char *cp = (const char *) (longword_ptr - 1);
+
+ if (cp[0] == 0)
+ return cp - str;
+ if (cp[1] == 0)
+ return cp - str + 1;
+ if (cp[2] == 0)
+ return cp - str + 2;
+ if (cp[3] == 0)
+ return cp - str + 3;
+ if (sizeof (longword) > 4)
+ {
+ if (cp[4] == 0)
+ return cp - str + 4;
+ if (cp[5] == 0)
+ return cp - str + 5;
+ if (cp[6] == 0)
+ return cp - str + 6;
+ if (cp[7] == 0)
+ return cp - str + 7;
+ }
+ }
+ }
+}
+libc_hidden_builtin_def (strlen)
diff --git a/sysdeps/generic/strncase.c b/sysdeps/generic/strncase.c
new file mode 100644
index 0000000000..a55aaf6a3a
--- /dev/null
+++ b/sysdeps/generic/strncase.c
@@ -0,0 +1,76 @@
+/* Compare at most N characters of two strings without taking care for
+ the case.
+ Copyright (C) 1992, 1996, 1997, 2001, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+
+#ifndef weak_alias
+# define __strncasecmp strncasecmp
+# define TOLOWER(Ch) tolower (Ch)
+#else
+# include <locale/localeinfo.h>
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define __strncasecmp __strncasecmp_l
+# endif
+# define TOLOWER(Ch) __tolower_l ((Ch), loc)
+#endif
+
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define LOCALE_PARAM , loc
+# define LOCALE_PARAM_DECL __locale_t loc;
+#else
+# define LOCALE_PARAM
+# define LOCALE_PARAM_DECL
+#endif
+
+/* Compare no more than N characters of S1 and S2,
+ ignoring case, returning less than, equal to or
+ greater than zero if S1 is lexicographically less
+ than, equal to or greater than S2. */
+int
+__strncasecmp (s1, s2, n LOCALE_PARAM)
+ const char *s1;
+ const char *s2;
+ size_t n;
+ LOCALE_PARAM_DECL
+{
+#if defined _LIBC && !defined USE_IN_EXTENDED_LOCALE_MODEL
+ __locale_t loc = _NL_CURRENT_LOCALE;
+#endif
+ const unsigned char *p1 = (const unsigned char *) s1;
+ const unsigned char *p2 = (const unsigned char *) s2;
+ int result;
+
+ if (p1 == p2 || n == 0)
+ return 0;
+
+ while ((result = TOLOWER (*p1) - TOLOWER (*p2++)) == 0)
+ if (*p1++ == '\0' || --n == 0)
+ break;
+
+ return result;
+}
+#ifndef __strncasecmp
+weak_alias (__strncasecmp, strncasecmp)
+#endif
diff --git a/sysdeps/generic/strncase_l.c b/sysdeps/generic/strncase_l.c
new file mode 100644
index 0000000000..0e61ebec7d
--- /dev/null
+++ b/sysdeps/generic/strncase_l.c
@@ -0,0 +1,25 @@
+/* Compare at most N characters of two strings without taking care for
+ the case using given locale.
+ Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define USE_IN_EXTENDED_LOCALE_MODEL 1
+#include <sysdeps/generic/strncase.c>
+
+libc_hidden_def (__strncasecmp_l)
+weak_alias (__strncasecmp_l, strncasecmp_l)
diff --git a/sysdeps/generic/strncat.c b/sysdeps/generic/strncat.c
new file mode 100644
index 0000000000..2e2de11508
--- /dev/null
+++ b/sysdeps/generic/strncat.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+#ifdef _LIBC
+# include <memcopy.h>
+#else
+typedef char reg_char;
+#endif
+
+#undef strncat
+
+char *
+strncat (s1, s2, n)
+ char *s1;
+ const char *s2;
+ size_t n;
+{
+ reg_char c;
+ char *s = s1;
+
+ /* Find the end of S1. */
+ do
+ c = *s1++;
+ while (c != '\0');
+
+ /* Make S1 point before next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ s1 -= 2;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+ do
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ } while (--n4 > 0);
+ n &= 3;
+ }
+
+ while (n > 0)
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ n--;
+ }
+
+ if (c != '\0')
+ *++s1 = '\0';
+
+ return s;
+}
diff --git a/sysdeps/generic/strncat_chk.c b/sysdeps/generic/strncat_chk.c
new file mode 100644
index 0000000000..953b435a4b
--- /dev/null
+++ b/sysdeps/generic/strncat_chk.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 1991, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+#include <memcopy.h>
+
+
+char *
+__strncat_chk (s1, s2, n, s1len)
+ char *s1;
+ const char *s2;
+ size_t n;
+ size_t s1len;
+{
+ reg_char c;
+ char *s = s1;
+
+ /* Find the end of S1. */
+ do
+ {
+ if (__builtin_expect (s1len-- == 0, 0))
+ __chk_fail ();
+ c = *s1++;
+ }
+ while (c != '\0');
+
+ /* Make S1 point before next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ ++s1len;
+ s1 -= 2;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+ do
+ {
+ if (__builtin_expect (s1len-- == 0, 0))
+ __chk_fail ();
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ if (__builtin_expect (s1len-- == 0, 0))
+ __chk_fail ();
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ if (__builtin_expect (s1len-- == 0, 0))
+ __chk_fail ();
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ if (__builtin_expect (s1len-- == 0, 0))
+ __chk_fail ();
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ } while (--n4 > 0);
+ n &= 3;
+ }
+
+ while (n > 0)
+ {
+ if (__builtin_expect (s1len-- == 0, 0))
+ __chk_fail ();
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ n--;
+ }
+
+ if (c != '\0')
+ {
+ if (__builtin_expect (s1len-- == 0, 0))
+ __chk_fail ();
+ *++s1 = '\0';
+ }
+
+ return s;
+}
diff --git a/sysdeps/generic/strncmp.c b/sysdeps/generic/strncmp.c
new file mode 100644
index 0000000000..1adb2c0ebd
--- /dev/null
+++ b/sysdeps/generic/strncmp.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 1991, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+#undef strncmp
+
+/* Compare no more than N characters of S1 and S2,
+ returning less than, equal to or greater than zero
+ if S1 is lexicographically less than, equal to or
+ greater than S2. */
+int
+strncmp (s1, s2, n)
+ const char *s1;
+ const char *s2;
+ size_t n;
+{
+ unsigned reg_char c1 = '\0';
+ unsigned reg_char c2 = '\0';
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+ do
+ {
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ } while (--n4 > 0);
+ n &= 3;
+ }
+
+ while (n > 0)
+ {
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ n--;
+ }
+
+ return c1 - c2;
+}
+libc_hidden_builtin_def (strncmp)
diff --git a/sysdeps/generic/strncpy.c b/sysdeps/generic/strncpy.c
new file mode 100644
index 0000000000..f32612e1cf
--- /dev/null
+++ b/sysdeps/generic/strncpy.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+#undef strncpy
+
+char *
+strncpy (s1, s2, n)
+ char *s1;
+ const char *s2;
+ size_t n;
+{
+ reg_char c;
+ char *s = s1;
+
+ --s1;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+
+ for (;;)
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ if (--n4 == 0)
+ goto last_chars;
+ }
+ n = n - (s1 - s) - 1;
+ if (n == 0)
+ return s;
+ goto zero_fill;
+ }
+
+ last_chars:
+ n &= 3;
+ if (n == 0)
+ return s;
+
+ do
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (--n == 0)
+ return s;
+ }
+ while (c != '\0');
+
+ zero_fill:
+ do
+ *++s1 = '\0';
+ while (--n > 0);
+
+ return s;
+}
+libc_hidden_builtin_def (strncpy)
diff --git a/sysdeps/generic/strncpy_chk.c b/sysdeps/generic/strncpy_chk.c
new file mode 100644
index 0000000000..bdede7738b
--- /dev/null
+++ b/sysdeps/generic/strncpy_chk.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 1991, 1997, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+#include <memcopy.h>
+
+
+char *
+__strncpy_chk (s1, s2, n, s1len)
+ char *s1;
+ const char *s2;
+ size_t n;
+ size_t s1len;
+{
+ reg_char c;
+ char *s = s1;
+
+ if (__builtin_expect (s1len < n, 0))
+ __chk_fail ();
+
+ --s1;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+
+ for (;;)
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ if (--n4 == 0)
+ goto last_chars;
+ }
+ n = n - (s1 - s) - 1;
+ if (n == 0)
+ return s;
+ goto zero_fill;
+ }
+
+ last_chars:
+ n &= 3;
+ if (n == 0)
+ return s;
+
+ do
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (--n == 0)
+ return s;
+ }
+ while (c != '\0');
+
+ zero_fill:
+ do
+ *++s1 = '\0';
+ while (--n > 0);
+
+ return s;
+}
diff --git a/sysdeps/generic/strnlen.c b/sysdeps/generic/strnlen.c
new file mode 100644
index 0000000000..c83520e349
--- /dev/null
+++ b/sysdeps/generic/strnlen.c
@@ -0,0 +1,160 @@
+/* Find the length of STRING, but scan at most MAXLEN characters.
+ Copyright (C) 1991, 1993, 1997, 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+ Based on strlen written by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se);
+ commentary by Jim Blandy (jimb@ai.mit.edu).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <stdlib.h>
+
+/* Find the length of S, but scan at most MAXLEN characters. If no
+ '\0' terminator is found in that many characters, return MAXLEN. */
+size_t
+__strnlen (const char *str, size_t maxlen)
+{
+ const char *char_ptr, *end_ptr = str + maxlen;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, himagic, lomagic;
+
+ if (maxlen == 0)
+ return 0;
+
+ if (__builtin_expect (end_ptr < str, 0))
+ end_ptr = (const char *) ~0UL;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = str; ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == '\0')
+ {
+ if (char_ptr > end_ptr)
+ char_ptr = end_ptr;
+ return char_ptr - str;
+ }
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ magic_bits = 0x7efefeffL;
+ himagic = 0x80808080L;
+ lomagic = 0x01010101L;
+ if (sizeof (longword) > 4)
+ {
+ /* 64-bit version of the magic. */
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+ himagic = ((himagic << 16) << 16) | himagic;
+ lomagic = ((lomagic << 16) << 16) | lomagic;
+ }
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (longword_ptr < (unsigned long int *) end_ptr)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly. */
+
+ longword = *longword_ptr++;
+
+ if ((longword - lomagic) & himagic)
+ {
+ /* Which of the bytes was the zero? If none of them were, it was
+ a misfire; continue the search. */
+
+ const char *cp = (const char *) (longword_ptr - 1);
+
+ char_ptr = cp;
+ if (cp[0] == 0)
+ break;
+ char_ptr = cp + 1;
+ if (cp[1] == 0)
+ break;
+ char_ptr = cp + 2;
+ if (cp[2] == 0)
+ break;
+ char_ptr = cp + 3;
+ if (cp[3] == 0)
+ break;
+ if (sizeof (longword) > 4)
+ {
+ char_ptr = cp + 4;
+ if (cp[4] == 0)
+ break;
+ char_ptr = cp + 5;
+ if (cp[5] == 0)
+ break;
+ char_ptr = cp + 6;
+ if (cp[6] == 0)
+ break;
+ char_ptr = cp + 7;
+ if (cp[7] == 0)
+ break;
+ }
+ }
+ char_ptr = end_ptr;
+ }
+
+ if (char_ptr > end_ptr)
+ char_ptr = end_ptr;
+ return char_ptr - str;
+}
+weak_alias (__strnlen, strnlen)
diff --git a/sysdeps/generic/strpbrk.c b/sysdeps/generic/strpbrk.c
new file mode 100644
index 0000000000..620cfab7f9
--- /dev/null
+++ b/sysdeps/generic/strpbrk.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1994, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined _LIBC || defined HAVE_CONFIG_H
+# include <string.h>
+#endif
+
+#undef strpbrk
+
+/* Find the first occurrence in S of any character in ACCEPT. */
+char *
+strpbrk (s, accept)
+ const char *s;
+ const char *accept;
+{
+ while (*s != '\0')
+ {
+ const char *a = accept;
+ while (*a != '\0')
+ if (*a++ == *s)
+ return (char *) s;
+ ++s;
+ }
+
+ return NULL;
+}
+libc_hidden_builtin_def (strpbrk)
diff --git a/sysdeps/generic/strrchr.c b/sysdeps/generic/strrchr.c
new file mode 100644
index 0000000000..64118b87ef
--- /dev/null
+++ b/sysdeps/generic/strrchr.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+#undef strrchr
+
+/* Find the last occurrence of C in S. */
+char *
+strrchr (const char *s, int c)
+{
+ register const char *found, *p;
+
+ c = (unsigned char) c;
+
+ /* Since strchr is fast, we use it rather than the obvious loop. */
+
+ if (c == '\0')
+ return strchr (s, '\0');
+
+ found = NULL;
+ while ((p = strchr (s, c)) != NULL)
+ {
+ found = p;
+ s = p + 1;
+ }
+
+ return (char *) found;
+}
+
+#ifdef weak_alias
+#undef rindex
+weak_alias (strrchr, rindex)
+#endif
+libc_hidden_builtin_def (strrchr)
diff --git a/sysdeps/generic/strsep.c b/sysdeps/generic/strsep.c
new file mode 100644
index 0000000000..e5342f7a22
--- /dev/null
+++ b/sysdeps/generic/strsep.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 1992, 93, 96, 97, 98, 99, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+#undef __strsep
+#undef strsep
+
+char *
+__strsep (char **stringp, const char *delim)
+{
+ char *begin, *end;
+
+ begin = *stringp;
+ if (begin == NULL)
+ return NULL;
+
+ /* A frequent case is when the delimiter string contains only one
+ character. Here we don't need to call the expensive `strpbrk'
+ function and instead work using `strchr'. */
+ if (delim[0] == '\0' || delim[1] == '\0')
+ {
+ char ch = delim[0];
+
+ if (ch == '\0')
+ end = NULL;
+ else
+ {
+ if (*begin == ch)
+ end = begin;
+ else if (*begin == '\0')
+ end = NULL;
+ else
+ end = strchr (begin + 1, ch);
+ }
+ }
+ else
+ /* Find the end of the token. */
+ end = strpbrk (begin, delim);
+
+ if (end)
+ {
+ /* Terminate the token and set *STRINGP past NUL character. */
+ *end++ = '\0';
+ *stringp = end;
+ }
+ else
+ /* No more delimiters; this is the last token. */
+ *stringp = NULL;
+
+ return begin;
+}
+weak_alias (__strsep, strsep)
+strong_alias (__strsep, __strsep_g)
+libc_hidden_def (__strsep_g)
diff --git a/sysdeps/generic/strspn.c b/sysdeps/generic/strspn.c
new file mode 100644
index 0000000000..dc17ea8cbc
--- /dev/null
+++ b/sysdeps/generic/strspn.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+#undef strspn
+
+/* Return the length of the maximum initial segment
+ of S which contains only characters in ACCEPT. */
+size_t
+strspn (s, accept)
+ const char *s;
+ const char *accept;
+{
+ const char *p;
+ const char *a;
+ size_t count = 0;
+
+ for (p = s; *p != '\0'; ++p)
+ {
+ for (a = accept; *a != '\0'; ++a)
+ if (*p == *a)
+ break;
+ if (*a == '\0')
+ return count;
+ else
+ ++count;
+ }
+
+ return count;
+}
+libc_hidden_builtin_def (strspn)
diff --git a/sysdeps/generic/strstr.c b/sysdeps/generic/strstr.c
new file mode 100644
index 0000000000..fce1f2a756
--- /dev/null
+++ b/sysdeps/generic/strstr.c
@@ -0,0 +1,123 @@
+/* Return the offset of one string within another.
+ Copyright (C) 1994,1996,1997,2000,2001,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * My personal strstr() implementation that beats most other algorithms.
+ * Until someone tells me otherwise, I assume that this is the
+ * fastest implementation of strstr() in C.
+ * I deliberately chose not to comment it. You should have at least
+ * as much fun trying to understand it, as I had to write it :-).
+ *
+ * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined _LIBC || defined HAVE_STRING_H
+# include <string.h>
+#endif
+
+typedef unsigned chartype;
+
+#undef strstr
+
+char *
+strstr (phaystack, pneedle)
+ const char *phaystack;
+ const char *pneedle;
+{
+ const unsigned char *haystack, *needle;
+ chartype b;
+ const unsigned char *rneedle;
+
+ haystack = (const unsigned char *) phaystack;
+
+ if ((b = *(needle = (const unsigned char *) pneedle)))
+ {
+ chartype c;
+ haystack--; /* possible ANSI violation */
+
+ {
+ chartype a;
+ do
+ if (!(a = *++haystack))
+ goto ret0;
+ while (a != b);
+ }
+
+ if (!(c = *++needle))
+ goto foundneedle;
+ ++needle;
+ goto jin;
+
+ for (;;)
+ {
+ {
+ chartype a;
+ if (0)
+ jin:{
+ if ((a = *++haystack) == c)
+ goto crest;
+ }
+ else
+ a = *++haystack;
+ do
+ {
+ for (; a != b; a = *++haystack)
+ {
+ if (!a)
+ goto ret0;
+ if ((a = *++haystack) == b)
+ break;
+ if (!a)
+ goto ret0;
+ }
+ }
+ while ((a = *++haystack) != c);
+ }
+ crest:
+ {
+ chartype a;
+ {
+ const unsigned char *rhaystack;
+ if (*(rhaystack = haystack-- + 1) == (a = *(rneedle = needle)))
+ do
+ {
+ if (!a)
+ goto foundneedle;
+ if (*++rhaystack != (a = *++needle))
+ break;
+ if (!a)
+ goto foundneedle;
+ }
+ while (*++rhaystack == (a = *++needle));
+ needle = rneedle; /* took the register-poor aproach */
+ }
+ if (!a)
+ break;
+ }
+ }
+ }
+foundneedle:
+ return (char *) haystack;
+ret0:
+ return 0;
+}
+libc_hidden_builtin_def (strstr)
diff --git a/sysdeps/generic/strtoimax.c b/sysdeps/generic/strtoimax.c
new file mode 100644
index 0000000000..f1de70f320
--- /dev/null
+++ b/sysdeps/generic/strtoimax.c
@@ -0,0 +1 @@
+#error "The correct implementation must be chosen based on the `intmax_t' type"
diff --git a/sysdeps/generic/strtok.c b/sysdeps/generic/strtok.c
new file mode 100644
index 0000000000..f45b760f74
--- /dev/null
+++ b/sysdeps/generic/strtok.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 1991,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <string.h>
+
+
+static char *olds;
+
+#undef strtok
+
+/* Parse S into tokens separated by characters in DELIM.
+ If S is NULL, the last string strtok() was called with is
+ used. For example:
+ char s[] = "-abc-=-def";
+ x = strtok(s, "-"); // x = "abc"
+ x = strtok(NULL, "-="); // x = "def"
+ x = strtok(NULL, "="); // x = NULL
+ // s = "abc\0-def\0"
+*/
+char *
+strtok (s, delim)
+ char *s;
+ const char *delim;
+{
+ char *token;
+
+ if (s == NULL)
+ s = olds;
+
+ /* Scan leading delimiters. */
+ s += strspn (s, delim);
+ if (*s == '\0')
+ {
+ olds = s;
+ return NULL;
+ }
+
+ /* Find the end of the token. */
+ token = s;
+ s = strpbrk (token, delim);
+ if (s == NULL)
+ /* This token finishes the string. */
+ olds = __rawmemchr (token, '\0');
+ else
+ {
+ /* Terminate the token and make OLDS point past it. */
+ *s = '\0';
+ olds = s + 1;
+ }
+ return token;
+}
diff --git a/sysdeps/generic/strtok_r.c b/sysdeps/generic/strtok_r.c
new file mode 100644
index 0000000000..b11cb520f6
--- /dev/null
+++ b/sysdeps/generic/strtok_r.c
@@ -0,0 +1,79 @@
+/* Reentrant string tokenizer. Generic version.
+ Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+
+#undef strtok_r
+#undef __strtok_r
+
+#ifndef _LIBC
+/* Get specification. */
+# include "strtok_r.h"
+# define __strtok_r strtok_r
+# define __rawmemchr strchr
+#endif
+
+/* Parse S into tokens separated by characters in DELIM.
+ If S is NULL, the saved pointer in SAVE_PTR is used as
+ the next starting point. For example:
+ char s[] = "-abc-=-def";
+ char *sp;
+ x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
+ x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
+ x = strtok_r(NULL, "=", &sp); // x = NULL
+ // s = "abc\0-def\0"
+*/
+char *
+__strtok_r (char *s, const char *delim, char **save_ptr)
+{
+ char *token;
+
+ if (s == NULL)
+ s = *save_ptr;
+
+ /* Scan leading delimiters. */
+ s += strspn (s, delim);
+ if (*s == '\0')
+ {
+ *save_ptr = s;
+ return NULL;
+ }
+
+ /* Find the end of the token. */
+ token = s;
+ s = strpbrk (token, delim);
+ if (s == NULL)
+ /* This token finishes the string. */
+ *save_ptr = __rawmemchr (token, '\0');
+ else
+ {
+ /* Terminate the token and make *SAVE_PTR point past it. */
+ *s = '\0';
+ *save_ptr = s + 1;
+ }
+ return token;
+}
+#ifdef weak_alias
+libc_hidden_def (__strtok_r)
+weak_alias (__strtok_r, strtok_r)
+#endif
diff --git a/sysdeps/generic/strtol.c b/sysdeps/generic/strtol.c
new file mode 100644
index 0000000000..02ec19aabe
--- /dev/null
+++ b/sysdeps/generic/strtol.c
@@ -0,0 +1,111 @@
+/* Convert string representation of a number into an integer value.
+ Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001,2002,2003,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <wchar.h>
+#include <locale/localeinfo.h>
+
+#ifndef UNSIGNED
+# define UNSIGNED 0
+# define INT LONG int
+#else
+# define INT unsigned LONG int
+#endif
+
+#if UNSIGNED
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol wcstoull
+# define __strtol_l __wcstoull_l
+# else
+# define strtol wcstoul
+# define __strtol_l __wcstoul_l
+# endif
+# else
+# ifdef QUAD
+# define strtol strtoull
+# define __strtol_l __strtoull_l
+# else
+# define strtol strtoul
+# define __strtol_l __strtoul_l
+# endif
+# endif
+#else
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol wcstoll
+# define __strtol_l __wcstoll_l
+# else
+# define strtol wcstol
+# define __strtol_l __wcstol_l
+# endif
+# else
+# ifdef QUAD
+# define strtol strtoll
+# define __strtol_l __strtoll_l
+# endif
+# endif
+#endif
+
+
+/* If QUAD is defined, we are defining `strtoll' or `strtoull',
+ operating on `long long int's. */
+#ifdef QUAD
+# define LONG long long
+#else
+# define LONG long
+#endif
+
+
+#ifdef USE_WIDE_CHAR
+# define STRING_TYPE wchar_t
+#else
+# define STRING_TYPE char
+#endif
+
+
+#define INTERNAL(X) INTERNAL1(X)
+#define INTERNAL1(X) __##X##_internal
+
+
+extern INT INTERNAL (__strtol_l) (const STRING_TYPE *, STRING_TYPE **, int,
+ int, __locale_t);
+
+
+INT
+INTERNAL (strtol) (nptr, endptr, base, group)
+ const STRING_TYPE *nptr;
+ STRING_TYPE **endptr;
+ int base;
+ int group;
+{
+ return INTERNAL (__strtol_l) (nptr, endptr, base, group, _NL_CURRENT_LOCALE);
+}
+libc_hidden_def (INTERNAL (strtol))
+
+
+INT
+strtol (nptr, endptr, base)
+ const STRING_TYPE *nptr;
+ STRING_TYPE **endptr;
+ int base;
+{
+ return INTERNAL (__strtol_l) (nptr, endptr, base, 0, _NL_CURRENT_LOCALE);
+}
diff --git a/sysdeps/generic/strtol_l.c b/sysdeps/generic/strtol_l.c
new file mode 100644
index 0000000000..156083c748
--- /dev/null
+++ b/sysdeps/generic/strtol_l.c
@@ -0,0 +1,557 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define USE_NUMBER_GROUPING
+# define STDC_HEADERS
+# define HAVE_LIMITS_H
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <xlocale.h>
+#include <bits/wordsize.h>
+
+#ifdef USE_NUMBER_GROUPING
+# include "../locale/localeinfo.h"
+#endif
+
+/* Nonzero if we are defining `strtoul' or `strtoull', operating on
+ unsigned integers. */
+#ifndef UNSIGNED
+# define UNSIGNED 0
+# define INT LONG int
+#else
+# define INT unsigned LONG int
+#endif
+
+/* Determine the name. */
+#if UNSIGNED
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol_l wcstoull_l
+# else
+# define strtol_l wcstoul_l
+# endif
+# else
+# ifdef QUAD
+# define strtol_l strtoull_l
+# else
+# define strtol_l strtoul_l
+# endif
+# endif
+#else
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol_l wcstoll_l
+# else
+# define strtol_l wcstol_l
+# endif
+# else
+# ifdef QUAD
+# define strtol_l strtoll_l
+# else
+# define strtol_l strtol_l
+# endif
+# endif
+#endif
+
+#define __strtol_l __strtol_l2(strtol_l)
+#define __strtol_l2(name) __strtol_l3(name)
+#define __strtol_l3(name) __##name
+
+
+/* If QUAD is defined, we are defining `strtoll' or `strtoull',
+ operating on `long long int's. */
+#ifdef QUAD
+# define LONG long long
+# define STRTOL_LONG_MIN LONG_LONG_MIN
+# define STRTOL_LONG_MAX LONG_LONG_MAX
+# define STRTOL_ULONG_MAX ULONG_LONG_MAX
+#else
+# define LONG long
+
+# ifndef ULONG_MAX
+# define ULONG_MAX ((unsigned long int) ~(unsigned long int) 0)
+# endif
+# ifndef LONG_MAX
+# define LONG_MAX ((long int) (ULONG_MAX >> 1))
+# endif
+# define STRTOL_LONG_MIN LONG_MIN
+# define STRTOL_LONG_MAX LONG_MAX
+# define STRTOL_ULONG_MAX ULONG_MAX
+#endif
+
+
+/* We use this code for the extended locale handling where the
+ function gets as an additional argument the locale which has to be
+ used. To access the values we have to redefine the _NL_CURRENT and
+ _NL_CURRENT_WORD macros. */
+#undef _NL_CURRENT
+#define _NL_CURRENT(category, item) \
+ (current->values[_NL_ITEM_INDEX (item)].string)
+#undef _NL_CURRENT_WORD
+#define _NL_CURRENT_WORD(category, item) \
+ ((uint32_t) current->values[_NL_ITEM_INDEX (item)].word)
+
+#if defined _LIBC || defined HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
+#ifdef USE_WIDE_CHAR
+# include <wctype.h>
+# define L_(Ch) L##Ch
+# define UCHAR_TYPE wint_t
+# define STRING_TYPE wchar_t
+# define ISSPACE(Ch) __iswspace_l ((Ch), loc)
+# define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
+# define TOUPPER(Ch) __towupper_l ((Ch), loc)
+#else
+# if defined _LIBC \
+ || defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
+# define IN_CTYPE_DOMAIN(c) 1
+# else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+# endif
+# define L_(Ch) Ch
+# define UCHAR_TYPE unsigned char
+# define STRING_TYPE char
+# define ISSPACE(Ch) __isspace_l ((Ch), loc)
+# define ISALPHA(Ch) __isalpha_l ((Ch), loc)
+# define TOUPPER(Ch) __toupper_l ((Ch), loc)
+#endif
+
+#define INTERNAL(X) INTERNAL1(X)
+#define INTERNAL1(X) __##X##_internal
+#define WEAKNAME(X) WEAKNAME1(X)
+
+#ifdef USE_NUMBER_GROUPING
+/* This file defines a function to check for correct grouping. */
+# include "grouping.h"
+#endif
+
+
+/* Define tables of maximum values and remainders in order to detect
+ overflow. Do this at compile-time in order to avoid the runtime
+ overhead of the division. */
+
+#define DEF(TYPE, NAME) \
+ const TYPE NAME[] attribute_hidden \
+ __attribute__((section(".gnu.linkonce.r." #NAME))) = \
+ { \
+ F(2), F(3), F(4), F(5), F(6), F(7), F(8), F(9), F(10), \
+ F(11), F(12), F(13), F(14), F(15), F(16), F(17), F(18), F(19), F(20), \
+ F(21), F(22), F(23), F(24), F(25), F(26), F(27), F(28), F(29), F(30), \
+ F(31), F(32), F(33), F(34), F(35), F(36) \
+ }
+
+#define F(X) ULONG_MAX / X
+ DEF (unsigned long, __strtol_ul_max_tab);
+#undef F
+#if defined(QUAD) && __WORDSIZE == 32
+# define F(X) ULONG_LONG_MAX / X
+ DEF (unsigned long long, __strtol_ull_max_tab);
+# undef F
+# define F(X) ULONG_LONG_MAX % X
+ DEF (unsigned char, __strtol_ull_rem_tab);
+# undef F
+#else
+# define F(X) ULONG_MAX % X
+ DEF (unsigned char, __strtol_ul_rem_tab);
+# undef F
+#endif
+#undef DEF
+
+/* Define some more readable aliases for these arrays which correspond
+ to how they'll be used in the function below. */
+#define jmax_tab __strtol_ul_max_tab
+#if defined(QUAD) && __WORDSIZE == 32
+# define cutoff_tab __strtol_ull_max_tab
+# define cutlim_tab __strtol_ull_rem_tab
+#else
+# define cutoff_tab __strtol_ul_max_tab
+# define cutlim_tab __strtol_ul_rem_tab
+#endif
+
+
+/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
+ If BASE is 0 the base is determined by the presence of a leading
+ zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
+ If BASE is < 2 or > 36, it is reset to 10.
+ If ENDPTR is not NULL, a pointer to the character after the last
+ one converted is stored in *ENDPTR. */
+
+INT
+INTERNAL (__strtol_l) (nptr, endptr, base, group, loc)
+ const STRING_TYPE *nptr;
+ STRING_TYPE **endptr;
+ int base;
+ int group;
+ __locale_t loc;
+{
+ int negative;
+ register unsigned LONG int cutoff;
+ register unsigned int cutlim;
+ register unsigned LONG int i;
+ register const STRING_TYPE *s;
+ register UCHAR_TYPE c;
+ const STRING_TYPE *save, *end;
+ int overflow;
+#ifndef USE_WIDE_CHAR
+ size_t cnt;
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+ struct locale_data *current = loc->__locales[LC_NUMERIC];
+ /* The thousands character of the current locale. */
+# ifdef USE_WIDE_CHAR
+ wchar_t thousands = L'\0';
+# else
+ const char *thousands = NULL;
+ size_t thousands_len = 0;
+# endif
+ /* The numeric grouping specification of the current locale,
+ in the format described in <locale.h>. */
+ const char *grouping;
+
+ if (__builtin_expect (group, 0))
+ {
+ grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+ if (*grouping <= 0 || *grouping == CHAR_MAX)
+ grouping = NULL;
+ else
+ {
+ /* Figure out the thousands separator character. */
+# ifdef USE_WIDE_CHAR
+# ifdef _LIBC
+ thousands = _NL_CURRENT_WORD (LC_NUMERIC,
+ _NL_NUMERIC_THOUSANDS_SEP_WC);
+# endif
+ if (thousands == L'\0')
+ grouping = NULL;
+# else
+# ifdef _LIBC
+ thousands = _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
+# endif
+ if (*thousands == '\0')
+ {
+ thousands = NULL;
+ grouping = NULL;
+ }
+# endif
+ }
+ }
+ else
+ grouping = NULL;
+#endif
+
+ if (base < 0 || base == 1 || base > 36)
+ {
+ __set_errno (EINVAL);
+ return 0;
+ }
+
+ save = s = nptr;
+
+ /* Skip white space. */
+ while (ISSPACE (*s))
+ ++s;
+ if (__builtin_expect (*s == L_('\0'), 0))
+ goto noconv;
+
+ /* Check for a sign. */
+ negative = 0;
+ if (*s == L_('-'))
+ {
+ negative = 1;
+ ++s;
+ }
+ else if (*s == L_('+'))
+ ++s;
+
+ /* Recognize number prefix and if BASE is zero, figure it out ourselves. */
+ if (*s == L_('0'))
+ {
+ if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
+ {
+ s += 2;
+ base = 16;
+ }
+ else if (base == 0)
+ base = 8;
+ }
+ else if (base == 0)
+ base = 10;
+
+ /* Save the pointer so we can check later if anything happened. */
+ save = s;
+
+#ifdef USE_NUMBER_GROUPING
+ if (base != 10)
+ grouping = NULL;
+
+ if (__builtin_expect (grouping != NULL, 0))
+ {
+# ifndef USE_WIDE_CHAR
+ thousands_len = strlen (thousands);
+# endif
+
+ /* Find the end of the digit string and check its grouping. */
+ end = s;
+ if (
+# ifdef USE_WIDE_CHAR
+ *s != thousands
+# else
+ ({ for (cnt = 0; cnt < thousands_len; ++cnt)
+ if (thousands[cnt] != end[cnt])
+ break;
+ cnt < thousands_len; })
+# endif
+ )
+ {
+ for (c = *end; c != L_('\0'); c = *++end)
+ if (((STRING_TYPE) c < L_('0') || (STRING_TYPE) c > L_('9'))
+# ifdef USE_WIDE_CHAR
+ && (wchar_t) c != thousands
+# else
+ && ({ for (cnt = 0; cnt < thousands_len; ++cnt)
+ if (thousands[cnt] != end[cnt])
+ break;
+ cnt < thousands_len; })
+# endif
+ && (!ISALPHA (c)
+ || (int) (TOUPPER (c) - L_('A') + 10) >= base))
+ break;
+
+# ifdef USE_WIDE_CHAR
+ end = __correctly_grouped_prefixwc (s, end, thousands, grouping);
+# else
+ end = __correctly_grouped_prefixmb (s, end, thousands, grouping);
+# endif
+ }
+ }
+ else
+#endif
+ end = NULL;
+
+ /* Avoid runtime division; lookup cutoff and limit. */
+ cutoff = cutoff_tab[base - 2];
+ cutlim = cutlim_tab[base - 2];
+
+ overflow = 0;
+ i = 0;
+ c = *s;
+ if (sizeof (long int) != sizeof (LONG int))
+ {
+ unsigned long int j = 0;
+ unsigned long int jmax = jmax_tab[base - 2];
+
+ for (;c != L_('\0'); c = *++s)
+ {
+ if (s == end)
+ break;
+ if (c >= L_('0') && c <= L_('9'))
+ c -= L_('0');
+#ifdef USE_NUMBER_GROUPING
+# ifdef USE_WIDE_CHAR
+ else if (grouping && (wchar_t) c == thousands)
+ continue;
+# else
+ else if (thousands_len)
+ {
+ for (cnt = 0; cnt < thousands_len; ++cnt)
+ if (thousands[cnt] != s[cnt])
+ break;
+ if (cnt == thousands_len)
+ {
+ s += thousands_len - 1;
+ continue;
+ }
+ if (ISALPHA (c))
+ c = TOUPPER (c) - L_('A') + 10;
+ else
+ break;
+ }
+# endif
+#endif
+ else if (ISALPHA (c))
+ c = TOUPPER (c) - L_('A') + 10;
+ else
+ break;
+ if ((int) c >= base)
+ break;
+ /* Note that we never can have an overflow. */
+ else if (j >= jmax)
+ {
+ /* We have an overflow. Now use the long representation. */
+ i = (unsigned LONG int) j;
+ goto use_long;
+ }
+ else
+ j = j * (unsigned long int) base + c;
+ }
+
+ i = (unsigned LONG int) j;
+ }
+ else
+ for (;c != L_('\0'); c = *++s)
+ {
+ if (s == end)
+ break;
+ if (c >= L_('0') && c <= L_('9'))
+ c -= L_('0');
+#ifdef USE_NUMBER_GROUPING
+# ifdef USE_WIDE_CHAR
+ else if (grouping && (wchar_t) c == thousands)
+ continue;
+# else
+ else if (thousands_len)
+ {
+ for (cnt = 0; cnt < thousands_len; ++cnt)
+ if (thousands[cnt] != s[cnt])
+ break;
+ if (cnt == thousands_len)
+ {
+ s += thousands_len - 1;
+ continue;
+ }
+ if (ISALPHA (c))
+ c = TOUPPER (c) - L_('A') + 10;
+ else
+ break;
+ }
+# endif
+#endif
+ else if (ISALPHA (c))
+ c = TOUPPER (c) - L_('A') + 10;
+ else
+ break;
+ if ((int) c >= base)
+ break;
+ /* Check for overflow. */
+ if (i > cutoff || (i == cutoff && c > cutlim))
+ overflow = 1;
+ else
+ {
+ use_long:
+ i *= (unsigned LONG int) base;
+ i += c;
+ }
+ }
+
+ /* Check if anything actually happened. */
+ if (s == save)
+ goto noconv;
+
+ /* Store in ENDPTR the address of one character
+ past the last character we converted. */
+ if (endptr != NULL)
+ *endptr = (STRING_TYPE *) s;
+
+#if !UNSIGNED
+ /* Check for a value that is within the range of
+ `unsigned LONG int', but outside the range of `LONG int'. */
+ if (overflow == 0
+ && i > (negative
+ ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
+ : (unsigned LONG int) STRTOL_LONG_MAX))
+ overflow = 1;
+#endif
+
+ if (__builtin_expect (overflow, 0))
+ {
+ __set_errno (ERANGE);
+#if UNSIGNED
+ return STRTOL_ULONG_MAX;
+#else
+ return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
+#endif
+ }
+
+ /* Return the result of the appropriate sign. */
+ return negative ? -i : i;
+
+noconv:
+ /* We must handle a special case here: the base is 0 or 16 and the
+ first two characters are '0' and 'x', but the rest are no
+ hexadecimal digits. This is no error case. We return 0 and
+ ENDPTR points to the `x`. */
+ if (endptr != NULL)
+ {
+ if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
+ && save[-2] == L_('0'))
+ *endptr = (STRING_TYPE *) &save[-1];
+ else
+ /* There was no number to convert. */
+ *endptr = (STRING_TYPE *) nptr;
+ }
+
+ return 0L;
+}
+#if defined _LIBC && !defined USE_WIDE_CHAR
+libc_hidden_def (INTERNAL (__strtol_l))
+#endif
+
+/* External user entry point. */
+
+#if _LIBC - 0 == 0
+# undef PARAMS
+# if defined (__STDC__) && __STDC__
+# define PARAMS(Args) Args
+# else
+# define PARAMS(Args) ()
+# endif
+
+/* Prototype. */
+extern INT __strtol_l PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr,
+ int base));
+#endif
+
+
+INT
+#ifdef weak_function
+weak_function
+#endif
+__strtol_l (nptr, endptr, base, loc)
+ const STRING_TYPE *nptr;
+ STRING_TYPE **endptr;
+ int base;
+ __locale_t loc;
+{
+ return INTERNAL (__strtol_l) (nptr, endptr, base, 0, loc);
+}
+weak_alias (__strtol_l, strtol_l)
diff --git a/sysdeps/generic/strtold_l.c b/sysdeps/generic/strtold_l.c
new file mode 100644
index 0000000000..690a8a92eb
--- /dev/null
+++ b/sysdeps/generic/strtold_l.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <stdlib.h>
+#include <xlocale.h>
+
+#ifdef USE_WIDE_CHAR
+# define STRING_TYPE wchar_t
+# define STRTOLD wcstold_l
+# define __STRTOLD __wcstold_l
+# define __STRTOD __wcstod_l
+#else
+# define STRING_TYPE char
+# define STRTOLD strtold_l
+# define __STRTOLD __strtold_l
+# define __STRTOD __strtod_l
+#endif
+
+#define INTERNAL(x) INTERNAL1(x)
+#define INTERNAL1(x) __##x##_internal
+
+extern double INTERNAL (__STRTOD) (const STRING_TYPE *, STRING_TYPE **,
+ int, __locale_t);
+
+/* There is no `long double' type, use the `double' implementations. */
+long double
+INTERNAL (__STRTOLD) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+ int group, __locale_t loc)
+{
+ return INTERNAL (__STRTOD) (nptr, endptr, group, loc);
+}
+#ifndef USE_WIDE_CHAR
+libc_hidden_def (INTERNAL (__STRTOLD))
+#endif
+
+long double
+weak_function
+__STRTOLD (const STRING_TYPE *nptr, STRING_TYPE **endptr, __locale_t loc)
+{
+ return INTERNAL (__STRTOD) (nptr, endptr, 0, loc);
+}
+weak_alias (__STRTOLD, STRTOLD)
diff --git a/sysdeps/generic/strtoll.c b/sysdeps/generic/strtoll.c
new file mode 100644
index 0000000000..60128df781
--- /dev/null
+++ b/sysdeps/generic/strtoll.c
@@ -0,0 +1,34 @@
+/* Function to parse a `long long int' from text.
+ Copyright (C) 1995, 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define QUAD 1
+
+#include <strtol.c>
+
+#ifdef _LIBC
+# ifdef SHARED
+# include <shlib-compat.h>
+
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
+# endif
+
+# endif
+weak_alias (strtoll, strtoq)
+#endif
diff --git a/sysdeps/generic/strtoll_l.c b/sysdeps/generic/strtoll_l.c
new file mode 100644
index 0000000000..7725035bd1
--- /dev/null
+++ b/sysdeps/generic/strtoll_l.c
@@ -0,0 +1,28 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define QUAD 1
+
+#include <xlocale.h>
+
+extern long long int ____strtoll_l_internal (const char *, char **, int, int,
+ __locale_t);
+
+#include <strtol_l.c>
diff --git a/sysdeps/generic/strtoul.c b/sysdeps/generic/strtoul.c
new file mode 100644
index 0000000000..0862950231
--- /dev/null
+++ b/sysdeps/generic/strtoul.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define UNSIGNED 1
+
+#include "strtol.c"
diff --git a/sysdeps/generic/strtoul_l.c b/sysdeps/generic/strtoul_l.c
new file mode 100644
index 0000000000..a8b980f48d
--- /dev/null
+++ b/sysdeps/generic/strtoul_l.c
@@ -0,0 +1,28 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define UNSIGNED 1
+
+#include <xlocale.h>
+
+extern unsigned long int ____strtoul_l_internal (const char *, char **, int,
+ int, __locale_t);
+
+#include "strtol_l.c"
diff --git a/sysdeps/generic/strtoull.c b/sysdeps/generic/strtoull.c
new file mode 100644
index 0000000000..accf5874a0
--- /dev/null
+++ b/sysdeps/generic/strtoull.c
@@ -0,0 +1,34 @@
+/* Function to parse an `unsigned long long int' from text.
+ Copyright (C) 1995, 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define QUAD 1
+
+#include <strtoul.c>
+
+#ifdef _LIBC
+# ifdef SHARED
+# include <shlib-compat.h>
+
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+compat_symbol (libc, __strtoull_internal, __strtouq_internal, GLIBC_2_0);
+# endif
+
+# endif
+weak_alias (strtoull, strtouq)
+#endif
diff --git a/sysdeps/generic/strtoull_l.c b/sysdeps/generic/strtoull_l.c
new file mode 100644
index 0000000000..68ad0d826e
--- /dev/null
+++ b/sysdeps/generic/strtoull_l.c
@@ -0,0 +1,29 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define QUAD 1
+#define UNSIGNED 1
+
+#include <xlocale.h>
+
+extern unsigned long long int ____strtoull_l_internal (const char *, char **,
+ int, int, __locale_t);
+
+#include <strtol_l.c>
diff --git a/sysdeps/generic/strtoumax.c b/sysdeps/generic/strtoumax.c
new file mode 100644
index 0000000000..508cb19f8c
--- /dev/null
+++ b/sysdeps/generic/strtoumax.c
@@ -0,0 +1 @@
+#error "The correct implementation must be chosen based on the `uintmax_t' type"
diff --git a/sysdeps/generic/strtsupp.c b/sysdeps/generic/strtsupp.c
new file mode 100644
index 0000000000..c66495bb3d
--- /dev/null
+++ b/sysdeps/generic/strtsupp.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+ On-Line Applications Research Corporation.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <standalone.h>
+
+/* This file is only required when a "bare" board is configured. */
+
+/* Start Support Routines
+
+The start code for some CPUs (e.g. i386) require target dependent
+support. For more info, consult the start file for your CPU. */
diff --git a/sysdeps/generic/stty.c b/sysdeps/generic/stty.c
new file mode 100644
index 0000000000..49c569a77b
--- /dev/null
+++ b/sysdeps/generic/stty.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sgtty.h>
+#include <stddef.h>
+
+/* Set the terminal parameters associated with FD to *PARAMS. */
+int
+stty (fd, params)
+ int fd;
+ const struct sgttyb *params;
+{
+ if (params == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (stty)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sub_n.c b/sysdeps/generic/sub_n.c
new file mode 100644
index 0000000000..4f2f06099c
--- /dev/null
+++ b/sysdeps/generic/sub_n.c
@@ -0,0 +1,62 @@
+/* mpn_sub_n -- Subtract two limb vectors of equal, non-zero length.
+
+Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+mp_limb_t
+#if __STDC__
+mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size)
+#else
+mpn_sub_n (res_ptr, s1_ptr, s2_ptr, size)
+ register mp_ptr res_ptr;
+ register mp_srcptr s1_ptr;
+ register mp_srcptr s2_ptr;
+ mp_size_t size;
+#endif
+{
+ register mp_limb_t x, y, cy;
+ register mp_size_t j;
+
+ /* The loop counter and index J goes from -SIZE to -1. This way
+ the loop becomes faster. */
+ j = -size;
+
+ /* Offset the base pointers to compensate for the negative indices. */
+ s1_ptr -= j;
+ s2_ptr -= j;
+ res_ptr -= j;
+
+ cy = 0;
+ do
+ {
+ y = s2_ptr[j];
+ x = s1_ptr[j];
+ y += cy; /* add previous carry to subtrahend */
+ cy = (y < cy); /* get out carry from that addition */
+ y = x - y; /* main subtract */
+ cy = (y > x) + cy; /* get out carry from the subtract, combine */
+ res_ptr[j] = y;
+ }
+ while (++j != 0);
+
+ return cy;
+}
diff --git a/sysdeps/generic/submul_1.c b/sysdeps/generic/submul_1.c
new file mode 100644
index 0000000000..c7c08ee4af
--- /dev/null
+++ b/sysdeps/generic/submul_1.c
@@ -0,0 +1,65 @@
+/* mpn_submul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR
+ by S2_LIMB, subtract the S1_SIZE least significant limbs of the product
+ from the limb vector pointed to by RES_PTR. Return the most significant
+ limb of the product, adjusted for carry-out from the subtraction.
+
+Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+mp_limb_t
+mpn_submul_1 (res_ptr, s1_ptr, s1_size, s2_limb)
+ register mp_ptr res_ptr;
+ register mp_srcptr s1_ptr;
+ mp_size_t s1_size;
+ register mp_limb_t s2_limb;
+{
+ register mp_limb_t cy_limb;
+ register mp_size_t j;
+ register mp_limb_t prod_high, prod_low;
+ register mp_limb_t x;
+
+ /* The loop counter and index J goes from -SIZE to -1. This way
+ the loop becomes faster. */
+ j = -s1_size;
+
+ /* Offset the base pointers to compensate for the negative indices. */
+ res_ptr -= j;
+ s1_ptr -= j;
+
+ cy_limb = 0;
+ do
+ {
+ umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb);
+
+ prod_low += cy_limb;
+ cy_limb = (prod_low < cy_limb) + prod_high;
+
+ x = res_ptr[j];
+ prod_low = x - prod_low;
+ cy_limb += (prod_low > x);
+ res_ptr[j] = prod_low;
+ }
+ while (++j != 0);
+
+ return cy_limb;
+}
diff --git a/sysdeps/generic/swapcontext.c b/sysdeps/generic/swapcontext.c
new file mode 100644
index 0000000000..56b73f0d6c
--- /dev/null
+++ b/sysdeps/generic/swapcontext.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <ucontext.h>
+
+int
+swapcontext (oucp, ucp)
+ ucontext_t *oucp;
+ const ucontext_t *ucp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (swapcontext)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/swapoff.c b/sysdeps/generic/swapoff.c
new file mode 100644
index 0000000000..033d841d95
--- /dev/null
+++ b/sysdeps/generic/swapoff.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Stop using block special device PATH for swapping. */
+int
+swapoff (const char *path)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (swapoff)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/swapon.c b/sysdeps/generic/swapon.c
new file mode 100644
index 0000000000..910781fa93
--- /dev/null
+++ b/sysdeps/generic/swapon.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/swap.h>
+
+/* Make the block special device PATH available to the system for swapping.
+ This call is restricted to the super-user. */
+int
+swapon (path)
+ const char *path;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (swapon)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/symlink.c b/sysdeps/generic/symlink.c
new file mode 100644
index 0000000000..e6c6709f1a
--- /dev/null
+++ b/sysdeps/generic/symlink.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Make a link to FROM called TO. */
+int
+__symlink (from, to)
+ const char *from;
+ const char *to;
+{
+ if (from == NULL || to == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (symlink)
+
+weak_alias (__symlink, symlink)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sync.c b/sysdeps/generic/sync.c
new file mode 100644
index 0000000000..5ccdb5d5bf
--- /dev/null
+++ b/sysdeps/generic/sync.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make all changes done to all files actually appear on disk. */
+void
+sync ()
+{
+ __set_errno (ENOSYS);
+}
+
+
+stub_warning (sync)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/syscall.c b/sysdeps/generic/syscall.c
new file mode 100644
index 0000000000..ad78a06b73
--- /dev/null
+++ b/sysdeps/generic/syscall.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Do system call CALLNO, passing it the remaining arguments.
+ This only makes sense in certain operating systems. */
+
+long int
+syscall (callno)
+ long int callno;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (syscall)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sysconf.c b/sysdeps/generic/sysconf.c
new file mode 100644
index 0000000000..f22685cb29
--- /dev/null
+++ b/sysdeps/generic/sysconf.c
@@ -0,0 +1,273 @@
+/* Copyright (C) 1991,1993,1995-1997,2001,2002,2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <grp.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+#include <limits.h>
+#include <sys/param.h>
+#include <sys/sysinfo.h>
+
+
+/* Get the value of the system variable NAME. */
+long int
+__sysconf (name)
+ int name;
+{
+ switch (name)
+ {
+ default:
+ __set_errno (EINVAL);
+ return -1;
+
+ case _SC_TZNAME_MAX:
+ return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
+
+ case _SC_CHARCLASS_NAME_MAX:
+#ifdef CHARCLASS_NAME_MAX
+ return CHARCLASS_NAME_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_COLL_WEIGHTS_MAX:
+#ifdef COLL_WEIGHTS_MAX
+ return COLL_WEIGHTS_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_EQUIV_CLASS_MAX:
+#ifdef EQUIV_CLASS_MAX
+ return EQUIV_CLASS_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_2_LOCALEDEF:
+#ifdef _POSIX2_LOCALEDEF
+ return _POSIX2_LOCALEDEF;
+#else
+ return -1;
+#endif
+
+ case _SC_NPROCESSORS_CONF:
+ return __get_nprocs_conf ();
+
+ case _SC_NPROCESSORS_ONLN:
+ return __get_nprocs ();
+
+ case _SC_PHYS_PAGES:
+ return __get_phys_pages ();
+
+ case _SC_AVPHYS_PAGES:
+ return __get_avphys_pages ();
+
+ case _SC_ATEXIT_MAX:
+ /* We have no limit since we use lists. */
+ return INT_MAX;
+
+ case _SC_PASS_MAX:
+ /* We have no limit but since the return value might be used to
+ allocate a buffer we restrict the value. */
+ return BUFSIZ;
+
+ case _SC_CHAR_BIT:
+ return CHAR_BIT;
+
+ case _SC_CHAR_MAX:
+ return CHAR_MAX;
+
+ case _SC_CHAR_MIN:
+ return CHAR_MIN;
+
+ case _SC_INT_MAX:
+ return INT_MAX;
+
+ case _SC_INT_MIN:
+ return INT_MIN;
+
+ case _SC_LONG_BIT:
+ return sizeof (long int) * CHAR_BIT;
+
+ case _SC_WORD_BIT:
+ return sizeof (int) * CHAR_BIT;
+
+ case _SC_MB_LEN_MAX:
+ return MB_LEN_MAX;
+
+ case _SC_NZERO:
+ return NZERO;
+
+ case _SC_SSIZE_MAX:
+ return _POSIX_SSIZE_MAX;
+
+ case _SC_SCHAR_MAX:
+ return SCHAR_MAX;
+
+ case _SC_SCHAR_MIN:
+ return SCHAR_MIN;
+
+ case _SC_SHRT_MAX:
+ return SHRT_MAX;
+
+ case _SC_SHRT_MIN:
+ return SHRT_MIN;
+
+ case _SC_UCHAR_MAX:
+ return UCHAR_MAX;
+
+ case _SC_UINT_MAX:
+ return UINT_MAX;
+
+ case _SC_ULONG_MAX:
+ return ULONG_MAX;
+
+ case _SC_USHRT_MAX:
+ return USHRT_MAX;
+
+ case _SC_GETGR_R_SIZE_MAX:
+ return NSS_BUFLEN_GROUP;
+
+ case _SC_GETPW_R_SIZE_MAX:
+ return NSS_BUFLEN_PASSWD;
+
+ case _SC_ARG_MAX:
+ case _SC_CHILD_MAX:
+ case _SC_CLK_TCK:
+ case _SC_NGROUPS_MAX:
+ case _SC_OPEN_MAX:
+ case _SC_STREAM_MAX:
+ case _SC_JOB_CONTROL:
+ case _SC_SAVED_IDS:
+ case _SC_REALTIME_SIGNALS:
+ case _SC_PRIORITY_SCHEDULING:
+ case _SC_TIMERS:
+ case _SC_ASYNCHRONOUS_IO:
+ case _SC_PRIORITIZED_IO:
+ case _SC_SYNCHRONIZED_IO:
+ case _SC_FSYNC:
+ case _SC_MAPPED_FILES:
+ case _SC_MEMLOCK:
+ case _SC_MEMLOCK_RANGE:
+ case _SC_MEMORY_PROTECTION:
+ case _SC_MESSAGE_PASSING:
+ case _SC_SEMAPHORES:
+ case _SC_SHARED_MEMORY_OBJECTS:
+
+ case _SC_AIO_LISTIO_MAX:
+ case _SC_AIO_MAX:
+ case _SC_AIO_PRIO_DELTA_MAX:
+ case _SC_DELAYTIMER_MAX:
+ case _SC_MQ_OPEN_MAX:
+ case _SC_MQ_PRIO_MAX:
+ case _SC_VERSION:
+ case _SC_PAGESIZE:
+ case _SC_RTSIG_MAX:
+ case _SC_SEM_NSEMS_MAX:
+ case _SC_SEM_VALUE_MAX:
+ case _SC_SIGQUEUE_MAX:
+ case _SC_TIMER_MAX:
+
+ case _SC_PII:
+ case _SC_PII_XTI:
+ case _SC_PII_SOCKET:
+ case _SC_PII_OSI:
+ case _SC_POLL:
+ case _SC_SELECT:
+ case _SC_UIO_MAXIOV:
+ case _SC_PII_INTERNET_STREAM:
+ case _SC_PII_INTERNET_DGRAM:
+ case _SC_PII_OSI_COTS:
+ case _SC_PII_OSI_CLTS:
+ case _SC_PII_OSI_M:
+ case _SC_T_IOV_MAX:
+
+ case _SC_BC_BASE_MAX:
+ case _SC_BC_DIM_MAX:
+ case _SC_BC_SCALE_MAX:
+ case _SC_BC_STRING_MAX:
+ case _SC_EXPR_NEST_MAX:
+ case _SC_LINE_MAX:
+ case _SC_RE_DUP_MAX:
+ case _SC_2_VERSION:
+ case _SC_2_C_BIND:
+ case _SC_2_C_DEV:
+ case _SC_2_FORT_DEV:
+ case _SC_2_SW_DEV:
+ case _SC_2_CHAR_TERM:
+ case _SC_2_C_VERSION:
+ case _SC_2_UPE:
+
+ case _SC_THREADS:
+ case _SC_THREAD_SAFE_FUNCTIONS:
+ case _SC_LOGIN_NAME_MAX:
+ case _SC_TTY_NAME_MAX:
+ case _SC_THREAD_DESTRUCTOR_ITERATIONS:
+ case _SC_THREAD_KEYS_MAX:
+ case _SC_THREAD_STACK_MIN:
+ case _SC_THREAD_THREADS_MAX:
+ case _SC_THREAD_ATTR_STACKADDR:
+ case _SC_THREAD_ATTR_STACKSIZE:
+ case _SC_THREAD_PRIORITY_SCHEDULING:
+ case _SC_THREAD_PRIO_INHERIT:
+ case _SC_THREAD_PRIO_PROTECT:
+ case _SC_THREAD_PROCESS_SHARED:
+
+ case _SC_XOPEN_VERSION:
+ case _SC_XOPEN_XCU_VERSION:
+ case _SC_XOPEN_UNIX:
+ case _SC_XOPEN_CRYPT:
+ case _SC_XOPEN_ENH_I18N:
+ case _SC_XOPEN_SHM:
+ case _SC_XOPEN_XPG2:
+ case _SC_XOPEN_XPG3:
+ case _SC_XOPEN_XPG4:
+
+ case _SC_NL_ARGMAX:
+ case _SC_NL_LANGMAX:
+ case _SC_NL_MSGMAX:
+ case _SC_NL_NMAX:
+ case _SC_NL_SETMAX:
+ case _SC_NL_TEXTMAX:
+
+ case _SC_XBS5_ILP32_OFF32:
+ case _SC_XBS5_ILP32_OFFBIG:
+ case _SC_XBS5_LP64_OFF64:
+ case _SC_XBS5_LPBIG_OFFBIG:
+
+ case _SC_XOPEN_LEGACY:
+ case _SC_XOPEN_REALTIME:
+ case _SC_XOPEN_REALTIME_THREADS:
+
+ break;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__sysconf, sysconf)
+libc_hidden_def (__sysconf)
+
+stub_warning (sysconf)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sysdep-cancel.h b/sysdeps/generic/sysdep-cancel.h
index ba6a1e04ba..f07b784f2e 100644
--- a/sysdeps/generic/sysdep-cancel.h
+++ b/sysdeps/generic/sysdep-cancel.h
@@ -2,7 +2,6 @@
/* No multi-thread handling enabled. */
#define SINGLE_THREAD_P (1)
-#define RTLD_SINGLE_THREAD_P (1)
#define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
#define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
#define LIBC_CANCEL_HANDLED() /* Nothing. */
diff --git a/sysdeps/generic/sysdep.c b/sysdeps/generic/sysdep.c
new file mode 100644
index 0000000000..5442eee00d
--- /dev/null
+++ b/sysdeps/generic/sysdep.c
@@ -0,0 +1,2 @@
+/* This file should contain any system-dependent functions
+ that will be used by many parts of the library. */
diff --git a/sysdeps/generic/sysdep.h b/sysdeps/generic/sysdep.h
index 15d951c777..58c79281ed 100644
--- a/sysdeps/generic/sysdep.h
+++ b/sysdeps/generic/sysdep.h
@@ -60,7 +60,6 @@
# define cfi_register(r1, r2) .cfi_register r1, r2
# define cfi_return_column(reg) .cfi_return_column reg
# define cfi_restore(reg) .cfi_restore reg
-# define cfi_same_value(reg) .cfi_same_value reg
# define cfi_undefined(reg) .cfi_undefined reg
# define cfi_remember_state .cfi_remember_state
# define cfi_restore_state .cfi_restore_state
@@ -77,7 +76,6 @@
# define cfi_register(r1, r2)
# define cfi_return_column(reg)
# define cfi_restore(reg)
-# define cfi_same_value(reg)
# define cfi_undefined(reg)
# define cfi_remember_state
# define cfi_restore_state
diff --git a/sysdeps/generic/system.c b/sysdeps/generic/system.c
new file mode 100644
index 0000000000..cd12128cd8
--- /dev/null
+++ b/sysdeps/generic/system.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdlib.h>
+
+
+/* Execute LINE as a shell command. */
+int
+__libc_system (line)
+ const char *line;
+{
+ if (line == NULL)
+ return 0; /* This indicates no command processor. */
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__libc_system, system)
+
+
+stub_warning (system)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/sysv_signal.c b/sysdeps/generic/sysv_signal.c
new file mode 100644
index 0000000000..86dbb1d093
--- /dev/null
+++ b/sysdeps/generic/sysv_signal.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Set the handler for the signal SIG to HANDLER,
+ returning the old handler, or SIG_ERR on error. */
+__sighandler_t
+__sysv_signal (sig, handler)
+ int sig;
+ __sighandler_t handler;
+{
+ /* Check signal extents to protect __sigismember. */
+ if (handler == SIG_ERR || sig < 1 || sig >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return SIG_ERR;
+ }
+
+ __set_errno (ENOSYS);
+
+ return SIG_ERR;
+}
+weak_alias (__sysv_signal, sysv_signal)
+
+stub_warning (sysv_signal)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/t_sincosl.c b/sysdeps/generic/t_sincosl.c
new file mode 100644
index 0000000000..6b271e6ff1
--- /dev/null
+++ b/sysdeps/generic/t_sincosl.c
@@ -0,0 +1 @@
+/* Empty. Not needed unless ldbl __kernel_* functions use it. */
diff --git a/sysdeps/generic/tcdrain.c b/sysdeps/generic/tcdrain.c
new file mode 100644
index 0000000000..d28ddbf006
--- /dev/null
+++ b/sysdeps/generic/tcdrain.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Wait for pending output to be written on FD. */
+int
+__libc_tcdrain (int fd)
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__libc_tcdrain, tcdrain)
+
+
+stub_warning (tcdrain)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tcflow.c b/sysdeps/generic/tcflow.c
new file mode 100644
index 0000000000..f4db981f28
--- /dev/null
+++ b/sysdeps/generic/tcflow.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Suspend or restart transmission on FD. */
+int
+tcflow (fd, action)
+ int fd;
+ int action;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ switch (action)
+ {
+ case TCOOFF:
+ case TCOON:
+ case TCIOFF:
+ case TCION:
+ break;
+
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (tcflow)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tcflush.c b/sysdeps/generic/tcflush.c
new file mode 100644
index 0000000000..c95f78e4ae
--- /dev/null
+++ b/sysdeps/generic/tcflush.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Flush pending data on FD. */
+int
+tcflush (fd, queue_selector)
+ int fd;
+ int queue_selector;
+{
+ switch (queue_selector)
+ {
+ case TCIFLUSH:
+ case TCOFLUSH:
+ case TCIOFLUSH:
+ break;
+
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning(tcflush);
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tcgetattr.c b/sysdeps/generic/tcgetattr.c
new file mode 100644
index 0000000000..6751e88b83
--- /dev/null
+++ b/sysdeps/generic/tcgetattr.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <termios.h>
+
+/* Put the state of FD into *TERMIOS_P. */
+int
+__tcgetattr (fd, termios_p)
+ int fd;
+ struct termios *termios_p;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (termios_p == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (tcgetattr)
+
+weak_alias (__tcgetattr, tcgetattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tcgetpgrp.c b/sysdeps/generic/tcgetpgrp.c
new file mode 100644
index 0000000000..2a1d846e75
--- /dev/null
+++ b/sysdeps/generic/tcgetpgrp.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Return the foreground process group ID of FD. */
+pid_t
+tcgetpgrp (fd)
+ int fd;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return (pid_t) -1;
+ }
+
+ __set_errno (ENOSYS);
+ return (pid_t) -1;
+}
+libc_hidden_def (tcgetpgrp)
+stub_warning (tcgetpgrp)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tcsendbrk.c b/sysdeps/generic/tcsendbrk.c
new file mode 100644
index 0000000000..4f40cfb153
--- /dev/null
+++ b/sysdeps/generic/tcsendbrk.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Send zero bits on FD. */
+int
+tcsendbreak (fd, duration)
+ int fd;
+ int duration;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (tcsendbreak)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tcsetattr.c b/sysdeps/generic/tcsetattr.c
new file mode 100644
index 0000000000..205838c87b
--- /dev/null
+++ b/sysdeps/generic/tcsetattr.c
@@ -0,0 +1,108 @@
+/* Copyright (C) 1991,95,96,2000,01,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <termios.h>
+
+static int bad_speed (speed_t speed);
+
+/* Set the state of FD to *TERMIOS_P. */
+int
+tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (termios_p == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ switch (optional_actions)
+ {
+ case TCSANOW:
+ case TCSADRAIN:
+ case TCSAFLUSH:
+ break;
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (bad_speed(termios_p->__ospeed) ||
+ bad_speed(termios_p->__ispeed == 0 ?
+ termios_p->__ospeed : termios_p->__ispeed))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (tcsetattr)
+
+/* Strychnine checking. */
+static int
+bad_speed (speed_t speed)
+{
+ switch (speed)
+ {
+ case B0:
+ case B50:
+ case B75:
+ case B110:
+ case B134:
+ case B150:
+ case B200:
+ case B300:
+ case B600:
+ case B1200:
+ case B1800:
+ case B2400:
+ case B4800:
+ case B9600:
+ case B19200:
+ case B38400:
+ case B57600:
+ case B115200:
+ case B230400:
+ case B460800:
+ case B500000:
+ case B576000:
+ case B921600:
+ case B1000000:
+ case B1152000:
+ case B1500000:
+ case B2000000:
+ case B2500000:
+ case B3000000:
+ case B3500000:
+ case B4000000:
+ return 0;
+ default:
+ return 1;
+ }
+}
+
+
+stub_warning (tcsetattr)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tcsetpgrp.c b/sysdeps/generic/tcsetpgrp.c
new file mode 100644
index 0000000000..59f58e59aa
--- /dev/null
+++ b/sysdeps/generic/tcsetpgrp.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the foreground process group ID of FD set PGRP_ID. */
+int
+tcsetpgrp (fd, pgrp_id)
+ int fd;
+ pid_t pgrp_id;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (tcsetpgrp)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/telldir.c b/sysdeps/generic/telldir.c
new file mode 100644
index 0000000000..7b14452327
--- /dev/null
+++ b/sysdeps/generic/telldir.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <stddef.h>
+#include <dirent.h>
+
+/* Return the current position of DIRP. */
+long int
+telldir (dirp)
+ DIR *dirp;
+{
+ if (dirp == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1l;
+ }
+
+ __set_errno (ENOSYS);
+ return -1l;
+}
+
+
+stub_warning (telldir)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tempname.c b/sysdeps/generic/tempname.c
new file mode 100644
index 0000000000..60c94d6409
--- /dev/null
+++ b/sysdeps/generic/tempname.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 1991, 92, 93, 95-98, 99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_size_t
+#include <stddef.h>
+#include <stdio.h>
+#include <errno.h>
+
+/* Perform the "SVID path search malarkey" on DIR and PFX. Write a
+ template suitable for use in __gen_tempname into TMPL, bounded
+ by TMPL_LEN. */
+int
+__path_search (tmpl, tmpl_len, dir, pfx, try_tmpdir)
+ char *tmpl;
+ size_t tmpl_len;
+ const char *dir;
+ const char *pfx;
+ int try_tmpdir;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (__path_search)
+
+/* Generate a (hopefully) unique temporary filename
+ in DIR (if applicable), using template TMPL.
+ KIND determines what to do with that name. It may be one of:
+ __GT_FILE: create a file and return a read-write fd.
+ __GT_BIGFILE: same, but use open64() (or equivalent).
+ __GT_DIR: create a directory.
+ __GT_NOCREATE: just find a name not currently in use.
+ */
+
+int
+__gen_tempname (tmpl, kind)
+ char *tmpl;
+ int kind;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (__gen_tempname)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/time.c b/sysdeps/generic/time.c
new file mode 100644
index 0000000000..ec66f119df
--- /dev/null
+++ b/sysdeps/generic/time.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Return the time now, and store it in *TIMER if not NULL. */
+time_t
+time (timer)
+ time_t *timer;
+{
+ __set_errno (ENOSYS);
+
+ if (timer != NULL)
+ *timer = (time_t) -1;
+ return (time_t) -1;
+}
+libc_hidden_def (time)
+
+stub_warning (time)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_create.c b/sysdeps/generic/timer_create.c
new file mode 100644
index 0000000000..0e3a6b0acc
--- /dev/null
+++ b/sysdeps/generic/timer_create.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Create new per-process timer using CLOCK. */
+int
+timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (timer_create)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_delete.c b/sysdeps/generic/timer_delete.c
new file mode 100644
index 0000000000..4be55aa322
--- /dev/null
+++ b/sysdeps/generic/timer_delete.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Delete timer TIMERID. */
+int
+timer_delete (timer_t timerid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (timer_delete)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_getoverr.c b/sysdeps/generic/timer_getoverr.c
new file mode 100644
index 0000000000..6ca7ff8e9e
--- /dev/null
+++ b/sysdeps/generic/timer_getoverr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Get expiration overrun for timer TIMERID. */
+int
+timer_getoverrun (timer_t timerid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (timer_getoverrun)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_gettime.c b/sysdeps/generic/timer_gettime.c
new file mode 100644
index 0000000000..728028ed3e
--- /dev/null
+++ b/sysdeps/generic/timer_gettime.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Get current value of timer TIMERID and store it in VLAUE. */
+int
+timer_gettime (timer_t timerid, struct itimerspec *value)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (timer_gettime)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_settime.c b/sysdeps/generic/timer_settime.c
new file mode 100644
index 0000000000..f494a0edd1
--- /dev/null
+++ b/sysdeps/generic/timer_settime.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <time.h>
+
+/* Set timer TIMERID to VALUE, returning old value in OVLAUE. */
+int
+timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
+ struct itimerspec *ovalue)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (timer_settime)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/times.c b/sysdeps/generic/times.c
new file mode 100644
index 0000000000..b4e08156ae
--- /dev/null
+++ b/sysdeps/generic/times.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/times.h>
+#include <stddef.h>
+
+/* Store the CPU time used by this process and all its
+ dead children (and their dead children) in BUFFER.
+ Return the elapsed real time, or (clock_t) -1 for errors.
+ All times are in CLK_TCKths of a second. */
+clock_t
+__times (buffer)
+ struct tms *buffer;
+{
+ if (buffer == NULL)
+ {
+ __set_errno (EINVAL);
+ return (clock_t) -1;
+ }
+
+ __set_errno (ENOSYS);
+ return (clock_t) -1;
+}
+stub_warning (times)
+
+weak_alias (__times, times)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/tls-macros.h b/sysdeps/generic/tls-macros.h
deleted file mode 100644
index 0a08f7c145..0000000000
--- a/sysdeps/generic/tls-macros.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Macros to support TLS testing in times of missing compiler support.
- Stub version.
-
- These macros should yield int * expressions for the TLS symbol X
- accessed using the various TLS access models. Macros for some machines
- are defined in elf/tls-macros.h, but ports can instead provide this file.
-
-#define TLS_LE(x)
-#define TLS_IE(x)
-#define TLS_LD(x)
-#define TLS_GD(x)
-*/
diff --git a/sysdeps/generic/tmpfile.c b/sysdeps/generic/tmpfile.c
new file mode 100644
index 0000000000..41f12bc8ba
--- /dev/null
+++ b/sysdeps/generic/tmpfile.c
@@ -0,0 +1,66 @@
+/* Open a stdio stream on an anonymous temporary file. Generic/POSIX version.
+ Copyright (C) 1991,93,1996-2000,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#ifdef USE_IN_LIBIO
+# include <iolibio.h>
+# define __fdopen INTUSE(_IO_fdopen)
+# ifndef tmpfile
+# define tmpfile __new_tmpfile
+# endif
+#endif
+
+#ifndef GEN_THIS
+# define GEN_THIS __GT_FILE
+#endif
+
+/* This returns a new stream opened on a temporary file (generated
+ by tmpnam). The file is opened with mode "w+b" (binary read/write).
+ If we couldn't generate a unique filename or the file couldn't
+ be opened, NULL is returned. */
+FILE *
+tmpfile (void)
+{
+ char buf[FILENAME_MAX];
+ int fd;
+ FILE *f;
+
+ if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
+ return NULL;
+ fd = __gen_tempname (buf, GEN_THIS);
+ if (fd < 0)
+ return NULL;
+
+ /* Note that this relies on the Unix semantics that
+ a file is not really removed until it is closed. */
+ (void) __unlink (buf);
+
+ if ((f = __fdopen (fd, "w+b")) == NULL)
+ __close (fd);
+
+ return f;
+}
+
+#if defined USE_IN_LIBIO && GEN_THIS == __GT_FILE /* Not for tmpfile64. */
+# undef tmpfile
+# include <shlib-compat.h>
+versioned_symbol (libc, __new_tmpfile, tmpfile, GLIBC_2_1);
+#endif
diff --git a/sysdeps/generic/tmpfile64.c b/sysdeps/generic/tmpfile64.c
new file mode 100644
index 0000000000..adce634556
--- /dev/null
+++ b/sysdeps/generic/tmpfile64.c
@@ -0,0 +1,3 @@
+#define GEN_THIS __GT_BIGFILE
+#define tmpfile tmpfile64
+#include "tmpfile.c"
diff --git a/sysdeps/generic/trampoline.c b/sysdeps/generic/trampoline.c
new file mode 100644
index 0000000000..7045a0d0ab
--- /dev/null
+++ b/sysdeps/generic/trampoline.c
@@ -0,0 +1,37 @@
+/* Set thread_state for sighandler, and sigcontext to recover. Stub version.
+ Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <hurd.h>
+#include <mach/thread_status.h>
+
+/* Set up STATE to run a signal handler in the thread it describes.
+ This should save the original state in a `struct sigcontext' on the
+ thread's stack (or possibly a signal stack described by SIGALTSTACK,
+ if the SA_ONSTACK bit is set in FLAGS), and return the address of
+ that structure. */
+
+struct sigcontext *
+_hurd_setup_sighandler (int flags,
+ __sighandler_t handler,
+ struct sigaltstack *sigaltstack,
+ int signo, int sigcode,
+ void *state)
+{
+#error "Need to write sysdeps/mach/hurd/MACHINE/trampoline.c"
+}
diff --git a/sysdeps/generic/truncate.c b/sysdeps/generic/truncate.c
new file mode 100644
index 0000000000..6d0f0c3bcb
--- /dev/null
+++ b/sysdeps/generic/truncate.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <errno.h>
+
+/* Truncate PATH to LENGTH bytes. */
+int
+__truncate (path, length)
+ const char *path;
+ off_t length;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__truncate, truncate)
+
+stub_warning (truncate)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/truncate64.c b/sysdeps/generic/truncate64.c
new file mode 100644
index 0000000000..d7e80dc3ae
--- /dev/null
+++ b/sysdeps/generic/truncate64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate PATH to LENGTH bytes. */
+int
+truncate64 (path, length)
+ const char *path;
+ off64_t length;
+{
+ if ((off_t) length != length)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ return truncate (path, (off_t) length);
+}
diff --git a/sysdeps/generic/tst-audit.h b/sysdeps/generic/tst-audit.h
deleted file mode 100644
index 402e7c0665..0000000000
--- a/sysdeps/generic/tst-audit.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Some machines have these macros defined in elf/tst-auditmod1.c directly.
- New machines can supply a tst-audit.h to define these macros used there.
-
-
-# define pltenter la_CPU_gnu_pltenter
-# define pltexit la_CPU_gnu_pltexit
-# define La_regs La_CPU_regs
-# define La_retval La_CPU_retval
-# define int_retval lrv_RETVALREG
-
-*/
diff --git a/sysdeps/generic/tst-timer.c b/sysdeps/generic/tst-timer.c
new file mode 100644
index 0000000000..d9b69a2467
--- /dev/null
+++ b/sysdeps/generic/tst-timer.c
@@ -0,0 +1,33 @@
+/* Tests for POSIX timer implementation. Dummy version.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+
+/* This file is only used if there is no other implementation and it should
+ means that there is no implementation of POSIX timers. */
+int
+main (void)
+{
+#ifdef _POSIX_TIMERS
+ /* There should be a test. */
+ return 1;
+#else
+ return 0;
+#endif
+}
diff --git a/sysdeps/generic/ttyname.c b/sysdeps/generic/ttyname.c
new file mode 100644
index 0000000000..088ba918a8
--- /dev/null
+++ b/sysdeps/generic/ttyname.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+char *__ttyname = NULL;
+
+/* Return the pathname of the terminal FD is open on, or NULL on errors.
+ The returned storage is good only until the next call to this function. */
+char *
+ttyname (fd)
+ int fd;
+{
+ __set_errno (ENOSYS);
+ return NULL;
+}
+
+
+stub_warning (ttyname)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ttyname_r.c b/sysdeps/generic/ttyname_r.c
new file mode 100644
index 0000000000..14c1209096
--- /dev/null
+++ b/sysdeps/generic/ttyname_r.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+
+/* Store at most BUFLEN characters the pathname of the terminal FD is
+ open on in BUF. Return 0 on success, otherwise an error number. */
+int
+__ttyname_r (fd, buf, buflen)
+ int fd;
+ char *buf;
+ size_t buflen;
+{
+ __set_errno (ENOSYS);
+ return ENOSYS;
+}
+weak_alias (__ttyname_r, ttyname_r)
+
+stub_warning (ttyname_r)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ualarm.c b/sysdeps/generic/ualarm.c
new file mode 100644
index 0000000000..4ca0847576
--- /dev/null
+++ b/sysdeps/generic/ualarm.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds.
+ If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go
+ off every INTERVAL microseconds thereafter.
+
+ Returns the number of microseconds remaining before the alarm. */
+useconds_t
+ualarm (value, interval)
+ useconds_t value;
+ useconds_t interval;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (ualarm)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/udiv_qrnnd.c b/sysdeps/generic/udiv_qrnnd.c
new file mode 100644
index 0000000000..d32796c04d
--- /dev/null
+++ b/sysdeps/generic/udiv_qrnnd.c
@@ -0,0 +1,10 @@
+/* For some machines GNU MP needs to define an auxiliary function:
+
+ udiv_qrnnd (quotient, remainder, high_numerator, low_numerator, denominator)
+
+ Divides a two-word unsigned integer, composed by the integers
+ HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient
+ in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less
+ than DENOMINATOR for correct operation. If, in addition, the most
+ significant bit of DENOMINATOR must be 1, then the pre-processor symbol
+ UDIV_NEEDS_NORMALIZATION is defined to 1. */
diff --git a/sysdeps/generic/ulimit.c b/sysdeps/generic/ulimit.c
new file mode 100644
index 0000000000..cc74054456
--- /dev/null
+++ b/sysdeps/generic/ulimit.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/resource.h>
+
+/* Function depends on CMD:
+ 1 = Return the limit on the size of a file, in units of 512 bytes.
+ 2 = Set the limit on the size of a file to NEWLIMIT. Only the
+ super-user can increase the limit.
+ 3 = Return the maximum possible address of the data segment.
+ 4 = Return the maximum number of files that the calling process
+ can open.
+ Returns -1 on errors. */
+long int
+__ulimit (int cmd, ...)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__ulimit, ulimit)
+
+stub_warning (ulimit)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/umask.c b/sysdeps/generic/umask.c
new file mode 100644
index 0000000000..588d57e1ce
--- /dev/null
+++ b/sysdeps/generic/umask.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/stat.h>
+#include <errno.h>
+#include <sys/types.h>
+
+/* Set the file creation mask to MASK, returning the old mask. */
+mode_t
+__umask (mask)
+ mode_t mask;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (umask)
+
+weak_alias (__umask, umask)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/uname.c b/sysdeps/generic/uname.c
new file mode 100644
index 0000000000..e7c41648ed
--- /dev/null
+++ b/sysdeps/generic/uname.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 1991,92,96,97,2000,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <string.h>
+#include <sys/utsname.h>
+#include <unistd.h>
+
+/* This file is created by the configuration process, and defines UNAME_*. */
+#include <config-name.h>
+
+/* Put information about the system in NAME. */
+int
+__uname (name)
+ struct utsname *name;
+{
+ int save;
+
+ if (name == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ save = errno;
+ if (__gethostname (name->nodename, sizeof (name->nodename)) < 0)
+ {
+ if (errno == ENOSYS)
+ {
+ /* Hostname is meaningless for this machine. */
+ name->nodename[0] = '\0';
+ __set_errno (save);
+ }
+#ifdef ENAMETOOLONG
+ else if (errno == ENAMETOOLONG)
+ /* The name was truncated. */
+ __set_errno (save);
+#endif
+ else
+ return -1;
+ }
+ strncpy (name->sysname, UNAME_SYSNAME, sizeof (name->sysname));
+ strncpy (name->release, UNAME_RELEASE, sizeof (name->release));
+ strncpy (name->version, UNAME_VERSION, sizeof (name->version));
+ strncpy (name->machine, UNAME_MACHINE, sizeof (name->machine));
+
+ return 0;
+}
+weak_alias (__uname, uname)
+libc_hidden_def (__uname)
+libc_hidden_def (uname)
diff --git a/sysdeps/generic/unlink.c b/sysdeps/generic/unlink.c
new file mode 100644
index 0000000000..1ec6d87ae1
--- /dev/null
+++ b/sysdeps/generic/unlink.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+
+
+/* Remove the link named NAME. */
+int
+__unlink (name)
+ const char *name;
+{
+ if (name == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (unlink)
+
+weak_alias (__unlink, unlink)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/unlockpt.c b/sysdeps/generic/unlockpt.c
new file mode 100644
index 0000000000..c5c4890f59
--- /dev/null
+++ b/sysdeps/generic/unlockpt.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <errno.h>
+
+/* Given a fd on a master pseudoterminal, clear a kernel lock so that
+ the slave can be opened. This is to avoid a race between opening the
+ master and calling grantpt() to take possession of the slave. */
+int
+unlockpt (fd)
+ int fd __attribute__ ((unused));
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (unlockpt)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
index d5b8119c9c..eb77b260d8 100644
--- a/sysdeps/generic/unsecvars.h
+++ b/sysdeps/generic/unsecvars.h
@@ -2,23 +2,21 @@
all stuffed in a single string which means they have to be terminated
with a '\0' explicitly. */
#define UNSECURE_ENVVARS \
- "GCONV_PATH\0" \
- "GETCONF_DIR\0" \
- "HOSTALIASES\0" \
- "LD_AUDIT\0" \
- "LD_DEBUG\0" \
- "LD_DEBUG_OUTPUT\0" \
- "LD_DYNAMIC_WEAK\0" \
+ "LD_PRELOAD\0" \
"LD_LIBRARY_PATH\0" \
"LD_ORIGIN_PATH\0" \
- "LD_PRELOAD\0" \
+ "LD_DEBUG\0" \
+ "LD_DEBUG_OUTPUT\0" \
"LD_PROFILE\0" \
- "LD_SHOW_AUXV\0" \
"LD_USE_LOAD_BIAS\0" \
+ "LD_DYNAMIC_WEAK\0" \
+ "LD_SHOW_AUXV\0" \
+ "GCONV_PATH\0" \
+ "GETCONF_DIR\0" \
+ "HOSTALIASES\0" \
"LOCALDOMAIN\0" \
"LOCPATH\0" \
"MALLOC_TRACE\0" \
- "NIS_PATH\0" \
"NLSPATH\0" \
"RESOLV_HOST_CONF\0" \
"RES_OPTIONS\0" \
diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c
index 13945b9719..1f03d17279 100644
--- a/sysdeps/generic/unwind-dw2-fde.c
+++ b/sysdeps/generic/unwind-dw2-fde.c
@@ -1,5 +1,5 @@
/* Subroutines needed for unwinding stack frames for exception handling. */
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>.
@@ -595,7 +595,7 @@ end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
{
fde_compare_t fde_compare;
- if (accu->linear->count != count)
+ if (accu->linear && accu->linear->count != count)
abort ();
if (ob->s.b.mixed_encoding)
diff --git a/sysdeps/generic/unwind-dw2.c b/sysdeps/generic/unwind-dw2.c
index d818e5dfd8..619250e614 100644
--- a/sysdeps/generic/unwind-dw2.c
+++ b/sysdeps/generic/unwind-dw2.c
@@ -1,6 +1,6 @@
/* DWARF2 exception handling and frame unwind runtime interface routines.
- Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005,2006
- Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -25,7 +25,6 @@
#include <error.h>
#include <libintl.h>
#include <dwarf2.h>
-#include <stdio.h>
#include <unwind.h>
#include <unwind-pe.h>
#include <unwind-dw2-fde.h>
@@ -257,7 +256,7 @@ extract_cie_info (struct dwarf_cie *cie, struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
const unsigned char *aug = cie->augmentation;
- const unsigned char *p = aug + strlen ((const char *) aug) + 1;
+ const unsigned char *p = aug + strlen (aug) + 1;
const unsigned char *ret = NULL;
_Unwind_Word utmp;
@@ -838,16 +837,9 @@ execute_cfa_program (const unsigned char *insn_ptr,
case DW_CFA_restore_state:
{
struct frame_state_reg_info *old_rs = fs->regs.prev;
-#ifdef _LIBC
- if (old_rs == NULL)
- __libc_fatal ("invalid DWARF unwind data");
- else
-#endif
- {
- fs->regs = *old_rs;
- old_rs->prev = unused_rs;
- unused_rs = old_rs;
- }
+ fs->regs = *old_rs;
+ old_rs->prev = unused_rs;
+ unused_rs = old_rs;
}
break;
@@ -905,16 +897,12 @@ execute_cfa_program (const unsigned char *insn_ptr,
break;
case DW_CFA_GNU_window_save:
- /* ??? Hardcoded for SPARC register window configuration.
- At least do not do anything for archs which explicitly
- define a lower register number. */
-#if DWARF_FRAME_REGISTERS >= 32
+ /* ??? Hardcoded for SPARC register window configuration. */
for (reg = 16; reg < 32; ++reg)
{
fs->regs.reg[reg].how = REG_SAVED_OFFSET;
fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *);
}
-#endif
break;
case DW_CFA_GNU_args_size:
diff --git a/sysdeps/generic/updwtmp.c b/sysdeps/generic/updwtmp.c
new file mode 100644
index 0000000000..415e1dbd42
--- /dev/null
+++ b/sysdeps/generic/updwtmp.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+
+#include "utmp-private.h"
+
+#ifndef TRANSFORM_UTMP_FILE_NAME
+# define TRANSFORM_UTMP_FILE_NAME(file_name) (file_name)
+#endif
+
+void
+__updwtmp (const char *wtmp_file, const struct utmp *utmp)
+{
+ const char *file_name = TRANSFORM_UTMP_FILE_NAME (wtmp_file);
+
+ (*__libc_utmp_file_functions.updwtmp) (file_name, utmp);
+}
+weak_alias (__updwtmp, updwtmp)
diff --git a/sysdeps/generic/updwtmpx.c b/sysdeps/generic/updwtmpx.c
new file mode 100644
index 0000000000..13a7045286
--- /dev/null
+++ b/sysdeps/generic/updwtmpx.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+void
+updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
+{
+ __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
+}
diff --git a/sysdeps/generic/usleep.c b/sysdeps/generic/usleep.c
new file mode 100644
index 0000000000..8f419f901a
--- /dev/null
+++ b/sysdeps/generic/usleep.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991,1995,1996,1997,1999,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Sleep USECONDS microseconds, or until a previously set timer goes off. */
+int
+usleep (useconds)
+ useconds_t useconds;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (usleep)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/ustat.c b/sysdeps/generic/ustat.c
new file mode 100644
index 0000000000..0aeee620c5
--- /dev/null
+++ b/sysdeps/generic/ustat.c
@@ -0,0 +1,33 @@
+/* Return info on filesystem.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <errno.h>
+#include <sys/ustat.h>
+
+int
+ustat (dev, ust)
+ dev_t dev;
+ struct ustat * ust;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (ustat)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/utime.c b/sysdeps/generic/utime.c
new file mode 100644
index 0000000000..3a3bcc38cc
--- /dev/null
+++ b/sysdeps/generic/utime.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991,95,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <utime.h>
+
+
+/* Set the access and modification times of FILE to those given in TIMES.
+ If TIMES is NULL, set them to the current time. */
+int
+utime (file, times)
+ const char *file;
+ const struct utimbuf *times;
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (utime)
+
+stub_warning (utime)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/utimes.c b/sysdeps/generic/utimes.c
new file mode 100644
index 0000000000..e4a6f0427f
--- /dev/null
+++ b/sysdeps/generic/utimes.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991,95,96,97,2000,02 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time of FILE to TVP[0] and
+ the modification time of FILE to TVP[1]. */
+int
+__utimes (file, tvp)
+ const char *file;
+ const struct timeval tvp[2];
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__utimes, utimes)
+
+stub_warning (utimes)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/utmp_file.c b/sysdeps/generic/utmp_file.c
new file mode 100644
index 0000000000..e7743bfac8
--- /dev/null
+++ b/sysdeps/generic/utmp_file.c
@@ -0,0 +1,499 @@
+/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>
+ and Paul Janzen <pcj@primenet.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmp.h>
+#include <not-cancel.h>
+
+#include "utmp-private.h"
+#include "utmp-equal.h"
+
+
+/* Descriptor for the file and position. */
+static int file_fd = -1;
+static off64_t file_offset;
+
+/* Cache for the last read entry. */
+static struct utmp last_entry;
+
+
+/* Locking timeout. */
+#ifndef TIMEOUT
+# define TIMEOUT 1
+#endif
+
+/* Do-nothing handler for locking timeout. */
+static void timeout_handler (int signum) {};
+
+/* LOCK_FILE(fd, type) failure_statement
+ attempts to get a lock on the utmp file referenced by FD. If it fails,
+ the failure_statement is executed, otherwise it is skipped.
+ LOCKING_FAILED()
+ jumps into the UNLOCK_FILE macro and ensures cleanup of LOCK_FILE.
+ UNLOCK_FILE(fd)
+ unlocks the utmp file referenced by FD and performs the cleanup of
+ LOCK_FILE.
+ */
+#define LOCK_FILE(fd, type) \
+{ \
+ struct flock fl; \
+ struct sigaction action, old_action; \
+ unsigned int old_timeout; \
+ \
+ /* Cancel any existing alarm. */ \
+ old_timeout = alarm (0); \
+ \
+ /* Establish signal handler. */ \
+ action.sa_handler = timeout_handler; \
+ __sigemptyset (&action.sa_mask); \
+ action.sa_flags = 0; \
+ __sigaction (SIGALRM, &action, &old_action); \
+ \
+ alarm (TIMEOUT); \
+ \
+ /* Try to get the lock. */ \
+ memset (&fl, '\0', sizeof (struct flock)); \
+ fl.l_type = (type); \
+ fl.l_whence = SEEK_SET; \
+ if (fcntl_not_cancel ((fd), F_SETLKW, &fl) < 0)
+
+#define LOCKING_FAILED() \
+ goto unalarm_return
+
+#define UNLOCK_FILE(fd) \
+ /* Unlock the file. */ \
+ fl.l_type = F_UNLCK; \
+ fcntl_not_cancel ((fd), F_SETLKW, &fl); \
+ \
+ unalarm_return: \
+ /* Reset the signal handler and alarm. We must reset the alarm \
+ before resetting the handler so our alarm does not generate a \
+ spurious SIGALRM seen by the user. However, we cannot just set \
+ the user's old alarm before restoring the handler, because then \
+ it's possible our handler could catch the user alarm's SIGARLM \
+ and then the user would never see the signal he expected. */ \
+ alarm (0); \
+ __sigaction (SIGALRM, &old_action, NULL); \
+ if (old_timeout != 0) \
+ alarm (old_timeout); \
+} while (0)
+
+
+/* Functions defined here. */
+static int setutent_file (void);
+static int getutent_r_file (struct utmp *buffer, struct utmp **result);
+static int getutid_r_file (const struct utmp *key, struct utmp *buffer,
+ struct utmp **result);
+static int getutline_r_file (const struct utmp *key, struct utmp *buffer,
+ struct utmp **result);
+static struct utmp *pututline_file (const struct utmp *data);
+static void endutent_file (void);
+static int updwtmp_file (const char *file, const struct utmp *utmp);
+
+/* Jump table for file functions. */
+const struct utfuncs __libc_utmp_file_functions =
+{
+ setutent_file,
+ getutent_r_file,
+ getutid_r_file,
+ getutline_r_file,
+ pututline_file,
+ endutent_file,
+ updwtmp_file
+};
+
+
+#ifndef TRANSFORM_UTMP_FILE_NAME
+# define TRANSFORM_UTMP_FILE_NAME(file_name) (file_name)
+#endif
+
+static int
+setutent_file (void)
+{
+ if (file_fd < 0)
+ {
+ const char *file_name;
+ int result;
+
+ file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name);
+
+ file_fd = open_not_cancel_2 (file_name, O_RDWR);
+ if (file_fd == -1)
+ {
+ /* Hhm, read-write access did not work. Try read-only. */
+ file_fd = open_not_cancel_2 (file_name, O_RDONLY);
+ if (file_fd == -1)
+ return 0;
+ }
+
+ /* We have to make sure the file is `closed on exec'. */
+ result = fcntl_not_cancel (file_fd, F_GETFD, 0);
+ if (result >= 0)
+ result = fcntl_not_cancel (file_fd, F_SETFD, result | FD_CLOEXEC);
+ if (result == -1)
+ {
+ close_not_cancel_no_status (file_fd);
+ return 0;
+ }
+ }
+
+ __lseek64 (file_fd, 0, SEEK_SET);
+ file_offset = 0;
+
+ /* Make sure the entry won't match. */
+#if _HAVE_UT_TYPE - 0
+ last_entry.ut_type = -1;
+#else
+ last_entry.ut_line[0] = '\177';
+# if _HAVE_UT_ID - 0
+ last_entry.ut_id[0] = '\0';
+# endif
+#endif
+
+ return 1;
+}
+
+
+static int
+getutent_r_file (struct utmp *buffer, struct utmp **result)
+{
+ ssize_t nbytes;
+
+ assert (file_fd >= 0);
+
+ if (file_offset == -1l)
+ {
+ /* Not available. */
+ *result = NULL;
+ return -1;
+ }
+
+ LOCK_FILE (file_fd, F_RDLCK)
+ {
+ nbytes = 0;
+ LOCKING_FAILED ();
+ }
+
+ /* Read the next entry. */
+ nbytes = read_not_cancel (file_fd, &last_entry, sizeof (struct utmp));
+
+ UNLOCK_FILE (file_fd);
+
+ if (nbytes != sizeof (struct utmp))
+ {
+ if (nbytes != 0)
+ file_offset = -1l;
+ *result = NULL;
+ return -1;
+ }
+
+ /* Update position pointer. */
+ file_offset += sizeof (struct utmp);
+
+ memcpy (buffer, &last_entry, sizeof (struct utmp));
+ *result = buffer;
+
+ return 0;
+}
+
+
+static int
+internal_getut_r (const struct utmp *id, struct utmp *buffer)
+{
+ int result = -1;
+
+ LOCK_FILE (file_fd, F_RDLCK)
+ LOCKING_FAILED ();
+
+#if _HAVE_UT_TYPE - 0
+ if (id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME
+ || id->ut_type == OLD_TIME || id->ut_type == NEW_TIME)
+ {
+ /* Search for next entry with type RUN_LVL, BOOT_TIME,
+ OLD_TIME, or NEW_TIME. */
+
+ while (1)
+ {
+ /* Read the next entry. */
+ if (read_not_cancel (file_fd, buffer, sizeof (struct utmp))
+ != sizeof (struct utmp))
+ {
+ __set_errno (ESRCH);
+ file_offset = -1l;
+ goto unlock_return;
+ }
+ file_offset += sizeof (struct utmp);
+
+ if (id->ut_type == buffer->ut_type)
+ break;
+ }
+ }
+ else
+#endif /* _HAVE_UT_TYPE */
+ {
+ /* Search for the next entry with the specified ID and with type
+ INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS. */
+
+ while (1)
+ {
+ /* Read the next entry. */
+ if (read_not_cancel (file_fd, buffer, sizeof (struct utmp))
+ != sizeof (struct utmp))
+ {
+ __set_errno (ESRCH);
+ file_offset = -1l;
+ goto unlock_return;
+ }
+ file_offset += sizeof (struct utmp);
+
+ if (__utmp_equal (buffer, id))
+ break;
+ }
+ }
+
+ result = 0;
+
+unlock_return:
+ UNLOCK_FILE (file_fd);
+
+ return result;
+}
+
+
+/* For implementing this function we don't use the getutent_r function
+ because we can avoid the reposition on every new entry this way. */
+static int
+getutid_r_file (const struct utmp *id, struct utmp *buffer,
+ struct utmp **result)
+{
+ assert (file_fd >= 0);
+
+ if (file_offset == -1l)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ if (internal_getut_r (id, &last_entry) < 0)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ memcpy (buffer, &last_entry, sizeof (struct utmp));
+ *result = buffer;
+
+ return 0;
+}
+
+
+/* For implementing this function we don't use the getutent_r function
+ because we can avoid the reposition on every new entry this way. */
+static int
+getutline_r_file (const struct utmp *line, struct utmp *buffer,
+ struct utmp **result)
+{
+ assert (file_fd >= 0);
+
+ if (file_offset == -1l)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ LOCK_FILE (file_fd, F_RDLCK)
+ {
+ *result = NULL;
+ LOCKING_FAILED ();
+ }
+
+ while (1)
+ {
+ /* Read the next entry. */
+ if (read_not_cancel (file_fd, &last_entry, sizeof (struct utmp))
+ != sizeof (struct utmp))
+ {
+ __set_errno (ESRCH);
+ file_offset = -1l;
+ *result = NULL;
+ goto unlock_return;
+ }
+ file_offset += sizeof (struct utmp);
+
+ /* Stop if we found a user or login entry. */
+ if (
+#if _HAVE_UT_TYPE - 0
+ (last_entry.ut_type == USER_PROCESS
+ || last_entry.ut_type == LOGIN_PROCESS)
+ &&
+#endif
+ !strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line))
+ break;
+ }
+
+ memcpy (buffer, &last_entry, sizeof (struct utmp));
+ *result = buffer;
+
+unlock_return:
+ UNLOCK_FILE (file_fd);
+
+ return ((*result == NULL) ? -1 : 0);
+}
+
+
+static struct utmp *
+pututline_file (const struct utmp *data)
+{
+ struct utmp buffer;
+ struct utmp *pbuf;
+ int found;
+
+ assert (file_fd >= 0);
+
+ /* Find the correct place to insert the data. */
+ if (file_offset > 0
+ && (
+#if _HAVE_UT_TYPE - 0
+ (last_entry.ut_type == data->ut_type
+ && (last_entry.ut_type == RUN_LVL
+ || last_entry.ut_type == BOOT_TIME
+ || last_entry.ut_type == OLD_TIME
+ || last_entry.ut_type == NEW_TIME))
+ ||
+#endif
+ __utmp_equal (&last_entry, data)))
+ found = 1;
+ else
+ found = internal_getut_r (data, &buffer);
+
+ LOCK_FILE (file_fd, F_WRLCK)
+ {
+ pbuf = NULL;
+ LOCKING_FAILED ();
+ }
+
+ if (found < 0)
+ {
+ /* We append the next entry. */
+ file_offset = __lseek64 (file_fd, 0, SEEK_END);
+ if (file_offset % sizeof (struct utmp) != 0)
+ {
+ file_offset -= file_offset % sizeof (struct utmp);
+ __ftruncate64 (file_fd, file_offset);
+
+ if (__lseek64 (file_fd, 0, SEEK_END) < 0)
+ {
+ pbuf = NULL;
+ goto unlock_return;
+ }
+ }
+ }
+ else
+ {
+ /* We replace the just read entry. */
+ file_offset -= sizeof (struct utmp);
+ __lseek64 (file_fd, file_offset, SEEK_SET);
+ }
+
+ /* Write the new data. */
+ if (write_not_cancel (file_fd, data, sizeof (struct utmp))
+ != sizeof (struct utmp))
+ {
+ /* If we appended a new record this is only partially written.
+ Remove it. */
+ if (found < 0)
+ (void) __ftruncate64 (file_fd, file_offset);
+ pbuf = NULL;
+ }
+ else
+ {
+ file_offset += sizeof (struct utmp);
+ pbuf = (struct utmp *) data;
+ }
+
+ unlock_return:
+ UNLOCK_FILE (file_fd);
+
+ return pbuf;
+}
+
+
+static void
+endutent_file (void)
+{
+ assert (file_fd >= 0);
+
+ close_not_cancel_no_status (file_fd);
+ file_fd = -1;
+}
+
+
+static int
+updwtmp_file (const char *file, const struct utmp *utmp)
+{
+ int result = -1;
+ off64_t offset;
+ int fd;
+
+ /* Open WTMP file. */
+ fd = open_not_cancel_2 (file, O_WRONLY);
+ if (fd < 0)
+ return -1;
+
+ LOCK_FILE (fd, F_WRLCK)
+ LOCKING_FAILED ();
+
+ /* Remember original size of log file. */
+ offset = __lseek64 (fd, 0, SEEK_END);
+ if (offset % sizeof (struct utmp) != 0)
+ {
+ offset -= offset % sizeof (struct utmp);
+ __ftruncate64 (fd, offset);
+
+ if (__lseek64 (fd, 0, SEEK_END) < 0)
+ goto unlock_return;
+ }
+
+ /* Write the entry. If we can't write all the bytes, reset the file
+ size back to the original size. That way, no partial entries
+ will remain. */
+ if (write_not_cancel (fd, utmp, sizeof (struct utmp))
+ != sizeof (struct utmp))
+ {
+ __ftruncate64 (fd, offset);
+ goto unlock_return;
+ }
+
+ result = 0;
+
+unlock_return:
+ UNLOCK_FILE (fd);
+
+ /* Close WTMP file. */
+ close_not_cancel_no_status (fd);
+
+ return result;
+}
diff --git a/sysdeps/generic/utmpxname.c b/sysdeps/generic/utmpxname.c
new file mode 100644
index 0000000000..06ff80b982
--- /dev/null
+++ b/sysdeps/generic/utmpxname.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <utmp.h>
+#include <utmpx.h>
+
+int
+utmpxname (const char *file)
+{
+ return __utmpname (file);
+}
diff --git a/sysdeps/generic/versionsort64.c b/sysdeps/generic/versionsort64.c
new file mode 100644
index 0000000000..e471827023
--- /dev/null
+++ b/sysdeps/generic/versionsort64.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1992, 1997, 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <dirent.h>
+#include <string.h>
+
+int
+versionsort64 (const void *a, const void *b)
+{
+ return __strverscmp ((*(const struct dirent64 **) a)->d_name,
+ (*(const struct dirent64 **) b)->d_name);
+}
diff --git a/sysdeps/generic/vfork.c b/sysdeps/generic/vfork.c
new file mode 100644
index 0000000000..d15841d712
--- /dev/null
+++ b/sysdeps/generic/vfork.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1992, 1995, 1997, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* If we don't have vfork, fork is close enough. */
+
+__pid_t
+__vfork (void)
+{
+ return __fork ();
+}
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/generic/vhangup.c b/sysdeps/generic/vhangup.c
new file mode 100644
index 0000000000..329fddbf24
--- /dev/null
+++ b/sysdeps/generic/vhangup.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Revoke access permissions to all processes currently communicating
+ with the control terminal, and then send a SIGHUP signal to the process
+ group of the control terminal. */
+int
+vhangup ()
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (vhangup)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/vlimit.c b/sysdeps/generic/vlimit.c
new file mode 100644
index 0000000000..03d89f4ad5
--- /dev/null
+++ b/sysdeps/generic/vlimit.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This is generic in the sense that it will work with the BSD, SYSV,
+ or stub versions of getrlimit. Separate versions could be written
+ for efficiency, but it's probably not worth it. */
+
+#include <sys/vlimit.h>
+#include <sys/resource.h>
+#include <errno.h>
+
+/* Set the soft limit for RESOURCE to be VALUE.
+ Returns 0 for success, -1 for failure. */
+int
+vlimit (resource, value)
+ enum __vlimit_resource resource;
+ int value;
+{
+ if (resource >= LIM_CPU && resource <= LIM_MAXRSS)
+ {
+ /* The rlimit codes happen to each be one less
+ than the corresponding vlimit codes. */
+ enum __rlimit_resource rlimit_res =
+ (enum __rlimit_resource) ((int) resource - 1);
+ struct rlimit lims;
+
+ if (__getrlimit (rlimit_res, &lims) < 0)
+ return -1;
+
+ lims.rlim_cur = value;
+ return __setrlimit (rlimit_res, &lims);
+ }
+
+ __set_errno (EINVAL);
+ return -1;
+}
diff --git a/sysdeps/generic/vtimes.c b/sysdeps/generic/vtimes.c
new file mode 100644
index 0000000000..37dc01b2fb
--- /dev/null
+++ b/sysdeps/generic/vtimes.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <sys/vtimes.h>
+#include <sys/resource.h>
+
+/* Return the number of 1/VTIMES_UNITS_PER_SECOND-second
+ units in the `struct timeval' TV. */
+#define TIMEVAL_TO_VTIMES(tv) \
+ ((tv.tv_sec * VTIMES_UNITS_PER_SECOND) + \
+ (tv.tv_usec * VTIMES_UNITS_PER_SECOND / 1000000))
+
+/* If VT is not NULL, write statistics for WHO into *VT.
+ Return 0 for success, -1 for failure. */
+static int
+vtimes_one (struct vtimes *vt, enum __rusage_who who)
+{
+ if (vt != NULL)
+ {
+ struct rusage usage;
+
+ if (__getrusage (who, &usage) < 0)
+ return -1;
+
+ vt->vm_utime = TIMEVAL_TO_VTIMES (usage.ru_utime);
+ vt->vm_stime = TIMEVAL_TO_VTIMES (usage.ru_stime);
+ vt->vm_idsrss = usage.ru_idrss + usage.ru_isrss;
+ vt->vm_majflt = usage.ru_majflt;
+ vt->vm_minflt = usage.ru_minflt;
+ vt->vm_nswap = usage.ru_nswap;
+ vt->vm_inblk = usage.ru_inblock;
+ vt->vm_oublk = usage.ru_oublock;
+ }
+ return 0;
+}
+
+/* If CURRENT is not NULL, write statistics for the current process into
+ *CURRENT. If CHILD is not NULL, write statistics for all terminated child
+ processes into *CHILD. Returns 0 for success, -1 for failure. */
+int
+vtimes (current, child)
+ struct vtimes *current;
+ struct vtimes *child;
+{
+ if (vtimes_one (current, RUSAGE_SELF) < 0
+ || vtimes_one (child, RUSAGE_CHILDREN) < 0)
+ return -1;
+ return 0;
+}
diff --git a/sysdeps/generic/w_acos.c b/sysdeps/generic/w_acos.c
new file mode 100644
index 0000000000..5a1158ea7a
--- /dev/null
+++ b/sysdeps/generic/w_acos.c
@@ -0,0 +1,48 @@
+/* @(#)w_acos.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_acos.c,v 1.6 1995/05/10 20:48:26 jtc Exp $";
+#endif
+
+/*
+ * wrap_acos(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __acos(double x) /* wrapper acos */
+#else
+ double __acos(x) /* wrapper acos */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acos(x);
+#else
+ double z;
+ z = __ieee754_acos(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ if(fabs(x)>1.0) {
+ return __kernel_standard(x,x,1); /* acos(|x|>1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__acos, acos)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__acos, __acosl)
+weak_alias (__acos, acosl)
+#endif
diff --git a/sysdeps/generic/w_acosf.c b/sysdeps/generic/w_acosf.c
new file mode 100644
index 0000000000..28260ddd3e
--- /dev/null
+++ b/sysdeps/generic/w_acosf.c
@@ -0,0 +1,48 @@
+/* w_acosf.c -- float version of w_acos.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_acosf.c,v 1.3 1995/05/10 20:48:29 jtc Exp $";
+#endif
+
+/*
+ * wrap_acosf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __acosf(float x) /* wrapper acosf */
+#else
+ float __acosf(x) /* wrapper acosf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acosf(x);
+#else
+ float z;
+ z = __ieee754_acosf(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ if(fabsf(x)>(float)1.0) {
+ /* acosf(|x|>1) */
+ return (float)__kernel_standard((double)x,(double)x,101);
+ } else
+ return z;
+#endif
+}
+weak_alias (__acosf, acosf)
diff --git a/sysdeps/generic/w_acosh.c b/sysdeps/generic/w_acosh.c
new file mode 100644
index 0000000000..2b5d60f7ea
--- /dev/null
+++ b/sysdeps/generic/w_acosh.c
@@ -0,0 +1,47 @@
+/* @(#)w_acosh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_acosh.c,v 1.6 1995/05/10 20:48:31 jtc Exp $";
+#endif
+
+/*
+ * wrapper acosh(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __acosh(double x) /* wrapper acosh */
+#else
+ double __acosh(x) /* wrapper acosh */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acosh(x);
+#else
+ double z;
+ z = __ieee754_acosh(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ if(x<1.0) {
+ return __kernel_standard(x,x,29); /* acosh(x<1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__acosh, acosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__acosh, __acoshl)
+weak_alias (__acosh, acoshl)
+#endif
diff --git a/sysdeps/generic/w_acoshf.c b/sysdeps/generic/w_acoshf.c
new file mode 100644
index 0000000000..f701983dc2
--- /dev/null
+++ b/sysdeps/generic/w_acoshf.c
@@ -0,0 +1,48 @@
+/* w_acoshf.c -- float version of w_acosh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ *
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_acoshf.c,v 1.3 1995/05/10 20:48:33 jtc Exp $";
+#endif
+
+/*
+ * wrapper acoshf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __acoshf(float x) /* wrapper acoshf */
+#else
+ float __acoshf(x) /* wrapper acoshf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acoshf(x);
+#else
+ float z;
+ z = __ieee754_acoshf(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ if(x<(float)1.0) {
+ /* acosh(x<1) */
+ return (float)__kernel_standard((double)x,(double)x,129);
+ } else
+ return z;
+#endif
+}
+weak_alias (__acoshf, acoshf)
diff --git a/sysdeps/generic/w_acoshl.c b/sysdeps/generic/w_acoshl.c
new file mode 100644
index 0000000000..a37d4c15d9
--- /dev/null
+++ b/sysdeps/generic/w_acoshl.c
@@ -0,0 +1,47 @@
+/* w_acoshl.c -- long double version of w_acosh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper acoshl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __acoshl(long double x) /* wrapper acosh */
+#else
+ long double __acoshl(x) /* wrapper acosh */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acoshl(x);
+#else
+ long double z;
+ z = __ieee754_acoshl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(x<1.0) {
+ return __kernel_standard(x,x,229); /* acoshl(x<1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__acoshl, acoshl)
diff --git a/sysdeps/generic/w_acosl.c b/sysdeps/generic/w_acosl.c
new file mode 100644
index 0000000000..cd9cecf2f9
--- /dev/null
+++ b/sysdeps/generic/w_acosl.c
@@ -0,0 +1,48 @@
+/* w_acosl.c -- long double version of w_acos.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrap_acosl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __acosl(long double x) /* wrapper acos */
+#else
+ long double __acosl(x) /* wrapper acos */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acosl(x);
+#else
+ long double z;
+ z = __ieee754_acosl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(fabsl(x)>1.0) {
+ return __kernel_standard(x,x,201); /* acosl(|x|>1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__acosl, acosl)
diff --git a/sysdeps/generic/w_asin.c b/sysdeps/generic/w_asin.c
new file mode 100644
index 0000000000..a7ca4ef9fd
--- /dev/null
+++ b/sysdeps/generic/w_asin.c
@@ -0,0 +1,49 @@
+/* @(#)w_asin.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_asin.c,v 1.6 1995/05/10 20:48:35 jtc Exp $";
+#endif
+
+/*
+ * wrapper asin(x)
+ */
+
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __asin(double x) /* wrapper asin */
+#else
+ double __asin(x) /* wrapper asin */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_asin(x);
+#else
+ double z;
+ z = __ieee754_asin(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ if(fabs(x)>1.0) {
+ return __kernel_standard(x,x,2); /* asin(|x|>1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__asin, asin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__asin, __asinl)
+weak_alias (__asin, asinl)
+#endif
diff --git a/sysdeps/generic/w_asinf.c b/sysdeps/generic/w_asinf.c
new file mode 100644
index 0000000000..d7f7a253b0
--- /dev/null
+++ b/sysdeps/generic/w_asinf.c
@@ -0,0 +1,49 @@
+/* w_asinf.c -- float version of w_asin.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_asinf.c,v 1.3 1995/05/10 20:48:37 jtc Exp $";
+#endif
+
+/*
+ * wrapper asinf(x)
+ */
+
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __asinf(float x) /* wrapper asinf */
+#else
+ float __asinf(x) /* wrapper asinf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_asinf(x);
+#else
+ float z;
+ z = __ieee754_asinf(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ if(fabsf(x)>(float)1.0) {
+ /* asinf(|x|>1) */
+ return (float)__kernel_standard((double)x,(double)x,102);
+ } else
+ return z;
+#endif
+}
+weak_alias (__asinf, asinf)
diff --git a/sysdeps/generic/w_asinl.c b/sysdeps/generic/w_asinl.c
new file mode 100644
index 0000000000..0ac3038e95
--- /dev/null
+++ b/sysdeps/generic/w_asinl.c
@@ -0,0 +1,49 @@
+/* w_asinl.c -- long double version of w_asin.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper asinl(x)
+ */
+
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __asinl(long double x) /* wrapper asinl */
+#else
+ long double __asinl(x) /* wrapper asinl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_asinl(x);
+#else
+ long double z;
+ z = __ieee754_asinl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(fabsl(x)>1.0) {
+ return __kernel_standard(x,x,202); /* asinl(|x|>1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__asinl, asinl)
diff --git a/sysdeps/generic/w_atan2.c b/sysdeps/generic/w_atan2.c
new file mode 100644
index 0000000000..801baa2347
--- /dev/null
+++ b/sysdeps/generic/w_atan2.c
@@ -0,0 +1,47 @@
+/* @(#)w_atan2.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $";
+#endif
+
+/*
+ * wrapper atan2(y,x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __atan2(double y, double x) /* wrapper atan2 */
+#else
+ double __atan2(y,x) /* wrapper atan2 */
+ double y,x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atan2(y,x);
+#else
+ double z;
+ z = __ieee754_atan2(y,x);
+ if(_LIB_VERSION != _SVID_||__isnan(x)||__isnan(y)) return z;
+ if(x==0.0&&y==0.0)
+ return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
+ return z;
+#endif
+}
+weak_alias (__atan2, atan2)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__atan2, __atan2l)
+weak_alias (__atan2, atan2l)
+#endif
diff --git a/sysdeps/generic/w_atan2f.c b/sysdeps/generic/w_atan2f.c
new file mode 100644
index 0000000000..09caa06f00
--- /dev/null
+++ b/sysdeps/generic/w_atan2f.c
@@ -0,0 +1,46 @@
+/* w_atan2f.c -- float version of w_atan2.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $";
+#endif
+
+/*
+ * wrapper atan2f(y,x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __atan2f(float y, float x) /* wrapper atan2f */
+#else
+ float __atan2f(y,x) /* wrapper atan2 */
+ float y,x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atan2f(y,x);
+#else
+ float z;
+ z = __ieee754_atan2f(y,x);
+ if(_LIB_VERSION != _SVID_||__isnanf(x)||__isnanf(y)) return z;
+ if(x==0.0&&y==0.0)
+ return __kernel_standard(y,x,103); /* atan2(+-0,+-0) */
+ return z;
+#endif
+}
+weak_alias (__atan2f, atan2f)
diff --git a/sysdeps/generic/w_atan2l.c b/sysdeps/generic/w_atan2l.c
new file mode 100644
index 0000000000..2897c8c5f9
--- /dev/null
+++ b/sysdeps/generic/w_atan2l.c
@@ -0,0 +1,47 @@
+/* w_atan2l.c -- long double version of w_atan2.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper atan2l(y,x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __atan2l(long double y, long double x) /* wrapper atan2l */
+#else
+ long double __atan2l(y,x) /* wrapper atan2l */
+ long double y,x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atan2l(y,x);
+#else
+ long double z;
+ z = __ieee754_atan2l(y,x);
+ if(_LIB_VERSION != _SVID_||__isnanl(x)||__isnanl(y)) return z;
+ if(x==0.0&&y==0.0)
+ return __kernel_standard(y,x,203); /* atan2(+-0,+-0) */
+ return z;
+#endif
+}
+weak_alias (__atan2l, atan2l)
diff --git a/sysdeps/generic/w_atanh.c b/sysdeps/generic/w_atanh.c
new file mode 100644
index 0000000000..e7995b1830
--- /dev/null
+++ b/sysdeps/generic/w_atanh.c
@@ -0,0 +1,52 @@
+/* @(#)w_atanh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_atanh.c,v 1.6 1995/05/10 20:48:43 jtc Exp $";
+#endif
+
+/*
+ * wrapper atanh(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __atanh(double x) /* wrapper atanh */
+#else
+ double __atanh(x) /* wrapper atanh */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atanh(x);
+#else
+ double z,y;
+ z = __ieee754_atanh(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ y = fabs(x);
+ if(y>=1.0) {
+ if(y>1.0)
+ return __kernel_standard(x,x,30); /* atanh(|x|>1) */
+ else
+ return __kernel_standard(x,x,31); /* atanh(|x|==1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__atanh, atanh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__atanh, __atanhl)
+weak_alias (__atanh, atanhl)
+#endif
diff --git a/sysdeps/generic/w_atanhf.c b/sysdeps/generic/w_atanhf.c
new file mode 100644
index 0000000000..0b24f2c71a
--- /dev/null
+++ b/sysdeps/generic/w_atanhf.c
@@ -0,0 +1,53 @@
+/* w_atanhf.c -- float version of w_atanh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_atanhf.c,v 1.3 1995/05/10 20:48:45 jtc Exp $";
+#endif
+
+/*
+ * wrapper atanhf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __atanhf(float x) /* wrapper atanhf */
+#else
+ float __atanhf(x) /* wrapper atanhf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atanhf(x);
+#else
+ float z,y;
+ z = __ieee754_atanhf(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ y = fabsf(x);
+ if(y>=(float)1.0) {
+ if(y>(float)1.0)
+ /* atanhf(|x|>1) */
+ return (float)__kernel_standard((double)x,(double)x,130);
+ else
+ /* atanhf(|x|==1) */
+ return (float)__kernel_standard((double)x,(double)x,131);
+ } else
+ return z;
+#endif
+}
+weak_alias (__atanhf, atanhf)
diff --git a/sysdeps/generic/w_atanhl.c b/sysdeps/generic/w_atanhl.c
new file mode 100644
index 0000000000..d675fc6fe7
--- /dev/null
+++ b/sysdeps/generic/w_atanhl.c
@@ -0,0 +1,52 @@
+/* w_atanhl.c -- long double version of w_atanh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper atanhl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __atanhl(long double x) /* wrapper atanhl */
+#else
+ long double __atanhl(x) /* wrapper atanhl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atanhl(x);
+#else
+ long double z,y;
+ z = __ieee754_atanhl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ y = fabsl(x);
+ if(y>=1.0) {
+ if(y>1.0)
+ return __kernel_standard(x,x,230); /* atanhl(|x|>1) */
+ else
+ return __kernel_standard(x,x,231); /* atanhl(|x|==1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__atanhl, atanhl)
diff --git a/sysdeps/generic/w_cosh.c b/sysdeps/generic/w_cosh.c
new file mode 100644
index 0000000000..709f485c6d
--- /dev/null
+++ b/sysdeps/generic/w_cosh.c
@@ -0,0 +1,47 @@
+/* @(#)w_cosh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
+#endif
+
+/*
+ * wrapper cosh(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __cosh(double x) /* wrapper cosh */
+#else
+ double __cosh(x) /* wrapper cosh */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_cosh(x);
+#else
+ double z;
+ z = __ieee754_cosh(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ if(!__finite(z) && __finite(x)) {
+ return __kernel_standard(x,x,5); /* cosh overflow */
+ } else
+ return z;
+#endif
+}
+weak_alias (__cosh, cosh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__cosh, __coshl)
+weak_alias (__cosh, coshl)
+#endif
diff --git a/sysdeps/generic/w_coshf.c b/sysdeps/generic/w_coshf.c
new file mode 100644
index 0000000000..c38fd1d93f
--- /dev/null
+++ b/sysdeps/generic/w_coshf.c
@@ -0,0 +1,47 @@
+/* w_coshf.c -- float version of w_cosh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_coshf.c,v 1.3 1995/05/10 20:48:49 jtc Exp $";
+#endif
+
+/*
+ * wrapper coshf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __coshf(float x) /* wrapper coshf */
+#else
+ float __coshf(x) /* wrapper coshf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_coshf(x);
+#else
+ float z;
+ z = __ieee754_coshf(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ if(!__finite(z) && __finite(x)) {
+ /* cosh overflow */
+ return (float)__kernel_standard((double)x,(double)x,105);
+ } else
+ return z;
+#endif
+}
+weak_alias (__coshf, coshf)
diff --git a/sysdeps/generic/w_coshl.c b/sysdeps/generic/w_coshl.c
new file mode 100644
index 0000000000..cc1929a9ec
--- /dev/null
+++ b/sysdeps/generic/w_coshl.c
@@ -0,0 +1,47 @@
+/* w_acoshl.c -- long double version of w_acosh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper coshl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __coshl(long double x) /* wrapper coshl */
+#else
+ long double __coshl(x) /* wrapper coshl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_coshl(x);
+#else
+ long double z;
+ z = __ieee754_coshl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(!__finite(z) && __finite(x)) {
+ return __kernel_standard(x,x,205); /* cosh overflow */
+ } else
+ return z;
+#endif
+}
+weak_alias (__coshl, coshl)
diff --git a/sysdeps/generic/w_drem.c b/sysdeps/generic/w_drem.c
new file mode 100644
index 0000000000..9e2b1e7472
--- /dev/null
+++ b/sysdeps/generic/w_drem.c
@@ -0,0 +1,20 @@
+/*
+ * drem() wrapper for remainder().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Placed into the Public Domain, 1994.
+ */
+
+#include <math.h>
+
+double
+__drem(x, y)
+ double x, y;
+{
+ return __remainder(x, y);
+}
+weak_alias (__drem, drem)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__drem, __dreml)
+weak_alias (__drem, dreml)
+#endif
diff --git a/sysdeps/generic/w_dremf.c b/sysdeps/generic/w_dremf.c
new file mode 100644
index 0000000000..b740ea304c
--- /dev/null
+++ b/sysdeps/generic/w_dremf.c
@@ -0,0 +1,17 @@
+/*
+ * dremf() wrapper for remainderf().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Placed into the Public Domain, 1994.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+float
+__dremf(x, y)
+ float x, y;
+{
+ return __remainderf(x, y);
+}
+weak_alias (__dremf, dremf)
diff --git a/sysdeps/generic/w_dreml.c b/sysdeps/generic/w_dreml.c
new file mode 100644
index 0000000000..aa73eedc49
--- /dev/null
+++ b/sysdeps/generic/w_dreml.c
@@ -0,0 +1,18 @@
+/*
+ * dreml() wrapper for remainderl().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ * Placed into the Public Domain, 1994.
+ */
+
+#include <math.h>
+
+long double
+__dreml(x, y)
+ long double x, y;
+{
+ return __remainderl(x, y);
+}
+weak_alias (__dreml, dreml)
diff --git a/sysdeps/generic/w_exp10.c b/sysdeps/generic/w_exp10.c
new file mode 100644
index 0000000000..597506f22f
--- /dev/null
+++ b/sysdeps/generic/w_exp10.c
@@ -0,0 +1,51 @@
+/* @(#)w_exp10.c
+ * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper exp10(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __exp10(double x) /* wrapper exp10 */
+#else
+ double __exp10(x) /* wrapper exp10 */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp10(x);
+#else
+ double z;
+ z = __ieee754_exp10(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!__finite(z) && __finite(x)) {
+ /* exp10 overflow (46) if x > 0, underflow (47) if x < 0. */
+ return __kernel_standard(x,x,46+!!__signbit(x));
+ }
+ return z;
+#endif
+}
+weak_alias (__exp10, exp10)
+strong_alias (__exp10, __pow10)
+weak_alias (__pow10, pow10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__exp10, __exp10l)
+weak_alias (__exp10, exp10l)
+strong_alias (__exp10l, __pow10l)
+weak_alias (__pow10l, pow10l)
+#endif
diff --git a/sysdeps/generic/w_exp10f.c b/sysdeps/generic/w_exp10f.c
new file mode 100644
index 0000000000..1c510a3bfa
--- /dev/null
+++ b/sysdeps/generic/w_exp10f.c
@@ -0,0 +1,46 @@
+/* w_exp10f.c -- float version of w_exp10.c.
+ * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper expf10(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __exp10f(float x) /* wrapper exp10f */
+#else
+ float __exp10f(x) /* wrapper exp10f */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp10f(x);
+#else
+ float z;
+ z = __ieee754_exp10f(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!__finitef(z) && __finitef(x)) {
+ /* exp10f overflow (146) if x > 0, underflow (147) if x < 0. */
+ return (float)__kernel_standard((double) x, (double) x,
+ 146+!!__signbitf(x));
+ }
+ return z;
+#endif
+}
+weak_alias (__exp10f, exp10f)
+strong_alias (__exp10f, __pow10f)
+weak_alias (__pow10f, pow10f)
diff --git a/sysdeps/generic/w_exp10l.c b/sysdeps/generic/w_exp10l.c
new file mode 100644
index 0000000000..aebddcb201
--- /dev/null
+++ b/sysdeps/generic/w_exp10l.c
@@ -0,0 +1,46 @@
+/* w_exp10l.c -- long double version of w_exp10.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper exp10l(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __exp10l(long double x) /* wrapper exp10 */
+#else
+ long double __exp10l(x) /* wrapper exp10 */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp10l(x);
+#else
+ long double z;
+ z = __ieee754_exp10l(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!__finitel(z) && __finitel(x)) {
+ /* exp10 overflow (246) if x > 0, underflow (247) if x < 0. */
+ return __kernel_standard(x,x,246+__signbitl(x));
+ }
+ return z;
+#endif
+}
+weak_alias (__exp10l, exp10l)
+strong_alias (__exp10l, __pow10l)
+weak_alias (__pow10l, pow10l)
diff --git a/sysdeps/generic/w_exp2.c b/sysdeps/generic/w_exp2.c
new file mode 100644
index 0000000000..4e667d770e
--- /dev/null
+++ b/sysdeps/generic/w_exp2.c
@@ -0,0 +1,36 @@
+/*
+ * wrapper exp2(x)
+ */
+
+#include <float.h>
+#include "math.h"
+#include "math_private.h"
+
+static const double o_threshold= (double) DBL_MAX_EXP;
+static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
+
+double
+__exp2 (double x) /* wrapper exp2 */
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp2 (x);
+#else
+ double z;
+ z = __ieee754_exp2 (x);
+ if (_LIB_VERSION != _IEEE_ && __finite (x))
+ {
+ if (x > o_threshold)
+ /* exp2 overflow */
+ return __kernel_standard (x, x, 44);
+ else if (x <= u_threshold)
+ /* exp2 underflow */
+ return __kernel_standard (x, x, 45);
+ }
+ return z;
+#endif
+}
+weak_alias (__exp2, exp2)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__exp2, __expl2)
+weak_alias (__exp2, expl2)
+#endif
diff --git a/sysdeps/generic/w_exp2f.c b/sysdeps/generic/w_exp2f.c
new file mode 100644
index 0000000000..13cfc9a19f
--- /dev/null
+++ b/sysdeps/generic/w_exp2f.c
@@ -0,0 +1,32 @@
+/*
+ * wrapper exp2f(x)
+ */
+
+#include <float.h>
+#include "math.h"
+#include "math_private.h"
+
+static const float o_threshold= (float) FLT_MAX_EXP;
+static const float u_threshold= (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
+
+float
+__exp2f (float x) /* wrapper exp2f */
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp2f (x);
+#else
+ float z;
+ z = __ieee754_exp2f (x);
+ if (_LIB_VERSION != _IEEE_ && __finitef (x))
+ {
+ if (x > o_threshold)
+ /* exp2 overflow */
+ return (float) __kernel_standard ((double) x, (double) x, 144);
+ else if (x <= u_threshold)
+ /* exp2 underflow */
+ return (float) __kernel_standard ((double) x, (double) x, 145);
+ }
+ return z;
+#endif
+}
+weak_alias (__exp2f, exp2f)
diff --git a/sysdeps/generic/w_exp2l.c b/sysdeps/generic/w_exp2l.c
new file mode 100644
index 0000000000..f492301223
--- /dev/null
+++ b/sysdeps/generic/w_exp2l.c
@@ -0,0 +1,31 @@
+/*
+ * wrapper exp2l(x)
+ */
+
+#include <float.h>
+#include "math.h"
+#include "math_private.h"
+
+static const long double o_threshold = (long double) LDBL_MAX_EXP;
+static const long double u_threshold
+ = (long double) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1);
+
+long double
+__exp2l (long double x) /* wrapper exp2l */
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp2l (x);
+#else
+ long double z;
+ z = __ieee754_exp2l (x);
+ if (_LIB_VERSION != _IEEE_ && __finitel (x))
+ {
+ if (x > o_threshold)
+ return __kernel_standard (x, x, 244); /* exp2l overflow */
+ else if (x <= u_threshold)
+ return __kernel_standard (x, x, 245); /* exp2l underflow */
+ }
+ return z;
+#endif
+}
+weak_alias (__exp2l, exp2l)
diff --git a/sysdeps/generic/w_expl.c b/sysdeps/generic/w_expl.c
new file mode 100644
index 0000000000..70096a820c
--- /dev/null
+++ b/sysdeps/generic/w_expl.c
@@ -0,0 +1,13 @@
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+
+long double
+__expl(long double x)
+{
+ fputs ("__expl not implemented\n", stderr);
+ __set_errno (ENOSYS);
+ return 0.0;
+}
+
+weak_alias (__expl, expl)
diff --git a/sysdeps/generic/w_fmod.c b/sysdeps/generic/w_fmod.c
new file mode 100644
index 0000000000..0ceeb98c55
--- /dev/null
+++ b/sysdeps/generic/w_fmod.c
@@ -0,0 +1,48 @@
+/* @(#)w_fmod.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
+#endif
+
+/*
+ * wrapper fmod(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __fmod(double x, double y) /* wrapper fmod */
+#else
+ double __fmod(x,y) /* wrapper fmod */
+ double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_fmod(x,y);
+#else
+ double z;
+ z = __ieee754_fmod(x,y);
+ if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
+ if(y==0.0) {
+ return __kernel_standard(x,y,27); /* fmod(x,0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__fmod, fmod)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmod, __fmodl)
+weak_alias (__fmod, fmodl)
+#endif
diff --git a/sysdeps/generic/w_fmodf.c b/sysdeps/generic/w_fmodf.c
new file mode 100644
index 0000000000..9afe5ddfdd
--- /dev/null
+++ b/sysdeps/generic/w_fmodf.c
@@ -0,0 +1,48 @@
+/* w_fmodf.c -- float version of w_fmod.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
+#endif
+
+/*
+ * wrapper fmodf(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __fmodf(float x, float y) /* wrapper fmodf */
+#else
+ float __fmodf(x,y) /* wrapper fmodf */
+ float x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_fmodf(x,y);
+#else
+ float z;
+ z = __ieee754_fmodf(x,y);
+ if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
+ if(y==(float)0.0) {
+ /* fmodf(x,0) */
+ return (float)__kernel_standard((double)x,(double)y,127);
+ } else
+ return z;
+#endif
+}
+weak_alias (__fmodf, fmodf)
diff --git a/sysdeps/generic/w_fmodl.c b/sysdeps/generic/w_fmodl.c
new file mode 100644
index 0000000000..71ed4a94a4
--- /dev/null
+++ b/sysdeps/generic/w_fmodl.c
@@ -0,0 +1,48 @@
+/* w_fmodl.c -- long double version of w_fmod.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper fmodl(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __fmodl(long double x, long double y)/* wrapper fmodl */
+#else
+ long double __fmodl(x,y) /* wrapper fmodl */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_fmodl(x,y);
+#else
+ long double z;
+ z = __ieee754_fmodl(x,y);
+ if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
+ if(y==0.0) {
+ return __kernel_standard(x,y,227); /* fmod(x,0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__fmodl, fmodl)
diff --git a/sysdeps/generic/w_hypot.c b/sysdeps/generic/w_hypot.c
new file mode 100644
index 0000000000..e91db17083
--- /dev/null
+++ b/sysdeps/generic/w_hypot.c
@@ -0,0 +1,48 @@
+/* @(#)w_hypot.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
+#endif
+
+/*
+ * wrapper hypot(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __hypot(double x, double y)/* wrapper hypot */
+#else
+ double __hypot(x,y) /* wrapper hypot */
+ double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_hypot(x,y);
+#else
+ double z;
+ z = __ieee754_hypot(x,y);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if((!__finite(z))&&__finite(x)&&__finite(y))
+ return __kernel_standard(x,y,4); /* hypot overflow */
+ else
+ return z;
+#endif
+}
+weak_alias (__hypot, hypot)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__hypot, __hypotl)
+weak_alias (__hypot, hypotl)
+#endif
diff --git a/sysdeps/generic/w_hypotf.c b/sysdeps/generic/w_hypotf.c
new file mode 100644
index 0000000000..a7e5c1fdb6
--- /dev/null
+++ b/sysdeps/generic/w_hypotf.c
@@ -0,0 +1,48 @@
+/* w_hypotf.c -- float version of w_hypot.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $";
+#endif
+
+/*
+ * wrapper hypotf(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __hypotf(float x, float y) /* wrapper hypotf */
+#else
+ float __hypotf(x,y) /* wrapper hypotf */
+ float x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_hypotf(x,y);
+#else
+ float z;
+ z = __ieee754_hypotf(x,y);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if((!__finitef(z))&&__finitef(x)&&__finitef(y))
+ /* hypot overflow */
+ return (float)__kernel_standard((double)x,(double)y,104);
+ else
+ return z;
+#endif
+}
+weak_alias (__hypotf, hypotf)
diff --git a/sysdeps/generic/w_hypotl.c b/sysdeps/generic/w_hypotl.c
new file mode 100644
index 0000000000..2ec215fd13
--- /dev/null
+++ b/sysdeps/generic/w_hypotl.c
@@ -0,0 +1,48 @@
+/* w_hypotl.c -- long double version of w_hypot.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper hypotl(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __hypotl(long double x, long double y)/* wrapper hypotl */
+#else
+ long double __hypotl(x,y) /* wrapper hypotl */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_hypotl(x,y);
+#else
+ long double z;
+ z = __ieee754_hypotl(x,y);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if((!__finitel(z))&&__finitel(x)&&__finitel(y))
+ return __kernel_standard(x,y,204); /* hypot overflow */
+ else
+ return z;
+#endif
+}
+weak_alias (__hypotl, hypotl)
diff --git a/sysdeps/generic/w_j0.c b/sysdeps/generic/w_j0.c
new file mode 100644
index 0000000000..5a018760bb
--- /dev/null
+++ b/sysdeps/generic/w_j0.c
@@ -0,0 +1,76 @@
+/* @(#)w_j0.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $";
+#endif
+
+/*
+ * wrapper j0(double x), y0(double x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double j0(double x) /* wrapper j0 */
+#else
+ double j0(x) /* wrapper j0 */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j0(x);
+#else
+ double z = __ieee754_j0(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ if(fabs(x)>X_TLOSS) {
+ return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (j0, j0l)
+#endif
+
+
+#ifdef __STDC__
+ double y0(double x) /* wrapper y0 */
+#else
+ double y0(x) /* wrapper y0 */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y0(x);
+#else
+ double z;
+ z = __ieee754_y0(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard(x,x,8);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard(x,x,9);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (y0, y0l)
+#endif
diff --git a/sysdeps/generic/w_j0f.c b/sysdeps/generic/w_j0f.c
new file mode 100644
index 0000000000..32e2eebb56
--- /dev/null
+++ b/sysdeps/generic/w_j0f.c
@@ -0,0 +1,74 @@
+/* w_j0f.c -- float version of w_j0.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_j0f.c,v 1.3 1995/05/10 20:49:13 jtc Exp $";
+#endif
+
+/*
+ * wrapper j0f(float x), y0f(float x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float j0f(float x) /* wrapper j0f */
+#else
+ float j0f(x) /* wrapper j0f */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j0f(x);
+#else
+ float z = __ieee754_j0f(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ if(fabsf(x)>(float)X_TLOSS) {
+ /* j0f(|x|>X_TLOSS) */
+ return (float)__kernel_standard((double)x,(double)x,134);
+ } else
+ return z;
+#endif
+}
+
+#ifdef __STDC__
+ float y0f(float x) /* wrapper y0f */
+#else
+ float y0f(x) /* wrapper y0f */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y0f(x);
+#else
+ float z;
+ z = __ieee754_y0f(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
+ if(x <= (float)0.0){
+ if(x==(float)0.0)
+ /* d= -one/(x-x); */
+ return (float)__kernel_standard((double)x,(double)x,108);
+ else
+ /* d = zero/(x-x); */
+ return (float)__kernel_standard((double)x,(double)x,109);
+ }
+ if(x>(float)X_TLOSS) {
+ /* y0(x>X_TLOSS) */
+ return (float)__kernel_standard((double)x,(double)x,135);
+ } else
+ return z;
+#endif
+}
diff --git a/sysdeps/generic/w_j0l.c b/sysdeps/generic/w_j0l.c
new file mode 100644
index 0000000000..b74d9ddcff
--- /dev/null
+++ b/sysdeps/generic/w_j0l.c
@@ -0,0 +1,73 @@
+/* w_j0l.c -- long double version of w_j0.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper j0l(long double x), y0l(long double x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double j0l(long double x) /* wrapper j0l */
+#else
+ long double j0l(x) /* wrapper j0 */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j0l(x);
+#else
+ long double z = __ieee754_j0l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(fabsl(x)>X_TLOSS) {
+ return __kernel_standard(x,x,234); /* j0(|x|>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+
+#ifdef __STDC__
+ long double y0l(long double x) /* wrapper y0l */
+#else
+ long double y0l(x) /* wrapper y0 */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y0l(x);
+#else
+ long double z;
+ z = __ieee754_y0l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard(x,x,208);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard(x,x,209);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard(x,x,235); /* y0(x>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
diff --git a/sysdeps/generic/w_j1.c b/sysdeps/generic/w_j1.c
new file mode 100644
index 0000000000..39fe8543b1
--- /dev/null
+++ b/sysdeps/generic/w_j1.c
@@ -0,0 +1,77 @@
+/* @(#)w_j1.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $";
+#endif
+
+/*
+ * wrapper of j1,y1
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double j1(double x) /* wrapper j1 */
+#else
+ double j1(x) /* wrapper j1 */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j1(x);
+#else
+ double z;
+ z = __ieee754_j1(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
+ if(fabs(x)>X_TLOSS) {
+ return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (j1, j1l)
+#endif
+
+
+#ifdef __STDC__
+ double y1(double x) /* wrapper y1 */
+#else
+ double y1(x) /* wrapper y1 */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y1(x);
+#else
+ double z;
+ z = __ieee754_y1(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard(x,x,10);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard(x,x,11);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (y1, y1l)
+#endif
diff --git a/sysdeps/generic/w_j1f.c b/sysdeps/generic/w_j1f.c
new file mode 100644
index 0000000000..2a7c8db819
--- /dev/null
+++ b/sysdeps/generic/w_j1f.c
@@ -0,0 +1,75 @@
+/* w_j1f.c -- float version of w_j1.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_j1f.c,v 1.3 1995/05/10 20:49:17 jtc Exp $";
+#endif
+
+/*
+ * wrapper of j1f,y1f
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float j1f(float x) /* wrapper j1f */
+#else
+ float j1f(x) /* wrapper j1f */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j1f(x);
+#else
+ float z;
+ z = __ieee754_j1f(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
+ if(fabsf(x)>(float)X_TLOSS) {
+ /* j1(|x|>X_TLOSS) */
+ return (float)__kernel_standard((double)x,(double)x,136);
+ } else
+ return z;
+#endif
+}
+
+#ifdef __STDC__
+ float y1f(float x) /* wrapper y1f */
+#else
+ float y1f(x) /* wrapper y1f */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y1f(x);
+#else
+ float z;
+ z = __ieee754_y1f(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
+ if(x <= (float)0.0){
+ if(x==(float)0.0)
+ /* d= -one/(x-x); */
+ return (float)__kernel_standard((double)x,(double)x,110);
+ else
+ /* d = zero/(x-x); */
+ return (float)__kernel_standard((double)x,(double)x,111);
+ }
+ if(x>(float)X_TLOSS) {
+ /* y1(x>X_TLOSS) */
+ return (float)__kernel_standard((double)x,(double)x,137);
+ } else
+ return z;
+#endif
+}
diff --git a/sysdeps/generic/w_j1l.c b/sysdeps/generic/w_j1l.c
new file mode 100644
index 0000000000..49a486cf8e
--- /dev/null
+++ b/sysdeps/generic/w_j1l.c
@@ -0,0 +1,74 @@
+/* w_j1l.c -- long double version of w_j1.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper of j1l,y1l
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double j1l(long double x) /* wrapper j1l */
+#else
+ long double j1l(x) /* wrapper j1l */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j1l(x);
+#else
+ long double z;
+ z = __ieee754_j1l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(fabsl(x)>X_TLOSS) {
+ return __kernel_standard(x,x,236); /* j1(|x|>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+
+#ifdef __STDC__
+ long double y1l(long double x) /* wrapper y1l */
+#else
+ long double y1l(x) /* wrapper y1l */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y1l(x);
+#else
+ long double z;
+ z = __ieee754_y1l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard(x,x,210);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard(x,x,211);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard(x,x,237); /* y1(x>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
diff --git a/sysdeps/generic/w_jn.c b/sysdeps/generic/w_jn.c
new file mode 100644
index 0000000000..85fc383fb7
--- /dev/null
+++ b/sysdeps/generic/w_jn.c
@@ -0,0 +1,99 @@
+/* @(#)w_jn.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $";
+#endif
+
+/*
+ * wrapper jn(int n, double x), yn(int n, double x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ * For n=0, j0(x) is called,
+ * for n=1, j1(x) is called,
+ * for n<x, forward recursion us used starting
+ * from values of j0(x) and j1(x).
+ * for n>x, a continued fraction approximation to
+ * j(n,x)/j(n-1,x) is evaluated and then backward
+ * recursion is used starting from a supposed value
+ * for j(n,x). The resulting value of j(0,x) is
+ * compared with the actual value to correct the
+ * supposed value of j(n,x).
+ *
+ * yn(n,x) is similar in all respects, except
+ * that forward recursion is used for all
+ * values of n>1.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double jn(int n, double x) /* wrapper jn */
+#else
+ double jn(n,x) /* wrapper jn */
+ double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_jn(n,x);
+#else
+ double z;
+ z = __ieee754_jn(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
+ if(fabs(x)>X_TLOSS) {
+ return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (jn, jnl)
+#endif
+
+
+#ifdef __STDC__
+ double yn(int n, double x) /* wrapper yn */
+#else
+ double yn(n,x) /* wrapper yn */
+ double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_yn(n,x);
+#else
+ double z;
+ z = __ieee754_yn(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard((double)n,x,12);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard((double)n,x,13);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
+#ifdef NO_LONG_DOUBLE
+strong_alias (yn, ynl)
+#endif
diff --git a/sysdeps/generic/w_jnf.c b/sysdeps/generic/w_jnf.c
new file mode 100644
index 0000000000..63ad335573
--- /dev/null
+++ b/sysdeps/generic/w_jnf.c
@@ -0,0 +1,71 @@
+/* w_jnf.c -- float version of w_jn.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_jnf.c,v 1.3 1995/05/10 20:49:21 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float jnf(int n, float x) /* wrapper jnf */
+#else
+ float jnf(n,x) /* wrapper jnf */
+ float x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_jnf(n,x);
+#else
+ float z;
+ z = __ieee754_jnf(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
+ if(fabsf(x)>(float)X_TLOSS) {
+ /* jn(|x|>X_TLOSS,n) */
+ return (float)__kernel_standard((double)n,(double)x,138);
+ } else
+ return z;
+#endif
+}
+
+#ifdef __STDC__
+ float ynf(int n, float x) /* wrapper ynf */
+#else
+ float ynf(n,x) /* wrapper ynf */
+ float x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_ynf(n,x);
+#else
+ float z;
+ z = __ieee754_ynf(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
+ if(x <= (float)0.0){
+ if(x==(float)0.0)
+ /* d= -one/(x-x); */
+ return (float)__kernel_standard((double)n,(double)x,112);
+ else
+ /* d = zero/(x-x); */
+ return (float)__kernel_standard((double)n,(double)x,113);
+ }
+ if(x>(float)X_TLOSS) {
+ /* yn(x>X_TLOSS,n) */
+ return (float)__kernel_standard((double)n,(double)x,139);
+ } else
+ return z;
+#endif
+}
diff --git a/sysdeps/generic/w_jnl.c b/sysdeps/generic/w_jnl.c
new file mode 100644
index 0000000000..866e3cdb00
--- /dev/null
+++ b/sysdeps/generic/w_jnl.c
@@ -0,0 +1,96 @@
+/* w_jnl.c -- long double version of w_jn.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper jn(int n, double x), yn(int n, double x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ * For n=0, j0(x) is called,
+ * for n=1, j1(x) is called,
+ * for n<x, forward recursion us used starting
+ * from values of j0(x) and j1(x).
+ * for n>x, a continued fraction approximation to
+ * j(n,x)/j(n-1,x) is evaluated and then backward
+ * recursion is used starting from a supposed value
+ * for j(n,x). The resulting value of j(0,x) is
+ * compared with the actual value to correct the
+ * supposed value of j(n,x).
+ *
+ * yn(n,x) is similar in all respects, except
+ * that forward recursion is used for all
+ * values of n>1.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double jnl(int n, long double x) /* wrapper jnl */
+#else
+ long double jnl(n,x) /* wrapper jnl */
+ long double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_jnl(n,x);
+#else
+ long double z;
+ z = __ieee754_jnl(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(fabsl(x)>X_TLOSS) {
+ return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
+
+#ifdef __STDC__
+ long double ynl(int n, long double x) /* wrapper ynl */
+#else
+ long double ynl(n,x) /* wrapper ynl */
+ long double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_ynl(n,x);
+#else
+ long double z;
+ z = __ieee754_ynl(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard((double)n,x,212);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard((double)n,x,213);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
diff --git a/sysdeps/generic/w_lgamma.c b/sysdeps/generic/w_lgamma.c
new file mode 100644
index 0000000000..7c7f34ff39
--- /dev/null
+++ b/sysdeps/generic/w_lgamma.c
@@ -0,0 +1,60 @@
+/* @(#)w_lgamma.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $";
+#endif
+
+/* double lgamma(double x)
+ * Return the logarithm of the Gamma function of x.
+ *
+ * Method: call __ieee754_lgamma_r
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __lgamma(double x)
+#else
+ double __lgamma(x)
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgamma_r(x,&signgam);
+#else
+ double y;
+ int local_signgam = 0;
+ y = __ieee754_lgamma_r(x,&local_signgam);
+ if (_LIB_VERSION != _ISOC_)
+ /* ISO C99 does not define the global variable. */
+ signgam = local_signgam;
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finite(y)&&__finite(x)) {
+ if(__floor(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,15); /* lgamma pole */
+ else
+ return __kernel_standard(x,x,14); /* lgamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgamma, lgamma)
+strong_alias (__lgamma, __gamma)
+weak_alias (__gamma, gamma)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lgamma, __lgammal)
+weak_alias (__lgamma, lgammal)
+strong_alias (__gamma, __gammal)
+weak_alias (__gamma, gammal)
+#endif
diff --git a/sysdeps/generic/w_lgamma_r.c b/sysdeps/generic/w_lgamma_r.c
new file mode 100644
index 0000000000..f3e7d821e2
--- /dev/null
+++ b/sysdeps/generic/w_lgamma_r.c
@@ -0,0 +1,51 @@
+/* @(#)wr_lgamma.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $";
+#endif
+
+/*
+ * wrapper double lgamma_r(double x, int *signgamp)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
+#else
+ double __lgamma_r(x,signgamp) /* wrapper lgamma_r */
+ double x; int *signgamp;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgamma_r(x,signgamp);
+#else
+ double y;
+ y = __ieee754_lgamma_r(x,signgamp);
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finite(y)&&__finite(x)) {
+ if(__floor(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,15); /* lgamma pole */
+ else
+ return __kernel_standard(x,x,14); /* lgamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgamma_r, lgamma_r)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lgamma_r, __lgammal_r)
+weak_alias (__lgamma_r, lgammal_r)
+#endif
diff --git a/sysdeps/generic/w_lgammaf.c b/sysdeps/generic/w_lgammaf.c
new file mode 100644
index 0000000000..d0f6d0d17c
--- /dev/null
+++ b/sysdeps/generic/w_lgammaf.c
@@ -0,0 +1,53 @@
+/* w_lgammaf.c -- float version of w_lgamma.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_lgammaf.c,v 1.3 1995/05/10 20:49:30 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __lgammaf(float x)
+#else
+ float __lgammaf(x)
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammaf_r(x,&signgam);
+#else
+ float y;
+ int local_signgam = 0;
+ y = __ieee754_lgammaf_r(x,&local_signgam);
+ if (_LIB_VERSION != _ISOC_)
+ /* ISO C99 does not define the global variable. */
+ signgam = local_signgam;
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitef(y)&&__finitef(x)) {
+ if(__floorf(x)==x&&x<=(float)0.0)
+ /* lgamma pole */
+ return (float)__kernel_standard((double)x,(double)x,115);
+ else
+ /* lgamma overflow */
+ return (float)__kernel_standard((double)x,(double)x,114);
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgammaf, lgammaf)
+strong_alias (__lgammaf, __gammaf)
+weak_alias (__gammaf, gammaf)
diff --git a/sysdeps/generic/w_lgammaf_r.c b/sysdeps/generic/w_lgammaf_r.c
new file mode 100644
index 0000000000..66962acc7e
--- /dev/null
+++ b/sysdeps/generic/w_lgammaf_r.c
@@ -0,0 +1,52 @@
+/* w_lgammaf_r.c -- float version of w_lgamma_r.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_lgammaf_r.c,v 1.3 1995/05/10 20:49:32 jtc Exp $";
+#endif
+
+/*
+ * wrapper float lgammaf_r(float x, int *signgamp)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
+#else
+ float __lgammaf_r(x,signgamp) /* wrapper lgammaf_r */
+ float x; int *signgamp;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammaf_r(x,signgamp);
+#else
+ float y;
+ y = __ieee754_lgammaf_r(x,signgamp);
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitef(y)&&__finitef(x)) {
+ if(__floorf(x)==x&&x<=(float)0.0)
+ /* lgamma pole */
+ return (float)__kernel_standard((double)x,(double)x,115);
+ else
+ /* lgamma overflow */
+ return (float)__kernel_standard((double)x,(double)x,114);
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgammaf_r, lgammaf_r)
diff --git a/sysdeps/generic/w_lgammal.c b/sysdeps/generic/w_lgammal.c
new file mode 100644
index 0000000000..1ee51a6f49
--- /dev/null
+++ b/sysdeps/generic/w_lgammal.c
@@ -0,0 +1,58 @@
+/* w_lgammal.c -- long double version of w_lgamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* long double lgammal(long double x)
+ * Return the logarithm of the Gamma function of x.
+ *
+ * Method: call __ieee754_lgammal_r
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __lgammal(long double x)
+#else
+ long double __lgammal(x)
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammal_r(x,&signgam);
+#else
+ long double y;
+ int local_signgam = 0;
+ y = __ieee754_lgammal_r(x,&local_signgam);
+ if (_LIB_VERSION != _ISOC_)
+ /* ISO C99 does not define the global variable. */
+ signgam = local_signgam;
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitel(y)&&__finitel(x)) {
+ if(__floorl(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,215); /* lgamma pole */
+ else
+ return __kernel_standard(x,x,214); /* lgamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgammal, lgammal)
+strong_alias (__lgammal, __gammal)
+weak_alias (__gammal, gammal)
diff --git a/sysdeps/generic/w_lgammal_r.c b/sysdeps/generic/w_lgammal_r.c
new file mode 100644
index 0000000000..71f5c005d0
--- /dev/null
+++ b/sysdeps/generic/w_lgammal_r.c
@@ -0,0 +1,52 @@
+/* w_lgammal_r.c -- long double version of w_lgamma_r.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper long double lgammal_r(long double x, int *signgamp)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __lgammal_r(long double x, int *signgamp)
+ /* wrapper lgamma_r */
+#else
+ long double __lgammal_r(x,signgamp) /* wrapper lgamma_r */
+ long double x; int *signgamp;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammal_r(x,signgamp);
+#else
+ long double y;
+ y = __ieee754_lgammal_r(x,signgamp);
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitel(y)&&__finitel(x)) {
+ if(__floorl(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,215); /* lgamma pole */
+ else
+ return __kernel_standard(x,x,214); /* lgamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgammal_r, lgammal_r)
diff --git a/sysdeps/generic/w_log.c b/sysdeps/generic/w_log.c
new file mode 100644
index 0000000000..5f0af79731
--- /dev/null
+++ b/sysdeps/generic/w_log.c
@@ -0,0 +1,48 @@
+/* @(#)w_log.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_log.c,v 1.6 1995/05/10 20:49:33 jtc Exp $";
+#endif
+
+/*
+ * wrapper log(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __log(double x) /* wrapper log */
+#else
+ double __log(x) /* wrapper log */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log(x);
+#else
+ double z;
+ z = __ieee754_log(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x) || x > 0.0) return z;
+ if(x==0.0)
+ return __kernel_standard(x,x,16); /* log(0) */
+ else
+ return __kernel_standard(x,x,17); /* log(x<0) */
+#endif
+}
+weak_alias (__log, log)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__log, __logl)
+weak_alias (__log, logl)
+#endif
diff --git a/sysdeps/generic/w_log10.c b/sysdeps/generic/w_log10.c
new file mode 100644
index 0000000000..8a0a70bdf7
--- /dev/null
+++ b/sysdeps/generic/w_log10.c
@@ -0,0 +1,51 @@
+/* @(#)w_log10.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_log10.c,v 1.6 1995/05/10 20:49:35 jtc Exp $";
+#endif
+
+/*
+ * wrapper log10(X)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __log10(double x) /* wrapper log10 */
+#else
+ double __log10(x) /* wrapper log10 */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log10(x);
+#else
+ double z;
+ z = __ieee754_log10(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ if(x<=0.0) {
+ if(x==0.0)
+ return __kernel_standard(x,x,18); /* log10(0) */
+ else
+ return __kernel_standard(x,x,19); /* log10(x<0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__log10, log10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__log10, __log10l)
+weak_alias (__log10, log10l)
+#endif
diff --git a/sysdeps/generic/w_log10f.c b/sysdeps/generic/w_log10f.c
new file mode 100644
index 0000000000..f90cb0cabc
--- /dev/null
+++ b/sysdeps/generic/w_log10f.c
@@ -0,0 +1,52 @@
+/* w_log10f.c -- float version of w_log10.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_log10f.c,v 1.3 1995/05/10 20:49:37 jtc Exp $";
+#endif
+
+/*
+ * wrapper log10f(X)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __log10f(float x) /* wrapper log10f */
+#else
+ float __log10f(x) /* wrapper log10f */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log10f(x);
+#else
+ float z;
+ z = __ieee754_log10f(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ if(x<=(float)0.0) {
+ if(x==(float)0.0)
+ /* log10(0) */
+ return (float)__kernel_standard((double)x,(double)x,118);
+ else
+ /* log10(x<0) */
+ return (float)__kernel_standard((double)x,(double)x,119);
+ } else
+ return z;
+#endif
+}
+weak_alias (__log10f, log10f)
diff --git a/sysdeps/generic/w_log10l.c b/sysdeps/generic/w_log10l.c
new file mode 100644
index 0000000000..0d0861689d
--- /dev/null
+++ b/sysdeps/generic/w_log10l.c
@@ -0,0 +1,51 @@
+/* w_log10l.c -- long double version of w_log10.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper log10l(X)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __log10l(long double x) /* wrapper log10l */
+#else
+ long double __log10l(x) /* wrapper log10l */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log10l(x);
+#else
+ long double z;
+ z = __ieee754_log10l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(x<=0.0) {
+ if(x==0.0)
+ return __kernel_standard(x,x,218); /* log10(0) */
+ else
+ return __kernel_standard(x,x,219); /* log10(x<0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__log10l, log10l)
diff --git a/sysdeps/generic/w_log2.c b/sysdeps/generic/w_log2.c
new file mode 100644
index 0000000000..7966ff359f
--- /dev/null
+++ b/sysdeps/generic/w_log2.c
@@ -0,0 +1,32 @@
+/*
+ * wrapper log2(X)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+double
+__log2 (double x) /* wrapper log2 */
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log2 (x);
+#else
+ double z;
+ z = __ieee754_log2 (x);
+ if (_LIB_VERSION == _IEEE_ || __isnan (x)) return z;
+ if (x <= 0.0)
+ {
+ if (x == 0.0)
+ return __kernel_standard (x, x, 48); /* log2 (0) */
+ else
+ return __kernel_standard (x, x, 49); /* log2 (x < 0) */
+ }
+ else
+ return z;
+#endif
+}
+weak_alias (__log2, log2)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__log2, __log2l)
+weak_alias (__log2, log2l)
+#endif
diff --git a/sysdeps/generic/w_log2f.c b/sysdeps/generic/w_log2f.c
new file mode 100644
index 0000000000..1e2eb85d7b
--- /dev/null
+++ b/sysdeps/generic/w_log2f.c
@@ -0,0 +1,30 @@
+/*
+ * wrapper log2(X)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+float
+__log2f (float x) /* wrapper log2f */
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log2f (x);
+#else
+ float z;
+ z = __ieee754_log2f (x);
+ if (_LIB_VERSION == _IEEE_ || __isnanf (x)) return z;
+ if (x <= 0.0f)
+ {
+ if (x == 0.0f)
+ /* log2f (0) */
+ return __kernel_standard ((double) x, (double) x, 148);
+ else
+ /* log2f (x < 0) */
+ return __kernel_standard ((double) x, (double) x, 149);
+ }
+ else
+ return z;
+#endif
+}
+weak_alias (__log2f, log2f)
diff --git a/sysdeps/generic/w_log2l.c b/sysdeps/generic/w_log2l.c
new file mode 100644
index 0000000000..f41757c5e4
--- /dev/null
+++ b/sysdeps/generic/w_log2l.c
@@ -0,0 +1,28 @@
+/*
+ * wrapper log2l(X)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+long double
+__log2l (long double x) /* wrapper log2l */
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log2l (x);
+#else
+ long double z;
+ z = __ieee754_log2l (x);
+ if (_LIB_VERSION == _IEEE_ || __isnanl (x)) return z;
+ if (x <= 0.0)
+ {
+ if (x == 0.0)
+ return __kernel_standard (x, x, 248); /* log2l (0) */
+ else
+ return __kernel_standard (x, x, 249); /* log2l (x < 0) */
+ }
+ else
+ return z;
+#endif
+}
+weak_alias (__log2l, log2l)
diff --git a/sysdeps/generic/w_logf.c b/sysdeps/generic/w_logf.c
new file mode 100644
index 0000000000..9eabe4b34c
--- /dev/null
+++ b/sysdeps/generic/w_logf.c
@@ -0,0 +1,49 @@
+/* w_logf.c -- float version of w_log.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_logf.c,v 1.3 1995/05/10 20:49:40 jtc Exp $";
+#endif
+
+/*
+ * wrapper logf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __logf(float x) /* wrapper logf */
+#else
+ float __logf(x) /* wrapper logf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_logf(x);
+#else
+ float z;
+ z = __ieee754_logf(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x) || x > (float)0.0) return z;
+ if(x==(float)0.0)
+ /* logf(0) */
+ return (float)__kernel_standard((double)x,(double)x,116);
+ else
+ /* logf(x<0) */
+ return (float)__kernel_standard((double)x,(double)x,117);
+#endif
+}
+weak_alias (__logf, logf)
diff --git a/sysdeps/generic/w_logl.c b/sysdeps/generic/w_logl.c
new file mode 100644
index 0000000000..bb979c26c3
--- /dev/null
+++ b/sysdeps/generic/w_logl.c
@@ -0,0 +1,48 @@
+/* w_logl.c -- long double version of w_log.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper logl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __logl(long double x) /* wrapper logl */
+#else
+ long double __logl(x) /* wrapper logl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_logl(x);
+#else
+ long double z;
+ z = __ieee754_logl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) || x > 0.0) return z;
+ if(x==0.0)
+ return __kernel_standard(x,x,216); /* log(0) */
+ else
+ return __kernel_standard(x,x,217); /* log(x<0) */
+#endif
+}
+weak_alias (__logl, logl)
diff --git a/sysdeps/generic/w_pow.c b/sysdeps/generic/w_pow.c
new file mode 100644
index 0000000000..5850651a1a
--- /dev/null
+++ b/sysdeps/generic/w_pow.c
@@ -0,0 +1,70 @@
+
+
+/* @(#)w_pow.c 5.2 93/10/01 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper pow(x,y) return x**y
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ double __pow(double x, double y) /* wrapper pow */
+#else
+ double __pow(x,y) /* wrapper pow */
+ double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_pow(x,y);
+#else
+ double z;
+ z=__ieee754_pow(x,y);
+ if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z;
+ if(__isnan(x)) {
+ if(y==0.0)
+ return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
+ else
+ return z;
+ }
+ if(x==0.0) {
+ if(y==0.0)
+ return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
+ if(__finite(y)&&y<0.0) {
+ if (signbit (x) && signbit (z))
+ return __kernel_standard(x,y,23); /* pow(-0.0,negative) */
+ else
+ return __kernel_standard(x,y,43); /* pow(+0.0,negative) */
+ }
+ return z;
+ }
+ if(!__finite(z)) {
+ if(__finite(x)&&__finite(y)) {
+ if(__isnan(z))
+ return __kernel_standard(x,y,24); /* pow neg**non-int */
+ else
+ return __kernel_standard(x,y,21); /* pow overflow */
+ }
+ }
+ if(z==0.0&&__finite(x)&&__finite(y))
+ return __kernel_standard(x,y,22); /* pow underflow */
+ return z;
+#endif
+}
+weak_alias (__pow, pow)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__pow, __powl)
+weak_alias (__pow, powl)
+#endif
diff --git a/sysdeps/generic/w_powf.c b/sysdeps/generic/w_powf.c
new file mode 100644
index 0000000000..32196fd89f
--- /dev/null
+++ b/sysdeps/generic/w_powf.c
@@ -0,0 +1,77 @@
+/* w_powf.c -- float version of w_pow.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_powf.c,v 1.3 1995/05/10 20:49:41 jtc Exp $";
+#endif
+
+/*
+ * wrapper powf(x,y) return x**y
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ float __powf(float x, float y) /* wrapper powf */
+#else
+ float __powf(x,y) /* wrapper powf */
+ float x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_powf(x,y);
+#else
+ float z;
+ z=__ieee754_powf(x,y);
+ if(_LIB_VERSION == _IEEE_|| __isnanf(y)) return z;
+ if(__isnanf(x)) {
+ if(y==(float)0.0)
+ /* powf(NaN,0.0) */
+ return (float)__kernel_standard((double)x,(double)y,142);
+ else
+ return z;
+ }
+ if(x==(float)0.0) {
+ if(y==(float)0.0)
+ /* powf(0.0,0.0) */
+ return (float)__kernel_standard((double)x,(double)y,120);
+ if(__finitef(y)&&y<(float)0.0) {
+ if (signbit (x) && signbit (z))
+ /* powf(0.0,negative) */
+ return (float)__kernel_standard((double)x,(double)y,123);
+ else
+ return (float)__kernel_standard((double)x,(double)y,143);
+ }
+ return z;
+ }
+ if(!__finitef(z)) {
+ if(__finitef(x)&&__finitef(y)) {
+ if(__isnanf(z))
+ /* powf neg**non-int */
+ return (float)__kernel_standard((double)x,(double)y,124);
+ else
+ /* powf overflow */
+ return (float)__kernel_standard((double)x,(double)y,121);
+ }
+ }
+ if(z==(float)0.0&&__finitef(x)&&__finitef(y))
+ /* powf underflow */
+ return (float)__kernel_standard((double)x,(double)y,122);
+ return z;
+#endif
+}
+weak_alias (__powf, powf)
diff --git a/sysdeps/generic/w_powl.c b/sysdeps/generic/w_powl.c
new file mode 100644
index 0000000000..17feb9fc61
--- /dev/null
+++ b/sysdeps/generic/w_powl.c
@@ -0,0 +1,68 @@
+/* w_powl.c -- long double version of w_pow.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper powl(x,y) return x**y
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __powl(long double x, long double y)/* wrapper powl */
+#else
+ long double __powl(x,y) /* wrapper powl */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_powl(x,y);
+#else
+ long double z;
+ z=__ieee754_powl(x,y);
+ if(_LIB_VERSION == _IEEE_|| __isnanl(y)) return z;
+ if(__isnanl(x)) {
+ if(y==0.0)
+ return __kernel_standard(x,y,242); /* pow(NaN,0.0) */
+ else
+ return z;
+ }
+ if(x==0.0) {
+ if(y==0.0)
+ return __kernel_standard(x,y,220); /* pow(0.0,0.0) */
+ if(__finitel(y)&&y<0.0) {
+ if (signbit (x) && signbit (z))
+ return __kernel_standard(x,y,223); /* pow(-0.0,negative) */
+ else
+ return __kernel_standard(x,y,243); /* pow(+0.0,negative) */
+ }
+ return z;
+ }
+ if(!__finitel(z)) {
+ if(__finitel(x)&&__finitel(y)) {
+ if(__isnanl(z))
+ return __kernel_standard(x,y,224); /* pow neg**non-int */
+ else
+ return __kernel_standard(x,y,221); /* pow overflow */
+ }
+ }
+ if(z==0.0&&__finitel(x)&&__finitel(y))
+ return __kernel_standard(x,y,222); /* pow underflow */
+ return z;
+#endif
+}
+weak_alias (__powl, powl)
diff --git a/sysdeps/generic/w_remainder.c b/sysdeps/generic/w_remainder.c
new file mode 100644
index 0000000000..d85a3febce
--- /dev/null
+++ b/sysdeps/generic/w_remainder.c
@@ -0,0 +1,47 @@
+/* @(#)w_remainder.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp $";
+#endif
+
+/*
+ * wrapper remainder(x,p)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __remainder(double x, double y) /* wrapper remainder */
+#else
+ double __remainder(x,y) /* wrapper remainder */
+ double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_remainder(x,y);
+#else
+ double z;
+ z = __ieee754_remainder(x,y);
+ if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z;
+ if(y==0.0)
+ return __kernel_standard(x,y,28); /* remainder(x,0) */
+ else
+ return z;
+#endif
+}
+weak_alias (__remainder, remainder)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__remainder, __remainderl)
+weak_alias (__remainder, remainderl)
+#endif
diff --git a/sysdeps/generic/w_remainderf.c b/sysdeps/generic/w_remainderf.c
new file mode 100644
index 0000000000..58255f5be5
--- /dev/null
+++ b/sysdeps/generic/w_remainderf.c
@@ -0,0 +1,47 @@
+/* w_remainderf.c -- float version of w_remainder.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp $";
+#endif
+
+/*
+ * wrapper remainderf(x,p)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __remainderf(float x, float y) /* wrapper remainder */
+#else
+ float __remainderf(x,y) /* wrapper remainder */
+ float x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_remainderf(x,y);
+#else
+ float z;
+ z = __ieee754_remainderf(x,y);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(y)) return z;
+ if(y==(float)0.0)
+ /* remainder(x,0) */
+ return (float)__kernel_standard((double)x,(double)y,128);
+ else
+ return z;
+#endif
+}
+weak_alias (__remainderf, remainderf)
diff --git a/sysdeps/generic/w_remainderl.c b/sysdeps/generic/w_remainderl.c
new file mode 100644
index 0000000000..284140174d
--- /dev/null
+++ b/sysdeps/generic/w_remainderl.c
@@ -0,0 +1,48 @@
+/* w_remainderl.c -- long double version of w_remainder.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper remainderl(x,p)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __remainderl(long double x, long double y)
+ /* wrapper remainderl */
+#else
+ long double __remainderl(x,y) /* wrapper remainder */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_remainderl(x,y);
+#else
+ long double z;
+ z = __ieee754_remainderl(x,y);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z;
+ if(y==0.0)
+ return __kernel_standard(x,y,228); /* remainder(x,0) */
+ else
+ return z;
+#endif
+}
+weak_alias (__remainderl, remainderl)
diff --git a/sysdeps/generic/w_scalb.c b/sysdeps/generic/w_scalb.c
new file mode 100644
index 0000000000..c981b858a9
--- /dev/null
+++ b/sysdeps/generic/w_scalb.c
@@ -0,0 +1,65 @@
+/* @(#)w_scalb.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $";
+#endif
+
+/*
+ * wrapper scalb(double x, double fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbn() instead.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#include <errno.h>
+
+#ifdef __STDC__
+#ifdef _SCALB_INT
+ double __scalb(double x, int fn) /* wrapper scalb */
+#else
+ double __scalb(double x, double fn) /* wrapper scalb */
+#endif
+#else
+ double __scalb(x,fn) /* wrapper scalb */
+#ifdef _SCALB_INT
+ double x; int fn;
+#else
+ double x,fn;
+#endif
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_scalb(x,fn);
+#else
+ double z;
+ z = __ieee754_scalb(x,fn);
+ if(_LIB_VERSION != _SVID_) return z;
+ if(!(__finite(z)||__isnan(z))&&__finite(x)) {
+ return __kernel_standard(x,(double)fn,32); /* scalb overflow */
+ }
+ if(z==0.0&&z!=x) {
+ return __kernel_standard(x,(double)fn,33); /* scalb underflow */
+ }
+#ifndef _SCALB_INT
+ if(!__finite(fn)) __set_errno (ERANGE);
+#endif
+ return z;
+#endif
+}
+weak_alias (__scalb, scalb)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__scalb, __scalbl)
+weak_alias (__scalb, scalbl)
+#endif
diff --git a/sysdeps/generic/w_scalbf.c b/sysdeps/generic/w_scalbf.c
new file mode 100644
index 0000000000..51056083e8
--- /dev/null
+++ b/sysdeps/generic/w_scalbf.c
@@ -0,0 +1,66 @@
+/* w_scalbf.c -- float version of w_scalb.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $";
+#endif
+
+/*
+ * wrapper scalbf(float x, float fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbn() instead.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#include <errno.h>
+
+#ifdef __STDC__
+#ifdef _SCALB_INT
+ float __scalbf(float x, int fn) /* wrapper scalbf */
+#else
+ float __scalbf(float x, float fn) /* wrapper scalbf */
+#endif
+#else
+ float __scalbf(x,fn) /* wrapper scalbf */
+#ifdef _SCALB_INT
+ float x; int fn;
+#else
+ float x,fn;
+#endif
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_scalbf(x,fn);
+#else
+ float z;
+ z = __ieee754_scalbf(x,fn);
+ if(_LIB_VERSION != _SVID_) return z;
+ if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) {
+ /* scalbf overflow */
+ return (float)__kernel_standard((double)x,(double)fn,132);
+ }
+ if(z==(float)0.0&&z!=x) {
+ /* scalbf underflow */
+ return (float)__kernel_standard((double)x,(double)fn,133);
+ }
+#ifndef _SCALB_INT
+ if(!__finitef(fn)) __set_errno (ERANGE);
+#endif
+ return z;
+#endif
+}
+weak_alias (__scalbf, scalbf)
diff --git a/sysdeps/generic/w_scalbl.c b/sysdeps/generic/w_scalbl.c
new file mode 100644
index 0000000000..6a7d307104
--- /dev/null
+++ b/sysdeps/generic/w_scalbl.c
@@ -0,0 +1,65 @@
+/* w_scalbl.c -- long double version of w_scalb.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper scalbl(long double x, long double fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbnl() instead.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#include <errno.h>
+
+#ifdef __STDC__
+#ifdef _SCALB_INT
+ long double __scalbl(long double x, int fn) /* wrapper scalbl */
+#else
+ long double __scalbl(long double x, long double fn)/* wrapper scalbl */
+#endif
+#else
+ long double __scalbl(x,fn) /* wrapper scalbl */
+#ifdef _SCALB_INT
+ long double x; int fn;
+#else
+ long double x,fn;
+#endif
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_scalbl(x,fn);
+#else
+ long double z;
+ z = __ieee754_scalbl(x,fn);
+ if(_LIB_VERSION != _SVID_) return z;
+ if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) {
+ return __kernel_standard(x,(double)fn,232); /* scalb overflow */
+ }
+ if(z==0.0&&z!=x) {
+ return __kernel_standard(x,(double)fn,233); /* scalb underflow */
+ }
+#ifndef _SCALB_INT
+ if(!__finitel(fn)) __set_errno (ERANGE);
+#endif
+ return z;
+#endif
+}
+weak_alias (__scalbl, scalbl)
diff --git a/sysdeps/generic/w_sinh.c b/sysdeps/generic/w_sinh.c
new file mode 100644
index 0000000000..9b34cd1873
--- /dev/null
+++ b/sysdeps/generic/w_sinh.c
@@ -0,0 +1,47 @@
+/* @(#)w_sinh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $";
+#endif
+
+/*
+ * wrapper sinh(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __sinh(double x) /* wrapper sinh */
+#else
+ double __sinh(x) /* wrapper sinh */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sinh(x);
+#else
+ double z;
+ z = __ieee754_sinh(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!__finite(z)&&__finite(x)) {
+ return __kernel_standard(x,x,25); /* sinh overflow */
+ } else
+ return z;
+#endif
+}
+weak_alias (__sinh, sinh)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__sinh, __sinhl)
+weak_alias (__sinh, sinhl)
+#endif
diff --git a/sysdeps/generic/w_sinhf.c b/sysdeps/generic/w_sinhf.c
new file mode 100644
index 0000000000..a69cf3072d
--- /dev/null
+++ b/sysdeps/generic/w_sinhf.c
@@ -0,0 +1,47 @@
+/* w_sinhf.c -- float version of w_sinh.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_sinhf.c,v 1.3 1995/05/10 20:49:54 jtc Exp $";
+#endif
+
+/*
+ * wrapper sinhf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __sinhf(float x) /* wrapper sinhf */
+#else
+ float __sinhf(x) /* wrapper sinhf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sinhf(x);
+#else
+ float z;
+ z = __ieee754_sinhf(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!__finitef(z)&&__finitef(x)) {
+ /* sinhf overflow */
+ return (float)__kernel_standard((double)x,(double)x,125);
+ } else
+ return z;
+#endif
+}
+weak_alias (__sinhf, sinhf)
diff --git a/sysdeps/generic/w_sinhl.c b/sysdeps/generic/w_sinhl.c
new file mode 100644
index 0000000000..3e93cc598d
--- /dev/null
+++ b/sysdeps/generic/w_sinhl.c
@@ -0,0 +1,47 @@
+/* w_sinhl.c -- long double version of w_sinh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper sinhl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __sinhl(long double x) /* wrapper sinhl */
+#else
+ long double __sinhl(x) /* wrapper sinhl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sinhl(x);
+#else
+ long double z;
+ z = __ieee754_sinhl(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!__finitel(z)&&__finitel(x)) {
+ return __kernel_standard(x,x,225); /* sinh overflow */
+ } else
+ return z;
+#endif
+}
+weak_alias (__sinhl, sinhl)
diff --git a/sysdeps/generic/w_sqrt.c b/sysdeps/generic/w_sqrt.c
new file mode 100644
index 0000000000..be15d959ea
--- /dev/null
+++ b/sysdeps/generic/w_sqrt.c
@@ -0,0 +1,47 @@
+/* @(#)w_sqrt.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_sqrt.c,v 1.6 1995/05/10 20:49:55 jtc Exp $";
+#endif
+
+/*
+ * wrapper sqrt(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __sqrt(double x) /* wrapper sqrt */
+#else
+ double __sqrt(x) /* wrapper sqrt */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sqrt(x);
+#else
+ double z;
+ z = __ieee754_sqrt(x);
+ if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
+ if(x<0.0) {
+ return __kernel_standard(x,x,26); /* sqrt(negative) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__sqrt, sqrt)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__sqrt, __sqrtl)
+weak_alias (__sqrt, sqrtl)
+#endif
diff --git a/sysdeps/generic/w_sqrtf.c b/sysdeps/generic/w_sqrtf.c
new file mode 100644
index 0000000000..f5ccc73868
--- /dev/null
+++ b/sysdeps/generic/w_sqrtf.c
@@ -0,0 +1,47 @@
+/* w_sqrtf.c -- float version of w_sqrt.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_sqrtf.c,v 1.3 1995/05/10 20:49:59 jtc Exp $";
+#endif
+
+/*
+ * wrapper sqrtf(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __sqrtf(float x) /* wrapper sqrtf */
+#else
+ float sqrt(x) /* wrapper sqrtf */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sqrtf(x);
+#else
+ float z;
+ z = __ieee754_sqrtf(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
+ if(x<(float)0.0) {
+ /* sqrtf(negative) */
+ return (float)__kernel_standard((double)x,(double)x,126);
+ } else
+ return z;
+#endif
+}
+weak_alias (__sqrtf, sqrtf)
diff --git a/sysdeps/generic/w_sqrtl.c b/sysdeps/generic/w_sqrtl.c
new file mode 100644
index 0000000000..5873ce93ab
--- /dev/null
+++ b/sysdeps/generic/w_sqrtl.c
@@ -0,0 +1,47 @@
+/* w_sqrtl.c -- long double version of w_sqrt.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper sqrtl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __sqrtl(long double x) /* wrapper sqrtl */
+#else
+ long double __sqrtl(x) /* wrapper sqrtl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sqrtl(x);
+#else
+ long double z;
+ z = __ieee754_sqrtl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(x<0.0) {
+ return __kernel_standard(x,x,226); /* sqrt(negative) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__sqrtl, sqrtl)
diff --git a/sysdeps/generic/w_tgamma.c b/sysdeps/generic/w_tgamma.c
new file mode 100644
index 0000000000..6e34b62be4
--- /dev/null
+++ b/sysdeps/generic/w_tgamma.c
@@ -0,0 +1,56 @@
+/* @(#)w_gamma.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
+#endif
+
+/* double gamma(double x)
+ * Return the logarithm of the Gamma function of x or the Gamma function of x,
+ * depending on the library mode.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __tgamma(double x)
+#else
+ double __tgamma(x)
+ double x;
+#endif
+{
+ double y;
+ int local_signgam;
+ y = __ieee754_gamma_r(x,&local_signgam);
+ if (local_signgam < 0) y = -y;
+#ifdef _IEEE_LIBM
+ return y;
+#else
+ if(_LIB_VERSION == _IEEE_) return y;
+
+ if(!__finite(y)&&__finite(x)) {
+ if (x == 0.0)
+ return __kernel_standard(x,x,50); /* tgamma pole */
+ else if(__floor(x)==x&&x<0.0)
+ return __kernel_standard(x,x,41); /* tgamma domain */
+ else
+ return __kernel_standard(x,x,40); /* tgamma overflow */
+ }
+ return y;
+#endif
+}
+weak_alias (__tgamma, tgamma)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__tgamma, __tgammal)
+weak_alias (__tgamma, tgammal)
+#endif
diff --git a/sysdeps/generic/w_tgammaf.c b/sysdeps/generic/w_tgammaf.c
new file mode 100644
index 0000000000..e7b0d87ab5
--- /dev/null
+++ b/sysdeps/generic/w_tgammaf.c
@@ -0,0 +1,53 @@
+/* w_gammaf.c -- float version of w_gamma.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __tgammaf(float x)
+#else
+ float __tgammaf(x)
+ float x;
+#endif
+{
+ float y;
+ int local_signgam;
+ y = __ieee754_gammaf_r(x,&local_signgam);
+ if (local_signgam < 0) y = -y;
+#ifdef _IEEE_LIBM
+ return y;
+#else
+ if(_LIB_VERSION == _IEEE_) return y;
+
+ if(!__finitef(y)&&__finitef(x)) {
+ if (x == (float)0.0)
+ /* tgammaf pole */
+ return (float)__kernel_standard((double)x,(double)x,150);
+ else if(__floorf(x)==x&&x<(float)0.0)
+ /* tgammaf domain */
+ return (float)__kernel_standard((double)x,(double)x,141);
+ else
+ /* tgammaf overflow */
+ return (float)__kernel_standard((double)x,(double)x,140);
+ }
+ return y;
+#endif
+}
+weak_alias (__tgammaf, tgammaf)
diff --git a/sysdeps/generic/w_tgammal.c b/sysdeps/generic/w_tgammal.c
new file mode 100644
index 0000000000..793fa17ac1
--- /dev/null
+++ b/sysdeps/generic/w_tgammal.c
@@ -0,0 +1,55 @@
+/* w_gammal.c -- long double version of w_gamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* long double gammal(double x)
+ * Return the Gamma function of x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __tgammal(long double x)
+#else
+ long double __tgammal(x)
+ long double x;
+#endif
+{
+ long double y;
+ int local_signgam;
+ y = __ieee754_gammal_r(x,&local_signgam);
+ if (local_signgam < 0) y = -y;
+#ifdef _IEEE_LIBM
+ return y;
+#else
+ if(_LIB_VERSION == _IEEE_) return y;
+
+ if(!__finitel(y)&&__finitel(x)) {
+ if(x==0.0)
+ return __kernel_standard(x,x,250); /* tgamma pole */
+ else if(__floorl(x)==x&&x<0.0)
+ return __kernel_standard(x,x,241); /* tgamma domain */
+ else
+ return __kernel_standard(x,x,240); /* tgamma overflow */
+ }
+ return y;
+#endif
+}
+weak_alias (__tgammal, tgammal)
diff --git a/sysdeps/generic/wait.c b/sysdeps/generic/wait.c
new file mode 100644
index 0000000000..b1c512ed39
--- /dev/null
+++ b/sysdeps/generic/wait.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/wait.h>
+#include <errno.h>
+
+/* Wait for a child to die. When one does, put its status in *STAT_LOC
+ and return its process ID. For errors, return (pid_t) -1. */
+__pid_t
+__wait (__WAIT_STATUS_DEFN stat_loc)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (wait)
+
+weak_alias (__wait, wait)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/wait3.c b/sysdeps/generic/wait3.c
new file mode 100644
index 0000000000..479d99e3da
--- /dev/null
+++ b/sysdeps/generic/wait3.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+
+/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
+ return its process ID. For errors return (pid_t) -1. If USAGE is not nil,
+ store information about the child's resource usage (as a `struct rusage')
+ there. If the WUNTRACED bit is set in OPTIONS, return status for stopped
+ children; otherwise don't. */
+pid_t
+__wait3 (__WAIT_STATUS_DEFN stat_loc, int options, struct rusage *usage)
+{
+ if ((options & ~(WNOHANG|WUNTRACED)) != 0)
+ {
+ __set_errno (EINVAL);
+ return (pid_t) -1;
+ }
+
+ __set_errno (ENOSYS);
+ return (pid_t) -1;
+}
+stub_warning (wait3)
+
+weak_alias (__wait3, wait3)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/wait4.c b/sysdeps/generic/wait4.c
new file mode 100644
index 0000000000..b59bf87ffc
--- /dev/null
+++ b/sysdeps/generic/wait4.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <errno.h>
+
+pid_t
+__wait4 (__pid_t pid, __WAIT_STATUS stat_loc, int options,
+ struct rusage *usage)
+{
+ __set_errno (ENOSYS);
+ return (pid_t) -1;
+}
+stub_warning (wait4)
+
+weak_alias (__wait4, wait4)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/waitid.c b/sysdeps/generic/waitid.c
new file mode 100644
index 0000000000..a9de1a19a5
--- /dev/null
+++ b/sysdeps/generic/waitid.c
@@ -0,0 +1,35 @@
+/* Stub version of waitid.
+ Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int
+__waitid (idtype, id, infop, options)
+ idtype_t idtype;
+ id_t id;
+ siginfo_t *infop;
+ int options;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__waitid, waitid)
diff --git a/sysdeps/generic/waitpid.c b/sysdeps/generic/waitpid.c
new file mode 100644
index 0000000000..9c7736e669
--- /dev/null
+++ b/sysdeps/generic/waitpid.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1991,95,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+
+
+/* Wait for a child matching PID to die.
+ If PID is greater than 0, match any process whose process ID is PID.
+ If PID is (pid_t) -1, match any process.
+ If PID is (pid_t) 0, match any process with the
+ same process group as the current process.
+ If PID is less than -1, match any process whose
+ process group is the absolute value of PID.
+ If the WNOHANG bit is set in OPTIONS, and that child
+ is not already dead, return (pid_t) 0. If successful,
+ return PID and store the dead child's status in STAT_LOC.
+ Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS,
+ return status for stopped children; otherwise don't. */
+pid_t
+__libc_waitpid (pid_t pid, int *stat_loc, int options)
+{
+ if ((options & ~(WNOHANG|WUNTRACED)) != 0)
+ {
+ __set_errno (EINVAL);
+ return (pid_t) -1;
+ }
+
+ __set_errno (ENOSYS);
+ return (pid_t) -1;
+}
+weak_alias (__libc_waitpid, __waitpid)
+libc_hidden_weak (__waitpid)
+weak_alias (__libc_waitpid, waitpid)
+
+stub_warning (waitpid)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/wcstoimax.c b/sysdeps/generic/wcstoimax.c
new file mode 100644
index 0000000000..f1de70f320
--- /dev/null
+++ b/sysdeps/generic/wcstoimax.c
@@ -0,0 +1 @@
+#error "The correct implementation must be chosen based on the `intmax_t' type"
diff --git a/sysdeps/generic/wcstol.c b/sysdeps/generic/wcstol.c
new file mode 100644
index 0000000000..b121d13876
--- /dev/null
+++ b/sysdeps/generic/wcstol.c
@@ -0,0 +1,23 @@
+/* Function to parse a `long int' from text.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define USE_WIDE_CHAR 1
+
+#include <sysdeps/generic/strtol.c>
diff --git a/sysdeps/generic/wcstol_l.c b/sysdeps/generic/wcstol_l.c
new file mode 100644
index 0000000000..f1b4171f18
--- /dev/null
+++ b/sysdeps/generic/wcstol_l.c
@@ -0,0 +1,30 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_wchar_t
+#include <stddef.h>
+#include <locale.h>
+
+#define USE_WIDE_CHAR 1
+
+extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int, int,
+ __locale_t);
+
+#include "strtol_l.c"
diff --git a/sysdeps/generic/wcstoll.c b/sysdeps/generic/wcstoll.c
new file mode 100644
index 0000000000..b666762da4
--- /dev/null
+++ b/sysdeps/generic/wcstoll.c
@@ -0,0 +1,25 @@
+/* Function to parse a `long long int' from text.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define QUAD 1
+
+#include "wcstol.c"
+
+weak_alias (wcstoll, wcstoq)
diff --git a/sysdeps/generic/wcstoll_l.c b/sysdeps/generic/wcstoll_l.c
new file mode 100644
index 0000000000..f1a4ca1623
--- /dev/null
+++ b/sysdeps/generic/wcstoll_l.c
@@ -0,0 +1,30 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_wchar_t
+#include <stddef.h>
+#include <locale.h>
+
+#define QUAD 1
+
+extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
+ int, int, __locale_t);
+
+#include <wcstol_l.c>
diff --git a/sysdeps/generic/wcstoul.c b/sysdeps/generic/wcstoul.c
new file mode 100644
index 0000000000..f25f7a9bff
--- /dev/null
+++ b/sysdeps/generic/wcstoul.c
@@ -0,0 +1,23 @@
+/* Function to parse an `unsigned long int' from text.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define UNSIGNED 1
+
+#include "wcstol.c"
diff --git a/sysdeps/generic/wcstoul_l.c b/sysdeps/generic/wcstoul_l.c
new file mode 100644
index 0000000000..eeee1f0baa
--- /dev/null
+++ b/sysdeps/generic/wcstoul_l.c
@@ -0,0 +1,30 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_wchar_t
+#include <stddef.h>
+#include <locale.h>
+
+#define UNSIGNED 1
+
+extern unsigned long int ____wcstoul_l_internal (const wchar_t *, wchar_t **,
+ int, int, __locale_t);
+
+#include <wcstol_l.c>
diff --git a/sysdeps/generic/wcstoull.c b/sysdeps/generic/wcstoull.c
new file mode 100644
index 0000000000..a69a103515
--- /dev/null
+++ b/sysdeps/generic/wcstoull.c
@@ -0,0 +1,25 @@
+/* Function to parse an `unsigned long long int' from text.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define QUAD 1
+
+#include "wcstoul.c"
+
+weak_alias (wcstoull, wcstouq)
diff --git a/sysdeps/generic/wcstoull_l.c b/sysdeps/generic/wcstoull_l.c
new file mode 100644
index 0000000000..32bc3c4bb9
--- /dev/null
+++ b/sysdeps/generic/wcstoull_l.c
@@ -0,0 +1,31 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_wchar_t
+#include <stddef.h>
+#include <locale.h>
+
+#define UNSIGNED 1
+
+extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
+ wchar_t **, int, int,
+ __locale_t);
+
+#include <wcstoll_l.c>
diff --git a/sysdeps/generic/wcstoumax.c b/sysdeps/generic/wcstoumax.c
new file mode 100644
index 0000000000..508cb19f8c
--- /dev/null
+++ b/sysdeps/generic/wcstoumax.c
@@ -0,0 +1 @@
+#error "The correct implementation must be chosen based on the `uintmax_t' type"
diff --git a/sysdeps/generic/wordcopy.c b/sysdeps/generic/wordcopy.c
new file mode 100644
index 0000000000..0c9a4be4f6
--- /dev/null
+++ b/sysdeps/generic/wordcopy.c
@@ -0,0 +1,413 @@
+/* _memcopy.c -- subroutines for memory copy functions.
+ Copyright (C) 1991, 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* BE VERY CAREFUL IF YOU CHANGE THIS CODE...! */
+
+#include <stddef.h>
+#include <memcopy.h>
+
+/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
+ block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
+ Both SRCP and DSTP should be aligned for memory operations on `op_t's. */
+
+void
+_wordcopy_fwd_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ op_t a0, a1;
+
+ switch (len % 8)
+ {
+ case 2:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 6 * OPSIZ;
+ dstp -= 7 * OPSIZ;
+ len += 6;
+ goto do1;
+ case 3:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 5 * OPSIZ;
+ dstp -= 6 * OPSIZ;
+ len += 5;
+ goto do2;
+ case 4:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 4 * OPSIZ;
+ dstp -= 5 * OPSIZ;
+ len += 4;
+ goto do3;
+ case 5:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 3 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ len += 3;
+ goto do4;
+ case 6:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 2 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ len += 2;
+ goto do5;
+ case 7:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 1 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ len += 1;
+ goto do6;
+
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 0 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ goto do7;
+ case 1:
+ a1 = ((op_t *) srcp)[0];
+ srcp -=-1 * OPSIZ;
+ dstp -= 0 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do8; /* No-op. */
+ }
+
+ do
+ {
+ do8:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ do7:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = a0;
+ do6:
+ a0 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = a1;
+ do5:
+ a1 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = a0;
+ do4:
+ a0 = ((op_t *) srcp)[4];
+ ((op_t *) dstp)[4] = a1;
+ do3:
+ a1 = ((op_t *) srcp)[5];
+ ((op_t *) dstp)[5] = a0;
+ do2:
+ a0 = ((op_t *) srcp)[6];
+ ((op_t *) dstp)[6] = a1;
+ do1:
+ a1 = ((op_t *) srcp)[7];
+ ((op_t *) dstp)[7] = a0;
+
+ srcp += 8 * OPSIZ;
+ dstp += 8 * OPSIZ;
+ len -= 8;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = a1;
+}
+
+/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
+ block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
+ DSTP should be aligned for memory operations on `op_t's, but SRCP must
+ *not* be aligned. */
+
+void
+_wordcopy_fwd_dest_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ op_t a0, a1, a2, a3;
+ int sh_1, sh_2;
+
+ /* Calculate how to shift a word read at the memory operation
+ aligned srcp to make it aligned for copy. */
+
+ sh_1 = 8 * (srcp % OPSIZ);
+ sh_2 = 8 * OPSIZ - sh_1;
+
+ /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
+ it points in the middle of. */
+ srcp &= -OPSIZ;
+
+ switch (len % 4)
+ {
+ case 2:
+ a1 = ((op_t *) srcp)[0];
+ a2 = ((op_t *) srcp)[1];
+ srcp -= 1 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ len += 2;
+ goto do1;
+ case 3:
+ a0 = ((op_t *) srcp)[0];
+ a1 = ((op_t *) srcp)[1];
+ srcp -= 0 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a3 = ((op_t *) srcp)[0];
+ a0 = ((op_t *) srcp)[1];
+ srcp -=-1 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ len += 0;
+ goto do3;
+ case 1:
+ a2 = ((op_t *) srcp)[0];
+ a3 = ((op_t *) srcp)[1];
+ srcp -=-2 * OPSIZ;
+ dstp -= 0 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+
+ do
+ {
+ do4:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2);
+ do3:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = MERGE (a3, sh_1, a0, sh_2);
+ do2:
+ a2 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = MERGE (a0, sh_1, a1, sh_2);
+ do1:
+ a3 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = MERGE (a1, sh_1, a2, sh_2);
+
+ srcp += 4 * OPSIZ;
+ dstp += 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2);
+}
+
+/* _wordcopy_bwd_aligned -- Copy block finishing right before
+ SRCP to block finishing right before DSTP with LEN `op_t' words
+ (not LEN bytes!). Both SRCP and DSTP should be aligned for memory
+ operations on `op_t's. */
+
+void
+_wordcopy_bwd_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ op_t a0, a1;
+
+ switch (len % 8)
+ {
+ case 2:
+ srcp -= 2 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ a0 = ((op_t *) srcp)[1];
+ len += 6;
+ goto do1;
+ case 3:
+ srcp -= 3 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ a1 = ((op_t *) srcp)[2];
+ len += 5;
+ goto do2;
+ case 4:
+ srcp -= 4 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ a0 = ((op_t *) srcp)[3];
+ len += 4;
+ goto do3;
+ case 5:
+ srcp -= 5 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ a1 = ((op_t *) srcp)[4];
+ len += 3;
+ goto do4;
+ case 6:
+ srcp -= 6 * OPSIZ;
+ dstp -= 5 * OPSIZ;
+ a0 = ((op_t *) srcp)[5];
+ len += 2;
+ goto do5;
+ case 7:
+ srcp -= 7 * OPSIZ;
+ dstp -= 6 * OPSIZ;
+ a1 = ((op_t *) srcp)[6];
+ len += 1;
+ goto do6;
+
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ srcp -= 8 * OPSIZ;
+ dstp -= 7 * OPSIZ;
+ a0 = ((op_t *) srcp)[7];
+ goto do7;
+ case 1:
+ srcp -= 9 * OPSIZ;
+ dstp -= 8 * OPSIZ;
+ a1 = ((op_t *) srcp)[8];
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do8; /* No-op. */
+ }
+
+ do
+ {
+ do8:
+ a0 = ((op_t *) srcp)[7];
+ ((op_t *) dstp)[7] = a1;
+ do7:
+ a1 = ((op_t *) srcp)[6];
+ ((op_t *) dstp)[6] = a0;
+ do6:
+ a0 = ((op_t *) srcp)[5];
+ ((op_t *) dstp)[5] = a1;
+ do5:
+ a1 = ((op_t *) srcp)[4];
+ ((op_t *) dstp)[4] = a0;
+ do4:
+ a0 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = a1;
+ do3:
+ a1 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = a0;
+ do2:
+ a0 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = a1;
+ do1:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+
+ srcp -= 8 * OPSIZ;
+ dstp -= 8 * OPSIZ;
+ len -= 8;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[7] = a1;
+}
+
+/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
+ before SRCP to block finishing right before DSTP with LEN `op_t'
+ words (not LEN bytes!). DSTP should be aligned for memory
+ operations on `op_t', but SRCP must *not* be aligned. */
+
+void
+_wordcopy_bwd_dest_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ op_t a0, a1, a2, a3;
+ int sh_1, sh_2;
+
+ /* Calculate how to shift a word read at the memory operation
+ aligned srcp to make it aligned for copy. */
+
+ sh_1 = 8 * (srcp % OPSIZ);
+ sh_2 = 8 * OPSIZ - sh_1;
+
+ /* Make srcp aligned by rounding it down to the beginning of the op_t
+ it points in the middle of. */
+ srcp &= -OPSIZ;
+ srcp += OPSIZ;
+
+ switch (len % 4)
+ {
+ case 2:
+ srcp -= 3 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ a2 = ((op_t *) srcp)[2];
+ a1 = ((op_t *) srcp)[1];
+ len += 2;
+ goto do1;
+ case 3:
+ srcp -= 4 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ a3 = ((op_t *) srcp)[3];
+ a2 = ((op_t *) srcp)[2];
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ srcp -= 5 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ a0 = ((op_t *) srcp)[4];
+ a3 = ((op_t *) srcp)[3];
+ goto do3;
+ case 1:
+ srcp -= 6 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ a1 = ((op_t *) srcp)[5];
+ a0 = ((op_t *) srcp)[4];
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+
+ do
+ {
+ do4:
+ a3 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2);
+ do3:
+ a2 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = MERGE (a3, sh_1, a0, sh_2);
+ do2:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = MERGE (a2, sh_1, a3, sh_2);
+ do1:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = MERGE (a1, sh_1, a2, sh_2);
+
+ srcp -= 4 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2);
+}
diff --git a/sysdeps/generic/wordexp.c b/sysdeps/generic/wordexp.c
new file mode 100644
index 0000000000..3e37d6449c
--- /dev/null
+++ b/sysdeps/generic/wordexp.c
@@ -0,0 +1,2460 @@
+/* POSIX.2 wordexp implementation.
+ Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <alloca.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <fnmatch.h>
+#include <glob.h>
+#include <libintl.h>
+#include <paths.h>
+#include <pwd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#ifdef USE_IN_LIBIO
+# include <wchar.h>
+#endif
+#include <wordexp.h>
+
+#include <bits/libc-lock.h>
+#include <stdio-common/_itoa.h>
+
+/* Undefine the following line for the production version. */
+/* #define NDEBUG 1 */
+#include <assert.h>
+
+/* Get some device information. */
+#include <device-nrs.h>
+
+/*
+ * This is a recursive-descent-style word expansion routine.
+ */
+
+/* These variables are defined and initialized in the startup code. */
+extern int __libc_argc attribute_hidden;
+extern char **__libc_argv attribute_hidden;
+
+/* Some forward declarations */
+static int parse_dollars (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags,
+ wordexp_t *pwordexp, const char *ifs,
+ const char *ifs_white, int quoted)
+ internal_function;
+static int parse_backtick (char **word, size_t *word_length,
+ size_t *max_length, const char *words,
+ size_t *offset, int flags, wordexp_t *pwordexp,
+ const char *ifs, const char *ifs_white)
+ internal_function;
+static int parse_dquote (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags,
+ wordexp_t *pwordexp, const char *ifs,
+ const char *ifs_white)
+ internal_function;
+static int eval_expr (char *expr, long int *result) internal_function;
+
+/* The w_*() functions manipulate word lists. */
+
+#define W_CHUNK (100)
+
+/* Result of w_newword will be ignored if it's the last word. */
+static inline char *
+w_newword (size_t *actlen, size_t *maxlen)
+{
+ *actlen = *maxlen = 0;
+ return NULL;
+}
+
+static char *
+w_addchar (char *buffer, size_t *actlen, size_t *maxlen, char ch)
+ /* (lengths exclude trailing zero) */
+{
+ /* Add a character to the buffer, allocating room for it if needed. */
+
+ if (*actlen == *maxlen)
+ {
+ char *old_buffer = buffer;
+ assert (buffer == NULL || *maxlen != 0);
+ *maxlen += W_CHUNK;
+ buffer = (char *) realloc (buffer, 1 + *maxlen);
+
+ if (buffer == NULL)
+ free (old_buffer);
+ }
+
+ if (buffer != NULL)
+ {
+ buffer[*actlen] = ch;
+ buffer[++(*actlen)] = '\0';
+ }
+
+ return buffer;
+}
+
+static char *
+internal_function
+w_addmem (char *buffer, size_t *actlen, size_t *maxlen, const char *str,
+ size_t len)
+{
+ /* Add a string to the buffer, allocating room for it if needed.
+ */
+ if (*actlen + len > *maxlen)
+ {
+ char *old_buffer = buffer;
+ assert (buffer == NULL || *maxlen != 0);
+ *maxlen += MAX (2 * len, W_CHUNK);
+ buffer = realloc (old_buffer, 1 + *maxlen);
+
+ if (buffer == NULL)
+ free (old_buffer);
+ }
+
+ if (buffer != NULL)
+ {
+ *((char *) __mempcpy (&buffer[*actlen], str, len)) = '\0';
+ *actlen += len;
+ }
+
+ return buffer;
+}
+
+static char *
+internal_function
+w_addstr (char *buffer, size_t *actlen, size_t *maxlen, const char *str)
+ /* (lengths exclude trailing zero) */
+{
+ /* Add a string to the buffer, allocating room for it if needed.
+ */
+ size_t len;
+
+ assert (str != NULL); /* w_addstr only called from this file */
+ len = strlen (str);
+
+ return w_addmem (buffer, actlen, maxlen, str, len);
+}
+
+static int
+internal_function
+w_addword (wordexp_t *pwordexp, char *word)
+{
+ /* Add a word to the wordlist */
+ size_t num_p;
+ char **new_wordv;
+
+ /* Internally, NULL acts like "". Convert NULLs to "" before
+ * the caller sees them.
+ */
+ if (word == NULL)
+ {
+ word = __strdup ("");
+ if (word == NULL)
+ goto no_space;
+ }
+
+ num_p = 2 + pwordexp->we_wordc + pwordexp->we_offs;
+ new_wordv = realloc (pwordexp->we_wordv, sizeof (char *) * num_p);
+ if (new_wordv != NULL)
+ {
+ pwordexp->we_wordv = new_wordv;
+ pwordexp->we_wordv[pwordexp->we_offs + pwordexp->we_wordc++] = word;
+ pwordexp->we_wordv[pwordexp->we_offs + pwordexp->we_wordc] = NULL;
+ return 0;
+ }
+
+no_space:
+ return WRDE_NOSPACE;
+}
+
+/* The parse_*() functions should leave *offset being the offset in 'words'
+ * to the last character processed.
+ */
+
+static int
+internal_function
+parse_backslash (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset)
+{
+ /* We are poised _at_ a backslash, not in quotes */
+
+ switch (words[1 + *offset])
+ {
+ case 0:
+ /* Backslash is last character of input words */
+ return WRDE_SYNTAX;
+
+ case '\n':
+ ++(*offset);
+ break;
+
+ default:
+ *word = w_addchar (*word, word_length, max_length, words[1 + *offset]);
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+
+ ++(*offset);
+ break;
+ }
+
+ return 0;
+}
+
+static int
+internal_function
+parse_qtd_backslash (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset)
+{
+ /* We are poised _at_ a backslash, inside quotes */
+
+ switch (words[1 + *offset])
+ {
+ case 0:
+ /* Backslash is last character of input words */
+ return WRDE_SYNTAX;
+
+ case '\n':
+ ++(*offset);
+ break;
+
+ case '$':
+ case '`':
+ case '"':
+ case '\\':
+ *word = w_addchar (*word, word_length, max_length, words[1 + *offset]);
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+
+ ++(*offset);
+ break;
+
+ default:
+ *word = w_addchar (*word, word_length, max_length, words[*offset]);
+ if (*word != NULL)
+ *word = w_addchar (*word, word_length, max_length, words[1 + *offset]);
+
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+
+ ++(*offset);
+ break;
+ }
+
+ return 0;
+}
+
+static int
+internal_function
+parse_tilde (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, size_t wordc)
+{
+ /* We are poised _at_ a tilde */
+ size_t i;
+
+ if (*word_length != 0)
+ {
+ if (!((*word)[*word_length - 1] == '=' && wordc == 0))
+ {
+ if (!((*word)[*word_length - 1] == ':'
+ && strchr (*word, '=') && wordc == 0))
+ {
+ *word = w_addchar (*word, word_length, max_length, '~');
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+ }
+ }
+
+ for (i = 1 + *offset; words[i]; i++)
+ {
+ if (words[i] == ':' || words[i] == '/' || words[i] == ' ' ||
+ words[i] == '\t' || words[i] == 0 )
+ break;
+
+ if (words[i] == '\\')
+ {
+ *word = w_addchar (*word, word_length, max_length, '~');
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+ }
+
+ if (i == 1 + *offset)
+ {
+ /* Tilde appears on its own */
+ uid_t uid;
+ struct passwd pwd, *tpwd;
+ int buflen = 1000;
+ char* home;
+ char* buffer;
+ int result;
+
+ /* POSIX.2 says ~ expands to $HOME and if HOME is unset the
+ results are unspecified. We do a lookup on the uid if
+ HOME is unset. */
+
+ home = getenv ("HOME");
+ if (home != NULL)
+ {
+ *word = w_addstr (*word, word_length, max_length, home);
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+ }
+ else
+ {
+ uid = __getuid ();
+ buffer = __alloca (buflen);
+
+ while ((result = __getpwuid_r (uid, &pwd, buffer, buflen, &tpwd)) != 0
+ && errno == ERANGE)
+ buffer = extend_alloca (buffer, buflen, buflen + 1000);
+
+ if (result == 0 && tpwd != NULL && pwd.pw_dir != NULL)
+ {
+ *word = w_addstr (*word, word_length, max_length, pwd.pw_dir);
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+ }
+ else
+ {
+ *word = w_addchar (*word, word_length, max_length, '~');
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+ }
+ }
+ }
+ else
+ {
+ /* Look up user name in database to get home directory */
+ char *user = strndupa (&words[1 + *offset], i - (1 + *offset));
+ struct passwd pwd, *tpwd;
+ int buflen = 1000;
+ char* buffer = __alloca (buflen);
+ int result;
+
+ while ((result = __getpwnam_r (user, &pwd, buffer, buflen, &tpwd)) != 0
+ && errno == ERANGE)
+ buffer = extend_alloca (buffer, buflen, buflen + 1000);
+
+ if (result == 0 && tpwd != NULL && pwd.pw_dir)
+ *word = w_addstr (*word, word_length, max_length, pwd.pw_dir);
+ else
+ {
+ /* (invalid login name) */
+ *word = w_addchar (*word, word_length, max_length, '~');
+ if (*word != NULL)
+ *word = w_addstr (*word, word_length, max_length, user);
+ }
+
+ *offset = i - 1;
+ }
+ return *word ? 0 : WRDE_NOSPACE;
+}
+
+
+static int
+internal_function
+do_parse_glob (const char *glob_word, char **word, size_t *word_length,
+ size_t *max_length, wordexp_t *pwordexp, const char *ifs,
+ const char *ifs_white)
+{
+ int error;
+ unsigned int match;
+ glob_t globbuf;
+
+ error = glob (glob_word, GLOB_NOCHECK, NULL, &globbuf);
+
+ if (error != 0)
+ {
+ /* We can only run into memory problems. */
+ assert (error == GLOB_NOSPACE);
+ return WRDE_NOSPACE;
+ }
+
+ if (ifs && !*ifs)
+ {
+ /* No field splitting allowed. */
+ assert (globbuf.gl_pathv[0] != NULL);
+ *word = w_addstr (*word, word_length, max_length, globbuf.gl_pathv[0]);
+ for (match = 1; match < globbuf.gl_pathc && *word != NULL; ++match)
+ {
+ *word = w_addchar (*word, word_length, max_length, ' ');
+ if (*word != NULL)
+ *word = w_addstr (*word, word_length, max_length,
+ globbuf.gl_pathv[match]);
+ }
+
+ globfree (&globbuf);
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+
+ assert (ifs == NULL || *ifs != '\0');
+ if (*word != NULL)
+ {
+ free (*word);
+ *word = w_newword (word_length, max_length);
+ }
+
+ for (match = 0; match < globbuf.gl_pathc; ++match)
+ {
+ char *matching_word = __strdup (globbuf.gl_pathv[match]);
+ if (matching_word == NULL || w_addword (pwordexp, matching_word))
+ {
+ globfree (&globbuf);
+ return WRDE_NOSPACE;
+ }
+ }
+
+ globfree (&globbuf);
+ return 0;
+}
+
+static int
+internal_function
+parse_glob (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags,
+ wordexp_t *pwordexp, const char *ifs, const char *ifs_white)
+{
+ /* We are poised just after a '*', a '[' or a '?'. */
+ int error = WRDE_NOSPACE;
+ int quoted = 0; /* 1 if singly-quoted, 2 if doubly */
+ size_t i;
+ wordexp_t glob_list; /* List of words to glob */
+
+ glob_list.we_wordc = 0;
+ glob_list.we_wordv = NULL;
+ glob_list.we_offs = 0;
+ for (; words[*offset] != '\0'; ++*offset)
+ {
+ if ((ifs && strchr (ifs, words[*offset])) ||
+ (!ifs && strchr (" \t\n", words[*offset])))
+ /* Reached IFS */
+ break;
+
+ /* Sort out quoting */
+ if (words[*offset] == '\'')
+ {
+ if (quoted == 0)
+ {
+ quoted = 1;
+ continue;
+ }
+ else if (quoted == 1)
+ {
+ quoted = 0;
+ continue;
+ }
+ }
+ else if (words[*offset] == '"')
+ {
+ if (quoted == 0)
+ {
+ quoted = 2;
+ continue;
+ }
+ else if (quoted == 2)
+ {
+ quoted = 0;
+ continue;
+ }
+ }
+
+ /* Sort out other special characters */
+ if (quoted != 1 && words[*offset] == '$')
+ {
+ error = parse_dollars (word, word_length, max_length, words,
+ offset, flags, &glob_list, ifs, ifs_white,
+ quoted == 2);
+ if (error)
+ goto tidy_up;
+
+ continue;
+ }
+ else if (words[*offset] == '\\')
+ {
+ if (quoted)
+ error = parse_qtd_backslash (word, word_length, max_length,
+ words, offset);
+ else
+ error = parse_backslash (word, word_length, max_length,
+ words, offset);
+
+ if (error)
+ goto tidy_up;
+
+ continue;
+ }
+
+ *word = w_addchar (*word, word_length, max_length, words[*offset]);
+ if (*word == NULL)
+ goto tidy_up;
+ }
+
+ /* Don't forget to re-parse the character we stopped at. */
+ --*offset;
+
+ /* Glob the words */
+ error = w_addword (&glob_list, *word);
+ *word = w_newword (word_length, max_length);
+ for (i = 0; error == 0 && i < glob_list.we_wordc; i++)
+ error = do_parse_glob (glob_list.we_wordv[i], word, word_length,
+ max_length, pwordexp, ifs, ifs_white);
+
+ /* Now tidy up */
+tidy_up:
+ wordfree (&glob_list);
+ return error;
+}
+
+static int
+internal_function
+parse_squote (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset)
+{
+ /* We are poised just after a single quote */
+ for (; words[*offset]; ++(*offset))
+ {
+ if (words[*offset] != '\'')
+ {
+ *word = w_addchar (*word, word_length, max_length, words[*offset]);
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+ }
+ else return 0;
+ }
+
+ /* Unterminated string */
+ return WRDE_SYNTAX;
+}
+
+/* Functions to evaluate an arithmetic expression */
+static int
+internal_function
+eval_expr_val (char **expr, long int *result)
+{
+ char *digit;
+
+ /* Skip white space */
+ for (digit = *expr; digit && *digit && isspace (*digit); ++digit);
+
+ if (*digit == '(')
+ {
+ /* Scan for closing paren */
+ for (++digit; **expr && **expr != ')'; ++(*expr));
+
+ /* Is there one? */
+ if (!**expr)
+ return WRDE_SYNTAX;
+
+ *(*expr)++ = 0;
+
+ if (eval_expr (digit, result))
+ return WRDE_SYNTAX;
+
+ return 0;
+ }
+
+ /* POSIX requires that decimal, octal, and hexadecimal constants are
+ recognized. Therefore we pass 0 as the third parameter to strtol. */
+ *result = strtol (digit, expr, 0);
+ if (digit == *expr)
+ return WRDE_SYNTAX;
+
+ return 0;
+}
+
+static int
+internal_function
+eval_expr_multdiv (char **expr, long int *result)
+{
+ long int arg;
+
+ /* Read a Value */
+ if (eval_expr_val (expr, result) != 0)
+ return WRDE_SYNTAX;
+
+ while (**expr)
+ {
+ /* Skip white space */
+ for (; *expr && **expr && isspace (**expr); ++(*expr));
+
+ if (**expr == '*')
+ {
+ ++(*expr);
+ if (eval_expr_val (expr, &arg) != 0)
+ return WRDE_SYNTAX;
+
+ *result *= arg;
+ }
+ else if (**expr == '/')
+ {
+ ++(*expr);
+ if (eval_expr_val (expr, &arg) != 0)
+ return WRDE_SYNTAX;
+
+ *result /= arg;
+ }
+ else break;
+ }
+
+ return 0;
+}
+
+static int
+internal_function
+eval_expr (char *expr, long int *result)
+{
+ long int arg;
+
+ /* Read a Multdiv */
+ if (eval_expr_multdiv (&expr, result) != 0)
+ return WRDE_SYNTAX;
+
+ while (*expr)
+ {
+ /* Skip white space */
+ for (; expr && *expr && isspace (*expr); ++expr);
+
+ if (*expr == '+')
+ {
+ ++expr;
+ if (eval_expr_multdiv (&expr, &arg) != 0)
+ return WRDE_SYNTAX;
+
+ *result += arg;
+ }
+ else if (*expr == '-')
+ {
+ ++expr;
+ if (eval_expr_multdiv (&expr, &arg) != 0)
+ return WRDE_SYNTAX;
+
+ *result -= arg;
+ }
+ else break;
+ }
+
+ return 0;
+}
+
+static int
+internal_function
+parse_arith (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags, int bracket)
+{
+ /* We are poised just after "$((" or "$[" */
+ int error;
+ int paren_depth = 1;
+ size_t expr_length;
+ size_t expr_maxlen;
+ char *expr;
+
+ expr = w_newword (&expr_length, &expr_maxlen);
+ for (; words[*offset]; ++(*offset))
+ {
+ switch (words[*offset])
+ {
+ case '$':
+ error = parse_dollars (&expr, &expr_length, &expr_maxlen,
+ words, offset, flags, NULL, NULL, NULL, 1);
+ /* The ``1'' here is to tell parse_dollars not to
+ * split the fields.
+ */
+ if (error)
+ {
+ free (expr);
+ return error;
+ }
+ break;
+
+ case '`':
+ (*offset)++;
+ error = parse_backtick (&expr, &expr_length, &expr_maxlen,
+ words, offset, flags, NULL, NULL, NULL);
+ /* The first NULL here is to tell parse_backtick not to
+ * split the fields.
+ */
+ if (error)
+ {
+ free (expr);
+ return error;
+ }
+ break;
+
+ case '\\':
+ error = parse_qtd_backslash (&expr, &expr_length, &expr_maxlen,
+ words, offset);
+ if (error)
+ {
+ free (expr);
+ return error;
+ }
+ /* I think that a backslash within an
+ * arithmetic expansion is bound to
+ * cause an error sooner or later anyway though.
+ */
+ break;
+
+ case ')':
+ if (--paren_depth == 0)
+ {
+ char result[21]; /* 21 = ceil(log10(2^64)) + 1 */
+ long int numresult = 0;
+ long long int convertme;
+
+ if (bracket || words[1 + *offset] != ')')
+ {
+ free (expr);
+ return WRDE_SYNTAX;
+ }
+
+ ++(*offset);
+
+ /* Go - evaluate. */
+ if (*expr && eval_expr (expr, &numresult) != 0)
+ {
+ free (expr);
+ return WRDE_SYNTAX;
+ }
+
+ if (numresult < 0)
+ {
+ convertme = -numresult;
+ *word = w_addchar (*word, word_length, max_length, '-');
+ if (!*word)
+ {
+ free (expr);
+ return WRDE_NOSPACE;
+ }
+ }
+ else
+ convertme = numresult;
+
+ result[20] = '\0';
+ *word = w_addstr (*word, word_length, max_length,
+ _itoa (convertme, &result[20], 10, 0));
+ free (expr);
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+ expr = w_addchar (expr, &expr_length, &expr_maxlen, words[*offset]);
+ if (expr == NULL)
+ return WRDE_NOSPACE;
+
+ break;
+
+ case ']':
+ if (bracket && paren_depth == 1)
+ {
+ char result[21]; /* 21 = ceil(log10(2^64)) + 1 */
+ long int numresult = 0;
+
+ /* Go - evaluate. */
+ if (*expr && eval_expr (expr, &numresult) != 0)
+ {
+ free (expr);
+ return WRDE_SYNTAX;
+ }
+
+ result[20] = '\0';
+ *word = w_addstr (*word, word_length, max_length,
+ _itoa_word (numresult, &result[20], 10, 0));
+ free (expr);
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+
+ free (expr);
+ return WRDE_SYNTAX;
+
+ case '\n':
+ case ';':
+ case '{':
+ case '}':
+ free (expr);
+ return WRDE_BADCHAR;
+
+ case '(':
+ ++paren_depth;
+ default:
+ expr = w_addchar (expr, &expr_length, &expr_maxlen, words[*offset]);
+ if (expr == NULL)
+ return WRDE_NOSPACE;
+ }
+ }
+
+ /* Premature end */
+ free (expr);
+ return WRDE_SYNTAX;
+}
+
+/* Function called by child process in exec_comm() */
+static void
+internal_function
+exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
+{
+ const char *args[4] = { _PATH_BSHELL, "-c", comm, NULL };
+
+ /* Execute the command, or just check syntax? */
+ if (noexec)
+ args[1] = "-nc";
+
+ /* Redirect output. */
+ __dup2 (fildes[1], STDOUT_FILENO);
+ __close (fildes[1]);
+
+ /* Redirect stderr to /dev/null if we have to. */
+ if (showerr == 0)
+ {
+ struct stat64 st;
+ int fd;
+ __close (2);
+ fd = __open (_PATH_DEVNULL, O_WRONLY);
+ if (fd >= 0 && fd != 2)
+ {
+ __dup2 (fd, STDERR_FILENO);
+ __close (fd);
+ }
+ /* Be paranoid. Check that we actually opened the /dev/null
+ device. */
+ if (__builtin_expect (__fxstat64 (_STAT_VER, STDERR_FILENO, &st), 0) != 0
+ || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
+#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
+ || st.st_rdev != makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)
+#endif
+ )
+ /* It's not the /dev/null device. Stop right here. The
+ problem is: how do we stop? We use _exit() with an
+ hopefully unusual exit code. */
+ _exit (90);
+ }
+
+ /* Make sure the subshell doesn't field-split on our behalf. */
+ __unsetenv ("IFS");
+
+ __close (fildes[0]);
+ __execve (_PATH_BSHELL, (char *const *) args, __environ);
+
+ /* Bad. What now? */
+ abort ();
+}
+
+/* Function to execute a command and retrieve the results */
+/* pwordexp contains NULL if field-splitting is forbidden */
+static int
+internal_function
+exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
+ int flags, wordexp_t *pwordexp, const char *ifs,
+ const char *ifs_white)
+{
+ int fildes[2];
+ int bufsize = 128;
+ int buflen;
+ int i;
+ int status = 0;
+ size_t maxnewlines = 0;
+ char *buffer;
+ pid_t pid;
+
+ /* Don't fork() unless necessary */
+ if (!comm || !*comm)
+ return 0;
+
+ if (__pipe (fildes))
+ /* Bad */
+ return WRDE_NOSPACE;
+
+ if ((pid = __fork ()) < 0)
+ {
+ /* Bad */
+ __close (fildes[0]);
+ __close (fildes[1]);
+ return WRDE_NOSPACE;
+ }
+
+ if (pid == 0)
+ exec_comm_child (comm, fildes, flags & WRDE_SHOWERR, 0);
+
+ /* Parent */
+
+ __close (fildes[1]);
+ buffer = __alloca (bufsize);
+
+ if (!pwordexp)
+ /* Quoted - no field splitting */
+ {
+ while (1)
+ {
+ if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
+ {
+ if (__waitpid (pid, &status, WNOHANG) == 0)
+ continue;
+ if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
+ break;
+ }
+
+ maxnewlines += buflen;
+
+ *word = w_addmem (*word, word_length, max_length, buffer, buflen);
+ if (*word == NULL)
+ goto no_space;
+ }
+ }
+ else
+ /* Not quoted - split fields */
+ {
+ int copying = 0;
+ /* 'copying' is:
+ * 0 when searching for first character in a field not IFS white space
+ * 1 when copying the text of a field
+ * 2 when searching for possible non-whitespace IFS
+ * 3 when searching for non-newline after copying field
+ */
+
+ while (1)
+ {
+ if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
+ {
+ if (__waitpid (pid, &status, WNOHANG) == 0)
+ continue;
+ if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
+ break;
+ }
+
+ for (i = 0; i < buflen; ++i)
+ {
+ if (strchr (ifs, buffer[i]) != NULL)
+ {
+ /* Current character is IFS */
+ if (strchr (ifs_white, buffer[i]) == NULL)
+ {
+ /* Current character is IFS but not whitespace */
+ if (copying == 2)
+ {
+ /* current character
+ * |
+ * V
+ * eg: text<space><comma><space>moretext
+ *
+ * So, strip whitespace IFS (like at the start)
+ */
+ copying = 0;
+ continue;
+ }
+
+ copying = 0;
+ /* fall through and delimit field.. */
+ }
+ else
+ {
+ if (buffer[i] == '\n')
+ {
+ /* Current character is (IFS) newline */
+
+ /* If copying a field, this is the end of it,
+ but maybe all that's left is trailing newlines.
+ So start searching for a non-newline. */
+ if (copying == 1)
+ copying = 3;
+
+ continue;
+ }
+ else
+ {
+ /* Current character is IFS white space, but
+ not a newline */
+
+ /* If not either copying a field or searching
+ for non-newline after a field, ignore it */
+ if (copying != 1 && copying != 3)
+ continue;
+
+ /* End of field (search for non-ws IFS afterwards) */
+ copying = 2;
+ }
+ }
+
+ /* First IFS white space (non-newline), or IFS non-whitespace.
+ * Delimit the field. Nulls are converted by w_addword. */
+ if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
+ goto no_space;
+
+ *word = w_newword (word_length, max_length);
+
+ maxnewlines = 0;
+ /* fall back round the loop.. */
+ }
+ else
+ {
+ /* Not IFS character */
+
+ if (copying == 3)
+ {
+ /* Nothing but (IFS) newlines since the last field,
+ so delimit it here before starting new word */
+ if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
+ goto no_space;
+
+ *word = w_newword (word_length, max_length);
+ }
+
+ copying = 1;
+
+ if (buffer[i] == '\n') /* happens if newline not in IFS */
+ maxnewlines++;
+ else
+ maxnewlines = 0;
+
+ *word = w_addchar (*word, word_length, max_length,
+ buffer[i]);
+ if (*word == NULL)
+ goto no_space;
+ }
+ }
+ }
+ }
+
+ /* Chop off trailing newlines (required by POSIX.2) */
+ /* Ensure we don't go back further than the beginning of the
+ substitution (i.e. remove maxnewlines bytes at most) */
+ while (maxnewlines-- != 0 &&
+ *word_length > 0 && (*word)[*word_length - 1] == '\n')
+ {
+ (*word)[--*word_length] = '\0';
+
+ /* If the last word was entirely newlines, turn it into a new word
+ * which can be ignored if there's nothing following it. */
+ if (*word_length == 0)
+ {
+ free (*word);
+ *word = w_newword (word_length, max_length);
+ break;
+ }
+ }
+
+ __close (fildes[0]);
+
+ /* Check for syntax error (re-execute but with "-n" flag) */
+ if (buflen < 1 && status != 0)
+ {
+ if ((pid = __fork ()) < 0)
+ {
+ /* Bad */
+ return WRDE_NOSPACE;
+ }
+
+ if (pid == 0)
+ {
+ fildes[0] = fildes[1] = -1;
+ exec_comm_child (comm, fildes, 0, 1);
+ }
+
+ if (__waitpid (pid, &status, 0) == pid && status != 0)
+ return WRDE_SYNTAX;
+ }
+
+ return 0;
+
+no_space:
+ __kill (pid, SIGKILL);
+ __waitpid (pid, NULL, 0);
+ __close (fildes[0]);
+ return WRDE_NOSPACE;
+}
+
+static int
+internal_function
+parse_comm (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
+ const char *ifs, const char *ifs_white)
+{
+ /* We are poised just after "$(" */
+ int paren_depth = 1;
+ int error = 0;
+ int quoted = 0; /* 1 for singly-quoted, 2 for doubly-quoted */
+ size_t comm_length;
+ size_t comm_maxlen;
+ char *comm = w_newword (&comm_length, &comm_maxlen);
+
+ for (; words[*offset]; ++(*offset))
+ {
+ switch (words[*offset])
+ {
+ case '\'':
+ if (quoted == 0)
+ quoted = 1;
+ else if (quoted == 1)
+ quoted = 0;
+
+ break;
+
+ case '"':
+ if (quoted == 0)
+ quoted = 2;
+ else if (quoted == 2)
+ quoted = 0;
+
+ break;
+
+ case ')':
+ if (!quoted && --paren_depth == 0)
+ {
+ /* Go -- give script to the shell */
+ if (comm)
+ {
+#ifdef __libc_ptf_call
+ /* We do not want the exec_comm call to be cut short
+ by a thread cancellation since cleanup is very
+ ugly. Therefore disable cancellation for
+ now. */
+ // XXX Ideally we do want the thread being cancelable.
+ // XXX If demand is there we'll change it.
+ int state = PTHREAD_CANCEL_ENABLE;
+ __libc_ptf_call (pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state), 0);
+#endif
+
+ error = exec_comm (comm, word, word_length, max_length,
+ flags, pwordexp, ifs, ifs_white);
+
+#ifdef __libc_ptf_call
+ __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+#endif
+
+ free (comm);
+ }
+
+ return error;
+ }
+
+ /* This is just part of the script */
+ break;
+
+ case '(':
+ if (!quoted)
+ ++paren_depth;
+ }
+
+ comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
+ if (comm == NULL)
+ return WRDE_NOSPACE;
+ }
+
+ /* Premature end */
+ if (comm)
+ free (comm);
+
+ return WRDE_SYNTAX;
+}
+
+static int
+internal_function
+parse_param (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
+ const char *ifs, const char *ifs_white, int quoted)
+{
+ /* We are poised just after "$" */
+ enum action
+ {
+ ACT_NONE,
+ ACT_RP_SHORT_LEFT = '#',
+ ACT_RP_LONG_LEFT = 'L',
+ ACT_RP_SHORT_RIGHT = '%',
+ ACT_RP_LONG_RIGHT = 'R',
+ ACT_NULL_ERROR = '?',
+ ACT_NULL_SUBST = '-',
+ ACT_NONNULL_SUBST = '+',
+ ACT_NULL_ASSIGN = '='
+ };
+ size_t env_length;
+ size_t env_maxlen;
+ size_t pat_length;
+ size_t pat_maxlen;
+ size_t start = *offset;
+ char *env;
+ char *pattern;
+ char *value = NULL;
+ enum action action = ACT_NONE;
+ int depth = 0;
+ int colon_seen = 0;
+ int seen_hash = 0;
+ int free_value = 0;
+ int pattern_is_quoted = 0; /* 1 for singly-quoted, 2 for doubly-quoted */
+ int error;
+ int special = 0;
+ char buffer[21];
+ int brace = words[*offset] == '{';
+
+ env = w_newword (&env_length, &env_maxlen);
+ pattern = w_newword (&pat_length, &pat_maxlen);
+
+ if (brace)
+ ++*offset;
+
+ /* First collect the parameter name. */
+
+ if (words[*offset] == '#')
+ {
+ seen_hash = 1;
+ if (!brace)
+ goto envsubst;
+ ++*offset;
+ }
+
+ if (isalpha (words[*offset]) || words[*offset] == '_')
+ {
+ /* Normal parameter name. */
+ do
+ {
+ env = w_addchar (env, &env_length, &env_maxlen,
+ words[*offset]);
+ if (env == NULL)
+ goto no_space;
+ }
+ while (isalnum (words[++*offset]) || words[*offset] == '_');
+ }
+ else if (isdigit (words[*offset]))
+ {
+ /* Numeric parameter name. */
+ special = 1;
+ do
+ {
+ env = w_addchar (env, &env_length, &env_maxlen,
+ words[*offset]);
+ if (env == NULL)
+ goto no_space;
+ if (!brace)
+ goto envsubst;
+ }
+ while (isdigit(words[++*offset]));
+ }
+ else if (strchr ("*@$", words[*offset]) != NULL)
+ {
+ /* Special parameter. */
+ special = 1;
+ env = w_addchar (env, &env_length, &env_maxlen,
+ words[*offset]);
+ if (env == NULL)
+ goto no_space;
+ ++*offset;
+ }
+ else
+ {
+ if (brace)
+ goto syntax;
+ }
+
+ if (brace)
+ {
+ /* Check for special action to be applied to the value. */
+ switch (words[*offset])
+ {
+ case '}':
+ /* Evaluate. */
+ goto envsubst;
+
+ case '#':
+ action = ACT_RP_SHORT_LEFT;
+ if (words[1 + *offset] == '#')
+ {
+ ++*offset;
+ action = ACT_RP_LONG_LEFT;
+ }
+ break;
+
+ case '%':
+ action = ACT_RP_SHORT_RIGHT;
+ if (words[1 + *offset] == '%')
+ {
+ ++*offset;
+ action = ACT_RP_LONG_RIGHT;
+ }
+ break;
+
+ case ':':
+ if (strchr ("-=?+", words[1 + *offset]) == NULL)
+ goto syntax;
+
+ colon_seen = 1;
+ action = words[++*offset];
+ break;
+
+ case '-':
+ case '=':
+ case '?':
+ case '+':
+ action = words[*offset];
+ break;
+
+ default:
+ goto syntax;
+ }
+
+ /* Now collect the pattern, but don't expand it yet. */
+ ++*offset;
+ for (; words[*offset]; ++(*offset))
+ {
+ switch (words[*offset])
+ {
+ case '{':
+ if (!pattern_is_quoted)
+ ++depth;
+ break;
+
+ case '}':
+ if (!pattern_is_quoted)
+ {
+ if (depth == 0)
+ goto envsubst;
+ --depth;
+ }
+ break;
+
+ case '\\':
+ if (pattern_is_quoted)
+ /* Quoted; treat as normal character. */
+ break;
+
+ /* Otherwise, it's an escape: next character is literal. */
+ if (words[++*offset] == '\0')
+ goto syntax;
+
+ pattern = w_addchar (pattern, &pat_length, &pat_maxlen, '\\');
+ if (pattern == NULL)
+ goto no_space;
+
+ break;
+
+ case '\'':
+ if (pattern_is_quoted == 0)
+ pattern_is_quoted = 1;
+ else if (pattern_is_quoted == 1)
+ pattern_is_quoted = 0;
+
+ break;
+
+ case '"':
+ if (pattern_is_quoted == 0)
+ pattern_is_quoted = 2;
+ else if (pattern_is_quoted == 2)
+ pattern_is_quoted = 0;
+
+ break;
+ }
+
+ pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
+ words[*offset]);
+ if (pattern == NULL)
+ goto no_space;
+ }
+ }
+
+ /* End of input string -- remember to reparse the character that we
+ * stopped at. */
+ --(*offset);
+
+envsubst:
+ if (words[start] == '{' && words[*offset] != '}')
+ goto syntax;
+
+ if (env == NULL)
+ {
+ if (seen_hash)
+ {
+ /* $# expands to the number of positional parameters */
+ buffer[20] = '\0';
+ value = _itoa_word (__libc_argc - 1, &buffer[20], 10, 0);
+ seen_hash = 0;
+ }
+ else
+ {
+ /* Just $ on its own */
+ *offset = start - 1;
+ *word = w_addchar (*word, word_length, max_length, '$');
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+ }
+ /* Is it a numeric parameter? */
+ else if (isdigit (env[0]))
+ {
+ int n = atoi (env);
+
+ if (n >= __libc_argc)
+ /* Substitute NULL. */
+ value = NULL;
+ else
+ /* Replace with appropriate positional parameter. */
+ value = __libc_argv[n];
+ }
+ /* Is it a special parameter? */
+ else if (special)
+ {
+ /* Is it `$$'? */
+ if (*env == '$')
+ {
+ buffer[20] = '\0';
+ value = _itoa_word (__getpid (), &buffer[20], 10, 0);
+ }
+ /* Is it `${#*}' or `${#@}'? */
+ else if ((*env == '*' || *env == '@') && seen_hash)
+ {
+ buffer[20] = '\0';
+ value = _itoa_word (__libc_argc > 0 ? __libc_argc - 1 : 0,
+ &buffer[20], 10, 0);
+ *word = w_addstr (*word, word_length, max_length, value);
+ free (env);
+ if (pattern)
+ free (pattern);
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+ /* Is it `$*' or `$@' (unquoted) ? */
+ else if (*env == '*' || (*env == '@' && !quoted))
+ {
+ size_t plist_len = 0;
+ int p;
+ char *end;
+
+ /* Build up value parameter by parameter (copy them) */
+ for (p = 1; __libc_argv[p]; ++p)
+ plist_len += strlen (__libc_argv[p]) + 1; /* for space */
+ value = malloc (plist_len);
+ if (value == NULL)
+ goto no_space;
+ end = value;
+ *end = 0;
+ for (p = 1; __libc_argv[p]; ++p)
+ {
+ if (p > 1)
+ *end++ = ' ';
+ end = __stpcpy (end, __libc_argv[p]);
+ }
+
+ free_value = 1;
+ }
+ else
+ {
+ /* Must be a quoted `$@' */
+ assert (*env == '@' && quoted);
+
+ /* Each parameter is a separate word ("$@") */
+ if (__libc_argc == 2)
+ value = __libc_argv[1];
+ else if (__libc_argc > 2)
+ {
+ int p;
+
+ /* Append first parameter to current word. */
+ value = w_addstr (*word, word_length, max_length,
+ __libc_argv[1]);
+ if (value == NULL || w_addword (pwordexp, value))
+ goto no_space;
+
+ for (p = 2; __libc_argv[p + 1]; p++)
+ {
+ char *newword = __strdup (__libc_argv[p]);
+ if (newword == NULL || w_addword (pwordexp, newword))
+ goto no_space;
+ }
+
+ /* Start a new word with the last parameter. */
+ *word = w_newword (word_length, max_length);
+ value = __libc_argv[p];
+ }
+ else
+ {
+ free (env);
+ free (pattern);
+ return 0;
+ }
+ }
+ }
+ else
+ value = getenv (env);
+
+ if (value == NULL && (flags & WRDE_UNDEF))
+ {
+ /* Variable not defined. */
+ error = WRDE_BADVAL;
+ goto do_error;
+ }
+
+ if (action != ACT_NONE)
+ {
+ int expand_pattern = 0;
+
+ /* First, find out if we need to expand pattern (i.e. if we will
+ * use it). */
+ switch (action)
+ {
+ case ACT_RP_SHORT_LEFT:
+ case ACT_RP_LONG_LEFT:
+ case ACT_RP_SHORT_RIGHT:
+ case ACT_RP_LONG_RIGHT:
+ /* Always expand for these. */
+ expand_pattern = 1;
+ break;
+
+ case ACT_NULL_ERROR:
+ case ACT_NULL_SUBST:
+ case ACT_NULL_ASSIGN:
+ if (!value || (!*value && colon_seen))
+ /* If param is unset, or set but null and a colon has been seen,
+ the expansion of the pattern will be needed. */
+ expand_pattern = 1;
+
+ break;
+
+ case ACT_NONNULL_SUBST:
+ /* Expansion of word will be needed if parameter is set and not null,
+ or set null but no colon has been seen. */
+ if (value && (*value || !colon_seen))
+ expand_pattern = 1;
+
+ break;
+
+ default:
+ assert (! "Unrecognised action!");
+ }
+
+ if (expand_pattern)
+ {
+ /* We need to perform tilde expansion, parameter expansion,
+ command substitution, and arithmetic expansion. We also
+ have to be a bit careful with wildcard characters, as
+ pattern might be given to fnmatch soon. To do this, we
+ convert quotes to escapes. */
+
+ char *expanded;
+ size_t exp_len;
+ size_t exp_maxl;
+ char *p;
+ int quoted = 0; /* 1: single quotes; 2: double */
+
+ expanded = w_newword (&exp_len, &exp_maxl);
+ for (p = pattern; p && *p; p++)
+ {
+ size_t offset;
+
+ switch (*p)
+ {
+ case '"':
+ if (quoted == 2)
+ quoted = 0;
+ else if (quoted == 0)
+ quoted = 2;
+ else break;
+
+ continue;
+
+ case '\'':
+ if (quoted == 1)
+ quoted = 0;
+ else if (quoted == 0)
+ quoted = 1;
+ else break;
+
+ continue;
+
+ case '*':
+ case '?':
+ if (quoted)
+ {
+ /* Convert quoted wildchar to escaped wildchar. */
+ expanded = w_addchar (expanded, &exp_len,
+ &exp_maxl, '\\');
+
+ if (expanded == NULL)
+ goto no_space;
+ }
+ break;
+
+ case '$':
+ offset = 0;
+ error = parse_dollars (&expanded, &exp_len, &exp_maxl, p,
+ &offset, flags, NULL, NULL, NULL, 1);
+ if (error)
+ {
+ if (free_value)
+ free (value);
+
+ if (expanded)
+ free (expanded);
+
+ goto do_error;
+ }
+
+ p += offset;
+ continue;
+
+ case '~':
+ if (quoted || exp_len)
+ break;
+
+ offset = 0;
+ error = parse_tilde (&expanded, &exp_len, &exp_maxl, p,
+ &offset, 0);
+ if (error)
+ {
+ if (free_value)
+ free (value);
+
+ if (expanded)
+ free (expanded);
+
+ goto do_error;
+ }
+
+ p += offset;
+ continue;
+
+ case '\\':
+ expanded = w_addchar (expanded, &exp_len, &exp_maxl, '\\');
+ ++p;
+ assert (*p); /* checked when extracted initially */
+ if (expanded == NULL)
+ goto no_space;
+ }
+
+ expanded = w_addchar (expanded, &exp_len, &exp_maxl, *p);
+
+ if (expanded == NULL)
+ goto no_space;
+ }
+
+ if (pattern)
+ free (pattern);
+
+ pattern = expanded;
+ }
+
+ switch (action)
+ {
+ case ACT_RP_SHORT_LEFT:
+ case ACT_RP_LONG_LEFT:
+ case ACT_RP_SHORT_RIGHT:
+ case ACT_RP_LONG_RIGHT:
+ {
+ char *p;
+ char c;
+ char *end;
+
+ if (value == NULL || pattern == NULL || *pattern == '\0')
+ break;
+
+ end = value + strlen (value);
+
+ switch (action)
+ {
+ case ACT_RP_SHORT_LEFT:
+ for (p = value; p <= end; ++p)
+ {
+ c = *p;
+ *p = '\0';
+ if (fnmatch (pattern, value, 0) != FNM_NOMATCH)
+ {
+ *p = c;
+ if (free_value)
+ {
+ char *newval = __strdup (p);
+ if (newval == NULL)
+ {
+ free (value);
+ goto no_space;
+ }
+ free (value);
+ value = newval;
+ }
+ else
+ value = p;
+ break;
+ }
+ *p = c;
+ }
+
+ break;
+
+ case ACT_RP_LONG_LEFT:
+ for (p = end; p >= value; --p)
+ {
+ c = *p;
+ *p = '\0';
+ if (fnmatch (pattern, value, 0) != FNM_NOMATCH)
+ {
+ *p = c;
+ if (free_value)
+ {
+ char *newval = __strdup (p);
+ if (newval == NULL)
+ {
+ free (value);
+ goto no_space;
+ }
+ free (value);
+ value = newval;
+ }
+ else
+ value = p;
+ break;
+ }
+ *p = c;
+ }
+
+ break;
+
+ case ACT_RP_SHORT_RIGHT:
+ for (p = end; p >= value; --p)
+ {
+ if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
+ {
+ char *newval;
+ newval = malloc (p - value + 1);
+
+ if (newval == NULL)
+ {
+ if (free_value)
+ free (value);
+ goto no_space;
+ }
+
+ *(char *) __mempcpy (newval, value, p - value) = '\0';
+ if (free_value)
+ free (value);
+ value = newval;
+ free_value = 1;
+ break;
+ }
+ }
+
+ break;
+
+ case ACT_RP_LONG_RIGHT:
+ for (p = value; p <= end; ++p)
+ {
+ if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
+ {
+ char *newval;
+ newval = malloc (p - value + 1);
+
+ if (newval == NULL)
+ {
+ if (free_value)
+ free (value);
+ goto no_space;
+ }
+
+ *(char *) __mempcpy (newval, value, p - value) = '\0';
+ if (free_value)
+ free (value);
+ value = newval;
+ free_value = 1;
+ break;
+ }
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+ }
+
+ case ACT_NULL_ERROR:
+ if (value && *value)
+ /* Substitute parameter */
+ break;
+
+ error = 0;
+ if (!colon_seen && value)
+ /* Substitute NULL */
+ ;
+ else
+ {
+ const char *str = pattern;
+
+ if (str[0] == '\0')
+ str = _("parameter null or not set");
+
+#ifdef USE_IN_LIBIO
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s: %s\n", env, str);
+ else
+#endif
+ fprintf (stderr, "%s: %s\n", env, str);
+ }
+
+ if (free_value)
+ free (value);
+ goto do_error;
+
+ case ACT_NULL_SUBST:
+ if (value && *value)
+ /* Substitute parameter */
+ break;
+
+ if (free_value && value)
+ free (value);
+
+ if (!colon_seen && value)
+ /* Substitute NULL */
+ goto success;
+
+ value = pattern ? __strdup (pattern) : pattern;
+ free_value = 1;
+
+ if (pattern && !value)
+ goto no_space;
+
+ break;
+
+ case ACT_NONNULL_SUBST:
+ if (value && (*value || !colon_seen))
+ {
+ if (free_value && value)
+ free (value);
+
+ value = pattern ? __strdup (pattern) : pattern;
+ free_value = 1;
+
+ if (pattern && !value)
+ goto no_space;
+
+ break;
+ }
+
+ /* Substitute NULL */
+ if (free_value)
+ free (value);
+ goto success;
+
+ case ACT_NULL_ASSIGN:
+ if (value && *value)
+ /* Substitute parameter */
+ break;
+
+ if (!colon_seen && value)
+ {
+ /* Substitute NULL */
+ if (free_value)
+ free (value);
+ goto success;
+ }
+
+ if (free_value && value)
+ free (value);
+
+ value = pattern ? __strdup (pattern) : pattern;
+ free_value = 1;
+
+ if (pattern && !value)
+ goto no_space;
+
+ __setenv (env, value, 1);
+ break;
+
+ default:
+ assert (! "Unrecognised action!");
+ }
+ }
+
+ free (env); env = NULL;
+ free (pattern); pattern = NULL;
+
+ if (seen_hash)
+ {
+ char param_length[21];
+ param_length[20] = '\0';
+ *word = w_addstr (*word, word_length, max_length,
+ _itoa_word (value ? strlen (value) : 0,
+ &param_length[20], 10, 0));
+ if (free_value)
+ {
+ assert (value != NULL);
+ free (value);
+ }
+
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+
+ if (value == NULL)
+ return 0;
+
+ if (quoted || !pwordexp)
+ {
+ /* Quoted - no field split */
+ *word = w_addstr (*word, word_length, max_length, value);
+ if (free_value)
+ free (value);
+
+ return *word ? 0 : WRDE_NOSPACE;
+ }
+ else
+ {
+ /* Need to field-split */
+ char *value_copy = __strdup (value); /* Don't modify value */
+ char *field_begin = value_copy;
+ int seen_nonws_ifs = 0;
+
+ if (free_value)
+ free (value);
+
+ if (value_copy == NULL)
+ goto no_space;
+
+ do
+ {
+ char *field_end = field_begin;
+ char *next_field;
+
+ /* If this isn't the first field, start a new word */
+ if (field_begin != value_copy)
+ {
+ if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
+ {
+ free (value_copy);
+ goto no_space;
+ }
+
+ *word = w_newword (word_length, max_length);
+ }
+
+ /* Skip IFS whitespace before the field */
+ field_begin += strspn (field_begin, ifs_white);
+
+ if (!seen_nonws_ifs && *field_begin == 0)
+ /* Nothing but whitespace */
+ break;
+
+ /* Search for the end of the field */
+ field_end = field_begin + strcspn (field_begin, ifs);
+
+ /* Set up pointer to the character after end of field and
+ skip whitespace IFS after it. */
+ next_field = field_end + strspn (field_end, ifs_white);
+
+ /* Skip at most one non-whitespace IFS character after the field */
+ seen_nonws_ifs = 0;
+ if (*next_field && strchr (ifs, *next_field))
+ {
+ seen_nonws_ifs = 1;
+ next_field++;
+ }
+
+ /* Null-terminate it */
+ *field_end = 0;
+
+ /* Tag a copy onto the current word */
+ *word = w_addstr (*word, word_length, max_length, field_begin);
+
+ if (*word == NULL && *field_begin != '\0')
+ {
+ free (value_copy);
+ goto no_space;
+ }
+
+ field_begin = next_field;
+ }
+ while (seen_nonws_ifs || *field_begin);
+
+ free (value_copy);
+ }
+
+ return 0;
+
+success:
+ error = 0;
+ goto do_error;
+
+no_space:
+ error = WRDE_NOSPACE;
+ goto do_error;
+
+syntax:
+ error = WRDE_SYNTAX;
+
+do_error:
+ if (env)
+ free (env);
+
+ if (pattern)
+ free (pattern);
+
+ return error;
+}
+
+static int
+internal_function
+parse_dollars (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags,
+ wordexp_t *pwordexp, const char *ifs, const char *ifs_white,
+ int quoted)
+{
+ /* We are poised _at_ "$" */
+ switch (words[1 + *offset])
+ {
+ case '"':
+ case '\'':
+ case 0:
+ *word = w_addchar (*word, word_length, max_length, '$');
+ return *word ? 0 : WRDE_NOSPACE;
+
+ case '(':
+ if (words[2 + *offset] == '(')
+ {
+ /* Differentiate between $((1+3)) and $((echo);(ls)) */
+ int i = 3 + *offset;
+ int depth = 0;
+ while (words[i] && !(depth == 0 && words[i] == ')'))
+ {
+ if (words[i] == '(')
+ ++depth;
+ else if (words[i] == ')')
+ --depth;
+
+ ++i;
+ }
+
+ if (words[i] == ')' && words[i + 1] == ')')
+ {
+ (*offset) += 3;
+ /* Call parse_arith -- 0 is for "no brackets" */
+ return parse_arith (word, word_length, max_length, words, offset,
+ flags, 0);
+ }
+ }
+
+ if (flags & WRDE_NOCMD)
+ return WRDE_CMDSUB;
+
+ (*offset) += 2;
+ return parse_comm (word, word_length, max_length, words, offset, flags,
+ quoted? NULL : pwordexp, ifs, ifs_white);
+
+ case '[':
+ (*offset) += 2;
+ /* Call parse_arith -- 1 is for "brackets" */
+ return parse_arith (word, word_length, max_length, words, offset, flags,
+ 1);
+
+ case '{':
+ default:
+ ++(*offset); /* parse_param needs to know if "{" is there */
+ return parse_param (word, word_length, max_length, words, offset, flags,
+ pwordexp, ifs, ifs_white, quoted);
+ }
+}
+
+static int
+internal_function
+parse_backtick (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags,
+ wordexp_t *pwordexp, const char *ifs, const char *ifs_white)
+{
+ /* We are poised just after "`" */
+ int error;
+ int squoting = 0;
+ size_t comm_length;
+ size_t comm_maxlen;
+ char *comm = w_newword (&comm_length, &comm_maxlen);
+
+ for (; words[*offset]; ++(*offset))
+ {
+ switch (words[*offset])
+ {
+ case '`':
+ /* Go -- give the script to the shell */
+ error = exec_comm (comm, word, word_length, max_length, flags,
+ pwordexp, ifs, ifs_white);
+ free (comm);
+ return error;
+
+ case '\\':
+ if (squoting)
+ {
+ error = parse_qtd_backslash (&comm, &comm_length, &comm_maxlen,
+ words, offset);
+
+ if (error)
+ {
+ free (comm);
+ return error;
+ }
+
+ break;
+ }
+
+ ++(*offset);
+ error = parse_backslash (&comm, &comm_length, &comm_maxlen, words,
+ offset);
+
+ if (error)
+ {
+ free (comm);
+ return error;
+ }
+
+ break;
+
+ case '\'':
+ squoting = 1 - squoting;
+ default:
+ comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
+ if (comm == NULL)
+ return WRDE_NOSPACE;
+ }
+ }
+
+ /* Premature end */
+ free (comm);
+ return WRDE_SYNTAX;
+}
+
+static int
+internal_function
+parse_dquote (char **word, size_t *word_length, size_t *max_length,
+ const char *words, size_t *offset, int flags,
+ wordexp_t *pwordexp, const char * ifs, const char * ifs_white)
+{
+ /* We are poised just after a double-quote */
+ int error;
+
+ for (; words[*offset]; ++(*offset))
+ {
+ switch (words[*offset])
+ {
+ case '"':
+ return 0;
+
+ case '$':
+ error = parse_dollars (word, word_length, max_length, words, offset,
+ flags, pwordexp, ifs, ifs_white, 1);
+ /* The ``1'' here is to tell parse_dollars not to
+ * split the fields. It may need to, however ("$@").
+ */
+ if (error)
+ return error;
+
+ break;
+
+ case '`':
+ if (flags & WRDE_NOCMD)
+ return WRDE_CMDSUB;
+
+ ++(*offset);
+ error = parse_backtick (word, word_length, max_length, words,
+ offset, flags, NULL, NULL, NULL);
+ /* The first NULL here is to tell parse_backtick not to
+ * split the fields.
+ */
+ if (error)
+ return error;
+
+ break;
+
+ case '\\':
+ error = parse_qtd_backslash (word, word_length, max_length, words,
+ offset);
+
+ if (error)
+ return error;
+
+ break;
+
+ default:
+ *word = w_addchar (*word, word_length, max_length, words[*offset]);
+ if (*word == NULL)
+ return WRDE_NOSPACE;
+ }
+ }
+
+ /* Unterminated string */
+ return WRDE_SYNTAX;
+}
+
+/*
+ * wordfree() is to be called after pwordexp is finished with.
+ */
+
+void
+wordfree (wordexp_t *pwordexp)
+{
+
+ /* wordexp can set pwordexp to NULL */
+ if (pwordexp && pwordexp->we_wordv)
+ {
+ char **wordv = pwordexp->we_wordv;
+
+ for (wordv += pwordexp->we_offs; *wordv; ++wordv)
+ free (*wordv);
+
+ free (pwordexp->we_wordv);
+ pwordexp->we_wordv = NULL;
+ }
+}
+libc_hidden_def (wordfree)
+
+/*
+ * wordexp()
+ */
+
+int
+wordexp (const char *words, wordexp_t *pwordexp, int flags)
+{
+ size_t words_offset;
+ size_t word_length;
+ size_t max_length;
+ char *word = w_newword (&word_length, &max_length);
+ int error;
+ char *ifs;
+ char ifs_white[4];
+ wordexp_t old_word = *pwordexp;
+
+ if (flags & WRDE_REUSE)
+ {
+ /* Minimal implementation of WRDE_REUSE for now */
+ wordfree (pwordexp);
+ old_word.we_wordv = NULL;
+ }
+
+ if ((flags & WRDE_APPEND) == 0)
+ {
+ pwordexp->we_wordc = 0;
+
+ if (flags & WRDE_DOOFFS)
+ {
+ pwordexp->we_wordv = calloc (1 + pwordexp->we_offs, sizeof (char *));
+ if (pwordexp->we_wordv == NULL)
+ {
+ error = WRDE_NOSPACE;
+ goto do_error;
+ }
+ }
+ else
+ {
+ pwordexp->we_wordv = calloc (1, sizeof (char *));
+ if (pwordexp->we_wordv == NULL)
+ {
+ error = WRDE_NOSPACE;
+ goto do_error;
+ }
+
+ pwordexp->we_offs = 0;
+ }
+ }
+
+ /* Find out what the field separators are.
+ * There are two types: whitespace and non-whitespace.
+ */
+ ifs = getenv ("IFS");
+
+ if (!ifs)
+ /* IFS unset - use <space><tab><newline>. */
+ ifs = strcpy (ifs_white, " \t\n");
+ else
+ {
+ char *ifsch = ifs;
+ char *whch = ifs_white;
+
+ /* Start off with no whitespace IFS characters */
+ ifs_white[0] = '\0';
+
+ while (*ifsch != '\0')
+ {
+ if ((*ifsch == ' ') || (*ifsch == '\t') || (*ifsch == '\n'))
+ {
+ /* Whitespace IFS. See first whether it is already in our
+ collection. */
+ char *runp = ifs_white;
+
+ while (runp < whch && *runp != '\0' && *runp != *ifsch)
+ ++runp;
+
+ if (runp == whch)
+ *whch++ = *ifsch;
+ }
+
+ ++ifsch;
+ }
+ *whch = '\0';
+ }
+
+ for (words_offset = 0 ; words[words_offset] ; ++words_offset)
+ switch (words[words_offset])
+ {
+ case '\\':
+ error = parse_backslash (&word, &word_length, &max_length, words,
+ &words_offset);
+
+ if (error)
+ goto do_error;
+
+ break;
+
+ case '$':
+ error = parse_dollars (&word, &word_length, &max_length, words,
+ &words_offset, flags, pwordexp, ifs, ifs_white,
+ 0);
+
+ if (error)
+ goto do_error;
+
+ break;
+
+ case '`':
+ if (flags & WRDE_NOCMD)
+ {
+ error = WRDE_CMDSUB;
+ goto do_error;
+ }
+
+ ++words_offset;
+ error = parse_backtick (&word, &word_length, &max_length, words,
+ &words_offset, flags, pwordexp, ifs,
+ ifs_white);
+
+ if (error)
+ goto do_error;
+
+ break;
+
+ case '"':
+ ++words_offset;
+ error = parse_dquote (&word, &word_length, &max_length, words,
+ &words_offset, flags, pwordexp, ifs, ifs_white);
+
+ if (error)
+ goto do_error;
+
+ if (!word_length)
+ {
+ error = w_addword (pwordexp, NULL);
+
+ if (error)
+ return error;
+ }
+
+ break;
+
+ case '\'':
+ ++words_offset;
+ error = parse_squote (&word, &word_length, &max_length, words,
+ &words_offset);
+
+ if (error)
+ goto do_error;
+
+ if (!word_length)
+ {
+ error = w_addword (pwordexp, NULL);
+
+ if (error)
+ return error;
+ }
+
+ break;
+
+ case '~':
+ error = parse_tilde (&word, &word_length, &max_length, words,
+ &words_offset, pwordexp->we_wordc);
+
+ if (error)
+ goto do_error;
+
+ break;
+
+ case '*':
+ case '[':
+ case '?':
+ error = parse_glob (&word, &word_length, &max_length, words,
+ &words_offset, flags, pwordexp, ifs, ifs_white);
+
+ if (error)
+ goto do_error;
+
+ break;
+
+ default:
+ /* Is it a word separator? */
+ if (strchr (" \t", words[words_offset]) == NULL)
+ {
+ char ch = words[words_offset];
+
+ /* Not a word separator -- but is it a valid word char? */
+ if (strchr ("\n|&;<>(){}", ch))
+ {
+ /* Fail */
+ error = WRDE_BADCHAR;
+ goto do_error;
+ }
+
+ /* "Ordinary" character -- add it to word */
+ word = w_addchar (word, &word_length, &max_length,
+ ch);
+ if (word == NULL)
+ {
+ error = WRDE_NOSPACE;
+ goto do_error;
+ }
+
+ break;
+ }
+
+ /* If a word has been delimited, add it to the list. */
+ if (word != NULL)
+ {
+ error = w_addword (pwordexp, word);
+ if (error)
+ goto do_error;
+ }
+
+ word = w_newword (&word_length, &max_length);
+ }
+
+ /* End of string */
+
+ /* There was a word separator at the end */
+ if (word == NULL) /* i.e. w_newword */
+ return 0;
+
+ /* There was no field separator at the end */
+ return w_addword (pwordexp, word);
+
+do_error:
+ /* Error:
+ * free memory used (unless error is WRDE_NOSPACE), and
+ * set pwordexp members back to what they were.
+ */
+
+ if (word != NULL)
+ free (word);
+
+ if (error == WRDE_NOSPACE)
+ return WRDE_NOSPACE;
+
+ if ((flags & WRDE_APPEND) == 0)
+ wordfree (pwordexp);
+
+ *pwordexp = old_word;
+ return error;
+}
diff --git a/sysdeps/generic/write.c b/sysdeps/generic/write.c
new file mode 100644
index 0000000000..928d43ced2
--- /dev/null
+++ b/sysdeps/generic/write.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+/* Write NBYTES of BUF to FD. Return the number written, or -1. */
+ssize_t
+__libc_write (int fd, const void *buf, size_t nbytes)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__libc_write)
+stub_warning (write)
+
+weak_alias (__libc_write, __write)
+libc_hidden_weak (__write)
+weak_alias (__libc_write, write)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/writev.c b/sysdeps/generic/writev.c
new file mode 100644
index 0000000000..d424c72143
--- /dev/null
+++ b/sysdeps/generic/writev.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Write data pointed by the buffers described by VECTOR, which
+ is a vector of COUNT `struct iovec's, to file descriptor FD.
+ The data is written in the order specified.
+ Operates just like `write' (see <unistd.h>) except that the data
+ are taken from VECTOR instead of a contiguous buffer. */
+ssize_t
+__libc_writev (fd, vector, count)
+ int fd;
+ const struct iovec *vector;
+ int count;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+strong_alias (__libc_writev, __writev)
+weak_alias (__libc_writev, writev)
+
+stub_warning (writev)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/xmknod.c b/sysdeps/generic/xmknod.c
new file mode 100644
index 0000000000..57ed46060d
--- /dev/null
+++ b/sysdeps/generic/xmknod.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991,1993,1995,1996,1997,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* Create a device file named PATH, with permission and special bits MODE
+ and device number DEV (which can be constructed from major and minor
+ device numbers with the `makedev' macro above). */
+int
+__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
+{
+ if (vers != _MKNOD_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (__xmknod)
+
+weak_alias (__xmknod, _xmknod)
+libc_hidden_def (__xmknod)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/xpg-strerror.c b/sysdeps/generic/xpg-strerror.c
new file mode 100644
index 0000000000..5cb56cdfb8
--- /dev/null
+++ b/sysdeps/generic/xpg-strerror.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <libintl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/param.h>
+#include <stdio-common/_itoa.h>
+
+/* It is critical here that we always use the `dcgettext' function for
+ the message translation. Since <libintl.h> only defines the macro
+ `dgettext' to use `dcgettext' for optimizing programs this is not
+ always guaranteed. */
+#ifndef dgettext
+# include <locale.h> /* We need LC_MESSAGES. */
+# define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
+#endif
+
+/* Fill buf with a string describing the errno code in ERRNUM. */
+int
+__xpg_strerror_r (int errnum, char *buf, size_t buflen)
+{
+ if (errnum < 0 || errnum >= _sys_nerr_internal
+ || _sys_errlist_internal[errnum] == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ const char *estr = (const char *) _(_sys_errlist_internal[errnum]);
+ size_t estrlen = strlen (estr) + 1;
+
+ if (buflen < estrlen)
+ {
+ __set_errno (ERANGE);
+ return -1;
+ }
+
+ memcpy (buf, estr, estrlen);
+ return 0;
+}
diff --git a/sysdeps/generic/xstat.c b/sysdeps/generic/xstat.c
new file mode 100644
index 0000000000..e7328cc10e
--- /dev/null
+++ b/sysdeps/generic/xstat.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <stddef.h>
+
+/* Get file information about FILE in BUF. */
+int
+__xstat (int vers, const char *file, struct stat *buf)
+{
+ if (vers != _STAT_VER || file == NULL || buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+hidden_def (__xstat)
+stub_warning (stat)
+weak_alias (__xstat, _xstat)
+#include <stub-tag.h>
diff --git a/sysdeps/generic/xstat64.c b/sysdeps/generic/xstat64.c
new file mode 100644
index 0000000000..2fb94cf331
--- /dev/null
+++ b/sysdeps/generic/xstat64.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <stddef.h>
+
+/* Get file information about FILE in BUF. */
+int
+__xstat64 (int vers, const char *file, struct stat64 *buf)
+{
+ if (vers != _STAT_VER || file == NULL || buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+hidden_def (__xstat64)
+stub_warning (stat64)
+#include <stub-tag.h>