From 9d13fb2413921c713f83efe331e8e4d219c62c6b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 14 Dec 2005 15:06:39 +0000 Subject: Moved to csu/errno-loc.c. --- bare/strtsupp.c | 28 + 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/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/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/enbl-secure.c | 37 + elf/readelflib.c | 220 +++ gmon/prof-freq.c | 55 + gmon/profil.c | 42 + gmon/sprofil.c | 36 + grp/setgroups.c | 35 + hurd/exc2signal.c | 71 + hurd/longjmp-ts.c | 32 + hurd/trampoline.c | 37 + 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/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/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/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/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/libc_fatal.c | 31 + 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/mig-reply.c | 53 + malloc/morecore.c | 54 + 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/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/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 + nscd/nscd_setup_thread.c | 26 + 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/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/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/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/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/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 + setjmp/jmp-unwind.c | 29 + setjmp/longjmp.c | 46 + setjmp/setjmp.c | 37 + setjmp/sigjmp.c | 35 + 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/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 + 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/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/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/putenv.c | 72 + stdlib/rshift.c | 88 ++ stdlib/setcontext.c | 32 + stdlib/setenv.c | 353 +++++ 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/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 + 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/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/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/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/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/mkdirat.c | 58 - sysdeps/generic/mkfifo.c | 43 - sysdeps/generic/mkfifoat.c | 60 - sysdeps/generic/mknod.c | 62 - sysdeps/generic/mknodat.c | 60 - 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 | 26 - 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/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 | 48 - sysdeps/generic/xmknodat.c | 63 - sysdeps/generic/xpg-strerror.c | 57 - sysdeps/generic/xstat.c | 39 - sysdeps/generic/xstat64.c | 38 - 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/ftime.c | 43 + time/getitimer.c | 42 + time/gettimeofday.c | 39 + time/setitimer.c | 44 + time/settimeofday.c | 35 + time/stime.c | 40 + time/time.c | 36 + 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 + 1445 files changed, 39502 insertions(+), 45370 deletions(-) create mode 100644 bare/strtsupp.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/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/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/enbl-secure.c create mode 100644 elf/readelflib.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 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/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/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/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/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/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/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 nscd/nscd_setup_thread.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/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 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/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/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/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/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/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/_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 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/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/mkdirat.c delete mode 100644 sysdeps/generic/mkfifo.c delete mode 100644 sysdeps/generic/mkfifoat.c delete mode 100644 sysdeps/generic/mknod.c delete mode 100644 sysdeps/generic/mknodat.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/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/xmknodat.c delete mode 100644 sysdeps/generic/xpg-strerror.c delete mode 100644 sysdeps/generic/xstat.c delete mode 100644 sysdeps/generic/xstat64.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/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/bare/strtsupp.c b/bare/strtsupp.c new file mode 100644 index 0000000..c66495b --- /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/csu/errno.c b/csu/errno.c new file mode 100644 index 0000000..03d661b --- /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 0000000..fa21274 --- /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 0000000..194db6b --- /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 0000000..3544e39 --- /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 0000000..08f985c --- /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 0000000..5442eee --- /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/memcpy_chk.c b/debug/memcpy_chk.c new file mode 100644 index 0000000..638cd0e --- /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 0000000..f3b74d2 --- /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 0000000..5297bba --- /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 0000000..d6206ff --- /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 0000000..4b8172f --- /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 0000000..f141fff --- /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 0000000..dacda01 --- /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 0000000..d136339 --- /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 0000000..b3fb347 --- /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 0000000..a4d909f --- /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 0000000..953b435 --- /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 0000000..bdede77 --- /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/fdopendir.c b/dirent/fdopendir.c new file mode 100644 index 0000000..ed30e89 --- /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 0000000..1b1b7c7 --- /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 0000000..cb30e76 --- /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 0000000..771013f --- /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 0000000..893b246 --- /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 0000000..0c18bd9 --- /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 0000000..cf9e952 --- /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 0000000..ad45dfa --- /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 0000000..e78d316 --- /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 0000000..68608de --- /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 0000000..c3828cd --- /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 0000000..7b14452 --- /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 0000000..e471827 --- /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/enbl-secure.c b/elf/enbl-secure.c new file mode 100644 index 0000000..fac3b9c --- /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/readelflib.c b/elf/readelflib.c new file mode 100644 index 0000000..26444ad --- /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/gmon/prof-freq.c b/gmon/prof-freq.c new file mode 100644 index 0000000..ffcc679 --- /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 0000000..8736375 --- /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 0000000..037ed46 --- /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 0000000..74bae72 --- /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 0000000..de044bb --- /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/longjmp-ts.c b/hurd/longjmp-ts.c new file mode 100644 index 0000000..e9c297a --- /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 0000000..7045a0d --- /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/inet/getipv4sourcefilter.c b/inet/getipv4sourcefilter.c new file mode 100644 index 0000000..e956977 --- /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 0000000..373550b --- /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 0000000..fd6deeb --- /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 0000000..dfee1b0 --- /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 0000000..95c94de --- /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 0000000..f217f37 --- /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 0000000..330aae3 --- /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 0000000..55e833b --- /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 0000000..db2b843 --- /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 0000000..870f5e2 --- /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/euidaccess.c b/io/euidaccess.c new file mode 100644 index 0000000..028fe90 --- /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 0000000..db1e4f8 --- /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 0000000..4b5eacb --- /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 0000000..e0d42dd --- /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 0000000..f6921c9 --- /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 0000000..db6fbc3 --- /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 0000000..db3bfcf --- /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 0000000..4a1a996 --- /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 0000000..249b97e --- /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 0000000..c5f75a7 --- /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 0000000..47d4e26 --- /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 0000000..b750dac --- /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 0000000..865ba49 --- /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 0000000..62f7fe3 --- /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 0000000..ba95b73 --- /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 0000000..c472d1d --- /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 0000000..9b0410c --- /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 0000000..524b24c --- /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 0000000..4e0330e --- /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 0000000..70c9949 --- /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/lockf.c b/io/lockf.c new file mode 100644 index 0000000..7b23f66 --- /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 0000000..e3b110c --- /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 0000000..d0a8cff --- /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 0000000..23d4442 --- /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 0000000..596ecd2 --- /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 0000000..8037dfb --- /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 0000000..ccea3aa --- /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 0000000..614ebe9 --- /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 0000000..48c38c8 --- /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 0000000..7d43593 --- /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 0000000..ac515b5 --- /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 0000000..188110b --- /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 0000000..d9a3811 --- /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 0000000..f3f699c --- /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 0000000..87952d3 --- /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 0000000..babaf9c --- /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 0000000..9f2f191 --- /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 0000000..92f8bb8 --- /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 0000000..e7eae5e --- /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 0000000..218b4ad --- /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 0000000..80c1cd3 --- /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 0000000..3943edd --- /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 0000000..779b809 --- /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/rmdir.c b/io/rmdir.c new file mode 100644 index 0000000..5a16fd4 --- /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 0000000..98dc9a8 --- /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 0000000..76b961e --- /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 0000000..af4a9ea --- /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 0000000..cf1a7d8 --- /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 0000000..22e24cf --- /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 0000000..4424abd --- /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 0000000..e6c6709 --- /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/ttyname.c b/io/ttyname.c new file mode 100644 index 0000000..088ba91 --- /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 0000000..14c1209 --- /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 0000000..588d57e --- /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 0000000..1ec6d87 --- /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 0000000..f9a08b9 --- /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 0000000..3a3bcc3 --- /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 0000000..928d43c --- /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 0000000..c2daa46 --- /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 0000000..56d88c7 --- /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 0000000..e7328cc --- /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 0000000..2fb94cf --- /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/libc_fatal.c b/libio/libc_fatal.c new file mode 100644 index 0000000..be23849 --- /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/login/endutxent.c b/login/endutxent.c new file mode 100644 index 0000000..2a93081 --- /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 0000000..cd7107e --- /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 0000000..275c1a8 --- /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 0000000..5f53f22 --- /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 0000000..4961dee --- /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 0000000..ba9d5b7 --- /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 0000000..7414953 --- /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 0000000..65da95b --- /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 0000000..c16e056 --- /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 0000000..1ed5178 --- /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 0000000..b6cd282 --- /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 0000000..c5c4890 --- /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 0000000..415e1db --- /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 0000000..13a7045 --- /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 0000000..e7743bf --- /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 0000000..06ff80b --- /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/mig-reply.c b/mach/mig-reply.c new file mode 100644 index 0000000..3b02028 --- /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/malloc/morecore.c b/malloc/morecore.c new file mode 100644 index 0000000..0a66ef5 --- /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/math/e_log2l.c b/math/e_log2l.c new file mode 100644 index 0000000..681904b --- /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 0000000..9ba9cfc --- /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 0000000..afc2248 --- /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 0000000..6172155 --- /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 0000000..606af53 --- /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 0000000..95a72eb --- /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 0000000..1f5677d --- /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 0000000..4cec79c --- /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 0000000..7680bdb --- /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 0000000..560e326 --- /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 0000000..e1e9065 --- /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 0000000..678271f --- /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 0000000..4a878cc --- /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 0000000..1870689 --- /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 0000000..cf7a774 --- /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 0000000..8680d1e --- /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 0000000..936d6c1 --- /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 0000000..5b14826 --- /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 0000000..3e6aed4 --- /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 0000000..aea2e0f --- /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 0000000..cd8eeff --- /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 0000000..764634a --- /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 0000000..8d0f0ff --- /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 0000000..4be3fb7 --- /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 0000000..29b83d6 --- /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 0000000..236eb30 --- /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 0000000..aa038c2 --- /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 0000000..ea1d71f --- /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 0000000..9993c6b --- /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/s_asinhl.c b/math/s_asinhl.c new file mode 100644 index 0000000..1d5cf47 --- /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 0000000..d9a7eb6 --- /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 0000000..07b6bdc --- /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 0000000..265184e --- /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 0000000..1ae8708 --- /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 0000000..52c3550 --- /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 0000000..4e5e2b3 --- /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 0000000..a7ceff8 --- /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 0000000..2d5b06c --- /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 0000000..5278dbb --- /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 0000000..a574add --- /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 0000000..7037ab9 --- /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 0000000..376b234 --- /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 0000000..f303c05 --- /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 0000000..1d0673a --- /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 0000000..25eec2b --- /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 0000000..e15c073 --- /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 0000000..d2422e6 --- /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 0000000..c3fb0ce --- /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 0000000..6cb45e5 --- /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 0000000..d668e37 --- /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 0000000..1b244d7 --- /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 0000000..4b154de --- /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 0000000..f5b29db --- /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 0000000..f400d34 --- /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 0000000..61ffb49 --- /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 0000000..4ebe2c3 --- /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 0000000..5a299b7 --- /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 0000000..7b68fc3 --- /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 0000000..cf6bc97 --- /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 0000000..f796024 --- /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 0000000..62c2ca7 --- /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 0000000..eed81f3 --- /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 0000000..f901543 --- /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 0000000..21e3b57 --- /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 0000000..43118f7 --- /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 0000000..86536cc --- /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 0000000..58eaa1a --- /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 0000000..4c358b3 --- /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 0000000..8e7ca41 --- /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 0000000..83df13c --- /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 0000000..c70cdc4 --- /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 0000000..eb380e2 --- /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 0000000..8004743 --- /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 0000000..f0e0cc6 --- /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 0000000..e4bb704 --- /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 0000000..2260756 --- /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 0000000..f7a1c43 --- /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 0000000..04ed410 --- /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 0000000..2fba69c --- /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 0000000..9d00946 --- /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 0000000..0464ab8 --- /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 0000000..58d9d13 --- /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 0000000..fe38dae --- /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 0000000..c331dba --- /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 0000000..77ca8f8 --- /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 0000000..89379a5 --- /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 0000000..f329d58 --- /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 0000000..b69d6ae --- /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 0000000..5804e63 --- /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 0000000..2f3ce30 --- /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 0000000..70246ba --- /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 0000000..e5ff5a7 --- /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 0000000..caa7f3a --- /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 0000000..b89e88b --- /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 0000000..f93e14f --- /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 0000000..6f368e1 --- /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 0000000..68c7060 --- /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 0000000..78f02da --- /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 0000000..d6aa9cc --- /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 0000000..5c1610a --- /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 0000000..62e123c --- /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 0000000..1ea5e09 --- /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 0000000..df8b29f --- /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 0000000..e5db907 --- /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 0000000..9b2c505 --- /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 0000000..2e1b1eb --- /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 0000000..9709b92 --- /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 0000000..9c678b7 --- /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 0000000..1a10266 --- /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 0000000..73c3610 --- /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 0000000..4a02dbc --- /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 0000000..69de1e6 --- /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 0000000..9fa0e4f --- /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 0000000..bc9a2d7 --- /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 0000000..cb50f9f --- /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 0000000..6b271e6 --- /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 0000000..f4e6e3c --- /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 0000000..a8998ef --- /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 0000000..e8322ec --- /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 0000000..62f94b8 --- /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 0000000..ae67911 --- /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 0000000..9ab4de8 --- /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 0000000..d531fbd --- /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 0000000..b19b5c5 --- /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 0000000..fb5ee35 --- /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 0000000..f0a10d4 --- /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 0000000..efb08f0 --- /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 0000000..9672e96 --- /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 0000000..b81f65c --- /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 0000000..52a144c --- /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 0000000..5ce53b8 --- /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 0000000..033a034 --- /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 0000000..8e24ca9 --- /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 0000000..5f4623a --- /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 0000000..9e2b1e7 --- /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 0000000..c3d391d --- /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 0000000..aa73eed --- /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 0000000..9447d8f --- /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 0000000..78e71be --- /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 0000000..368ed77 --- /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 0000000..446e5ea --- /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 0000000..9120c88 --- /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 0000000..fea5425 --- /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 0000000..70096a8 --- /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 0000000..43a1d8e --- /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 0000000..2bd133f --- /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 0000000..7b9a297 --- /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 0000000..ab929f7 --- /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 0000000..b6be39e --- /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 0000000..916afbd --- /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 0000000..5ab3544 --- /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 0000000..bb2b82f --- /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 0000000..fde0f64 --- /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 0000000..db8c4ce --- /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 0000000..35b1862 --- /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 0000000..5ecfd1e --- /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 0000000..3a28443 --- /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 0000000..628701d --- /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 0000000..021c16a --- /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 0000000..ab75f75 --- /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 0000000..17a7d01 --- /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 0000000..7c3c058 --- /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 0000000..a32c325 --- /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 0000000..f250e50 --- /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 0000000..2dfea8a --- /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 0000000..6f6f74f --- /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 0000000..9425db3 --- /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 0000000..c63fcd1 --- /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 0000000..25c051d --- /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 0000000..d56a6ee --- /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 0000000..ec8d297 --- /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 0000000..b1d8706 --- /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 0000000..46d9749 --- /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 0000000..5a38f20 --- /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 0000000..707cffc --- /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 0000000..2480fe5 --- /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 0000000..d8be7b7 --- /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 0000000..9d7a7c5 --- /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 0000000..486e626 --- /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 0000000..7635fb9 --- /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 0000000..0086c2a --- /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 0000000..60cb567 --- /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 0000000..c8a45d4 --- /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 0000000..5bde8a2 --- /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 0000000..c29c466 --- /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 0000000..19eb774 --- /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 0000000..41ab1d1 --- /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 0000000..21beb55 --- /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 0000000..0b03eeb --- /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 0000000..3ce6e77 --- /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 0000000..d369805 --- /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 0000000..75970a3 --- /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/fchflags.c b/misc/fchflags.c new file mode 100644 index 0000000..f191194 --- /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 0000000..3edeef0 --- /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 0000000..610ed32 --- /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 0000000..fc2863d --- /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 0000000..9719d42 --- /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 0000000..8a52e72 --- /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 0000000..e2a4d70 --- /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 0000000..d4cca2e --- /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 0000000..df84b7c --- /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 0000000..3378dbf --- /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 0000000..74ccd87 --- /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 0000000..897c6a2 --- /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 0000000..6074ccf --- /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 0000000..38b7577 --- /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 0000000..01baf12 --- /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 0000000..bc59ab5 --- /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 0000000..070c879 --- /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 0000000..40ed1ee --- /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 0000000..bc67e23 --- /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 0000000..ebf7bf2 --- /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 0000000..84e7fed --- /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 0000000..3f71452 --- /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 0000000..6adf1fd --- /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 0000000..490a092 --- /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 0000000..1a7e1e4 --- /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 0000000..fad64e5 --- /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 0000000..6daf6ef --- /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 0000000..6f8cdde --- /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 0000000..34fc183 --- /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 0000000..dbef959 --- /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 0000000..804447e --- /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 0000000..fd8dc8b --- /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 0000000..3d3ed67 --- /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 0000000..43b25a0 --- /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 0000000..2c8aac8 --- /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 0000000..9fefdfc --- /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 0000000..0ffd5c0 --- /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 0000000..3c728c0 --- /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 0000000..ca71982 --- /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 0000000..4a78c32 --- /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 0000000..43b371c --- /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 0000000..1825d57 --- /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 0000000..b33444c --- /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 0000000..6036726 --- /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 0000000..0f15ea4 --- /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 0000000..8379ed1 --- /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 0000000..fc757d8 --- /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 0000000..0df6007 --- /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 0000000..124f26a --- /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 0000000..4d9cbb7 --- /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 0000000..5b5e2cf --- /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 0000000..689000f --- /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 0000000..6f393de --- /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 0000000..1f65b1e --- /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 0000000..f8f33d1 --- /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 0000000..cce2d9d --- /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 0000000..5b8743a --- /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 0000000..6cba9b7 --- /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 0000000..49c569a --- /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 0000000..033d841 --- /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 0000000..910781f --- /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 0000000..5ccdb5d --- /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 0000000..ad78a06 --- /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 0000000..9c5597f --- /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 0000000..6d0f0c3 --- /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 0000000..d7e80dc --- /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 0000000..4ca0847 --- /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 0000000..8f419f9 --- /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 0000000..0aeee62 --- /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 0000000..e4a6f04 --- /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 0000000..329fddb --- /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 0000000..d424c72 --- /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/nscd/nscd_setup_thread.c b/nscd/nscd_setup_thread.c new file mode 100644 index 0000000..32bfe07 --- /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/posix/environ.c b/posix/environ.c new file mode 100644 index 0000000..a0ed0d8 --- /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 0000000..2d75629 --- /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 0000000..fceae92 --- /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 0000000..c19fa65 --- /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 0000000..840460b --- /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 0000000..932c591 --- /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 0000000..548c0b8 --- /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/getegid.c b/posix/getegid.c new file mode 100644 index 0000000..d939d6a --- /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 0000000..c67dbfd --- /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 0000000..742c099 --- /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 0000000..d5868cc --- /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 0000000..12b4283 --- /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 0000000..f2470ee --- /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 0000000..ad46771 --- /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 0000000..85efc2f --- /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 0000000..c1c91fe --- /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 0000000..e00c237 --- /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 0000000..d6a9b52 --- /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 0000000..227d6b7 --- /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 0000000..eb7e60f --- /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 0000000..c4ea7e8 --- /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 0000000..2e76730 --- /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 0000000..2bfab74 --- /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 0000000..7bd9c46 --- /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 0000000..0c2b717 --- /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 0000000..7a2138b --- /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 0000000..6ac5d31 --- /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 0000000..2e34b43 --- /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 0000000..6f8d60f --- /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 0000000..5c79dd5 --- /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 0000000..6831657 --- /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 0000000..ec35ece --- /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 0000000..dd14aa0 --- /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/sched_getaffinity.c b/posix/sched_getaffinity.c new file mode 100644 index 0000000..b2e452f --- /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 0000000..1ca7789 --- /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 0000000..479b913 --- /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 0000000..4b3c1cb --- /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 0000000..813b8f6 --- /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 0000000..f8fec63 --- /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 0000000..652163d --- /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 0000000..cc451fc --- /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 0000000..631cac2 --- /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 0000000..ce41ce9 --- /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 0000000..05c2cc6 --- /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 0000000..c16e29d --- /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 0000000..cb2abf1 --- /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 0000000..8ceb159 --- /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 0000000..78e308c --- /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 0000000..430b63b --- /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 0000000..6a6712b --- /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 0000000..96c3e01 --- /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 0000000..f9d2a65 --- /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 0000000..c7d5f59 --- /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 0000000..f22685c --- /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 0000000..b4e0815 --- /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 0000000..e7c4164 --- /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/vfork.c b/posix/vfork.c new file mode 100644 index 0000000..d15841d --- /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 0000000..b1c512e --- /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 0000000..479d99e --- /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 0000000..b59bf87 --- /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 0000000..a9de1a1 --- /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 0000000..9c7736e --- /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 0000000..2eb5808 --- /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 0000000..2c91df6 --- /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/res-state.c b/resolv/res-state.c new file mode 100644 index 0000000..e327e34 --- /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 0000000..501c92a --- /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 0000000..d4bcadd --- /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 0000000..dcd67cf --- /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 0000000..c679855 --- /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 0000000..8561931 --- /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 0000000..b2e6f8a --- /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 0000000..c8f6e03 --- /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 0000000..d4b4bfc --- /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 0000000..cc74054 --- /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 0000000..03d89f4 --- /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 0000000..37dc01b --- /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/get_clockfreq.c b/rt/get_clockfreq.c new file mode 100644 index 0000000..14375ec --- /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 0000000..d535594 --- /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 0000000..35a571c --- /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 0000000..8237a64 --- /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 0000000..2d24b85 --- /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 0000000..29de75a --- /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 0000000..dea5741 --- /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 0000000..527fd75 --- /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 0000000..8b7cd87 --- /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 0000000..57ee075 --- /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 0000000..e4723f8 --- /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 0000000..5ccfe23 --- /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 0000000..e947b84 --- /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 0000000..6a53903 --- /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 0000000..28478b8 --- /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 0000000..0e3a6b0 --- /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 0000000..4be55aa --- /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 0000000..6ca7ff8 --- /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 0000000..728028e --- /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 0000000..f494a0e --- /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 0000000..d9b69a2 --- /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/setjmp/jmp-unwind.c b/setjmp/jmp-unwind.c new file mode 100644 index 0000000..d2f76c6 --- /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 0000000..9b1bda1 --- /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 0000000..0676ff1 --- /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 0000000..b23c547 --- /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/kill.c b/signal/kill.c new file mode 100644 index 0000000..1d81e45 --- /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 0000000..ad9258d --- /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 0000000..c5a449f --- /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 0000000..bf0a15b --- /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 0000000..17c7e06 --- /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 0000000..81a4ff1 --- /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 0000000..95d52cf --- /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 0000000..734422d --- /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 0000000..9d4c2c8 --- /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 0000000..6c1808b --- /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 0000000..bc598d0 --- /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 0000000..80e16e5 --- /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 0000000..472b3a4 --- /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 0000000..c6e77c0 --- /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 0000000..0239b0a --- /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 0000000..191a909 --- /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 0000000..602c0ad --- /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 0000000..ca9c801 --- /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 0000000..58452e3 --- /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 0000000..7b114a3 --- /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 0000000..148e9a0 --- /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 0000000..0167685 --- /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 0000000..e0659b0 --- /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 0000000..86dbb1d --- /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/getpeername.c b/socket/getpeername.c new file mode 100644 index 0000000..6507387 --- /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 0000000..b698bdb --- /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 0000000..8f4fa89 --- /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 0000000..ba10912 --- /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 0000000..cbdd8b9 --- /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 0000000..4a4d5dd --- /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 0000000..62af8fe --- /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 0000000..4f6a045 --- /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 0000000..419415c --- /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 0000000..7f94fbb --- /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 0000000..a4a3cea --- /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 0000000..823c9dd --- /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 0000000..aca7362 --- /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 0000000..6fb25a4 --- /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 0000000..402ef9b --- /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 0000000..94e70bc --- /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 0000000..ad277c0 --- /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/stdio-common/errlist.c b/stdio-common/errlist.c new file mode 100644 index 0000000..6a834fc --- /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 0000000..571930e --- /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 0000000..7bd3e9b --- /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 0000000..902d294 --- /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 0000000..fd790d5 --- /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 0000000..5dc0e9e --- /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 0000000..b7d8392 --- /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 0000000..e862909 --- /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 0000000..80847cd --- /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 0000000..60c94d6 --- /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 0000000..41f12bc --- /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 0000000..adce634 --- /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/getcontext.c b/stdlib/getcontext.c new file mode 100644 index 0000000..e417575 --- /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 0000000..6cdfe2b --- /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 0000000..5f1065e --- /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 0000000..c568e44 --- /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 0000000..450f938 --- /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 0000000..a7796d8 --- /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 0000000..b15c347 --- /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 0000000..28a016b --- /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/lshift.c b/stdlib/lshift.c new file mode 100644 index 0000000..bedf442 --- /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 0000000..a658688 --- /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 0000000..3273c92 --- /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 0000000..2220299 --- /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 0000000..178edbf --- /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 0000000..16ec73c --- /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 0000000..450f938 --- /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 0000000..fe0cbf3 --- /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 0000000..686e6c5 --- /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 0000000..b478c76 --- /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/putenv.c b/stdlib/putenv.c new file mode 100644 index 0000000..4e86934 --- /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 0000000..9d0a9c4 --- /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 0000000..5841e20 --- /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 0000000..48aaecf --- /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/strtoimax.c b/stdlib/strtoimax.c new file mode 100644 index 0000000..f1de70f --- /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 0000000..02ec19a --- /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 0000000..156083c --- /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 0000000..690a8a9 --- /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 0000000..60128df --- /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 0000000..7725035 --- /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 0000000..0862950 --- /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 0000000..a8b980f --- /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 0000000..accf587 --- /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 0000000..68ad0d8 --- /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 0000000..508cb19 --- /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 0000000..987ad91 --- /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 0000000..3e7163a --- /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 0000000..56b73f0 --- /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 0000000..cd12128 --- /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 0000000..d32796c --- /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 0000000..f1de70f --- /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 0000000..508cb19 --- /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 0000000..555e0b6 --- /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 0000000..431c92b --- /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 0000000..861a40f --- /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 0000000..e6e9898 --- /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 0000000..88dae29 --- /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 0000000..b84dd84 --- /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 0000000..6e37036 --- /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/ffs.c b/string/ffs.c new file mode 100644 index 0000000..06a1542 --- /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 0000000..9dd269a --- /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 0000000..9ffdc33 --- /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 0000000..f3098c7 --- /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 0000000..2f8cf34 --- /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 0000000..e167e85 --- /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 0000000..c404621 --- /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 0000000..16671f7 --- /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 0000000..a72617e --- /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 0000000..21662b1 --- /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 0000000..592b11e --- /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 0000000..cb00ad7 --- /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 0000000..6e42911 --- /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 0000000..164d0f1 --- /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 0000000..3ae3d67 --- /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 0000000..498a27d --- /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 0000000..1dde43c --- /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 0000000..eef22ad --- /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 0000000..c8b7969 --- /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 0000000..88b96dd --- /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 0000000..bd53c05 --- /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 0000000..c736a60 --- /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 0000000..f359d57 --- /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 0000000..89a5baa --- /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 0000000..9bc9db6 --- /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 0000000..a55aaf6 --- /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 0000000..0f22b46 --- /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 0000000..2e2de11 --- /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 0000000..1adb2c0 --- /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 0000000..f32612e --- /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 0000000..454257b --- /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 0000000..620cfab --- /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 0000000..64118b8 --- /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 0000000..e5342f7 --- /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 0000000..dc17ea8 --- /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 0000000..fce1f2a --- /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 0000000..f45b760 --- /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 0000000..b11cb52 --- /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 0000000..0c9a4be --- /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 0000000..5cb56cd --- /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/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c deleted file mode 100644 index f6f16ff..0000000 --- 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 00788f2..0000000 --- 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 dad34ce..0000000 --- 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 c266e94..0000000 --- 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 b626b5d..0000000 --- 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 5fcb7e4..0000000 --- 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 746ae31..0000000 --- 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 8645652..0000000 --- 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 c24a2f7..0000000 --- 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 bc23d75..0000000 --- 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 c29b8d0..0000000 --- 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 2c79ee6..0000000 --- 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 db1d19f..0000000 --- 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 c129235..0000000 --- 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 e824c6b..0000000 --- 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 0530f00..0000000 --- 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 bc62fcb..0000000 --- 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 bb1693e..0000000 --- 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 1f0cceb..0000000 --- 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 ac8d2b6..0000000 --- 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 fe84aec..0000000 --- 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 f2d5237..0000000 --- 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 db7ba36..0000000 --- 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 b01f8b0..0000000 --- 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 19901d8..0000000 --- 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 3f16b88..0000000 --- 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 382e29d..0000000 --- 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 af96bcd..0000000 --- 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 b951819..0000000 --- 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 884a4da..0000000 --- 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 15f3f15..0000000 --- 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 c6ede14..0000000 --- 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 956db76..0000000 --- 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 df1f20b..0000000 --- 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 afaeef8..0000000 --- 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 10ba3da..0000000 --- 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 5d98c98..0000000 --- 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 b678121..0000000 --- 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 38b0512..0000000 --- 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 0e368f2..0000000 --- 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 f20ccf4..0000000 --- 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 d4e441e..0000000 --- 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 99dc5f4..0000000 --- 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 39c7e55..0000000 --- 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 f5978da..0000000 --- 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 ff30612..0000000 --- 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 cff1c25..0000000 --- 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 9d6a92e..0000000 --- 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 0856ba8..0000000 --- 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 4410f02..0000000 --- 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 8e9792f..0000000 --- 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/conjf.c b/sysdeps/generic/conjf.c deleted file mode 100644 index 7893891..0000000 --- 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 5509331..0000000 --- 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 326ebed..0000000 --- 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 e3235a8..0000000 --- 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 4628824..0000000 --- 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 39f4580..0000000 --- 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 e4d94ea..0000000 --- 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 826972f..0000000 --- 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 773ca4f..0000000 --- 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/dirfd.c b/sysdeps/generic/dirfd.c deleted file mode 100644 index 06c0cde..0000000 --- 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 5268f4c..0000000 --- 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 50b97db..0000000 --- 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 609f3d7..0000000 --- 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 c37cdfe..0000000 --- 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 29886e1..0000000 --- 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 089e89e..0000000 --- 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 6dce21e..0000000 --- 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 78beecf..0000000 --- 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 8761937..0000000 --- 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 4713a92..0000000 --- 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 3c850ca..0000000 --- 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 985e2b8..0000000 --- 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 4fed570..0000000 --- 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 3ca89f3..0000000 --- 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 5d5e1b4..0000000 --- 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 2b89789..0000000 --- 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/e_acoshl.c b/sysdeps/generic/e_acoshl.c deleted file mode 100644 index 2c2fbe8..0000000 --- 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 d844d88..0000000 --- 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 3b26f03..0000000 --- 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 0caed8a..0000000 --- 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 625d42d..0000000 --- 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 0da319b..0000000 --- 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 a3eccbb..0000000 --- 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 7d06d07..0000000 --- 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 56f0cfe..0000000 --- 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 64ef6d3..0000000 --- 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 f9467c3..0000000 --- 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 380da24..0000000 --- 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 1c45c84..0000000 --- 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 07df22e..0000000 --- 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 1bf0a1d..0000000 --- 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 656abeb..0000000 --- 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 1bfc069..0000000 --- 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 1784b26..0000000 --- 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 5bc264b..0000000 --- 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 681904b..0000000 --- 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 9ba9cfc..0000000 --- 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 afc2248..0000000 --- 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 6172155..0000000 --- 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 a7664db..0000000 --- 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 5c6326b..0000000 --- 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 a34369c..0000000 --- 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 4cec79c..0000000 --- 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 7680bdb..0000000 --- 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 fac3b9c..0000000 --- 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 2a93081..0000000 --- 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 a0ed0d8..0000000 --- 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 6a834fc..0000000 --- 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 633590f..0000000 --- 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 03d661b..0000000 --- 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 028fe90..0000000 --- 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 de044bb..0000000 --- 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 2d75629..0000000 --- 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 555e0b6..0000000 --- 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 db1e4f8..0000000 --- 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 f191194..0000000 --- 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 4b5eacb..0000000 --- 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 e0d42dd..0000000 --- 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 f6921c9..0000000 --- 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 560e326..0000000 --- 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 db6fbc3..0000000 --- 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 3edeef0..0000000 --- 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 431c92b..0000000 --- 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 ed30e89..0000000 --- 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 e1e9065..0000000 --- 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 678271f..0000000 --- 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 4a878cc..0000000 --- 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 1870689..0000000 --- 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 cf7a774..0000000 --- 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 8680d1e..0000000 --- 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 936d6c1..0000000 --- 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 5b14826..0000000 --- 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 3e6aed4..0000000 --- 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 fceae92..0000000 --- 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 06a1542..0000000 --- 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 9dd269a..0000000 --- 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 aea2e0f..0000000 --- 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 610ed32..0000000 --- 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 fc2863d..0000000 --- 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 db3bfcf..0000000 --- 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 571930e..0000000 --- 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 c19fa65..0000000 --- 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 840460b..0000000 --- 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 cd8eeff..0000000 --- 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 764634a..0000000 --- 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 9719d42..0000000 --- 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 8d0f0ff..0000000 --- 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 8a52e72..0000000 --- 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 4a1a996..0000000 --- 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 249b97e..0000000 --- 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 c5f75a7..0000000 --- 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 47d4e26..0000000 --- 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 e2a4d70..0000000 --- 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 4be3fb7..0000000 --- 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 94dfbcc..0000000 --- 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 d4cca2e..0000000 --- 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 df84b7c..0000000 --- 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 7bd3e9b..0000000 --- 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 902d294..0000000 --- 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 3378dbf..0000000 --- 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 74ccd87..0000000 --- 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 b750dac..0000000 --- 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 865ba49..0000000 --- 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 62f7fe3..0000000 --- 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 ba95b73..0000000 --- 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 2c91df6..0000000 --- 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 932c591..0000000 --- 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 14375ec..0000000 --- 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 548c0b8..0000000 --- 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 897c6a2..0000000 --- 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 e417575..0000000 --- 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 c472d1d..0000000 --- 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 1b1b7c7..0000000 --- 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 cb30e76..0000000 --- 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 6074ccf..0000000 --- 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 38b7577..0000000 --- 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 d939d6a..0000000 --- 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 6cdfe2b..0000000 --- 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 c67dbfd..0000000 --- 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 742c099..0000000 --- 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 d5868cc..0000000 --- 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 01baf12..0000000 --- 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 bc59ab5..0000000 --- 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 e956977..0000000 --- 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 d9f3063..0000000 --- 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 070c879..0000000 --- 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 12b4283..0000000 --- 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 f2470ee..0000000 --- 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 861a40f..0000000 --- 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 40ed1ee..0000000 --- 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 6507387..0000000 --- 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 ad46771..0000000 --- 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 85efc2f..0000000 --- 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 c1c91fe..0000000 --- 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 e6e9898..0000000 --- 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 e00c237..0000000 --- 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 501c92a..0000000 --- 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 cd7107e..0000000 --- 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 d6a9b52..0000000 --- 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 227d6b7..0000000 --- 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 d4bcadd..0000000 --- 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 dcd67cf..0000000 --- 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 c679855..0000000 --- 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 eb7e60f..0000000 --- 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 b698bdb..0000000 --- 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 8f4fa89..0000000 --- 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 373550b..0000000 --- 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 bc67e23..0000000 --- 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 f4a170c..0000000 --- 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 c4ea7e8..0000000 --- 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 275c1a8..0000000 --- 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 5f53f22..0000000 --- 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 4961dee..0000000 --- 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 ba9d5b7..0000000 --- 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 7414953..0000000 --- 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 ebf7bf2..0000000 --- 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 2e76730..0000000 --- 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 2bfab74..0000000 --- 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 65da95b..0000000 --- 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 7bd9c46..0000000 --- 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 84e7fed..0000000 --- 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 fd6deeb..0000000 --- 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 dfee1b0..0000000 --- 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 95c94de..0000000 --- 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 f217f37..0000000 --- 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 330aae3..0000000 --- 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 55e833b..0000000 --- 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 fa21274..0000000 --- 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 0c2b717..0000000 --- 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 dca305e..0000000 --- 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 3f71452..0000000 --- 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 88dae29..0000000 --- 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 9b0410c..0000000 --- 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 ba10912..0000000 --- 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 d2f76c6..0000000 --- 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 29b83d6..0000000 --- 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 236eb30..0000000 --- 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 aa038c2..0000000 --- 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 ea1d71f..0000000 --- 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 9993c6b..0000000 --- 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 1d81e45..0000000 --- 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 ad9258d..0000000 --- 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 c568e44..0000000 --- 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 524b24c..0000000 --- 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 4e0330e..0000000 --- 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 450f938..0000000 --- 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 a7796d8..0000000 --- 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/lgetxattr.c b/sysdeps/generic/lgetxattr.c deleted file mode 100644 index 6adf1fd..0000000 --- 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 194db6b..0000000 --- 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 3544e39..0000000 --- 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 be23849..0000000 --- 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 70c9949..0000000 --- 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 d535594..0000000 --- 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 2e72c46..0000000 --- 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 cbdd8b9..0000000 --- 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 490a092..0000000 --- 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 b15c347..0000000 --- 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 28a016b..0000000 --- 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 1a7e1e4..0000000 --- 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 7b23f66..0000000 --- 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 e3b110c..0000000 --- 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 e9c297a..0000000 --- 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 9b1bda1..0000000 --- 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 fad64e5..0000000 --- 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 6daf6ef..0000000 --- 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 d0a8cff..0000000 --- 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 6f8cdde..0000000 --- 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 0b58389..0000000 --- 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 34fc183..0000000 --- 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 23d4442..0000000 --- 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 596ecd2..0000000 --- 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 dbef959..0000000 --- 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 a658688..0000000 --- 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 9ffdc33..0000000 --- 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 f3098c7..0000000 --- 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 2f8cf34..0000000 --- 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 e167e85..0000000 --- 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 638cd0e..0000000 --- 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 c404621..0000000 --- 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 16671f7..0000000 --- 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 f3b74d2..0000000 --- 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 a72617e..0000000 --- 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 5297bba..0000000 --- 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 21662b1..0000000 --- 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 592b11e..0000000 --- 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 d6206ff..0000000 --- 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 3b02028..0000000 --- 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 804447e..0000000 --- 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 8037dfb..0000000 --- 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/mkdirat.c b/sysdeps/generic/mkdirat.c deleted file mode 100644 index ccea3aa..0000000 --- a/sysdeps/generic/mkdirat.c +++ /dev/null @@ -1,58 +0,0 @@ -/* 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/sysdeps/generic/mkfifo.c b/sysdeps/generic/mkfifo.c deleted file mode 100644 index 614ebe9..0000000 --- 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/mkfifoat.c b/sysdeps/generic/mkfifoat.c deleted file mode 100644 index 48c38c8..0000000 --- a/sysdeps/generic/mkfifoat.c +++ /dev/null @@ -1,60 +0,0 @@ -/* 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/sysdeps/generic/mknod.c b/sysdeps/generic/mknod.c deleted file mode 100644 index 7d43593..0000000 --- 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/mknodat.c b/sysdeps/generic/mknodat.c deleted file mode 100644 index ac515b5..0000000 --- a/sysdeps/generic/mknodat.c +++ /dev/null @@ -1,60 +0,0 @@ -/* 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/sysdeps/generic/mlock.c b/sysdeps/generic/mlock.c deleted file mode 100644 index fd8dc8b..0000000 --- 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 3d3ed67..0000000 --- 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 43b25a0..0000000 --- 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 2c8aac8..0000000 --- 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 90385d1..0000000 --- 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 0a66ef5..0000000 --- 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 520ea31..0000000 --- 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 ea1b7dc..0000000 --- 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 16ec73c..0000000 --- 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 450f938..0000000 --- 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 9fefdfc..0000000 --- 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 8237a64..0000000 --- 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 2d24b85..0000000 --- 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 29de75a..0000000 --- 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 dea5741..0000000 --- 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 527fd75..0000000 --- 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 8b7cd87..0000000 --- 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 57ee075..0000000 --- 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 e4723f8..0000000 --- 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 5ccfe23..0000000 --- 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 e947b84..0000000 --- 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 e4451ed..0000000 --- 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 75f8f1b..0000000 --- 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 f366fa8..0000000 --- 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 fb4ca1a..0000000 --- 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 0ffd5c0..0000000 --- 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 7678e72..0000000 --- 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 1c36b5f..0000000 --- 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 2120cd4..0000000 --- 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 3c728c0..0000000 --- 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 ca71982..0000000 --- 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 4a78c32..0000000 --- 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 7a2138b..0000000 --- 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 8561931..0000000 --- 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 32bfe07..0000000 --- a/sysdeps/generic/nscd_setup_thread.c +++ /dev/null @@ -1,26 +0,0 @@ -/* 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/sysdeps/generic/open.c b/sysdeps/generic/open.c deleted file mode 100644 index 188110b..0000000 --- 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 d9a3811..0000000 --- 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 f3f699c..0000000 --- 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 87952d3..0000000 --- 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 771013f..0000000 --- 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 4a4d5dd..0000000 --- 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 6ac5d31..0000000 --- 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 2e34b43..0000000 --- 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 babaf9c..0000000 --- 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 9f2f191..0000000 --- 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 92f8bb8..0000000 --- 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 e7eae5e..0000000 --- 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 218b4ad..0000000 --- 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 80c1cd3..0000000 --- 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 6f8d60f..0000000 --- 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 5c79dd5..0000000 --- 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 6831657..0000000 --- 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 fd790d5..0000000 --- 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 ffcc679..0000000 --- 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 8736375..0000000 --- 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 43b371c..0000000 --- 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 1825d57..0000000 --- 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 c16e056..0000000 --- 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 4e86934..0000000 --- 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 b84dd84..0000000 --- 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 6e37036..0000000 --- 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 1ed5178..0000000 --- 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 ec35ece..0000000 --- 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 dd14aa0..0000000 --- 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 c5a449f..0000000 --- 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 cb00ad7..0000000 --- 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 3943edd..0000000 --- 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 893b246..0000000 --- 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 0c18bd9..0000000 --- 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 cf9e952..0000000 --- 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 ad45dfa..0000000 --- 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 26444ad..0000000 --- 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 779b809..0000000 --- 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 4b8172f..0000000 --- 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 b33444c..0000000 --- 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 6036726..0000000 --- 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 62af8fe..0000000 --- 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 4f6a045..0000000 --- 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 419415c..0000000 --- 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 0f15ea4..0000000 --- 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 5dc0e9e..0000000 --- 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 8379ed1..0000000 --- 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 b7d8392..0000000 --- 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 e862909..0000000 --- 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 e327e34..0000000 --- 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 fc757d8..0000000 --- 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 e78d316..0000000 --- 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 5a16fd4..0000000 --- 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 59caf73..0000000 --- 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 1d5cf47..0000000 --- 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 d9a7eb6..0000000 --- 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 07b6bdc..0000000 --- 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 265184e..0000000 --- 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 1ae8708..0000000 --- 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 52c3550..0000000 --- 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 4e5e2b3..0000000 --- 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 a7ceff8..0000000 --- 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 2d5b06c..0000000 --- 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 5278dbb..0000000 --- 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 a574add..0000000 --- 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 7037ab9..0000000 --- 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 376b234..0000000 --- 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 f303c05..0000000 --- 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 1d0673a..0000000 --- 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 25eec2b..0000000 --- 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 e15c073..0000000 --- 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 d2422e6..0000000 --- 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 c3fb0ce..0000000 --- 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 6cb45e5..0000000 --- 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 d668e37..0000000 --- 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 1b244d7..0000000 --- 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 4b154de..0000000 --- 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 f5b29db..0000000 --- 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 f400d34..0000000 --- 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 61ffb49..0000000 --- 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 4ebe2c3..0000000 --- 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 5a299b7..0000000 --- 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 7b68fc3..0000000 --- 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 cf6bc97..0000000 --- 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 f796024..0000000 --- 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 62c2ca7..0000000 --- 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 eed81f3..0000000 --- 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 f901543..0000000 --- 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 21e3b57..0000000 --- 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 43118f7..0000000 --- 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 86536cc..0000000 --- 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 58eaa1a..0000000 --- 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 4c358b3..0000000 --- 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 8e7ca41..0000000 --- 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 83df13c..0000000 --- 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 c70cdc4..0000000 --- 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 eb380e2..0000000 --- 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 8004743..0000000 --- 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 f0e0cc6..0000000 --- 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 e4bb704..0000000 --- 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 2260756..0000000 --- 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 f7a1c43..0000000 --- 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 04ed410..0000000 --- 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 2fba69c..0000000 --- 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 9d00946..0000000 --- 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 0464ab8..0000000 --- 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 58d9d13..0000000 --- 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 fe38dae..0000000 --- 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 c331dba..0000000 --- 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 77ca8f8..0000000 --- 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 89379a5..0000000 --- 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 f329d58..0000000 --- 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 b69d6ae..0000000 --- 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 5804e63..0000000 --- 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 2f3ce30..0000000 --- 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 70246ba..0000000 --- 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 e5ff5a7..0000000 --- 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 caa7f3a..0000000 --- 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 b89e88b..0000000 --- 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 f93e14f..0000000 --- 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 6f368e1..0000000 --- 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 68c7060..0000000 --- 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 78f02da..0000000 --- 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 d6aa9cc..0000000 --- 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 5c1610a..0000000 --- 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 12c336f..0000000 --- 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 631db42..0000000 --- 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 123a6b3..0000000 --- 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 e5db907..0000000 --- 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 9b2c505..0000000 --- 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 2e1b1eb..0000000 --- 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 9709b92..0000000 --- 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 c2d799d..0000000 --- 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 4f502c2..0000000 --- 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 73c3610..0000000 --- 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 f95b648..0000000 --- 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 cf5eb59..0000000 --- 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 d84e806..0000000 --- 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 bc9a2d7..0000000 --- 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 0df6007..0000000 --- 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 68608de..0000000 --- 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 b2e452f..0000000 --- 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 1ca7789..0000000 --- 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 479b913..0000000 --- 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 4b3c1cb..0000000 --- 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 813b8f6..0000000 --- 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 f8fec63..0000000 --- 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 652163d..0000000 --- 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 cc451fc..0000000 --- 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 631cac2..0000000 --- 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 ce41ce9..0000000 --- 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 c3828cd..0000000 --- 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 f141fff..0000000 --- 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 124f26a..0000000 --- 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 28a8f37..0000000 --- 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 a9db299..0000000 --- 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 6ebcb98..0000000 --- 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 82c5682..0000000 --- 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 7f94fbb..0000000 --- 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 98dc9a8..0000000 --- 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 76b961e..0000000 --- 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 a4a3cea..0000000 --- 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 823c9dd..0000000 --- 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 5841e20..0000000 --- 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 4d9cbb7..0000000 --- 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 5b5e2cf..0000000 --- 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 48aaecf..0000000 --- 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 689000f..0000000 --- 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 cb50f9f..0000000 --- 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 05c2cc6..0000000 --- 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 74bae72..0000000 --- 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 6f393de..0000000 --- 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 1f65b1e..0000000 --- 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 db2b843..0000000 --- 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 755fa06..0000000 --- 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 0676ff1..0000000 --- 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 c16e29d..0000000 --- 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 cb2abf1..0000000 --- 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 8ceb159..0000000 --- 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 b2e6f8a..0000000 --- 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 f8f33d1..0000000 --- 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 78e308c..0000000 --- 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 430b63b..0000000 --- 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 cce2d9d..0000000 --- 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 c8f6e03..0000000 --- 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 d4b4bfc..0000000 --- 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 6a6712b..0000000 --- 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 aca7362..0000000 --- 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 870f5e2..0000000 --- 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 abff6f9..0000000 --- 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 96c3e01..0000000 --- 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 b6cd282..0000000 --- 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 5b8743a..0000000 --- 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 6a53903..0000000 --- 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 28478b8..0000000 --- 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 f418f3e..0000000 --- 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 83374e4..0000000 --- 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 e77f39d..0000000 --- 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 7426de6..0000000 --- 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 6fb25a4..0000000 --- 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 bf0a15b..0000000 --- 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 17c7e06..0000000 --- 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 81a4ff1..0000000 --- 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 95d52cf..0000000 --- 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 734422d..0000000 --- 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 9d4c2c8..0000000 --- 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 b23c547..0000000 --- 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 80847cd..0000000 --- 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 6c1808b..0000000 --- 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/sigpause.c b/sysdeps/generic/sigpause.c deleted file mode 100644 index bc598d0..0000000 --- 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 80e16e5..0000000 --- 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 472b3a4..0000000 --- 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 c6e77c0..0000000 --- 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 0239b0a..0000000 --- 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 191a909..0000000 --- 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 602c0ad..0000000 --- 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 ca9c801..0000000 --- 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 58452e3..0000000 --- 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 7b114a3..0000000 --- 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 148e9a0..0000000 --- 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 0167685..0000000 --- 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 e0659b0..0000000 --- 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 f9d2a65..0000000 --- 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 402ef9b..0000000 --- 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 94e70bc..0000000 --- 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 ad277c0..0000000 --- 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 c7d5f59..0000000 --- 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 b4acd62..0000000 --- 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 037ed46..0000000 --- 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 6cba9b7..0000000 --- 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 08f985c..0000000 --- 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 af4a9ea..0000000 --- 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 cf1a7d8..0000000 --- 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 22e24cf..0000000 --- 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 4424abd..0000000 --- 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 5ed1b04..0000000 --- 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 6e42911..0000000 --- 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 dacda01..0000000 --- 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 164d0f1..0000000 --- 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 d136339..0000000 --- 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 3ae3d67..0000000 --- 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 1cd3fe1..0000000 --- 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 1dde43c..0000000 --- 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 eef22ad..0000000 --- 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 b3fb347..0000000 --- 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 c8b7969..0000000 --- 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 88b96dd..0000000 --- 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 bd53c05..0000000 --- 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 c736a60..0000000 --- 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 a4d909f..0000000 --- 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 f359d57..0000000 --- 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 89a5baa..0000000 --- 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 9bc9db6..0000000 --- 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 a55aaf6..0000000 --- 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 0e61ebe..0000000 --- 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 2e2de11..0000000 --- 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 953b435..0000000 --- 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 1adb2c0..0000000 --- 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 f32612e..0000000 --- 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 bdede77..0000000 --- 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 454257b..0000000 --- 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 620cfab..0000000 --- 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 64118b8..0000000 --- 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 e5342f7..0000000 --- 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 dc17ea8..0000000 --- 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 fce1f2a..0000000 --- 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 f1de70f..0000000 --- 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 f45b760..0000000 --- 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 b11cb52..0000000 --- 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 02ec19a..0000000 --- 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 156083c..0000000 --- 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 690a8a9..0000000 --- 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 60128df..0000000 --- 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 7725035..0000000 --- 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 0862950..0000000 --- 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 a8b980f..0000000 --- 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 accf587..0000000 --- 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 68ad0d8..0000000 --- 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 508cb19..0000000 --- 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 c66495b..0000000 --- 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 49c569a..0000000 --- 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 4f2f060..0000000 --- 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 c7c08ee..0000000 --- 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 56b73f0..0000000 --- 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 033d841..0000000 --- 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 910781f..0000000 --- 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 e6c6709..0000000 --- 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 5ccdb5d..0000000 --- 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 ad78a06..0000000 --- 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 f22685c..0000000 --- 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 5442eee..0000000 --- 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 9c5597f..0000000 --- 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 cd12128..0000000 --- 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 86dbb1d..0000000 --- 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 6b271e6..0000000 --- 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 d28ddbf..0000000 --- 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 f4db981..0000000 --- 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 c95f78e..0000000 --- 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 6751e88..0000000 --- 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 2a1d846..0000000 --- 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 4f40cfb..0000000 --- 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 205838c..0000000 --- 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 59f58e5..0000000 --- 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 7b14452..0000000 --- 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 60c94d6..0000000 --- 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 ec66f11..0000000 --- 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 0e3a6b0..0000000 --- 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 4be55aa..0000000 --- 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 6ca7ff8..0000000 --- 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 728028e..0000000 --- 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 f494a0e..0000000 --- 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 b4e0815..0000000 --- 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 41f12bc..0000000 --- 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 adce634..0000000 --- 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 7045a0d..0000000 --- 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 6d0f0c3..0000000 --- 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 d7e80dc..0000000 --- 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 d9b69a2..0000000 --- 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 088ba91..0000000 --- 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 14c1209..0000000 --- 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 4ca0847..0000000 --- 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 d32796c..0000000 --- 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 cc74054..0000000 --- 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 588d57e..0000000 --- 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 e7c4164..0000000 --- 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 1ec6d87..0000000 --- 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 f9a08b9..0000000 --- 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 c5c4890..0000000 --- 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 415e1db..0000000 --- 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 13a7045..0000000 --- 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 8f419f9..0000000 --- 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 0aeee62..0000000 --- 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 3a3bcc3..0000000 --- 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 e4a6f04..0000000 --- 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 e7743bf..0000000 --- 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 06ff80b..0000000 --- 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 e471827..0000000 --- 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 d15841d..0000000 --- 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 329fddb..0000000 --- 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 03d89f4..0000000 --- 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 37dc01b..0000000 --- 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 5a1158e..0000000 --- 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 28260dd..0000000 --- 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 2b5d60f..0000000 --- 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 f701983..0000000 --- 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 a37d4c1..0000000 --- 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 cd9cecf..0000000 --- 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 a7ca4ef..0000000 --- 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 d7f7a25..0000000 --- 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 0ac3038..0000000 --- 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 801baa2..0000000 --- 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 09caa06..0000000 --- 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 2897c8c..0000000 --- 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 e7995b1..0000000 --- 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 0b24f2c..0000000 --- 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 d675fc6..0000000 --- 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 709f485..0000000 --- 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 c38fd1d..0000000 --- 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 cc1929a..0000000 --- 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 9e2b1e7..0000000 --- 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 b740ea3..0000000 --- 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 aa73eed..0000000 --- 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 597506f..0000000 --- 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 1c510a3..0000000 --- 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 aebddcb..0000000 --- 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 ccf6a1c..0000000 --- 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 13cfc9a..0000000 --- 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 f492301..0000000 --- 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 70096a8..0000000 --- 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 0ceeb98..0000000 --- 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 9afe5dd..0000000 --- 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 71ed4a9..0000000 --- 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 e91db17..0000000 --- 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 a7e5c1f..0000000 --- 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 2ec215f..0000000 --- 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 5a01876..0000000 --- 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 32e2eeb..0000000 --- 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 b74d9dd..0000000 --- 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 39fe854..0000000 --- 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 2a7c8db..0000000 --- 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 49a486c..0000000 --- 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 85fc383..0000000 --- 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 63ad335..0000000 --- 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 866e3cd..0000000 --- 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 7c7f34f..0000000 --- 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 f3e7d82..0000000 --- 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 d0f6d0d..0000000 --- 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 66962ac..0000000 --- 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 1ee51a6..0000000 --- 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 71f5c00..0000000 --- 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 5f0af79..0000000 --- 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 8a0a70b..0000000 --- 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 f90cb0c..0000000 --- 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 0d08616..0000000 --- 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 7966ff3..0000000 --- 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 1e2eb85..0000000 --- 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 f41757c..0000000 --- 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 9eabe4b..0000000 --- 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 bb979c2..0000000 --- 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 5850651..0000000 --- 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 32196fd..0000000 --- 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 17feb9f..0000000 --- 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 d85a3fe..0000000 --- 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 58255f5..0000000 --- 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 2841401..0000000 --- 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 c981b85..0000000 --- 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 5105608..0000000 --- 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 6a7d307..0000000 --- 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 9b34cd1..0000000 --- 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 a69cf30..0000000 --- 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 3e93cc5..0000000 --- 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 be15d95..0000000 --- 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 f5ccc73..0000000 --- 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 5873ce9..0000000 --- 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 6e34b62..0000000 --- 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 e7b0d87..0000000 --- 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 793fa17..0000000 --- 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 b1c512e..0000000 --- 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 479d99e..0000000 --- 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 b59bf87..0000000 --- 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 a9de1a1..0000000 --- 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 9c7736e..0000000 --- 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 f1de70f..0000000 --- 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 b121d13..0000000 --- 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 f1b4171..0000000 --- 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 b666762..0000000 --- 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 f1a4ca1..0000000 --- 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 f25f7a9..0000000 --- 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 25058de..0000000 --- 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 a69a103..0000000 --- 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 32bc3c4..0000000 --- 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 508cb19..0000000 --- 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 0c9a4be..0000000 --- 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 2eb5808..0000000 --- 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 928d43c..0000000 --- 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 d424c72..0000000 --- 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 c2daa46..0000000 --- a/sysdeps/generic/xmknod.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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/sysdeps/generic/xmknodat.c b/sysdeps/generic/xmknodat.c deleted file mode 100644 index 56d88c7..0000000 --- a/sysdeps/generic/xmknodat.c +++ /dev/null @@ -1,63 +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 - -/* 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/sysdeps/generic/xpg-strerror.c b/sysdeps/generic/xpg-strerror.c deleted file mode 100644 index 5cb56cd..0000000 --- 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 e7328cc..0000000 --- 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 2fb94cf..0000000 --- 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/sysvipc/msgctl.c b/sysvipc/msgctl.c new file mode 100644 index 0000000..e4451ed --- /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 0000000..75f8f1b --- /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 0000000..f366fa8 --- /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 0000000..fb4ca1a --- /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 0000000..28a8f37 --- /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 0000000..a9db299 --- /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 0000000..6ebcb98 --- /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 0000000..82c5682 --- /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 0000000..f418f3e --- /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 0000000..83374e4 --- /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 0000000..e77f39d --- /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 0000000..7426de6 --- /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 0000000..b4acd62 --- /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 0000000..d28ddbf --- /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 0000000..f4db981 --- /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 0000000..c95f78e --- /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 0000000..6751e88 --- /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 0000000..2a1d846 --- /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 0000000..4f40cfb --- /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 0000000..205838c --- /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 0000000..59f58e5 --- /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/ftime.c b/time/ftime.c new file mode 100644 index 0000000..94dfbcc --- /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 0000000..d9f3063 --- /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 0000000..f4a170c --- /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 0000000..755fa06 --- /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 0000000..abff6f9 --- /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 0000000..5ed1b04 --- /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/time.c b/time/time.c new file mode 100644 index 0000000..ec66f11 --- /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/wcstol.c b/wcsmbs/wcstol.c new file mode 100644 index 0000000..b238d04 --- /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 0000000..3d3bf76 --- /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 0000000..b666762 --- /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 0000000..f1a4ca1 --- /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 0000000..f25f7a9 --- /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 0000000..25058de --- /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 0000000..a69a103 --- /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 0000000..32bc3c4 --- /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 -- cgit v1.1