From 2c6cfe6853a30deb4af842aacc924fa298d0521a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 19 Dec 2005 12:11:38 +0000 Subject: Updated to fedora-glibc-20051219T1003 --- ChangeLog | 2188 +++++++++++++++++ Makeconfig | 19 +- Makefile | 5 +- Makefile.in | 2 - Makerules | 95 +- NEWS | 4 +- bare/brdinit.c | 32 + bare/console.c | 42 + bare/strtsupp.c | 28 + catgets/gencat.c | 22 +- config-name.in | 1 - config.make.in | 1 - csu/check_fds.c | 102 + csu/errno-loc.c | 37 + csu/errno.c | 53 + csu/init-first.c | 59 + csu/libc-start.c | 263 +++ csu/libc-tls.c | 263 +++ csu/start.c | 13 + csu/sysdep.c | 2 + debug/backtrace.c | 94 + debug/backtracesyms.c | 58 + debug/backtracesymsfd.c | 64 + debug/memcpy_chk.c | 66 + debug/memmove_chk.c | 98 + debug/mempcpy_chk.c | 67 + debug/memset_chk.c | 92 + debug/readonly-area.c | 34 + debug/segfault.c | 214 ++ debug/stpcpy_chk.c | 45 + debug/stpncpy_chk.c | 85 + debug/strcat_chk.c | 58 + debug/strcpy_chk.c | 68 + debug/strncat_chk.c | 100 + debug/strncpy_chk.c | 89 + dirent/alphasort64.c | 27 + dirent/closedir.c | 35 + dirent/dirfd.c | 33 + dirent/fdopendir.c | 34 + dirent/getdents.c | 37 + dirent/getdents64.c | 36 + dirent/opendir.c | 34 + dirent/readdir.c | 33 + dirent/readdir64.c | 32 + dirent/readdir64_r.c | 33 + dirent/readdir_r.c | 35 + dirent/rewinddir.c | 35 + dirent/scandir64.c | 30 + dirent/seekdir.c | 41 + dirent/telldir.c | 41 + dirent/versionsort64.c | 27 + elf/Versions | 2 + elf/cache.c | 20 +- elf/chroot_canon.c | 22 +- elf/dl-brk.c | 5 + elf/dl-cache.c | 311 +++ elf/dl-environ.c | 86 + elf/dl-error.c | 6 +- elf/dl-execstack.c | 32 + elf/dl-fptr.c | 323 +++ elf/dl-minimal.c | 8 +- elf/dl-origin.c | 51 + elf/dl-sbrk.c | 5 + elf/dl-symaddr.c | 33 + elf/dl-sysdep.c | 590 +++++ elf/dl-tls.c | 799 +++++++ elf/dl-trampoline.c | 1 + elf/enbl-secure.c | 37 + elf/ldconfig.c | 20 +- elf/readelflib.c | 220 ++ elf/readlib.c | 22 +- elf/rtld.c | 34 +- fedora/branch.mk | 4 +- fedora/glibc.spec.in | 40 +- gmon/bb_init_func.c | 54 + gmon/prof-freq.c | 55 + gmon/profil.c | 42 + gmon/sprofil.c | 36 + grp/setgroups.c | 35 + hurd/exc2signal.c | 71 + hurd/hurdmalloc.c | 58 +- hurd/longjmp-ts.c | 32 + hurd/trampoline.c | 37 + iconv/dummy-repertoire.c | 22 +- iconv/gconv.c | 19 +- iconv/gconv_builtin.c | 13 +- iconv/gconv_db.c | 71 +- iconv/gconv_dl.c | 11 +- iconv/iconv_charmap.c | 22 +- iconv/iconv_prog.c | 20 +- iconv/iconvconfig.c | 20 +- iconv/skeleton.c | 13 +- include/dirent.h | 2 +- include/fcntl.h | 3 + include/sys/sendfile.h | 1 + include/sys/stat.h | 1 + inet/check_pf.c | 50 + inet/getipv4sourcefilter.c | 32 + inet/getsourcefilter.c | 33 + inet/herrno-loc.c | 34 + inet/htonl.c | 36 + inet/htons.c | 36 + inet/if_index.c | 65 + inet/ifaddrs.c | 46 + inet/ifreq.c | 80 + inet/setipv4sourcefilter.c | 33 + inet/setsourcefilter.c | 33 + io/Makefile | 15 +- io/Versions | 4 + io/access.c | 41 + io/chdir.c | 40 + io/chmod.c | 42 + io/chown.c | 45 + io/close.c | 40 + io/creat.c | 36 + io/creat64.c | 31 + io/dup.c | 34 + io/dup2.c | 48 + io/euidaccess.c | 40 + io/fchdir.c | 33 + io/fchmod.c | 42 + io/fchown.c | 43 + io/fchownat.c | 51 + io/fcntl.c | 41 + io/flock.c | 36 + io/fstatfs.c | 34 + io/fstatfs64.c | 32 + io/fstatvfs.c | 33 + io/fstatvfs64.c | 32 + io/fxstat.c | 50 + io/fxstat64.c | 49 + io/fxstatat.c | 49 + io/fxstatat64.c | 50 + io/getcwd.c | 40 + io/isatty.c | 34 + io/lchmod.c | 33 + io/lchown.c | 43 + io/link.c | 42 + io/linkat.c | 51 + io/lockf.c | 74 + io/lockf64.c | 79 + io/lseek64.c | 49 + io/lxstat.c | 27 + io/lxstat64.c | 39 + io/mkdir.c | 43 + io/mkdirat.c | 58 + io/mkfifo.c | 43 + io/mkfifoat.c | 60 + io/mknod.c | 62 + io/mknodat.c | 60 + io/open.c | 54 + io/open64.c | 57 + io/openat.c | 69 + io/openat64.c | 69 + io/pipe.c | 44 + io/poll.c | 39 + io/posix_fadvise.c | 31 + io/posix_fadvise64.c | 31 + io/posix_fallocate.c | 31 + io/posix_fallocate64.c | 31 + io/read.c | 49 + io/readlink.c | 37 + io/readlinkat.c | 50 + io/rmdir.c | 41 + io/sendfile.c | 33 + io/sendfile64.c | 33 + io/statfs.c | 35 + io/statfs64.c | 32 + io/statvfs.c | 34 + io/statvfs64.c | 32 + io/symlink.c | 42 + io/symlinkat.c | 49 + io/sys/stat.h | 52 +- io/ttyname.c | 38 + io/ttyname_r.c | 37 + io/umask.c | 34 + io/unlink.c | 41 + io/unlinkat.c | 49 + io/utime.c | 43 + io/write.c | 50 + io/xmknod.c | 48 + io/xmknodat.c | 63 + io/xstat.c | 39 + io/xstat64.c | 38 + libio/iofwide.c | 43 +- libio/libc_fatal.c | 31 + libio/libioP.h | 4 +- locale/programs/3level.h | 22 +- locale/programs/charmap-dir.c | 22 +- locale/programs/charmap-dir.h | 22 +- locale/programs/charmap-kw.gperf | 22 +- locale/programs/charmap-kw.h | 100 +- locale/programs/charmap.c | 22 +- locale/programs/charmap.h | 22 +- locale/programs/config.h | 22 +- locale/programs/ld-address.c | 20 +- locale/programs/ld-collate.c | 20 +- locale/programs/ld-ctype.c | 22 +- locale/programs/ld-identification.c | 22 +- locale/programs/ld-measurement.c | 22 +- locale/programs/ld-messages.c | 22 +- locale/programs/ld-monetary.c | 22 +- locale/programs/ld-name.c | 22 +- locale/programs/ld-numeric.c | 22 +- locale/programs/ld-paper.c | 22 +- locale/programs/ld-telephone.c | 22 +- locale/programs/ld-time.c | 22 +- locale/programs/linereader.c | 20 +- locale/programs/linereader.h | 22 +- locale/programs/locale-spec.c | 22 +- locale/programs/locale.c | 20 +- locale/programs/localedef.c | 20 +- locale/programs/localedef.h | 22 +- locale/programs/locarchive.c | 22 +- locale/programs/locfile-kw.gperf | 22 +- locale/programs/locfile-kw.h | 727 +++--- locale/programs/locfile-token.h | 22 +- locale/programs/locfile.c | 22 +- locale/programs/locfile.h | 22 +- locale/programs/repertoire.c | 22 +- locale/programs/repertoire.h | 22 +- locale/programs/simple-hash.c | 22 +- locale/programs/simple-hash.h | 22 +- locale/programs/xmalloc.c | 23 +- locale/programs/xstrdup.c | 22 +- localedata/ChangeLog | 4 + localedata/locales/se_NO | 5 +- login/endutxent.c | 27 + login/getpt.c | 45 + login/getutmp.c | 46 + login/getutmpx.c | 48 + login/getutxent.c | 27 + login/getutxid.c | 27 + login/getutxline.c | 27 + login/grantpt.c | 35 + login/ptsname.c | 47 + login/pututxline.c | 27 + login/setutxent.c | 27 + login/unlockpt.c | 35 + login/updwtmp.c | 35 + login/updwtmpx.c | 27 + login/utmp_file.c | 499 ++++ login/utmpxname.c | 27 + mach/err_kern.sub | 11 +- mach/err_server.sub | 26 +- mach/err_us.sub | 26 +- mach/error_compat.c | 41 +- mach/errorlib.h | 28 +- mach/errstring.c | 40 +- mach/mach/error.h | 23 +- mach/mach_error.c | 48 +- mach/mach_error.h | 33 +- mach/mig-reply.c | 53 + mach/msg-destroy.c | 31 +- mach/msgserver.c | 40 +- malloc/arena.c | 2 - malloc/hooks.c | 2 - malloc/malloc.c | 1 - malloc/memusagestat.c | 24 +- malloc/morecore.c | 54 + malloc/tst-mallocfork.c | 3 +- manual/dir | 1 - manual/install.texi | 7 +- manual/stdio.texi | 5 +- math/cabsf.c | 29 + math/cargf.c | 29 + math/cimagf.c | 28 + math/conjf.c | 28 + math/crealf.c | 28 + math/e_acoshl.c | 14 + math/e_acosl.c | 14 + math/e_asinl.c | 14 + math/e_atan2l.c | 14 + math/e_atanhl.c | 14 + math/e_coshl.c | 14 + math/e_exp10.c | 30 + math/e_exp10f.c | 30 + math/e_exp10l.c | 30 + math/e_exp2l.c | 14 + math/e_expl.c | 14 + math/e_fmodl.c | 14 + math/e_gammal_r.c | 15 + math/e_hypotl.c | 14 + math/e_j0l.c | 25 + math/e_j1l.c | 25 + math/e_jnl.c | 25 + math/e_lgammal_r.c | 17 + math/e_log10l.c | 14 + math/e_log2l.c | 14 + math/e_logl.c | 14 + math/e_powl.c | 14 + math/e_rem_pio2l.c | 15 + math/e_scalb.c | 71 + math/e_scalbf.c | 68 + math/e_scalbl.c | 75 + math/e_sinhl.c | 14 + math/e_sqrtl.c | 14 + math/fclrexcpt.c | 37 + math/fedisblxcpt.c | 30 + math/feenablxcpt.c | 30 + math/fegetenv.c | 38 + math/fegetexcept.c | 30 + math/fegetround.c | 29 + math/feholdexcpt.c | 30 + math/fesetenv.c | 38 + math/fesetround.c | 30 + math/feupdateenv.c | 37 + math/fgetexcptflg.c | 37 + math/fpu_control.c | 25 + math/fraiseexcpt.c | 38 + math/fsetexcptflg.c | 37 + math/ftestexcept.c | 29 + math/k_cosl.c | 15 + math/k_rem_pio2l.c | 16 + math/k_sincosl.c | 1 + math/k_sinl.c | 15 + math/k_tanl.c | 15 + math/math_private.h | 1 - math/s_asinhl.c | 15 + math/s_atanl.c | 15 + math/s_cacos.c | 41 + math/s_cacosf.c | 39 + math/s_cacosh.c | 88 + math/s_cacoshf.c | 101 + math/s_cacoshl.c | 84 + math/s_cacosl.c | 37 + math/s_casin.c | 66 + math/s_casinf.c | 64 + math/s_casinh.c | 84 + math/s_casinhf.c | 82 + math/s_casinhl.c | 80 + math/s_casinl.c | 62 + math/s_catan.c | 89 + math/s_catanf.c | 87 + math/s_catanh.c | 84 + math/s_catanhf.c | 82 + math/s_catanhl.c | 80 + math/s_catanl.c | 85 + math/s_cbrtl.c | 15 + math/s_ccos.c | 80 + math/s_ccosf.c | 78 + math/s_ccosh.c | 105 + math/s_ccoshf.c | 103 + math/s_ccoshl.c | 101 + math/s_ccosl.c | 76 + math/s_cexp.c | 127 + math/s_cexpf.c | 125 + math/s_cexpl.c | 123 + math/s_clog.c | 65 + math/s_clog10.c | 65 + math/s_clog10f.c | 63 + math/s_clog10l.c | 61 + math/s_clogf.c | 63 + math/s_clogl.c | 61 + math/s_cpow.c | 34 + math/s_cpowf.c | 32 + math/s_cpowl.c | 30 + math/s_cproj.c | 51 + math/s_cprojf.c | 49 + math/s_cprojl.c | 48 + math/s_csin.c | 131 ++ math/s_csinf.c | 129 + math/s_csinh.c | 126 + math/s_csinhf.c | 124 + math/s_csinhl.c | 122 + math/s_csinl.c | 127 + math/s_csqrt.c | 114 + math/s_csqrtf.c | 112 + math/s_csqrtl.c | 110 + math/s_ctan.c | 84 + math/s_ctanf.c | 83 + math/s_ctanh.c | 84 + math/s_ctanhf.c | 82 + math/s_ctanhl.c | 80 + math/s_ctanl.c | 81 + math/s_erfl.c | 26 + math/s_expm1l.c | 16 + math/s_fdim.c | 40 + math/s_fdimf.c | 36 + math/s_fdiml.c | 36 + math/s_fma.c | 33 + math/s_fmaf.c | 28 + math/s_fmal.c | 28 + math/s_fmax.c | 33 + math/s_fmaxf.c | 29 + math/s_fmaxl.c | 29 + math/s_fmin.c | 33 + math/s_fminf.c | 29 + math/s_fminl.c | 29 + math/s_ldexp.c | 37 + math/s_ldexpf.c | 37 + math/s_ldexpl.c | 37 + math/s_log1pl.c | 15 + math/s_nan.c | 44 + math/s_nanf.c | 40 + math/s_nanl.c | 40 + math/s_nextafter.c | 100 + math/s_nexttowardf.c | 86 + math/s_nexttowardl.c | 1 + math/s_significand.c | 39 + math/s_significandf.c | 32 + math/s_significandl.c | 39 + math/s_tanhl.c | 15 + math/setfpucw.c | 37 + math/t_sincosl.c | 1 + math/w_acos.c | 48 + math/w_acosf.c | 48 + math/w_acosh.c | 47 + math/w_acoshf.c | 48 + math/w_acoshl.c | 47 + math/w_acosl.c | 48 + math/w_asin.c | 49 + math/w_asinf.c | 49 + math/w_asinl.c | 49 + math/w_atan2.c | 47 + math/w_atan2f.c | 46 + math/w_atan2l.c | 47 + math/w_atanh.c | 52 + math/w_atanhf.c | 53 + math/w_atanhl.c | 52 + math/w_cosh.c | 47 + math/w_coshf.c | 47 + math/w_coshl.c | 47 + math/w_drem.c | 20 + math/w_dremf.c | 17 + math/w_dreml.c | 18 + math/w_exp10.c | 51 + math/w_exp10f.c | 46 + math/w_exp10l.c | 46 + math/w_exp2.c | 36 + math/w_exp2f.c | 32 + math/w_exp2l.c | 31 + math/w_expl.c | 13 + math/w_fmod.c | 48 + math/w_fmodf.c | 48 + math/w_fmodl.c | 48 + math/w_hypot.c | 48 + math/w_hypotf.c | 48 + math/w_hypotl.c | 48 + math/w_j0.c | 76 + math/w_j0f.c | 74 + math/w_j0l.c | 73 + math/w_j1.c | 77 + math/w_j1f.c | 75 + math/w_j1l.c | 74 + math/w_jn.c | 99 + math/w_jnf.c | 71 + math/w_jnl.c | 96 + math/w_lgamma.c | 60 + math/w_lgamma_r.c | 51 + math/w_lgammaf.c | 53 + math/w_lgammaf_r.c | 52 + math/w_lgammal.c | 58 + math/w_lgammal_r.c | 52 + math/w_log.c | 48 + math/w_log10.c | 51 + math/w_log10f.c | 52 + math/w_log10l.c | 51 + math/w_log2.c | 32 + math/w_log2f.c | 30 + math/w_log2l.c | 28 + math/w_logf.c | 49 + math/w_logl.c | 48 + math/w_pow.c | 70 + math/w_powf.c | 77 + math/w_powl.c | 68 + math/w_remainder.c | 47 + math/w_remainderf.c | 47 + math/w_remainderl.c | 48 + math/w_scalb.c | 65 + math/w_scalbf.c | 66 + math/w_scalbl.c | 65 + math/w_sinh.c | 47 + math/w_sinhf.c | 47 + math/w_sinhl.c | 47 + math/w_sqrt.c | 47 + math/w_sqrtf.c | 47 + math/w_sqrtl.c | 47 + math/w_tgamma.c | 56 + math/w_tgammaf.c | 53 + math/w_tgammal.c | 55 + misc/acct.c | 34 + misc/brk.c | 37 + misc/chflags.c | 43 + misc/chroot.c | 34 + misc/fchflags.c | 43 + misc/fdatasync.c | 28 + misc/fgetxattr.c | 31 + misc/flistxattr.c | 30 + misc/fremovexattr.c | 30 + misc/fsetxattr.c | 31 + misc/fsync.c | 33 + misc/ftruncate.c | 36 + misc/ftruncate64.c | 36 + misc/futimes.c | 34 + misc/futimesat.c | 48 + misc/getclktck.c | 30 + misc/getdomain.c | 64 + misc/getdtsz.c | 33 + misc/gethostid.c | 32 + misc/gethostname.c | 36 + misc/getloadavg.c | 37 + misc/getpagesize.c | 33 + misc/getsysstats.c | 69 + misc/getxattr.c | 31 + misc/gtty.c | 40 + misc/ioctl.c | 35 + misc/lgetxattr.c | 31 + misc/listxattr.c | 30 + misc/llistxattr.c | 30 + misc/lremovexattr.c | 30 + misc/lseek.c | 53 + misc/lsetxattr.c | 31 + misc/lutimes.c | 35 + misc/madvise.c | 33 + misc/mincore.c | 30 + misc/mlock.c | 35 + misc/mlockall.c | 36 + misc/mmap.c | 41 + misc/mmap64.c | 48 + misc/mprotect.c | 36 + misc/msync.c | 35 + misc/munlock.c | 34 + misc/munlockall.c | 34 + misc/munmap.c | 35 + misc/pselect.c | 88 + misc/ptrace.c | 103 + misc/readv.c | 41 + misc/reboot.c | 34 + misc/remap_file_pages.c | 35 + misc/removexattr.c | 30 + misc/revoke.c | 31 + misc/sbrk.c | 56 + misc/select.c | 43 + misc/setdomain.c | 34 + misc/setegid.c | 32 + misc/seteuid.c | 32 + misc/sethostid.c | 34 + misc/sethostname.c | 35 + misc/setregid.c | 36 + misc/setreuid.c | 36 + misc/setxattr.c | 31 + misc/sstk.c | 35 + misc/stty.c | 40 + misc/swapoff.c | 31 + misc/swapon.c | 34 + misc/sync.c | 31 + misc/syscall.c | 35 + misc/syslog.c | 438 ++++ misc/truncate.c | 34 + misc/truncate64.c | 35 + misc/ualarm.c | 37 + misc/usleep.c | 32 + misc/ustat.c | 33 + misc/utimes.c | 43 + misc/vhangup.c | 33 + misc/writev.c | 41 + nis/nis_call.c | 32 +- nis/nis_error.c | 15 +- nis/nis_lookup.c | 19 +- nis/nis_table.c | 143 +- nis/nss_nisplus/nisplus-alias.c | 225 +- nis/nss_nisplus/nisplus-ethers.c | 210 +- nis/nss_nisplus/nisplus-grp.c | 194 +- nis/nss_nisplus/nisplus-hosts.c | 266 ++- nis/nss_nisplus/nisplus-netgrp.c | 7 +- nis/nss_nisplus/nisplus-network.c | 243 +- nis/nss_nisplus/nisplus-proto.c | 245 +- nis/nss_nisplus/nisplus-publickey.c | 21 +- nis/nss_nisplus/nisplus-pwd.c | 239 +- nis/nss_nisplus/nisplus-rpc.c | 250 +- nis/nss_nisplus/nisplus-service.c | 259 ++- nis/nss_nisplus/nisplus-spwd.c | 140 +- nis/ypclnt.c | 281 ++- nptl/ChangeLog | 48 + nptl/allocatestack.c | 5 +- nptl/errno-loc.c | 1 + nptl/init.c | 25 +- nptl/pthread_create.c | 5 + nptl/sysdeps/i386/tcb-offsets.sym | 1 + nptl/sysdeps/i386/tls.h | 9 + nptl/sysdeps/pthread/pthread.h | 4 +- nptl/sysdeps/pthread/sigfillset.c | 4 +- .../unix/sysv/linux/i386/bits/pthreadtypes.h | 4 +- nptl/sysdeps/unix/sysv/linux/mq_notify.c | 4 +- .../unix/sysv/linux/x86_64/bits/pthreadtypes.h | 7 +- nptl/sysdeps/x86_64/tcb-offsets.sym | 1 + nptl/sysdeps/x86_64/tls.h | 10 + nscd/Makefile | 11 +- nscd/aicache.c | 28 +- nscd/cache.c | 20 +- nscd/connections.c | 45 +- nscd/dbg_log.c | 22 +- nscd/gai.c | 17 + nscd/getgrgid_r.c | 22 +- nscd/getgrnam_r.c | 22 +- nscd/gethstbyad_r.c | 22 +- nscd/gethstbynm2_r.c | 22 +- nscd/getpwnam_r.c | 22 +- nscd/getpwuid_r.c | 22 +- nscd/grpcache.c | 28 +- nscd/hstcache.c | 28 +- nscd/initgrcache.c | 28 +- nscd/mem.c | 20 +- nscd/nscd-client.h | 2 + nscd/nscd.c | 20 +- nscd/nscd_conf.c | 20 +- nscd/nscd_helper.c | 6 +- nscd/nscd_nischeck.c | 96 - nscd/nscd_setup_thread.c | 26 + nscd/pwdcache.c | 28 +- nss/function.def | 3 +- nss/nss_files/files-netgrp.c | 2 +- posix/_exit.c | 36 + posix/alarm.c | 39 + posix/environ.c | 12 + posix/execve.c | 44 + posix/fexecve.c | 43 + posix/fork.c | 36 + posix/fpathconf.c | 62 + posix/gai_strerror.c | 29 + posix/getaddrinfo.c | 41 + posix/getconf.c | 20 +- posix/getegid.c | 32 + posix/geteuid.c | 33 + posix/getgid.c | 33 + posix/getgroups.c | 48 + posix/getlogin.c | 33 + posix/getlogin_r.c | 37 + posix/getpgid.c | 33 + posix/getpgrp.c | 27 + posix/getpid.c | 34 + posix/getppid.c | 33 + posix/getresgid.c | 34 + posix/getresuid.c | 34 + posix/getsid.c | 32 + posix/getuid.c | 33 + posix/glob.c | 1558 +++++++++++++ posix/glob64.c | 54 + posix/group_member.c | 50 + posix/init-posix.c | 1 + posix/nanosleep.c | 36 + posix/pathconf.c | 41 + posix/pause.c | 34 + posix/posix_madvise.c | 32 + posix/pread.c | 46 + posix/pread64.c | 46 + posix/pwrite.c | 46 + posix/pwrite64.c | 47 + posix/regex_internal.h | 8 + posix/sched_getaffinity.c | 35 + posix/sched_getp.c | 34 + posix/sched_gets.c | 34 + posix/sched_primax.c | 33 + posix/sched_primin.c | 33 + posix/sched_rr_gi.c | 34 + posix/sched_setaffinity.c | 35 + posix/sched_setp.c | 34 + posix/sched_sets.c | 35 + posix/sched_yield.c | 33 + posix/setgid.c | 37 + posix/setlogin.c | 32 + posix/setpgid.c | 37 + posix/setpgrp.c | 25 + posix/setresgid.c | 35 + posix/setresuid.c | 35 + posix/setsid.c | 35 + posix/setuid.c | 37 + posix/sleep.c | 41 + posix/spawni.c | 46 + posix/sysconf.c | 273 +++ posix/times.c | 43 + posix/uname.c | 66 + posix/unistd.h | 18 + posix/vfork.c | 31 + posix/wait.c | 33 + posix/wait3.c | 43 + posix/wait4.c | 33 + posix/waitid.c | 35 + posix/waitpid.c | 53 + posix/wordexp.c | 2457 ++++++++++++++++++++ resolv/gai_sigqueue.c | 36 + resolv/gethnamaddr.c | 1 - resolv/res-state.c | 45 + resource/getpriority.c | 37 + resource/getrlimit.c | 34 + resource/getrlimit64.c | 43 + resource/getrusage.c | 35 + resource/nice.c | 33 + resource/setpriority.c | 36 + resource/setrlimit.c | 37 + resource/setrlimit64.c | 43 + resource/ulimit.c | 39 + resource/vlimit.c | 51 + resource/vtimes.c | 65 + rt/aio_cancel.c | 44 + rt/aio_fsync.c | 51 + rt/aio_misc.c | 29 + rt/aio_notify.c | 24 + rt/aio_read.c | 36 + rt/aio_read64.c | 2 + rt/aio_sigqueue.c | 36 + rt/aio_suspend.c | 46 + rt/aio_write.c | 36 + rt/aio_write64.c | 2 + rt/clock_getcpuclockid.c | 39 + rt/clock_getres.c | 30 + rt/clock_gettime.c | 31 + rt/clock_nanosleep.c | 39 + rt/clock_settime.c | 30 + rt/get_clockfreq.c | 28 + rt/lio_listio.c | 42 + rt/lio_listio64.c | 2 + rt/mq_close.c | 31 + rt/mq_getattr.c | 30 + rt/mq_notify.c | 31 + rt/mq_open.c | 36 + rt/mq_receive.c | 32 + rt/mq_send.c | 31 + rt/mq_setattr.c | 33 + rt/mq_timedreceive.c | 34 + rt/mq_timedsend.c | 33 + rt/mq_unlink.c | 30 + rt/shm_open.c | 31 + rt/shm_unlink.c | 31 + rt/timer_create.c | 30 + rt/timer_delete.c | 30 + rt/timer_getoverr.c | 30 + rt/timer_gettime.c | 30 + rt/timer_settime.c | 31 + rt/tst-timer.c | 33 + scripts/check-c++-types.sh | 4 +- scripts/check-local-headers.sh | 38 + scripts/mkinstalldirs | 2 - setjmp/__longjmp.c | 36 + setjmp/bsd-_setjmp.c | 35 + setjmp/bsd-setjmp.c | 34 + setjmp/jmp-unwind.c | 29 + setjmp/longjmp.c | 46 + setjmp/setjmp.c | 37 + setjmp/sigjmp.c | 35 + signal/allocrtsig.c | 96 + signal/kill.c | 37 + signal/killpg.c | 36 + signal/raise.c | 34 + signal/sigaction.c | 44 + signal/sigaltstack.c | 34 + signal/sigblock.c | 33 + signal/sigfillset.c | 47 + signal/sigignore.c | 33 + signal/sigintr.c | 35 + signal/signal.c | 38 + signal/sigpause.c | 53 + signal/sigpending.c | 40 + signal/sigprocmask.c | 51 + signal/sigqueue.c | 33 + signal/sigreturn.c | 32 + signal/sigset.c | 34 + signal/sigsetmask.c | 32 + signal/sigstack.c | 34 + signal/sigsuspend.c | 37 + signal/sigtimedwait.c | 34 + signal/sigvec.c | 39 + signal/sigwait.c | 32 + signal/sigwaitinfo.c | 33 + signal/sysv_signal.c | 43 + socket/accept.c | 40 + socket/bind.c | 36 + socket/connect.c | 38 + socket/getpeername.c | 36 + socket/getsockname.c | 36 + socket/getsockopt.c | 38 + socket/isfdtype.c | 31 + socket/listen.c | 37 + socket/opensock.c | 71 + socket/recv.c | 37 + socket/recvfrom.c | 41 + socket/recvmsg.c | 37 + socket/send.c | 37 + socket/sendmsg.c | 37 + socket/sendto.c | 40 + socket/setsockopt.c | 40 + socket/shutdown.c | 39 + socket/sockatmark.c | 33 + socket/socket.c | 38 + socket/socketpair.c | 39 + soft-fp/floatdisf.c | 2 +- soft-fp/soft-fp.h | 2 + stdio-common/ctermid.c | 36 + stdio-common/cuserid.c | 35 + stdio-common/errlist.c | 37 + stdio-common/flockfile.c | 30 + stdio-common/ftrylockfile.c | 31 + stdio-common/funlockfile.c | 30 + stdio-common/printf_fphex.c | 490 ++++ stdio-common/remove.c | 33 + stdio-common/rename.c | 41 + stdio-common/renameat.c | 50 + stdio-common/siglist.c | 38 + stdio-common/tempname.c | 59 + stdio-common/tmpfile.c | 66 + stdio-common/tmpfile64.c | 3 + stdlib/abort.c | 140 ++ stdlib/add_n.c | 62 + stdlib/addmul_1.c | 65 + stdlib/cmp.c | 56 + stdlib/cxa_atexit.c | 8 +- stdlib/cxa_finalize.c | 11 +- stdlib/dbl2mpn.c | 32 + stdlib/div.c | 86 + stdlib/divmod_1.c | 208 ++ stdlib/divrem.c | 245 ++ stdlib/exit.c | 23 +- stdlib/getcontext.c | 32 + stdlib/getenv.c | 98 + stdlib/inlines.c | 3 + stdlib/labs.c | 29 + stdlib/ldbl2mpn.c | 1 + stdlib/ldiv.c | 54 + stdlib/llabs.c | 31 + stdlib/lldiv.c | 57 + stdlib/longlong.h | 152 +- stdlib/lshift.c | 87 + stdlib/makecontext.c | 30 + stdlib/mod_1.c | 197 ++ stdlib/mp_clz_tab.c | 37 + stdlib/mpn2dbl.c | 30 + stdlib/mpn2flt.c | 30 + stdlib/mpn2ldbl.c | 1 + stdlib/mul.c | 152 ++ stdlib/mul_1.c | 59 + stdlib/mul_n.c | 401 ++++ stdlib/on_exit.c | 10 +- stdlib/putenv.c | 72 + stdlib/rshift.c | 88 + stdlib/setcontext.c | 32 + stdlib/setenv.c | 353 +++ stdlib/strtod_l.c | 4 +- stdlib/strtoimax.c | 1 + stdlib/strtol.c | 111 + stdlib/strtol_l.c | 557 +++++ stdlib/strtold_l.c | 58 + stdlib/strtoll.c | 34 + stdlib/strtoll_l.c | 28 + stdlib/strtoul.c | 21 + stdlib/strtoul_l.c | 28 + stdlib/strtoull.c | 34 + stdlib/strtoull_l.c | 29 + stdlib/strtoumax.c | 1 + stdlib/sub_n.c | 62 + stdlib/submul_1.c | 65 + stdlib/swapcontext.c | 33 + stdlib/system.c | 38 + stdlib/udiv_qrnnd.c | 10 + stdlib/wcstoimax.c | 1 + stdlib/wcstoumax.c | 1 + streams/fattach.c | 33 + streams/fdetach.c | 32 + streams/getmsg.c | 35 + streams/getpmsg.c | 36 + streams/isastream.c | 35 + streams/putmsg.c | 35 + streams/putpmsg.c | 36 + string/_strerror.c | 67 + string/bcopy.c | 29 + string/bzero.c | 83 + string/ffs.c | 55 + string/ffsll.c | 42 + string/memccpy.c | 46 + string/memchr.c | 215 ++ string/memcmp.c | 381 +++ string/memcpy.c | 65 + string/memmem.c | 58 + string/memmove.c | 112 + string/mempcpy.c | 69 + string/memrchr.c | 210 ++ string/memset.c | 91 + string/rawmemchr.c | 189 ++ string/stpcpy.c | 55 + string/stpncpy.c | 100 + string/strcasecmp.c | 74 + string/strcasecmp_l.c | 23 + string/strcasestr.c | 142 ++ string/strcat.c | 52 + string/strchr.c | 190 ++ string/strchrnul.c | 170 ++ string/strcmp.c | 47 + string/strcpy.c | 50 + string/strcspn.c | 51 + string/string-inlines.c | 35 + string/strlen.c | 153 ++ string/strncase.c | 76 + string/strncase_l.c | 25 + string/strncat.c | 85 + string/strncmp.c | 73 + string/strncpy.c | 87 + string/strnlen.c | 161 ++ string/strpbrk.c | 46 + string/strrchr.c | 50 + string/strsep.c | 70 + string/strspn.c | 47 + string/strstr.c | 123 + string/strtok.c | 66 + string/strtok_r.c | 79 + string/wordcopy.c | 413 ++++ string/xpg-strerror.c | 57 + sunrpc/auth_des.c | 2 +- sunrpc/bindrsvprt.c | 9 +- sunrpc/rpc_clntout.c | 4 - sunrpc/rpc_cout.c | 4 - sunrpc/rpc_hout.c | 4 - sunrpc/rpc_main.c | 4 - sunrpc/rpc_parse.c | 4 - sunrpc/rpc_sample.c | 4 - sunrpc/rpc_scan.c | 4 - sunrpc/rpc_svcout.c | 4 - sunrpc/rpc_tblout.c | 4 - sunrpc/rpc_util.c | 4 - sysdeps/alpha/fpu/s_cacosf.c | 4 +- sysdeps/alpha/fpu/s_cacoshf.c | 4 +- sysdeps/alpha/fpu/s_casinf.c | 4 +- sysdeps/alpha/fpu/s_casinhf.c | 4 +- sysdeps/alpha/fpu/s_catanf.c | 4 +- sysdeps/alpha/fpu/s_catanhf.c | 4 +- sysdeps/alpha/fpu/s_ccosf.c | 4 +- sysdeps/alpha/fpu/s_ccoshf.c | 4 +- sysdeps/alpha/fpu/s_cexpf.c | 4 +- sysdeps/alpha/fpu/s_clog10f.c | 4 +- sysdeps/alpha/fpu/s_clogf.c | 4 +- sysdeps/alpha/fpu/s_cpowf.c | 4 +- sysdeps/alpha/fpu/s_cprojf.c | 4 +- sysdeps/alpha/fpu/s_csinf.c | 4 +- sysdeps/alpha/fpu/s_csinhf.c | 4 +- sysdeps/alpha/fpu/s_csqrtf.c | 4 +- sysdeps/alpha/fpu/s_ctanf.c | 4 +- sysdeps/alpha/fpu/s_ctanhf.c | 4 +- sysdeps/alpha/libc-tls.c | 4 +- sysdeps/alpha/strncmp.S | 33 +- sysdeps/generic/Dist | 3 - sysdeps/generic/Makefile | 18 +- sysdeps/generic/__longjmp.c | 36 - sysdeps/generic/_exit.c | 36 - sysdeps/generic/_strerror.c | 67 - sysdeps/generic/abort.c | 140 -- sysdeps/generic/accept.c | 40 - sysdeps/generic/access.c | 41 - sysdeps/generic/acct.c | 34 - sysdeps/generic/add_n.c | 62 - sysdeps/generic/addmul_1.c | 65 - sysdeps/generic/adjtime.c | 37 - sysdeps/generic/aio_cancel.c | 44 - sysdeps/generic/aio_fsync.c | 51 - sysdeps/generic/aio_misc.c | 29 - sysdeps/generic/aio_notify.c | 24 - sysdeps/generic/aio_read.c | 36 - sysdeps/generic/aio_read64.c | 2 - sysdeps/generic/aio_sigqueue.c | 36 - sysdeps/generic/aio_suspend.c | 46 - sysdeps/generic/aio_write.c | 36 - sysdeps/generic/aio_write64.c | 2 - sysdeps/generic/alarm.c | 39 - sysdeps/generic/allocrtsig.c | 96 - sysdeps/generic/alphasort64.c | 27 - sysdeps/generic/backtrace.c | 94 - sysdeps/generic/backtracesyms.c | 58 - sysdeps/generic/backtracesymsfd.c | 64 - sysdeps/generic/bb_init_func.c | 54 - sysdeps/generic/bcopy.c | 29 - sysdeps/generic/bind.c | 36 - sysdeps/generic/brdinit.c | 32 - sysdeps/generic/brk.c | 37 - sysdeps/generic/bsd-_setjmp.c | 35 - sysdeps/generic/bsd-setjmp.c | 34 - sysdeps/generic/bzero.c | 83 - sysdeps/generic/cabsf.c | 29 - sysdeps/generic/cargf.c | 29 - sysdeps/generic/chdir.c | 40 - sysdeps/generic/check_fds.c | 102 - sysdeps/generic/check_pf.c | 50 - sysdeps/generic/chflags.c | 43 - sysdeps/generic/chmod.c | 42 - sysdeps/generic/chown.c | 45 - sysdeps/generic/chroot.c | 34 - sysdeps/generic/cimagf.c | 28 - sysdeps/generic/clock.c | 32 - sysdeps/generic/clock_getcpuclockid.c | 39 - sysdeps/generic/clock_getres.c | 30 - sysdeps/generic/clock_gettime.c | 31 - sysdeps/generic/clock_nanosleep.c | 39 - sysdeps/generic/clock_settime.c | 30 - sysdeps/generic/close.c | 40 - sysdeps/generic/closedir.c | 35 - sysdeps/generic/cmp.c | 56 - sysdeps/generic/configure | 108 - sysdeps/generic/configure.in | 6 - sysdeps/generic/conjf.c | 28 - sysdeps/generic/connect.c | 38 - sysdeps/generic/console.c | 42 - sysdeps/generic/crealf.c | 28 - sysdeps/generic/creat.c | 36 - sysdeps/generic/creat64.c | 31 - sysdeps/generic/ctermid.c | 36 - sysdeps/generic/cuserid.c | 35 - sysdeps/generic/dbl2mpn.c | 32 - sysdeps/generic/det_endian.c | 35 - sysdeps/generic/dirfd.c | 33 - sysdeps/generic/div.c | 86 - sysdeps/generic/divmod_1.c | 208 -- sysdeps/generic/divrem.c | 245 -- sysdeps/generic/dl-brk.c | 5 - sysdeps/generic/dl-cache.c | 311 --- sysdeps/generic/dl-environ.c | 86 - sysdeps/generic/dl-execstack.c | 32 - sysdeps/generic/dl-fptr.c | 323 --- sysdeps/generic/dl-origin.c | 51 - sysdeps/generic/dl-sbrk.c | 5 - sysdeps/generic/dl-symaddr.c | 33 - sysdeps/generic/dl-sysdep.c | 590 ----- sysdeps/generic/dl-tls.c | 799 ------- sysdeps/generic/dl-trampoline.c | 1 - sysdeps/generic/dup.c | 34 - sysdeps/generic/dup2.c | 48 - sysdeps/generic/dwarf2.h | 32 +- sysdeps/generic/e_acoshl.c | 14 - sysdeps/generic/e_acosl.c | 14 - sysdeps/generic/e_asinl.c | 14 - sysdeps/generic/e_atan2l.c | 14 - sysdeps/generic/e_atanhl.c | 14 - sysdeps/generic/e_coshl.c | 14 - sysdeps/generic/e_exp10.c | 30 - sysdeps/generic/e_exp10f.c | 30 - sysdeps/generic/e_exp10l.c | 30 - sysdeps/generic/e_exp2l.c | 14 - sysdeps/generic/e_expl.c | 14 - sysdeps/generic/e_fmodl.c | 14 - sysdeps/generic/e_gammal_r.c | 15 - sysdeps/generic/e_hypotl.c | 14 - sysdeps/generic/e_j0l.c | 25 - sysdeps/generic/e_j1l.c | 25 - sysdeps/generic/e_jnl.c | 25 - sysdeps/generic/e_lgammal_r.c | 17 - sysdeps/generic/e_log10l.c | 14 - sysdeps/generic/e_log2l.c | 14 - sysdeps/generic/e_logl.c | 14 - sysdeps/generic/e_powl.c | 14 - sysdeps/generic/e_rem_pio2l.c | 15 - sysdeps/generic/e_scalb.c | 71 - sysdeps/generic/e_scalbf.c | 68 - sysdeps/generic/e_scalbl.c | 75 - sysdeps/generic/e_sinhl.c | 14 - sysdeps/generic/e_sqrtl.c | 14 - sysdeps/generic/enbl-secure.c | 37 - sysdeps/generic/endutxent.c | 27 - sysdeps/generic/environ.c | 12 - sysdeps/generic/errlist.c | 37 - sysdeps/generic/errno-loc.c | 37 - sysdeps/generic/errno.c | 53 - sysdeps/generic/euidaccess.c | 40 - sysdeps/generic/exc2signal.c | 71 - sysdeps/generic/execve.c | 44 - sysdeps/generic/fattach.c | 33 - sysdeps/generic/fchdir.c | 33 - sysdeps/generic/fchflags.c | 43 - sysdeps/generic/fchmod.c | 42 - sysdeps/generic/fchown.c | 43 - sysdeps/generic/fchownat.c | 51 - sysdeps/generic/fclrexcpt.c | 37 - sysdeps/generic/fcntl.c | 41 - sysdeps/generic/fdatasync.c | 28 - sysdeps/generic/fdetach.c | 32 - sysdeps/generic/fdopendir.c | 34 - sysdeps/generic/fedisblxcpt.c | 30 - sysdeps/generic/feenablxcpt.c | 30 - sysdeps/generic/fegetenv.c | 38 - sysdeps/generic/fegetexcept.c | 30 - sysdeps/generic/fegetround.c | 29 - sysdeps/generic/feholdexcpt.c | 30 - sysdeps/generic/fesetenv.c | 38 - sysdeps/generic/fesetround.c | 30 - sysdeps/generic/feupdateenv.c | 37 - sysdeps/generic/fexecve.c | 43 - sysdeps/generic/ffs.c | 55 - sysdeps/generic/ffsll.c | 42 - sysdeps/generic/fgetexcptflg.c | 37 - sysdeps/generic/fgetxattr.c | 31 - sysdeps/generic/flistxattr.c | 30 - sysdeps/generic/flock.c | 36 - sysdeps/generic/flockfile.c | 30 - sysdeps/generic/fork.c | 36 - sysdeps/generic/fpathconf.c | 62 - sysdeps/generic/fpu_control.c | 25 - sysdeps/generic/fraiseexcpt.c | 38 - sysdeps/generic/fremovexattr.c | 30 - sysdeps/generic/fsetexcptflg.c | 37 - sysdeps/generic/fsetxattr.c | 31 - sysdeps/generic/fstatfs.c | 34 - sysdeps/generic/fstatfs64.c | 32 - sysdeps/generic/fstatvfs.c | 33 - sysdeps/generic/fstatvfs64.c | 32 - sysdeps/generic/fsync.c | 33 - sysdeps/generic/ftestexcept.c | 29 - sysdeps/generic/ftime.c | 43 - sysdeps/generic/ftruncate.c | 36 - sysdeps/generic/ftruncate64.c | 36 - sysdeps/generic/ftrylockfile.c | 31 - sysdeps/generic/funlockfile.c | 30 - sysdeps/generic/futimes.c | 34 - sysdeps/generic/futimesat.c | 48 - sysdeps/generic/fxstat.c | 50 - sysdeps/generic/fxstat64.c | 49 - sysdeps/generic/fxstatat.c | 49 - sysdeps/generic/fxstatat64.c | 50 - sysdeps/generic/gai_sigqueue.c | 36 - sysdeps/generic/gai_strerror.c | 29 - sysdeps/generic/get_clockfreq.c | 28 - sysdeps/generic/getaddrinfo.c | 41 - sysdeps/generic/getclktck.c | 30 - sysdeps/generic/getcontext.c | 32 - sysdeps/generic/getcwd.c | 40 - sysdeps/generic/getdents.c | 37 - sysdeps/generic/getdents64.c | 36 - sysdeps/generic/getdomain.c | 64 - sysdeps/generic/getdtsz.c | 33 - sysdeps/generic/getegid.c | 32 - sysdeps/generic/getenv.c | 98 - sysdeps/generic/geteuid.c | 33 - sysdeps/generic/getgid.c | 33 - sysdeps/generic/getgroups.c | 48 - sysdeps/generic/gethostid.c | 32 - sysdeps/generic/gethostname.c | 36 - sysdeps/generic/getipv4sourcefilter.c | 32 - sysdeps/generic/getitimer.c | 42 - sysdeps/generic/getloadavg.c | 37 - sysdeps/generic/getlogin.c | 33 - sysdeps/generic/getlogin_r.c | 37 - sysdeps/generic/getmsg.c | 35 - sysdeps/generic/getpagesize.c | 33 - sysdeps/generic/getpeername.c | 36 - sysdeps/generic/getpgid.c | 33 - sysdeps/generic/getpgrp.c | 27 - sysdeps/generic/getpid.c | 34 - sysdeps/generic/getpmsg.c | 36 - sysdeps/generic/getppid.c | 33 - sysdeps/generic/getpriority.c | 37 - sysdeps/generic/getpt.c | 45 - sysdeps/generic/getresgid.c | 34 - sysdeps/generic/getresuid.c | 34 - sysdeps/generic/getrlimit.c | 34 - sysdeps/generic/getrlimit64.c | 43 - sysdeps/generic/getrusage.c | 35 - sysdeps/generic/getsid.c | 32 - sysdeps/generic/getsockname.c | 36 - sysdeps/generic/getsockopt.c | 38 - sysdeps/generic/getsourcefilter.c | 33 - sysdeps/generic/getsysstats.c | 69 - sysdeps/generic/gettimeofday.c | 39 - sysdeps/generic/getuid.c | 33 - sysdeps/generic/getutmp.c | 46 - sysdeps/generic/getutmpx.c | 48 - sysdeps/generic/getutxent.c | 27 - sysdeps/generic/getutxid.c | 27 - sysdeps/generic/getutxline.c | 27 - sysdeps/generic/getxattr.c | 31 - sysdeps/generic/glob.c | 1558 ------------- sysdeps/generic/glob64.c | 54 - sysdeps/generic/grantpt.c | 35 - sysdeps/generic/group_member.c | 50 - sysdeps/generic/gtty.c | 40 - sysdeps/generic/herrno-loc.c | 34 - sysdeps/generic/htonl.c | 36 - sysdeps/generic/htons.c | 36 - sysdeps/generic/if_index.c | 65 - sysdeps/generic/ifaddrs.c | 46 - sysdeps/generic/ifreq.c | 80 - sysdeps/generic/init-first.c | 59 - sysdeps/generic/init-posix.c | 1 - sysdeps/generic/inlines.c | 3 - sysdeps/generic/ioctl.c | 35 - sysdeps/generic/isastream.c | 35 - sysdeps/generic/isatty.c | 34 - sysdeps/generic/isfdtype.c | 31 - sysdeps/generic/jmp-unwind.c | 29 - sysdeps/generic/k_cosl.c | 15 - sysdeps/generic/k_rem_pio2l.c | 16 - sysdeps/generic/k_sincosl.c | 1 - sysdeps/generic/k_sinl.c | 15 - sysdeps/generic/k_tanl.c | 15 - sysdeps/generic/kill.c | 37 - sysdeps/generic/killpg.c | 36 - sysdeps/generic/labs.c | 29 - sysdeps/generic/lchmod.c | 33 - sysdeps/generic/lchown.c | 43 - sysdeps/generic/ldbl2mpn.c | 1 - sysdeps/generic/ldiv.c | 54 - sysdeps/generic/ldsodefs.h | 4 +- sysdeps/generic/lgetxattr.c | 31 - sysdeps/generic/libc-start.c | 263 --- sysdeps/generic/libc-tls.c | 263 --- sysdeps/generic/libc_fatal.c | 31 - sysdeps/generic/link.c | 42 - sysdeps/generic/lio_listio.c | 42 - sysdeps/generic/lio_listio64.c | 2 - sysdeps/generic/listen.c | 37 - sysdeps/generic/listxattr.c | 30 - sysdeps/generic/llabs.c | 31 - sysdeps/generic/lldiv.c | 57 - sysdeps/generic/llistxattr.c | 30 - sysdeps/generic/lockf.c | 74 - sysdeps/generic/lockf64.c | 79 - sysdeps/generic/longjmp-ts.c | 32 - sysdeps/generic/longjmp.c | 46 - sysdeps/generic/lremovexattr.c | 30 - sysdeps/generic/lseek.c | 53 - sysdeps/generic/lseek64.c | 49 - sysdeps/generic/lsetxattr.c | 31 - sysdeps/generic/lshift.c | 87 - sysdeps/generic/lutimes.c | 35 - sysdeps/generic/lxstat.c | 27 - sysdeps/generic/lxstat64.c | 39 - sysdeps/generic/madvise.c | 33 - sysdeps/generic/makecontext.c | 30 - sysdeps/generic/memccpy.c | 46 - sysdeps/generic/memchr.c | 215 -- sysdeps/generic/memcmp.c | 381 --- sysdeps/generic/memcpy.c | 65 - sysdeps/generic/memcpy_chk.c | 66 - sysdeps/generic/memmem.c | 58 - sysdeps/generic/memmove.c | 112 - sysdeps/generic/memmove_chk.c | 98 - sysdeps/generic/mempcpy.c | 69 - sysdeps/generic/mempcpy_chk.c | 67 - sysdeps/generic/memrchr.c | 210 -- sysdeps/generic/memset.c | 91 - sysdeps/generic/memset_chk.c | 92 - sysdeps/generic/mig-reply.c | 53 - sysdeps/generic/mincore.c | 30 - sysdeps/generic/mkdir.c | 43 - sysdeps/generic/mkfifo.c | 43 - sysdeps/generic/mknod.c | 62 - sysdeps/generic/mlock.c | 35 - sysdeps/generic/mlockall.c | 36 - sysdeps/generic/mmap.c | 41 - sysdeps/generic/mmap64.c | 48 - sysdeps/generic/mod_1.c | 197 -- sysdeps/generic/morecore.c | 54 - sysdeps/generic/mp_clz_tab.c | 37 - sysdeps/generic/mpn2dbl.c | 30 - sysdeps/generic/mpn2flt.c | 30 - sysdeps/generic/mpn2ldbl.c | 1 - sysdeps/generic/mprotect.c | 36 - sysdeps/generic/mq_close.c | 31 - sysdeps/generic/mq_getattr.c | 30 - sysdeps/generic/mq_notify.c | 31 - sysdeps/generic/mq_open.c | 36 - sysdeps/generic/mq_receive.c | 32 - sysdeps/generic/mq_send.c | 31 - sysdeps/generic/mq_setattr.c | 33 - sysdeps/generic/mq_timedreceive.c | 34 - sysdeps/generic/mq_timedsend.c | 33 - sysdeps/generic/mq_unlink.c | 30 - sysdeps/generic/msgctl.c | 37 - sysdeps/generic/msgget.c | 36 - sysdeps/generic/msgrcv.c | 42 - sysdeps/generic/msgsnd.c | 41 - sysdeps/generic/msync.c | 35 - sysdeps/generic/mul.c | 152 -- sysdeps/generic/mul_1.c | 59 - sysdeps/generic/mul_n.c | 401 ---- sysdeps/generic/munlock.c | 34 - sysdeps/generic/munlockall.c | 34 - sysdeps/generic/munmap.c | 35 - sysdeps/generic/nanosleep.c | 36 - sysdeps/generic/nice.c | 33 - sysdeps/generic/nscd_setup_thread.c | 28 - sysdeps/generic/open.c | 54 - sysdeps/generic/open64.c | 57 - sysdeps/generic/openat.c | 69 - sysdeps/generic/openat64.c | 69 - sysdeps/generic/opendir.c | 34 - sysdeps/generic/opensock.c | 71 - sysdeps/generic/pathconf.c | 41 - sysdeps/generic/pause.c | 34 - sysdeps/generic/pipe.c | 44 - sysdeps/generic/poll.c | 39 - sysdeps/generic/posix_fadvise.c | 31 - sysdeps/generic/posix_fadvise64.c | 31 - sysdeps/generic/posix_fallocate.c | 31 - sysdeps/generic/posix_fallocate64.c | 31 - sysdeps/generic/posix_madvise.c | 32 - sysdeps/generic/pread.c | 46 - sysdeps/generic/pread64.c | 46 - sysdeps/generic/printf_fphex.c | 490 ---- sysdeps/generic/prof-freq.c | 55 - sysdeps/generic/profil.c | 42 - sysdeps/generic/pselect.c | 88 - sysdeps/generic/ptrace.c | 103 - sysdeps/generic/ptsname.c | 47 - sysdeps/generic/putenv.c | 72 - sysdeps/generic/putmsg.c | 35 - sysdeps/generic/putpmsg.c | 36 - sysdeps/generic/pututxline.c | 27 - sysdeps/generic/pwrite.c | 46 - sysdeps/generic/pwrite64.c | 47 - sysdeps/generic/raise.c | 34 - sysdeps/generic/rawmemchr.c | 189 -- sysdeps/generic/read.c | 49 - sysdeps/generic/readdir.c | 33 - sysdeps/generic/readdir64.c | 32 - sysdeps/generic/readdir64_r.c | 33 - sysdeps/generic/readdir_r.c | 35 - sysdeps/generic/readelflib.c | 220 -- sysdeps/generic/readlink.c | 37 - sysdeps/generic/readonly-area.c | 34 - sysdeps/generic/readv.c | 41 - sysdeps/generic/reboot.c | 34 - sysdeps/generic/recv.c | 37 - sysdeps/generic/recvfrom.c | 41 - sysdeps/generic/recvmsg.c | 37 - sysdeps/generic/remap_file_pages.c | 35 - sysdeps/generic/remove.c | 33 - sysdeps/generic/removexattr.c | 30 - sysdeps/generic/rename.c | 41 - sysdeps/generic/renameat.c | 50 - sysdeps/generic/res-state.c | 45 - sysdeps/generic/revoke.c | 31 - sysdeps/generic/rewinddir.c | 35 - sysdeps/generic/rmdir.c | 41 - sysdeps/generic/rshift.c | 88 - sysdeps/generic/s_asinhl.c | 15 - sysdeps/generic/s_atanl.c | 15 - sysdeps/generic/s_cacos.c | 41 - sysdeps/generic/s_cacosf.c | 39 - sysdeps/generic/s_cacosh.c | 88 - sysdeps/generic/s_cacoshf.c | 101 - sysdeps/generic/s_cacoshl.c | 84 - sysdeps/generic/s_cacosl.c | 37 - sysdeps/generic/s_casin.c | 66 - sysdeps/generic/s_casinf.c | 64 - sysdeps/generic/s_casinh.c | 84 - sysdeps/generic/s_casinhf.c | 82 - sysdeps/generic/s_casinhl.c | 80 - sysdeps/generic/s_casinl.c | 62 - sysdeps/generic/s_catan.c | 89 - sysdeps/generic/s_catanf.c | 87 - sysdeps/generic/s_catanh.c | 84 - sysdeps/generic/s_catanhf.c | 82 - sysdeps/generic/s_catanhl.c | 80 - sysdeps/generic/s_catanl.c | 85 - sysdeps/generic/s_cbrtl.c | 15 - sysdeps/generic/s_ccos.c | 80 - sysdeps/generic/s_ccosf.c | 78 - sysdeps/generic/s_ccosh.c | 105 - sysdeps/generic/s_ccoshf.c | 103 - sysdeps/generic/s_ccoshl.c | 101 - sysdeps/generic/s_ccosl.c | 76 - sysdeps/generic/s_cexp.c | 127 - sysdeps/generic/s_cexpf.c | 125 - sysdeps/generic/s_cexpl.c | 123 - sysdeps/generic/s_clog.c | 65 - sysdeps/generic/s_clog10.c | 65 - sysdeps/generic/s_clog10f.c | 63 - sysdeps/generic/s_clog10l.c | 61 - sysdeps/generic/s_clogf.c | 63 - sysdeps/generic/s_clogl.c | 61 - sysdeps/generic/s_cpow.c | 34 - sysdeps/generic/s_cpowf.c | 32 - sysdeps/generic/s_cpowl.c | 30 - sysdeps/generic/s_cproj.c | 51 - sysdeps/generic/s_cprojf.c | 49 - sysdeps/generic/s_cprojl.c | 48 - sysdeps/generic/s_csin.c | 131 -- sysdeps/generic/s_csinf.c | 129 - sysdeps/generic/s_csinh.c | 126 - sysdeps/generic/s_csinhf.c | 124 - sysdeps/generic/s_csinhl.c | 122 - sysdeps/generic/s_csinl.c | 127 - sysdeps/generic/s_csqrt.c | 114 - sysdeps/generic/s_csqrtf.c | 112 - sysdeps/generic/s_csqrtl.c | 110 - sysdeps/generic/s_ctan.c | 84 - sysdeps/generic/s_ctanf.c | 83 - sysdeps/generic/s_ctanh.c | 84 - sysdeps/generic/s_ctanhf.c | 82 - sysdeps/generic/s_ctanhl.c | 80 - sysdeps/generic/s_ctanl.c | 81 - sysdeps/generic/s_erfl.c | 26 - sysdeps/generic/s_expm1l.c | 16 - sysdeps/generic/s_fdim.c | 40 - sysdeps/generic/s_fdimf.c | 36 - sysdeps/generic/s_fdiml.c | 36 - sysdeps/generic/s_fma.c | 33 - sysdeps/generic/s_fmaf.c | 28 - sysdeps/generic/s_fmal.c | 28 - sysdeps/generic/s_fmax.c | 33 - sysdeps/generic/s_fmaxf.c | 29 - sysdeps/generic/s_fmaxl.c | 29 - sysdeps/generic/s_fmin.c | 33 - sysdeps/generic/s_fminf.c | 29 - sysdeps/generic/s_fminl.c | 29 - sysdeps/generic/s_ldexp.c | 37 - sysdeps/generic/s_ldexpf.c | 37 - sysdeps/generic/s_ldexpl.c | 37 - sysdeps/generic/s_log1pl.c | 15 - sysdeps/generic/s_nan.c | 44 - sysdeps/generic/s_nanf.c | 40 - sysdeps/generic/s_nanl.c | 40 - sysdeps/generic/s_nextafter.c | 100 - sysdeps/generic/s_nexttowardf.c | 86 - sysdeps/generic/s_nexttowardl.c | 1 - sysdeps/generic/s_significand.c | 39 - sysdeps/generic/s_significandf.c | 32 - sysdeps/generic/s_significandl.c | 39 - sysdeps/generic/s_tanhl.c | 15 - sysdeps/generic/sbrk.c | 56 - sysdeps/generic/scandir64.c | 30 - sysdeps/generic/sched_getaffinity.c | 35 - sysdeps/generic/sched_getp.c | 34 - sysdeps/generic/sched_gets.c | 34 - sysdeps/generic/sched_primax.c | 33 - sysdeps/generic/sched_primin.c | 33 - sysdeps/generic/sched_rr_gi.c | 34 - sysdeps/generic/sched_setaffinity.c | 35 - sysdeps/generic/sched_setp.c | 34 - sysdeps/generic/sched_sets.c | 35 - sysdeps/generic/sched_yield.c | 33 - sysdeps/generic/seekdir.c | 41 - sysdeps/generic/segfault.c | 214 -- sysdeps/generic/select.c | 43 - sysdeps/generic/semctl.c | 34 - sysdeps/generic/semget.c | 37 - sysdeps/generic/semop.c | 36 - sysdeps/generic/semtimedop.c | 37 - sysdeps/generic/send.c | 37 - sysdeps/generic/sendfile.c | 33 - sysdeps/generic/sendfile64.c | 33 - sysdeps/generic/sendmsg.c | 37 - sysdeps/generic/sendto.c | 40 - sysdeps/generic/setcontext.c | 32 - sysdeps/generic/setdomain.c | 34 - sysdeps/generic/setegid.c | 32 - sysdeps/generic/setenv.c | 353 --- sysdeps/generic/seteuid.c | 32 - sysdeps/generic/setfpucw.c | 37 - sysdeps/generic/setgid.c | 37 - sysdeps/generic/setgroups.c | 35 - sysdeps/generic/sethostid.c | 34 - sysdeps/generic/sethostname.c | 35 - sysdeps/generic/setipv4sourcefilter.c | 33 - sysdeps/generic/setitimer.c | 44 - sysdeps/generic/setjmp.c | 37 - sysdeps/generic/setlogin.c | 32 - sysdeps/generic/setpgid.c | 37 - sysdeps/generic/setpgrp.c | 25 - sysdeps/generic/setpriority.c | 36 - sysdeps/generic/setregid.c | 36 - sysdeps/generic/setresgid.c | 35 - sysdeps/generic/setresuid.c | 35 - sysdeps/generic/setreuid.c | 36 - sysdeps/generic/setrlimit.c | 37 - sysdeps/generic/setrlimit64.c | 43 - sysdeps/generic/setsid.c | 35 - sysdeps/generic/setsockopt.c | 40 - sysdeps/generic/setsourcefilter.c | 33 - sysdeps/generic/settimeofday.c | 35 - sysdeps/generic/setuid.c | 37 - sysdeps/generic/setutxent.c | 27 - sysdeps/generic/setxattr.c | 31 - sysdeps/generic/shm_open.c | 31 - sysdeps/generic/shm_unlink.c | 31 - sysdeps/generic/shmat.c | 38 - sysdeps/generic/shmctl.c | 36 - sysdeps/generic/shmdt.c | 35 - sysdeps/generic/shmget.c | 37 - sysdeps/generic/shutdown.c | 39 - sysdeps/generic/sigaction.c | 44 - sysdeps/generic/sigaltstack.c | 34 - sysdeps/generic/sigblock.c | 33 - sysdeps/generic/sigfillset.c | 47 - sysdeps/generic/sigignore.c | 33 - sysdeps/generic/sigintr.c | 35 - sysdeps/generic/sigjmp.c | 35 - sysdeps/generic/siglist.c | 38 - sysdeps/generic/signal.c | 38 - sysdeps/generic/signame.c | 312 --- sysdeps/generic/signame.h | 67 - sysdeps/generic/sigpause.c | 53 - sysdeps/generic/sigpending.c | 40 - sysdeps/generic/sigprocmask.c | 51 - sysdeps/generic/sigqueue.c | 33 - sysdeps/generic/sigreturn.c | 32 - sysdeps/generic/sigset.c | 34 - sysdeps/generic/sigsetmask.c | 32 - sysdeps/generic/sigstack.c | 34 - sysdeps/generic/sigsuspend.c | 37 - sysdeps/generic/sigtimedwait.c | 34 - sysdeps/generic/sigvec.c | 39 - sysdeps/generic/sigwait.c | 32 - sysdeps/generic/sigwaitinfo.c | 33 - sysdeps/generic/sleep.c | 41 - sysdeps/generic/sockatmark.c | 33 - sysdeps/generic/socket.c | 38 - sysdeps/generic/socketpair.c | 39 - sysdeps/generic/spawni.c | 46 - sysdeps/generic/speed.c | 72 - sysdeps/generic/sprofil.c | 36 - sysdeps/generic/sstk.c | 35 - sysdeps/generic/start.c | 13 - sysdeps/generic/statfs.c | 35 - sysdeps/generic/statfs64.c | 32 - sysdeps/generic/statvfs.c | 34 - sysdeps/generic/statvfs64.c | 32 - sysdeps/generic/stime.c | 40 - sysdeps/generic/stpcpy.c | 55 - sysdeps/generic/stpcpy_chk.c | 45 - sysdeps/generic/stpncpy.c | 100 - sysdeps/generic/stpncpy_chk.c | 85 - sysdeps/generic/strcasecmp.c | 74 - sysdeps/generic/strcasecmp_l.c | 23 - sysdeps/generic/strcasestr.c | 142 -- sysdeps/generic/strcat.c | 52 - sysdeps/generic/strcat_chk.c | 58 - sysdeps/generic/strchr.c | 190 -- sysdeps/generic/strchrnul.c | 170 -- sysdeps/generic/strcmp.c | 47 - sysdeps/generic/strcpy.c | 50 - sysdeps/generic/strcpy_chk.c | 68 - sysdeps/generic/strcspn.c | 51 - sysdeps/generic/string-inlines.c | 35 - sysdeps/generic/strlen.c | 153 -- sysdeps/generic/strncase.c | 76 - sysdeps/generic/strncase_l.c | 25 - sysdeps/generic/strncat.c | 85 - sysdeps/generic/strncat_chk.c | 100 - sysdeps/generic/strncmp.c | 73 - sysdeps/generic/strncpy.c | 87 - sysdeps/generic/strncpy_chk.c | 89 - sysdeps/generic/strnlen.c | 161 -- sysdeps/generic/strpbrk.c | 46 - sysdeps/generic/strrchr.c | 50 - sysdeps/generic/strsep.c | 70 - sysdeps/generic/strspn.c | 47 - sysdeps/generic/strstr.c | 123 - sysdeps/generic/strtoimax.c | 1 - sysdeps/generic/strtok.c | 66 - sysdeps/generic/strtok_r.c | 79 - sysdeps/generic/strtol.c | 111 - sysdeps/generic/strtol_l.c | 557 ----- sysdeps/generic/strtold_l.c | 58 - sysdeps/generic/strtoll.c | 34 - sysdeps/generic/strtoll_l.c | 28 - sysdeps/generic/strtoul.c | 21 - sysdeps/generic/strtoul_l.c | 28 - sysdeps/generic/strtoull.c | 34 - sysdeps/generic/strtoull_l.c | 29 - sysdeps/generic/strtoumax.c | 1 - sysdeps/generic/strtsupp.c | 28 - sysdeps/generic/stty.c | 40 - sysdeps/generic/sub_n.c | 62 - sysdeps/generic/submul_1.c | 65 - sysdeps/generic/swapcontext.c | 33 - sysdeps/generic/swapoff.c | 31 - sysdeps/generic/swapon.c | 34 - sysdeps/generic/symlink.c | 42 - sysdeps/generic/sync.c | 31 - sysdeps/generic/syscall.c | 35 - sysdeps/generic/sysconf.c | 273 --- sysdeps/generic/sysdep.c | 2 - sysdeps/generic/syslog.c | 438 ---- sysdeps/generic/system.c | 38 - sysdeps/generic/sysv_signal.c | 43 - sysdeps/generic/t_sincosl.c | 1 - sysdeps/generic/tcdrain.c | 39 - sysdeps/generic/tcflow.c | 53 - sysdeps/generic/tcflush.c | 46 - sysdeps/generic/tcgetattr.c | 46 - sysdeps/generic/tcgetpgrp.c | 39 - sysdeps/generic/tcsendbrk.c | 40 - sysdeps/generic/tcsetattr.c | 108 - sysdeps/generic/tcsetpgrp.c | 41 - sysdeps/generic/telldir.c | 41 - sysdeps/generic/tempname.c | 59 - sysdeps/generic/time.c | 36 - sysdeps/generic/timer_create.c | 30 - sysdeps/generic/timer_delete.c | 30 - sysdeps/generic/timer_getoverr.c | 30 - sysdeps/generic/timer_gettime.c | 30 - sysdeps/generic/timer_settime.c | 31 - sysdeps/generic/times.c | 43 - sysdeps/generic/tmpfile.c | 66 - sysdeps/generic/tmpfile64.c | 3 - sysdeps/generic/trampoline.c | 37 - sysdeps/generic/truncate.c | 34 - sysdeps/generic/truncate64.c | 35 - sysdeps/generic/tst-timer.c | 33 - sysdeps/generic/ttyname.c | 38 - sysdeps/generic/ttyname_r.c | 37 - sysdeps/generic/ualarm.c | 37 - sysdeps/generic/udiv_qrnnd.c | 10 - sysdeps/generic/ulimit.c | 39 - sysdeps/generic/umask.c | 34 - sysdeps/generic/uname.c | 66 - sysdeps/generic/unlink.c | 41 - sysdeps/generic/unlinkat.c | 49 - sysdeps/generic/unlockpt.c | 35 - sysdeps/generic/updwtmp.c | 35 - sysdeps/generic/updwtmpx.c | 27 - sysdeps/generic/usleep.c | 32 - sysdeps/generic/ustat.c | 33 - sysdeps/generic/utime.c | 43 - sysdeps/generic/utimes.c | 43 - sysdeps/generic/utmp_file.c | 499 ---- sysdeps/generic/utmpxname.c | 27 - sysdeps/generic/versionsort64.c | 27 - sysdeps/generic/vfork.c | 31 - sysdeps/generic/vhangup.c | 33 - sysdeps/generic/vlimit.c | 51 - sysdeps/generic/vtimes.c | 65 - sysdeps/generic/w_acos.c | 48 - sysdeps/generic/w_acosf.c | 48 - sysdeps/generic/w_acosh.c | 47 - sysdeps/generic/w_acoshf.c | 48 - sysdeps/generic/w_acoshl.c | 47 - sysdeps/generic/w_acosl.c | 48 - sysdeps/generic/w_asin.c | 49 - sysdeps/generic/w_asinf.c | 49 - sysdeps/generic/w_asinl.c | 49 - sysdeps/generic/w_atan2.c | 47 - sysdeps/generic/w_atan2f.c | 46 - sysdeps/generic/w_atan2l.c | 47 - sysdeps/generic/w_atanh.c | 52 - sysdeps/generic/w_atanhf.c | 53 - sysdeps/generic/w_atanhl.c | 52 - sysdeps/generic/w_cosh.c | 47 - sysdeps/generic/w_coshf.c | 47 - sysdeps/generic/w_coshl.c | 47 - sysdeps/generic/w_drem.c | 20 - sysdeps/generic/w_dremf.c | 17 - sysdeps/generic/w_dreml.c | 18 - sysdeps/generic/w_exp10.c | 51 - sysdeps/generic/w_exp10f.c | 46 - sysdeps/generic/w_exp10l.c | 46 - sysdeps/generic/w_exp2.c | 36 - sysdeps/generic/w_exp2f.c | 32 - sysdeps/generic/w_exp2l.c | 31 - sysdeps/generic/w_expl.c | 13 - sysdeps/generic/w_fmod.c | 48 - sysdeps/generic/w_fmodf.c | 48 - sysdeps/generic/w_fmodl.c | 48 - sysdeps/generic/w_hypot.c | 48 - sysdeps/generic/w_hypotf.c | 48 - sysdeps/generic/w_hypotl.c | 48 - sysdeps/generic/w_j0.c | 76 - sysdeps/generic/w_j0f.c | 74 - sysdeps/generic/w_j0l.c | 73 - sysdeps/generic/w_j1.c | 77 - sysdeps/generic/w_j1f.c | 75 - sysdeps/generic/w_j1l.c | 74 - sysdeps/generic/w_jn.c | 99 - sysdeps/generic/w_jnf.c | 71 - sysdeps/generic/w_jnl.c | 96 - sysdeps/generic/w_lgamma.c | 60 - sysdeps/generic/w_lgamma_r.c | 51 - sysdeps/generic/w_lgammaf.c | 53 - sysdeps/generic/w_lgammaf_r.c | 52 - sysdeps/generic/w_lgammal.c | 58 - sysdeps/generic/w_lgammal_r.c | 52 - sysdeps/generic/w_log.c | 48 - sysdeps/generic/w_log10.c | 51 - sysdeps/generic/w_log10f.c | 52 - sysdeps/generic/w_log10l.c | 51 - sysdeps/generic/w_log2.c | 32 - sysdeps/generic/w_log2f.c | 30 - sysdeps/generic/w_log2l.c | 28 - sysdeps/generic/w_logf.c | 49 - sysdeps/generic/w_logl.c | 48 - sysdeps/generic/w_pow.c | 70 - sysdeps/generic/w_powf.c | 77 - sysdeps/generic/w_powl.c | 68 - sysdeps/generic/w_remainder.c | 47 - sysdeps/generic/w_remainderf.c | 47 - sysdeps/generic/w_remainderl.c | 48 - sysdeps/generic/w_scalb.c | 65 - sysdeps/generic/w_scalbf.c | 66 - sysdeps/generic/w_scalbl.c | 65 - sysdeps/generic/w_sinh.c | 47 - sysdeps/generic/w_sinhf.c | 47 - sysdeps/generic/w_sinhl.c | 47 - sysdeps/generic/w_sqrt.c | 47 - sysdeps/generic/w_sqrtf.c | 47 - sysdeps/generic/w_sqrtl.c | 47 - sysdeps/generic/w_tgamma.c | 56 - sysdeps/generic/w_tgammaf.c | 53 - sysdeps/generic/w_tgammal.c | 55 - sysdeps/generic/wait.c | 33 - sysdeps/generic/wait3.c | 43 - sysdeps/generic/wait4.c | 33 - sysdeps/generic/waitid.c | 35 - sysdeps/generic/waitpid.c | 53 - sysdeps/generic/wcstoimax.c | 1 - sysdeps/generic/wcstol.c | 23 - sysdeps/generic/wcstol_l.c | 30 - sysdeps/generic/wcstoll.c | 25 - sysdeps/generic/wcstoll_l.c | 30 - sysdeps/generic/wcstoul.c | 23 - sysdeps/generic/wcstoul_l.c | 30 - sysdeps/generic/wcstoull.c | 25 - sysdeps/generic/wcstoull_l.c | 31 - sysdeps/generic/wcstoumax.c | 1 - sysdeps/generic/wordcopy.c | 413 ---- sysdeps/generic/wordexp.c | 2457 -------------------- sysdeps/generic/write.c | 50 - sysdeps/generic/writev.c | 41 - sysdeps/generic/xmknod.c | 42 - sysdeps/generic/xpg-strerror.c | 57 - sysdeps/generic/xstat.c | 39 - sysdeps/generic/xstat64.c | 38 - sysdeps/gnu/glob64.c | 2 +- sysdeps/gnu/updwtmp.c | 4 +- sysdeps/gnu/utmp_file.c | 4 +- sysdeps/hppa/bits/setjmp.h | 6 +- sysdeps/i386/__longjmp.S | 5 +- sysdeps/i386/bsd-_setjmp.S | 5 +- sysdeps/i386/bsd-setjmp.S | 7 + sysdeps/i386/bzero.c | 4 +- sysdeps/i386/elf/bsd-setjmp.S | 82 - sysdeps/i386/elf/setjmp.S | 70 - sysdeps/i386/ffs.c | 4 +- sysdeps/i386/i686/ffs.c | 4 +- sysdeps/i386/memset.c | 4 +- sysdeps/i386/setjmp.S | 13 +- sysdeps/ia64/fpu/printf_fphex.c | 4 +- sysdeps/ia64/libc-tls.c | 5 +- sysdeps/ieee754/ldbl-128/printf_fphex.c | 4 +- sysdeps/ieee754/ldbl-96/printf_fphex.c | 4 +- sysdeps/ieee754/ldbl-96/strtold_l.c | 4 +- sysdeps/m68k/bits/setjmp.h | 6 +- sysdeps/m68k/ffs.c | 4 +- sysdeps/mach/hurd/getdents.c | 2 +- sysdeps/mach/hurd/init-posix.c | 2 +- sysdeps/mach/msync.c | 4 +- sysdeps/mach/sys/reboot.h | 136 +- sysdeps/mips/bits/setjmp.h | 2 +- sysdeps/mips/libc-tls.c | 2 +- sysdeps/posix/euidaccess.c | 88 +- sysdeps/posix/getaddrinfo.c | 92 +- sysdeps/posix/profil.c | 4 +- sysdeps/posix/shm_open.c | 4 +- sysdeps/posix/shm_unlink.c | 4 +- sysdeps/posix/sprofil.c | 4 +- sysdeps/powerpc/dl-procinfo.c | 66 + sysdeps/powerpc/dl-procinfo.h | 75 + sysdeps/powerpc/elf/libc-start.c | 4 +- sysdeps/powerpc/ffs.c | 4 +- sysdeps/powerpc/powerpc32/setjmp-common.S | 8 +- sysdeps/powerpc/powerpc64/setjmp-common.S | 7 +- sysdeps/rs6000/ffs.c | 4 +- sysdeps/s390/bits/setjmp.h | 4 + sysdeps/s390/libc-tls.c | 4 +- sysdeps/sh/bits/setjmp.h | 2 +- sysdeps/unix/mkfifoat.c | 32 + sysdeps/unix/opendir.c | 2 +- sysdeps/unix/sysv/linux/Makefile | 5 - sysdeps/unix/sysv/linux/aio_sigqueue.c | 4 +- sysdeps/unix/sysv/linux/alpha/bits/mman.h | 1 + sysdeps/unix/sysv/linux/alpha/fxstatat.c | 7 +- sysdeps/unix/sysv/linux/alpha/glob.c | 4 +- sysdeps/unix/sysv/linux/alpha/sigaction.c | 2 + sysdeps/unix/sysv/linux/alpha/wordexp.c | 4 +- sysdeps/unix/sysv/linux/dl-sbrk.c | 2 +- sysdeps/unix/sysv/linux/dl-sysdep.c | 4 +- sysdeps/unix/sysv/linux/fchownat.c | 2 + sysdeps/unix/sysv/linux/ftruncate64.c | 4 +- sysdeps/unix/sysv/linux/fxstatat64.c | 1 + sysdeps/unix/sysv/linux/gai_sigqueue.c | 4 +- sysdeps/unix/sysv/linux/i386/getmsg.c | 4 +- sysdeps/unix/sysv/linux/i386/getresgid.c | 4 +- sysdeps/unix/sysv/linux/i386/getresuid.c | 4 +- sysdeps/unix/sysv/linux/i386/getrlimit64.c | 4 +- sysdeps/unix/sysv/linux/i386/glob64.c | 4 +- sysdeps/unix/sysv/linux/i386/lchown.c | 4 +- sysdeps/unix/sysv/linux/i386/putmsg.c | 4 +- sysdeps/unix/sysv/linux/i386/readelflib.c | 6 +- sysdeps/unix/sysv/linux/i386/setresgid.c | 4 +- sysdeps/unix/sysv/linux/i386/setresuid.c | 4 +- sysdeps/unix/sysv/linux/i386/sysdep.h | 20 + sysdeps/unix/sysv/linux/ia64/readelflib.c | 6 +- sysdeps/unix/sysv/linux/kernel-features.h | 5 + sysdeps/unix/sysv/linux/linkat.c | 87 + sysdeps/unix/sysv/linux/mips/bits/mman.h | 3 +- sysdeps/unix/sysv/linux/mips/ftruncate64.c | 4 +- sysdeps/unix/sysv/linux/mips/readelflib.c | 6 +- sysdeps/unix/sysv/linux/mips/truncate64.c | 4 +- sysdeps/unix/sysv/linux/mkdirat.c | 66 + sysdeps/unix/sysv/linux/mq_close.c | 4 +- sysdeps/unix/sysv/linux/mq_getattr.c | 4 +- sysdeps/unix/sysv/linux/mq_notify.c | 4 +- sysdeps/unix/sysv/linux/mq_open.c | 4 +- sysdeps/unix/sysv/linux/mq_receive.c | 4 +- sysdeps/unix/sysv/linux/mq_send.c | 4 +- sysdeps/unix/sysv/linux/mq_unlink.c | 4 +- sysdeps/unix/sysv/linux/nscd_setup_thread.c | 22 +- .../sysv/linux/powerpc/powerpc32/ftruncate64.c | 2 +- .../unix/sysv/linux/powerpc/powerpc32/truncate64.c | 2 +- sysdeps/unix/sysv/linux/powerpc/readelflib.c | 6 +- sysdeps/unix/sysv/linux/readlinkat.c | 69 + sysdeps/unix/sysv/linux/renameat.c | 87 +- sysdeps/unix/sysv/linux/s390/readelflib.c | 6 +- sysdeps/unix/sysv/linux/sched_getaffinity.c | 4 +- sysdeps/unix/sysv/linux/sched_setaffinity.c | 4 +- sysdeps/unix/sysv/linux/segfault.c | 2 +- sysdeps/unix/sysv/linux/sigqueue.c | 4 +- sysdeps/unix/sysv/linux/sigreturn.c | 2 +- sysdeps/unix/sysv/linux/sigstack.c | 4 +- sysdeps/unix/sysv/linux/sigtimedwait.c | 4 +- sysdeps/unix/sysv/linux/sigwaitinfo.c | 4 +- sysdeps/unix/sysv/linux/sparc/readelflib.c | 6 +- sysdeps/unix/sysv/linux/symlinkat.c | 67 + sysdeps/unix/sysv/linux/sys/quota.h | 2 - sysdeps/unix/sysv/linux/syslog.c | 2 +- sysdeps/unix/sysv/linux/truncate64.c | 4 +- sysdeps/unix/sysv/linux/updwtmp.c | 4 +- sysdeps/unix/sysv/linux/utmp_file.c | 4 +- sysdeps/unix/sysv/linux/vfork.c | 2 +- sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c | 4 +- sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h | 4 +- sysdeps/unix/sysv/linux/x86_64/readelflib.c | 6 +- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 27 + sysdeps/unix/sysv/linux/xmknodat.c | 75 + sysdeps/wordsize-32/llabs.c | 4 +- sysdeps/wordsize-32/lldiv.c | 4 +- sysdeps/wordsize-64/glob.c | 2 +- sysdeps/wordsize-64/labs.c | 4 +- sysdeps/wordsize-64/ldiv.c | 4 +- sysdeps/wordsize-64/strtol.c | 2 +- sysdeps/wordsize-64/strtol_l.c | 2 +- sysdeps/wordsize-64/strtoul.c | 2 +- sysdeps/wordsize-64/strtoul_l.c | 2 +- sysdeps/wordsize-64/wcstol.c | 2 +- sysdeps/wordsize-64/wcstol_l.c | 2 +- sysdeps/wordsize-64/wcstoul.c | 2 +- sysdeps/wordsize-64/wcstoul_l.c | 2 +- sysdeps/x86_64/__longjmp.S | 5 +- sysdeps/x86_64/bsd-setjmp.S | 1 + sysdeps/x86_64/fpu/printf_fphex.c | 4 +- sysdeps/x86_64/setjmp.S | 15 +- sysvipc/msgctl.c | 37 + sysvipc/msgget.c | 36 + sysvipc/msgrcv.c | 42 + sysvipc/msgsnd.c | 41 + sysvipc/semctl.c | 34 + sysvipc/semget.c | 37 + sysvipc/semop.c | 36 + sysvipc/semtimedop.c | 37 + sysvipc/shmat.c | 38 + sysvipc/shmctl.c | 36 + sysvipc/shmdt.c | 35 + sysvipc/shmget.c | 37 + termios/speed.c | 72 + termios/tcdrain.c | 39 + termios/tcflow.c | 53 + termios/tcflush.c | 46 + termios/tcgetattr.c | 46 + termios/tcgetpgrp.c | 39 + termios/tcsendbrk.c | 40 + termios/tcsetattr.c | 108 + termios/tcsetpgrp.c | 41 + time/adjtime.c | 37 + time/clock.c | 32 + time/ftime.c | 43 + time/getitimer.c | 42 + time/gettimeofday.c | 39 + time/setitimer.c | 44 + time/settimeofday.c | 35 + time/stime.c | 40 + time/sys/time.h | 2 +- time/time.c | 36 + wcsmbs/Makefile | 5 +- wcsmbs/btowc.c | 22 +- wcsmbs/mbrtowc.c | 13 +- wcsmbs/mbsnrtowcs.c | 15 +- wcsmbs/mbsrtowcs_l.c | 18 +- wcsmbs/wcrtomb.c | 15 +- wcsmbs/wcsmbsload.c | 10 +- wcsmbs/wcsnrtombs.c | 22 +- wcsmbs/wcsrtombs.c | 22 +- wcsmbs/wcstol.c | 23 + wcsmbs/wcstol_l.c | 30 + wcsmbs/wcstoll.c | 25 + wcsmbs/wcstoll_l.c | 30 + wcsmbs/wcstoul.c | 23 + wcsmbs/wcstoul_l.c | 30 + wcsmbs/wcstoull.c | 25 + wcsmbs/wcstoull_l.c | 31 + wcsmbs/wctob.c | 9 +- 1894 files changed, 52362 insertions(+), 49626 deletions(-) create mode 100644 bare/brdinit.c create mode 100644 bare/console.c create mode 100644 bare/strtsupp.c create mode 100644 csu/check_fds.c create mode 100644 csu/errno-loc.c create mode 100644 csu/errno.c create mode 100644 csu/init-first.c create mode 100644 csu/libc-start.c create mode 100644 csu/libc-tls.c create mode 100644 csu/start.c create mode 100644 csu/sysdep.c create mode 100644 debug/backtrace.c create mode 100644 debug/backtracesyms.c create mode 100644 debug/backtracesymsfd.c create mode 100644 debug/memcpy_chk.c create mode 100644 debug/memmove_chk.c create mode 100644 debug/mempcpy_chk.c create mode 100644 debug/memset_chk.c create mode 100644 debug/readonly-area.c create mode 100644 debug/segfault.c create mode 100644 debug/stpcpy_chk.c create mode 100644 debug/stpncpy_chk.c create mode 100644 debug/strcat_chk.c create mode 100644 debug/strcpy_chk.c create mode 100644 debug/strncat_chk.c create mode 100644 debug/strncpy_chk.c create mode 100644 dirent/alphasort64.c create mode 100644 dirent/closedir.c create mode 100644 dirent/dirfd.c create mode 100644 dirent/fdopendir.c create mode 100644 dirent/getdents.c create mode 100644 dirent/getdents64.c create mode 100644 dirent/opendir.c create mode 100644 dirent/readdir.c create mode 100644 dirent/readdir64.c create mode 100644 dirent/readdir64_r.c create mode 100644 dirent/readdir_r.c create mode 100644 dirent/rewinddir.c create mode 100644 dirent/scandir64.c create mode 100644 dirent/seekdir.c create mode 100644 dirent/telldir.c create mode 100644 dirent/versionsort64.c create mode 100644 elf/dl-brk.c create mode 100644 elf/dl-cache.c create mode 100644 elf/dl-environ.c create mode 100644 elf/dl-execstack.c create mode 100644 elf/dl-fptr.c create mode 100644 elf/dl-origin.c create mode 100644 elf/dl-sbrk.c create mode 100644 elf/dl-symaddr.c create mode 100644 elf/dl-sysdep.c create mode 100644 elf/dl-tls.c create mode 100644 elf/dl-trampoline.c create mode 100644 elf/enbl-secure.c create mode 100644 elf/readelflib.c create mode 100644 gmon/bb_init_func.c create mode 100644 gmon/prof-freq.c create mode 100644 gmon/profil.c create mode 100644 gmon/sprofil.c create mode 100644 grp/setgroups.c create mode 100644 hurd/exc2signal.c create mode 100644 hurd/longjmp-ts.c create mode 100644 hurd/trampoline.c create mode 100644 include/sys/sendfile.h create mode 100644 inet/check_pf.c create mode 100644 inet/getipv4sourcefilter.c create mode 100644 inet/getsourcefilter.c create mode 100644 inet/herrno-loc.c create mode 100644 inet/htonl.c create mode 100644 inet/htons.c create mode 100644 inet/if_index.c create mode 100644 inet/ifaddrs.c create mode 100644 inet/ifreq.c create mode 100644 inet/setipv4sourcefilter.c create mode 100644 inet/setsourcefilter.c create mode 100644 io/access.c create mode 100644 io/chdir.c create mode 100644 io/chmod.c create mode 100644 io/chown.c create mode 100644 io/close.c create mode 100644 io/creat.c create mode 100644 io/creat64.c create mode 100644 io/dup.c create mode 100644 io/dup2.c create mode 100644 io/euidaccess.c create mode 100644 io/fchdir.c create mode 100644 io/fchmod.c create mode 100644 io/fchown.c create mode 100644 io/fchownat.c create mode 100644 io/fcntl.c create mode 100644 io/flock.c create mode 100644 io/fstatfs.c create mode 100644 io/fstatfs64.c create mode 100644 io/fstatvfs.c create mode 100644 io/fstatvfs64.c create mode 100644 io/fxstat.c create mode 100644 io/fxstat64.c create mode 100644 io/fxstatat.c create mode 100644 io/fxstatat64.c create mode 100644 io/getcwd.c create mode 100644 io/isatty.c create mode 100644 io/lchmod.c create mode 100644 io/lchown.c create mode 100644 io/link.c create mode 100644 io/linkat.c create mode 100644 io/lockf.c create mode 100644 io/lockf64.c create mode 100644 io/lseek64.c create mode 100644 io/lxstat.c create mode 100644 io/lxstat64.c create mode 100644 io/mkdir.c create mode 100644 io/mkdirat.c create mode 100644 io/mkfifo.c create mode 100644 io/mkfifoat.c create mode 100644 io/mknod.c create mode 100644 io/mknodat.c create mode 100644 io/open.c create mode 100644 io/open64.c create mode 100644 io/openat.c create mode 100644 io/openat64.c create mode 100644 io/pipe.c create mode 100644 io/poll.c create mode 100644 io/posix_fadvise.c create mode 100644 io/posix_fadvise64.c create mode 100644 io/posix_fallocate.c create mode 100644 io/posix_fallocate64.c create mode 100644 io/read.c create mode 100644 io/readlink.c create mode 100644 io/readlinkat.c create mode 100644 io/rmdir.c create mode 100644 io/sendfile.c create mode 100644 io/sendfile64.c create mode 100644 io/statfs.c create mode 100644 io/statfs64.c create mode 100644 io/statvfs.c create mode 100644 io/statvfs64.c create mode 100644 io/symlink.c create mode 100644 io/symlinkat.c create mode 100644 io/ttyname.c create mode 100644 io/ttyname_r.c create mode 100644 io/umask.c create mode 100644 io/unlink.c create mode 100644 io/unlinkat.c create mode 100644 io/utime.c create mode 100644 io/write.c create mode 100644 io/xmknod.c create mode 100644 io/xmknodat.c create mode 100644 io/xstat.c create mode 100644 io/xstat64.c create mode 100644 libio/libc_fatal.c create mode 100644 login/endutxent.c create mode 100644 login/getpt.c create mode 100644 login/getutmp.c create mode 100644 login/getutmpx.c create mode 100644 login/getutxent.c create mode 100644 login/getutxid.c create mode 100644 login/getutxline.c create mode 100644 login/grantpt.c create mode 100644 login/ptsname.c create mode 100644 login/pututxline.c create mode 100644 login/setutxent.c create mode 100644 login/unlockpt.c create mode 100644 login/updwtmp.c create mode 100644 login/updwtmpx.c create mode 100644 login/utmp_file.c create mode 100644 login/utmpxname.c create mode 100644 mach/mig-reply.c create mode 100644 malloc/morecore.c create mode 100644 math/cabsf.c create mode 100644 math/cargf.c create mode 100644 math/cimagf.c create mode 100644 math/conjf.c create mode 100644 math/crealf.c create mode 100644 math/e_acoshl.c create mode 100644 math/e_acosl.c create mode 100644 math/e_asinl.c create mode 100644 math/e_atan2l.c create mode 100644 math/e_atanhl.c create mode 100644 math/e_coshl.c create mode 100644 math/e_exp10.c create mode 100644 math/e_exp10f.c create mode 100644 math/e_exp10l.c create mode 100644 math/e_exp2l.c create mode 100644 math/e_expl.c create mode 100644 math/e_fmodl.c create mode 100644 math/e_gammal_r.c create mode 100644 math/e_hypotl.c create mode 100644 math/e_j0l.c create mode 100644 math/e_j1l.c create mode 100644 math/e_jnl.c create mode 100644 math/e_lgammal_r.c create mode 100644 math/e_log10l.c create mode 100644 math/e_log2l.c create mode 100644 math/e_logl.c create mode 100644 math/e_powl.c create mode 100644 math/e_rem_pio2l.c create mode 100644 math/e_scalb.c create mode 100644 math/e_scalbf.c create mode 100644 math/e_scalbl.c create mode 100644 math/e_sinhl.c create mode 100644 math/e_sqrtl.c create mode 100644 math/fclrexcpt.c create mode 100644 math/fedisblxcpt.c create mode 100644 math/feenablxcpt.c create mode 100644 math/fegetenv.c create mode 100644 math/fegetexcept.c create mode 100644 math/fegetround.c create mode 100644 math/feholdexcpt.c create mode 100644 math/fesetenv.c create mode 100644 math/fesetround.c create mode 100644 math/feupdateenv.c create mode 100644 math/fgetexcptflg.c create mode 100644 math/fpu_control.c create mode 100644 math/fraiseexcpt.c create mode 100644 math/fsetexcptflg.c create mode 100644 math/ftestexcept.c create mode 100644 math/k_cosl.c create mode 100644 math/k_rem_pio2l.c create mode 100644 math/k_sincosl.c create mode 100644 math/k_sinl.c create mode 100644 math/k_tanl.c create mode 100644 math/s_asinhl.c create mode 100644 math/s_atanl.c create mode 100644 math/s_cacos.c create mode 100644 math/s_cacosf.c create mode 100644 math/s_cacosh.c create mode 100644 math/s_cacoshf.c create mode 100644 math/s_cacoshl.c create mode 100644 math/s_cacosl.c create mode 100644 math/s_casin.c create mode 100644 math/s_casinf.c create mode 100644 math/s_casinh.c create mode 100644 math/s_casinhf.c create mode 100644 math/s_casinhl.c create mode 100644 math/s_casinl.c create mode 100644 math/s_catan.c create mode 100644 math/s_catanf.c create mode 100644 math/s_catanh.c create mode 100644 math/s_catanhf.c create mode 100644 math/s_catanhl.c create mode 100644 math/s_catanl.c create mode 100644 math/s_cbrtl.c create mode 100644 math/s_ccos.c create mode 100644 math/s_ccosf.c create mode 100644 math/s_ccosh.c create mode 100644 math/s_ccoshf.c create mode 100644 math/s_ccoshl.c create mode 100644 math/s_ccosl.c create mode 100644 math/s_cexp.c create mode 100644 math/s_cexpf.c create mode 100644 math/s_cexpl.c create mode 100644 math/s_clog.c create mode 100644 math/s_clog10.c create mode 100644 math/s_clog10f.c create mode 100644 math/s_clog10l.c create mode 100644 math/s_clogf.c create mode 100644 math/s_clogl.c create mode 100644 math/s_cpow.c create mode 100644 math/s_cpowf.c create mode 100644 math/s_cpowl.c create mode 100644 math/s_cproj.c create mode 100644 math/s_cprojf.c create mode 100644 math/s_cprojl.c create mode 100644 math/s_csin.c create mode 100644 math/s_csinf.c create mode 100644 math/s_csinh.c create mode 100644 math/s_csinhf.c create mode 100644 math/s_csinhl.c create mode 100644 math/s_csinl.c create mode 100644 math/s_csqrt.c create mode 100644 math/s_csqrtf.c create mode 100644 math/s_csqrtl.c create mode 100644 math/s_ctan.c create mode 100644 math/s_ctanf.c create mode 100644 math/s_ctanh.c create mode 100644 math/s_ctanhf.c create mode 100644 math/s_ctanhl.c create mode 100644 math/s_ctanl.c create mode 100644 math/s_erfl.c create mode 100644 math/s_expm1l.c create mode 100644 math/s_fdim.c create mode 100644 math/s_fdimf.c create mode 100644 math/s_fdiml.c create mode 100644 math/s_fma.c create mode 100644 math/s_fmaf.c create mode 100644 math/s_fmal.c create mode 100644 math/s_fmax.c create mode 100644 math/s_fmaxf.c create mode 100644 math/s_fmaxl.c create mode 100644 math/s_fmin.c create mode 100644 math/s_fminf.c create mode 100644 math/s_fminl.c create mode 100644 math/s_ldexp.c create mode 100644 math/s_ldexpf.c create mode 100644 math/s_ldexpl.c create mode 100644 math/s_log1pl.c create mode 100644 math/s_nan.c create mode 100644 math/s_nanf.c create mode 100644 math/s_nanl.c create mode 100644 math/s_nextafter.c create mode 100644 math/s_nexttowardf.c create mode 100644 math/s_nexttowardl.c create mode 100644 math/s_significand.c create mode 100644 math/s_significandf.c create mode 100644 math/s_significandl.c create mode 100644 math/s_tanhl.c create mode 100644 math/setfpucw.c create mode 100644 math/t_sincosl.c create mode 100644 math/w_acos.c create mode 100644 math/w_acosf.c create mode 100644 math/w_acosh.c create mode 100644 math/w_acoshf.c create mode 100644 math/w_acoshl.c create mode 100644 math/w_acosl.c create mode 100644 math/w_asin.c create mode 100644 math/w_asinf.c create mode 100644 math/w_asinl.c create mode 100644 math/w_atan2.c create mode 100644 math/w_atan2f.c create mode 100644 math/w_atan2l.c create mode 100644 math/w_atanh.c create mode 100644 math/w_atanhf.c create mode 100644 math/w_atanhl.c create mode 100644 math/w_cosh.c create mode 100644 math/w_coshf.c create mode 100644 math/w_coshl.c create mode 100644 math/w_drem.c create mode 100644 math/w_dremf.c create mode 100644 math/w_dreml.c create mode 100644 math/w_exp10.c create mode 100644 math/w_exp10f.c create mode 100644 math/w_exp10l.c create mode 100644 math/w_exp2.c create mode 100644 math/w_exp2f.c create mode 100644 math/w_exp2l.c create mode 100644 math/w_expl.c create mode 100644 math/w_fmod.c create mode 100644 math/w_fmodf.c create mode 100644 math/w_fmodl.c create mode 100644 math/w_hypot.c create mode 100644 math/w_hypotf.c create mode 100644 math/w_hypotl.c create mode 100644 math/w_j0.c create mode 100644 math/w_j0f.c create mode 100644 math/w_j0l.c create mode 100644 math/w_j1.c create mode 100644 math/w_j1f.c create mode 100644 math/w_j1l.c create mode 100644 math/w_jn.c create mode 100644 math/w_jnf.c create mode 100644 math/w_jnl.c create mode 100644 math/w_lgamma.c create mode 100644 math/w_lgamma_r.c create mode 100644 math/w_lgammaf.c create mode 100644 math/w_lgammaf_r.c create mode 100644 math/w_lgammal.c create mode 100644 math/w_lgammal_r.c create mode 100644 math/w_log.c create mode 100644 math/w_log10.c create mode 100644 math/w_log10f.c create mode 100644 math/w_log10l.c create mode 100644 math/w_log2.c create mode 100644 math/w_log2f.c create mode 100644 math/w_log2l.c create mode 100644 math/w_logf.c create mode 100644 math/w_logl.c create mode 100644 math/w_pow.c create mode 100644 math/w_powf.c create mode 100644 math/w_powl.c create mode 100644 math/w_remainder.c create mode 100644 math/w_remainderf.c create mode 100644 math/w_remainderl.c create mode 100644 math/w_scalb.c create mode 100644 math/w_scalbf.c create mode 100644 math/w_scalbl.c create mode 100644 math/w_sinh.c create mode 100644 math/w_sinhf.c create mode 100644 math/w_sinhl.c create mode 100644 math/w_sqrt.c create mode 100644 math/w_sqrtf.c create mode 100644 math/w_sqrtl.c create mode 100644 math/w_tgamma.c create mode 100644 math/w_tgammaf.c create mode 100644 math/w_tgammal.c create mode 100644 misc/acct.c create mode 100644 misc/brk.c create mode 100644 misc/chflags.c create mode 100644 misc/chroot.c create mode 100644 misc/fchflags.c create mode 100644 misc/fdatasync.c create mode 100644 misc/fgetxattr.c create mode 100644 misc/flistxattr.c create mode 100644 misc/fremovexattr.c create mode 100644 misc/fsetxattr.c create mode 100644 misc/fsync.c create mode 100644 misc/ftruncate.c create mode 100644 misc/ftruncate64.c create mode 100644 misc/futimes.c create mode 100644 misc/futimesat.c create mode 100644 misc/getclktck.c create mode 100644 misc/getdomain.c create mode 100644 misc/getdtsz.c create mode 100644 misc/gethostid.c create mode 100644 misc/gethostname.c create mode 100644 misc/getloadavg.c create mode 100644 misc/getpagesize.c create mode 100644 misc/getsysstats.c create mode 100644 misc/getxattr.c create mode 100644 misc/gtty.c create mode 100644 misc/ioctl.c create mode 100644 misc/lgetxattr.c create mode 100644 misc/listxattr.c create mode 100644 misc/llistxattr.c create mode 100644 misc/lremovexattr.c create mode 100644 misc/lseek.c create mode 100644 misc/lsetxattr.c create mode 100644 misc/lutimes.c create mode 100644 misc/madvise.c create mode 100644 misc/mincore.c create mode 100644 misc/mlock.c create mode 100644 misc/mlockall.c create mode 100644 misc/mmap.c create mode 100644 misc/mmap64.c create mode 100644 misc/mprotect.c create mode 100644 misc/msync.c create mode 100644 misc/munlock.c create mode 100644 misc/munlockall.c create mode 100644 misc/munmap.c create mode 100644 misc/pselect.c create mode 100644 misc/ptrace.c create mode 100644 misc/readv.c create mode 100644 misc/reboot.c create mode 100644 misc/remap_file_pages.c create mode 100644 misc/removexattr.c create mode 100644 misc/revoke.c create mode 100644 misc/sbrk.c create mode 100644 misc/select.c create mode 100644 misc/setdomain.c create mode 100644 misc/setegid.c create mode 100644 misc/seteuid.c create mode 100644 misc/sethostid.c create mode 100644 misc/sethostname.c create mode 100644 misc/setregid.c create mode 100644 misc/setreuid.c create mode 100644 misc/setxattr.c create mode 100644 misc/sstk.c create mode 100644 misc/stty.c create mode 100644 misc/swapoff.c create mode 100644 misc/swapon.c create mode 100644 misc/sync.c create mode 100644 misc/syscall.c create mode 100644 misc/syslog.c create mode 100644 misc/truncate.c create mode 100644 misc/truncate64.c create mode 100644 misc/ualarm.c create mode 100644 misc/usleep.c create mode 100644 misc/ustat.c create mode 100644 misc/utimes.c create mode 100644 misc/vhangup.c create mode 100644 misc/writev.c create mode 100644 nptl/errno-loc.c delete mode 100644 nscd/nscd_nischeck.c create mode 100644 nscd/nscd_setup_thread.c create mode 100644 posix/_exit.c create mode 100644 posix/alarm.c create mode 100644 posix/environ.c create mode 100644 posix/execve.c create mode 100644 posix/fexecve.c create mode 100644 posix/fork.c create mode 100644 posix/fpathconf.c create mode 100644 posix/gai_strerror.c create mode 100644 posix/getaddrinfo.c create mode 100644 posix/getegid.c create mode 100644 posix/geteuid.c create mode 100644 posix/getgid.c create mode 100644 posix/getgroups.c create mode 100644 posix/getlogin.c create mode 100644 posix/getlogin_r.c create mode 100644 posix/getpgid.c create mode 100644 posix/getpgrp.c create mode 100644 posix/getpid.c create mode 100644 posix/getppid.c create mode 100644 posix/getresgid.c create mode 100644 posix/getresuid.c create mode 100644 posix/getsid.c create mode 100644 posix/getuid.c create mode 100644 posix/glob.c create mode 100644 posix/glob64.c create mode 100644 posix/group_member.c create mode 100644 posix/init-posix.c create mode 100644 posix/nanosleep.c create mode 100644 posix/pathconf.c create mode 100644 posix/pause.c create mode 100644 posix/posix_madvise.c create mode 100644 posix/pread.c create mode 100644 posix/pread64.c create mode 100644 posix/pwrite.c create mode 100644 posix/pwrite64.c create mode 100644 posix/sched_getaffinity.c create mode 100644 posix/sched_getp.c create mode 100644 posix/sched_gets.c create mode 100644 posix/sched_primax.c create mode 100644 posix/sched_primin.c create mode 100644 posix/sched_rr_gi.c create mode 100644 posix/sched_setaffinity.c create mode 100644 posix/sched_setp.c create mode 100644 posix/sched_sets.c create mode 100644 posix/sched_yield.c create mode 100644 posix/setgid.c create mode 100644 posix/setlogin.c create mode 100644 posix/setpgid.c create mode 100644 posix/setpgrp.c create mode 100644 posix/setresgid.c create mode 100644 posix/setresuid.c create mode 100644 posix/setsid.c create mode 100644 posix/setuid.c create mode 100644 posix/sleep.c create mode 100644 posix/spawni.c create mode 100644 posix/sysconf.c create mode 100644 posix/times.c create mode 100644 posix/uname.c create mode 100644 posix/vfork.c create mode 100644 posix/wait.c create mode 100644 posix/wait3.c create mode 100644 posix/wait4.c create mode 100644 posix/waitid.c create mode 100644 posix/waitpid.c create mode 100644 posix/wordexp.c create mode 100644 resolv/gai_sigqueue.c create mode 100644 resolv/res-state.c create mode 100644 resource/getpriority.c create mode 100644 resource/getrlimit.c create mode 100644 resource/getrlimit64.c create mode 100644 resource/getrusage.c create mode 100644 resource/nice.c create mode 100644 resource/setpriority.c create mode 100644 resource/setrlimit.c create mode 100644 resource/setrlimit64.c create mode 100644 resource/ulimit.c create mode 100644 resource/vlimit.c create mode 100644 resource/vtimes.c create mode 100644 rt/aio_cancel.c create mode 100644 rt/aio_fsync.c create mode 100644 rt/aio_misc.c create mode 100644 rt/aio_notify.c create mode 100644 rt/aio_read.c create mode 100644 rt/aio_read64.c create mode 100644 rt/aio_sigqueue.c create mode 100644 rt/aio_suspend.c create mode 100644 rt/aio_write.c create mode 100644 rt/aio_write64.c create mode 100644 rt/clock_getcpuclockid.c create mode 100644 rt/clock_getres.c create mode 100644 rt/clock_gettime.c create mode 100644 rt/clock_nanosleep.c create mode 100644 rt/clock_settime.c create mode 100644 rt/get_clockfreq.c create mode 100644 rt/lio_listio.c create mode 100644 rt/lio_listio64.c create mode 100644 rt/mq_close.c create mode 100644 rt/mq_getattr.c create mode 100644 rt/mq_notify.c create mode 100644 rt/mq_open.c create mode 100644 rt/mq_receive.c create mode 100644 rt/mq_send.c create mode 100644 rt/mq_setattr.c create mode 100644 rt/mq_timedreceive.c create mode 100644 rt/mq_timedsend.c create mode 100644 rt/mq_unlink.c create mode 100644 rt/shm_open.c create mode 100644 rt/shm_unlink.c create mode 100644 rt/timer_create.c create mode 100644 rt/timer_delete.c create mode 100644 rt/timer_getoverr.c create mode 100644 rt/timer_gettime.c create mode 100644 rt/timer_settime.c create mode 100644 rt/tst-timer.c create mode 100755 scripts/check-local-headers.sh create mode 100644 setjmp/__longjmp.c create mode 100644 setjmp/bsd-_setjmp.c create mode 100644 setjmp/bsd-setjmp.c create mode 100644 setjmp/jmp-unwind.c create mode 100644 setjmp/longjmp.c create mode 100644 setjmp/setjmp.c create mode 100644 setjmp/sigjmp.c create mode 100644 signal/allocrtsig.c create mode 100644 signal/kill.c create mode 100644 signal/killpg.c create mode 100644 signal/raise.c create mode 100644 signal/sigaction.c create mode 100644 signal/sigaltstack.c create mode 100644 signal/sigblock.c create mode 100644 signal/sigfillset.c create mode 100644 signal/sigignore.c create mode 100644 signal/sigintr.c create mode 100644 signal/signal.c create mode 100644 signal/sigpause.c create mode 100644 signal/sigpending.c create mode 100644 signal/sigprocmask.c create mode 100644 signal/sigqueue.c create mode 100644 signal/sigreturn.c create mode 100644 signal/sigset.c create mode 100644 signal/sigsetmask.c create mode 100644 signal/sigstack.c create mode 100644 signal/sigsuspend.c create mode 100644 signal/sigtimedwait.c create mode 100644 signal/sigvec.c create mode 100644 signal/sigwait.c create mode 100644 signal/sigwaitinfo.c create mode 100644 signal/sysv_signal.c create mode 100644 socket/accept.c create mode 100644 socket/bind.c create mode 100644 socket/connect.c create mode 100644 socket/getpeername.c create mode 100644 socket/getsockname.c create mode 100644 socket/getsockopt.c create mode 100644 socket/isfdtype.c create mode 100644 socket/listen.c create mode 100644 socket/opensock.c create mode 100644 socket/recv.c create mode 100644 socket/recvfrom.c create mode 100644 socket/recvmsg.c create mode 100644 socket/send.c create mode 100644 socket/sendmsg.c create mode 100644 socket/sendto.c create mode 100644 socket/setsockopt.c create mode 100644 socket/shutdown.c create mode 100644 socket/sockatmark.c create mode 100644 socket/socket.c create mode 100644 socket/socketpair.c create mode 100644 stdio-common/ctermid.c create mode 100644 stdio-common/cuserid.c create mode 100644 stdio-common/errlist.c create mode 100644 stdio-common/flockfile.c create mode 100644 stdio-common/ftrylockfile.c create mode 100644 stdio-common/funlockfile.c create mode 100644 stdio-common/printf_fphex.c create mode 100644 stdio-common/remove.c create mode 100644 stdio-common/rename.c create mode 100644 stdio-common/renameat.c create mode 100644 stdio-common/siglist.c create mode 100644 stdio-common/tempname.c create mode 100644 stdio-common/tmpfile.c create mode 100644 stdio-common/tmpfile64.c create mode 100644 stdlib/abort.c create mode 100644 stdlib/add_n.c create mode 100644 stdlib/addmul_1.c create mode 100644 stdlib/cmp.c create mode 100644 stdlib/dbl2mpn.c create mode 100644 stdlib/div.c create mode 100644 stdlib/divmod_1.c create mode 100644 stdlib/divrem.c create mode 100644 stdlib/getcontext.c create mode 100644 stdlib/getenv.c create mode 100644 stdlib/inlines.c create mode 100644 stdlib/labs.c create mode 100644 stdlib/ldbl2mpn.c create mode 100644 stdlib/ldiv.c create mode 100644 stdlib/llabs.c create mode 100644 stdlib/lldiv.c create mode 100644 stdlib/lshift.c create mode 100644 stdlib/makecontext.c create mode 100644 stdlib/mod_1.c create mode 100644 stdlib/mp_clz_tab.c create mode 100644 stdlib/mpn2dbl.c create mode 100644 stdlib/mpn2flt.c create mode 100644 stdlib/mpn2ldbl.c create mode 100644 stdlib/mul.c create mode 100644 stdlib/mul_1.c create mode 100644 stdlib/mul_n.c create mode 100644 stdlib/putenv.c create mode 100644 stdlib/rshift.c create mode 100644 stdlib/setcontext.c create mode 100644 stdlib/setenv.c create mode 100644 stdlib/strtoimax.c create mode 100644 stdlib/strtol.c create mode 100644 stdlib/strtol_l.c create mode 100644 stdlib/strtold_l.c create mode 100644 stdlib/strtoll.c create mode 100644 stdlib/strtoll_l.c create mode 100644 stdlib/strtoul.c create mode 100644 stdlib/strtoul_l.c create mode 100644 stdlib/strtoull.c create mode 100644 stdlib/strtoull_l.c create mode 100644 stdlib/strtoumax.c create mode 100644 stdlib/sub_n.c create mode 100644 stdlib/submul_1.c create mode 100644 stdlib/swapcontext.c create mode 100644 stdlib/system.c create mode 100644 stdlib/udiv_qrnnd.c create mode 100644 stdlib/wcstoimax.c create mode 100644 stdlib/wcstoumax.c create mode 100644 streams/fattach.c create mode 100644 streams/fdetach.c create mode 100644 streams/getmsg.c create mode 100644 streams/getpmsg.c create mode 100644 streams/isastream.c create mode 100644 streams/putmsg.c create mode 100644 streams/putpmsg.c create mode 100644 string/_strerror.c create mode 100644 string/bcopy.c create mode 100644 string/bzero.c create mode 100644 string/ffs.c create mode 100644 string/ffsll.c create mode 100644 string/memccpy.c create mode 100644 string/memchr.c create mode 100644 string/memcmp.c create mode 100644 string/memcpy.c create mode 100644 string/memmem.c create mode 100644 string/memmove.c create mode 100644 string/mempcpy.c create mode 100644 string/memrchr.c create mode 100644 string/memset.c create mode 100644 string/rawmemchr.c create mode 100644 string/stpcpy.c create mode 100644 string/stpncpy.c create mode 100644 string/strcasecmp.c create mode 100644 string/strcasecmp_l.c create mode 100644 string/strcasestr.c create mode 100644 string/strcat.c create mode 100644 string/strchr.c create mode 100644 string/strchrnul.c create mode 100644 string/strcmp.c create mode 100644 string/strcpy.c create mode 100644 string/strcspn.c create mode 100644 string/string-inlines.c create mode 100644 string/strlen.c create mode 100644 string/strncase.c create mode 100644 string/strncase_l.c create mode 100644 string/strncat.c create mode 100644 string/strncmp.c create mode 100644 string/strncpy.c create mode 100644 string/strnlen.c create mode 100644 string/strpbrk.c create mode 100644 string/strrchr.c create mode 100644 string/strsep.c create mode 100644 string/strspn.c create mode 100644 string/strstr.c create mode 100644 string/strtok.c create mode 100644 string/strtok_r.c create mode 100644 string/wordcopy.c create mode 100644 string/xpg-strerror.c delete mode 100644 sysdeps/generic/__longjmp.c delete mode 100644 sysdeps/generic/_exit.c delete mode 100644 sysdeps/generic/_strerror.c delete mode 100644 sysdeps/generic/abort.c delete mode 100644 sysdeps/generic/accept.c delete mode 100644 sysdeps/generic/access.c delete mode 100644 sysdeps/generic/acct.c delete mode 100644 sysdeps/generic/add_n.c delete mode 100644 sysdeps/generic/addmul_1.c delete mode 100644 sysdeps/generic/adjtime.c delete mode 100644 sysdeps/generic/aio_cancel.c delete mode 100644 sysdeps/generic/aio_fsync.c delete mode 100644 sysdeps/generic/aio_misc.c delete mode 100644 sysdeps/generic/aio_notify.c delete mode 100644 sysdeps/generic/aio_read.c delete mode 100644 sysdeps/generic/aio_read64.c delete mode 100644 sysdeps/generic/aio_sigqueue.c delete mode 100644 sysdeps/generic/aio_suspend.c delete mode 100644 sysdeps/generic/aio_write.c delete mode 100644 sysdeps/generic/aio_write64.c delete mode 100644 sysdeps/generic/alarm.c delete mode 100644 sysdeps/generic/allocrtsig.c delete mode 100644 sysdeps/generic/alphasort64.c delete mode 100644 sysdeps/generic/backtrace.c delete mode 100644 sysdeps/generic/backtracesyms.c delete mode 100644 sysdeps/generic/backtracesymsfd.c delete mode 100644 sysdeps/generic/bb_init_func.c delete mode 100644 sysdeps/generic/bcopy.c delete mode 100644 sysdeps/generic/bind.c delete mode 100644 sysdeps/generic/brdinit.c delete mode 100644 sysdeps/generic/brk.c delete mode 100644 sysdeps/generic/bsd-_setjmp.c delete mode 100644 sysdeps/generic/bsd-setjmp.c delete mode 100644 sysdeps/generic/bzero.c delete mode 100644 sysdeps/generic/cabsf.c delete mode 100644 sysdeps/generic/cargf.c delete mode 100644 sysdeps/generic/chdir.c delete mode 100644 sysdeps/generic/check_fds.c delete mode 100644 sysdeps/generic/check_pf.c delete mode 100644 sysdeps/generic/chflags.c delete mode 100644 sysdeps/generic/chmod.c delete mode 100644 sysdeps/generic/chown.c delete mode 100644 sysdeps/generic/chroot.c delete mode 100644 sysdeps/generic/cimagf.c delete mode 100644 sysdeps/generic/clock.c delete mode 100644 sysdeps/generic/clock_getcpuclockid.c delete mode 100644 sysdeps/generic/clock_getres.c delete mode 100644 sysdeps/generic/clock_gettime.c delete mode 100644 sysdeps/generic/clock_nanosleep.c delete mode 100644 sysdeps/generic/clock_settime.c delete mode 100644 sysdeps/generic/close.c delete mode 100644 sysdeps/generic/closedir.c delete mode 100644 sysdeps/generic/cmp.c delete mode 100755 sysdeps/generic/configure delete mode 100644 sysdeps/generic/configure.in delete mode 100644 sysdeps/generic/conjf.c delete mode 100644 sysdeps/generic/connect.c delete mode 100644 sysdeps/generic/console.c delete mode 100644 sysdeps/generic/crealf.c delete mode 100644 sysdeps/generic/creat.c delete mode 100644 sysdeps/generic/creat64.c delete mode 100644 sysdeps/generic/ctermid.c delete mode 100644 sysdeps/generic/cuserid.c delete mode 100644 sysdeps/generic/dbl2mpn.c delete mode 100644 sysdeps/generic/det_endian.c delete mode 100644 sysdeps/generic/dirfd.c delete mode 100644 sysdeps/generic/div.c delete mode 100644 sysdeps/generic/divmod_1.c delete mode 100644 sysdeps/generic/divrem.c delete mode 100644 sysdeps/generic/dl-brk.c delete mode 100644 sysdeps/generic/dl-cache.c delete mode 100644 sysdeps/generic/dl-environ.c delete mode 100644 sysdeps/generic/dl-execstack.c delete mode 100644 sysdeps/generic/dl-fptr.c delete mode 100644 sysdeps/generic/dl-origin.c delete mode 100644 sysdeps/generic/dl-sbrk.c delete mode 100644 sysdeps/generic/dl-symaddr.c delete mode 100644 sysdeps/generic/dl-sysdep.c delete mode 100644 sysdeps/generic/dl-tls.c delete mode 100644 sysdeps/generic/dl-trampoline.c delete mode 100644 sysdeps/generic/dup.c delete mode 100644 sysdeps/generic/dup2.c delete mode 100644 sysdeps/generic/e_acoshl.c delete mode 100644 sysdeps/generic/e_acosl.c delete mode 100644 sysdeps/generic/e_asinl.c delete mode 100644 sysdeps/generic/e_atan2l.c delete mode 100644 sysdeps/generic/e_atanhl.c delete mode 100644 sysdeps/generic/e_coshl.c delete mode 100644 sysdeps/generic/e_exp10.c delete mode 100644 sysdeps/generic/e_exp10f.c delete mode 100644 sysdeps/generic/e_exp10l.c delete mode 100644 sysdeps/generic/e_exp2l.c delete mode 100644 sysdeps/generic/e_expl.c delete mode 100644 sysdeps/generic/e_fmodl.c delete mode 100644 sysdeps/generic/e_gammal_r.c delete mode 100644 sysdeps/generic/e_hypotl.c delete mode 100644 sysdeps/generic/e_j0l.c delete mode 100644 sysdeps/generic/e_j1l.c delete mode 100644 sysdeps/generic/e_jnl.c delete mode 100644 sysdeps/generic/e_lgammal_r.c delete mode 100644 sysdeps/generic/e_log10l.c delete mode 100644 sysdeps/generic/e_log2l.c delete mode 100644 sysdeps/generic/e_logl.c delete mode 100644 sysdeps/generic/e_powl.c delete mode 100644 sysdeps/generic/e_rem_pio2l.c delete mode 100644 sysdeps/generic/e_scalb.c delete mode 100644 sysdeps/generic/e_scalbf.c delete mode 100644 sysdeps/generic/e_scalbl.c delete mode 100644 sysdeps/generic/e_sinhl.c delete mode 100644 sysdeps/generic/e_sqrtl.c delete mode 100644 sysdeps/generic/enbl-secure.c delete mode 100644 sysdeps/generic/endutxent.c delete mode 100644 sysdeps/generic/environ.c delete mode 100644 sysdeps/generic/errlist.c delete mode 100644 sysdeps/generic/errno-loc.c delete mode 100644 sysdeps/generic/errno.c delete mode 100644 sysdeps/generic/euidaccess.c delete mode 100644 sysdeps/generic/exc2signal.c delete mode 100644 sysdeps/generic/execve.c delete mode 100644 sysdeps/generic/fattach.c delete mode 100644 sysdeps/generic/fchdir.c delete mode 100644 sysdeps/generic/fchflags.c delete mode 100644 sysdeps/generic/fchmod.c delete mode 100644 sysdeps/generic/fchown.c delete mode 100644 sysdeps/generic/fchownat.c delete mode 100644 sysdeps/generic/fclrexcpt.c delete mode 100644 sysdeps/generic/fcntl.c delete mode 100644 sysdeps/generic/fdatasync.c delete mode 100644 sysdeps/generic/fdetach.c delete mode 100644 sysdeps/generic/fdopendir.c delete mode 100644 sysdeps/generic/fedisblxcpt.c delete mode 100644 sysdeps/generic/feenablxcpt.c delete mode 100644 sysdeps/generic/fegetenv.c delete mode 100644 sysdeps/generic/fegetexcept.c delete mode 100644 sysdeps/generic/fegetround.c delete mode 100644 sysdeps/generic/feholdexcpt.c delete mode 100644 sysdeps/generic/fesetenv.c delete mode 100644 sysdeps/generic/fesetround.c delete mode 100644 sysdeps/generic/feupdateenv.c delete mode 100644 sysdeps/generic/fexecve.c delete mode 100644 sysdeps/generic/ffs.c delete mode 100644 sysdeps/generic/ffsll.c delete mode 100644 sysdeps/generic/fgetexcptflg.c delete mode 100644 sysdeps/generic/fgetxattr.c delete mode 100644 sysdeps/generic/flistxattr.c delete mode 100644 sysdeps/generic/flock.c delete mode 100644 sysdeps/generic/flockfile.c delete mode 100644 sysdeps/generic/fork.c delete mode 100644 sysdeps/generic/fpathconf.c delete mode 100644 sysdeps/generic/fpu_control.c delete mode 100644 sysdeps/generic/fraiseexcpt.c delete mode 100644 sysdeps/generic/fremovexattr.c delete mode 100644 sysdeps/generic/fsetexcptflg.c delete mode 100644 sysdeps/generic/fsetxattr.c delete mode 100644 sysdeps/generic/fstatfs.c delete mode 100644 sysdeps/generic/fstatfs64.c delete mode 100644 sysdeps/generic/fstatvfs.c delete mode 100644 sysdeps/generic/fstatvfs64.c delete mode 100644 sysdeps/generic/fsync.c delete mode 100644 sysdeps/generic/ftestexcept.c delete mode 100644 sysdeps/generic/ftime.c delete mode 100644 sysdeps/generic/ftruncate.c delete mode 100644 sysdeps/generic/ftruncate64.c delete mode 100644 sysdeps/generic/ftrylockfile.c delete mode 100644 sysdeps/generic/funlockfile.c delete mode 100644 sysdeps/generic/futimes.c delete mode 100644 sysdeps/generic/futimesat.c delete mode 100644 sysdeps/generic/fxstat.c delete mode 100644 sysdeps/generic/fxstat64.c delete mode 100644 sysdeps/generic/fxstatat.c delete mode 100644 sysdeps/generic/fxstatat64.c delete mode 100644 sysdeps/generic/gai_sigqueue.c delete mode 100644 sysdeps/generic/gai_strerror.c delete mode 100644 sysdeps/generic/get_clockfreq.c delete mode 100644 sysdeps/generic/getaddrinfo.c delete mode 100644 sysdeps/generic/getclktck.c delete mode 100644 sysdeps/generic/getcontext.c delete mode 100644 sysdeps/generic/getcwd.c delete mode 100644 sysdeps/generic/getdents.c delete mode 100644 sysdeps/generic/getdents64.c delete mode 100644 sysdeps/generic/getdomain.c delete mode 100644 sysdeps/generic/getdtsz.c delete mode 100644 sysdeps/generic/getegid.c delete mode 100644 sysdeps/generic/getenv.c delete mode 100644 sysdeps/generic/geteuid.c delete mode 100644 sysdeps/generic/getgid.c delete mode 100644 sysdeps/generic/getgroups.c delete mode 100644 sysdeps/generic/gethostid.c delete mode 100644 sysdeps/generic/gethostname.c delete mode 100644 sysdeps/generic/getipv4sourcefilter.c delete mode 100644 sysdeps/generic/getitimer.c delete mode 100644 sysdeps/generic/getloadavg.c delete mode 100644 sysdeps/generic/getlogin.c delete mode 100644 sysdeps/generic/getlogin_r.c delete mode 100644 sysdeps/generic/getmsg.c delete mode 100644 sysdeps/generic/getpagesize.c delete mode 100644 sysdeps/generic/getpeername.c delete mode 100644 sysdeps/generic/getpgid.c delete mode 100644 sysdeps/generic/getpgrp.c delete mode 100644 sysdeps/generic/getpid.c delete mode 100644 sysdeps/generic/getpmsg.c delete mode 100644 sysdeps/generic/getppid.c delete mode 100644 sysdeps/generic/getpriority.c delete mode 100644 sysdeps/generic/getpt.c delete mode 100644 sysdeps/generic/getresgid.c delete mode 100644 sysdeps/generic/getresuid.c delete mode 100644 sysdeps/generic/getrlimit.c delete mode 100644 sysdeps/generic/getrlimit64.c delete mode 100644 sysdeps/generic/getrusage.c delete mode 100644 sysdeps/generic/getsid.c delete mode 100644 sysdeps/generic/getsockname.c delete mode 100644 sysdeps/generic/getsockopt.c delete mode 100644 sysdeps/generic/getsourcefilter.c delete mode 100644 sysdeps/generic/getsysstats.c delete mode 100644 sysdeps/generic/gettimeofday.c delete mode 100644 sysdeps/generic/getuid.c delete mode 100644 sysdeps/generic/getutmp.c delete mode 100644 sysdeps/generic/getutmpx.c delete mode 100644 sysdeps/generic/getutxent.c delete mode 100644 sysdeps/generic/getutxid.c delete mode 100644 sysdeps/generic/getutxline.c delete mode 100644 sysdeps/generic/getxattr.c delete mode 100644 sysdeps/generic/glob.c delete mode 100644 sysdeps/generic/glob64.c delete mode 100644 sysdeps/generic/grantpt.c delete mode 100644 sysdeps/generic/group_member.c delete mode 100644 sysdeps/generic/gtty.c delete mode 100644 sysdeps/generic/herrno-loc.c delete mode 100644 sysdeps/generic/htonl.c delete mode 100644 sysdeps/generic/htons.c delete mode 100644 sysdeps/generic/if_index.c delete mode 100644 sysdeps/generic/ifaddrs.c delete mode 100644 sysdeps/generic/ifreq.c delete mode 100644 sysdeps/generic/init-first.c delete mode 100644 sysdeps/generic/init-posix.c delete mode 100644 sysdeps/generic/inlines.c delete mode 100644 sysdeps/generic/ioctl.c delete mode 100644 sysdeps/generic/isastream.c delete mode 100644 sysdeps/generic/isatty.c delete mode 100644 sysdeps/generic/isfdtype.c delete mode 100644 sysdeps/generic/jmp-unwind.c delete mode 100644 sysdeps/generic/k_cosl.c delete mode 100644 sysdeps/generic/k_rem_pio2l.c delete mode 100644 sysdeps/generic/k_sincosl.c delete mode 100644 sysdeps/generic/k_sinl.c delete mode 100644 sysdeps/generic/k_tanl.c delete mode 100644 sysdeps/generic/kill.c delete mode 100644 sysdeps/generic/killpg.c delete mode 100644 sysdeps/generic/labs.c delete mode 100644 sysdeps/generic/lchmod.c delete mode 100644 sysdeps/generic/lchown.c delete mode 100644 sysdeps/generic/ldbl2mpn.c delete mode 100644 sysdeps/generic/ldiv.c delete mode 100644 sysdeps/generic/lgetxattr.c delete mode 100644 sysdeps/generic/libc-start.c delete mode 100644 sysdeps/generic/libc-tls.c delete mode 100644 sysdeps/generic/libc_fatal.c delete mode 100644 sysdeps/generic/link.c delete mode 100644 sysdeps/generic/lio_listio.c delete mode 100644 sysdeps/generic/lio_listio64.c delete mode 100644 sysdeps/generic/listen.c delete mode 100644 sysdeps/generic/listxattr.c delete mode 100644 sysdeps/generic/llabs.c delete mode 100644 sysdeps/generic/lldiv.c delete mode 100644 sysdeps/generic/llistxattr.c delete mode 100644 sysdeps/generic/lockf.c delete mode 100644 sysdeps/generic/lockf64.c delete mode 100644 sysdeps/generic/longjmp-ts.c delete mode 100644 sysdeps/generic/longjmp.c delete mode 100644 sysdeps/generic/lremovexattr.c delete mode 100644 sysdeps/generic/lseek.c delete mode 100644 sysdeps/generic/lseek64.c delete mode 100644 sysdeps/generic/lsetxattr.c delete mode 100644 sysdeps/generic/lshift.c delete mode 100644 sysdeps/generic/lutimes.c delete mode 100644 sysdeps/generic/lxstat.c delete mode 100644 sysdeps/generic/lxstat64.c delete mode 100644 sysdeps/generic/madvise.c delete mode 100644 sysdeps/generic/makecontext.c delete mode 100644 sysdeps/generic/memccpy.c delete mode 100644 sysdeps/generic/memchr.c delete mode 100644 sysdeps/generic/memcmp.c delete mode 100644 sysdeps/generic/memcpy.c delete mode 100644 sysdeps/generic/memcpy_chk.c delete mode 100644 sysdeps/generic/memmem.c delete mode 100644 sysdeps/generic/memmove.c delete mode 100644 sysdeps/generic/memmove_chk.c delete mode 100644 sysdeps/generic/mempcpy.c delete mode 100644 sysdeps/generic/mempcpy_chk.c delete mode 100644 sysdeps/generic/memrchr.c delete mode 100644 sysdeps/generic/memset.c delete mode 100644 sysdeps/generic/memset_chk.c delete mode 100644 sysdeps/generic/mig-reply.c delete mode 100644 sysdeps/generic/mincore.c delete mode 100644 sysdeps/generic/mkdir.c delete mode 100644 sysdeps/generic/mkfifo.c delete mode 100644 sysdeps/generic/mknod.c delete mode 100644 sysdeps/generic/mlock.c delete mode 100644 sysdeps/generic/mlockall.c delete mode 100644 sysdeps/generic/mmap.c delete mode 100644 sysdeps/generic/mmap64.c delete mode 100644 sysdeps/generic/mod_1.c delete mode 100644 sysdeps/generic/morecore.c delete mode 100644 sysdeps/generic/mp_clz_tab.c delete mode 100644 sysdeps/generic/mpn2dbl.c delete mode 100644 sysdeps/generic/mpn2flt.c delete mode 100644 sysdeps/generic/mpn2ldbl.c delete mode 100644 sysdeps/generic/mprotect.c delete mode 100644 sysdeps/generic/mq_close.c delete mode 100644 sysdeps/generic/mq_getattr.c delete mode 100644 sysdeps/generic/mq_notify.c delete mode 100644 sysdeps/generic/mq_open.c delete mode 100644 sysdeps/generic/mq_receive.c delete mode 100644 sysdeps/generic/mq_send.c delete mode 100644 sysdeps/generic/mq_setattr.c delete mode 100644 sysdeps/generic/mq_timedreceive.c delete mode 100644 sysdeps/generic/mq_timedsend.c delete mode 100644 sysdeps/generic/mq_unlink.c delete mode 100644 sysdeps/generic/msgctl.c delete mode 100644 sysdeps/generic/msgget.c delete mode 100644 sysdeps/generic/msgrcv.c delete mode 100644 sysdeps/generic/msgsnd.c delete mode 100644 sysdeps/generic/msync.c delete mode 100644 sysdeps/generic/mul.c delete mode 100644 sysdeps/generic/mul_1.c delete mode 100644 sysdeps/generic/mul_n.c delete mode 100644 sysdeps/generic/munlock.c delete mode 100644 sysdeps/generic/munlockall.c delete mode 100644 sysdeps/generic/munmap.c delete mode 100644 sysdeps/generic/nanosleep.c delete mode 100644 sysdeps/generic/nice.c delete mode 100644 sysdeps/generic/nscd_setup_thread.c delete mode 100644 sysdeps/generic/open.c delete mode 100644 sysdeps/generic/open64.c delete mode 100644 sysdeps/generic/openat.c delete mode 100644 sysdeps/generic/openat64.c delete mode 100644 sysdeps/generic/opendir.c delete mode 100644 sysdeps/generic/opensock.c delete mode 100644 sysdeps/generic/pathconf.c delete mode 100644 sysdeps/generic/pause.c delete mode 100644 sysdeps/generic/pipe.c delete mode 100644 sysdeps/generic/poll.c delete mode 100644 sysdeps/generic/posix_fadvise.c delete mode 100644 sysdeps/generic/posix_fadvise64.c delete mode 100644 sysdeps/generic/posix_fallocate.c delete mode 100644 sysdeps/generic/posix_fallocate64.c delete mode 100644 sysdeps/generic/posix_madvise.c delete mode 100644 sysdeps/generic/pread.c delete mode 100644 sysdeps/generic/pread64.c delete mode 100644 sysdeps/generic/printf_fphex.c delete mode 100644 sysdeps/generic/prof-freq.c delete mode 100644 sysdeps/generic/profil.c delete mode 100644 sysdeps/generic/pselect.c delete mode 100644 sysdeps/generic/ptrace.c delete mode 100644 sysdeps/generic/ptsname.c delete mode 100644 sysdeps/generic/putenv.c delete mode 100644 sysdeps/generic/putmsg.c delete mode 100644 sysdeps/generic/putpmsg.c delete mode 100644 sysdeps/generic/pututxline.c delete mode 100644 sysdeps/generic/pwrite.c delete mode 100644 sysdeps/generic/pwrite64.c delete mode 100644 sysdeps/generic/raise.c delete mode 100644 sysdeps/generic/rawmemchr.c delete mode 100644 sysdeps/generic/read.c delete mode 100644 sysdeps/generic/readdir.c delete mode 100644 sysdeps/generic/readdir64.c delete mode 100644 sysdeps/generic/readdir64_r.c delete mode 100644 sysdeps/generic/readdir_r.c delete mode 100644 sysdeps/generic/readelflib.c delete mode 100644 sysdeps/generic/readlink.c delete mode 100644 sysdeps/generic/readonly-area.c delete mode 100644 sysdeps/generic/readv.c delete mode 100644 sysdeps/generic/reboot.c delete mode 100644 sysdeps/generic/recv.c delete mode 100644 sysdeps/generic/recvfrom.c delete mode 100644 sysdeps/generic/recvmsg.c delete mode 100644 sysdeps/generic/remap_file_pages.c delete mode 100644 sysdeps/generic/remove.c delete mode 100644 sysdeps/generic/removexattr.c delete mode 100644 sysdeps/generic/rename.c delete mode 100644 sysdeps/generic/renameat.c delete mode 100644 sysdeps/generic/res-state.c delete mode 100644 sysdeps/generic/revoke.c delete mode 100644 sysdeps/generic/rewinddir.c delete mode 100644 sysdeps/generic/rmdir.c delete mode 100644 sysdeps/generic/rshift.c delete mode 100644 sysdeps/generic/s_asinhl.c delete mode 100644 sysdeps/generic/s_atanl.c delete mode 100644 sysdeps/generic/s_cacos.c delete mode 100644 sysdeps/generic/s_cacosf.c delete mode 100644 sysdeps/generic/s_cacosh.c delete mode 100644 sysdeps/generic/s_cacoshf.c delete mode 100644 sysdeps/generic/s_cacoshl.c delete mode 100644 sysdeps/generic/s_cacosl.c delete mode 100644 sysdeps/generic/s_casin.c delete mode 100644 sysdeps/generic/s_casinf.c delete mode 100644 sysdeps/generic/s_casinh.c delete mode 100644 sysdeps/generic/s_casinhf.c delete mode 100644 sysdeps/generic/s_casinhl.c delete mode 100644 sysdeps/generic/s_casinl.c delete mode 100644 sysdeps/generic/s_catan.c delete mode 100644 sysdeps/generic/s_catanf.c delete mode 100644 sysdeps/generic/s_catanh.c delete mode 100644 sysdeps/generic/s_catanhf.c delete mode 100644 sysdeps/generic/s_catanhl.c delete mode 100644 sysdeps/generic/s_catanl.c delete mode 100644 sysdeps/generic/s_cbrtl.c delete mode 100644 sysdeps/generic/s_ccos.c delete mode 100644 sysdeps/generic/s_ccosf.c delete mode 100644 sysdeps/generic/s_ccosh.c delete mode 100644 sysdeps/generic/s_ccoshf.c delete mode 100644 sysdeps/generic/s_ccoshl.c delete mode 100644 sysdeps/generic/s_ccosl.c delete mode 100644 sysdeps/generic/s_cexp.c delete mode 100644 sysdeps/generic/s_cexpf.c delete mode 100644 sysdeps/generic/s_cexpl.c delete mode 100644 sysdeps/generic/s_clog.c delete mode 100644 sysdeps/generic/s_clog10.c delete mode 100644 sysdeps/generic/s_clog10f.c delete mode 100644 sysdeps/generic/s_clog10l.c delete mode 100644 sysdeps/generic/s_clogf.c delete mode 100644 sysdeps/generic/s_clogl.c delete mode 100644 sysdeps/generic/s_cpow.c delete mode 100644 sysdeps/generic/s_cpowf.c delete mode 100644 sysdeps/generic/s_cpowl.c delete mode 100644 sysdeps/generic/s_cproj.c delete mode 100644 sysdeps/generic/s_cprojf.c delete mode 100644 sysdeps/generic/s_cprojl.c delete mode 100644 sysdeps/generic/s_csin.c delete mode 100644 sysdeps/generic/s_csinf.c delete mode 100644 sysdeps/generic/s_csinh.c delete mode 100644 sysdeps/generic/s_csinhf.c delete mode 100644 sysdeps/generic/s_csinhl.c delete mode 100644 sysdeps/generic/s_csinl.c delete mode 100644 sysdeps/generic/s_csqrt.c delete mode 100644 sysdeps/generic/s_csqrtf.c delete mode 100644 sysdeps/generic/s_csqrtl.c delete mode 100644 sysdeps/generic/s_ctan.c delete mode 100644 sysdeps/generic/s_ctanf.c delete mode 100644 sysdeps/generic/s_ctanh.c delete mode 100644 sysdeps/generic/s_ctanhf.c delete mode 100644 sysdeps/generic/s_ctanhl.c delete mode 100644 sysdeps/generic/s_ctanl.c delete mode 100644 sysdeps/generic/s_erfl.c delete mode 100644 sysdeps/generic/s_expm1l.c delete mode 100644 sysdeps/generic/s_fdim.c delete mode 100644 sysdeps/generic/s_fdimf.c delete mode 100644 sysdeps/generic/s_fdiml.c delete mode 100644 sysdeps/generic/s_fma.c delete mode 100644 sysdeps/generic/s_fmaf.c delete mode 100644 sysdeps/generic/s_fmal.c delete mode 100644 sysdeps/generic/s_fmax.c delete mode 100644 sysdeps/generic/s_fmaxf.c delete mode 100644 sysdeps/generic/s_fmaxl.c delete mode 100644 sysdeps/generic/s_fmin.c delete mode 100644 sysdeps/generic/s_fminf.c delete mode 100644 sysdeps/generic/s_fminl.c delete mode 100644 sysdeps/generic/s_ldexp.c delete mode 100644 sysdeps/generic/s_ldexpf.c delete mode 100644 sysdeps/generic/s_ldexpl.c delete mode 100644 sysdeps/generic/s_log1pl.c delete mode 100644 sysdeps/generic/s_nan.c delete mode 100644 sysdeps/generic/s_nanf.c delete mode 100644 sysdeps/generic/s_nanl.c delete mode 100644 sysdeps/generic/s_nextafter.c delete mode 100644 sysdeps/generic/s_nexttowardf.c delete mode 100644 sysdeps/generic/s_nexttowardl.c delete mode 100644 sysdeps/generic/s_significand.c delete mode 100644 sysdeps/generic/s_significandf.c delete mode 100644 sysdeps/generic/s_significandl.c delete mode 100644 sysdeps/generic/s_tanhl.c delete mode 100644 sysdeps/generic/sbrk.c delete mode 100644 sysdeps/generic/scandir64.c delete mode 100644 sysdeps/generic/sched_getaffinity.c delete mode 100644 sysdeps/generic/sched_getp.c delete mode 100644 sysdeps/generic/sched_gets.c delete mode 100644 sysdeps/generic/sched_primax.c delete mode 100644 sysdeps/generic/sched_primin.c delete mode 100644 sysdeps/generic/sched_rr_gi.c delete mode 100644 sysdeps/generic/sched_setaffinity.c delete mode 100644 sysdeps/generic/sched_setp.c delete mode 100644 sysdeps/generic/sched_sets.c delete mode 100644 sysdeps/generic/sched_yield.c delete mode 100644 sysdeps/generic/seekdir.c delete mode 100644 sysdeps/generic/segfault.c delete mode 100644 sysdeps/generic/select.c delete mode 100644 sysdeps/generic/semctl.c delete mode 100644 sysdeps/generic/semget.c delete mode 100644 sysdeps/generic/semop.c delete mode 100644 sysdeps/generic/semtimedop.c delete mode 100644 sysdeps/generic/send.c delete mode 100644 sysdeps/generic/sendfile.c delete mode 100644 sysdeps/generic/sendfile64.c delete mode 100644 sysdeps/generic/sendmsg.c delete mode 100644 sysdeps/generic/sendto.c delete mode 100644 sysdeps/generic/setcontext.c delete mode 100644 sysdeps/generic/setdomain.c delete mode 100644 sysdeps/generic/setegid.c delete mode 100644 sysdeps/generic/setenv.c delete mode 100644 sysdeps/generic/seteuid.c delete mode 100644 sysdeps/generic/setfpucw.c delete mode 100644 sysdeps/generic/setgid.c delete mode 100644 sysdeps/generic/setgroups.c delete mode 100644 sysdeps/generic/sethostid.c delete mode 100644 sysdeps/generic/sethostname.c delete mode 100644 sysdeps/generic/setipv4sourcefilter.c delete mode 100644 sysdeps/generic/setitimer.c delete mode 100644 sysdeps/generic/setjmp.c delete mode 100644 sysdeps/generic/setlogin.c delete mode 100644 sysdeps/generic/setpgid.c delete mode 100644 sysdeps/generic/setpgrp.c delete mode 100644 sysdeps/generic/setpriority.c delete mode 100644 sysdeps/generic/setregid.c delete mode 100644 sysdeps/generic/setresgid.c delete mode 100644 sysdeps/generic/setresuid.c delete mode 100644 sysdeps/generic/setreuid.c delete mode 100644 sysdeps/generic/setrlimit.c delete mode 100644 sysdeps/generic/setrlimit64.c delete mode 100644 sysdeps/generic/setsid.c delete mode 100644 sysdeps/generic/setsockopt.c delete mode 100644 sysdeps/generic/setsourcefilter.c delete mode 100644 sysdeps/generic/settimeofday.c delete mode 100644 sysdeps/generic/setuid.c delete mode 100644 sysdeps/generic/setutxent.c delete mode 100644 sysdeps/generic/setxattr.c delete mode 100644 sysdeps/generic/shm_open.c delete mode 100644 sysdeps/generic/shm_unlink.c delete mode 100644 sysdeps/generic/shmat.c delete mode 100644 sysdeps/generic/shmctl.c delete mode 100644 sysdeps/generic/shmdt.c delete mode 100644 sysdeps/generic/shmget.c delete mode 100644 sysdeps/generic/shutdown.c delete mode 100644 sysdeps/generic/sigaction.c delete mode 100644 sysdeps/generic/sigaltstack.c delete mode 100644 sysdeps/generic/sigblock.c delete mode 100644 sysdeps/generic/sigfillset.c delete mode 100644 sysdeps/generic/sigignore.c delete mode 100644 sysdeps/generic/sigintr.c delete mode 100644 sysdeps/generic/sigjmp.c delete mode 100644 sysdeps/generic/siglist.c delete mode 100644 sysdeps/generic/signal.c delete mode 100644 sysdeps/generic/signame.c delete mode 100644 sysdeps/generic/signame.h delete mode 100644 sysdeps/generic/sigpause.c delete mode 100644 sysdeps/generic/sigpending.c delete mode 100644 sysdeps/generic/sigprocmask.c delete mode 100644 sysdeps/generic/sigqueue.c delete mode 100644 sysdeps/generic/sigreturn.c delete mode 100644 sysdeps/generic/sigset.c delete mode 100644 sysdeps/generic/sigsetmask.c delete mode 100644 sysdeps/generic/sigstack.c delete mode 100644 sysdeps/generic/sigsuspend.c delete mode 100644 sysdeps/generic/sigtimedwait.c delete mode 100644 sysdeps/generic/sigvec.c delete mode 100644 sysdeps/generic/sigwait.c delete mode 100644 sysdeps/generic/sigwaitinfo.c delete mode 100644 sysdeps/generic/sleep.c delete mode 100644 sysdeps/generic/sockatmark.c delete mode 100644 sysdeps/generic/socket.c delete mode 100644 sysdeps/generic/socketpair.c delete mode 100644 sysdeps/generic/spawni.c delete mode 100644 sysdeps/generic/speed.c delete mode 100644 sysdeps/generic/sprofil.c delete mode 100644 sysdeps/generic/sstk.c delete mode 100644 sysdeps/generic/start.c delete mode 100644 sysdeps/generic/statfs.c delete mode 100644 sysdeps/generic/statfs64.c delete mode 100644 sysdeps/generic/statvfs.c delete mode 100644 sysdeps/generic/statvfs64.c delete mode 100644 sysdeps/generic/stime.c delete mode 100644 sysdeps/generic/stpcpy.c delete mode 100644 sysdeps/generic/stpcpy_chk.c delete mode 100644 sysdeps/generic/stpncpy.c delete mode 100644 sysdeps/generic/stpncpy_chk.c delete mode 100644 sysdeps/generic/strcasecmp.c delete mode 100644 sysdeps/generic/strcasecmp_l.c delete mode 100644 sysdeps/generic/strcasestr.c delete mode 100644 sysdeps/generic/strcat.c delete mode 100644 sysdeps/generic/strcat_chk.c delete mode 100644 sysdeps/generic/strchr.c delete mode 100644 sysdeps/generic/strchrnul.c delete mode 100644 sysdeps/generic/strcmp.c delete mode 100644 sysdeps/generic/strcpy.c delete mode 100644 sysdeps/generic/strcpy_chk.c delete mode 100644 sysdeps/generic/strcspn.c delete mode 100644 sysdeps/generic/string-inlines.c delete mode 100644 sysdeps/generic/strlen.c delete mode 100644 sysdeps/generic/strncase.c delete mode 100644 sysdeps/generic/strncase_l.c delete mode 100644 sysdeps/generic/strncat.c delete mode 100644 sysdeps/generic/strncat_chk.c delete mode 100644 sysdeps/generic/strncmp.c delete mode 100644 sysdeps/generic/strncpy.c delete mode 100644 sysdeps/generic/strncpy_chk.c delete mode 100644 sysdeps/generic/strnlen.c delete mode 100644 sysdeps/generic/strpbrk.c delete mode 100644 sysdeps/generic/strrchr.c delete mode 100644 sysdeps/generic/strsep.c delete mode 100644 sysdeps/generic/strspn.c delete mode 100644 sysdeps/generic/strstr.c delete mode 100644 sysdeps/generic/strtoimax.c delete mode 100644 sysdeps/generic/strtok.c delete mode 100644 sysdeps/generic/strtok_r.c delete mode 100644 sysdeps/generic/strtol.c delete mode 100644 sysdeps/generic/strtol_l.c delete mode 100644 sysdeps/generic/strtold_l.c delete mode 100644 sysdeps/generic/strtoll.c delete mode 100644 sysdeps/generic/strtoll_l.c delete mode 100644 sysdeps/generic/strtoul.c delete mode 100644 sysdeps/generic/strtoul_l.c delete mode 100644 sysdeps/generic/strtoull.c delete mode 100644 sysdeps/generic/strtoull_l.c delete mode 100644 sysdeps/generic/strtoumax.c delete mode 100644 sysdeps/generic/strtsupp.c delete mode 100644 sysdeps/generic/stty.c delete mode 100644 sysdeps/generic/sub_n.c delete mode 100644 sysdeps/generic/submul_1.c delete mode 100644 sysdeps/generic/swapcontext.c delete mode 100644 sysdeps/generic/swapoff.c delete mode 100644 sysdeps/generic/swapon.c delete mode 100644 sysdeps/generic/symlink.c delete mode 100644 sysdeps/generic/sync.c delete mode 100644 sysdeps/generic/syscall.c delete mode 100644 sysdeps/generic/sysconf.c delete mode 100644 sysdeps/generic/sysdep.c delete mode 100644 sysdeps/generic/syslog.c delete mode 100644 sysdeps/generic/system.c delete mode 100644 sysdeps/generic/sysv_signal.c delete mode 100644 sysdeps/generic/t_sincosl.c delete mode 100644 sysdeps/generic/tcdrain.c delete mode 100644 sysdeps/generic/tcflow.c delete mode 100644 sysdeps/generic/tcflush.c delete mode 100644 sysdeps/generic/tcgetattr.c delete mode 100644 sysdeps/generic/tcgetpgrp.c delete mode 100644 sysdeps/generic/tcsendbrk.c delete mode 100644 sysdeps/generic/tcsetattr.c delete mode 100644 sysdeps/generic/tcsetpgrp.c delete mode 100644 sysdeps/generic/telldir.c delete mode 100644 sysdeps/generic/tempname.c delete mode 100644 sysdeps/generic/time.c delete mode 100644 sysdeps/generic/timer_create.c delete mode 100644 sysdeps/generic/timer_delete.c delete mode 100644 sysdeps/generic/timer_getoverr.c delete mode 100644 sysdeps/generic/timer_gettime.c delete mode 100644 sysdeps/generic/timer_settime.c delete mode 100644 sysdeps/generic/times.c delete mode 100644 sysdeps/generic/tmpfile.c delete mode 100644 sysdeps/generic/tmpfile64.c delete mode 100644 sysdeps/generic/trampoline.c delete mode 100644 sysdeps/generic/truncate.c delete mode 100644 sysdeps/generic/truncate64.c delete mode 100644 sysdeps/generic/tst-timer.c delete mode 100644 sysdeps/generic/ttyname.c delete mode 100644 sysdeps/generic/ttyname_r.c delete mode 100644 sysdeps/generic/ualarm.c delete mode 100644 sysdeps/generic/udiv_qrnnd.c delete mode 100644 sysdeps/generic/ulimit.c delete mode 100644 sysdeps/generic/umask.c delete mode 100644 sysdeps/generic/uname.c delete mode 100644 sysdeps/generic/unlink.c delete mode 100644 sysdeps/generic/unlinkat.c delete mode 100644 sysdeps/generic/unlockpt.c delete mode 100644 sysdeps/generic/updwtmp.c delete mode 100644 sysdeps/generic/updwtmpx.c delete mode 100644 sysdeps/generic/usleep.c delete mode 100644 sysdeps/generic/ustat.c delete mode 100644 sysdeps/generic/utime.c delete mode 100644 sysdeps/generic/utimes.c delete mode 100644 sysdeps/generic/utmp_file.c delete mode 100644 sysdeps/generic/utmpxname.c delete mode 100644 sysdeps/generic/versionsort64.c delete mode 100644 sysdeps/generic/vfork.c delete mode 100644 sysdeps/generic/vhangup.c delete mode 100644 sysdeps/generic/vlimit.c delete mode 100644 sysdeps/generic/vtimes.c delete mode 100644 sysdeps/generic/w_acos.c delete mode 100644 sysdeps/generic/w_acosf.c delete mode 100644 sysdeps/generic/w_acosh.c delete mode 100644 sysdeps/generic/w_acoshf.c delete mode 100644 sysdeps/generic/w_acoshl.c delete mode 100644 sysdeps/generic/w_acosl.c delete mode 100644 sysdeps/generic/w_asin.c delete mode 100644 sysdeps/generic/w_asinf.c delete mode 100644 sysdeps/generic/w_asinl.c delete mode 100644 sysdeps/generic/w_atan2.c delete mode 100644 sysdeps/generic/w_atan2f.c delete mode 100644 sysdeps/generic/w_atan2l.c delete mode 100644 sysdeps/generic/w_atanh.c delete mode 100644 sysdeps/generic/w_atanhf.c delete mode 100644 sysdeps/generic/w_atanhl.c delete mode 100644 sysdeps/generic/w_cosh.c delete mode 100644 sysdeps/generic/w_coshf.c delete mode 100644 sysdeps/generic/w_coshl.c delete mode 100644 sysdeps/generic/w_drem.c delete mode 100644 sysdeps/generic/w_dremf.c delete mode 100644 sysdeps/generic/w_dreml.c delete mode 100644 sysdeps/generic/w_exp10.c delete mode 100644 sysdeps/generic/w_exp10f.c delete mode 100644 sysdeps/generic/w_exp10l.c delete mode 100644 sysdeps/generic/w_exp2.c delete mode 100644 sysdeps/generic/w_exp2f.c delete mode 100644 sysdeps/generic/w_exp2l.c delete mode 100644 sysdeps/generic/w_expl.c delete mode 100644 sysdeps/generic/w_fmod.c delete mode 100644 sysdeps/generic/w_fmodf.c delete mode 100644 sysdeps/generic/w_fmodl.c delete mode 100644 sysdeps/generic/w_hypot.c delete mode 100644 sysdeps/generic/w_hypotf.c delete mode 100644 sysdeps/generic/w_hypotl.c delete mode 100644 sysdeps/generic/w_j0.c delete mode 100644 sysdeps/generic/w_j0f.c delete mode 100644 sysdeps/generic/w_j0l.c delete mode 100644 sysdeps/generic/w_j1.c delete mode 100644 sysdeps/generic/w_j1f.c delete mode 100644 sysdeps/generic/w_j1l.c delete mode 100644 sysdeps/generic/w_jn.c delete mode 100644 sysdeps/generic/w_jnf.c delete mode 100644 sysdeps/generic/w_jnl.c delete mode 100644 sysdeps/generic/w_lgamma.c delete mode 100644 sysdeps/generic/w_lgamma_r.c delete mode 100644 sysdeps/generic/w_lgammaf.c delete mode 100644 sysdeps/generic/w_lgammaf_r.c delete mode 100644 sysdeps/generic/w_lgammal.c delete mode 100644 sysdeps/generic/w_lgammal_r.c delete mode 100644 sysdeps/generic/w_log.c delete mode 100644 sysdeps/generic/w_log10.c delete mode 100644 sysdeps/generic/w_log10f.c delete mode 100644 sysdeps/generic/w_log10l.c delete mode 100644 sysdeps/generic/w_log2.c delete mode 100644 sysdeps/generic/w_log2f.c delete mode 100644 sysdeps/generic/w_log2l.c delete mode 100644 sysdeps/generic/w_logf.c delete mode 100644 sysdeps/generic/w_logl.c delete mode 100644 sysdeps/generic/w_pow.c delete mode 100644 sysdeps/generic/w_powf.c delete mode 100644 sysdeps/generic/w_powl.c delete mode 100644 sysdeps/generic/w_remainder.c delete mode 100644 sysdeps/generic/w_remainderf.c delete mode 100644 sysdeps/generic/w_remainderl.c delete mode 100644 sysdeps/generic/w_scalb.c delete mode 100644 sysdeps/generic/w_scalbf.c delete mode 100644 sysdeps/generic/w_scalbl.c delete mode 100644 sysdeps/generic/w_sinh.c delete mode 100644 sysdeps/generic/w_sinhf.c delete mode 100644 sysdeps/generic/w_sinhl.c delete mode 100644 sysdeps/generic/w_sqrt.c delete mode 100644 sysdeps/generic/w_sqrtf.c delete mode 100644 sysdeps/generic/w_sqrtl.c delete mode 100644 sysdeps/generic/w_tgamma.c delete mode 100644 sysdeps/generic/w_tgammaf.c delete mode 100644 sysdeps/generic/w_tgammal.c delete mode 100644 sysdeps/generic/wait.c delete mode 100644 sysdeps/generic/wait3.c delete mode 100644 sysdeps/generic/wait4.c delete mode 100644 sysdeps/generic/waitid.c delete mode 100644 sysdeps/generic/waitpid.c delete mode 100644 sysdeps/generic/wcstoimax.c delete mode 100644 sysdeps/generic/wcstol.c delete mode 100644 sysdeps/generic/wcstol_l.c delete mode 100644 sysdeps/generic/wcstoll.c delete mode 100644 sysdeps/generic/wcstoll_l.c delete mode 100644 sysdeps/generic/wcstoul.c delete mode 100644 sysdeps/generic/wcstoul_l.c delete mode 100644 sysdeps/generic/wcstoull.c delete mode 100644 sysdeps/generic/wcstoull_l.c delete mode 100644 sysdeps/generic/wcstoumax.c delete mode 100644 sysdeps/generic/wordcopy.c delete mode 100644 sysdeps/generic/wordexp.c delete mode 100644 sysdeps/generic/write.c delete mode 100644 sysdeps/generic/writev.c delete mode 100644 sysdeps/generic/xmknod.c delete mode 100644 sysdeps/generic/xpg-strerror.c delete mode 100644 sysdeps/generic/xstat.c delete mode 100644 sysdeps/generic/xstat64.c delete mode 100644 sysdeps/i386/elf/bsd-setjmp.S delete mode 100644 sysdeps/i386/elf/setjmp.S create mode 100644 sysdeps/powerpc/dl-procinfo.c create mode 100644 sysdeps/powerpc/dl-procinfo.h create mode 100644 sysdeps/unix/mkfifoat.c create mode 100644 sysdeps/unix/sysv/linux/linkat.c create mode 100644 sysdeps/unix/sysv/linux/mkdirat.c create mode 100644 sysdeps/unix/sysv/linux/readlinkat.c create mode 100644 sysdeps/unix/sysv/linux/symlinkat.c create mode 100644 sysdeps/unix/sysv/linux/xmknodat.c create mode 100644 sysvipc/msgctl.c create mode 100644 sysvipc/msgget.c create mode 100644 sysvipc/msgrcv.c create mode 100644 sysvipc/msgsnd.c create mode 100644 sysvipc/semctl.c create mode 100644 sysvipc/semget.c create mode 100644 sysvipc/semop.c create mode 100644 sysvipc/semtimedop.c create mode 100644 sysvipc/shmat.c create mode 100644 sysvipc/shmctl.c create mode 100644 sysvipc/shmdt.c create mode 100644 sysvipc/shmget.c create mode 100644 termios/speed.c create mode 100644 termios/tcdrain.c create mode 100644 termios/tcflow.c create mode 100644 termios/tcflush.c create mode 100644 termios/tcgetattr.c create mode 100644 termios/tcgetpgrp.c create mode 100644 termios/tcsendbrk.c create mode 100644 termios/tcsetattr.c create mode 100644 termios/tcsetpgrp.c create mode 100644 time/adjtime.c create mode 100644 time/clock.c create mode 100644 time/ftime.c create mode 100644 time/getitimer.c create mode 100644 time/gettimeofday.c create mode 100644 time/setitimer.c create mode 100644 time/settimeofday.c create mode 100644 time/stime.c create mode 100644 time/time.c create mode 100644 wcsmbs/wcstol.c create mode 100644 wcsmbs/wcstol_l.c create mode 100644 wcsmbs/wcstoll.c create mode 100644 wcsmbs/wcstoll_l.c create mode 100644 wcsmbs/wcstoul.c create mode 100644 wcsmbs/wcstoul_l.c create mode 100644 wcsmbs/wcstoull.c create mode 100644 wcsmbs/wcstoull_l.c diff --git a/ChangeLog b/ChangeLog index a83b6a0e49..54801f90f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,2191 @@ +2005-12-18 Ulrich Drepper + + * iconv/gconv.c: Demangle pointers before use if necessary. + * iconv/gconv_cache.c: Likewise. + * iconv/skeleton.c: Likewise. + * libio/iofwide.c: Likewise. + * wcsmbs/btowc.c: Likewise. + * wcsmbs/mbrtowc.c: Likewise. + * wcsmbs/mbsnrtowcs.c: Likewise. + * wcsmbs/mbsrtowcs_l.c: Likewise. + * wcsmbs/wcrtomb.c: Likewise. + * wcsmbs/wcsnrtombs.c: Likewise. + * wcsmbs/wcsrtombs.c: Likewise. + * wcsmbs/wctob.c: Likewise. + * iconv_gconv_db.c: Likewise. After init functions returns mangle + btowc pointer if necessary. + * iconv/gconv_dl.c: Mangle function pointers retrieved from dlsym. + + * iconv/gconv_builtin.c (builtin_map): Change type of size + information fields to int8_t. + + * libio/iofwide.c (__libio_codecvt): Mark as const. + (__libio_translit): Likewise. + * libio/libioP.h (__libio_codecvt): Adjust declaraction. + + * wcsmbs/wcsmbsload.c (to_wc): Mark as const. + (to_mb): Likewise. + +2005-12-18 Richard Henderson + + * sysdeps/alpha/libc-tls.c: Fix directory on include of base file. + +2005-12-18 Ulrich Drepper + + * iconv/gconv_builtin.c: Mark map with attribute_relro. + + * sysdeps/unix/sysv/linux/x86_64/sysdep.h (PTR_MANGLE): Define C + version for inside ld.so. + + * elf/rtld.c (dl_main): Don't use hp timing code unless it's available. + + * sysdeps/powerpc/powerpc32/setjmp-common.S [IS_IN_rtld]: Avoid + call to __sigjmp_save. + * sysdeps/powerpc/powerpc64/setjmp-common.S: Likewise. + + * stdlib/cxa_atexit.c: Use PTR_MANGLE on function pointer. Fill in + flavor field last and protect with memory barrier. + * stdlib/on_exit.c: Likewise. + * stdlib/cxa_finalize.c: Use PTR_DEMANGLE on function pointer before + using it. + * stdlib/exit.c: Likewise. + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Define PTR_MANGLE and + PTR_DEMANGLE for C code in libc. + * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. + +2005-12-17 Ulrich Drepper + + * elf/Versions [GLIBC_PRIVATE]: Export __pointer_chk_guard if defined. + * elf/rtld.c: Define __pointer_chk_guard_local and if necessary + __pointer_chk_guard. + (_rtld_global_ro): Initialize _dl_pointer_guard. + (dl_main): Initialize __pointer_chk_guard_local and either + __pointer_chk_guard or TLS value if necessary. + (process_envvars): Recognize and handle LD_POINTER_GUARD. + * sysdeps/generic/ldsodefs.h (rtld_global_ro): Add _dl_pointer_guard. + * sysdeps/i386/__longjmp.S: Use PTR_DEMANGLE for PC if defined. + * sysdeps/x86_64/__longjmp.S: Likewise. + * sysdeps/i386/bsd-_setjmp.S: Use PTR_MANGLE for PC if defined. + * sysdeps/i386/bsd-_setjmp.S: Likewise. + * sysdeps/i386/setjmp.S: Likewise. + [IS_IN_rtld]: Avoid call to __sigjmp_save. + * sysdeps/i386/setjmp.S: Likewise. + * sysdeps/unix/sysv/linux/i386/sysdep.h: Define PTR_MANGLE and + PTR_DEMANGLE. + * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. + + * sysdeps/i386/elf/setjmp.S: Removed. + * sysdeps/i386/elf/bsd-setjmp.S: Removed. + + * elf/dl-error.c (_dl_catch_error): Use __sigsetgjmp instead of + setjmp. + * elf/dl-error.c (_dl_signal_error): Use __longjmp instead of longjmp. + * elf/dl-minimal.c (longjmp): Remove definition. + + * sysdeps/x86_64/bsd-setjmp.S [PIC] (setjmp): Add missing jmp. + +2005-12-14 Thorsten Kukuk + + * nscd/Makefile: Don't build nscd_nischeck. + * nscd/nscd_nischeck.c: Removed. + +2005-12-15 Ulrich Drepper + + * sysdeps/unix/sysv/linux/renameat.c: Move errno setting code in + separate function __atfct_seterrno_2. + * include/fcntl.h: Declare __atfct_seterrno_2. + * posix/unistd.h: Declare linkat, symlinkat, readlinkat. + * io/Makefile (routines): Add linkat, symlinkat, readlinkat. + * io/Versions [GLIBC_2.4]: Export linkat, symlinkat, readlinkat. + * io/linkat.c: New file. + * io/readlinkat.c: New file. + * io/symlinkat.c: New file. + * sysdeps/unix/sysv/linux/linkat.c: New file. + * sysdeps/unix/sysv/linux/readlinkat.c: New file. + * sysdeps/unix/sysv/linux/symlinkat.c: New file. + +2005-12-15 Roland McGrath + + [BZ #1997] + * manual/stdio.texi (String Streams): For open_memstream, elaborate a + little on malloc reference. + + * sysdeps/alpha/fpu/s_cacosf.c: Don't use sysdeps/generic/. + * sysdeps/alpha/fpu/s_cacoshf.c: Likewise. + * sysdeps/alpha/fpu/s_casinf.c: Likewise. + * sysdeps/alpha/fpu/s_casinhf.c: Likewise. + * sysdeps/alpha/fpu/s_catanf.c: Likewise. + * sysdeps/alpha/fpu/s_catanhf.c: Likewise. + * sysdeps/alpha/fpu/s_ccosf.c: Likewise. + * sysdeps/alpha/fpu/s_ccoshf.c: Likewise. + * sysdeps/alpha/fpu/s_cexpf.c: Likewise. + * sysdeps/alpha/fpu/s_clog10f.c: Likewise. + * sysdeps/alpha/fpu/s_clogf.c: Likewise. + * sysdeps/alpha/fpu/s_cpowf.c: Likewise. + * sysdeps/alpha/fpu/s_cprojf.c: Likewise. + * sysdeps/alpha/fpu/s_csinf.c: Likewise. + * sysdeps/alpha/fpu/s_csinhf.c: Likewise. + * sysdeps/alpha/fpu/s_csqrtf.c: Likewise. + * sysdeps/alpha/fpu/s_ctanf.c: Likewise. + * sysdeps/alpha/fpu/s_ctanhf.c: Likewise. + * sysdeps/alpha/libc-tls.c: Likewise. + * sysdeps/gnu/glob64.c: Likewise. + * sysdeps/gnu/updwtmp.c: Likewise. + * sysdeps/gnu/utmp_file.c: Likewise. + * sysdeps/i386/bzero.c: Likewise. + * sysdeps/i386/ffs.c: Likewise. + * sysdeps/i386/i686/ffs.c: Likewise. + * sysdeps/i386/memset.c: Likewise. + * sysdeps/ia64/fpu/printf_fphex.c: Likewise. + * sysdeps/ia64/libc-tls.c: Likewise. + * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise. + * sysdeps/m68k/ffs.c: Likewise. + * sysdeps/mach/hurd/getdents.c: Likewise. + * sysdeps/mach/hurd/init-posix.c: Likewise. + * sysdeps/mach/msync.c: Likewise. + * sysdeps/mips/libc-tls.c: Likewise. + * sysdeps/posix/profil.c: Likewise. + * sysdeps/posix/shm_open.c: Likewise. + * sysdeps/posix/shm_unlink.c: Likewise. + * sysdeps/posix/sprofil.c: Likewise. + * sysdeps/powerpc/ffs.c: Likewise. + * sysdeps/rs6000/ffs.c: Likewise. + * sysdeps/s390/libc-tls.c: Likewise. + * sysdeps/unix/sysv/linux/aio_sigqueue.c: Likewise. + * sysdeps/unix/sysv/linux/alpha/glob.c: Likewise. + * sysdeps/unix/sysv/linux/alpha/wordexp.c: Likewise. + * sysdeps/unix/sysv/linux/ftruncate64.c: Likewise. + * sysdeps/unix/sysv/linux/gai_sigqueue.c: Likewise. + * sysdeps/unix/sysv/linux/i386/getmsg.c: Likewise. + * sysdeps/unix/sysv/linux/i386/getresgid.c: Likewise. + * sysdeps/unix/sysv/linux/i386/getresuid.c: Likewise. + * sysdeps/unix/sysv/linux/i386/lchown.c: Likewise. + * sysdeps/unix/sysv/linux/i386/putmsg.c: Likewise. + * sysdeps/unix/sysv/linux/i386/readelflib.c: Likewise. + * sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise. + * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. + * sysdeps/unix/sysv/linux/ia64/readelflib.c: Likewise. + * sysdeps/unix/sysv/linux/mips/ftruncate64.c: Likewise. + * sysdeps/unix/sysv/linux/mips/readelflib.c: Likewise. + * sysdeps/unix/sysv/linux/mips/truncate64.c: Likewise. + * sysdeps/unix/sysv/linux/mq_close.c: Likewise. + * sysdeps/unix/sysv/linux/mq_getattr.c: Likewise. + * sysdeps/unix/sysv/linux/mq_notify.c: Likewise. + * sysdeps/unix/sysv/linux/mq_open.c: Likewise. + * sysdeps/unix/sysv/linux/mq_receive.c: Likewise. + * sysdeps/unix/sysv/linux/mq_send.c: Likewise. + * sysdeps/unix/sysv/linux/mq_unlink.c: Likewise. + * sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c: Likewise. + * sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c: Likewise. + * sysdeps/unix/sysv/linux/powerpc/readelflib.c: Likewise. + * sysdeps/unix/sysv/linux/s390/readelflib.c: Likewise. + * sysdeps/unix/sysv/linux/sched_getaffinity.c: Likewise. + * sysdeps/unix/sysv/linux/sched_setaffinity.c: Likewise. + * sysdeps/unix/sysv/linux/sigqueue.c: Likewise. + * sysdeps/unix/sysv/linux/sigstack.c: Likewise. + * sysdeps/unix/sysv/linux/sigtimedwait.c: Likewise. + * sysdeps/unix/sysv/linux/sigwaitinfo.c: Likewise. + * sysdeps/unix/sysv/linux/sparc/readelflib.c: Likewise. + * sysdeps/unix/sysv/linux/truncate64.c: Likewise. + * sysdeps/unix/sysv/linux/vfork.c: Likewise. + * sysdeps/unix/sysv/linux/x86_64/readelflib.c: Likewise. + + * sysdeps/unix/sysv/linux/Makefile (inhibit-siglist): Removed. + +2005-12-13 Ulrich Drepper + + * locale/programs/charmap-kw.h: Regenerated with new gperf. + * locale/programs/locfile-kw.h: Likewise. + + * Makeconfig (+includes): Look in current directory late. + * Makerules: Add rules from rules before the rules for the current + directory. + * sysdeps/generic/__longjmp.c: Moved to... + * setjmp/__longjmp.c: ...here. + * sysdeps/generic/_exit.c: Moved to... + * posix/_exit.c: ...here. + * sysdeps/generic/_strerror.c: Moved to... + * string/_strerror.c: ...here. + * sysdeps/generic/abort.c: Moved to... + * stdlib/abort.c: ...here. + * sysdeps/generic/accept.c: Moved to... + * socket/accept.c: ...here. + * sysdeps/generic/access.c: Moved to... + * io/access.c: ...here. + * sysdeps/generic/acct.c: Moved to... + * misc/acct.c: ...here. + * sysdeps/generic/add_n.c: Moved to... + * stdlib/add_n.c: ...here. + * sysdeps/generic/addmul_1.c: Moved to... + * stdlib/addmul_1.c: ...here. + * sysdeps/generic/adjtime.c: Moved to... + * time/adjtime.c: ...here. + * sysdeps/generic/aio_cancel.c: Moved to... + * rt/aio_cancel.c: ...here. + * sysdeps/generic/aio_fsync.c: Moved to... + * rt/aio_fsync.c: ...here. + * sysdeps/generic/aio_misc.c: Moved to... + * rt/aio_misc.c: ...here. + * sysdeps/generic/aio_notify.c: Moved to... + * rt/aio_notify.c: ...here. + * sysdeps/generic/aio_read.c: Moved to... + * rt/aio_read.c: ...here. + * sysdeps/generic/aio_read64.c: Moved to... + * rt/aio_read64.c: ...here. + * sysdeps/generic/aio_sigqueue.c: Moved to... + * rt/aio_sigqueue.c: ...here. + * sysdeps/generic/aio_suspend.c: Moved to... + * rt/aio_suspend.c: ...here. + * sysdeps/generic/aio_write.c: Moved to... + * rt/aio_write.c: ...here. + * sysdeps/generic/aio_write64.c: Moved to... + * rt/aio_write64.c: ...here. + * sysdeps/generic/alarm.c: Moved to... + * posix/alarm.c: ...here. + * sysdeps/generic/allocrtsig.c: Moved to... + * signal/allocrtsig.c: ...here. + * sysdeps/generic/alphasort64.c: Moved to... + * dirent/alphasort64.c: ...here. + * sysdeps/generic/backtrace.c: Moved to... + * debug/backtrace.c: ...here. + * sysdeps/generic/backtracesyms.c: Moved to... + * debug/backtracesyms.c: ...here. + * sysdeps/generic/backtracesymsfd.c: Moved to... + * debug/backtracesymsfd.c: ...here. + * sysdeps/generic/bb_init_func.c: Moved to... + * gmon/bb_init_func.c: ...here. + * sysdeps/generic/bcopy.c: Moved to... + * string/bcopy.c: ...here. + * sysdeps/generic/bind.c: Moved to... + * socket/bind.c: ...here. + * sysdeps/generic/brdinit.c: Moved to... + * bare/brdinit.c: ...here. + * sysdeps/generic/brk.c: Moved to... + * misc/brk.c: ...here. + * sysdeps/generic/bsd-_setjmp.c: Moved to... + * setjmp/bsd-_setjmp.c: ...here. + * sysdeps/generic/bsd-setjmp.c: Moved to... + * setjmp/bsd-setjmp.c: ...here. + * sysdeps/generic/bzero.c: Moved to... + * string/bzero.c: ...here. + * sysdeps/generic/cabsf.c: Moved to... + * math/cabsf.c: ...here. + * sysdeps/generic/cargf.c: Moved to... + * math/cargf.c: ...here. + * sysdeps/generic/chdir.c: Moved to... + * io/chdir.c: ...here. + * sysdeps/generic/check_fds.c: Moved to... + * csu/check_fds.c: ...here. + * sysdeps/generic/check_pf.c: Moved to... + * inet/check_pf.c: ...here. + * sysdeps/generic/chflags.c: Moved to... + * misc/chflags.c: ...here. + * sysdeps/generic/chmod.c: Moved to... + * io/chmod.c: ...here. + * sysdeps/generic/chown.c: Moved to... + * io/chown.c: ...here. + * sysdeps/generic/chroot.c: Moved to... + * misc/chroot.c: ...here. + * sysdeps/generic/cimagf.c: Moved to... + * math/cimagf.c: ...here. + * sysdeps/generic/clock.c: Moved to... + * time/clock.c: ...here. + * sysdeps/generic/clock_getcpuclockid.c: Moved to... + * rt/clock_getcpuclockid.c: ...here. + * sysdeps/generic/clock_getres.c: Moved to... + * rt/clock_getres.c: ...here. + * sysdeps/generic/clock_gettime.c: Moved to... + * rt/clock_gettime.c: ...here. + * sysdeps/generic/clock_nanosleep.c: Moved to... + * rt/clock_nanosleep.c: ...here. + * sysdeps/generic/clock_settime.c: Moved to... + * rt/clock_settime.c: ...here. + * sysdeps/generic/close.c: Moved to... + * io/close.c: ...here. + * sysdeps/generic/closedir.c: Moved to... + * dirent/closedir.c: ...here. + * sysdeps/generic/cmp.c: Moved to... + * stdlib/cmp.c: ...here. + * sysdeps/generic/conjf.c: Moved to... + * math/conjf.c: ...here. + * sysdeps/generic/connect.c: Moved to... + * socket/connect.c: ...here. + * sysdeps/generic/console.c: Moved to... + * bare/console.c: ...here. + * sysdeps/generic/crealf.c: Moved to... + * math/crealf.c: ...here. + * sysdeps/generic/creat.c: Moved to... + * io/creat.c: ...here. + * sysdeps/generic/creat64.c: Moved to... + * io/creat64.c: ...here. + * sysdeps/generic/ctermid.c: Moved to... + * stdio-common/ctermid.c: ...here. + * sysdeps/generic/cuserid.c: Moved to... + * stdio-common/cuserid.c: ...here. + * sysdeps/generic/dbl2mpn.c: Moved to... + * stdlib/dbl2mpn.c: ...here. + * sysdeps/generic/dirfd.c: Moved to... + * dirent/dirfd.c: ...here. + * sysdeps/generic/div.c: Moved to... + * stdlib/div.c: ...here. + * sysdeps/generic/divmod_1.c: Moved to... + * stdlib/divmod_1.c: ...here. + * sysdeps/generic/divrem.c: Moved to... + * stdlib/divrem.c: ...here. + * sysdeps/generic/dl-brk.c: Moved to... + * elf/dl-brk.c: ...here. + * sysdeps/generic/dl-cache.c: Moved to... + * elf/dl-cache.c: ...here. + * sysdeps/generic/dl-environ.c: Moved to... + * elf/dl-environ.c: ...here. + * sysdeps/generic/dl-execstack.c: Moved to... + * elf/dl-execstack.c: ...here. + * sysdeps/generic/dl-fptr.c: Moved to... + * elf/dl-fptr.c: ...here. + * sysdeps/generic/dl-origin.c: Moved to... + * elf/dl-origin.c: ...here. + * sysdeps/generic/dl-sbrk.c: Moved to... + * elf/dl-sbrk.c: ...here. + * sysdeps/generic/dl-symaddr.c: Moved to... + * elf/dl-symaddr.c: ...here. + * sysdeps/generic/dl-sysdep.c: Moved to... + * elf/dl-sysdep.c: ...here. + * sysdeps/generic/dl-tls.c: Moved to... + * elf/dl-tls.c: ...here. + * sysdeps/generic/dl-trampoline.c: Moved to... + * elf/dl-trampoline.c: ...here. + * sysdeps/generic/dup.c: Moved to... + * io/dup.c: ...here. + * sysdeps/generic/dup2.c: Moved to... + * io/dup2.c: ...here. + * sysdeps/generic/e_acoshl.c: Moved to... + * math/e_acoshl.c: ...here. + * sysdeps/generic/e_acosl.c: Moved to... + * math/e_acosl.c: ...here. + * sysdeps/generic/e_asinl.c: Moved to... + * math/e_asinl.c: ...here. + * sysdeps/generic/e_atan2l.c: Moved to... + * math/e_atan2l.c: ...here. + * sysdeps/generic/e_atanhl.c: Moved to... + * math/e_atanhl.c: ...here. + * sysdeps/generic/e_coshl.c: Moved to... + * math/e_coshl.c: ...here. + * sysdeps/generic/e_exp10.c: Moved to... + * math/e_exp10.c: ...here. + * sysdeps/generic/e_exp10f.c: Moved to... + * math/e_exp10f.c: ...here. + * sysdeps/generic/e_exp10l.c: Moved to... + * math/e_exp10l.c: ...here. + * sysdeps/generic/e_exp2l.c: Moved to... + * math/e_exp2l.c: ...here. + * sysdeps/generic/e_expl.c: Moved to... + * math/e_expl.c: ...here. + * sysdeps/generic/e_fmodl.c: Moved to... + * math/e_fmodl.c: ...here. + * sysdeps/generic/e_gammal_r.c: Moved to... + * math/e_gammal_r.c: ...here. + * sysdeps/generic/e_hypotl.c: Moved to... + * math/e_hypotl.c: ...here. + * sysdeps/generic/e_j0l.c: Moved to... + * math/e_j0l.c: ...here. + * sysdeps/generic/e_j1l.c: Moved to... + * math/e_j1l.c: ...here. + * sysdeps/generic/e_jnl.c: Moved to... + * math/e_jnl.c: ...here. + * sysdeps/generic/e_lgammal_r.c: Moved to... + * math/e_lgammal_r.c: ...here. + * sysdeps/generic/e_log10l.c: Moved to... + * math/e_log10l.c: ...here. + * sysdeps/generic/e_log2l.c: Moved to... + * math/e_log2l.c: ...here. + * sysdeps/generic/e_logl.c: Moved to... + * math/e_logl.c: ...here. + * sysdeps/generic/e_powl.c: Moved to... + * math/e_powl.c: ...here. + * sysdeps/generic/e_rem_pio2l.c: Moved to... + * math/e_rem_pio2l.c: ...here. + * sysdeps/generic/e_scalb.c: Moved to... + * math/e_scalb.c: ...here. + * sysdeps/generic/e_scalbf.c: Moved to... + * math/e_scalbf.c: ...here. + * sysdeps/generic/e_scalbl.c: Moved to... + * math/e_scalbl.c: ...here. + * sysdeps/generic/e_sinhl.c: Moved to... + * math/e_sinhl.c: ...here. + * sysdeps/generic/e_sqrtl.c: Moved to... + * math/e_sqrtl.c: ...here. + * sysdeps/generic/enbl-secure.c: Moved to... + * elf/enbl-secure.c: ...here. + * sysdeps/generic/endutxent.c: Moved to... + * login/endutxent.c: ...here. + * sysdeps/generic/environ.c: Moved to... + * posix/environ.c: ...here. + * sysdeps/generic/errlist.c: Moved to... + * stdio-common/errlist.c: ...here. + * sysdeps/generic/errno-loc.c: Moved to... + * csu/errno-loc.c: ...here. + * sysdeps/generic/errno-loc.c: Moved to... + * csu/errno-loc.c: ...here. + * sysdeps/generic/errno.c: Moved to... + * csu/errno.c: ...here. + * sysdeps/generic/euidaccess.c: Moved to... + * io/euidaccess.c: ...here. + * sysdeps/generic/exc2signal.c: Moved to... + * hurd/exc2signal.c: ...here. + * sysdeps/generic/execve.c: Moved to... + * posix/execve.c: ...here. + * sysdeps/generic/fattach.c: Moved to... + * streams/fattach.c: ...here. + * sysdeps/generic/fchdir.c: Moved to... + * io/fchdir.c: ...here. + * sysdeps/generic/fchflags.c: Moved to... + * misc/fchflags.c: ...here. + * sysdeps/generic/fchmod.c: Moved to... + * io/fchmod.c: ...here. + * sysdeps/generic/fchown.c: Moved to... + * io/fchown.c: ...here. + * sysdeps/generic/fchownat.c: Moved to... + * io/fchownat.c: ...here. + * sysdeps/generic/fclrexcpt.c: Moved to... + * math/fclrexcpt.c: ...here. + * sysdeps/generic/fcntl.c: Moved to... + * io/fcntl.c: ...here. + * sysdeps/generic/fdatasync.c: Moved to... + * misc/fdatasync.c: ...here. + * sysdeps/generic/fdetach.c: Moved to... + * streams/fdetach.c: ...here. + * sysdeps/generic/fdopendir.c: Moved to... + * dirent/fdopendir.c: ...here. + * sysdeps/generic/fedisblxcpt.c: Moved to... + * math/fedisblxcpt.c: ...here. + * sysdeps/generic/feenablxcpt.c: Moved to... + * math/feenablxcpt.c: ...here. + * sysdeps/generic/fegetenv.c: Moved to... + * math/fegetenv.c: ...here. + * sysdeps/generic/fegetexcept.c: Moved to... + * math/fegetexcept.c: ...here. + * sysdeps/generic/fegetround.c: Moved to... + * math/fegetround.c: ...here. + * sysdeps/generic/feholdexcpt.c: Moved to... + * math/feholdexcpt.c: ...here. + * sysdeps/generic/fesetenv.c: Moved to... + * math/fesetenv.c: ...here. + * sysdeps/generic/fesetround.c: Moved to... + * math/fesetround.c: ...here. + * sysdeps/generic/feupdateenv.c: Moved to... + * math/feupdateenv.c: ...here. + * sysdeps/generic/fexecve.c: Moved to... + * posix/fexecve.c: ...here. + * sysdeps/generic/ffs.c: Moved to... + * string/ffs.c: ...here. + * sysdeps/generic/ffsll.c: Moved to... + * string/ffsll.c: ...here. + * sysdeps/generic/fgetexcptflg.c: Moved to... + * math/fgetexcptflg.c: ...here. + * sysdeps/generic/fgetxattr.c: Moved to... + * misc/fgetxattr.c: ...here. + * sysdeps/generic/flistxattr.c: Moved to... + * misc/flistxattr.c: ...here. + * sysdeps/generic/flock.c: Moved to... + * io/flock.c: ...here. + * sysdeps/generic/flockfile.c: Moved to... + * stdio-common/flockfile.c: ...here. + * sysdeps/generic/fork.c: Moved to... + * posix/fork.c: ...here. + * sysdeps/generic/fpathconf.c: Moved to... + * posix/fpathconf.c: ...here. + * sysdeps/generic/fpu_control.c: Moved to... + * math/fpu_control.c: ...here. + * sysdeps/generic/fraiseexcpt.c: Moved to... + * math/fraiseexcpt.c: ...here. + * sysdeps/generic/fremovexattr.c: Moved to... + * misc/fremovexattr.c: ...here. + * sysdeps/generic/fsetexcptflg.c: Moved to... + * math/fsetexcptflg.c: ...here. + * sysdeps/generic/fsetxattr.c: Moved to... + * misc/fsetxattr.c: ...here. + * sysdeps/generic/fstatfs.c: Moved to... + * io/fstatfs.c: ...here. + * sysdeps/generic/fstatfs64.c: Moved to... + * io/fstatfs64.c: ...here. + * sysdeps/generic/fstatvfs.c: Moved to... + * io/fstatvfs.c: ...here. + * sysdeps/generic/fstatvfs64.c: Moved to... + * io/fstatvfs64.c: ...here. + * sysdeps/generic/fsync.c: Moved to... + * misc/fsync.c: ...here. + * sysdeps/generic/ftestexcept.c: Moved to... + * math/ftestexcept.c: ...here. + * sysdeps/generic/ftime.c: Moved to... + * time/ftime.c: ...here. + * sysdeps/generic/ftruncate.c: Moved to... + * misc/ftruncate.c: ...here. + * sysdeps/generic/ftruncate64.c: Moved to... + * misc/ftruncate64.c: ...here. + * sysdeps/generic/ftrylockfile.c: Moved to... + * stdio-common/ftrylockfile.c: ...here. + * sysdeps/generic/funlockfile.c: Moved to... + * stdio-common/funlockfile.c: ...here. + * sysdeps/generic/futimes.c: Moved to... + * misc/futimes.c: ...here. + * sysdeps/generic/futimesat.c: Moved to... + * misc/futimesat.c: ...here. + * sysdeps/generic/fxstat.c: Moved to... + * io/fxstat.c: ...here. + * sysdeps/generic/fxstat64.c: Moved to... + * io/fxstat64.c: ...here. + * sysdeps/generic/fxstatat.c: Moved to... + * io/fxstatat.c: ...here. + * sysdeps/generic/fxstatat64.c: Moved to... + * io/fxstatat64.c: ...here. + * sysdeps/generic/gai_sigqueue.c: Moved to... + * resolv/gai_sigqueue.c: ...here. + * sysdeps/generic/gai_strerror.c: Moved to... + * posix/gai_strerror.c: ...here. + * sysdeps/generic/get_clockfreq.c: Moved to... + * rt/get_clockfreq.c: ...here. + * sysdeps/generic/getaddrinfo.c: Moved to... + * posix/getaddrinfo.c: ...here. + * sysdeps/generic/getclktck.c: Moved to... + * misc/getclktck.c: ...here. + * sysdeps/generic/getcontext.c: Moved to... + * stdlib/getcontext.c: ...here. + * sysdeps/generic/getcwd.c: Moved to... + * io/getcwd.c: ...here. + * sysdeps/generic/getdents.c: Moved to... + * dirent/getdents.c: ...here. + * sysdeps/generic/getdents64.c: Moved to... + * dirent/getdents64.c: ...here. + * sysdeps/generic/getdomain.c: Moved to... + * misc/getdomain.c: ...here. + * sysdeps/generic/getdtsz.c: Moved to... + * misc/getdtsz.c: ...here. + * sysdeps/generic/getegid.c: Moved to... + * posix/getegid.c: ...here. + * sysdeps/generic/getenv.c: Moved to... + * stdlib/getenv.c: ...here. + * sysdeps/generic/geteuid.c: Moved to... + * posix/geteuid.c: ...here. + * sysdeps/generic/getgid.c: Moved to... + * posix/getgid.c: ...here. + * sysdeps/generic/getgroups.c: Moved to... + * posix/getgroups.c: ...here. + * sysdeps/generic/gethostid.c: Moved to... + * misc/gethostid.c: ...here. + * sysdeps/generic/gethostname.c: Moved to... + * misc/gethostname.c: ...here. + * sysdeps/generic/getipv4sourcefilter.c: Moved to... + * inet/getipv4sourcefilter.c: ...here. + * sysdeps/generic/getitimer.c: Moved to... + * time/getitimer.c: ...here. + * sysdeps/generic/getloadavg.c: Moved to... + * misc/getloadavg.c: ...here. + * sysdeps/generic/getlogin.c: Moved to... + * posix/getlogin.c: ...here. + * sysdeps/generic/getlogin_r.c: Moved to... + * posix/getlogin_r.c: ...here. + * sysdeps/generic/getmsg.c: Moved to... + * streams/getmsg.c: ...here. + * sysdeps/generic/getpagesize.c: Moved to... + * misc/getpagesize.c: ...here. + * sysdeps/generic/getpeername.c: Moved to... + * socket/getpeername.c: ...here. + * sysdeps/generic/getpgid.c: Moved to... + * posix/getpgid.c: ...here. + * sysdeps/generic/getpgrp.c: Moved to... + * posix/getpgrp.c: ...here. + * sysdeps/generic/getpid.c: Moved to... + * posix/getpid.c: ...here. + * sysdeps/generic/getpmsg.c: Moved to... + * streams/getpmsg.c: ...here. + * sysdeps/generic/getppid.c: Moved to... + * posix/getppid.c: ...here. + * sysdeps/generic/getpriority.c: Moved to... + * resource/getpriority.c: ...here. + * sysdeps/generic/getpt.c: Moved to... + * login/getpt.c: ...here. + * sysdeps/generic/getresgid.c: Moved to... + * posix/getresgid.c: ...here. + * sysdeps/generic/getresuid.c: Moved to... + * posix/getresuid.c: ...here. + * sysdeps/generic/getrlimit.c: Moved to... + * resource/getrlimit.c: ...here. + * sysdeps/generic/getrlimit64.c: Moved to... + * resource/getrlimit64.c: ...here. + * sysdeps/generic/getrusage.c: Moved to... + * resource/getrusage.c: ...here. + * sysdeps/generic/getsid.c: Moved to... + * posix/getsid.c: ...here. + * sysdeps/generic/getsockname.c: Moved to... + * socket/getsockname.c: ...here. + * sysdeps/generic/getsockopt.c: Moved to... + * socket/getsockopt.c: ...here. + * sysdeps/generic/getsourcefilter.c: Moved to... + * inet/getsourcefilter.c: ...here. + * sysdeps/generic/getsysstats.c: Moved to... + * misc/getsysstats.c: ...here. + * sysdeps/generic/gettimeofday.c: Moved to... + * time/gettimeofday.c: ...here. + * sysdeps/generic/getuid.c: Moved to... + * posix/getuid.c: ...here. + * sysdeps/generic/getutmp.c: Moved to... + * login/getutmp.c: ...here. + * sysdeps/generic/getutmpx.c: Moved to... + * login/getutmpx.c: ...here. + * sysdeps/generic/getutxent.c: Moved to... + * login/getutxent.c: ...here. + * sysdeps/generic/getutxid.c: Moved to... + * login/getutxid.c: ...here. + * sysdeps/generic/getutxline.c: Moved to... + * login/getutxline.c: ...here. + * sysdeps/generic/getxattr.c: Moved to... + * misc/getxattr.c: ...here. + * sysdeps/generic/glob.c: Moved to... + * posix/glob.c: ...here. + * sysdeps/generic/glob64.c: Moved to... + * posix/glob64.c: ...here. + * sysdeps/generic/grantpt.c: Moved to... + * login/grantpt.c: ...here. + * sysdeps/generic/group_member.c: Moved to... + * posix/group_member.c: ...here. + * sysdeps/generic/gtty.c: Moved to... + * misc/gtty.c: ...here. + * sysdeps/generic/herrno-loc.c: Moved to... + * inet/herrno-loc.c: ...here. + * sysdeps/generic/htonl.c: Moved to... + * inet/htonl.c: ...here. + * sysdeps/generic/htons.c: Moved to... + * inet/htons.c: ...here. + * sysdeps/generic/if_index.c: Moved to... + * inet/if_index.c: ...here. + * sysdeps/generic/ifaddrs.c: Moved to... + * inet/ifaddrs.c: ...here. + * sysdeps/generic/ifreq.c: Moved to... + * inet/ifreq.c: ...here. + * sysdeps/generic/init-first.c: Moved to... + * csu/init-first.c: ...here. + * sysdeps/generic/init-posix.c: Moved to... + * posix/init-posix.c: ...here. + * sysdeps/generic/inlines.c: Moved to... + * stdlib/inlines.c: ...here. + * sysdeps/generic/ioctl.c: Moved to... + * misc/ioctl.c: ...here. + * sysdeps/generic/isastream.c: Moved to... + * streams/isastream.c: ...here. + * sysdeps/generic/isatty.c: Moved to... + * io/isatty.c: ...here. + * sysdeps/generic/isfdtype.c: Moved to... + * socket/isfdtype.c: ...here. + * sysdeps/generic/jmp-unwind.c: Moved to... + * setjmp/jmp-unwind.c: ...here. + * sysdeps/generic/k_cosl.c: Moved to... + * math/k_cosl.c: ...here. + * sysdeps/generic/k_rem_pio2l.c: Moved to... + * math/k_rem_pio2l.c: ...here. + * sysdeps/generic/k_sincosl.c: Moved to... + * math/k_sincosl.c: ...here. + * sysdeps/generic/k_sinl.c: Moved to... + * math/k_sinl.c: ...here. + * sysdeps/generic/k_tanl.c: Moved to... + * math/k_tanl.c: ...here. + * sysdeps/generic/kill.c: Moved to... + * signal/kill.c: ...here. + * sysdeps/generic/killpg.c: Moved to... + * signal/killpg.c: ...here. + * sysdeps/generic/labs.c: Moved to... + * stdlib/labs.c: ...here. + * sysdeps/generic/lchmod.c: Moved to... + * io/lchmod.c: ...here. + * sysdeps/generic/lchown.c: Moved to... + * io/lchown.c: ...here. + * sysdeps/generic/ldbl2mpn.c: Moved to... + * stdlib/ldbl2mpn.c: ...here. + * sysdeps/generic/ldiv.c: Moved to... + * stdlib/ldiv.c: ...here. + * sysdeps/generic/lgetxattr.c: Moved to... + * misc/lgetxattr.c: ...here. + * sysdeps/generic/libc-start.c: Moved to... + * csu/libc-start.c: ...here. + * sysdeps/generic/libc-tls.c: Moved to... + * csu/libc-tls.c: ...here. + * sysdeps/generic/libc_fatal.c: Moved to... + * libio/libc_fatal.c: ...here. + * sysdeps/generic/link.c: Moved to... + * io/link.c: ...here. + * sysdeps/generic/lio_listio.c: Moved to... + * rt/lio_listio.c: ...here. + * sysdeps/generic/lio_listio64.c: Moved to... + * rt/lio_listio64.c: ...here. + * sysdeps/generic/listen.c: Moved to... + * socket/listen.c: ...here. + * sysdeps/generic/listxattr.c: Moved to... + * misc/listxattr.c: ...here. + * sysdeps/generic/llabs.c: Moved to... + * stdlib/llabs.c: ...here. + * sysdeps/generic/lldiv.c: Moved to... + * stdlib/lldiv.c: ...here. + * sysdeps/generic/llistxattr.c: Moved to... + * misc/llistxattr.c: ...here. + * sysdeps/generic/lockf.c: Moved to... + * io/lockf.c: ...here. + * sysdeps/generic/lockf64.c: Moved to... + * io/lockf64.c: ...here. + * sysdeps/generic/longjmp-ts.c: Moved to... + * hurd/longjmp-ts.c: ...here. + * sysdeps/generic/longjmp.c: Moved to... + * setjmp/longjmp.c: ...here. + * sysdeps/generic/lremovexattr.c: Moved to... + * misc/lremovexattr.c: ...here. + * sysdeps/generic/lseek.c: Moved to... + * misc/lseek.c: ...here. + * sysdeps/generic/lseek64.c: Moved to... + * io/lseek64.c: ...here. + * sysdeps/generic/lsetxattr.c: Moved to... + * misc/lsetxattr.c: ...here. + * sysdeps/generic/lshift.c: Moved to... + * stdlib/lshift.c: ...here. + * sysdeps/generic/lutimes.c: Moved to... + * misc/lutimes.c: ...here. + * sysdeps/generic/lxstat.c: Moved to... + * io/lxstat.c: ...here. + * sysdeps/generic/lxstat64.c: Moved to... + * io/lxstat64.c: ...here. + * sysdeps/generic/madvise.c: Moved to... + * misc/madvise.c: ...here. + * sysdeps/generic/makecontext.c: Moved to... + * stdlib/makecontext.c: ...here. + * sysdeps/generic/memccpy.c: Moved to... + * string/memccpy.c: ...here. + * sysdeps/generic/memchr.c: Moved to... + * string/memchr.c: ...here. + * sysdeps/generic/memcmp.c: Moved to... + * string/memcmp.c: ...here. + * sysdeps/generic/memcpy.c: Moved to... + * string/memcpy.c: ...here. + * sysdeps/generic/memcpy_chk.c: Moved to... + * debug/memcpy_chk.c: ...here. + * sysdeps/generic/memmem.c: Moved to... + * string/memmem.c: ...here. + * sysdeps/generic/memmove.c: Moved to... + * string/memmove.c: ...here. + * sysdeps/generic/memmove_chk.c: Moved to... + * debug/memmove_chk.c: ...here. + * sysdeps/generic/mempcpy.c: Moved to... + * string/mempcpy.c: ...here. + * sysdeps/generic/mempcpy_chk.c: Moved to... + * debug/mempcpy_chk.c: ...here. + * sysdeps/generic/memrchr.c: Moved to... + * string/memrchr.c: ...here. + * sysdeps/generic/memset.c: Moved to... + * string/memset.c: ...here. + * sysdeps/generic/memset_chk.c: Moved to... + * debug/memset_chk.c: ...here. + * sysdeps/generic/mig-reply.c: Moved to... + * mach/mig-reply.c: ...here. + * sysdeps/generic/mincore.c: Moved to... + * misc/mincore.c: ...here. + * sysdeps/generic/mkdir.c: Moved to... + * io/mkdir.c: ...here. + * sysdeps/generic/mkdirat.c: Moved to... + * io/mkdirat.c: ...here. + * sysdeps/generic/mkfifo.c: Moved to... + * io/mkfifo.c: ...here. + * sysdeps/generic/mkfifoat.c: Moved to... + * io/mkfifoat.c: ...here. + * sysdeps/generic/mknod.c: Moved to... + * io/mknod.c: ...here. + * sysdeps/generic/mknodat.c: Moved to... + * io/mknodat.c: ...here. + * sysdeps/generic/mlock.c: Moved to... + * misc/mlock.c: ...here. + * sysdeps/generic/mlockall.c: Moved to... + * misc/mlockall.c: ...here. + * sysdeps/generic/mmap.c: Moved to... + * misc/mmap.c: ...here. + * sysdeps/generic/mmap64.c: Moved to... + * misc/mmap64.c: ...here. + * sysdeps/generic/mod_1.c: Moved to... + * stdlib/mod_1.c: ...here. + * sysdeps/generic/morecore.c: Moved to... + * malloc/morecore.c: ...here. + * sysdeps/generic/mp_clz_tab.c: Moved to... + * stdlib/mp_clz_tab.c: ...here. + * sysdeps/generic/mpn2dbl.c: Moved to... + * stdlib/mpn2dbl.c: ...here. + * sysdeps/generic/mpn2flt.c: Moved to... + * stdlib/mpn2flt.c: ...here. + * sysdeps/generic/mpn2ldbl.c: Moved to... + * stdlib/mpn2ldbl.c: ...here. + * sysdeps/generic/mprotect.c: Moved to... + * misc/mprotect.c: ...here. + * sysdeps/generic/mq_close.c: Moved to... + * rt/mq_close.c: ...here. + * sysdeps/generic/mq_getattr.c: Moved to... + * rt/mq_getattr.c: ...here. + * sysdeps/generic/mq_notify.c: Moved to... + * rt/mq_notify.c: ...here. + * sysdeps/generic/mq_open.c: Moved to... + * rt/mq_open.c: ...here. + * sysdeps/generic/mq_receive.c: Moved to... + * rt/mq_receive.c: ...here. + * sysdeps/generic/mq_send.c: Moved to... + * rt/mq_send.c: ...here. + * sysdeps/generic/mq_setattr.c: Moved to... + * rt/mq_setattr.c: ...here. + * sysdeps/generic/mq_timedreceive.c: Moved to... + * rt/mq_timedreceive.c: ...here. + * sysdeps/generic/mq_timedsend.c: Moved to... + * rt/mq_timedsend.c: ...here. + * sysdeps/generic/mq_unlink.c: Moved to... + * rt/mq_unlink.c: ...here. + * sysdeps/generic/msgctl.c: Moved to... + * sysvipc/msgctl.c: ...here. + * sysdeps/generic/msgget.c: Moved to... + * sysvipc/msgget.c: ...here. + * sysdeps/generic/msgrcv.c: Moved to... + * sysvipc/msgrcv.c: ...here. + * sysdeps/generic/msgsnd.c: Moved to... + * sysvipc/msgsnd.c: ...here. + * sysdeps/generic/msync.c: Moved to... + * misc/msync.c: ...here. + * sysdeps/generic/mul.c: Moved to... + * stdlib/mul.c: ...here. + * sysdeps/generic/mul_1.c: Moved to... + * stdlib/mul_1.c: ...here. + * sysdeps/generic/mul_n.c: Moved to... + * stdlib/mul_n.c: ...here. + * sysdeps/generic/munlock.c: Moved to... + * misc/munlock.c: ...here. + * sysdeps/generic/munlockall.c: Moved to... + * misc/munlockall.c: ...here. + * sysdeps/generic/munmap.c: Moved to... + * misc/munmap.c: ...here. + * sysdeps/generic/nanosleep.c: Moved to... + * posix/nanosleep.c: ...here. + * sysdeps/generic/nice.c: Moved to... + * resource/nice.c: ...here. + * sysdeps/generic/nscd_setup_thread.c: Moved to... + * nscd/nscd_setup_thread.c: ...here. + * sysdeps/generic/open.c: Moved to... + * io/open.c: ...here. + * sysdeps/generic/open64.c: Moved to... + * io/open64.c: ...here. + * sysdeps/generic/openat.c: Moved to... + * io/openat.c: ...here. + * sysdeps/generic/openat64.c: Moved to... + * io/openat64.c: ...here. + * sysdeps/generic/opendir.c: Moved to... + * dirent/opendir.c: ...here. + * sysdeps/generic/opensock.c: Moved to... + * socket/opensock.c: ...here. + * sysdeps/generic/pathconf.c: Moved to... + * posix/pathconf.c: ...here. + * sysdeps/generic/pause.c: Moved to... + * posix/pause.c: ...here. + * sysdeps/generic/pipe.c: Moved to... + * io/pipe.c: ...here. + * sysdeps/generic/poll.c: Moved to... + * io/poll.c: ...here. + * sysdeps/generic/posix_fadvise.c: Moved to... + * io/posix_fadvise.c: ...here. + * sysdeps/generic/posix_fadvise64.c: Moved to... + * io/posix_fadvise64.c: ...here. + * sysdeps/generic/posix_fallocate.c: Moved to... + * io/posix_fallocate.c: ...here. + * sysdeps/generic/posix_fallocate64.c: Moved to... + * io/posix_fallocate64.c: ...here. + * sysdeps/generic/posix_madvise.c: Moved to... + * posix/posix_madvise.c: ...here. + * sysdeps/generic/pread.c: Moved to... + * posix/pread.c: ...here. + * sysdeps/generic/pread64.c: Moved to... + * posix/pread64.c: ...here. + * sysdeps/generic/printf_fphex.c: Moved to... + * stdio-common/printf_fphex.c: ...here. + * sysdeps/generic/prof-freq.c: Moved to... + * gmon/prof-freq.c: ...here. + * sysdeps/generic/profil.c: Moved to... + * gmon/profil.c: ...here. + * sysdeps/generic/pselect.c: Moved to... + * misc/pselect.c: ...here. + * sysdeps/generic/ptrace.c: Moved to... + * misc/ptrace.c: ...here. + * sysdeps/generic/ptsname.c: Moved to... + * login/ptsname.c: ...here. + * sysdeps/generic/putenv.c: Moved to... + * stdlib/putenv.c: ...here. + * sysdeps/generic/putmsg.c: Moved to... + * streams/putmsg.c: ...here. + * sysdeps/generic/putpmsg.c: Moved to... + * streams/putpmsg.c: ...here. + * sysdeps/generic/pututxline.c: Moved to... + * login/pututxline.c: ...here. + * sysdeps/generic/pwrite.c: Moved to... + * posix/pwrite.c: ...here. + * sysdeps/generic/pwrite64.c: Moved to... + * posix/pwrite64.c: ...here. + * sysdeps/generic/raise.c: Moved to... + * signal/raise.c: ...here. + * sysdeps/generic/rawmemchr.c: Moved to... + * string/rawmemchr.c: ...here. + * sysdeps/generic/read.c: Moved to... + * io/read.c: ...here. + * sysdeps/generic/readdir.c: Moved to... + * dirent/readdir.c: ...here. + * sysdeps/generic/readdir64.c: Moved to... + * dirent/readdir64.c: ...here. + * sysdeps/generic/readdir64_r.c: Moved to... + * dirent/readdir64_r.c: ...here. + * sysdeps/generic/readdir_r.c: Moved to... + * dirent/readdir_r.c: ...here. + * sysdeps/generic/readelflib.c: Moved to... + * elf/readelflib.c: ...here. + * sysdeps/generic/readlink.c: Moved to... + * io/readlink.c: ...here. + * sysdeps/generic/readonly-area.c: Moved to... + * debug/readonly-area.c: ...here. + * sysdeps/generic/readv.c: Moved to... + * misc/readv.c: ...here. + * sysdeps/generic/reboot.c: Moved to... + * misc/reboot.c: ...here. + * sysdeps/generic/recv.c: Moved to... + * socket/recv.c: ...here. + * sysdeps/generic/recvfrom.c: Moved to... + * socket/recvfrom.c: ...here. + * sysdeps/generic/recvmsg.c: Moved to... + * socket/recvmsg.c: ...here. + * sysdeps/generic/remap_file_pages.c: Moved to... + * misc/remap_file_pages.c: ...here. + * sysdeps/generic/remove.c: Moved to... + * stdio-common/remove.c: ...here. + * sysdeps/generic/removexattr.c: Moved to... + * misc/removexattr.c: ...here. + * sysdeps/generic/rename.c: Moved to... + * stdio-common/rename.c: ...here. + * sysdeps/generic/renameat.c: Moved to... + * stdio-common/renameat.c: ...here. + * sysdeps/generic/res-state.c: Moved to... + * resolv/res-state.c: ...here. + * sysdeps/generic/revoke.c: Moved to... + * misc/revoke.c: ...here. + * sysdeps/generic/rewinddir.c: Moved to... + * dirent/rewinddir.c: ...here. + * sysdeps/generic/rmdir.c: Moved to... + * io/rmdir.c: ...here. + * sysdeps/generic/rshift.c: Moved to... + * stdlib/rshift.c: ...here. + * sysdeps/generic/s_asinhl.c: Moved to... + * math/s_asinhl.c: ...here. + * sysdeps/generic/s_atanl.c: Moved to... + * math/s_atanl.c: ...here. + * sysdeps/generic/s_cacos.c: Moved to... + * math/s_cacos.c: ...here. + * sysdeps/generic/s_cacosf.c: Moved to... + * math/s_cacosf.c: ...here. + * sysdeps/generic/s_cacosh.c: Moved to... + * math/s_cacosh.c: ...here. + * sysdeps/generic/s_cacoshf.c: Moved to... + * math/s_cacoshf.c: ...here. + * sysdeps/generic/s_cacoshl.c: Moved to... + * math/s_cacoshl.c: ...here. + * sysdeps/generic/s_cacosl.c: Moved to... + * math/s_cacosl.c: ...here. + * sysdeps/generic/s_casin.c: Moved to... + * math/s_casin.c: ...here. + * sysdeps/generic/s_casinf.c: Moved to... + * math/s_casinf.c: ...here. + * sysdeps/generic/s_casinh.c: Moved to... + * math/s_casinh.c: ...here. + * sysdeps/generic/s_casinhf.c: Moved to... + * math/s_casinhf.c: ...here. + * sysdeps/generic/s_casinhl.c: Moved to... + * math/s_casinhl.c: ...here. + * sysdeps/generic/s_casinl.c: Moved to... + * math/s_casinl.c: ...here. + * sysdeps/generic/s_catan.c: Moved to... + * math/s_catan.c: ...here. + * sysdeps/generic/s_catanf.c: Moved to... + * math/s_catanf.c: ...here. + * sysdeps/generic/s_catanh.c: Moved to... + * math/s_catanh.c: ...here. + * sysdeps/generic/s_catanhf.c: Moved to... + * math/s_catanhf.c: ...here. + * sysdeps/generic/s_catanhl.c: Moved to... + * math/s_catanhl.c: ...here. + * sysdeps/generic/s_catanl.c: Moved to... + * math/s_catanl.c: ...here. + * sysdeps/generic/s_cbrtl.c: Moved to... + * math/s_cbrtl.c: ...here. + * sysdeps/generic/s_ccos.c: Moved to... + * math/s_ccos.c: ...here. + * sysdeps/generic/s_ccosf.c: Moved to... + * math/s_ccosf.c: ...here. + * sysdeps/generic/s_ccosh.c: Moved to... + * math/s_ccosh.c: ...here. + * sysdeps/generic/s_ccoshf.c: Moved to... + * math/s_ccoshf.c: ...here. + * sysdeps/generic/s_ccoshl.c: Moved to... + * math/s_ccoshl.c: ...here. + * sysdeps/generic/s_ccosl.c: Moved to... + * math/s_ccosl.c: ...here. + * sysdeps/generic/s_cexp.c: Moved to... + * math/s_cexp.c: ...here. + * sysdeps/generic/s_cexpf.c: Moved to... + * math/s_cexpf.c: ...here. + * sysdeps/generic/s_cexpl.c: Moved to... + * math/s_cexpl.c: ...here. + * sysdeps/generic/s_clog.c: Moved to... + * math/s_clog.c: ...here. + * sysdeps/generic/s_clog10.c: Moved to... + * math/s_clog10.c: ...here. + * sysdeps/generic/s_clog10f.c: Moved to... + * math/s_clog10f.c: ...here. + * sysdeps/generic/s_clog10l.c: Moved to... + * math/s_clog10l.c: ...here. + * sysdeps/generic/s_clogf.c: Moved to... + * math/s_clogf.c: ...here. + * sysdeps/generic/s_clogl.c: Moved to... + * math/s_clogl.c: ...here. + * sysdeps/generic/s_cpow.c: Moved to... + * math/s_cpow.c: ...here. + * sysdeps/generic/s_cpowf.c: Moved to... + * math/s_cpowf.c: ...here. + * sysdeps/generic/s_cpowl.c: Moved to... + * math/s_cpowl.c: ...here. + * sysdeps/generic/s_cproj.c: Moved to... + * math/s_cproj.c: ...here. + * sysdeps/generic/s_cprojf.c: Moved to... + * math/s_cprojf.c: ...here. + * sysdeps/generic/s_cprojl.c: Moved to... + * math/s_cprojl.c: ...here. + * sysdeps/generic/s_csin.c: Moved to... + * math/s_csin.c: ...here. + * sysdeps/generic/s_csinf.c: Moved to... + * math/s_csinf.c: ...here. + * sysdeps/generic/s_csinh.c: Moved to... + * math/s_csinh.c: ...here. + * sysdeps/generic/s_csinhf.c: Moved to... + * math/s_csinhf.c: ...here. + * sysdeps/generic/s_csinhl.c: Moved to... + * math/s_csinhl.c: ...here. + * sysdeps/generic/s_csinl.c: Moved to... + * math/s_csinl.c: ...here. + * sysdeps/generic/s_csqrt.c: Moved to... + * math/s_csqrt.c: ...here. + * sysdeps/generic/s_csqrtf.c: Moved to... + * math/s_csqrtf.c: ...here. + * sysdeps/generic/s_csqrtl.c: Moved to... + * math/s_csqrtl.c: ...here. + * sysdeps/generic/s_ctan.c: Moved to... + * math/s_ctan.c: ...here. + * sysdeps/generic/s_ctanf.c: Moved to... + * math/s_ctanf.c: ...here. + * sysdeps/generic/s_ctanh.c: Moved to... + * math/s_ctanh.c: ...here. + * sysdeps/generic/s_ctanhf.c: Moved to... + * math/s_ctanhf.c: ...here. + * sysdeps/generic/s_ctanhl.c: Moved to... + * math/s_ctanhl.c: ...here. + * sysdeps/generic/s_ctanl.c: Moved to... + * math/s_ctanl.c: ...here. + * sysdeps/generic/s_erfl.c: Moved to... + * math/s_erfl.c: ...here. + * sysdeps/generic/s_expm1l.c: Moved to... + * math/s_expm1l.c: ...here. + * sysdeps/generic/s_fdim.c: Moved to... + * math/s_fdim.c: ...here. + * sysdeps/generic/s_fdimf.c: Moved to... + * math/s_fdimf.c: ...here. + * sysdeps/generic/s_fdiml.c: Moved to... + * math/s_fdiml.c: ...here. + * sysdeps/generic/s_fma.c: Moved to... + * math/s_fma.c: ...here. + * sysdeps/generic/s_fmaf.c: Moved to... + * math/s_fmaf.c: ...here. + * sysdeps/generic/s_fmal.c: Moved to... + * math/s_fmal.c: ...here. + * sysdeps/generic/s_fmax.c: Moved to... + * math/s_fmax.c: ...here. + * sysdeps/generic/s_fmaxf.c: Moved to... + * math/s_fmaxf.c: ...here. + * sysdeps/generic/s_fmaxl.c: Moved to... + * math/s_fmaxl.c: ...here. + * sysdeps/generic/s_fmin.c: Moved to... + * math/s_fmin.c: ...here. + * sysdeps/generic/s_fminf.c: Moved to... + * math/s_fminf.c: ...here. + * sysdeps/generic/s_fminl.c: Moved to... + * math/s_fminl.c: ...here. + * sysdeps/generic/s_ldexp.c: Moved to... + * math/s_ldexp.c: ...here. + * sysdeps/generic/s_ldexpf.c: Moved to... + * math/s_ldexpf.c: ...here. + * sysdeps/generic/s_ldexpl.c: Moved to... + * math/s_ldexpl.c: ...here. + * sysdeps/generic/s_log1pl.c: Moved to... + * math/s_log1pl.c: ...here. + * sysdeps/generic/s_nan.c: Moved to... + * math/s_nan.c: ...here. + * sysdeps/generic/s_nanf.c: Moved to... + * math/s_nanf.c: ...here. + * sysdeps/generic/s_nanl.c: Moved to... + * math/s_nanl.c: ...here. + * sysdeps/generic/s_nextafter.c: Moved to... + * math/s_nextafter.c: ...here. + * sysdeps/generic/s_nexttowardf.c: Moved to... + * math/s_nexttowardf.c: ...here. + * sysdeps/generic/s_nexttowardl.c: Moved to... + * math/s_nexttowardl.c: ...here. + * sysdeps/generic/s_significand.c: Moved to... + * math/s_significand.c: ...here. + * sysdeps/generic/s_significandf.c: Moved to... + * math/s_significandf.c: ...here. + * sysdeps/generic/s_significandl.c: Moved to... + * math/s_significandl.c: ...here. + * sysdeps/generic/s_tanhl.c: Moved to... + * math/s_tanhl.c: ...here. + * sysdeps/generic/sbrk.c: Moved to... + * misc/sbrk.c: ...here. + * sysdeps/generic/scandir64.c: Moved to... + * dirent/scandir64.c: ...here. + * sysdeps/generic/sched_getaffinity.c: Moved to... + * posix/sched_getaffinity.c: ...here. + * sysdeps/generic/sched_getp.c: Moved to... + * posix/sched_getp.c: ...here. + * sysdeps/generic/sched_gets.c: Moved to... + * posix/sched_gets.c: ...here. + * sysdeps/generic/sched_primax.c: Moved to... + * posix/sched_primax.c: ...here. + * sysdeps/generic/sched_primin.c: Moved to... + * posix/sched_primin.c: ...here. + * sysdeps/generic/sched_rr_gi.c: Moved to... + * posix/sched_rr_gi.c: ...here. + * sysdeps/generic/sched_setaffinity.c: Moved to... + * posix/sched_setaffinity.c: ...here. + * sysdeps/generic/sched_setp.c: Moved to... + * posix/sched_setp.c: ...here. + * sysdeps/generic/sched_sets.c: Moved to... + * posix/sched_sets.c: ...here. + * sysdeps/generic/sched_yield.c: Moved to... + * posix/sched_yield.c: ...here. + * sysdeps/generic/seekdir.c: Moved to... + * dirent/seekdir.c: ...here. + * sysdeps/generic/segfault.c: Moved to... + * debug/segfault.c: ...here. + * sysdeps/generic/select.c: Moved to... + * misc/select.c: ...here. + * sysdeps/generic/semctl.c: Moved to... + * sysvipc/semctl.c: ...here. + * sysdeps/generic/semget.c: Moved to... + * sysvipc/semget.c: ...here. + * sysdeps/generic/semop.c: Moved to... + * sysvipc/semop.c: ...here. + * sysdeps/generic/semtimedop.c: Moved to... + * sysvipc/semtimedop.c: ...here. + * sysdeps/generic/send.c: Moved to... + * socket/send.c: ...here. + * sysdeps/generic/sendfile.c: Moved to... + * io/sendfile.c: ...here. + * sysdeps/generic/sendfile64.c: Moved to... + * io/sendfile64.c: ...here. + * sysdeps/generic/sendmsg.c: Moved to... + * socket/sendmsg.c: ...here. + * sysdeps/generic/sendto.c: Moved to... + * socket/sendto.c: ...here. + * sysdeps/generic/setcontext.c: Moved to... + * stdlib/setcontext.c: ...here. + * sysdeps/generic/setdomain.c: Moved to... + * misc/setdomain.c: ...here. + * sysdeps/generic/setegid.c: Moved to... + * misc/setegid.c: ...here. + * sysdeps/generic/setenv.c: Moved to... + * stdlib/setenv.c: ...here. + * sysdeps/generic/seteuid.c: Moved to... + * misc/seteuid.c: ...here. + * sysdeps/generic/setfpucw.c: Moved to... + * math/setfpucw.c: ...here. + * sysdeps/generic/setgid.c: Moved to... + * posix/setgid.c: ...here. + * sysdeps/generic/setgroups.c: Moved to... + * grp/setgroups.c: ...here. + * sysdeps/generic/sethostid.c: Moved to... + * misc/sethostid.c: ...here. + * sysdeps/generic/sethostname.c: Moved to... + * misc/sethostname.c: ...here. + * sysdeps/generic/setipv4sourcefilter.c: Moved to... + * inet/setipv4sourcefilter.c: ...here. + * sysdeps/generic/setitimer.c: Moved to... + * time/setitimer.c: ...here. + * sysdeps/generic/setjmp.c: Moved to... + * setjmp/setjmp.c: ...here. + * sysdeps/generic/setlogin.c: Moved to... + * posix/setlogin.c: ...here. + * sysdeps/generic/setpgid.c: Moved to... + * posix/setpgid.c: ...here. + * sysdeps/generic/setpgrp.c: Moved to... + * posix/setpgrp.c: ...here. + * sysdeps/generic/setpriority.c: Moved to... + * resource/setpriority.c: ...here. + * sysdeps/generic/setregid.c: Moved to... + * misc/setregid.c: ...here. + * sysdeps/generic/setresgid.c: Moved to... + * posix/setresgid.c: ...here. + * sysdeps/generic/setresuid.c: Moved to... + * posix/setresuid.c: ...here. + * sysdeps/generic/setreuid.c: Moved to... + * misc/setreuid.c: ...here. + * sysdeps/generic/setrlimit.c: Moved to... + * resource/setrlimit.c: ...here. + * sysdeps/generic/setrlimit64.c: Moved to... + * resource/setrlimit64.c: ...here. + * sysdeps/generic/setsid.c: Moved to... + * posix/setsid.c: ...here. + * sysdeps/generic/setsockopt.c: Moved to... + * socket/setsockopt.c: ...here. + * sysdeps/generic/setsourcefilter.c: Moved to... + * inet/setsourcefilter.c: ...here. + * sysdeps/generic/settimeofday.c: Moved to... + * time/settimeofday.c: ...here. + * sysdeps/generic/setuid.c: Moved to... + * posix/setuid.c: ...here. + * sysdeps/generic/setutxent.c: Moved to... + * login/setutxent.c: ...here. + * sysdeps/generic/setxattr.c: Moved to... + * misc/setxattr.c: ...here. + * sysdeps/generic/shm_open.c: Moved to... + * rt/shm_open.c: ...here. + * sysdeps/generic/shm_unlink.c: Moved to... + * rt/shm_unlink.c: ...here. + * sysdeps/generic/shmat.c: Moved to... + * sysvipc/shmat.c: ...here. + * sysdeps/generic/shmctl.c: Moved to... + * sysvipc/shmctl.c: ...here. + * sysdeps/generic/shmdt.c: Moved to... + * sysvipc/shmdt.c: ...here. + * sysdeps/generic/shmget.c: Moved to... + * sysvipc/shmget.c: ...here. + * sysdeps/generic/shutdown.c: Moved to... + * socket/shutdown.c: ...here. + * sysdeps/generic/sigaction.c: Moved to... + * signal/sigaction.c: ...here. + * sysdeps/generic/sigaltstack.c: Moved to... + * signal/sigaltstack.c: ...here. + * sysdeps/generic/sigblock.c: Moved to... + * signal/sigblock.c: ...here. + * sysdeps/generic/sigfillset.c: Moved to... + * signal/sigfillset.c: ...here. + * sysdeps/generic/sigignore.c: Moved to... + * signal/sigignore.c: ...here. + * sysdeps/generic/sigintr.c: Moved to... + * signal/sigintr.c: ...here. + * sysdeps/generic/sigjmp.c: Moved to... + * setjmp/sigjmp.c: ...here. + * sysdeps/generic/siglist.c: Moved to... + * stdio-common/siglist.c: ...here. + * sysdeps/generic/signal.c: Moved to... + * signal/signal.c: ...here. + * sysdeps/generic/sigpause.c: Moved to... + * signal/sigpause.c: ...here. + * sysdeps/generic/sigpending.c: Moved to... + * signal/sigpending.c: ...here. + * sysdeps/generic/sigprocmask.c: Moved to... + * signal/sigprocmask.c: ...here. + * sysdeps/generic/sigqueue.c: Moved to... + * signal/sigqueue.c: ...here. + * sysdeps/generic/sigreturn.c: Moved to... + * signal/sigreturn.c: ...here. + * sysdeps/generic/sigset.c: Moved to... + * signal/sigset.c: ...here. + * sysdeps/generic/sigsetmask.c: Moved to... + * signal/sigsetmask.c: ...here. + * sysdeps/generic/sigstack.c: Moved to... + * signal/sigstack.c: ...here. + * sysdeps/generic/sigsuspend.c: Moved to... + * signal/sigsuspend.c: ...here. + * sysdeps/generic/sigtimedwait.c: Moved to... + * signal/sigtimedwait.c: ...here. + * sysdeps/generic/sigvec.c: Moved to... + * signal/sigvec.c: ...here. + * sysdeps/generic/sigwait.c: Moved to... + * signal/sigwait.c: ...here. + * sysdeps/generic/sigwaitinfo.c: Moved to... + * signal/sigwaitinfo.c: ...here. + * sysdeps/generic/sleep.c: Moved to... + * posix/sleep.c: ...here. + * sysdeps/generic/sockatmark.c: Moved to... + * socket/sockatmark.c: ...here. + * sysdeps/generic/socket.c: Moved to... + * socket/socket.c: ...here. + * sysdeps/generic/socketpair.c: Moved to... + * socket/socketpair.c: ...here. + * sysdeps/generic/spawni.c: Moved to... + * posix/spawni.c: ...here. + * sysdeps/generic/speed.c: Moved to... + * termios/speed.c: ...here. + * sysdeps/generic/sprofil.c: Moved to... + * gmon/sprofil.c: ...here. + * sysdeps/generic/sstk.c: Moved to... + * misc/sstk.c: ...here. + * sysdeps/generic/start.c: Moved to... + * csu/start.c: ...here. + * sysdeps/generic/statfs.c: Moved to... + * io/statfs.c: ...here. + * sysdeps/generic/statfs64.c: Moved to... + * io/statfs64.c: ...here. + * sysdeps/generic/statvfs.c: Moved to... + * io/statvfs.c: ...here. + * sysdeps/generic/statvfs64.c: Moved to... + * io/statvfs64.c: ...here. + * sysdeps/generic/stime.c: Moved to... + * time/stime.c: ...here. + * sysdeps/generic/stpcpy.c: Moved to... + * string/stpcpy.c: ...here. + * sysdeps/generic/stpcpy_chk.c: Moved to... + * debug/stpcpy_chk.c: ...here. + * sysdeps/generic/stpncpy.c: Moved to... + * string/stpncpy.c: ...here. + * sysdeps/generic/stpncpy_chk.c: Moved to... + * debug/stpncpy_chk.c: ...here. + * sysdeps/generic/strcasecmp.c: Moved to... + * string/strcasecmp.c: ...here. + * sysdeps/generic/strcasecmp_l.c: Moved to... + * string/strcasecmp_l.c: ...here. + * sysdeps/generic/strcasestr.c: Moved to... + * string/strcasestr.c: ...here. + * sysdeps/generic/strcat.c: Moved to... + * string/strcat.c: ...here. + * sysdeps/generic/strcat_chk.c: Moved to... + * debug/strcat_chk.c: ...here. + * sysdeps/generic/strchr.c: Moved to... + * string/strchr.c: ...here. + * sysdeps/generic/strchrnul.c: Moved to... + * string/strchrnul.c: ...here. + * sysdeps/generic/strcmp.c: Moved to... + * string/strcmp.c: ...here. + * sysdeps/generic/strcpy.c: Moved to... + * string/strcpy.c: ...here. + * sysdeps/generic/strcpy_chk.c: Moved to... + * debug/strcpy_chk.c: ...here. + * sysdeps/generic/strcspn.c: Moved to... + * string/strcspn.c: ...here. + * sysdeps/generic/string-inlines.c: Moved to... + * string/string-inlines.c: ...here. + * sysdeps/generic/strlen.c: Moved to... + * string/strlen.c: ...here. + * sysdeps/generic/strncase.c: Moved to... + * string/strncase.c: ...here. + * sysdeps/generic/strncase_l.c: Moved to... + * string/strncase_l.c: ...here. + * sysdeps/generic/strncat.c: Moved to... + * string/strncat.c: ...here. + * sysdeps/generic/strncat_chk.c: Moved to... + * debug/strncat_chk.c: ...here. + * sysdeps/generic/strncmp.c: Moved to... + * string/strncmp.c: ...here. + * sysdeps/generic/strncpy.c: Moved to... + * string/strncpy.c: ...here. + * sysdeps/generic/strncpy_chk.c: Moved to... + * debug/strncpy_chk.c: ...here. + * sysdeps/generic/strnlen.c: Moved to... + * string/strnlen.c: ...here. + * sysdeps/generic/strpbrk.c: Moved to... + * string/strpbrk.c: ...here. + * sysdeps/generic/strrchr.c: Moved to... + * string/strrchr.c: ...here. + * sysdeps/generic/strsep.c: Moved to... + * string/strsep.c: ...here. + * sysdeps/generic/strspn.c: Moved to... + * string/strspn.c: ...here. + * sysdeps/generic/strstr.c: Moved to... + * string/strstr.c: ...here. + * sysdeps/generic/strtoimax.c: Moved to... + * stdlib/strtoimax.c: ...here. + * sysdeps/generic/strtok.c: Moved to... + * string/strtok.c: ...here. + * sysdeps/generic/strtok_r.c: Moved to... + * string/strtok_r.c: ...here. + * sysdeps/generic/strtol.c: Moved to... + * stdlib/strtol.c: ...here. + * sysdeps/generic/strtol_l.c: Moved to... + * stdlib/strtol_l.c: ...here. + * sysdeps/generic/strtold_l.c: Moved to... + * stdlib/strtold_l.c: ...here. + * sysdeps/generic/strtoll.c: Moved to... + * stdlib/strtoll.c: ...here. + * sysdeps/generic/strtoll_l.c: Moved to... + * stdlib/strtoll_l.c: ...here. + * sysdeps/generic/strtoul.c: Moved to... + * stdlib/strtoul.c: ...here. + * sysdeps/generic/strtoul_l.c: Moved to... + * stdlib/strtoul_l.c: ...here. + * sysdeps/generic/strtoull.c: Moved to... + * stdlib/strtoull.c: ...here. + * sysdeps/generic/strtoull_l.c: Moved to... + * stdlib/strtoull_l.c: ...here. + * sysdeps/generic/strtoumax.c: Moved to... + * stdlib/strtoumax.c: ...here. + * sysdeps/generic/strtsupp.c: Moved to... + * bare/strtsupp.c: ...here. + * sysdeps/generic/stty.c: Moved to... + * misc/stty.c: ...here. + * sysdeps/generic/sub_n.c: Moved to... + * stdlib/sub_n.c: ...here. + * sysdeps/generic/submul_1.c: Moved to... + * stdlib/submul_1.c: ...here. + * sysdeps/generic/swapcontext.c: Moved to... + * stdlib/swapcontext.c: ...here. + * sysdeps/generic/swapoff.c: Moved to... + * misc/swapoff.c: ...here. + * sysdeps/generic/swapon.c: Moved to... + * misc/swapon.c: ...here. + * sysdeps/generic/symlink.c: Moved to... + * io/symlink.c: ...here. + * sysdeps/generic/sync.c: Moved to... + * misc/sync.c: ...here. + * sysdeps/generic/syscall.c: Moved to... + * misc/syscall.c: ...here. + * sysdeps/generic/sysconf.c: Moved to... + * posix/sysconf.c: ...here. + * sysdeps/generic/sysdep.c: Moved to... + * csu/sysdep.c: ...here. + * sysdeps/generic/syslog.c: Moved to... + * misc/syslog.c: ...here. + * sysdeps/generic/system.c: Moved to... + * stdlib/system.c: ...here. + * sysdeps/generic/sysv_signal.c: Moved to... + * signal/sysv_signal.c: ...here. + * sysdeps/generic/t_sincosl.c: Moved to... + * math/t_sincosl.c: ...here. + * sysdeps/generic/tcdrain.c: Moved to... + * termios/tcdrain.c: ...here. + * sysdeps/generic/tcflow.c: Moved to... + * termios/tcflow.c: ...here. + * sysdeps/generic/tcflush.c: Moved to... + * termios/tcflush.c: ...here. + * sysdeps/generic/tcgetattr.c: Moved to... + * termios/tcgetattr.c: ...here. + * sysdeps/generic/tcgetpgrp.c: Moved to... + * termios/tcgetpgrp.c: ...here. + * sysdeps/generic/tcsendbrk.c: Moved to... + * termios/tcsendbrk.c: ...here. + * sysdeps/generic/tcsetattr.c: Moved to... + * termios/tcsetattr.c: ...here. + * sysdeps/generic/tcsetpgrp.c: Moved to... + * termios/tcsetpgrp.c: ...here. + * sysdeps/generic/telldir.c: Moved to... + * dirent/telldir.c: ...here. + * sysdeps/generic/tempname.c: Moved to... + * stdio-common/tempname.c: ...here. + * sysdeps/generic/time.c: Moved to... + * time/time.c: ...here. + * sysdeps/generic/timer_create.c: Moved to... + * rt/timer_create.c: ...here. + * sysdeps/generic/timer_delete.c: Moved to... + * rt/timer_delete.c: ...here. + * sysdeps/generic/timer_getoverr.c: Moved to... + * rt/timer_getoverr.c: ...here. + * sysdeps/generic/timer_gettime.c: Moved to... + * rt/timer_gettime.c: ...here. + * sysdeps/generic/timer_settime.c: Moved to... + * rt/timer_settime.c: ...here. + * sysdeps/generic/times.c: Moved to... + * posix/times.c: ...here. + * sysdeps/generic/tmpfile.c: Moved to... + * stdio-common/tmpfile.c: ...here. + * sysdeps/generic/tmpfile64.c: Moved to... + * stdio-common/tmpfile64.c: ...here. + * sysdeps/generic/trampoline.c: Moved to... + * hurd/trampoline.c: ...here. + * sysdeps/generic/truncate.c: Moved to... + * misc/truncate.c: ...here. + * sysdeps/generic/truncate64.c: Moved to... + * misc/truncate64.c: ...here. + * sysdeps/generic/tst-timer.c: Moved to... + * rt/tst-timer.c: ...here. + * sysdeps/generic/ttyname.c: Moved to... + * io/ttyname.c: ...here. + * sysdeps/generic/ttyname_r.c: Moved to... + * io/ttyname_r.c: ...here. + * sysdeps/generic/ualarm.c: Moved to... + * misc/ualarm.c: ...here. + * sysdeps/generic/udiv_qrnnd.c: Moved to... + * stdlib/udiv_qrnnd.c: ...here. + * sysdeps/generic/ulimit.c: Moved to... + * resource/ulimit.c: ...here. + * sysdeps/generic/umask.c: Moved to... + * io/umask.c: ...here. + * sysdeps/generic/uname.c: Moved to... + * posix/uname.c: ...here. + * sysdeps/generic/unlink.c: Moved to... + * io/unlink.c: ...here. + * sysdeps/generic/unlinkat.c: Moved to... + * io/unlinkat.c: ...here. + * sysdeps/generic/unlockpt.c: Moved to... + * login/unlockpt.c: ...here. + * sysdeps/generic/updwtmp.c: Moved to... + * login/updwtmp.c: ...here. + * sysdeps/generic/updwtmpx.c: Moved to... + * login/updwtmpx.c: ...here. + * sysdeps/generic/usleep.c: Moved to... + * misc/usleep.c: ...here. + * sysdeps/generic/ustat.c: Moved to... + * misc/ustat.c: ...here. + * sysdeps/generic/utime.c: Moved to... + * io/utime.c: ...here. + * sysdeps/generic/utimes.c: Moved to... + * misc/utimes.c: ...here. + * sysdeps/generic/utmp_file.c: Moved to... + * login/utmp_file.c: ...here. + * sysdeps/generic/utmpxname.c: Moved to... + * login/utmpxname.c: ...here. + * sysdeps/generic/versionsort64.c: Moved to... + * dirent/versionsort64.c: ...here. + * sysdeps/generic/vfork.c: Moved to... + * posix/vfork.c: ...here. + * sysdeps/generic/vhangup.c: Moved to... + * misc/vhangup.c: ...here. + * sysdeps/generic/vlimit.c: Moved to... + * resource/vlimit.c: ...here. + * sysdeps/generic/vtimes.c: Moved to... + * resource/vtimes.c: ...here. + * sysdeps/generic/w_acos.c: Moved to... + * math/w_acos.c: ...here. + * sysdeps/generic/w_acosf.c: Moved to... + * math/w_acosf.c: ...here. + * sysdeps/generic/w_acosh.c: Moved to... + * math/w_acosh.c: ...here. + * sysdeps/generic/w_acoshf.c: Moved to... + * math/w_acoshf.c: ...here. + * sysdeps/generic/w_acoshl.c: Moved to... + * math/w_acoshl.c: ...here. + * sysdeps/generic/w_acosl.c: Moved to... + * math/w_acosl.c: ...here. + * sysdeps/generic/w_asin.c: Moved to... + * math/w_asin.c: ...here. + * sysdeps/generic/w_asinf.c: Moved to... + * math/w_asinf.c: ...here. + * sysdeps/generic/w_asinl.c: Moved to... + * math/w_asinl.c: ...here. + * sysdeps/generic/w_atan2.c: Moved to... + * math/w_atan2.c: ...here. + * sysdeps/generic/w_atan2f.c: Moved to... + * math/w_atan2f.c: ...here. + * sysdeps/generic/w_atan2l.c: Moved to... + * math/w_atan2l.c: ...here. + * sysdeps/generic/w_atanh.c: Moved to... + * math/w_atanh.c: ...here. + * sysdeps/generic/w_atanhf.c: Moved to... + * math/w_atanhf.c: ...here. + * sysdeps/generic/w_atanhl.c: Moved to... + * math/w_atanhl.c: ...here. + * sysdeps/generic/w_cosh.c: Moved to... + * math/w_cosh.c: ...here. + * sysdeps/generic/w_coshf.c: Moved to... + * math/w_coshf.c: ...here. + * sysdeps/generic/w_coshl.c: Moved to... + * math/w_coshl.c: ...here. + * sysdeps/generic/w_drem.c: Moved to... + * math/w_drem.c: ...here. + * sysdeps/generic/w_dremf.c: Moved to... + * math/w_dremf.c: ...here. + * sysdeps/generic/w_dreml.c: Moved to... + * math/w_dreml.c: ...here. + * sysdeps/generic/w_exp10.c: Moved to... + * math/w_exp10.c: ...here. + * sysdeps/generic/w_exp10f.c: Moved to... + * math/w_exp10f.c: ...here. + * sysdeps/generic/w_exp10l.c: Moved to... + * math/w_exp10l.c: ...here. + * sysdeps/generic/w_exp2.c: Moved to... + * math/w_exp2.c: ...here. + * sysdeps/generic/w_exp2f.c: Moved to... + * math/w_exp2f.c: ...here. + * sysdeps/generic/w_exp2l.c: Moved to... + * math/w_exp2l.c: ...here. + * sysdeps/generic/w_expl.c: Moved to... + * math/w_expl.c: ...here. + * sysdeps/generic/w_fmod.c: Moved to... + * math/w_fmod.c: ...here. + * sysdeps/generic/w_fmodf.c: Moved to... + * math/w_fmodf.c: ...here. + * sysdeps/generic/w_fmodl.c: Moved to... + * math/w_fmodl.c: ...here. + * sysdeps/generic/w_hypot.c: Moved to... + * math/w_hypot.c: ...here. + * sysdeps/generic/w_hypotf.c: Moved to... + * math/w_hypotf.c: ...here. + * sysdeps/generic/w_hypotl.c: Moved to... + * math/w_hypotl.c: ...here. + * sysdeps/generic/w_j0.c: Moved to... + * math/w_j0.c: ...here. + * sysdeps/generic/w_j0f.c: Moved to... + * math/w_j0f.c: ...here. + * sysdeps/generic/w_j0l.c: Moved to... + * math/w_j0l.c: ...here. + * sysdeps/generic/w_j1.c: Moved to... + * math/w_j1.c: ...here. + * sysdeps/generic/w_j1f.c: Moved to... + * math/w_j1f.c: ...here. + * sysdeps/generic/w_j1l.c: Moved to... + * math/w_j1l.c: ...here. + * sysdeps/generic/w_jn.c: Moved to... + * math/w_jn.c: ...here. + * sysdeps/generic/w_jnf.c: Moved to... + * math/w_jnf.c: ...here. + * sysdeps/generic/w_jnl.c: Moved to... + * math/w_jnl.c: ...here. + * sysdeps/generic/w_lgamma.c: Moved to... + * math/w_lgamma.c: ...here. + * sysdeps/generic/w_lgamma_r.c: Moved to... + * math/w_lgamma_r.c: ...here. + * sysdeps/generic/w_lgammaf.c: Moved to... + * math/w_lgammaf.c: ...here. + * sysdeps/generic/w_lgammaf_r.c: Moved to... + * math/w_lgammaf_r.c: ...here. + * sysdeps/generic/w_lgammal.c: Moved to... + * math/w_lgammal.c: ...here. + * sysdeps/generic/w_lgammal_r.c: Moved to... + * math/w_lgammal_r.c: ...here. + * sysdeps/generic/w_log.c: Moved to... + * math/w_log.c: ...here. + * sysdeps/generic/w_log10.c: Moved to... + * math/w_log10.c: ...here. + * sysdeps/generic/w_log10f.c: Moved to... + * math/w_log10f.c: ...here. + * sysdeps/generic/w_log10l.c: Moved to... + * math/w_log10l.c: ...here. + * sysdeps/generic/w_log2.c: Moved to... + * math/w_log2.c: ...here. + * sysdeps/generic/w_log2f.c: Moved to... + * math/w_log2f.c: ...here. + * sysdeps/generic/w_log2l.c: Moved to... + * math/w_log2l.c: ...here. + * sysdeps/generic/w_logf.c: Moved to... + * math/w_logf.c: ...here. + * sysdeps/generic/w_logl.c: Moved to... + * math/w_logl.c: ...here. + * sysdeps/generic/w_pow.c: Moved to... + * math/w_pow.c: ...here. + * sysdeps/generic/w_powf.c: Moved to... + * math/w_powf.c: ...here. + * sysdeps/generic/w_powl.c: Moved to... + * math/w_powl.c: ...here. + * sysdeps/generic/w_remainder.c: Moved to... + * math/w_remainder.c: ...here. + * sysdeps/generic/w_remainderf.c: Moved to... + * math/w_remainderf.c: ...here. + * sysdeps/generic/w_remainderl.c: Moved to... + * math/w_remainderl.c: ...here. + * sysdeps/generic/w_scalb.c: Moved to... + * math/w_scalb.c: ...here. + * sysdeps/generic/w_scalbf.c: Moved to... + * math/w_scalbf.c: ...here. + * sysdeps/generic/w_scalbl.c: Moved to... + * math/w_scalbl.c: ...here. + * sysdeps/generic/w_sinh.c: Moved to... + * math/w_sinh.c: ...here. + * sysdeps/generic/w_sinhf.c: Moved to... + * math/w_sinhf.c: ...here. + * sysdeps/generic/w_sinhl.c: Moved to... + * math/w_sinhl.c: ...here. + * sysdeps/generic/w_sqrt.c: Moved to... + * math/w_sqrt.c: ...here. + * sysdeps/generic/w_sqrtf.c: Moved to... + * math/w_sqrtf.c: ...here. + * sysdeps/generic/w_sqrtl.c: Moved to... + * math/w_sqrtl.c: ...here. + * sysdeps/generic/w_tgamma.c: Moved to... + * math/w_tgamma.c: ...here. + * sysdeps/generic/w_tgammaf.c: Moved to... + * math/w_tgammaf.c: ...here. + * sysdeps/generic/w_tgammal.c: Moved to... + * math/w_tgammal.c: ...here. + * sysdeps/generic/wait.c: Moved to... + * posix/wait.c: ...here. + * sysdeps/generic/wait3.c: Moved to... + * posix/wait3.c: ...here. + * sysdeps/generic/wait4.c: Moved to... + * posix/wait4.c: ...here. + * sysdeps/generic/waitid.c: Moved to... + * posix/waitid.c: ...here. + * sysdeps/generic/waitpid.c: Moved to... + * posix/waitpid.c: ...here. + * sysdeps/generic/wcstoimax.c: Moved to... + * stdlib/wcstoimax.c: ...here. + * sysdeps/generic/wcstol.c: Moved to... + * wcsmbs/wcstol.c: ...here. + * sysdeps/generic/wcstol_l.c: Moved to... + * wcsmbs/wcstol_l.c: ...here. + * sysdeps/generic/wcstoll.c: Moved to... + * wcsmbs/wcstoll.c: ...here. + * sysdeps/generic/wcstoll_l.c: Moved to... + * wcsmbs/wcstoll_l.c: ...here. + * sysdeps/generic/wcstoul.c: Moved to... + * wcsmbs/wcstoul.c: ...here. + * sysdeps/generic/wcstoul_l.c: Moved to... + * wcsmbs/wcstoul_l.c: ...here. + * sysdeps/generic/wcstoull.c: Moved to... + * wcsmbs/wcstoull.c: ...here. + * sysdeps/generic/wcstoull_l.c: Moved to... + * wcsmbs/wcstoull_l.c: ...here. + * sysdeps/generic/wcstoumax.c: Moved to... + * stdlib/wcstoumax.c: ...here. + * sysdeps/generic/wordcopy.c: Moved to... + * string/wordcopy.c: ...here. + * sysdeps/generic/wordexp.c: Moved to... + * posix/wordexp.c: ...here. + * sysdeps/generic/write.c: Moved to... + * io/write.c: ...here. + * sysdeps/generic/writev.c: Moved to... + * misc/writev.c: ...here. + * sysdeps/generic/xmknod.c: Moved to... + * io/xmknod.c: ...here. + * sysdeps/generic/xmknodat.c: Moved to... + * io/xmknodat.c: ...here. + * sysdeps/generic/xpg-strerror.c: Moved to... + * string/xpg-strerror.c: ...here. + * sysdeps/generic/xstat.c: Moved to... + * io/xstat.c: ...here. + * sysdeps/generic/xstat64.c: Moved to... + * io/xstat64.c: ...here. + * catgets/gencat.c: Use "config.h" to refer to the local config.h file. + * stdlib/stdtod_l.c: Use "..." for gmp-impl.h and longlong.h headers. + * sysdeps/ieee754/ldbl-96/printf_fphex.c: Adjust for files moving + out of sysdeps/generic. + * sysdeps/ieee754/ldbl-96/strtold_l.c: Likewise. + * sysdeps/powerpc/elf/libc-start.c: Likewise. + * sysdeps/unix/sysv/linux/dl-sbrk.c: Likewise. + * sysdeps/unix/sysv/linux/dl-sysdep.c: Likewise. + * sysdeps/unix/sysv/linux/segfault.c: Likewise. + * sysdeps/unix/sysv/linux/sigreturn.c: Likewise. + * sysdeps/unix/sysv/linux/syslog.c: Likewise. + * sysdeps/unix/sysv/linux/updwtmp.c: Likewise. + * sysdeps/unix/sysv/linux/utmp_file.c: Likewise. + * sysdeps/unix/sysv/linux/i386/getrlimit64.c: Likewise. + * sysdeps/unix/sysv/linux/i386/glob64.c: Likewise. + * sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c: Likewise. + * sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h: Likewise. + * sysdeps/wordsize-32/llabs.c: Likewise. + * sysdeps/wordsize-32/lldiv.c: Likewise. + * sysdeps/wordsize-64/glob.c: Likewise. + * sysdeps/wordsize-64/labs.c: Likewise. + * sysdeps/wordsize-64/ldiv.c: Likewise. + * sysdeps/wordsize-64/strtol.c: Likewise. + * sysdeps/wordsize-64/strtol_l.c: Likewise. + * sysdeps/wordsize-64/strtoul.c: Likewise. + * sysdeps/wordsize-64/strtoul_l.c: Likewise. + * sysdeps/wordsize-64/wcstol.c: Likewise. + * sysdeps/wordsize-64/wcstol_l.c: Likewise. + * sysdeps/wordsize-64/wcstoul.c: Likewise. + * sysdeps/wordsize-64/wcstoul_l.c: Likewise. + * sysdeps/x86_64/fpu/printf_fphex.c: Likewise. + * wcsmbs/Makefile (strtox-CFLAGS): remove -I../stdlib. + (CPPFLAGS-wcstold_l.c): Add -I../stdlib. + +2005-12-13 Roland McGrath + + * sysdeps/generic/Makefile: Remove remaining bits/endian.h cruft. + +2005-12-13 Ulrich Drepper + + * sysdeps/generic/signame.c: Removed. + * sysdeps/generic/signame.h: Removed. + * sysdeps/generic/configure.in: Removed. + * sysdeps/generic/Dist: Remove these files. + + * sysdeps/generic/det_endian.c: Removed. + * sysdeps/generic/Makefile: Remove rule to build it. + * sysdeps/generic/Dist: Don't distribute it. + +2005-12-13 Roland McGrath + + * sysdeps/powerpc/dl-procinfo.c: New file. + * sysdeps/powerpc/dl-procinfo.h: New file. + +2005-12-12 Ulrich Drepper + + * io/sys/stat.h: Add restrict to fstatat declarations. + +2005-12-10 Ulrich Drepper + + * posix/regex_internal.h: Include if available. + +2005-12-06 Paolo Bonzini + + * posix/regex_internal.h (SIZE_MAX): Provide a default definition. + +2005-12-08 Ulrich Drepper + + * nis/nis_call.c (inetstr2int): Optimize. + +2005-12-08 Jakub Jelinek + + * nis/nis_call.c (__nisbind_create): Remove __nisbind_destroy, + ->clnt cannot be != NULL. + (__do_niscall): No need to use __nisbind_destroy, __nisbind_next + did it. + (__nisbind_connect): use_auth is already TRUE, otherwise we would + not be here. + + * nis/nis_lookup.c (nis_lookup): Remove unnecessary + __nisbind_destroy calls. __nisbind_next does all that. + + * nis/ypclnt.c (yp_update): Before trying default authentication, + free DES descriptor. + +2005-12-07 Jakub Jelinek + + * nis/nis_table.c (nis_list): Fix memory handling in error case. + +2005-12-07 Ulrich Drepper + + * nis/nis_table.c (nis_list): Remove have_tablepath, just use the + pointer value itself. + +2005-12-06 Ulrich Drepper + + * catgets/gencat.c: Use GPL, not LGPL. + * elf/cache.c: Likewise. + * elf/chroot_canon.c: Likewise. + * elf/ldconfig.c: Likewise. + * elf/readlib.c: Likewise. + * iconv/dummy-repertoire.c: Likewise. + * iconv/iconv_charmap.c: Likewise. + * iconv/iconv_prog.c: Likewise. + * iconv/iconvconfig.c: Likewise. + * locale/programs/3level.h: Likewise. + * locale/programs/charmap-dir.c: Likewise. + * locale/programs/charmap-dir.h: Likewise. + * locale/programs/charmap-kw.gperf: Likewise. + * locale/programs/charmap.c: Likewise. + * locale/programs/charmap.h: Likewise. + * locale/programs/config.h: Likewise. + * locale/programs/ld-address.c: Likewise. + * locale/programs/ld-collate.c: Likewise. + * locale/programs/ld-ctype.c: Likewise. + * locale/programs/ld-identification.c: Likewise. + * locale/programs/ld-measurement.c: Likewise. + * locale/programs/ld-messages.c: Likewise. + * locale/programs/ld-monetary.c: Likewise. + * locale/programs/ld-name.c: Likewise. + * locale/programs/ld-numeric.c: Likewise. + * locale/programs/ld-paper.c: Likewise. + * locale/programs/ld-telephone.c: Likewise. + * locale/programs/ld-time.c: Likewise. + * locale/programs/linereader.c: Likewise. + * locale/programs/linereader.h: Likewise. + * locale/programs/locale-spec.c: Likewise. + * locale/programs/locale.c: Likewise. + * locale/programs/localedef.c: Likewise. + * locale/programs/localedef.h: Likewise. + * locale/programs/locarchive.c: Likewise. + * locale/programs/locfile-kw.gperf: Likewise. + * locale/programs/locfile-token.h: Likewise. + * locale/programs/locfile.c: Likewise. + * locale/programs/locfile.h: Likewise. + * locale/programs/repertoire.c: Likewise. + * locale/programs/repertoire.h: Likewise. + * locale/programs/simple-hash.c: Likewise. + * locale/programs/simple-hash.h: Likewise. + * locale/programs/xmalloc.c: Likewise. + * locale/programs/xstrdup.c: Likewise. + * malloc/memusagestat.c: Likewise. + * nscd/aicache.c: Likewise. + * nscd/cache.c: Likewise. + * nscd/connections.c: Likewise. + * nscd/dbg_log.c: Likewise. + * nscd/gai.c: Likewise. + * nscd/getgrgid_r.c: Likewise. + * nscd/getgrnam_r.c: Likewise. + * nscd/gethstbyad_r.c: Likewise. + * nscd/gethstbynm2_r.c: Likewise. + * nscd/getpwnam_r.c: Likewise. + * nscd/getpwuid_r.c: Likewise. + * nscd/grpcache.c: Likewise. + * nscd/hstcache.c: Likewise. + * nscd/initgrcache.c: Likewise. + * nscd/mem.c: Likewise. + * nscd/nscd.c: Likewise. + * nscd/nscd_conf.c: Likewise. + * nscd/pwdcache.c: Likewise. + * posix/getconf.c: Likewise. + * sysdeps/generic/nscd_setup_thread.c: Likewise. + * sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise. + + * sunrpc/auth_des.c (authdes_pk_create): If conversation key + cannot be created, free memory. + Reported by rprasad@vmware.com. + +2005-11-15 Mike Frysinger + + * sysdeps/hppa/bits/setjmp.h: Add _BITS_SETJMP_H preprocessor + protection and allow pthread.h to include bits/setjmp.h as well as + setjmp.h. + * sysdeps/m68k/bits/setjmp.h: Likewise. + * sysdeps/s390/bits/setjmp.h: Make sure only setjmp.h or pthread.h + are allow to include bits/setjmp.h. + * sysdeps/mips/bits/setjmp.h (_JMPBUF_UNWINDS): Cast rhs to match lhs + cast of address. + * sysdeps/sh/bits/setjmp.h: Likewise. + +2005-11-12 Jim Meyering + + * sysdeps/unix/opendir.c (__alloc_dir): Declare STATP parameter + to be pointer to const. + * include/dirent.h: Update decl. + +2005-12-05 Roland McGrath + + * hurd/hurdmalloc.c: Remove $ tag $ magic. + * mach/err_kern.sub: Likewise. + * mach/err_server.sub: Likewise. + * mach/err_us.sub: Likewise. + * mach/error_compat.c: Likewise. + * mach/errorlib.h: Likewise. + * mach/errstring.c: Likewise. + * mach/mach/error.h: Likewise. + * mach/mach_error.c: Likewise. + * mach/mach_error.h: Likewise. + * mach/msg-destroy.c: Likewise. + * mach/msgserver.c: Likewise. + * sysdeps/mach/sys/reboot.h: Likewise. + + * sysdeps/generic/dwarf2.h: Replace license text with glibc LGPL. + +2005-11-28 Jakub Jelinek + + * malloc/tst-mallocfork.c (do_test): Make sure sa_flags is + initialized. Reported by John Reiser . + +2005-12-05 Daniel Jacobowitz + + * stdlib/longlong.h: Update from GCC. + +2005-12-04 Joseph S. Myers + + * soft-fp/soft-fp.h: Include . + + * soft-fp/floatdisf.c (__floatdisf): Return float. + +2005-12-05 Roland McGrath + + * sysdeps/unix/sysv/linux/kernel-features.h + (__ASSUME_POSIX_CPU_TIMERS): New macro, for 2.6.12 and later. + +2005-12-03 Ulrich Drepper + + * nis/nis_table.c (nis_list): Optimize freeing and reallocation of + result record. + + * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyaddr_r): + Better sized buffers. Correct error case handling. + * nis/nis_error.c (nis_sperror_r): Let snprintf determine whether + there is an overflow. + * nis/nss_nisplus/nisplus-service.c: Fix locking to use + _nss_create_tablename. Avoid unnecessary copying, remove + unnecessary variables, general cleanup. + * nis/nss_nisplus/nisplus-rpc.c: Likewise. + * nis/nss_nisplus/nisplus-proto.c: Likewise.. + * nis/nss_nisplus/nisplus-network.c: Fix locking to use + _nss_create_tablename. Avoid unnecessary copying, general cleanup. + * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_getipnodebyname_r): + Removed. + Fix locking to use _nss_create_tablename. Avoid unnecessary copying, + general cleanup. + * nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_getntohost_r): + Correctly construct request. + Fix locking to use _nss_create_tablename. Avoid unnecessary copying, + general cleanup. + * nis/nss_nisplus/nisplus-alias.c: Fix locking to use + _nss_create_tablename. Avoid unnecessary copying, general cleanup. + * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_setnetgrent): + Rewrite to use snprintf. + * nis/nss_nisplus/nisplus-publickey.c (_nss_nisplus_netname2user): + Likewise. + +2005-12-02 Ulrich Drepper + + * nis/nss_nisplus/nisplus-pwd.c (_nss_pwd_create_tablename): + Renamed from _nss_create_tablename. Export from file (but not DSO). + (pwd_tablename_val): Renamed from tablename_val, mark hidden. + (pwd_tablename_len): Renamed from tablename_len, mark hidden. + Change all users. + * nis/nss_nisplus/nisplus-spwd.c (_nss_create_tablename): Removed. + Use _nss_pwd_create_tablename now. Use pwd_tablename_val and + pwd_tablename_len. Remove unnecessary variables, general cleanup. + + * nis/nss_nisplus/nisplus-pwd.c: Fix locking to use + _nss_create_tablename. Avoid unnecessary copying, remove + unnecessary variables, general cleanup. + * nis/nss_nisplus/nisplus-grp.c: Likewise. + + * io/Makefile (routines): Add mknodat, xmknodat, mkdirat, mkfifoat. + (static-only-routines): Add mknodat. + * io/Versions [GLIBC_2.4]: Add mkdirat, mkfifoat, __xmknodat. + * io/sys/stat.h: Declare mkditat, mknodat, mkfifoat, __xmknodat. + Define mknodat inline function. + * include/sys/stat.h: Add hidden proto for __xmknodat. + * sysdeps/generic/mkdirat.c: New file. + * sysdeps/generic/mkfifoat.c: New file. + * sysdeps/generic/mknodat.c: New file. + * sysdeps/generic/xmknodat.c: New file. + * sysdeps/unix/mkfifoat.c: New file. + * sysdeps/unix/sysv/linux/mkdirat.c: New file. + * sysdeps/unix/sysv/linux/xmknodat.c: New file. + + * sysdeps/generic/xmknod.c: Add one more parameter check. + +2005-11-28 Andreas Jaeger + + * sysdeps/unix/sysv/linux/mips/bits/mman.h (MREMAP_FIXED): Added, + Patch by René Rebe . + +2005-11-27 Ulrich Drepper + + * sysdeps/posix/getaddrinfo.c: Avoid RFC 3484 sorting if there are + multiple return records but only one address. + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Avoid some code duplication. + +2005-11-27 Roland McGrath + + * sysdeps/unix/sysv/linux/fchownat.c: Include alloca.h, sysdep.h. + Reported by René Rebe . + +2005-11-27 Ulrich Drepper + + * sysdeps/posix/euidaccess.c [_LIBC] (euidaccess): Don't cache + euid and egid. + + * nis/nis_table.c (nis_list): Add more free calls in error cases. + +2005-11-26 Richard Henderson + + * sysdeps/alpha/strncmp.S: Don't read too much data when pointers + are co-aligned, and count is aligned with the end of the word. + +2005-11-26 Ulrich Drepper + + * nis/nis_lookup.c (nis_lookup): Mark RPCTIMEOUT as const. Pretty + printing. + + * nis/nis_table.c (__create_ib_request): Use strdupa instead of + variable size array. + (RPCTIMEOUT): Mark as const. + + * nis/ypclnt.c (yp_bind_ypbindprog): Initialize clnt_saddr by hand. + (ypdomainname): Renamed from __ypdomainname. No need for initializer. + (ypbindlist): Renamed from __ypbindlist. + (do_ypcall): Check memory allocation suceeded before calling + yp_bind_ypbindprog. + (yperr_string): Reduce size of function by using only one gettext call. + (ypbinderr_string): Likewise. + (yp_match): Free response in case memory for return value cannot be + allocated. + (yp_first): Likewise. + (yp_next): Likewise. + (do_ypcall_tr): New function which translates error codes as well. + (yp_match, yp_next, yp_master, yp_order, yp_maplist): Use it. + (yp_all): Correct test for invalid parameter. + Pretty printing. + (RPCTIMEOUT, UDPTIMEOUT): Mark as const. + +2005-11-25 Richard Henderson + + * sysdeps/unix/sysv/linux/alpha/fxstatat.c (__fxstatat): Fix typo. + (__fxstatat64): Alias from __fxstatat; remove other cnp errors. + * sysdeps/unix/sysv/linux/alpha/sigaction.c: Include sys/cdefs.h + and stddef.h. + * sysdeps/unix/sysv/linux/alpha/bits/mman.h (MREMAP_FIXED): Define. + +2005-11-25 Ulrich Drepper + + * Makeconfig (+cflags): Add -fmerge-all-constants by default. + + [BZ #1912] + * nss/function.def: Add entry to use gethostbyname2 for files. + +2005-11-25 Thorsten Kukuk + + * sysdeps/unix/sysv/linux/fxstatat64.c: Include string.h. + +2005-11-25 Ulrich Drepper + + [BZ #1926] + * nss/nss_files/files-netgrp.c (_nss_files_endnetgrent): Change + return value type to match expected type. + + [BZ #1925] + * nis/ypclnt.c (yp_order): Correct test for invalid parameter. + +2005-11-24 Ulrich Drepper + + * scripts/check-c++-types.sh: Improve comments. + + * scripts/check-local-headers.sh: New file. + * Makefile (tests): Run check-local-headers.sh. + +2005-11-23 Thorsten Kukuk + + * include/sys/sendfile.h: New file. + +2005-11-24 Andreas Schwab + + * time/sys/time.h: Remove nonnull attribute from futimesat. + +2005-11-22 Ulrich Drepper + + * nscd/connections.c (sendfileall): Define. + (handle_request): Use it instead of sendfile call. + * nscd/nscd-client.h: Declare sendfileall. + * nscd/aicache.c: Use sendfileall instead of sendfile. + * nscd/grpcache.c: Likewise. + * nscd/hstcache.c: Likewise. + * nscd/initgrcache.c: Likewise. + * nscd/pwdcache.c: Likewise. + + [BZ #1908] + * manual/install.texi (Tools for Compilation): Require gawk. + +2005-11-22 Jakub Jelinek + + * sysdeps/generic/ldsodefs.h (struct rtld_global): Remove + unused is_static field from slotinfo array. + +2005-11-21 Jakub Jelinek + + * sunrpc/bindrsvprt.c (bindresvport): Wrap around to startport + in the loop if port is bigger than endport, initially set to + ENDPORT. When changing startport, set endport and port + appropriately. + +2005-11-21 Ulrich Drepper + + * Makefile.in: Remove RCS ID line. + * config-name.in: Likewise. + * config.make.in: Likewise. + * malloc/arena.c: Likewise. + * malloc/hooks.c: Likewise. + * malloc/malloc.c: Likewise. + * manual/dir: Likewise. + * math/math_private.h: Likewise. + * resolv/gethnamaddr.c: Likewise. + * scripts/mkinstalldirs: Likewise. + * sunrpc/rpc_clntout.c: Likewise. + * sunrpc/rpc_cout.c: Likewise. + * sunrpc/rpc_hout.c: Likewise. + * sunrpc/rpc_main.c: Likewise. + * sunrpc/rpc_parse.c: Likewise. + * sunrpc/rpc_sample.c: Likewise. + * sunrpc/rpc_scan.c: Likewise. + * sunrpc/rpc_svcout.c: Likewise. + * sunrpc/rpc_tblout.c: Likewise. + * sunrpc/rpc_util.c: Likewise. + * sysdeps/unix/sysv/linux/sys/quote.h: Likewise. + + * nscd/nscd_helper.c: Pretty printing. + 2005-11-19 Roland McGrath * elf/elf.h: Revert last change. diff --git a/Makeconfig b/Makeconfig index 97f74f7e1f..45a970402e 100644 --- a/Makeconfig +++ b/Makeconfig @@ -557,6 +557,10 @@ else +gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes endif +# We do not depend on the address of constants in different files to be +# actually different, so allow the compiler to merge them all. ++merge-constants = -fmerge-all-constants + # This is the program that generates makefile dependencies from C source files. # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy # targets for headers so that removed headers don't break the build. @@ -611,21 +615,22 @@ ifeq "$(strip $(+cflags))" "" +cflags := $(default_cflags) endif # $(+cflags) == "" -+cflags := $(+cflags) $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) ++cflags += $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) $(+merge-constants) +gcc-nowarn := -w # Don't duplicate options if we inherited variables from the parent. +cflags := $(sort $(+cflags)) -# These are flags given to the C compiler to tell it to look for include -# files (including ones given in angle brackets) in the current directory, -# in the parent library source directory and in the include directory. +# These are flags given to the C compiler to tell it to look for +# include files (including ones given in angle brackets) in the parent +# library source directory, in the include directory, and in the +# current directory. # `+sysdep-includes' will be defined by Makerules. -+includes = -I$(..)include -I. \ - $(patsubst %/,-I%,$(objpfx)) $(patsubst %/,-I%,$(..)) \ ++includes = -I$(..)include $(patsubst %/,-I%,$(..)) \ $(libio-include) $(includes) \ - $(+sysdep-includes) $(sysincludes) + $(+sysdep-includes) $(sysincludes) -I. \ + $(patsubst %/,-I%,$(objpfx)) # Since libio has several internal header files, we use a -I instead # of many little headers in the include directory. diff --git a/Makefile b/Makefile index f2d0b1bed0..3a20a7fc22 100644 --- a/Makefile +++ b/Makefile @@ -235,7 +235,7 @@ mostlyclean: parent-mostlyclean tests-clean: @$(MAKE) subdir_testclean no_deps=t -tests: $(objpfx)c++-types-check.out +tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out ifneq ($(CXX),no) check-data := $(firstword $(wildcard \ $(foreach M,$(config-machine) $(base-machine),\ @@ -250,6 +250,9 @@ $(objpfx)c++-types-check.out: endif endif +$(objpfx)check-local-headers.out: scripts/check-local-headers.sh + scripts/check-local-headers.sh "$(includedir)" "$(objpfx)" > $@ + ifneq ($(PERL),no) installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \ crypt/crypt.h ctype/ctype.h debug/execinfo.h \ diff --git a/Makefile.in b/Makefile.in index ccdfb73c86..1c1e2c1df1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,3 @@ -# Generated from $Id$. - srcdir = @srcdir@ # Uncomment the line below if you want to do parallel build. diff --git a/Makerules b/Makerules index 3ffff58db3..d0b1d8975d 100644 --- a/Makerules +++ b/Makerules @@ -208,53 +208,6 @@ before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h) # later directory would be chosen over a .c file in an earlier directory, # which does not preserve the desired sysdeps ordering behavior. -# It matters that this set of rules, for compiling from sources in -# the current directory (the $srcdir/$subdir) come before the -# generated sysdep rules in included from sysd-rules below. When -# compiling in the source tree, generated sources go into the current -# directory, and those should be chosen before any sources in sysdeps. -define o-iterator-doit -$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) - -define o-iterator-doit -$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) - -define o-iterator-doit -$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) - -# Omit the objpfx rules when building in the source tree, because -# objpfx is empty and so these rules just override the ones above. -ifdef objpfx -# Define first rules to find the source files in $(objpfx). -# Generated source files will end up there. -define o-iterator-doit -$(objpfx)%$o: $(objpfx)%.S $(before-compile); $$(compile-command.S) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) - -define o-iterator-doit -$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) - -define o-iterator-doit -$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) -endif - # System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard # patterns matching sysdep directories whose assembly source files should # be suppressed. @@ -304,6 +257,7 @@ $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \ echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)"; \ echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)"; \ done; \ + echo "\$$(objpfx)m_%.c: s_%.c; \$$(+make-include-of-dep)"; \ echo 'sysd-rules-done = t') > $@T mv -f $@T $@ @@ -318,6 +272,53 @@ echo '#include <$<>' > $@T mv -f $@T $@ endef +# It matters that this set of rules, for compiling from sources in +# the current directory (the $srcdir/$subdir) come before the +# generated sysdep rules in included from sysd-rules below. When +# compiling in the source tree, generated sources go into the current +# directory, and those should be chosen before any sources in sysdeps. +define o-iterator-doit +$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) + +define o-iterator-doit +$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) + +define o-iterator-doit +$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) + +# Omit the objpfx rules when building in the source tree, because +# objpfx is empty and so these rules just override the ones above. +ifdef objpfx +# Define first rules to find the source files in $(objpfx). +# Generated source files will end up there. +define o-iterator-doit +$(objpfx)%$o: $(objpfx)%.S $(before-compile); $$(compile-command.S) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) + +define o-iterator-doit +$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) + +define o-iterator-doit +$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) +endif + # Generate version maps, but wait until sysdep-subdirs is known ifeq ($(sysd-sorted-done),t) ifeq ($(versioning),yes) diff --git a/NEWS b/NEWS index 86c7b5e833..41755c383b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 2005-11-11 +GNU C Library NEWS -- history of user-visible changes. 2005-12-15 Copyright (C) 1992-2002,2003,2004,2005 Free Software Foundation, Inc. See the end for copying conditions. @@ -28,7 +28,7 @@ Version 2.4 recommend using the stable 2.3 branch. * New interfaces: fdopendir, openat, fstatat, fchownat, futimesat, renameat, - unlinkat. + unlinkat, mkdirat, mkfifoat, mknodat, linkat, symlinkat, readlinkat. Version 2.3.6 diff --git a/bare/brdinit.c b/bare/brdinit.c new file mode 100644 index 0000000000..af96bcd12a --- /dev/null +++ b/bare/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 + +/* 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/bare/console.c b/bare/console.c new file mode 100644 index 0000000000..326ebed4a1 --- /dev/null +++ b/bare/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 + +/* 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/bare/strtsupp.c b/bare/strtsupp.c new file mode 100644 index 0000000000..c66495bb3d --- /dev/null +++ b/bare/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 + +/* 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/catgets/gencat.c b/catgets/gencat.c index 39938097d3..2afecadcbe 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -2,23 +2,21 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #include diff --git a/config-name.in b/config-name.in index 6380b09254..cdac43d860 100644 --- a/config-name.in +++ b/config-name.in @@ -1,5 +1,4 @@ /* @configure_input@ -*- C -*- - Generated from $Id$. This is used only by the generic `uname' function for systems with no real `uname' call. If this data is not correct, it does not matter much. */ diff --git a/config.make.in b/config.make.in index 748ea96b2e..3af1e396e9 100644 --- a/config.make.in +++ b/config.make.in @@ -1,5 +1,4 @@ # @configure_input@ -# From $Id$. # Don't edit this file. Put configuration parameters in configparms instead. version = @VERSION@ diff --git a/csu/check_fds.c b/csu/check_fds.c new file mode 100644 index 0000000000..10ba3da395 --- /dev/null +++ b/csu/check_fds.c @@ -0,0 +1,102 @@ +/* Copyright (C) 2000, 2002, 2003, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + +/* Try to get a machine dependent instruction which will make the + program crash. This is used in case everything else fails. */ +#include +#ifndef ABORT_INSTRUCTION +/* No such instruction is available. */ +# define ABORT_INSTRUCTION +#endif + +#include +#include + + +/* 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) + { + const char *name; + dev_t dev; + + /* For writable descriptors we use /dev/full. */ + if ((mode & O_ACCMODE) == O_WRONLY) + { + name = _PATH_DEV "full"; + dev = makedev (DEV_FULL_MAJOR, DEV_FULL_MINOR); + } + else + { + name = _PATH_DEVNULL; + dev = makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR); + } + + /* 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 (name, 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. */ + struct stat64 st; + if (__builtin_expect (nullfd != fd, 0) + || __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0 + || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0 + || st.st_rdev != dev) + /* 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_WRONLY | O_NOFOLLOW); + check_one_fd (STDOUT_FILENO, O_RDONLY | O_NOFOLLOW); + check_one_fd (STDERR_FILENO, O_RDONLY | O_NOFOLLOW); +} diff --git a/csu/errno-loc.c b/csu/errno-loc.c new file mode 100644 index 0000000000..633590f4f9 --- /dev/null +++ b/csu/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 +#include + +#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/csu/errno.c b/csu/errno.c new file mode 100644 index 0000000000..03d661b717 --- /dev/null +++ b/csu/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 +#include +#include +#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 +compat_symbol (libc, errno, errno, GLIBC_2_0); +compat_symbol (libc, _errno, _errno, GLIBC_2_0); +# endif + +#endif diff --git a/csu/init-first.c b/csu/init-first.c new file mode 100644 index 0000000000..fa21274c73 --- /dev/null +++ b/csu/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 +#include + +/* 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/csu/libc-start.c b/csu/libc-start.c new file mode 100644 index 0000000000..194db6b1ec --- /dev/null +++ b/csu/libc-start.c @@ -0,0 +1,263 @@ +/* Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + +extern void __libc_init_first (int argc, char **argv, char **envp); + +extern int __libc_multiple_libcs; + +#include +#ifndef SHARED +# include +extern void __pthread_initialize_minimal (void) +# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP + __attribute__ ((weak)) +# endif + ; +# ifndef THREAD_SET_STACK_GUARD +/* Only exported for architectures that don't store the stack guard canary + in thread local area. */ +uintptr_t __stack_chk_guard attribute_relro; +# endif +#endif + +#ifdef HAVE_PTR_NTHREADS +/* We need atomic operations. */ +# include +#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 + __typeof (main) init, + void (*fini) (void), + void (*rtld_fini) (void), + void *__unbounded stack_end) + __attribute__ ((noreturn)); + + +/* Note: the fini parameter is ignored here for shared library. It + is registered with __cxa_atexit. This had the disadvantage that + finalizers were called in more than one place. */ +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 + __typeof (main) init, + void (*fini) (void), + void (*rtld_fini) (void), void *__unbounded stack_end) +{ +#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; + +#ifndef SHARED + char *__unbounded *__unbounded ubp_ev = &ubp_av[argc + 1]; + + INIT_ARGV_and_ENVIRON; + + /* 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 + +# ifndef SHARED + /* Set up the stack checker's canary. */ + uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); +# ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); +# else + __stack_chk_guard = stack_chk_guard; +# endif +#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); + +#ifndef SHARED + /* 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'. */ + __libc_init_first (argc, argv, __environ); + + /* Register the destructor of the program, if any. */ + if (fini) + __cxa_atexit ((void (*) (void *)) fini, NULL, NULL); + + /* 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) (argc, argv, __environ MAIN_AUXVEC_PARAM); + +#ifdef SHARED + /* Auditing checkpoint: we have a new object. */ + if (__builtin_expect (GLRO(dl_naudit) > 0, 0)) + { + struct audit_ifaces *afct = GLRO(dl_audit); + struct link_map *head = GL(dl_ns)[LM_ID_BASE]._ns_loaded; + for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) + { + if (afct->preinit != NULL) + afct->preinit (&head->l_audit[cnt].cookie); + + afct = afct->next; + } + } +#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 + unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads; +# else + extern unsigned int __nptl_nthreads __attribute ((weak)); + unsigned 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/csu/libc-tls.c b/csu/libc-tls.c new file mode 100644 index 0000000000..3544e396da --- /dev/null +++ b/csu/libc-tls.c @@ -0,0 +1,263 @@ +/* Initialization code for TLS in statically linked application. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +#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; + + +static dtv_t static_dtv[2 + TLS_SLOTINFO_SURPLUS]; + + +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. Giving this initialized value + preallocates some surplus bytes in the static TLS area. */ +size_t _dl_tls_static_size = 2048; +/* 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; + } + + /* 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 = (sizeof (static_dtv) / sizeof (static_dtv[0])) - 2; + // 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.val = ((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.val = (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 + static_dtv[2].pointer.is_static = true; + /* sbrk gives us zero'd memory, so we don't need to clear the remainder. */ + memcpy (static_dtv[2].pointer.val, 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/csu/start.c b/csu/start.c new file mode 100644 index 0000000000..08f985c482 --- /dev/null +++ b/csu/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/csu/sysdep.c b/csu/sysdep.c new file mode 100644 index 0000000000..5442eee00d --- /dev/null +++ b/csu/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/debug/backtrace.c b/debug/backtrace.c new file mode 100644 index 0000000000..f2d52372d5 --- /dev/null +++ b/debug/backtrace.c @@ -0,0 +1,94 @@ +/* Return backtrace of current program state. Generic version. + Copyright (C) 1998, 2000, 2002, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include +#include +#include +#include + +/* 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) +libc_hidden_def (__backtrace) diff --git a/debug/backtracesyms.c b/debug/backtracesyms.c new file mode 100644 index 0000000000..db7ba36d0f --- /dev/null +++ b/debug/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 , 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 +#include +#include + + +/* 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]". */ + 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/debug/backtracesymsfd.c b/debug/backtracesymsfd.c new file mode 100644 index 0000000000..b01f8b0094 --- /dev/null +++ b/debug/backtracesymsfd.c @@ -0,0 +1,64 @@ +/* Write formatted list with names for addresses in backtrace to a file. + Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include + +#include +#include + +#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) +libc_hidden_def (__backtrace_symbols_fd) diff --git a/debug/memcpy_chk.c b/debug/memcpy_chk.c new file mode 100644 index 0000000000..638cd0e4fb --- /dev/null +++ b/debug/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 +#include +#include + +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/debug/memmove_chk.c b/debug/memmove_chk.c new file mode 100644 index 0000000000..f3b74d23d9 --- /dev/null +++ b/debug/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 +#include +#include + +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/debug/mempcpy_chk.c b/debug/mempcpy_chk.c new file mode 100644 index 0000000000..5297bbab92 --- /dev/null +++ b/debug/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 +#include +#include + +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/debug/memset_chk.c b/debug/memset_chk.c new file mode 100644 index 0000000000..d6206ffc99 --- /dev/null +++ b/debug/memset_chk.c @@ -0,0 +1,92 @@ +/* Copyright (C) 1991, 1997, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +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/debug/readonly-area.c b/debug/readonly-area.c new file mode 100644 index 0000000000..4b8172f193 --- /dev/null +++ b/debug/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 + +/* 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/debug/segfault.c b/debug/segfault.c new file mode 100644 index 0000000000..f141fff661 --- /dev/null +++ b/debug/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 , 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* This file defines macros to access the content of the sigcontext element + passed up by the signal handler. */ +#include + +/* Get code to possibly dump the content of all registers. */ +#include + +/* 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/debug/stpcpy_chk.c b/debug/stpcpy_chk.c new file mode 100644 index 0000000000..dacda0115a --- /dev/null +++ b/debug/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 +#endif + +#include + + +/* 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/debug/stpncpy_chk.c b/debug/stpncpy_chk.c new file mode 100644 index 0000000000..d136339dea --- /dev/null +++ b/debug/stpncpy_chk.c @@ -0,0 +1,85 @@ +/* Copyright (C) 1993,1995,1996,1997,2002,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along 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. */ + +#include + + +/* 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_chk (char *dest, const char *src, size_t n, size_t destlen) +{ + char c; + char *s = dest; + + if (__builtin_expect (destlen < n, 0)) + __chk_fail (); + + 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; +} diff --git a/debug/strcat_chk.c b/debug/strcat_chk.c new file mode 100644 index 0000000000..b3fb3470b7 --- /dev/null +++ b/debug/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 +#include + + +/* 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/debug/strcpy_chk.c b/debug/strcpy_chk.c new file mode 100644 index 0000000000..a4d909feda --- /dev/null +++ b/debug/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 +#include +#include + +#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/debug/strncat_chk.c b/debug/strncat_chk.c new file mode 100644 index 0000000000..953b435a4b --- /dev/null +++ b/debug/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 + +#include + + +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/debug/strncpy_chk.c b/debug/strncpy_chk.c new file mode 100644 index 0000000000..bdede7738b --- /dev/null +++ b/debug/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 +#include + + +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/dirent/alphasort64.c b/dirent/alphasort64.c new file mode 100644 index 0000000000..fe84aec2f1 --- /dev/null +++ b/dirent/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 +#include + +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/dirent/closedir.c b/dirent/closedir.c new file mode 100644 index 0000000000..4410f02fb3 --- /dev/null +++ b/dirent/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 +#include +#include + + +/* 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 diff --git a/dirent/dirfd.c b/dirent/dirfd.c new file mode 100644 index 0000000000..06c0cde435 --- /dev/null +++ b/dirent/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 +#include +#include + +int +dirfd (dirp) + DIR *dirp; +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (dirfd) +#include diff --git a/dirent/fdopendir.c b/dirent/fdopendir.c new file mode 100644 index 0000000000..ed30e89e7e --- /dev/null +++ b/dirent/fdopendir.c @@ -0,0 +1,34 @@ +/* Open a directory stream from a file descriptor. Stub version. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + + +/* Open a directory stream on FD. */ +DIR * +fdopendir (int fd) +{ + __set_errno (ENOSYS); + return NULL; +} + +stub_warning (fdopendir) +#include diff --git a/dirent/getdents.c b/dirent/getdents.c new file mode 100644 index 0000000000..1b1b7c7e8f --- /dev/null +++ b/dirent/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 +#include +#include +#include + +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 diff --git a/dirent/getdents64.c b/dirent/getdents64.c new file mode 100644 index 0000000000..cb30e76545 --- /dev/null +++ b/dirent/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 +#include +#include +#include + +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 diff --git a/dirent/opendir.c b/dirent/opendir.c new file mode 100644 index 0000000000..771013f6eb --- /dev/null +++ b/dirent/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 +#include +#include + + +/* Open a directory stream on NAME. */ +DIR * +__opendir (const char *name) +{ + __set_errno (ENOSYS); + return NULL; +} +weak_alias (__opendir, opendir) + +stub_warning (opendir) +#include diff --git a/dirent/readdir.c b/dirent/readdir.c new file mode 100644 index 0000000000..893b246d41 --- /dev/null +++ b/dirent/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 +#include +#include + +/* Read a directory entry from DIRP. */ +struct dirent * +__readdir (DIR *dirp) +{ + __set_errno (ENOSYS); + return NULL; +} +weak_alias (__readdir, readdir) + +stub_warning (readdir) +#include diff --git a/dirent/readdir64.c b/dirent/readdir64.c new file mode 100644 index 0000000000..0c18bd9440 --- /dev/null +++ b/dirent/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 +#include +#include + +/* Read a directory entry from DIRP. */ +struct dirent64 * +__readdir64 (DIR *dirp) +{ + __set_errno (ENOSYS); + return NULL; +} +weak_alias (__readdir64, readdir64) +stub_warning (readdir64) +#include diff --git a/dirent/readdir64_r.c b/dirent/readdir64_r.c new file mode 100644 index 0000000000..cf9e952e1a --- /dev/null +++ b/dirent/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 +#include +#include + +/* 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 diff --git a/dirent/readdir_r.c b/dirent/readdir_r.c new file mode 100644 index 0000000000..ad45dfa504 --- /dev/null +++ b/dirent/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 +#include +#include + +/* 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 diff --git a/dirent/rewinddir.c b/dirent/rewinddir.c new file mode 100644 index 0000000000..e78d316880 --- /dev/null +++ b/dirent/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 +#include +#include + + +/* 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 diff --git a/dirent/scandir64.c b/dirent/scandir64.c new file mode 100644 index 0000000000..68608de9a0 --- /dev/null +++ b/dirent/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 + +#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 diff --git a/dirent/seekdir.c b/dirent/seekdir.c new file mode 100644 index 0000000000..c3828cde0f --- /dev/null +++ b/dirent/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 +#include +#include +#include + +/* 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 diff --git a/dirent/telldir.c b/dirent/telldir.c new file mode 100644 index 0000000000..7b14452327 --- /dev/null +++ b/dirent/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 +#include +#include +#include + +/* 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 diff --git a/dirent/versionsort64.c b/dirent/versionsort64.c new file mode 100644 index 0000000000..e471827023 --- /dev/null +++ b/dirent/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 +#include + +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/elf/Versions b/elf/Versions index 9c53f1615e..87e27c5a7a 100644 --- a/elf/Versions +++ b/elf/Versions @@ -60,5 +60,7 @@ ld { _dl_make_stack_executable; # Only here for gdb while a better method is developed. _dl_debug_state; + # Pointer protection. + __pointer_chk_guard; } } diff --git a/elf/cache.c b/elf/cache.c index d5f313657c..9ce3d161a7 100644 --- a/elf/cache.c +++ b/elf/cache.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Andreas Jaeger , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/elf/chroot_canon.c b/elf/chroot_canon.c index d29a032163..41d6e82625 100644 --- a/elf/chroot_canon.c +++ b/elf/chroot_canon.c @@ -1,22 +1,20 @@ /* Return the canonical absolute name of a given file inside chroot. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2004 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/elf/dl-brk.c b/elf/dl-brk.c new file mode 100644 index 0000000000..c37cdfec33 --- /dev/null +++ b/elf/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 diff --git a/elf/dl-cache.c b/elf/dl-cache.c new file mode 100644 index 0000000000..29886e194a --- /dev/null +++ b/elf/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 +#include +#include +#include +#include +#include + +#include + +#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/elf/dl-environ.c b/elf/dl-environ.c new file mode 100644 index 0000000000..089e89e6e7 --- /dev/null +++ b/elf/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 +#include +#include +#include + +/* 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/elf/dl-error.c b/elf/dl-error.c index 3a0d9bb8a7..b5374e949c 100644 --- a/elf/dl-error.c +++ b/elf/dl-error.c @@ -112,7 +112,8 @@ _dl_signal_error (int errcode, const char *objname, const char *occation, lcatch->errstring = _dl_out_of_memory; lcatch->malloced = false; } - longjmp (lcatch->env, errcode ?: -1); + /* We do not restore the signal mask because none was saved. */ + __longjmp (lcatch->env, errcode ?: -1); } else { @@ -169,7 +170,8 @@ _dl_catch_error (const char **objname, const char **errstring, struct catch **const catchp = &CATCH_HOOK; old = *catchp; - errcode = setjmp (c.env); + /* Do not save the signal mask. */ + errcode = __sigsetjmp (c.env, 0); if (__builtin_expect (errcode, 0) == 0) { *catchp = &c; diff --git a/elf/dl-execstack.c b/elf/dl-execstack.c new file mode 100644 index 0000000000..6dce21e7a1 --- /dev/null +++ b/elf/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 +#include + +/* 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/elf/dl-fptr.c b/elf/dl-fptr.c new file mode 100644 index 0000000000..78beecfdcb --- /dev/null +++ b/elf/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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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/elf/dl-minimal.c b/elf/dl-minimal.c index adb85e6753..868d3bd2ed 100644 --- a/elf/dl-minimal.c +++ b/elf/dl-minimal.c @@ -1,5 +1,5 @@ /* Minimal replacements for basic facilities used in the dynamic linker. - Copyright (C) 1995-1998,2000-2002,2004 Free Software Foundation, Inc. + Copyright (C) 1995-1998,2000-2002,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -148,12 +148,6 @@ __sigjmp_save (sigjmp_buf env, int savemask __attribute__ ((unused))) env[0].__mask_was_saved = 0; return 0; } - -void weak_function -longjmp (jmp_buf env, int val) -{ - __longjmp (env[0].__jmpbuf, val); -} /* Define our own version of the internal function used by strerror. We only provide the messages for some common errors. This avoids pulling diff --git a/elf/dl-origin.c b/elf/dl-origin.c new file mode 100644 index 0000000000..87619379bc --- /dev/null +++ b/elf/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 , 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 +#include +#include +#include + +#include + + +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/elf/dl-sbrk.c b/elf/dl-sbrk.c new file mode 100644 index 0000000000..4713a92694 --- /dev/null +++ b/elf/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 diff --git a/elf/dl-symaddr.c b/elf/dl-symaddr.c new file mode 100644 index 0000000000..3c850ca835 --- /dev/null +++ b/elf/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 +#include + +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/elf/dl-sysdep.c b/elf/dl-sysdep.c new file mode 100644 index 0000000000..985e2b8f77 --- /dev/null +++ b/elf/dl-sysdep.c @@ -0,0 +1,590 @@ +/* Operating system support for run-time dynamic linker. Generic Unix version. + Copyright (C) 1995-1998, 2000-2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef _DL_FIRST_PLATFORM +# define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT) +#else +# define _DL_FIRST_EXTRA _DL_HWCAP_COUNT +#endif + +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 = (void *) av->a_un.a_val; + 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) = (void *) av->a_un.a_val; + break; + case AT_HWCAP: + GLRO(dl_hwcap) = (unsigned long int) 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) = (void *) av->a_un.a_val; + break; +#endif +#ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV +#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 = (char *) av->a_un.a_val; + + 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. */ + uint64_t 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; (~((1ULL << n) - 1) & masked) != 0; ++n) + if ((masked & (1ULL << n)) != 0) + ++cnt; + +#if (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO) && defined SHARED + /* The system-supplied DSO can contain a note of type 2, vendor "GNU". + This gives us a list of names to treat as fake hwcap bits. */ + + const char *dsocaps = NULL; + size_t dsocapslen = 0; + if (GLRO(dl_sysinfo_map) != NULL) + { + const ElfW(Phdr) *const phdr = GLRO(dl_sysinfo_map)->l_phdr; + const ElfW(Word) phnum = GLRO(dl_sysinfo_map)->l_phnum; + for (uint_fast16_t i = 0; i < phnum; ++i) + if (phdr[i].p_type == PT_NOTE) + { + const ElfW(Addr) start = (phdr[i].p_vaddr + + GLRO(dl_sysinfo_map)->l_addr); + const struct + { + ElfW(Word) vendorlen; + ElfW(Word) datalen; + ElfW(Word) type; + } *note = (const void *) start; + while ((ElfW(Addr)) (note + 1) - start < phdr[i].p_memsz) + { +#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word))) + if (note->type == 2 + && note->vendorlen == sizeof "GNU" + && !memcmp ((note + 1), "GNU", sizeof "GNU") + && note->datalen > 2 * sizeof (ElfW(Word)) + 2) + { + const ElfW(Word) *p = ((const void *) (note + 1) + + ROUND (sizeof "GNU")); + cnt += *p++; + ++p; /* Skip mask word. */ + dsocaps = (const char *) p; + dsocapslen = note->datalen - sizeof *p * 2; + break; + } + note = ((const void *) (note + 1) + + ROUND (note->vendorlen) + ROUND (note->datalen)); + } + if (dsocaps != NULL) + break; + } + } +#endif + +#ifdef USE_TLS + /* For TLS enabled builds always add 'tls'. */ + ++cnt; +#else + if (cnt == 0) + { + /* If we no 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; +#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO + if (dsocaps != NULL) + { + const ElfW(Word) mask = ((const ElfW(Word) *) dsocaps)[-1]; + GLRO(dl_hwcap) |= (uint64_t) mask << _DL_FIRST_EXTRA; + size_t len; + for (const char *p = dsocaps; p < dsocaps + dsocapslen; p += len + 1) + { + uint_fast8_t bit = *p++; + len = strlen (p); + + /* Skip entries that are not enabled in the mask word. */ + if (__builtin_expect (mask & ((ElfW(Word)) 1 << bit), 1)) + { + temp[m].str = p; + temp[m].len = len; + ++m; + } + else + --cnt; + } + } +#endif + for (n = 0; masked != 0; ++n) + if ((masked & (1ULL << n)) != 0) + { + temp[m].str = _dl_hwcap_string (n); + temp[m].len = strlen (temp[m].str); + masked ^= 1ULL << 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 half starts right after the first part of the string of + the 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/elf/dl-tls.c b/elf/dl-tls.c new file mode 100644 index 0000000000..4fed570d5c --- /dev/null +++ b/elf/dl-tls.c @@ -0,0 +1,799 @@ +/* Thread-local storage handling in the ELF dynamic linker. Generic version. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +/* We don't need any of this if TLS is not supported. */ +#ifdef USE_TLS + +# include +# include + +/* 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. + + NB: the offset +1 is due to the fact that DTV[0] is used + for something else. */ + result = GL(dl_tls_static_nelem) + 1; + if (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) + 1); + /* 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) +{ + size_t max_align = TLS_TCB_ALIGN; + size_t freetop = 0; + size_t freebottom = 0; + + /* 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); + + struct dtv_slotinfo *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. */ + size_t offset = 0; + + for (size_t cnt = 0; 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. */ + size_t offset = TLS_TCB_SIZE; + + for (size_t cnt = 0; 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; + size_t maxgen = 0; + + /* We have to 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; + + /* Keep track of the maximum generation number. This might + not be the generation counter. */ + maxgen = MAX (maxgen, listp->slotinfo[cnt].gen); + + 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.val = TLS_DTV_UNALLOCATED; + dtv[map->l_tls_modid].pointer.is_static = false; + 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.val = dest; + dtv[map->l_tls_modid].pointer.is_static = true; + 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); + } + + /* The DTV version is up-to-date now. */ + dtv[0].counter = maxgen; + + 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); + + /* We need to free the memory allocated for non-static TLS. */ + for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt) + if (! dtv[1 + cnt].pointer.is_static + && dtv[1 + cnt].pointer.val != TLS_DTV_UNALLOCATED) + free (dtv[1 + cnt].pointer.val); + + /* 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; +} + + +struct link_map * +_dl_update_slotinfo (unsigned long int req_modid) +{ + struct link_map *the_map = NULL; + dtv_t *dtv = THREAD_DTV (); + + /* 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. */ + unsigned long int idx = req_modid; + struct dtv_slotinfo_list *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 + { + for (size_t cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt) + { + size_t gen = listp->slotinfo[cnt].gen; + + 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. */ + struct link_map *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.is_static + && dtv[total + cnt].pointer.val != TLS_DTV_UNALLOCATED) + { + free (dtv[total + cnt].pointer.val); + dtv[total + cnt].pointer.val = TLS_DTV_UNALLOCATED; + } + + continue; + } + + /* Check whether the current dtv array is large enough. */ + size_t 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.is_static + && dtv[modid].pointer.val != 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.val); + + /* This module is loaded dynamically- We defer memory + allocation. */ + dtv[modid].pointer.is_static = false; + dtv[modid].pointer.val = TLS_DTV_UNALLOCATED; + + if (modid == req_modid) + the_map = map; + } + + total += listp->len; + } + while ((listp = listp->next) != NULL); + + /* This will be the new maximum generation counter. */ + dtv[0].counter = new_gen; + } + + return the_map; +} + + +/* 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)) + the_map = _dl_update_slotinfo (GET_ADDR_MODULE); + + p = dtv[GET_ADDR_MODULE].pointer.val; + + 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.val = allocate_and_init (the_map); + dtv[GET_ADDR_MODULE].pointer.is_static = false; + } + + return (char *) p + GET_ADDR_OFFSET; +} +# endif + + + +void +_dl_add_to_slotinfo (struct link_map *l) +{ + /* Now that we know the object is loaded successfully add + modules containing TLS data to the dtv info table. We + might have to increase its size. */ + struct dtv_slotinfo_list *listp; + struct dtv_slotinfo_list *prevp; + size_t idx = l->l_tls_modid; + + /* Find the place in the dtv slotinfo list. */ + listp = GL(dl_tls_dtv_slotinfo_list); + prevp = NULL; /* Needed to shut up gcc. */ + do + { + /* Does it fit in the array of this list element? */ + if (idx < listp->len) + break; + idx -= listp->len; + prevp = listp; + listp = listp->next; + } + while (listp != NULL); + + if (listp == NULL) + { + /* When we come here it means we have to add a new element + to the slotinfo list. And the new module must be in + the first slot. */ + assert (idx == 0); + + listp = prevp->next = (struct dtv_slotinfo_list *) + malloc (sizeof (struct dtv_slotinfo_list) + + TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo)); + if (listp == NULL) + { + /* We ran out of memory. We will simply fail this + call but don't undo anything we did so far. The + application will crash or be terminated anyway very + soon. */ + + /* We have to do this since some entries in the dtv + slotinfo array might already point to this + generation. */ + ++GL(dl_tls_generation); + + _dl_signal_error (ENOMEM, "dlopen", NULL, N_("\ +cannot create TLS data structures")); + } + + listp->len = TLS_SLOTINFO_SURPLUS; + listp->next = NULL; + memset (listp->slotinfo, '\0', + TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo)); + } + + /* Add the information into the slotinfo data structure. */ + listp->slotinfo[idx].map = l; + listp->slotinfo[idx].gen = GL(dl_tls_generation) + 1; +} +#endif /* use TLS */ diff --git a/elf/dl-trampoline.c b/elf/dl-trampoline.c new file mode 100644 index 0000000000..3ca89f3879 --- /dev/null +++ b/elf/dl-trampoline.c @@ -0,0 +1 @@ +#error "Architecture specific PLT trampolines must be defined." diff --git a/elf/enbl-secure.c b/elf/enbl-secure.c new file mode 100644 index 0000000000..fac3b9c527 --- /dev/null +++ b/elf/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 +#include + +/* 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/elf/ldconfig.c b/elf/ldconfig.c index d96295cbc1..e63b312bd0 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Andreas Jaeger , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define PROCINFO_CLASS static #include diff --git a/elf/readelflib.c b/elf/readelflib.c new file mode 100644 index 0000000000..26444ad6b2 --- /dev/null +++ b/elf/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 , 1999 and + Jakub Jelinek , 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/elf/readlib.c b/elf/readlib.c index 4fbc3e5e4c..65c8e9d65d 100644 --- a/elf/readlib.c +++ b/elf/readlib.c @@ -1,22 +1,20 @@ -/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1999 and Jakub Jelinek , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* The code in this file and in readelflib is a heavily simplified version of the readelf program that's part of the current binutils diff --git a/elf/rtld.c b/elf/rtld.c index a89f89b3a5..aee3ea9a2a 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -90,6 +90,15 @@ INTDEF(_dl_argv) uintptr_t __stack_chk_guard attribute_relro; #endif +/* Only exported for architectures that don't store the pointer guard + value in thread local area. */ +uintptr_t __pointer_chk_guard_local + attribute_relro attribute_hidden __attribute__ ((nocommon)); +#ifndef THREAD_SET_POINTER_GUARD +strong_alias (__pointer_chk_guard_local, __pointer_chk_guard) +#endif + + /* List of auditing DSOs. */ static struct audit_list { @@ -142,6 +151,7 @@ struct rtld_global_ro _rtld_global_ro attribute_relro = ._dl_hwcap_mask = HWCAP_IMPORTANT, ._dl_lazy = 1, ._dl_fpu_control = _FPU_DEFAULT, + ._dl_pointer_guard = 1, /* Function pointers. */ ._dl_debug_printf = _dl_debug_printf, @@ -1823,6 +1833,22 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", __stack_chk_guard = stack_chk_guard; #endif + /* Set up the pointer guard as well, if necessary. */ + if (GLRO(dl_pointer_guard)) + { + // XXX If it is cheap, we should use a separate value. + uintptr_t pointer_chk_guard = stack_chk_guard; +#ifndef HP_TIMING_NONAVAIL + hp_timing_t now; + HP_TIMING_NOW (now); + pointer_chk_guard ^= now; +#endif +#ifdef THREAD_SET_POINTER_GUARD + THREAD_SET_POINTER_GUARD (pointer_chk_guard); +#endif + __pointer_chk_guard_local = pointer_chk_guard; + } + if (__builtin_expect (mode, normal) != normal) { /* We were run just to list the shared libraries. It is @@ -2575,7 +2601,13 @@ process_envvars (enum mode *modep) #endif if (!INTUSE(__libc_enable_secure) && memcmp (envline, "USE_LOAD_BIAS", 13) == 0) - GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0; + { + GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0; + break; + } + + if (memcmp (envline, "POINTER_GUARD", 13) == 0) + GLRO(dl_pointer_guard) = envline[14] == '0'; break; case 14: diff --git a/fedora/branch.mk b/fedora/branch.mk index c65d6d075e..991d75fc73 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc4 -fedora-sync-date := 2005-11-19 19:59 UTC -fedora-sync-tag := fedora-glibc-20051119T1959 +fedora-sync-date := 2005-12-19 10:03 UTC +fedora-sync-tag := fedora-glibc-20051219T1003 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index 29ecf0e1fe..6ea4c95d97 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1,4 +1,4 @@ -%define glibcrelease 18 +%define glibcrelease 19 %define auxarches i586 i686 athlon sparcv9 alphaev6 %define prelinkarches noarch %define xenarches i686 athlon @@ -30,7 +30,7 @@ Patch1: %{name}-ppc-assume.patch Patch2: %{name}-ia64-lib64.patch Buildroot: %{_tmppath}/glibc-%{PACKAGE_VERSION}-root Obsoletes: zoneinfo, libc-static, libc-devel, libc-profile, libc-headers, -Obsoletes: gencat, locale, ldconfig, locale-ja +Obsoletes: gencat, locale, ldconfig, locale-ja, glibc-profile Provides: ldconfig Autoreq: false Requires: glibc-common = %{version}-%{release} @@ -150,24 +150,6 @@ executables. Install glibc-headers if you are going to develop programs which will use the standard C libraries. -%package profile -Summary: The GNU libc libraries, including support for gprof profiling. -Group: Development/Libraries -Obsoletes: libc-profile -Autoreq: true - -%description profile -The glibc-profile package includes the GNU libc libraries and support -for profiling using the gprof program. Profiling is analyzing a -program's functions to see how much CPU time they use and determining -which functions are calling other functions during execution. To use -gprof to profile a program, your program needs to use the GNU libc -libraries included in glibc-profile (instead of the standard GNU libc -libraries included in the glibc package). - -If you are going to use the gprof program to profile a program, you'll -need to install the glibc-profile package. - %package common Summary: Common binaries and locale data for glibc Conflicts: %{name} < %{version} @@ -503,7 +485,8 @@ CC="$GCC" CFLAGS="$build_CFLAGS" ../configure --prefix=%{_prefix} \ --enable-add-ons=nptl$AddOns --without-cvs $EnableKernel \ --with-headers=%{_prefix}/include --enable-bind-now \ --with-tls --with-__thread --build %{nptl_target_cpu}-redhat-linux \ - --host %{nptl_target_cpu}-redhat-linux + --host %{nptl_target_cpu}-redhat-linux \ + --disable-profile make %{?_smp_mflags} -r CFLAGS="$build_CFLAGS" PARALLELMFLAGS=-s cd .. @@ -512,7 +495,6 @@ cd .. build_nptl linuxnptl %if %{buildxen} -EnableKernel="$EnableKernel --disable-profile" build_nptl linuxnptl-nosegneg -mno-tls-direct-seg-refs %endif @@ -691,7 +673,6 @@ for i in $RPM_BUILD_ROOT%{_prefix}/bin/{xtrace,memusage}; do chmod 755 $i; rm -f $i.tmp done -grep '%{_prefix}/%{_lib}/lib.*_p\.a' < rpm.filelist > profile.filelist || : grep '%{_infodir}' < rpm.filelist | grep -v '%{_infodir}/dir' > devel.filelist grep '%{_prefix}/include/gnu/stubs-[32164]\+\.h' < rpm.filelist >> devel.filelist || : @@ -934,7 +915,7 @@ case "$-" in *x*) save_trace=yes;; esac set +x echo Cutting down the list of unpackaged files for i in `sed '/%%dir/d;/%%config/d;/%%verify/d;s/%%lang([^)]*) //' \ - common.filelist devel.filelist headers.filelist profile.filelist \ + common.filelist devel.filelist headers.filelist \ utils.filelist nscd.filelist`; do [ -f "$RPM_BUILD_ROOT$i" ] && rm -f "$RPM_BUILD_ROOT$i" || : done @@ -1051,9 +1032,6 @@ rm -f *.filelist* %files -f headers.filelist headers %defattr(-,root,root) -%files -f profile.filelist profile -%defattr(-,root,root) - %files -f utils.filelist utils %defattr(-,root,root) @@ -1095,6 +1073,14 @@ rm -f *.filelist* %endif %changelog +* Mon Dec 19 2005 Jakub Jelinek 2.3.90-19 +- update from CVS + - sysdeps/generic reorg + - setjmp/longjmp jump pointer mangling +- rebuilt with GCC 4.1-RH prerelease, worked around broken _Pragma () + handling in it +- remove glibc-profile subpackage + * Sat Nov 19 2005 Jakub Jelinek 2.3.90-18 - update from CVS - change for broken apps that #define const /**/, diff --git a/gmon/bb_init_func.c b/gmon/bb_init_func.c new file mode 100644 index 0000000000..19901d8d09 --- /dev/null +++ b/gmon/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 +#include + +#include + +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/gmon/prof-freq.c b/gmon/prof-freq.c new file mode 100644 index 0000000000..ffcc67931b --- /dev/null +++ b/gmon/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 +#include +#include + +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/gmon/profil.c b/gmon/profil.c new file mode 100644 index 0000000000..8736375858 --- /dev/null +++ b/gmon/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 +#include +#include + +/* 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 diff --git a/gmon/sprofil.c b/gmon/sprofil.c new file mode 100644 index 0000000000..037ed4672e --- /dev/null +++ b/gmon/sprofil.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by David Mosberger-Tang . + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include +#include + +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/grp/setgroups.c b/grp/setgroups.c new file mode 100644 index 0000000000..74bae72974 --- /dev/null +++ b/grp/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 +#include +#include + +/* 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 diff --git a/hurd/exc2signal.c b/hurd/exc2signal.c new file mode 100644 index 0000000000..de044bbcf4 --- /dev/null +++ b/hurd/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 + +/* 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/hurd/hurdmalloc.c b/hurd/hurdmalloc.c index 4839d98535..12da1f2abc 100644 --- a/hurd/hurdmalloc.c +++ b/hurd/hurdmalloc.c @@ -33,63 +33,7 @@ * the rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.15 2001/09/19 03:04:09 drepper - * (bcopy): Removed. - * (realloc): Replace bcopy with memcpy. - * - * Revision 1.14 2001/04/01 05:03:14 roland - * 2001-03-11 Roland McGrath - * - * * mach/mach_error.h: Fix ancient #endif syntax. - * * hurd/hurdmalloc.c: Likewise. - * - * Revision 1.13 1996/12/20 01:32:01 drepper - * Update from main archive 961219 - * - * Revision 1.12 1996/11/15 19:44:13 thomas - * Tue Nov 12 16:58:41 1996 Thomas Bushnell, n/BSG - * - * * mach/msg-destroy.c (mach_msg_destroy_port, - * mach_msg_destroy_memory): Use prototype syntax. - * * hurd/hurdmalloc.c (more_memory, malloc_fork_prepare, - * malloc_fork_parent, malloc_fork_child): Likewise. - * - * Revision 1.11 1996/06/06 15:13:47 miles - * Changes to bring in line with the hurd libthreads/malloc.c: - * (more_memory): Use assert_perror instead of MACH_CALL. - * "cthread_internals.h": Include removed. - * (realloc): Use LOG2_MIN_SIZE. - * (LOG2_MIN_SIZE): New macro. - * (realloc): Don't bother allocating a new block if the - * new size request fits in the old one and doesn't waste any space. - * Only free the old block if we successfully got a new one. - * [MCHECK] (struct header): New type. - * (union header): Only define if !MCHECK. - * (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros. - * [MCHECK] (MIN_SIZE): Add correct definition for this case. - * (more_memory, malloc, free, realloc): Use above macros, and add - * appropriate checks & frobs in MCHECK case. - * - * Revision 1.6 1996/03/07 21:13:08 miles - * (realloc): - * Use LOG2_MIN_SIZE. - * Don't bother allocating a new block if the new size request fits in the old - * one and doesn't waste any space. - * Only free the old block if we successfully got a new one. - * (LOG2_MIN_SIZE): New macro. - * - * Revision 1.5 1996/03/06 23:51:04 miles - * [MCHECK] (struct header): New type. - * (union header): Only define if !MCHECK. - * (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros. - * [MCHECK] (MIN_SIZE): Add correct definition for this case. - * (more_memory, malloc, free, realloc): - * Use above macros, and add appropriate checks & frobs in MCHECK case. - * - * Revision 1.4 1994/05/05 11:21:42 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.7 91/05/14 17:57:34 mrt * Correcting copyright diff --git a/hurd/longjmp-ts.c b/hurd/longjmp-ts.c new file mode 100644 index 0000000000..e9c297a20b --- /dev/null +++ b/hurd/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 +#include + +/* 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/hurd/trampoline.c b/hurd/trampoline.c new file mode 100644 index 0000000000..7045a0d0ab --- /dev/null +++ b/hurd/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 +#include + +/* 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/iconv/dummy-repertoire.c b/iconv/dummy-repertoire.c index a195460f9a..a87685c505 100644 --- a/iconv/dummy-repertoire.c +++ b/iconv/dummy-repertoire.c @@ -1,21 +1,19 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2001. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* For iconv we don't have to handle repertoire maps. Provide dummy definitions to allow the use of linereader.c unchanged. */ diff --git a/iconv/gconv.c b/iconv/gconv.c index f3f49b7db3..cd43d3d6fb 100644 --- a/iconv/gconv.c +++ b/iconv/gconv.c @@ -1,6 +1,6 @@ /* Convert characters in input buffer using conversion descriptor to output buffer. - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1997-2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -20,10 +20,13 @@ 02111-1307 USA. */ #include -#include -#include #include #include +#include + +#include +#include + int internal_function @@ -45,9 +48,15 @@ __gconv (__gconv_t cd, const unsigned char **inbuf, cd->__data[last_step].__outbuf = outbuf != NULL ? *outbuf : NULL; cd->__data[last_step].__outbufend = outbufend; + __gconv_fct fct = cd->__steps->__fct; +#ifdef PTR_DEMANGLE + if (cd->__steps->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + if (inbuf == NULL || *inbuf == NULL) /* We just flush. */ - result = DL_CALL_FCT (cd->__steps->__fct, + result = DL_CALL_FCT (fct, (cd->__steps, cd->__data, NULL, NULL, NULL, irreversible, cd->__data[last_step].__outbuf == NULL ? 2 : 1, 0)); @@ -60,7 +69,7 @@ __gconv (__gconv_t cd, const unsigned char **inbuf, do { last_start = *inbuf; - result = DL_CALL_FCT (cd->__steps->__fct, + result = DL_CALL_FCT (fct, (cd->__steps, cd->__data, inbuf, inbufend, NULL, irreversible, 0, 0)); } diff --git a/iconv/gconv_builtin.c b/iconv/gconv_builtin.c index f653d6c7f3..d8beabd416 100644 --- a/iconv/gconv_builtin.c +++ b/iconv/gconv_builtin.c @@ -1,5 +1,5 @@ /* Table for builtin transformation mapping. - Copyright (C) 1997-1999, 2000-2002 Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2000-2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -27,16 +28,16 @@ #include -static struct builtin_map +static const struct builtin_map { const char *name; __gconv_fct fct; __gconv_btowc_fct btowc_fct; - int min_needed_from; - int max_needed_from; - int min_needed_to; - int max_needed_to; + int8_t min_needed_from; + int8_t max_needed_from; + int8_t min_needed_to; + int8_t max_needed_to; } map[] = { diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index 8dc6b14d25..3431ce0812 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -1,5 +1,5 @@ /* Provide access to the collection of available transformation modules. - Copyright (C) 1997-2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1997-2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -18,6 +18,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -28,6 +29,7 @@ #include #include +#include /* Simple data structure for alias mapping. We have two names, `from' @@ -180,7 +182,15 @@ free_derivation (void *p) for (cnt = 0; cnt < deriv->nsteps; ++cnt) if (deriv->steps[cnt].__counter > 0 && deriv->steps[cnt].__end_fct != NULL) - DL_CALL_FCT (deriv->steps[cnt].__end_fct, (&deriv->steps[cnt])); + { + assert (deriv->steps[cnt].__shlib_handle != NULL); + + __gconv_end_fct end_fct = deriv->steps[cnt].__end_fct; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (end_fct); +#endif + DL_CALL_FCT (end_fct, (&deriv->steps[cnt])); + } /* Free the name strings. */ free ((char *) deriv->steps[0].__from_name); @@ -196,22 +206,30 @@ void internal_function __gconv_release_step (struct __gconv_step *step) { - if (--step->__counter == 0) + /* Skip builtin modules; they are not reference counted. */ + if (step->__shlib_handle != NULL && --step->__counter == 0) { /* Call the destructor. */ if (step->__end_fct != NULL) - DL_CALL_FCT (step->__end_fct, (step)); - -#ifndef STATIC_GCONV - /* Skip builtin modules; they are not reference counted. */ - if (step->__shlib_handle != NULL) { - /* Release the loaded module. */ - __gconv_release_shlib (step->__shlib_handle); - step->__shlib_handle = NULL; + assert (step->__shlib_handle != NULL); + + __gconv_end_fct end_fct = step->__end_fct; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (end_fct); +#endif + DL_CALL_FCT (end_fct, (step)); } + +#ifndef STATIC_GCONV + /* Release the loaded module. */ + __gconv_release_shlib (step->__shlib_handle); + step->__shlib_handle = NULL; #endif } + else + /* Builtin modules should not have end functions. */ + assert (step->__end_fct == NULL); } static int @@ -272,10 +290,15 @@ gen_steps (struct derivation_step *best, const char *toset, result[step_cnt].__btowc_fct = NULL; /* Call the init function. */ - if (result[step_cnt].__init_fct != NULL) + __gconv_init_fct init_fct = result[step_cnt].__init_fct; + if (init_fct != NULL) { - status = DL_CALL_FCT (result[step_cnt].__init_fct, - (&result[step_cnt])); + assert (result[step_cnt].__shlib_handle != NULL); + +# ifdef PTR_DEMANGLE + PTR_DEMANGLE (init_fct); +# endif + status = DL_CALL_FCT (init_fct, (&result[step_cnt])); if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK) { @@ -285,6 +308,11 @@ gen_steps (struct derivation_step *best, const char *toset, result[step_cnt].__end_fct = NULL; break; } + +# ifdef PTR_MANGLE + if (result[step_cnt].__btowc_fct != NULL) + PTR_MANGLE (result[step_cnt].__btowc_fct); +# endif } } else @@ -362,8 +390,19 @@ increment_counter (struct __gconv_step *steps, size_t nsteps) } /* Call the init function. */ - if (step->__init_fct != NULL) - DL_CALL_FCT (step->__init_fct, (step)); + __gconv_init_fct init_fct = step->__init_fct; + if (init_fct != NULL) + { +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (init_fct); +#endif + DL_CALL_FCT (init_fct, (step)); + +#ifdef PTR_MANGLE + if (step->__btowc_fct != NULL) + PTR_MANGLE (step->__btowc_fct); +#endif + } } } return result; diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c index 9504017210..8217b7e553 100644 --- a/iconv/gconv_dl.c +++ b/iconv/gconv_dl.c @@ -1,5 +1,5 @@ /* Handle loading/unloading of shared object for transformation. - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -29,6 +29,7 @@ #include #include +#include #ifdef DEBUG @@ -130,6 +131,14 @@ __gconv_find_shlib (const char *name) found->init_fct = __libc_dlsym (found->handle, "gconv_init"); found->end_fct = __libc_dlsym (found->handle, "gconv_end"); +#ifdef PTR_MANGLE + PTR_MANGLE (found->fct); + if (found->init_fct != NULL) + PTR_MANGLE (found->init_fct); + if (found->end_fct != NULL) + PTR_MANGLE (found->end_fct); +#endif + /* We have succeeded in loading the shared object. */ found->counter = 1; } diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c index 03a8f5fa23..b83081efca 100644 --- a/iconv/iconv_charmap.c +++ b/iconv/iconv_charmap.c @@ -1,22 +1,20 @@ /* Convert using charmaps and possibly iconv(). - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2001. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index 5b3d35ecaa..a7036af99c 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c index df66f11f08..96a86191e9 100644 --- a/iconv/iconvconfig.c +++ b/iconv/iconvconfig.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2000. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/iconv/skeleton.c b/iconv/skeleton.c index c74935693f..baace6b3fb 100644 --- a/iconv/skeleton.c +++ b/iconv/skeleton.c @@ -144,6 +144,8 @@ # include #endif +#include + #ifndef DL_CALL_FCT # define DL_CALL_FCT(fct, args) fct args #endif @@ -393,10 +395,17 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data, { struct __gconv_step *next_step = step + 1; struct __gconv_step_data *next_data = data + 1; - __gconv_fct fct; + __gconv_fct fct = NULL; int status; - fct = (data->__flags & __GCONV_IS_LAST) ? NULL : next_step->__fct; + if ((data->__flags & __GCONV_IS_LAST) == 0) + { + fct = next_step->__fct; +#ifdef PTR_DEMANGLE + if (next_step->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + } /* If the function is called with no input this means we have to reset to the initial state. The possibly partly converted input is diff --git a/include/dirent.h b/include/dirent.h index 4e95ffd6cd..681024fd02 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -25,6 +25,6 @@ extern int __alphasort64 (const void *a, const void *b) __attribute_pure__; extern int __versionsort64 (const void *a, const void *b) __attribute_pure__; -extern DIR *__alloc_dir (int fd, bool close_fd, struct stat64 *statp) +extern DIR *__alloc_dir (int fd, bool close_fd, const struct stat64 *statp) internal_function; #endif diff --git a/include/fcntl.h b/include/fcntl.h index 6080faba3e..610e322cfd 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -21,5 +21,8 @@ libc_hidden_proto (__fcntl) /* Helper functions for the various *at functions. For Linux. */ extern void __atfct_seterrno (int errval, int fd, const char *buf) attribute_hidden; +extern void __atfct_seterrno_2 (int errval, int fd1, const char *buf1, + int fd2, const char *buf2) + attribute_hidden; #endif diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h new file mode 100644 index 0000000000..abe09769cc --- /dev/null +++ b/include/sys/sendfile.h @@ -0,0 +1 @@ +#include diff --git a/include/sys/stat.h b/include/sys/stat.h index 2e2566d9ef..4a4d05d938 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -29,6 +29,7 @@ extern __inline__ int __mknod (__const char *__path, __mode_t __mode, { return __xmknod (_MKNOD_VER, __path, __mode, &__dev); } +libc_hidden_proto (__xmknodat) /* The `stat', `fstat', `lstat' functions have to be handled special since diff --git a/inet/check_pf.c b/inet/check_pf.c new file mode 100644 index 0000000000..5d98c98aff --- /dev/null +++ b/inet/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 +#include + + +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/inet/getipv4sourcefilter.c b/inet/getipv4sourcefilter.c new file mode 100644 index 0000000000..e95697778a --- /dev/null +++ b/inet/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 , 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 +#include + + +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/inet/getsourcefilter.c b/inet/getsourcefilter.c new file mode 100644 index 0000000000..373550beb3 --- /dev/null +++ b/inet/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 , 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 +#include + + +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/inet/herrno-loc.c b/inet/herrno-loc.c new file mode 100644 index 0000000000..fd6deeb330 --- /dev/null +++ b/inet/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 +#include + +#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/inet/htonl.c b/inet/htonl.c new file mode 100644 index 0000000000..dfee1b0545 --- /dev/null +++ b/inet/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 + +#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/inet/htons.c b/inet/htons.c new file mode 100644 index 0000000000..95c94de8a3 --- /dev/null +++ b/inet/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 + +#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/inet/if_index.c b/inet/if_index.c new file mode 100644 index 0000000000..f217f37642 --- /dev/null +++ b/inet/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 +#include +#include + +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 + +#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/inet/ifaddrs.c b/inet/ifaddrs.c new file mode 100644 index 0000000000..330aae3b39 --- /dev/null +++ b/inet/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 +#include +#include + +/* 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/inet/ifreq.c b/inet/ifreq.c new file mode 100644 index 0000000000..55e833bdb3 --- /dev/null +++ b/inet/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 . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with 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/inet/setipv4sourcefilter.c b/inet/setipv4sourcefilter.c new file mode 100644 index 0000000000..db2b8433bb --- /dev/null +++ b/inet/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 , 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 +#include + + +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/inet/setsourcefilter.c b/inet/setsourcefilter.c new file mode 100644 index 0000000000..870f5e2c38 --- /dev/null +++ b/inet/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 , 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 +#include + + +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/io/Makefile b/io/Makefile index 9339ffe699..4731e24d24 100644 --- a/io/Makefile +++ b/io/Makefile @@ -28,13 +28,14 @@ headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \ routines := \ utime \ - mkfifo \ - stat fstat lstat mknod stat64 fstat64 lstat64 fstatat fstatat64 \ - xstat fxstat lxstat xmknod xstat64 fxstat64 lxstat64 \ + mkfifo mkfifoat \ + stat fstat lstat stat64 fstat64 lstat64 fstatat fstatat64 \ + xstat fxstat lxstat xstat64 fxstat64 lxstat64 \ + mknod mknodat xmknod xmknodat \ fxstatat fxstatat64 \ statfs fstatfs statfs64 fstatfs64 \ statvfs fstatvfs statvfs64 fstatvfs64 \ - umask chmod fchmod lchmod mkdir \ + umask chmod fchmod lchmod mkdir mkdirat \ open open64 openat openat64 close \ read write lseek lseek64 access euidaccess \ fcntl flock lockf lockf64 \ @@ -44,7 +45,7 @@ routines := \ getcwd getwd getdirname \ chown fchown lchown fchownat \ ttyname ttyname_r isatty \ - link symlink readlink \ + link linkat symlink symlinkat readlink readlinkat \ unlink unlinkat rmdir \ ftw ftw64 fts poll \ posix_fadvise posix_fadvise64 \ @@ -54,8 +55,8 @@ routines := \ # These routines will be omitted from the libc shared object. # Instead the static object files will be included in a special archive # linked against when the shared library will be used. -static-only-routines = stat fstat lstat mknod stat64 fstat64 lstat64 \ - fstatat fstatat64 +static-only-routines = stat fstat lstat stat64 fstat64 lstat64 \ + fstatat fstatat64 mknod mknodat others := pwd test-srcs := ftwtest diff --git a/io/Versions b/io/Versions index 65ee77182e..2f0f94f3bb 100644 --- a/io/Versions +++ b/io/Versions @@ -100,7 +100,11 @@ libc { GLIBC_2.4 { fchownat; __fxstatat; __fxstatat64; + linkat; + mkdirat; mkfifoat; __xmknodat; openat; openat64; + readlinkat; + symlinkat; unlinkat; } } diff --git a/io/access.c b/io/access.c new file mode 100644 index 0000000000..c266e945a9 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/chdir.c b/io/chdir.c new file mode 100644 index 0000000000..afaeef8787 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/chmod.c b/io/chmod.c new file mode 100644 index 0000000000..38b05127c9 --- /dev/null +++ b/io/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 +#include +#include +#include + +/* 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 diff --git a/io/chown.c b/io/chown.c new file mode 100644 index 0000000000..0e368f2ac4 --- /dev/null +++ b/io/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 +#include +#include +#include + +/* 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 diff --git a/io/close.c b/io/close.c new file mode 100644 index 0000000000..0856ba851b --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/creat.c b/io/creat.c new file mode 100644 index 0000000000..462882415c --- /dev/null +++ b/io/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 +#include +#include + +#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/io/creat64.c b/io/creat64.c new file mode 100644 index 0000000000..39f4580571 --- /dev/null +++ b/io/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 +#include + +#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/io/dup.c b/io/dup.c new file mode 100644 index 0000000000..5d5e1b4cd5 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/dup2.c b/io/dup2.c new file mode 100644 index 0000000000..2b897896f6 --- /dev/null +++ b/io/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 +#include +#include + + +/* 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 diff --git a/io/euidaccess.c b/io/euidaccess.c new file mode 100644 index 0000000000..028fe9085c --- /dev/null +++ b/io/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 +#include +#include + +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 diff --git a/io/fchdir.c b/io/fchdir.c new file mode 100644 index 0000000000..db1e4f8f35 --- /dev/null +++ b/io/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 +#include +#include + +/* Change the current directory to FD. */ +int +fchdir (fd) + int fd; +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (fchdir) +#include diff --git a/io/fchmod.c b/io/fchmod.c new file mode 100644 index 0000000000..4b5eacb3eb --- /dev/null +++ b/io/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 +#include +#include +#include + +/* 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 diff --git a/io/fchown.c b/io/fchown.c new file mode 100644 index 0000000000..e0d42dd293 --- /dev/null +++ b/io/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 +#include +#include +#include + +/* 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 diff --git a/io/fchownat.c b/io/fchownat.c new file mode 100644 index 0000000000..f6921c9012 --- /dev/null +++ b/io/fchownat.c @@ -0,0 +1,51 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +/* Change the owner and group of FILE. */ +int +fchownat (fd, file, owner, group, flag) + int fd; + const char *file; + uid_t owner; + gid_t group; + int flag; +{ + if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) + { + __set_errno (EINVAL); + return -1; + } + + if (fd < 0 && fd != AT_FDCWD) + { + __set_errno (EBADF); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (fchownat) + +#include diff --git a/io/fcntl.c b/io/fcntl.c new file mode 100644 index 0000000000..db6fbc399c --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/flock.c b/io/flock.c new file mode 100644 index 0000000000..db3bfcfcbe --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/fstatfs.c b/io/fstatfs.c new file mode 100644 index 0000000000..4a1a996cbc --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/fstatfs64.c b/io/fstatfs64.c new file mode 100644 index 0000000000..249b97ea44 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/fstatvfs.c b/io/fstatvfs.c new file mode 100644 index 0000000000..c5f75a7c97 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/fstatvfs64.c b/io/fstatvfs64.c new file mode 100644 index 0000000000..47d4e266e2 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/fxstat.c b/io/fxstat.c new file mode 100644 index 0000000000..b750daca63 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/fxstat64.c b/io/fxstat64.c new file mode 100644 index 0000000000..865ba49484 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/fxstatat.c b/io/fxstatat.c new file mode 100644 index 0000000000..62f7fe3efb --- /dev/null +++ b/io/fxstatat.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +/* Get information about the file descriptor FD in BUF. */ +int +__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag) +{ + if (vers != _STAT_VER) + { + __set_errno (EINVAL); + return -1; + } + + if (fd < 0 && fd != AT_FDCWD) + { + __set_errno (EBADF); + return -1; + } + if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) + { + __set_errno (EINVAL); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (fstatat) +#include diff --git a/io/fxstatat64.c b/io/fxstatat64.c new file mode 100644 index 0000000000..ba95b73e81 --- /dev/null +++ b/io/fxstatat64.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +/* Get information about the file descriptor FD in BUF. */ +int +__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf, + int flag) +{ + if (vers != _STAT_VER) + { + __set_errno (EINVAL); + return -1; + } + + if (fd < 0 && fd != AT_FDCWD) + { + __set_errno (EBADF); + return -1; + } + if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) + { + __set_errno (EINVAL); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (fstatat64) +#include diff --git a/io/getcwd.c b/io/getcwd.c new file mode 100644 index 0000000000..c472d1d7a6 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/isatty.c b/io/isatty.c new file mode 100644 index 0000000000..9b0410c614 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/lchmod.c b/io/lchmod.c new file mode 100644 index 0000000000..524b24c1ed --- /dev/null +++ b/io/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 +#include +#include + +/* Change the protections of FILE to MODE. */ +int +lchmod (const char *file, mode_t mode) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (lchmod) +#include diff --git a/io/lchown.c b/io/lchown.c new file mode 100644 index 0000000000..4e0330e526 --- /dev/null +++ b/io/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 +#include +#include +#include + +/* 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 diff --git a/io/link.c b/io/link.c new file mode 100644 index 0000000000..70c9949704 --- /dev/null +++ b/io/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 +#include +#include + + +/* 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 diff --git a/io/linkat.c b/io/linkat.c new file mode 100644 index 0000000000..6420d50334 --- /dev/null +++ b/io/linkat.c @@ -0,0 +1,51 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +/* Make a link to FROM relative to FROMFD called TO relative to TOFD. */ +int +linkat (fromfd, from, tofd, to) + int fromfd; + const char *from; + int tofd; + const char *to; +{ + if (from == NULL || to == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if ((tofd != AT_FDCWD && tofd < 0 && *to != '/') + || (fromfd != AT_FDCWD && fromfd < 0 && *from != '/')) + { + __set_errno (EBADF); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (linkat) + +#include diff --git a/io/lockf.c b/io/lockf.c new file mode 100644 index 0000000000..7b23f66bc9 --- /dev/null +++ b/io/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 +#include +#include +#include +#include + +/* 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/io/lockf64.c b/io/lockf64.c new file mode 100644 index 0000000000..e3b110cd3f --- /dev/null +++ b/io/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 +#include +#include +#include +#include + +/* 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/io/lseek64.c b/io/lseek64.c new file mode 100644 index 0000000000..d0a8cff03e --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/lxstat.c b/io/lxstat.c new file mode 100644 index 0000000000..23d4442b5c --- /dev/null +++ b/io/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 + +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/io/lxstat64.c b/io/lxstat64.c new file mode 100644 index 0000000000..596ecd2277 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/mkdir.c b/io/mkdir.c new file mode 100644 index 0000000000..8037dfb3ee --- /dev/null +++ b/io/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 +#include +#include +#include + + +/* 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 diff --git a/io/mkdirat.c b/io/mkdirat.c new file mode 100644 index 0000000000..ccea3aa8d8 --- /dev/null +++ b/io/mkdirat.c @@ -0,0 +1,58 @@ +/* Copyright (C) 1991, 1995, 1996, 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + + +/* Create a directory named PATH relative to FD with protections MODE. */ +int +mkdirat (fd, path, mode) + int fd; + const char *path; + mode_t mode; +{ + if (path == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (fd != AT_FDCWD && path[0] != '/') + { + /* Check FD is associated with a directory. */ + struct stat64 st; + if (__fxstat64 (_STAT_VER, fd, &st) != 0) + return -1; + + if (!S_ISDIR (st.st_mode)) + { + __set_errno (ENOTDIR); + return -1; + } + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (mkdirat) + +#include diff --git a/io/mkfifo.c b/io/mkfifo.c new file mode 100644 index 0000000000..614ebe97c3 --- /dev/null +++ b/io/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 +#include +#include +#include + + +/* 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 diff --git a/io/mkfifoat.c b/io/mkfifoat.c new file mode 100644 index 0000000000..48c38c8182 --- /dev/null +++ b/io/mkfifoat.c @@ -0,0 +1,60 @@ +/* Copyright (C) 1991, 1995, 1996, 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + + +/* Create a named pipe (FIFO) named PATH relative to FD with + protections MODE. */ +int +mkfifoat (fd, path, mode) + int fd; + const char *path; + mode_t mode; +{ + if (path == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (fd != AT_FDCWD && path[0] != '/') + { + /* Check FD is associated with a directory. */ + struct stat64 st; + if (__fxstat64 (_STAT_VER, fd, &st) != 0) + return -1; + + if (!S_ISDIR (st.st_mode)) + { + __set_errno (ENOTDIR); + return -1; + } + } + + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (mkfifoat) +#include diff --git a/io/mknod.c b/io/mknod.c new file mode 100644 index 0000000000..7d43593a25 --- /dev/null +++ b/io/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 +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . 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/io/mknodat.c b/io/mknodat.c new file mode 100644 index 0000000000..ac515b5b48 --- /dev/null +++ b/io/mknodat.c @@ -0,0 +1,60 @@ +/* Copyright (C) 1995, 1996, 2001, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser 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 +#include + +/* This definition is only used if inlining fails for this function; see + the last page of . 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 +mknodat (int fd, const char *path, mode_t mode, dev_t dev) +{ + return __xmknodat (_MKNOD_VER, fd, path, mode, &dev); +} + + +/* Hide the symbol so that no definition but the one locally in the + executable or DSO is used. */ +#ifdef HAVE_DOT_HIDDEN +asm (".hidden\tmknodat"); +#endif diff --git a/io/open.c b/io/open.c new file mode 100644 index 0000000000..188110b3f3 --- /dev/null +++ b/io/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 +#include +#include +#include + +/* 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 diff --git a/io/open64.c b/io/open64.c new file mode 100644 index 0000000000..d9a38112ac --- /dev/null +++ b/io/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 +#include +#include +#include +#include + +/* 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 diff --git a/io/openat.c b/io/openat.c new file mode 100644 index 0000000000..f3f699ca23 --- /dev/null +++ b/io/openat.c @@ -0,0 +1,69 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +/* Open FILE with access OFLAG. Interpret relative paths relative to + the directory associated with FD. If OFLAG includes O_CREAT, a + third argument is the file protection. */ +int +openat (fd, file, oflag) + int fd; + const char *file; + int oflag; +{ + int mode; + + if (file == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (fd != AT_FDCWD && file[0] != '/') + { + /* Check FD is associated with a directory. */ + struct stat64 st; + if (__fxstat64 (_STAT_VER, fd, &st) != 0) + return -1; + + if (!S_ISDIR (st.st_mode)) + { + __set_errno (ENOTDIR); + 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; +} +stub_warning (openat) + +#include diff --git a/io/openat64.c b/io/openat64.c new file mode 100644 index 0000000000..87952d38d6 --- /dev/null +++ b/io/openat64.c @@ -0,0 +1,69 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +/* Open FILE with access OFLAG. Interpret relative paths relative to + the directory associated with FD. If OFLAG includes O_CREAT, a + third argument is the file protection. */ +int +openat64 (fd, file, oflag) + int fd; + const char *file; + int oflag; +{ + int mode; + + if (file == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (fd != AT_FDCWD && file[0] != '/') + { + /* Check FD is associated with a directory. */ + struct stat64 st; + if (__fxstat64 (_STAT_VER, fd, &st) != 0) + return -1; + + if (!S_ISDIR (st.st_mode)) + { + __set_errno (ENOTDIR); + 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; +} +stub_warning (openat64) + +#include diff --git a/io/pipe.c b/io/pipe.c new file mode 100644 index 0000000000..babaf9c24b --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/poll.c b/io/poll.c new file mode 100644 index 0000000000..9f2f191764 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/posix_fadvise.c b/io/posix_fadvise.c new file mode 100644 index 0000000000..92f8bb8974 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/posix_fadvise64.c b/io/posix_fadvise64.c new file mode 100644 index 0000000000..e7eae5e6e3 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/posix_fallocate.c b/io/posix_fallocate.c new file mode 100644 index 0000000000..218b4adbe3 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/posix_fallocate64.c b/io/posix_fallocate64.c new file mode 100644 index 0000000000..80c1cd385d --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/read.c b/io/read.c new file mode 100644 index 0000000000..3943edd689 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/readlink.c b/io/readlink.c new file mode 100644 index 0000000000..779b809eaa --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/readlinkat.c b/io/readlinkat.c new file mode 100644 index 0000000000..c6a032c474 --- /dev/null +++ b/io/readlinkat.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +/* Read the contents of the symbolic link PATH relative to FD 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 +readlinkat (fd, path, buf, len) + int fd; + const char *path; + char *buf; + size_t len; +{ + if (path == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (fd != AT_FDCWD && fd < 0 && *path != '/') + { + __set_errno (EBADF); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (readlinkat) + +#include diff --git a/io/rmdir.c b/io/rmdir.c new file mode 100644 index 0000000000..5a16fd4284 --- /dev/null +++ b/io/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 +#include +#include + + +/* 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 diff --git a/io/sendfile.c b/io/sendfile.c new file mode 100644 index 0000000000..98dc9a814d --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/sendfile64.c b/io/sendfile64.c new file mode 100644 index 0000000000..76b961e22a --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/statfs.c b/io/statfs.c new file mode 100644 index 0000000000..af4a9ea4e5 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/statfs64.c b/io/statfs64.c new file mode 100644 index 0000000000..cf1a7d82a4 --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/statvfs.c b/io/statvfs.c new file mode 100644 index 0000000000..22e24cfeeb --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/statvfs64.c b/io/statvfs64.c new file mode 100644 index 0000000000..4424abdbea --- /dev/null +++ b/io/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 +#include + +/* 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 diff --git a/io/symlink.c b/io/symlink.c new file mode 100644 index 0000000000..e6c6709f1a --- /dev/null +++ b/io/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 +#include +#include + + +/* 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 diff --git a/io/symlinkat.c b/io/symlinkat.c new file mode 100644 index 0000000000..5c2f3f553a --- /dev/null +++ b/io/symlinkat.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +/* Make a link to FROM called TO relative to FD. */ +int +symlinkat (from, fd, to) + const char *from; + int fd; + const char *to; +{ + if (from == NULL || to == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (fd != AT_FDCWD && fd < 0 && *to != '/') + { + __set_errno (EBADF); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (symlinkat) + +#include diff --git a/io/sys/stat.h b/io/sys/stat.h index 03152990e7..6ce3a1be66 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -233,20 +233,23 @@ extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); Relative path names are interpreted relative to FD unless FD is AT_FDCWD. */ # ifndef __USE_FILE_OFFSET64 -extern int fstatat (int __fd, __const char *__file, struct stat *__buf, - int __flag) __THROW __nonnull ((2, 3)); +extern int fstatat (int __fd, __const char *__restrict __file, + struct stat *__restrict __buf, int __flag) + __THROW __nonnull ((2, 3)); # else # ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__file, - struct stat *__buf, int __flag), +extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__restrict __file, + struct stat *__restrict __buf, + int __flag), fstatat64) __nonnull ((2, 3)); # else # define fstatat fstatat64 # endif # endif -extern int fstatat64 (int __fd, __const char *__file, struct stat64 *__buf, - int __flag) __THROW __nonnull ((2, 3)); +extern int fstatat64 (int __fd, __const char *__restrict __file, + struct stat64 *__restrict __buf, int __flag) + __THROW __nonnull ((2, 3)); #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED @@ -305,6 +308,14 @@ extern __mode_t getumask (void) __THROW; extern int mkdir (__const char *__path, __mode_t __mode) __THROW __nonnull ((1)); +#ifdef __USE_GNU +/* Like mkdir, create a new directory with permission bits MODE. But + interpret relative PATH names relative to the directory associated + with FD. */ +extern int mkdirat (int __fd, __const char *__path, __mode_t __mode) + __THROW __nonnull ((2)); +#endif + /* 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). */ @@ -313,10 +324,26 @@ extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev) __THROW __nonnull ((1)); #endif +#ifdef __USE_GNU +/* Like mknod, create a new device file with permission bits MODE and + device number DEV. But interpret relative PATH names relative to + the directory associated with FD. */ +extern int mknodat (int __fd, __const char *__path, __mode_t __mode, + __dev_t __dev) __THROW __nonnull ((2)); +#endif + /* Create a new FIFO named PATH, with permission bits MODE. */ extern int mkfifo (__const char *__path, __mode_t __mode) __THROW __nonnull ((1)); + +#ifdef __USE_GNU +/* Like mkfifo, create a new FIFO with permission bits MODE. But + interpret relative PATH names relative to the directory associated + with FD. */ +extern int mkfifoat (int __fd, __const char *__path, __mode_t __mode) + __THROW __nonnull ((2)); +#endif /* To allow the `struct stat' structure and the file type `mode_t' bits to vary without changing shared library major version number, @@ -388,6 +415,10 @@ extern int __fxstatat64 (int __ver, int __fildes, __const char *__filename, extern int __xmknod (int __ver, __const char *__path, __mode_t __mode, __dev_t *__dev) __THROW __nonnull ((2, 4)); +extern int __xmknodat (int __ver, int __fd, __const char *__path, + __mode_t __mode, __dev_t *__dev) + __THROW __nonnull ((3, 5)); + #if defined __GNUC__ && __GNUC__ >= 2 /* Inlined versions of the real stat and mknod functions. */ @@ -428,6 +459,15 @@ __NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev)) } # endif +# ifdef __USE_GNU +extern __inline__ int +__NTH (mknodat (int __fd, __const char *__path, __mode_t __mode, + __dev_t __dev)) +{ + return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev); +} +# endif + # if defined __USE_LARGEFILE64 \ && (! defined __USE_FILE_OFFSET64 \ || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) diff --git a/io/ttyname.c b/io/ttyname.c new file mode 100644 index 0000000000..088ba918a8 --- /dev/null +++ b/io/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 +#include +#include + + +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 diff --git a/io/ttyname_r.c b/io/ttyname_r.c new file mode 100644 index 0000000000..14c1209096 --- /dev/null +++ b/io/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 +#include + + +/* 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 diff --git a/io/umask.c b/io/umask.c new file mode 100644 index 0000000000..588d57e1ce --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/unlink.c b/io/unlink.c new file mode 100644 index 0000000000..1ec6d87ae1 --- /dev/null +++ b/io/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 +#include +#include + + +/* 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 diff --git a/io/unlinkat.c b/io/unlinkat.c new file mode 100644 index 0000000000..f9a08b9903 --- /dev/null +++ b/io/unlinkat.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +/* Remove the link named NAME. */ +int +unlinkat (fd, name, flag) + int fd; + const char *name; + int flag; +{ + if (name == NULL || (flag & AT_REMOVEDIR) != 0) + { + __set_errno (EINVAL); + return -1; + } + + if (fd < 0 && fd != AT_FDCWD) + { + __set_errno (EBADF); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (unlinkat) + +#include diff --git a/io/utime.c b/io/utime.c new file mode 100644 index 0000000000..3a3bcc38cc --- /dev/null +++ b/io/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 +#include +#include + + +/* 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 diff --git a/io/write.c b/io/write.c new file mode 100644 index 0000000000..928d43ced2 --- /dev/null +++ b/io/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 +#include +#include +#include + +/* 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 diff --git a/io/xmknod.c b/io/xmknod.c new file mode 100644 index 0000000000..c2daa46e07 --- /dev/null +++ b/io/xmknod.c @@ -0,0 +1,48 @@ +/* Copyright (C) 1991,1993,1995-1997,2002,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +/* 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; + } + + if (path == NULL) + { + __set_errno (EINVAL); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (__xmknod) + +weak_alias (__xmknod, _xmknod) +libc_hidden_def (__xmknod) +#include diff --git a/io/xmknodat.c b/io/xmknodat.c new file mode 100644 index 0000000000..56d88c7b0f --- /dev/null +++ b/io/xmknodat.c @@ -0,0 +1,63 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +/* Create a device file named PATH relative to FD, 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 +__xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev) +{ + if (vers != _MKNOD_VER) + { + __set_errno (EINVAL); + return -1; + } + + if (path == NULL) + { + __set_errno (EINVAL); + return -1; + } + + if (fd != AT_FDCWD && path[0] != '/') + { + /* Check FD is associated with a directory. */ + struct stat64 st; + if (__fxstat64 (_STAT_VER, fd, &st) != 0) + return -1; + + if (!S_ISDIR (st.st_mode)) + { + __set_errno (ENOTDIR); + return -1; + } + } + + __set_errno (ENOSYS); + return -1; +} +stub_warning (__xmknodat) + +libc_hidden_def (__xmknodat) +#include diff --git a/io/xstat.c b/io/xstat.c new file mode 100644 index 0000000000..e7328cc10e --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/io/xstat64.c b/io/xstat64.c new file mode 100644 index 0000000000..2fb94cf331 --- /dev/null +++ b/io/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 +#include +#include + +/* 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 diff --git a/libio/iofwide.c b/libio/iofwide.c index 7af9a633f8..a9936687dd 100644 --- a/libio/iofwide.c +++ b/libio/iofwide.c @@ -40,6 +40,7 @@ # include # include # include +# include #endif @@ -68,7 +69,7 @@ static int do_always_noconv (struct _IO_codecvt *codecvt); /* The functions used in `codecvt' for libio are always the same. */ -struct _IO_codecvt __libio_codecvt = +const struct _IO_codecvt __libio_codecvt = { .__codecvt_destr = NULL, /* Destructor, never used. */ .__codecvt_do_out = do_out, @@ -82,7 +83,7 @@ struct _IO_codecvt __libio_codecvt = #ifdef _LIBC -struct __gconv_trans_data __libio_translit attribute_hidden = +const struct __gconv_trans_data __libio_translit attribute_hidden = { .__trans_fct = __gconv_transliterate }; @@ -126,12 +127,11 @@ _IO_fwide (fp, mode) selected locale for LC_CTYPE. */ #ifdef _LIBC { - struct gconv_fcts fcts; - /* Clear the state. We start all over again. */ memset (&fp->_wide_data->_IO_state, '\0', sizeof (__mbstate_t)); memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__mbstate_t)); + struct gconv_fcts fcts; __wcsmbs_clone_conv (&fcts); assert (fcts.towc_nsteps == 1); assert (fcts.tomb_nsteps == 1); @@ -159,7 +159,8 @@ _IO_fwide (fp, mode) cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state; /* And now the transliteration. */ - cc->__cd_out.__cd.__data[0].__trans = &__libio_translit; + cc->__cd_out.__cd.__data[0].__trans + = (struct __gconv_trans_data *) &__libio_translit; } #else # ifdef _GLIBCPP_USE_WCHAR_T @@ -232,7 +233,13 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep, codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end; codecvt->__cd_out.__cd.__data[0].__statep = statep; - status = DL_CALL_FCT (gs->__fct, + __gconv_fct fct = gs->__fct; +#ifdef PTR_DEMANGLE + if (gs->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + + status = DL_CALL_FCT (fct, (gs, codecvt->__cd_out.__cd.__data, &from_start_copy, (const unsigned char *) from_end, NULL, &dummy, 0, 0)); @@ -298,7 +305,13 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep, codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end; codecvt->__cd_out.__cd.__data[0].__statep = statep; - status = DL_CALL_FCT (gs->__fct, + __gconv_fct fct = gs->__fct; +#ifdef PTR_DEMANGLE + if (gs->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + + status = DL_CALL_FCT (fct, (gs, codecvt->__cd_out.__cd.__data, NULL, NULL, NULL, &dummy, 1, 0)); @@ -361,7 +374,13 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep, codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) to_end; codecvt->__cd_in.__cd.__data[0].__statep = statep; - status = DL_CALL_FCT (gs->__fct, + __gconv_fct fct = gs->__fct; +#ifdef PTR_DEMANGLE + if (gs->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + + status = DL_CALL_FCT (fct, (gs, codecvt->__cd_in.__cd.__data, &from_start_copy, (const unsigned char *) from_end, NULL, &dummy, 0, 0)); @@ -459,7 +478,13 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep, codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) &to_buf[max]; codecvt->__cd_in.__cd.__data[0].__statep = statep; - status = DL_CALL_FCT (gs->__fct, + __gconv_fct fct = gs->__fct; +#ifdef PTR_DEMANGLE + if (gs->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + + status = DL_CALL_FCT (fct, (gs, codecvt->__cd_in.__cd.__data, &cp, (const unsigned char *) from_end, NULL, &dummy, 0, 0)); diff --git a/libio/libc_fatal.c b/libio/libc_fatal.c new file mode 100644 index 0000000000..be23849829 --- /dev/null +++ b/libio/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 + +/* 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/libio/libioP.h b/libio/libioP.h index 319b0fd5f3..be3b38a2e4 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1997-2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1997-2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -469,7 +469,7 @@ extern const struct _IO_jump_t _IO_streambuf_jumps; extern const struct _IO_jump_t _IO_old_proc_jumps attribute_hidden; extern const struct _IO_jump_t _IO_str_jumps attribute_hidden; extern const struct _IO_jump_t _IO_wstr_jumps attribute_hidden; -extern struct _IO_codecvt __libio_codecvt attribute_hidden; +extern const struct _IO_codecvt __libio_codecvt attribute_hidden; extern int _IO_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; diff --git a/locale/programs/3level.h b/locale/programs/3level.h index fa92b11bbd..88f1b49724 100644 --- a/locale/programs/3level.h +++ b/locale/programs/3level.h @@ -1,21 +1,19 @@ -/* Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Bruno Haible , 2000. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Construction of sparse 3-level tables. See wchar-lookup.h or coll-lookup.h for their structure and the diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c index 903bd5cabc..07d0cdcfd0 100644 --- a/locale/programs/charmap-dir.c +++ b/locale/programs/charmap-dir.c @@ -1,20 +1,18 @@ -/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/locale/programs/charmap-dir.h b/locale/programs/charmap-dir.h index 1d07c64ec1..256db8dc35 100644 --- a/locale/programs/charmap-dir.h +++ b/locale/programs/charmap-dir.h @@ -1,20 +1,18 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _CHARMAP_DIR_H #define _CHARMAP_DIR_H 1 diff --git a/locale/programs/charmap-kw.gperf b/locale/programs/charmap-kw.gperf index 83da36aa74..64f7452500 100644 --- a/locale/programs/charmap-kw.gperf +++ b/locale/programs/charmap-kw.gperf @@ -1,22 +1,20 @@ %{ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,1999,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/locale/programs/charmap-kw.h b/locale/programs/charmap-kw.h index 089f45d7d8..25996f4346 100644 --- a/locale/programs/charmap-kw.h +++ b/locale/programs/charmap-kw.h @@ -1,27 +1,56 @@ -/* ANSI-C code produced by gperf version 2.7.2 */ +/* ANSI-C code produced by gperf version 3.0.1 */ /* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash programs/charmap-kw.gperf */ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +#line 1 "programs/charmap-kw.gperf" + +/* Copyright (C) 1995,1996,1997,1998,1999,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "locfile-token.h" +#line 23 "programs/charmap-kw.gperf" struct keyword_t ; #define TOTAL_KEYWORDS 17 @@ -47,15 +76,15 @@ hash (register const char *str, register unsigned int len) 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, 25, 10, - 15, 20, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 10, 0, 0, - 5, 36, 0, 0, 36, 36, 36, 0, 0, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 25, 20, + 15, 10, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 5, 0, 0, + 5, 36, 0, 0, 36, 36, 36, 5, 0, 36, 0, 36, 0, 36, 0, 36, 36, 0, 36, 36, - 36, 36, 36, 36, 36, 0, 36, 0, 0, 0, - 10, 0, 36, 0, 0, 0, 36, 36, 36, 0, + 36, 36, 36, 36, 36, 0, 36, 5, 0, 0, + 5, 0, 36, 5, 0, 0, 36, 36, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 36, - 25, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 0, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, @@ -75,17 +104,19 @@ hash (register const char *str, register unsigned int len) switch (hval) { default: - case 9: hval += asso_values[(unsigned char)str[8]]; + /*FALLTHROUGH*/ case 8: case 7: case 6: case 5: hval += asso_values[(unsigned char)str[4]]; + /*FALLTHROUGH*/ case 4: case 3: case 2: hval += asso_values[(unsigned char)str[1]]; + /*FALLTHROUGH*/ case 1: hval += asso_values[(unsigned char)str[0]]; break; @@ -102,29 +133,46 @@ charmap_hash (register const char *str, register unsigned int len) static const struct keyword_t wordlist[] = { {""}, {""}, {""}, +#line 38 "programs/charmap-kw.gperf" {"END", tok_end, 0}, {""}, +#line 39 "programs/charmap-kw.gperf" {"WIDTH", tok_width, 0}, +#line 34 "programs/charmap-kw.gperf" {"escseq", tok_escseq, 1}, +#line 36 "programs/charmap-kw.gperf" {"include", tok_include, 1}, {""}, {""}, +#line 27 "programs/charmap-kw.gperf" {"mb_cur_min", tok_mb_cur_min, 1}, +#line 28 "programs/charmap-kw.gperf" {"escape_char", tok_escape_char, 1}, +#line 29 "programs/charmap-kw.gperf" {"comment_char", tok_comment_char, 1}, +#line 25 "programs/charmap-kw.gperf" {"code_set_name", tok_code_set_name, 1}, +#line 40 "programs/charmap-kw.gperf" {"WIDTH_VARIABLE", tok_width_variable, 0}, - {"g1esc", tok_g1esc, 1}, +#line 26 "programs/charmap-kw.gperf" + {"mb_cur_max", tok_mb_cur_max, 1}, +#line 35 "programs/charmap-kw.gperf" {"addset", tok_addset, 1}, +#line 37 "programs/charmap-kw.gperf" {"CHARMAP", tok_charmap, 0}, +#line 41 "programs/charmap-kw.gperf" {"WIDTH_DEFAULT", tok_width_default, 0}, {""}, - {"g2esc", tok_g2esc, 1}, - {""}, {""}, {""}, {""}, +#line 33 "programs/charmap-kw.gperf" {"g3esc", tok_g3esc, 1}, {""}, {""}, {""}, {""}, - {"g0esc", tok_g0esc, 1}, +#line 32 "programs/charmap-kw.gperf" + {"g2esc", tok_g2esc, 1}, + {""}, {""}, {""}, {""}, +#line 31 "programs/charmap-kw.gperf" + {"g1esc", tok_g1esc, 1}, {""}, {""}, {""}, {""}, - {"mb_cur_max", tok_mb_cur_max, 1} +#line 30 "programs/charmap-kw.gperf" + {"g0esc", tok_g0esc, 1} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c index b8aa1aafc4..6ac898d161 100644 --- a/locale/programs/charmap.c +++ b/locale/programs/charmap.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1998-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1998-2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/charmap.h b/locale/programs/charmap.h index a4a6d3833b..a3f31d6333 100644 --- a/locale/programs/charmap.h +++ b/locale/programs/charmap.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1996-1999, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999, 2001, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _CHARMAP_H #define _CHARMAP_H diff --git a/locale/programs/config.h b/locale/programs/config.h index 12a921c1cf..6f9bfde903 100644 --- a/locale/programs/config.h +++ b/locale/programs/config.h @@ -1,22 +1,20 @@ /* Configuration for localedef program. - Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,1998,2000,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LD_CONFIG_H #define _LD_CONFIG_H 1 diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c index 5a7d821de6..4d649b0456 100644 --- a/locale/programs/ld-address.c +++ b/locale/programs/ld-address.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 00ad2ee488..66638d50c8 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index ed8fa919d5..b0b2e3f805 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c index ae5ea6fb16..d050f7aaa9 100644 --- a/locale/programs/ld-identification.c +++ b/locale/programs/ld-identification.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-measurement.c b/locale/programs/ld-measurement.c index e3ec90199e..6a9b847a1a 100644 --- a/locale/programs/ld-measurement.c +++ b/locale/programs/ld-measurement.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c index d5cc393e4b..e98574f130 100644 --- a/locale/programs/ld-messages.c +++ b/locale/programs/ld-messages.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c index 868ab6980e..27636d6498 100644 --- a/locale/programs/ld-monetary.c +++ b/locale/programs/ld-monetary.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-name.c b/locale/programs/ld-name.c index 80b42f7048..c1153fd51d 100644 --- a/locale/programs/ld-name.c +++ b/locale/programs/ld-name.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c index 594c0c8c1b..a101a402f4 100644 --- a/locale/programs/ld-numeric.c +++ b/locale/programs/ld-numeric.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-paper.c b/locale/programs/ld-paper.c index 2910954f04..38f9af3e60 100644 --- a/locale/programs/ld-paper.c +++ b/locale/programs/ld-paper.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-telephone.c b/locale/programs/ld-telephone.c index 5a60c016b0..4075a14f46 100644 --- a/locale/programs/ld-telephone.c +++ b/locale/programs/ld-telephone.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index a7dd25c80d..2d63275d3c 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 5c8cf65012..1d3e60f69f 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h index 27043b2456..d4d7e830a6 100644 --- a/locale/programs/linereader.h +++ b/locale/programs/linereader.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LINEREADER_H #define _LINEREADER_H 1 diff --git a/locale/programs/locale-spec.c b/locale/programs/locale-spec.c index a1a3aba47f..6ad3d95efe 100644 --- a/locale/programs/locale-spec.c +++ b/locale/programs/locale-spec.c @@ -1,22 +1,20 @@ /* Handle special requests. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/locale.c b/locale/programs/locale.c index d64bb0b560..526eb2b929 100644 --- a/locale/programs/locale.c +++ b/locale/programs/locale.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c index 326113c175..dfabaa9f8a 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h index 41f72860d4..f8cc4ca9c1 100644 --- a/locale/programs/localedef.h +++ b/locale/programs/localedef.h @@ -1,22 +1,20 @@ /* General definitions for localedef(1). - Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LOCALEDEF_H #define _LOCALEDEF_H 1 diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c index 1a1c7701d1..5c0d5f18ce 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -1,21 +1,19 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/locfile-kw.gperf b/locale/programs/locfile-kw.gperf index 7a9285d97e..efdb9afab9 100644 --- a/locale/programs/locfile-kw.gperf +++ b/locale/programs/locfile-kw.gperf @@ -1,22 +1,20 @@ %{ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/locale/programs/locfile-kw.h b/locale/programs/locfile-kw.h index da4a63e033..8692b0936c 100644 --- a/locale/programs/locfile-kw.h +++ b/locale/programs/locfile-kw.h @@ -1,35 +1,64 @@ -/* ANSI-C code produced by gperf version 2.7.2 */ +/* ANSI-C code produced by gperf version 3.0.1 */ /* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N locfile_hash programs/locfile-kw.gperf */ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +#line 1 "programs/locfile-kw.gperf" + +/* Copyright (C) 1996,1997,1998,1999,2000,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "locfile-token.h" +#line 23 "programs/locfile-kw.gperf" struct keyword_t ; #define TOTAL_KEYWORDS 175 #define MIN_WORD_LENGTH 3 #define MAX_WORD_LENGTH 22 #define MIN_HASH_VALUE 3 -#define MAX_HASH_VALUE 687 -/* maximum key range = 685, duplicates = 0 */ +#define MAX_HASH_VALUE 610 +/* maximum key range = 608, duplicates = 0 */ #ifdef __GNUC__ __inline @@ -43,49 +72,51 @@ hash (register const char *str, register unsigned int len) { static const unsigned short asso_values[] = { - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 5, 0, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 15, 688, 0, 0, 0, - 5, 0, 0, 0, 688, 688, 0, 688, 0, 5, - 688, 688, 15, 0, 5, 15, 688, 688, 688, 0, - 688, 688, 688, 688, 688, 75, 688, 0, 0, 65, - 5, 0, 85, 40, 5, 155, 688, 10, 105, 120, - 125, 35, 5, 20, 5, 190, 0, 125, 35, 10, - 30, 35, 0, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, - 688, 688, 688, 688, 688, 688 + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 5, 0, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 5, 611, 0, 0, 0, + 0, 0, 10, 0, 611, 611, 0, 611, 0, 5, + 611, 611, 0, 0, 0, 10, 611, 611, 611, 0, + 611, 611, 611, 611, 611, 0, 611, 145, 105, 25, + 15, 0, 190, 110, 10, 35, 611, 0, 80, 65, + 5, 130, 40, 50, 5, 0, 10, 35, 50, 20, + 5, 10, 0, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 611, 611, 611 }; register int hval = len; switch (hval) { default: - case 9: hval += asso_values[(unsigned char)str[8]]; + /*FALLTHROUGH*/ case 8: case 7: case 6: case 5: hval += asso_values[(unsigned char)str[4]]; + /*FALLTHROUGH*/ case 4: case 3: case 2: hval += asso_values[(unsigned char)str[1]]; + /*FALLTHROUGH*/ case 1: hval += asso_values[(unsigned char)str[0]]; break; @@ -102,314 +133,470 @@ locfile_hash (register const char *str, register unsigned int len) static const struct keyword_t wordlist[] = { {""}, {""}, {""}, +#line 30 "programs/locfile-kw.gperf" {"END", tok_end, 0}, - {""}, {""}, {""}, + {""}, {""}, +#line 69 "programs/locfile-kw.gperf" + {"IGNORE", tok_ignore, 0}, +#line 127 "programs/locfile-kw.gperf" {"LC_TIME", tok_lc_time, 0}, - {"era", tok_era, 0}, - {"date", tok_date, 0}, +#line 29 "programs/locfile-kw.gperf" + {"LC_CTYPE", tok_lc_ctype, 0}, + {""}, +#line 164 "programs/locfile-kw.gperf" {"LC_ADDRESS", tok_lc_address, 0}, +#line 149 "programs/locfile-kw.gperf" {"LC_MESSAGES", tok_lc_messages, 0}, - {"LC_TELEPHONE", tok_lc_telephone, 0}, - {"LC_CTYPE", tok_lc_ctype, 0}, - {"era_t_fmt", tok_era_t_fmt, 0}, - {"print", tok_print, 0}, - {"height", tok_height, 0}, +#line 157 "programs/locfile-kw.gperf" + {"LC_NAME", tok_lc_name, 0}, +#line 154 "programs/locfile-kw.gperf" + {"LC_PAPER", tok_lc_paper, 0}, +#line 182 "programs/locfile-kw.gperf" + {"LC_MEASUREMENT", tok_lc_measurement, 0}, +#line 55 "programs/locfile-kw.gperf" + {"LC_COLLATE", tok_lc_collate, 0}, + {""}, +#line 184 "programs/locfile-kw.gperf" {"LC_IDENTIFICATION", tok_lc_identification, 0}, +#line 197 "programs/locfile-kw.gperf" + {"revision", tok_revision, 0}, +#line 68 "programs/locfile-kw.gperf" + {"UNDEFINED", tok_undefined, 0}, +#line 123 "programs/locfile-kw.gperf" + {"LC_NUMERIC", tok_lc_numeric, 0}, +#line 80 "programs/locfile-kw.gperf" + {"LC_MONETARY", tok_lc_monetary, 0}, +#line 177 "programs/locfile-kw.gperf" + {"LC_TELEPHONE", tok_lc_telephone, 0}, {""}, - {"era_d_fmt", tok_era_d_fmt, 0}, - {"LC_COLLATE", tok_lc_collate, 0}, - {"IGNORE", tok_ignore, 0}, - {"LC_NAME", tok_lc_name, 0}, - {"backward", tok_backward, 0}, +#line 130 "programs/locfile-kw.gperf" {"week", tok_week, 0}, - {"LC_NUMERIC", tok_lc_numeric, 0}, + {""}, +#line 74 "programs/locfile-kw.gperf" + {"define", tok_define, 0}, +#line 150 "programs/locfile-kw.gperf" + {"yesexpr", tok_yesexpr, 0}, +#line 139 "programs/locfile-kw.gperf" + {"era_year", tok_era_year, 0}, + {""}, +#line 53 "programs/locfile-kw.gperf" + {"translit_ignore", tok_translit_ignore, 0}, +#line 152 "programs/locfile-kw.gperf" + {"yesstr", tok_yesstr, 0}, + {""}, +#line 87 "programs/locfile-kw.gperf" + {"negative_sign", tok_negative_sign, 0}, + {""}, +#line 135 "programs/locfile-kw.gperf" + {"t_fmt", tok_t_fmt, 0}, +#line 155 "programs/locfile-kw.gperf" + {"height", tok_height, 0}, + {""}, {""}, +#line 51 "programs/locfile-kw.gperf" + {"translit_start", tok_translit_start, 0}, +#line 134 "programs/locfile-kw.gperf" + {"d_fmt", tok_d_fmt, 0}, + {""}, +#line 52 "programs/locfile-kw.gperf" + {"translit_end", tok_translit_end, 0}, +#line 92 "programs/locfile-kw.gperf" + {"n_cs_precedes", tok_n_cs_precedes, 0}, +#line 142 "programs/locfile-kw.gperf" + {"era_t_fmt", tok_era_t_fmt, 0}, +#line 38 "programs/locfile-kw.gperf" + {"space", tok_space, 0}, +#line 71 "programs/locfile-kw.gperf" {"reorder-end", tok_reorder_end, 0}, +#line 72 "programs/locfile-kw.gperf" + {"reorder-sections-after", tok_reorder_sections_after, 0}, {""}, - {"reorder-after", tok_reorder_after, 0}, - {"UNDEFINED", tok_undefined, 0}, +#line 140 "programs/locfile-kw.gperf" + {"era_d_fmt", tok_era_d_fmt, 0}, +#line 185 "programs/locfile-kw.gperf" + {"title", tok_title, 0}, + {""}, {""}, +#line 147 "programs/locfile-kw.gperf" + {"timezone", tok_timezone, 0}, {""}, - {"LC_MONETARY", tok_lc_monetary, 0}, +#line 73 "programs/locfile-kw.gperf" + {"reorder-sections-end", tok_reorder_sections_end, 0}, + {""}, {""}, {""}, +#line 93 "programs/locfile-kw.gperf" + {"n_sep_by_space", tok_n_sep_by_space, 0}, + {""}, {""}, +#line 98 "programs/locfile-kw.gperf" + {"int_n_cs_precedes", tok_int_n_cs_precedes, 0}, + {""}, {""}, {""}, +#line 25 "programs/locfile-kw.gperf" + {"escape_char", tok_escape_char, 0}, {""}, +#line 27 "programs/locfile-kw.gperf" {"repertoiremap", tok_repertoiremap, 0}, - {"LC_MEASUREMENT", tok_lc_measurement, 0}, - {""}, {""}, {""}, - {"LC_PAPER", tok_lc_paper, 0}, +#line 45 "programs/locfile-kw.gperf" + {"charclass", tok_charclass, 0}, +#line 42 "programs/locfile-kw.gperf" + {"print", tok_print, 0}, +#line 43 "programs/locfile-kw.gperf" + {"xdigit", tok_xdigit, 0}, +#line 108 "programs/locfile-kw.gperf" + {"duo_n_cs_precedes", tok_duo_n_cs_precedes, 0}, +#line 125 "programs/locfile-kw.gperf" + {"thousands_sep", tok_thousands_sep, 0}, +#line 193 "programs/locfile-kw.gperf" + {"territory", tok_territory, 0}, +#line 35 "programs/locfile-kw.gperf" + {"digit", tok_digit, 0}, + {""}, {""}, +#line 90 "programs/locfile-kw.gperf" + {"p_cs_precedes", tok_p_cs_precedes, 0}, + {""}, +#line 156 "programs/locfile-kw.gperf" + {"width", tok_width, 0}, +#line 61 "programs/locfile-kw.gperf" + {"script", tok_script, 0}, +#line 28 "programs/locfile-kw.gperf" + {"include", tok_include, 0}, + {""}, +#line 77 "programs/locfile-kw.gperf" + {"else", tok_else, 0}, +#line 180 "programs/locfile-kw.gperf" + {"int_select", tok_int_select, 0}, {""}, {""}, {""}, {""}, - {"day", tok_day, 0}, +#line 32 "programs/locfile-kw.gperf" + {"upper", tok_upper, 0}, {""}, {""}, - {"yesstr", tok_yesstr, 0}, - {""}, {""}, {""}, {""}, {""}, - {"toupper", tok_toupper, 0}, - {"era_year", tok_era_year, 0}, +#line 190 "programs/locfile-kw.gperf" + {"tel", tok_tel, 0}, +#line 91 "programs/locfile-kw.gperf" + {"p_sep_by_space", tok_p_sep_by_space, 0}, {""}, {""}, - {"order_start", tok_order_start, 0}, - {"tolower", tok_tolower, 0}, +#line 96 "programs/locfile-kw.gperf" + {"int_p_cs_precedes", tok_int_p_cs_precedes, 0}, {""}, {""}, - {"graph", tok_graph, 0}, +#line 40 "programs/locfile-kw.gperf" + {"punct", tok_punct, 0}, + {""}, {""}, +#line 99 "programs/locfile-kw.gperf" + {"int_n_sep_by_space", tok_int_n_sep_by_space, 0}, {""}, {""}, {""}, - {"order_end", tok_order_end, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 106 "programs/locfile-kw.gperf" + {"duo_p_cs_precedes", tok_duo_p_cs_precedes, 0}, + {""}, {""}, +#line 46 "programs/locfile-kw.gperf" + {"class", tok_class, 0}, +#line 112 "programs/locfile-kw.gperf" + {"duo_int_n_cs_precedes", tok_duo_int_n_cs_precedes, 0}, +#line 113 "programs/locfile-kw.gperf" + {"duo_int_n_sep_by_space", tok_duo_int_n_sep_by_space, 0}, +#line 109 "programs/locfile-kw.gperf" + {"duo_n_sep_by_space", tok_duo_n_sep_by_space, 0}, +#line 117 "programs/locfile-kw.gperf" + {"duo_int_n_sign_posn", tok_duo_int_n_sign_posn, 0}, + {""}, {""}, {""}, +#line 47 "programs/locfile-kw.gperf" + {"charconv", tok_charconv, 0}, + {""}, {""}, +#line 183 "programs/locfile-kw.gperf" + {"measurement", tok_measurement, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 57 "programs/locfile-kw.gperf" + {"section-symbol", tok_section_symbol, 0}, +#line 181 "programs/locfile-kw.gperf" + {"int_prefix", tok_int_prefix, 0}, + {""}, {""}, {""}, {""}, +#line 137 "programs/locfile-kw.gperf" + {"t_fmt_ampm", tok_t_fmt_ampm, 0}, + {""}, {""}, +#line 97 "programs/locfile-kw.gperf" + {"int_p_sep_by_space", tok_int_p_sep_by_space, 0}, {""}, - {"abday", tok_abday, 0}, +#line 41 "programs/locfile-kw.gperf" + {"graph", tok_graph, 0}, + {""}, {""}, +#line 124 "programs/locfile-kw.gperf" + {"decimal_point", tok_decimal_point, 0}, + {""}, {""}, +#line 110 "programs/locfile-kw.gperf" + {"duo_int_p_cs_precedes", tok_duo_int_p_cs_precedes, 0}, +#line 111 "programs/locfile-kw.gperf" + {"duo_int_p_sep_by_space", tok_duo_int_p_sep_by_space, 0}, +#line 107 "programs/locfile-kw.gperf" + {"duo_p_sep_by_space", tok_duo_p_sep_by_space, 0}, +#line 116 "programs/locfile-kw.gperf" + {"duo_int_p_sign_posn", tok_duo_int_p_sign_posn, 0}, +#line 153 "programs/locfile-kw.gperf" + {"nostr", tok_nostr, 0}, + {""}, {""}, +#line 138 "programs/locfile-kw.gperf" + {"era", tok_era, 0}, {""}, - {"yesexpr", tok_yesexpr, 0}, +#line 82 "programs/locfile-kw.gperf" + {"currency_symbol", tok_currency_symbol, 0}, + {""}, +#line 163 "programs/locfile-kw.gperf" + {"name_ms", tok_name_ms, 0}, +#line 161 "programs/locfile-kw.gperf" + {"name_mrs", tok_name_mrs, 0}, +#line 162 "programs/locfile-kw.gperf" + {"name_miss", tok_name_miss, 0}, +#line 81 "programs/locfile-kw.gperf" + {"int_curr_symbol", tok_int_curr_symbol, 0}, +#line 186 "programs/locfile-kw.gperf" + {"source", tok_source, 0}, +#line 160 "programs/locfile-kw.gperf" + {"name_mr", tok_name_mr, 0}, +#line 159 "programs/locfile-kw.gperf" + {"name_gen", tok_name_gen, 0}, +#line 198 "programs/locfile-kw.gperf" + {"date", tok_date, 0}, {""}, {""}, - {"t_fmt", tok_t_fmt, 0}, - {""}, {""}, {""}, {""}, - {"d_fmt", tok_d_fmt, 0}, +#line 187 "programs/locfile-kw.gperf" + {"address", tok_address, 0}, +#line 158 "programs/locfile-kw.gperf" + {"name_fmt", tok_name_fmt, 0}, +#line 31 "programs/locfile-kw.gperf" + {"copy", tok_copy, 0}, {""}, {""}, +#line 49 "programs/locfile-kw.gperf" + {"tolower", tok_tolower, 0}, +#line 129 "programs/locfile-kw.gperf" + {"day", tok_day, 0}, +#line 103 "programs/locfile-kw.gperf" + {"duo_currency_symbol", tok_duo_currency_symbol, 0}, +#line 101 "programs/locfile-kw.gperf" + {"int_n_sign_posn", tok_int_n_sign_posn, 0}, + {""}, {""}, +#line 148 "programs/locfile-kw.gperf" {"date_fmt", tok_date_fmt, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"grouping", tok_grouping, 0}, +#line 63 "programs/locfile-kw.gperf" + {"order_end", tok_order_end, 0}, {""}, {""}, - {"tel_dom_fmt", tok_tel_dom_fmt, 0}, - {""}, {""}, {""}, {""}, - {"era_d_t_fmt", tok_era_d_t_fmt, 0}, - {"contact", tok_contact, 0}, - {"tel", tok_tel, 0}, - {"else", tok_else, 0}, - {"alpha", tok_alpha, 0}, - {"country_ab3", tok_country_ab3, 0}, - {""}, {""}, {""}, {""}, - {"country_ab2", tok_country_ab2, 0}, - {"country_post", tok_country_post, 0}, - {"fax", tok_fax, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"map", tok_map, 0}, - {""}, - {"blank", tok_blank, 0}, +#line 166 "programs/locfile-kw.gperf" + {"country_name", tok_country_name, 0}, +#line 70 "programs/locfile-kw.gperf" + {"reorder-after", tok_reorder_after, 0}, +#line 118 "programs/locfile-kw.gperf" + {"uno_valid_from", tok_uno_valid_from, 0}, +#line 115 "programs/locfile-kw.gperf" + {"duo_n_sign_posn", tok_duo_n_sign_posn, 0}, +#line 151 "programs/locfile-kw.gperf" + {"noexpr", tok_noexpr, 0}, {""}, - {"forward", tok_forward, 0}, +#line 194 "programs/locfile-kw.gperf" {"audience", tok_audience, 0}, {""}, - {"punct", tok_punct, 0}, - {"define", tok_define, 0}, - {"abbreviation", tok_abbreviation, 0}, - {""}, - {"copy", tok_copy, 0}, - {""}, {""}, {""}, - {"decimal_point", tok_decimal_point, 0}, +#line 44 "programs/locfile-kw.gperf" + {"blank", tok_blank, 0}, {""}, - {"upper", tok_upper, 0}, - {""}, {""}, - {"category", tok_category, 0}, +#line 48 "programs/locfile-kw.gperf" + {"toupper", tok_toupper, 0}, +#line 67 "programs/locfile-kw.gperf" + {"position", tok_position, 0}, +#line 120 "programs/locfile-kw.gperf" + {"duo_valid_from", tok_duo_valid_from, 0}, +#line 39 "programs/locfile-kw.gperf" + {"cntrl", tok_cntrl, 0}, {""}, - {"conversion_rate", tok_conversion_rate, 0}, +#line 26 "programs/locfile-kw.gperf" + {"comment_char", tok_comment_char, 0}, +#line 86 "programs/locfile-kw.gperf" + {"positive_sign", tok_positive_sign, 0}, {""}, {""}, {""}, {""}, - {"lower", tok_lower, 0}, - {""}, - {"collating-element", tok_collating_element, 0}, - {"duo_p_sep_by_space", tok_duo_p_sep_by_space, 0}, - {""}, - {"title", tok_title, 0}, +#line 132 "programs/locfile-kw.gperf" + {"mon", tok_mon, 0}, {""}, {""}, - {"timezone", tok_timezone, 0}, +#line 171 "programs/locfile-kw.gperf" + {"country_car", tok_country_car, 0}, {""}, - {"digit", tok_digit, 0}, - {""}, {""}, {""}, {""}, - {"postal_fmt", tok_postal_fmt, 0}, +#line 60 "programs/locfile-kw.gperf" + {"symbol-equivalence", tok_symbol_equivalence, 0}, +#line 102 "programs/locfile-kw.gperf" + {"duo_int_curr_symbol", tok_duo_int_curr_symbol, 0}, +#line 100 "programs/locfile-kw.gperf" + {"int_p_sign_posn", tok_int_p_sign_posn, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 172 "programs/locfile-kw.gperf" + {"country_isbn", tok_country_isbn, 0}, +#line 36 "programs/locfile-kw.gperf" + {"outdigit", tok_outdigit, 0}, + {""}, +#line 114 "programs/locfile-kw.gperf" + {"duo_p_sign_posn", tok_duo_p_sign_posn, 0}, {""}, +#line 133 "programs/locfile-kw.gperf" {"d_t_fmt", tok_d_t_fmt, 0}, - {"position", tok_position, 0}, - {"p_sep_by_space", tok_p_sep_by_space, 0}, - {"nostr", tok_nostr, 0}, - {"noexpr", tok_noexpr, 0}, + {""}, {""}, +#line 33 "programs/locfile-kw.gperf" + {"lower", tok_lower, 0}, {""}, - {"charconv", tok_charconv, 0}, +#line 167 "programs/locfile-kw.gperf" + {"country_post", tok_country_post, 0}, +#line 146 "programs/locfile-kw.gperf" + {"cal_direction", tok_cal_direction, 0}, {""}, - {"width", tok_width, 0}, - {"country_car", tok_country_car, 0}, - {"comment_char", tok_comment_char, 0}, - {""}, {""}, {""}, {""}, - {"lang_ab", tok_lang_ab, 0}, - {"lang_lib", tok_lang_lib, 0}, +#line 189 "programs/locfile-kw.gperf" + {"email", tok_email, 0}, +#line 141 "programs/locfile-kw.gperf" + {"era_d_t_fmt", tok_era_d_t_fmt, 0}, + {""}, {""}, +#line 173 "programs/locfile-kw.gperf" {"lang_name", tok_lang_name, 0}, - {""}, {""}, {""}, {""}, - {"elif", tok_elif, 0}, {""}, - {"xdigit", tok_xdigit, 0}, +#line 179 "programs/locfile-kw.gperf" + {"tel_dom_fmt", tok_tel_dom_fmt, 0}, {""}, {""}, {""}, - {"space", tok_space, 0}, - {""}, - {"address", tok_address, 0}, +#line 54 "programs/locfile-kw.gperf" + {"default_missing", tok_default_missing, 0}, +#line 89 "programs/locfile-kw.gperf" + {"frac_digits", tok_frac_digits, 0}, + {""}, {""}, {""}, +#line 88 "programs/locfile-kw.gperf" + {"int_frac_digits", tok_int_frac_digits, 0}, +#line 170 "programs/locfile-kw.gperf" + {"country_num", tok_country_num, 0}, +#line 119 "programs/locfile-kw.gperf" + {"uno_valid_to", tok_uno_valid_to, 0}, {""}, {""}, {""}, {""}, {""}, - {"name_fmt", tok_name_fmt, 0}, - {""}, - {"t_fmt_ampm", tok_t_fmt_ampm, 0}, - {""}, - {"name_mr", tok_name_mr, 0}, - {""}, - {"from", tok_from, 0}, +#line 50 "programs/locfile-kw.gperf" + {"map", tok_map, 0}, {""}, - {"escape_char", tok_escape_char, 0}, +#line 105 "programs/locfile-kw.gperf" + {"duo_frac_digits", tok_duo_frac_digits, 0}, +#line 178 "programs/locfile-kw.gperf" + {"tel_int_fmt", tok_tel_int_fmt, 0}, +#line 121 "programs/locfile-kw.gperf" {"duo_valid_to", tok_duo_valid_to, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"reorder-sections-end", tok_reorder_sections_end, 0}, +#line 144 "programs/locfile-kw.gperf" + {"first_weekday", tok_first_weekday, 0}, {""}, - {"reorder-sections-after", tok_reorder_sections_after, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"territory", tok_territory, 0}, +#line 143 "programs/locfile-kw.gperf" + {"alt_digits", tok_alt_digits, 0}, +#line 95 "programs/locfile-kw.gperf" + {"n_sign_posn", tok_n_sign_posn, 0}, +#line 84 "programs/locfile-kw.gperf" + {"mon_thousands_sep", tok_mon_thousands_sep, 0}, +#line 145 "programs/locfile-kw.gperf" + {"first_workday", tok_first_workday, 0}, +#line 64 "programs/locfile-kw.gperf" + {"from", tok_from, 0}, +#line 131 "programs/locfile-kw.gperf" + {"abmon", tok_abmon, 0}, {""}, {""}, - {"country_name", tok_country_name, 0}, +#line 192 "programs/locfile-kw.gperf" {"language", tok_language, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"tel_int_fmt", tok_tel_int_fmt, 0}, - {"mon_grouping", tok_mon_grouping, 0}, - {"positive_sign", tok_positive_sign, 0}, + {""}, {""}, +#line 195 "programs/locfile-kw.gperf" + {"application", tok_application, 0}, {""}, - {"abmon", tok_abmon, 0}, - {"measurement", tok_measurement, 0}, - {""}, {""}, {""}, +#line 126 "programs/locfile-kw.gperf" + {"grouping", tok_grouping, 0}, +#line 78 "programs/locfile-kw.gperf" + {"elif", tok_elif, 0}, +#line 128 "programs/locfile-kw.gperf" + {"abday", tok_abday, 0}, + {""}, +#line 196 "programs/locfile-kw.gperf" + {"abbreviation", tok_abbreviation, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 56 "programs/locfile-kw.gperf" {"coll_weight_max", tok_coll_weight_max, 0}, - {"collating-symbol", tok_collating_symbol, 0}, - {""}, {""}, {""}, {""}, - {"script", tok_script, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"cal_direction", tok_cal_direction, 0}, - {""}, {""}, {""}, {""}, - {"duo_n_sep_by_space", tok_duo_n_sep_by_space, 0}, - {""}, {""}, {""}, {""}, - {"mon", tok_mon, 0}, - {"translit_start", tok_translit_start, 0}, - {"translit_ignore", tok_translit_ignore, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 66 "programs/locfile-kw.gperf" + {"backward", tok_backward, 0}, +#line 104 "programs/locfile-kw.gperf" + {"duo_int_frac_digits", tok_duo_int_frac_digits, 0}, {""}, - {"translit_end", tok_translit_end, 0}, - {"first_weekday", tok_first_weekday, 0}, - {""}, {""}, +#line 94 "programs/locfile-kw.gperf" {"p_sign_posn", tok_p_sign_posn, 0}, {""}, - {"first_workday", tok_first_workday, 0}, - {"n_sep_by_space", tok_n_sep_by_space, 0}, +#line 199 "programs/locfile-kw.gperf" + {"category", tok_category, 0}, {""}, - {"source", tok_source, 0}, - {"mon_decimal_point", tok_mon_decimal_point, 0}, - {"symbol-equivalence", tok_symbol_equivalence, 0}, +#line 122 "programs/locfile-kw.gperf" + {"conversion_rate", tok_conversion_rate, 0}, {""}, - {"endif", tok_endif, 0}, +#line 83 "programs/locfile-kw.gperf" + {"mon_decimal_point", tok_mon_decimal_point, 0}, {""}, {""}, {""}, - {"duo_valid_from", tok_duo_valid_from, 0}, - {"default_missing", tok_default_missing, 0}, - {""}, {""}, - {"int_p_sep_by_space", tok_int_p_sep_by_space, 0}, - {""}, - {"alt_digits", tok_alt_digits, 0}, +#line 62 "programs/locfile-kw.gperf" + {"order_start", tok_order_start, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"duo_int_p_sep_by_space", tok_duo_int_p_sep_by_space, 0}, - {""}, {""}, - {"duo_p_sign_posn", tok_duo_p_sign_posn, 0}, - {""}, {""}, {""}, - {"duo_currency_symbol", tok_duo_currency_symbol, 0}, +#line 188 "programs/locfile-kw.gperf" + {"contact", tok_contact, 0}, {""}, {""}, {""}, - {"outdigit", tok_outdigit, 0}, - {""}, {""}, {""}, {""}, - {"revision", tok_revision, 0}, +#line 169 "programs/locfile-kw.gperf" + {"country_ab3", tok_country_ab3, 0}, {""}, {""}, {""}, {""}, - {"name_gen", tok_name_gen, 0}, - {""}, - {"email", tok_email, 0}, - {""}, - {"uno_valid_to", tok_uno_valid_to, 0}, - {"negative_sign", tok_negative_sign, 0}, +#line 168 "programs/locfile-kw.gperf" + {"country_ab2", tok_country_ab2, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"alnum", tok_alnum, 0}, - {""}, {""}, {""}, {""}, {""}, - {"country_num", tok_country_num, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"am_pm", tok_am_pm, 0}, {""}, - {"mon_thousands_sep", tok_mon_thousands_sep, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"currency_symbol", tok_currency_symbol, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"country_isbn", tok_country_isbn, 0}, - {""}, {""}, {""}, {""}, - {"name_ms", tok_name_ms, 0}, - {"name_mrs", tok_name_mrs, 0}, +#line 174 "programs/locfile-kw.gperf" + {"lang_ab", tok_lang_ab, 0}, +#line 176 "programs/locfile-kw.gperf" + {"lang_lib", tok_lang_lib, 0}, {""}, {""}, {""}, {""}, - {"thousands_sep", tok_thousands_sep, 0}, - {""}, - {"cntrl", tok_cntrl, 0}, - {""}, {""}, {""}, {""}, {""}, - {"n_sign_posn", tok_n_sign_posn, 0}, - {"include", tok_include, 0}, - {""}, {""}, - {"ifdef", tok_ifdef, 0}, +#line 191 "programs/locfile-kw.gperf" + {"fax", tok_fax, 0}, {""}, - {"duo_p_cs_precedes", tok_duo_p_cs_precedes, 0}, +#line 136 "programs/locfile-kw.gperf" + {"am_pm", tok_am_pm, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"p_cs_precedes", tok_p_cs_precedes, 0}, - {"uno_valid_from", tok_uno_valid_from, 0}, - {"undef", tok_undef, 0}, - {""}, {""}, - {"int_n_sep_by_space", tok_int_n_sep_by_space, 0}, +#line 37 "programs/locfile-kw.gperf" + {"alnum", tok_alnum, 0}, + {""}, {""}, {""}, +#line 175 "programs/locfile-kw.gperf" {"lang_term", tok_lang_term, 0}, - {""}, {""}, - {"duo_int_n_sep_by_space", tok_duo_int_n_sep_by_space, 0}, - {""}, - {"duo_int_p_sign_posn", tok_duo_int_p_sign_posn, 0}, - {"duo_n_sign_posn", tok_duo_n_sign_posn, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"application", tok_application, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"int_p_sign_posn", tok_int_p_sign_posn, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"duo_int_curr_symbol", tok_duo_int_curr_symbol, 0}, - {""}, {""}, {""}, {""}, {""}, - {"int_prefix", tok_int_prefix, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 79 "programs/locfile-kw.gperf" + {"endif", tok_endif, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"duo_frac_digits", tok_duo_frac_digits, 0}, - {""}, {""}, {""}, {""}, {""}, - {"duo_int_p_cs_precedes", tok_duo_int_p_cs_precedes, 0}, +#line 165 "programs/locfile-kw.gperf" + {"postal_fmt", tok_postal_fmt, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"frac_digits", tok_frac_digits, 0}, - {""}, {""}, - {"charclass", tok_charclass, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 75 "programs/locfile-kw.gperf" + {"undef", tok_undef, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"duo_n_cs_precedes", tok_duo_n_cs_precedes, 0}, - {""}, {""}, - {"int_curr_symbol", tok_int_curr_symbol, 0}, {""}, {""}, - {"n_cs_precedes", tok_n_cs_precedes, 0}, - {""}, - {"int_select", tok_int_select, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"duo_int_n_sign_posn", tok_duo_int_n_sign_posn, 0}, - {"class", tok_class, 0}, +#line 58 "programs/locfile-kw.gperf" + {"collating-element", tok_collating_element, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"int_p_cs_precedes", tok_int_p_cs_precedes, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"duo_int_frac_digits", tok_duo_int_frac_digits, 0}, - {""}, {""}, {""}, {""}, {""}, - {"int_n_sign_posn", tok_int_n_sign_posn, 0}, - {""}, {""}, {""}, - {"name_miss", tok_name_miss, 0}, +#line 85 "programs/locfile-kw.gperf" + {"mon_grouping", tok_mon_grouping, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 65 "programs/locfile-kw.gperf" + {"forward", tok_forward, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 59 "programs/locfile-kw.gperf" + {"collating-symbol", tok_collating_symbol, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"duo_int_n_cs_precedes", tok_duo_int_n_cs_precedes, 0}, +#line 34 "programs/locfile-kw.gperf" + {"alpha", tok_alpha, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"int_frac_digits", tok_int_frac_digits, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"section-symbol", tok_section_symbol, 0}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"int_n_cs_precedes", tok_int_n_cs_precedes, 0} + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 76 "programs/locfile-kw.gperf" + {"ifdef", tok_ifdef, 0} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/locale/programs/locfile-token.h b/locale/programs/locfile-token.h index cada206655..beb979c632 100644 --- a/locale/programs/locfile-token.h +++ b/locale/programs/locfile-token.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _TOKEN_H #define _TOKEN_H diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c index 1d3276a6bf..bc12fbb332 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1996-2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h index db34f462e3..f6290f0ee0 100644 --- a/locale/programs/locfile.h +++ b/locale/programs/locfile.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LOCFILE_H #define _LOCFILE_H 1 diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c index 933b88f5cd..7f7ba713b2 100644 --- a/locale/programs/repertoire.c +++ b/locale/programs/repertoire.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998,1999,2000,2001,2002,2004 Free Software Foundation, Inc. +/* Copyright (C) 1998-2002,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/repertoire.h b/locale/programs/repertoire.h index d463c81690..75877044ca 100644 --- a/locale/programs/repertoire.h +++ b/locale/programs/repertoire.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _REPERTOIREMAP_H #define _REPERTOIREMAP_H 1 diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c index c319068677..86bbdd5b13 100644 --- a/locale/programs/simple-hash.c +++ b/locale/programs/simple-hash.c @@ -1,22 +1,20 @@ /* Implement simple hashing table with string based keys. - Copyright (C) 1994-1997, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper , October 1994. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/simple-hash.h b/locale/programs/simple-hash.h index 469caedc19..7261ebc396 100644 --- a/locale/programs/simple-hash.h +++ b/locale/programs/simple-hash.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-1999, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _SIMPLE_HASH_H #define _SIMPLE_HASH_H diff --git a/locale/programs/xmalloc.c b/locale/programs/xmalloc.c index 9f3c2c1cd1..a95dc5a40f 100644 --- a/locale/programs/xmalloc.c +++ b/locale/programs/xmalloc.c @@ -1,21 +1,20 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990,91,92,93,94,95,96,97,2004 Free Software Foundation, Inc. + Copyright (C) 1990,91,92,93,94,95,96,97,2004,2005 + Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include diff --git a/locale/programs/xstrdup.c b/locale/programs/xstrdup.c index 7838d201ab..12fb3a8287 100644 --- a/locale/programs/xstrdup.c +++ b/locale/programs/xstrdup.c @@ -1,21 +1,19 @@ /* xstrdup.c -- copy a string with out of memory checking - Copyright (C) 1990, 1996, 1997, 1999, 2004 Free Software Foundation, Inc. + Copyright (C) 1990,1996,1997,1999,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/localedata/ChangeLog b/localedata/ChangeLog index ebb5f15c3a..ad32e0bb52 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,7 @@ +2005-11-21 Ulrich Drepper + + * locales/se_NO: Remove RCS ID line. + 2005-11-16 Ulrich Drepper [BZ 1872] diff --git a/localedata/locales/se_NO b/localedata/locales/se_NO index 1c98500a2c..d9eccf54ef 100644 --- a/localedata/locales/se_NO +++ b/localedata/locales/se_NO @@ -1,4 +1,3 @@ -# $Id$ comment_char % escape_char / % @@ -71,7 +70,7 @@ collating-symbol collating-symbol collating-symbol -% +% reorder-after @@ -267,7 +266,7 @@ am_pm "";"" t_fmt_ampm "" % Denne linjen vil gi f.eks.: -% duorasdat, borgemnu 23. b. 2001 00:47:57 CEST +% duorasdat, borgemnu 23. b. 2001 00:47:57 CEST date_fmt "/ / " diff --git a/login/endutxent.c b/login/endutxent.c new file mode 100644 index 0000000000..2a93081c83 --- /dev/null +++ b/login/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 , 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 +#include + +void +endutxent (void) +{ + __endutent (); +} diff --git a/login/getpt.c b/login/getpt.c new file mode 100644 index 0000000000..cd7107e5d6 --- /dev/null +++ b/login/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 , 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 +#include + +/* 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 diff --git a/login/getutmp.c b/login/getutmp.c new file mode 100644 index 0000000000..275c1a8738 --- /dev/null +++ b/login/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 +#include +#include + +/* 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/login/getutmpx.c b/login/getutmpx.c new file mode 100644 index 0000000000..5f53f22e6c --- /dev/null +++ b/login/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 +#include +#include + +/* 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/login/getutxent.c b/login/getutxent.c new file mode 100644 index 0000000000..4961dee051 --- /dev/null +++ b/login/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 , 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 +#include + +struct utmpx * +getutxent (void) +{ + return (struct utmpx *) __getutent (); +} diff --git a/login/getutxid.c b/login/getutxid.c new file mode 100644 index 0000000000..ba9d5b79d8 --- /dev/null +++ b/login/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 , 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 +#include + +struct utmpx * +getutxid (const struct utmpx *id) +{ + return (struct utmpx *) __getutid ((const struct utmp *) id); +} diff --git a/login/getutxline.c b/login/getutxline.c new file mode 100644 index 0000000000..74149534c4 --- /dev/null +++ b/login/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 , 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 +#include + +struct utmpx * +getutxline (const struct utmpx *line) +{ + return (struct utmpx *) __getutline ((const struct utmp *) line); +} diff --git a/login/grantpt.c b/login/grantpt.c new file mode 100644 index 0000000000..65da95b308 --- /dev/null +++ b/login/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 , 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 +#include + +/* 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 diff --git a/login/ptsname.c b/login/ptsname.c new file mode 100644 index 0000000000..c16e056a97 --- /dev/null +++ b/login/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 , 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 +#include +#include + +/* 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/login/pututxline.c b/login/pututxline.c new file mode 100644 index 0000000000..1ed5178862 --- /dev/null +++ b/login/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 , 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 +#include + +struct utmpx * +pututxline (const struct utmpx *utmpx) +{ + return (struct utmpx *) __pututline ((const struct utmp *) utmpx); +} diff --git a/login/setutxent.c b/login/setutxent.c new file mode 100644 index 0000000000..b6cd282644 --- /dev/null +++ b/login/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 , 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 +#include + +void +setutxent (void) +{ + return __setutent (); +} diff --git a/login/unlockpt.c b/login/unlockpt.c new file mode 100644 index 0000000000..c5c4890f59 --- /dev/null +++ b/login/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 , 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 +#include + +/* 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 diff --git a/login/updwtmp.c b/login/updwtmp.c new file mode 100644 index 0000000000..415e1dbd42 --- /dev/null +++ b/login/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 , 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 + +#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/login/updwtmpx.c b/login/updwtmpx.c new file mode 100644 index 0000000000..13a7045286 --- /dev/null +++ b/login/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 , 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 +#include + +void +updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx) +{ + __updwtmp (wtmpx_file, (const struct utmp *) utmpx); +} diff --git a/login/utmp_file.c b/login/utmp_file.c new file mode 100644 index 0000000000..e7743bfac8 --- /dev/null +++ b/login/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 + and Paul Janzen , 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#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/login/utmpxname.c b/login/utmpxname.c new file mode 100644 index 0000000000..06ff80b982 --- /dev/null +++ b/login/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 , 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 +#include + +int +utmpxname (const char *file) +{ + return __utmpname (file); +} diff --git a/mach/err_kern.sub b/mach/err_kern.sub index e2e498d2b7..ab00ae40f2 100644 --- a/mach/err_kern.sub +++ b/mach/err_kern.sub @@ -24,16 +24,7 @@ * rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.5 1996/12/20 01:32:34 drepper - * Update from main archive 961219 - * - * Revision 1.5 1996/12/19 20:23:39 drepper - * Spelling corrections. - * - * Revision 1.4 1993/12/17 06:14:52 mib - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.3 92/04/01 19:38:02 rpd * Added err_codes_device. diff --git a/mach/err_server.sub b/mach/err_server.sub index 1594246462..a2f806aa09 100644 --- a/mach/err_server.sub +++ b/mach/err_server.sub @@ -1,48 +1,45 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ /* * HISTORY - * $Log$ - * Revision 1.1 1992/10/06 18:29:53 roland - * entered into RCS * * Revision 2.2 92/01/16 00:10:29 rpd * Moved from user collection to mk collection. - * + * * Revision 2.3 91/08/29 15:51:39 rpd * Fixed err_codes_netname. * [91/08/22 rpd] - * + * * Revision 2.2 91/03/27 16:05:51 mrt * First checkin - * + * * Revision 2.3 90/10/29 17:27:20 dpj * Merged-up to U25 * [90/09/02 20:00:25 dpj] - * + * */ /* * File: err_server.sub @@ -371,4 +368,3 @@ static struct error_subsystem err_server_sub[] = { }, }; - diff --git a/mach/err_us.sub b/mach/err_us.sub index 7261165d8d..184f11d369 100644 --- a/mach/err_us.sub +++ b/mach/err_us.sub @@ -1,40 +1,37 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ /* * HISTORY - * $Log$ - * Revision 1.2 1993/11/23 21:14:05 mib - * entered into RCS * * Revision 2.2 92/01/16 00:10:45 rpd * Moved from user collection to mk collection. - * + * * Revision 2.2 91/03/27 16:06:06 mrt * First checkin - * + * */ /* * File: err_us.sub @@ -49,8 +46,3 @@ static struct error_subsystem err_us_sub[] = { {0,0,0} }; - - - - - diff --git a/mach/error_compat.c b/mach/error_compat.c index e874dd43d4..8f7bd87c0f 100644 --- a/mach/error_compat.c +++ b/mach/error_compat.c @@ -1,54 +1,33 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990,1989 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* This file was broken out from: - $Log$ - Revision 1.2 1997/03/16 17:41:36 drepper - (__mach_error_map_compat): Give full prototype. - - Revision 1.2 1997/03/14 15:26:28 thomas - Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG - - * mach/mach_error.c (mach_error_string_int): Give full prototype. - * mach/errstring.c (mach_error_string_int): Likewise. - * mach/error_compat.c (__mach_error_map_compat): Likewise. - - * mach/spin-solid.c: Include . - * mach/spin-solid.c (__spin_lock_solid): Provide arg to - swtch_pri. - - * mach/mach_init.c: Include . - - * mach/mach_error.h (mach_error_string, mach_error, - mach_error_type): Always provide prototypes. - - Revision 1.1 1993/11/30 17:35:24 roland - entered into RCS Revision 2.3 92/04/01 19:38:18 rpd + The static do_compat function is renamed to be globally accessible. */ @@ -62,9 +41,9 @@ __mach_error_map_compat(mach_error_t *org_err) { mach_error_t err = *org_err; - /* - * map old error numbers to - * to new error sys & subsystem + /* + * map old error numbers to + * to new error sys & subsystem */ if ((-200 < err) && (err <= -100)) diff --git a/mach/errorlib.h b/mach/errorlib.h index 7fe6350b43..ff0c55eb36 100644 --- a/mach/errorlib.h +++ b/mach/errorlib.h @@ -1,47 +1,41 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990,1989 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.5 1995/03/10 23:57:44 roland - * (errors): Use const for decl. - * - * Revision 1.4 1993/12/17 21:56:16 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.3 92/03/31 15:18:52 rpd * Added KERN_DEVICE_MOD for device errors. * [92/03/09 rpd] - * + * * Revision 2.2 92/01/16 00:21:17 rpd * Moved from user collection to mk collection. - * + * * Revision 2.2 91/03/27 15:37:37 mrt * First checkin - * + * */ /* * File: errorlib.h diff --git a/mach/errstring.c b/mach/errstring.c index e56fa728cc..52cf1eb46e 100644 --- a/mach/errstring.c +++ b/mach/errstring.c @@ -1,62 +1,40 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990,1989 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.2 1997/03/16 17:41:48 drepper - * (mach_error_string_int): Give full prototype. - * - * Revision 1.2 1997/03/14 15:26:29 thomas - * Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG - * - * * mach/mach_error.c (mach_error_string_int): Give full prototype. - * * mach/errstring.c (mach_error_string_int): Likewise. - * * mach/error_compat.c (__mach_error_map_compat): Likewise. - * - * * mach/spin-solid.c: Include . - * * mach/spin-solid.c (__spin_lock_solid): Provide arg to - * swtch_pri. - * - * * mach/mach_init.c: Include . - * - * * mach/mach_error.h (mach_error_string, mach_error, - * mach_error_type): Always provide prototypes. - * - * Revision 1.1 1993/11/30 17:35:58 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.3 92/04/01 19:38:18 rpd * Updated do_compat for kernel device errors, * bootstrap file-system errors. * [92/03/09 rpd] - * + * * Revision 2.2 92/02/20 15:58:08 elf * Created from mach_error.c. * [92/02/11 rpd] - * + * */ #define EXPORT_BOOLEAN diff --git a/mach/mach/error.h b/mach/mach/error.h index 70f189f65e..084d8afd37 100644 --- a/mach/mach/error.h +++ b/mach/mach/error.h @@ -25,28 +25,7 @@ * the rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.3 1997/03/16 17:43:08 drepper - * (mach_error_fn_t): Comment out declaration; it appears to be entirely - * unused dead code. - * - * Revision 1.3 1997/03/14 15:27:35 thomas - * Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG - * - * * mach/mach/mach_traps.h: Include . - * - * * mach/mach/error.h (mach_error_fn_t): Comment out declaration; it - * appears to be entirely unused dead code. - * - * Revision 1.2 1996/12/20 01:32:36 drepper - * Update from main archive 961219 - * - * Revision 1.2 1996/12/19 20:23:56 drepper - * Spelling corrections. - * - * Revision 1.1 1993/12/17 21:40:28 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.6 93/01/14 17:41:31 danner * Standardized include symbol name. diff --git a/mach/mach_error.c b/mach/mach_error.c index f6f945fd73..8bbb2ec74e 100644 --- a/mach/mach_error.c +++ b/mach/mach_error.c @@ -1,73 +1,51 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990,1989 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.2 1997/03/16 17:42:02 drepper - * (mach_error_string_int): Give full prototype. - * - * Revision 1.2 1997/03/14 15:26:30 thomas - * Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG - * - * * mach/mach_error.c (mach_error_string_int): Give full prototype. - * * mach/errstring.c (mach_error_string_int): Likewise. - * * mach/error_compat.c (__mach_error_map_compat): Likewise. - * - * * mach/spin-solid.c: Include . - * * mach/spin-solid.c (__spin_lock_solid): Provide arg to - * swtch_pri. - * - * * mach/mach_init.c: Include . - * - * * mach/mach_error.h (mach_error_string, mach_error, - * mach_error_type): Always provide prototypes. - * - * Revision 1.1 1992/10/06 18:29:54 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.4 92/02/19 15:10:52 elf * Moved mach_error_string and mach_error_type to mach_error_string.c. * [92/02/11 rpd] - * + * * Revision 2.3 92/01/23 15:22:06 rpd * Changed to . * [92/01/16 rpd] - * + * * Revision 2.2 92/01/16 00:08:03 rpd * Moved from user collection to mk collection. - * + * * Revision 2.3 91/08/29 15:51:50 rpd * Changed IPC_MIG_MOD to MACH_IPC_MIG_MOD, to get the new error strings. * [91/08/22 rpd] - * + * * Revision 2.2 91/03/27 16:06:29 mrt * Changed include of "errorlib.h" to * Added new copyright * [91/03/20 mrt] - * + * */ /* * File: mach_error.c @@ -85,7 +63,7 @@ extern char * mach_error_string_int(mach_error_t, boolean_t *); void -mach_error( str, err ) +mach_error( str, err ) char *str; mach_error_t err; { diff --git a/mach/mach_error.h b/mach/mach_error.h index 78f7c526ea..fc4a3fed7e 100644 --- a/mach/mach_error.h +++ b/mach/mach_error.h @@ -24,38 +24,7 @@ * rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.4 2001/04/01 05:03:14 roland - * 2001-03-11 Roland McGrath - * - * * mach/mach_error.h: Fix ancient #endif syntax. - * * hurd/hurdmalloc.c: Likewise. - * - * Revision 1.3 1997/03/16 17:42:25 drepper - * (mach_error_string, mach_error, mach_error_type): Always provide - * prototypes. - * (mach_error_fn_t): Comment out declaration; it appears to be entirely - * unused dead code. - * - * Revision 1.3 1997/03/14 15:26:31 thomas - * Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG - * - * * mach/mach_error.c (mach_error_string_int): Give full prototype. - * * mach/errstring.c (mach_error_string_int): Likewise. - * * mach/error_compat.c (__mach_error_map_compat): Likewise. - * - * * mach/spin-solid.c: Include . - * * mach/spin-solid.c (__spin_lock_solid): Provide arg to - * swtch_pri. - * - * * mach/mach_init.c: Include . - * - * * mach/mach_error.h (mach_error_string, mach_error, - * mach_error_type): Always provide prototypes. - * - * Revision 1.2 1993/11/23 20:39:08 mib - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.2 92/01/16 00:08:10 rpd * Moved from user collection to mk collection. diff --git a/mach/mig-reply.c b/mach/mig-reply.c new file mode 100644 index 0000000000..3b02028858 --- /dev/null +++ b/mach/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 + +/* 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/mach/msg-destroy.c b/mach/msg-destroy.c index 9ecbdc0512..19f96d4e21 100644 --- a/mach/msg-destroy.c +++ b/mach/msg-destroy.c @@ -24,36 +24,7 @@ * the rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.6 2002/02/17 07:13:36 roland - * 2002-02-16 Roland McGrath - * - * * mach/msg-destroy.c (__mach_msg_destroy) [MACH_MSG_PORT_DESCRIPTOR]: - * Grok the OSF flavor of message format. - * (mach_msg_destroy_port): For MAKE_SEND and - * MAKE_SEND_ONCE rights, create an destroy a right to ensure proper - * no-senders notification. - * - * Revision 1.5 1997/06/21 01:40:07 drepper - * More 64bit changes. - * - * Revision 1.4 1996/11/15 19:44:43 thomas - * Tue Nov 12 16:58:41 1996 Thomas Bushnell, n/BSG - * - * * mach/mach.h (__mach_msg_destroy, mach_msg_destroy, __mach_msg): - * Provide prototypes. - * - * * mach/msg-destroy.c (mach_msg_destroy_port, - * mach_msg_destroy_memory): Use prototype syntax. - * * hurd/hurdmalloc.c (more_memory, malloc_fork_prepare, - * malloc_fork_parent, malloc_fork_child): Likewise. - * - * Revision 1.3 1995/01/23 22:16:52 roland - * (mach_msg_destroy): Define as weak alias for __mach_msg_destroy. - * - * Revision 1.2 1993/08/03 06:13:18 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.4 91/05/14 17:53:15 mrt * Correcting copyright diff --git a/mach/msgserver.c b/mach/msgserver.c index 82dc3d0c8f..9478ae1914 100644 --- a/mach/msgserver.c +++ b/mach/msgserver.c @@ -47,45 +47,7 @@ * the rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.9 2002/02/18 20:56:35 roland - * 2002-02-18 Roland McGrath - * - * * mach/msgserver.c (__mach_msg_server_timeout) [! MACH_RCV_LARGE]: - * Double MAX_SIZE and don't retry on MACH_RCV_TOO_LARGE. - * - * Revision 1.8 2002/02/17 07:13:32 roland - * 2002-02-16 Roland McGrath - * - * * mach/msgserver.c [NDR_CHAR_ASCII] (mig_reply_header_t): #define as - * mig_reply_error_t for OSF Mach variant. - * - * Revision 1.7 2001/07/06 04:55:34 aj - * Update to LGPL v2.1. - * - * Revision 1.6 2001/04/09 21:23:38 roland - * 2001-04-07 Roland McGrath - * - * * mach/msgserver.c (__mach_msg_server_timeout): Add an assert. - * - * Revision 1.5 1996/12/20 01:32:35 drepper - * Update from main archive 961219 - * - * Revision 1.5 1996/12/19 20:23:45 drepper - * Spelling corrections. - * - * Revision 1.4 1996/01/29 15:44:23 roland - * Declare DEMUX arg with prototype. - * - * Revision 1.3 1995/01/21 15:00:57 roland - * Converted to use weak aliases with macros from libc-symbols.h. - * - * Revision 1.2 1994/10/10 07:20:14 roland - * Increase default MAX_SIZE to two pages. - * - * Revision 1.1 1993/12/06 23:25:25 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.4 91/05/14 17:53:22 mrt * Correcting copyright diff --git a/malloc/arena.c b/malloc/arena.c index abbca1f02e..d0d223e94e 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -18,8 +18,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id$ */ - #include /* Compile-time constants. */ diff --git a/malloc/hooks.c b/malloc/hooks.c index 5dd2d65e62..708f0faf83 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -18,8 +18,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id$ */ - /* What to do if the standard debugging hooks are in place and a corrupt pointer is detected: do nothing (0), print an error message (1), or call abort() (2). */ diff --git a/malloc/malloc.c b/malloc/malloc.c index f9aa5b1226..7730963637 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -24,7 +24,6 @@ Doug Lea and adapted to multiple threads/arenas by Wolfram Gloger. * Version ptmalloc2-20011215 - $Id$ based on: VERSION 2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) diff --git a/malloc/memusagestat.c b/malloc/memusagestat.c index b1cad9b251..91e00af6d4 100644 --- a/malloc/memusagestat.c +++ b/malloc/memusagestat.c @@ -1,22 +1,20 @@ /* Generate graphic from memory profiling data. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define _FILE_OFFSET_BITS 64 @@ -311,7 +309,7 @@ main (int argc, char *argv[]) (maxsize_heap / heap_scale); gdImageDashedLine (im_out, 40, ysize - 20 - cnt, xsize - 40, ysize - 20 - cnt, red); - snprintf (buf, sizeof (buf), heap_format, maxsize_heap / 4 * line / + snprintf (buf, sizeof (buf), heap_format, maxsize_heap / 4 * line / heap_scale); gdImageString (im_out, gdFontSmall, 39 - strlen (buf) * 6, ysize - 26 - cnt, buf, red); diff --git a/malloc/morecore.c b/malloc/morecore.c new file mode 100644 index 0000000000..0a66ef5a85 --- /dev/null +++ b/malloc/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 +#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 +#include +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/malloc/tst-mallocfork.c b/malloc/tst-mallocfork.c index abbc9d83b6..f90ce94887 100644 --- a/malloc/tst-mallocfork.c +++ b/malloc/tst-mallocfork.c @@ -22,9 +22,8 @@ do_test (void) { pid_t parent = getpid (); - struct sigaction action; + struct sigaction action = { .sa_handler = sig_handler }; sigemptyset (&action.sa_mask); - action.sa_handler = sig_handler; malloc (sizeof (int)); diff --git a/manual/dir b/manual/dir index f5920b12be..ee98f79f59 100644 --- a/manual/dir +++ b/manual/dir @@ -1,4 +1,3 @@ -$Id$ This is the file .../info/dir, which contains the topmost node of the Info hierarchy. The first time you invoke Info you start off looking at that node, which is (dir)Top. diff --git a/manual/install.texi b/manual/install.texi index dee5c9b6b6..b538f77fb2 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -357,11 +357,10 @@ understand all the tags used in the document, and the installation mechanism for the info files is not present or works differently. @item -GNU @code{awk} 3.0, or some other POSIX awk +GNU @code{awk} 3.0, or higher -@code{Awk} is used in several places to generate files. The scripts -should work with any POSIX-compliant @code{awk} implementation; -@code{gawk} 3.0 and @code{mawk} 1.3 are known to work. +@code{Awk} is used in several places to generate files. +@code{gawk} 3.0 is known to work. @item Perl 5 diff --git a/manual/stdio.texi b/manual/stdio.texi index 29de41a167..e4278b7a32 100644 --- a/manual/stdio.texi +++ b/manual/stdio.texi @@ -4852,8 +4852,9 @@ Got r @comment GNU @deftypefun {FILE *} open_memstream (char **@var{ptr}, size_t *@var{sizeloc}) This function opens a stream for writing to a buffer. The buffer is -allocated dynamically (as with @code{malloc}; @pxref{Unconstrained -Allocation}) and grown as necessary. +allocated dynamically and grown as necessary, using @code{malloc}. +After you've closed the stream, this buffer is your responsibility to +clean up using @code{free} or @code{realloc}. @xref{Unconstrained Allocation}. When the stream is closed with @code{fclose} or flushed with @code{fflush}, the locations @var{ptr} and @var{sizeloc} are updated to diff --git a/math/cabsf.c b/math/cabsf.c new file mode 100644 index 0000000000..956db76ba1 --- /dev/null +++ b/math/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 , 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 +#include + +float +__cabsf (float _Complex z) +{ + return __hypotf (__real__ z, __imag__ z); +} +weak_alias (__cabsf, cabsf) diff --git a/math/cargf.c b/math/cargf.c new file mode 100644 index 0000000000..df1f20bc48 --- /dev/null +++ b/math/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 , 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 +#include + +float +__cargf (__complex__ float x) +{ + return __atan2f (__imag__ x, __real__ x); +} +weak_alias (__cargf, cargf) diff --git a/math/cimagf.c b/math/cimagf.c new file mode 100644 index 0000000000..d4e441e69f --- /dev/null +++ b/math/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 , 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 + +float +__cimagf (float _Complex z) +{ + return __imag__ z; +} +weak_alias (__cimagf, cimagf) diff --git a/math/conjf.c b/math/conjf.c new file mode 100644 index 0000000000..7893891933 --- /dev/null +++ b/math/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 , 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 + +float _Complex +__conjf (float _Complex z) +{ + return ~z; +} +weak_alias (__conjf, conjf) diff --git a/math/crealf.c b/math/crealf.c new file mode 100644 index 0000000000..e3235a874f --- /dev/null +++ b/math/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 , 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 + +float +__crealf (float _Complex z) +{ + return __real__ z; +} +weak_alias (__crealf, crealf) diff --git a/math/e_acoshl.c b/math/e_acoshl.c new file mode 100644 index 0000000000..2c2fbe8eb4 --- /dev/null +++ b/math/e_acoshl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_acoshl (long double x) +{ + fputs ("__ieee754_acoshl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (acoshl) +#include diff --git a/math/e_acosl.c b/math/e_acosl.c new file mode 100644 index 0000000000..d844d885b8 --- /dev/null +++ b/math/e_acosl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_acosl (long double x) +{ + fputs ("__ieee754_acosl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (acosl) +#include diff --git a/math/e_asinl.c b/math/e_asinl.c new file mode 100644 index 0000000000..3b26f030ef --- /dev/null +++ b/math/e_asinl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_asinl (long double x) +{ + fputs ("__ieee754_asinl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (asinl) +#include diff --git a/math/e_atan2l.c b/math/e_atan2l.c new file mode 100644 index 0000000000..0caed8a32f --- /dev/null +++ b/math/e_atan2l.c @@ -0,0 +1,14 @@ +#include +#include +#include + +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 diff --git a/math/e_atanhl.c b/math/e_atanhl.c new file mode 100644 index 0000000000..625d42db31 --- /dev/null +++ b/math/e_atanhl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +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 diff --git a/math/e_coshl.c b/math/e_coshl.c new file mode 100644 index 0000000000..0da319b785 --- /dev/null +++ b/math/e_coshl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +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 diff --git a/math/e_exp10.c b/math/e_exp10.c new file mode 100644 index 0000000000..a3eccbb9e6 --- /dev/null +++ b/math/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 , 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 +#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/math/e_exp10f.c b/math/e_exp10f.c new file mode 100644 index 0000000000..7d06d074b8 --- /dev/null +++ b/math/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 , 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 +#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/math/e_exp10l.c b/math/e_exp10l.c new file mode 100644 index 0000000000..56f0cfec2f --- /dev/null +++ b/math/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 , 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 +#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/math/e_exp2l.c b/math/e_exp2l.c new file mode 100644 index 0000000000..64ef6d3d50 --- /dev/null +++ b/math/e_exp2l.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_exp2l (long double x) +{ + fputs ("__ieee754_exp2l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (exp2l) +#include diff --git a/math/e_expl.c b/math/e_expl.c new file mode 100644 index 0000000000..f9467c38ab --- /dev/null +++ b/math/e_expl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_expl (long double x) +{ + fputs ("__ieee754_expl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (expl) +#include diff --git a/math/e_fmodl.c b/math/e_fmodl.c new file mode 100644 index 0000000000..380da24e41 --- /dev/null +++ b/math/e_fmodl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +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 diff --git a/math/e_gammal_r.c b/math/e_gammal_r.c new file mode 100644 index 0000000000..1c45c8421b --- /dev/null +++ b/math/e_gammal_r.c @@ -0,0 +1,15 @@ +#include +#include +#include + +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 diff --git a/math/e_hypotl.c b/math/e_hypotl.c new file mode 100644 index 0000000000..07df22eb36 --- /dev/null +++ b/math/e_hypotl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +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 diff --git a/math/e_j0l.c b/math/e_j0l.c new file mode 100644 index 0000000000..1bf0a1de73 --- /dev/null +++ b/math/e_j0l.c @@ -0,0 +1,25 @@ +#include +#include +#include +#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 diff --git a/math/e_j1l.c b/math/e_j1l.c new file mode 100644 index 0000000000..656abeba57 --- /dev/null +++ b/math/e_j1l.c @@ -0,0 +1,25 @@ +#include +#include +#include +#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 diff --git a/math/e_jnl.c b/math/e_jnl.c new file mode 100644 index 0000000000..1bfc0695a5 --- /dev/null +++ b/math/e_jnl.c @@ -0,0 +1,25 @@ +#include +#include +#include +#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 diff --git a/math/e_lgammal_r.c b/math/e_lgammal_r.c new file mode 100644 index 0000000000..1784b2663f --- /dev/null +++ b/math/e_lgammal_r.c @@ -0,0 +1,17 @@ +#include +#include +#include +#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 diff --git a/math/e_log10l.c b/math/e_log10l.c new file mode 100644 index 0000000000..5bc264b32c --- /dev/null +++ b/math/e_log10l.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_log10l (long double x) +{ + fputs ("__ieee754_log10l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (log10l) +#include diff --git a/math/e_log2l.c b/math/e_log2l.c new file mode 100644 index 0000000000..681904bfbb --- /dev/null +++ b/math/e_log2l.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_log2l (long double x) +{ + fputs ("__ieee754_log2l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (log2l) +#include diff --git a/math/e_logl.c b/math/e_logl.c new file mode 100644 index 0000000000..9ba9cfc799 --- /dev/null +++ b/math/e_logl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_logl (long double x) +{ + fputs ("__ieee754_logl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (logl) +#include diff --git a/math/e_powl.c b/math/e_powl.c new file mode 100644 index 0000000000..afc2248b6b --- /dev/null +++ b/math/e_powl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +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 diff --git a/math/e_rem_pio2l.c b/math/e_rem_pio2l.c new file mode 100644 index 0000000000..617215516b --- /dev/null +++ b/math/e_rem_pio2l.c @@ -0,0 +1,15 @@ +#include +#include +#include +#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 diff --git a/math/e_scalb.c b/math/e_scalb.c new file mode 100644 index 0000000000..606af53724 --- /dev/null +++ b/math/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 +#include +#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/math/e_scalbf.c b/math/e_scalbf.c new file mode 100644 index 0000000000..95a72eb56d --- /dev/null +++ b/math/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 +#include +#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/math/e_scalbl.c b/math/e_scalbl.c new file mode 100644 index 0000000000..1f5677d9f4 --- /dev/null +++ b/math/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 +#include +#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/math/e_sinhl.c b/math/e_sinhl.c new file mode 100644 index 0000000000..4cec79cb2d --- /dev/null +++ b/math/e_sinhl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +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 diff --git a/math/e_sqrtl.c b/math/e_sqrtl.c new file mode 100644 index 0000000000..7680bdb145 --- /dev/null +++ b/math/e_sqrtl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_sqrtl (long double x) +{ + fputs ("__ieee754_sqrtl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (sqrtl) +#include diff --git a/math/fclrexcpt.c b/math/fclrexcpt.c new file mode 100644 index 0000000000..560e326ee3 --- /dev/null +++ b/math/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 , 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 +#include + +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 diff --git a/math/fedisblxcpt.c b/math/fedisblxcpt.c new file mode 100644 index 0000000000..e1e9065aac --- /dev/null +++ b/math/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 , 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 + +int +fedisableexcept (int excepts) +{ + /* Signal failure. */ + return -1; +} +stub_warning (fedisableexcept) +#include diff --git a/math/feenablxcpt.c b/math/feenablxcpt.c new file mode 100644 index 0000000000..678271f360 --- /dev/null +++ b/math/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 , 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 + +int +feenableexcept (int excepts) +{ + /* Signal failure. */ + return -1; +} +stub_warning (feenableexcept) +#include diff --git a/math/fegetenv.c b/math/fegetenv.c new file mode 100644 index 0000000000..4a878cc41b --- /dev/null +++ b/math/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 , 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 +#include +#include + +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 diff --git a/math/fegetexcept.c b/math/fegetexcept.c new file mode 100644 index 0000000000..1870689e8d --- /dev/null +++ b/math/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 , 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 + +int +fegetexcept (void) +{ + /* Signal failure. */ + return -1; +} +stub_warning (fegetexcept) +#include diff --git a/math/fegetround.c b/math/fegetround.c new file mode 100644 index 0000000000..cf7a774929 --- /dev/null +++ b/math/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 , 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 + +int +fegetround (void) +{ + return 0; +} +stub_warning (fegetround) +#include diff --git a/math/feholdexcpt.c b/math/feholdexcpt.c new file mode 100644 index 0000000000..8680d1e492 --- /dev/null +++ b/math/feholdexcpt.c @@ -0,0 +1,30 @@ +/* Store current floating-point environment and clear exceptions. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 + +int +feholdexcept (fenv_t *envp) +{ + return 1; /* Signal failure. */ +} +libm_hidden_def (feholdexcept) +stub_warning (feholdexcept) +#include diff --git a/math/fesetenv.c b/math/fesetenv.c new file mode 100644 index 0000000000..936d6c121b --- /dev/null +++ b/math/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 , 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 +#include + +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 diff --git a/math/fesetround.c b/math/fesetround.c new file mode 100644 index 0000000000..5b14826390 --- /dev/null +++ b/math/fesetround.c @@ -0,0 +1,30 @@ +/* Set current rounding direction. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 + +int +fesetround (int round) +{ + return 1; /* Signal we are unable to set the direction. */ +} +libm_hidden_def (fesetround) +stub_warning (fesetround) +#include diff --git a/math/feupdateenv.c b/math/feupdateenv.c new file mode 100644 index 0000000000..3e6aed4fdf --- /dev/null +++ b/math/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 , 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 +#include + +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 diff --git a/math/fgetexcptflg.c b/math/fgetexcptflg.c new file mode 100644 index 0000000000..aea2e0ffaf --- /dev/null +++ b/math/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 , 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 +#include + +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 diff --git a/math/fpu_control.c b/math/fpu_control.c new file mode 100644 index 0000000000..cd8eeff99d --- /dev/null +++ b/math/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 +#include + +/* This module defines `__fpu_control' with the default value. */ + +fpu_control_t __fpu_control = _FPU_DEFAULT; diff --git a/math/fraiseexcpt.c b/math/fraiseexcpt.c new file mode 100644 index 0000000000..764634a3b1 --- /dev/null +++ b/math/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 , 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 +#include + +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 diff --git a/math/fsetexcptflg.c b/math/fsetexcptflg.c new file mode 100644 index 0000000000..8d0f0ff64b --- /dev/null +++ b/math/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 , 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 +#include + +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 diff --git a/math/ftestexcept.c b/math/ftestexcept.c new file mode 100644 index 0000000000..4be3fb770f --- /dev/null +++ b/math/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 , 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 + +int +fetestexcept (int excepts) +{ + return 0; +} +stub_warning (fetestexcept) +#include diff --git a/math/k_cosl.c b/math/k_cosl.c new file mode 100644 index 0000000000..29b83d6273 --- /dev/null +++ b/math/k_cosl.c @@ -0,0 +1,15 @@ +#include +#include +#include +#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 diff --git a/math/k_rem_pio2l.c b/math/k_rem_pio2l.c new file mode 100644 index 0000000000..236eb30dd9 --- /dev/null +++ b/math/k_rem_pio2l.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +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 diff --git a/math/k_sincosl.c b/math/k_sincosl.c new file mode 100644 index 0000000000..aa038c26c4 --- /dev/null +++ b/math/k_sincosl.c @@ -0,0 +1 @@ +/* Empty. Not needed. */ diff --git a/math/k_sinl.c b/math/k_sinl.c new file mode 100644 index 0000000000..ea1d71f61b --- /dev/null +++ b/math/k_sinl.c @@ -0,0 +1,15 @@ +#include +#include +#include +#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 diff --git a/math/k_tanl.c b/math/k_tanl.c new file mode 100644 index 0000000000..9993c6b998 --- /dev/null +++ b/math/k_tanl.c @@ -0,0 +1,15 @@ +#include +#include +#include +#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 diff --git a/math/math_private.h b/math/math_private.h index a6a85d3b1e..572e546831 100644 --- a/math/math_private.h +++ b/math/math_private.h @@ -11,7 +11,6 @@ /* * from: @(#)fdlibm.h 5.1 93/09/24 - * $Id$ */ #ifndef _MATH_PRIVATE_H_ diff --git a/math/s_asinhl.c b/math/s_asinhl.c new file mode 100644 index 0000000000..1d5cf47a4f --- /dev/null +++ b/math/s_asinhl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +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 diff --git a/math/s_atanl.c b/math/s_atanl.c new file mode 100644 index 0000000000..d9a7eb6f8f --- /dev/null +++ b/math/s_atanl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +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 diff --git a/math/s_cacos.c b/math/s_cacos.c new file mode 100644 index 0000000000..07b6bdcb9c --- /dev/null +++ b/math/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 , 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 +#include + +__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/math/s_cacosf.c b/math/s_cacosf.c new file mode 100644 index 0000000000..265184e38d --- /dev/null +++ b/math/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 , 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 +#include + +__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/math/s_cacosh.c b/math/s_cacosh.c new file mode 100644 index 0000000000..1ae8708d49 --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_cacoshf.c b/math/s_cacoshf.c new file mode 100644 index 0000000000..52c35505e0 --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_cacoshl.c b/math/s_cacoshl.c new file mode 100644 index 0000000000..4e5e2b3e3e --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_cacosl.c b/math/s_cacosl.c new file mode 100644 index 0000000000..a7ceff891b --- /dev/null +++ b/math/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 , 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 +#include + +__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/math/s_casin.c b/math/s_casin.c new file mode 100644 index 0000000000..2d5b06cf78 --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_casinf.c b/math/s_casinf.c new file mode 100644 index 0000000000..5278dbbf78 --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_casinh.c b/math/s_casinh.c new file mode 100644 index 0000000000..a574add70e --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_casinhf.c b/math/s_casinhf.c new file mode 100644 index 0000000000..7037ab937c --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_casinhl.c b/math/s_casinhl.c new file mode 100644 index 0000000000..376b2347a0 --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_casinl.c b/math/s_casinl.c new file mode 100644 index 0000000000..f303c05ae6 --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_catan.c b/math/s_catan.c new file mode 100644 index 0000000000..1d0673ad6a --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_catanf.c b/math/s_catanf.c new file mode 100644 index 0000000000..25eec2b1b5 --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_catanh.c b/math/s_catanh.c new file mode 100644 index 0000000000..e15c073f96 --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_catanhf.c b/math/s_catanhf.c new file mode 100644 index 0000000000..d2422e6111 --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_catanhl.c b/math/s_catanhl.c new file mode 100644 index 0000000000..c3fb0ce5ff --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_catanl.c b/math/s_catanl.c new file mode 100644 index 0000000000..6cb45e5bee --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_cbrtl.c b/math/s_cbrtl.c new file mode 100644 index 0000000000..d668e377af --- /dev/null +++ b/math/s_cbrtl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +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 diff --git a/math/s_ccos.c b/math/s_ccos.c new file mode 100644 index 0000000000..1b244d7079 --- /dev/null +++ b/math/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 , 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 +#include +#include + + +__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/math/s_ccosf.c b/math/s_ccosf.c new file mode 100644 index 0000000000..4b154deac5 --- /dev/null +++ b/math/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 , 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 +#include +#include + + +__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/math/s_ccosh.c b/math/s_ccosh.c new file mode 100644 index 0000000000..f5b29db24b --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_ccoshf.c b/math/s_ccoshf.c new file mode 100644 index 0000000000..f400d34f0b --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_ccoshl.c b/math/s_ccoshl.c new file mode 100644 index 0000000000..61ffb49ca0 --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_ccosl.c b/math/s_ccosl.c new file mode 100644 index 0000000000..4ebe2c347d --- /dev/null +++ b/math/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 , 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 +#include +#include + + +__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/math/s_cexp.c b/math/s_cexp.c new file mode 100644 index 0000000000..5a299b7687 --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_cexpf.c b/math/s_cexpf.c new file mode 100644 index 0000000000..7b68fc365c --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_cexpl.c b/math/s_cexpl.c new file mode 100644 index 0000000000..cf6bc974a9 --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_clog.c b/math/s_clog.c new file mode 100644 index 0000000000..f796024b47 --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_clog10.c b/math/s_clog10.c new file mode 100644 index 0000000000..62c2ca724a --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_clog10f.c b/math/s_clog10f.c new file mode 100644 index 0000000000..eed81f368c --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_clog10l.c b/math/s_clog10l.c new file mode 100644 index 0000000000..f901543d05 --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_clogf.c b/math/s_clogf.c new file mode 100644 index 0000000000..21e3b57b7f --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_clogl.c b/math/s_clogl.c new file mode 100644 index 0000000000..43118f768c --- /dev/null +++ b/math/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 , 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 +#include + +#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/math/s_cpow.c b/math/s_cpow.c new file mode 100644 index 0000000000..86536cc95b --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_cpowf.c b/math/s_cpowf.c new file mode 100644 index 0000000000..58eaa1aa06 --- /dev/null +++ b/math/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 , 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 +#include + + +__complex__ float +__cpowf (__complex__ float x, __complex__ float c) +{ + return __cexpf (c * __clogf (x)); +} +#ifndef __cpowf +weak_alias (__cpowf, cpowf) +#endif diff --git a/math/s_cpowl.c b/math/s_cpowl.c new file mode 100644 index 0000000000..4c358b3ebe --- /dev/null +++ b/math/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 , 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 +#include + + +__complex__ long double +__cpowl (__complex__ long double x, __complex__ long double c) +{ + return __cexpl (c * __clogl (x)); +} +weak_alias (__cpowl, cpowl) diff --git a/math/s_cproj.c b/math/s_cproj.c new file mode 100644 index 0000000000..8e7ca41df8 --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_cprojf.c b/math/s_cprojf.c new file mode 100644 index 0000000000..83df13cfa9 --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_cprojl.c b/math/s_cprojl.c new file mode 100644 index 0000000000..c70cdc47db --- /dev/null +++ b/math/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 , 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 +#include + + +__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/math/s_csin.c b/math/s_csin.c new file mode 100644 index 0000000000..eb380e2c3f --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_csinf.c b/math/s_csinf.c new file mode 100644 index 0000000000..8004743bd3 --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_csinh.c b/math/s_csinh.c new file mode 100644 index 0000000000..f0e0cc61f1 --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_csinhf.c b/math/s_csinhf.c new file mode 100644 index 0000000000..e4bb704268 --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_csinhl.c b/math/s_csinhl.c new file mode 100644 index 0000000000..226075634d --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_csinl.c b/math/s_csinl.c new file mode 100644 index 0000000000..f7a1c43600 --- /dev/null +++ b/math/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 , 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 +#include +#include + +#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/math/s_csqrt.c b/math/s_csqrt.c new file mode 100644 index 0000000000..04ed410a16 --- /dev/null +++ b/math/s_csqrt.c @@ -0,0 +1,114 @@ +/* Complex square root of double value. + Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Based on an algorithm by Stephen L. Moshier . + Contributed by Ulrich Drepper , 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 +#include + +#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 = r; + __imag__ res = __copysign (r, __imag__ x); + } + 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/math/s_csqrtf.c b/math/s_csqrtf.c new file mode 100644 index 0000000000..2fba69ce1b --- /dev/null +++ b/math/s_csqrtf.c @@ -0,0 +1,112 @@ +/* Complex square root of float value. + Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Based on an algorithm by Stephen L. Moshier . + Contributed by Ulrich Drepper , 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 +#include + +#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 = r; + __imag__ res = __copysignf (r, __imag__ x); + } + 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/math/s_csqrtl.c b/math/s_csqrtl.c new file mode 100644 index 0000000000..9d00946c51 --- /dev/null +++ b/math/s_csqrtl.c @@ -0,0 +1,110 @@ +/* Complex square root of long double value. + Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Based on an algorithm by Stephen L. Moshier . + Contributed by Ulrich Drepper , 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 +#include + +#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 = r; + __imag__ res = __copysignl (r, __imag__ x); + } + 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/math/s_ctan.c b/math/s_ctan.c new file mode 100644 index 0000000000..0464ab86d5 --- /dev/null +++ b/math/s_ctan.c @@ -0,0 +1,84 @@ +/* Complex tangent function for double. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include + +#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); + + if (den == 0.0) + { + __complex__ double ez = __cexp (1.0i * x); + __complex__ double emz = __cexp (-1.0i * x); + + res = (ez - emz) / (ez + emz) * -1.0i; + } + else + { + __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/math/s_ctanf.c b/math/s_ctanf.c new file mode 100644 index 0000000000..58d9d13298 --- /dev/null +++ b/math/s_ctanf.c @@ -0,0 +1,83 @@ +/* Complex tangent function for float. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include + +#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); + + + if (den == 0.0) + { + __complex__ float ez = __cexpf (1.0i * x); + __complex__ float emz = __cexpf (-1.0i * x); + + res = (ez - emz) / (ez + emz) * -1.0i; + } + else + { + __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/math/s_ctanh.c b/math/s_ctanh.c new file mode 100644 index 0000000000..fe38dae291 --- /dev/null +++ b/math/s_ctanh.c @@ -0,0 +1,84 @@ +/* Complex hyperbole tangent for double. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include + +#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); + + if (den == 0.0) + { + __complex__ double ez = __cexp (x); + __complex__ double emz = __cexp (-x); + + res = (ez - emz) / (ez + emz); + } + else + { + __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/math/s_ctanhf.c b/math/s_ctanhf.c new file mode 100644 index 0000000000..c331dbaabb --- /dev/null +++ b/math/s_ctanhf.c @@ -0,0 +1,82 @@ +/* Complex hyperbole tangent for float. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include + +#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); + + if (den == 0.0f) + { + __complex__ float ez = __cexpf (x); + __complex__ float emz = __cexpf (-x); + + res = (ez - emz) / (ez + emz); + } + else + { + __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/math/s_ctanhl.c b/math/s_ctanhl.c new file mode 100644 index 0000000000..77ca8f8717 --- /dev/null +++ b/math/s_ctanhl.c @@ -0,0 +1,80 @@ +/* Complex hyperbole tangent for long double. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include + +#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); + + if (den == 0.0L) + { + __complex__ long double ez = __cexpl (x); + __complex__ long double emz = __cexpl (-x); + + res = (ez - emz) / (ez + emz); + } + else + { + __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den; + __imag__ res = sin2ix / den; + } + } + + return res; +} +weak_alias (__ctanhl, ctanhl) diff --git a/math/s_ctanl.c b/math/s_ctanl.c new file mode 100644 index 0000000000..89379a5ff9 --- /dev/null +++ b/math/s_ctanl.c @@ -0,0 +1,81 @@ +/* Complex tangent function for long double. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include +#include + +#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); + + + if (den == 0.0) + { + __complex__ long double ez = __cexpl (1.0i * x); + __complex__ long double emz = __cexpl (-1.0i * x); + + res = (ez - emz) / (ez + emz) * -1.0i; + } + else + { + __real__ res = sin2rx / den; + __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den; + } + } + + return res; +} +weak_alias (__ctanl, ctanl) diff --git a/math/s_erfl.c b/math/s_erfl.c new file mode 100644 index 0000000000..f329d58809 --- /dev/null +++ b/math/s_erfl.c @@ -0,0 +1,26 @@ +#include +#include +#include + +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 diff --git a/math/s_expm1l.c b/math/s_expm1l.c new file mode 100644 index 0000000000..b69d6aeb97 --- /dev/null +++ b/math/s_expm1l.c @@ -0,0 +1,16 @@ +#include +#include +#include + +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 diff --git a/math/s_fdim.c b/math/s_fdim.c new file mode 100644 index 0000000000..5804e631c3 --- /dev/null +++ b/math/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 , 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 + +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/math/s_fdimf.c b/math/s_fdimf.c new file mode 100644 index 0000000000..2f3ce303ae --- /dev/null +++ b/math/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 , 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 + +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/math/s_fdiml.c b/math/s_fdiml.c new file mode 100644 index 0000000000..70246bafbd --- /dev/null +++ b/math/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 , 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 + +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/math/s_fma.c b/math/s_fma.c new file mode 100644 index 0000000000..e5ff5a7228 --- /dev/null +++ b/math/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 , 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 + +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/math/s_fmaf.c b/math/s_fmaf.c new file mode 100644 index 0000000000..caa7f3afe8 --- /dev/null +++ b/math/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 , 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 + +float +__fmaf (float x, float y, float z) +{ + return (x * y) + z; +} +weak_alias (__fmaf, fmaf) diff --git a/math/s_fmal.c b/math/s_fmal.c new file mode 100644 index 0000000000..b89e88b9a3 --- /dev/null +++ b/math/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 , 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 + +long double +__fmal (long double x, long double y, long double z) +{ + return (x * y) + z; +} +weak_alias (__fmal, fmal) diff --git a/math/s_fmax.c b/math/s_fmax.c new file mode 100644 index 0000000000..f93e14f28c --- /dev/null +++ b/math/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 , 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 + + +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/math/s_fmaxf.c b/math/s_fmaxf.c new file mode 100644 index 0000000000..6f368e18b0 --- /dev/null +++ b/math/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 , 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 + + +float +__fmaxf (float x, float y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmaxf, fmaxf) diff --git a/math/s_fmaxl.c b/math/s_fmaxl.c new file mode 100644 index 0000000000..68c7060f42 --- /dev/null +++ b/math/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 , 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 + + +long double +__fmaxl (long double x, long double y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmaxl, fmaxl) diff --git a/math/s_fmin.c b/math/s_fmin.c new file mode 100644 index 0000000000..78f02da74a --- /dev/null +++ b/math/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 , 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 + + +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/math/s_fminf.c b/math/s_fminf.c new file mode 100644 index 0000000000..d6aa9ccf62 --- /dev/null +++ b/math/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 , 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 + + +float +__fminf (float x, float y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fminf, fminf) diff --git a/math/s_fminl.c b/math/s_fminl.c new file mode 100644 index 0000000000..5c1610aa85 --- /dev/null +++ b/math/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 , 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 + + +long double +__fminl (long double x, long double y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fminl, fminl) diff --git a/math/s_ldexp.c b/math/s_ldexp.c new file mode 100644 index 0000000000..62e123cd01 --- /dev/null +++ b/math/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 +#include "math_private.h" +#include + +#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/math/s_ldexpf.c b/math/s_ldexpf.c new file mode 100644 index 0000000000..1ea5e09f8f --- /dev/null +++ b/math/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 +#include "math_private.h" +#include + +#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/math/s_ldexpl.c b/math/s_ldexpl.c new file mode 100644 index 0000000000..df8b29f94d --- /dev/null +++ b/math/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 +#include "math_private.h" +#include + +#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/math/s_log1pl.c b/math/s_log1pl.c new file mode 100644 index 0000000000..e5db9078bf --- /dev/null +++ b/math/s_log1pl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +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 diff --git a/math/s_nan.c b/math/s_nan.c new file mode 100644 index 0000000000..9b2c50558b --- /dev/null +++ b/math/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 , 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 +#include +#include +#include +#include + + +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/math/s_nanf.c b/math/s_nanf.c new file mode 100644 index 0000000000..2e1b1eb911 --- /dev/null +++ b/math/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 , 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 +#include +#include +#include +#include + + +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/math/s_nanl.c b/math/s_nanl.c new file mode 100644 index 0000000000..9709b92383 --- /dev/null +++ b/math/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 , 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 +#include +#include +#include +#include + + +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/math/s_nextafter.c b/math/s_nextafter.c new file mode 100644 index 0000000000..9c678b79c5 --- /dev/null +++ b/math/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 +#include "math_private.h" +#include + +#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/math/s_nexttowardf.c b/math/s_nexttowardf.c new file mode 100644 index 0000000000..1a1026612e --- /dev/null +++ b/math/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 +#include "math_private.h" +#include + +#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/math/s_nexttowardl.c b/math/s_nexttowardl.c new file mode 100644 index 0000000000..73c3610fc1 --- /dev/null +++ b/math/s_nexttowardl.c @@ -0,0 +1 @@ +/* This function is the same as nextafterl so we use an alias there. */ diff --git a/math/s_significand.c b/math/s_significand.c new file mode 100644 index 0000000000..4a02dbcba1 --- /dev/null +++ b/math/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 +#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/math/s_significandf.c b/math/s_significandf.c new file mode 100644 index 0000000000..69de1e6b0e --- /dev/null +++ b/math/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 +#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/math/s_significandl.c b/math/s_significandl.c new file mode 100644 index 0000000000..9fa0e4ff91 --- /dev/null +++ b/math/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 +#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/math/s_tanhl.c b/math/s_tanhl.c new file mode 100644 index 0000000000..bc9a2d7f48 --- /dev/null +++ b/math/s_tanhl.c @@ -0,0 +1,15 @@ +#include +#include +#include + +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 diff --git a/math/setfpucw.c b/math/setfpucw.c new file mode 100644 index 0000000000..cb50f9f3f1 --- /dev/null +++ b/math/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 +#include + +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/math/t_sincosl.c b/math/t_sincosl.c new file mode 100644 index 0000000000..6b271e6ff1 --- /dev/null +++ b/math/t_sincosl.c @@ -0,0 +1 @@ +/* Empty. Not needed unless ldbl __kernel_* functions use it. */ diff --git a/math/w_acos.c b/math/w_acos.c new file mode 100644 index 0000000000..f4e6e3c910 --- /dev/null +++ b/math/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 +#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/math/w_acosf.c b/math/w_acosf.c new file mode 100644 index 0000000000..a8998efb84 --- /dev/null +++ b/math/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 +#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/math/w_acosh.c b/math/w_acosh.c new file mode 100644 index 0000000000..e8322ec667 --- /dev/null +++ b/math/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 +#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/math/w_acoshf.c b/math/w_acoshf.c new file mode 100644 index 0000000000..62f94b80e7 --- /dev/null +++ b/math/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 +#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/math/w_acoshl.c b/math/w_acoshl.c new file mode 100644 index 0000000000..ae67911ae5 --- /dev/null +++ b/math/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 +#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/math/w_acosl.c b/math/w_acosl.c new file mode 100644 index 0000000000..9ab4de899f --- /dev/null +++ b/math/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 +#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/math/w_asin.c b/math/w_asin.c new file mode 100644 index 0000000000..d531fbd26a --- /dev/null +++ b/math/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 +#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/math/w_asinf.c b/math/w_asinf.c new file mode 100644 index 0000000000..b19b5c54e3 --- /dev/null +++ b/math/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 +#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/math/w_asinl.c b/math/w_asinl.c new file mode 100644 index 0000000000..fb5ee35fc0 --- /dev/null +++ b/math/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 +#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/math/w_atan2.c b/math/w_atan2.c new file mode 100644 index 0000000000..f0a10d4102 --- /dev/null +++ b/math/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 +#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/math/w_atan2f.c b/math/w_atan2f.c new file mode 100644 index 0000000000..efb08f076b --- /dev/null +++ b/math/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 +#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/math/w_atan2l.c b/math/w_atan2l.c new file mode 100644 index 0000000000..9672e9615f --- /dev/null +++ b/math/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 +#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/math/w_atanh.c b/math/w_atanh.c new file mode 100644 index 0000000000..b81f65c311 --- /dev/null +++ b/math/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 +#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/math/w_atanhf.c b/math/w_atanhf.c new file mode 100644 index 0000000000..52a144c05a --- /dev/null +++ b/math/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 +#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/math/w_atanhl.c b/math/w_atanhl.c new file mode 100644 index 0000000000..5ce53b847d --- /dev/null +++ b/math/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 +#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/math/w_cosh.c b/math/w_cosh.c new file mode 100644 index 0000000000..033a034059 --- /dev/null +++ b/math/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 +#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/math/w_coshf.c b/math/w_coshf.c new file mode 100644 index 0000000000..8e24ca9adc --- /dev/null +++ b/math/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 +#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/math/w_coshl.c b/math/w_coshl.c new file mode 100644 index 0000000000..5f4623a81a --- /dev/null +++ b/math/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 +#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/math/w_drem.c b/math/w_drem.c new file mode 100644 index 0000000000..9e2b1e7472 --- /dev/null +++ b/math/w_drem.c @@ -0,0 +1,20 @@ +/* + * drem() wrapper for remainder(). + * + * Written by J.T. Conklin, + * Placed into the Public Domain, 1994. + */ + +#include + +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/math/w_dremf.c b/math/w_dremf.c new file mode 100644 index 0000000000..c3d391d634 --- /dev/null +++ b/math/w_dremf.c @@ -0,0 +1,17 @@ +/* + * dremf() wrapper for remainderf(). + * + * Written by J.T. Conklin, + * Placed into the Public Domain, 1994. + */ + +#include +#include "math_private.h" + +float +__dremf(x, y) + float x, y; +{ + return __remainderf(x, y); +} +weak_alias (__dremf, dremf) diff --git a/math/w_dreml.c b/math/w_dreml.c new file mode 100644 index 0000000000..aa73eedc49 --- /dev/null +++ b/math/w_dreml.c @@ -0,0 +1,18 @@ +/* + * dreml() wrapper for remainderl(). + * + * Written by J.T. Conklin, + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + * Placed into the Public Domain, 1994. + */ + +#include + +long double +__dreml(x, y) + long double x, y; +{ + return __remainderl(x, y); +} +weak_alias (__dreml, dreml) diff --git a/math/w_exp10.c b/math/w_exp10.c new file mode 100644 index 0000000000..9447d8fa2a --- /dev/null +++ b/math/w_exp10.c @@ -0,0 +1,51 @@ +/* @(#)w_exp10.c + * Conversion to exp10 by Ulrich Drepper . + */ + +/* + * ==================================================== + * 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 +#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/math/w_exp10f.c b/math/w_exp10f.c new file mode 100644 index 0000000000..78e71be069 --- /dev/null +++ b/math/w_exp10f.c @@ -0,0 +1,46 @@ +/* w_exp10f.c -- float version of w_exp10.c. + * Conversion to exp10 by Ulrich Drepper . + */ + +/* + * ==================================================== + * 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 +#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/math/w_exp10l.c b/math/w_exp10l.c new file mode 100644 index 0000000000..368ed77304 --- /dev/null +++ b/math/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 +#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/math/w_exp2.c b/math/w_exp2.c new file mode 100644 index 0000000000..446e5ea91c --- /dev/null +++ b/math/w_exp2.c @@ -0,0 +1,36 @@ +/* + * wrapper exp2(x) + */ + +#include +#include +#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, __exp2l) +weak_alias (__exp2, exp2l) +#endif diff --git a/math/w_exp2f.c b/math/w_exp2f.c new file mode 100644 index 0000000000..9120c88b60 --- /dev/null +++ b/math/w_exp2f.c @@ -0,0 +1,32 @@ +/* + * wrapper exp2f(x) + */ + +#include +#include +#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/math/w_exp2l.c b/math/w_exp2l.c new file mode 100644 index 0000000000..fea5425ac4 --- /dev/null +++ b/math/w_exp2l.c @@ -0,0 +1,31 @@ +/* + * wrapper exp2l(x) + */ + +#include +#include +#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/math/w_expl.c b/math/w_expl.c new file mode 100644 index 0000000000..70096a820c --- /dev/null +++ b/math/w_expl.c @@ -0,0 +1,13 @@ +#include +#include +#include + +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/math/w_fmod.c b/math/w_fmod.c new file mode 100644 index 0000000000..43a1d8ef5c --- /dev/null +++ b/math/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 +#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/math/w_fmodf.c b/math/w_fmodf.c new file mode 100644 index 0000000000..2bd133f2d7 --- /dev/null +++ b/math/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 +#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/math/w_fmodl.c b/math/w_fmodl.c new file mode 100644 index 0000000000..7b9a297cfd --- /dev/null +++ b/math/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 +#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/math/w_hypot.c b/math/w_hypot.c new file mode 100644 index 0000000000..ab929f78ad --- /dev/null +++ b/math/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 +#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/math/w_hypotf.c b/math/w_hypotf.c new file mode 100644 index 0000000000..b6be39e39f --- /dev/null +++ b/math/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 +#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/math/w_hypotl.c b/math/w_hypotl.c new file mode 100644 index 0000000000..916afbd417 --- /dev/null +++ b/math/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 +#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/math/w_j0.c b/math/w_j0.c new file mode 100644 index 0000000000..5ab3544aa7 --- /dev/null +++ b/math/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 +#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/math/w_j0f.c b/math/w_j0f.c new file mode 100644 index 0000000000..bb2b82f060 --- /dev/null +++ b/math/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 +#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/math/w_j0l.c b/math/w_j0l.c new file mode 100644 index 0000000000..fde0f64f89 --- /dev/null +++ b/math/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 +#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/math/w_j1.c b/math/w_j1.c new file mode 100644 index 0000000000..db8c4ce333 --- /dev/null +++ b/math/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 +#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/math/w_j1f.c b/math/w_j1f.c new file mode 100644 index 0000000000..35b186206e --- /dev/null +++ b/math/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 +#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/math/w_j1l.c b/math/w_j1l.c new file mode 100644 index 0000000000..5ecfd1ec6e --- /dev/null +++ b/math/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 +#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/math/w_jn.c b/math/w_jn.c new file mode 100644 index 0000000000..3a28443dcf --- /dev/null +++ b/math/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 nx, 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 +#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/math/w_jnf.c b/math/w_jnf.c new file mode 100644 index 0000000000..628701d7fa --- /dev/null +++ b/math/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 +#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/math/w_jnl.c b/math/w_jnl.c new file mode 100644 index 0000000000..021c16a104 --- /dev/null +++ b/math/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 nx, 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 +#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/math/w_lgamma.c b/math/w_lgamma.c new file mode 100644 index 0000000000..ab75f75997 --- /dev/null +++ b/math/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 +#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/math/w_lgamma_r.c b/math/w_lgamma_r.c new file mode 100644 index 0000000000..17a7d013e9 --- /dev/null +++ b/math/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 +#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/math/w_lgammaf.c b/math/w_lgammaf.c new file mode 100644 index 0000000000..7c3c058d75 --- /dev/null +++ b/math/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 +#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/math/w_lgammaf_r.c b/math/w_lgammaf_r.c new file mode 100644 index 0000000000..a32c325638 --- /dev/null +++ b/math/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 +#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/math/w_lgammal.c b/math/w_lgammal.c new file mode 100644 index 0000000000..f250e50388 --- /dev/null +++ b/math/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 +#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/math/w_lgammal_r.c b/math/w_lgammal_r.c new file mode 100644 index 0000000000..2dfea8a465 --- /dev/null +++ b/math/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 +#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/math/w_log.c b/math/w_log.c new file mode 100644 index 0000000000..6f6f74fd14 --- /dev/null +++ b/math/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 +#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/math/w_log10.c b/math/w_log10.c new file mode 100644 index 0000000000..9425db3ddf --- /dev/null +++ b/math/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 +#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/math/w_log10f.c b/math/w_log10f.c new file mode 100644 index 0000000000..c63fcd1ec2 --- /dev/null +++ b/math/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 +#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/math/w_log10l.c b/math/w_log10l.c new file mode 100644 index 0000000000..25c051d375 --- /dev/null +++ b/math/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 +#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/math/w_log2.c b/math/w_log2.c new file mode 100644 index 0000000000..d56a6ee663 --- /dev/null +++ b/math/w_log2.c @@ -0,0 +1,32 @@ +/* + * wrapper log2(X) + */ + +#include +#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/math/w_log2f.c b/math/w_log2f.c new file mode 100644 index 0000000000..ec8d297161 --- /dev/null +++ b/math/w_log2f.c @@ -0,0 +1,30 @@ +/* + * wrapper log2(X) + */ + +#include +#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/math/w_log2l.c b/math/w_log2l.c new file mode 100644 index 0000000000..b1d8706f2a --- /dev/null +++ b/math/w_log2l.c @@ -0,0 +1,28 @@ +/* + * wrapper log2l(X) + */ + +#include +#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/math/w_logf.c b/math/w_logf.c new file mode 100644 index 0000000000..46d9749114 --- /dev/null +++ b/math/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 +#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/math/w_logl.c b/math/w_logl.c new file mode 100644 index 0000000000..5a38f20038 --- /dev/null +++ b/math/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 +#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/math/w_pow.c b/math/w_pow.c new file mode 100644 index 0000000000..707cffcc43 --- /dev/null +++ b/math/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 +#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/math/w_powf.c b/math/w_powf.c new file mode 100644 index 0000000000..2480fe559e --- /dev/null +++ b/math/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 +#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/math/w_powl.c b/math/w_powl.c new file mode 100644 index 0000000000..d8be7b7b03 --- /dev/null +++ b/math/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 +#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/math/w_remainder.c b/math/w_remainder.c new file mode 100644 index 0000000000..9d7a7c5383 --- /dev/null +++ b/math/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 +#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/math/w_remainderf.c b/math/w_remainderf.c new file mode 100644 index 0000000000..486e626c28 --- /dev/null +++ b/math/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 +#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/math/w_remainderl.c b/math/w_remainderl.c new file mode 100644 index 0000000000..7635fb9363 --- /dev/null +++ b/math/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 +#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/math/w_scalb.c b/math/w_scalb.c new file mode 100644 index 0000000000..0086c2adfd --- /dev/null +++ b/math/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 +#include "math_private.h" + +#include + +#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/math/w_scalbf.c b/math/w_scalbf.c new file mode 100644 index 0000000000..60cb5670ed --- /dev/null +++ b/math/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 +#include "math_private.h" + +#include + +#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/math/w_scalbl.c b/math/w_scalbl.c new file mode 100644 index 0000000000..c8a45d460d --- /dev/null +++ b/math/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 +#include "math_private.h" + +#include + +#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/math/w_sinh.c b/math/w_sinh.c new file mode 100644 index 0000000000..5bde8a2ddd --- /dev/null +++ b/math/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 +#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/math/w_sinhf.c b/math/w_sinhf.c new file mode 100644 index 0000000000..c29c46620f --- /dev/null +++ b/math/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 +#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/math/w_sinhl.c b/math/w_sinhl.c new file mode 100644 index 0000000000..19eb774d64 --- /dev/null +++ b/math/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 +#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/math/w_sqrt.c b/math/w_sqrt.c new file mode 100644 index 0000000000..41ab1d18b2 --- /dev/null +++ b/math/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 +#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/math/w_sqrtf.c b/math/w_sqrtf.c new file mode 100644 index 0000000000..21beb550f4 --- /dev/null +++ b/math/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 +#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/math/w_sqrtl.c b/math/w_sqrtl.c new file mode 100644 index 0000000000..0b03eebe1d --- /dev/null +++ b/math/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 +#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/math/w_tgamma.c b/math/w_tgamma.c new file mode 100644 index 0000000000..3ce6e77b49 --- /dev/null +++ b/math/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 +#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/math/w_tgammaf.c b/math/w_tgammaf.c new file mode 100644 index 0000000000..d3698059e7 --- /dev/null +++ b/math/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 +#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/math/w_tgammal.c b/math/w_tgammal.c new file mode 100644 index 0000000000..75970a34d4 --- /dev/null +++ b/math/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 +#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/misc/acct.c b/misc/acct.c new file mode 100644 index 0000000000..b626b5d938 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/brk.c b/misc/brk.c new file mode 100644 index 0000000000..b951819f21 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/chflags.c b/misc/chflags.c new file mode 100644 index 0000000000..b678121265 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/chroot.c b/misc/chroot.c new file mode 100644 index 0000000000..f20ccf4c2b --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/fchflags.c b/misc/fchflags.c new file mode 100644 index 0000000000..f191194c12 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/fdatasync.c b/misc/fdatasync.c new file mode 100644 index 0000000000..3edeef0c9e --- /dev/null +++ b/misc/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 + + +/* Synchronize at least the data part of a file with the underlying + media. */ +int +fdatasync (int fildes) +{ + return fsync (fildes); +} diff --git a/misc/fgetxattr.c b/misc/fgetxattr.c new file mode 100644 index 0000000000..610ed32d1f --- /dev/null +++ b/misc/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 +#include + +ssize_t +fgetxattr (int __fd, const char *__name, + void *__value, size_t __size) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (fgetxattr) +#include diff --git a/misc/flistxattr.c b/misc/flistxattr.c new file mode 100644 index 0000000000..fc2863d31c --- /dev/null +++ b/misc/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 +#include + +ssize_t +flistxattr (int __fd, char *__list, size_t __size) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (flistxattr) +#include diff --git a/misc/fremovexattr.c b/misc/fremovexattr.c new file mode 100644 index 0000000000..9719d42d40 --- /dev/null +++ b/misc/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 +#include + +int +fremovexattr (int __fd, const char *__name) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (fremovexattr) +#include diff --git a/misc/fsetxattr.c b/misc/fsetxattr.c new file mode 100644 index 0000000000..8a52e72529 --- /dev/null +++ b/misc/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 +#include + +int +fsetxattr (int __fd, const char *__name, const void *__value, + size_t __size, int __flags) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (fsetxattr) +#include diff --git a/misc/fsync.c b/misc/fsync.c new file mode 100644 index 0000000000..e2a4d700d5 --- /dev/null +++ b/misc/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 +#include + +/* Make all changes done to FD actually appear on disk. */ +int +fsync (fd) + int fd; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (fsync) +#include diff --git a/misc/ftruncate.c b/misc/ftruncate.c new file mode 100644 index 0000000000..d4cca2e267 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/ftruncate64.c b/misc/ftruncate64.c new file mode 100644 index 0000000000..df84b7c3c1 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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/misc/futimes.c b/misc/futimes.c new file mode 100644 index 0000000000..3378dbf416 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/futimesat.c b/misc/futimesat.c new file mode 100644 index 0000000000..74ccd876e6 --- /dev/null +++ b/misc/futimesat.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +/* Change the access time of FILE relative to FD to TVP[0] and + the modification time of FILE to TVP[1]. */ +int +futimesat (fd, file, tvp) + int fd; + const char *file; + const struct timeval tvp[2]; +{ + if (fd < 0 + && (file == NULL + || (fd != AT_FDCWD && file[0] != '/'))) + { + __set_errno (EBADF); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} + +weak_alias (__utimes, utimes) + +stub_warning (utimes) +#include diff --git a/misc/getclktck.c b/misc/getclktck.c new file mode 100644 index 0000000000..897c6a25ba --- /dev/null +++ b/misc/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 + +/* Return frequency of times(). */ +int +__getclktck () +{ +#ifdef CLK_TCK + return CLK_TCK; +#else + return 60; +#endif +} diff --git a/misc/getdomain.c b/misc/getdomain.c new file mode 100644 index 0000000000..6074ccfb79 --- /dev/null +++ b/misc/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 +#include +#include +#include +#include + +#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 + +#endif + +libc_hidden_def (getdomainname) diff --git a/misc/getdtsz.c b/misc/getdtsz.c new file mode 100644 index 0000000000..38b7577914 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/gethostid.c b/misc/gethostid.c new file mode 100644 index 0000000000..01baf12230 --- /dev/null +++ b/misc/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 +#include + +/* Return the current machine's Internet number. */ +long int +gethostid () +{ + __set_errno (ENOSYS); + return -1L; +} + + +stub_warning (gethostid) +#include diff --git a/misc/gethostname.c b/misc/gethostname.c new file mode 100644 index 0000000000..bc59ab57c6 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/getloadavg.c b/misc/getloadavg.c new file mode 100644 index 0000000000..070c879fd5 --- /dev/null +++ b/misc/getloadavg.c @@ -0,0 +1,37 @@ +/* Get system load averages. Stub version. + 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 +#include +#include + + +/* 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. */ + +int +getloadavg (double loadavg[], int nelem) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (getloadavg) +#include diff --git a/misc/getpagesize.c b/misc/getpagesize.c new file mode 100644 index 0000000000..40ed1ee2b1 --- /dev/null +++ b/misc/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 +#include + +/* Return the system page size. */ +int +__getpagesize () +{ + __set_errno (ENOSYS); + return 0; +} +libc_hidden_def (__getpagesize) +stub_warning (getpagesize) + +weak_alias (__getpagesize, getpagesize) +#include diff --git a/misc/getsysstats.c b/misc/getsysstats.c new file mode 100644 index 0000000000..bc67e23e79 --- /dev/null +++ b/misc/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 , 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 +#include + +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 diff --git a/misc/getxattr.c b/misc/getxattr.c new file mode 100644 index 0000000000..ebf7bf2b4d --- /dev/null +++ b/misc/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 +#include + +ssize_t +getxattr (const char *__path, const char *__name, + void *__value, size_t __size) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (getxattr) +#include diff --git a/misc/gtty.c b/misc/gtty.c new file mode 100644 index 0000000000..84e7fed55e --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/ioctl.c b/misc/ioctl.c new file mode 100644 index 0000000000..3f71452cc1 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/lgetxattr.c b/misc/lgetxattr.c new file mode 100644 index 0000000000..6adf1fdf04 --- /dev/null +++ b/misc/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 +#include + +ssize_t +lgetxattr (const char *__path, const char *__name, + void *__value, size_t __size) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (lgetxattr) +#include diff --git a/misc/listxattr.c b/misc/listxattr.c new file mode 100644 index 0000000000..490a092b75 --- /dev/null +++ b/misc/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 +#include + +ssize_t +listxattr (const char *__path, char *__list, size_t __size) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (listxattr) +#include diff --git a/misc/llistxattr.c b/misc/llistxattr.c new file mode 100644 index 0000000000..1a7e1e4cfd --- /dev/null +++ b/misc/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 +#include + +ssize_t +llistxattr (const char *__path, char *__list, size_t __size) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (llistxattr) +#include diff --git a/misc/lremovexattr.c b/misc/lremovexattr.c new file mode 100644 index 0000000000..fad64e5150 --- /dev/null +++ b/misc/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 +#include + +int +lremovexattr (const char *__path, const char *__name) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (lremovexattr) +#include diff --git a/misc/lseek.c b/misc/lseek.c new file mode 100644 index 0000000000..6daf6ef154 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/lsetxattr.c b/misc/lsetxattr.c new file mode 100644 index 0000000000..6f8cdde1da --- /dev/null +++ b/misc/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 +#include + +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 diff --git a/misc/lutimes.c b/misc/lutimes.c new file mode 100644 index 0000000000..34fc1838f0 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/madvise.c b/misc/madvise.c new file mode 100644 index 0000000000..dbef959dd8 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/mincore.c b/misc/mincore.c new file mode 100644 index 0000000000..804447e8f3 --- /dev/null +++ b/misc/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 +#include + +int +mincore (void *__start, size_t __len, unsigned char *__vec) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (mincore) +#include diff --git a/misc/mlock.c b/misc/mlock.c new file mode 100644 index 0000000000..fd8dc8bc9d --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/mlockall.c b/misc/mlockall.c new file mode 100644 index 0000000000..3d3ed6736d --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/mmap.c b/misc/mmap.c new file mode 100644 index 0000000000..43b25a06d2 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 +weak_alias (__mmap, mmap) diff --git a/misc/mmap64.c b/misc/mmap64.c new file mode 100644 index 0000000000..2c8aac808b --- /dev/null +++ b/misc/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 +#include +#include + +/* 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/misc/mprotect.c b/misc/mprotect.c new file mode 100644 index 0000000000..9fefdfce71 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/msync.c b/misc/msync.c new file mode 100644 index 0000000000..0ffd5c04f6 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/munlock.c b/misc/munlock.c new file mode 100644 index 0000000000..3c728c01d5 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/munlockall.c b/misc/munlockall.c new file mode 100644 index 0000000000..ca7198265f --- /dev/null +++ b/misc/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 +#include +#include + +/* Undo the effects of all prior mlock calls in this process. */ + +int +munlockall (void) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (munlockall) +#include diff --git a/misc/munmap.c b/misc/munmap.c new file mode 100644 index 0000000000..4a78c324ad --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 +weak_alias (__munmap, munmap) diff --git a/misc/pselect.c b/misc/pselect.c new file mode 100644 index 0000000000..43b371cce7 --- /dev/null +++ b/misc/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 , 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 +#include +#include /* For NULL. */ +#include +#include +#include + +/* 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/misc/ptrace.c b/misc/ptrace.c new file mode 100644 index 0000000000..1825d57143 --- /dev/null +++ b/misc/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 +#include +#include +#include + +/* Perform process tracing functions. REQUEST is one of the values + in , 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 diff --git a/misc/readv.c b/misc/readv.c new file mode 100644 index 0000000000..b33444c036 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 ) 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 diff --git a/misc/reboot.c b/misc/reboot.c new file mode 100644 index 0000000000..6036726c1f --- /dev/null +++ b/misc/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 +#include +#include + +/* Reboot the system. */ +int +reboot (howto) + int howto; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (reboot) +#include diff --git a/misc/remap_file_pages.c b/misc/remap_file_pages.c new file mode 100644 index 0000000000..0f15ea44c2 --- /dev/null +++ b/misc/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 +#include + +/* 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 +weak_alias (__remap_file_pages, remap_file_pages) diff --git a/misc/removexattr.c b/misc/removexattr.c new file mode 100644 index 0000000000..8379ed10c8 --- /dev/null +++ b/misc/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 +#include + +int +removexattr (const char *__path, const char *__name) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (removexattr) +#include diff --git a/misc/revoke.c b/misc/revoke.c new file mode 100644 index 0000000000..fc757d80b4 --- /dev/null +++ b/misc/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 +#include + +int +revoke (file) + const char *file; +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (revoke) +#include diff --git a/misc/sbrk.c b/misc/sbrk.c new file mode 100644 index 0000000000..0df60076cc --- /dev/null +++ b/misc/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 +#include + +/* 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/misc/select.c b/misc/select.c new file mode 100644 index 0000000000..124f26aff7 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/setdomain.c b/misc/setdomain.c new file mode 100644 index 0000000000..4d9cbb7cac --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/setegid.c b/misc/setegid.c new file mode 100644 index 0000000000..5b5e2cf4bb --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/seteuid.c b/misc/seteuid.c new file mode 100644 index 0000000000..689000f993 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/sethostid.c b/misc/sethostid.c new file mode 100644 index 0000000000..6f393de06a --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/sethostname.c b/misc/sethostname.c new file mode 100644 index 0000000000..1f65b1e759 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/setregid.c b/misc/setregid.c new file mode 100644 index 0000000000..f8f33d1da7 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/setreuid.c b/misc/setreuid.c new file mode 100644 index 0000000000..cce2d9d52b --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/setxattr.c b/misc/setxattr.c new file mode 100644 index 0000000000..5b8743a7ce --- /dev/null +++ b/misc/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 +#include + +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 diff --git a/misc/sstk.c b/misc/sstk.c new file mode 100644 index 0000000000..6cba9b7fba --- /dev/null +++ b/misc/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 + +/* 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 diff --git a/misc/stty.c b/misc/stty.c new file mode 100644 index 0000000000..49c569a77b --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/swapoff.c b/misc/swapoff.c new file mode 100644 index 0000000000..033d841d95 --- /dev/null +++ b/misc/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 +#include + +/* Stop using block special device PATH for swapping. */ +int +swapoff (const char *path) +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (swapoff) +#include diff --git a/misc/swapon.c b/misc/swapon.c new file mode 100644 index 0000000000..910781fa93 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/sync.c b/misc/sync.c new file mode 100644 index 0000000000..5ccdb5d5bf --- /dev/null +++ b/misc/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 +#include + +/* Make all changes done to all files actually appear on disk. */ +void +sync () +{ + __set_errno (ENOSYS); +} + + +stub_warning (sync) +#include diff --git a/misc/syscall.c b/misc/syscall.c new file mode 100644 index 0000000000..ad78a06b73 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/syslog.c b/misc/syslog.c new file mode 100644 index 0000000000..9c5597f5aa --- /dev/null +++ b/misc/syslog.c @@ -0,0 +1,438 @@ +/* + * Copyright (c) 1983, 1988, 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if __STDC__ +#include +#else +#include +#endif + +#include +#define ftell(s) INTUSE(_IO_ftell) (s) + +static int LogType = SOCK_DGRAM; /* type of socket connection */ +static int LogFile = -1; /* fd for log */ +static int connected; /* have done connect */ +static int LogStat; /* status bits, set by openlog() */ +static const char *LogTag; /* string to tag the entry with */ +static int LogFacility = LOG_USER; /* default facility code */ +static int LogMask = 0xff; /* mask of priorities to be logged */ +extern char *__progname; /* Program name, from crt0. */ + +/* Define the lock. */ +__libc_lock_define_initialized (static, syslog_lock) + +static void openlog_internal(const char *, int, int) internal_function; +static void closelog_internal(void); +#ifndef NO_SIGPIPE +static void sigpipe_handler (int); +#endif + +#ifndef send_flags +# define send_flags 0 +#endif + +struct cleanup_arg +{ + void *buf; + struct sigaction *oldaction; +}; + +static void +cancel_handler (void *ptr) +{ +#ifndef NO_SIGPIPE + /* Restore the old signal handler. */ + struct cleanup_arg *clarg = (struct cleanup_arg *) ptr; + + if (clarg != NULL && clarg->oldaction != NULL) + __sigaction (SIGPIPE, clarg->oldaction, NULL); +#endif + + /* Free the lock. */ + __libc_lock_unlock (syslog_lock); +} + + +/* + * syslog, vsyslog -- + * print message on log file; output is intended for syslogd(8). + */ +void +syslog(int pri, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + __vsyslog_chk(pri, -1, fmt, ap); + va_end(ap); +} +libc_hidden_def (syslog) + +void +__syslog_chk(int pri, int flag, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + __vsyslog_chk(pri, flag, fmt, ap); + va_end(ap); +} + +void +__vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) +{ + struct tm now_tm; + time_t now; + int fd; + FILE *f; + char *buf = 0; + size_t bufsize = 0; + size_t prioff, msgoff; +#ifndef NO_SIGPIPE + struct sigaction action, oldaction; + int sigpipe; +#endif + int saved_errno = errno; + char failbuf[3 * sizeof (pid_t) + sizeof "out of memory []"]; + +#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID + /* Check for invalid bits. */ + if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) { + syslog(INTERNALLOG, + "syslog: unknown facility/priority: %x", pri); + pri &= LOG_PRIMASK|LOG_FACMASK; + } + + /* Check priority against setlogmask values. */ + if ((LOG_MASK (LOG_PRI (pri)) & LogMask) == 0) + return; + + /* Set default facility if none specified. */ + if ((pri & LOG_FACMASK) == 0) + pri |= LogFacility; + + /* Build the message in a memory-buffer stream. */ + f = open_memstream (&buf, &bufsize); + if (f == NULL) + { + /* We cannot get a stream. There is not much we can do but + emitting an error messages. */ + char numbuf[3 * sizeof (pid_t)]; + char *nump; + char *endp = __stpcpy (failbuf, "out of memory ["); + pid_t pid = __getpid (); + + nump = numbuf + sizeof (numbuf); + /* The PID can never be zero. */ + do + *--nump = '0' + pid % 10; + while ((pid /= 10) != 0); + + endp = __mempcpy (endp, nump, (numbuf + sizeof (numbuf)) - nump); + *endp++ = ']'; + *endp = '\0'; + buf = failbuf; + bufsize = endp - failbuf; + msgoff = 0; + } + else + { + __fsetlocking (f, FSETLOCKING_BYCALLER); + prioff = fprintf (f, "<%d>", pri); + (void) time (&now); + f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr, + f->_IO_write_end + - f->_IO_write_ptr, + "%h %e %T ", + __localtime_r (&now, &now_tm), + &_nl_C_locobj); + msgoff = ftell (f); + if (LogTag == NULL) + LogTag = __progname; + if (LogTag != NULL) + fputs_unlocked (LogTag, f); + if (LogStat & LOG_PID) + fprintf (f, "[%d]", (int) __getpid ()); + if (LogTag != NULL) + { + putc_unlocked (':', f); + putc_unlocked (' ', f); + } + + /* Restore errno for %m format. */ + __set_errno (saved_errno); + + /* We have the header. Print the user's format into the + buffer. */ + if (flag == -1) + vfprintf (f, fmt, ap); + else + __vfprintf_chk (f, flag, fmt, ap); + + /* Close the memory stream; this will finalize the data + into a malloc'd buffer in BUF. */ + fclose (f); + } + + /* Output to stderr if requested. */ + if (LogStat & LOG_PERROR) { + struct iovec iov[2]; + register struct iovec *v = iov; + + v->iov_base = buf + msgoff; + v->iov_len = bufsize - msgoff; + /* Append a newline if necessary. */ + if (buf[bufsize - 1] != '\n') + { + ++v; + v->iov_base = (char *) "\n"; + v->iov_len = 1; + } + + __libc_cleanup_push (free, buf == failbuf ? NULL : buf); + + /* writev is a cancellation point. */ + (void)__writev(STDERR_FILENO, iov, v - iov + 1); + + __libc_cleanup_pop (0); + } + + /* Prepare for multiple users. We have to take care: open and + write are cancellation points. */ + struct cleanup_arg clarg; + clarg.buf = buf; + clarg.oldaction = NULL; + __libc_cleanup_push (cancel_handler, &clarg); + __libc_lock_lock (syslog_lock); + +#ifndef NO_SIGPIPE + /* Prepare for a broken connection. */ + memset (&action, 0, sizeof (action)); + action.sa_handler = sigpipe_handler; + sigemptyset (&action.sa_mask); + sigpipe = __sigaction (SIGPIPE, &action, &oldaction); + if (sigpipe == 0) + clarg.oldaction = &oldaction; +#endif + + /* Get connected, output the message to the local logger. */ + if (!connected) + openlog_internal(LogTag, LogStat | LOG_NDELAY, 0); + + /* If we have a SOCK_STREAM connection, also send ASCII NUL as + a record terminator. */ + if (LogType == SOCK_STREAM) + ++bufsize; + + if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0) + { + if (connected) + { + /* Try to reopen the syslog connection. Maybe it went + down. */ + closelog_internal (); + openlog_internal(LogTag, LogStat | LOG_NDELAY, 0); + } + + if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0) + { + closelog_internal (); /* attempt re-open next time */ + /* + * Output the message to the console; don't worry + * about blocking, if console blocks everything will. + * Make sure the error reported is the one from the + * syslogd failure. + */ + if (LogStat & LOG_CONS && + (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0) + { + dprintf (fd, "%s\r\n", buf + msgoff); + (void)__close(fd); + } + } + } + +#ifndef NO_SIGPIPE + if (sigpipe == 0) + __sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL); +#endif + + /* End of critical section. */ + __libc_cleanup_pop (0); + __libc_lock_unlock (syslog_lock); + + if (buf != failbuf) + free (buf); +} +libc_hidden_def (__vsyslog_chk) + +void +vsyslog(pri, fmt, ap) + int pri; + register const char *fmt; + va_list ap; +{ + __vsyslog_chk (pri, -1, fmt, ap); +} +libc_hidden_def (vsyslog) + +static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ + + +static void +internal_function +openlog_internal(const char *ident, int logstat, int logfac) +{ + if (ident != NULL) + LogTag = ident; + LogStat = logstat; + if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0) + LogFacility = logfac; + + int retry = 0; + while (retry < 2) { + if (LogFile == -1) { + SyslogAddr.sa_family = AF_UNIX; + (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, + sizeof(SyslogAddr.sa_data)); + if (LogStat & LOG_NDELAY) { + if ((LogFile = __socket(AF_UNIX, LogType, 0)) + == -1) + return; + (void)__fcntl(LogFile, F_SETFD, 1); + } + } + if (LogFile != -1 && !connected) + { + int old_errno = errno; + if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr)) + == -1) + { + int saved_errno = errno; + int fd = LogFile; + LogFile = -1; + (void)__close(fd); + __set_errno (old_errno); + if (saved_errno == EPROTOTYPE) + { + /* retry with the other type: */ + LogType = (LogType == SOCK_DGRAM + ? SOCK_STREAM : SOCK_DGRAM); + ++retry; + continue; + } + } else + connected = 1; + } + break; + } +} + +void +openlog (const char *ident, int logstat, int logfac) +{ + /* Protect against multiple users and cancellation. */ + __libc_cleanup_push (cancel_handler, NULL); + __libc_lock_lock (syslog_lock); + + openlog_internal (ident, logstat, logfac); + + __libc_cleanup_pop (1); +} + +#ifndef NO_SIGPIPE +static void +sigpipe_handler (int signo) +{ + closelog_internal (); +} +#endif + +static void +closelog_internal() +{ + if (!connected) + return; + + __close (LogFile); + LogFile = -1; + connected = 0; +} + +void +closelog () +{ + /* Protect against multiple users and cancellation. */ + __libc_cleanup_push (cancel_handler, NULL); + __libc_lock_lock (syslog_lock); + + closelog_internal (); + LogTag = NULL; + LogType = SOCK_DGRAM; /* this is the default */ + + /* Free the lock. */ + __libc_cleanup_pop (1); +} + +/* setlogmask -- set the log mask level */ +int +setlogmask(pmask) + int pmask; +{ + int omask; + + omask = LogMask; + if (pmask != 0) + LogMask = pmask; + return (omask); +} diff --git a/misc/truncate.c b/misc/truncate.c new file mode 100644 index 0000000000..6d0f0c3bcb --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/truncate64.c b/misc/truncate64.c new file mode 100644 index 0000000000..d7e80dc3ae --- /dev/null +++ b/misc/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 +#include +#include + +/* 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/misc/ualarm.c b/misc/ualarm.c new file mode 100644 index 0000000000..4ca0847576 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/usleep.c b/misc/usleep.c new file mode 100644 index 0000000000..8f419f901a --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/ustat.c b/misc/ustat.c new file mode 100644 index 0000000000..0aeee620c5 --- /dev/null +++ b/misc/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 +#include +#include + +int +ustat (dev, ust) + dev_t dev; + struct ustat * ust; +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (ustat) +#include diff --git a/misc/utimes.c b/misc/utimes.c new file mode 100644 index 0000000000..e4a6f0427f --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 diff --git a/misc/vhangup.c b/misc/vhangup.c new file mode 100644 index 0000000000..329fddbf24 --- /dev/null +++ b/misc/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 +#include + +/* 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 diff --git a/misc/writev.c b/misc/writev.c new file mode 100644 index 0000000000..d424c72143 --- /dev/null +++ b/misc/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 +#include +#include + +/* 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 ) 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 diff --git a/nis/nis_call.c b/nis/nis_call.c index 14041a160c..5b432b7981 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2001, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2001, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -40,25 +40,16 @@ extern u_short __pmap_getnisport (struct sockaddr_in *address, u_long program, unsigned long inetstr2int (const char *str) { - char buffer[strlen (str) + 3]; - size_t buflen; - size_t i, j; - - buflen = stpcpy (buffer, str) - buffer; - - j = 0; - for (i = 0; i < buflen; ++i) - if (buffer[i] == '.') + size_t j = 0; + for (size_t i = 0; str[i] != '\0'; ++i) + if (str[i] == '.' && ++j == 4) { - ++j; - if (j == 4) - { - buffer[i] = '\0'; - break; - } + char buffer[i + 1]; + buffer[i] = '\0'; + return inet_addr (memcpy (buffer, str, i)); } - return inet_addr (buffer); + return inet_addr (str); } void @@ -179,7 +170,6 @@ __nisbind_connect (dir_binding *dbp) } else dbp->clnt->cl_auth = authunix_create_default (); - dbp->use_auth = TRUE; } return NIS_SUCCESS; @@ -215,10 +205,7 @@ __nisbind_create (dir_binding *dbp, const nis_server *serv_val, dbp->class = -1; if (__nis_findfastest (dbp) < 1) - { - __nisbind_destroy (dbp); - return NIS_NAMEUNREACHABLE; - } + return NIS_NAMEUNREACHABLE; return NIS_SUCCESS; } @@ -585,7 +572,6 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs, if (__nisbind_next (&bptr) != NIS_SUCCESS) { nis_free_directory (dir); - __nisbind_destroy (&bptr); return NIS_NAMEUNREACHABLE; } } diff --git a/nis/nis_error.c b/nis/nis_error.c index 147f88ce15..7db885ef93 100644 --- a/nis/nis_error.c +++ b/nis/nis_error.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -102,26 +102,21 @@ char * nis_sperror_r (const nis_error status, const char *label, char *buffer, size_t buflen) { - const char *cptr; - - cptr = nis_sperrno (status); - - if ((strlen (cptr) + strlen (label) + 3) > buflen) + if (snprintf (buffer, buflen, "%s: %s", label, nis_sperrno (status)) + >= buflen) { errno = ERANGE; return NULL; } - sprintf (buffer, "%s: %s", label, cptr); - - return buffer; + return buffer; } libnsl_hidden_def (nis_sperror_r) char * nis_sperror (const nis_error status, const char *label) { - static char buffer[NIS_MAXNAMELEN +1]; + static char buffer[NIS_MAXNAMELEN + 1]; return nis_sperror_r (status, label, buffer, sizeof (buffer)); } diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c index 0b97e67a61..4cb34dd1a8 100644 --- a/nis/nis_lookup.c +++ b/nis/nis_lookup.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -81,7 +81,6 @@ nis_lookup (const_nis_name name, const unsigned int flags) { if (__nisbind_next (&bptr) != NIS_SUCCESS) { - __nisbind_destroy (&bptr); nis_free_directory (dir); NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE; return res; @@ -90,7 +89,7 @@ nis_lookup (const_nis_name name, const unsigned int flags) do { - static struct timeval RPCTIMEOUT = {10, 0}; + static const struct timeval RPCTIMEOUT = {10, 0}; enum clnt_stat result; again: @@ -107,8 +106,8 @@ nis_lookup (const_nis_name name, const unsigned int flags) if (NIS_RES_STATUS (res) == NIS_SUCCESS) { - if (__type_of(NIS_RES_OBJECT (res)) == NIS_LINK_OBJ && - flags & FOLLOW_LINKS) /* We are following links */ + if (__type_of(NIS_RES_OBJECT (res)) == NIS_LINK_OBJ + && (flags & FOLLOW_LINKS)) /* We are following links */ { if (count_links) free (req.ns_name); @@ -137,16 +136,17 @@ nis_lookup (const_nis_name name, const unsigned int flags) } } else - if ((NIS_RES_STATUS (res) == NIS_SYSTEMERROR) || - (NIS_RES_STATUS (res) == NIS_NOSUCHNAME) || - (NIS_RES_STATUS (res) == NIS_NOT_ME)) + if (NIS_RES_STATUS (res) == NIS_SYSTEMERROR + || NIS_RES_STATUS (res) == NIS_NOSUCHNAME + || NIS_RES_STATUS (res) == NIS_NOT_ME) { if (link_first_try) { __nisbind_destroy (&bptr); nis_free_directory (dir); - if (__nisfind_server (req.ns_name, &dir) != NIS_SUCCESS) + if (__nisfind_server (req.ns_name, &dir) + != NIS_SUCCESS) return res; if (__nisbind_create (&bptr, @@ -166,7 +166,6 @@ nis_lookup (const_nis_name name, const unsigned int flags) { if (__nisbind_next (&bptr) != NIS_SUCCESS) { - __nisbind_destroy (&bptr); nis_free_directory (dir); return res; } diff --git a/nis/nis_table.c b/nis/nis_table.c index 2531a3fbc5..2ef28ac59b 100644 --- a/nis/nis_table.c +++ b/nis/nis_table.c @@ -27,11 +27,9 @@ static struct ib_request * __create_ib_request (const_nis_name name, unsigned int flags) { - struct ib_request *ibreq = calloc (1, sizeof (ib_request)); - char buf[strlen (name) + 1]; + struct ib_request *ibreq = calloc (1, sizeof (struct ib_request)); nis_attr *search_val = NULL; size_t search_len = 0; - char *cptr; size_t size = 0; if (ibreq == NULL) @@ -39,7 +37,7 @@ __create_ib_request (const_nis_name name, unsigned int flags) ibreq->ibr_flags = flags; - cptr = strcpy (buf, name); + char *cptr = strdupa (name); /* Not of "[key=value,key=value,...],foo.." format? */ if (cptr[0] != '[') @@ -49,8 +47,8 @@ __create_ib_request (const_nis_name name, unsigned int flags) ibreq->ibr_name = strchr (cptr, ']'); if (ibreq->ibr_name == NULL || ibreq->ibr_name[1] != ',') { - ibreq->ibr_name = NULL; /* Or the xdr_* functions will dump */ - nis_free_request (ibreq); + /* The object has not really been built yet so we use free. */ + free (ibreq); return NULL; } @@ -120,17 +118,16 @@ __create_ib_request (const_nis_name name, unsigned int flags) return ibreq; } -static struct timeval RPCTIMEOUT = {10, 0}; +static const struct timeval RPCTIMEOUT = {10, 0}; static char * __get_tablepath (char *name, dir_binding *bptr) { enum clnt_stat result; - nis_result *res = calloc (1, sizeof (nis_result)); + nis_result res; struct ns_request req; - if (res == NULL) - return NULL; + memset (&res, '\0', sizeof (res)); req.ns_name = name; req.ns_object.ns_object_len = 0; @@ -138,20 +135,16 @@ __get_tablepath (char *name, dir_binding *bptr) result = clnt_call (bptr->clnt, NIS_LOOKUP, (xdrproc_t) _xdr_ns_request, (caddr_t) &req, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, RPCTIMEOUT); + (caddr_t) &res, RPCTIMEOUT); - if (result == RPC_SUCCESS && NIS_RES_STATUS (res) == NIS_SUCCESS && - __type_of (NIS_RES_OBJECT (res)) == NIS_TABLE_OBJ) - { - char *cptr = strdup (NIS_RES_OBJECT (res)->TA_data.ta_path); - nis_freeresult (res); - return cptr; - } + const char *cptr; + if (result == RPC_SUCCESS && NIS_RES_STATUS (&res) == NIS_SUCCESS + && __type_of (NIS_RES_OBJECT (&res)) == NIS_TABLE_OBJ) + cptr = NIS_RES_OBJECT (&res)->TA_data.ta_path; else - { - nis_freeresult (res); - return strdup (""); - } + cptr = ""; + + return strdup (cptr); } nis_result * @@ -171,8 +164,8 @@ nis_list (const_nis_name name, unsigned int flags, nis_name namebuf[2] = {NULL, NULL}; int name_nr = 0; nis_cb *cb = NULL; - char *tableptr, *tablepath = NULL; - int have_tablepath = 0; + char *tableptr; + char *tablepath = NULL; int first_try = 0; /* Do we try the old binding at first ? */ if (res == NULL) @@ -205,6 +198,7 @@ nis_list (const_nis_name name, unsigned int flags, ibreq->ibr_name = strdup (names[name_nr]); if (ibreq->ibr_name == NULL) { + nis_freenames (names); nis_free_request (ibreq); NIS_RES_STATUS (res) = NIS_NOMEMORY; return res; @@ -227,30 +221,24 @@ nis_list (const_nis_name name, unsigned int flags, status = __nisfind_server (ibreq->ibr_name, &dir); if (status != NIS_SUCCESS) - { - nis_free_request (ibreq); + { NIS_RES_STATUS (res) = status; - return res; - } + goto fail3; + } status = __nisbind_create (&bptr, dir->do_servers.do_servers_val, - dir->do_servers.do_servers_len, flags); + dir->do_servers.do_servers_len, flags); if (status != NIS_SUCCESS) { - nis_free_request (ibreq); NIS_RES_STATUS (res) = status; - nis_free_directory (dir); - return res; + goto fail2; } while (__nisbind_connect (&bptr) != NIS_SUCCESS) if (__nisbind_next (&bptr) != NIS_SUCCESS) { - __nisbind_destroy (&bptr); - nis_free_directory (dir); - nis_free_request (ibreq); NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE; - return res; + goto fail; } if (callback != NULL) @@ -274,8 +262,8 @@ nis_list (const_nis_name name, unsigned int flags, case NIS_PARTIAL: case NIS_SUCCESS: case NIS_S_SUCCESS: - if (__type_of (NIS_RES_OBJECT (res)) == NIS_LINK_OBJ && - flags & FOLLOW_LINKS) /* We are following links. */ + if (__type_of (NIS_RES_OBJECT (res)) == NIS_LINK_OBJ + && (flags & FOLLOW_LINKS)) /* We are following links. */ { free (ibreq->ibr_name); ibreq->ibr_name = NULL; @@ -291,8 +279,22 @@ nis_list (const_nis_name name, unsigned int flags, strdup (NIS_RES_OBJECT (res)->LI_data.li_name); if (ibreq->ibr_name == NULL) { - nis_free_request (ibreq); NIS_RES_STATUS (res) = NIS_NOMEMORY; + fail: + __nisbind_destroy (&bptr); + fail2: + nis_free_directory (dir); + fail3: + free (tablepath); + if (cb) + { + __nis_destroy_callback (cb); + ibreq->ibr_cbhost.ibr_cbhost_len = 0; + ibreq->ibr_cbhost.ibr_cbhost_val = NULL; + } + if (names != namebuf) + nis_freenames (names); + nis_free_request (ibreq); return res; } if (NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_len) @@ -303,27 +305,30 @@ nis_list (const_nis_name name, unsigned int flags, ibreq->ibr_srch.ibr_srch_val = NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_val; } + /* The following is a non-obvious optimization. A + nis_freeresult call would call xdr_free as the + following code. But it also would unnecessarily + free the result structure. We avoid this here + along with the necessary tests. */ +#if 1 + xdr_free ((xdrproc_t) _xdr_nis_result, (char *)res); + memset (res, '\0', sizeof (*res)); +#else nis_freeresult (res); res = calloc (1, sizeof (nis_result)); if (res == NULL) - { - if (have_tablepath) - free (tablepath); - __nisbind_destroy (&bptr); - nis_free_directory (dir); - return NULL; - } + goto fail; +#endif first_try = 1; /* Try at first the old binding */ goto again; } - else if ((flags & FOLLOW_PATH) && - NIS_RES_STATUS (res) == NIS_PARTIAL) + else if ((flags & FOLLOW_PATH) + && NIS_RES_STATUS (res) == NIS_PARTIAL) { - if (!have_tablepath) + if (tablepath == NULL) { tablepath = __get_tablepath (ibreq->ibr_name, &bptr); tableptr = tablepath; - have_tablepath = 1; } if (tableptr == NULL) { @@ -337,27 +342,37 @@ nis_list (const_nis_name name, unsigned int flags, ibreq->ibr_name = strdup (""); if (ibreq->ibr_name == NULL) { - nis_free_request (ibreq); NIS_RES_STATUS (res) = NIS_NOMEMORY; - return res; + goto fail; } ++done; } else { ibreq->ibr_name = strdup (ibreq->ibr_name); + /* The following is a non-obvious optimization. A + nis_freeresult call would call xdr_free as the + following code. But it also would unnecessarily + free the result structure. We avoid this here + along with the necessary tests. */ +#if 1 + xdr_free ((xdrproc_t) _xdr_nis_result, (char *)res); + memset (res, '\0', sizeof (*res)); + if (ibreq->ibr_name == NULL) + { + NIS_RES_STATUS (res) = NIS_NOMEMORY; + goto fail; + } +#else nis_freeresult (res); res = calloc (1, sizeof (nis_result)); if (res == NULL || ibreq->ibr_name == NULL) { free (res); - nis_free_request (ibreq); - if (have_tablepath) - free (tablepath); - __nisbind_destroy (&bptr); - nis_free_directory (dir); - return NULL; + res = NULL; + goto fail; } +#endif first_try = 1; goto again; } @@ -375,11 +390,10 @@ nis_list (const_nis_name name, unsigned int flags, ++done; else { - if (!have_tablepath) + if (tablepath == NULL) { tablepath = __get_tablepath (ibreq->ibr_name, &bptr); tableptr = tablepath; - have_tablepath = 1; } if (tableptr == NULL) { @@ -397,9 +411,8 @@ nis_list (const_nis_name name, unsigned int flags, ibreq->ibr_name = strdup (ibreq->ibr_name); if (ibreq->ibr_name == NULL) { - nis_free_request (ibreq); NIS_RES_STATUS (res) = NIS_NOMEMORY; - return res; + goto fail; } } } @@ -448,9 +461,8 @@ nis_list (const_nis_name name, unsigned int flags, ibreq->ibr_name = strdup (names[name_nr]); if (ibreq->ibr_name == NULL) { - nis_free_request (ibreq); NIS_RES_STATUS (res) = NIS_NOMEMORY; - return res; + goto fail; } first_try = 1; /* Try old binding at first */ goto again; @@ -464,12 +476,15 @@ nis_list (const_nis_name name, unsigned int flags, __nis_destroy_callback (cb); ibreq->ibr_cbhost.ibr_cbhost_len = 0; ibreq->ibr_cbhost.ibr_cbhost_val = NULL; + cb = NULL; } __nisbind_destroy (&bptr); nis_free_directory (dir); } + free (tablepath); + if (names != namebuf) nis_freenames (names); diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c index 152e5fc3fc..6aa93ab3bc 100644 --- a/nis/nss_nisplus/nisplus-alias.c +++ b/nis/nss_nisplus/nisplus-alias.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2001,2002,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -32,7 +33,7 @@ __libc_lock_define_initialized (static, lock) static nis_result *result; static u_long next_entry; static nis_name tablename_val; -static u_long tablename_len; +static size_t tablename_len; #define NISENTRYVAL(idx,col,res) \ ((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val) @@ -45,19 +46,26 @@ _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "mail_aliases.org_dir."; - p = __stpcpy (buf, "mail_aliases.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } + return NSS_STATUS_SUCCESS; } @@ -75,81 +83,73 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry, "mail_aliases") != 0 || result->objects.objects_val[entry].EN_data.en_cols.en_cols_len < 2) return 0; - else + + char *first_unused = buffer + NISENTRYLEN (0, 1, result) + 1; + size_t room_left = (buflen - (buflen % __alignof__ (char *)) + - NISENTRYLEN (0, 1, result) - 2); + + if (NISENTRYLEN (entry, 1, result) >= buflen) { - char *first_unused = buffer + NISENTRYLEN (0, 1, result) + 1; - size_t room_left = - buflen - (buflen % __alignof__ (char *)) - - NISENTRYLEN (0, 1, result) - 2; - char *line; - char *cp; - - if (NISENTRYLEN (entry, 1, result) >= buflen) - { - /* The line is too long for our buffer. */ - no_more_room: - *errnop = ERANGE; - return -1; - } - else - { - cp = __stpncpy (buffer, NISENTRYVAL (entry, 1, result), - NISENTRYLEN (entry, 1, result)); - *cp = '\0'; - } + /* The line is too long for our buffer. */ + no_more_room: + *errnop = ERANGE; + return -1; + } + + char *cp = __stpncpy (buffer, NISENTRYVAL (entry, 1, result), + NISENTRYLEN (entry, 1, result)); + *cp = '\0'; + + if (NISENTRYLEN(entry, 0, result) >= room_left) + goto no_more_room; + + alias->alias_local = 0; + alias->alias_members_len = 0; + *first_unused = '\0'; + ++first_unused; + cp = __stpncpy (first_unused, NISENTRYVAL (entry, 0, result), + NISENTRYLEN (entry, 0, result)); + *cp = '\0'; + alias->alias_name = first_unused; + + /* Terminate the line for any case. */ + cp = strpbrk (alias->alias_name, "#\n"); + if (cp != NULL) + *cp = '\0'; + + first_unused += strlen (alias->alias_name) +1; + /* Adjust the pointer so it is aligned for + storing pointers. */ + first_unused += __alignof__ (char *) - 1; + first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *)); + alias->alias_members = (char **) first_unused; + + char *line = buffer; + while (*line != '\0') + { + /* Skip leading blanks. */ + while (isspace (*line)) + ++line; + + if (*line == '\0') + break; - if (NISENTRYLEN(entry, 0, result) >= room_left) + if (room_left < sizeof (char *)) goto no_more_room; + room_left -= sizeof (char *); + alias->alias_members[alias->alias_members_len] = line; + + while (*line != '\0' && *line != ',') + ++line; - alias->alias_local = 0; - alias->alias_members_len = 0; - *first_unused = '\0'; - ++first_unused; - cp = __stpncpy (first_unused, NISENTRYVAL (entry, 0, result), - NISENTRYLEN (entry, 0, result)); - *cp = '\0'; - alias->alias_name = first_unused; - - /* Terminate the line for any case. */ - cp = strpbrk (alias->alias_name, "#\n"); - if (cp != NULL) - *cp = '\0'; - - first_unused += strlen (alias->alias_name) +1; - /* Adjust the pointer so it is aligned for - storing pointers. */ - first_unused += __alignof__ (char *) - 1; - first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *)); - alias->alias_members = (char **) first_unused; - - line = buffer; - - while (*line != '\0') + if (line != alias->alias_members[alias->alias_members_len]) { - /* Skip leading blanks. */ - while (isspace (*line)) - ++line; - - if (*line == '\0') - break; - - if (room_left < sizeof (char *)) - goto no_more_room; - room_left -= sizeof (char *); - alias->alias_members[alias->alias_members_len] = line; - - while (*line != '\0' && *line != ',') - ++line; - - if (line != alias->alias_members[alias->alias_members_len]) - { - *line++ = '\0'; - alias->alias_members_len++; - } + *line++ = '\0'; + alias->alias_members_len++; } - - return alias->alias_members_len == 0 ? 0 : 1; } + + return alias->alias_members_len == 0 ? 0 : 1; } static enum nss_status @@ -158,9 +158,11 @@ internal_setaliasent (void) enum nss_status status; int err; - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } if (_nss_create_tablename (&err) != NSS_STATUS_SUCCESS) return NSS_STATUS_UNAVAIL; @@ -203,9 +205,11 @@ _nss_nisplus_endaliasent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } next_entry = 0; __libc_lock_unlock (lock); @@ -240,7 +244,8 @@ internal_nisplus_getaliasent_r (struct aliasent *alias, return NSS_STATUS_TRYAGAIN; ++next_entry; - } while (!parse_res); + } + while (!parse_res); return NSS_STATUS_SUCCESS; } @@ -268,7 +273,12 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } @@ -278,35 +288,34 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } - else - { - nis_result *result; - char buf[strlen (name) + 30 + tablename_len]; - int olderr = errno; - sprintf (buf, "[name=%s],%s", name, tablename_val); + char buf[strlen (name) + 9 + tablename_len]; + int olderr = errno; - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - return niserr2nss (result->status); + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - parse_res = _nss_nisplus_parse_aliasent (result, 0, alias, - buffer, buflen, errnop); - if (parse_res < 1) - { - __set_errno (olderr); + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - if (parse_res == -1) - return NSS_STATUS_TRYAGAIN; - else - return NSS_STATUS_NOTFOUND; - } - return NSS_STATUS_SUCCESS; + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + return niserr2nss (result->status); + + parse_res = _nss_nisplus_parse_aliasent (result, 0, alias, + buffer, buflen, errnop); + if (__builtin_expect (parse_res < 1, 0)) + { + __set_errno (olderr); + + if (parse_res == -1) + return NSS_STATUS_TRYAGAIN; + else + return NSS_STATUS_NOTFOUND; } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c index 028309c841..fcc550e743 100644 --- a/nis/nss_nisplus/nisplus-ethers.c +++ b/nis/nss_nisplus/nisplus-ethers.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,2000,2001,2002,2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000-2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,15 +17,17 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include +#include #include -#include -#include +#include +#include #include +#include +#include #include -#include #include +#include +#include #include "nss-nisplus.h" @@ -70,7 +72,14 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether, room_left -= (NISENTRYLEN (0, 0, result) +1); ether->e_name = p; - ether->e_addr = *ether_aton (NISENTRYVAL (0, 1, result)); + struct ether_addr *ea = ether_aton (NISENTRYVAL (0, 1, result)); + if (ea == NULL) + { + *errnop = EINVAL; + return -2; + } + + ether->e_addr = *ea; return 1; } @@ -80,18 +89,24 @@ _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "ethers.org_dir."; - p = __stpcpy (buf, "ethers.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } return NSS_STATUS_SUCCESS; } @@ -107,9 +122,11 @@ _nss_nisplus_setetherent (int stayopen) __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } if (_nss_create_tablename (&err) != NSS_STATUS_SUCCESS) status = NSS_STATUS_UNAVAIL; @@ -124,9 +141,11 @@ _nss_nisplus_endetherent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -137,8 +156,6 @@ static enum nss_status internal_nisplus_getetherent_r (struct etherent *ether, char *buffer, size_t buflen, int *errnop) { - int parse_res; - if (tablename_val == NULL) { enum nss_status status = _nss_create_tablename (errnop); @@ -148,6 +165,7 @@ internal_nisplus_getetherent_r (struct etherent *ether, char *buffer, } /* Get the next entry until we found a correct one. */ + int parse_res; do { nis_result *saved_result; @@ -161,11 +179,8 @@ internal_nisplus_getetherent_r (struct etherent *ether, char *buffer, } else { - nis_result *res2; - - res2 = nis_next_entry(tablename_val, &result->cookie); saved_result = result; - result = res2; + result = nis_next_entry (tablename_val, &result->cookie); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { nis_freeresult (saved_result); @@ -178,17 +193,15 @@ internal_nisplus_getetherent_r (struct etherent *ether, char *buffer, if (parse_res == -1) { nis_freeresult (result); - *errnop = ERANGE; result = saved_result; return NSS_STATUS_TRYAGAIN; } - else - { - if (saved_result != NULL) - nis_freeresult (saved_result); - } - } while (!parse_res); + if (saved_result != NULL) + nis_freeresult (saved_result); + + } + while (!parse_res); return NSS_STATUS_SUCCESS; } @@ -212,8 +225,6 @@ enum nss_status _nss_nisplus_gethostton_r (const char *name, struct etherent *eth, char *buffer, size_t buflen, int *errnop) { - int parse_res; - if (tablename_val == NULL) { enum nss_status status = _nss_create_tablename (errnop); @@ -227,56 +238,57 @@ _nss_nisplus_gethostton_r (const char *name, struct etherent *eth, *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } - else - { - nis_result *result; - char buf[strlen (name) + 40 + tablename_len]; - int olderr = errno; - sprintf (buf, "[name=%s],%s", name, tablename_val); + char buf[strlen (name) + 9 + tablename_len]; + int olderr = errno; - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); - nis_freeresult (result); - return status; - } + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } + + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); + nis_freeresult (result); + return status; + } + + int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen, errnop); - if (parse_res < 1) - { - __set_errno (olderr); + if (__builtin_expect (parse_res < 1, 0)) + { + __set_errno (olderr); - if (parse_res == -1) - { - nis_freeresult (result); - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - return NSS_STATUS_NOTFOUND; + if (parse_res == -1) + { + nis_freeresult (result); + return NSS_STATUS_TRYAGAIN; } - return NSS_STATUS_SUCCESS; + else + return NSS_STATUS_NOTFOUND; } + + return NSS_STATUS_SUCCESS; } enum nss_status -_nss_nisplus_getntohost_r (const struct ether_addr *addr, - struct etherent *eth, +_nss_nisplus_getntohost_r (const struct ether_addr *addr, struct etherent *eth, char *buffer, size_t buflen, int *errnop) { if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } @@ -286,44 +298,44 @@ _nss_nisplus_getntohost_r (const struct ether_addr *addr, *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } - else - { - int parse_res; - nis_result *result; - char buf[255 + tablename_len]; - sprintf (buf, "[addr=%x:%x:%x:%x:%x:%x],ethers.org_dir", - addr->ether_addr_octet[0], addr->ether_addr_octet[1], - addr->ether_addr_octet[2], addr->ether_addr_octet[3], - addr->ether_addr_octet[4], addr->ether_addr_octet[5]); + char buf[26 + tablename_len]; - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + snprintf (buf, sizeof (buf), + "[addr=%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 + ":%" PRIx8 "],%s", + addr->ether_addr_octet[0], addr->ether_addr_octet[1], + addr->ether_addr_octet[2], addr->ether_addr_octet[3], + addr->ether_addr_octet[4], addr->ether_addr_octet[5], + tablename_val); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); - nis_freeresult (result); - return status; - } + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } + + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); + nis_freeresult (result); + return status; + } + + int parse_res = _nss_nisplus_parse_etherent (result, eth, buffer, buflen, errnop); - if (parse_res < 1) + if (__builtin_expect (parse_res < 1, 0)) + { + if (parse_res == -1) { - if (parse_res == -1) - { - nis_freeresult (result); - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - return NSS_STATUS_NOTFOUND; + nis_freeresult (result); + return NSS_STATUS_TRYAGAIN; } - return NSS_STATUS_SUCCESS; + + return NSS_STATUS_NOTFOUND; } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c index daca94fc87..423f7e7291 100644 --- a/nis/nss_nisplus/nisplus-grp.c +++ b/nis/nss_nisplus/nisplus-grp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -28,31 +29,39 @@ #include "nss-nisplus.h" #include "nisplus-parser.h" + __libc_lock_define_initialized (static, lock); static nis_result *result; static unsigned long next_entry; static nis_name tablename_val; -static u_long tablename_len; +static size_t tablename_len; static enum nss_status _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "group.org_dir."; - p = __stpcpy (buf, "group.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } + return NSS_STATUS_SUCCESS; } @@ -60,16 +69,20 @@ static enum nss_status internal_setgrent (void) { enum nss_status status; - int err; - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } next_entry = 0; if (tablename_val == NULL) - if (_nss_create_tablename (&err) != NSS_STATUS_SUCCESS) - return NSS_STATUS_UNAVAIL; + { + int err; + if (_nss_create_tablename (&err) != NSS_STATUS_SUCCESS) + return NSS_STATUS_UNAVAIL; + } result = nis_list (tablename_val, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); if (result == NULL) @@ -108,9 +121,11 @@ _nss_nisplus_endgrent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -173,8 +188,12 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr, if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } @@ -184,47 +203,46 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr, *errnop = EINVAL; return NSS_STATUS_NOTFOUND; } - else + + nis_result *result; + char buf[strlen (name) + 9 + tablename_len]; + int olderr = errno; + + snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val); + + result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); + + if (result == NULL) { - nis_result *result; - char buf[strlen (name) + 24 + tablename_len]; - int olderr = errno; + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - sprintf (buf, "[name=%s],%s", name, tablename_val); + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); - result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); + nis_freeresult (result); + return status; + } - if (result == NULL) + parse_res = _nss_nisplus_parse_grent (result, 0, gr, buffer, buflen, errnop); + nis_freeresult (result); + if (__builtin_expect (parse_res < 1, 0)) + { + if (parse_res == -1) { - *errnop = ENOMEM; + *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); - - nis_freeresult (result); - return status; - } - - parse_res = _nss_nisplus_parse_grent (result, 0, gr, buffer, buflen, - errnop); - nis_freeresult (result); - if (parse_res < 1) + else { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } - return NSS_STATUS_SUCCESS; } + + return NSS_STATUS_SUCCESS; } enum nss_status @@ -233,53 +251,57 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr, { if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } - { - int parse_res; - nis_result *result; - char buf[36 + tablename_len]; - int olderr = errno; + int parse_res; + nis_result *result; + char buf[8 + 3 * sizeof (unsigned long int) + tablename_len]; + int olderr = errno; - sprintf (buf, "[gid=%lu],%s", (unsigned long int) gid, tablename_val); + snprintf (buf, sizeof (buf), "[gid=%lu],%s", + (unsigned long int) gid, tablename_val); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - __set_errno (olderr); + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); - nis_freeresult (result); - return status; - } - - parse_res = _nss_nisplus_parse_grent (result, 0, gr, buffer, buflen, - errnop); - - nis_freeresult (result); - if (parse_res < 1) - { - __set_errno (olderr); - - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - return NSS_STATUS_NOTFOUND; - } - return NSS_STATUS_SUCCESS; - } + __set_errno (olderr); + + nis_freeresult (result); + return status; + } + + parse_res = _nss_nisplus_parse_grent (result, 0, gr, buffer, buflen, errnop); + + nis_freeresult (result); + if (__builtin_expect (parse_res < 1, 0)) + { + __set_errno (olderr); + + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + return NSS_STATUS_NOTFOUND; + } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c index 540469894e..81f8a984dc 100644 --- a/nis/nss_nisplus/nisplus-hosts.c +++ b/nis/nss_nisplus/nisplus-hosts.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997-2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,15 +17,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include -#include +#include #include +#include +#include +#include #include -#include #include -#include +#include #include +#include #include "nss-nisplus.h" @@ -180,19 +181,26 @@ _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "hosts.org_dir."; - p = __stpcpy (buf, "hosts.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } + return NSS_STATUS_SUCCESS; } @@ -204,9 +212,11 @@ _nss_nisplus_sethostent (int stayopen) __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } if (tablename_val == NULL) status = _nss_create_tablename (&err); @@ -221,9 +231,11 @@ _nss_nisplus_endhostent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -335,8 +347,12 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host, if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) { *herrnop = NETDB_INTERNAL; @@ -350,75 +366,81 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host, *herrnop = NETDB_INTERNAL; return NSS_STATUS_NOTFOUND; } - else - { - nis_result *result; - char buf[strlen (name) + 255 + tablename_len]; - int olderr = errno; - /* Search at first in the alias list, and use the correct name - for the next search */ - sprintf (buf, "[name=%s],%s", name, tablename_val); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + nis_result *result; + char buf[strlen (name) + 10 + tablename_len]; + int olderr = errno; - if (result != NULL) - { - /* If we do not find it, try it as original name. But if the - database is correct, we should find it in the first case, too */ - if ((result->status != NIS_SUCCESS - && result->status != NIS_S_SUCCESS) - || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ - || strcmp (result->objects.objects_val->EN_data.en_type, - "hosts_tbl") != 0 - || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3) - sprintf (buf, "[cname=%s],%s", name, tablename_val); - else - sprintf (buf, "[cname=%s],%s", NISENTRYVAL(0, 0, result), - tablename_val); - - nis_freeresult (result); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - } + /* Search at first in the alias list, and use the correct name + for the next search. */ + snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val); + result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result == NULL) + if (result != NULL) + { + char *bufptr = buf; + + /* If we did not find it, try it as original name. But if the + database is correct, we should find it in the first case, too. */ + if ((result->status != NIS_SUCCESS + && result->status != NIS_S_SUCCESS) + || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ + || strcmp (result->objects.objects_val->EN_data.en_type, + "hosts_tbl") != 0 + || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3) + snprintf (buf, sizeof (buf), "[cname=%s],%s", name, tablename_val); + else { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; + /* We need to allocate a new buffer since there is no + guarantee the returned name has a length limit. */ + const char *entryval = NISENTRYVAL(0, 0, result); + size_t buflen = strlen (entryval) + 10 + tablename_len; + bufptr = alloca (buflen); + snprintf (bufptr, buflen, "[cname=%s],%s", + entryval, tablename_val); } - retval = niserr2nss (result->status); - if (retval != NSS_STATUS_SUCCESS) - { - if (retval == NSS_STATUS_TRYAGAIN) - { - *errnop = errno; - *herrnop = NETDB_INTERNAL; - } - else - __set_errno (olderr); - nis_freeresult (result); - return retval; - } - - parse_res = _nss_nisplus_parse_hostent (result, af, host, buffer, - buflen, errnop, flags); nis_freeresult (result); + result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + } - if (parse_res > 0) - return NSS_STATUS_SUCCESS; + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - *herrnop = NETDB_INTERNAL; - if (parse_res == -1) + retval = niserr2nss (result->status); + if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) + { + if (retval == NSS_STATUS_TRYAGAIN) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + *errnop = errno; + *herrnop = NETDB_INTERNAL; } else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + __set_errno (olderr); + nis_freeresult (result); + return retval; } + + parse_res = _nss_nisplus_parse_hostent (result, af, host, buffer, + buflen, errnop, flags); + + nis_freeresult (result); + + if (parse_res > 0) + return NSS_STATUS_SUCCESS; + + *herrnop = NETDB_INTERNAL; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } enum nss_status @@ -431,17 +453,6 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host, ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0)); } -#if 0 -enum nss_status -_nss_nisplus_getipnodebyname_r (const char *name, int af, int flags, - struct hostent *result, char *buffer, - size_t buflen, int *errnop, int *herrnop) -{ - return internal_gethostbyname2_r (name, af, result, buffer, buflen, - errnop, herrnop, flags); -} -#endif - enum nss_status _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host, char *buffer, size_t buflen, int *errnop, @@ -469,62 +480,63 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af, { if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } if (addr == NULL) return NSS_STATUS_NOTFOUND; - else - { - nis_result *result; - char buf[255 + tablename_len]; - int retval, parse_res; - int olderr = errno; - sprintf (buf, "[addr=%s],%s", - inet_ntoa (*(const struct in_addr *) addr), tablename_val); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - - if (result == NULL) - { - __set_errno (ENOMEM); - return NSS_STATUS_TRYAGAIN; - } - retval = niserr2nss (result->status); - if (retval != NSS_STATUS_SUCCESS) - { - if (retval == NSS_STATUS_TRYAGAIN) - { - *errnop = errno; - *herrnop = NETDB_INTERNAL; - } - else - __set_errno (olderr); - nis_freeresult (result); - return retval; - } + char buf[24 + tablename_len]; + int retval, parse_res; + int olderr = errno; - parse_res = _nss_nisplus_parse_hostent (result, af, host, - buffer, buflen, errnop, - ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0)); - nis_freeresult (result); + snprintf (buf, sizeof (buf), "[addr=%s],%s", + inet_ntoa (*(const struct in_addr *) addr), tablename_val); + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (parse_res > 0) - return NSS_STATUS_SUCCESS; + if (result == NULL) + { + __set_errno (ENOMEM); + return NSS_STATUS_TRYAGAIN; + } - *herrnop = NETDB_INTERNAL; - if (parse_res == -1) + retval = niserr2nss (result->status); + if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) + { + if (retval == NSS_STATUS_TRYAGAIN) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + *errnop = errno; + *herrnop = NETDB_INTERNAL; } else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + __set_errno (olderr); + nis_freeresult (result); + return retval; + } + + parse_res = _nss_nisplus_parse_hostent (result, af, host, + buffer, buflen, errnop, + ((_res.options & RES_USE_INET6) + ? AI_V4MAPPED : 0)); + nis_freeresult (result); + + if (parse_res > 0) + return NSS_STATUS_SUCCESS; + + *herrnop = NETDB_INTERNAL; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; } + + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } diff --git a/nis/nss_nisplus/nisplus-netgrp.c b/nis/nss_nisplus/nisplus-netgrp.c index 344d65f4c4..31a8cdf097 100644 --- a/nis/nss_nisplus/nisplus-netgrp.c +++ b/nis/nss_nisplus/nisplus-netgrp.c @@ -150,15 +150,14 @@ internal_endnetgrent (struct __netgrent *netgrp) enum nss_status _nss_nisplus_setnetgrent (const char *group, struct __netgrent *netgrp) { - enum nss_status status; - char buf[strlen (group) + 30]; + char buf[strlen (group) + 25]; if (group == NULL || group[0] == '\0') return NSS_STATUS_UNAVAIL; - status = NSS_STATUS_SUCCESS; + enum nss_status status = NSS_STATUS_SUCCESS; - sprintf (buf, "[name=%s],netgroup.org_dir", group); + snprintf (buf, sizeof (buf), "[name=%s],netgroup.org_dir", group); netgrp->data = (char *) nis_list (buf, EXPAND_NAME, NULL, NULL); diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c index 422b02b82a..dc6b99e505 100644 --- a/nis/nss_nisplus/nisplus-network.c +++ b/nis/nss_nisplus/nisplus-network.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,2000,2001,2002,2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000-2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,15 +17,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include -#include +#include #include +#include +#include +#include #include #include #include -#include #include +#include #include "nss-nisplus.h" @@ -44,12 +45,10 @@ static u_long tablename_len; static int _nss_nisplus_parse_netent (nis_result *result, struct netent *network, - char *buffer, size_t buflen, int *errnop) + char *buffer, size_t buflen, int *errnop) { char *first_unused = buffer; size_t room_left = buflen; - unsigned int i; - char *p, *line; if (result == NULL) return 0; @@ -61,7 +60,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network, || result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3) return 0; - if (NISENTRYLEN(0, 0, result) >= room_left) + if (NISENTRYLEN (0, 0, result) >= room_left) { /* The line is too long for our buffer. */ no_more_room: @@ -69,7 +68,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network, return -1; } - strncpy (first_unused, NISENTRYVAL(0, 0, result), + strncpy (first_unused, NISENTRYVAL (0, 0, result), NISENTRYLEN (0, 0, result)); first_unused[NISENTRYLEN (0, 0, result)] = '\0'; network->n_name = first_unused; @@ -77,10 +76,10 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network, first_unused += strlen (first_unused) +1; network->n_addrtype = 0; network->n_net = inet_network (NISENTRYVAL (0, 2, result)); - p = first_unused; + char *p = first_unused; - line = p; - for (i = 0; i < result->objects.objects_len; ++i) + char *line = p; + for (unsigned int i = 0; i < result->objects.objects_len; ++i) { if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0) { @@ -107,12 +106,12 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network, room_left -= (2 * sizeof (char *)); network->n_aliases[0] = NULL; - i = 0; + unsigned int i = 0; while (*line != '\0') { /* Skip leading blanks. */ while (isspace (*line)) - line++; + ++line; if (*line == '\0') break; @@ -133,7 +132,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network, ++i; } else - network->n_aliases[i+1] = NULL; + network->n_aliases[i + 1] = NULL; } return 1; @@ -144,19 +143,26 @@ _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "networks.org_dir."; - p = __stpcpy (buf, "networks.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } + return NSS_STATUS_SUCCESS; } @@ -164,16 +170,20 @@ enum nss_status _nss_nisplus_setnetent (int stayopen) { enum nss_status status = NSS_STATUS_SUCCESS; - int err; __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } if (tablename_val == NULL) - status = _nss_create_tablename (&err); + { + int err; + status = _nss_create_tablename (&err); + } __libc_lock_unlock (lock); @@ -185,9 +195,11 @@ _nss_nisplus_endnetent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -220,9 +232,7 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer, result = nis_first_entry (tablename_val); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { - int retval; - - retval = niserr2nss (result->status); + int retval = niserr2nss (result->status); nis_freeresult (result); result = NULL; if (retval == NSS_STATUS_TRYAGAIN) @@ -237,16 +247,12 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer, } else { - nis_result *res; - - res = nis_next_entry (tablename_val, &result->cookie); + nis_result *res = nis_next_entry (tablename_val, &result->cookie); saved_res = result; result = res; if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { - int retval; - - retval = niserr2nss (result->status); + int retval = niserr2nss (result->status); nis_freeresult (result); result = saved_res; if (retval == NSS_STATUS_TRYAGAIN) @@ -266,7 +272,8 @@ internal_nisplus_getnetent_r (struct netent *network, char *buffer, return NSS_STATUS_TRYAGAIN; } - } while (!parse_res); + } + while (!parse_res); return NSS_STATUS_SUCCESS; } @@ -296,8 +303,12 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network, if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } @@ -308,76 +319,82 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network, *herrnop = NETDB_INTERNAL; return NSS_STATUS_UNAVAIL; } - else - { - nis_result *result; - char buf[strlen (name) + 255 + tablename_len]; - int olderr = errno; - /* Search at first in the alias list, and use the correct name - for the next search */ - sprintf (buf, "[name=%s],%s", name, tablename_val); - result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); + nis_result *result; + char buf[strlen (name) + 10 + tablename_len]; + int olderr = errno; - if (result != NULL) - { - /* If we do not find it, try it as original name. But if the - database is correct, we should find it in the first case, too */ - if ((result->status != NIS_SUCCESS - && result->status != NIS_S_SUCCESS) - || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ - || strcmp (result->objects.objects_val[0].EN_data.en_type, - "networks_tbl") != 0 - || (result->objects.objects_val[0].EN_data.en_cols.en_cols_len - < 3)) - sprintf (buf, "[cname=%s],%s", name, tablename_val); - else - sprintf (buf, "[cname=%s],%s", NISENTRYVAL (0, 0, result), - tablename_val); - - nis_freeresult (result); - result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); - } + /* Search at first in the alias list, and use the correct name + for the next search */ + snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val); + result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); - if (result == NULL) - { - __set_errno (ENOMEM); - return NSS_STATUS_TRYAGAIN; - } - retval = niserr2nss (result->status); - if (retval != NSS_STATUS_SUCCESS) + if (result != NULL) + { + char *bufptr = buf; + + /* If we do not find it, try it as original name. But if the + database is correct, we should find it in the first case, too */ + if ((result->status != NIS_SUCCESS + && result->status != NIS_S_SUCCESS) + || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ + || strcmp (result->objects.objects_val[0].EN_data.en_type, + "networks_tbl") != 0 + || (result->objects.objects_val[0].EN_data.en_cols.en_cols_len + < 3)) + snprintf (buf, sizeof (buf), "[cname=%s],%s", name, tablename_val); + else { - if (retval == NSS_STATUS_TRYAGAIN) - { - *errnop = errno; - *herrnop = NETDB_INTERNAL; - } - else - __set_errno (olderr); - nis_freeresult (result); - return retval; + /* We need to allocate a new buffer since there is no + guarantee the returned name has a length limit. */ + const char *entryval = NISENTRYVAL (0, 0, result); + size_t buflen = strlen (entryval) + 10 + tablename_len; + bufptr = alloca (buflen); + snprintf (bufptr, buflen, "[cname=%s],%s", + entryval, tablename_val); } - parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen, - errnop); - nis_freeresult (result); + result = nis_list (bufptr, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); + } - if (parse_res > 0) - return NSS_STATUS_SUCCESS; + if (result == NULL) + { + __set_errno (ENOMEM); + return NSS_STATUS_TRYAGAIN; + } - *herrnop = NETDB_INTERNAL; - if (parse_res == -1) + retval = niserr2nss (result->status); + if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) + { + if (retval == NSS_STATUS_TRYAGAIN) { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + *errnop = errno; + *herrnop = NETDB_INTERNAL; } else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + __set_errno (olderr); + nis_freeresult (result); + return retval; + } + + parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen, + errnop); + + nis_freeresult (result); + + if (parse_res > 0) + return NSS_STATUS_SUCCESS; + + *herrnop = NETDB_INTERNAL; + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; } + + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } /* XXX type is ignored, SUN's NIS+ table doesn't support it */ @@ -388,39 +405,39 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type, { if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } { - int parse_res, retval; - nis_result *result; - char buf[1024 + tablename_len]; - struct in_addr in; - char buf2[256]; - int b2len; + char buf[27 + tablename_len]; + char buf2[18]; int olderr = errno; - in = inet_makeaddr (addr, 0); + struct in_addr in = inet_makeaddr (addr, 0); strcpy (buf2, inet_ntoa (in)); - b2len = strlen (buf2); + size_t b2len = strlen (buf2); while (1) { - sprintf (buf, "[addr=%s],%s", buf2, tablename_val); - result = nis_list (buf, EXPAND_NAME, NULL, NULL); + snprintf (buf, sizeof (buf), "[addr=%s],%s", buf2, tablename_val); + nis_result *result = nis_list (buf, EXPAND_NAME, NULL, NULL); if (result == NULL) { __set_errno (ENOMEM); return NSS_STATUS_TRYAGAIN; } - retval = niserr2nss (result->status); - if (retval != NSS_STATUS_SUCCESS) + enum nss_status retval = niserr2nss (result->status); + if (__builtin_expect (retval != NSS_STATUS_SUCCESS, 0)) { - if (buf2[b2len -2] == '.' && buf2[b2len -1] == '0') + if (b2len > 2 && buf2[b2len - 2] == '.' && buf2[b2len - 1] == '0') { /* Try again, but with trailing dot(s) removed (one by one) */ @@ -428,8 +445,6 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type, b2len -= 2; continue; } - else - return NSS_STATUS_NOTFOUND; if (retval == NSS_STATUS_TRYAGAIN) { @@ -442,8 +457,8 @@ _nss_nisplus_getnetbyaddr_r (uint32_t addr, const int type, return retval; } - parse_res = _nss_nisplus_parse_netent (result, network, buffer, - buflen, errnop); + int parse_res = _nss_nisplus_parse_netent (result, network, buffer, + buflen, errnop); nis_freeresult (result); diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c index 83456cae64..585a4844ad 100644 --- a/nis/nss_nisplus/nisplus-proto.c +++ b/nis/nss_nisplus/nisplus-proto.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2001,2002,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,13 +17,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include +#include #include +#include #include +#include #include -#include #include +#include #include "nss-nisplus.h" @@ -141,19 +142,26 @@ _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "protocols.org_dir."; - p = __stpcpy (buf, "protocols.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } + return NSS_STATUS_SUCCESS; } @@ -164,9 +172,11 @@ _nss_nisplus_setprotoent (int stayopen) __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } if (tablename_val == NULL) { @@ -184,9 +194,11 @@ _nss_nisplus_endprotoent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -221,11 +233,8 @@ internal_nisplus_getprotoent_r (struct protoent *proto, char *buffer, } else { - nis_result *res; - saved_res = result; - res = nis_next_entry (tablename_val, &result->cookie); - result = res; + result = nis_next_entry (tablename_val, &result->cookie); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { @@ -277,79 +286,91 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto, if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } if (name == NULL) return NSS_STATUS_NOTFOUND; - else - { - nis_result *result; - char buf[strlen (name) + 255 + tablename_len]; - int olderr = errno; - - /* Search at first in the alias list, and use the correct name - for the next search */ - sprintf (buf, "[name=%s],%s", name, tablename_val); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result != NULL) - { - /* If we do not find it, try it as original name. But if the - database is correct, we should find it in the first case, too */ - if ((result->status != NIS_SUCCESS - && result->status != NIS_S_SUCCESS) - || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ - || strcmp (result->objects.objects_val->EN_data.en_type, - "protocols_tbl") != 0 - || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3) - sprintf (buf, "[cname=%s],%s", name, tablename_val); - else - sprintf (buf, "[cname=%s],%s", NISENTRYVAL (0, 0, result), - tablename_val); + char buf[strlen (name) + 10 + tablename_len]; + int olderr = errno; - nis_freeresult (result); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - } + /* Search at first in the alias list, and use the correct name + for the next search */ + snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val); + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result == NULL) + if (result != NULL) + { + char *bufptr = buf; + + /* If we did not find it, try it as original name. But if the + database is correct, we should find it in the first case, too */ + if ((result->status != NIS_SUCCESS + && result->status != NIS_S_SUCCESS) + || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ + || strcmp (result->objects.objects_val->EN_data.en_type, + "protocols_tbl") != 0 + || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3) + snprintf (buf, sizeof (buf), "[cname=%s],%s", name, tablename_val); + else { - __set_errno (ENOMEM); - return NSS_STATUS_TRYAGAIN; + /* We need to allocate a new buffer since there is no + guarantee the returned name has a length limit. */ + const char *entryval = NISENTRYVAL (0, 0, result); + size_t buflen = strlen (entryval) + 10 + tablename_len; + bufptr = alloca (buflen); + snprintf (bufptr, buflen, "[cname=%s],%s", + entryval, tablename_val); } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); - __set_errno (olderr); + nis_freeresult (result); + result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + } - nis_freeresult (result); - return status; - } + if (result == NULL) + { + __set_errno (ENOMEM); + return NSS_STATUS_TRYAGAIN; + } - parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen, - errnop); + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); + + __set_errno (olderr); nis_freeresult (result); + return status; + } - if (parse_res < 1) + parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen, + errnop); + + nis_freeresult (result); + + if (parse_res < 1) + { + if (parse_res == -1) { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } - return NSS_STATUS_SUCCESS; } + + return NSS_STATUS_SUCCESS; } enum nss_status @@ -358,55 +379,57 @@ _nss_nisplus_getprotobynumber_r (const int number, struct protoent *proto, { if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } - { - int parse_res; - nis_result *result; - char buf[46 + tablename_len]; - int olderr = errno; + char buf[12 + 3 * sizeof (number) + tablename_len]; + int olderr = errno; - sprintf (buf, "[number=%d],%s", number, tablename_val); + snprintf (buf, sizeof (buf), "[number=%d],%s", number, tablename_val); - result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); + nis_result *result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); - if (result == NULL) - { - __set_errno (ENOMEM); - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); + if (result == NULL) + { + __set_errno (ENOMEM); + return NSS_STATUS_TRYAGAIN; + } - __set_errno (olderr); + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); - nis_freeresult (result); - return status; - } - - parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen, - errnop); - - nis_freeresult (result); - - if (parse_res < 1) - { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } - } - return NSS_STATUS_SUCCESS; - } + __set_errno (olderr); + + nis_freeresult (result); + return status; + } + + int parse_res = _nss_nisplus_parse_protoent (result, proto, buffer, buflen, + errnop); + + nis_freeresult (result); + + if (parse_res < 1) + { + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; + } + } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-publickey.c b/nis/nss_nisplus/nisplus-publickey.c index 58ae7012af..c24e898137 100644 --- a/nis/nss_nisplus/nisplus-publickey.c +++ b/nis/nss_nisplus/nisplus-publickey.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1999, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1999, 2001, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -37,7 +37,7 @@ _nss_nisplus_getpublickey (const char *netname, char *pkey, int *errnop) { nis_result *res; enum nss_status retval; - char buf[NIS_MAXNAMELEN+2]; + char buf[NIS_MAXNAMELEN + 2]; size_t slen; char *domain, *cptr; int len; @@ -120,7 +120,7 @@ _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd, { nis_result *res; enum nss_status retval; - char buf[NIS_MAXNAMELEN+2]; + char buf[NIS_MAXNAMELEN + 2]; size_t slen; char *domain, *cptr; int len; @@ -154,7 +154,7 @@ _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd, buf[slen] = '\0'; } - res = nis_list (buf, USE_DGRAM+NO_AUTHINFO+FOLLOW_LINKS+FOLLOW_PATH, + res = nis_list (buf, USE_DGRAM | NO_AUTHINFO | FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); if (res == NULL) @@ -242,9 +242,9 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp, { char *domain; nis_result *res; - char sname[NIS_MAXNAMELEN+2]; /* search criteria + table name */ + char sname[NIS_MAXNAMELEN + 2]; /* search criteria + table name */ size_t slen; - char principal[NIS_MAXNAMELEN+1]; + char principal[NIS_MAXNAMELEN + 1]; int len; /* 1. Get home domain of user. */ @@ -255,10 +255,6 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp, ++domain; /* skip '@' */ /* 2. Get user's nisplus principal name. */ - if ((strlen (netname) + strlen (domain)+45) > - (size_t) NIS_MAXNAMELEN) - return NSS_STATUS_UNAVAIL; - slen = snprintf (sname, NIS_MAXNAMELEN, "[auth_name=%s,auth_type=DES],cred.org_dir.%s", netname, domain); @@ -339,8 +335,9 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp, return NSS_STATUS_UNAVAIL; } - slen = sprintf (sname, "[cname=%s,auth_type=LOCAL],cred.org_dir.%s", - principal, domain); + slen = snprintf (sname, sizeof (sname), + "[cname=%s,auth_type=LOCAL],cred.org_dir.%s", + principal, domain); if (sname[slen - 1] != '.') { diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c index 8f3bc997b3..97679dd349 100644 --- a/nis/nss_nisplus/nisplus-pwd.c +++ b/nis/nss_nisplus/nisplus-pwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2001,2002,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -30,27 +31,39 @@ __libc_lock_define_initialized (static, lock) static nis_result *result; -static nis_name tablename_val; -static u_long tablename_len; +nis_name pwd_tablename_val attribute_hidden; +size_t pwd_tablename_len attribute_hidden; -static enum nss_status -_nss_create_tablename (int *errnop) +enum nss_status +_nss_pwd_create_tablename (int *errnop) { - if (tablename_val == NULL) + if (pwd_tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "passwd.org_dir."; - p = __stpcpy (buf, "passwd.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); - if (tablename_val == NULL) + char *p = malloc (sizeof (prefix) + local_dir_len); + if (pwd_tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + pwd_tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + if (atomic_compare_and_exchange_bool_acq (&pwd_tablename_val, p, NULL)) + { + /* Another thread already installed the value. */ + free (p); + pwd_tablename_len = strlen (pwd_tablename_val); + } } + return NSS_STATUS_SUCCESS; } @@ -59,16 +72,20 @@ enum nss_status _nss_nisplus_setpwent (int stayopen) { enum nss_status status = NSS_STATUS_SUCCESS; - int err; __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } - if (tablename_val == NULL) - status = _nss_create_tablename (&err); + if (pwd_tablename_val == NULL) + { + int err; + status = _nss_pwd_create_tablename (&err); + } __libc_lock_unlock (lock); @@ -80,9 +97,11 @@ _nss_nisplus_endpwent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -103,25 +122,22 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen, if (result == NULL) { saved_res = NULL; - if (tablename_val == NULL) + if (pwd_tablename_val == NULL) { - enum nss_status status = _nss_create_tablename (errnop); + enum nss_status status = _nss_pwd_create_tablename (errnop); if (status != NSS_STATUS_SUCCESS) return status; } - result = nis_first_entry (tablename_val); + result = nis_first_entry (pwd_tablename_val); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) return niserr2nss (result->status); } else { - nis_result *res; - saved_res = result; - res = nis_next_entry (tablename_val, &result->cookie); - result = res; + result = nis_next_entry (pwd_tablename_val, &result->cookie); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { nis_freeresult (saved_res); @@ -131,19 +147,18 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen, parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen, errnop); - if (parse_res == -1) + if (__builtin_expect (parse_res == -1, 0)) { nis_freeresult (result); result = saved_res; *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; } - else - { - if (saved_res) - nis_freeresult (saved_res); - } - } while (!parse_res); + + if (saved_res) + nis_freeresult (saved_res); + } + while (!parse_res); return NSS_STATUS_SUCCESS; } @@ -169,9 +184,9 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw, { int parse_res; - if (tablename_val == NULL) + if (pwd_tablename_val == NULL) { - enum nss_status status = _nss_create_tablename (errnop); + enum nss_status status = _nss_pwd_create_tablename (errnop); if (status != NSS_STATUS_SUCCESS) return status; @@ -182,107 +197,107 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw, *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } - else - { - nis_result *result; - char buf[strlen (name) + 24 + tablename_len]; - int olderr = errno; - sprintf (buf, "[name=%s],%s", name, tablename_val); + nis_result *result; + char buf[strlen (name) + 9 + pwd_tablename_len]; + int olderr = errno; - result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + snprintf (buf, sizeof (buf), "[name=%s],%s", name, pwd_tablename_val); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); + result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - __set_errno (olderr); + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - nis_freeresult (result); - return status; - } + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); - parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen, - errnop); + __set_errno (olderr); nis_freeresult (result); + return status; + } + + parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen, errnop); + + nis_freeresult (result); - if (parse_res < 1) + if (__builtin_expect (parse_res < 1, 0)) + { + if (parse_res == -1) { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } - return NSS_STATUS_SUCCESS; } + + return NSS_STATUS_SUCCESS; } enum nss_status _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw, char *buffer, size_t buflen, int *errnop) { - if (tablename_val == NULL) + if (pwd_tablename_val == NULL) { - enum nss_status status = _nss_create_tablename (errnop); + enum nss_status status = _nss_pwd_create_tablename (errnop); if (status != NSS_STATUS_SUCCESS) return status; } - { - int parse_res; - nis_result *result; - char buf[100 + tablename_len]; - int olderr = errno; + int parse_res; + nis_result *result; + char buf[8 + 3 * sizeof (unsigned long int) + pwd_tablename_len]; + int olderr = errno; - sprintf (buf, "[uid=%lu],%s", (unsigned long int) uid, tablename_val); + snprintf (buf, sizeof (buf), "[uid=%lu],%s", + (unsigned long int) uid, pwd_tablename_val); - result = nis_list(buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - __set_errno (olderr); + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); - nis_freeresult (result); - return status; - } - - parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen, errnop); - - nis_freeresult (result); - - if (parse_res < 1) - { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } - } - return NSS_STATUS_SUCCESS; - } + __set_errno (olderr); + + nis_freeresult (result); + return status; + } + + parse_res = _nss_nisplus_parse_pwent (result, pw, buffer, buflen, errnop); + + nis_freeresult (result); + + if (__builtin_expect (parse_res < 1, 0)) + { + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; + } + } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c index 31d48d17a3..98baa5f7fc 100644 --- a/nis/nss_nisplus/nisplus-rpc.c +++ b/nis/nss_nisplus/nisplus-rpc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2001,2002,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,13 +17,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include +#include #include +#include +#include #include -#include #include #include +#include #include "nss-nisplus.h" @@ -138,19 +139,26 @@ _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "rpc.org_dir."; - p = __stpcpy (buf, "rpc.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } + return NSS_STATUS_SUCCESS; } @@ -159,16 +167,20 @@ enum nss_status _nss_nisplus_setrpcent (int stayopen) { enum nss_status status = NSS_STATUS_SUCCESS; - int err; __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } if (tablename_val == NULL) - status = _nss_create_tablename (&err); + { + int err; + status = _nss_create_tablename (&err); + } __libc_lock_unlock (lock); @@ -180,9 +192,11 @@ _nss_nisplus_endrpcent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -217,11 +231,8 @@ internal_nisplus_getrpcent_r (struct rpcent *rpc, char *buffer, } else { - nis_result *res; - saved_res = result; - res = nis_next_entry (tablename_val, &result->cookie); - result = res; + result = nis_next_entry (tablename_val, &result->cookie); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { nis_freeresult (saved_res); @@ -243,7 +254,8 @@ internal_nisplus_getrpcent_r (struct rpcent *rpc, char *buffer, if (saved_res) nis_freeresult (saved_res); } - } while (!parse_res); + } + while (!parse_res); return NSS_STATUS_SUCCESS; } @@ -271,77 +283,89 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc, if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } if (name == NULL) return NSS_STATUS_NOTFOUND; - else - { - nis_result *result; - char buf[strlen (name) + 255 + tablename_len]; - int olderr = errno; - - /* Search at first in the alias list, and use the correct name - for the next search */ - sprintf (buf, "[name=%s],%s", name, tablename_val); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result != NULL) - { - /* If we do not find it, try it as original name. But if the - database is correct, we should find it in the first case, too */ - if ((result->status != NIS_SUCCESS - && result->status != NIS_S_SUCCESS) - || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ - || strcmp (result->objects.objects_val->EN_data.en_type, - "rpc_tbl") != 0 - || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3) - sprintf (buf, "[cname=%s],%s", name, tablename_val); - else - sprintf (buf, "[cname=%s],%s", NISENTRYVAL (0, 0, result), - tablename_val); + char buf[strlen (name) + 10 + tablename_len]; + int olderr = errno; - nis_freeresult (result); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS , NULL, NULL); - } + /* Search at first in the alias list, and use the correct name + for the next search */ + snprintf (buf, sizeof (buf), "[name=%s],%s", name, tablename_val); + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result == NULL) + if (result != NULL) + { + char *bufptr = buf; + + /* If we did not find it, try it as original name. But if the + database is correct, we should find it in the first case, too */ + if ((result->status != NIS_SUCCESS + && result->status != NIS_S_SUCCESS) + || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ + || strcmp (result->objects.objects_val->EN_data.en_type, + "rpc_tbl") != 0 + || result->objects.objects_val->EN_data.en_cols.en_cols_len < 3) + snprintf (buf, sizeof (buf), "[cname=%s],%s", name, tablename_val); + else { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; + /* We need to allocate a new buffer since there is no + guarantee the returned name has a length limit. */ + const char *entryval = NISENTRYVAL (0, 0, result); + size_t buflen = strlen (entryval) + 10 + tablename_len; + bufptr = alloca (buflen); + snprintf (bufptr, buflen, "[cname=%s],%s", + entryval, tablename_val); } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); - __set_errno (olderr); + nis_freeresult (result); + result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS , NULL, NULL); + } - nis_freeresult (result); - return status; - } + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen, - errnop); + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); + + __set_errno (olderr); nis_freeresult (result); + return status; + } - if (parse_res < 1) - { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } + parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen, + errnop); - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; + nis_freeresult (result); + + if (parse_res < 1) + { + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; } - return NSS_STATUS_SUCCESS; + + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } + + return NSS_STATUS_SUCCESS; } enum nss_status @@ -350,55 +374,57 @@ _nss_nisplus_getrpcbynumber_r (const int number, struct rpcent *rpc, { if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } - { - int parse_res; - nis_result *result; - char buf[100 + tablename_len]; - int olderr = errno; + char buf[12 + 3 * sizeof (number) + tablename_len]; + int olderr = errno; + + snprintf (buf, sizeof (buf), "[number=%d],%s", number, tablename_val); + + nis_result *result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); + + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } + + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); - sprintf (buf, "[number=%d],%s", number, tablename_val); + __set_errno (olderr); - result = nis_list(buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL); + nis_freeresult (result); + return status; + } - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); + int parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen, + errnop); - __set_errno (olderr); + nis_freeresult (result); - nis_freeresult (result); - return status; - } - - parse_res = _nss_nisplus_parse_rpcent (result, rpc, buffer, buflen, - errnop); - - nis_freeresult (result); - - if (parse_res < 1) - { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } - } - return NSS_STATUS_SUCCESS; - } + if (parse_res < 1) + { + if (parse_res == -1) + { + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; + } + } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c index fbb6987e9e..848e5f4dd8 100644 --- a/nis/nss_nisplus/nisplus-service.c +++ b/nis/nss_nisplus/nisplus-service.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2001,2002,2003 Free Software Foundation, Inc. +/* Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -17,13 +17,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include -#include +#include #include +#include #include +#include #include -#include #include +#include #include "nss-nisplus.h" @@ -45,8 +46,6 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv, { char *first_unused = buffer; size_t room_left = buflen; - unsigned int i; - char *p, *line; if (result == NULL) return 0; @@ -81,10 +80,10 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv, first_unused += strlen (first_unused) + 1; serv->s_port = htons (atoi (NISENTRYVAL (0, 3, result))); - p = first_unused; + char *p = first_unused; - line = p; - for (i = 0; i < result->objects.objects_len; ++i) + char *line = p; + for (unsigned int i = 0; i < result->objects.objects_len; ++i) { if (strcmp (NISENTRYVAL (i, 1, result), serv->s_name) != 0) { @@ -110,7 +109,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv, room_left -= (sizeof (char *)); serv->s_aliases[0] = NULL; - i = 0; + unsigned int i = 0; while (*line != '\0') { /* Skip leading blanks. */ @@ -147,19 +146,26 @@ _nss_create_tablename (int *errnop) { if (tablename_val == NULL) { - char buf [40 + strlen (nis_local_directory ())]; - char *p; + const char *local_dir = nis_local_directory (); + size_t local_dir_len = strlen (local_dir); + static const char prefix[] = "services.org_dir."; - p = __stpcpy (buf, "services.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); + char *p = malloc (sizeof (prefix) + local_dir_len); if (tablename_val == NULL) { *errnop = errno; return NSS_STATUS_TRYAGAIN; } - tablename_len = strlen (tablename_val); + + memcpy (__stpcpy (p, prefix), local_dir, local_dir_len + 1); + + tablename_len = sizeof (prefix) - 1 + local_dir_len; + + atomic_write_barrier (); + + tablename_val = p; } + return NSS_STATUS_SUCCESS; } @@ -172,9 +178,11 @@ _nss_nisplus_setservent (int stayopen) __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } if (tablename_val == NULL) status = _nss_create_tablename (&err); @@ -189,9 +197,11 @@ _nss_nisplus_endservent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -226,11 +236,8 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer, } else { - nis_result *res; - saved_res = result; - res = nis_next_entry (tablename_val, &result->cookie); - result = res; + result = nis_next_entry (tablename_val, &result->cookie); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { nis_freeresult (saved_res); @@ -240,7 +247,7 @@ internal_nisplus_getservent_r (struct servent *serv, char *buffer, parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen, errnop); - if (parse_res == -1) + if (__builtin_expect (parse_res == -1, 0)) { nis_freeresult (result); result = saved_res; @@ -262,11 +269,9 @@ enum nss_status _nss_nisplus_getservent_r (struct servent *result, char *buffer, size_t buflen, int *errnop) { - int status; - __libc_lock_lock (lock); - status = internal_nisplus_getservent_r (result, buffer, buflen, errnop); + int status = internal_nisplus_getservent_r (result, buffer, buflen, errnop); __libc_lock_unlock (lock); @@ -278,12 +283,14 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol, struct servent *serv, char *buffer, size_t buflen, int *errnop) { - int parse_res; - if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } @@ -293,72 +300,82 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol, *errnop = EINVAL; return NSS_STATUS_NOTFOUND; } - else - { - nis_result *result; - char buf[strlen (name) + 255 + tablename_len]; - int olderr = errno; - /* Search at first in the alias list, and use the correct name - for the next search */ - sprintf (buf, "[name=%s,proto=%s],%s", name, protocol, - tablename_val); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + size_t protocol_len = strlen (protocol); + char buf[strlen (name) + protocol_len + 17 + tablename_len]; + int olderr = errno; - if (result != NULL) - { - /* If we do not find it, try it as original name. But if the - database is correct, we should find it in the first case, too */ - if ((result->status != NIS_SUCCESS - && result->status != NIS_S_SUCCESS) - || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ - || strcmp (result->objects.objects_val->EN_data.en_type, - "services_tbl") != 0 - || result->objects.objects_val->EN_data.en_cols.en_cols_len < 4) - sprintf (buf, "[cname=%s,proto=%s],%s", name, protocol, - tablename_val); - else - sprintf (buf, "[cname=%s,proto=%s],%s", - NISENTRYVAL (0, 0, result), protocol, tablename_val); - - nis_freeresult (result); - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - } + /* Search at first in the alias list, and use the correct name + for the next search */ + snprintf (buf, sizeof (buf), "[name=%s,proto=%s],%s", name, protocol, + tablename_val); + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - if (result == NULL) + if (result != NULL) + { + char *bufptr = buf; + + /* If we did not find it, try it as original name. But if the + database is correct, we should find it in the first case, too */ + if ((result->status != NIS_SUCCESS + && result->status != NIS_S_SUCCESS) + || __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ + || strcmp (result->objects.objects_val->EN_data.en_type, + "services_tbl") != 0 + || result->objects.objects_val->EN_data.en_cols.en_cols_len < 4) + snprintf (buf, sizeof (buf), "[cname=%s,proto=%s],%s", name, protocol, + tablename_val); + else { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; + /* We need to allocate a new buffer since there is no + guarantee the returned name has a length limit. */ + const char *entryval = NISENTRYVAL(0, 0, result); + size_t buflen = (strlen (entryval) + protocol_len + 17 + + tablename_len); + bufptr = alloca (buflen); + snprintf (bufptr, buflen, "[cname=%s,proto=%s],%s", + entryval, protocol, tablename_val); } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); - __set_errno (olderr); + nis_freeresult (result); + result = nis_list (bufptr, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + } - nis_freeresult (result); - return status; - } + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } + + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); + + __set_errno (olderr); - parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen, - errnop); nis_freeresult (result); + return status; + } + + int parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen, + errnop); + nis_freeresult (result); - if (parse_res < 1) + if (__builtin_expect (parse_res < 1, 0)) + { + if (parse_res == -1) { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } - return NSS_STATUS_SUCCESS; } + + return NSS_STATUS_SUCCESS; } enum nss_status @@ -368,8 +385,12 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol, { if (tablename_val == NULL) { + __libc_lock_lock (lock); + enum nss_status status = _nss_create_tablename (errnop); + __libc_lock_unlock (lock); + if (status != NSS_STATUS_SUCCESS) return status; } @@ -379,50 +400,48 @@ _nss_nisplus_getservbyport_r (const int number, const char *protocol, *errnop = EINVAL; return NSS_STATUS_NOTFOUND; } - else - { - int parse_res; - nis_result *result; - char buf[60 + strlen (protocol) + tablename_len]; - int olderr = errno; - sprintf (buf, "[port=%d,proto=%s],%s", - number, protocol, tablename_val); + char buf[17 + 3 * sizeof (int) + strlen (protocol) + tablename_len]; + int olderr = errno; - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + snprintf (buf, sizeof (buf), "[port=%d,proto=%s],%s", + number, protocol, tablename_val); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); + nis_result *result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - __set_errno (olderr); + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - nis_freeresult (result); - return status; - } + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); + + __set_errno (olderr); - parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen, - errnop); nis_freeresult (result); + return status; + } + + int parse_res = _nss_nisplus_parse_servent (result, serv, buffer, buflen, + errnop); + nis_freeresult (result); - if (parse_res < 1) + if (__builtin_expect (parse_res < 1, 0)) + { + if (parse_res == -1) { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } - return NSS_STATUS_SUCCESS; } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/nss_nisplus/nisplus-spwd.c b/nis/nss_nisplus/nisplus-spwd.c index c317469137..8584300698 100644 --- a/nis/nss_nisplus/nisplus-spwd.c +++ b/nis/nss_nisplus/nisplus-spwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -30,29 +30,12 @@ __libc_lock_define_initialized (static, lock) static nis_result *result; -static nis_name tablename_val; -static u_long tablename_len; -static enum nss_status -_nss_create_tablename (int *errnop) -{ - if (tablename_val == NULL) - { - char buf [40 + strlen (nis_local_directory ())]; - char *p; +/* Defined in nisplus-pwd.c. */ +extern nis_name pwd_tablename_val attribute_hidden; +extern size_t pwd_tablename_len attribute_hidden; +extern enum nss_status _nss_pwd_create_tablename (int *errnop); - p = __stpcpy (buf, "passwd.org_dir."); - p = __stpcpy (p, nis_local_directory ()); - tablename_val = __strdup (buf); - if (tablename_val == NULL) - { - *errnop = errno; - return NSS_STATUS_TRYAGAIN; - } - tablename_len = strlen (tablename_val); - } - return NSS_STATUS_SUCCESS; -} enum nss_status _nss_nisplus_setspent (int stayopen) @@ -62,12 +45,14 @@ _nss_nisplus_setspent (int stayopen) __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } - if (tablename_val == NULL) - status = _nss_create_tablename (&err); + if (pwd_tablename_val == NULL) + status = _nss_pwd_create_tablename (&err); __libc_lock_unlock (lock); @@ -79,9 +64,11 @@ _nss_nisplus_endspent (void) { __libc_lock_lock (lock); - if (result) - nis_freeresult (result); - result = NULL; + if (result != NULL) + { + nis_freeresult (result); + result = NULL; + } __libc_lock_unlock (lock); @@ -103,25 +90,22 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen, { saved_res = NULL; - if (tablename_val == NULL) + if (pwd_tablename_val == NULL) { - enum nss_status status = _nss_create_tablename (errnop); + enum nss_status status = _nss_pwd_create_tablename (errnop); if (status != NSS_STATUS_SUCCESS) return status; } - result = nis_first_entry (tablename_val); + result = nis_first_entry (pwd_tablename_val); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) return niserr2nss (result->status); } else { - nis_result *res; - saved_res = result; - res = nis_next_entry (tablename_val, &result->cookie); - result = res; + result = nis_next_entry (pwd_tablename_val, &result->cookie); if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) { nis_freeresult (saved_res); @@ -131,19 +115,18 @@ internal_nisplus_getspent_r (struct spwd *sp, char *buffer, size_t buflen, parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, errnop); - if (parse_res == -1) + if (__builtin_expect (parse_res == -1, 0)) { nis_freeresult (result); result = saved_res; *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; } - else - { - if (saved_res) - nis_freeresult (saved_res); - } - } while (!parse_res); + + if (saved_res != NULL) + nis_freeresult (saved_res); + } + while (!parse_res); return NSS_STATUS_SUCCESS; } @@ -169,9 +152,9 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp, { int parse_res; - if (tablename_val == NULL) + if (pwd_tablename_val == NULL) { - enum nss_status status = _nss_create_tablename (errnop); + enum nss_status status = _nss_pwd_create_tablename (errnop); if (status != NSS_STATUS_SUCCESS) return status; @@ -182,48 +165,47 @@ _nss_nisplus_getspnam_r (const char *name, struct spwd *sp, *errnop = EINVAL; return NSS_STATUS_NOTFOUND; } - else - { - nis_result *result; - char buf[strlen (name) + 24 + tablename_len]; - int olderr = errno; - sprintf (buf, "[name=%s],%s", name, tablename_val); + nis_result *result; + char buf[strlen (name) + 9 + pwd_tablename_len]; + int olderr = errno; - result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); + snprintf (buf, sizeof (buf), "[name=%s],%s", name, pwd_tablename_val); - if (result == NULL) - { - *errnop = ENOMEM; - return NSS_STATUS_TRYAGAIN; - } - if (niserr2nss (result->status) != NSS_STATUS_SUCCESS) - { - enum nss_status status = niserr2nss (result->status); + result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); - __set_errno (olderr); + if (result == NULL) + { + *errnop = ENOMEM; + return NSS_STATUS_TRYAGAIN; + } - nis_freeresult (result); - return status; - } + if (__builtin_expect (niserr2nss (result->status) != NSS_STATUS_SUCCESS, 0)) + { + enum nss_status status = niserr2nss (result->status); + + __set_errno (olderr); - parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, - errnop); nis_freeresult (result); + return status; + } - if (parse_res < 1) + parse_res = _nss_nisplus_parse_spent (result, sp, buffer, buflen, errnop); + nis_freeresult (result); + + if (__builtin_expect (parse_res < 1, 0)) + { + if (parse_res == -1) { - if (parse_res == -1) - { - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } - else - { - __set_errno (olderr); - return NSS_STATUS_NOTFOUND; - } + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + else + { + __set_errno (olderr); + return NSS_STATUS_NOTFOUND; } - return NSS_STATUS_SUCCESS; } + + return NSS_STATUS_SUCCESS; } diff --git a/nis/ypclnt.c b/nis/ypclnt.c index 6230cb84dc..66095667c6 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -46,12 +46,12 @@ struct dom_binding }; typedef struct dom_binding dom_binding; -static struct timeval RPCTIMEOUT = {25, 0}; -static struct timeval UDPTIMEOUT = {5, 0}; +static const struct timeval RPCTIMEOUT = {25, 0}; +static const struct timeval UDPTIMEOUT = {5, 0}; static int const MAXTRIES = 2; -static char __ypdomainname[NIS_MAXNAMELEN + 1] = "\0"; +static char ypdomainname[NIS_MAXNAMELEN + 1]; __libc_lock_define_initialized (static, ypbindlist_lock) -static dom_binding *__ypbindlist = NULL; +static dom_binding *ypbindlist = NULL; static void @@ -111,8 +111,8 @@ yp_bind_ypbindprog (const char *domain, dom_binding *ysd) int clnt_sock; CLIENT *client; - memset (&clnt_saddr, '\0', sizeof clnt_saddr); clnt_saddr.sin_family = AF_INET; + clnt_saddr.sin_port = 0; clnt_saddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); clnt_sock = RPC_ANYSOCK; client = clnttcp_create (&clnt_saddr, YPBINDPROG, YPBINDVERS, @@ -142,7 +142,7 @@ yp_bind_ypbindprog (const char *domain, dom_binding *ysd) if (ypbr.ypbind_status != YPBIND_SUCC_VAL) { - fprintf (stderr, _("YPBINDPROC_DOMAIN: %s\n"), + fprintf (stderr, "YPBINDPROC_DOMAIN: %s\n", ypbinderr_string (ypbr.ypbind_resp_u.ypbind_error)); return YPERR_DOMAIN; } @@ -225,7 +225,7 @@ yp_bind (const char *indomain) __libc_lock_lock (ypbindlist_lock); - status = __yp_bind (indomain, &__ypbindlist); + status = __yp_bind (indomain, &ypbindlist); __libc_lock_unlock (ypbindlist_lock); @@ -239,7 +239,7 @@ yp_unbind_locked (const char *indomain) dom_binding *ydbptr, *ydbptr2; ydbptr2 = NULL; - ydbptr = __ypbindlist; + ydbptr = ypbindlist; while (ydbptr != NULL) { @@ -249,7 +249,7 @@ yp_unbind_locked (const char *indomain) work = ydbptr; if (ydbptr2 == NULL) - __ypbindlist = __ypbindlist->dom_pnext; + ypbindlist = ypbindlist->dom_pnext; else ydbptr2 = ydbptr->dom_pnext; __yp_unbind (work); @@ -306,7 +306,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, status = YPERR_YPERR; __libc_lock_lock (ypbindlist_lock); - ydb = __ypbindlist; + ydb = ypbindlist; while (ydb != NULL) { if (strcmp (domain, ydb->dom_domain) == 0) @@ -349,7 +349,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, if (status != YPERR_SUCCESS) { ydb = calloc (1, sizeof (dom_binding)); - if (yp_bind_ypbindprog (domain, ydb) == YPERR_SUCCESS) + if (ydb != NULL && yp_bind_ypbindprog (domain, ydb) == YPERR_SUCCESS) { status = __ypclnt_call (domain, prog, xargs, req, xres, resp, &ydb, 1); @@ -365,6 +365,21 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, return status; } +/* Like do_ypcall, but translate the status value if necessary. */ +static int +do_ypcall_tr (const char *domain, u_long prog, xdrproc_t xargs, + caddr_t req, xdrproc_t xres, caddr_t resp) +{ + int status = do_ypcall (domain, prog, xargs, req, xres, resp); + if (status == YPERR_SUCCESS) + /* We cast to ypresp_val although the pointer could also be of + type ypresp_key_val or ypresp_master or ypresp_order or + ypresp_maplist. But the stat element is in a common prefix so + this does not matter. */ + status = ypprot_err (((struct ypresp_val *) resp)->stat); + return status; +} + __libc_lock_define_initialized (static, domainname_lock) @@ -376,21 +391,21 @@ yp_get_default_domain (char **outdomain) __libc_lock_lock (domainname_lock); - if (__ypdomainname[0] == '\0') + if (ypdomainname[0] == '\0') { - if (getdomainname (__ypdomainname, NIS_MAXNAMELEN)) + if (getdomainname (ypdomainname, NIS_MAXNAMELEN)) result = YPERR_NODOM; - else if (strcmp (__ypdomainname, "(none)") == 0) + else if (strcmp (ypdomainname, "(none)") == 0) { /* If domainname is not set, some systems will return "(none)" */ - __ypdomainname[0] = '\0'; + ypdomainname[0] = '\0'; result = YPERR_NODOM; } else - *outdomain = __ypdomainname; + *outdomain = ypdomainname; } else - *outdomain = __ypdomainname; + *outdomain = ypdomainname; __libc_lock_unlock (domainname_lock); @@ -403,14 +418,14 @@ __yp_check (char **domain) { char *unused; - if (__ypdomainname[0] == '\0') + if (ypdomainname[0] == '\0') if (yp_get_default_domain (&unused)) return 0; if (domain) - *domain = __ypdomainname; + *domain = ypdomainname; - if (yp_bind (__ypdomainname) == 0) + if (yp_bind (ypdomainname) == 0) return 1; return 0; } @@ -437,25 +452,26 @@ yp_match (const char *indomain, const char *inmap, const char *inkey, *outvallen = 0; memset (&resp, '\0', sizeof (resp)); - result = do_ypcall (indomain, YPPROC_MATCH, (xdrproc_t) xdr_ypreq_key, - (caddr_t) & req, (xdrproc_t) xdr_ypresp_val, - (caddr_t) & resp); + result = do_ypcall_tr (indomain, YPPROC_MATCH, (xdrproc_t) xdr_ypreq_key, + (caddr_t) &req, (xdrproc_t) xdr_ypresp_val, + (caddr_t) &resp); if (result != YPERR_SUCCESS) return result; - if (resp.stat != YP_TRUE) - return ypprot_err (resp.stat); *outvallen = resp.val.valdat_len; *outval = malloc (*outvallen + 1); - if (__builtin_expect (*outval == NULL, 0)) - return YPERR_RESRC; - memcpy (*outval, resp.val.valdat_val, *outvallen); - (*outval)[*outvallen] = '\0'; + int status = YPERR_RESRC; + if (__builtin_expect (*outval != NULL, 1)) + { + memcpy (*outval, resp.val.valdat_val, *outvallen); + (*outval)[*outvallen] = '\0'; + status = YPERR_SUCCESS; + } xdr_free ((xdrproc_t) xdr_ypresp_val, (char *) &resp); - return YPERR_SUCCESS; + return status; } int @@ -478,30 +494,38 @@ yp_first (const char *indomain, const char *inmap, char **outkey, memset (&resp, '\0', sizeof (resp)); result = do_ypcall (indomain, YPPROC_FIRST, (xdrproc_t) xdr_ypreq_nokey, - (caddr_t) & req, (xdrproc_t) xdr_ypresp_key_val, - (caddr_t) & resp); + (caddr_t) &req, (xdrproc_t) xdr_ypresp_key_val, + (caddr_t) &resp); if (result != RPC_SUCCESS) return YPERR_RPC; if (resp.stat != YP_TRUE) return ypprot_err (resp.stat); - *outkeylen = resp.key.keydat_len; - *outkey = malloc (*outkeylen + 1); - if (__builtin_expect (*outkey == NULL, 0)) - return YPERR_RESRC; - memcpy (*outkey, resp.key.keydat_val, *outkeylen); - (*outkey)[*outkeylen] = '\0'; - *outvallen = resp.val.valdat_len; - *outval = malloc (*outvallen + 1); - if (__builtin_expect (*outval == NULL, 0)) - return YPERR_RESRC; - memcpy (*outval, resp.val.valdat_val, *outvallen); - (*outval)[*outvallen] = '\0'; + int status; + if (__builtin_expect ((*outkey = malloc (resp.key.keydat_len + 1)) != NULL + && (*outval = malloc (resp.val.valdat_len + + 1)) != NULL, 1)) + { + *outkeylen = resp.key.keydat_len; + memcpy (*outkey, resp.key.keydat_val, *outkeylen); + (*outkey)[*outkeylen] = '\0'; + + *outvallen = resp.val.valdat_len; + memcpy (*outval, resp.val.valdat_val, *outvallen); + (*outval)[*outvallen] = '\0'; + + status = YPERR_SUCCESS; + } + else + { + free (*outkey); + status = YPERR_RESRC; + } xdr_free ((xdrproc_t) xdr_ypresp_key_val, (char *) &resp); - return YPERR_SUCCESS; + return status; } int @@ -527,31 +551,37 @@ yp_next (const char *indomain, const char *inmap, const char *inkey, *outkeylen = *outvallen = 0; memset (&resp, '\0', sizeof (resp)); - result = do_ypcall (indomain, YPPROC_NEXT, (xdrproc_t) xdr_ypreq_key, - (caddr_t) & req, (xdrproc_t) xdr_ypresp_key_val, - (caddr_t) & resp); + result = do_ypcall_tr (indomain, YPPROC_NEXT, (xdrproc_t) xdr_ypreq_key, + (caddr_t) &req, (xdrproc_t) xdr_ypresp_key_val, + (caddr_t) &resp); if (result != YPERR_SUCCESS) return result; - if (resp.stat != YP_TRUE) - return ypprot_err (resp.stat); - *outkeylen = resp.key.keydat_len; - *outkey = malloc (*outkeylen + 1); - if (__builtin_expect (*outkey == NULL, 0)) - return YPERR_RESRC; - memcpy (*outkey, resp.key.keydat_val, *outkeylen); - (*outkey)[*outkeylen] = '\0'; - *outvallen = resp.val.valdat_len; - *outval = malloc (*outvallen + 1); - if (__builtin_expect (*outval == NULL, 0)) - return YPERR_RESRC; - memcpy (*outval, resp.val.valdat_val, *outvallen); - (*outval)[*outvallen] = '\0'; + int status; + if (__builtin_expect ((*outkey = malloc (resp.key.keydat_len + 1)) != NULL + && (*outval = malloc (resp.val.valdat_len + + 1)) != NULL, 1)) + { + *outkeylen = resp.key.keydat_len; + memcpy (*outkey, resp.key.keydat_val, *outkeylen); + (*outkey)[*outkeylen] = '\0'; + + *outvallen = resp.val.valdat_len; + memcpy (*outval, resp.val.valdat_val, *outvallen); + (*outval)[*outvallen] = '\0'; + + status = YPERR_SUCCESS; + } + else + { + free (*outkey); + status = YPERR_RESRC; + } xdr_free ((xdrproc_t) xdr_ypresp_key_val, (char *) &resp); - return YPERR_SUCCESS; + return status; } int @@ -570,13 +600,12 @@ yp_master (const char *indomain, const char *inmap, char **outname) memset (&resp, '\0', sizeof (ypresp_master)); - result = do_ypcall (indomain, YPPROC_MASTER, (xdrproc_t) xdr_ypreq_nokey, - (caddr_t) & req, (xdrproc_t) xdr_ypresp_master, (caddr_t) & resp); + result = do_ypcall_tr (indomain, YPPROC_MASTER, (xdrproc_t) xdr_ypreq_nokey, + (caddr_t) &req, (xdrproc_t) xdr_ypresp_master, + (caddr_t) &resp); if (result != YPERR_SUCCESS) return result; - if (resp.stat != YP_TRUE) - return ypprot_err (resp.stat); *outname = strdup (resp.peer); xdr_free ((xdrproc_t) xdr_ypresp_master, (char *) &resp); @@ -593,7 +622,7 @@ yp_order (const char *indomain, const char *inmap, unsigned int *outorder) enum clnt_stat result; if (indomain == NULL || indomain[0] == '\0' || - inmap == NULL || inmap == '\0') + inmap == NULL || inmap[0] == '\0') return YPERR_BADARGS; req.domain = (char *) indomain; @@ -601,18 +630,17 @@ yp_order (const char *indomain, const char *inmap, unsigned int *outorder) memset (&resp, '\0', sizeof (resp)); - result = do_ypcall (indomain, YPPROC_ORDER, (xdrproc_t) xdr_ypreq_nokey, - (caddr_t) & req, (xdrproc_t) xdr_ypresp_order, (caddr_t) & resp); + result = do_ypcall_tr (indomain, YPPROC_ORDER, (xdrproc_t) xdr_ypreq_nokey, + (caddr_t) &req, (xdrproc_t) xdr_ypresp_order, + (caddr_t) &resp); - if (result != YPERR_SUCCESS) + if (result == YPERR_SUCCESS) return result; - if (resp.stat != YP_TRUE) - return ypprot_err (resp.stat); *outorder = resp.ordernum; xdr_free ((xdrproc_t) xdr_ypresp_order, (char *) &resp); - return YPERR_SUCCESS; + return result; } struct ypresp_all_data @@ -694,8 +722,8 @@ yp_all (const char *indomain, const char *inmap, int clnt_sock; int saved_errno = errno; - if (indomain == NULL || indomain[0] == '\0' || - inmap == NULL || inmap == '\0') + if (indomain == NULL || indomain[0] == '\0' + || inmap == NULL || inmap[0] == '\0') return YPERR_BADARGS; try = 0; @@ -733,9 +761,9 @@ yp_all (const char *indomain, const char *inmap, (caddr_t) &req, (xdrproc_t) __xdr_ypresp_all, (caddr_t) &data, RPCTIMEOUT); - if (result != RPC_SUCCESS) + if (__builtin_expect (result != RPC_SUCCESS, 0)) { - /* Print the error message only on the last try */ + /* Print the error message only on the last try. */ if (try == MAXTRIES - 1) clnt_perror (clnt, "yp_all: clnt_call"); res = YPERR_RPC; @@ -759,6 +787,7 @@ yp_all (const char *indomain, const char *inmap, } int + yp_maplist (const char *indomain, struct ypmaplist **outmaplist) { struct ypresp_maplist resp; @@ -769,62 +798,82 @@ yp_maplist (const char *indomain, struct ypmaplist **outmaplist) memset (&resp, '\0', sizeof (resp)); - result = do_ypcall (indomain, YPPROC_MAPLIST, (xdrproc_t) xdr_domainname, - (caddr_t) & indomain, (xdrproc_t) xdr_ypresp_maplist, (caddr_t) & resp); - - if (result != YPERR_SUCCESS) - return result; - if (resp.stat != YP_TRUE) - return ypprot_err (resp.stat); + result = do_ypcall_tr (indomain, YPPROC_MAPLIST, (xdrproc_t) xdr_domainname, + (caddr_t) &indomain, (xdrproc_t) xdr_ypresp_maplist, + (caddr_t) &resp); - *outmaplist = resp.maps; - /* We give the list not free, this will be done by ypserv - xdr_free((xdrproc_t)xdr_ypresp_maplist, (char *)&resp); */ + if (__builtin_expect (result == YPERR_SUCCESS, 1)) + { + *outmaplist = resp.maps; + /* We don't free the list, this will be done by ypserv + xdr_free((xdrproc_t)xdr_ypresp_maplist, (char *)&resp); */ + } - return YPERR_SUCCESS; + return result; } const char * yperr_string (const int error) { + const char *str; switch (error) { case YPERR_SUCCESS: - return _("Success"); + str = "Success"; + break; case YPERR_BADARGS: - return _("Request arguments bad"); + str = "Request arguments bad"; + break; case YPERR_RPC: - return _("RPC failure on NIS operation"); + str = "RPC failure on NIS operation"; + break; case YPERR_DOMAIN: - return _("Can't bind to server which serves this domain"); + str = "Can't bind to server which serves this domain"; + break; case YPERR_MAP: - return _("No such map in server's domain"); + str = "No such map in server's domain"; + break; case YPERR_KEY: - return _("No such key in map"); + str = "No such key in map"; + break; case YPERR_YPERR: - return _("Internal NIS error"); + str = "Internal NIS error"; + break; case YPERR_RESRC: - return _("Local resource allocation failure"); + str = "Local resource allocation failure"; + break; case YPERR_NOMORE: - return _("No more records in map database"); + str = "No more records in map database"; + break; case YPERR_PMAP: - return _("Can't communicate with portmapper"); + str = "Can't communicate with portmapper"; + break; case YPERR_YPBIND: - return _("Can't communicate with ypbind"); + str = "Can't communicate with ypbind"; + break; case YPERR_YPSERV: - return _("Can't communicate with ypserv"); + str = "Can't communicate with ypserv"; + break; case YPERR_NODOM: - return _("Local domain name not set"); + str = "Local domain name not set"; + break; case YPERR_BADDB: - return _("NIS map database is bad"); + str = "NIS map database is bad"; + break; case YPERR_VERS: - return _("NIS client/server version mismatch - can't supply service"); + str = "NIS client/server version mismatch - can't supply service"; + break; case YPERR_ACCESS: - return _("Permission denied"); + str = "Permission denied"; + break; case YPERR_BUSY: - return _("Database is busy"); + str = "Database is busy"; + break; + default: + str = "Unknown NIS error code"; + break; } - return _("Unknown NIS error code"); + return _(str); } static const int8_t yp_2_yperr[] = @@ -854,19 +903,26 @@ libnsl_hidden_def (ypprot_err) const char * ypbinderr_string (const int error) { + const char *str; switch (error) { case 0: - return _("Success"); + str = "Success"; + break; case YPBIND_ERR_ERR: - return _("Internal ypbind error"); + str = "Internal ypbind error"; + break; case YPBIND_ERR_NOSERV: - return _("Domain not bound"); + str = "Domain not bound"; + break; case YPBIND_ERR_RESC: - return _("System resource allocation failure"); + str = "System resource allocation failure"; + break; default: - return _("Unknown ypbind error"); + str = "Unknown ypbind error"; + break; } + return _(str); } libnsl_hidden_def (ypbinderr_string) @@ -948,6 +1004,7 @@ again: { if (clnt->cl_auth->ah_cred.oa_flavor == AUTH_DES) { + auth_destroy (clnt->cl_auth); clnt->cl_auth = authunix_create_default (); goto again; } diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 1f9cbc7139..875fceaf33 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,51 @@ +2005-12-17 Ulrich Drepper + + * pthread_create.c (__pthread_create_2_1): Use + THREAD_COPY_POINTER_GUARD if available. + * sysdeps/i386/tcb-offsets.sym: Add POINTER_GUARD. + * sysdeps/x86_64/tcb-offsets.sym: Likewise. + * sysdeps/i386/tls.h (tcbhead_t): Add pointer_guard. + Define THREAD_SET_POINTER_GUARD and THREAD_COPY_POINTER_GUARD. + * sysdeps/x86_64/tls.h: Likewise. + +2005-12-15 Roland McGrath + + * sysdeps/unix/sysv/linux/mq_notify.c: Don't use sysdeps/generic. + +2005-12-13 Ulrich Drepper + + * sysdeps/pthread/sigfillset.c: Adjust for files moved out of + sysdeps/generic. + * errno-loc.c: New file. + +2005-12-12 Roland McGrath + + * init.c (__pthread_initialize_minimal_internal): Do __static_tls_size + adjustments before choosing stack size. Update minimum stack size + calculation to match allocate_stack change. + +2005-12-12 Ulrich Drepper + + * allocatestack.c (allocate_stack): Don't demand that there is an + additional full page available on the stack beside guard, TLS, the + minimum stack. + +2005-11-24 Ulrich Drepper + + * sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h + (__cleanup_fct_attribute): Use __regparm__ not regparm. + + * sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: When + compiling 32-bit code we must define __cleanup_fct_attribute. + +005-11-24 Jakub Jelinek + + [BZ #1920] + * sysdeps/pthread/pthread.h (__pthread_unwind_next): Use + __attribute__ instead of __attribute. + * sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h + (__cleanup_fct_attribute): Likewise. + 2005-11-17 Jakub Jelinek * sysdeps/pthread/unwind-forcedunwind.c (pthread_cancel_init): Put diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 255129a1df..e6bcc2170f 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -407,8 +407,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, /* Make sure the size of the stack is enough for the guard and eventually the thread descriptor. */ guardsize = (attr->guardsize + pagesize_m1) & ~pagesize_m1; - if (__builtin_expect (size < (guardsize + __static_tls_size - + MINIMAL_REST_STACK + pagesize_m1 + 1), + if (__builtin_expect (size < ((guardsize + __static_tls_size + + MINIMAL_REST_STACK + pagesize_m1) + & ~pagesize_m1), 0)) /* The stack is too small (or the guard too large). */ return EINVAL; diff --git a/nptl/errno-loc.c b/nptl/errno-loc.c new file mode 100644 index 0000000000..712b2b119c --- /dev/null +++ b/nptl/errno-loc.c @@ -0,0 +1 @@ +#include "../csu/errno-loc.c" diff --git a/nptl/init.c b/nptl/init.c index 6a7fff9959..1f79eba62a 100644 --- a/nptl/init.c +++ b/nptl/init.c @@ -289,6 +289,17 @@ __pthread_initialize_minimal_internal (void) (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask, NULL, _NSIG / 8); + /* Get the size of the static and alignment requirements for the TLS + block. */ + size_t static_tls_align; + _dl_get_tls_static_info (&__static_tls_size, &static_tls_align); + + /* Make sure the size takes all the alignments into account. */ + if (STACK_ALIGN > static_tls_align) + static_tls_align = STACK_ALIGN; + __static_tls_align_m1 = static_tls_align - 1; + + __static_tls_size = roundup (__static_tls_size, static_tls_align); /* Determine the default allowed stack size. This is the size used in case the user does not specify one. */ @@ -306,7 +317,7 @@ __pthread_initialize_minimal_internal (void) /* Make sure it meets the minimum size that allocate_stack (allocatestack.c) will demand, which depends on the page size. */ const uintptr_t pagesz = __sysconf (_SC_PAGESIZE); - const size_t minstack = pagesz * 2 + __static_tls_size + MINIMAL_REST_STACK; + const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK; if (limit.rlim_cur < minstack) limit.rlim_cur = minstack; @@ -314,18 +325,6 @@ __pthread_initialize_minimal_internal (void) limit.rlim_cur = (limit.rlim_cur + pagesz - 1) & -pagesz; __default_stacksize = limit.rlim_cur; - /* Get the size of the static and alignment requirements for the TLS - block. */ - size_t static_tls_align; - _dl_get_tls_static_info (&__static_tls_size, &static_tls_align); - - /* Make sure the size takes all the alignments into account. */ - if (STACK_ALIGN > static_tls_align) - static_tls_align = STACK_ALIGN; - __static_tls_align_m1 = static_tls_align - 1; - - __static_tls_size = roundup (__static_tls_size, static_tls_align); - #ifdef SHARED /* Transfer the old value from the dynamic linker's internal location. */ *__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) (); diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index f2f206be5a..c11d972572 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -415,6 +415,11 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg) THREAD_COPY_STACK_GUARD (pd); #endif + /* Copy the pointer guard value. */ +#ifdef THREAD_COPY_POINTER_GUARD + THREAD_COPY_POINTER_GUARD (pd); +#endif + /* Determine scheduling parameters for the thread. */ if (attr != NULL && __builtin_expect ((iattr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0, 0) diff --git a/nptl/sysdeps/i386/tcb-offsets.sym b/nptl/sysdeps/i386/tcb-offsets.sym index 4e0444ba38..7c8d9a5ca5 100644 --- a/nptl/sysdeps/i386/tcb-offsets.sym +++ b/nptl/sysdeps/i386/tcb-offsets.sym @@ -11,3 +11,4 @@ SYSINFO_OFFSET offsetof (tcbhead_t, sysinfo) CLEANUP offsetof (struct pthread, cleanup) CLEANUP_PREV offsetof (struct _pthread_cleanup_buffer, __prev) MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock) +POINTER_GUARD offsetof (tcbhead_t, pointer_guard) diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h index 65566ff7a7..a870a848cf 100644 --- a/nptl/sysdeps/i386/tls.h +++ b/nptl/sysdeps/i386/tls.h @@ -50,6 +50,7 @@ typedef struct int multiple_threads; uintptr_t sysinfo; uintptr_t stack_guard; + uintptr_t pointer_guard; } tcbhead_t; # define TLS_MULTIPLE_THREADS_IN_TCB 1 @@ -425,6 +426,14 @@ union user_desc_init = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) +/* Set the pointer guard field in the TCB head. */ +#define THREAD_SET_POINTER_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.pointer_guard, value) +#define THREAD_COPY_POINTER_GUARD(descr) \ + ((descr)->header.pointer_guard \ + = THREAD_GETMEM (THREAD_SELF, header.pointer_guard)) + + #endif /* __ASSEMBLER__ */ #endif /* tls.h */ diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h index 92e66f7c72..badadae169 100644 --- a/nptl/sysdeps/pthread/pthread.h +++ b/nptl/sysdeps/pthread/pthread.h @@ -657,9 +657,9 @@ extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf) /* Internal interface to initiate cleanup. */ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) - __cleanup_fct_attribute __attribute ((__noreturn__)) + __cleanup_fct_attribute __attribute__ ((__noreturn__)) # ifndef SHARED - __attribute ((__weak__)) + __attribute__ ((__weak__)) # endif ; #endif diff --git a/nptl/sysdeps/pthread/sigfillset.c b/nptl/sysdeps/pthread/sigfillset.c index fe58ccd53e..180607c77b 100644 --- a/nptl/sysdeps/pthread/sigfillset.c +++ b/nptl/sysdeps/pthread/sigfillset.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,4 +18,4 @@ #include -#include +#include diff --git a/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h index 4d1c9450b5..ddb3574aaa 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -155,6 +155,6 @@ typedef union /* Extra attributes for the cleanup functions. */ -#define __cleanup_fct_attribute __attribute ((regparm (1))) +#define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) #endif /* bits/pthreadtypes.h */ diff --git a/nptl/sysdeps/unix/sysv/linux/mq_notify.c b/nptl/sysdeps/unix/sysv/linux/mq_notify.c index e9c2b6e79a..2ec11bf686 100644 --- a/nptl/sysdeps/unix/sysv/linux/mq_notify.c +++ b/nptl/sysdeps/unix/sysv/linux/mq_notify.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contribute by Ulrich Drepper , 2004. @@ -283,5 +283,5 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification) } #else -# include +# include #endif diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h index 92fb08c951..7f1ace693c 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -192,4 +192,9 @@ typedef union #endif +#if __WORDSIZE == 32 +/* Extra attributes for the cleanup functions. */ +# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) +#endif + #endif /* bits/pthreadtypes.h */ diff --git a/nptl/sysdeps/x86_64/tcb-offsets.sym b/nptl/sysdeps/x86_64/tcb-offsets.sym index 8118d2df8b..a9ede75c96 100644 --- a/nptl/sysdeps/x86_64/tcb-offsets.sym +++ b/nptl/sysdeps/x86_64/tcb-offsets.sym @@ -10,3 +10,4 @@ CLEANUP offsetof (struct pthread, cleanup) CLEANUP_PREV offsetof (struct _pthread_cleanup_buffer, __prev) MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock) MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) +POINTER_GUARD offsetof (tcbhead_t, pointer_guard) diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h index 516827b8e1..13cf6fb3f5 100644 --- a/nptl/sysdeps/x86_64/tls.h +++ b/nptl/sysdeps/x86_64/tls.h @@ -49,6 +49,7 @@ typedef struct int multiple_threads; uintptr_t sysinfo; uintptr_t stack_guard; + uintptr_t pointer_guard; } tcbhead_t; #else /* __ASSEMBLER__ */ @@ -329,6 +330,15 @@ typedef struct ((descr)->header.stack_guard \ = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) + +/* Set the pointer guard field in the TCB head. */ +#define THREAD_SET_POINTER_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.pointer_guard, value) +#define THREAD_COPY_POINTER_GUARD(descr) \ + ((descr)->header.pointer_guard \ + = THREAD_GETMEM (THREAD_SELF, header.pointer_guard)) + + #endif /* __ASSEMBLER__ */ #endif /* tls.h */ diff --git a/nscd/Makefile b/nscd/Makefile index b7d5f3400b..e91c289a4f 100644 --- a/nscd/Makefile +++ b/nscd/Makefile @@ -36,13 +36,12 @@ nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \ ifeq ($(have-thread-library),yes) -others := nscd_nischeck ifneq (yesyes,$(have-fpie)$(build-shared)) others += nscd endif -install-sbin := nscd nscd_nischeck +install-sbin := nscd -extra-objs := $(nscd-modules:=.o) nscd_nischeck.o +extra-objs := $(nscd-modules:=.o) endif @@ -73,8 +72,7 @@ $(objpfx)selinux.o: sysincludes = # nothing distribute := nscd.h nscd-client.h dbg_log.h \ $(addsuffix .c, $(filter-out xmalloc,$(all-nscd-modules))) \ - nscd_nischeck.c nscd.conf nscd.init nscd_proto.h \ - nscd-types.h + nscd.conf nscd.init nscd_proto.h nscd-types.h include ../Rules @@ -137,14 +135,11 @@ lib := nonlib include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o) -$(objpfx)nscd_nischeck: $(objpfx)nscd_nischeck.o ifeq ($(build-shared),yes) $(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library) \ $(common-objpfx)nis/libnsl.so -$(objpfx)nscd_nischeck: $(common-objpfx)nis/libnsl.so else $(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) \ $(common-objpfx)nis/libnsl.a -$(objpfx)nscd_nischeck: $(common-objpfx)nis/libnsl.a endif diff --git a/nscd/aicache.c b/nscd/aicache.c index 9b8a4e50f2..6f24daabec 100644 --- a/nscd/aicache.c +++ b/nscd/aicache.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include @@ -26,9 +24,6 @@ #include #include #include -#ifdef HAVE_SENDFILE -# include -#endif #include "dbg_log.h" #include "nscd.h" @@ -382,9 +377,10 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req, <= (sizeof (struct database_pers_head) + db->head->module * sizeof (ref_t) + db->head->data_size)); - off_t off = (char *) &dataset->resp - (char *) db->head; ssize_t written; - written = sendfile (fd, db->wr_fd, &off, total); + written = sendfileall (fd, db->wr_fd, + (char *) &dataset->resp + - (char *) db->head, total); # ifndef __ASSUME_SENDFILE if (written == -1 && errno == ENOSYS) goto use_write; diff --git a/nscd/cache.c b/nscd/cache.c index a3f669bf8c..787f8b46f5 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/nscd/connections.c b/nscd/connections.c index f055642dcc..632635845b 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include @@ -204,6 +202,26 @@ writeall (int fd, const void *buf, size_t len) } +#ifdef HAVE_SENDFILE +ssize_t +sendfileall (int tofd, int fromfd, off_t off, size_t len) +{ + ssize_t n = len; + ssize_t ret; + + do + { + ret = TEMP_FAILURE_RETRY (sendfile (tofd, fromfd, &off, n)); + if (ret <= 0) + break; + n -= ret; + } + while (n > 0); + return ret < 0 ? ret : len - n; +} +#endif + + enum usekey { use_not = 0, @@ -957,8 +975,9 @@ cannot handle old request version %d; current version is %d"), <= (sizeof (struct database_pers_head) + db->head->module * sizeof (ref_t) + db->head->data_size)); - off_t off = (char *) cached->data - (char *) db->head; - nwritten = sendfile (fd, db->wr_fd, &off, cached->recsize); + nwritten = sendfileall (fd, db->wr_fd, + (char *) cached->data + - (char *) db->head, cached->recsize); # ifndef __ASSUME_SENDFILE if (nwritten == -1 && errno == ENOSYS) goto use_write; diff --git a/nscd/dbg_log.c b/nscd/dbg_log.c index 4b8843037b..d64afc7e8d 100644 --- a/nscd/dbg_log.c +++ b/nscd/dbg_log.c @@ -1,21 +1,19 @@ -/* Copyright (c) 1998, 2000, 2004 Free Software Foundation, Inc. +/* Copyright (c) 1998, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/nscd/gai.c b/nscd/gai.c index 722c7e415d..18fc62e7a0 100644 --- a/nscd/gai.c +++ b/nscd/gai.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2004. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that 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 General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + /* This file uses the getaddrinfo code but it compiles it without NSCD support. We just need a few symbol renames. */ #define __getservbyname_r getservbyname_r diff --git a/nscd/getgrgid_r.c b/nscd/getgrgid_r.c index d46fb0fcac..037509d8aa 100644 --- a/nscd/getgrgid_r.c +++ b/nscd/getgrgid_r.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/nscd/getgrnam_r.c b/nscd/getgrnam_r.c index 42daa16177..8fc74dcbaf 100644 --- a/nscd/getgrnam_r.c +++ b/nscd/getgrnam_r.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/nscd/gethstbyad_r.c b/nscd/gethstbyad_r.c index 47ed3e22e7..4c02492101 100644 --- a/nscd/gethstbyad_r.c +++ b/nscd/gethstbyad_r.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/nscd/gethstbynm2_r.c b/nscd/gethstbynm2_r.c index b0cc713a84..416b5ceafa 100644 --- a/nscd/gethstbynm2_r.c +++ b/nscd/gethstbynm2_r.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/nscd/getpwnam_r.c b/nscd/getpwnam_r.c index df73b99e4a..c92209a0cf 100644 --- a/nscd/getpwnam_r.c +++ b/nscd/getpwnam_r.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/nscd/getpwuid_r.c b/nscd/getpwuid_r.c index 015a521bbe..f68951511e 100644 --- a/nscd/getpwuid_r.c +++ b/nscd/getpwuid_r.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/nscd/grpcache.c b/nscd/grpcache.c index fb043152c6..d38a92809e 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include @@ -32,9 +30,6 @@ #include #include #include -#ifdef HAVE_SENDFILE -# include -#endif #include #include @@ -310,8 +305,9 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, <= (sizeof (struct database_pers_head) + db->head->module * sizeof (ref_t) + db->head->data_size)); - off_t off = (char *) &dataset->resp - (char *) db->head; - written = sendfile (fd, db->wr_fd, &off, total); + written = sendfileall (fd, db->wr_fd, + (char *) &dataset->resp + - (char *) db->head, total); # ifndef __ASSUME_SENDFILE if (written == -1 && errno == ENOSYS) goto use_write; diff --git a/nscd/hstcache.c b/nscd/hstcache.c index 29f14af66b..a7d981ad31 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include @@ -34,9 +32,6 @@ #include #include #include -#ifdef HAVE_SENDFILE -# include -#endif #include #include "nscd.h" @@ -344,8 +339,9 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, <= (sizeof (struct database_pers_head) + db->head->module * sizeof (ref_t) + db->head->data_size)); - off_t off = (char *) &dataset->resp - (char *) db->head; - written = sendfile (fd, db->wr_fd, &off, total); + written = sendfileall (fd, db->wr_fd, + (char *) &dataset->resp + - (char *) db->head, total); # ifndef __ASSUME_SENDFILE if (written == -1 && errno == ENOSYS) goto use_write; diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c index eb03fc7a5d..423dbbe4d3 100644 --- a/nscd/initgrcache.c +++ b/nscd/initgrcache.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include @@ -26,9 +24,6 @@ #include #include #include -#ifdef HAVE_SENDFILE -# include -#endif #include "dbg_log.h" #include "nscd.h" @@ -361,8 +356,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, <= (sizeof (struct database_pers_head) + db->head->module * sizeof (ref_t) + db->head->data_size)); - off_t off = (char *) &dataset->resp - (char *) db->head; - written = sendfile (fd, db->wr_fd, &off, total); + written = sendfileall (fd, db->wr_fd, + (char *) &dataset->resp + - (char *) db->head, total); # ifndef __ASSUME_SENDFILE if (written == -1 && errno == ENOSYS) goto use_write; diff --git a/nscd/mem.c b/nscd/mem.c index 96f0170c6c..a41c0bdb07 100644 --- a/nscd/mem.c +++ b/nscd/mem.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h index 1389f2da19..98c167eb62 100644 --- a/nscd/nscd-client.h +++ b/nscd/nscd-client.h @@ -319,5 +319,7 @@ extern ssize_t __readvall (int fd, const struct iovec *iov, int iovcnt) attribute_hidden; extern ssize_t writeall (int fd, const void *buf, size_t len) attribute_hidden; +extern ssize_t sendfileall (int tofd, int fromfd, off_t off, size_t len) + attribute_hidden; #endif /* nscd.h */ diff --git a/nscd/nscd.c b/nscd/nscd.c index 8f299a3aa4..3c65e20a60 100644 --- a/nscd/nscd.c +++ b/nscd/nscd.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* nscd - Name Service Cache Daemon. Caches passwd, group, and hosts. */ diff --git a/nscd/nscd_conf.c b/nscd/nscd_conf.c index 1039250f48..579ddd402f 100644 --- a/nscd/nscd_conf.c +++ b/nscd/nscd_conf.c @@ -2,20 +2,18 @@ This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index 65e78a1174..827d3a97ab 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -230,9 +230,9 @@ get_mapping (request_type type, const char *key, if (wait_on_socket (sock) <= 0) goto out_close2; -#ifndef MSG_NOSIGNAL -# define MSG_NOSIGNAL 0 -#endif +# ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL 0 +# endif if (__builtin_expect (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, MSG_NOSIGNAL)) != keylen, 0)) diff --git a/nscd/nscd_nischeck.c b/nscd/nscd_nischeck.c deleted file mode 100644 index 20f7bb0620..0000000000 --- a/nscd/nscd_nischeck.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 1999, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Thorsten Kukuk , 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. */ - -/* nscd_nischeck: Check, if everybody has read permissions for NIS+ table. - Return value: - 0: Everybody can read the NIS+ table - 1: Only authenticated users could read the NIS+ table */ - -#include -#include -#include -#include -#include -#include - -/* Get libc version number. */ -#include - -#define PACKAGE _libc_intl_domainname - -/* Name and version of program. */ -static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; - -/* Data structure to communicate with argp functions. */ -static struct argp argp = -{ - NULL, NULL, NULL, NULL, -}; - -int -main (int argc, char **argv) -{ - int remaining; - nis_result *res; - char *tablename, *cp; - - /* Set locale via LC_ALL. */ - setlocale (LC_ALL, ""); - /* Set the text message domain. */ - textdomain (PACKAGE); - - /* Parse and process arguments. */ - argp_parse (&argp, argc, argv, 0, &remaining, NULL); - - if (remaining + 1 != argc) - { - error (0, 0, gettext ("wrong number of arguments")); - argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name); - exit (EXIT_FAILURE); - } - - tablename = alloca (strlen (argv[1]) + 10); - cp = stpcpy (tablename, argv[1]); - strcpy (cp, ".org_dir"); - - res = nis_lookup (tablename, EXPAND_NAME|FOLLOW_LINKS); - - if (res == NULL || - (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)) - return 0; - - if (NIS_NOBODY(NIS_RES_OBJECT(res)->zo_access, NIS_READ_ACC)) - return 0; - else - return 1; -} - -/* Print the version information. */ -static void -print_version (FILE *stream, struct argp_state *state) -{ - fprintf (stream, "nscd_nischeck (GNU %s) %s\n", PACKAGE, VERSION); - fprintf (stream, gettext ("\ -Copyright (C) %s Free Software Foundation, Inc.\n\ -This is free software; see the source for copying conditions. There is NO\n\ -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2005"); - fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk"); -} diff --git a/nscd/nscd_setup_thread.c b/nscd/nscd_setup_thread.c new file mode 100644 index 0000000000..32bfe07000 --- /dev/null +++ b/nscd/nscd_setup_thread.c @@ -0,0 +1,26 @@ +/* Setup of nscd worker threads. Stub verison. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2004. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that 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 General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include + + +void +setup_thread (struct database_dyn *db) +{ + /* Nothing. */ +} diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c index 6f4b032d10..529c707de8 100644 --- a/nscd/pwdcache.c +++ b/nscd/pwdcache.c @@ -3,20 +3,18 @@ This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include @@ -32,9 +30,6 @@ #include #include #include -#ifdef HAVE_SENDFILE -# include -#endif #include #include @@ -305,8 +300,9 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, <= (sizeof (struct database_pers_head) + db->head->module * sizeof (ref_t) + db->head->data_size)); - off_t off = (char *) &dataset->resp - (char *) db->head; - written = sendfile (fd, db->wr_fd, &off, total); + written = sendfileall (fd, db->wr_fd, + (char *) &dataset->resp + - (char *) db->head, total); # ifndef __ASSUME_SENDFILE if (written == -1 && errno == ENOSYS) goto use_write; diff --git a/nss/function.def b/nss/function.def index 59a06a2d31..505fb9307f 100644 --- a/nss/function.def +++ b/nss/function.def @@ -1,5 +1,5 @@ /* List of functions defined for static NSS in GNU C Library. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,6 +37,7 @@ DEFINE_GET (files, grnam) DEFINE_ENT (files, host) DEFINE_GETBY (files, host, addr) DEFINE_GETBY (files, host, name) +DEFINE_GETBY (files, host, name2) DEFINE_GET (files, hostton) DEFINE_GET (files, ntohost) DEFINE_GETBY (dns, host, addr) diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c index 45f3b8ac42..4b5d774fdd 100644 --- a/nss/nss_files/files-netgrp.c +++ b/nss/nss_files/files-netgrp.c @@ -153,7 +153,7 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result) } -int +enum nss_status _nss_files_endnetgrent (struct __netgrent *result) { /* Free allocated memory for data if some is present. */ diff --git a/posix/_exit.c b/posix/_exit.c new file mode 100644 index 0000000000..673667df30 --- /dev/null +++ b/posix/_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 +#include + +/* 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 diff --git a/posix/alarm.c b/posix/alarm.c new file mode 100644 index 0000000000..1f0cceb58e --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/environ.c b/posix/environ.c new file mode 100644 index 0000000000..a0ed0d80ea --- /dev/null +++ b/posix/environ.c @@ -0,0 +1,12 @@ +/* This file just defines the `__environ' variable (and alias `environ'). */ + +#include +#include + +/* 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/posix/execve.c b/posix/execve.c new file mode 100644 index 0000000000..2d756293ed --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/fexecve.c b/posix/fexecve.c new file mode 100644 index 0000000000..fceae9251a --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/fork.c b/posix/fork.c new file mode 100644 index 0000000000..c19fa656b3 --- /dev/null +++ b/posix/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 +#include + + +/* 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 diff --git a/posix/fpathconf.c b/posix/fpathconf.c new file mode 100644 index 0000000000..840460b04b --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/gai_strerror.c b/posix/gai_strerror.c new file mode 100644 index 0000000000..932c5910df --- /dev/null +++ b/posix/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 +#include + +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/posix/getaddrinfo.c b/posix/getaddrinfo.c new file mode 100644 index 0000000000..548c0b863e --- /dev/null +++ b/posix/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 +#include + +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 diff --git a/posix/getconf.c b/posix/getconf.c index da8e538ad3..57c1d6a5d6 100644 --- a/posix/getconf.c +++ b/posix/getconf.c @@ -1,20 +1,18 @@ /* Copyright (C) 1991, 92, 1995-2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/posix/getegid.c b/posix/getegid.c new file mode 100644 index 0000000000..d939d6ad64 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/geteuid.c b/posix/geteuid.c new file mode 100644 index 0000000000..c67dbfd708 --- /dev/null +++ b/posix/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 +#include + + +/* 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 diff --git a/posix/getgid.c b/posix/getgid.c new file mode 100644 index 0000000000..742c099fa2 --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/getgroups.c b/posix/getgroups.c new file mode 100644 index 0000000000..d5868cc1b8 --- /dev/null +++ b/posix/getgroups.c @@ -0,0 +1,48 @@ +/* Copyright (C) 1991,1992,1995,1996,1997,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + + +/* 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 (NGROUPS_MAX) && NGROUPS_MAX == 0) +stub_warning (getgroups); +#endif + +weak_alias (__getgroups, getgroups) +#include diff --git a/posix/getlogin.c b/posix/getlogin.c new file mode 100644 index 0000000000..12b4283396 --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/getlogin_r.c b/posix/getlogin_r.c new file mode 100644 index 0000000000..f2470ee032 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/getpgid.c b/posix/getpgid.c new file mode 100644 index 0000000000..ad46771d2f --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/getpgrp.c b/posix/getpgrp.c new file mode 100644 index 0000000000..85efc2f215 --- /dev/null +++ b/posix/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 +#include + +/* Get the process group ID of the calling process. */ +pid_t +getpgrp (void) +{ + return __getpgid (0); +} diff --git a/posix/getpid.c b/posix/getpid.c new file mode 100644 index 0000000000..c1c91fede7 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/getppid.c b/posix/getppid.c new file mode 100644 index 0000000000..e00c237496 --- /dev/null +++ b/posix/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 +#include + + +/* Get the parent process ID of the calling process. */ +int +__getppid () +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (getppid) + +weak_alias (__getppid, getppid) +#include diff --git a/posix/getresgid.c b/posix/getresgid.c new file mode 100644 index 0000000000..d6a9b52957 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/getresuid.c b/posix/getresuid.c new file mode 100644 index 0000000000..227d6b7ded --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/getsid.c b/posix/getsid.c new file mode 100644 index 0000000000..eb7e60fa42 --- /dev/null +++ b/posix/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 +#include +#include + +pid_t +getsid (pid_t pid) +{ + __set_errno (ENOSYS); + return (pid_t) -1; +} +libc_hidden_def (getsid) +stub_warning (getsid) +#include diff --git a/posix/getuid.c b/posix/getuid.c new file mode 100644 index 0000000000..c4ea7e8c98 --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/glob.c b/posix/glob.c new file mode 100644 index 0000000000..2e767304a7 --- /dev/null +++ b/posix/glob.c @@ -0,0 +1,1558 @@ +/* Copyright (C) 1991-2002,2003,2004,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along 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 +#endif + +/* Enable GNU extensions in glob.h. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include +#include +#include + +/* Outcomment the following line for production quality code. */ +/* #define NDEBUG 1 */ +#include + +#include /* 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 +# 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 +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +# ifndef POSIX +# ifdef _POSIX_VERSION +# define POSIX +# endif +# endif +#endif + +#if !defined _AMIGA && !defined VMS && !defined WINDOWS32 +# include +#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 +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# ifdef HAVE_SYS_NDIR_H +# include +# endif +# ifdef HAVE_SYS_DIR_H +# include +# endif +# ifdef HAVE_NDIR_H +# include +# endif +# ifdef HAVE_VMSDIR_H +# include "vmsdir.h" +# endif /* HAVE_VMSDIR_H */ +#endif + + +/* In GNU systems, 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 +# include +# define ANSI_STRING +#else /* No standard headers. */ + +extern char *getenv (); + +# ifdef HAVE_STRING_H +# include +# define ANSI_STRING +# else +# include +# endif +# ifdef HAVE_MEMORY_H +# include +# endif + +extern char *malloc (), *realloc (); +extern void free (); + +extern void qsort (); +extern void abort (), exit (); + +#endif /* Standard headers. */ + +/* NAME_MAX is usually defined in or . */ +#if defined HAVE_LIMITS_H || defined __GNU_LIBRARY__ +# include +#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 +# else /* Not HAVE_ALLOCA_H. */ +# ifndef _AIX +# ifdef WINDOWS32 +# include +# 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 +# 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 to take precedence. */ +#ifndef __GNU_LIBRARY__ +# undef FNM_PATHNAME +# undef FNM_NOESCAPE +# undef FNM_PERIOD +#endif +#include + +/* Some system header files erroneously define these. + We want our own definitions from 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 + +#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/posix/glob64.c b/posix/glob64.c new file mode 100644 index 0000000000..2bfab74074 --- /dev/null +++ b/posix/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 +#include +#include +#include + +/* 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 diff --git a/posix/group_member.c b/posix/group_member.c new file mode 100644 index 0000000000..7bd9c46ba2 --- /dev/null +++ b/posix/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 +#include +#include +#include + +#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/posix/init-posix.c b/posix/init-posix.c new file mode 100644 index 0000000000..0c2b717e6d --- /dev/null +++ b/posix/init-posix.c @@ -0,0 +1 @@ +/* Nothing to do. */ diff --git a/posix/nanosleep.c b/posix/nanosleep.c new file mode 100644 index 0000000000..7a2138b6f1 --- /dev/null +++ b/posix/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 +#include + + +/* 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 diff --git a/posix/pathconf.c b/posix/pathconf.c new file mode 100644 index 0000000000..6ac5d31902 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/pause.c b/posix/pause.c new file mode 100644 index 0000000000..2e34b436f1 --- /dev/null +++ b/posix/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 +#include + + +/* 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 diff --git a/posix/posix_madvise.c b/posix/posix_madvise.c new file mode 100644 index 0000000000..6f8d60f55f --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/pread.c b/posix/pread.c new file mode 100644 index 0000000000..5c79dd526d --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/pread64.c b/posix/pread64.c new file mode 100644 index 0000000000..68316579c6 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/pwrite.c b/posix/pwrite.c new file mode 100644 index 0000000000..ec35ecea9c --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/pwrite64.c b/posix/pwrite64.c new file mode 100644 index 0000000000..dd14aa0bd7 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/regex_internal.h b/posix/regex_internal.h index d1447a4d5e..3b575c3c48 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -42,6 +42,9 @@ #if defined HAVE_STDBOOL_H || defined _LIBC # include #endif /* HAVE_STDBOOL_H || _LIBC */ +#if defined HAVE_STDINT_H || defined _LIBC +# include +#endif /* HAVE_STDINT_H || _LIBC */ #if defined _LIBC # include #else @@ -83,6 +86,11 @@ # define gettext_noop(String) String #endif +/* For loser systems without the definition. */ +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + #if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) || _LIBC # define RE_ENABLE_I18N #endif diff --git a/posix/sched_getaffinity.c b/posix/sched_getaffinity.c new file mode 100644 index 0000000000..b2e452f879 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/sched_getp.c b/posix/sched_getp.c new file mode 100644 index 0000000000..1ca77893f4 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/sched_gets.c b/posix/sched_gets.c new file mode 100644 index 0000000000..479b913f32 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/sched_primax.c b/posix/sched_primax.c new file mode 100644 index 0000000000..4b3c1cbe67 --- /dev/null +++ b/posix/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 +#include + + +/* 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 diff --git a/posix/sched_primin.c b/posix/sched_primin.c new file mode 100644 index 0000000000..813b8f63ca --- /dev/null +++ b/posix/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 +#include + + +/* 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 diff --git a/posix/sched_rr_gi.c b/posix/sched_rr_gi.c new file mode 100644 index 0000000000..f8fec63617 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/sched_setaffinity.c b/posix/sched_setaffinity.c new file mode 100644 index 0000000000..652163db85 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/sched_setp.c b/posix/sched_setp.c new file mode 100644 index 0000000000..cc451fc131 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/sched_sets.c b/posix/sched_sets.c new file mode 100644 index 0000000000..631cac228b --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/sched_yield.c b/posix/sched_yield.c new file mode 100644 index 0000000000..ce41ce9b6f --- /dev/null +++ b/posix/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 +#include + + +/* Yield the processor. */ +int +__sched_yield (void) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (sched_yield) + +weak_alias (__sched_yield, sched_yield) +#include diff --git a/posix/setgid.c b/posix/setgid.c new file mode 100644 index 0000000000..05c2cc6621 --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/setlogin.c b/posix/setlogin.c new file mode 100644 index 0000000000..c16e29dd9e --- /dev/null +++ b/posix/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 +#include + +/* Set the login name returned by `getlogin'. */ +int +setlogin (name) + const char *name; +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (setlogin) +#include diff --git a/posix/setpgid.c b/posix/setpgid.c new file mode 100644 index 0000000000..cb2abf1159 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/setpgrp.c b/posix/setpgrp.c new file mode 100644 index 0000000000..8ceb159341 --- /dev/null +++ b/posix/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 + +int +setpgrp () +{ + return __setpgid (0, 0); +} diff --git a/posix/setresgid.c b/posix/setresgid.c new file mode 100644 index 0000000000..78e308c5d0 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/setresuid.c b/posix/setresuid.c new file mode 100644 index 0000000000..430b63b2fd --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/setsid.c b/posix/setsid.c new file mode 100644 index 0000000000..6a6712b9bd --- /dev/null +++ b/posix/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 +#include + + +/* 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 diff --git a/posix/setuid.c b/posix/setuid.c new file mode 100644 index 0000000000..96c3e01cb9 --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/sleep.c b/posix/sleep.c new file mode 100644 index 0000000000..f9d2a6593f --- /dev/null +++ b/posix/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 +#include +#include +#include + +/* 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 diff --git a/posix/spawni.c b/posix/spawni.c new file mode 100644 index 0000000000..c7d5f59ffc --- /dev/null +++ b/posix/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 +#include +#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 diff --git a/posix/sysconf.c b/posix/sysconf.c new file mode 100644 index 0000000000..f22685cb29 --- /dev/null +++ b/posix/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 +#include +#include +#include +#include +#include +#include +#include +#include + + +/* 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 diff --git a/posix/times.c b/posix/times.c new file mode 100644 index 0000000000..b4e08156ae --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/uname.c b/posix/uname.c new file mode 100644 index 0000000000..e7c41648ed --- /dev/null +++ b/posix/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 +#include +#include +#include + +/* This file is created by the configuration process, and defines UNAME_*. */ +#include + +/* 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/posix/unistd.h b/posix/unistd.h index 86e0e9e659..9684126eaa 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -742,6 +742,13 @@ extern int ttyslot (void) __THROW; extern int link (__const char *__from, __const char *__to) __THROW __nonnull ((1, 2)) __wur; +#ifdef __USE_GNU +/* Like link but relative paths in TO and FROM are interpreted relative + to FROMFD and TOFD respectively. */ +extern int linkat (int __fromfd, __const char *__from, int __tofd, + __const char *__to) __THROW __nonnull ((2, 4)) __wur; +#endif + #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K /* Make a symbolic link to FROM named TO. */ extern int symlink (__const char *__from, __const char *__to) @@ -754,6 +761,17 @@ extern int readlink (__const char *__restrict __path, char *__restrict __buf, size_t __len) __THROW __nonnull ((1, 2)) __wur; #endif /* Use BSD. */ +#ifdef __USE_GNU +/* Like symlink but a relative path in TO is interpreted relative to TOFD. */ +extern int symlinkat (__const char *__from, int __tofd, + __const char *__to) __THROW __nonnull ((1, 3)) __wur; + +/* Like readlink but a relative PATH is interpreted relative to FD. */ +extern int readlinkat (int __fd, __const char *__restrict __path, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((2, 3)) __wur; +#endif + /* Remove the link NAME. */ extern int unlink (__const char *__name) __THROW __nonnull ((1)); diff --git a/posix/vfork.c b/posix/vfork.c new file mode 100644 index 0000000000..d15841d712 --- /dev/null +++ b/posix/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 +#include + +/* 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/posix/wait.c b/posix/wait.c new file mode 100644 index 0000000000..b1c512ed39 --- /dev/null +++ b/posix/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 +#include + +/* 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 diff --git a/posix/wait3.c b/posix/wait3.c new file mode 100644 index 0000000000..479d99e3da --- /dev/null +++ b/posix/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 +#include +#include + +/* 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 diff --git a/posix/wait4.c b/posix/wait4.c new file mode 100644 index 0000000000..b59bf87ffc --- /dev/null +++ b/posix/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 +#include +#include + +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 diff --git a/posix/waitid.c b/posix/waitid.c new file mode 100644 index 0000000000..a9de1a19a5 --- /dev/null +++ b/posix/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 , 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 +#include +#include + +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/posix/waitpid.c b/posix/waitpid.c new file mode 100644 index 0000000000..9c7736e669 --- /dev/null +++ b/posix/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 +#include +#include + + +/* 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 diff --git a/posix/wordexp.c b/posix/wordexp.c new file mode 100644 index 0000000000..2eb58089c4 --- /dev/null +++ b/posix/wordexp.c @@ -0,0 +1,2457 @@ +/* POSIX.2 wordexp implementation. + Copyright (C) 1997-2002, 2003, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Tim Waugh . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef USE_IN_LIBIO +# include +#endif +#include + +#include +#include + +/* Undefine the following line for the production version. */ +/* #define NDEBUG 1 */ +#include + +/* Get some device information. */ +#include + +/* + * 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 inline void +internal_function __attribute__ ((always_inline)) +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]; +#define bufsize 128 + int buflen; + int i; + int status = 0; + size_t maxnewlines = 0; + char buffer[bufsize]; + pid_t pid; + int noexec = 0; + + /* Don't fork() unless necessary */ + if (!comm || !*comm) + return 0; + + if (__pipe (fildes)) + /* Bad */ + return WRDE_NOSPACE; + + again: + if ((pid = __fork ()) < 0) + { + /* Bad */ + if (fildes[0] != -1) + __close (fildes[0]); + if (fildes[1] != -1) + __close (fildes[1]); + return WRDE_NOSPACE; + } + + if (pid == 0) + exec_comm_child (comm, fildes, noexec ? 0 : flags & WRDE_SHOWERR, noexec); + + /* Parent */ + + /* If we are just testing the syntax, only wait. */ + if (noexec) + return (TEMP_FAILURE_RETRY (__waitpid (pid, &status, 0)) == pid + && status != 0) ? WRDE_SYNTAX : 0; + + __close (fildes[1]); + fildes[1] = -1; + + if (!pwordexp) + /* Quoted - no field splitting */ + { + while (1) + { + if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer, + bufsize))) < 1) + { + if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0) + continue; + if ((buflen = TEMP_FAILURE_RETRY (__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 = TEMP_FAILURE_RETRY (__read (fildes[0], buffer, + bufsize))) < 1) + { + if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0) + continue; + if ((buflen = TEMP_FAILURE_RETRY (__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: textmoretext + * + * 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]); + fildes[0] = -1; + + /* Check for syntax error (re-execute but with "-n" flag) */ + if (buflen < 1 && status != 0) + { + noexec = 1; + goto again; + } + + return 0; + +no_space: + __kill (pid, SIGKILL); + TEMP_FAILURE_RETRY (__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"); + + __fxprintf (NULL, "%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, + ¶m_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 . */ + 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/resolv/gai_sigqueue.c b/resolv/gai_sigqueue.c new file mode 100644 index 0000000000..2c91df6ddc --- /dev/null +++ b/resolv/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 +#include +#include + +#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 diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c index 3698e4b841..bab2535ceb 100644 --- a/resolv/gethnamaddr.c +++ b/resolv/gethnamaddr.c @@ -51,7 +51,6 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id$"; #endif /* LIBC_SCCS and not lint */ #include diff --git a/resolv/res-state.c b/resolv/res-state.c new file mode 100644 index 0000000000..e327e34f59 --- /dev/null +++ b/resolv/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 +#include + +#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/resource/getpriority.c b/resource/getpriority.c new file mode 100644 index 0000000000..501c92a08a --- /dev/null +++ b/resource/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 +#include + +/* Return the highest priority of any process specified by WHICH and WHO + (see ); 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 diff --git a/resource/getrlimit.c b/resource/getrlimit.c new file mode 100644 index 0000000000..d4bcadd762 --- /dev/null +++ b/resource/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 +#include +#include + +/* 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 diff --git a/resource/getrlimit64.c b/resource/getrlimit64.c new file mode 100644 index 0000000000..dcd67cf56f --- /dev/null +++ b/resource/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 +#include +#include + +/* 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/resource/getrusage.c b/resource/getrusage.c new file mode 100644 index 0000000000..c679855ace --- /dev/null +++ b/resource/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 +#include + +/* 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 diff --git a/resource/nice.c b/resource/nice.c new file mode 100644 index 0000000000..8561931af7 --- /dev/null +++ b/resource/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 +#include + +/* 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 diff --git a/resource/setpriority.c b/resource/setpriority.c new file mode 100644 index 0000000000..b2e6f8a059 --- /dev/null +++ b/resource/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 +#include + +/* 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 diff --git a/resource/setrlimit.c b/resource/setrlimit.c new file mode 100644 index 0000000000..c8f6e03ad3 --- /dev/null +++ b/resource/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 +#include +#include + +/* 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 diff --git a/resource/setrlimit64.c b/resource/setrlimit64.c new file mode 100644 index 0000000000..d4b4bfce0a --- /dev/null +++ b/resource/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 +#include +#include + +/* 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/resource/ulimit.c b/resource/ulimit.c new file mode 100644 index 0000000000..cc74054456 --- /dev/null +++ b/resource/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 +#include + +/* 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 diff --git a/resource/vlimit.c b/resource/vlimit.c new file mode 100644 index 0000000000..03d89f4ad5 --- /dev/null +++ b/resource/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 +#include +#include + +/* 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/resource/vtimes.c b/resource/vtimes.c new file mode 100644 index 0000000000..37dc01b2fb --- /dev/null +++ b/resource/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 +#include +#include + +/* 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/rt/aio_cancel.c b/rt/aio_cancel.c new file mode 100644 index 0000000000..c24a2f7529 --- /dev/null +++ b/rt/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 +/* And undo the hack. */ +#undef aio_cancel64 + +#include + +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 diff --git a/rt/aio_fsync.c b/rt/aio_fsync.c new file mode 100644 index 0000000000..bc23d75f69 --- /dev/null +++ b/rt/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 +/* And undo the hack. */ +#undef aio_fsync64 + +#include +#include + +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 diff --git a/rt/aio_misc.c b/rt/aio_misc.c new file mode 100644 index 0000000000..c29b8d0eae --- /dev/null +++ b/rt/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 +#include + +/* 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/rt/aio_notify.c b/rt/aio_notify.c new file mode 100644 index 0000000000..2c79ee6c2f --- /dev/null +++ b/rt/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 +#include + +/* This file contains only internal functions used by + the particular aio_* implementation code. */ diff --git a/rt/aio_read.c b/rt/aio_read.c new file mode 100644 index 0000000000..db1d19f3d7 --- /dev/null +++ b/rt/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 +#include + +#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 diff --git a/rt/aio_read64.c b/rt/aio_read64.c new file mode 100644 index 0000000000..c1292352af --- /dev/null +++ b/rt/aio_read64.c @@ -0,0 +1,2 @@ +#define BE_AIO64 +#include "aio_read.c" diff --git a/rt/aio_sigqueue.c b/rt/aio_sigqueue.c new file mode 100644 index 0000000000..e824c6b3de --- /dev/null +++ b/rt/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 +#include +#include + +#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 diff --git a/rt/aio_suspend.c b/rt/aio_suspend.c new file mode 100644 index 0000000000..0530f0019c --- /dev/null +++ b/rt/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 +/* And undo the hack. */ +#undef aio_suspend64 + +#include +#include + + +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 diff --git a/rt/aio_write.c b/rt/aio_write.c new file mode 100644 index 0000000000..bc62fcb469 --- /dev/null +++ b/rt/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 +#include + +#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 diff --git a/rt/aio_write64.c b/rt/aio_write64.c new file mode 100644 index 0000000000..bb1693eeee --- /dev/null +++ b/rt/aio_write64.c @@ -0,0 +1,2 @@ +#define BE_AIO64 +#include "aio_write.c" diff --git a/rt/clock_getcpuclockid.c b/rt/clock_getcpuclockid.c new file mode 100644 index 0000000000..39c7e55f66 --- /dev/null +++ b/rt/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 +#include +#include + +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/rt/clock_getres.c b/rt/clock_getres.c new file mode 100644 index 0000000000..f5978da380 --- /dev/null +++ b/rt/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 +#include + +/* Get resolution of clock. */ +int +clock_getres (clockid_t clock_id, struct timespec *res) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (clock_getres) +#include diff --git a/rt/clock_gettime.c b/rt/clock_gettime.c new file mode 100644 index 0000000000..ff306120ba --- /dev/null +++ b/rt/clock_gettime.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1999, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +/* 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; +} +librt_hidden_def (clock_gettime) +stub_warning (clock_gettime) +#include diff --git a/rt/clock_nanosleep.c b/rt/clock_nanosleep.c new file mode 100644 index 0000000000..cff1c2570a --- /dev/null +++ b/rt/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 +#include + + +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 diff --git a/rt/clock_settime.c b/rt/clock_settime.c new file mode 100644 index 0000000000..9d6a92e058 --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/get_clockfreq.c b/rt/get_clockfreq.c new file mode 100644 index 0000000000..14375ec186 --- /dev/null +++ b/rt/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 + +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/rt/lio_listio.c b/rt/lio_listio.c new file mode 100644 index 0000000000..d535594492 --- /dev/null +++ b/rt/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 +#include + +#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 diff --git a/rt/lio_listio64.c b/rt/lio_listio64.c new file mode 100644 index 0000000000..35a571c685 --- /dev/null +++ b/rt/lio_listio64.c @@ -0,0 +1,2 @@ +#define BE_AIO64 +#include diff --git a/rt/mq_close.c b/rt/mq_close.c new file mode 100644 index 0000000000..8237a6438e --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_getattr.c b/rt/mq_getattr.c new file mode 100644 index 0000000000..2d24b85d47 --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_notify.c b/rt/mq_notify.c new file mode 100644 index 0000000000..29de75a471 --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_open.c b/rt/mq_open.c new file mode 100644 index 0000000000..dea5741d5a --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_receive.c b/rt/mq_receive.c new file mode 100644 index 0000000000..527fd75963 --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_send.c b/rt/mq_send.c new file mode 100644 index 0000000000..8b7cd87f7f --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_setattr.c b/rt/mq_setattr.c new file mode 100644 index 0000000000..57ee0759ab --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_timedreceive.c b/rt/mq_timedreceive.c new file mode 100644 index 0000000000..e4723f812a --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_timedsend.c b/rt/mq_timedsend.c new file mode 100644 index 0000000000..5ccfe23b0a --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/mq_unlink.c b/rt/mq_unlink.c new file mode 100644 index 0000000000..e947b84f3b --- /dev/null +++ b/rt/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 +#include + +/* Remove message queue named NAME. */ +int +mq_unlink (const char *name) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (mq_unlink) +#include diff --git a/rt/shm_open.c b/rt/shm_open.c new file mode 100644 index 0000000000..6a53903a75 --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/shm_unlink.c b/rt/shm_unlink.c new file mode 100644 index 0000000000..28478b895b --- /dev/null +++ b/rt/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 +#include + +/* Remove shared memory object. */ +int +shm_unlink (const char *name) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (shm_unlink) + +#include diff --git a/rt/timer_create.c b/rt/timer_create.c new file mode 100644 index 0000000000..0e3a6b0acc --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/timer_delete.c b/rt/timer_delete.c new file mode 100644 index 0000000000..4be55aa322 --- /dev/null +++ b/rt/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 +#include + +/* Delete timer TIMERID. */ +int +timer_delete (timer_t timerid) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (timer_delete) +#include diff --git a/rt/timer_getoverr.c b/rt/timer_getoverr.c new file mode 100644 index 0000000000..6ca7ff8e9e --- /dev/null +++ b/rt/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 +#include + +/* Get expiration overrun for timer TIMERID. */ +int +timer_getoverrun (timer_t timerid) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (timer_getoverrun) +#include diff --git a/rt/timer_gettime.c b/rt/timer_gettime.c new file mode 100644 index 0000000000..728028ed3e --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/timer_settime.c b/rt/timer_settime.c new file mode 100644 index 0000000000..f494a0edd1 --- /dev/null +++ b/rt/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 +#include + +/* 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 diff --git a/rt/tst-timer.c b/rt/tst-timer.c new file mode 100644 index 0000000000..d9b69a2467 --- /dev/null +++ b/rt/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 + +/* 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/scripts/check-c++-types.sh b/scripts/check-c++-types.sh index 1992705e0f..f0ea0b5a84 100755 --- a/scripts/check-c++-types.sh +++ b/scripts/check-c++-types.sh @@ -1,5 +1,5 @@ #! /bin/bash -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -28,7 +28,7 @@ # egrep '^typedef.*;$' | # sed 's/^typedef[[:space:]]*//;s/\([[:space:]]\{1,\}__attribute__.*\);/;/;s/.*[[:space:]]\([*]\|\)\(.*\);/\2/' | # egrep -v '^_' | -# sort -u +# LC_ALL=C sort -u # data=$1 shift diff --git a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh new file mode 100755 index 0000000000..88c85f7106 --- /dev/null +++ b/scripts/check-local-headers.sh @@ -0,0 +1,38 @@ +#! /bin/bash +# Copyright (C) 2005 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. +# +includedir="$1" +objpfx="$2" + +# To avoid long paths. +cd "$objpfx" + + +# Search all dependency files for file names in the include directory. +# There are a few system headers we are known to use. +if fgrep "$includedir" */*.d | +fgrep -v "$includedir/asm" | +fgrep -v "$includedir/linux" | +fgrep -v "$includedir/selinux" | +fgrep -v "$includedir/gd"; then + # If we found a match something is wrong. + exit 1 +fi + +exit 0 diff --git a/scripts/mkinstalldirs b/scripts/mkinstalldirs index d0fd194fd6..f945dbf2bc 100755 --- a/scripts/mkinstalldirs +++ b/scripts/mkinstalldirs @@ -4,8 +4,6 @@ # Created: 1993-05-16 # Public domain -# $Id$ - errstatus=0 for file diff --git a/setjmp/__longjmp.c b/setjmp/__longjmp.c new file mode 100644 index 0000000000..8a61ff6770 --- /dev/null +++ b/setjmp/__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 +#include + + +/* 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 diff --git a/setjmp/bsd-_setjmp.c b/setjmp/bsd-_setjmp.c new file mode 100644 index 0000000000..884a4da9b6 --- /dev/null +++ b/setjmp/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 +#include + +#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/setjmp/bsd-setjmp.c b/setjmp/bsd-setjmp.c new file mode 100644 index 0000000000..15f3f153cc --- /dev/null +++ b/setjmp/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 +#include + +#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/setjmp/jmp-unwind.c b/setjmp/jmp-unwind.c new file mode 100644 index 0000000000..d2f76c62e7 --- /dev/null +++ b/setjmp/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 + +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/setjmp/longjmp.c b/setjmp/longjmp.c new file mode 100644 index 0000000000..9b1bda1caa --- /dev/null +++ b/setjmp/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 +#include +#include + + +/* 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/setjmp/setjmp.c b/setjmp/setjmp.c new file mode 100644 index 0000000000..0676ff1396 --- /dev/null +++ b/setjmp/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 +#include + + +/* 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 diff --git a/setjmp/sigjmp.c b/setjmp/sigjmp.c new file mode 100644 index 0000000000..b23c547f5e --- /dev/null +++ b/setjmp/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 +#include +#include + +/* 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/signal/allocrtsig.c b/signal/allocrtsig.c new file mode 100644 index 0000000000..ac8d2b6bfe --- /dev/null +++ b/signal/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 , 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 + +/* 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 + +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/signal/kill.c b/signal/kill.c new file mode 100644 index 0000000000..1d81e45dde --- /dev/null +++ b/signal/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 +#include + + +/* 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 diff --git a/signal/killpg.c b/signal/killpg.c new file mode 100644 index 0000000000..ad9258dffc --- /dev/null +++ b/signal/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 +#include + + +/* 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 diff --git a/signal/raise.c b/signal/raise.c new file mode 100644 index 0000000000..c5a449f7bc --- /dev/null +++ b/signal/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 +#include + +/* 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 diff --git a/signal/sigaction.c b/signal/sigaction.c new file mode 100644 index 0000000000..bf0a15bacb --- /dev/null +++ b/signal/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 +#include + + +/* 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 diff --git a/signal/sigaltstack.c b/signal/sigaltstack.c new file mode 100644 index 0000000000..17c7e06b35 --- /dev/null +++ b/signal/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 +#include + +/* 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 diff --git a/signal/sigblock.c b/signal/sigblock.c new file mode 100644 index 0000000000..81a4ff1447 --- /dev/null +++ b/signal/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 +#include + +/* 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 diff --git a/signal/sigfillset.c b/signal/sigfillset.c new file mode 100644 index 0000000000..95d52cf0c0 --- /dev/null +++ b/signal/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 +#include +#include + +/* 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/signal/sigignore.c b/signal/sigignore.c new file mode 100644 index 0000000000..734422dd81 --- /dev/null +++ b/signal/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 +#include + + +/* Set the disposition for SIG to SIG_IGN. */ +int +sigignore (sig) + int sig; +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (sigignore) +#include diff --git a/signal/sigintr.c b/signal/sigintr.c new file mode 100644 index 0000000000..9d4c2c8f58 --- /dev/null +++ b/signal/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 +#include + +/* 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 diff --git a/signal/signal.c b/signal/signal.c new file mode 100644 index 0000000000..6c1808bb15 --- /dev/null +++ b/signal/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 +#include + + +/* 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 diff --git a/signal/sigpause.c b/signal/sigpause.c new file mode 100644 index 0000000000..bc598d070c --- /dev/null +++ b/signal/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 +#include +#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 + + +int +__attribute ((weak)) +__xpg___sigpause (int sig) +{ + __set_errno (ENOSYS); + return -1; +} diff --git a/signal/sigpending.c b/signal/sigpending.c new file mode 100644 index 0000000000..80e16e588c --- /dev/null +++ b/signal/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 +#include +#include + + +/* 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 diff --git a/signal/sigprocmask.c b/signal/sigprocmask.c new file mode 100644 index 0000000000..472b3a4fa5 --- /dev/null +++ b/signal/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 +#include + + +/* 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/signal/sigqueue.c b/signal/sigqueue.c new file mode 100644 index 0000000000..c6e77c0a27 --- /dev/null +++ b/signal/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 +#include +#include + +int +__sigqueue (pid_t pid, int sig, const union sigval val) +{ + __set_errno (ENOSYS); + return -1; +} +weak_alias (__sigqueue, sigqueue) + +stub_warning (sigqueue) +#include diff --git a/signal/sigreturn.c b/signal/sigreturn.c new file mode 100644 index 0000000000..0239b0a98c --- /dev/null +++ b/signal/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 +#include + +int +__sigreturn (context) + struct sigcontext *context; +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (sigreturn) + +weak_alias (__sigreturn, sigreturn) +#include diff --git a/signal/sigset.c b/signal/sigset.c new file mode 100644 index 0000000000..191a909158 --- /dev/null +++ b/signal/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 +#include + + +/* Set the disposition for SIG. */ +__sighandler_t +sigset (sig, disp) + int sig; + __sighandler_t disp; +{ + __set_errno (ENOSYS); + return -1; +} + +stub_warning (sigset) +#include diff --git a/signal/sigsetmask.c b/signal/sigsetmask.c new file mode 100644 index 0000000000..602c0add40 --- /dev/null +++ b/signal/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 +#include + +int +__sigsetmask (mask) + int mask; +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (sigsetmask) + +weak_alias (__sigsetmask, sigsetmask) +#include diff --git a/signal/sigstack.c b/signal/sigstack.c new file mode 100644 index 0000000000..ca9c8018a4 --- /dev/null +++ b/signal/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 +#include + +/* 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 diff --git a/signal/sigsuspend.c b/signal/sigsuspend.c new file mode 100644 index 0000000000..58452e334c --- /dev/null +++ b/signal/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 +#include + + +/* 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 diff --git a/signal/sigtimedwait.c b/signal/sigtimedwait.c new file mode 100644 index 0000000000..7b114a3133 --- /dev/null +++ b/signal/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 +#include + +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 diff --git a/signal/sigvec.c b/signal/sigvec.c new file mode 100644 index 0000000000..148e9a0d85 --- /dev/null +++ b/signal/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 +#include + +/* 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 diff --git a/signal/sigwait.c b/signal/sigwait.c new file mode 100644 index 0000000000..016768553d --- /dev/null +++ b/signal/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 +#include + +int +__sigwait (const sigset_t *set, int *sig) +{ + __set_errno (ENOSYS); + return -1; +} +weak_alias (__sigwait, sigwait) + +stub_warning (sigwait) +#include diff --git a/signal/sigwaitinfo.c b/signal/sigwaitinfo.c new file mode 100644 index 0000000000..e0659b0243 --- /dev/null +++ b/signal/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 +#include + +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 diff --git a/signal/sysv_signal.c b/signal/sysv_signal.c new file mode 100644 index 0000000000..86dbb1d093 --- /dev/null +++ b/signal/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 +#include + +/* 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 diff --git a/socket/accept.c b/socket/accept.c new file mode 100644 index 0000000000..dad34ceddd --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/bind.c b/socket/bind.c new file mode 100644 index 0000000000..382e29db16 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/connect.c b/socket/connect.c new file mode 100644 index 0000000000..55093313c9 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/getpeername.c b/socket/getpeername.c new file mode 100644 index 0000000000..6507387bd1 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/getsockname.c b/socket/getsockname.c new file mode 100644 index 0000000000..b698bdbb7a --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/getsockopt.c b/socket/getsockopt.c new file mode 100644 index 0000000000..8f4fa89578 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/isfdtype.c b/socket/isfdtype.c new file mode 100644 index 0000000000..ba10912c9f --- /dev/null +++ b/socket/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 +#include + + +int +isfdtype (int fildes, int fdtype) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (isfdtype) +#include diff --git a/socket/listen.c b/socket/listen.c new file mode 100644 index 0000000000..cbdd8b9d18 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/opensock.c b/socket/opensock.c new file mode 100644 index 0000000000..4a4d5dd385 --- /dev/null +++ b/socket/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 +#include +#include + +/* 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/socket/recv.c b/socket/recv.c new file mode 100644 index 0000000000..62af8fedf2 --- /dev/null +++ b/socket/recv.c @@ -0,0 +1,37 @@ +/* Copyright (C) 1991,1995,1996,1997,2001,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +/* 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; +} +weak_alias (__recv, recv) + +stub_warning (recv) +#include diff --git a/socket/recvfrom.c b/socket/recvfrom.c new file mode 100644 index 0000000000..4f6a045077 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/recvmsg.c b/socket/recvmsg.c new file mode 100644 index 0000000000..419415cd75 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/send.c b/socket/send.c new file mode 100644 index 0000000000..7f94fbb093 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/sendmsg.c b/socket/sendmsg.c new file mode 100644 index 0000000000..a4a3cea950 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/sendto.c b/socket/sendto.c new file mode 100644 index 0000000000..823c9dd1c7 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/setsockopt.c b/socket/setsockopt.c new file mode 100644 index 0000000000..aca73623fe --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/shutdown.c b/socket/shutdown.c new file mode 100644 index 0000000000..6fb25a4bc1 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/sockatmark.c b/socket/sockatmark.c new file mode 100644 index 0000000000..402ef9b4d0 --- /dev/null +++ b/socket/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 +#include + +/* Determine wheter socket is at a out-of-band mark. */ +int +sockatmark (fd) + int fd; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (sockatmark) +#include diff --git a/socket/socket.c b/socket/socket.c new file mode 100644 index 0000000000..94e70bc4ea --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/socket/socketpair.c b/socket/socketpair.c new file mode 100644 index 0000000000..ad277c00e5 --- /dev/null +++ b/socket/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 +#include + +/* 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 diff --git a/soft-fp/floatdisf.c b/soft-fp/floatdisf.c index c7933a85ff..d2a2af0947 100644 --- a/soft-fp/floatdisf.c +++ b/soft-fp/floatdisf.c @@ -23,7 +23,7 @@ #include "soft-fp.h" #include "single.h" -double __floatdisf(DItype i) +float __floatdisf(DItype i) { FP_DECL_EX; FP_DECL_S(A); diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h index 18779f88d8..2dc66c1ba3 100644 --- a/soft-fp/soft-fp.h +++ b/soft-fp/soft-fp.h @@ -175,4 +175,6 @@ typedef USItype UHWtype; #include #endif +#include + #endif diff --git a/stdio-common/ctermid.c b/stdio-common/ctermid.c new file mode 100644 index 0000000000..e4d94eada2 --- /dev/null +++ b/stdio-common/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 +#include + + +/* 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 diff --git a/stdio-common/cuserid.c b/stdio-common/cuserid.c new file mode 100644 index 0000000000..826972f4de --- /dev/null +++ b/stdio-common/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 +#include + +/* 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 diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c new file mode 100644 index 0000000000..6a834fc329 --- /dev/null +++ b/stdio-common/errlist.c @@ -0,0 +1,37 @@ +/* Copyright (C) 1991, 1994, 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +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/stdio-common/flockfile.c b/stdio-common/flockfile.c new file mode 100644 index 0000000000..571930ee54 --- /dev/null +++ b/stdio-common/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 + +#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/stdio-common/ftrylockfile.c b/stdio-common/ftrylockfile.c new file mode 100644 index 0000000000..7bd3e9b53b --- /dev/null +++ b/stdio-common/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 + +#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/stdio-common/funlockfile.c b/stdio-common/funlockfile.c new file mode 100644 index 0000000000..902d29478d --- /dev/null +++ b/stdio-common/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 + +#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/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c new file mode 100644 index 0000000000..fd790d5bf3 --- /dev/null +++ b/stdio-common/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 , 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 +#include +#include +#include +#include +#include +#include +#include +#include "_itoa.h" +#include "_itowa.h" +#include + +/* #define NDEBUG 1*/ /* Undefine this for debugging assertions. */ +#include + +/* 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 +# 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/stdio-common/remove.c b/stdio-common/remove.c new file mode 100644 index 0000000000..5dc0e9edf0 --- /dev/null +++ b/stdio-common/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 +#include + +int +remove (file) + const char *file; +{ + __set_errno (ENOSYS); + return -1; +} +libc_hidden_def (remove) + +stub_warning (remove) +#include diff --git a/stdio-common/rename.c b/stdio-common/rename.c new file mode 100644 index 0000000000..b7d8392179 --- /dev/null +++ b/stdio-common/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 +#include + + +/* 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 diff --git a/stdio-common/renameat.c b/stdio-common/renameat.c new file mode 100644 index 0000000000..e8629098df --- /dev/null +++ b/stdio-common/renameat.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + + +/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */ +int +renameat (oldfd, old, newfd, new) + int oldfd; + const char *old; + int newfd; + const char *new; +{ + if ((oldfd < 0 & oldfd !_ AT_FDCWD) || (newfd < 0 && newfd != AT_FDCWD)) + { + __set_errno (EBADF); + return -1; + } + + if (old == NULL || new == NULL) + { + __set_errno (EINVAL); + return -1; + } + + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (renameat) +#include diff --git a/stdio-common/siglist.c b/stdio-common/siglist.c new file mode 100644 index 0000000000..80847cd491 --- /dev/null +++ b/stdio-common/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 +#include +#include + +const char *const _sys_siglist[NSIG] = +{ +#define init_sig(sig, abbrev, desc) [sig] = desc, +#include +#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 +#undef init_sig +}; diff --git a/stdio-common/tempname.c b/stdio-common/tempname.c new file mode 100644 index 0000000000..60c94d6409 --- /dev/null +++ b/stdio-common/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 +#include +#include + +/* 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 diff --git a/stdio-common/tmpfile.c b/stdio-common/tmpfile.c new file mode 100644 index 0000000000..41f12bc8ba --- /dev/null +++ b/stdio-common/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 +#include + +#ifdef USE_IN_LIBIO +# include +# 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 +versioned_symbol (libc, __new_tmpfile, tmpfile, GLIBC_2_1); +#endif diff --git a/stdio-common/tmpfile64.c b/stdio-common/tmpfile64.c new file mode 100644 index 0000000000..adce634556 --- /dev/null +++ b/stdio-common/tmpfile64.c @@ -0,0 +1,3 @@ +#define GEN_THIS __GT_BIGFILE +#define tmpfile tmpfile64 +#include "tmpfile.c" diff --git a/stdlib/abort.c b/stdlib/abort.c new file mode 100644 index 0000000000..00788f22c7 --- /dev/null +++ b/stdlib/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 +#include +#include +#include +#include +#include + +/* Try to get a machine dependent instruction which will make the + program crash. This is used in case everything else fails. */ +#include +#ifndef ABORT_INSTRUCTION +/* No such instruction is available. */ +# define ABORT_INSTRUCTION +#endif + +#ifdef USE_IN_LIBIO +# include +# 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/stdlib/add_n.c b/stdlib/add_n.c new file mode 100644 index 0000000000..280e30545a --- /dev/null +++ b/stdlib/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 +#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/stdlib/addmul_1.c b/stdlib/addmul_1.c new file mode 100644 index 0000000000..6ae1e57ad9 --- /dev/null +++ b/stdlib/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 +#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/stdlib/cmp.c b/stdlib/cmp.c new file mode 100644 index 0000000000..e7661702b6 --- /dev/null +++ b/stdlib/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 +#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/stdlib/cxa_atexit.c b/stdlib/cxa_atexit.c index 490776105f..9b7a932b85 100644 --- a/stdlib/cxa_atexit.c +++ b/stdlib/cxa_atexit.c @@ -21,6 +21,8 @@ #include #include "exit.h" +#include +#include #undef __cxa_atexit @@ -35,10 +37,14 @@ __cxa_atexit (void (*func) (void *), void *arg, void *d) if (new == NULL) return -1; - new->flavor = ef_cxa; +#ifdef PTR_MANGLE + PTR_MANGLE (func); +#endif new->func.cxa.fn = (void (*) (void *, int)) func; new->func.cxa.arg = arg; new->func.cxa.dso_handle = d; + atomic_write_barrier (); + new->flavor = ef_cxa; return 0; } INTDEF(__cxa_atexit) diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c index 2339c7b5bd..43fcbc484f 100644 --- a/stdlib/cxa_finalize.c +++ b/stdlib/cxa_finalize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,6 +21,7 @@ #include #include "exit.h" #include +#include /* If D is non-NULL, call all functions registered with `__cxa_atexit' with the same dso handle. Otherwise, if D is NULL, call all of the @@ -39,7 +40,13 @@ __cxa_finalize (void *d) /* We don't want to run this cleanup more than once. */ && ! atomic_compare_and_exchange_bool_acq (&f->flavor, ef_free, ef_cxa)) - (*f->func.cxa.fn) (f->func.cxa.arg, 0); + { + void (*cxafn) (void *arg, int status) = f->func.cxa.fn; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (cxafn); +#endif + cxafn (f->func.cxa.arg, 0); + } } /* Remove the registered fork handlers. We do not have to diff --git a/stdlib/dbl2mpn.c b/stdlib/dbl2mpn.c new file mode 100644 index 0000000000..4444467946 --- /dev/null +++ b/stdlib/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 +#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/stdlib/div.c b/stdlib/div.c new file mode 100644 index 0000000000..5268f4c494 --- /dev/null +++ b/stdlib/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 + +/* 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/stdlib/divmod_1.c b/stdlib/divmod_1.c new file mode 100644 index 0000000000..51a47d85d3 --- /dev/null +++ b/stdlib/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 +#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/stdlib/divrem.c b/stdlib/divrem.c new file mode 100644 index 0000000000..c97d01ec17 --- /dev/null +++ b/stdlib/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 +#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/stdlib/exit.c b/stdlib/exit.c index e5e25960b1..bc4cb0fd08 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "exit.h" #include "set-hooks.h" @@ -45,17 +46,33 @@ exit (int status) &__exit_funcs->fns[--__exit_funcs->idx]; switch (f->flavor) { + void (*atfct) (void); + void (*onfct) (int status, void *arg); + void (*cxafct) (void *arg, int status); + case ef_free: case ef_us: break; case ef_on: - (*f->func.on.fn) (status, f->func.on.arg); + onfct = f->func.on.fn; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (onfct); +#endif + onfct (status, f->func.on.arg); break; case ef_at: - (*f->func.at) (); + atfct = f->func.at; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (atfct); +#endif + atfct (); break; case ef_cxa: - (*f->func.cxa.fn) (f->func.cxa.arg, status); + cxafct = f->func.cxa.fn; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (cxafct); +#endif + cxafct (f->func.cxa.arg, status); break; } } diff --git a/stdlib/getcontext.c b/stdlib/getcontext.c new file mode 100644 index 0000000000..e417575a58 --- /dev/null +++ b/stdlib/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 +#include + +int +getcontext (ucp) + ucontext_t *ucp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (getcontext) +#include diff --git a/stdlib/getenv.c b/stdlib/getenv.c new file mode 100644 index 0000000000..6cdfe2b266 --- /dev/null +++ b/stdlib/getenv.c @@ -0,0 +1,98 @@ +/* Copyright (C) 1991,92,94,96,98,99,2002,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +/* 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/stdlib/inlines.c b/stdlib/inlines.c new file mode 100644 index 0000000000..5f1065ea13 --- /dev/null +++ b/stdlib/inlines.c @@ -0,0 +1,3 @@ +#define _FORCE_INLINES +#define _EXTERN_INLINE /* empty */ +#include diff --git a/stdlib/labs.c b/stdlib/labs.c new file mode 100644 index 0000000000..c568e44454 --- /dev/null +++ b/stdlib/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 + +#undef labs + + +/* Return the absolute value of I. */ +long int +labs (long int i) +{ + return i < 0 ? -i : i; +} diff --git a/stdlib/ldbl2mpn.c b/stdlib/ldbl2mpn.c new file mode 100644 index 0000000000..450f9381cc --- /dev/null +++ b/stdlib/ldbl2mpn.c @@ -0,0 +1 @@ +/* Empty. Not needed unless ldbl support is in. */ diff --git a/stdlib/ldiv.c b/stdlib/ldiv.c new file mode 100644 index 0000000000..a7796d8e95 --- /dev/null +++ b/stdlib/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 + + +/* 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/stdlib/llabs.c b/stdlib/llabs.c new file mode 100644 index 0000000000..b15c347d32 --- /dev/null +++ b/stdlib/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 + +#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/stdlib/lldiv.c b/stdlib/lldiv.c new file mode 100644 index 0000000000..28a016b744 --- /dev/null +++ b/stdlib/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 + + +/* 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/stdlib/longlong.h b/stdlib/longlong.h index f89ae27a67..4e1931d823 100644 --- a/stdlib/longlong.h +++ b/stdlib/longlong.h @@ -1,5 +1,6 @@ /* longlong.h -- definitions for mixed size 32/64 bit arithmetic. - Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -31,8 +32,7 @@ DItype, UDItype -- Signed and unsigned 64 bit types. On a 32 bit machine UWtype should typically be USItype; - on a 64 bit machine, UWtype should typically be UDItype. -*/ + on a 64 bit machine, UWtype should typically be UDItype. */ #define __BITS4 (W_TYPE_SIZE / 4) #define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2)) @@ -46,10 +46,12 @@ #define UDWtype UDItype #endif +extern const UQItype __clz_tab[256]; + /* Define auxiliary asm macros. - 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand) multiplies two - UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype + 1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two + UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype word product in HIGH_PROD and LOW_PROD. 2) __umulsidi3(a,b) multiplies two UWtype integers A and B, and returns a @@ -113,10 +115,7 @@ #define umul_ppmm(ph, pl, m0, m1) \ do { \ UDItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("umulh %r1,%2,%0" \ - : "=r" ((UDItype) ph) \ - : "%rJ" (__m0), \ - "rI" (__m1)); \ + (ph) = __builtin_alpha_umulh (__m0, __m1); \ (pl) = __m0 * __m1; \ } while (0) #define UMUL_TIME 46 @@ -130,30 +129,27 @@ extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype); #define UDIV_TIME 220 #endif /* LONGLONG_STANDALONE */ #ifdef __alpha_cix__ -#define count_leading_zeros(COUNT,X) \ - __asm__("ctlz %1,%0" : "=r"(COUNT) : "r"(X)) -#define count_trailing_zeros(COUNT,X) \ - __asm__("cttz %1,%0" : "=r"(COUNT) : "r"(X)) +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X)) +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X)) #define COUNT_LEADING_ZEROS_0 64 #else -extern const UQItype __clz_tab[]; #define count_leading_zeros(COUNT,X) \ do { \ UDItype __xr = (X), __t, __a; \ - __asm__("cmpbge $31,%1,%0" : "=r"(__t) : "r"(__xr)); \ + __t = __builtin_alpha_cmpbge (0, __xr); \ __a = __clz_tab[__t ^ 0xff] - 1; \ - __asm__("extbl %1,%2,%0" : "=r"(__t) : "r"(__xr), "r"(__a)); \ + __t = __builtin_alpha_extbl (__xr, __a); \ (COUNT) = 64 - (__clz_tab[__t] + __a*8); \ } while (0) #define count_trailing_zeros(COUNT,X) \ do { \ UDItype __xr = (X), __t, __a; \ - __asm__("cmpbge $31,%1,%0" : "=r"(__t) : "r"(__xr)); \ + __t = __builtin_alpha_cmpbge (0, __xr); \ __t = ~__t & -~__t; \ __a = ((__t & 0xCC) != 0) * 2; \ __a += ((__t & 0xF0) != 0) * 4; \ __a += ((__t & 0xAA) != 0); \ - __asm__("extbl %1,%2,%0" : "=r"(__t) : "r"(__xr), "r"(__a)); \ + __t = __builtin_alpha_extbl (__xr, __a); \ __a <<= 3; \ __t &= -__t; \ __a += ((__t & 0xCC) != 0) * 2; \ @@ -193,7 +189,7 @@ do { \ UDItype __umulsidi3 (USItype, USItype); #endif -#if defined (__arm__) && W_TYPE_SIZE == 32 +#if defined (__arm__) && !defined (__thumb__) && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("adds %1, %4, %5\n\tadc %0, %2, %3" \ : "=r" ((USItype) (sh)), \ @@ -201,7 +197,7 @@ UDItype __umulsidi3 (USItype, USItype); : "%r" ((USItype) (ah)), \ "rI" ((USItype) (bh)), \ "%r" ((USItype) (al)), \ - "rI" ((USItype) (bl))) + "rI" ((USItype) (bl)) __CLOBBER_CC) #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("subs %1, %4, %5\n\tsbc %0, %2, %3" \ : "=r" ((USItype) (sh)), \ @@ -209,7 +205,7 @@ UDItype __umulsidi3 (USItype, USItype); : "r" ((USItype) (ah)), \ "rI" ((USItype) (bh)), \ "r" ((USItype) (al)), \ - "rI" ((USItype) (bl))) + "rI" ((USItype) (bl)) __CLOBBER_CC) #define umul_ppmm(xh, xl, a, b) \ {register USItype __t0, __t1, __t2; \ __asm__ ("%@ Inlined umul_ppmm\n" \ @@ -229,7 +225,7 @@ UDItype __umulsidi3 (USItype, USItype); "=r" ((USItype) (xl)), \ "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \ : "r" ((USItype) (a)), \ - "r" ((USItype) (b)));} + "r" ((USItype) (b)) __CLOBBER_CC );} #define UMUL_TIME 20 #define UDIV_TIME 100 #endif /* __arm__ */ @@ -294,44 +290,27 @@ UDItype __umulsidi3 (USItype, USItype); } while (0) #endif -#if (defined (__i370__) || defined (__mvs__)) && W_TYPE_SIZE == 32 -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mr %0,%3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (__m0), \ - "r" (__m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ - (xh) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) +#if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32 #define smul_ppmm(xh, xl, m0, m1) \ do { \ union {DItype __ll; \ struct {USItype __h, __l;} __i; \ - } __xx; \ - __asm__ ("mr %0,%3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (m0), \ - "r" (m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ + } __x; \ + __asm__ ("lr %N0,%1\n\tmr %0,%2" \ + : "=&r" (__x.__ll) \ + : "r" (m0), "r" (m1)); \ + (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ } while (0) #define sdiv_qrnnd(q, r, n1, n0, d) \ do { \ union {DItype __ll; \ struct {USItype __h, __l;} __i; \ - } __xx; \ - __xx.__i.__h = n1; __xx.__i.__l = n0; \ + } __x; \ + __x.__i.__h = n1; __x.__i.__l = n0; \ __asm__ ("dr %0,%2" \ - : "=r" (__xx.__ll) \ - : "0" (__xx.__ll), "r" (d)); \ - (q) = __xx.__i.__l; (r) = __xx.__i.__h; \ + : "=r" (__x.__ll) \ + : "0" (__x.__ll), "r" (d)); \ + (q) = __x.__i.__l; (r) = __x.__i.__h; \ } while (0) #endif @@ -438,11 +417,8 @@ UDItype __umulsidi3 (USItype, USItype); "1" ((USItype) (al)), \ "g" ((USItype) (bl))) -/* The '020, '030, '040 and CPU32 have 32x32->64 and 64/32->32q-32r. */ -#if defined (__mc68020__) || defined(mc68020) \ - || defined(__mc68030__) || defined(mc68030) \ - || defined(__mc68040__) || defined(mc68040) \ - || defined(__mcpu32__) || defined(mcpu32) +/* The '020, '030, '040, '060 and CPU32 have 32x32->64 and 64/32->32q-32r. */ +#if (defined (__mc68020__) && !defined (__mc68060__)) #define umul_ppmm(w1, w0, u, v) \ __asm__ ("mulu%.l %3,%1:%0" \ : "=d" ((USItype) (w0)), \ @@ -466,8 +442,43 @@ UDItype __umulsidi3 (USItype, USItype); "1" ((USItype) (n1)), \ "dmi" ((USItype) (d))) -#else /* not mc68020 */ -#if !defined(__mcf5200__) +#elif defined (__mcoldfire__) /* not mc68020 */ + +#define umul_ppmm(xh, xl, a, b) \ + __asm__ ("| Inlined umul_ppmm\n" \ + " move%.l %2,%/d0\n" \ + " move%.l %3,%/d1\n" \ + " move%.l %/d0,%/d2\n" \ + " swap %/d0\n" \ + " move%.l %/d1,%/d3\n" \ + " swap %/d1\n" \ + " move%.w %/d2,%/d4\n" \ + " mulu %/d3,%/d4\n" \ + " mulu %/d1,%/d2\n" \ + " mulu %/d0,%/d3\n" \ + " mulu %/d0,%/d1\n" \ + " move%.l %/d4,%/d0\n" \ + " clr%.w %/d0\n" \ + " swap %/d0\n" \ + " add%.l %/d0,%/d2\n" \ + " add%.l %/d3,%/d2\n" \ + " jcc 1f\n" \ + " add%.l %#65536,%/d1\n" \ + "1: swap %/d2\n" \ + " moveq %#0,%/d0\n" \ + " move%.w %/d2,%/d0\n" \ + " move%.w %/d4,%/d2\n" \ + " move%.l %/d2,%1\n" \ + " add%.l %/d1,%/d0\n" \ + " move%.l %/d0,%0" \ + : "=g" ((USItype) (xh)), \ + "=g" ((USItype) (xl)) \ + : "g" ((USItype) (a)), \ + "g" ((USItype) (b)) \ + : "d0", "d1", "d2", "d3", "d4") +#define UMUL_TIME 100 +#define UDIV_TIME 400 +#else /* not ColdFire */ /* %/ inserts REGISTER_PREFIX, %# inserts IMMEDIATE_PREFIX. */ #define umul_ppmm(xh, xl, a, b) \ __asm__ ("| Inlined umul_ppmm\n" \ @@ -503,14 +514,12 @@ UDItype __umulsidi3 (USItype, USItype); : "d0", "d1", "d2", "d3", "d4") #define UMUL_TIME 100 #define UDIV_TIME 400 -#endif /* not mcf5200 */ + #endif /* not mc68020 */ -/* The '020, '030, '040 and '060 have bitfield insns. */ -#if defined (__mc68020__) || defined(mc68020) \ - || defined(__mc68030__) || defined(mc68030) \ - || defined(__mc68040__) || defined(mc68040) \ - || defined(__mc68060__) || defined(mc68060) +/* The '020, '030, '040 and '060 have bitfield insns. + cpu32 disguises as a 68020, but lacks them. */ +#if defined (__mc68020__) && !defined (__mcpu32__) #define count_leading_zeros(count, x) \ __asm__ ("bfffo %1{%b2:%b2},%0" \ : "=d" ((USItype) (count)) \ @@ -671,7 +680,7 @@ UDItype __umulsidi3 (USItype, USItype); __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x)) #define COUNT_LEADING_ZEROS_0 32 #if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \ - || defined (__ppc__) || defined (PPC) || defined (__vxworks__) + || defined (__ppc__) || defined (PPC) #define umul_ppmm(ph, pl, m0, m1) \ do { \ USItype __m0 = (m0), __m1 = (m1); \ @@ -1203,6 +1212,20 @@ UDItype __umulsidi3 (USItype, USItype); } while (0) #endif +/* If we lack umul_ppmm but have smul_ppmm, define umul_ppmm in terms of + smul_ppmm. */ +#if !defined (umul_ppmm) && defined (smul_ppmm) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + UWtype __w1; \ + UWtype __xm0 = (u), __xm1 = (v); \ + smul_ppmm (__w1, w0, __xm0, __xm1); \ + (w1) = __w1 + (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \ + + (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \ + } while (0) +#endif + +/* If we still don't have umul_ppmm, define it using plain C. */ #if !defined (umul_ppmm) #define umul_ppmm(w1, w0, u, v) \ do { \ @@ -1292,7 +1315,6 @@ UDItype __umulsidi3 (USItype, USItype); #endif #if !defined (count_leading_zeros) -extern const UQItype __clz_tab[]; #define count_leading_zeros(count, x) \ do { \ UWtype __xr = (x); \ diff --git a/stdlib/lshift.c b/stdlib/lshift.c new file mode 100644 index 0000000000..bedf44229f --- /dev/null +++ b/stdlib/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 +#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/stdlib/makecontext.c b/stdlib/makecontext.c new file mode 100644 index 0000000000..a65868827f --- /dev/null +++ b/stdlib/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 +#include + +void +makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) +{ + __set_errno (ENOSYS); +} + + +stub_warning (makecontext) +#include diff --git a/stdlib/mod_1.c b/stdlib/mod_1.c new file mode 100644 index 0000000000..3273c9222d --- /dev/null +++ b/stdlib/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 +#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/stdlib/mp_clz_tab.c b/stdlib/mp_clz_tab.c new file mode 100644 index 0000000000..2220299e7c --- /dev/null +++ b/stdlib/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 +#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/stdlib/mpn2dbl.c b/stdlib/mpn2dbl.c new file mode 100644 index 0000000000..178edbf816 --- /dev/null +++ b/stdlib/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 +#include "gmp-impl.h" +#include + +/* 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/stdlib/mpn2flt.c b/stdlib/mpn2flt.c new file mode 100644 index 0000000000..16ec73c174 --- /dev/null +++ b/stdlib/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 + +/* 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/stdlib/mpn2ldbl.c b/stdlib/mpn2ldbl.c new file mode 100644 index 0000000000..450f9381cc --- /dev/null +++ b/stdlib/mpn2ldbl.c @@ -0,0 +1 @@ +/* Empty. Not needed unless ldbl support is in. */ diff --git a/stdlib/mul.c b/stdlib/mul.c new file mode 100644 index 0000000000..fe0cbf3d7f --- /dev/null +++ b/stdlib/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 +#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/stdlib/mul_1.c b/stdlib/mul_1.c new file mode 100644 index 0000000000..686e6c5efe --- /dev/null +++ b/stdlib/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 +#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/stdlib/mul_n.c b/stdlib/mul_n.c new file mode 100644 index 0000000000..b478c76aba --- /dev/null +++ b/stdlib/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 +#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/stdlib/on_exit.c b/stdlib/on_exit.c index d98fbb3a86..e777604084 100644 --- a/stdlib/on_exit.c +++ b/stdlib/on_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1996, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,8 @@ #include #include "exit.h" +#include +#include /* Register a function to be called by exit. */ int @@ -28,9 +30,13 @@ __on_exit (void (*func) (int status, void *arg), void *arg) if (new == NULL) return -1; - new->flavor = ef_on; +#ifdef PTR_MANGLE + PTR_MANGLE (func); +#endif new->func.on.fn = func; new->func.on.arg = arg; + atomic_write_barrier (); + new->flavor = ef_on; return 0; } weak_alias (__on_exit, on_exit) diff --git a/stdlib/putenv.c b/stdlib/putenv.c new file mode 100644 index 0000000000..4e8693403a --- /dev/null +++ b/stdlib/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 +#endif + +#if _LIBC || HAVE_STDLIB_H +# include +#endif +#if _LIBC || HAVE_STRING_H +# include +#endif + +#if !__GNU_LIBRARY__ && !HAVE_STRCHR +# define strchr index +#endif + +#ifndef _LIBC +# ifdef HAVE_ALLOCA_H +# include +# 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/stdlib/rshift.c b/stdlib/rshift.c new file mode 100644 index 0000000000..9d0a9c4c0e --- /dev/null +++ b/stdlib/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 +#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/stdlib/setcontext.c b/stdlib/setcontext.c new file mode 100644 index 0000000000..5841e20317 --- /dev/null +++ b/stdlib/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 +#include + +int +setcontext (ucp) + const ucontext_t *ucp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (setcontext) +#include diff --git a/stdlib/setenv.c b/stdlib/setenv.c new file mode 100644 index 0000000000..48aaecffe0 --- /dev/null +++ b/stdlib/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 +#endif + +#include +#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 +#endif +#if _LIBC || HAVE_STRING_H +# include +#endif +#if _LIBC || HAVE_UNISTD_H +# include +#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 +__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 + +/* 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/stdlib/strtod_l.c b/stdlib/strtod_l.c index 3a1c1ebd4b..c7901c29fe 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -68,8 +68,8 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **, and _LONG_LONG_LIMB in it can take effect into gmp.h. */ #include #include -#include -#include +#include "gmp-impl.h" +#include "longlong.h" #include "fpioconst.h" #define NDEBUG 1 diff --git a/stdlib/strtoimax.c b/stdlib/strtoimax.c new file mode 100644 index 0000000000..f1de70f320 --- /dev/null +++ b/stdlib/strtoimax.c @@ -0,0 +1 @@ +#error "The correct implementation must be chosen based on the `intmax_t' type" diff --git a/stdlib/strtol.c b/stdlib/strtol.c new file mode 100644 index 0000000000..02ec19aabe --- /dev/null +++ b/stdlib/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 +#include +#include + +#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/stdlib/strtol_l.c b/stdlib/strtol_l.c new file mode 100644 index 0000000000..156083c748 --- /dev/null +++ b/stdlib/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 , 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 +#endif + +#ifdef _LIBC +# define USE_NUMBER_GROUPING +# define STDC_HEADERS +# define HAVE_LIMITS_H +#endif + +#include +#include +#ifndef __set_errno +# define __set_errno(Val) errno = (Val) +#endif + +#ifdef HAVE_LIMITS_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#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 +#endif + +#ifdef USE_WIDE_CHAR +# include +# 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 . */ + 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/stdlib/strtold_l.c b/stdlib/strtold_l.c new file mode 100644 index 0000000000..690a8a92eb --- /dev/null +++ b/stdlib/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 +#include +#include + +#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/stdlib/strtoll.c b/stdlib/strtoll.c new file mode 100644 index 0000000000..60128df781 --- /dev/null +++ b/stdlib/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 + +#ifdef _LIBC +# ifdef SHARED +# include + +# 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/stdlib/strtoll_l.c b/stdlib/strtoll_l.c new file mode 100644 index 0000000000..7725035bd1 --- /dev/null +++ b/stdlib/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 , 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 + +extern long long int ____strtoll_l_internal (const char *, char **, int, int, + __locale_t); + +#include diff --git a/stdlib/strtoul.c b/stdlib/strtoul.c new file mode 100644 index 0000000000..0862950231 --- /dev/null +++ b/stdlib/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/stdlib/strtoul_l.c b/stdlib/strtoul_l.c new file mode 100644 index 0000000000..a8b980f48d --- /dev/null +++ b/stdlib/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 , 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 + +extern unsigned long int ____strtoul_l_internal (const char *, char **, int, + int, __locale_t); + +#include "strtol_l.c" diff --git a/stdlib/strtoull.c b/stdlib/strtoull.c new file mode 100644 index 0000000000..accf5874a0 --- /dev/null +++ b/stdlib/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 + +#ifdef _LIBC +# ifdef SHARED +# include + +# 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/stdlib/strtoull_l.c b/stdlib/strtoull_l.c new file mode 100644 index 0000000000..68ad0d826e --- /dev/null +++ b/stdlib/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 , 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 + +extern unsigned long long int ____strtoull_l_internal (const char *, char **, + int, int, __locale_t); + +#include diff --git a/stdlib/strtoumax.c b/stdlib/strtoumax.c new file mode 100644 index 0000000000..508cb19f8c --- /dev/null +++ b/stdlib/strtoumax.c @@ -0,0 +1 @@ +#error "The correct implementation must be chosen based on the `uintmax_t' type" diff --git a/stdlib/sub_n.c b/stdlib/sub_n.c new file mode 100644 index 0000000000..987ad91eb1 --- /dev/null +++ b/stdlib/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 +#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/stdlib/submul_1.c b/stdlib/submul_1.c new file mode 100644 index 0000000000..3e7163a2a3 --- /dev/null +++ b/stdlib/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, 2005 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 +#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/stdlib/swapcontext.c b/stdlib/swapcontext.c new file mode 100644 index 0000000000..56b73f0d6c --- /dev/null +++ b/stdlib/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 +#include + +int +swapcontext (oucp, ucp) + ucontext_t *oucp; + const ucontext_t *ucp; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (swapcontext) +#include diff --git a/stdlib/system.c b/stdlib/system.c new file mode 100644 index 0000000000..cd12128cd8 --- /dev/null +++ b/stdlib/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 +#include + + +/* 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 diff --git a/stdlib/udiv_qrnnd.c b/stdlib/udiv_qrnnd.c new file mode 100644 index 0000000000..d32796c04d --- /dev/null +++ b/stdlib/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/stdlib/wcstoimax.c b/stdlib/wcstoimax.c new file mode 100644 index 0000000000..f1de70f320 --- /dev/null +++ b/stdlib/wcstoimax.c @@ -0,0 +1 @@ +#error "The correct implementation must be chosen based on the `intmax_t' type" diff --git a/stdlib/wcstoumax.c b/stdlib/wcstoumax.c new file mode 100644 index 0000000000..508cb19f8c --- /dev/null +++ b/stdlib/wcstoumax.c @@ -0,0 +1 @@ +#error "The correct implementation must be chosen based on the `uintmax_t' type" diff --git a/streams/fattach.c b/streams/fattach.c new file mode 100644 index 0000000000..555e0b65e6 --- /dev/null +++ b/streams/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 +#include + +int +fattach (fildes, path) + int fildes; + const char *path; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (fattach) +#include diff --git a/streams/fdetach.c b/streams/fdetach.c new file mode 100644 index 0000000000..431c92bbea --- /dev/null +++ b/streams/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 +#include + +int +fdetach (path) + const char *path; +{ + __set_errno (ENOSYS); + return -1; +} + + +stub_warning (fdetach) +#include diff --git a/streams/getmsg.c b/streams/getmsg.c new file mode 100644 index 0000000000..861a40f677 --- /dev/null +++ b/streams/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 +#include + +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 diff --git a/streams/getpmsg.c b/streams/getpmsg.c new file mode 100644 index 0000000000..e6e9898e46 --- /dev/null +++ b/streams/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 +#include + +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 diff --git a/streams/isastream.c b/streams/isastream.c new file mode 100644 index 0000000000..88dae299fc --- /dev/null +++ b/streams/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 +#include +#include + +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/streams/putmsg.c b/streams/putmsg.c new file mode 100644 index 0000000000..b84dd843ba --- /dev/null +++ b/streams/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 +#include + +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 diff --git a/streams/putpmsg.c b/streams/putpmsg.c new file mode 100644 index 0000000000..6e37036aac --- /dev/null +++ b/streams/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 +#include + +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 diff --git a/string/_strerror.c b/string/_strerror.c new file mode 100644 index 0000000000..f6f16ff2af --- /dev/null +++ b/string/_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 +#include +#include +#include +#include + +/* It is critical here that we always use the `dcgettext' function for + the message translation. Since only defines the macro + `dgettext' to use `dcgettext' for optimizing programs this is not + always guaranteed. */ +#ifndef dgettext +# include /* 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/string/bcopy.c b/string/bcopy.c new file mode 100644 index 0000000000..3f16b884ac --- /dev/null +++ b/string/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 + +#define memmove bcopy +#define rettype void +#define RETURN(s) return +#define a1 src +#define a1const const +#define a2 dest +#define a2const + +#include diff --git a/string/bzero.c b/string/bzero.c new file mode 100644 index 0000000000..c6ede14139 --- /dev/null +++ b/string/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 +#include + +#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/string/ffs.c b/string/ffs.c new file mode 100644 index 0000000000..06a1542bd9 --- /dev/null +++ b/string/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 +#define ffsl __something_else +#include + +#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/string/ffsll.c b/string/ffsll.c new file mode 100644 index 0000000000..9dd269afb7 --- /dev/null +++ b/string/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 +#define ffsl __something_else +#include + +#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/string/memccpy.c b/string/memccpy.c new file mode 100644 index 0000000000..9ffdc335d4 --- /dev/null +++ b/string/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 + +#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/string/memchr.c b/string/memchr.c new file mode 100644 index 0000000000..f3098c775a --- /dev/null +++ b/string/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 +#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 +# include +#else +# define reg_char char +#endif + +#if HAVE_STDLIB_H || defined _LIBC +# include +#endif + +#if HAVE_LIMITS_H || defined _LIBC +# include +#endif + +#define LONG_MAX_32_BITS 2147483647 + +#ifndef LONG_MAX +#define LONG_MAX LONG_MAX_32_BITS +#endif + +#include +#if HAVE_BP_SYM_H || defined _LIBC +#include +#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/string/memcmp.c b/string/memcmp.c new file mode 100644 index 0000000000..2f8cf344af --- /dev/null +++ b/string/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 +#endif + +#undef memcmp + +#ifdef _LIBC + +# include +# include + +# if __BYTE_ORDER == __BIG_ENDIAN +# define WORDS_BIGENDIAN +# endif + +#else /* Not in the GNU C library. */ + +# include + +/* 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/string/memcpy.c b/string/memcpy.c new file mode 100644 index 0000000000..e167e85d7b --- /dev/null +++ b/string/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 +#include +#include + +#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/string/memmem.c b/string/memmem.c new file mode 100644 index 0000000000..c40462104a --- /dev/null +++ b/string/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 +#include + +#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/string/memmove.c b/string/memmove.c new file mode 100644 index 0000000000..16671f7bb5 --- /dev/null +++ b/string/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 +#include +#include + +/* 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/string/mempcpy.c b/string/mempcpy.c new file mode 100644 index 0000000000..a72617e86f --- /dev/null +++ b/string/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 +#include +#include + +#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/string/memrchr.c b/string/memrchr.c new file mode 100644 index 0000000000..21662b1bd7 --- /dev/null +++ b/string/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 + +#ifdef HAVE_CONFIG_H +# include +#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 +# include +#else +# define reg_char char +#endif + +#if defined HAVE_LIMITS_H || defined _LIBC +# include +#endif + +#define LONG_MAX_32_BITS 2147483647 + +#ifndef LONG_MAX +# define LONG_MAX LONG_MAX_32_BITS +#endif + +#include + +#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/string/memset.c b/string/memset.c new file mode 100644 index 0000000000..592b11e435 --- /dev/null +++ b/string/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 +#include + +#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/string/rawmemchr.c b/string/rawmemchr.c new file mode 100644 index 0000000000..cb00ad7e90 --- /dev/null +++ b/string/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 +#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 +# include +# include +#else +# define reg_char char +#endif + +#if defined (HAVE_LIMITS_H) || defined (_LIBC) +# include +#endif + +#define LONG_MAX_32_BITS 2147483647 + +#ifndef LONG_MAX +#define LONG_MAX LONG_MAX_32_BITS +#endif + +#include + +#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/string/stpcpy.c b/string/stpcpy.c new file mode 100644 index 0000000000..6e42911fde --- /dev/null +++ b/string/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 +#endif + +#include + +#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/string/stpncpy.c b/string/stpncpy.c new file mode 100644 index 0000000000..164d0f1747 --- /dev/null +++ b/string/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 +#endif + +#ifdef _LIBC +# include +#else +# include +#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/string/strcasecmp.c b/string/strcasecmp.c new file mode 100644 index 0000000000..3ae3d67d04 --- /dev/null +++ b/string/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 +#endif + +#include +#include + +#ifndef _LIBC +# define __strcasecmp strcasecmp +# define TOLOWER(Ch) tolower (Ch) +#else +# include +# 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/string/strcasecmp_l.c b/string/strcasecmp_l.c new file mode 100644 index 0000000000..498a27d975 --- /dev/null +++ b/string/strcasecmp_l.c @@ -0,0 +1,23 @@ +/* Copyright (C) 1997, 2002, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along 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 "strcasecmp.c" + +libc_hidden_def (__strcasecmp_l) +weak_alias (__strcasecmp_l, strcasecmp_l) diff --git a/string/strcasestr.c b/string/strcasestr.c new file mode 100644 index 0000000000..1dde43c606 --- /dev/null +++ b/string/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 +#endif + +#include + +#if defined _LIBC || defined HAVE_STRING_H +# include +#endif + +#ifdef _LIBC +# include +# 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/string/strcat.c b/string/strcat.c new file mode 100644 index 0000000000..eef22add36 --- /dev/null +++ b/string/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 +#include + +#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/string/strchr.c b/string/strchr.c new file mode 100644 index 0000000000..c8b7969e85 --- /dev/null +++ b/string/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 +#include +#include + +#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/string/strchrnul.c b/string/strchrnul.c new file mode 100644 index 0000000000..88b96dd126 --- /dev/null +++ b/string/strchrnul.c @@ -0,0 +1,170 @@ +/* Copyright (C) 1991,1993-1997,99,2000,2005 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 +#include +#include + +#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 = (const unsigned char *) 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/string/strcmp.c b/string/strcmp.c new file mode 100644 index 0000000000..bd53c05c6e --- /dev/null +++ b/string/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 +#include + +#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/string/strcpy.c b/string/strcpy.c new file mode 100644 index 0000000000..c736a60762 --- /dev/null +++ b/string/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 +#include +#include +#include + +#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/string/strcspn.c b/string/strcspn.c new file mode 100644 index 0000000000..f359d578f7 --- /dev/null +++ b/string/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 +#endif + +#if defined _LIBC || HAVE_STRING_H +# include +#else +# include +# 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/string/string-inlines.c b/string/string-inlines.c new file mode 100644 index 0000000000..89a5baab5d --- /dev/null +++ b/string/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. */ + +/* and 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 +#undef index +#undef rindex + +#undef __NO_INLINE__ +#include +#include diff --git a/string/strlen.c b/string/strlen.c new file mode 100644 index 0000000000..9bc9db68f7 --- /dev/null +++ b/string/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 +#include + +#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/string/strncase.c b/string/strncase.c new file mode 100644 index 0000000000..a55aaf6a3a --- /dev/null +++ b/string/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 +#endif + +#include +#include + +#ifndef weak_alias +# define __strncasecmp strncasecmp +# define TOLOWER(Ch) tolower (Ch) +#else +# include +# 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/string/strncase_l.c b/string/strncase_l.c new file mode 100644 index 0000000000..0f22b46de1 --- /dev/null +++ b/string/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, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along 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 "strncase.c" + +libc_hidden_def (__strncasecmp_l) +weak_alias (__strncasecmp_l, strncasecmp_l) diff --git a/string/strncat.c b/string/strncat.c new file mode 100644 index 0000000000..2e2de11508 --- /dev/null +++ b/string/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 + +#ifdef _LIBC +# include +#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/string/strncmp.c b/string/strncmp.c new file mode 100644 index 0000000000..1adb2c0ebd --- /dev/null +++ b/string/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 +#include + +#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/string/strncpy.c b/string/strncpy.c new file mode 100644 index 0000000000..f32612e1cf --- /dev/null +++ b/string/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 +#include + +#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/string/strnlen.c b/string/strnlen.c new file mode 100644 index 0000000000..454257b2bc --- /dev/null +++ b/string/strnlen.c @@ -0,0 +1,161 @@ +/* Find the length of STRING, but scan at most MAXLEN characters. + Copyright (C) 1991,1993,1997,2000,2001,2005 Free Software Foundation, Inc. + Contributed by Jakub Jelinek . + + 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 +#include + +/* 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) +libc_hidden_def (strnlen) diff --git a/string/strpbrk.c b/string/strpbrk.c new file mode 100644 index 0000000000..620cfab7f9 --- /dev/null +++ b/string/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 +#endif + +#if defined _LIBC || defined HAVE_CONFIG_H +# include +#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/string/strrchr.c b/string/strrchr.c new file mode 100644 index 0000000000..64118b87ef --- /dev/null +++ b/string/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 + +#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/string/strsep.c b/string/strsep.c new file mode 100644 index 0000000000..e5342f7a22 --- /dev/null +++ b/string/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 + +#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/string/strspn.c b/string/strspn.c new file mode 100644 index 0000000000..dc17ea8cbc --- /dev/null +++ b/string/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 + +#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/string/strstr.c b/string/strstr.c new file mode 100644 index 0000000000..fce1f2a756 --- /dev/null +++ b/string/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 +#endif + +#if defined _LIBC || defined HAVE_STRING_H +# include +#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/string/strtok.c b/string/strtok.c new file mode 100644 index 0000000000..f45b760f74 --- /dev/null +++ b/string/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 + + +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/string/strtok_r.c b/string/strtok_r.c new file mode 100644 index 0000000000..b11cb520f6 --- /dev/null +++ b/string/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 +#endif + +#include + +#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/string/wordcopy.c b/string/wordcopy.c new file mode 100644 index 0000000000..0c9a4be4f6 --- /dev/null +++ b/string/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 +#include + +/* _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/string/xpg-strerror.c b/string/xpg-strerror.c new file mode 100644 index 0000000000..5cb56cdfb8 --- /dev/null +++ b/string/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 +#include +#include +#include +#include +#include + +/* It is critical here that we always use the `dcgettext' function for + the message translation. Since only defines the macro + `dgettext' to use `dcgettext' for optimizing programs this is not + always guaranteed. */ +#ifndef dgettext +# include /* 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/sunrpc/auth_des.c b/sunrpc/auth_des.c index 7fe96ca765..dbd12e5aad 100644 --- a/sunrpc/auth_des.c +++ b/sunrpc/auth_des.c @@ -174,7 +174,7 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window, if (key_gendes (&auth->ah_key) < 0) { debug ("authdes_create: unable to gen conversation key"); - return NULL; + goto failed; } } else diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c index f58d3b2a8b..023ae1723b 100644 --- a/sunrpc/bindrsvprt.c +++ b/sunrpc/bindrsvprt.c @@ -74,14 +74,13 @@ bindresvport (int sd, struct sockaddr_in *sin) int res = -1; int nports = ENDPORT - startport + 1; + int endport = ENDPORT; again: for (i = 0; i < nports; ++i) { sin->sin_port = htons (port++); - if (port > ENDPORT) - { - port = startport; - } + if (port > endport) + port = startport; res = __bind (sd, sin, sizeof (struct sockaddr_in)); if (res >= 0 || errno != EADDRINUSE) break; @@ -90,7 +89,9 @@ bindresvport (int sd, struct sockaddr_in *sin) if (i == nports && startport != LOWPORT) { startport = LOWPORT; + endport = STARTPORT - 1; nports = STARTPORT - LOWPORT; + port = LOWPORT + port % (STARTPORT - LOWPORT); goto again; } diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c index 4e2832ff56..08d9601212 100644 --- a/sunrpc/rpc_clntout.c +++ b/sunrpc/rpc_clntout.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char clntout_rcsid[] = - "$Id$"; -#endif /* * rpc_clntout.c, Client-stub outputter for the RPC protocol compiler diff --git a/sunrpc/rpc_cout.c b/sunrpc/rpc_cout.c index a803feb65a..dfc57fd277 100644 --- a/sunrpc/rpc_cout.c +++ b/sunrpc/rpc_cout.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char cout_rcsid[] = -"$Id$"; -#endif /* * rpc_cout.c, XDR routine outputter for the RPC protocol compiler diff --git a/sunrpc/rpc_hout.c b/sunrpc/rpc_hout.c index 38cb419527..270d149a6e 100644 --- a/sunrpc/rpc_hout.c +++ b/sunrpc/rpc_hout.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char hout_rcsid[] = - "$Id$"; -#endif /* * rpc_hout.c, Header file outputter for the RPC protocol compiler diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c index acc0132603..2679720a7f 100644 --- a/sunrpc/rpc_main.c +++ b/sunrpc/rpc_main.c @@ -31,10 +31,6 @@ /* * From @(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI; */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char main_rcsid[] = - "$Id$"; -#endif /* * rpc_main.c, Top level of the RPC protocol compiler. diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c index 7115cbdd08..2a29878d6a 100644 --- a/sunrpc/rpc_parse.c +++ b/sunrpc/rpc_parse.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char parse_rcsid[] = - "$Id$"; -#endif /* * rpc_parse.c, Parser for the RPC protocol compiler diff --git a/sunrpc/rpc_sample.c b/sunrpc/rpc_sample.c index 50c3d5554b..00b58d5bc2 100644 --- a/sunrpc/rpc_sample.c +++ b/sunrpc/rpc_sample.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_sample.c 1.1 90/08/30 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char sample_rcsid[] = - "$Id$"; -#endif /* * rpc_sample.c, Sample client-server code outputter for the RPC protocol compiler diff --git a/sunrpc/rpc_scan.c b/sunrpc/rpc_scan.c index d6211e9105..42ab2bae8b 100644 --- a/sunrpc/rpc_scan.c +++ b/sunrpc/rpc_scan.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char scan_rcsid[] = - "$Id$"; -#endif /* * rpc_scan.c, Scanner for the RPC protocol compiler diff --git a/sunrpc/rpc_svcout.c b/sunrpc/rpc_svcout.c index 9a807c4096..6774cc8c0f 100644 --- a/sunrpc/rpc_svcout.c +++ b/sunrpc/rpc_svcout.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char svcout_rcsid[] = - "$Id$"; -#endif /* * rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler diff --git a/sunrpc/rpc_tblout.c b/sunrpc/rpc_tblout.c index bf4037fc37..8fd2b1267d 100644 --- a/sunrpc/rpc_tblout.c +++ b/sunrpc/rpc_tblout.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_tblout.c 1.4 89/02/22 (C) 1988 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char tblout_rcsid[] = - "$Id$"; -#endif /* * rpc_tblout.c, Dispatch table outputter for the RPC protocol compiler diff --git a/sunrpc/rpc_util.c b/sunrpc/rpc_util.c index 31e1d3143c..b910401a31 100644 --- a/sunrpc/rpc_util.c +++ b/sunrpc/rpc_util.c @@ -31,10 +31,6 @@ /* * From: @(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI */ -#if defined(LIBC_SCCS) && !defined(lint) -static const char util_rcsid[] = - "$Id$"; -#endif /* * rpc_util.c, Utility routines for the RPC protocol compiler diff --git a/sysdeps/alpha/fpu/s_cacosf.c b/sysdeps/alpha/fpu/s_cacosf.c index 20e67f4ac9..46dca5aeb8 100644 --- a/sysdeps/alpha/fpu/s_cacosf.c +++ b/sysdeps/alpha/fpu/s_cacosf.c @@ -1,5 +1,5 @@ /* Return arc cosine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_cacosf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __cacosf diff --git a/sysdeps/alpha/fpu/s_cacoshf.c b/sysdeps/alpha/fpu/s_cacoshf.c index 86cb4fbcaa..6b61d1ddaa 100644 --- a/sysdeps/alpha/fpu/s_cacoshf.c +++ b/sysdeps/alpha/fpu/s_cacoshf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_cacoshf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __cacoshf diff --git a/sysdeps/alpha/fpu/s_casinf.c b/sysdeps/alpha/fpu/s_casinf.c index 3d0d4eadf2..fd41042ec9 100644 --- a/sysdeps/alpha/fpu/s_casinf.c +++ b/sysdeps/alpha/fpu/s_casinf.c @@ -1,5 +1,5 @@ /* Return arc sine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_casinf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __casinf diff --git a/sysdeps/alpha/fpu/s_casinhf.c b/sysdeps/alpha/fpu/s_casinhf.c index 698ce10c04..0b72a24d5a 100644 --- a/sysdeps/alpha/fpu/s_casinhf.c +++ b/sysdeps/alpha/fpu/s_casinhf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole sine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_casinhf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __casinhf diff --git a/sysdeps/alpha/fpu/s_catanf.c b/sysdeps/alpha/fpu/s_catanf.c index 221a461c1b..8f40616617 100644 --- a/sysdeps/alpha/fpu/s_catanf.c +++ b/sysdeps/alpha/fpu/s_catanf.c @@ -1,5 +1,5 @@ /* Return arc tangent of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_catanf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __catanf diff --git a/sysdeps/alpha/fpu/s_catanhf.c b/sysdeps/alpha/fpu/s_catanhf.c index 7465a43cac..ac11945727 100644 --- a/sysdeps/alpha/fpu/s_catanhf.c +++ b/sysdeps/alpha/fpu/s_catanhf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole tangent of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_catanhf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __catanhf diff --git a/sysdeps/alpha/fpu/s_ccosf.c b/sysdeps/alpha/fpu/s_ccosf.c index fd775903f0..04036f4613 100644 --- a/sysdeps/alpha/fpu/s_ccosf.c +++ b/sysdeps/alpha/fpu/s_ccosf.c @@ -1,5 +1,5 @@ /* Return cosine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_ccosf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __ccosf diff --git a/sysdeps/alpha/fpu/s_ccoshf.c b/sysdeps/alpha/fpu/s_ccoshf.c index 0e8eab288f..e9fb34ce47 100644 --- a/sysdeps/alpha/fpu/s_ccoshf.c +++ b/sysdeps/alpha/fpu/s_ccoshf.c @@ -1,5 +1,5 @@ /* Return hyperbole cosine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_ccoshf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __ccoshf diff --git a/sysdeps/alpha/fpu/s_cexpf.c b/sysdeps/alpha/fpu/s_cexpf.c index 2cf6db4b55..4a28dcd9bf 100644 --- a/sysdeps/alpha/fpu/s_cexpf.c +++ b/sysdeps/alpha/fpu/s_cexpf.c @@ -1,5 +1,5 @@ /* Return exponent of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_cexpf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __cexpf diff --git a/sysdeps/alpha/fpu/s_clog10f.c b/sysdeps/alpha/fpu/s_clog10f.c index 12ecdea957..e7dc7bb23f 100644 --- a/sysdeps/alpha/fpu/s_clog10f.c +++ b/sysdeps/alpha/fpu/s_clog10f.c @@ -1,5 +1,5 @@ /* Return base 10 logarithm of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_clog10f (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __clog10f diff --git a/sysdeps/alpha/fpu/s_clogf.c b/sysdeps/alpha/fpu/s_clogf.c index 9eefe9fa30..364dcec883 100644 --- a/sysdeps/alpha/fpu/s_clogf.c +++ b/sysdeps/alpha/fpu/s_clogf.c @@ -1,5 +1,5 @@ /* Return natural logarithm of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_clogf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __clogf diff --git a/sysdeps/alpha/fpu/s_cpowf.c b/sysdeps/alpha/fpu/s_cpowf.c index f4cb3547f6..cc61b1895e 100644 --- a/sysdeps/alpha/fpu/s_cpowf.c +++ b/sysdeps/alpha/fpu/s_cpowf.c @@ -1,5 +1,5 @@ /* Return power of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_cpowf (_Complex float x, _Complex float c); -#include +#include #include "cfloat-compat.h" #undef __cpowf diff --git a/sysdeps/alpha/fpu/s_cprojf.c b/sysdeps/alpha/fpu/s_cprojf.c index eac8687707..5cfb526679 100644 --- a/sysdeps/alpha/fpu/s_cprojf.c +++ b/sysdeps/alpha/fpu/s_cprojf.c @@ -1,5 +1,5 @@ /* Return projection of complex float value to Riemann sphere. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_cprojf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __cprojf diff --git a/sysdeps/alpha/fpu/s_csinf.c b/sysdeps/alpha/fpu/s_csinf.c index eba70e9930..8eb9a1019d 100644 --- a/sysdeps/alpha/fpu/s_csinf.c +++ b/sysdeps/alpha/fpu/s_csinf.c @@ -1,5 +1,5 @@ /* Return sine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_csinf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __csinf diff --git a/sysdeps/alpha/fpu/s_csinhf.c b/sysdeps/alpha/fpu/s_csinhf.c index 9db81a81e4..0e2c186740 100644 --- a/sysdeps/alpha/fpu/s_csinhf.c +++ b/sysdeps/alpha/fpu/s_csinhf.c @@ -1,5 +1,5 @@ /* Return hyperbole sine of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_csinhf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __csinhf diff --git a/sysdeps/alpha/fpu/s_csqrtf.c b/sysdeps/alpha/fpu/s_csqrtf.c index cc4a8e0245..ebf23a828e 100644 --- a/sysdeps/alpha/fpu/s_csqrtf.c +++ b/sysdeps/alpha/fpu/s_csqrtf.c @@ -1,5 +1,5 @@ /* Return square root of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_csqrtf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __csqrtf diff --git a/sysdeps/alpha/fpu/s_ctanf.c b/sysdeps/alpha/fpu/s_ctanf.c index 843ee53717..e26db963e4 100644 --- a/sysdeps/alpha/fpu/s_ctanf.c +++ b/sysdeps/alpha/fpu/s_ctanf.c @@ -1,5 +1,5 @@ /* Return tangent of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_ctanf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __ctanf diff --git a/sysdeps/alpha/fpu/s_ctanhf.c b/sysdeps/alpha/fpu/s_ctanhf.c index f1f74ab12d..5d047bd460 100644 --- a/sysdeps/alpha/fpu/s_ctanhf.c +++ b/sysdeps/alpha/fpu/s_ctanhf.c @@ -1,5 +1,5 @@ /* Return hyperbole tangent of complex float value. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ static _Complex float internal_ctanhf (_Complex float x); -#include +#include #include "cfloat-compat.h" #undef __ctanhf diff --git a/sysdeps/alpha/libc-tls.c b/sysdeps/alpha/libc-tls.c index a3b68e928f..24629e9aca 100644 --- a/sysdeps/alpha/libc-tls.c +++ b/sysdeps/alpha/libc-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. Alpha version. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2005 Free Software 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,7 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include #include #if USE_TLS diff --git a/sysdeps/alpha/strncmp.S b/sysdeps/alpha/strncmp.S index e2b4ebf857..ff199eb743 100644 --- a/sysdeps/alpha/strncmp.S +++ b/sysdeps/alpha/strncmp.S @@ -61,8 +61,10 @@ $aligned: ornot t0, t3, t0 # .. e1 : cmpbge zero, t1, t7 # e0 : bits set iff null found beq a2, $eoc # .. e1 : check end of count - subq a2, 1, a2 # e0 : + unop # e0 : bne t7, $eos # .. e1 : + unop # e0 : + beq t10, $ant_loop # .. e1 : /* Aligned compare main loop. On entry to this basic block: @@ -74,13 +76,30 @@ $a_loop: bne t2, $wordcmp # .. e1 (zdb) ldq_u t1, 8(a1) # e0 : ldq_u t0, 8(a0) # .. e1 : + subq a2, 1, a2 # e0 : + addq a1, 8, a1 # .. e1 : + addq a0, 8, a0 # e0 : + beq a2, $eoc # .. e1 : + cmpbge zero, t1, t7 # e0 : + beq t7, $a_loop # .. e1 : + unop # e0 : + br $eos # .. e1 : + + /* Alternate aligned compare loop, for when there's no trailing + bytes on the count. We have to avoid reading too much data. */ +$ant_loop: + xor t0, t1, t2 # e0 : + bne t2, $wordcmp # .. e1 (zdb) + subq a2, 1, a2 # e0 : + beq a2, $zerolength # .. e1 : + ldq_u t1, 8(a1) # e0 : + ldq_u t0, 8(a0) # .. e1 : addq a1, 8, a1 # e0 : addq a0, 8, a0 # .. e1 : cmpbge zero, t1, t7 # e0 : - beq a2, $eoc # .. e1 : - subq a2, 1, a2 # e0 : - beq t7, $a_loop # .. e1 : - br $eos # e1 : + beq t7, $ant_loop # .. e1 : + unop # e0 : + br $eos # .. e1 : /* The two strings are not co-aligned. Align s1 and cope. */ $unaligned: @@ -184,6 +203,8 @@ $u_final: $eoc: mskql t0, t10, t0 mskql t1, t10, t1 + unop + cmpbge zero, t1, t7 /* We've found a zero somewhere in a word we just read. On entry to this basic block: @@ -203,6 +224,7 @@ $eos: /* Here we have two differing co-aligned words in t0 & t1. Bytewise compare them and return (t0 > t1 ? 1 : -1). */ + .align 3 $wordcmp: cmpbge t0, t1, t2 # e0 : comparison yields bit mask of ge cmpbge t1, t0, t3 # .. e1 : @@ -216,6 +238,7 @@ $wordcmp: $done: ret # e1 : + .align 3 $zerolength: clr v0 ret diff --git a/sysdeps/generic/Dist b/sysdeps/generic/Dist index 549b616fb5..e93e7b30b1 100644 --- a/sysdeps/generic/Dist +++ b/sysdeps/generic/Dist @@ -1,6 +1,3 @@ -signame.c -signame.h -det_endian.c dl-brk.c dl-sbrk.c entry.h diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile index d741864b9c..972d469737 100644 --- a/sysdeps/generic/Makefile +++ b/sysdeps/generic/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1992,93,94,95,96,97,99,2002 Free Software Foundation, Inc. +# Copyright (C) 1992,93,94,95,96,97,99,2002,2005 +# Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -16,21 +17,6 @@ # 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 deleted file mode 100644 index 8a61ff6770..0000000000 --- a/sysdeps/generic/__longjmp.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/_exit.c b/sysdeps/generic/_exit.c deleted file mode 100644 index 673667df30..0000000000 --- a/sysdeps/generic/_exit.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c deleted file mode 100644 index f6f16ff2af..0000000000 --- a/sysdeps/generic/_strerror.c +++ /dev/null @@ -1,67 +0,0 @@ -/* 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 -#include -#include -#include -#include - -/* It is critical here that we always use the `dcgettext' function for - the message translation. Since only defines the macro - `dgettext' to use `dcgettext' for optimizing programs this is not - always guaranteed. */ -#ifndef dgettext -# include /* 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 deleted file mode 100644 index 00788f22c7..0000000000 --- a/sysdeps/generic/abort.c +++ /dev/null @@ -1,140 +0,0 @@ -/* 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 -#include -#include -#include -#include -#include - -/* Try to get a machine dependent instruction which will make the - program crash. This is used in case everything else fails. */ -#include -#ifndef ABORT_INSTRUCTION -/* No such instruction is available. */ -# define ABORT_INSTRUCTION -#endif - -#ifdef USE_IN_LIBIO -# include -# 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 deleted file mode 100644 index dad34ceddd..0000000000 --- a/sysdeps/generic/accept.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/access.c b/sysdeps/generic/access.c deleted file mode 100644 index c266e945a9..0000000000 --- a/sysdeps/generic/access.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/acct.c b/sysdeps/generic/acct.c deleted file mode 100644 index b626b5d938..0000000000 --- a/sysdeps/generic/acct.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/add_n.c b/sysdeps/generic/add_n.c deleted file mode 100644 index 5fcb7e4835..0000000000 --- a/sysdeps/generic/add_n.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 deleted file mode 100644 index 746ae31307..0000000000 --- a/sysdeps/generic/addmul_1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 deleted file mode 100644 index 8645652188..0000000000 --- a/sysdeps/generic/adjtime.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/aio_cancel.c b/sysdeps/generic/aio_cancel.c deleted file mode 100644 index c24a2f7529..0000000000 --- a/sysdeps/generic/aio_cancel.c +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 -/* And undo the hack. */ -#undef aio_cancel64 - -#include - -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 diff --git a/sysdeps/generic/aio_fsync.c b/sysdeps/generic/aio_fsync.c deleted file mode 100644 index bc23d75f69..0000000000 --- a/sysdeps/generic/aio_fsync.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 -/* And undo the hack. */ -#undef aio_fsync64 - -#include -#include - -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 diff --git a/sysdeps/generic/aio_misc.c b/sysdeps/generic/aio_misc.c deleted file mode 100644 index c29b8d0eae..0000000000 --- a/sysdeps/generic/aio_misc.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 2c79ee6c2f..0000000000 --- a/sysdeps/generic/aio_notify.c +++ /dev/null @@ -1,24 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index db1d19f3d7..0000000000 --- a/sysdeps/generic/aio_read.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -#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 diff --git a/sysdeps/generic/aio_read64.c b/sysdeps/generic/aio_read64.c deleted file mode 100644 index c1292352af..0000000000 --- a/sysdeps/generic/aio_read64.c +++ /dev/null @@ -1,2 +0,0 @@ -#define BE_AIO64 -#include "aio_read.c" diff --git a/sysdeps/generic/aio_sigqueue.c b/sysdeps/generic/aio_sigqueue.c deleted file mode 100644 index e824c6b3de..0000000000 --- a/sysdeps/generic/aio_sigqueue.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -#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 diff --git a/sysdeps/generic/aio_suspend.c b/sysdeps/generic/aio_suspend.c deleted file mode 100644 index 0530f0019c..0000000000 --- a/sysdeps/generic/aio_suspend.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -/* And undo the hack. */ -#undef aio_suspend64 - -#include -#include - - -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 diff --git a/sysdeps/generic/aio_write.c b/sysdeps/generic/aio_write.c deleted file mode 100644 index bc62fcb469..0000000000 --- a/sysdeps/generic/aio_write.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -#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 diff --git a/sysdeps/generic/aio_write64.c b/sysdeps/generic/aio_write64.c deleted file mode 100644 index bb1693eeee..0000000000 --- a/sysdeps/generic/aio_write64.c +++ /dev/null @@ -1,2 +0,0 @@ -#define BE_AIO64 -#include "aio_write.c" diff --git a/sysdeps/generic/alarm.c b/sysdeps/generic/alarm.c deleted file mode 100644 index 1f0cceb58e..0000000000 --- a/sysdeps/generic/alarm.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/allocrtsig.c b/sysdeps/generic/allocrtsig.c deleted file mode 100644 index ac8d2b6bfe..0000000000 --- a/sysdeps/generic/allocrtsig.c +++ /dev/null @@ -1,96 +0,0 @@ -/* 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 , 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 - -/* 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 - -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 deleted file mode 100644 index fe84aec2f1..0000000000 --- a/sysdeps/generic/alphasort64.c +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 -#include - -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 deleted file mode 100644 index f2d52372d5..0000000000 --- a/sysdeps/generic/backtrace.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Return backtrace of current program state. Generic version. - Copyright (C) 1998, 2000, 2002, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include -#include -#include -#include - -/* 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) -libc_hidden_def (__backtrace) diff --git a/sysdeps/generic/backtracesyms.c b/sysdeps/generic/backtracesyms.c deleted file mode 100644 index db7ba36d0f..0000000000 --- a/sysdeps/generic/backtracesyms.c +++ /dev/null @@ -1,58 +0,0 @@ -/* 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 , 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 -#include -#include - - -/* 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]". */ - 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 deleted file mode 100644 index b01f8b0094..0000000000 --- a/sysdeps/generic/backtracesymsfd.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Write formatted list with names for addresses in backtrace to a file. - Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include - -#include -#include - -#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) -libc_hidden_def (__backtrace_symbols_fd) diff --git a/sysdeps/generic/bb_init_func.c b/sysdeps/generic/bb_init_func.c deleted file mode 100644 index 19901d8d09..0000000000 --- a/sysdeps/generic/bb_init_func.c +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 -#include - -#include - -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 deleted file mode 100644 index 3f16b884ac..0000000000 --- a/sysdeps/generic/bcopy.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 - -#define memmove bcopy -#define rettype void -#define RETURN(s) return -#define a1 src -#define a1const const -#define a2 dest -#define a2const - -#include diff --git a/sysdeps/generic/bind.c b/sysdeps/generic/bind.c deleted file mode 100644 index 382e29db16..0000000000 --- a/sysdeps/generic/bind.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/brdinit.c b/sysdeps/generic/brdinit.c deleted file mode 100644 index af96bcd12a..0000000000 --- a/sysdeps/generic/brdinit.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index b951819f21..0000000000 --- a/sysdeps/generic/brk.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/bsd-_setjmp.c b/sysdeps/generic/bsd-_setjmp.c deleted file mode 100644 index 884a4da9b6..0000000000 --- a/sysdeps/generic/bsd-_setjmp.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index 15f3f153cc..0000000000 --- a/sysdeps/generic/bsd-setjmp.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index c6ede14139..0000000000 --- a/sysdeps/generic/bzero.c +++ /dev/null @@ -1,83 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index 956db76ba1..0000000000 --- a/sysdeps/generic/cabsf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 -#include - -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 deleted file mode 100644 index df1f20bc48..0000000000 --- a/sysdeps/generic/cargf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 -#include - -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 deleted file mode 100644 index afaeef8787..0000000000 --- a/sysdeps/generic/chdir.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/check_fds.c b/sysdeps/generic/check_fds.c deleted file mode 100644 index 10ba3da395..0000000000 --- a/sysdeps/generic/check_fds.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright (C) 2000, 2002, 2003, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include -#include - -/* Try to get a machine dependent instruction which will make the - program crash. This is used in case everything else fails. */ -#include -#ifndef ABORT_INSTRUCTION -/* No such instruction is available. */ -# define ABORT_INSTRUCTION -#endif - -#include -#include - - -/* 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) - { - const char *name; - dev_t dev; - - /* For writable descriptors we use /dev/full. */ - if ((mode & O_ACCMODE) == O_WRONLY) - { - name = _PATH_DEV "full"; - dev = makedev (DEV_FULL_MAJOR, DEV_FULL_MINOR); - } - else - { - name = _PATH_DEVNULL; - dev = makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR); - } - - /* 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 (name, 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. */ - struct stat64 st; - if (__builtin_expect (nullfd != fd, 0) - || __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0 - || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0 - || st.st_rdev != dev) - /* 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_WRONLY | O_NOFOLLOW); - check_one_fd (STDOUT_FILENO, O_RDONLY | O_NOFOLLOW); - check_one_fd (STDERR_FILENO, O_RDONLY | O_NOFOLLOW); -} diff --git a/sysdeps/generic/check_pf.c b/sysdeps/generic/check_pf.c deleted file mode 100644 index 5d98c98aff..0000000000 --- a/sysdeps/generic/check_pf.c +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 -#include - - -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 deleted file mode 100644 index b678121265..0000000000 --- a/sysdeps/generic/chflags.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/chmod.c b/sysdeps/generic/chmod.c deleted file mode 100644 index 38b05127c9..0000000000 --- a/sysdeps/generic/chmod.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/chown.c b/sysdeps/generic/chown.c deleted file mode 100644 index 0e368f2ac4..0000000000 --- a/sysdeps/generic/chown.c +++ /dev/null @@ -1,45 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/chroot.c b/sysdeps/generic/chroot.c deleted file mode 100644 index f20ccf4c2b..0000000000 --- a/sysdeps/generic/chroot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/cimagf.c b/sysdeps/generic/cimagf.c deleted file mode 100644 index d4e441e69f..0000000000 --- a/sysdeps/generic/cimagf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - -float -__cimagf (float _Complex z) -{ - return __imag__ z; -} -weak_alias (__cimagf, cimagf) diff --git a/sysdeps/generic/clock.c b/sysdeps/generic/clock.c deleted file mode 100644 index 99dc5f47e0..0000000000 --- a/sysdeps/generic/clock.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/clock_getcpuclockid.c b/sysdeps/generic/clock_getcpuclockid.c deleted file mode 100644 index 39c7e55f66..0000000000 --- a/sysdeps/generic/clock_getcpuclockid.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include -#include - -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 deleted file mode 100644 index f5978da380..0000000000 --- a/sysdeps/generic/clock_getres.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* Get resolution of clock. */ -int -clock_getres (clockid_t clock_id, struct timespec *res) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (clock_getres) -#include diff --git a/sysdeps/generic/clock_gettime.c b/sysdeps/generic/clock_gettime.c deleted file mode 100644 index ff306120ba..0000000000 --- a/sysdeps/generic/clock_gettime.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1999, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include - -/* 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; -} -librt_hidden_def (clock_gettime) -stub_warning (clock_gettime) -#include diff --git a/sysdeps/generic/clock_nanosleep.c b/sysdeps/generic/clock_nanosleep.c deleted file mode 100644 index cff1c2570a..0000000000 --- a/sysdeps/generic/clock_nanosleep.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - - -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 diff --git a/sysdeps/generic/clock_settime.c b/sysdeps/generic/clock_settime.c deleted file mode 100644 index 9d6a92e058..0000000000 --- a/sysdeps/generic/clock_settime.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/close.c b/sysdeps/generic/close.c deleted file mode 100644 index 0856ba851b..0000000000 --- a/sysdeps/generic/close.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/closedir.c b/sysdeps/generic/closedir.c deleted file mode 100644 index 4410f02fb3..0000000000 --- a/sysdeps/generic/closedir.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/cmp.c b/sysdeps/generic/cmp.c deleted file mode 100644 index 8e9792f54e..0000000000 --- a/sysdeps/generic/cmp.c +++ /dev/null @@ -1,56 +0,0 @@ -/* 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 deleted file mode 100755 index 47f9ec0d5e..0000000000 --- a/sysdeps/generic/configure +++ /dev/null @@ -1,108 +0,0 @@ -# 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 declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 deleted file mode 100644 index 393bc307e8..0000000000 --- a/sysdeps/generic/configure.in +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 7893891933..0000000000 --- a/sysdeps/generic/conjf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - -float _Complex -__conjf (float _Complex z) -{ - return ~z; -} -weak_alias (__conjf, conjf) diff --git a/sysdeps/generic/connect.c b/sysdeps/generic/connect.c deleted file mode 100644 index 55093313c9..0000000000 --- a/sysdeps/generic/connect.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/console.c b/sysdeps/generic/console.c deleted file mode 100644 index 326ebed4a1..0000000000 --- a/sysdeps/generic/console.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index e3235a874f..0000000000 --- a/sysdeps/generic/crealf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - -float -__crealf (float _Complex z) -{ - return __real__ z; -} -weak_alias (__crealf, crealf) diff --git a/sysdeps/generic/creat.c b/sysdeps/generic/creat.c deleted file mode 100644 index 462882415c..0000000000 --- a/sysdeps/generic/creat.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -#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 deleted file mode 100644 index 39f4580571..0000000000 --- a/sysdeps/generic/creat64.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index e4d94eada2..0000000000 --- a/sysdeps/generic/ctermid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/cuserid.c b/sysdeps/generic/cuserid.c deleted file mode 100644 index 826972f4de..0000000000 --- a/sysdeps/generic/cuserid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/dbl2mpn.c b/sysdeps/generic/dbl2mpn.c deleted file mode 100644 index 773ca4fd6a..0000000000 --- a/sysdeps/generic/dbl2mpn.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 deleted file mode 100644 index 4c86be3a85..0000000000 --- a/sysdeps/generic/det_endian.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 - -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 deleted file mode 100644 index 06c0cde435..0000000000 --- a/sysdeps/generic/dirfd.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -int -dirfd (dirp) - DIR *dirp; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (dirfd) -#include diff --git a/sysdeps/generic/div.c b/sysdeps/generic/div.c deleted file mode 100644 index 5268f4c494..0000000000 --- a/sysdeps/generic/div.c +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 50b97db72f..0000000000 --- a/sysdeps/generic/divmod_1.c +++ /dev/null @@ -1,208 +0,0 @@ -/* 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 deleted file mode 100644 index 609f3d789c..0000000000 --- a/sysdeps/generic/divrem.c +++ /dev/null @@ -1,245 +0,0 @@ -/* 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 deleted file mode 100644 index c37cdfec33..0000000000 --- a/sysdeps/generic/dl-brk.c +++ /dev/null @@ -1,5 +0,0 @@ -/* We can use the normal code but we also know the __curbrk is not exported - from ld.so. */ -extern void *__curbrk attribute_hidden; - -#include diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c deleted file mode 100644 index 29886e194a..0000000000 --- a/sysdeps/generic/dl-cache.c +++ /dev/null @@ -1,311 +0,0 @@ -/* 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 -#include -#include -#include -#include -#include - -#include - -#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-environ.c b/sysdeps/generic/dl-environ.c deleted file mode 100644 index 089e89e6e7..0000000000 --- a/sysdeps/generic/dl-environ.c +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 deleted file mode 100644 index 6dce21e7a1..0000000000 --- a/sysdeps/generic/dl-execstack.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 78beecfdcb..0000000000 --- a/sysdeps/generic/dl-fptr.c +++ /dev/null @@ -1,323 +0,0 @@ -/* 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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-origin.c b/sysdeps/generic/dl-origin.c deleted file mode 100644 index 87619379bc..0000000000 --- a/sysdeps/generic/dl-origin.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 , 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 -#include -#include -#include - -#include - - -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-sbrk.c b/sysdeps/generic/dl-sbrk.c deleted file mode 100644 index 4713a92694..0000000000 --- a/sysdeps/generic/dl-sbrk.c +++ /dev/null @@ -1,5 +0,0 @@ -/* We can use the normal code but we also know the __curbrk is not exported - from ld.so. */ -extern void *__curbrk attribute_hidden; - -#include diff --git a/sysdeps/generic/dl-symaddr.c b/sysdeps/generic/dl-symaddr.c deleted file mode 100644 index 3c850ca835..0000000000 --- a/sysdeps/generic/dl-symaddr.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -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 deleted file mode 100644 index 985e2b8f77..0000000000 --- a/sysdeps/generic/dl-sysdep.c +++ /dev/null @@ -1,590 +0,0 @@ -/* Operating system support for run-time dynamic linker. Generic Unix version. - Copyright (C) 1995-1998, 2000-2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef _DL_FIRST_PLATFORM -# define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT) -#else -# define _DL_FIRST_EXTRA _DL_HWCAP_COUNT -#endif - -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 = (void *) av->a_un.a_val; - 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) = (void *) av->a_un.a_val; - break; - case AT_HWCAP: - GLRO(dl_hwcap) = (unsigned long int) 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) = (void *) av->a_un.a_val; - break; -#endif -#ifdef DL_PLATFORM_AUXV - DL_PLATFORM_AUXV -#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 = (char *) av->a_un.a_val; - - 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. */ - uint64_t 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; (~((1ULL << n) - 1) & masked) != 0; ++n) - if ((masked & (1ULL << n)) != 0) - ++cnt; - -#if (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO) && defined SHARED - /* The system-supplied DSO can contain a note of type 2, vendor "GNU". - This gives us a list of names to treat as fake hwcap bits. */ - - const char *dsocaps = NULL; - size_t dsocapslen = 0; - if (GLRO(dl_sysinfo_map) != NULL) - { - const ElfW(Phdr) *const phdr = GLRO(dl_sysinfo_map)->l_phdr; - const ElfW(Word) phnum = GLRO(dl_sysinfo_map)->l_phnum; - for (uint_fast16_t i = 0; i < phnum; ++i) - if (phdr[i].p_type == PT_NOTE) - { - const ElfW(Addr) start = (phdr[i].p_vaddr - + GLRO(dl_sysinfo_map)->l_addr); - const struct - { - ElfW(Word) vendorlen; - ElfW(Word) datalen; - ElfW(Word) type; - } *note = (const void *) start; - while ((ElfW(Addr)) (note + 1) - start < phdr[i].p_memsz) - { -#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word))) - if (note->type == 2 - && note->vendorlen == sizeof "GNU" - && !memcmp ((note + 1), "GNU", sizeof "GNU") - && note->datalen > 2 * sizeof (ElfW(Word)) + 2) - { - const ElfW(Word) *p = ((const void *) (note + 1) - + ROUND (sizeof "GNU")); - cnt += *p++; - ++p; /* Skip mask word. */ - dsocaps = (const char *) p; - dsocapslen = note->datalen - sizeof *p * 2; - break; - } - note = ((const void *) (note + 1) - + ROUND (note->vendorlen) + ROUND (note->datalen)); - } - if (dsocaps != NULL) - break; - } - } -#endif - -#ifdef USE_TLS - /* For TLS enabled builds always add 'tls'. */ - ++cnt; -#else - if (cnt == 0) - { - /* If we no 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; -#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO - if (dsocaps != NULL) - { - const ElfW(Word) mask = ((const ElfW(Word) *) dsocaps)[-1]; - GLRO(dl_hwcap) |= (uint64_t) mask << _DL_FIRST_EXTRA; - size_t len; - for (const char *p = dsocaps; p < dsocaps + dsocapslen; p += len + 1) - { - uint_fast8_t bit = *p++; - len = strlen (p); - - /* Skip entries that are not enabled in the mask word. */ - if (__builtin_expect (mask & ((ElfW(Word)) 1 << bit), 1)) - { - temp[m].str = p; - temp[m].len = len; - ++m; - } - else - --cnt; - } - } -#endif - for (n = 0; masked != 0; ++n) - if ((masked & (1ULL << n)) != 0) - { - temp[m].str = _dl_hwcap_string (n); - temp[m].len = strlen (temp[m].str); - masked ^= 1ULL << 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 half starts right after the first part of the string of - the 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-tls.c b/sysdeps/generic/dl-tls.c deleted file mode 100644 index 4fed570d5c..0000000000 --- a/sysdeps/generic/dl-tls.c +++ /dev/null @@ -1,799 +0,0 @@ -/* Thread-local storage handling in the ELF dynamic linker. Generic version. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -/* We don't need any of this if TLS is not supported. */ -#ifdef USE_TLS - -# include -# include - -/* 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. - - NB: the offset +1 is due to the fact that DTV[0] is used - for something else. */ - result = GL(dl_tls_static_nelem) + 1; - if (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) + 1); - /* 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) -{ - size_t max_align = TLS_TCB_ALIGN; - size_t freetop = 0; - size_t freebottom = 0; - - /* 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); - - struct dtv_slotinfo *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. */ - size_t offset = 0; - - for (size_t cnt = 0; 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. */ - size_t offset = TLS_TCB_SIZE; - - for (size_t cnt = 0; 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; - size_t maxgen = 0; - - /* We have to 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; - - /* Keep track of the maximum generation number. This might - not be the generation counter. */ - maxgen = MAX (maxgen, listp->slotinfo[cnt].gen); - - 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.val = TLS_DTV_UNALLOCATED; - dtv[map->l_tls_modid].pointer.is_static = false; - 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.val = dest; - dtv[map->l_tls_modid].pointer.is_static = true; - 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); - } - - /* The DTV version is up-to-date now. */ - dtv[0].counter = maxgen; - - 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); - - /* We need to free the memory allocated for non-static TLS. */ - for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt) - if (! dtv[1 + cnt].pointer.is_static - && dtv[1 + cnt].pointer.val != TLS_DTV_UNALLOCATED) - free (dtv[1 + cnt].pointer.val); - - /* 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; -} - - -struct link_map * -_dl_update_slotinfo (unsigned long int req_modid) -{ - struct link_map *the_map = NULL; - dtv_t *dtv = THREAD_DTV (); - - /* 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. */ - unsigned long int idx = req_modid; - struct dtv_slotinfo_list *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 - { - for (size_t cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt) - { - size_t gen = listp->slotinfo[cnt].gen; - - 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. */ - struct link_map *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.is_static - && dtv[total + cnt].pointer.val != TLS_DTV_UNALLOCATED) - { - free (dtv[total + cnt].pointer.val); - dtv[total + cnt].pointer.val = TLS_DTV_UNALLOCATED; - } - - continue; - } - - /* Check whether the current dtv array is large enough. */ - size_t 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.is_static - && dtv[modid].pointer.val != 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.val); - - /* This module is loaded dynamically- We defer memory - allocation. */ - dtv[modid].pointer.is_static = false; - dtv[modid].pointer.val = TLS_DTV_UNALLOCATED; - - if (modid == req_modid) - the_map = map; - } - - total += listp->len; - } - while ((listp = listp->next) != NULL); - - /* This will be the new maximum generation counter. */ - dtv[0].counter = new_gen; - } - - return the_map; -} - - -/* 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)) - the_map = _dl_update_slotinfo (GET_ADDR_MODULE); - - p = dtv[GET_ADDR_MODULE].pointer.val; - - 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.val = allocate_and_init (the_map); - dtv[GET_ADDR_MODULE].pointer.is_static = false; - } - - return (char *) p + GET_ADDR_OFFSET; -} -# endif - - - -void -_dl_add_to_slotinfo (struct link_map *l) -{ - /* Now that we know the object is loaded successfully add - modules containing TLS data to the dtv info table. We - might have to increase its size. */ - struct dtv_slotinfo_list *listp; - struct dtv_slotinfo_list *prevp; - size_t idx = l->l_tls_modid; - - /* Find the place in the dtv slotinfo list. */ - listp = GL(dl_tls_dtv_slotinfo_list); - prevp = NULL; /* Needed to shut up gcc. */ - do - { - /* Does it fit in the array of this list element? */ - if (idx < listp->len) - break; - idx -= listp->len; - prevp = listp; - listp = listp->next; - } - while (listp != NULL); - - if (listp == NULL) - { - /* When we come here it means we have to add a new element - to the slotinfo list. And the new module must be in - the first slot. */ - assert (idx == 0); - - listp = prevp->next = (struct dtv_slotinfo_list *) - malloc (sizeof (struct dtv_slotinfo_list) - + TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo)); - if (listp == NULL) - { - /* We ran out of memory. We will simply fail this - call but don't undo anything we did so far. The - application will crash or be terminated anyway very - soon. */ - - /* We have to do this since some entries in the dtv - slotinfo array might already point to this - generation. */ - ++GL(dl_tls_generation); - - _dl_signal_error (ENOMEM, "dlopen", NULL, N_("\ -cannot create TLS data structures")); - } - - listp->len = TLS_SLOTINFO_SURPLUS; - listp->next = NULL; - memset (listp->slotinfo, '\0', - TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo)); - } - - /* Add the information into the slotinfo data structure. */ - listp->slotinfo[idx].map = l; - listp->slotinfo[idx].gen = GL(dl_tls_generation) + 1; -} -#endif /* use TLS */ diff --git a/sysdeps/generic/dl-trampoline.c b/sysdeps/generic/dl-trampoline.c deleted file mode 100644 index 3ca89f3879..0000000000 --- a/sysdeps/generic/dl-trampoline.c +++ /dev/null @@ -1 +0,0 @@ -#error "Architecture specific PLT trampolines must be defined." diff --git a/sysdeps/generic/dup.c b/sysdeps/generic/dup.c deleted file mode 100644 index 5d5e1b4cd5..0000000000 --- a/sysdeps/generic/dup.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/dup2.c b/sysdeps/generic/dup2.c deleted file mode 100644 index 2b897896f6..0000000000 --- a/sysdeps/generic/dup2.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/dwarf2.h b/sysdeps/generic/dwarf2.h index 800bda2dc0..9fca4c00e0 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 GNU CC. + This file is part of the GNU C Library. -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 free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser 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 distributed in the hope that 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. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. -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. */ + You should have received a copy of the GNU Lesser General Public + License along 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 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 deleted file mode 100644 index 2c2fbe8eb4..0000000000 --- a/sysdeps/generic/e_acoshl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_acoshl (long double x) -{ - fputs ("__ieee754_acoshl not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (acoshl) -#include diff --git a/sysdeps/generic/e_acosl.c b/sysdeps/generic/e_acosl.c deleted file mode 100644 index d844d885b8..0000000000 --- a/sysdeps/generic/e_acosl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_acosl (long double x) -{ - fputs ("__ieee754_acosl not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (acosl) -#include diff --git a/sysdeps/generic/e_asinl.c b/sysdeps/generic/e_asinl.c deleted file mode 100644 index 3b26f030ef..0000000000 --- a/sysdeps/generic/e_asinl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_asinl (long double x) -{ - fputs ("__ieee754_asinl not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (asinl) -#include diff --git a/sysdeps/generic/e_atan2l.c b/sysdeps/generic/e_atan2l.c deleted file mode 100644 index 0caed8a32f..0000000000 --- a/sysdeps/generic/e_atan2l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_atanhl.c b/sysdeps/generic/e_atanhl.c deleted file mode 100644 index 625d42db31..0000000000 --- a/sysdeps/generic/e_atanhl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_coshl.c b/sysdeps/generic/e_coshl.c deleted file mode 100644 index 0da319b785..0000000000 --- a/sysdeps/generic/e_coshl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_exp10.c b/sysdeps/generic/e_exp10.c deleted file mode 100644 index a3eccbb9e6..0000000000 --- a/sysdeps/generic/e_exp10.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#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 deleted file mode 100644 index 7d06d074b8..0000000000 --- a/sysdeps/generic/e_exp10f.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#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 deleted file mode 100644 index 56f0cfec2f..0000000000 --- a/sysdeps/generic/e_exp10l.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#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 deleted file mode 100644 index 64ef6d3d50..0000000000 --- a/sysdeps/generic/e_exp2l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_exp2l (long double x) -{ - fputs ("__ieee754_exp2l not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (exp2l) -#include diff --git a/sysdeps/generic/e_expl.c b/sysdeps/generic/e_expl.c deleted file mode 100644 index f9467c38ab..0000000000 --- a/sysdeps/generic/e_expl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_expl (long double x) -{ - fputs ("__ieee754_expl not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (expl) -#include diff --git a/sysdeps/generic/e_fmodl.c b/sysdeps/generic/e_fmodl.c deleted file mode 100644 index 380da24e41..0000000000 --- a/sysdeps/generic/e_fmodl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_gammal_r.c b/sysdeps/generic/e_gammal_r.c deleted file mode 100644 index 1c45c8421b..0000000000 --- a/sysdeps/generic/e_gammal_r.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_hypotl.c b/sysdeps/generic/e_hypotl.c deleted file mode 100644 index 07df22eb36..0000000000 --- a/sysdeps/generic/e_hypotl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_j0l.c b/sysdeps/generic/e_j0l.c deleted file mode 100644 index 1bf0a1de73..0000000000 --- a/sysdeps/generic/e_j0l.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/e_j1l.c b/sysdeps/generic/e_j1l.c deleted file mode 100644 index 656abeba57..0000000000 --- a/sysdeps/generic/e_j1l.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/e_jnl.c b/sysdeps/generic/e_jnl.c deleted file mode 100644 index 1bfc0695a5..0000000000 --- a/sysdeps/generic/e_jnl.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/e_lgammal_r.c b/sysdeps/generic/e_lgammal_r.c deleted file mode 100644 index 1784b2663f..0000000000 --- a/sysdeps/generic/e_lgammal_r.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/e_log10l.c b/sysdeps/generic/e_log10l.c deleted file mode 100644 index 5bc264b32c..0000000000 --- a/sysdeps/generic/e_log10l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_log10l (long double x) -{ - fputs ("__ieee754_log10l not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (log10l) -#include diff --git a/sysdeps/generic/e_log2l.c b/sysdeps/generic/e_log2l.c deleted file mode 100644 index 681904bfbb..0000000000 --- a/sysdeps/generic/e_log2l.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_log2l (long double x) -{ - fputs ("__ieee754_log2l not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (log2l) -#include diff --git a/sysdeps/generic/e_logl.c b/sysdeps/generic/e_logl.c deleted file mode 100644 index 9ba9cfc799..0000000000 --- a/sysdeps/generic/e_logl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_logl (long double x) -{ - fputs ("__ieee754_logl not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (logl) -#include diff --git a/sysdeps/generic/e_powl.c b/sysdeps/generic/e_powl.c deleted file mode 100644 index afc2248b6b..0000000000 --- a/sysdeps/generic/e_powl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_rem_pio2l.c b/sysdeps/generic/e_rem_pio2l.c deleted file mode 100644 index 617215516b..0000000000 --- a/sysdeps/generic/e_rem_pio2l.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/e_scalb.c b/sysdeps/generic/e_scalb.c deleted file mode 100644 index a7664db546..0000000000 --- a/sysdeps/generic/e_scalb.c +++ /dev/null @@ -1,71 +0,0 @@ -/* @(#)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 -#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 deleted file mode 100644 index 5c6326bc16..0000000000 --- a/sysdeps/generic/e_scalbf.c +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 -#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 deleted file mode 100644 index a34369c0b5..0000000000 --- a/sysdeps/generic/e_scalbl.c +++ /dev/null @@ -1,75 +0,0 @@ -/* 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 -#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 deleted file mode 100644 index 4cec79cb2d..0000000000 --- a/sysdeps/generic/e_sinhl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/e_sqrtl.c b/sysdeps/generic/e_sqrtl.c deleted file mode 100644 index 7680bdb145..0000000000 --- a/sysdeps/generic/e_sqrtl.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include - -long double -__ieee754_sqrtl (long double x) -{ - fputs ("__ieee754_sqrtl not implemented\n", stderr); - __set_errno (ENOSYS); - return 0.0; -} - -stub_warning (sqrtl) -#include diff --git a/sysdeps/generic/enbl-secure.c b/sysdeps/generic/enbl-secure.c deleted file mode 100644 index fac3b9c527..0000000000 --- a/sysdeps/generic/enbl-secure.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 2a93081c83..0000000000 --- a/sysdeps/generic/endutxent.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -void -endutxent (void) -{ - __endutent (); -} diff --git a/sysdeps/generic/environ.c b/sysdeps/generic/environ.c deleted file mode 100644 index a0ed0d80ea..0000000000 --- a/sysdeps/generic/environ.c +++ /dev/null @@ -1,12 +0,0 @@ -/* This file just defines the `__environ' variable (and alias `environ'). */ - -#include -#include - -/* 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 deleted file mode 100644 index 6a834fc329..0000000000 --- a/sysdeps/generic/errlist.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991, 1994, 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include - - -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 deleted file mode 100644 index 633590f4f9..0000000000 --- a/sysdeps/generic/errno-loc.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index 03d661b717..0000000000 --- a/sysdeps/generic/errno.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 -#include -#include -#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 -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 deleted file mode 100644 index 028fe9085c..0000000000 --- a/sysdeps/generic/euidaccess.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include - -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 diff --git a/sysdeps/generic/exc2signal.c b/sysdeps/generic/exc2signal.c deleted file mode 100644 index de044bbcf4..0000000000 --- a/sysdeps/generic/exc2signal.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 2d756293ed..0000000000 --- a/sysdeps/generic/execve.c +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/fattach.c b/sysdeps/generic/fattach.c deleted file mode 100644 index 555e0b65e6..0000000000 --- a/sysdeps/generic/fattach.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -int -fattach (fildes, path) - int fildes; - const char *path; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (fattach) -#include diff --git a/sysdeps/generic/fchdir.c b/sysdeps/generic/fchdir.c deleted file mode 100644 index db1e4f8f35..0000000000 --- a/sysdeps/generic/fchdir.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* Change the current directory to FD. */ -int -fchdir (fd) - int fd; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fchdir) -#include diff --git a/sysdeps/generic/fchflags.c b/sysdeps/generic/fchflags.c deleted file mode 100644 index f191194c12..0000000000 --- a/sysdeps/generic/fchflags.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/fchmod.c b/sysdeps/generic/fchmod.c deleted file mode 100644 index 4b5eacb3eb..0000000000 --- a/sysdeps/generic/fchmod.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/fchown.c b/sysdeps/generic/fchown.c deleted file mode 100644 index e0d42dd293..0000000000 --- a/sysdeps/generic/fchown.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/fchownat.c b/sysdeps/generic/fchownat.c deleted file mode 100644 index f6921c9012..0000000000 --- a/sysdeps/generic/fchownat.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include - -/* Change the owner and group of FILE. */ -int -fchownat (fd, file, owner, group, flag) - int fd; - const char *file; - uid_t owner; - gid_t group; - int flag; -{ - if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fchownat) - -#include diff --git a/sysdeps/generic/fclrexcpt.c b/sysdeps/generic/fclrexcpt.c deleted file mode 100644 index 560e326ee3..0000000000 --- a/sysdeps/generic/fclrexcpt.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 , 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 -#include - -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 diff --git a/sysdeps/generic/fcntl.c b/sysdeps/generic/fcntl.c deleted file mode 100644 index db6fbc399c..0000000000 --- a/sysdeps/generic/fcntl.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/fdatasync.c b/sysdeps/generic/fdatasync.c deleted file mode 100644 index 3edeef0c9e..0000000000 --- a/sysdeps/generic/fdatasync.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 - - -/* 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 deleted file mode 100644 index 431c92bbea..0000000000 --- a/sysdeps/generic/fdetach.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -int -fdetach (path) - const char *path; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (fdetach) -#include diff --git a/sysdeps/generic/fdopendir.c b/sysdeps/generic/fdopendir.c deleted file mode 100644 index ed30e89e7e..0000000000 --- a/sysdeps/generic/fdopendir.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Open a directory stream from a file descriptor. Stub version. - Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include - - -/* Open a directory stream on FD. */ -DIR * -fdopendir (int fd) -{ - __set_errno (ENOSYS); - return NULL; -} - -stub_warning (fdopendir) -#include diff --git a/sysdeps/generic/fedisblxcpt.c b/sysdeps/generic/fedisblxcpt.c deleted file mode 100644 index e1e9065aac..0000000000 --- a/sysdeps/generic/fedisblxcpt.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Disable floating-point exceptions. - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger , 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 - -int -fedisableexcept (int excepts) -{ - /* Signal failure. */ - return -1; -} -stub_warning (fedisableexcept) -#include diff --git a/sysdeps/generic/feenablxcpt.c b/sysdeps/generic/feenablxcpt.c deleted file mode 100644 index 678271f360..0000000000 --- a/sysdeps/generic/feenablxcpt.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Enable floating-point exceptions. - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger , 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 - -int -feenableexcept (int excepts) -{ - /* Signal failure. */ - return -1; -} -stub_warning (feenableexcept) -#include diff --git a/sysdeps/generic/fegetenv.c b/sysdeps/generic/fegetenv.c deleted file mode 100644 index 4a878cc41b..0000000000 --- a/sysdeps/generic/fegetenv.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 , 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 -#include -#include - -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 diff --git a/sysdeps/generic/fegetexcept.c b/sysdeps/generic/fegetexcept.c deleted file mode 100644 index 1870689e8d..0000000000 --- a/sysdeps/generic/fegetexcept.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Get floating-point exceptions. - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger , 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 - -int -fegetexcept (void) -{ - /* Signal failure. */ - return -1; -} -stub_warning (fegetexcept) -#include diff --git a/sysdeps/generic/fegetround.c b/sysdeps/generic/fegetround.c deleted file mode 100644 index cf7a774929..0000000000 --- a/sysdeps/generic/fegetround.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Return current rounding direction. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -int -fegetround (void) -{ - return 0; -} -stub_warning (fegetround) -#include diff --git a/sysdeps/generic/feholdexcpt.c b/sysdeps/generic/feholdexcpt.c deleted file mode 100644 index 8680d1e492..0000000000 --- a/sysdeps/generic/feholdexcpt.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Store current floating-point environment and clear exceptions. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -int -feholdexcept (fenv_t *envp) -{ - return 1; /* Signal failure. */ -} -libm_hidden_def (feholdexcept) -stub_warning (feholdexcept) -#include diff --git a/sysdeps/generic/fesetenv.c b/sysdeps/generic/fesetenv.c deleted file mode 100644 index 936d6c121b..0000000000 --- a/sysdeps/generic/fesetenv.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 , 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 -#include - -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 diff --git a/sysdeps/generic/fesetround.c b/sysdeps/generic/fesetround.c deleted file mode 100644 index 5b14826390..0000000000 --- a/sysdeps/generic/fesetround.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Set current rounding direction. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -int -fesetround (int round) -{ - return 1; /* Signal we are unable to set the direction. */ -} -libm_hidden_def (fesetround) -stub_warning (fesetround) -#include diff --git a/sysdeps/generic/feupdateenv.c b/sysdeps/generic/feupdateenv.c deleted file mode 100644 index 3e6aed4fdf..0000000000 --- a/sysdeps/generic/feupdateenv.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 , 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 -#include - -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 diff --git a/sysdeps/generic/fexecve.c b/sysdeps/generic/fexecve.c deleted file mode 100644 index fceae9251a..0000000000 --- a/sysdeps/generic/fexecve.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/ffs.c b/sysdeps/generic/ffs.c deleted file mode 100644 index 06a1542bd9..0000000000 --- a/sysdeps/generic/ffs.c +++ /dev/null @@ -1,55 +0,0 @@ -/* 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 -#define ffsl __something_else -#include - -#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 deleted file mode 100644 index 9dd269afb7..0000000000 --- a/sysdeps/generic/ffsll.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#define ffsl __something_else -#include - -#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 deleted file mode 100644 index aea2e0ffaf..0000000000 --- a/sysdeps/generic/fgetexcptflg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 , 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 -#include - -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 diff --git a/sysdeps/generic/fgetxattr.c b/sysdeps/generic/fgetxattr.c deleted file mode 100644 index 610ed32d1f..0000000000 --- a/sysdeps/generic/fgetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -ssize_t -fgetxattr (int __fd, const char *__name, - void *__value, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fgetxattr) -#include diff --git a/sysdeps/generic/flistxattr.c b/sysdeps/generic/flistxattr.c deleted file mode 100644 index fc2863d31c..0000000000 --- a/sysdeps/generic/flistxattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -ssize_t -flistxattr (int __fd, char *__list, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (flistxattr) -#include diff --git a/sysdeps/generic/flock.c b/sysdeps/generic/flock.c deleted file mode 100644 index db3bfcfcbe..0000000000 --- a/sysdeps/generic/flock.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/flockfile.c b/sysdeps/generic/flockfile.c deleted file mode 100644 index 571930ee54..0000000000 --- a/sysdeps/generic/flockfile.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index c19fa656b3..0000000000 --- a/sysdeps/generic/fork.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/fpathconf.c b/sysdeps/generic/fpathconf.c deleted file mode 100644 index 840460b04b..0000000000 --- a/sysdeps/generic/fpathconf.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/fpu_control.c b/sysdeps/generic/fpu_control.c deleted file mode 100644 index cd8eeff99d..0000000000 --- a/sysdeps/generic/fpu_control.c +++ /dev/null @@ -1,25 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 764634a3b1..0000000000 --- a/sysdeps/generic/fraiseexcpt.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 , 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 -#include - -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 diff --git a/sysdeps/generic/fremovexattr.c b/sysdeps/generic/fremovexattr.c deleted file mode 100644 index 9719d42d40..0000000000 --- a/sysdeps/generic/fremovexattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -int -fremovexattr (int __fd, const char *__name) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fremovexattr) -#include diff --git a/sysdeps/generic/fsetexcptflg.c b/sysdeps/generic/fsetexcptflg.c deleted file mode 100644 index 8d0f0ff64b..0000000000 --- a/sysdeps/generic/fsetexcptflg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 , 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 -#include - -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 diff --git a/sysdeps/generic/fsetxattr.c b/sysdeps/generic/fsetxattr.c deleted file mode 100644 index 8a52e72529..0000000000 --- a/sysdeps/generic/fsetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -int -fsetxattr (int __fd, const char *__name, const void *__value, - size_t __size, int __flags) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fsetxattr) -#include diff --git a/sysdeps/generic/fstatfs.c b/sysdeps/generic/fstatfs.c deleted file mode 100644 index 4a1a996cbc..0000000000 --- a/sysdeps/generic/fstatfs.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/fstatfs64.c b/sysdeps/generic/fstatfs64.c deleted file mode 100644 index 249b97ea44..0000000000 --- a/sysdeps/generic/fstatfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/fstatvfs.c b/sysdeps/generic/fstatvfs.c deleted file mode 100644 index c5f75a7c97..0000000000 --- a/sysdeps/generic/fstatvfs.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/fstatvfs64.c b/sysdeps/generic/fstatvfs64.c deleted file mode 100644 index 47d4e266e2..0000000000 --- a/sysdeps/generic/fstatvfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/fsync.c b/sysdeps/generic/fsync.c deleted file mode 100644 index e2a4d700d5..0000000000 --- a/sysdeps/generic/fsync.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* Make all changes done to FD actually appear on disk. */ -int -fsync (fd) - int fd; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (fsync) -#include diff --git a/sysdeps/generic/ftestexcept.c b/sysdeps/generic/ftestexcept.c deleted file mode 100644 index 4be3fb770f..0000000000 --- a/sysdeps/generic/ftestexcept.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 - -int -fetestexcept (int excepts) -{ - return 0; -} -stub_warning (fetestexcept) -#include diff --git a/sysdeps/generic/ftime.c b/sysdeps/generic/ftime.c deleted file mode 100644 index 94dfbcc98b..0000000000 --- a/sysdeps/generic/ftime.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -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 deleted file mode 100644 index d4cca2e267..0000000000 --- a/sysdeps/generic/ftruncate.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/ftruncate64.c b/sysdeps/generic/ftruncate64.c deleted file mode 100644 index df84b7c3c1..0000000000 --- a/sysdeps/generic/ftruncate64.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 7bd3e9b53b..0000000000 --- a/sysdeps/generic/ftrylockfile.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 902d29478d..0000000000 --- a/sysdeps/generic/funlockfile.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 3378dbf416..0000000000 --- a/sysdeps/generic/futimes.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/futimesat.c b/sysdeps/generic/futimesat.c deleted file mode 100644 index 74ccd876e6..0000000000 --- a/sysdeps/generic/futimesat.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include - - -/* Change the access time of FILE relative to FD to TVP[0] and - the modification time of FILE to TVP[1]. */ -int -futimesat (fd, file, tvp) - int fd; - const char *file; - const struct timeval tvp[2]; -{ - if (fd < 0 - && (file == NULL - || (fd != AT_FDCWD && file[0] != '/'))) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - -weak_alias (__utimes, utimes) - -stub_warning (utimes) -#include diff --git a/sysdeps/generic/fxstat.c b/sysdeps/generic/fxstat.c deleted file mode 100644 index b750daca63..0000000000 --- a/sysdeps/generic/fxstat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/fxstat64.c b/sysdeps/generic/fxstat64.c deleted file mode 100644 index 865ba49484..0000000000 --- a/sysdeps/generic/fxstat64.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/fxstatat.c b/sysdeps/generic/fxstatat.c deleted file mode 100644 index 62f7fe3efb..0000000000 --- a/sysdeps/generic/fxstatat.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include - -/* Get information about the file descriptor FD in BUF. */ -int -__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag) -{ - if (vers != _STAT_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fstatat) -#include diff --git a/sysdeps/generic/fxstatat64.c b/sysdeps/generic/fxstatat64.c deleted file mode 100644 index ba95b73e81..0000000000 --- a/sysdeps/generic/fxstatat64.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include - -/* Get information about the file descriptor FD in BUF. */ -int -__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf, - int flag) -{ - if (vers != _STAT_VER) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (fstatat64) -#include diff --git a/sysdeps/generic/gai_sigqueue.c b/sysdeps/generic/gai_sigqueue.c deleted file mode 100644 index 2c91df6ddc..0000000000 --- a/sysdeps/generic/gai_sigqueue.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -#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 diff --git a/sysdeps/generic/gai_strerror.c b/sysdeps/generic/gai_strerror.c deleted file mode 100644 index 932c5910df..0000000000 --- a/sysdeps/generic/gai_strerror.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 -#include - -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 deleted file mode 100644 index 14375ec186..0000000000 --- a/sysdeps/generic/get_clockfreq.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 - -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 deleted file mode 100644 index 548c0b863e..0000000000 --- a/sysdeps/generic/getaddrinfo.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/getclktck.c b/sysdeps/generic/getclktck.c deleted file mode 100644 index 897c6a25ba..0000000000 --- a/sysdeps/generic/getclktck.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index e417575a58..0000000000 --- a/sysdeps/generic/getcontext.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -int -getcontext (ucp) - ucontext_t *ucp; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (getcontext) -#include diff --git a/sysdeps/generic/getcwd.c b/sysdeps/generic/getcwd.c deleted file mode 100644 index c472d1d7a6..0000000000 --- a/sysdeps/generic/getcwd.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/getdents.c b/sysdeps/generic/getdents.c deleted file mode 100644 index 1b1b7c7e8f..0000000000 --- a/sysdeps/generic/getdents.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include -#include -#include - -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 diff --git a/sysdeps/generic/getdents64.c b/sysdeps/generic/getdents64.c deleted file mode 100644 index cb30e76545..0000000000 --- a/sysdeps/generic/getdents64.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include -#include - -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 diff --git a/sysdeps/generic/getdomain.c b/sysdeps/generic/getdomain.c deleted file mode 100644 index 6074ccfb79..0000000000 --- a/sysdeps/generic/getdomain.c +++ /dev/null @@ -1,64 +0,0 @@ -/* 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 -#include -#include -#include -#include - -#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 - -#endif - -libc_hidden_def (getdomainname) diff --git a/sysdeps/generic/getdtsz.c b/sysdeps/generic/getdtsz.c deleted file mode 100644 index 38b7577914..0000000000 --- a/sysdeps/generic/getdtsz.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getegid.c b/sysdeps/generic/getegid.c deleted file mode 100644 index d939d6ad64..0000000000 --- a/sysdeps/generic/getegid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getenv.c b/sysdeps/generic/getenv.c deleted file mode 100644 index 6cdfe2b266..0000000000 --- a/sysdeps/generic/getenv.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (C) 1991,92,94,96,98,99,2002,2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include -#include - - -/* 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 deleted file mode 100644 index c67dbfd708..0000000000 --- a/sysdeps/generic/geteuid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/getgid.c b/sysdeps/generic/getgid.c deleted file mode 100644 index 742c099fa2..0000000000 --- a/sysdeps/generic/getgid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/getgroups.c b/sysdeps/generic/getgroups.c deleted file mode 100644 index d5868cc1b8..0000000000 --- a/sysdeps/generic/getgroups.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1991,1992,1995,1996,1997,2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include - - -/* 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 (NGROUPS_MAX) && NGROUPS_MAX == 0) -stub_warning (getgroups); -#endif - -weak_alias (__getgroups, getgroups) -#include diff --git a/sysdeps/generic/gethostid.c b/sysdeps/generic/gethostid.c deleted file mode 100644 index 01baf12230..0000000000 --- a/sysdeps/generic/gethostid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* Return the current machine's Internet number. */ -long int -gethostid () -{ - __set_errno (ENOSYS); - return -1L; -} - - -stub_warning (gethostid) -#include diff --git a/sysdeps/generic/gethostname.c b/sysdeps/generic/gethostname.c deleted file mode 100644 index bc59ab57c6..0000000000 --- a/sysdeps/generic/gethostname.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getipv4sourcefilter.c b/sysdeps/generic/getipv4sourcefilter.c deleted file mode 100644 index e95697778a..0000000000 --- a/sysdeps/generic/getipv4sourcefilter.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 , 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 -#include - - -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 deleted file mode 100644 index d9f3063e1e..0000000000 --- a/sysdeps/generic/getitimer.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/getloadavg.c b/sysdeps/generic/getloadavg.c deleted file mode 100644 index 070c879fd5..0000000000 --- a/sysdeps/generic/getloadavg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Get system load averages. Stub version. - 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 -#include -#include - - -/* 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. */ - -int -getloadavg (double loadavg[], int nelem) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (getloadavg) -#include diff --git a/sysdeps/generic/getlogin.c b/sysdeps/generic/getlogin.c deleted file mode 100644 index 12b4283396..0000000000 --- a/sysdeps/generic/getlogin.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/getlogin_r.c b/sysdeps/generic/getlogin_r.c deleted file mode 100644 index f2470ee032..0000000000 --- a/sysdeps/generic/getlogin_r.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getmsg.c b/sysdeps/generic/getmsg.c deleted file mode 100644 index 861a40f677..0000000000 --- a/sysdeps/generic/getmsg.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/getpagesize.c b/sysdeps/generic/getpagesize.c deleted file mode 100644 index 40ed1ee2b1..0000000000 --- a/sysdeps/generic/getpagesize.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* Return the system page size. */ -int -__getpagesize () -{ - __set_errno (ENOSYS); - return 0; -} -libc_hidden_def (__getpagesize) -stub_warning (getpagesize) - -weak_alias (__getpagesize, getpagesize) -#include diff --git a/sysdeps/generic/getpeername.c b/sysdeps/generic/getpeername.c deleted file mode 100644 index 6507387bd1..0000000000 --- a/sysdeps/generic/getpeername.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getpgid.c b/sysdeps/generic/getpgid.c deleted file mode 100644 index ad46771d2f..0000000000 --- a/sysdeps/generic/getpgid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getpgrp.c b/sysdeps/generic/getpgrp.c deleted file mode 100644 index 85efc2f215..0000000000 --- a/sysdeps/generic/getpgrp.c +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index c1c91fede7..0000000000 --- a/sysdeps/generic/getpid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getpmsg.c b/sysdeps/generic/getpmsg.c deleted file mode 100644 index e6e9898e46..0000000000 --- a/sysdeps/generic/getpmsg.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/getppid.c b/sysdeps/generic/getppid.c deleted file mode 100644 index e00c237496..0000000000 --- a/sysdeps/generic/getppid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - - -/* Get the parent process ID of the calling process. */ -int -__getppid () -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (getppid) - -weak_alias (__getppid, getppid) -#include diff --git a/sysdeps/generic/getpriority.c b/sysdeps/generic/getpriority.c deleted file mode 100644 index 501c92a08a..0000000000 --- a/sysdeps/generic/getpriority.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* Return the highest priority of any process specified by WHICH and WHO - (see ); 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 diff --git a/sysdeps/generic/getpt.c b/sysdeps/generic/getpt.c deleted file mode 100644 index cd7107e5d6..0000000000 --- a/sysdeps/generic/getpt.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 1998, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Zack Weinberg , 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 -#include - -/* 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 diff --git a/sysdeps/generic/getresgid.c b/sysdeps/generic/getresgid.c deleted file mode 100644 index d6a9b52957..0000000000 --- a/sysdeps/generic/getresgid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getresuid.c b/sysdeps/generic/getresuid.c deleted file mode 100644 index 227d6b7ded..0000000000 --- a/sysdeps/generic/getresuid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getrlimit.c b/sysdeps/generic/getrlimit.c deleted file mode 100644 index d4bcadd762..0000000000 --- a/sysdeps/generic/getrlimit.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/getrlimit64.c b/sysdeps/generic/getrlimit64.c deleted file mode 100644 index dcd67cf56f..0000000000 --- a/sysdeps/generic/getrlimit64.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index c679855ace..0000000000 --- a/sysdeps/generic/getrusage.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getsid.c b/sysdeps/generic/getsid.c deleted file mode 100644 index eb7e60fa42..0000000000 --- a/sysdeps/generic/getsid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include -#include - -pid_t -getsid (pid_t pid) -{ - __set_errno (ENOSYS); - return (pid_t) -1; -} -libc_hidden_def (getsid) -stub_warning (getsid) -#include diff --git a/sysdeps/generic/getsockname.c b/sysdeps/generic/getsockname.c deleted file mode 100644 index b698bdbb7a..0000000000 --- a/sysdeps/generic/getsockname.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getsockopt.c b/sysdeps/generic/getsockopt.c deleted file mode 100644 index 8f4fa89578..0000000000 --- a/sysdeps/generic/getsockopt.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/getsourcefilter.c b/sysdeps/generic/getsourcefilter.c deleted file mode 100644 index 373550beb3..0000000000 --- a/sysdeps/generic/getsourcefilter.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 , 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 -#include - - -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 deleted file mode 100644 index bc67e23e79..0000000000 --- a/sysdeps/generic/getsysstats.c +++ /dev/null @@ -1,69 +0,0 @@ -/* 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 , 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 -#include - -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 diff --git a/sysdeps/generic/gettimeofday.c b/sysdeps/generic/gettimeofday.c deleted file mode 100644 index f4a170c9e7..0000000000 --- a/sysdeps/generic/gettimeofday.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -#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 diff --git a/sysdeps/generic/getuid.c b/sysdeps/generic/getuid.c deleted file mode 100644 index c4ea7e8c98..0000000000 --- a/sysdeps/generic/getuid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/getutmp.c b/sysdeps/generic/getutmp.c deleted file mode 100644 index 275c1a8738..0000000000 --- a/sysdeps/generic/getutmp.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 5f53f22e6c..0000000000 --- a/sysdeps/generic/getutmpx.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 4961dee051..0000000000 --- a/sysdeps/generic/getutxent.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -struct utmpx * -getutxent (void) -{ - return (struct utmpx *) __getutent (); -} diff --git a/sysdeps/generic/getutxid.c b/sysdeps/generic/getutxid.c deleted file mode 100644 index ba9d5b79d8..0000000000 --- a/sysdeps/generic/getutxid.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -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 deleted file mode 100644 index 74149534c4..0000000000 --- a/sysdeps/generic/getutxline.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -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 deleted file mode 100644 index ebf7bf2b4d..0000000000 --- a/sysdeps/generic/getxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -ssize_t -getxattr (const char *__path, const char *__name, - void *__value, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (getxattr) -#include diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c deleted file mode 100644 index 2e767304a7..0000000000 --- a/sysdeps/generic/glob.c +++ /dev/null @@ -1,1558 +0,0 @@ -/* Copyright (C) 1991-2002,2003,2004,2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along 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 -#endif - -/* Enable GNU extensions in glob.h. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#include -#include -#include - -/* Outcomment the following line for production quality code. */ -/* #define NDEBUG 1 */ -#include - -#include /* 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 -# 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 -#endif - -#if defined HAVE_UNISTD_H || defined _LIBC -# include -# ifndef POSIX -# ifdef _POSIX_VERSION -# define POSIX -# endif -# endif -#endif - -#if !defined _AMIGA && !defined VMS && !defined WINDOWS32 -# include -#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 -# define NAMLEN(dirent) strlen((dirent)->d_name) -#else -# define dirent direct -# define NAMLEN(dirent) (dirent)->d_namlen -# ifdef HAVE_SYS_NDIR_H -# include -# endif -# ifdef HAVE_SYS_DIR_H -# include -# endif -# ifdef HAVE_NDIR_H -# include -# endif -# ifdef HAVE_VMSDIR_H -# include "vmsdir.h" -# endif /* HAVE_VMSDIR_H */ -#endif - - -/* In GNU systems, 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 -# include -# define ANSI_STRING -#else /* No standard headers. */ - -extern char *getenv (); - -# ifdef HAVE_STRING_H -# include -# define ANSI_STRING -# else -# include -# endif -# ifdef HAVE_MEMORY_H -# include -# endif - -extern char *malloc (), *realloc (); -extern void free (); - -extern void qsort (); -extern void abort (), exit (); - -#endif /* Standard headers. */ - -/* NAME_MAX is usually defined in or . */ -#if defined HAVE_LIMITS_H || defined __GNU_LIBRARY__ -# include -#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 -# else /* Not HAVE_ALLOCA_H. */ -# ifndef _AIX -# ifdef WINDOWS32 -# include -# 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 -# 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 to take precedence. */ -#ifndef __GNU_LIBRARY__ -# undef FNM_PATHNAME -# undef FNM_NOESCAPE -# undef FNM_PERIOD -#endif -#include - -/* Some system header files erroneously define these. - We want our own definitions from 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 - -#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 deleted file mode 100644 index 2bfab74074..0000000000 --- a/sysdeps/generic/glob64.c +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/grantpt.c b/sysdeps/generic/grantpt.c deleted file mode 100644 index 65da95b308..0000000000 --- a/sysdeps/generic/grantpt.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Zack Weinberg , 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 -#include - -/* 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 diff --git a/sysdeps/generic/group_member.c b/sysdeps/generic/group_member.c deleted file mode 100644 index 7bd9c46ba2..0000000000 --- a/sysdeps/generic/group_member.c +++ /dev/null @@ -1,50 +0,0 @@ -/* `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 -#include -#include -#include - -#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 deleted file mode 100644 index 84e7fed55e..0000000000 --- a/sysdeps/generic/gtty.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/herrno-loc.c b/sysdeps/generic/herrno-loc.c deleted file mode 100644 index fd6deeb330..0000000000 --- a/sysdeps/generic/herrno-loc.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index dfee1b0545..0000000000 --- a/sysdeps/generic/htonl.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 95c94de8a3..0000000000 --- a/sysdeps/generic/htons.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index f217f37642..0000000000 --- a/sysdeps/generic/if_index.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 -#include -#include - -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 - -#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 deleted file mode 100644 index 330aae3b39..0000000000 --- a/sysdeps/generic/ifaddrs.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 55e833bdb3..0000000000 --- a/sysdeps/generic/ifreq.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with 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 deleted file mode 100644 index fa21274c73..0000000000 --- a/sysdeps/generic/init-first.c +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 0c2b717e6d..0000000000 --- a/sysdeps/generic/init-posix.c +++ /dev/null @@ -1 +0,0 @@ -/* Nothing to do. */ diff --git a/sysdeps/generic/inlines.c b/sysdeps/generic/inlines.c deleted file mode 100644 index dca305e6e4..0000000000 --- a/sysdeps/generic/inlines.c +++ /dev/null @@ -1,3 +0,0 @@ -#define _FORCE_INLINES -#define _EXTERN_INLINE /* empty */ -#include "gmp.h" diff --git a/sysdeps/generic/ioctl.c b/sysdeps/generic/ioctl.c deleted file mode 100644 index 3f71452cc1..0000000000 --- a/sysdeps/generic/ioctl.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/isastream.c b/sysdeps/generic/isastream.c deleted file mode 100644 index 88dae299fc..0000000000 --- a/sysdeps/generic/isastream.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -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 deleted file mode 100644 index 9b0410c614..0000000000 --- a/sysdeps/generic/isatty.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/isfdtype.c b/sysdeps/generic/isfdtype.c deleted file mode 100644 index ba10912c9f..0000000000 --- a/sysdeps/generic/isfdtype.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - - -int -isfdtype (int fildes, int fdtype) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (isfdtype) -#include diff --git a/sysdeps/generic/jmp-unwind.c b/sysdeps/generic/jmp-unwind.c deleted file mode 100644 index d2f76c62e7..0000000000 --- a/sysdeps/generic/jmp-unwind.c +++ /dev/null @@ -1,29 +0,0 @@ -/* _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 - -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 deleted file mode 100644 index 29b83d6273..0000000000 --- a/sysdeps/generic/k_cosl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/k_rem_pio2l.c b/sysdeps/generic/k_rem_pio2l.c deleted file mode 100644 index 236eb30dd9..0000000000 --- a/sysdeps/generic/k_rem_pio2l.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include -#include - -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 diff --git a/sysdeps/generic/k_sincosl.c b/sysdeps/generic/k_sincosl.c deleted file mode 100644 index aa038c26c4..0000000000 --- a/sysdeps/generic/k_sincosl.c +++ /dev/null @@ -1 +0,0 @@ -/* Empty. Not needed. */ diff --git a/sysdeps/generic/k_sinl.c b/sysdeps/generic/k_sinl.c deleted file mode 100644 index ea1d71f61b..0000000000 --- a/sysdeps/generic/k_sinl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/k_tanl.c b/sysdeps/generic/k_tanl.c deleted file mode 100644 index 9993c6b998..0000000000 --- a/sysdeps/generic/k_tanl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include -#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 diff --git a/sysdeps/generic/kill.c b/sysdeps/generic/kill.c deleted file mode 100644 index 1d81e45dde..0000000000 --- a/sysdeps/generic/kill.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/killpg.c b/sysdeps/generic/killpg.c deleted file mode 100644 index ad9258dffc..0000000000 --- a/sysdeps/generic/killpg.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/labs.c b/sysdeps/generic/labs.c deleted file mode 100644 index c568e44454..0000000000 --- a/sysdeps/generic/labs.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 524b24c1ed..0000000000 --- a/sysdeps/generic/lchmod.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* Change the protections of FILE to MODE. */ -int -lchmod (const char *file, mode_t mode) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (lchmod) -#include diff --git a/sysdeps/generic/lchown.c b/sysdeps/generic/lchown.c deleted file mode 100644 index 4e0330e526..0000000000 --- a/sysdeps/generic/lchown.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/ldbl2mpn.c b/sysdeps/generic/ldbl2mpn.c deleted file mode 100644 index 450f9381cc..0000000000 --- a/sysdeps/generic/ldbl2mpn.c +++ /dev/null @@ -1 +0,0 @@ -/* Empty. Not needed unless ldbl support is in. */ diff --git a/sysdeps/generic/ldiv.c b/sysdeps/generic/ldiv.c deleted file mode 100644 index a7796d8e95..0000000000 --- a/sysdeps/generic/ldiv.c +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 - - -/* 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 b8333ed79c..b5f7c3cae5 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -508,7 +508,6 @@ struct rtld_global struct dtv_slotinfo { size_t gen; - bool is_static; struct link_map *map; } slotinfo[0]; } *_dl_tls_dtv_slotinfo_list; @@ -624,6 +623,9 @@ struct rtld_global_ro /* Expected cache ID. */ EXTERN int _dl_correct_cache_id; + /* 0 if internal pointer values should not be guarded, 1 if they should. */ + EXTERN int _dl_pointer_guard; + /* Mask for hardware capabilities that are available. */ EXTERN uint64_t _dl_hwcap; diff --git a/sysdeps/generic/lgetxattr.c b/sysdeps/generic/lgetxattr.c deleted file mode 100644 index 6adf1fdf04..0000000000 --- a/sysdeps/generic/lgetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -ssize_t -lgetxattr (const char *__path, const char *__name, - void *__value, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (lgetxattr) -#include diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c deleted file mode 100644 index 194db6b1ec..0000000000 --- a/sysdeps/generic/libc-start.c +++ /dev/null @@ -1,263 +0,0 @@ -/* Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include -#include - -extern void __libc_init_first (int argc, char **argv, char **envp); - -extern int __libc_multiple_libcs; - -#include -#ifndef SHARED -# include -extern void __pthread_initialize_minimal (void) -# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP - __attribute__ ((weak)) -# endif - ; -# ifndef THREAD_SET_STACK_GUARD -/* Only exported for architectures that don't store the stack guard canary - in thread local area. */ -uintptr_t __stack_chk_guard attribute_relro; -# endif -#endif - -#ifdef HAVE_PTR_NTHREADS -/* We need atomic operations. */ -# include -#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 - __typeof (main) init, - void (*fini) (void), - void (*rtld_fini) (void), - void *__unbounded stack_end) - __attribute__ ((noreturn)); - - -/* Note: the fini parameter is ignored here for shared library. It - is registered with __cxa_atexit. This had the disadvantage that - finalizers were called in more than one place. */ -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 - __typeof (main) init, - void (*fini) (void), - void (*rtld_fini) (void), void *__unbounded stack_end) -{ -#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; - -#ifndef SHARED - char *__unbounded *__unbounded ubp_ev = &ubp_av[argc + 1]; - - INIT_ARGV_and_ENVIRON; - - /* 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 - -# ifndef SHARED - /* Set up the stack checker's canary. */ - uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); -# ifdef THREAD_SET_STACK_GUARD - THREAD_SET_STACK_GUARD (stack_chk_guard); -# else - __stack_chk_guard = stack_chk_guard; -# endif -#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); - -#ifndef SHARED - /* 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'. */ - __libc_init_first (argc, argv, __environ); - - /* Register the destructor of the program, if any. */ - if (fini) - __cxa_atexit ((void (*) (void *)) fini, NULL, NULL); - - /* 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) (argc, argv, __environ MAIN_AUXVEC_PARAM); - -#ifdef SHARED - /* Auditing checkpoint: we have a new object. */ - if (__builtin_expect (GLRO(dl_naudit) > 0, 0)) - { - struct audit_ifaces *afct = GLRO(dl_audit); - struct link_map *head = GL(dl_ns)[LM_ID_BASE]._ns_loaded; - for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) - { - if (afct->preinit != NULL) - afct->preinit (&head->l_audit[cnt].cookie); - - afct = afct->next; - } - } -#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 - unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads; -# else - extern unsigned int __nptl_nthreads __attribute ((weak)); - unsigned 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 deleted file mode 100644 index 3544e396da..0000000000 --- a/sysdeps/generic/libc-tls.c +++ /dev/null @@ -1,263 +0,0 @@ -/* Initialization code for TLS in statically linked application. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include -#include - - -#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; - - -static dtv_t static_dtv[2 + TLS_SLOTINFO_SURPLUS]; - - -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. Giving this initialized value - preallocates some surplus bytes in the static TLS area. */ -size_t _dl_tls_static_size = 2048; -/* 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; - } - - /* 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 = (sizeof (static_dtv) / sizeof (static_dtv[0])) - 2; - // 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.val = ((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.val = (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 - static_dtv[2].pointer.is_static = true; - /* sbrk gives us zero'd memory, so we don't need to clear the remainder. */ - memcpy (static_dtv[2].pointer.val, 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 deleted file mode 100644 index be23849829..0000000000 --- a/sysdeps/generic/libc_fatal.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 70c9949704..0000000000 --- a/sysdeps/generic/link.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/lio_listio.c b/sysdeps/generic/lio_listio.c deleted file mode 100644 index d535594492..0000000000 --- a/sysdeps/generic/lio_listio.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include - -#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 diff --git a/sysdeps/generic/lio_listio64.c b/sysdeps/generic/lio_listio64.c deleted file mode 100644 index 2e72c46b0b..0000000000 --- a/sysdeps/generic/lio_listio64.c +++ /dev/null @@ -1,2 +0,0 @@ -#define BE_AIO64 -#include "lio_listio.c" diff --git a/sysdeps/generic/listen.c b/sysdeps/generic/listen.c deleted file mode 100644 index cbdd8b9d18..0000000000 --- a/sysdeps/generic/listen.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/listxattr.c b/sysdeps/generic/listxattr.c deleted file mode 100644 index 490a092b75..0000000000 --- a/sysdeps/generic/listxattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -ssize_t -listxattr (const char *__path, char *__list, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (listxattr) -#include diff --git a/sysdeps/generic/llabs.c b/sysdeps/generic/llabs.c deleted file mode 100644 index b15c347d32..0000000000 --- a/sysdeps/generic/llabs.c +++ /dev/null @@ -1,31 +0,0 @@ -/* `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 - -#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 deleted file mode 100644 index 28a016b744..0000000000 --- a/sysdeps/generic/lldiv.c +++ /dev/null @@ -1,57 +0,0 @@ -/* `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 - - -/* 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 deleted file mode 100644 index 1a7e1e4cfd..0000000000 --- a/sysdeps/generic/llistxattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -ssize_t -llistxattr (const char *__path, char *__list, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (llistxattr) -#include diff --git a/sysdeps/generic/lockf.c b/sysdeps/generic/lockf.c deleted file mode 100644 index 7b23f66bc9..0000000000 --- a/sysdeps/generic/lockf.c +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 -#include -#include -#include -#include - -/* 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 deleted file mode 100644 index e3b110cd3f..0000000000 --- a/sysdeps/generic/lockf64.c +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 -#include -#include -#include -#include - -/* 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 deleted file mode 100644 index e9c297a20b..0000000000 --- a/sysdeps/generic/longjmp-ts.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 9b1bda1caa..0000000000 --- a/sysdeps/generic/longjmp.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include -#include - - -/* 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 deleted file mode 100644 index fad64e5150..0000000000 --- a/sysdeps/generic/lremovexattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -int -lremovexattr (const char *__path, const char *__name) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (lremovexattr) -#include diff --git a/sysdeps/generic/lseek.c b/sysdeps/generic/lseek.c deleted file mode 100644 index 6daf6ef154..0000000000 --- a/sysdeps/generic/lseek.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/lseek64.c b/sysdeps/generic/lseek64.c deleted file mode 100644 index d0a8cff03e..0000000000 --- a/sysdeps/generic/lseek64.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/lsetxattr.c b/sysdeps/generic/lsetxattr.c deleted file mode 100644 index 6f8cdde1da..0000000000 --- a/sysdeps/generic/lsetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/lshift.c b/sysdeps/generic/lshift.c deleted file mode 100644 index 0b58389658..0000000000 --- a/sysdeps/generic/lshift.c +++ /dev/null @@ -1,87 +0,0 @@ -/* 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 deleted file mode 100644 index 34fc1838f0..0000000000 --- a/sysdeps/generic/lutimes.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/lxstat.c b/sysdeps/generic/lxstat.c deleted file mode 100644 index 23d4442b5c..0000000000 --- a/sysdeps/generic/lxstat.c +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 - -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 deleted file mode 100644 index 596ecd2277..0000000000 --- a/sysdeps/generic/lxstat64.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/madvise.c b/sysdeps/generic/madvise.c deleted file mode 100644 index dbef959dd8..0000000000 --- a/sysdeps/generic/madvise.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/makecontext.c b/sysdeps/generic/makecontext.c deleted file mode 100644 index a65868827f..0000000000 --- a/sysdeps/generic/makecontext.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -void -makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) -{ - __set_errno (ENOSYS); -} - - -stub_warning (makecontext) -#include diff --git a/sysdeps/generic/memccpy.c b/sysdeps/generic/memccpy.c deleted file mode 100644 index 9ffdc335d4..0000000000 --- a/sysdeps/generic/memccpy.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index f3098c775a..0000000000 --- a/sysdeps/generic/memchr.c +++ /dev/null @@ -1,215 +0,0 @@ -/* 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 -#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 -# include -#else -# define reg_char char -#endif - -#if HAVE_STDLIB_H || defined _LIBC -# include -#endif - -#if HAVE_LIMITS_H || defined _LIBC -# include -#endif - -#define LONG_MAX_32_BITS 2147483647 - -#ifndef LONG_MAX -#define LONG_MAX LONG_MAX_32_BITS -#endif - -#include -#if HAVE_BP_SYM_H || defined _LIBC -#include -#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 deleted file mode 100644 index 2f8cf344af..0000000000 --- a/sysdeps/generic/memcmp.c +++ /dev/null @@ -1,381 +0,0 @@ -/* 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 -#endif - -#undef memcmp - -#ifdef _LIBC - -# include -# include - -# if __BYTE_ORDER == __BIG_ENDIAN -# define WORDS_BIGENDIAN -# endif - -#else /* Not in the GNU C library. */ - -# include - -/* 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 deleted file mode 100644 index e167e85d7b..0000000000 --- a/sysdeps/generic/memcpy.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 -#include -#include - -#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 deleted file mode 100644 index 638cd0e4fb..0000000000 --- a/sysdeps/generic/memcpy_chk.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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 -#include -#include - -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 deleted file mode 100644 index c40462104a..0000000000 --- a/sysdeps/generic/memmem.c +++ /dev/null @@ -1,58 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index 16671f7bb5..0000000000 --- a/sysdeps/generic/memmove.c +++ /dev/null @@ -1,112 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index f3b74d23d9..0000000000 --- a/sysdeps/generic/memmove_chk.c +++ /dev/null @@ -1,98 +0,0 @@ -/* 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 -#include -#include - -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 deleted file mode 100644 index a72617e86f..0000000000 --- a/sysdeps/generic/mempcpy.c +++ /dev/null @@ -1,69 +0,0 @@ -/* 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 -#include -#include - -#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 deleted file mode 100644 index 5297bbab92..0000000000 --- a/sysdeps/generic/mempcpy_chk.c +++ /dev/null @@ -1,67 +0,0 @@ -/* 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 -#include -#include - -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 deleted file mode 100644 index 21662b1bd7..0000000000 --- a/sysdeps/generic/memrchr.c +++ /dev/null @@ -1,210 +0,0 @@ -/* 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 - -#ifdef HAVE_CONFIG_H -# include -#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 -# include -#else -# define reg_char char -#endif - -#if defined HAVE_LIMITS_H || defined _LIBC -# include -#endif - -#define LONG_MAX_32_BITS 2147483647 - -#ifndef LONG_MAX -# define LONG_MAX LONG_MAX_32_BITS -#endif - -#include - -#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 deleted file mode 100644 index 592b11e435..0000000000 --- a/sysdeps/generic/memset.c +++ /dev/null @@ -1,91 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index d6206ffc99..0000000000 --- a/sysdeps/generic/memset_chk.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (C) 1991, 1997, 2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include - -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/mig-reply.c b/sysdeps/generic/mig-reply.c deleted file mode 100644 index 3b02028858..0000000000 --- a/sysdeps/generic/mig-reply.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 804447e8f3..0000000000 --- a/sysdeps/generic/mincore.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -int -mincore (void *__start, size_t __len, unsigned char *__vec) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (mincore) -#include diff --git a/sysdeps/generic/mkdir.c b/sysdeps/generic/mkdir.c deleted file mode 100644 index 8037dfb3ee..0000000000 --- a/sysdeps/generic/mkdir.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include -#include - - -/* 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 diff --git a/sysdeps/generic/mkfifo.c b/sysdeps/generic/mkfifo.c deleted file mode 100644 index 614ebe97c3..0000000000 --- a/sysdeps/generic/mkfifo.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include -#include - - -/* 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 diff --git a/sysdeps/generic/mknod.c b/sysdeps/generic/mknod.c deleted file mode 100644 index 7d43593a25..0000000000 --- a/sysdeps/generic/mknod.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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 deleted file mode 100644 index fd8dc8bc9d..0000000000 --- a/sysdeps/generic/mlock.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/mlockall.c b/sysdeps/generic/mlockall.c deleted file mode 100644 index 3d3ed6736d..0000000000 --- a/sysdeps/generic/mlockall.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/mmap.c b/sysdeps/generic/mmap.c deleted file mode 100644 index 43b25a06d2..0000000000 --- a/sysdeps/generic/mmap.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - -/* 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 -weak_alias (__mmap, mmap) diff --git a/sysdeps/generic/mmap64.c b/sysdeps/generic/mmap64.c deleted file mode 100644 index 2c8aac808b..0000000000 --- a/sysdeps/generic/mmap64.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 90385d1e6a..0000000000 --- a/sysdeps/generic/mod_1.c +++ /dev/null @@ -1,197 +0,0 @@ -/* 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 deleted file mode 100644 index 0a66ef5a85..0000000000 --- a/sysdeps/generic/morecore.c +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 -#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 -#include -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 deleted file mode 100644 index 520ea31930..0000000000 --- a/sysdeps/generic/mp_clz_tab.c +++ /dev/null @@ -1,37 +0,0 @@ -/* __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 deleted file mode 100644 index ea1b7dc27f..0000000000 --- a/sysdeps/generic/mpn2dbl.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 16ec73c174..0000000000 --- a/sysdeps/generic/mpn2flt.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 450f9381cc..0000000000 --- a/sysdeps/generic/mpn2ldbl.c +++ /dev/null @@ -1 +0,0 @@ -/* Empty. Not needed unless ldbl support is in. */ diff --git a/sysdeps/generic/mprotect.c b/sysdeps/generic/mprotect.c deleted file mode 100644 index 9fefdfce71..0000000000 --- a/sysdeps/generic/mprotect.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/mq_close.c b/sysdeps/generic/mq_close.c deleted file mode 100644 index 8237a6438e..0000000000 --- a/sysdeps/generic/mq_close.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_getattr.c b/sysdeps/generic/mq_getattr.c deleted file mode 100644 index 2d24b85d47..0000000000 --- a/sysdeps/generic/mq_getattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_notify.c b/sysdeps/generic/mq_notify.c deleted file mode 100644 index 29de75a471..0000000000 --- a/sysdeps/generic/mq_notify.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_open.c b/sysdeps/generic/mq_open.c deleted file mode 100644 index dea5741d5a..0000000000 --- a/sysdeps/generic/mq_open.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_receive.c b/sysdeps/generic/mq_receive.c deleted file mode 100644 index 527fd75963..0000000000 --- a/sysdeps/generic/mq_receive.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_send.c b/sysdeps/generic/mq_send.c deleted file mode 100644 index 8b7cd87f7f..0000000000 --- a/sysdeps/generic/mq_send.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_setattr.c b/sysdeps/generic/mq_setattr.c deleted file mode 100644 index 57ee0759ab..0000000000 --- a/sysdeps/generic/mq_setattr.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_timedreceive.c b/sysdeps/generic/mq_timedreceive.c deleted file mode 100644 index e4723f812a..0000000000 --- a/sysdeps/generic/mq_timedreceive.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_timedsend.c b/sysdeps/generic/mq_timedsend.c deleted file mode 100644 index 5ccfe23b0a..0000000000 --- a/sysdeps/generic/mq_timedsend.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/mq_unlink.c b/sysdeps/generic/mq_unlink.c deleted file mode 100644 index e947b84f3b..0000000000 --- a/sysdeps/generic/mq_unlink.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* Remove message queue named NAME. */ -int -mq_unlink (const char *name) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (mq_unlink) -#include diff --git a/sysdeps/generic/msgctl.c b/sysdeps/generic/msgctl.c deleted file mode 100644 index e4451ed368..0000000000 --- a/sysdeps/generic/msgctl.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/msgget.c b/sysdeps/generic/msgget.c deleted file mode 100644 index 75f8f1bc7f..0000000000 --- a/sysdeps/generic/msgget.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/msgrcv.c b/sysdeps/generic/msgrcv.c deleted file mode 100644 index f366fa8170..0000000000 --- a/sysdeps/generic/msgrcv.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/msgsnd.c b/sysdeps/generic/msgsnd.c deleted file mode 100644 index fb4ca1aa56..0000000000 --- a/sysdeps/generic/msgsnd.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/msync.c b/sysdeps/generic/msync.c deleted file mode 100644 index 0ffd5c04f6..0000000000 --- a/sysdeps/generic/msync.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/mul.c b/sysdeps/generic/mul.c deleted file mode 100644 index 7678e72a0a..0000000000 --- a/sysdeps/generic/mul.c +++ /dev/null @@ -1,152 +0,0 @@ -/* 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 deleted file mode 100644 index 1c36b5fb1f..0000000000 --- a/sysdeps/generic/mul_1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 deleted file mode 100644 index 2120cd4f59..0000000000 --- a/sysdeps/generic/mul_n.c +++ /dev/null @@ -1,401 +0,0 @@ -/* 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 deleted file mode 100644 index 3c728c01d5..0000000000 --- a/sysdeps/generic/munlock.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/munlockall.c b/sysdeps/generic/munlockall.c deleted file mode 100644 index ca7198265f..0000000000 --- a/sysdeps/generic/munlockall.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* Undo the effects of all prior mlock calls in this process. */ - -int -munlockall (void) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (munlockall) -#include diff --git a/sysdeps/generic/munmap.c b/sysdeps/generic/munmap.c deleted file mode 100644 index 4a78c324ad..0000000000 --- a/sysdeps/generic/munmap.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 -weak_alias (__munmap, munmap) diff --git a/sysdeps/generic/nanosleep.c b/sysdeps/generic/nanosleep.c deleted file mode 100644 index 7a2138b6f1..0000000000 --- a/sysdeps/generic/nanosleep.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/nice.c b/sysdeps/generic/nice.c deleted file mode 100644 index 8561931af7..0000000000 --- a/sysdeps/generic/nice.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/nscd_setup_thread.c b/sysdeps/generic/nscd_setup_thread.c deleted file mode 100644 index 8ebc050b4a..0000000000 --- a/sysdeps/generic/nscd_setup_thread.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - - -void -setup_thread (struct database_dyn *db) -{ - /* Nothing. */ -} diff --git a/sysdeps/generic/open.c b/sysdeps/generic/open.c deleted file mode 100644 index 188110b3f3..0000000000 --- a/sysdeps/generic/open.c +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/open64.c b/sysdeps/generic/open64.c deleted file mode 100644 index d9a38112ac..0000000000 --- a/sysdeps/generic/open64.c +++ /dev/null @@ -1,57 +0,0 @@ -/* 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 -#include -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/openat.c b/sysdeps/generic/openat.c deleted file mode 100644 index f3f699ca23..0000000000 --- a/sysdeps/generic/openat.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include - -/* Open FILE with access OFLAG. Interpret relative paths relative to - the directory associated with FD. If OFLAG includes O_CREAT, a - third argument is the file protection. */ -int -openat (fd, file, oflag) - int fd; - const char *file; - int oflag; -{ - int mode; - - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && file[0] != '/') - { - /* Check FD is associated with a directory. */ - struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) - return -1; - - if (!S_ISDIR (st.st_mode)) - { - __set_errno (ENOTDIR); - 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; -} -stub_warning (openat) - -#include diff --git a/sysdeps/generic/openat64.c b/sysdeps/generic/openat64.c deleted file mode 100644 index 87952d38d6..0000000000 --- a/sysdeps/generic/openat64.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include - -/* Open FILE with access OFLAG. Interpret relative paths relative to - the directory associated with FD. If OFLAG includes O_CREAT, a - third argument is the file protection. */ -int -openat64 (fd, file, oflag) - int fd; - const char *file; - int oflag; -{ - int mode; - - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - if (fd != AT_FDCWD && file[0] != '/') - { - /* Check FD is associated with a directory. */ - struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0) - return -1; - - if (!S_ISDIR (st.st_mode)) - { - __set_errno (ENOTDIR); - 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; -} -stub_warning (openat64) - -#include diff --git a/sysdeps/generic/opendir.c b/sysdeps/generic/opendir.c deleted file mode 100644 index 771013f6eb..0000000000 --- a/sysdeps/generic/opendir.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - - -/* Open a directory stream on NAME. */ -DIR * -__opendir (const char *name) -{ - __set_errno (ENOSYS); - return NULL; -} -weak_alias (__opendir, opendir) - -stub_warning (opendir) -#include diff --git a/sysdeps/generic/opensock.c b/sysdeps/generic/opensock.c deleted file mode 100644 index 4a4d5dd385..0000000000 --- a/sysdeps/generic/opensock.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 6ac5d31902..0000000000 --- a/sysdeps/generic/pathconf.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/pause.c b/sysdeps/generic/pause.c deleted file mode 100644 index 2e34b436f1..0000000000 --- a/sysdeps/generic/pause.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/pipe.c b/sysdeps/generic/pipe.c deleted file mode 100644 index babaf9c24b..0000000000 --- a/sysdeps/generic/pipe.c +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/poll.c b/sysdeps/generic/poll.c deleted file mode 100644 index 9f2f191764..0000000000 --- a/sysdeps/generic/poll.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/posix_fadvise.c b/sysdeps/generic/posix_fadvise.c deleted file mode 100644 index 92f8bb8974..0000000000 --- a/sysdeps/generic/posix_fadvise.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/posix_fadvise64.c b/sysdeps/generic/posix_fadvise64.c deleted file mode 100644 index e7eae5e6e3..0000000000 --- a/sysdeps/generic/posix_fadvise64.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/posix_fallocate.c b/sysdeps/generic/posix_fallocate.c deleted file mode 100644 index 218b4adbe3..0000000000 --- a/sysdeps/generic/posix_fallocate.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/posix_fallocate64.c b/sysdeps/generic/posix_fallocate64.c deleted file mode 100644 index 80c1cd385d..0000000000 --- a/sysdeps/generic/posix_fallocate64.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/posix_madvise.c b/sysdeps/generic/posix_madvise.c deleted file mode 100644 index 6f8d60f55f..0000000000 --- a/sysdeps/generic/posix_madvise.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/pread.c b/sysdeps/generic/pread.c deleted file mode 100644 index 5c79dd526d..0000000000 --- a/sysdeps/generic/pread.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/pread64.c b/sysdeps/generic/pread64.c deleted file mode 100644 index 68316579c6..0000000000 --- a/sysdeps/generic/pread64.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/printf_fphex.c b/sysdeps/generic/printf_fphex.c deleted file mode 100644 index fd790d5bf3..0000000000 --- a/sysdeps/generic/printf_fphex.c +++ /dev/null @@ -1,490 +0,0 @@ -/* 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 , 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 -#include -#include -#include -#include -#include -#include -#include -#include "_itoa.h" -#include "_itowa.h" -#include - -/* #define NDEBUG 1*/ /* Undefine this for debugging assertions. */ -#include - -/* 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 -# 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 deleted file mode 100644 index ffcc67931b..0000000000 --- a/sysdeps/generic/prof-freq.c +++ /dev/null @@ -1,55 +0,0 @@ -/* 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 -#include -#include - -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 deleted file mode 100644 index 8736375858..0000000000 --- a/sysdeps/generic/profil.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/pselect.c b/sysdeps/generic/pselect.c deleted file mode 100644 index 43b371cce7..0000000000 --- a/sysdeps/generic/pselect.c +++ /dev/null @@ -1,88 +0,0 @@ -/* 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 , 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 -#include -#include /* For NULL. */ -#include -#include -#include - -/* 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 deleted file mode 100644 index 1825d57143..0000000000 --- a/sysdeps/generic/ptrace.c +++ /dev/null @@ -1,103 +0,0 @@ -/* 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 -#include -#include -#include - -/* Perform process tracing functions. REQUEST is one of the values - in , 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 diff --git a/sysdeps/generic/ptsname.c b/sysdeps/generic/ptsname.c deleted file mode 100644 index c16e056a97..0000000000 --- a/sysdeps/generic/ptsname.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1998,2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Zack Weinberg , 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 -#include -#include - -/* 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 deleted file mode 100644 index 4e8693403a..0000000000 --- a/sysdeps/generic/putenv.c +++ /dev/null @@ -1,72 +0,0 @@ -/* 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 -#endif - -#if _LIBC || HAVE_STDLIB_H -# include -#endif -#if _LIBC || HAVE_STRING_H -# include -#endif - -#if !__GNU_LIBRARY__ && !HAVE_STRCHR -# define strchr index -#endif - -#ifndef _LIBC -# ifdef HAVE_ALLOCA_H -# include -# 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 deleted file mode 100644 index b84dd843ba..0000000000 --- a/sysdeps/generic/putmsg.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/putpmsg.c b/sysdeps/generic/putpmsg.c deleted file mode 100644 index 6e37036aac..0000000000 --- a/sysdeps/generic/putpmsg.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/pututxline.c b/sysdeps/generic/pututxline.c deleted file mode 100644 index 1ed5178862..0000000000 --- a/sysdeps/generic/pututxline.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -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 deleted file mode 100644 index ec35ecea9c..0000000000 --- a/sysdeps/generic/pwrite.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/pwrite64.c b/sysdeps/generic/pwrite64.c deleted file mode 100644 index dd14aa0bd7..0000000000 --- a/sysdeps/generic/pwrite64.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/raise.c b/sysdeps/generic/raise.c deleted file mode 100644 index c5a449f7bc..0000000000 --- a/sysdeps/generic/raise.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/rawmemchr.c b/sysdeps/generic/rawmemchr.c deleted file mode 100644 index cb00ad7e90..0000000000 --- a/sysdeps/generic/rawmemchr.c +++ /dev/null @@ -1,189 +0,0 @@ -/* 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 -#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 -# include -# include -#else -# define reg_char char -#endif - -#if defined (HAVE_LIMITS_H) || defined (_LIBC) -# include -#endif - -#define LONG_MAX_32_BITS 2147483647 - -#ifndef LONG_MAX -#define LONG_MAX LONG_MAX_32_BITS -#endif - -#include - -#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 deleted file mode 100644 index 3943edd689..0000000000 --- a/sysdeps/generic/read.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/readdir.c b/sysdeps/generic/readdir.c deleted file mode 100644 index 893b246d41..0000000000 --- a/sysdeps/generic/readdir.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* Read a directory entry from DIRP. */ -struct dirent * -__readdir (DIR *dirp) -{ - __set_errno (ENOSYS); - return NULL; -} -weak_alias (__readdir, readdir) - -stub_warning (readdir) -#include diff --git a/sysdeps/generic/readdir64.c b/sysdeps/generic/readdir64.c deleted file mode 100644 index 0c18bd9440..0000000000 --- a/sysdeps/generic/readdir64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include -#include - -/* Read a directory entry from DIRP. */ -struct dirent64 * -__readdir64 (DIR *dirp) -{ - __set_errno (ENOSYS); - return NULL; -} -weak_alias (__readdir64, readdir64) -stub_warning (readdir64) -#include diff --git a/sysdeps/generic/readdir64_r.c b/sysdeps/generic/readdir64_r.c deleted file mode 100644 index cf9e952e1a..0000000000 --- a/sysdeps/generic/readdir64_r.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/readdir_r.c b/sysdeps/generic/readdir_r.c deleted file mode 100644 index ad45dfa504..0000000000 --- a/sysdeps/generic/readdir_r.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/readelflib.c b/sysdeps/generic/readelflib.c deleted file mode 100644 index 26444ad6b2..0000000000 --- a/sysdeps/generic/readelflib.c +++ /dev/null @@ -1,220 +0,0 @@ -/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger , 1999 and - Jakub Jelinek , 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 deleted file mode 100644 index 779b809eaa..0000000000 --- a/sysdeps/generic/readlink.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/readonly-area.c b/sysdeps/generic/readonly-area.c deleted file mode 100644 index 4b8172f193..0000000000 --- a/sysdeps/generic/readonly-area.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index b33444c036..0000000000 --- a/sysdeps/generic/readv.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - -/* 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 ) 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 diff --git a/sysdeps/generic/reboot.c b/sysdeps/generic/reboot.c deleted file mode 100644 index 6036726c1f..0000000000 --- a/sysdeps/generic/reboot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* Reboot the system. */ -int -reboot (howto) - int howto; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (reboot) -#include diff --git a/sysdeps/generic/recv.c b/sysdeps/generic/recv.c deleted file mode 100644 index 62af8fedf2..0000000000 --- a/sysdeps/generic/recv.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991,1995,1996,1997,2001,2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include - -/* 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; -} -weak_alias (__recv, recv) - -stub_warning (recv) -#include diff --git a/sysdeps/generic/recvfrom.c b/sysdeps/generic/recvfrom.c deleted file mode 100644 index 4f6a045077..0000000000 --- a/sysdeps/generic/recvfrom.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/recvmsg.c b/sysdeps/generic/recvmsg.c deleted file mode 100644 index 419415cd75..0000000000 --- a/sysdeps/generic/recvmsg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/remap_file_pages.c b/sysdeps/generic/remap_file_pages.c deleted file mode 100644 index 0f15ea44c2..0000000000 --- a/sysdeps/generic/remap_file_pages.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 -weak_alias (__remap_file_pages, remap_file_pages) diff --git a/sysdeps/generic/remove.c b/sysdeps/generic/remove.c deleted file mode 100644 index 5dc0e9edf0..0000000000 --- a/sysdeps/generic/remove.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -int -remove (file) - const char *file; -{ - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (remove) - -stub_warning (remove) -#include diff --git a/sysdeps/generic/removexattr.c b/sysdeps/generic/removexattr.c deleted file mode 100644 index 8379ed10c8..0000000000 --- a/sysdeps/generic/removexattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -int -removexattr (const char *__path, const char *__name) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (removexattr) -#include diff --git a/sysdeps/generic/rename.c b/sysdeps/generic/rename.c deleted file mode 100644 index b7d8392179..0000000000 --- a/sysdeps/generic/rename.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/renameat.c b/sysdeps/generic/renameat.c deleted file mode 100644 index e8629098df..0000000000 --- a/sysdeps/generic/renameat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include - - -/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */ -int -renameat (oldfd, old, newfd, new) - int oldfd; - const char *old; - int newfd; - const char *new; -{ - if ((oldfd < 0 & oldfd !_ AT_FDCWD) || (newfd < 0 && newfd != AT_FDCWD)) - { - __set_errno (EBADF); - return -1; - } - - if (old == NULL || new == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (renameat) -#include diff --git a/sysdeps/generic/res-state.c b/sysdeps/generic/res-state.c deleted file mode 100644 index e327e34f59..0000000000 --- a/sysdeps/generic/res-state.c +++ /dev/null @@ -1,45 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index fc757d80b4..0000000000 --- a/sysdeps/generic/revoke.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -int -revoke (file) - const char *file; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (revoke) -#include diff --git a/sysdeps/generic/rewinddir.c b/sysdeps/generic/rewinddir.c deleted file mode 100644 index e78d316880..0000000000 --- a/sysdeps/generic/rewinddir.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/rmdir.c b/sysdeps/generic/rmdir.c deleted file mode 100644 index 5a16fd4284..0000000000 --- a/sysdeps/generic/rmdir.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/rshift.c b/sysdeps/generic/rshift.c deleted file mode 100644 index 59caf73529..0000000000 --- a/sysdeps/generic/rshift.c +++ /dev/null @@ -1,88 +0,0 @@ -/* 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/s_asinhl.c b/sysdeps/generic/s_asinhl.c deleted file mode 100644 index 1d5cf47a4f..0000000000 --- a/sysdeps/generic/s_asinhl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/s_atanl.c b/sysdeps/generic/s_atanl.c deleted file mode 100644 index d9a7eb6f8f..0000000000 --- a/sysdeps/generic/s_atanl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/s_cacos.c b/sysdeps/generic/s_cacos.c deleted file mode 100644 index 07b6bdcb9c..0000000000 --- a/sysdeps/generic/s_cacos.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 , 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 -#include - -__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 deleted file mode 100644 index 265184e38d..0000000000 --- a/sysdeps/generic/s_cacosf.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 , 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 -#include - -__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 deleted file mode 100644 index 1ae8708d49..0000000000 --- a/sysdeps/generic/s_cacosh.c +++ /dev/null @@ -1,88 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 52c35505e0..0000000000 --- a/sysdeps/generic/s_cacoshf.c +++ /dev/null @@ -1,101 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index 4e5e2b3e3e..0000000000 --- a/sysdeps/generic/s_cacoshl.c +++ /dev/null @@ -1,84 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index a7ceff891b..0000000000 --- a/sysdeps/generic/s_cacosl.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 , 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 -#include - -__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 deleted file mode 100644 index 2d5b06cf78..0000000000 --- a/sysdeps/generic/s_casin.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 5278dbbf78..0000000000 --- a/sysdeps/generic/s_casinf.c +++ /dev/null @@ -1,64 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index a574add70e..0000000000 --- a/sysdeps/generic/s_casinh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 7037ab937c..0000000000 --- a/sysdeps/generic/s_casinhf.c +++ /dev/null @@ -1,82 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 376b2347a0..0000000000 --- a/sysdeps/generic/s_casinhl.c +++ /dev/null @@ -1,80 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index f303c05ae6..0000000000 --- a/sysdeps/generic/s_casinl.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 1d0673ad6a..0000000000 --- a/sysdeps/generic/s_catan.c +++ /dev/null @@ -1,89 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index 25eec2b1b5..0000000000 --- a/sysdeps/generic/s_catanf.c +++ /dev/null @@ -1,87 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index e15c073f96..0000000000 --- a/sysdeps/generic/s_catanh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index d2422e6111..0000000000 --- a/sysdeps/generic/s_catanhf.c +++ /dev/null @@ -1,82 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index c3fb0ce5ff..0000000000 --- a/sysdeps/generic/s_catanhl.c +++ /dev/null @@ -1,80 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index 6cb45e5bee..0000000000 --- a/sysdeps/generic/s_catanl.c +++ /dev/null @@ -1,85 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index d668e377af..0000000000 --- a/sysdeps/generic/s_cbrtl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/s_ccos.c b/sysdeps/generic/s_ccos.c deleted file mode 100644 index 1b244d7079..0000000000 --- a/sysdeps/generic/s_ccos.c +++ /dev/null @@ -1,80 +0,0 @@ -/* 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 , 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 -#include -#include - - -__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 deleted file mode 100644 index 4b154deac5..0000000000 --- a/sysdeps/generic/s_ccosf.c +++ /dev/null @@ -1,78 +0,0 @@ -/* 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 , 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 -#include -#include - - -__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 deleted file mode 100644 index f5b29db24b..0000000000 --- a/sysdeps/generic/s_ccosh.c +++ /dev/null @@ -1,105 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index f400d34f0b..0000000000 --- a/sysdeps/generic/s_ccoshf.c +++ /dev/null @@ -1,103 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index 61ffb49ca0..0000000000 --- a/sysdeps/generic/s_ccoshl.c +++ /dev/null @@ -1,101 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index 4ebe2c347d..0000000000 --- a/sysdeps/generic/s_ccosl.c +++ /dev/null @@ -1,76 +0,0 @@ -/* 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 , 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 -#include -#include - - -__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 deleted file mode 100644 index 5a299b7687..0000000000 --- a/sysdeps/generic/s_cexp.c +++ /dev/null @@ -1,127 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index 7b68fc365c..0000000000 --- a/sysdeps/generic/s_cexpf.c +++ /dev/null @@ -1,125 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index cf6bc974a9..0000000000 --- a/sysdeps/generic/s_cexpl.c +++ /dev/null @@ -1,123 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index f796024b47..0000000000 --- a/sysdeps/generic/s_clog.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -#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 deleted file mode 100644 index 62c2ca724a..0000000000 --- a/sysdeps/generic/s_clog10.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index eed81f368c..0000000000 --- a/sysdeps/generic/s_clog10f.c +++ /dev/null @@ -1,63 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index f901543d05..0000000000 --- a/sysdeps/generic/s_clog10l.c +++ /dev/null @@ -1,61 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index 21e3b57b7f..0000000000 --- a/sysdeps/generic/s_clogf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -#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 deleted file mode 100644 index 43118f768c..0000000000 --- a/sysdeps/generic/s_clogl.c +++ /dev/null @@ -1,61 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index 86536cc95b..0000000000 --- a/sysdeps/generic/s_cpow.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 58eaa1aa06..0000000000 --- a/sysdeps/generic/s_cpowf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 4c358b3ebe..0000000000 --- a/sysdeps/generic/s_cpowl.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 8e7ca41df8..0000000000 --- a/sysdeps/generic/s_cproj.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index 83df13cfa9..0000000000 --- a/sysdeps/generic/s_cprojf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index c70cdc47db..0000000000 --- a/sysdeps/generic/s_cprojl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 , 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 -#include - - -__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 deleted file mode 100644 index eb380e2c3f..0000000000 --- a/sysdeps/generic/s_csin.c +++ /dev/null @@ -1,131 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index 8004743bd3..0000000000 --- a/sysdeps/generic/s_csinf.c +++ /dev/null @@ -1,129 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index f0e0cc61f1..0000000000 --- a/sysdeps/generic/s_csinh.c +++ /dev/null @@ -1,126 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index e4bb704268..0000000000 --- a/sysdeps/generic/s_csinhf.c +++ /dev/null @@ -1,124 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index 226075634d..0000000000 --- a/sysdeps/generic/s_csinhl.c +++ /dev/null @@ -1,122 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index f7a1c43600..0000000000 --- a/sysdeps/generic/s_csinl.c +++ /dev/null @@ -1,127 +0,0 @@ -/* 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 , 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 -#include -#include - -#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 deleted file mode 100644 index 04ed410a16..0000000000 --- a/sysdeps/generic/s_csqrt.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Complex square root of double value. - Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - Contributed by Ulrich Drepper , 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 -#include - -#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 = r; - __imag__ res = __copysign (r, __imag__ x); - } - 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 deleted file mode 100644 index 2fba69ce1b..0000000000 --- a/sysdeps/generic/s_csqrtf.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Complex square root of float value. - Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - Contributed by Ulrich Drepper , 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 -#include - -#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 = r; - __imag__ res = __copysignf (r, __imag__ x); - } - 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 deleted file mode 100644 index 9d00946c51..0000000000 --- a/sysdeps/generic/s_csqrtl.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Complex square root of long double value. - Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - Contributed by Ulrich Drepper , 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 -#include - -#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 = r; - __imag__ res = __copysignl (r, __imag__ x); - } - 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 deleted file mode 100644 index 0464ab86d5..0000000000 --- a/sysdeps/generic/s_ctan.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Complex tangent function for double. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include - -#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); - - if (den == 0.0) - { - __complex__ double ez = __cexp (1.0i * x); - __complex__ double emz = __cexp (-1.0i * x); - - res = (ez - emz) / (ez + emz) * -1.0i; - } - else - { - __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 deleted file mode 100644 index 58d9d13298..0000000000 --- a/sysdeps/generic/s_ctanf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Complex tangent function for float. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include - -#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); - - - if (den == 0.0) - { - __complex__ float ez = __cexpf (1.0i * x); - __complex__ float emz = __cexpf (-1.0i * x); - - res = (ez - emz) / (ez + emz) * -1.0i; - } - else - { - __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 deleted file mode 100644 index fe38dae291..0000000000 --- a/sysdeps/generic/s_ctanh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Complex hyperbole tangent for double. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include - -#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); - - if (den == 0.0) - { - __complex__ double ez = __cexp (x); - __complex__ double emz = __cexp (-x); - - res = (ez - emz) / (ez + emz); - } - else - { - __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 deleted file mode 100644 index c331dbaabb..0000000000 --- a/sysdeps/generic/s_ctanhf.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Complex hyperbole tangent for float. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include - -#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); - - if (den == 0.0f) - { - __complex__ float ez = __cexpf (x); - __complex__ float emz = __cexpf (-x); - - res = (ez - emz) / (ez + emz); - } - else - { - __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 deleted file mode 100644 index 77ca8f8717..0000000000 --- a/sysdeps/generic/s_ctanhl.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Complex hyperbole tangent for long double. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include - -#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); - - if (den == 0.0L) - { - __complex__ long double ez = __cexpl (x); - __complex__ long double emz = __cexpl (-x); - - res = (ez - emz) / (ez + emz); - } - else - { - __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 deleted file mode 100644 index 89379a5ff9..0000000000 --- a/sysdeps/generic/s_ctanl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Complex tangent function for long double. - Copyright (C) 1997, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include - -#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); - - - if (den == 0.0) - { - __complex__ long double ez = __cexpl (1.0i * x); - __complex__ long double emz = __cexpl (-1.0i * x); - - res = (ez - emz) / (ez + emz) * -1.0i; - } - else - { - __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 deleted file mode 100644 index f329d58809..0000000000 --- a/sysdeps/generic/s_erfl.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/s_expm1l.c b/sysdeps/generic/s_expm1l.c deleted file mode 100644 index b69d6aeb97..0000000000 --- a/sysdeps/generic/s_expm1l.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/s_fdim.c b/sysdeps/generic/s_fdim.c deleted file mode 100644 index 5804e631c3..0000000000 --- a/sysdeps/generic/s_fdim.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 , 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 - -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 deleted file mode 100644 index 2f3ce303ae..0000000000 --- a/sysdeps/generic/s_fdimf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 , 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 - -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 deleted file mode 100644 index 70246bafbd..0000000000 --- a/sysdeps/generic/s_fdiml.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 , 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 - -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 deleted file mode 100644 index e5ff5a7228..0000000000 --- a/sysdeps/generic/s_fma.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 , 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 - -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 deleted file mode 100644 index caa7f3afe8..0000000000 --- a/sysdeps/generic/s_fmaf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - -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 deleted file mode 100644 index b89e88b9a3..0000000000 --- a/sysdeps/generic/s_fmal.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - -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 deleted file mode 100644 index f93e14f28c..0000000000 --- a/sysdeps/generic/s_fmax.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 , 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 - - -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 deleted file mode 100644 index 6f368e18b0..0000000000 --- a/sysdeps/generic/s_fmaxf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 - - -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 deleted file mode 100644 index 68c7060f42..0000000000 --- a/sysdeps/generic/s_fmaxl.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 - - -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 deleted file mode 100644 index 78f02da74a..0000000000 --- a/sysdeps/generic/s_fmin.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 , 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 - - -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 deleted file mode 100644 index d6aa9ccf62..0000000000 --- a/sysdeps/generic/s_fminf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 - - -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 deleted file mode 100644 index 5c1610aa85..0000000000 --- a/sysdeps/generic/s_fminl.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 - - -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 deleted file mode 100644 index 12c336fad4..0000000000 --- a/sysdeps/generic/s_ldexp.c +++ /dev/null @@ -1,37 +0,0 @@ -/* @(#)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 - -#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 deleted file mode 100644 index 631db422a3..0000000000 --- a/sysdeps/generic/s_ldexpf.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 123a6b3b58..0000000000 --- a/sysdeps/generic/s_ldexpl.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index e5db9078bf..0000000000 --- a/sysdeps/generic/s_log1pl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/s_nan.c b/sysdeps/generic/s_nan.c deleted file mode 100644 index 9b2c50558b..0000000000 --- a/sysdeps/generic/s_nan.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Return quiet nan. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include -#include -#include - - -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 deleted file mode 100644 index 2e1b1eb911..0000000000 --- a/sysdeps/generic/s_nanf.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Return quiet nan. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include -#include -#include - - -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 deleted file mode 100644 index 9709b92383..0000000000 --- a/sysdeps/generic/s_nanl.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Return quiet nan. - Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include -#include -#include -#include - - -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 deleted file mode 100644 index c2d799d5df..0000000000 --- a/sysdeps/generic/s_nextafter.c +++ /dev/null @@ -1,100 +0,0 @@ -/* @(#)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 - -#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 deleted file mode 100644 index 4f502c210e..0000000000 --- a/sysdeps/generic/s_nexttowardf.c +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 73c3610fc1..0000000000 --- a/sysdeps/generic/s_nexttowardl.c +++ /dev/null @@ -1 +0,0 @@ -/* 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 deleted file mode 100644 index f95b6481c2..0000000000 --- a/sysdeps/generic/s_significand.c +++ /dev/null @@ -1,39 +0,0 @@ -/* @(#)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 deleted file mode 100644 index cf5eb59efc..0000000000 --- a/sysdeps/generic/s_significandf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 deleted file mode 100644 index d84e806fdc..0000000000 --- a/sysdeps/generic/s_significandl.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 deleted file mode 100644 index bc9a2d7f48..0000000000 --- a/sysdeps/generic/s_tanhl.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -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 diff --git a/sysdeps/generic/sbrk.c b/sysdeps/generic/sbrk.c deleted file mode 100644 index 0df60076cc..0000000000 --- a/sysdeps/generic/sbrk.c +++ /dev/null @@ -1,56 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 68608de9a0..0000000000 --- a/sysdeps/generic/scandir64.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 - -#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 diff --git a/sysdeps/generic/sched_getaffinity.c b/sysdeps/generic/sched_getaffinity.c deleted file mode 100644 index b2e452f879..0000000000 --- a/sysdeps/generic/sched_getaffinity.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sched_getp.c b/sysdeps/generic/sched_getp.c deleted file mode 100644 index 1ca77893f4..0000000000 --- a/sysdeps/generic/sched_getp.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sched_gets.c b/sysdeps/generic/sched_gets.c deleted file mode 100644 index 479b913f32..0000000000 --- a/sysdeps/generic/sched_gets.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sched_primax.c b/sysdeps/generic/sched_primax.c deleted file mode 100644 index 4b3c1cbe67..0000000000 --- a/sysdeps/generic/sched_primax.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/sched_primin.c b/sysdeps/generic/sched_primin.c deleted file mode 100644 index 813b8f63ca..0000000000 --- a/sysdeps/generic/sched_primin.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/sched_rr_gi.c b/sysdeps/generic/sched_rr_gi.c deleted file mode 100644 index f8fec63617..0000000000 --- a/sysdeps/generic/sched_rr_gi.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sched_setaffinity.c b/sysdeps/generic/sched_setaffinity.c deleted file mode 100644 index 652163db85..0000000000 --- a/sysdeps/generic/sched_setaffinity.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sched_setp.c b/sysdeps/generic/sched_setp.c deleted file mode 100644 index cc451fc131..0000000000 --- a/sysdeps/generic/sched_setp.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sched_sets.c b/sysdeps/generic/sched_sets.c deleted file mode 100644 index 631cac228b..0000000000 --- a/sysdeps/generic/sched_sets.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sched_yield.c b/sysdeps/generic/sched_yield.c deleted file mode 100644 index ce41ce9b6f..0000000000 --- a/sysdeps/generic/sched_yield.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - - -/* Yield the processor. */ -int -__sched_yield (void) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (sched_yield) - -weak_alias (__sched_yield, sched_yield) -#include diff --git a/sysdeps/generic/seekdir.c b/sysdeps/generic/seekdir.c deleted file mode 100644 index c3828cde0f..0000000000 --- a/sysdeps/generic/seekdir.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c deleted file mode 100644 index f141fff661..0000000000 --- a/sysdeps/generic/segfault.c +++ /dev/null @@ -1,214 +0,0 @@ -/* 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 , 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* This file defines macros to access the content of the sigcontext element - passed up by the signal handler. */ -#include - -/* Get code to possibly dump the content of all registers. */ -#include - -/* 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 deleted file mode 100644 index 124f26aff7..0000000000 --- a/sysdeps/generic/select.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/semctl.c b/sysdeps/generic/semctl.c deleted file mode 100644 index 28a8f37387..0000000000 --- a/sysdeps/generic/semctl.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/semget.c b/sysdeps/generic/semget.c deleted file mode 100644 index a9db299000..0000000000 --- a/sysdeps/generic/semget.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/semop.c b/sysdeps/generic/semop.c deleted file mode 100644 index 6ebcb98ba9..0000000000 --- a/sysdeps/generic/semop.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/semtimedop.c b/sysdeps/generic/semtimedop.c deleted file mode 100644 index 82c5682655..0000000000 --- a/sysdeps/generic/semtimedop.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/send.c b/sysdeps/generic/send.c deleted file mode 100644 index 7f94fbb093..0000000000 --- a/sysdeps/generic/send.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sendfile.c b/sysdeps/generic/sendfile.c deleted file mode 100644 index 98dc9a814d..0000000000 --- a/sysdeps/generic/sendfile.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sendfile64.c b/sysdeps/generic/sendfile64.c deleted file mode 100644 index 76b961e22a..0000000000 --- a/sysdeps/generic/sendfile64.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sendmsg.c b/sysdeps/generic/sendmsg.c deleted file mode 100644 index a4a3cea950..0000000000 --- a/sysdeps/generic/sendmsg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sendto.c b/sysdeps/generic/sendto.c deleted file mode 100644 index 823c9dd1c7..0000000000 --- a/sysdeps/generic/sendto.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setcontext.c b/sysdeps/generic/setcontext.c deleted file mode 100644 index 5841e20317..0000000000 --- a/sysdeps/generic/setcontext.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -int -setcontext (ucp) - const ucontext_t *ucp; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (setcontext) -#include diff --git a/sysdeps/generic/setdomain.c b/sysdeps/generic/setdomain.c deleted file mode 100644 index 4d9cbb7cac..0000000000 --- a/sysdeps/generic/setdomain.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setegid.c b/sysdeps/generic/setegid.c deleted file mode 100644 index 5b5e2cf4bb..0000000000 --- a/sysdeps/generic/setegid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c deleted file mode 100644 index 48aaecffe0..0000000000 --- a/sysdeps/generic/setenv.c +++ /dev/null @@ -1,353 +0,0 @@ -/* 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 -#endif - -#include -#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 -#endif -#if _LIBC || HAVE_STRING_H -# include -#endif -#if _LIBC || HAVE_UNISTD_H -# include -#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 -__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 - -/* 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 deleted file mode 100644 index 689000f993..0000000000 --- a/sysdeps/generic/seteuid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setfpucw.c b/sysdeps/generic/setfpucw.c deleted file mode 100644 index cb50f9f3f1..0000000000 --- a/sysdeps/generic/setfpucw.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -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 deleted file mode 100644 index 05c2cc6621..0000000000 --- a/sysdeps/generic/setgid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/setgroups.c b/sysdeps/generic/setgroups.c deleted file mode 100644 index 74bae72974..0000000000 --- a/sysdeps/generic/setgroups.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/sethostid.c b/sysdeps/generic/sethostid.c deleted file mode 100644 index 6f393de06a..0000000000 --- a/sysdeps/generic/sethostid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sethostname.c b/sysdeps/generic/sethostname.c deleted file mode 100644 index 1f65b1e759..0000000000 --- a/sysdeps/generic/sethostname.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setipv4sourcefilter.c b/sysdeps/generic/setipv4sourcefilter.c deleted file mode 100644 index db2b8433bb..0000000000 --- a/sysdeps/generic/setipv4sourcefilter.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 , 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 -#include - - -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 deleted file mode 100644 index 755fa06a7b..0000000000 --- a/sysdeps/generic/setitimer.c +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/setjmp.c b/sysdeps/generic/setjmp.c deleted file mode 100644 index 0676ff1396..0000000000 --- a/sysdeps/generic/setjmp.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/setlogin.c b/sysdeps/generic/setlogin.c deleted file mode 100644 index c16e29dd9e..0000000000 --- a/sysdeps/generic/setlogin.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* Set the login name returned by `getlogin'. */ -int -setlogin (name) - const char *name; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (setlogin) -#include diff --git a/sysdeps/generic/setpgid.c b/sysdeps/generic/setpgid.c deleted file mode 100644 index cb2abf1159..0000000000 --- a/sysdeps/generic/setpgid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setpgrp.c b/sysdeps/generic/setpgrp.c deleted file mode 100644 index 8ceb159341..0000000000 --- a/sysdeps/generic/setpgrp.c +++ /dev/null @@ -1,25 +0,0 @@ -/* 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 - -int -setpgrp () -{ - return __setpgid (0, 0); -} diff --git a/sysdeps/generic/setpriority.c b/sysdeps/generic/setpriority.c deleted file mode 100644 index b2e6f8a059..0000000000 --- a/sysdeps/generic/setpriority.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setregid.c b/sysdeps/generic/setregid.c deleted file mode 100644 index f8f33d1da7..0000000000 --- a/sysdeps/generic/setregid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/setresgid.c b/sysdeps/generic/setresgid.c deleted file mode 100644 index 78e308c5d0..0000000000 --- a/sysdeps/generic/setresgid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setresuid.c b/sysdeps/generic/setresuid.c deleted file mode 100644 index 430b63b2fd..0000000000 --- a/sysdeps/generic/setresuid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setreuid.c b/sysdeps/generic/setreuid.c deleted file mode 100644 index cce2d9d52b..0000000000 --- a/sysdeps/generic/setreuid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/setrlimit.c b/sysdeps/generic/setrlimit.c deleted file mode 100644 index c8f6e03ad3..0000000000 --- a/sysdeps/generic/setrlimit.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/setrlimit64.c b/sysdeps/generic/setrlimit64.c deleted file mode 100644 index d4b4bfce0a..0000000000 --- a/sysdeps/generic/setrlimit64.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 6a6712b9bd..0000000000 --- a/sysdeps/generic/setsid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/setsockopt.c b/sysdeps/generic/setsockopt.c deleted file mode 100644 index aca73623fe..0000000000 --- a/sysdeps/generic/setsockopt.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setsourcefilter.c b/sysdeps/generic/setsourcefilter.c deleted file mode 100644 index 870f5e2c38..0000000000 --- a/sysdeps/generic/setsourcefilter.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 , 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 -#include - - -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 deleted file mode 100644 index abff6f92a1..0000000000 --- a/sysdeps/generic/settimeofday.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/setuid.c b/sysdeps/generic/setuid.c deleted file mode 100644 index 96c3e01cb9..0000000000 --- a/sysdeps/generic/setuid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/setutxent.c b/sysdeps/generic/setutxent.c deleted file mode 100644 index b6cd282644..0000000000 --- a/sysdeps/generic/setutxent.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -void -setutxent (void) -{ - return __setutent (); -} diff --git a/sysdeps/generic/setxattr.c b/sysdeps/generic/setxattr.c deleted file mode 100644 index 5b8743a7ce..0000000000 --- a/sysdeps/generic/setxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/shm_open.c b/sysdeps/generic/shm_open.c deleted file mode 100644 index 6a53903a75..0000000000 --- a/sysdeps/generic/shm_open.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/shm_unlink.c b/sysdeps/generic/shm_unlink.c deleted file mode 100644 index 28478b895b..0000000000 --- a/sysdeps/generic/shm_unlink.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* Remove shared memory object. */ -int -shm_unlink (const char *name) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (shm_unlink) - -#include diff --git a/sysdeps/generic/shmat.c b/sysdeps/generic/shmat.c deleted file mode 100644 index f418f3e774..0000000000 --- a/sysdeps/generic/shmat.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/shmctl.c b/sysdeps/generic/shmctl.c deleted file mode 100644 index 83374e4b92..0000000000 --- a/sysdeps/generic/shmctl.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/shmdt.c b/sysdeps/generic/shmdt.c deleted file mode 100644 index e77f39daac..0000000000 --- a/sysdeps/generic/shmdt.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/shmget.c b/sysdeps/generic/shmget.c deleted file mode 100644 index 7426de656d..0000000000 --- a/sysdeps/generic/shmget.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -/* 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 diff --git a/sysdeps/generic/shutdown.c b/sysdeps/generic/shutdown.c deleted file mode 100644 index 6fb25a4bc1..0000000000 --- a/sysdeps/generic/shutdown.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sigaction.c b/sysdeps/generic/sigaction.c deleted file mode 100644 index bf0a15bacb..0000000000 --- a/sysdeps/generic/sigaction.c +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/sigaltstack.c b/sysdeps/generic/sigaltstack.c deleted file mode 100644 index 17c7e06b35..0000000000 --- a/sysdeps/generic/sigaltstack.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sigblock.c b/sysdeps/generic/sigblock.c deleted file mode 100644 index 81a4ff1447..0000000000 --- a/sysdeps/generic/sigblock.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sigfillset.c b/sysdeps/generic/sigfillset.c deleted file mode 100644 index 95d52cf0c0..0000000000 --- a/sysdeps/generic/sigfillset.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 734422dd81..0000000000 --- a/sysdeps/generic/sigignore.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - - -/* Set the disposition for SIG to SIG_IGN. */ -int -sigignore (sig) - int sig; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (sigignore) -#include diff --git a/sysdeps/generic/sigintr.c b/sysdeps/generic/sigintr.c deleted file mode 100644 index 9d4c2c8f58..0000000000 --- a/sysdeps/generic/sigintr.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sigjmp.c b/sysdeps/generic/sigjmp.c deleted file mode 100644 index b23c547f5e..0000000000 --- a/sysdeps/generic/sigjmp.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 80847cd491..0000000000 --- a/sysdeps/generic/siglist.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include -#include - -const char *const _sys_siglist[NSIG] = -{ -#define init_sig(sig, abbrev, desc) [sig] = desc, -#include -#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 -#undef init_sig -}; diff --git a/sysdeps/generic/signal.c b/sysdeps/generic/signal.c deleted file mode 100644 index 6c1808bb15..0000000000 --- a/sysdeps/generic/signal.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/signame.c b/sysdeps/generic/signame.c deleted file mode 100644 index 6085532e28..0000000000 --- a/sysdeps/generic/signame.c +++ /dev/null @@ -1,312 +0,0 @@ -/* 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 -#endif - -#include -#include /* Some systems need this for . */ -#include - -#ifdef HAVE_STRING_H -#include -#endif - -/* Some systems declare `sys_siglist in ; if - configure defined SYS_SIGLIST_DECLARED, it may expect - to find the declaration there. */ -#ifdef HAVE_UNISTD_H -#include -#endif - - -/* Some systems do not define NSIG in . */ -#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 deleted file mode 100644 index d829e860b4..0000000000 --- a/sysdeps/generic/signame.h +++ /dev/null @@ -1,67 +0,0 @@ -/* 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 deleted file mode 100644 index bc598d070c..0000000000 --- a/sysdeps/generic/sigpause.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 -#include -#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 - - -int -__attribute ((weak)) -__xpg___sigpause (int sig) -{ - __set_errno (ENOSYS); - return -1; -} diff --git a/sysdeps/generic/sigpending.c b/sysdeps/generic/sigpending.c deleted file mode 100644 index 80e16e588c..0000000000 --- a/sysdeps/generic/sigpending.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sigprocmask.c b/sysdeps/generic/sigprocmask.c deleted file mode 100644 index 472b3a4fa5..0000000000 --- a/sysdeps/generic/sigprocmask.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 -#include - - -/* 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 deleted file mode 100644 index c6e77c0a27..0000000000 --- a/sysdeps/generic/sigqueue.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -int -__sigqueue (pid_t pid, int sig, const union sigval val) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__sigqueue, sigqueue) - -stub_warning (sigqueue) -#include diff --git a/sysdeps/generic/sigreturn.c b/sysdeps/generic/sigreturn.c deleted file mode 100644 index 0239b0a98c..0000000000 --- a/sysdeps/generic/sigreturn.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -int -__sigreturn (context) - struct sigcontext *context; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (sigreturn) - -weak_alias (__sigreturn, sigreturn) -#include diff --git a/sysdeps/generic/sigset.c b/sysdeps/generic/sigset.c deleted file mode 100644 index 191a909158..0000000000 --- a/sysdeps/generic/sigset.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - - -/* Set the disposition for SIG. */ -__sighandler_t -sigset (sig, disp) - int sig; - __sighandler_t disp; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (sigset) -#include diff --git a/sysdeps/generic/sigsetmask.c b/sysdeps/generic/sigsetmask.c deleted file mode 100644 index 602c0add40..0000000000 --- a/sysdeps/generic/sigsetmask.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -int -__sigsetmask (mask) - int mask; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (sigsetmask) - -weak_alias (__sigsetmask, sigsetmask) -#include diff --git a/sysdeps/generic/sigstack.c b/sysdeps/generic/sigstack.c deleted file mode 100644 index ca9c8018a4..0000000000 --- a/sysdeps/generic/sigstack.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sigsuspend.c b/sysdeps/generic/sigsuspend.c deleted file mode 100644 index 58452e334c..0000000000 --- a/sysdeps/generic/sigsuspend.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/sigtimedwait.c b/sysdeps/generic/sigtimedwait.c deleted file mode 100644 index 7b114a3133..0000000000 --- a/sysdeps/generic/sigtimedwait.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/sigvec.c b/sysdeps/generic/sigvec.c deleted file mode 100644 index 148e9a0d85..0000000000 --- a/sysdeps/generic/sigvec.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/sigwait.c b/sysdeps/generic/sigwait.c deleted file mode 100644 index 016768553d..0000000000 --- a/sysdeps/generic/sigwait.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -int -__sigwait (const sigset_t *set, int *sig) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__sigwait, sigwait) - -stub_warning (sigwait) -#include diff --git a/sysdeps/generic/sigwaitinfo.c b/sysdeps/generic/sigwaitinfo.c deleted file mode 100644 index e0659b0243..0000000000 --- a/sysdeps/generic/sigwaitinfo.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -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 diff --git a/sysdeps/generic/sleep.c b/sysdeps/generic/sleep.c deleted file mode 100644 index f9d2a6593f..0000000000 --- a/sysdeps/generic/sleep.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/sockatmark.c b/sysdeps/generic/sockatmark.c deleted file mode 100644 index 402ef9b4d0..0000000000 --- a/sysdeps/generic/sockatmark.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* Determine wheter socket is at a out-of-band mark. */ -int -sockatmark (fd) - int fd; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (sockatmark) -#include diff --git a/sysdeps/generic/socket.c b/sysdeps/generic/socket.c deleted file mode 100644 index 94e70bc4ea..0000000000 --- a/sysdeps/generic/socket.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/socketpair.c b/sysdeps/generic/socketpair.c deleted file mode 100644 index ad277c00e5..0000000000 --- a/sysdeps/generic/socketpair.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/spawni.c b/sysdeps/generic/spawni.c deleted file mode 100644 index c7d5f59ffc..0000000000 --- a/sysdeps/generic/spawni.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include -#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 diff --git a/sysdeps/generic/speed.c b/sysdeps/generic/speed.c deleted file mode 100644 index b4acd62230..0000000000 --- a/sysdeps/generic/speed.c +++ /dev/null @@ -1,72 +0,0 @@ -/* `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 -#include -#include - -/* 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 deleted file mode 100644 index 037ed4672e..0000000000 --- a/sysdeps/generic/sprofil.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. - Contributed by David Mosberger-Tang . - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include - -#include -#include - -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 deleted file mode 100644 index 6cba9b7fba..0000000000 --- a/sysdeps/generic/sstk.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 - -/* 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 diff --git a/sysdeps/generic/start.c b/sysdeps/generic/start.c deleted file mode 100644 index 08f985c482..0000000000 --- a/sysdeps/generic/start.c +++ /dev/null @@ -1,13 +0,0 @@ -/* 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 deleted file mode 100644 index af4a9ea4e5..0000000000 --- a/sysdeps/generic/statfs.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/statfs64.c b/sysdeps/generic/statfs64.c deleted file mode 100644 index cf1a7d82a4..0000000000 --- a/sysdeps/generic/statfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/statvfs.c b/sysdeps/generic/statvfs.c deleted file mode 100644 index 22e24cfeeb..0000000000 --- a/sysdeps/generic/statvfs.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/statvfs64.c b/sysdeps/generic/statvfs64.c deleted file mode 100644 index 4424abdbea..0000000000 --- a/sysdeps/generic/statvfs64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/stime.c b/sysdeps/generic/stime.c deleted file mode 100644 index 5ed1b040e2..0000000000 --- a/sysdeps/generic/stime.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/stpcpy.c b/sysdeps/generic/stpcpy.c deleted file mode 100644 index 6e42911fde..0000000000 --- a/sysdeps/generic/stpcpy.c +++ /dev/null @@ -1,55 +0,0 @@ -/* 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 -#endif - -#include - -#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 deleted file mode 100644 index dacda0115a..0000000000 --- a/sysdeps/generic/stpcpy_chk.c +++ /dev/null @@ -1,45 +0,0 @@ -/* 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 -#endif - -#include - - -/* 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 deleted file mode 100644 index 164d0f1747..0000000000 --- a/sysdeps/generic/stpncpy.c +++ /dev/null @@ -1,100 +0,0 @@ -/* 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 -#endif - -#ifdef _LIBC -# include -#else -# include -#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/stpncpy_chk.c b/sysdeps/generic/stpncpy_chk.c deleted file mode 100644 index d136339dea..0000000000 --- a/sysdeps/generic/stpncpy_chk.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 1993,1995,1996,1997,2002,2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along 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. */ - -#include - - -/* 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_chk (char *dest, const char *src, size_t n, size_t destlen) -{ - char c; - char *s = dest; - - if (__builtin_expect (destlen < n, 0)) - __chk_fail (); - - 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; -} diff --git a/sysdeps/generic/strcasecmp.c b/sysdeps/generic/strcasecmp.c deleted file mode 100644 index 3ae3d67d04..0000000000 --- a/sysdeps/generic/strcasecmp.c +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 -#endif - -#include -#include - -#ifndef _LIBC -# define __strcasecmp strcasecmp -# define TOLOWER(Ch) tolower (Ch) -#else -# include -# 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 deleted file mode 100644 index 1cd3fe14c5..0000000000 --- a/sysdeps/generic/strcasecmp_l.c +++ /dev/null @@ -1,23 +0,0 @@ -/* 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 - -libc_hidden_def (__strcasecmp_l) -weak_alias (__strcasecmp_l, strcasecmp_l) diff --git a/sysdeps/generic/strcasestr.c b/sysdeps/generic/strcasestr.c deleted file mode 100644 index 1dde43c606..0000000000 --- a/sysdeps/generic/strcasestr.c +++ /dev/null @@ -1,142 +0,0 @@ -/* 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 -#endif - -#include - -#if defined _LIBC || defined HAVE_STRING_H -# include -#endif - -#ifdef _LIBC -# include -# 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 deleted file mode 100644 index eef22add36..0000000000 --- a/sysdeps/generic/strcat.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index b3fb3470b7..0000000000 --- a/sysdeps/generic/strcat_chk.c +++ /dev/null @@ -1,58 +0,0 @@ -/* 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 -#include - - -/* 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 deleted file mode 100644 index c8b7969e85..0000000000 --- a/sysdeps/generic/strchr.c +++ /dev/null @@ -1,190 +0,0 @@ -/* 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 -#include -#include - -#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 deleted file mode 100644 index 88b96dd126..0000000000 --- a/sysdeps/generic/strchrnul.c +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright (C) 1991,1993-1997,99,2000,2005 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 -#include -#include - -#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 = (const unsigned char *) 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 deleted file mode 100644 index bd53c05c6e..0000000000 --- a/sysdeps/generic/strcmp.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index c736a60762..0000000000 --- a/sysdeps/generic/strcpy.c +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 -#include -#include -#include - -#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 deleted file mode 100644 index a4d909feda..0000000000 --- a/sysdeps/generic/strcpy_chk.c +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 -#include -#include - -#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 deleted file mode 100644 index f359d578f7..0000000000 --- a/sysdeps/generic/strcspn.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 -#endif - -#if defined _LIBC || HAVE_STRING_H -# include -#else -# include -# 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 deleted file mode 100644 index 89a5baab5d..0000000000 --- a/sysdeps/generic/string-inlines.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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. */ - -/* and 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 -#undef index -#undef rindex - -#undef __NO_INLINE__ -#include -#include diff --git a/sysdeps/generic/strlen.c b/sysdeps/generic/strlen.c deleted file mode 100644 index 9bc9db68f7..0000000000 --- a/sysdeps/generic/strlen.c +++ /dev/null @@ -1,153 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index a55aaf6a3a..0000000000 --- a/sysdeps/generic/strncase.c +++ /dev/null @@ -1,76 +0,0 @@ -/* 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 -#endif - -#include -#include - -#ifndef weak_alias -# define __strncasecmp strncasecmp -# define TOLOWER(Ch) tolower (Ch) -#else -# include -# 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 deleted file mode 100644 index 0e61ebec7d..0000000000 --- a/sysdeps/generic/strncase_l.c +++ /dev/null @@ -1,25 +0,0 @@ -/* 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 - -libc_hidden_def (__strncasecmp_l) -weak_alias (__strncasecmp_l, strncasecmp_l) diff --git a/sysdeps/generic/strncat.c b/sysdeps/generic/strncat.c deleted file mode 100644 index 2e2de11508..0000000000 --- a/sysdeps/generic/strncat.c +++ /dev/null @@ -1,85 +0,0 @@ -/* 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 - -#ifdef _LIBC -# include -#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 deleted file mode 100644 index 953b435a4b..0000000000 --- a/sysdeps/generic/strncat_chk.c +++ /dev/null @@ -1,100 +0,0 @@ -/* 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 - -#include - - -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 deleted file mode 100644 index 1adb2c0ebd..0000000000 --- a/sysdeps/generic/strncmp.c +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index f32612e1cf..0000000000 --- a/sysdeps/generic/strncpy.c +++ /dev/null @@ -1,87 +0,0 @@ -/* 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 -#include - -#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 deleted file mode 100644 index bdede7738b..0000000000 --- a/sysdeps/generic/strncpy_chk.c +++ /dev/null @@ -1,89 +0,0 @@ -/* 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 -#include - - -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 deleted file mode 100644 index 454257b2bc..0000000000 --- a/sysdeps/generic/strnlen.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 1991,1993,1997,2000,2001,2005 Free Software Foundation, Inc. - Contributed by Jakub Jelinek . - - 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 -#include - -/* 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) -libc_hidden_def (strnlen) diff --git a/sysdeps/generic/strpbrk.c b/sysdeps/generic/strpbrk.c deleted file mode 100644 index 620cfab7f9..0000000000 --- a/sysdeps/generic/strpbrk.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#endif - -#if defined _LIBC || defined HAVE_CONFIG_H -# include -#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 deleted file mode 100644 index 64118b87ef..0000000000 --- a/sysdeps/generic/strrchr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index e5342f7a22..0000000000 --- a/sysdeps/generic/strsep.c +++ /dev/null @@ -1,70 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index dc17ea8cbc..0000000000 --- a/sysdeps/generic/strspn.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index fce1f2a756..0000000000 --- a/sysdeps/generic/strstr.c +++ /dev/null @@ -1,123 +0,0 @@ -/* 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 -#endif - -#if defined _LIBC || defined HAVE_STRING_H -# include -#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 deleted file mode 100644 index f1de70f320..0000000000 --- a/sysdeps/generic/strtoimax.c +++ /dev/null @@ -1 +0,0 @@ -#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 deleted file mode 100644 index f45b760f74..0000000000 --- a/sysdeps/generic/strtok.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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 - - -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 deleted file mode 100644 index b11cb520f6..0000000000 --- a/sysdeps/generic/strtok_r.c +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 -#endif - -#include - -#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 deleted file mode 100644 index 02ec19aabe..0000000000 --- a/sysdeps/generic/strtol.c +++ /dev/null @@ -1,111 +0,0 @@ -/* 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 -#include -#include - -#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 deleted file mode 100644 index 156083c748..0000000000 --- a/sysdeps/generic/strtol_l.c +++ /dev/null @@ -1,557 +0,0 @@ -/* 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 , 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 -#endif - -#ifdef _LIBC -# define USE_NUMBER_GROUPING -# define STDC_HEADERS -# define HAVE_LIMITS_H -#endif - -#include -#include -#ifndef __set_errno -# define __set_errno(Val) errno = (Val) -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#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 -#endif - -#ifdef USE_WIDE_CHAR -# include -# 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 . */ - 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 deleted file mode 100644 index 690a8a92eb..0000000000 --- a/sysdeps/generic/strtold_l.c +++ /dev/null @@ -1,58 +0,0 @@ -/* 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 -#include -#include - -#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 deleted file mode 100644 index 60128df781..0000000000 --- a/sysdeps/generic/strtoll.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 - -#ifdef _LIBC -# ifdef SHARED -# include - -# 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 deleted file mode 100644 index 7725035bd1..0000000000 --- a/sysdeps/generic/strtoll_l.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - -extern long long int ____strtoll_l_internal (const char *, char **, int, int, - __locale_t); - -#include diff --git a/sysdeps/generic/strtoul.c b/sysdeps/generic/strtoul.c deleted file mode 100644 index 0862950231..0000000000 --- a/sysdeps/generic/strtoul.c +++ /dev/null @@ -1,21 +0,0 @@ -/* 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 deleted file mode 100644 index a8b980f48d..0000000000 --- a/sysdeps/generic/strtoul_l.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 , 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 - -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 deleted file mode 100644 index accf5874a0..0000000000 --- a/sysdeps/generic/strtoull.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 - -#ifdef _LIBC -# ifdef SHARED -# include - -# 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 deleted file mode 100644 index 68ad0d826e..0000000000 --- a/sysdeps/generic/strtoull_l.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 , 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 - -extern unsigned long long int ____strtoull_l_internal (const char *, char **, - int, int, __locale_t); - -#include diff --git a/sysdeps/generic/strtoumax.c b/sysdeps/generic/strtoumax.c deleted file mode 100644 index 508cb19f8c..0000000000 --- a/sysdeps/generic/strtoumax.c +++ /dev/null @@ -1 +0,0 @@ -#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 deleted file mode 100644 index c66495bb3d..0000000000 --- a/sysdeps/generic/strtsupp.c +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 49c569a77b..0000000000 --- a/sysdeps/generic/stty.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/sub_n.c b/sysdeps/generic/sub_n.c deleted file mode 100644 index 4f2f06099c..0000000000 --- a/sysdeps/generic/sub_n.c +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 deleted file mode 100644 index c7c08ee4af..0000000000 --- a/sysdeps/generic/submul_1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 deleted file mode 100644 index 56b73f0d6c..0000000000 --- a/sysdeps/generic/swapcontext.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -int -swapcontext (oucp, ucp) - ucontext_t *oucp; - const ucontext_t *ucp; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (swapcontext) -#include diff --git a/sysdeps/generic/swapoff.c b/sysdeps/generic/swapoff.c deleted file mode 100644 index 033d841d95..0000000000 --- a/sysdeps/generic/swapoff.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* Stop using block special device PATH for swapping. */ -int -swapoff (const char *path) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (swapoff) -#include diff --git a/sysdeps/generic/swapon.c b/sysdeps/generic/swapon.c deleted file mode 100644 index 910781fa93..0000000000 --- a/sysdeps/generic/swapon.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/symlink.c b/sysdeps/generic/symlink.c deleted file mode 100644 index e6c6709f1a..0000000000 --- a/sysdeps/generic/symlink.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sync.c b/sysdeps/generic/sync.c deleted file mode 100644 index 5ccdb5d5bf..0000000000 --- a/sysdeps/generic/sync.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* Make all changes done to all files actually appear on disk. */ -void -sync () -{ - __set_errno (ENOSYS); -} - - -stub_warning (sync) -#include diff --git a/sysdeps/generic/syscall.c b/sysdeps/generic/syscall.c deleted file mode 100644 index ad78a06b73..0000000000 --- a/sysdeps/generic/syscall.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/sysconf.c b/sysdeps/generic/sysconf.c deleted file mode 100644 index f22685cb29..0000000000 --- a/sysdeps/generic/sysconf.c +++ /dev/null @@ -1,273 +0,0 @@ -/* 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 -#include -#include -#include -#include -#include -#include -#include -#include - - -/* 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 diff --git a/sysdeps/generic/sysdep.c b/sysdeps/generic/sysdep.c deleted file mode 100644 index 5442eee00d..0000000000 --- a/sysdeps/generic/sysdep.c +++ /dev/null @@ -1,2 +0,0 @@ -/* This file should contain any system-dependent functions - that will be used by many parts of the library. */ diff --git a/sysdeps/generic/syslog.c b/sysdeps/generic/syslog.c deleted file mode 100644 index 9c5597f5aa..0000000000 --- a/sysdeps/generic/syslog.c +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Copyright (c) 1983, 1988, 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. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if __STDC__ -#include -#else -#include -#endif - -#include -#define ftell(s) INTUSE(_IO_ftell) (s) - -static int LogType = SOCK_DGRAM; /* type of socket connection */ -static int LogFile = -1; /* fd for log */ -static int connected; /* have done connect */ -static int LogStat; /* status bits, set by openlog() */ -static const char *LogTag; /* string to tag the entry with */ -static int LogFacility = LOG_USER; /* default facility code */ -static int LogMask = 0xff; /* mask of priorities to be logged */ -extern char *__progname; /* Program name, from crt0. */ - -/* Define the lock. */ -__libc_lock_define_initialized (static, syslog_lock) - -static void openlog_internal(const char *, int, int) internal_function; -static void closelog_internal(void); -#ifndef NO_SIGPIPE -static void sigpipe_handler (int); -#endif - -#ifndef send_flags -# define send_flags 0 -#endif - -struct cleanup_arg -{ - void *buf; - struct sigaction *oldaction; -}; - -static void -cancel_handler (void *ptr) -{ -#ifndef NO_SIGPIPE - /* Restore the old signal handler. */ - struct cleanup_arg *clarg = (struct cleanup_arg *) ptr; - - if (clarg != NULL && clarg->oldaction != NULL) - __sigaction (SIGPIPE, clarg->oldaction, NULL); -#endif - - /* Free the lock. */ - __libc_lock_unlock (syslog_lock); -} - - -/* - * syslog, vsyslog -- - * print message on log file; output is intended for syslogd(8). - */ -void -syslog(int pri, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - __vsyslog_chk(pri, -1, fmt, ap); - va_end(ap); -} -libc_hidden_def (syslog) - -void -__syslog_chk(int pri, int flag, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - __vsyslog_chk(pri, flag, fmt, ap); - va_end(ap); -} - -void -__vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) -{ - struct tm now_tm; - time_t now; - int fd; - FILE *f; - char *buf = 0; - size_t bufsize = 0; - size_t prioff, msgoff; -#ifndef NO_SIGPIPE - struct sigaction action, oldaction; - int sigpipe; -#endif - int saved_errno = errno; - char failbuf[3 * sizeof (pid_t) + sizeof "out of memory []"]; - -#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID - /* Check for invalid bits. */ - if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) { - syslog(INTERNALLOG, - "syslog: unknown facility/priority: %x", pri); - pri &= LOG_PRIMASK|LOG_FACMASK; - } - - /* Check priority against setlogmask values. */ - if ((LOG_MASK (LOG_PRI (pri)) & LogMask) == 0) - return; - - /* Set default facility if none specified. */ - if ((pri & LOG_FACMASK) == 0) - pri |= LogFacility; - - /* Build the message in a memory-buffer stream. */ - f = open_memstream (&buf, &bufsize); - if (f == NULL) - { - /* We cannot get a stream. There is not much we can do but - emitting an error messages. */ - char numbuf[3 * sizeof (pid_t)]; - char *nump; - char *endp = __stpcpy (failbuf, "out of memory ["); - pid_t pid = __getpid (); - - nump = numbuf + sizeof (numbuf); - /* The PID can never be zero. */ - do - *--nump = '0' + pid % 10; - while ((pid /= 10) != 0); - - endp = __mempcpy (endp, nump, (numbuf + sizeof (numbuf)) - nump); - *endp++ = ']'; - *endp = '\0'; - buf = failbuf; - bufsize = endp - failbuf; - msgoff = 0; - } - else - { - __fsetlocking (f, FSETLOCKING_BYCALLER); - prioff = fprintf (f, "<%d>", pri); - (void) time (&now); - f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr, - f->_IO_write_end - - f->_IO_write_ptr, - "%h %e %T ", - __localtime_r (&now, &now_tm), - &_nl_C_locobj); - msgoff = ftell (f); - if (LogTag == NULL) - LogTag = __progname; - if (LogTag != NULL) - fputs_unlocked (LogTag, f); - if (LogStat & LOG_PID) - fprintf (f, "[%d]", (int) __getpid ()); - if (LogTag != NULL) - { - putc_unlocked (':', f); - putc_unlocked (' ', f); - } - - /* Restore errno for %m format. */ - __set_errno (saved_errno); - - /* We have the header. Print the user's format into the - buffer. */ - if (flag == -1) - vfprintf (f, fmt, ap); - else - __vfprintf_chk (f, flag, fmt, ap); - - /* Close the memory stream; this will finalize the data - into a malloc'd buffer in BUF. */ - fclose (f); - } - - /* Output to stderr if requested. */ - if (LogStat & LOG_PERROR) { - struct iovec iov[2]; - register struct iovec *v = iov; - - v->iov_base = buf + msgoff; - v->iov_len = bufsize - msgoff; - /* Append a newline if necessary. */ - if (buf[bufsize - 1] != '\n') - { - ++v; - v->iov_base = (char *) "\n"; - v->iov_len = 1; - } - - __libc_cleanup_push (free, buf == failbuf ? NULL : buf); - - /* writev is a cancellation point. */ - (void)__writev(STDERR_FILENO, iov, v - iov + 1); - - __libc_cleanup_pop (0); - } - - /* Prepare for multiple users. We have to take care: open and - write are cancellation points. */ - struct cleanup_arg clarg; - clarg.buf = buf; - clarg.oldaction = NULL; - __libc_cleanup_push (cancel_handler, &clarg); - __libc_lock_lock (syslog_lock); - -#ifndef NO_SIGPIPE - /* Prepare for a broken connection. */ - memset (&action, 0, sizeof (action)); - action.sa_handler = sigpipe_handler; - sigemptyset (&action.sa_mask); - sigpipe = __sigaction (SIGPIPE, &action, &oldaction); - if (sigpipe == 0) - clarg.oldaction = &oldaction; -#endif - - /* Get connected, output the message to the local logger. */ - if (!connected) - openlog_internal(LogTag, LogStat | LOG_NDELAY, 0); - - /* If we have a SOCK_STREAM connection, also send ASCII NUL as - a record terminator. */ - if (LogType == SOCK_STREAM) - ++bufsize; - - if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0) - { - if (connected) - { - /* Try to reopen the syslog connection. Maybe it went - down. */ - closelog_internal (); - openlog_internal(LogTag, LogStat | LOG_NDELAY, 0); - } - - if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0) - { - closelog_internal (); /* attempt re-open next time */ - /* - * Output the message to the console; don't worry - * about blocking, if console blocks everything will. - * Make sure the error reported is the one from the - * syslogd failure. - */ - if (LogStat & LOG_CONS && - (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0) - { - dprintf (fd, "%s\r\n", buf + msgoff); - (void)__close(fd); - } - } - } - -#ifndef NO_SIGPIPE - if (sigpipe == 0) - __sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL); -#endif - - /* End of critical section. */ - __libc_cleanup_pop (0); - __libc_lock_unlock (syslog_lock); - - if (buf != failbuf) - free (buf); -} -libc_hidden_def (__vsyslog_chk) - -void -vsyslog(pri, fmt, ap) - int pri; - register const char *fmt; - va_list ap; -{ - __vsyslog_chk (pri, -1, fmt, ap); -} -libc_hidden_def (vsyslog) - -static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ - - -static void -internal_function -openlog_internal(const char *ident, int logstat, int logfac) -{ - if (ident != NULL) - LogTag = ident; - LogStat = logstat; - if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0) - LogFacility = logfac; - - int retry = 0; - while (retry < 2) { - if (LogFile == -1) { - SyslogAddr.sa_family = AF_UNIX; - (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, - sizeof(SyslogAddr.sa_data)); - if (LogStat & LOG_NDELAY) { - if ((LogFile = __socket(AF_UNIX, LogType, 0)) - == -1) - return; - (void)__fcntl(LogFile, F_SETFD, 1); - } - } - if (LogFile != -1 && !connected) - { - int old_errno = errno; - if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr)) - == -1) - { - int saved_errno = errno; - int fd = LogFile; - LogFile = -1; - (void)__close(fd); - __set_errno (old_errno); - if (saved_errno == EPROTOTYPE) - { - /* retry with the other type: */ - LogType = (LogType == SOCK_DGRAM - ? SOCK_STREAM : SOCK_DGRAM); - ++retry; - continue; - } - } else - connected = 1; - } - break; - } -} - -void -openlog (const char *ident, int logstat, int logfac) -{ - /* Protect against multiple users and cancellation. */ - __libc_cleanup_push (cancel_handler, NULL); - __libc_lock_lock (syslog_lock); - - openlog_internal (ident, logstat, logfac); - - __libc_cleanup_pop (1); -} - -#ifndef NO_SIGPIPE -static void -sigpipe_handler (int signo) -{ - closelog_internal (); -} -#endif - -static void -closelog_internal() -{ - if (!connected) - return; - - __close (LogFile); - LogFile = -1; - connected = 0; -} - -void -closelog () -{ - /* Protect against multiple users and cancellation. */ - __libc_cleanup_push (cancel_handler, NULL); - __libc_lock_lock (syslog_lock); - - closelog_internal (); - LogTag = NULL; - LogType = SOCK_DGRAM; /* this is the default */ - - /* Free the lock. */ - __libc_cleanup_pop (1); -} - -/* setlogmask -- set the log mask level */ -int -setlogmask(pmask) - int pmask; -{ - int omask; - - omask = LogMask; - if (pmask != 0) - LogMask = pmask; - return (omask); -} diff --git a/sysdeps/generic/system.c b/sysdeps/generic/system.c deleted file mode 100644 index cd12128cd8..0000000000 --- a/sysdeps/generic/system.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/sysv_signal.c b/sysdeps/generic/sysv_signal.c deleted file mode 100644 index 86dbb1d093..0000000000 --- a/sysdeps/generic/sysv_signal.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/t_sincosl.c b/sysdeps/generic/t_sincosl.c deleted file mode 100644 index 6b271e6ff1..0000000000 --- a/sysdeps/generic/t_sincosl.c +++ /dev/null @@ -1 +0,0 @@ -/* Empty. Not needed unless ldbl __kernel_* functions use it. */ diff --git a/sysdeps/generic/tcdrain.c b/sysdeps/generic/tcdrain.c deleted file mode 100644 index d28ddbf006..0000000000 --- a/sysdeps/generic/tcdrain.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/tcflow.c b/sysdeps/generic/tcflow.c deleted file mode 100644 index f4db981f28..0000000000 --- a/sysdeps/generic/tcflow.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/tcflush.c b/sysdeps/generic/tcflush.c deleted file mode 100644 index c95f78e4ae..0000000000 --- a/sysdeps/generic/tcflush.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/tcgetattr.c b/sysdeps/generic/tcgetattr.c deleted file mode 100644 index 6751e88b83..0000000000 --- a/sysdeps/generic/tcgetattr.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/tcgetpgrp.c b/sysdeps/generic/tcgetpgrp.c deleted file mode 100644 index 2a1d846e75..0000000000 --- a/sysdeps/generic/tcgetpgrp.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/tcsendbrk.c b/sysdeps/generic/tcsendbrk.c deleted file mode 100644 index 4f40cfb153..0000000000 --- a/sysdeps/generic/tcsendbrk.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/tcsetattr.c b/sysdeps/generic/tcsetattr.c deleted file mode 100644 index 205838c87b..0000000000 --- a/sysdeps/generic/tcsetattr.c +++ /dev/null @@ -1,108 +0,0 @@ -/* 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 -#include -#include - -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 diff --git a/sysdeps/generic/tcsetpgrp.c b/sysdeps/generic/tcsetpgrp.c deleted file mode 100644 index 59f58e59aa..0000000000 --- a/sysdeps/generic/tcsetpgrp.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/telldir.c b/sysdeps/generic/telldir.c deleted file mode 100644 index 7b14452327..0000000000 --- a/sysdeps/generic/telldir.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/tempname.c b/sysdeps/generic/tempname.c deleted file mode 100644 index 60c94d6409..0000000000 --- a/sysdeps/generic/tempname.c +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/time.c b/sysdeps/generic/time.c deleted file mode 100644 index ec66f119df..0000000000 --- a/sysdeps/generic/time.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/timer_create.c b/sysdeps/generic/timer_create.c deleted file mode 100644 index 0e3a6b0acc..0000000000 --- a/sysdeps/generic/timer_create.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/timer_delete.c b/sysdeps/generic/timer_delete.c deleted file mode 100644 index 4be55aa322..0000000000 --- a/sysdeps/generic/timer_delete.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* Delete timer TIMERID. */ -int -timer_delete (timer_t timerid) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (timer_delete) -#include diff --git a/sysdeps/generic/timer_getoverr.c b/sysdeps/generic/timer_getoverr.c deleted file mode 100644 index 6ca7ff8e9e..0000000000 --- a/sysdeps/generic/timer_getoverr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* Get expiration overrun for timer TIMERID. */ -int -timer_getoverrun (timer_t timerid) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (timer_getoverrun) -#include diff --git a/sysdeps/generic/timer_gettime.c b/sysdeps/generic/timer_gettime.c deleted file mode 100644 index 728028ed3e..0000000000 --- a/sysdeps/generic/timer_gettime.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/timer_settime.c b/sysdeps/generic/timer_settime.c deleted file mode 100644 index f494a0edd1..0000000000 --- a/sysdeps/generic/timer_settime.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/times.c b/sysdeps/generic/times.c deleted file mode 100644 index b4e08156ae..0000000000 --- a/sysdeps/generic/times.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/tmpfile.c b/sysdeps/generic/tmpfile.c deleted file mode 100644 index 41f12bc8ba..0000000000 --- a/sysdeps/generic/tmpfile.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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 -#include - -#ifdef USE_IN_LIBIO -# include -# 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 -versioned_symbol (libc, __new_tmpfile, tmpfile, GLIBC_2_1); -#endif diff --git a/sysdeps/generic/tmpfile64.c b/sysdeps/generic/tmpfile64.c deleted file mode 100644 index adce634556..0000000000 --- a/sysdeps/generic/tmpfile64.c +++ /dev/null @@ -1,3 +0,0 @@ -#define GEN_THIS __GT_BIGFILE -#define tmpfile tmpfile64 -#include "tmpfile.c" diff --git a/sysdeps/generic/trampoline.c b/sysdeps/generic/trampoline.c deleted file mode 100644 index 7045a0d0ab..0000000000 --- a/sysdeps/generic/trampoline.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 6d0f0c3bcb..0000000000 --- a/sysdeps/generic/truncate.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/truncate64.c b/sysdeps/generic/truncate64.c deleted file mode 100644 index d7e80dc3ae..0000000000 --- a/sysdeps/generic/truncate64.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 -#include -#include - -/* 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-timer.c b/sysdeps/generic/tst-timer.c deleted file mode 100644 index d9b69a2467..0000000000 --- a/sysdeps/generic/tst-timer.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 - -/* 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 deleted file mode 100644 index 088ba918a8..0000000000 --- a/sysdeps/generic/ttyname.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include -#include - - -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 diff --git a/sysdeps/generic/ttyname_r.c b/sysdeps/generic/ttyname_r.c deleted file mode 100644 index 14c1209096..0000000000 --- a/sysdeps/generic/ttyname_r.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - - -/* 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 diff --git a/sysdeps/generic/ualarm.c b/sysdeps/generic/ualarm.c deleted file mode 100644 index 4ca0847576..0000000000 --- a/sysdeps/generic/ualarm.c +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/udiv_qrnnd.c b/sysdeps/generic/udiv_qrnnd.c deleted file mode 100644 index d32796c04d..0000000000 --- a/sysdeps/generic/udiv_qrnnd.c +++ /dev/null @@ -1,10 +0,0 @@ -/* 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 deleted file mode 100644 index cc74054456..0000000000 --- a/sysdeps/generic/ulimit.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/umask.c b/sysdeps/generic/umask.c deleted file mode 100644 index 588d57e1ce..0000000000 --- a/sysdeps/generic/umask.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/uname.c b/sysdeps/generic/uname.c deleted file mode 100644 index e7c41648ed..0000000000 --- a/sysdeps/generic/uname.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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 -#include -#include -#include - -/* This file is created by the configuration process, and defines UNAME_*. */ -#include - -/* 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 deleted file mode 100644 index 1ec6d87ae1..0000000000 --- a/sysdeps/generic/unlink.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/unlinkat.c b/sysdeps/generic/unlinkat.c deleted file mode 100644 index f9a08b9903..0000000000 --- a/sysdeps/generic/unlinkat.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include - - -/* Remove the link named NAME. */ -int -unlinkat (fd, name, flag) - int fd; - const char *name; - int flag; -{ - if (name == NULL || (flag & AT_REMOVEDIR) != 0) - { - __set_errno (EINVAL); - return -1; - } - - if (fd < 0 && fd != AT_FDCWD) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (unlinkat) - -#include diff --git a/sysdeps/generic/unlockpt.c b/sysdeps/generic/unlockpt.c deleted file mode 100644 index c5c4890f59..0000000000 --- a/sysdeps/generic/unlockpt.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Zack Weinberg , 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 -#include - -/* 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 diff --git a/sysdeps/generic/updwtmp.c b/sysdeps/generic/updwtmp.c deleted file mode 100644 index 415e1dbd42..0000000000 --- a/sysdeps/generic/updwtmp.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 - -#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 deleted file mode 100644 index 13a7045286..0000000000 --- a/sysdeps/generic/updwtmpx.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -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 deleted file mode 100644 index 8f419f901a..0000000000 --- a/sysdeps/generic/usleep.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/ustat.c b/sysdeps/generic/ustat.c deleted file mode 100644 index 0aeee620c5..0000000000 --- a/sysdeps/generic/ustat.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -int -ustat (dev, ust) - dev_t dev; - struct ustat * ust; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (ustat) -#include diff --git a/sysdeps/generic/utime.c b/sysdeps/generic/utime.c deleted file mode 100644 index 3a3bcc38cc..0000000000 --- a/sysdeps/generic/utime.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/utimes.c b/sysdeps/generic/utimes.c deleted file mode 100644 index e4a6f0427f..0000000000 --- a/sysdeps/generic/utimes.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/utmp_file.c b/sysdeps/generic/utmp_file.c deleted file mode 100644 index e7743bfac8..0000000000 --- a/sysdeps/generic/utmp_file.c +++ /dev/null @@ -1,499 +0,0 @@ -/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper - and Paul Janzen , 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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 deleted file mode 100644 index 06ff80b982..0000000000 --- a/sysdeps/generic/utmpxname.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Mark Kettenis , 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 -#include - -int -utmpxname (const char *file) -{ - return __utmpname (file); -} diff --git a/sysdeps/generic/versionsort64.c b/sysdeps/generic/versionsort64.c deleted file mode 100644 index e471827023..0000000000 --- a/sysdeps/generic/versionsort64.c +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 -#include - -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 deleted file mode 100644 index d15841d712..0000000000 --- a/sysdeps/generic/vfork.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 -#include - -/* 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 deleted file mode 100644 index 329fddbf24..0000000000 --- a/sysdeps/generic/vhangup.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/vlimit.c b/sysdeps/generic/vlimit.c deleted file mode 100644 index 03d89f4ad5..0000000000 --- a/sysdeps/generic/vlimit.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 37dc01b2fb..0000000000 --- a/sysdeps/generic/vtimes.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 -#include -#include - -/* 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 deleted file mode 100644 index 5a1158ea7a..0000000000 --- a/sysdeps/generic/w_acos.c +++ /dev/null @@ -1,48 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 28260ddd3e..0000000000 --- a/sysdeps/generic/w_acosf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index 2b5d60f7ea..0000000000 --- a/sysdeps/generic/w_acosh.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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 deleted file mode 100644 index f701983dc2..0000000000 --- a/sysdeps/generic/w_acoshf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index a37d4c15d9..0000000000 --- a/sysdeps/generic/w_acoshl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index cd9cecf2f9..0000000000 --- a/sysdeps/generic/w_acosl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index a7ca4ef9fd..0000000000 --- a/sysdeps/generic/w_asin.c +++ /dev/null @@ -1,49 +0,0 @@ -/* @(#)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 deleted file mode 100644 index d7f7a253b0..0000000000 --- a/sysdeps/generic/w_asinf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 deleted file mode 100644 index 0ac3038e95..0000000000 --- a/sysdeps/generic/w_asinl.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 deleted file mode 100644 index 801baa2347..0000000000 --- a/sysdeps/generic/w_atan2.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 09caa06f00..0000000000 --- a/sysdeps/generic/w_atan2f.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 deleted file mode 100644 index 2897c8c5f9..0000000000 --- a/sysdeps/generic/w_atan2l.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index e7995b1830..0000000000 --- a/sysdeps/generic/w_atanh.c +++ /dev/null @@ -1,52 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 0b24f2c71a..0000000000 --- a/sysdeps/generic/w_atanhf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 deleted file mode 100644 index d675fc6fe7..0000000000 --- a/sysdeps/generic/w_atanhl.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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 deleted file mode 100644 index 709f485c6d..0000000000 --- a/sysdeps/generic/w_cosh.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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 deleted file mode 100644 index c38fd1d93f..0000000000 --- a/sysdeps/generic/w_coshf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index cc1929a9ec..0000000000 --- a/sysdeps/generic/w_coshl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index 9e2b1e7472..0000000000 --- a/sysdeps/generic/w_drem.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * drem() wrapper for remainder(). - * - * Written by J.T. Conklin, - * Placed into the Public Domain, 1994. - */ - -#include - -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 deleted file mode 100644 index b740ea304c..0000000000 --- a/sysdeps/generic/w_dremf.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * dremf() wrapper for remainderf(). - * - * Written by J.T. Conklin, - * 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 deleted file mode 100644 index aa73eedc49..0000000000 --- a/sysdeps/generic/w_dreml.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * dreml() wrapper for remainderl(). - * - * Written by J.T. Conklin, - * Conversion to long double by Ulrich Drepper, - * Cygnus Support, drepper@cygnus.com. - * Placed into the Public Domain, 1994. - */ - -#include - -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 deleted file mode 100644 index 597506f22f..0000000000 --- a/sysdeps/generic/w_exp10.c +++ /dev/null @@ -1,51 +0,0 @@ -/* @(#)w_exp10.c - * Conversion to exp10 by Ulrich Drepper . - */ - -/* - * ==================================================== - * 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 deleted file mode 100644 index 1c510a3bfa..0000000000 --- a/sysdeps/generic/w_exp10f.c +++ /dev/null @@ -1,46 +0,0 @@ -/* w_exp10f.c -- float version of w_exp10.c. - * Conversion to exp10 by Ulrich Drepper . - */ - -/* - * ==================================================== - * 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 deleted file mode 100644 index aebddcb201..0000000000 --- a/sysdeps/generic/w_exp10l.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 deleted file mode 100644 index ccf6a1cd6a..0000000000 --- a/sysdeps/generic/w_exp2.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * wrapper exp2(x) - */ - -#include -#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, __exp2l) -weak_alias (__exp2, exp2l) -#endif diff --git a/sysdeps/generic/w_exp2f.c b/sysdeps/generic/w_exp2f.c deleted file mode 100644 index 13cfc9a19f..0000000000 --- a/sysdeps/generic/w_exp2f.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * wrapper exp2f(x) - */ - -#include -#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 deleted file mode 100644 index f492301223..0000000000 --- a/sysdeps/generic/w_exp2l.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * wrapper exp2l(x) - */ - -#include -#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 deleted file mode 100644 index 70096a820c..0000000000 --- a/sysdeps/generic/w_expl.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include - -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 deleted file mode 100644 index 0ceeb98c55..0000000000 --- a/sysdeps/generic/w_fmod.c +++ /dev/null @@ -1,48 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 9afe5ddfdd..0000000000 --- a/sysdeps/generic/w_fmodf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index 71ed4a94a4..0000000000 --- a/sysdeps/generic/w_fmodl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index e91db17083..0000000000 --- a/sysdeps/generic/w_hypot.c +++ /dev/null @@ -1,48 +0,0 @@ -/* @(#)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 deleted file mode 100644 index a7e5c1fdb6..0000000000 --- a/sysdeps/generic/w_hypotf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index 2ec215fd13..0000000000 --- a/sysdeps/generic/w_hypotl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index 5a018760bb..0000000000 --- a/sysdeps/generic/w_j0.c +++ /dev/null @@ -1,76 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 32e2eebb56..0000000000 --- a/sysdeps/generic/w_j0f.c +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 deleted file mode 100644 index b74d9ddcff..0000000000 --- a/sysdeps/generic/w_j0l.c +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 deleted file mode 100644 index 39fe8543b1..0000000000 --- a/sysdeps/generic/w_j1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 2a7c8db819..0000000000 --- a/sysdeps/generic/w_j1f.c +++ /dev/null @@ -1,75 +0,0 @@ -/* 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 deleted file mode 100644 index 49a486cf8e..0000000000 --- a/sysdeps/generic/w_j1l.c +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 deleted file mode 100644 index 85fc383fb7..0000000000 --- a/sysdeps/generic/w_jn.c +++ /dev/null @@ -1,99 +0,0 @@ -/* @(#)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 nx, 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 deleted file mode 100644 index 63ad335573..0000000000 --- a/sysdeps/generic/w_jnf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 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 deleted file mode 100644 index 866e3cdb00..0000000000 --- a/sysdeps/generic/w_jnl.c +++ /dev/null @@ -1,96 +0,0 @@ -/* 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 nx, 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 deleted file mode 100644 index 7c7f34ff39..0000000000 --- a/sysdeps/generic/w_lgamma.c +++ /dev/null @@ -1,60 +0,0 @@ -/* @(#)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 deleted file mode 100644 index f3e7d821e2..0000000000 --- a/sysdeps/generic/w_lgamma_r.c +++ /dev/null @@ -1,51 +0,0 @@ -/* @(#)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 deleted file mode 100644 index d0f6d0d17c..0000000000 --- a/sysdeps/generic/w_lgammaf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 deleted file mode 100644 index 66962acc7e..0000000000 --- a/sysdeps/generic/w_lgammaf_r.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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 deleted file mode 100644 index 1ee51a6f49..0000000000 --- a/sysdeps/generic/w_lgammal.c +++ /dev/null @@ -1,58 +0,0 @@ -/* 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 deleted file mode 100644 index 71f5c005d0..0000000000 --- a/sysdeps/generic/w_lgammal_r.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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 deleted file mode 100644 index 5f0af79731..0000000000 --- a/sysdeps/generic/w_log.c +++ /dev/null @@ -1,48 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 8a0a70bdf7..0000000000 --- a/sysdeps/generic/w_log10.c +++ /dev/null @@ -1,51 +0,0 @@ -/* @(#)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 deleted file mode 100644 index f90cb0cabc..0000000000 --- a/sysdeps/generic/w_log10f.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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 deleted file mode 100644 index 0d0861689d..0000000000 --- a/sysdeps/generic/w_log10l.c +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 deleted file mode 100644 index 7966ff359f..0000000000 --- a/sysdeps/generic/w_log2.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 deleted file mode 100644 index 1e2eb85d7b..0000000000 --- a/sysdeps/generic/w_log2f.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 deleted file mode 100644 index f41757c5e4..0000000000 --- a/sysdeps/generic/w_log2l.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 deleted file mode 100644 index 9eabe4b34c..0000000000 --- a/sysdeps/generic/w_logf.c +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 deleted file mode 100644 index bb979c26c3..0000000000 --- a/sysdeps/generic/w_logl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index 5850651a1a..0000000000 --- a/sysdeps/generic/w_pow.c +++ /dev/null @@ -1,70 +0,0 @@ - - -/* @(#)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 deleted file mode 100644 index 32196fd89f..0000000000 --- a/sysdeps/generic/w_powf.c +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 deleted file mode 100644 index 17feb9fc61..0000000000 --- a/sysdeps/generic/w_powl.c +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 deleted file mode 100644 index d85a3febce..0000000000 --- a/sysdeps/generic/w_remainder.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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 deleted file mode 100644 index 58255f5be5..0000000000 --- a/sysdeps/generic/w_remainderf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index 284140174d..0000000000 --- a/sysdeps/generic/w_remainderl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 deleted file mode 100644 index c981b858a9..0000000000 --- a/sysdeps/generic/w_scalb.c +++ /dev/null @@ -1,65 +0,0 @@ -/* @(#)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 - -#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 deleted file mode 100644 index 51056083e8..0000000000 --- a/sysdeps/generic/w_scalbf.c +++ /dev/null @@ -1,66 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 6a7d307104..0000000000 --- a/sysdeps/generic/w_scalbl.c +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 - -#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 deleted file mode 100644 index 9b34cd1873..0000000000 --- a/sysdeps/generic/w_sinh.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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 deleted file mode 100644 index a69cf3072d..0000000000 --- a/sysdeps/generic/w_sinhf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index 3e93cc598d..0000000000 --- a/sysdeps/generic/w_sinhl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index be15d959ea..0000000000 --- a/sysdeps/generic/w_sqrt.c +++ /dev/null @@ -1,47 +0,0 @@ -/* @(#)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 deleted file mode 100644 index f5ccc73868..0000000000 --- a/sysdeps/generic/w_sqrtf.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index 5873ce93ab..0000000000 --- a/sysdeps/generic/w_sqrtl.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 deleted file mode 100644 index 6e34b62be4..0000000000 --- a/sysdeps/generic/w_tgamma.c +++ /dev/null @@ -1,56 +0,0 @@ -/* @(#)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 deleted file mode 100644 index e7b0d87ab5..0000000000 --- a/sysdeps/generic/w_tgammaf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 deleted file mode 100644 index 793fa17ac1..0000000000 --- a/sysdeps/generic/w_tgammal.c +++ /dev/null @@ -1,55 +0,0 @@ -/* 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 deleted file mode 100644 index b1c512ed39..0000000000 --- a/sysdeps/generic/wait.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include - -/* 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 diff --git a/sysdeps/generic/wait3.c b/sysdeps/generic/wait3.c deleted file mode 100644 index 479d99e3da..0000000000 --- a/sysdeps/generic/wait3.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/wait4.c b/sysdeps/generic/wait4.c deleted file mode 100644 index b59bf87ffc..0000000000 --- a/sysdeps/generic/wait4.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 -#include -#include - -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 diff --git a/sysdeps/generic/waitid.c b/sysdeps/generic/waitid.c deleted file mode 100644 index a9de1a19a5..0000000000 --- a/sysdeps/generic/waitid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 , 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 -#include -#include - -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 deleted file mode 100644 index 9c7736e669..0000000000 --- a/sysdeps/generic/waitpid.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 -#include -#include - - -/* 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 diff --git a/sysdeps/generic/wcstoimax.c b/sysdeps/generic/wcstoimax.c deleted file mode 100644 index f1de70f320..0000000000 --- a/sysdeps/generic/wcstoimax.c +++ /dev/null @@ -1 +0,0 @@ -#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 deleted file mode 100644 index b121d13876..0000000000 --- a/sysdeps/generic/wcstol.c +++ /dev/null @@ -1,23 +0,0 @@ -/* 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 , 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 diff --git a/sysdeps/generic/wcstol_l.c b/sysdeps/generic/wcstol_l.c deleted file mode 100644 index f1b4171f18..0000000000 --- a/sysdeps/generic/wcstol_l.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 , 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 -#include - -#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 deleted file mode 100644 index b666762da4..0000000000 --- a/sysdeps/generic/wcstoll.c +++ /dev/null @@ -1,25 +0,0 @@ -/* 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 , 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 deleted file mode 100644 index f1a4ca1623..0000000000 --- a/sysdeps/generic/wcstoll_l.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 , 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 -#include - -#define QUAD 1 - -extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **, - int, int, __locale_t); - -#include diff --git a/sysdeps/generic/wcstoul.c b/sysdeps/generic/wcstoul.c deleted file mode 100644 index f25f7a9bff..0000000000 --- a/sysdeps/generic/wcstoul.c +++ /dev/null @@ -1,23 +0,0 @@ -/* 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 , 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 deleted file mode 100644 index 25058de817..0000000000 --- a/sysdeps/generic/wcstoul_l.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997, 2002, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -#include - -#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 deleted file mode 100644 index a69a103515..0000000000 --- a/sysdeps/generic/wcstoull.c +++ /dev/null @@ -1,25 +0,0 @@ -/* 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 , 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 deleted file mode 100644 index 32bc3c4bb9..0000000000 --- a/sysdeps/generic/wcstoull_l.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 , 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 -#include - -#define UNSIGNED 1 - -extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, - wchar_t **, int, int, - __locale_t); - -#include diff --git a/sysdeps/generic/wcstoumax.c b/sysdeps/generic/wcstoumax.c deleted file mode 100644 index 508cb19f8c..0000000000 --- a/sysdeps/generic/wcstoumax.c +++ /dev/null @@ -1 +0,0 @@ -#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 deleted file mode 100644 index 0c9a4be4f6..0000000000 --- a/sysdeps/generic/wordcopy.c +++ /dev/null @@ -1,413 +0,0 @@ -/* _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 -#include - -/* _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 deleted file mode 100644 index 2eb58089c4..0000000000 --- a/sysdeps/generic/wordexp.c +++ /dev/null @@ -1,2457 +0,0 @@ -/* POSIX.2 wordexp implementation. - Copyright (C) 1997-2002, 2003, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Tim Waugh . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef USE_IN_LIBIO -# include -#endif -#include - -#include -#include - -/* Undefine the following line for the production version. */ -/* #define NDEBUG 1 */ -#include - -/* Get some device information. */ -#include - -/* - * 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 inline void -internal_function __attribute__ ((always_inline)) -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]; -#define bufsize 128 - int buflen; - int i; - int status = 0; - size_t maxnewlines = 0; - char buffer[bufsize]; - pid_t pid; - int noexec = 0; - - /* Don't fork() unless necessary */ - if (!comm || !*comm) - return 0; - - if (__pipe (fildes)) - /* Bad */ - return WRDE_NOSPACE; - - again: - if ((pid = __fork ()) < 0) - { - /* Bad */ - if (fildes[0] != -1) - __close (fildes[0]); - if (fildes[1] != -1) - __close (fildes[1]); - return WRDE_NOSPACE; - } - - if (pid == 0) - exec_comm_child (comm, fildes, noexec ? 0 : flags & WRDE_SHOWERR, noexec); - - /* Parent */ - - /* If we are just testing the syntax, only wait. */ - if (noexec) - return (TEMP_FAILURE_RETRY (__waitpid (pid, &status, 0)) == pid - && status != 0) ? WRDE_SYNTAX : 0; - - __close (fildes[1]); - fildes[1] = -1; - - if (!pwordexp) - /* Quoted - no field splitting */ - { - while (1) - { - if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer, - bufsize))) < 1) - { - if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0) - continue; - if ((buflen = TEMP_FAILURE_RETRY (__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 = TEMP_FAILURE_RETRY (__read (fildes[0], buffer, - bufsize))) < 1) - { - if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0) - continue; - if ((buflen = TEMP_FAILURE_RETRY (__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: textmoretext - * - * 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]); - fildes[0] = -1; - - /* Check for syntax error (re-execute but with "-n" flag) */ - if (buflen < 1 && status != 0) - { - noexec = 1; - goto again; - } - - return 0; - -no_space: - __kill (pid, SIGKILL); - TEMP_FAILURE_RETRY (__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"); - - __fxprintf (NULL, "%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, - ¶m_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 . */ - 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 deleted file mode 100644 index 928d43ced2..0000000000 --- a/sysdeps/generic/write.c +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 -#include -#include -#include - -/* 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 diff --git a/sysdeps/generic/writev.c b/sysdeps/generic/writev.c deleted file mode 100644 index d424c72143..0000000000 --- a/sysdeps/generic/writev.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 -#include -#include - -/* 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 ) 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 diff --git a/sysdeps/generic/xmknod.c b/sysdeps/generic/xmknod.c deleted file mode 100644 index 57ed46060d..0000000000 --- a/sysdeps/generic/xmknod.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/xpg-strerror.c b/sysdeps/generic/xpg-strerror.c deleted file mode 100644 index 5cb56cdfb8..0000000000 --- a/sysdeps/generic/xpg-strerror.c +++ /dev/null @@ -1,57 +0,0 @@ -/* 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 -#include -#include -#include -#include -#include - -/* It is critical here that we always use the `dcgettext' function for - the message translation. Since only defines the macro - `dgettext' to use `dcgettext' for optimizing programs this is not - always guaranteed. */ -#ifndef dgettext -# include /* 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 deleted file mode 100644 index e7328cc10e..0000000000 --- a/sysdeps/generic/xstat.c +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/generic/xstat64.c b/sysdeps/generic/xstat64.c deleted file mode 100644 index 2fb94cf331..0000000000 --- a/sysdeps/generic/xstat64.c +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include -#include - -/* 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 diff --git a/sysdeps/gnu/glob64.c b/sysdeps/gnu/glob64.c index 210c9c2553..d1e4e6f0d5 100644 --- a/sysdeps/gnu/glob64.c +++ b/sysdeps/gnu/glob64.c @@ -19,7 +19,7 @@ #define COMPILE_GLOB64 1 -#include +#include libc_hidden_def (glob64) libc_hidden_def (globfree64) diff --git a/sysdeps/gnu/updwtmp.c b/sysdeps/gnu/updwtmp.c index 71a3003c96..e4f63088a9 100644 --- a/sysdeps/gnu/updwtmp.c +++ b/sysdeps/gnu/updwtmp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Mark Kettenis , 1998. @@ -27,4 +27,4 @@ && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \ file_name)) -#include +#include diff --git a/sysdeps/gnu/utmp_file.c b/sysdeps/gnu/utmp_file.c index 2fc925017c..5ef6f306cd 100644 --- a/sysdeps/gnu/utmp_file.c +++ b/sysdeps/gnu/utmp_file.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Mark Kettenis , 1998. @@ -27,4 +27,4 @@ && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \ file_name)) -#include +#include diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h index 7fb2af77d0..4395b8f562 100644 --- a/sysdeps/hppa/bits/setjmp.h +++ b/sysdeps/hppa/bits/setjmp.h @@ -17,8 +17,10 @@ 02111-1307 USA. */ /* Define the machine-dependent type `jmp_buf'. HPPA version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include directly; use instead." #endif @@ -39,3 +41,5 @@ typedef double __jmp_buf[21]; variable at ADDRESS. */ #define _JMPBUF_UNWINDS(_jmpbuf, _address) \ ((void *)(_address) > (void *)(((unsigned long *) _jmpbuf)[JB_SP])) + +#endif /* bits/setjmp.h */ diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S index 6b590f7f04..aced5f42c9 100644 --- a/sysdeps/i386/__longjmp.S +++ b/sysdeps/i386/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for i386. - Copyright (C) 1995,1996,1997,1998,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998,2000,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,6 +44,9 @@ ENTRY (BP_SYM (__longjmp)) movl (JB_DI*4)(%ecx), %edi movl (JB_BP*4)(%ecx), %ebp movl (JB_SP*4)(%ecx), %esp +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (%edx) +#endif /* Jump to saved PC. */ jmp *%edx END (BP_SYM (__longjmp)) diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S index aa8df167d0..f80d239323 100644 --- a/sysdeps/i386/bsd-_setjmp.S +++ b/sysdeps/i386/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version. - Copyright (C) 1994-1997,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000-2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -46,6 +46,9 @@ ENTRY (BP_SYM (_setjmp)) leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ movl %ecx, (JB_SP*4)(%edx) movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_PC*4)(%edx) LEAVE movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */ diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S index b6934dc548..f4257a0dc5 100644 --- a/sysdeps/i386/bsd-setjmp.S +++ b/sysdeps/i386/bsd-setjmp.S @@ -28,6 +28,10 @@ #include "bp-sym.h" #include "bp-asm.h" +#define PARMS LINKAGE /* no space for saved regs */ +#define JMPBUF PARMS +#define SIGMSK JMPBUF+PTR_SIZE + ENTRY (BP_SYM (setjmp)) /* Note that we have to use a non-exported symbol in the next jump since otherwise gas will emit it as a jump through the @@ -44,6 +48,9 @@ ENTRY (BP_SYM (setjmp)) leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ movl %ecx, (JB_SP*4)(%eax) movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_PC*4)(%eax) LEAVE /* pop frame pointer to prepare for tail-call. */ movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ diff --git a/sysdeps/i386/bzero.c b/sysdeps/i386/bzero.c index c2b135cb88..a1cfe36ba1 100644 --- a/sysdeps/i386/bzero.c +++ b/sysdeps/i386/bzero.c @@ -1,6 +1,6 @@ /* bzero -- set a block of memory to zero. For Intel 80x86, x>=3. This file is part of the GNU C Library. - Copyright (C) 1991,92,93,97,98,99 Free Software Foundation, Inc. + Copyright (C) 1991,92,93,97,98,99, 05 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or @@ -79,5 +79,5 @@ __bzero (dstpp, len) weak_alias (__bzero, bzero) #else -#include +#include #endif diff --git a/sysdeps/i386/elf/bsd-setjmp.S b/sysdeps/i386/elf/bsd-setjmp.S deleted file mode 100644 index c421791fe0..0000000000 --- a/sysdeps/i386/elf/bsd-setjmp.S +++ /dev/null @@ -1,82 +0,0 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version. - Copyright (C) 1995-1997,2000-2003,2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#define _ASM -#define _SETJMP_H -#include -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define JMPBUF PARMS -#define SIGMSK JMPBUF+PTR_SIZE - -ENTRY (BP_SYM (setjmp)) - /* Note that we have to use a non-exported symbol in the next - jump since otherwise gas will emit it as a jump through the - PLT which is what we cannot use here. */ - ENTER - - movl JMPBUF(%esp), %eax - CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE) - - /* Save registers. */ - movl %ebx, (JB_BX*4)(%eax) - movl %esi, (JB_SI*4)(%eax) - movl %edi, (JB_DI*4)(%eax) - leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%eax) - movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_PC*4)(%eax) - LEAVE /* pop frame pointer to prepare for tail-call. */ - movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ - - /* Call __sigjmp_save. */ - pushl $1 - cfi_adjust_cfa_offset (4) - pushl 8(%esp) - cfi_adjust_cfa_offset (4) -#ifdef PIC - /* We cannot use the PLT, because it requires that %ebx be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT, using for the temporary register - %ecx, which is call-clobbered. */ - call __i686.get_pc_thunk.cx - addl $_GLOBAL_OFFSET_TABLE_, %ecx - leal C_SYMBOL_NAME (BP_SYM (__sigjmp_save)@GOTOFF)(%ecx), %ecx - call *%ecx -#else - call BP_SYM (__sigjmp_save) -#endif - popl %ecx - cfi_adjust_cfa_offset (-4) - popl %edx - cfi_adjust_cfa_offset (-4) - ret -END (BP_SYM (setjmp)) - - .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits - .globl __i686.get_pc_thunk.cx - .hidden __i686.get_pc_thunk.cx - .type __i686.get_pc_thunk.cx,@function -__i686.get_pc_thunk.cx: - movl (%esp), %ecx - ret - .size __i686.get_pc_thunk.cx, . - __i686.get_pc_thunk.cx diff --git a/sysdeps/i386/elf/setjmp.S b/sysdeps/i386/elf/setjmp.S deleted file mode 100644 index d6ae98b8b4..0000000000 --- a/sysdeps/i386/elf/setjmp.S +++ /dev/null @@ -1,70 +0,0 @@ -/* setjmp for i386, ELF version. - Copyright (C) 1995-1997,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. */ - -#include -#define _ASM -#define _SETJMP_H -#include -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define JMPBUF PARMS -#define SIGMSK JMPBUF+PTR_SIZE - -ENTRY (BP_SYM (__sigsetjmp)) - ENTER - - movl JMPBUF(%esp), %eax - CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE) - - /* Save registers. */ - movl %ebx, (JB_BX*4)(%eax) - movl %esi, (JB_SI*4)(%eax) - movl %edi, (JB_DI*4)(%eax) - leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%eax) - movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_PC*4)(%eax) - LEAVE /* pop frame pointer to prepare for tail-call. */ - movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ - - /* Make a tail call to __sigjmp_save; it takes the same args. */ -#ifdef PIC - /* We cannot use the PLT, because it requires that %ebx be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT, using for the temporary register - %ecx, which is call-clobbered. */ - call __i686.get_pc_thunk.cx - addl $_GLOBAL_OFFSET_TABLE_, %ecx - leal C_SYMBOL_NAME (BP_SYM (__sigjmp_save)@GOTOFF)(%ecx), %ecx - jmp *%ecx -#else - jmp BP_SYM (__sigjmp_save) -#endif -END (BP_SYM (__sigsetjmp)) - - .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits - .globl __i686.get_pc_thunk.cx - .hidden __i686.get_pc_thunk.cx - .type __i686.get_pc_thunk.cx,@function -__i686.get_pc_thunk.cx: - movl (%esp), %ecx - ret - .size __i686.get_pc_thunk.cx, . - __i686.get_pc_thunk.cx diff --git a/sysdeps/i386/ffs.c b/sysdeps/i386/ffs.c index 695d48be56..b6aac64dd8 100644 --- a/sysdeps/i386/ffs.c +++ b/sysdeps/i386/ffs.c @@ -1,7 +1,7 @@ /* ffs -- find first set bit in a word, counted from least significant end. For Intel 80x86, x>=3. This file is part of the GNU C Library. - Copyright (C) 1991, 92, 93, 94, 97, 98, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 97, 98, 2004, 2005 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or @@ -47,5 +47,5 @@ libc_hidden_builtin_def (ffs) weak_alias (__ffs, ffsl) #else -#include +#include #endif diff --git a/sysdeps/i386/i686/ffs.c b/sysdeps/i386/i686/ffs.c index fd7ef1a3d6..684ae21827 100644 --- a/sysdeps/i386/i686/ffs.c +++ b/sysdeps/i386/i686/ffs.c @@ -1,7 +1,7 @@ /* ffs -- find first set bit in a word, counted from least significant end. For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 1991, 92, 93, 94, 97, 98, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 97, 98, 2004, 2005 Free Software Foundation, Inc. Contributed by Ulrich Drepper . The GNU C Library is free software; you can redistribute it and/or @@ -45,5 +45,5 @@ libc_hidden_builtin_def (ffs) weak_alias (__ffs, ffsl) #else -#include +#include #endif diff --git a/sysdeps/i386/memset.c b/sysdeps/i386/memset.c index 6a7fff8747..120df94d63 100644 --- a/sysdeps/i386/memset.c +++ b/sysdeps/i386/memset.c @@ -1,6 +1,6 @@ /* Set a block of memory to some byte value. For Intel 80x86, x>=3. - Copyright (C) 1991,1992,1993,1997,1998,2003 Free Software Foundation, Inc. + Copyright (C) 1991,1992,1993,1997,1998,2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). @@ -82,5 +82,5 @@ memset (void *dstpp, int c, size_t len) libc_hidden_builtin_def (memset) #else -#include +#include #endif diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S index e01d32b66c..747499adc2 100644 --- a/sysdeps/i386/setjmp.S +++ b/sysdeps/i386/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for i386. - Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,2000,2001,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -42,10 +42,19 @@ ENTRY (BP_SYM (__sigsetjmp)) leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ movl %ecx, (JB_SP*4)(%eax) movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_PC*4)(%eax) LEAVE /* pop frame pointer to prepare for tail-call. */ movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ +#if defined NOT_IN_libc && defined IS_IN_rtld + /* In ld.so we never save the signal mask. */ + xorl %eax, %eax + ret +#else /* Make a tail call to __sigjmp_save; it takes the same args. */ - jmp BP_SYM (__sigjmp_save) + jmp __sigjmp_save +#endif END (BP_SYM (__sigsetjmp)) diff --git a/sysdeps/ia64/fpu/printf_fphex.c b/sysdeps/ia64/fpu/printf_fphex.c index 42f64b2ab2..5def1905d8 100644 --- a/sysdeps/ia64/fpu/printf_fphex.c +++ b/sysdeps/ia64/fpu/printf_fphex.c @@ -1,5 +1,5 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -78,4 +78,4 @@ do { \ } \ } while (0) -#include +#include diff --git a/sysdeps/ia64/libc-tls.c b/sysdeps/ia64/libc-tls.c index 3a6b8e5532..2c0eeae86f 100644 --- a/sysdeps/ia64/libc-tls.c +++ b/sysdeps/ia64/libc-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. IA-64 version. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2005 Free Software 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,7 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include #if USE_TLS @@ -34,4 +34,3 @@ __tls_get_addr (size_t m, size_t offset) } #endif - diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c index 0cb6b293e0..361a9baa05 100644 --- a/sysdeps/ieee754/ldbl-128/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c @@ -1,6 +1,6 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -103,4 +103,4 @@ do { \ } \ } while (0) -#include +#include diff --git a/sysdeps/ieee754/ldbl-96/printf_fphex.c b/sysdeps/ieee754/ldbl-96/printf_fphex.c index 3c8183df2e..ba9f4c2960 100644 --- a/sysdeps/ieee754/ldbl-96/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-96/printf_fphex.c @@ -1,5 +1,5 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -90,4 +90,4 @@ do { \ } \ } while (0) -#include +#include diff --git a/sysdeps/ieee754/ldbl-96/strtold_l.c b/sysdeps/ieee754/ldbl-96/strtold_l.c index 32bf18084b..52335c227f 100644 --- a/sysdeps/ieee754/ldbl-96/strtold_l.c +++ b/sysdeps/ieee754/ldbl-96/strtold_l.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -42,4 +42,4 @@ (flt) = u.d; \ } while (0) -#include +#include diff --git a/sysdeps/m68k/bits/setjmp.h b/sysdeps/m68k/bits/setjmp.h index 2c2b3ee15a..193eec3509 100644 --- a/sysdeps/m68k/bits/setjmp.h +++ b/sysdeps/m68k/bits/setjmp.h @@ -17,8 +17,10 @@ 02111-1307 USA. */ /* Define the machine-dependent type `jmp_buf'. m68k version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 -#ifndef _SETJMP_H +#if !defined _SETJMP_H && !defined _PTHREAD_H # error "Never include directly; use instead." #endif @@ -44,3 +46,5 @@ typedef struct containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((void *) (address) < (void *) (jmpbuf)->__sp) + +#endif /* bits/setjmp.h */ diff --git a/sysdeps/m68k/ffs.c b/sysdeps/m68k/ffs.c index 189936b94f..2032e8662c 100644 --- a/sysdeps/m68k/ffs.c +++ b/sysdeps/m68k/ffs.c @@ -1,7 +1,7 @@ /* ffs -- find first set bit in a word, counted from least significant end. For mc68020, mc68030, mc68040. This file is part of the GNU C Library. - Copyright (C) 1991, 1992, 1997, 1998, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1997, 1998, 2004, 2005 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or @@ -43,6 +43,6 @@ weak_alias (__ffs, ffsl) #else -#include +#include #endif diff --git a/sysdeps/mach/hurd/getdents.c b/sysdeps/mach/hurd/getdents.c index 4775f983b4..d15be3b8f3 100644 --- a/sysdeps/mach/hurd/getdents.c +++ b/sysdeps/mach/hurd/getdents.c @@ -1 +1 @@ -#include +#include diff --git a/sysdeps/mach/hurd/init-posix.c b/sysdeps/mach/hurd/init-posix.c index 3eecf62769..eaf6332fe1 100644 --- a/sysdeps/mach/hurd/init-posix.c +++ b/sysdeps/mach/hurd/init-posix.c @@ -1,2 +1,2 @@ /* We don't need the unix/bsd version. */ -#include +#include diff --git a/sysdeps/mach/msync.c b/sysdeps/mach/msync.c index cf62960b4f..567143f728 100644 --- a/sysdeps/mach/msync.c +++ b/sysdeps/mach/msync.c @@ -1,5 +1,5 @@ /* msync -- Synchronize mapped memory to external storage. Mach version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,7 +26,7 @@ define the VM_SYNC_* bits when we include . */ #ifndef VM_SYNC_SYNCHRONOUS -# include +# include #else /* Synchronize the region starting at ADDR and extending LEN bytes with the diff --git a/sysdeps/mach/sys/reboot.h b/sysdeps/mach/sys/reboot.h index 5e49f7fa87..fc7308929b 100644 --- a/sysdeps/mach/sys/reboot.h +++ b/sysdeps/mach/sys/reboot.h @@ -24,137 +24,7 @@ * the rights to redistribute these changes. */ /* - * HISTORY - * $Log$ - * Revision 1.4 2002/07/06 06:36:00 aj - * * sysdeps/ia64/fpu/e_acos.S: Added text of Intel license. - * * sysdeps/ia64/fpu/e_acosf.S: Likewise. - * * sysdeps/ia64/fpu/e_acosl.S: Likewise. - * * sysdeps/ia64/fpu/e_asin.S: Likewise. - * * sysdeps/ia64/fpu/e_asinf.S: Likewise. - * * sysdeps/ia64/fpu/e_asinl.S: Likewise. - * * sysdeps/ia64/fpu/e_atan2.S: Likewise. - * * sysdeps/ia64/fpu/e_atan2f.S: Likewise. - * * sysdeps/ia64/fpu/e_cosh.S: Likewise. - * * sysdeps/ia64/fpu/e_coshf.S: Likewise. - * * sysdeps/ia64/fpu/e_coshl.S: Likewise. - * * sysdeps/ia64/fpu/e_exp.S: Likewise. - * * sysdeps/ia64/fpu/e_expf.S: Likewise. - * * sysdeps/ia64/fpu/e_fmod.S: Likewise. - * * sysdeps/ia64/fpu/e_fmodf.S: Likewise. - * * sysdeps/ia64/fpu/e_fmodl.S: Likewise. - * * sysdeps/ia64/fpu/e_hypot.S: Likewise. - * * sysdeps/ia64/fpu/e_hypotf.S: Likewise. - * * sysdeps/ia64/fpu/e_hypotl.S: Likewise. - * * sysdeps/ia64/fpu/e_log.S: Likewise. - * * sysdeps/ia64/fpu/e_logf.S: Likewise. - * * sysdeps/ia64/fpu/e_pow.S: Likewise. - * * sysdeps/ia64/fpu/e_powf.S: Likewise. - * * sysdeps/ia64/fpu/e_powl.S: Likewise. - * * sysdeps/ia64/fpu/e_remainder.S: Likewise. - * * sysdeps/ia64/fpu/e_remainderf.S: Likewise. - * * sysdeps/ia64/fpu/e_remainderl.S: Likewise. - * * sysdeps/ia64/fpu/e_scalb.S: Likewise. - * * sysdeps/ia64/fpu/e_scalbf.S: Likewise. - * * sysdeps/ia64/fpu/e_scalbl.S: Likewise. - * * sysdeps/ia64/fpu/e_sinh.S: Likewise. - * * sysdeps/ia64/fpu/e_sinhf.S: Likewise. - * * sysdeps/ia64/fpu/e_sinhl.S: Likewise. - * * sysdeps/ia64/fpu/e_sqrt.S: Likewise. - * * sysdeps/ia64/fpu/e_sqrtf.S: Likewise. - * * sysdeps/ia64/fpu/e_sqrtl.S: Likewise. - * * sysdeps/ia64/fpu/libm_atan2_req.S: Likewise. - * * sysdeps/ia64/fpu/libm_error.c: Likewise. - * * sysdeps/ia64/fpu/libm_frexp4.S: Likewise. - * * sysdeps/ia64/fpu/libm_frexp4f.S: Likewise. - * * sysdeps/ia64/fpu/s_frexpl.c: Likewise. - * * sysdeps/ia64/fpu/s_ilogb.S: Likewise. - * * sysdeps/ia64/fpu/s_ilogbf.S: Likewise. - * * sysdeps/ia64/fpu/s_ilogbl.S: Likewise. - * * sysdeps/ia64/fpu/s_ldexp.S: Likewise. - * * sysdeps/ia64/fpu/s_ldexpf.S: Likewise. - * * sysdeps/ia64/fpu/s_ldexpl.S: Likewise. - * * sysdeps/ia64/fpu/s_log1p.S: Likewise. - * * sysdeps/ia64/fpu/s_log1pf.S: Likewise. - * * sysdeps/ia64/fpu/s_log1pl.S: Likewise. - * * sysdeps/ia64/fpu/s_logb.S: Likewise. - * * sysdeps/ia64/fpu/s_logbf.S: Likewise. - * * sysdeps/ia64/fpu/s_logbl.S: Likewise. - * * sysdeps/ia64/fpu/s_modf.S: Likewise. - * * sysdeps/ia64/fpu/s_modff.S: Likewise. - * * sysdeps/ia64/fpu/s_modfl.S: Likewise. - * * sysdeps/ia64/fpu/s_nearbyint.S: Likewise. - * * sysdeps/ia64/fpu/s_nearbyintf.S: Likewise. - * * sysdeps/ia64/fpu/s_nearbyintl.S: Likewise. - * * sysdeps/ia64/fpu/s_rint.S: Likewise. - * * sysdeps/ia64/fpu/s_rintf.S: Likewise. - * * sysdeps/ia64/fpu/s_rintl.S: Likewise. - * * sysdeps/ia64/fpu/s_round.S: Likewise. - * * sysdeps/ia64/fpu/s_roundf.S: Likewise. - * * sysdeps/ia64/fpu/s_roundl.S: Likewise. - * * sysdeps/ia64/fpu/s_scalbn.S: Likewise. - * * sysdeps/ia64/fpu/s_scalbnf.S: Likewise. - * * sysdeps/ia64/fpu/s_scalbnl.S: Likewise. - * * sysdeps/ia64/fpu/s_significand.S: Likewise. - * * sysdeps/ia64/fpu/s_significandf.S: Likewise. - * * sysdeps/ia64/fpu/s_significandl.S: Likewise. - * * sysdeps/ia64/fpu/s_tan.S: Likewise. - * * sysdeps/ia64/fpu/s_tanf.S: Likewise. - * * sysdeps/ia64/fpu/s_tanl.S: Likewise. - * * sysdeps/ia64/fpu/s_trunc.S: Likewise. - * * sysdeps/ia64/fpu/s_truncf.S: Likewise. - * * sysdeps/ia64/fpu/s_truncl.S: Likewise. - * * sysdeps/ieee754/dbl-64/doasin.c: changed copyright notice to - * reflect IBM donation of math library to FSF - * * sysdeps/ieee754/dbl-64/dosincos.c: Likewise. - * * sysdeps/ieee754/dbl-64/e_asin.c: Likewise. - * * sysdeps/ieee754/dbl-64/e_atan2.c: Likewise. - * * sysdeps/ieee754/dbl-64/e_exp.c: Likewise. - * * sysdeps/ieee754/dbl-64/e_log.c: Likewise. - * * sysdeps/ieee754/dbl-64/e_pow.c: Likewise. - * * sysdeps/ieee754/dbl-64/e_remainder.c: Likewise. - * * sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise. - * * sysdeps/ieee754/dbl-64/halfulp.c: Likewise. - * * sysdeps/ieee754/dbl-64/mpa.c: Likewise. - * * sysdeps/ieee754/dbl-64/mpatan.c: Likewise. - * * sysdeps/ieee754/dbl-64/mpatan2.c: Likewise. - * * sysdeps/ieee754/dbl-64/mpexp.c: Likewise. - * * sysdeps/ieee754/dbl-64/mplog.c: Likewise. - * * sysdeps/ieee754/dbl-64/mpsqrt.c: Likewise. - * * sysdeps/ieee754/dbl-64/mptan.c: Likewise. - * * sysdeps/ieee754/dbl-64/s_atan.c: Likewise. - * * sysdeps/ieee754/dbl-64/s_sin.c: Likewise. - * * sysdeps/ieee754/dbl-64/s_tan.c: Likewise. - * * sysdeps/ieee754/dbl-64/sincos32.c: Likewise. - * * sysdeps/ieee754/dbl-64/slowexp.c: Likewise. - * * sysdeps/ieee754/dbl-64/slowpow.c: Likewise. - * * sysdeps/gnu/netinet/udp.h: Added BSD copying permission notice - * * sysdeps/vax/__longjmp.c: Likewise. - * * sysdeps/vax/setjmp.c: Likewise. - * * libio/filedoalloc.c: Fixed BSD copying permission notice to remove - * advertising clause - * * sysdeps/vax/htonl.s: Likewise. - * * sysdeps/vax/htons.s: Likewise. - * * libio/wfiledoalloc.c: Likewise. - * * stdlib/random.c: Likewise. - * * stdlib/random_r.c: Likewise. - * * sysdeps/mach/sys/reboot.h: Likewise. - * * inet/getnameinfo.c: Deleted advertising clause from Inner Net License - * * sysdeps/posix/getaddrinfo.c: Likewise. - * * sunrpc/des_impl.c: Updated license permission notice to Lesser GPL - * and corrected pointer to point to the correct license. - * - * Revision 1.3 2000/03/27 04:09:08 roland - * 2000-03-26 Roland McGrath - * - * * sysdeps/mach/sys/reboot.h: Include . - * (reboot): Declare it. - * - * Revision 1.2 1998/05/29 10:19:59 drepper - * Use __ASSEMBLER__ test macro not ASSEMBLER. - * - * Revision 1.1 1993/08/03 22:25:15 roland - * entered into RCS + * (pre-GNU) HISTORY * * Revision 2.8 93/03/11 13:46:40 danner * u_long -> u_int. @@ -188,7 +58,7 @@ /* Copyright (C) 1982, 1986, 1988 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: @@ -201,7 +71,7 @@ 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 diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h index 2b42b22ba4..74caae8cba 100644 --- a/sysdeps/mips/bits/setjmp.h +++ b/sysdeps/mips/bits/setjmp.h @@ -81,6 +81,6 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (jmpbuf)[0].__sp) + ((void *) (address) < (void *) (jmpbuf)[0].__sp) #endif /* _MIPS_BITS_SETJMP_H */ diff --git a/sysdeps/mips/libc-tls.c b/sysdeps/mips/libc-tls.c index 157ba3389a..a3d6301d1d 100644 --- a/sysdeps/mips/libc-tls.c +++ b/sysdeps/mips/libc-tls.c @@ -17,7 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include #include #if USE_TLS diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c index 8a2d826e95..5464bfb374 100644 --- a/sysdeps/posix/euidaccess.c +++ b/sysdeps/posix/euidaccess.c @@ -1,5 +1,5 @@ /* Check if effective user id can access file - Copyright (C) 1990,91,95,96,97,98,99,2000,01 Free Software Foundation, Inc. + Copyright (C) 1990,1991,1995-2001,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,26 +21,26 @@ Adapted for GNU C library by Roland McGrath. */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include #include #ifdef S_IEXEC -#ifndef S_IXUSR -#define S_IXUSR S_IEXEC -#endif -#ifndef S_IXGRP -#define S_IXGRP (S_IEXEC >> 3) -#endif -#ifndef S_IXOTH -#define S_IXOTH (S_IEXEC >> 6) -#endif +# ifndef S_IXUSR +# define S_IXUSR S_IEXEC +# endif +# ifndef S_IXGRP +# define S_IXGRP (S_IEXEC >> 3) +# endif +# ifndef S_IXOTH +# define S_IXOTH (S_IEXEC >> 6) +# endif #endif /* S_IEXEC */ -#if defined (HAVE_UNISTD_H) || defined (_LIBC) -#include +#if defined HAVE_UNISTD_H || defined _LIBC +# include #endif #ifndef _POSIX_VERSION @@ -55,35 +55,35 @@ gid_t getegid (); extern int errno; #endif #ifndef __set_errno -#define __set_errno(val) errno = (val) +# define __set_errno(val) errno = (val) #endif -#if defined(EACCES) && !defined(EACCESS) -#define EACCESS EACCES +#if defined EACCES && !defined EACCESS +# define EACCESS EACCES #endif #ifndef F_OK -#define F_OK 0 -#define X_OK 1 -#define W_OK 2 -#define R_OK 4 +# define F_OK 0 +# define X_OK 1 +# define W_OK 2 +# define R_OK 4 #endif -#if !defined (S_IROTH) && defined (R_OK) +#if !defined S_IROTH && defined R_OK # define S_IROTH R_OK #endif -#if !defined (S_IWOTH) && defined (W_OK) +#if !defined S_IWOTH && defined W_OK # define S_IWOTH W_OK #endif -#if !defined (S_IXOTH) && defined (X_OK) +#if !defined S_IXOTH && defined X_OK # define S_IXOTH X_OK #endif #ifdef _LIBC -#define group_member __group_member -#define euidaccess __euidaccess +# define group_member __group_member +# define euidaccess __euidaccess #else @@ -93,14 +93,6 @@ static uid_t uid; /* The user's real group id. */ static gid_t gid; -#ifdef HAVE_GETGROUPS -int group_member (); -#else -#define group_member(gid) 0 -#endif - -#endif - /* The user's effective user id. */ static uid_t euid; @@ -110,6 +102,14 @@ static gid_t egid; /* Nonzero if UID, GID, EUID, and EGID have valid values. */ static int have_ids; +# ifdef HAVE_GETGROUPS +int group_member (); +# else +# define group_member(gid) 0 +# endif + +#endif + /* Return 0 if the user has permission of type MODE on file PATH; otherwise, return -1 and set `errno' to EACCESS. @@ -126,6 +126,9 @@ euidaccess (path, mode) int granted; #ifdef _LIBC + uid_t euid; + gid_t egid; + if (! __libc_enable_secure) /* If we are not set-uid or set-gid, access does the same. */ return __access (path, mode); @@ -157,12 +160,8 @@ euidaccess (path, mode) #ifdef _LIBC /* Now we need the IDs. */ - if (have_ids == 0) - { - have_ids = 1; - euid = __geteuid (); - egid = __getegid (); - } + euid = __geteuid (); + egid = __getegid (); #endif /* The super-user can read and write any file, and execute any file @@ -172,11 +171,12 @@ euidaccess (path, mode) return 0; if (euid == stats.st_uid) - granted = (unsigned) (stats.st_mode & (mode << 6)) >> 6; + granted = (unsigned int) (stats.st_mode & (mode << 6)) >> 6; else if (egid == stats.st_gid || group_member (stats.st_gid)) - granted = (unsigned) (stats.st_mode & (mode << 3)) >> 3; + granted = (unsigned int) (stats.st_mode & (mode << 3)) >> 3; else granted = (stats.st_mode & mode); + /* XXX Add support for ACLs. */ if (granted == mode) return 0; __set_errno (EACCESS); @@ -188,9 +188,9 @@ weak_alias (__euidaccess, euidaccess) #endif #ifdef TEST -#include -#include -#include "error.h" +# include +# include +# include "error.h" char *program_name; diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 81a56a0794..b9819bfc0a 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -121,7 +121,8 @@ struct gaih { int family; int (*gaih)(const char *name, const struct gaih_service *service, - const struct addrinfo *req, struct addrinfo **pai); + const struct addrinfo *req, struct addrinfo **pai, + unsigned int *naddrs); }; static const struct addrinfo default_hints = @@ -363,7 +364,8 @@ extern service_user *__nss_hosts_database attribute_hidden; static int gaih_inet (const char *name, const struct gaih_service *service, - const struct addrinfo *req, struct addrinfo **pai) + const struct addrinfo *req, struct addrinfo **pai, + unsigned int *naddrs) { const struct gaih_typeproto *tp = gaih_inet_typeproto; struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; @@ -393,6 +395,7 @@ gaih_inet (const char *name, const struct gaih_service *service, } } + int port = 0; if (service != NULL) { if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) @@ -445,63 +448,41 @@ gaih_inet (const char *name, const struct gaih_service *service, } else { - if (req->ai_socktype || req->ai_protocol) - { - st = __alloca (sizeof (struct gaih_servtuple)); - st->next = NULL; - st->socktype = tp->socktype; - st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) - ? req->ai_protocol : tp->protocol); - st->port = htons (service->num); - } - else - { - /* Neither socket type nor protocol is set. Return all - socket types we know about. */ - struct gaih_servtuple **lastp = &st; - for (tp = gaih_inet_typeproto + 1; tp->name[0]; ++tp) - if ((tp->protoflag & GAI_PROTO_NOSERVICE) == 0) - { - struct gaih_servtuple *newp; - - newp = __alloca (sizeof (struct gaih_servtuple)); - newp->next = NULL; - newp->socktype = tp->socktype; - newp->protocol = tp->protocol; - newp->port = htons (service->num); - - *lastp = newp; - lastp = &newp->next; - } - } + port = htons (service->num); + goto got_port; } } - else if (req->ai_socktype || req->ai_protocol) - { - st = __alloca (sizeof (struct gaih_servtuple)); - st->next = NULL; - st->socktype = tp->socktype; - st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) - ? req->ai_protocol : tp->protocol); - st->port = 0; - } else { - /* Neither socket type nor protocol is set. Return all socket types - we know about. */ - struct gaih_servtuple **lastp = &st; - for (++tp; tp->name[0]; ++tp) + got_port: + + if (req->ai_socktype || req->ai_protocol) { - struct gaih_servtuple *newp; + st = __alloca (sizeof (struct gaih_servtuple)); + st->next = NULL; + st->socktype = tp->socktype; + st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) + ? req->ai_protocol : tp->protocol); + st->port = port; + } + else + { + /* Neither socket type nor protocol is set. Return all socket types + we know about. */ + struct gaih_servtuple **lastp = &st; + for (++tp; tp->name[0]; ++tp) + { + struct gaih_servtuple *newp; - newp = __alloca (sizeof (struct gaih_servtuple)); - newp->next = NULL; - newp->socktype = tp->socktype; - newp->protocol = tp->protocol; - newp->port = 0; + newp = __alloca (sizeof (struct gaih_servtuple)); + newp->next = NULL; + newp->socktype = tp->socktype; + newp->protocol = tp->protocol; + newp->port = port; - *lastp = newp; - lastp = &newp->next; + *lastp = newp; + lastp = &newp->next; + } } } @@ -1108,6 +1089,8 @@ gaih_inet (const char *name, const struct gaih_service *service, } *pai = NULL; + ++*naddrs; + ignore: at2 = at2->next; } @@ -1556,6 +1539,7 @@ getaddrinfo (const char *name, const char *service, else end = NULL; + unsigned int naddrs = 0; while (g->gaih) { if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC) @@ -1564,7 +1548,7 @@ getaddrinfo (const char *name, const char *service, if (pg == NULL || pg->gaih != g->gaih) { pg = g; - i = g->gaih (name, pservice, hints, end); + i = g->gaih (name, pservice, hints, end, &naddrs); if (i != 0) { /* EAI_NODATA is a more specific result as it says that @@ -1596,7 +1580,7 @@ getaddrinfo (const char *name, const char *service, if (j == 0) return EAI_FAMILY; - if (nresults > 1) + if (naddrs > 1) { /* Sort results according to RFC 3484. */ struct sort_result results[nresults]; diff --git a/sysdeps/posix/profil.c b/sysdeps/posix/profil.c index 3c2e1dfa07..f40faee33d 100644 --- a/sysdeps/posix/profil.c +++ b/sysdeps/posix/profil.c @@ -1,5 +1,5 @@ /* Low-level statistical profiling support function. Mostly POSIX.1 version. - Copyright (C) 1996,97,98,2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1996,97,98,2002, 2004, 2005 Free Software 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,7 +25,7 @@ #ifndef SIGPROF -#include +#include #else diff --git a/sysdeps/posix/shm_open.c b/sysdeps/posix/shm_open.c index b773d40db0..0a657fadfa 100644 --- a/sysdeps/posix/shm_open.c +++ b/sysdeps/posix/shm_open.c @@ -1,5 +1,5 @@ /* shm_open -- open a POSIX shared memory object. Generic POSIX file version. - Copyright (C) 2001,02 Free Software Foundation, Inc. + Copyright (C) 2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,7 +20,7 @@ #include #if ! _POSIX_MAPPED_FILES -#include +#include #else diff --git a/sysdeps/posix/shm_unlink.c b/sysdeps/posix/shm_unlink.c index b67240f838..18ca416e16 100644 --- a/sysdeps/posix/shm_unlink.c +++ b/sysdeps/posix/shm_unlink.c @@ -1,5 +1,5 @@ /* shm_unlink -- remove a POSIX shared memory object. Generic POSIX version. - Copyright (C) 2001,02 Free Software Foundation, Inc. + Copyright (C) 2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,7 +20,7 @@ #include #if ! _POSIX_MAPPED_FILES -#include +#include #else diff --git a/sysdeps/posix/sprofil.c b/sysdeps/posix/sprofil.c index 19787fa364..04ca1688ec 100644 --- a/sysdeps/posix/sprofil.c +++ b/sysdeps/posix/sprofil.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Contributed by David Mosberger-Tang . This file is part of the GNU C Library. @@ -27,7 +27,7 @@ #include #ifndef SIGPROF -# include +# include #else #include diff --git a/sysdeps/powerpc/dl-procinfo.c b/sysdeps/powerpc/dl-procinfo.c new file mode 100644 index 0000000000..7c1ab7bad7 --- /dev/null +++ b/sysdeps/powerpc/dl-procinfo.c @@ -0,0 +1,66 @@ +/* Data for processor capability information. PowerPC version. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along 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 information must be kept in sync with the _DL_HWCAP_COUNT and + _DL_PLATFORM_COUNT definitions in procinfo.h. + + If anything should be added here check whether the size of each string + is still ok with the given array size. + + All the #ifdefs in the definitions are quite irritating but + necessary if we want to avoid duplicating the information. There + are three different modes: + + - PROCINFO_DECL is defined. This means we are only interested in + declarations. + + - PROCINFO_DECL is not defined: + + + if SHARED is defined the file is included in an array + initializer. The .element = { ... } syntax is needed. + + + if SHARED is not defined a normal array initialization is + needed. + */ + +#ifndef PROCINFO_CLASS +# define PROCINFO_CLASS +#endif + +#if !defined PROCINFO_DECL && defined SHARED + ._dl_powerpc_cap_flags +#else +PROCINFO_CLASS const char _dl_powerpc_cap_flags[16][10] +#endif +#ifndef PROCINFO_DECL += { + "cell", "power5+", "power5", "power4", + "notb", "efpdouble", "efpsingle", "spe", + "ucache", "4xxmac", "mmu", "fpu", + "altivec", "ppc601", "ppc64", "ppc32", + } +#endif +#if !defined SHARED || defined PROCINFO_DECL +; +#else +, +#endif + +#undef PROCINFO_DECL +#undef PROCINFO_CLASS diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h new file mode 100644 index 0000000000..8edc5e539a --- /dev/null +++ b/sysdeps/powerpc/dl-procinfo.h @@ -0,0 +1,75 @@ +/* Processor capability information handling macros. PowerPC version. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along 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 _DL_PROCINFO_H +#define _DL_PROCINFO_H 1 + +#include +#include /* This defines the PPC_FEATURE_* macros. */ + +/* There are 16 bits used, but they are bits 16..31. */ +#define _DL_HWCAP_FIRST 16 +#define _DL_HWCAP_COUNT 32 + +/* These bits influence library search. */ +#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \ + | PPC_FEATURE_POWER4 \ + | PPC_FEATURE_POWER5 \ + | PPC_FEATURE_POWER5_PLUS \ + | PPC_FEATURE_CELL) + +/* We don't use AT_PLATFORM. */ +#define _DL_HWCAP_PLATFORM 0 +#define _dl_string_platform(str) (-1) + +static inline const char * +__attribute__ ((unused)) +_dl_hwcap_string (int idx) +{ + return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST]; +}; + +static inline int +__attribute__ ((unused)) +_dl_string_hwcap (const char *str) +{ + for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i) + if (strcmp (str, _dl_hwcap_string (i)) == 0) + return i; + return -1; +}; + +#ifdef IS_IN_rtld +static inline int +__attribute__ ((unused)) +_dl_procinfo (int word) +{ + _dl_printf ("AT_HWCAP: "); + + for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i) + if (word & (1 << i)) + _dl_printf (" %s", _dl_hwcap_string (i)); + + _dl_printf ("\n"); + + return 0; +} +#endif + +#endif /* dl-procinfo.h */ diff --git a/sysdeps/powerpc/elf/libc-start.c b/sysdeps/powerpc/elf/libc-start.c index af67a39a29..8a60af8d71 100644 --- a/sysdeps/powerpc/elf/libc-start.c +++ b/sysdeps/powerpc/elf/libc-start.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,2001,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1998,2000-2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,7 +30,7 @@ weak_extern (__cache_line_size) #define LIBC_START_DISABLE_INLINE #define LIBC_START_MAIN_AUXVEC_ARG #define MAIN_AUXVEC_ARG -#include +#include struct startup_info diff --git a/sysdeps/powerpc/ffs.c b/sysdeps/powerpc/ffs.c index f45b5ea8e2..61d79c4c2f 100644 --- a/sysdeps/powerpc/ffs.c +++ b/sysdeps/powerpc/ffs.c @@ -1,6 +1,6 @@ /* Find first set bit in a word, counted from least significant end. For PowerPC. - Copyright (C) 1991, 1992, 1997, 1998, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1997, 1998, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). @@ -43,5 +43,5 @@ weak_alias (__ffs, ffsl) #endif #else -#include +#include #endif diff --git a/sysdeps/powerpc/powerpc32/setjmp-common.S b/sysdeps/powerpc/powerpc32/setjmp-common.S index ad7113f461..ae21284e03 100644 --- a/sysdeps/powerpc/powerpc32/setjmp-common.S +++ b/sysdeps/powerpc/powerpc32/setjmp-common.S @@ -1,5 +1,6 @@ /* setjmp for PowerPC. - Copyright (C) 1995-1997,1999-2001,2003,2004 Free Software Foundation, Inc. + Copyright (C) 1995-1997,1999-2001,2003,2004,2005 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -55,5 +56,10 @@ ENTRY (BP_SYM (__sigsetjmp)) stw r29,((JB_GPRS+15)*4)(3) stw r30,((JB_GPRS+16)*4)(3) stw r31,((JB_GPRS+17)*4)(3) +#if defined NOT_IN_libc && defined IS_IN_rtld + li r3,0 + blr +#else b BP_SYM (__sigjmp_save@local) +#endif END (BP_SYM (__sigsetjmp)) diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S index 0de07a82d3..c1926ecd68 100644 --- a/sysdeps/powerpc/powerpc64/setjmp-common.S +++ b/sysdeps/powerpc/powerpc64/setjmp-common.S @@ -1,5 +1,5 @@ /* setjmp for PowerPC64. - Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -177,5 +177,10 @@ L(aligned_save_vmx): stvx 31,0,r6 L(no_vmx): #endif +#if defined NOT_IN_libc && defined IS_IN_rtld + li r3,0 + blr +#else b JUMPTARGET (BP_SYM (__sigjmp_save)) +#endif END (BP_SYM (__sigsetjmp)) diff --git a/sysdeps/rs6000/ffs.c b/sysdeps/rs6000/ffs.c index 4d01727044..619412cb50 100644 --- a/sysdeps/rs6000/ffs.c +++ b/sysdeps/rs6000/ffs.c @@ -1,6 +1,6 @@ /* ffs -- find first set bit in a word, counted from least significant end. For IBM rs6000. - Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1997, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). @@ -38,5 +38,5 @@ weak_alias (__ffs, ffs) libc_hidden_builtin_def (ffs) #else -#include +#include #endif diff --git a/sysdeps/s390/bits/setjmp.h b/sysdeps/s390/bits/setjmp.h index 35bc9a53f3..4009514763 100644 --- a/sysdeps/s390/bits/setjmp.h +++ b/sysdeps/s390/bits/setjmp.h @@ -21,6 +21,10 @@ #ifndef __S390_SETJMP_H__ #define __S390_SETJMP_H__ +#if !defined _SETJMP_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + #include #define __JB_GPR6 0 diff --git a/sysdeps/s390/libc-tls.c b/sysdeps/s390/libc-tls.c index 7362dbf8f8..f177f436e9 100644 --- a/sysdeps/s390/libc-tls.c +++ b/sysdeps/s390/libc-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. S390 version. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ 02111-1307 USA. */ #include -#include +#include #if USE_TLS diff --git a/sysdeps/sh/bits/setjmp.h b/sysdeps/sh/bits/setjmp.h index d92feea214..242720ca53 100644 --- a/sysdeps/sh/bits/setjmp.h +++ b/sysdeps/sh/bits/setjmp.h @@ -51,6 +51,6 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (jmpbuf)[0].__regs[7]) + ((void *) (address) < (void *) (jmpbuf)[0].__regs[7]) #endif /* bits/setjmp.h */ diff --git a/sysdeps/unix/mkfifoat.c b/sysdeps/unix/mkfifoat.c new file mode 100644 index 0000000000..5c4da2a982 --- /dev/null +++ b/sysdeps/unix/mkfifoat.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +/* Create a new FIFO with permission bits MODE. But interpret + relative PATH names relative to the directory associated with FD. */ +int +mkfifoat (fd, file, mode) + int fd; + const char *file; + mode_t mode; +{ + dev_t dev = 0; + return __xmknodat (_MKNOD_VER, fd, file, mode | S_IFIFO, &dev); +} diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c index 98fb4ca5c8..6aa738fb69 100644 --- a/sysdeps/unix/opendir.c +++ b/sysdeps/unix/opendir.c @@ -139,7 +139,7 @@ weak_alias (__opendir, opendir) DIR * internal_function -__alloc_dir (int fd, bool close_fd, struct stat64 *statp) +__alloc_dir (int fd, bool close_fd, const struct stat64 *statp) { if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0) goto lose; diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index b2bbbc0b28..812cd97c80 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -107,11 +107,6 @@ ifeq ($(subdir),termios) sysdep_headers += termio.h endif -ifeq ($(subdir),stdio-common) -# Just disable the auto generation in sysdeps/generic -inhibit-siglist := yes -endif - ifeq ($(subdir),posix) sysdep_headers += bits/initspin.h diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c index 44ff22ea7d..a6dbfb4eb1 100644 --- a/sysdeps/unix/sysv/linux/aio_sigqueue.c +++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2003, 2005 Free Software 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,5 +52,5 @@ __aio_sigqueue (sig, val, caller_pid) sig, __ptrvalue (&info)); } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/alpha/bits/mman.h b/sysdeps/unix/sysv/linux/alpha/bits/mman.h index bb41887479..59574266a4 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/mman.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/mman.h @@ -86,6 +86,7 @@ /* Flags for `mremap'. */ #ifdef __USE_GNU # define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 #endif /* Advice to `madvise'. */ diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c index 65b7ad97a3..127f7f3c57 100644 --- a/sysdeps/unix/sysv/linux/alpha/fxstatat.c +++ b/sysdeps/unix/sysv/linux/alpha/fxstatat.c @@ -67,7 +67,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64) { - if (flags & AT_SYMLINK_NOFOLLOW) + if (flag & AT_SYMLINK_NOFOLLOW) result = INTERNAL_SYSCALL (lstat64, err, 2, file, st); else result = INTERNAL_SYSCALL (stat64, err, 2, file, st); @@ -94,7 +94,4 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) return -1; } -hidden_def (__xstat) -weak_alias (__xstat, _xstat); -strong_alias (__xstat, __xstat64); -hidden_ver (__xstat, __xstat64) +strong_alias (__fxstatat, __fxstatat64); diff --git a/sysdeps/unix/sysv/linux/alpha/glob.c b/sysdeps/unix/sysv/linux/alpha/glob.c index a51020d51f..84573899d6 100644 --- a/sysdeps/unix/sysv/linux/alpha/glob.c +++ b/sysdeps/unix/sysv/linux/alpha/glob.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,7 +35,7 @@ extern int __new_glob (const char *__pattern, int __flags, glob_t *__pglob); extern void __new_globfree (glob_t *__pglob); -#include +#include #undef glob #undef globfree diff --git a/sysdeps/unix/sysv/linux/alpha/sigaction.c b/sysdeps/unix/sysv/linux/alpha/sigaction.c index 21a2063c30..26b081d9a3 100644 --- a/sysdeps/unix/sysv/linux/alpha/sigaction.c +++ b/sysdeps/unix/sysv/linux/alpha/sigaction.c @@ -17,6 +17,8 @@ 02111-1307 USA. */ #include +#include +#include /* * In order to get the hidden arguments for rt_sigaction set up diff --git a/sysdeps/unix/sysv/linux/alpha/wordexp.c b/sysdeps/unix/sysv/linux/alpha/wordexp.c index 1921a03388..c2972e40c2 100644 --- a/sysdeps/unix/sysv/linux/alpha/wordexp.c +++ b/sysdeps/unix/sysv/linux/alpha/wordexp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ #define wordexp(words, pwordexp, flags) \ __new_wordexp (words, pwordexp, flags) -#include +#include versioned_symbol (libc, __new_wordexp, wordexp, GLIBC_2_2_2); diff --git a/sysdeps/unix/sysv/linux/dl-sbrk.c b/sysdeps/unix/sysv/linux/dl-sbrk.c index 4713a92694..1ce5cb188c 100644 --- a/sysdeps/unix/sysv/linux/dl-sbrk.c +++ b/sysdeps/unix/sysv/linux/dl-sbrk.c @@ -2,4 +2,4 @@ from ld.so. */ extern void *__curbrk attribute_hidden; -#include +#include diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index 79f95df0a2..acc2441051 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -1,5 +1,5 @@ /* Dynamic linker system dependencies for Linux. - Copyright (C) 1995, 1997, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 2001, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -53,4 +53,4 @@ frob_brk (void) #endif } -#include +#include diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c index f8bc5e3033..10d87e87fc 100644 --- a/sysdeps/unix/sysv/linux/fchownat.c +++ b/sysdeps/unix/sysv/linux/fchownat.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include /* Change the owner and group of FILE. */ int diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c index 26caee2f46..4c60a1f19a 100644 --- a/sysdeps/unix/sysv/linux/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2001,2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -72,5 +72,5 @@ weak_alias (__ftruncate64, ftruncate64) #else /* Use the generic implementation. */ -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c index 2360f50d98..31113d5db5 100644 --- a/sysdeps/unix/sysv/linux/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/fxstatat64.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/sysdeps/unix/sysv/linux/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c index 3e67add0d7..0c6654a386 100644 --- a/sysdeps/unix/sysv/linux/gai_sigqueue.c +++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2003, 2005 Free Software 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,5 +52,5 @@ __gai_sigqueue (sig, val, caller_pid) sig, __ptrvalue (&info)); } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/i386/getmsg.c b/sysdeps/unix/sysv/linux/i386/getmsg.c index e6ca88d136..c0efd56369 100644 --- a/sysdeps/unix/sysv/linux/i386/getmsg.c +++ b/sysdeps/unix/sysv/linux/i386/getmsg.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,5 +34,5 @@ getmsg (fildes, ctlptr, dataptr, flagsp) return INLINE_SYSCALL (getpmsg, 5, fildes, ctlptr, dataptr, NULL, flagsp); } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/i386/getresgid.c b/sysdeps/unix/sysv/linux/i386/getresgid.c index 8028dec3f9..ea3318e7f5 100644 --- a/sysdeps/unix/sysv/linux/i386/getresgid.c +++ b/sysdeps/unix/sysv/linux/i386/getresgid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -81,5 +81,5 @@ libc_hidden_def (__getresgid) weak_alias (__getresgid, getresgid) #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/i386/getresuid.c b/sysdeps/unix/sysv/linux/i386/getresuid.c index 6b94bbb66c..b2783d075c 100644 --- a/sysdeps/unix/sysv/linux/i386/getresuid.c +++ b/sysdeps/unix/sysv/linux/i386/getresuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -80,5 +80,5 @@ libc_hidden_def (__getresuid) weak_alias (__getresuid, getresuid) #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/i386/getrlimit64.c b/sysdeps/unix/sysv/linux/i386/getrlimit64.c index d6ab86f3e4..2ff175393c 100644 --- a/sysdeps/unix/sysv/linux/i386/getrlimit64.c +++ b/sysdeps/unix/sysv/linux/i386/getrlimit64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ #define getrlimit64 __new_getrlimit64 -#include +#include #undef getrlimit64 #include diff --git a/sysdeps/unix/sysv/linux/i386/glob64.c b/sysdeps/unix/sysv/linux/i386/glob64.c index d3d1212f05..18b7f21ae8 100644 --- a/sysdeps/unix/sysv/linux/i386/glob64.c +++ b/sysdeps/unix/sysv/linux/i386/glob64.c @@ -19,7 +19,7 @@ #define COMPILE_GLOB64 1 -#include +#include #include "shlib-compat.h" @@ -48,7 +48,7 @@ int __old_glob64 (__const char *__pattern, int __flags, #define GLOB_ONLY_P 1 -#include +#include compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1); #endif diff --git a/sysdeps/unix/sysv/linux/i386/lchown.c b/sysdeps/unix/sysv/linux/i386/lchown.c index 1b217a9451..57226277c1 100644 --- a/sysdeps/unix/sysv/linux/i386/lchown.c +++ b/sysdeps/unix/sysv/linux/i386/lchown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -70,5 +70,5 @@ __lchown (const char *file, uid_t owner, gid_t group) weak_alias (__lchown, lchown) #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/i386/putmsg.c b/sysdeps/unix/sysv/linux/i386/putmsg.c index e7b7a08b55..04fd159b7c 100644 --- a/sysdeps/unix/sysv/linux/i386/putmsg.c +++ b/sysdeps/unix/sysv/linux/i386/putmsg.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,5 +34,5 @@ putmsg (fildes, ctlptr, dataptr, flags) return INLINE_SYSCALL (putpmsg, 5, fildes, ctlptr, dataptr, -1, flags); } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c index 6852f2a9a9..a6374e61d2 100644 --- a/sysdeps/unix/sysv/linux/i386/readelflib.c +++ b/sysdeps/unix/sysv/linux/i386/readelflib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1999 and Jakub Jelinek , 2000. @@ -73,10 +73,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag, #undef process_elf_file #define process_elf_file process_elf32_file #define __ELF_NATIVE_CLASS 32 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" #undef __ELF_NATIVE_CLASS #undef process_elf_file #define process_elf_file process_elf64_file #define __ELF_NATIVE_CLASS 64 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c index d4093afb0f..fd0dfb342a 100644 --- a/sysdeps/unix/sysv/linux/i386/setresgid.c +++ b/sysdeps/unix/sysv/linux/i386/setresgid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -80,6 +80,6 @@ weak_alias (__setresgid, setresgid) #else -#include +#include #endif diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c index 540b954e08..c5651bf85a 100644 --- a/sysdeps/unix/sysv/linux/i386/setresuid.c +++ b/sysdeps/unix/sysv/linux/i386/setresuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -80,6 +80,6 @@ weak_alias (__setresuid, setresuid) #else -#include +#include #endif diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 99f9bf1edf..cb5767955c 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -558,4 +558,24 @@ asm (".L__X'%ebx = 1\n\t" #endif /* __ASSEMBLER__ */ + +/* Pointer mangling support. */ +#if defined NOT_IN_libc && defined IS_IN_rtld +/* We cannot use the thread descriptor because in ld.so we use setjmp + earlier than the descriptor is initialized. Using a global variable + is too complicated here since we have no PC-relative addressing mode. */ +#else +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(reg) xorl %gs:POINTER_GUARD, reg +# define PTR_DEMANGLE(reg) PTR_MANGLE (reg) +# else +# define PTR_MANGLE(var) asm ("xorl %%gs:%c2, %0" \ + : "=r" (var) \ + : "0" (var), \ + "i" (offsetof (tcbhead_t, \ + pointer_guard))) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + #endif /* linux/i386/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/ia64/readelflib.c b/sysdeps/unix/sysv/linux/ia64/readelflib.c index 9b1a645d34..7a10d23c90 100644 --- a/sysdeps/unix/sysv/linux/ia64/readelflib.c +++ b/sysdeps/unix/sysv/linux/ia64/readelflib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -51,10 +51,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag, #undef process_elf_file #define process_elf_file process_elf32_file #define __ELF_NATIVE_CLASS 32 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" #undef __ELF_NATIVE_CLASS #undef process_elf_file #define process_elf_file process_elf64_file #define __ELF_NATIVE_CLASS 64 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 44ac727820..9bbd97e6d2 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -318,6 +318,11 @@ # define __ASSUME_POSIX_TIMERS 1 #endif +/* Beginning with 2.6.12 the clock and timer supports CPU clocks. */ +#if __LINUX_KERNEL_VERSION >= 0x2060c +# define __ASSUME_POSIX_CPU_TIMERS 1 +#endif + /* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize their availability with one define. The changes were made first for i386 and the have to be done separately for the other archs. diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c new file mode 100644 index 0000000000..8ebff74215 --- /dev/null +++ b/sysdeps/unix/sysv/linux/linkat.c @@ -0,0 +1,87 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +/* Make a link to FROM named TO but relative paths in TO and FROM are + interpreted relative to FROMFD and TOFD respectively. */ +int +linkat (fromfd, from, tofd, to) + int fromfd; + const char *from; + int tofd; + const char *to; +{ + static const char procfd[] = "/proc/self/fd/%d/%s"; + char *buffrom = NULL; + + if (fromfd != AT_FDCWD && from[0] != '/') + { + size_t filelen = strlen (from); + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen; + buffrom = alloca (buflen); + + __snprintf (buffrom, buflen, procfd, fromfd, from); + from = buffrom; + } + + char *bufto = NULL; + + if (tofd != AT_FDCWD && to[0] != '/') + { + size_t filelen = strlen (to); + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen; + bufto = alloca (buflen); + + __snprintf (bufto, buflen, procfd, tofd, to); + to = bufto; + } + + INTERNAL_SYSCALL_DECL (err); + + int result = INTERNAL_SYSCALL (link, err, 2, from, to); + + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) + { + __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), tofd, bufto, + fromfd, buffrom); + result = -1; + } + + return result; +} diff --git a/sysdeps/unix/sysv/linux/mips/bits/mman.h b/sysdeps/unix/sysv/linux/mips/bits/mman.h index 154501fba2..92d4b8a340 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/mman.h +++ b/sysdeps/unix/sysv/linux/mips/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997, 2000, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -89,4 +89,5 @@ /* Flags for `mremap'. */ #ifdef __USE_GNU # define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 #endif diff --git a/sysdeps/unix/sysv/linux/mips/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/ftruncate64.c index cdb2d56840..11e242570d 100644 --- a/sysdeps/unix/sysv/linux/mips/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/mips/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -72,5 +72,5 @@ weak_alias (__ftruncate64, ftruncate64) #else /* Use the generic implementation. */ -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mips/readelflib.c b/sysdeps/unix/sysv/linux/mips/readelflib.c index 73fd43f46f..baa92fe57c 100644 --- a/sysdeps/unix/sysv/linux/mips/readelflib.c +++ b/sysdeps/unix/sysv/linux/mips/readelflib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Alexandre Oliva Based on work ../x86_64/readelflib.c, @@ -62,10 +62,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag, #undef process_elf_file #define process_elf_file process_elf32_file #define __ELF_NATIVE_CLASS 32 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" #undef __ELF_NATIVE_CLASS #undef process_elf_file #define process_elf_file process_elf64_file #define __ELF_NATIVE_CLASS 64 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" diff --git a/sysdeps/unix/sysv/linux/mips/truncate64.c b/sysdeps/unix/sysv/linux/mips/truncate64.c index e955f18ea3..d01d25b077 100644 --- a/sysdeps/unix/sysv/linux/mips/truncate64.c +++ b/sysdeps/unix/sysv/linux/mips/truncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003 +/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -72,5 +72,5 @@ truncate64 (const char *path, off64_t length) #else /* Use the generic implementation. */ -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c new file mode 100644 index 0000000000..367441b05b --- /dev/null +++ b/sysdeps/unix/sysv/linux/mkdirat.c @@ -0,0 +1,66 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include + + +/* Create a new directory with permission bits MODE. But interpret + relative PATH names relative to the directory associated with FD. */ +int +mkdirat (fd, file, mode) + int fd; + const char *file; + mode_t mode; +{ + char *buf = NULL; + + if (fd != AT_FDCWD && file[0] != '/') + { + size_t filelen = strlen (file); + static const char procfd[] = "/proc/self/fd/%d/%s"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen; + buf = alloca (buflen); + + __snprintf (buf, buflen, procfd, fd, file); + file = buf; + } + + INTERNAL_SYSCALL_DECL (err); + int res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode); + + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0)) + { + __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf); + res = -1; + } + + return res; +} diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c index 65522d5adc..008e8eeb95 100644 --- a/sysdeps/unix/sysv/linux/mq_close.c +++ b/sysdeps/unix/sysv/linux/mq_close.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,5 +31,5 @@ mq_close (mqd_t mqdes) } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mq_getattr.c b/sysdeps/unix/sysv/linux/mq_getattr.c index a61722e237..d25df7bcfd 100644 --- a/sysdeps/unix/sysv/linux/mq_getattr.c +++ b/sysdeps/unix/sysv/linux/mq_getattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,5 +31,5 @@ mq_getattr (mqd_t mqdes, struct mq_attr *mqstat) } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c index 14db27da70..4eba28a301 100644 --- a/sysdeps/unix/sysv/linux/mq_notify.c +++ b/sysdeps/unix/sysv/linux/mq_notify.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -40,5 +40,5 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification) } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c index d8926a73a7..eac6e01238 100644 --- a/sysdeps/unix/sysv/linux/mq_open.c +++ b/sysdeps/unix/sysv/linux/mq_open.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -56,5 +56,5 @@ mq_open (const char *name, int oflag, ...) } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c index 891663c66a..2186508029 100644 --- a/sysdeps/unix/sysv/linux/mq_receive.c +++ b/sysdeps/unix/sysv/linux/mq_receive.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,5 +33,5 @@ mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len, } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c index cb9cbc2a69..83b9f8df4a 100644 --- a/sysdeps/unix/sysv/linux/mq_send.c +++ b/sysdeps/unix/sysv/linux/mq_send.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,5 +32,5 @@ mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len, } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c index 8d87ffadf4..bef39a4ae2 100644 --- a/sysdeps/unix/sysv/linux/mq_unlink.c +++ b/sysdeps/unix/sysv/linux/mq_unlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,5 +50,5 @@ mq_unlink (const char *name) } #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/nscd_setup_thread.c b/sysdeps/unix/sysv/linux/nscd_setup_thread.c index 7d1bfd8dd1..1589c24ea9 100644 --- a/sysdeps/unix/sysv/linux/nscd_setup_thread.c +++ b/sysdeps/unix/sysv/linux/nscd_setup_thread.c @@ -1,22 +1,20 @@ /* Setup of nscd worker threads. Linux verison. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 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. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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 this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c index 069f94bd9d..cf61b01a54 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c @@ -74,5 +74,5 @@ weak_alias (__ftruncate64, ftruncate64) #else /* Use the generic implementation. */ -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c index ee1b50c04b..af6fa548dd 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c @@ -74,5 +74,5 @@ truncate64 (path, length) #else /* Use the generic implementation. */ -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/powerpc/readelflib.c b/sysdeps/unix/sysv/linux/powerpc/readelflib.c index b4a449cdff..3c6b2daf81 100644 --- a/sysdeps/unix/sysv/linux/powerpc/readelflib.c +++ b/sysdeps/unix/sysv/linux/powerpc/readelflib.c @@ -1,5 +1,5 @@ /* Special checks on libraries for ldconfig. Linux/PowerPC version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2005 Free Software 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,10 +52,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag, #undef process_elf_file #define process_elf_file process_elf32_file #define __ELF_NATIVE_CLASS 32 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" #undef __ELF_NATIVE_CLASS #undef process_elf_file #define process_elf_file process_elf64_file #define __ELF_NATIVE_CLASS 64 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c new file mode 100644 index 0000000000..42c3877bd7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/readlinkat.c @@ -0,0 +1,69 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Read the contents of the symbolic link PATH relative to FD into no + more than LEN bytes of BUF. */ +int +readlinkat (fd, path, buf, len) + int fd; + const char *path; + char *buf; + size_t len; +{ + char *pathbuf = NULL; + + if (fd != AT_FDCWD && path[0] != '/') + { + size_t pathlen = strlen (path); + static const char procfd[] = "/proc/self/fd/%d/%s"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + pathlen; + pathbuf = __alloca (buflen); + + __snprintf (pathbuf, buflen, procfd, fd, path); + path = pathbuf; + } + + INTERNAL_SYSCALL_DECL (err); + + int result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len); + + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) + { + __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, pathbuf); + result = -1; + } + + return result; +} diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c index 9d94d5f86c..849c67b5d6 100644 --- a/sysdeps/unix/sysv/linux/renameat.c +++ b/sysdeps/unix/sysv/linux/renameat.c @@ -23,6 +23,52 @@ #include +void +attribute_hidden +__atfct_seterrno_2 (int errval, int fd1, const char *buf1, int fd2, + const char *buf2) +{ + if (errval == ENOTDIR && (buf1 != NULL || buf2 != NULL)) + { + /* This can mean either the file descriptor is invalid or + /proc is not mounted. */ + struct stat64 st; + + if (buf1 != NULL) + { + if (__fxstat64 (_STAT_VER, fd1, &st) != 0) + /* errno is already set correctly. */ + return; + + /* If /proc is not mounted there is nothing we can do. */ + if (S_ISDIR (st.st_mode) + && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0 + || !S_ISDIR (st.st_mode))) + { + errval = ENOSYS; + goto out; + } + } + + if (buf2 != NULL) + { + if (__fxstat64 (_STAT_VER, fd2, &st) != 0) + /* errno is already set correctly. */ + return; + + /* If /proc is not mounted there is nothing we can do. */ + if (S_ISDIR (st.st_mode) + && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0 + || !S_ISDIR (st.st_mode))) + errval = ENOSYS; + } + } + + out: + __set_errno (errval); +} + + /* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */ int renameat (oldfd, old, newfd, new) @@ -76,45 +122,8 @@ renameat (oldfd, old, newfd, new) if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) { - int errval = INTERNAL_SYSCALL_ERRNO (result, err); - if (errval == ENOTDIR && (bufnew != NULL || bufold != NULL)) - { - /* This can mean either the file descriptor is invalid or - /proc is not mounted. */ - struct stat64 st; - - if (bufnew != NULL) - { - if (__fxstat64 (_STAT_VER, newfd, &st) != 0) - /* errno is already set correctly. */ - return -1; - - /* If /proc is not mounted there is nothing we can do. */ - if (S_ISDIR (st.st_mode) - && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0 - || !S_ISDIR (st.st_mode))) - { - errval = ENOSYS; - goto out; - } - } - - if (bufold != NULL) - { - if (__fxstat64 (_STAT_VER, oldfd, &st) != 0) - /* errno is already set correctly. */ - return -1; - - /* If /proc is not mounted there is nothing we can do. */ - if (S_ISDIR (st.st_mode) - && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0 - || !S_ISDIR (st.st_mode))) - errval = ENOSYS; - } - } - - out: - __set_errno (errval); + __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), newfd, bufnew, + oldfd, bufold); result = -1; } diff --git a/sysdeps/unix/sysv/linux/s390/readelflib.c b/sysdeps/unix/sysv/linux/s390/readelflib.c index c8efcbf7ac..2782bc1e01 100644 --- a/sysdeps/unix/sysv/linux/s390/readelflib.c +++ b/sysdeps/unix/sysv/linux/s390/readelflib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -51,10 +51,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag, #undef process_elf_file #define process_elf_file process_elf32_file #define __ELF_NATIVE_CLASS 32 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" #undef __ELF_NATIVE_CLASS #undef process_elf_file #define process_elf_file process_elf64_file #define __ELF_NATIVE_CLASS 64 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c index 50443c6482..c0a6eb81b9 100644 --- a/sysdeps/unix/sysv/linux/sched_getaffinity.c +++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -54,5 +54,5 @@ __sched_getaffinity_old (pid_t pid, cpu_set_t *cpuset) compat_symbol (libc, __sched_getaffinity_old, sched_getaffinity, GLIBC_2_3_3); # endif #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/sched_setaffinity.c b/sysdeps/unix/sysv/linux/sched_setaffinity.c index 5b1b8ee878..ccd3c8f514 100644 --- a/sysdeps/unix/sysv/linux/sched_setaffinity.c +++ b/sysdeps/unix/sysv/linux/sched_setaffinity.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -84,5 +84,5 @@ __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset) compat_symbol (libc, __sched_setaffinity_old, sched_setaffinity, GLIBC_2_3_3); # endif #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/segfault.c b/sysdeps/unix/sysv/linux/segfault.c index 088c329b7f..a417df9c41 100644 --- a/sysdeps/unix/sysv/linux/segfault.c +++ b/sysdeps/unix/sysv/linux/segfault.c @@ -1,2 +1,2 @@ #define HAVE_PROC_SELF 1 -#include +#include diff --git a/sysdeps/unix/sysv/linux/sigqueue.c b/sysdeps/unix/sysv/linux/sigqueue.c index 337f886257..22a8036b64 100644 --- a/sysdeps/unix/sysv/linux/sigqueue.c +++ b/sysdeps/unix/sysv/linux/sigqueue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -48,5 +48,5 @@ __sigqueue (pid, sig, val) } weak_alias (__sigqueue, sigqueue) #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/sigreturn.c b/sysdeps/unix/sysv/linux/sigreturn.c index 6b3116fef2..626b1eb8af 100644 --- a/sysdeps/unix/sysv/linux/sigreturn.c +++ b/sysdeps/unix/sysv/linux/sigreturn.c @@ -1,3 +1,3 @@ /* The sigreturn syscall cannot be explicitly called on Linux, only implicitly by returning from a signal handler. */ -#include +#include diff --git a/sysdeps/unix/sysv/linux/sigstack.c b/sysdeps/unix/sysv/linux/sigstack.c index 4faf4424fe..76d2126986 100644 --- a/sysdeps/unix/sysv/linux/sigstack.c +++ b/sysdeps/unix/sysv/linux/sigstack.c @@ -1,5 +1,5 @@ /* Emulate sigstack function using sigaltstack. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -65,5 +65,5 @@ sigstack (ss, oss) link_warning (sigstack, "the `sigstack' function is dangerous. `sigaltstack' should be used instead.") #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/sigtimedwait.c b/sysdeps/unix/sysv/linux/sigtimedwait.c index adeadc1587..8795652766 100644 --- a/sysdeps/unix/sysv/linux/sigtimedwait.c +++ b/sysdeps/unix/sysv/linux/sigtimedwait.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000,2002,2003,2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -89,5 +89,5 @@ __sigtimedwait (set, info, timeout) libc_hidden_def (__sigtimedwait) weak_alias (__sigtimedwait, sigtimedwait) #else -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/sigwaitinfo.c b/sysdeps/unix/sysv/linux/sigwaitinfo.c index a51a01f20b..80790df9eb 100644 --- a/sysdeps/unix/sysv/linux/sigwaitinfo.c +++ b/sysdeps/unix/sysv/linux/sigwaitinfo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000,2002,2003,2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -89,6 +89,6 @@ __sigwaitinfo (set, info) libc_hidden_def (__sigwaitinfo) weak_alias (__sigwaitinfo, sigwaitinfo) #else -# include +# include #endif strong_alias (__sigwaitinfo, __libc_sigwaitinfo) diff --git a/sysdeps/unix/sysv/linux/sparc/readelflib.c b/sysdeps/unix/sysv/linux/sparc/readelflib.c index ef5fa0e2cd..e12fbc7824 100644 --- a/sysdeps/unix/sysv/linux/sparc/readelflib.c +++ b/sysdeps/unix/sysv/linux/sparc/readelflib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1999 and Jakub Jelinek , 1999. @@ -53,10 +53,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag, #undef process_elf_file #define process_elf_file process_elf32_file #define __ELF_NATIVE_CLASS 32 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" #undef __ELF_NATIVE_CLASS #undef process_elf_file #define process_elf_file process_elf64_file #define __ELF_NATIVE_CLASS 64 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c new file mode 100644 index 0000000000..211b49c299 --- /dev/null +++ b/sysdeps/unix/sysv/linux/symlinkat.c @@ -0,0 +1,67 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Make a symbolic link to FROM named TO relative to TOFD. */ +int +symlinkat (from, tofd, to) + const char *from; + int tofd; + const char *to; +{ + char *buf = NULL; + + if (tofd != AT_FDCWD && to[0] != '/') + { + size_t tolen = strlen (to); + static const char procfd[] = "/proc/self/fd/%d/%s"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + tolen; + buf = __alloca (buflen); + + __snprintf (buf, buflen, procfd, tofd, to); + to = buf; + } + + INTERNAL_SYSCALL_DECL (err); + + int result = INTERNAL_SYSCALL (symlink, err, 2, from, to); + + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) + { + __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), tofd, buf); + result = -1; + } + + return result; +} diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h index be2810e0c7..5aa0ec07d2 100644 --- a/sysdeps/unix/sysv/linux/sys/quota.h +++ b/sysdeps/unix/sysv/linux/sys/quota.h @@ -30,8 +30,6 @@ * 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. - * - * Version: $Id$ */ #ifndef _SYS_QUOTA_H diff --git a/sysdeps/unix/sysv/linux/syslog.c b/sysdeps/unix/sysv/linux/syslog.c index eaaa9839dc..56828b24e3 100644 --- a/sysdeps/unix/sysv/linux/syslog.c +++ b/sysdeps/unix/sysv/linux/syslog.c @@ -7,4 +7,4 @@ # define send_flags 0 #endif -#include +#include diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c index e6af2c4b04..b2ef13eaf8 100644 --- a/sysdeps/unix/sysv/linux/truncate64.c +++ b/sysdeps/unix/sysv/linux/truncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2000, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997-2000, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -71,5 +71,5 @@ truncate64 (const char *path, off64_t length) #else /* Use the generic implementation. */ -# include +# include #endif diff --git a/sysdeps/unix/sysv/linux/updwtmp.c b/sysdeps/unix/sysv/linux/updwtmp.c index 63dd87e418..d4d3f2cb7a 100644 --- a/sysdeps/unix/sysv/linux/updwtmp.c +++ b/sysdeps/unix/sysv/linux/updwtmp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Mark Kettenis , 1998. @@ -31,4 +31,4 @@ && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \ file_name)))) -#include +#include diff --git a/sysdeps/unix/sysv/linux/utmp_file.c b/sysdeps/unix/sysv/linux/utmp_file.c index 3a27802b11..958619a032 100644 --- a/sysdeps/unix/sysv/linux/utmp_file.c +++ b/sysdeps/unix/sysv/linux/utmp_file.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Mark Kettenis , 1998. @@ -31,4 +31,4 @@ && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \ file_name)))) -#include +#include diff --git a/sysdeps/unix/sysv/linux/vfork.c b/sysdeps/unix/sysv/linux/vfork.c index 9b4dd5f121..c8c13d0fd5 100644 --- a/sysdeps/unix/sysv/linux/vfork.c +++ b/sysdeps/unix/sysv/linux/vfork.c @@ -1 +1 @@ -#include +#include diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c index 7e26fecb3a..6662a94d09 100644 --- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c +++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c @@ -1,5 +1,5 @@ #ifdef IS_IN_ldconfig -#include +# include #else -#include +# include #endif diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h index b360b4288a..31455204c3 100644 --- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h @@ -1,5 +1,5 @@ #ifdef IS_IN_ldconfig -#include +# include #else -#include +# include #endif diff --git a/sysdeps/unix/sysv/linux/x86_64/readelflib.c b/sysdeps/unix/sysv/linux/x86_64/readelflib.c index c672f1df5a..5a49af3fa6 100644 --- a/sysdeps/unix/sysv/linux/x86_64/readelflib.c +++ b/sysdeps/unix/sysv/linux/x86_64/readelflib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1999 and Jakub Jelinek , 1999. @@ -53,10 +53,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag, #undef process_elf_file #define process_elf_file process_elf32_file #define __ELF_NATIVE_CLASS 32 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" #undef __ELF_NATIVE_CLASS #undef process_elf_file #define process_elf_file process_elf64_file #define __ELF_NATIVE_CLASS 64 -#include "sysdeps/generic/readelflib.c" +#include "elf/readelflib.c" diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 0dc2f2750e..5dfffca455 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -311,4 +311,31 @@ #endif /* __ASSEMBLER__ */ + +/* Pointer mangling support. */ +#if defined NOT_IN_libc && defined IS_IN_rtld +/* We cannot use the thread descriptor because in ld.so we use setjmp + earlier than the descriptor is initialized. */ +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(reg) xorq __pointer_chk_guard_local(%rip), reg +# define PTR_DEMANGLE(reg) PTR_MANGLE (reg) +# else +# define PTR_MANGLE(reg) asm ("xorq __pointer_chk_guard_local(%%rip), %0"\ + : "=r" (reg) : "0" (reg)) +# define PTR_DEMANGLE(reg) PTR_MANGLE (reg) +# endif +#else +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(reg) xorq %fs:POINTER_GUARD, reg +# define PTR_DEMANGLE(reg) PTR_MANGLE (reg) +# else +# define PTR_MANGLE(var) asm ("xorq %%fs:%c2, %0" \ + : "=r" (var) \ + : "0" (var), \ + "i" (offsetof (tcbhead_t, \ + pointer_guard))) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + #endif /* linux/x86_64/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c new file mode 100644 index 0000000000..9332ae683e --- /dev/null +++ b/sysdeps/unix/sysv/linux/xmknodat.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* Create a device file named PATH relative to FD, 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 +__xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev) +{ + if (vers != _MKNOD_VER) + { + __set_errno (EINVAL); + return -1; + } + + char *buf = NULL; + + if (fd != AT_FDCWD && file[0] != '/') + { + size_t filelen = strlen (file); + static const char procfd[] = "/proc/self/fd/%d/%s"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen; + buf = alloca (buflen); + + __snprintf (buf, buflen, procfd, fd, file); + file = buf; + } + + /* We must convert the value to dev_t type used by the kernel. */ + unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1); + if (k_dev != *dev) + { + __set_errno (EINVAL); + return -1; + } + + return INLINE_SYSCALL (mknod, 3, CHECK_STRING (file), mode, + (unsigned int) k_dev); +} + +libc_hidden_def (__xmknodat) diff --git a/sysdeps/wordsize-32/llabs.c b/sysdeps/wordsize-32/llabs.c index 3087fd6b71..04a93f4eaf 100644 --- a/sysdeps/wordsize-32/llabs.c +++ b/sysdeps/wordsize-32/llabs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,6 @@ #include -#include +#include weak_alias (llabs, imaxabs) diff --git a/sysdeps/wordsize-32/lldiv.c b/sysdeps/wordsize-32/lldiv.c index 5cefd35c22..1d543ba0ff 100644 --- a/sysdeps/wordsize-32/lldiv.c +++ b/sysdeps/wordsize-32/lldiv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ #include -#include +#include #undef imaxdiv weak_alias (lldiv, imaxdiv) diff --git a/sysdeps/wordsize-64/glob.c b/sysdeps/wordsize-64/glob.c index 7ee2eb2727..082faf1c70 100644 --- a/sysdeps/wordsize-64/glob.c +++ b/sysdeps/wordsize-64/glob.c @@ -1,6 +1,6 @@ #define glob64 __no_glob64_decl #define globfree64 __no_globfree64_decl -#include +#include #undef glob64 #undef globfree64 weak_alias (glob, glob64) diff --git a/sysdeps/wordsize-64/labs.c b/sysdeps/wordsize-64/labs.c index 75b41b1145..5162ec5b17 100644 --- a/sysdeps/wordsize-64/labs.c +++ b/sysdeps/wordsize-64/labs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,6 @@ #include -#include +#include weak_alias (labs, imaxabs) diff --git a/sysdeps/wordsize-64/ldiv.c b/sysdeps/wordsize-64/ldiv.c index ff213914ec..e4681a3b8e 100644 --- a/sysdeps/wordsize-64/ldiv.c +++ b/sysdeps/wordsize-64/ldiv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ #include -#include +#include #undef imaxdiv weak_alias (ldiv, imaxdiv) diff --git a/sysdeps/wordsize-64/strtol.c b/sysdeps/wordsize-64/strtol.c index ec07ea7261..2e1b229349 100644 --- a/sysdeps/wordsize-64/strtol.c +++ b/sysdeps/wordsize-64/strtol.c @@ -3,7 +3,7 @@ #define strtoll strtoll_XXX #define strtoq strtoq_XXX -#include +#include #undef __strtoll_internal #undef strtoll diff --git a/sysdeps/wordsize-64/strtol_l.c b/sysdeps/wordsize-64/strtol_l.c index 5a5cd8d0b7..b2cd102add 100644 --- a/sysdeps/wordsize-64/strtol_l.c +++ b/sysdeps/wordsize-64/strtol_l.c @@ -3,7 +3,7 @@ #define __strtoll_l __strtoll_l_XXX #define strtoll_l strtoll_l_XXX -#include +#include #undef ____strtoll_l_internal #undef __strtoll_l diff --git a/sysdeps/wordsize-64/strtoul.c b/sysdeps/wordsize-64/strtoul.c index ac3ca71116..401882ce0d 100644 --- a/sysdeps/wordsize-64/strtoul.c +++ b/sysdeps/wordsize-64/strtoul.c @@ -3,7 +3,7 @@ #define strtoull strtoull_XXX #define strtouq strtouq_XXX -#include +#include #undef __strtoull_internal #undef strtoull diff --git a/sysdeps/wordsize-64/strtoul_l.c b/sysdeps/wordsize-64/strtoul_l.c index 9ee00a379a..80cca332b1 100644 --- a/sysdeps/wordsize-64/strtoul_l.c +++ b/sysdeps/wordsize-64/strtoul_l.c @@ -3,7 +3,7 @@ #define __strtoull_l __strtoull_l_XXX #define strtoull_l strtoull_l_XXX -#include +#include #undef ____strtoull_l_internal #undef __strtoull_l diff --git a/sysdeps/wordsize-64/wcstol.c b/sysdeps/wordsize-64/wcstol.c index 96870cbd3c..b10895a82b 100644 --- a/sysdeps/wordsize-64/wcstol.c +++ b/sysdeps/wordsize-64/wcstol.c @@ -3,7 +3,7 @@ #define wcstoll wcstoll_XXX #define wcstoq wcstoq_XXX -#include +#include #undef __wcstoll_internal #undef wcstoll diff --git a/sysdeps/wordsize-64/wcstol_l.c b/sysdeps/wordsize-64/wcstol_l.c index fe81147fe2..4f48f60c65 100644 --- a/sysdeps/wordsize-64/wcstol_l.c +++ b/sysdeps/wordsize-64/wcstol_l.c @@ -3,7 +3,7 @@ #define __wcstoll_l ___wcstoll_l_XXX #define wcstoll_l __wcstoll_l_XX -#include +#include #undef ____wcstoll_l_internal #undef __wcstoll_l diff --git a/sysdeps/wordsize-64/wcstoul.c b/sysdeps/wordsize-64/wcstoul.c index b6f5d9ac07..2becb80744 100644 --- a/sysdeps/wordsize-64/wcstoul.c +++ b/sysdeps/wordsize-64/wcstoul.c @@ -3,7 +3,7 @@ #define wcstoull wcstoull_XXX #define wcstouq wcstouq_XXX -#include +#include #undef __wcstoull_internal #undef wcstoull diff --git a/sysdeps/wordsize-64/wcstoul_l.c b/sysdeps/wordsize-64/wcstoul_l.c index d13bd5b16a..c376fa0e81 100644 --- a/sysdeps/wordsize-64/wcstoul_l.c +++ b/sysdeps/wordsize-64/wcstoul_l.c @@ -3,7 +3,7 @@ #define __wcstoull_l ___wcstoull_l_XXX #define wcstoull_l __wcstoull_l_XXX -#include +#include #undef ____wcstoull_l_internal #undef __wcstoull_l diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S index 9ed480c540..becfb4f79d 100644 --- a/sysdeps/x86_64/__longjmp.S +++ b/sysdeps/x86_64/__longjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,5 +50,8 @@ ENTRY(__longjmp) mov %esi, %eax movq (JB_PC*8)(%rdi),%rdx movq (JB_RSP*8)(%rdi),%rsp +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (%rdx) +#endif jmpq *%rdx END (BP_SYM (__longjmp)) diff --git a/sysdeps/x86_64/bsd-setjmp.S b/sysdeps/x86_64/bsd-setjmp.S index fdf4833dc6..216c503ccb 100644 --- a/sysdeps/x86_64/bsd-setjmp.S +++ b/sysdeps/x86_64/bsd-setjmp.S @@ -33,6 +33,7 @@ ENTRY (BP_SYM (setjmp)) /* Set up arguments, we only need to set the 2nd arg. */ movl $1, %esi #ifdef PIC + jmp HIDDEN_JUMPTARGET (__sigsetjmp) #else jmp BP_SYM (__sigsetjmp) #endif diff --git a/sysdeps/x86_64/fpu/printf_fphex.c b/sysdeps/x86_64/fpu/printf_fphex.c index d6ca102a88..b701b20b87 100644 --- a/sysdeps/x86_64/fpu/printf_fphex.c +++ b/sysdeps/x86_64/fpu/printf_fphex.c @@ -1,5 +1,5 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2000,2001,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -89,4 +89,4 @@ do { \ } \ } while (0) -#include +#include diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S index 811ab1d913..8af5502042 100644 --- a/sysdeps/x86_64/setjmp.S +++ b/sysdeps/x86_64/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for x86-64. - Copyright (C) 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,13 +34,22 @@ ENTRY (__sigsetjmp) leaq 8(%rsp), %rdx /* Save SP as it will be after we return. */ movq %rdx, (JB_RSP*8)(%rdi) movq (%rsp), %rax /* Save PC we are returning to now. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%rax) +#endif movq %rax, (JB_PC*8)(%rdi) +#if defined NOT_IN_libc && defined IS_IN_rtld + /* In ld.so we never save the signal mask. */ + xorl %eax, %eax + retq +#else /* Make a tail call to __sigjmp_save; it takes the same args. */ -#ifdef PIC +# ifdef PIC jmp C_SYMBOL_NAME (BP_SYM (__sigjmp_save))@PLT -#else +# else jmp BP_SYM (__sigjmp_save) +# endif #endif END (BP_SYM (__sigsetjmp)) hidden_def (__sigsetjmp) diff --git a/sysvipc/msgctl.c b/sysvipc/msgctl.c new file mode 100644 index 0000000000..e4451ed368 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/msgget.c b/sysvipc/msgget.c new file mode 100644 index 0000000000..75f8f1bc7f --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/msgrcv.c b/sysvipc/msgrcv.c new file mode 100644 index 0000000000..f366fa8170 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/msgsnd.c b/sysvipc/msgsnd.c new file mode 100644 index 0000000000..fb4ca1aa56 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/semctl.c b/sysvipc/semctl.c new file mode 100644 index 0000000000..28a8f37387 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/semget.c b/sysvipc/semget.c new file mode 100644 index 0000000000..a9db299000 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/semop.c b/sysvipc/semop.c new file mode 100644 index 0000000000..6ebcb98ba9 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/semtimedop.c b/sysvipc/semtimedop.c new file mode 100644 index 0000000000..82c5682655 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/shmat.c b/sysvipc/shmat.c new file mode 100644 index 0000000000..f418f3e774 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/shmctl.c b/sysvipc/shmctl.c new file mode 100644 index 0000000000..83374e4b92 --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/shmdt.c b/sysvipc/shmdt.c new file mode 100644 index 0000000000..e77f39daac --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/sysvipc/shmget.c b/sysvipc/shmget.c new file mode 100644 index 0000000000..7426de656d --- /dev/null +++ b/sysvipc/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 , 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 +#include + +/* 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 diff --git a/termios/speed.c b/termios/speed.c new file mode 100644 index 0000000000..b4acd62230 --- /dev/null +++ b/termios/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 +#include +#include + +/* 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/termios/tcdrain.c b/termios/tcdrain.c new file mode 100644 index 0000000000..d28ddbf006 --- /dev/null +++ b/termios/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 +#include + +/* 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 diff --git a/termios/tcflow.c b/termios/tcflow.c new file mode 100644 index 0000000000..f4db981f28 --- /dev/null +++ b/termios/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 +#include + +/* 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 diff --git a/termios/tcflush.c b/termios/tcflush.c new file mode 100644 index 0000000000..c95f78e4ae --- /dev/null +++ b/termios/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 +#include + +/* 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 diff --git a/termios/tcgetattr.c b/termios/tcgetattr.c new file mode 100644 index 0000000000..6751e88b83 --- /dev/null +++ b/termios/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 +#include +#include + +/* 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 diff --git a/termios/tcgetpgrp.c b/termios/tcgetpgrp.c new file mode 100644 index 0000000000..2a1d846e75 --- /dev/null +++ b/termios/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 +#include +#include + +/* 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 diff --git a/termios/tcsendbrk.c b/termios/tcsendbrk.c new file mode 100644 index 0000000000..4f40cfb153 --- /dev/null +++ b/termios/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 +#include + +/* 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 diff --git a/termios/tcsetattr.c b/termios/tcsetattr.c new file mode 100644 index 0000000000..205838c87b --- /dev/null +++ b/termios/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 +#include +#include + +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 diff --git a/termios/tcsetpgrp.c b/termios/tcsetpgrp.c new file mode 100644 index 0000000000..59f58e59aa --- /dev/null +++ b/termios/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 +#include +#include + +/* 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 diff --git a/time/adjtime.c b/time/adjtime.c new file mode 100644 index 0000000000..8645652188 --- /dev/null +++ b/time/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 +#include + +/* 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 diff --git a/time/clock.c b/time/clock.c new file mode 100644 index 0000000000..99dc5f47e0 --- /dev/null +++ b/time/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 +#include +#include + +/* 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 diff --git a/time/ftime.c b/time/ftime.c new file mode 100644 index 0000000000..94dfbcc98b --- /dev/null +++ b/time/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 +#include +#include + +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/time/getitimer.c b/time/getitimer.c new file mode 100644 index 0000000000..d9f3063e1e --- /dev/null +++ b/time/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 +#include +#include + +/* 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 diff --git a/time/gettimeofday.c b/time/gettimeofday.c new file mode 100644 index 0000000000..f4a170c9e7 --- /dev/null +++ b/time/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 +#include + +#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 diff --git a/time/setitimer.c b/time/setitimer.c new file mode 100644 index 0000000000..755fa06a7b --- /dev/null +++ b/time/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 +#include +#include + +/* 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 diff --git a/time/settimeofday.c b/time/settimeofday.c new file mode 100644 index 0000000000..abff6f92a1 --- /dev/null +++ b/time/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 +#include + +/* 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 diff --git a/time/stime.c b/time/stime.c new file mode 100644 index 0000000000..5ed1b040e2 --- /dev/null +++ b/time/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 +#include +#include + +/* 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 diff --git a/time/sys/time.h b/time/sys/time.h index 199125bff3..96649ffa45 100644 --- a/time/sys/time.h +++ b/time/sys/time.h @@ -153,7 +153,7 @@ extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW; modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ extern int futimesat (int __fd, __const char *__file, - __const struct timeval __tvp[2]) __THROW __nonnull ((2)); + __const struct timeval __tvp[2]) __THROW; #endif diff --git a/time/time.c b/time/time.c new file mode 100644 index 0000000000..ec66f119df --- /dev/null +++ b/time/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 +#include + +/* 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 diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 4aab7e8d89..7446bda89e 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -47,7 +47,7 @@ include ../Rules CFLAGS-wcwidth.c = -I../wctype CFLAGS-wcswidth.c = -I../wctype -strtox-CFLAGS = -I../include -I../stdlib +strtox-CFLAGS = -I../include CFLAGS-wcstol.c = $(strtox-CFLAGS) CFLAGS-wcstoul.c = $(strtox-CFLAGS) CFLAGS-wcstoll.c = $(strtox-CFLAGS) @@ -64,6 +64,9 @@ CFLAGS-wcstold_l.c = $(strtox-CFLAGS) CFLAGS-wcstof_l.c = $(strtox-CFLAGS) CFLAGS-tst-wchar-h.c = -D_FORTIFY_SOURCE=2 +# We need to find the default version of strtold_l in stdlib. +CPPFLAGS-wcstold_l.c = -I../stdlib + tst-btowc-ENV = LOCPATH=$(common-objpfx)localedata tst-mbrtowc-ENV = LOCPATH=$(common-objpfx)localedata tst-wcrtomb-ENV = LOCPATH=$(common-objpfx)localedata diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c index 6add7ed8bb..6517d4f635 100644 --- a/wcsmbs/btowc.c +++ b/wcsmbs/btowc.c @@ -26,6 +26,8 @@ #include #include +#include + wint_t __btowc (c) @@ -45,13 +47,17 @@ __btowc (c) /* Get the conversion functions. */ fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE)); + __gconv_btowc_fct btowc_fct = fcts->towc->__btowc_fct; if (__builtin_expect (fcts->towc_nsteps == 1, 1) - && __builtin_expect (fcts->towc->__btowc_fct != NULL, 1)) + && __builtin_expect (btowc_fct != NULL, 1)) { /* Use the shortcut function. */ - return DL_CALL_FCT (fcts->towc->__btowc_fct, - (fcts->towc, (unsigned char) c)); +#ifdef PTR_DEMANGLE + if (fcts->towc->__shlib_handle != NULL) + PTR_DEMANGLE (btowc_fct); +#endif + return DL_CALL_FCT (btowc_fct, (fcts->towc, (unsigned char) c)); } else { @@ -78,9 +84,13 @@ __btowc (c) /* Create the input string. */ inbuf[0] = c; - status = DL_CALL_FCT (fcts->towc->__fct, - (fcts->towc, &data, &inptr, inptr + 1, - NULL, &dummy, 0, 1)); + __gconv_fct fct = fcts->towc->__fct; +#ifdef PTR_DEMANGLE + if (fcts->towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + status = DL_CALL_FCT (fct, (fcts->towc, &data, &inptr, inptr + 1, + NULL, &dummy, 0, 1)); if (status != __GCONV_OK && status != __GCONV_FULL_OUTPUT && status != __GCONV_EMPTY_INPUT) diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index eb2a312b7c..b534571736 100644 --- a/wcsmbs/mbrtowc.c +++ b/wcsmbs/mbrtowc.c @@ -18,13 +18,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include #include #include -#include +#include #ifndef EILSEQ # define EILSEQ EINVAL @@ -73,9 +74,13 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) endbuf = inbuf + n; if (__builtin_expect (endbuf < inbuf, 0)) endbuf = (const unsigned char *) ~(uintptr_t) 0; - status = DL_CALL_FCT (fcts->towc->__fct, - (fcts->towc, &data, &inbuf, endbuf, - NULL, &dummy, 0, 1)); + __gconv_fct fct = fcts->towc->__fct; +#ifdef PTR_DEMANGLE + if (fcts->towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + status = DL_CALL_FCT (fct, (fcts->towc, &data, &inbuf, endbuf, + NULL, &dummy, 0, 1)); /* There must not be any problems with the conversion but illegal input characters. The output buffer must be large enough, otherwise the diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c index ef5ca06e2f..8d0b9d3609 100644 --- a/wcsmbs/mbsnrtowcs.c +++ b/wcsmbs/mbsnrtowcs.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -24,7 +25,7 @@ #include #include -#include +#include #ifndef EILSEQ # define EILSEQ EINVAL @@ -69,6 +70,11 @@ __mbsnrtowcs (dst, src, nmc, len, ps) /* Get the structure with the function pointers. */ towc = fcts->towc; + __gconv_fct fct = towc->__fct; +#ifdef PTR_DEMANGLE + if (towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -82,9 +88,8 @@ __mbsnrtowcs (dst, src, nmc, len, ps) { data.__outbuf = (unsigned char *) buf; - status = DL_CALL_FCT (towc->__fct, - (towc, &data, &inbuf, srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (towc, &data, &inbuf, srcend, NULL, + &dummy, 0, 1)); result += (wchar_t *) data.__outbuf - buf; } @@ -103,7 +108,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps) data.__outbuf = (unsigned char *) dst; data.__outbufend = data.__outbuf + len * sizeof (wchar_t); - status = DL_CALL_FCT (towc->__fct, + status = DL_CALL_FCT (fct, (towc, &data, (const unsigned char **) src, srcend, NULL, &dummy, 0, 1)); diff --git a/wcsmbs/mbsrtowcs_l.c b/wcsmbs/mbsrtowcs_l.c index c44c8e5066..264c410c92 100644 --- a/wcsmbs/mbsrtowcs_l.c +++ b/wcsmbs/mbsrtowcs_l.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include "wcsmbsload.h" @@ -28,7 +29,7 @@ #include #include -#include +#include #ifndef EILSEQ # define EILSEQ EINVAL @@ -63,6 +64,11 @@ __mbsrtowcs_l (dst, src, len, ps, l) /* Get the structure with the function pointers. */ towc = fcts->towc; + __gconv_fct fct = towc->__fct; +#ifdef PTR_DEMANGLE + if (towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -81,9 +87,8 @@ __mbsrtowcs_l (dst, src, len, ps, l) { data.__outbuf = (unsigned char *) buf; - status = DL_CALL_FCT (towc->__fct, - (towc, &data, &inbuf, srcend, NULL, - &non_reversible, 0, 1)); + status = DL_CALL_FCT (fct, (towc, &data, &inbuf, srcend, NULL, + &non_reversible, 0, 1)); result += (wchar_t *) data.__outbuf - buf; } @@ -116,9 +121,8 @@ __mbsrtowcs_l (dst, src, len, ps, l) worst case we need one input byte for one output wchar_t. */ srcend = srcp + __strnlen ((const char *) srcp, len) + 1; - status = DL_CALL_FCT (towc->__fct, - (towc, &data, &srcp, srcend, NULL, - &non_reversible, 0, 1)); + status = DL_CALL_FCT (fct, (towc, &data, &srcp, srcend, NULL, + &non_reversible, 0, 1)); if ((status != __GCONV_EMPTY_INPUT && status != __GCONV_INCOMPLETE_INPUT) /* Not all input read. */ diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c index f7971e704b..aa51b6891b 100644 --- a/wcsmbs/wcrtomb.c +++ b/wcsmbs/wcrtomb.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -24,7 +25,7 @@ #include #include -#include +#include #ifndef EILSEQ # define EILSEQ EINVAL @@ -65,15 +66,19 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps) /* Get the conversion functions. */ fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE)); + __gconv_fct fct = fcts->tomb->__fct; +#ifdef PTR_DEMANGLE + if (fcts->tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* If WC is the NUL character we write into the output buffer the byte sequence necessary for PS to get into the initial state, followed by a NUL byte. */ if (wc == L'\0') { - status = DL_CALL_FCT (fcts->tomb->__fct, - (fcts->tomb, &data, NULL, NULL, - NULL, &dummy, 1, 1)); + status = DL_CALL_FCT (fct, (fcts->tomb, &data, NULL, NULL, + NULL, &dummy, 1, 1)); if (status == __GCONV_OK || status == __GCONV_EMPTY_INPUT) *data.__outbuf++ = '\0'; @@ -83,7 +88,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps) /* Do a normal conversion. */ const unsigned char *inbuf = (const unsigned char *) &wc; - status = DL_CALL_FCT (fcts->tomb->__fct, + status = DL_CALL_FCT (fct, (fcts->tomb, &data, &inbuf, inbuf + sizeof (wchar_t), NULL, &dummy, 0, 1)); } diff --git a/wcsmbs/wcsmbsload.c b/wcsmbs/wcsmbsload.c index 1d7374b386..e82b1ffaff 100644 --- a/wcsmbs/wcsmbsload.c +++ b/wcsmbs/wcsmbsload.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,1999,2000,2001,2002,2004 Free Software Foundation, Inc. +/* Copyright (C) 1998-2002,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -29,7 +29,7 @@ /* These are the descriptions for the default conversion functions. */ -static struct __gconv_step to_wc = +static const struct __gconv_step to_wc = { .__shlib_handle = NULL, .__modname = NULL, @@ -48,7 +48,7 @@ static struct __gconv_step to_wc = .__data = NULL }; -static struct __gconv_step to_mb = +static const struct __gconv_step to_mb = { .__shlib_handle = NULL, .__modname = NULL, @@ -71,9 +71,9 @@ static struct __gconv_step to_mb = /* For the default locale we only have to handle ANSI_X3.4-1968. */ const struct gconv_fcts __wcsmbs_gconv_fcts_c = { - .towc = &to_wc, + .towc = (struct __gconv_step *) &to_wc, .towc_nsteps = 1, - .tomb = &to_mb, + .tomb = (struct __gconv_step *) &to_mb, .tomb_nsteps = 1 }; diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c index 0252b7fa23..171fc3c227 100644 --- a/wcsmbs/wcsnrtombs.c +++ b/wcsmbs/wcsnrtombs.c @@ -17,13 +17,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include #include #include -#include +#include #ifndef EILSEQ # define EILSEQ EINVAL @@ -67,6 +68,11 @@ __wcsnrtombs (dst, src, nwc, len, ps) /* Get the structure with the function pointers. */ tomb = fcts->tomb; + __gconv_fct fct = tomb->__fct; +#ifdef PTR_DEMANGLE + if (tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -82,10 +88,9 @@ __wcsnrtombs (dst, src, nwc, len, ps) { data.__outbuf = buf; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, &inbuf, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, &inbuf, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result += data.__outbuf - buf; @@ -107,10 +112,9 @@ __wcsnrtombs (dst, src, nwc, len, ps) data.__outbuf = (unsigned char *) dst; data.__outbufend = (unsigned char *) dst + len; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, (const unsigned char **) src, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, (const unsigned char **) src, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result = data.__outbuf - (unsigned char *) dst; diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c index d41ca5366b..5973fd9303 100644 --- a/wcsmbs/wcsrtombs.c +++ b/wcsmbs/wcsrtombs.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -24,7 +25,7 @@ #include #include -#include +#include #ifndef EILSEQ # define EILSEQ EINVAL @@ -59,6 +60,11 @@ __wcsrtombs (dst, src, len, ps) /* Get the structure with the function pointers. */ tomb = fcts->tomb; + __gconv_fct fct = tomb->__fct; +#ifdef PTR_DEMANGLE + if (tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -79,10 +85,9 @@ __wcsrtombs (dst, src, len, ps) { data.__outbuf = buf; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, &inbuf, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, &inbuf, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result += data.__outbuf - buf; @@ -108,10 +113,9 @@ __wcsrtombs (dst, src, len, ps) data.__outbuf = (unsigned char *) dst; data.__outbufend = (unsigned char *) dst + len; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, (const unsigned char **) src, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, (const unsigned char **) src, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result = data.__outbuf - (unsigned char *) dst; diff --git a/wcsmbs/wcstol.c b/wcsmbs/wcstol.c new file mode 100644 index 0000000000..b238d04b19 --- /dev/null +++ b/wcsmbs/wcstol.c @@ -0,0 +1,23 @@ +/* Function to parse a `long int' from text. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 diff --git a/wcsmbs/wcstol_l.c b/wcsmbs/wcstol_l.c new file mode 100644 index 0000000000..3d3bf76ea6 --- /dev/null +++ b/wcsmbs/wcstol_l.c @@ -0,0 +1,30 @@ +/* Convert string representing a number to integer value, using given locale. + Copyright (C) 1997, 2002, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include + +#define USE_WIDE_CHAR 1 + +extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int, int, + __locale_t); + +#include diff --git a/wcsmbs/wcstoll.c b/wcsmbs/wcstoll.c new file mode 100644 index 0000000000..b666762da4 --- /dev/null +++ b/wcsmbs/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 , 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/wcsmbs/wcstoll_l.c b/wcsmbs/wcstoll_l.c new file mode 100644 index 0000000000..f1a4ca1623 --- /dev/null +++ b/wcsmbs/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 , 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 +#include + +#define QUAD 1 + +extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **, + int, int, __locale_t); + +#include diff --git a/wcsmbs/wcstoul.c b/wcsmbs/wcstoul.c new file mode 100644 index 0000000000..f25f7a9bff --- /dev/null +++ b/wcsmbs/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 , 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/wcsmbs/wcstoul_l.c b/wcsmbs/wcstoul_l.c new file mode 100644 index 0000000000..25058de817 --- /dev/null +++ b/wcsmbs/wcstoul_l.c @@ -0,0 +1,30 @@ +/* Convert string representing a number to integer value, using given locale. + Copyright (C) 1997, 2002, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 +#include + +#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/wcsmbs/wcstoull.c b/wcsmbs/wcstoull.c new file mode 100644 index 0000000000..a69a103515 --- /dev/null +++ b/wcsmbs/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 , 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/wcsmbs/wcstoull_l.c b/wcsmbs/wcstoull_l.c new file mode 100644 index 0000000000..32bc3c4bb9 --- /dev/null +++ b/wcsmbs/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 , 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 +#include + +#define UNSIGNED 1 + +extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, + wchar_t **, int, int, + __locale_t); + +#include diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c index 0f241577a4..cbaac53367 100644 --- a/wcsmbs/wctob.c +++ b/wcsmbs/wctob.c @@ -24,6 +24,8 @@ #include #include +#include + int wctob (c) @@ -64,7 +66,12 @@ wctob (c) inbuf[0] = c; const unsigned char *argptr = (const unsigned char *) inptr; - status = DL_CALL_FCT (fcts->tomb->__fct, + __gconv_fct fct = fcts->tomb->__fct; +#ifdef PTR_DEMANGLE + if (fcts->tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + status = DL_CALL_FCT (fct, (fcts->tomb, &data, &argptr, argptr + sizeof (inbuf[0]), NULL, &dummy, 0, 1)); -- cgit v1.2.3