aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog580
-rw-r--r--FAQ5
-rw-r--r--Makeconfig5
-rw-r--r--NOTES91
-rw-r--r--bits/confname.h30
-rw-r--r--bits/resource.h26
-rw-r--r--bits/statfs.h10
-rw-r--r--bits/types.h17
-rw-r--r--config.h.in11
-rwxr-xr-xconfigure136
-rw-r--r--configure.in5
-rw-r--r--ctype/ctype.h94
-rw-r--r--db2/makedb.c5
-rw-r--r--dirent/Makefile2
-rw-r--r--dirent/dirent.h30
-rw-r--r--elf/dl-runtime.c18
-rw-r--r--gmon/gmon.c9
-rw-r--r--grp/grp.h26
-rw-r--r--include/features.h31
-rw-r--r--include/libc-symbols.h202
-rw-r--r--include/limits.h16
-rw-r--r--include/values.h2
-rw-r--r--inet/getnameinfo.c3
-rw-r--r--inet/getnetgrent_r.c3
-rw-r--r--inet/rcmd.c3
-rw-r--r--intl/dcgettext.c14
-rw-r--r--intl/loadmsgcat.c18
-rw-r--r--intl/localealias.c7
-rw-r--r--io/Makefile12
-rw-r--r--io/creat64.c31
-rw-r--r--io/fcntl.h49
-rw-r--r--io/fstat64.c43
-rw-r--r--io/fts.c24
-rw-r--r--io/ftw.c61
-rw-r--r--io/ftw.h24
-rw-r--r--io/ftw64.c32
-rw-r--r--io/lstat64.c43
-rw-r--r--io/stat64.c43
-rw-r--r--io/sys/stat.h198
-rw-r--r--io/sys/statfs.h18
-rw-r--r--libc.map75
-rw-r--r--libio/Makefile4
-rw-r--r--libio/filedoalloc.c2
-rw-r--r--libio/fileops.c51
-rw-r--r--libio/freopen64.c49
-rw-r--r--libio/fseeko64.c48
-rw-r--r--libio/ftello64.c55
-rw-r--r--libio/genops.c35
-rw-r--r--libio/iofgetpos.c2
-rw-r--r--libio/iofgetpos64.c61
-rw-r--r--libio/iofopen.c2
-rw-r--r--libio/iofopen64.c69
-rw-r--r--libio/iofopncook.c14
-rw-r--r--libio/iofsetpos64.c61
-rw-r--r--libio/iolibio.h7
-rw-r--r--libio/iopopen.c4
-rw-r--r--libio/ioseekoff.c6
-rw-r--r--libio/ioseekpos.c6
-rw-r--r--libio/libio.h10
-rw-r--r--libio/libioP.h67
-rw-r--r--libio/memstream.c4
-rw-r--r--libio/obprintf.c4
-rw-r--r--libio/stdio.h133
-rw-r--r--libio/strops.c10
-rw-r--r--libio/vsnprintf.c4
-rw-r--r--locale/programs/locfile.c2
-rw-r--r--malloc/Makefile2
-rw-r--r--malloc/malloc.c249
-rw-r--r--malloc/malloc.h61
-rw-r--r--malloc/mtrace.c3
-rw-r--r--malloc/obstack.h8
-rw-r--r--manual/arith.texi10
-rw-r--r--manual/conf.texi593
-rw-r--r--manual/creature.texi65
-rw-r--r--manual/llio.texi216
-rw-r--r--manual/maint.texi135
-rw-r--r--manual/math.texi27
-rw-r--r--manual/process.texi24
-rw-r--r--manual/signal.texi8
-rw-r--r--manual/stdio.texi29
-rw-r--r--manual/terminal.texi8
-rw-r--r--manual/time.texi36
-rw-r--r--math/Makefile10
-rw-r--r--math/bits/cmathcalls.h5
-rw-r--r--math/bits/mathcalls.h25
-rw-r--r--math/libm-test.c216
-rw-r--r--math/libm.map11
-rw-r--r--math/math.h25
-rw-r--r--math/test-double.c1
-rw-r--r--math/test-float.c1
-rw-r--r--math/test-idouble.c1
-rw-r--r--math/test-ifloat.c3
-rw-r--r--math/tgmath.h312
-rw-r--r--misc/err.h6
-rw-r--r--misc/fstab.c1
-rw-r--r--misc/getttyent.c5
-rw-r--r--misc/regexp.h7
-rw-r--r--misc/sys/cdefs.h68
-rw-r--r--misc/sys/file.h18
-rw-r--r--misc/syslog.c3
-rw-r--r--misc/tsearch.c2
-rw-r--r--nis/Banner2
-rw-r--r--nis/Makefile9
-rw-r--r--nis/TODO3
-rw-r--r--nis/lckcache.c181
-rw-r--r--nis/libnsl.map31
-rw-r--r--nis/nis_add.c1
-rw-r--r--nis/nis_addmember.c27
-rw-r--r--nis/nis_cache.c307
-rw-r--r--nis/nis_call.c9
-rw-r--r--nis/nis_checkpoint.c22
-rw-r--r--nis/nis_clone.c573
-rw-r--r--nis/nis_clone_dir.c69
-rw-r--r--nis/nis_clone_obj.c69
-rw-r--r--nis/nis_clone_res.c69
-rw-r--r--nis/nis_creategroup.c3
-rw-r--r--nis/nis_defaults.c66
-rw-r--r--nis/nis_destroygroup.c3
-rw-r--r--nis/nis_domain_of.c1
-rw-r--r--nis/nis_domain_of_r.c1
-rw-r--r--nis/nis_error.c1
-rw-r--r--nis/nis_file.c2
-rw-r--r--nis/nis_free.c300
-rw-r--r--nis/nis_getservlist.c15
-rw-r--r--nis/nis_intern.h4
-rw-r--r--nis/nis_ismember.c155
-rw-r--r--nis/nis_local_names.c1
-rw-r--r--nis/nis_lookup.c5
-rw-r--r--nis/nis_mkdir.c1
-rw-r--r--nis/nis_modify.c3
-rw-r--r--nis/nis_ping.c5
-rw-r--r--nis/nis_print.c105
-rw-r--r--nis/nis_print_group_entry.c134
-rw-r--r--nis/nis_remove.c3
-rw-r--r--nis/nis_removemember.c33
-rw-r--r--nis/nis_rmdir.c1
-rw-r--r--nis/nis_subr.c1
-rw-r--r--nis/nis_table.c178
-rw-r--r--nis/nis_verifygroup.c1
-rw-r--r--nis/nis_xdr.c16
-rw-r--r--nis/nss_nisplus/nisplus-alias.c2
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c2
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c4
-rw-r--r--nis/nss_nisplus/nisplus-network.c4
-rw-r--r--nis/nss_nisplus/nisplus-parser.c6
-rw-r--r--nis/nss_nisplus/nisplus-proto.c4
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c4
-rw-r--r--nis/nss_nisplus/nisplus-service.c4
-rw-r--r--nis/rpcsvc/nis.h52
-rw-r--r--nis/rpcsvc/nis.x118
-rw-r--r--nis/rpcsvc/nis_cache.h47
-rw-r--r--nis/rpcsvc/nis_cache.x47
-rw-r--r--nis/rpcsvc/nis_object.x34
-rw-r--r--nis/rpcsvc/nis_tags.h7
-rw-r--r--nis/rpcsvc/nislib.h20
-rw-r--r--nis/rpcsvc/ypupd.h2
-rw-r--r--nss/digits_dots.c41
-rw-r--r--nss/getXXbyYY_r.c2
-rw-r--r--nss/nsswitch.c17
-rw-r--r--posix/Makefile4
-rw-r--r--posix/confstr.c13
-rw-r--r--posix/execvp.c66
-rw-r--r--posix/getconf.c14
-rwxr-xr-xposix/globtest.sh16
-rw-r--r--posix/sys/types.h35
-rw-r--r--posix/sys/utsname.h12
-rw-r--r--posix/sys/wait.h60
-rw-r--r--posix/unistd.h71
-rw-r--r--posix/wordexp.c20
-rw-r--r--pwd/pwd.h22
-rw-r--r--resolv/gethnamaddr.c3
-rw-r--r--resolv/inet_ntop.c8
-rw-r--r--resolv/inet_pton.c6
-rw-r--r--resolv/netdb.h44
-rw-r--r--resolv/res_init.c3
-rw-r--r--resource/Makefile4
-rw-r--r--resource/sys/resource.h20
-rw-r--r--signal/signal.h72
-rw-r--r--stdio-common/Makefile2
-rw-r--r--stdio-common/fprintf.c7
-rw-r--r--stdio-common/printf_fp.c4
-rw-r--r--stdio-common/tempnam.c2
-rw-r--r--stdio-common/tmpfile.c4
-rw-r--r--stdio-common/tmpfile64.c48
-rw-r--r--stdio-common/tmpnam.c2
-rw-r--r--stdio-common/tmpnam_r.c2
-rw-r--r--stdio-common/vfprintf.c9
-rw-r--r--stdlib/fmtmsg.c4
-rw-r--r--stdlib/longlong.h2
-rw-r--r--stdlib/stdlib.h24
-rw-r--r--stdlib/ucontext.h52
-rw-r--r--string/bits/string2.h30
-rw-r--r--string/endian.h10
-rw-r--r--string/memory.h4
-rw-r--r--string/tester.c13
-rw-r--r--sunrpc/auth_des.c7
-rw-r--r--sunrpc/auth_unix.c3
-rw-r--r--sunrpc/clnt_perr.c3
-rw-r--r--sunrpc/key_call.c3
-rw-r--r--sunrpc/pmap_rmt.c1
-rw-r--r--sunrpc/svc_tcp.c3
-rw-r--r--sunrpc/svcauth_des.c16
-rw-r--r--sunrpc/xcrypt.c31
-rw-r--r--sunrpc/xdr_rec.c15
-rw-r--r--sysdeps/alpha/dl-machine.h8
-rw-r--r--sysdeps/alpha/setjmp.S6
-rw-r--r--sysdeps/generic/_G_config.h9
-rw-r--r--sysdeps/generic/bits/confname.h30
-rw-r--r--sysdeps/generic/bits/resource.h26
-rw-r--r--sysdeps/generic/bits/statfs.h10
-rw-r--r--sysdeps/generic/bits/types.h17
-rw-r--r--sysdeps/generic/memcmp.c2
-rw-r--r--sysdeps/generic/memset.c3
-rw-r--r--sysdeps/generic/strchr.c5
-rw-r--r--sysdeps/generic/strlen.c7
-rw-r--r--sysdeps/generic/sys/mman.h10
-rw-r--r--sysdeps/i386/dl-machine.h8
-rw-r--r--sysdeps/i386/elf/start.S7
-rw-r--r--sysdeps/i386/setjmp.S8
-rw-r--r--sysdeps/i386/sys/ucontext.h120
-rw-r--r--sysdeps/libm-i387/s_fma.S32
-rw-r--r--sysdeps/libm-i387/s_fmaf.S32
-rw-r--r--sysdeps/libm-i387/s_fmal.S32
-rw-r--r--sysdeps/libm-i387/s_llrint.S2
-rw-r--r--sysdeps/libm-i387/s_llrintf.S34
-rw-r--r--sysdeps/libm-i387/s_llrintl.S34
-rw-r--r--sysdeps/libm-i387/s_lrint.S2
-rw-r--r--sysdeps/libm-i387/s_lrintf.S33
-rw-r--r--sysdeps/libm-i387/s_lrintl.S33
-rw-r--r--sysdeps/libm-i387/s_scalbln.c2
-rw-r--r--sysdeps/libm-i387/s_scalblnf.c2
-rw-r--r--sysdeps/libm-i387/s_scalblnl.c2
-rw-r--r--sysdeps/libm-i387/s_scalbn.S2
-rw-r--r--sysdeps/libm-i387/s_scalbnf.S2
-rw-r--r--sysdeps/libm-i387/s_scalbnl.S2
-rw-r--r--sysdeps/libm-ieee754/s_clog10.c65
-rw-r--r--sysdeps/libm-ieee754/s_clog10f.c61
-rw-r--r--sysdeps/libm-ieee754/s_clog10l.c61
-rw-r--r--sysdeps/libm-ieee754/s_fma.c28
-rw-r--r--sysdeps/libm-ieee754/s_fmaf.c28
-rw-r--r--sysdeps/libm-ieee754/s_fmal.c28
-rw-r--r--sysdeps/libm-ieee754/s_llrint.c227
-rw-r--r--sysdeps/libm-ieee754/s_llrintf.c78
-rw-r--r--sysdeps/libm-ieee754/s_llrintl.c86
-rw-r--r--sysdeps/libm-ieee754/s_llround.c151
-rw-r--r--sysdeps/libm-ieee754/s_llroundf.c63
-rw-r--r--sysdeps/libm-ieee754/s_llroundl.c78
-rw-r--r--sysdeps/libm-ieee754/s_lrint.c225
-rw-r--r--sysdeps/libm-ieee754/s_lrintf.c78
-rw-r--r--sysdeps/libm-ieee754/s_lrintl.c86
-rw-r--r--sysdeps/libm-ieee754/s_lround.c143
-rw-r--r--sysdeps/libm-ieee754/s_lroundf.c63
-rw-r--r--sysdeps/libm-ieee754/s_lroundl.c78
-rw-r--r--sysdeps/libm-ieee754/s_nextafterl.c2
-rw-r--r--sysdeps/libm-ieee754/s_nextafterx.c98
-rw-r--r--sysdeps/libm-ieee754/s_nextafterxf.c78
-rw-r--r--sysdeps/libm-ieee754/s_nextafterxl.c1
-rw-r--r--sysdeps/libm-ieee754/s_scalbln.c70
-rw-r--r--sysdeps/libm-ieee754/s_scalblnf.c63
-rw-r--r--sysdeps/libm-ieee754/s_scalblnl.c71
-rw-r--r--sysdeps/libm-ieee754/s_scalbn.c4
-rw-r--r--sysdeps/libm-ieee754/s_scalbnf.c4
-rw-r--r--sysdeps/libm-ieee754/s_scalbnl.c4
-rw-r--r--sysdeps/m68k/dl-machine.h13
-rw-r--r--sysdeps/m68k/m68020/bits/string.h26
-rw-r--r--sysdeps/mach/hurd/bits/fcntl.h76
-rw-r--r--sysdeps/mach/hurd/bits/stat.h64
-rw-r--r--sysdeps/mach/hurd/sys/param.h4
-rw-r--r--sysdeps/posix/open64.c43
-rw-r--r--sysdeps/posix/tempname.c8
-rw-r--r--sysdeps/powerpc/dl-machine.h8
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h12
-rw-r--r--sysdeps/sparc/sparc32/setjmp.S6
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h8
-rw-r--r--sysdeps/sparc/sparc64/sub_n.S4
-rw-r--r--sysdeps/stub/fstatfs.c4
-rw-r--r--sysdeps/stub/fstatfs64.c (renamed from sysdeps/stub/setenv.c)34
-rw-r--r--sysdeps/stub/fxstat.c2
-rw-r--r--sysdeps/stub/fxstat64.c (renamed from sysdeps/stub/morecore.c)40
-rw-r--r--sysdeps/stub/getrlimit64.c (renamed from sysdeps/stub/putenv.c)12
-rw-r--r--sysdeps/stub/lseek64.c49
-rw-r--r--sysdeps/stub/lxstat64.c (renamed from sysdeps/stub/lxstat.c)6
-rw-r--r--sysdeps/stub/open64.c52
-rw-r--r--sysdeps/stub/pread64.c43
-rw-r--r--sysdeps/stub/pwrite64.c43
-rw-r--r--sysdeps/stub/readdir64.c (renamed from sysdeps/stub/getenv.c)16
-rw-r--r--sysdeps/stub/readdir64_r.c (renamed from sysdeps/stub/sbrk.c)19
-rw-r--r--sysdeps/stub/setrlimit64.c34
-rw-r--r--sysdeps/stub/statfs64.c31
-rw-r--r--sysdeps/stub/sysd-stdio.c116
-rw-r--r--sysdeps/stub/sysdep.h3
-rw-r--r--sysdeps/stub/tempname.c7
-rw-r--r--sysdeps/stub/xstat64.c36
-rw-r--r--sysdeps/unix/bsd/bits/fcntl.h65
-rw-r--r--sysdeps/unix/bsd/bits/stat.h2
-rw-r--r--sysdeps/unix/bsd/bsd4.4/wait3.c2
-rw-r--r--sysdeps/unix/bsd/osf/alpha/bits/stat.h2
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h42
-rw-r--r--sysdeps/unix/sysv/i386/i686/time.S27
-rw-r--r--sysdeps/unix/sysv/i386/time.S6
-rw-r--r--sysdeps/unix/sysv/linux/_G_config.h15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/dirent.h50
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h79
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/stat.h2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h21
-rw-r--r--sysdeps/unix/sysv/linux/bits/dirent.h25
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h84
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h115
-rw-r--r--sysdeps/unix/sysv/linux/bits/stat.h45
-rw-r--r--sysdeps/unix/sysv/linux/bits/statfs.h36
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h23
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c6
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c1
-rw-r--r--sysdeps/unix/sysv/linux/llseek.c6
-rw-r--r--sysdeps/unix/sysv/linux/lseek64.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h94
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h51
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/statfs.h40
-rw-r--r--sysdeps/unix/sysv/linux/poll.c5
-rw-r--r--sysdeps/unix/sysv/linux/readv.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h80
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/ioctls.h8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h23
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S13
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h10
-rw-r--r--sysdeps/unix/sysv/linux/sys/param.h6
-rw-r--r--sysdeps/unix/sysv/linux/writev.c4
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/bits/stat.h4
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h2
-rw-r--r--sysdeps/wordsize-32/inttypes.h29
-rw-r--r--sysdeps/wordsize-64/inttypes.h27
-rw-r--r--termios/termios.h4
-rw-r--r--time/README38
-rw-r--r--time/africa256
-rw-r--r--time/strptime.c6
-rw-r--r--time/tzfile.c6
-rw-r--r--time/tzset.c10
-rw-r--r--wcsmbs/wchar.h10
-rw-r--r--wctype/test_wctype.c2
-rw-r--r--wctype/wctype.h90
341 files changed, 9035 insertions, 4388 deletions
diff --git a/ChangeLog b/ChangeLog
index e78451a71f6..40e559d74a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,583 @@
+1997-10-12 05:09 Ulrich Drepper <drepper@cygnus.com>
+
+ * libio/Makefile (routines): Remove iofprintf.
+ * stdio-common/fprintf.c [USE_IN_LIBIO]: Define _IO_fprintf.
+ * libio/filedoalloc.c: Use _G_stat64 instead of stat.
+ * libio/fileops.c (_IO_file_open): Change to take extra argument
+ indicating whether 32 or 64 bit mode is wanted.
+ * libio/iofopen.c: Call _IO_file_open with extra argument set to 0.
+ * libio/iofopen64.c: Call _IO_file_open with extra argument set to 0.
+ * libio/iolibio.h (_IO_freopen, _IO_freopen64): Likewise.
+ * libio/iofgetpos.c: Pretty print.
+ * libio/iofgetpos64.c: Use _IO_fpos64_t for local variable `pos'.
+
+ * manual/conf.texi: Document all the _SC_ and _CS_ constants.
+ * manual/creature.texi: Document _LARGEFILE_SOURCE, _LARGEFILE64_SOURCE
+ and _FILE_OFFSET_BITS.
+ * manual/llio.texi: Document truncate and ftruncate.
+ * manual/stdio.texi: Document positional parameters for printf.
+
+ * math/Makefile (headers): Add tgmath.h.
+ (libm-support): Remove s_lrint, s_llrint, s_lround, and s_llround and
+ move to ...
+ (libm-calls): ... here. Add scalbln, s_nextafterx and s_fma.
+ * math/libm-test.c (lround_test, llround_test): Test for all FP formats
+ by using FUNC().
+ * math/libm.map: Add fma, fmaf, fmal, nextafterx, nextafterxf,
+ nextafterxl, scalbln, scalblnf, scalblnl, lrintf, lrintl, llrintf,
+ llrintl, lroundf, lroundl, llroundf, and llroundl.
+ * math/math.h: Document new platform specific macros from mathdef.h.
+ Remove declaration of lrint, llrint, lround, and llround.
+ * math/test-double.c: Define TEST_DOUBLE.
+ * math/test-idouble.c: Likewise.
+ * math/test-float.c: Define TEST_FLOAT.
+ * math/test-ifloat.c: Likewise.
+ * math/tgmath.h: New file.
+ * math/bits/mathcalls.h: Add nextafterx, scalbln, fma, lrint, llrint,
+ lround, and llround.
+ Change second argument of scalbn to `int'.
+ * sysdeps/libm-ieee754/s_fma.S: New file.
+ * sysdeps/libm-ieee754/s_fmaf.S: New file.
+ * sysdeps/libm-ieee754/s_fmal.S: New file.
+ * sysdeps/libm-i387/s_fma.S: New file.
+ * sysdeps/libm-i387/s_fmaf.S: New file.
+ * sysdeps/libm-i387/s_fmal.S: New file.
+ * sysdeps/libm-i387/s_llrint.S: Change to take double argument.
+ * sysdeps/libm-i387/s_lrint.S: Likewise.
+ * sysdeps/libm-i387/s_llrintf.S: New file.
+ * sysdeps/libm-i387/s_llrintl.S: New file.
+ * sysdeps/libm-i387/s_lrintf.S: New file.
+ * sysdeps/libm-i387/s_lrintl.S: New file.
+ * sysdeps/libm-ieee754/s_llrint.c: Remove version which works on
+ 80bit double.
+ * sysdeps/libm-ieee754/s_lrint.c: Likewise.
+ * sysdeps/libm-ieee754/s_llrintf.S: New file.
+ * sysdeps/libm-ieee754/s_llrintl.S: New file.
+ * sysdeps/libm-ieee754/s_lrintf.S: New file.
+ * sysdeps/libm-ieee754/s_lrintl.S: New file.
+ * sysdeps/libm-i387/s_scalbln.c: New file. Empty file.
+ * sysdeps/libm-i387/s_scalblnf.c: New file. Empty file.
+ * sysdeps/libm-i387/s_scalblnl.c: New file. Empty file.
+ * sysdeps/libm-i387/s_scalbn.c: Add scalbln as alias.
+ * sysdeps/libm-i387/s_scalbnf.c: Add scalblnf as alias.
+ * sysdeps/libm-i387/s_scalbnl.c: Add scalblnl as alias.
+ * sysdeps/libm-ieee754/s_llround.c: Remove version which works on
+ 80bit double.
+ * sysdeps/libm-ieee754/s_lround.c: Likewise.
+ * sysdeps/libm-ieee754/s_llroundf.c: Likewise.
+ * sysdeps/libm-ieee754/s_llroundl.c: Likewise.
+ * sysdeps/libm-ieee754/s_lroundf.c: Likewise.
+ * sysdeps/libm-ieee754/s_lroundl.c: Likewise.
+ * sysdeps/libm-ieee754/s_nextafterl.c: Add alias fo nextafterxl.
+ * sysdeps/libm-ieee754/s_nextafterx.c: New file.
+ * sysdeps/libm-ieee754/s_nextafterxf.c: New file.
+ * sysdeps/libm-ieee754/s_nextafterxl.c: New file.
+ * sysdeps/libm-ieee754/s_scalbln.c: New file.
+ * sysdeps/libm-ieee754/s_scalblnf.c: New file.
+ * sysdeps/libm-ieee754/s_scalblnl.c: New file.
+ * sysdeps/libm-ieee754/s_scalbn.c: Change to take `int' as second arg.
+ * sysdeps/libm-ieee754/s_scalbnf.c: Likewise.
+ * sysdeps/libm-ieee754/s_scalbnl.c: Likewise.
+
+ * stdlib/stdlib.h: Protect declarations of __strto*l_internal functions
+ by #ifdefs since they are duplicated in inttypes.h.
+ * sysdeps/wordsize-32/inttypes.h: Add definition of strtoimax and
+ strtoumax plus needed declarations.
+
+ * sysdeps/generic/confname.h (_SC_AIO_LISTIO_MAX): Fix typo.
+
+1997-10-09 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * locale/programs/locfile.c (locfile_read): Correct while loop.
+
+ * db2/makedb.c (main): Add missing parameter for error output.
+ (process_input): Likewise.
+
+ * resolv/gethnamaddr.c (getanswer): Rewrite a bit to avoid warning.
+
+1997-10-12 05:05 Ulrich Drepper <drepper@cygnus.com>
+
+ * libc-map: Add __bzero, __mempcpy.
+
+1997-10-10 18:51 David S. Miller <davem@tanya.rutgers.edu>
+
+ * sysdeps/unix/sysv/linux/sparc/bits/ioctls.h: Remove dependencies
+ on kernel_termios.h
+
+1997-10-09 10:24 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ Add the changes from the Solaris 2.6 header files, use the new public
+ defines/functions.
+ * nis/nis_addmember.c: Updated.
+ * nis/nis_checkpoint.c: Updated.
+ * nis/nis_creategroup.c: updated.
+ * nis/nis_destroygroup.c: Updated.
+ * nis/nis_getservlist.c: Updated.
+ * nis/nis_ismember.c: Updated.
+ * nis/nis_lookup.c: Updated.
+ * nis/nis_modify.c: Updated.
+ * nis/nis_ping.c: Updated.
+ * nis/nis_print.c: Updated.
+ * nis/nis_print_group_entry.c: Updated.
+ * nis/nis_remove.c: Updated.
+ * nis/nis_removemember.c: Updated.
+ * nis/nis_xdr.c: Updated.
+ * nis/nss_nisplus/nisplus-alias.c: Updated.
+ * nis/nss_nisplus/nisplus-ethers.c: Updated.
+ * nis/nss_nisplus/nisplus-hosts.c: Updated.
+ * nis/nss_nisplus/nisplus-network.c: Updated.
+ * nis/nss_nisplus/nisplus-parser.c: Updated.
+ * nis/nss_nisplus/nisplus-proto.c: Updated.
+ * nis/nss_nisplus/nisplus-rpc.c: Updated.
+ * nis/nss_nisplus/nisplus-service.c: Updated.
+ * nis/rpcsvc/nis.h: Updated.
+ * nis/rpcsvc/nis.x: Updated.
+ * nis/rpcsvc/nis_object.x: Updated.
+ * nis/rpcsvc/nis_tags.h: Updated.
+ * nis/rpcsvc/nislib.h: Updated.
+
+ * nis/lckcache.c: Removed, since Sun has dropped the directory
+ signatures. The old cache version is now a security risk and not
+ longer supported by Sun.
+ * nis/nis_cache.c: Likewise.
+ * nis/rpcsvc/nis_cache.h: Likewise.
+ * nis/rpcsvc/nis_cache.x: Likewise.
+
+ * nis/nis_call.c: Remove calls to the cache functions.
+
+ * nis/libnsl.map: Remove cache and depending functions.
+ * nis/nis_intern.h: Likewise.
+
+ * nis/nis_add.c: Remove #include <rpcsvc/nislib.h>.
+ * nis/nis_domain_of.c: Likewise.
+ * nis/nis_domain_of_r.c: Likewise.
+ * nis/nis_error.c: Likewise.
+ * nis/nis_file.c: Likewise.
+ * nis/nis_local_names.c: Likewise.
+ * nis/nis_mkdir.c: Likewise.
+ * nis/nis_rmdir.c: Likewise.
+ * nis/nis_subr.c: Likewise.
+ * nis/nis_verifygroup.c: Likewise.
+
+ * nis/nis_clone.c: Removed, replaced by ...
+ * nis/nis_clone_dir.c: New.
+ * nis/nis_clone_obj.c: New.
+ * nis/nis_clone_res.c: New.
+ * nis/nis_table.c: Fixed bugs shown through the new clone functions.
+
+ * nis/nis_defaults.c: Fixed a lot of race conditions.
+
+ * nis/nis_free.c: Rewritten.
+
+ * sunrpc/auth_des.c: Fix use of free'ed pointer.
+
+ * nis/Makefile (libnsl-routines): Remove nis_clone, nis_cache and
+ lckcache. Add nis_clone_dir, nis_clone_obj, and nis_clone_res.
+
+1997-10-09 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * wctype/test_wctype.c (TEST): Add parens to avoid ambiguity.
+
+1997-10-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * include/features.h: Don't crash if _XOPEN_SOURCE is defined to
+ be empty.
+
+1997-10-09 05:54 Ulrich Drepper <drepper@cygnus.com>
+
+ * nss/digits_dots.c: Place `result' in resbuf and not in `buffer'.
+ * nss/getXXbyYY_r.c: Make sure digits_dots.c sees `resbuf' as
+ struct and not a pointer. Little optimizations.
+
+1997-10-09 05:00 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/stub/getenv.c: Remove unused file.
+ * sysdeps/stub/lxstat.c: Likewise.
+ * sysdeps/stub/morecore.c: Likewise.
+ * sysdeps/stub/putenv.c: Likewise.
+ * sysdeps/stub/sbrk.c: Likewise.
+ * sysdeps/stub/setenv.c: Likewise.
+ * sysdeps/stub/sysd-stdio.c: Likewise.
+ * sysdeps/stub/sysdep.h: Likewise.
+ Reported by Zack Weinberg <zack@rabi.phys.columbia.edu>.
+
+1997-10-09 04:58 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Add __bzero definition to DWARF2 unwind test.
+ Reported by David S. Miller <davem@caip.rutgers.edu>.
+
+1997-10-07 Paul Eggert <eggert@twinsun.com>
+
+ * intl/loadmsgcat.c (_nl_load_domain):
+ Fix &&/|| typo when checking file size.
+ Check for overflow when stuffing off_t into size_t.
+
+1997-10-07 18:11 Ulrich Drepper <drepper@cygnus.com>
+
+ * time/africa: Update from tzdata1997i.
+
+1997-10-07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * posix/globtest.sh: Add arguments for name of dynamic linker and
+ call dynamic linker to execute globtest.
+
+ * posix/Makefile (tests): Supply arguments to globtest.sh.
+
+1997-10-07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * nis/rpcsvc/ypupd.h: Add missing __END_DECLS.
+
+1997-10-03 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * libc.map: Add mempcpy, prctl.
+
+1997-09-30 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/generic/memcmp.c: Avoid warnings.
+ * sysdeps/generic/memset.c: Likewise.
+ * sysdeps/generic/strchr.c: Likewise.
+ * sysdeps/generic/strlen.c: Likewise.
+
+1997-09-29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * malloc/Makefile ($(objpfx)mtrace): Fix typo.
+
+1997-09-29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/m68k/dl-machine.h (elf_machine_rela): Fix last change.
+ The R_68K_GLOB_DAT and R_68K_JMP_SLOT relocations really ignore
+ the addend, Richard.
+ (elf_machine_fixup_plt): Don't add the addend.
+ (elf_machine_plt_value): New function.
+
+ * sysdeps/alpha/dl-machine.h (elf_machine_plt_value): New
+ function.
+ * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_plt_value): New
+ function.
+ * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_plt_value): New
+ function.
+ * sysdeps/powerpc/dl-machine.h (elf_machine_plt_value): New
+ function.
+ * sysdeps/i386/dl-machine.h (elf_machine_plt_value): New
+ function.
+
+ * elf/dl-runtime.c (fixup, profile_fixup): Don't add in the
+ addend, instead let the machine dependent setup decide.
+
+1997-09-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/m68k/m68020/bits/string.h: New file.
+
+1997-10-07 04:27 Richard Henderson <rth@cygnus.com>
+
+ * Makeconfig (+includes): Add -I$(objpfx).
+
+ * stdlib/longlong.h [__sparc__]: Prototype __udiv_qrnnd.
+
+ * sysdeps/alpha/setjmp.S: __setjmp is the same as _setjmp. Make
+ the former a strong symbol and the later a weak alias.
+ * sysdeps/sparc/sparc32/setjmp.S: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S: Likewise.
+
+1997-10-06 21:01 David S. Miller <davem@tanya.rutgers.edu>
+
+ * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Make ino_t
+ 64-bits.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h: Make st_ino
+ member 64-bits as well, to match the kernel.
+
+1997-10-06 19:35 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/sparc/sparc64/sub_n.S: Fix typo.
+ Patch by Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>.
+
+1997-10-06 01:09 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * time/README: Correct list of files from tzcode package. Add
+ contact information for tzcode/tzdata maintainers. Correct
+ spelling of author's name. Compact lists.
+
+1997-10-06 01:48 Ulrich Drepper <drepper@cygnus.com>
+
+ * malloc/malloc.h: Remove hook definition without caller argument.
+ * malloc/malloc.c: Likewise.
+
+ * string/tester.c: Correct strsep test.
+
+ * string/bits/string2.h: Define __string2_1bptr_p and use it.
+ Patch by David S. Miller <davem@tanya.rutgers.edu>.
+
+ * math/Makefile (routines): Add s_clog10.
+ * math/libm-test.c: Add test for clog10.
+ * math/libm.map: Add clog10{,f,l}.
+ * math/bits/cmathcalls.h [__USE_GNU]: Add clog10.
+ * sysdeps/libm-ieee754/s_clog10.c: New file.
+ * sysdeps/libm-ieee754/s_clog10f.c: New file.
+ * sysdeps/libm-ieee754/s_clog10l.c: New file.
+ * manual/math.texi: Describe clog10.
+
+ * config.h.in: Add USE_REGPARMS and define internal_function based on
+ this.
+ * configure.in: Define USE_REGPARMS for ix86 machines.
+ * gmon/gmon.c: Mark write_hist, write_call_graph and write_bb_counts
+ as internal functions.
+ * inet/getnameinfo.c: Likewise for nrl_domainname.
+ * inet/getnetgrent_r.c: Likewise for __internal_setnetgrent_reuse.
+ * inet/rcmd.c: Likewise for __icheckhost.
+ * intl/dcgettext.c: Likewise for category_to_name and
+ guess_category_value.
+ * intl/localealias.c: Likewise for read_alias_file.
+ * io/fts.c: Likewise for fts_alloc, fts_build, fts_lfree,
+ fts_maxarglen, fts_padjust, fts_palloc, fts_sort, and fts_stat.
+ * libio/genops.c: Likewise for save_for_backup.
+ * malloc/malloc.c (chunk_free, chunk_alloc, chunk_realloc, chunk_align,
+ main_trim, heap_trim): Likewise.
+ * malloc/mtrace.c (tr_where): Likewise.
+ * misc/fstab.c (mnt2fs): Likewise.
+ * misc/getttyent.c (skip, value): Likewise.
+ * misc/syslog.c (openlog_internal): Likewise.
+ * misc/tsearch.c (trecurse, tdestroy_internal): Likewise.
+ * nss/nsswitch.c (nss_lookup_function, nss_parse_file, nss_getline,
+ nss_parse_service_list, nss_new_service): Likewise.
+ * posix/wordexp.c (parse_dollars, parse_backtick, eval_expr): Likewise.
+ * resolv/inet_ntop.c (inet_ntop4, inet_ntop6): Likewise.
+ * resolv/inet_pton.c (inet_pton4, inet_pton6): Likewise.
+ * resolv/res_init.c (res_setoptions): Likewise.
+ * stdio-common/printf_fp.c (group_number): Likewise.
+ * stdio-common/vfprintf.c (buffered_vfprintf, group_number): Likewise.
+ * stdlib/fmtmsg.c (internal_addseverity): Likewise.
+ * sunrpc/auth_des.c (synchronize): Likewise.
+ * sunrpc/auth_unix.c (marshal_new_auth): Likewise.
+ * sunrpc/clnt_perr.c (auth_errmsg): Likewise.
+ * sunrpc/key_call.c (key_call): Likewise.
+ * sunprc/pmap_rmt.c (getbroadcastnets): Likewise.
+ * sunrpc/svc_tcp.c (makefd_xprt): Likewise.
+ * sunrpc/svcauth_des.c (cache_init, cache_spot, cache_ref, invalidate):
+ Likewise.
+ * sunrpc/xdr_rec.c (fix_buf_size, skip_input_bytes, flush_out,
+ set_input_fragment, get_input_bytes): Likewise.
+ * sysdeps/unix/sysv/linux/getsysstats.c (get_proc_path,
+ phys_pages_info): Likewise.
+ * sysdeps/unix/sysv/linux/if_index.c (opensock): Likewise.
+ * sysdeps/unix/sysv/linux/poll.c (__emulate_poll): Likewise.
+ * sysdeps/unix/sysv/linux/readv.c (__atomic_readv_replacement):
+ Likewise.
+ * sysdeps/unix/sysv/linux/readv.c (__atomic_writev_replacement):
+ Likewise.
+ * time/strptime.c (strptime_internal): Likewise.
+ * time/tzfile.c (find_transition, compute_tzname_max): Likewise.
+ * time/tzset.c (compute_change, tz_compute, tzset_internal): Likewise.
+
+ * libc.map: Remove _libio_using_thunks, add _fp_hw and _dl_addr.
+
+ * ctype/ctype.h: Pretty print.
+ * grp/grp.h: Likewise.
+ * include/libc-symbols.h: Likewise.
+ * include/limits.h: Likewise.
+ * include/values.h: Likewise.
+ * io/fcntl.h: Likewise.
+ * io/sys/stat.h: Likewise.
+ * libio/stdio.h: Likewise.
+ * malloc/malloc.h: Likewise.
+ * misc/err.h: Likewise.
+ * misc/regexp.h: Likewise.
+ * misc/sys/cdefs.h: Likewise.
+ * misc/sys/file.h: Likewise.
+ * posix/sys/utsname.h: Likewise.
+ * posix/sys/wait.h: Likewise.
+ * pwd/pwd.h: Likewise.
+ * resolv/netdb.h: Likewise.
+ * signal/signal.h: Likewise.
+ * stdlib/stdlib.h: Likewise.
+ * string/endian.h: Likewise.
+ * string/memory.h: Likewise.
+ * sysdeps/mach/hurd/bits/fcntl.h: Likewise.
+ * sysdeps/mach/hurd/sys/param.h: Likewise.
+ * sysdeps/unix/sysv/linux/sys/param.h: Likewise.
+ * termios/termios.h: Likewise.
+ * wcsmbs/wchar.h: Likewise.
+ * wctype/wctype.h: Likewise.
+
+ * sysdeps/unix/bsd/bsd4.4/wait3.c: Use __WAIT_STATUS in definition.
+
+ Implement Large File Support API.
+ * include/features.h: Add suuport for _LARGEFILE_SOURCE,
+ _LARGEFILE64_SOURCE, and _FILE_OFFSET_BITS.
+ * libc.map: Add new functions for LFS.
+ * dirent/Makefile (routines): Add readdir64 and readdir64_r.
+ * dirent/dirent.h: Update readdir prototype for LFS and add new
+ prototypes for above functions.
+ * io/Makefile (routines): Add xstat64, fxstat64, lxstat64,
+ statfs64, fstatfs64, lstat64, open64, lseek64, creat64, and ftw64.
+ * io/creat64.c: New file.
+ * io/fstat64.c: New file.
+ * io/lstat64.c: New file.
+ * io/stat64.c: New file.
+ * io/ftw64.c: New file.
+ * io/ftw.c: Rewrite to allow easy definition of ftw64.
+ * io/ftw.h: Add LFS interface.
+ * io/fcntl.h: Likewise.
+ * io/sys/stat.h: Likewise.
+ * io/sys/statfs.h: Likewise.
+ * libio/Makefile (routines): Add iofgetpos64, iofopen64, iofsetpos64,
+ freopen64, fseeko64, and ftello64.
+ * libcio/fseeko64.c: New file.
+ * libio/ftello64.c: New file.
+ * libio/iofgetpos64.c: New file.
+ * libio/iofopen64.c: New file.
+ * libio/iofsetpos64.c: New file.
+ * libio/fileops.c (_IO_file_fopen): Change to use _IO_off64_t.
+ (_IO_file_attach): Likewise.
+ (_IO_do_write): Likewise.
+ (_IO_file_sync): Likewise.
+ (_IO_file_seek): Likewise.
+ (_IO_file_seekoff): Likewise. Use _G_stat64.
+ (_IO_file_fopen64): New function.
+ (_IO_file_jumps): Initialize showmanyc and imbue.
+ * libio/genops.c (_IO_default_seekpos): Change to use _IO_fpos64_t.
+ (_IO_default_seekoff): Likewise.
+ (_IO_default_seek): Likewise.
+ (_IO_default_showmanyc, _IO_default_imbue): New functions.
+ * libio/iofopncook.c (_IO_cookie_seek): Change to use _IO_off64_t.
+ * libio/iolibio.h: Add prototypes for LFS functions.
+ * libio/ioseekoff.c: Change to use _IO_fpos64_t.
+ * libio/ioseekpos.c: Likewise.
+ * libio/libio.h: Define _IO_fpos64_t and _IO_off64_t.
+ (_IO_FILE): Move _offset field to end and change type to _IO_off64_t.
+ (_IO_seekoff, _IO_seekpos): Change prototype.
+ * libio/libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t): Change
+ to use _IO_off64_t.
+ Change prototypes for function from the *ops.c files.
+ * libio/stdio.h: Add LFS interface definition.
+ * libio/strops.c (_IO_str_seekoff): Change to use _IO_fpos64_t.
+ * posix/Makefile (routines): Add pread64 and pwrite64.
+ * posix/confstr.c: Handle _CS_LFS* requests.
+ * posix/getconf.c: Handle LFS* requests.
+ * sysdeps/generic/confname.h: Add _CS_LFS* constants.
+ * posix/unistd.h: Document _LFS64_LARGEFILE and _LFS64_STDIO.
+ Define off_t and off64_t appropriately. Change prototypes of
+ LFS functions.
+ * posix/sys/types.h: Add LFS types.
+ * resources/Makefile (routines): Add getrlimit64 and setlimit64.
+ * resource/sys/resource.h: Change prototypes of LFS functions.
+ * stdio-common/Makefile (routines): Add tmpfile64.
+ * stdio-common/tmpfile64.c: New file.
+ * sysdeps/generic/_G_config.h: Define _G_fpos64_t and _G_off64_t.
+ Define _G_OPEN64, _G_LSEEK64, _G_FSTAT64.
+ * sysdeps/unix/sysv/linux/_G_config.h: Likewise.
+ * sysdeps/generic/bits/resource.h: Add LFS definitions.
+ * sysdeps/unix/bsd/sun/sunos4/bits/resource.h: Likewise.
+ * sysdeps/unix/sysv/linux/bits/resource.h: Likewise.
+ * sysdeps/generic/statfs.h: Use __fsblkcnt_t for some of the fields.
+ * sysdeps/unix/sysv/linux/bits/statfs.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/bits/statfs.h: Likewise.
+ * sysdeps/generic/types.h: Define LFS types.
+ * sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise.
+ * sysdeps/unix/sysv/linux/bits/types.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise.
+ * sysdeps/generic/sys/mman.h: Add LFS definitions.
+ * sysdeps/unix/sysv/linux/sys/mman.h: Likewise.
+ * sysdeps/generic/mach/hurd/bits/fcntl.h: Add flock LFS extensions.
+ * sysdeps/unix/bsd/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/bits/fcntl.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Likewise.
+ * sysdeps/generic/mach/hurd/bits/stat.h: Add stat LFS extensions.
+ * sysdeps/unix/bsd/bits/stat.h: Likewise.
+ * sysdeps/unix/bsd/osf/alpha/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/sysv4/i386/bits/stat.h: Likewise.
+ * sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h: Likewise.
+ * sysdeps/posix/open64.c: New file.
+ * sysdeps/stub/fstatfs64.c: New file.
+ * sysdeps/stub/fxstat64.c: New file.
+ * sysdeps/stub/getrlimit64.c: New file.
+ * sysdeps/stub/lseek64.c: New file.
+ * sysdeps/stub/lxstat64.c: New file.
+ * sysdeps/stub/open64.c: New file.
+ * sysdeps/stub/pread64.c: New file.
+ * sysdeps/stub/pwrite64.c: New file.
+ * sysdeps/stub/readdir64.c: New file.
+ * sysdeps/stub/readdir64_r.c: New file.
+ * sysdeps/stub/setrlimit64.c: New file.
+ * sysdeps/stub/statfs64.c: New file.
+ * sysdeps/stub/xstat64.c: New file.
+ * sysdeps/unix/sysv/linux/llseek.c: Define as __llseek and make
+ llseek and lseek64 weak aliases.
+ * sysdeps/unix/sysv/linux/lseek64.c: New file. Empty.
+ * sysdeps/unix/sysv/linux/alpha/bits/dirent.h: New file.
+ * sysdeps/unix/sysv/linux/bits/dirent.h: Add LFS definitions.
+
+ * sysdeps/posix/tempname.c: Add extra argument to trigger use of
+ open64.
+ * sysdeps/stub/tempname.c: Likewise.
+ * stdio-common/tempnam.c: Call __stdio_gen_tempname with extra
+ argument.
+ * stdio-common/tmpfile.c: Likewise.
+ * stdio-common/tmpnam.c: Likewise.
+ * stdio-common/tmpnam_r.c: Likewise.
+
+ * libio/libioP.h: Add definition ofr showmanyc and imbue callbacks.
+ * libio/fileops.c (_IO_file_jumps): Initialize showmanyc and imbue.
+ * libio/iofopncook.c (_IO_cookie_jumps): Likewise.
+ * libio/iopopen.c (_IO_proc_jumps): Likewise.
+ * libio/memstream.c (_IO_mem_jumps): Likewise.
+ * libio/obprintf.c (_IO_obstack_jumps): Likewise.
+ * libio/vsnprintf.c (_IO_strn_jumps): Likewise.
+ * libio/strops.c (_IO_str_jumps): Likewise.
+
+ * manual/arith.texi: Add a few words why cabs should be used.
+ * manual/llio.texi: Describe sync, fsync, fdatasync.
+ Tell about cleanup handlers & fcntl,lseek,write,read,close,open.
+ * manual/process.texi: Tell about cleanup handlers & system,waitpid,
+ wait.
+ * manual/signal.texi: Likewise for pause.
+ * manual/terminal.texi: Likewise for tcdrain.
+ * manual/time.texi: Document nanosleep.
+
+ * posix/exevp.c: Don't use nested function.
+
+ * stdlib/ucontext.h: New file.
+ * sysdeps/i386/sys/ucontext.h: New file. SysV/i386 API definitions.
+
+ * sunrpc/xcrypt.c (hexval): Make a macro for efficiency.
+
+ * sysdeps/i386/setjmp.h: Make `here` label local.
+
+ * sysdeps/i386/elf/start.S: Define _fp_hw "variable".
+
+ * sysdeps/stub/fstatfs.c: Correct warning.
+ * sysdeps/stub/fxstat.c: Likewise.
+ * sysdeps/stub/lxstat.c: Likewise.
+
+ * sysdeps/unix/sysv/i386/i686/time.S: New file.
+
+1997-10-03 20:56 Jason Merrill <jason@yorick.cygnus.com>
+
+ * malloc/obstack.h (obstack_empty_p): New macro.
+
+1997-10-04 17:41 Philip Blundell <Philip.Blundell@pobox.com>
+
+ * inet/getnameinfo.c (getnameinfo): Remove spurious `#if INET6'.
+
+1997-09-30 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * maint.texi: Add copyright terms for libdb (Sleepycat, Harvard).
+ Document new --with-binutils switch; delete reference to
+ --with-gnu-as, --with-gnu-ld, --with-gnu-binutils.
+ Add to description of --without-fp: a kernel FPU emulator
+ is adequate (from FAQ)
+ * INSTALL: Regenerated.
+
+1997-09-30 17:29 Richard Henderson <rth@cygnus.com>
+
+ * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Move
+ _dl_hwcap declaration to ...
+ (elf_machine_fixup_plt): ... here.
+
1997-09-30 18:03 Ulrich Drepper <drepper@cygnus.com>
* Makerules: Undo last change.
diff --git a/FAQ b/FAQ
index bba8bef434d..14d1886d05a 100644
--- a/FAQ
+++ b/FAQ
@@ -192,7 +192,8 @@ Library.
* plenty of time (approx 1h for i?86-linux on i586@133 or 2.5h on
i486@66 or 4.5h on i486@33), both for shared and static only).
- For Hurd systems times are much higher.
+ Multiply this by 1.5 or 2.0 if you build profiling and/or the highly
+ optimized version as well. For Hurd systems times are much higher.
For Atari Falcon (Motorola 68030 @ 16 Mhz, 14 Mb memory) James Troup
<J.J.Troup@comp.brad.ac.uk> reports for a full build (shared, static,
@@ -438,7 +439,7 @@ programs and source code. Until this law gets abolished we cannot
ship the cryptographic function together with the libc.
But of course we provide the code and there is an very easy way to use
-this code. First get the extra package. People in the US way get it
+this code. First get the extra package. People in the US may get it
from the same place they got the GNU libc from. People outside the US
should get the code from ftp://ftp.ifi.uio.no/pub/gnu, or another
archive site outside the USA. The README explains how to install the
diff --git a/Makeconfig b/Makeconfig
index e87100e9afb..45e792fbc74 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -507,8 +507,9 @@ endif # $(+cflags) == ""
# files (including ones given in angle brackets) in the current directory,
# in the parent library source directory and in the include directory.
# `+sysdep-includes' will be defined by Makerules.
-+includes = -I. $(patsubst %/,-I%,$(..)) -I$(..)include $($(stdio)-include) \
- $(includes) $(+sysdep-includes) $(last-includes)
++includes = -I. $(patsubst %/,-I%,$(objpfx)) $(patsubst %/,-I%,$(..)) \
+ -I$(..)include $($(stdio)-include) $(includes) \
+ $(+sysdep-includes) $(last-includes)
# Since libio has several internal header files, we use a -I instead
# of many little headers in the include directory.
diff --git a/NOTES b/NOTES
index 4477110d972..b5c48b861df 100644
--- a/NOTES
+++ b/NOTES
@@ -5,7 +5,7 @@ Feature Test Macros
is controlled by which "feature test macros" you define.
If you compile your programs using `gcc -ansi', you get only the
-ANSI C library features, unless you explicitly request additional
+ISO C library features, unless you explicitly request additional
features by defining one or more of the feature macros. *Note GNU CC
Command Options: (gcc.info)Invoking GCC, for more information about GCC
options.
@@ -21,7 +21,7 @@ self-contained way.
- Macro: _POSIX_SOURCE
If you define this macro, then the functionality from the POSIX.1
standard (IEEE Standard 1003.1) is available, as well as all of the
- ANSI C facilities.
+ ISO C facilities.
- Macro: _POSIX_C_SOURCE
If you define this macro with a value of `1', then the
@@ -29,11 +29,11 @@ self-contained way.
made available. If you define this macro with a value of `2',
then both the functionality from the POSIX.1 standard and the
functionality from the POSIX.2 standard (IEEE Standard 1003.2) are
- made available. This is in addition to the ANSI C facilities.
+ made available. This is in addition to the ISO C facilities.
- Macro: _BSD_SOURCE
If you define this macro, functionality derived from 4.3 BSD Unix
- is included as well as the ANSI C, POSIX.1, and POSIX.2 material.
+ is included as well as the ISO C, POSIX.1, and POSIX.2 material.
Some of the features derived from 4.3 BSD Unix conflict with the
corresponding features specified by the POSIX.1 standard. If this
@@ -53,26 +53,86 @@ self-contained way.
- Macro: _SVID_SOURCE
If you define this macro, functionality derived from SVID is
- included as well as the ANSI C, POSIX.1, POSIX.2, and X/Open
+ included as well as the ISO C, POSIX.1, POSIX.2, and X/Open
material.
- Macro: _XOPEN_SOURCE
- If you define these macro, functionality described in the X/Open
- Portability Guide is included. This is an superset of the POSIX.1
+ - Macro: _XOPEN_SOURCE_EXTENDED
+ If you define this macro, functionality described in the X/Open
+ Portability Guide is included. This is a superset of the POSIX.1
and POSIX.2 functionality and in fact `_POSIX_SOURCE' and
- `_POSIX_C_SOURCE' get automatically be defined.
+ `_POSIX_C_SOURCE' are automatically defined.
- But as the great unifaction of all Unices there is also
- functionality only available in BSD and SVID is included.
+ As the unification of all Unices, functionality only available in
+ BSD and SVID is also included.
If the macro `_XOPEN_SOURCE_EXTENDED' is also defined, even more
functionality is available. The extra functions will make all
functions available which are necessary for the X/Open Unix brand.
+ If the macro `_XOPEN_SOURCE' has the value 500 this includes all
+ functionality described so far plus some new definitions from the
+ Single Unix specification, version 2.
+
+ - Macro: _LARGEFILE_SOURCE
+ If this macro is defined some extra functions are available which
+ rectify a few shortcomings in all previous standards. More
+ concreten the functions `fseeko' and `ftello' are available.
+ Without these functions the difference between the ISO C interface
+ (`fseek', `ftell') and the low-level POSIX interface (`lseek')
+ would lead to problems.
+
+ This macro was introduced as part of the Large File Support
+ extension (LFS).
+
+ - Variable: Macro _LARGEFILE64_SOURCE
+ If you define this macro an additional set of function gets
+ available which enables to use on 32 bit systems to use files of
+ sizes beyond the usual limit of 2GB. This interface is not
+ available if the system does not support files that large. On
+ systems where the natural file size limit is greater than 2GB
+ (i.e., on 64 bit systems) the new functions are identical to the
+ replaced functions.
+
+ The new functionality is made available by a new set of types and
+ functions which replace existing. The names of these new objects
+ contain `64' to indicate the intention, e.g., `off_t' vs.
+ `off64_t' and `fseeko' vs. `fseeko64'.
+
+ This macro was introduced as part of the Large File Support
+ extension (LFS). It is a transition interface for the time 64 bit
+ offsets are not generally used (see `_FILE_OFFSET_BITS'.
+
+ - Variable: _FILE_OFFSET_BITS
+ This macro lets decide which file system interface shall be used,
+ one replacing the other. While `_LARGEFILE64_SOURCE' makes the
+ 64 bit interface available as an additional interface
+ `_FILE_OFFSET_BITS' allows to use the 64 bit interface to replace
+ the old interface.
+
+ If `_FILE_OFFSET_BITS' is undefined or if it is defined to the
+ value `32' nothing changes. The 32 bit interface is used and
+ types like `off_t' have a size of 32 bits on 32 bit systems.
+
+ If the macro is defined to the value `64' the large file interface
+ replaces the old interface. I.e., the functions are not made
+ available under different names as `_LARGEFILE64_SOURCE' does.
+ Instead the old function names now reference the new functions,
+ e.g., a call to `fseeko' now indeed calls `fseeko64'.
+
+ This macro should only be selected if the system provides
+ mechanisms for handling large files. On 64 bit systems this macro
+ has no effect since the `*64' functions are identical to the
+ normal functions.
+
+ This macro was introduced as part of the Large File Support
+ extension (LFS).
+
- Macro: _GNU_SOURCE
- If you define this macro, everything is included: ANSI C, POSIX.1,
- POSIX.2, BSD, SVID, X/Open, and GNU extensions. In the cases where
- POSIX.1 conflicts with BSD, the POSIX definitions take precedence.
+ If you define this macro, everything is included: ISO C, POSIX.1,
+ POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions. In the cases
+ where POSIX.1 conflicts with BSD, the POSIX definitions take
+ precedence.
If you want to get the full effect of `_GNU_SOURCE' but make the
BSD definitions take precedence over the POSIX definitions, use
@@ -87,8 +147,9 @@ self-contained way.
compiler or linker. *Note:* If you forget to do this, you may get
very strange errors at run time.
- - Macro: _REENTRANT,_THREAD_SAFE
- If you define one this macro, reentrant versions of several
+ - Macro: _REENTRANT
+ - Macro: _THREAD_SAFE
+ If you define one of these macros, reentrant versions of several
functions get declared. Some of the functions are specified in
POSIX.1c but many others are only available on a few other systems
or are unique to GNU libc. The problem is that the
diff --git a/bits/confname.h b/bits/confname.h
index 5b5cf742b61..6926cad0adb 100644
--- a/bits/confname.h
+++ b/bits/confname.h
@@ -1,5 +1,5 @@
/* `sysconf', `pathconf', and `confstr' NAME values. Generic version.
- Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -97,7 +97,7 @@ enum
_SC_SHARED_MEMORY_OBJECTS,
#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS
_SC_AIO_LISTIO_MAX,
-#define _SC_AIO_LIST_MAX _SC_AIO_LIST_MAX
+#define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX
_SC_AIO_MAX,
#define _SC_AIO_MAX _SC_AIO_MAX
_SC_AIO_PRIO_DELTA_MAX,
@@ -316,10 +316,32 @@ enum
#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX
};
-#ifdef __USE_POSIX2
+#if (defined __USE_POSIX2 || defined __USE_FILE_OFFSET64 \
+ || defined __USE_LARGEFILE64 || defined __USE_LARGEFILE)
/* Values for the NAME argument to `confstr'. */
enum
{
- _CS_PATH /* The default search path. */
+ _CS_PATH, /* The default search path. */
+#define _CS_PATH _CS_PATH
+
+#if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \
+ || defined __USE_LARGEFILE)
+ _CS_LFS_CFLAGS = 1000,
+# define _CS_LFS_CFLAGS _CS_LFS_CFLAGS
+ _CS_LFS_LDFLAGS,
+# define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS
+ _CS_LFS_LIBS,
+# define _CS_LFS_LIBS _CS_LFS_LIBS
+ _CS_LFS_LINTFLAGS,
+# define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS
+ _CS_LFS64_CFLAGS,
+# define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS
+ _CS_LFS64_LDFLAGS,
+# define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS
+ _CS_LFS64_LIBS,
+# define _CS_LFS64_LIBS _CS_LFS64_LIBS
+ _CS_LFS64_LINTFLAGS
+# define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS
+#endif
};
#endif
diff --git a/bits/resource.h b/bits/resource.h
index 2c35c12a47b..46cf9a7af59 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. 4.4 BSD/generic GNU version.
- Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -65,14 +65,34 @@ enum __rlimit_resource
#define RLIM_INFINITY RLIM_INFINITY
};
+/* Type for resource quantity measurement. */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
struct rlimit
{
/* The current (soft) limit. */
- int rlim_cur;
+ rlim_t rlim_cur;
/* The hard limit. */
- int rlim_max;
+ rlim_t rlim_max;
};
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+ {
+ /* The current (soft) limit. */
+ rlim64_t rlim_cur;
+ /* The hard limit. */
+ rlim64_t rlim_max;
+ };
+#endif
+
/* Whose usage statistics do you want? */
enum __rusage_who
/* The macro definitions are necessary because some programs want
diff --git a/bits/statfs.h b/bits/statfs.h
index 10bc0728b23..9fa33888018 100644
--- a/bits/statfs.h
+++ b/bits/statfs.h
@@ -38,11 +38,11 @@ struct statfs
{
unsigned int f_type;
unsigned int f_bsize;
- unsigned int f_blocks;
- unsigned int f_bfree;
- unsigned int f_bavail;
- unsigned int f_files;
- unsigned int f_ffree;
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_bavail;
+ __fsblkcnt_t f_files;
+ __fsblkcnt_t f_ffree;
__fsid_t f_fsid;
unsigned int f_namelen;
unsigned int f_spare[6];
diff --git a/bits/types.h b/bits/types.h
index c264adc917a..fdb36f0b546 100644
--- a/bits/types.h
+++ b/bits/types.h
@@ -65,6 +65,8 @@ typedef int __pid_t; /* Type of process identifications. */
typedef int __ssize_t; /* Type of a byte count, or error. */
typedef __u_quad_t __fsid_t; /* Type of file system IDs. */
typedef long int __clock_t; /* Type of CPU usage counts. */
+typedef long int __rlim_t; /* Type for resource measurement. */
+typedef __quad_t __rlim64_t; /* Type for resource measurement (LFS). */
/* Everythin' else. */
typedef long int __daddr_t; /* The type of a disk address. */
@@ -91,4 +93,19 @@ typedef struct
typedef unsigned long int __fd_mask;
+
+/* Types from the Large File Support interface. */
+
+/* Type to count number os disk blocks. */
+typedef long int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks. */
+typedef unsigned int __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes. */
+typedef unsigned long int __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
#endif /* bits/types.h */
diff --git a/config.h.in b/config.h.in
index 1301d9ea681..f2fa9167d37 100644
--- a/config.h.in
+++ b/config.h.in
@@ -52,6 +52,17 @@
/* Define if gcc uses DWARF2 unwind information for exception support. */
#undef HAVE_DWARF2_UNWIND_INFO
+/* Define is the regparm attribute shall be used for local functions
+ (gcc on ix86 only). */
+#undef USE_REGPARMS
+
+
+/* Defined to some form of __attribute__ ((...)) if the compiler supports
+ a different, more efficient calling convention. */
+#ifdef USE_REGPARMS
+# define internal_function __attribute__ ((regparm (3), stdcall))
+#endif
+
/*
*/
diff --git a/configure b/configure
index 2ab552c3092..6081b3b064f 100755
--- a/configure
+++ b/configure
@@ -863,11 +863,18 @@ sparc64 | ultrasparc)
esac
+if test "$base_machine" = "i386"; then
+ cat >> confdefs.h <<\EOF
+#define USE_REGPARMS 1
+EOF
+
+fi
+
# Compute the list of sysdep directories for this configuration.
# This can take a while to compute.
sysdep_dir=$srcdir/sysdeps
echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6
-echo "configure:871: checking sysdep dirs" >&5
+echo "configure:878: checking sysdep dirs" >&5
# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
@@ -1068,7 +1075,7 @@ echo "$ac_t""sysdeps/generic sysdeps/stub" 1>&6
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1072: checking for a BSD compatible install" >&5
+echo "configure:1079: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1122,7 +1129,7 @@ if test "$INSTALL" = "${srcdir}/install-sh -c"; then
INSTALL='\$(..)./install-sh -c'
fi
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1126: checking whether ln -s works" >&5
+echo "configure:1133: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1147,7 +1154,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1151: checking for $ac_word" >&5
+echo "configure:1158: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1180,7 +1187,7 @@ test -n "$MSGFMT" || MSGFMT=":"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1184: checking for $ac_word" >&5
+echo "configure:1191: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1209,7 +1216,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1213: checking for $ac_word" >&5
+echo "configure:1220: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1257,7 +1264,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1261: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1268: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1267,11 +1274,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 1271 "configure"
+#line 1278 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1294,13 +1301,13 @@ else
cross_linkable=yes
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1298: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1305: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1304: checking whether we are using GNU C" >&5
+echo "configure:1311: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1309,7 +1316,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1326,7 +1333,7 @@ if test $ac_cv_prog_gcc = yes; then
yes;
#endif
EOF
- if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1330: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1337: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if test -z "$CFLAGS"; then
CFLAGS="-g -O2"
fi
@@ -1338,7 +1345,7 @@ else
fi
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1342: checking build system type" >&5
+echo "configure:1349: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1361,7 +1368,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1365: checking for $ac_word" >&5
+echo "configure:1372: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1392,7 +1399,7 @@ done
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1396: checking how to run the C preprocessor" >&5
+echo "configure:1403: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1407,13 +1414,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1411 "configure"
+#line 1418 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1424: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1424,13 +1431,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1428 "configure"
+#line 1435 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1441: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1463,7 +1470,7 @@ LD=`$CC -print-file-name=ld`
# Determine whether we are using GNU binutils.
echo $ac_n "checking whether $AS is GNU as""... $ac_c" 1>&6
-echo "configure:1467: checking whether $AS is GNU as" >&5
+echo "configure:1474: checking whether $AS is GNU as" >&5
if eval "test \"`echo '$''{'libc_cv_prog_as_gnu'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1481,7 +1488,7 @@ rm -f a.out
gnu_as=$libc_cv_prog_as_gnu
echo $ac_n "checking whether $LD is GNU ld""... $ac_c" 1>&6
-echo "configure:1485: checking whether $LD is GNU ld" >&5
+echo "configure:1492: checking whether $LD is GNU ld" >&5
if eval "test \"`echo '$''{'libc_cv_prog_ld_gnu'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1505,7 +1512,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1509: checking for $ac_word" >&5
+echo "configure:1516: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1536,7 +1543,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1540: checking for $ac_word" >&5
+echo "configure:1547: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1567,7 +1574,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1571: checking for $ac_word" >&5
+echo "configure:1578: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1602,7 +1609,7 @@ fi
# Extract the first word of "bash", so it can be a program name with args.
set dummy bash; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1606: checking for $ac_word" >&5
+echo "configure:1613: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1643,7 +1650,7 @@ if test "$BASH" = no; then
# Extract the first word of "ksh", so it can be a program name with args.
set dummy ksh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1647: checking for $ac_word" >&5
+echo "configure:1654: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1689,7 +1696,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1693: checking for $ac_word" >&5
+echo "configure:1700: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1724,7 +1731,7 @@ test -n "$PERL" || PERL="no"
echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1728: checking for signed size_t type" >&5
+echo "configure:1735: checking for signed size_t type" >&5
if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1748,12 +1755,12 @@ EOF
fi
echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1752: checking for libc-friendly stddef.h" >&5
+echo "configure:1759: checking for libc-friendly stddef.h" >&5
if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1757 "configure"
+#line 1764 "configure"
#include "confdefs.h"
#define __need_size_t
#define __need_wchar_t
@@ -1768,7 +1775,7 @@ size_t size; wchar_t wchar;
if (&size == NULL || &wchar == NULL) abort ();
; return 0; }
EOF
-if { (eval echo configure:1772: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_friendly_stddef=yes
else
@@ -1787,7 +1794,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
fi
echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:1791: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1798: checking whether we need to use -P to assemble .S files" >&5
if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1810,7 +1817,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
fi
echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1814: checking for assembler global-symbol directive" >&5
+echo "configure:1821: checking for assembler global-symbol directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1840,7 +1847,7 @@ EOF
fi
echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1844: checking for .set assembler directive" >&5
+echo "configure:1851: checking for .set assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1874,7 +1881,7 @@ EOF
fi
echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1878: checking for .symver assembler directive" >&5
+echo "configure:1885: checking for .symver assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1893,7 +1900,7 @@ fi
echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:1897: checking for ld --version-script" >&5
+echo "configure:1904: checking for ld --version-script" >&5
if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1912,7 +1919,7 @@ EOF
if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
-nostartfiles -nostdlib
-Wl,--version-script,conftest.map
- 1>&5'; { (eval echo configure:1916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+ 1>&5'; { (eval echo configure:1923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
then
libc_cv_ld_version_script_option=yes
else
@@ -1943,7 +1950,7 @@ fi
if test $elf = yes; then
echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1947: checking for .previous assembler directive" >&5
+echo "configure:1954: checking for .previous assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1951,7 +1958,7 @@ else
.section foo_section
.previous
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1955: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_previous_directive=yes
else
libc_cv_asm_previous_directive=no
@@ -1967,7 +1974,7 @@ EOF
else
echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1971: checking for .popsection assembler directive" >&5
+echo "configure:1978: checking for .popsection assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1975,7 +1982,7 @@ else
.pushsection foo_section
.popsection
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1979: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1986: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_popsection_directive=yes
else
libc_cv_asm_popsection_directive=no
@@ -1995,12 +2002,12 @@ fi
if test $elf != yes; then
echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1999: checking for .init and .fini sections" >&5
+echo "configure:2006: checking for .init and .fini sections" >&5
if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2004 "configure"
+#line 2011 "configure"
#include "confdefs.h"
int main() {
@@ -2009,7 +2016,7 @@ asm (".section .init");
asm (".text");
; return 0; }
EOF
-if { (eval echo configure:2013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_have_initfini=yes
else
@@ -2037,19 +2044,19 @@ if test $elf = yes; then
else
if test $ac_cv_prog_cc_works = yes; then
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:2041: checking for _ prefix on C symbol names" >&5
+echo "configure:2048: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2046 "configure"
+#line 2053 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() {
glibc_foobar ();
; return 0; }
EOF
-if { (eval echo configure:2053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
@@ -2064,17 +2071,17 @@ fi
echo "$ac_t""$libc_cv_asm_underscores" 1>&6
else
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:2068: checking for _ prefix on C symbol names" >&5
+echo "configure:2075: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2073 "configure"
+#line 2080 "configure"
#include "confdefs.h"
void underscore_test(void) {
return; }
EOF
-if { (eval echo configure:2078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if grep _underscore_test conftest* >/dev/null; then
rm -f conftest*
libc_cv_asm_underscores=yes
@@ -2107,7 +2114,7 @@ if test $elf = yes; then
libc_cv_asm_weakext_directive=no
else
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:2111: checking for assembler .weak directive" >&5
+echo "configure:2118: checking for assembler .weak directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2130,7 +2137,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
if test $libc_cv_asm_weak_directive = no; then
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:2134: checking for assembler .weakext directive" >&5
+echo "configure:2141: checking for assembler .weakext directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2167,7 +2174,7 @@ EOF
fi
echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:2171: checking for ld --no-whole-archive" >&5
+echo "configure:2178: checking for ld --no-whole-archive" >&5
if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2178,7 +2185,7 @@ __throw () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -Wl,--no-whole-archive
- -o conftest conftest.c 1>&5'; { (eval echo configure:2182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c 1>&5'; { (eval echo configure:2189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_ld_no_whole_archive=yes
else
libc_cv_ld_no_whole_archive=no
@@ -2189,7 +2196,7 @@ fi
echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:2193: checking for gcc -fno-exceptions" >&5
+echo "configure:2200: checking for gcc -fno-exceptions" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2200,7 +2207,7 @@ __throw () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -fno-exceptions
- -o conftest conftest.c 1>&5'; { (eval echo configure:2204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c 1>&5'; { (eval echo configure:2211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_no_exceptions=yes
else
libc_cv_gcc_no_exceptions=no
@@ -2211,12 +2218,12 @@ fi
echo "$ac_t""$libc_cv_gcc_no_exceptions" 1>&6
echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6
-echo "configure:2215: checking for DWARF2 unwind info support" >&5
+echo "configure:2222: checking for DWARF2 unwind info support" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
-#line 2220 "configure"
+#line 2227 "configure"
static char __EH_FRAME_BEGIN__;
_start ()
{
@@ -2233,10 +2240,11 @@ memcpy () {}
memset () {}
free () {}
abort () {}
+__bzero () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles
- -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_dwarf2_unwind_info=yes
else
libc_cv_gcc_dwarf2_unwind_info=no
@@ -2294,7 +2302,7 @@ if test "$uname" = "sysdeps/generic"; then
fi
echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2298: checking OS release for uname" >&5
+echo "configure:2306: checking OS release for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2316,7 +2324,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
uname_release="$libc_cv_uname_release"
echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:2320: checking OS version for uname" >&5
+echo "configure:2328: checking OS version for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2338,7 +2346,7 @@ else
fi
echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2342: checking stdio selection" >&5
+echo "configure:2350: checking stdio selection" >&5
case $stdio in
libio) cat >> confdefs.h <<\EOF
@@ -2350,7 +2358,7 @@ esac
echo "$ac_t""$stdio" 1>&6
echo $ac_n "checking ldap selection""... $ac_c" 1>&6
-echo "configure:2354: checking ldap selection" >&5
+echo "configure:2362: checking ldap selection" >&5
case $add_ons in
*ldap*)
diff --git a/configure.in b/configure.in
index b0bb90543a7..992f1ee5927 100644
--- a/configure.in
+++ b/configure.in
@@ -193,6 +193,10 @@ esac
changequote([,])dnl
AC_SUBST(base_machine)
+if test "$base_machine" = "i386"; then
+ AC_DEFINE(USE_REGPARMS)
+fi
+
# Compute the list of sysdep directories for this configuration.
# This can take a while to compute.
sysdep_dir=$srcdir/sysdeps
@@ -779,6 +783,7 @@ memcpy () {}
memset () {}
free () {}
abort () {}
+__bzero () {}
EOF
dnl No \ in command here because it ends up inside ''.
if AC_TRY_COMMAND([${CC-cc} $CFLAGS
diff --git a/ctype/ctype.h b/ctype/ctype.h
index 922f5b38c8f..37e2cbeb35a 100644
--- a/ctype/ctype.h
+++ b/ctype/ctype.h
@@ -37,12 +37,12 @@ __BEGIN_DECLS
endian). We define the bit value interpretations here dependent on the
machine's byte order. */
-#include <endian.h>
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define _ISbit(bit) (1 << bit)
-#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
-#define _ISbit(bit) (bit < 8 ? ((1 << bit) << 8) : ((1 << bit) >> 8))
-#endif
+# include <endian.h>
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define _ISbit(bit) (1 << bit)
+# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+# define _ISbit(bit) (bit < 8 ? ((1 << bit) << 8) : ((1 << bit) >> 8))
+# endif
enum
{
@@ -115,7 +115,7 @@ extern int tolower __P ((int __c));
extern int toupper __P ((int __c));
-#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
/* Return nonzero iff C is in the ASCII set
(i.e., is no more than 7 bits wide). */
@@ -127,35 +127,35 @@ extern int toascii __P ((int __c));
#endif /* Use SVID or use misc. */
-#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
/* These are the same as `toupper' and `tolower'. */
__exctype (_toupper);
__exctype (_tolower);
#endif
#ifndef __NO_CTYPE
-#define isalnum(c) __isctype((c), _ISalnum)
-#define isalpha(c) __isctype((c), _ISalpha)
-#define iscntrl(c) __isctype((c), _IScntrl)
-#define isdigit(c) __isctype((c), _ISdigit)
-#define islower(c) __isctype((c), _ISlower)
-#define isgraph(c) __isctype((c), _ISgraph)
-#define isprint(c) __isctype((c), _ISprint)
-#define ispunct(c) __isctype((c), _ISpunct)
-#define isspace(c) __isctype((c), _ISspace)
-#define isupper(c) __isctype((c), _ISupper)
-#define isxdigit(c) __isctype((c), _ISxdigit)
+# define isalnum(c) __isctype((c), _ISalnum)
+# define isalpha(c) __isctype((c), _ISalpha)
+# define iscntrl(c) __isctype((c), _IScntrl)
+# define isdigit(c) __isctype((c), _ISdigit)
+# define islower(c) __isctype((c), _ISlower)
+# define isgraph(c) __isctype((c), _ISgraph)
+# define isprint(c) __isctype((c), _ISprint)
+# define ispunct(c) __isctype((c), _ISpunct)
+# define isspace(c) __isctype((c), _ISspace)
+# define isupper(c) __isctype((c), _ISupper)
+# define isxdigit(c) __isctype((c), _ISxdigit)
#ifdef __USE_GNU
-#define isblank(c) __isctype((c), _ISblank)
+# define isblank(c) __isctype((c), _ISblank)
#endif
#define tolower(c) __tolower(c)
#define toupper(c) __toupper(c)
-#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN)
-#define isascii(c) __isascii(c)
-#define toascii(c) __toascii(c)
+#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
+# define isascii(c) __isascii(c)
+# define toascii(c) __toascii(c)
#endif
#endif /* Not __NO_CTYPE. */
@@ -179,13 +179,13 @@ __exctype (_tolower);
/* These definitions are similar to the ones above but all functions
take as an argument a handle for the locale which shall be used. */
-#define __isctype_l(c, type, locale) \
+# define __isctype_l(c, type, locale) \
((locale)->__ctype_b[(int) (c)] & (unsigned short int) type)
-#define __tolower_l(c, locale) ((int) (locale)->__ctype_tolower[(int) (c)])
-#define __toupper_l(c, locale) ((int) (locale)->__ctype_toupper[(int) (c)])
+# define __tolower_l(c, locale) ((int) (locale)->__ctype_tolower[(int) (c)])
+# define __toupper_l(c, locale) ((int) (locale)->__ctype_toupper[(int) (c)])
-#define __exctype_l(name) extern int name __P ((int, __locale_t))
+# define __exctype_l(name) extern int name __P ((int, __locale_t))
/* The following names are all functions:
int isCHARACTERISTIC(int c, locale_t *locale);
@@ -213,27 +213,27 @@ extern int __tolower_l __P ((int __c, __locale_t __l));
extern int __toupper_l __P ((int __c, __locale_t __l));
-#ifndef __NO_CTYPE
-#define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l))
-#define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l))
-#define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l))
-#define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l))
-#define __islower_l(c,l) __isctype_l((c), _ISlower, (l))
-#define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l))
-#define __isprint_l(c,l) __isctype_l((c), _ISprint, (l))
-#define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l))
-#define __isspace_l(c,l) __isctype_l((c), _ISspace, (l))
-#define __isupper_l(c,l) __isctype_l((c), _ISupper, (l))
-#define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l))
-
-#define __isblank_l(c,l) __isctype_l((c), _ISblank, (l))
-
-#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN)
-#define __isascii_l(c,l) __isascii(c)
-#define __toascii_l(c,l) __toascii(c)
-#endif
+# ifndef __NO_CTYPE
+# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l))
+# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l))
+# define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l))
+# define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l))
+# define __islower_l(c,l) __isctype_l((c), _ISlower, (l))
+# define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l))
+# define __isprint_l(c,l) __isctype_l((c), _ISprint, (l))
+# define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l))
+# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l))
+# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l))
+# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l))
-#endif /* Not __NO_CTYPE. */
+# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l))
+
+# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
+# define __isascii_l(c,l) __isascii(c)
+# define __toascii_l(c,l) __toascii(c)
+# endif
+
+# endif /* Not __NO_CTYPE. */
#endif /* Use GNU. */
diff --git a/db2/makedb.c b/db2/makedb.c
index 68c9514882f..69a40290663 100644
--- a/db2/makedb.c
+++ b/db2/makedb.c
@@ -168,7 +168,8 @@ main (argc, argv)
db_file = dbopen (output_name, O_CREAT | O_RDWR | O_TRUNC, 0666,
DB_BTREE, NULL);
if (db_file == NULL)
- error (EXIT_FAILURE, errno, gettext ("cannot open output file `%s'"));
+ error (EXIT_FAILURE, errno, gettext ("cannot open output file `%s'"),
+ output_name);
/* Start the real work. */
status = process_input (input_file, input_name, db_file, to_lowercase,
@@ -328,7 +329,7 @@ process_input (input, inname, output, to_lowercase, be_quiet)
if (ferror (input))
{
- error (0, 0, gettext ("problems while reading `%s'"));
+ error (0, 0, gettext ("problems while reading `%s'"), inname);
status = EXIT_FAILURE;
}
diff --git a/dirent/Makefile b/dirent/Makefile
index a7f3553df00..7c36510ca13 100644
--- a/dirent/Makefile
+++ b/dirent/Makefile
@@ -24,7 +24,7 @@ subdir := dirent
headers := dirent.h bits/dirent.h
routines := opendir closedir readdir readdir_r rewinddir \
seekdir telldir scandir alphasort versionsort \
- getdents dirfd
+ getdents dirfd readdir64 readdir64_r
distribute := dirstream.h
tests := list tst-seekdir
diff --git a/dirent/dirent.h b/dirent/dirent.h
index a9b7a7474d1..e2fab0ab034 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -112,20 +112,42 @@ extern DIR *opendir __P ((__const char *__name));
extern int __closedir __P ((DIR *__dirp));
extern int closedir __P ((DIR *__dirp));
-/* Read a directory entry from DIRP.
- Return a pointer to a `struct dirent' describing the entry,
- or NULL for EOF or error. The storage returned may be overwritten
- by a later readdir call on the same DIR stream. */
+/* Read a directory entry from DIRP. Return a pointer to a `struct
+ dirent' describing the entry, or NULL for EOF or error. The
+ storage returned may be overwritten by a later readdir call on the
+ same DIR stream.
+
+ If the Large File Support API is selected we have to use the
+ appropriate interface. */
extern struct dirent *__readdir __P ((DIR *__dirp));
+#ifndef __USE_FILE_OFFSET64
extern struct dirent *readdir __P ((DIR *__dirp));
+#else
+extern struct dirent64 *readdir __P ((DIR *__dirp)) __asm__ ("readdir64");
+#endif
+
+#ifdef __USE_LARGEFILE64
+extern struct dirent64 *readdir64 __P ((DIR *__dirp));
+#endif
#if defined __USE_POSIX || defined __USE_MISC
/* Reentrant version of `readdir'. Return in RESULT a pointer to the
next entry. */
extern int __readdir_r __P ((DIR *__dirp, struct dirent *__entry,
struct dirent **__result));
+# ifndef __USE_FILE_OFFSET64
extern int readdir_r __P ((DIR *__dirp, struct dirent *__entry,
struct dirent **__result));
+# else
+extern int readdir_r __P ((DIR *__dirp, struct dirent64 *__entry,
+ struct dirent64 **__result))
+ __asm__ ("readdir64_r");
+# endif
+
+# ifdef __USE_LARGEFILE64
+extern int readdir64_r __P ((DIR *__dirp, struct dirent64 *__entry,
+ struct dirent64 **__result));
+# endif
#endif /* POSIX or misc */
/* Rewind DIRP to the beginning of the directory. */
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index 3f09d72c321..8087fbd3be4 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -140,13 +140,8 @@ fixup (
that defines sym. Now add in the symbol offset. */
value = (sym ? value + sym->st_value : 0);
- /* And now the relocation addend. */
-#ifndef ELF_MACHINE_NO_RELA
- if (l->l_info[DT_PLTRELSZ]->d_un.d_val == sizeof (ElfW(Rela)))
- value += reloc->r_addend;
-#elif ELF_MACHINE_NO_REL
- value += reloc->r_addend;
-#endif
+ /* And now perhaps the relocation addend. */
+ value = elf_machine_plt_value (l, reloc, value);
/* Finally, fix up the plt itself. */
elf_machine_fixup_plt (l, reloc, rel_addr, value);
@@ -212,13 +207,8 @@ profile_fixup (
that defines sym. Now add in the symbol offset. */
value = (sym ? value + sym->st_value : 0);
- /* And now the relocation addend. */
-#ifndef ELF_MACHINE_NO_RELA
- if (l->l_info[DT_PLTRELSZ]->d_un.d_val == sizeof (ElfW(Rela)))
- value += reloc->r_addend;
-#elif ELF_MACHINE_NO_REL
- value += reloc->r_addend;
-#endif
+ /* And now perhaps the relocation addend. */
+ value = elf_machine_plt_value (l, reloc, value);
*_dl_global_scope_end = NULL;
(*mcount_fct) (retaddr, value);
diff --git a/gmon/gmon.c b/gmon/gmon.c
index 10ae215c808..787da5a7e7b 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -64,9 +64,9 @@ static int s_scale;
void moncontrol __P ((int mode));
void __moncontrol __P ((int mode));
-static void write_hist __P ((int fd));
-static void write_call_graph __P ((int fd));
-static void write_bb_counts __P ((int fd));
+static void write_hist __P ((int fd)) internal_function;
+static void write_call_graph __P ((int fd)) internal_function;
+static void write_bb_counts __P ((int fd)) internal_function;
/*
* Control profiling
@@ -169,6 +169,7 @@ weak_alias(__monstartup, monstartup)
static void
+internal_function
write_hist (fd)
int fd;
{
@@ -198,6 +199,7 @@ write_hist (fd)
static void
+internal_function
write_call_graph (fd)
int fd;
{
@@ -251,6 +253,7 @@ write_call_graph (fd)
static void
+internal_function
write_bb_counts (fd)
int fd;
{
diff --git a/grp/grp.h b/grp/grp.h
index 72b8925a8c1..f5db84f7dc1 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -43,9 +43,9 @@ struct group
};
-#if defined(__USE_SVID) || defined(__USE_GNU)
-#define __need_FILE
-#include <stdio.h>
+#if defined __USE_SVID || defined __USE_GNU
+# define __need_FILE
+# include <stdio.h>
#endif
#ifdef __USE_GNU
@@ -66,7 +66,7 @@ extern struct group *__grpscan __P ((__ptr_t *__p,
#endif
-#if defined(__USE_SVID) || defined (__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Rewind the group-file stream. */
extern void setgrent __P ((void));
@@ -90,11 +90,11 @@ extern struct group *getgrnam __P ((__const char *__name));
#if defined __USE_POSIX || defined __USE_MISC
-#ifdef __USE_MISC
+# ifdef __USE_MISC
/* Reasonable value for the buffer sized used in the reentrant
functions below. But better use `sysconf'. */
-#define NSS_BUFLEN_GROUP 1024
-#endif
+# define NSS_BUFLEN_GROUP 1024
+# endif
/* Reentrant versions of some of the functions above.
@@ -104,12 +104,12 @@ extern struct group *getgrnam __P ((__const char *__name));
other reentrant functions so the chances are good this is what the
POSIX people would choose. */
-#if defined(__USE_SVID) || defined (__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+# if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
extern int __getgrent_r __P ((struct group *__resultbuf, char *buffer,
size_t __buflen, struct group **__result));
extern int getgrent_r __P ((struct group *__resultbuf, char *buffer,
size_t __buflen, struct group **__result));
-#endif
+# endif
/* Search for an entry with a matching group ID. */
extern int getgrgid_r __P ((__gid_t __gid, struct group *__resultbuf,
@@ -121,7 +121,7 @@ extern int getgrnam_r __P ((__const char *__name, struct group *__resultbuf,
char *buffer, size_t __buflen,
struct group **__result));
-#ifdef __USE_SVID
+# ifdef __USE_SVID
/* Read a group entry from STREAM. This function is not standardized
an probably never will. */
extern int __fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf,
@@ -130,15 +130,15 @@ extern int __fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf,
extern int fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf,
char *buffer, size_t __buflen,
struct group **__result));
-#endif
+# endif
#endif /* POSIX or reentrant */
#ifdef __USE_BSD
-#define __need_size_t
-#include <stddef.h>
+# define __need_size_t
+# include <stddef.h>
/* Set the group set for the current user to GROUPS (N of them). */
extern int setgroups __P ((size_t __n, __const __gid_t *__groups));
diff --git a/include/features.h b/include/features.h
index 52aeaabb4c7..e8c97f800e0 100644
--- a/include/features.h
+++ b/include/features.h
@@ -30,6 +30,9 @@
_XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
Single Unix conformance is wanted.
_XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
+ _LARGEFILE_SOURCE Some more functions for correct standard I/O.
+ _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
+ _FILE_OFFSET_BITS=N Select default filesystem interface.
_BSD_SOURCE ISO C, POSIX, and 4.3BSD things.
_SVID_SOURCE ISO C, POSIX, and SVID things.
_GNU_SOURCE All of the above, plus GNU extensions.
@@ -52,6 +55,8 @@
__USE_XOPEN Define XPG things.
__USE_XOPEN_EXTENDED Define X/Open Unix things.
__USE_UNIX98 Define Single Unix V2 things.
+ __USE_LARGEFILE64 Define LFS things with separate names.
+ __USE_FILE_OFFSET64 Define 64bit interface as default.
__USE_BSD Define 4.3BSD things.
__USE_SVID Define SVID things.
__USE_MISC Define things common to BSD and System V Unix.
@@ -78,6 +83,10 @@
#undef __USE_POSIX199309
#undef __USE_XOPEN
#undef __USE_XOPEN_EXTENDED
+#undef __USE_UNIX98
+#undef __USE_LARGEFILE
+#undef __USE_LARGEFILE64
+#undef __USE_FILE_OFFSET64
#undef __USE_BSD
#undef __USE_SVID
#undef __USE_MISC
@@ -100,6 +109,7 @@
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
+ defined _LARGEFILE64_SOURCE || defined _FILE_OFFSET_BITS || \
defined _GNU_SOURCE || defined _SVID_SOURCE)
# define __FAVOR_BSD 1
#endif
@@ -116,6 +126,8 @@
# define _XOPEN_SOURCE 500
# undef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
+# undef _LARGEFILE64_SOURCE
+# define _LARGEFILE64_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
@@ -127,6 +139,7 @@
#if (!defined __STRICT_ANSI__ && !defined _ISOC9X_SOURCE && \
!defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
!defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
+ !defined _LARGEFILE64_SOURCE && !defined _FILE_OFFSET_BITS && \
!defined _BSD_SOURCE && !defined _SVID_SOURCE)
# define _BSD_SOURCE 1
# define _SVID_SOURCE 1
@@ -143,7 +156,7 @@
#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
!defined _POSIX_C_SOURCE)
# define _POSIX_SOURCE 1
-# if defined _XOPEN_SOURCE && _XOPEN_SOURCE != 500
+# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) != 500
# define _POSIX_C_SOURCE 2
# else
# define _POSIX_C_SOURCE 199309L
@@ -164,9 +177,11 @@
#ifdef _XOPEN_SOURCE
# define __USE_XOPEN 1
-# if _XOPEN_SOURCE == 500
+# if (_XOPEN_SOURCE - 0) == 500
# define __USE_XOPEN_EXTENDED 1
# define __USE_UNIX98 1
+# undef _LARGEFILE_SOURCE
+# define _LARGEFILE_SOURCE 1
# else
# ifdef _XOPEN_SOURCE_EXTENDED
# define __USE_XOPEN_EXTENDED 1
@@ -174,6 +189,18 @@
# endif
#endif
+#ifdef _LARGEFILE_SOURCE
+# define __USE_LARGEFILE 1
+#endif
+
+#ifdef _LARGEFILE64_SOURCE
+# define __USE_LARGEFILE64 1
+#endif
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# define __USE_FILE_OFFSET64 1
+#endif
+
#if defined _BSD_SOURCE || defined _SVID_SOURCE
# define __USE_MISC 1
#endif
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 07a35f1b531..66d7eed0d09 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -61,19 +61,19 @@
/* Define the macros `_' and `N_' for conveniently marking translatable
strings in the libc source code. */
-#define N_(msgid) msgid
+# define N_(msgid) msgid
-#include <libintl.h>
+# include <libintl.h>
extern const char _libc_intl_domainname[];
-#ifdef dgettext
+# ifdef dgettext
/* This is defined as an optimizing macro, so use it. */
-#define _(msgid) dgettext (_libc_intl_domainname, (msgid))
-#else
+# define _(msgid) dgettext (_libc_intl_domainname, (msgid))
+# else
/* Be sure to use only the __ name when `dgettext' is a plain function
instead of an optimizing macro. */
-#define _(msgid) __dgettext (_libc_intl_domainname, (msgid))
-#endif
+# define _(msgid) __dgettext (_libc_intl_domainname, (msgid))
+# endif
#endif
@@ -83,50 +83,50 @@ extern const char _libc_intl_domainname[];
/* The symbols in all the user (non-_) macros are C symbols.
HAVE_GNU_LD without HAVE_ELF implies a.out. */
-#if defined (HAVE_ASM_WEAK_DIRECTIVE) || defined (HAVE_ASM_WEAKEXT_DIRECTIVE)
-#define HAVE_WEAK_SYMBOLS
+#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE
+# define HAVE_WEAK_SYMBOLS
#endif
#ifndef __SYMBOL_PREFIX
-#ifdef NO_UNDERSCORES
-#define __SYMBOL_PREFIX
-#else
-#define __SYMBOL_PREFIX "_"
-#endif
+# ifdef NO_UNDERSCORES
+# define __SYMBOL_PREFIX
+# else
+# define __SYMBOL_PREFIX "_"
+# endif
#endif
#ifndef C_SYMBOL_NAME
-#ifdef NO_UNDERSCORES
-#define C_SYMBOL_NAME(name) name
-#else
-#define C_SYMBOL_NAME(name) _##name
-#endif
+# ifdef NO_UNDERSCORES
+# define C_SYMBOL_NAME(name) name
+# else
+# define C_SYMBOL_NAME(name) _##name
+# endif
#endif
/* Define ALIAS as a strong alias for ORIGINAL. */
#ifdef HAVE_ASM_SET_DIRECTIVE
-#define strong_alias_asm(original, alias) \
+# define strong_alias_asm(original, alias) \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \
.set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
-#ifdef ASSEMBLER
-#define strong_alias(original, alias) strong_alias_asm (original, alias)
-#else
-#define strong_alias(original, alias) \
+# ifdef ASSEMBLER
+# define strong_alias(original, alias) strong_alias_asm (original, alias)
+# else
+# define strong_alias(original, alias) \
asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \
".set " __SYMBOL_PREFIX #alias "," __SYMBOL_PREFIX #original);
-#endif
+# endif
#else
-#define strong_alias_asm(original, alias) \
+# define strong_alias_asm(original, alias) \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
-#ifdef ASSEMBLER
-#define strong_alias(original, alias) strong_alias_asm (original, alias)
-#else
-#define strong_alias(original, alias) \
+# ifdef ASSEMBLER
+# define strong_alias(original, alias) strong_alias_asm (original, alias)
+# else
+# define strong_alias(original, alias) \
asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \
__SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
-#endif
+# endif
#endif
/* Helper macros used above. */
@@ -136,77 +136,77 @@ extern const char _libc_intl_domainname[];
#ifdef HAVE_WEAK_SYMBOLS
-#ifdef ASSEMBLER
+# ifdef ASSEMBLER
-#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
+# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
/* Define ALIAS as a weak alias for ORIGINAL.
If weak aliases are not available, this defines a strong alias. */
-#define weak_alias(original, alias) \
+# define weak_alias(original, alias) \
.weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
-#define weak_extern(symbol) \
+# define weak_extern(symbol) \
.weakext C_SYMBOL_NAME (symbol)
-#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
/* Define ALIAS as a weak alias for ORIGINAL.
If weak aliases are not available, this defines a strong alias. */
-#define weak_alias(original, alias) \
+# define weak_alias(original, alias) \
.weak C_SYMBOL_NAME (alias); \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
-#define weak_extern(symbol) \
+# define weak_extern(symbol) \
.weak C_SYMBOL_NAME (symbol)
-#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
-#else /* ! ASSEMBLER */
+# else /* ! ASSEMBLER */
-#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
-#define weak_extern_asm(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
-#define weak_alias_asm(original, alias) \
+# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
+# define weak_extern_asm(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
+# define weak_alias_asm(original, alias) \
asm (".weakext " __SYMBOL_PREFIX #alias ", " __SYMBOL_PREFIX #original);
-#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
-#define weak_extern_asm(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
-#define weak_alias_asm(original, alias) \
+# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+# define weak_extern_asm(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
+# define weak_alias_asm(original, alias) \
asm (".weak " __SYMBOL_PREFIX #alias "\n" \
__SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
-#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
-#define weak_alias(o, a) weak_alias_asm (o, a)
-#define weak_extern(symbol) weak_extern_asm (symbol)
+# define weak_alias(o, a) weak_alias_asm (o, a)
+# define weak_extern(symbol) weak_extern_asm (symbol)
-#endif /* ! ASSEMBLER */
+# endif /* ! ASSEMBLER */
#else
-#define weak_alias(original, alias) strong_alias(original, alias)
-#define weak_extern(symbol) /* Do nothing; the ref will be strong. */
+# define weak_alias(original, alias) strong_alias(original, alias)
+# define weak_extern(symbol) /* Do nothing; the ref will be strong. */
#endif
-#if (!defined (ASSEMBLER) && \
+#if (!defined ASSEMBLER && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)))
/* GCC 2.7 and later has special syntax for weak symbols and aliases.
Using that is better when possible, because the compiler and assembler
are better clued in to what we are doing. */
-#undef strong_alias
-#define strong_alias(name, aliasname) \
+# undef strong_alias
+# define strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
-#ifdef HAVE_WEAK_SYMBOLS
-#undef weak_alias
-#define weak_alias(name, aliasname) \
+# ifdef HAVE_WEAK_SYMBOLS
+# undef weak_alias
+# define weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
/* This comes between the return type and function name in
a function definition to make that definition weak. */
-#define weak_function __attribute__ ((weak))
-#define weak_const_function __attribute__ ((weak, __const__))
+# define weak_function __attribute__ ((weak))
+# define weak_const_function __attribute__ ((weak, __const__))
-#endif /* HAVE_WEAK_SYMBOLS. */
+# endif /* HAVE_WEAK_SYMBOLS. */
#endif /* Not ASSEMBLER, and GCC 2.7 or later. */
@@ -215,39 +215,45 @@ extern const char _libc_intl_domainname[];
can define functions as weak symbols. The compiler will emit a `.globl'
directive for the function symbol, and a `.weak' directive in addition
will produce an error from the assembler. */
-#define weak_function /* empty */
-#define weak_const_function /* empty */
+# define weak_function /* empty */
+# define weak_const_function /* empty */
#endif
+/* On some platforms we can make internal function calls (i.e., calls of
+ functions not exported) a bit faster by using a different calling
+ convention. */
+#ifndef internal_function
+# define internal_function /* empty */
+#endif
/* When a reference to SYMBOL is encountered, the linker will emit a
warning message MSG. */
#ifdef HAVE_GNU_LD
-#ifdef HAVE_ELF
+# ifdef HAVE_ELF
/* We want the .gnu.warning.SYMBOL section to be unallocated. */
-#ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
-#define __make_section_unallocated(section_string) \
+# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
+# define __make_section_unallocated(section_string) \
asm(".section " section_string "; .previous");
-#elif defined (HAVE_ASM_POPSECTION_DIRECTIVE)
-#define __make_section_unallocated(section_string) \
+# elif defined (HAVE_ASM_POPSECTION_DIRECTIVE)
+# define __make_section_unallocated(section_string) \
asm(".pushsection " section_string "; .popsection");
-#else
-#define __make_section_unallocated(section_string)
-#endif
+# else
+# define __make_section_unallocated(section_string)
+# endif
-#define link_warning(symbol, msg) \
+# define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((section (".gnu.warning." #symbol))) = msg;
-#else
-#define link_warning(symbol, msg) \
+# else
+# define link_warning(symbol, msg) \
asm(".stabs \"" msg "\",30,0,0,0\n" \
".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n");
-#endif
+# endif
#else
/* We will never be heard; they will all die horribly. */
-#define link_warning(symbol, msg)
+# define link_warning(symbol, msg)
#endif
/* A canned warning for sysdeps/stub functions. */
@@ -263,60 +269,60 @@ extern const char _libc_intl_domainname[];
/* Symbol set support macros. */
-#ifdef HAVE_ELF
+# ifdef HAVE_ELF
/* Make SYMBOL, which is in the text segment, an element of SET. */
-#define text_set_element(set, symbol) _elf_set_element(set, symbol)
+# define text_set_element(set, symbol) _elf_set_element(set, symbol)
/* Make SYMBOL, which is in the data segment, an element of SET. */
-#define data_set_element(set, symbol) _elf_set_element(set, symbol)
+# define data_set_element(set, symbol) _elf_set_element(set, symbol)
/* Make SYMBOL, which is in the bss segment, an element of SET. */
-#define bss_set_element(set, symbol) _elf_set_element(set, symbol)
+# define bss_set_element(set, symbol) _elf_set_element(set, symbol)
/* These are all done the same way in ELF.
There is a new section created for each set. */
-#ifdef PIC
+# ifdef PIC
/* When building a shared library, make the set section writable,
because it will need to be relocated at run time anyway. */
-#define _elf_set_element(set, symbol) \
+# define _elf_set_element(set, symbol) \
static const void *__elf_set_##set##_element_##symbol##__ \
__attribute__ ((unused, section (#set))) = &(symbol)
-#else
-#define _elf_set_element(set, symbol) \
+# else
+# define _elf_set_element(set, symbol) \
static const void *const __elf_set_##set##_element_##symbol##__ \
__attribute__ ((unused, section (#set))) = &(symbol)
-#endif
+# endif
/* Define SET as a symbol set. This may be required (it is in a.out) to
be able to use the set's contents. */
-#define symbol_set_define(set) symbol_set_declare(set)
+# define symbol_set_define(set) symbol_set_declare(set)
/* Declare SET for use in this module, if defined in another module. */
-#define symbol_set_declare(set) \
+# define symbol_set_declare(set) \
extern void *const __start_##set __attribute__ ((__weak__)); \
extern void *const __stop_##set __attribute__ ((__weak__)); \
weak_extern (__start_##set) weak_extern (__stop_##set)
/* Return a pointer (void *const *) to the first element of SET. */
-#define symbol_set_first_element(set) (&__start_##set)
+# define symbol_set_first_element(set) (&__start_##set)
/* Return true iff PTR (a void *const *) has been incremented
past the last element in SET. */
-#define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set)
+# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set)
-#else /* Not ELF: a.out. */
+# else /* Not ELF: a.out. */
-#define text_set_element(set, symbol) \
+# define text_set_element(set, symbol) \
asm(".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol)
-#define data_set_element(set, symbol) \
+# define data_set_element(set, symbol) \
asm(".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol)
-#define bss_set_element(set, symbol) ?error Must use initialized data.
-#define symbol_set_define(set) void *const (set)[1];
-#define symbol_set_declare(set) extern void *const (set)[1];
+# define bss_set_element(set, symbol) ?error Must use initialized data.
+# define symbol_set_define(set) void *const (set)[1];
+# define symbol_set_declare(set) extern void *const (set)[1];
-#define symbol_set_first_element(set) &(set)[1]
-#define symbol_set_end_p(set, ptr) (*(ptr) == 0)
+# define symbol_set_first_element(set) &(set)[1]
+# define symbol_set_end_p(set, ptr) (*(ptr) == 0)
-#endif /* ELF. */
+# endif /* ELF. */
#endif /* Have GNU ld. */
#endif /* libc-symbols.h */
diff --git a/include/limits.h b/include/limits.h
index 31d8792d9d4..160fc5f41cc 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+/* 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
@@ -36,15 +36,15 @@
#endif
-#if __GNUC__ >= 2
+#if __GNUC__ >= 2
/* Get the compiler's limits.h, which defines all the ANSI constants. */
- #ifndef _LIBC_LIMITS_H_
- #define _LIBC_LIMITS_H_ /* This tells it not to look for another. */
- #endif
- #ifndef _GCC_LIMITS_H_ /* This is what GCC's file defines. */
- #include_next <limits.h>
- #endif
+# ifndef _LIBC_LIMITS_H_
+# define _LIBC_LIMITS_H_ /* This tells it not to look for another. */
+# endif
+# ifndef _GCC_LIMITS_H_ /* This is what GCC's file defines. */
+# include_next <limits.h>
+# endif
#else /* Not GCC 2. */
diff --git a/include/values.h b/include/values.h
index 26421724c44..afbd72d8610 100644
--- a/include/values.h
+++ b/include/values.h
@@ -63,7 +63,7 @@
#ifdef __USE_MISC
/* Some systems define this name instead of CHAR_BIT or CHARBITS. */
-#define BITSPERBYTE CHAR_BIT
+# define BITSPERBYTE CHAR_BIT
#endif
#endif /* values.h */
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 2bba606ec75..a7cdb07742b 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -63,6 +63,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static char *
+internal_function
nrl_domainname (void)
{
static char *domain = NULL;
@@ -258,13 +259,11 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
else
{
const char *c;
-#if INET6
if (sa->sa_family == AF_INET6)
c = inet_ntop (AF_INET6,
(void *) &(((struct sockaddr_in6 *) sa)->sin6_addr),
host, hostlen);
else
-#endif /* INET6 */
c = inet_ntop (AF_INET,
(void *) &(((struct sockaddr_in *) sa)->sin_addr),
host, hostlen);
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index 5afe82561c9..a388d86ba8d 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* 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
@@ -91,6 +91,7 @@ free_memory (struct __netgrent *data)
}
static int
+internal_function
__internal_setnetgrent_reuse (const char *group, struct __netgrent *datap)
{
enum nss_status (*fct) (const char *, struct __netgrent *);
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 6a680c18b72..92ce0948075 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -55,7 +55,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
int __ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
-static int __icheckhost __P((u_int32_t, char *));
+static int __icheckhost __P((u_int32_t, char *)) internal_function;
int
rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
@@ -426,6 +426,7 @@ __ivaliduser(hostf, raddr, luser, ruser)
* Returns "true" if match, 0 if no match.
*/
static int
+internal_function
__icheckhost(raddr, lhost)
u_int32_t raddr;
register char *lhost;
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
index 692ce45bcf9..3557202ea56 100644
--- a/intl/dcgettext.c
+++ b/intl/dcgettext.c
@@ -142,6 +142,10 @@ static char *stpcpy PARAMS ((char *dest, const char *src));
# define PATH_MAX _POSIX_PATH_MAX
#endif
+#ifndef internal_function
+# define internal_function
+#endif
+
/* XPG3 defines the result of `setlocale (category, NULL)' as:
``Directs `setlocale()' to query `category' and return the current
setting of `local'.''
@@ -168,10 +172,11 @@ struct binding *_nl_domain_bindings;
/* Prototypes for local functions. */
static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
- const char *msgid));
-static const char *category_to_name PARAMS ((int category));
+ const char *msgid)) internal_function;
+static const char *category_to_name PARAMS ((int category)) internal_function;
static const char *guess_category_value PARAMS ((int category,
- const char *categoryname));
+ const char *categoryname))
+ internal_function;
/* For those loosing systems which don't have `alloca' we have to add
@@ -394,6 +399,7 @@ weak_alias (__dcgettext, dcgettext);
static char *
+internal_function
find_msg (domain_file, msgid)
struct loaded_l10nfile *domain_file;
const char *msgid;
@@ -482,6 +488,7 @@ find_msg (domain_file, msgid)
/* Return string representation of locale CATEGORY. */
static const char *
+internal_function
category_to_name (category)
int category;
{
@@ -541,6 +548,7 @@ category_to_name (category)
/* Guess value of current locale from value of the environment variables. */
static const char *
+internal_function
guess_category_value (category, categoryname)
int category;
const char *categoryname;
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index 43158c4cfa7..a67223ff7e0 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -69,6 +69,7 @@ _nl_load_domain (domain_file)
struct loaded_l10nfile *domain_file;
{
int fd;
+ size_t size;
struct stat st;
struct mo_file_header *data = (struct mo_file_header *) -1;
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
@@ -94,7 +95,8 @@ _nl_load_domain (domain_file)
/* We must know about the size of the file. */
if (fstat (fd, &st) != 0
- && st.st_size < (off_t) sizeof (struct mo_file_header))
+ || (size = (size_t) st.st_size) != st.st_size
+ || size < sizeof (struct mo_file_header))
{
/* Something went wrong. */
close (fd);
@@ -105,7 +107,7 @@ _nl_load_domain (domain_file)
|| defined _LIBC
/* Now we are ready to load the file. If mmap() is available we try
this first. If not available or it failed we try to load it. */
- data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
+ data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
MAP_PRIVATE, fd, 0);
if (data != (struct mo_file_header *) -1)
@@ -120,14 +122,14 @@ _nl_load_domain (domain_file)
it manually. */
if (data == (struct mo_file_header *) -1)
{
- off_t to_read;
+ size_t to_read;
char *read_ptr;
- data = (struct mo_file_header *) malloc (st.st_size);
+ data = (struct mo_file_header *) malloc (size);
if (data == NULL)
return;
- to_read = st.st_size;
+ to_read = size;
read_ptr = (char *) data;
do
{
@@ -154,7 +156,7 @@ _nl_load_domain (domain_file)
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
- munmap ((caddr_t) data, st.st_size);
+ munmap ((caddr_t) data, size);
else
#endif
free (data);
@@ -169,7 +171,7 @@ _nl_load_domain (domain_file)
domain = (struct loaded_domain *) domain_file->data;
domain->data = (char *) data;
domain->use_mmap = use_mmap;
- domain->mmap_size = st.st_size;
+ domain->mmap_size = size;
domain->must_swap = data->magic != _MAGIC;
/* Fill in the information about the available tables. */
@@ -190,7 +192,7 @@ _nl_load_domain (domain_file)
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
- munmap ((caddr_t) data, st.st_size);
+ munmap ((caddr_t) data, size);
else
#endif
free (data);
diff --git a/intl/localealias.c b/intl/localealias.c
index 46d570f88f7..05832f0e368 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -90,6 +90,9 @@ void free ();
__libc_lock_define_initialized (static, lock);
#endif
+#ifndef internal_function
+# define internal_function
+#endif
/* For those loosing systems which don't have `alloca' we have to add
some additional code emulating it. */
@@ -143,7 +146,8 @@ static size_t maxmap = 0;
/* Prototypes for local functions. */
-static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
+static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
+ internal_function;
static void extend_alias_table PARAMS ((void));
static int alias_compare PARAMS ((const struct alias_map *map1,
const struct alias_map *map2));
@@ -212,6 +216,7 @@ _nl_expand_alias (name)
static size_t
+internal_function
read_alias_file (fname, fname_len)
const char *fname;
int fname_len;
diff --git a/io/Makefile b/io/Makefile
index 3f37e37c8ad..e5c86b4cf6e 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -29,21 +29,21 @@ headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \
routines := \
utime \
mkfifo \
- stat fstat lstat mknod \
- xstat fxstat lxstat xmknod \
- statfs fstatfs \
+ stat fstat lstat mknod stat64 fstat64 lstat64 \
+ xstat fxstat lxstat xmknod xstat64 fxstat64 lxstat64 \
+ statfs fstatfs statfs64 fstatfs64 \
umask chmod fchmod mkdir \
- open close read write lseek access euidaccess \
+ open open64 close read write lseek lseek64 access euidaccess \
fcntl flock lockf \
dup dup2 pipe \
- creat \
+ creat creat64 \
chdir fchdir \
getcwd getwd getdirname \
chown fchown lchown \
ttyname ttyname_r isatty \
link symlink readlink \
unlink rmdir \
- ftw fts poll
+ ftw ftw64 fts poll
# These routines will be omitted from the libc shared object.
# Instead the static object files will be included in a special archive
diff --git a/io/creat64.c b/io/creat64.c
new file mode 100644
index 00000000000..6e51dc0ff4a
--- /dev/null
+++ b/io/creat64.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library 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 <fcntl.h>
+#include <sys/types.h>
+
+#undef creat
+
+/* Create FILE with protections MODE. */
+int
+creat64 (file, mode)
+ const char *file;
+ mode_t mode;
+{
+ return __open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
+}
diff --git a/io/fcntl.h b/io/fcntl.h
index 519230019ca..d47da0a1ffb 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 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
@@ -33,14 +33,14 @@ __BEGIN_DECLS
#include <bits/fcntl.h>
#ifdef __USE_MISC
-#ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */
+# ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */
/* Values for the second argument to access.
These may be OR'd together. */
-#define R_OK 4 /* Test for read permission. */
-#define W_OK 2 /* Test for write permission. */
-#define X_OK 1 /* Test for execute permission. */
-#define F_OK 0 /* Test for existence. */
-#endif
+# define R_OK 4 /* Test for read permission. */
+# define W_OK 2 /* Test for write permission. */
+# define X_OK 1 /* Test for execute permission. */
+# define F_OK 0 /* Test for existence. */
+# endif
#endif /* Use misc. */
/* Do the file control operation described by CMD on FD.
@@ -52,14 +52,31 @@ extern int fcntl __P ((int __fd, int __cmd, ...));
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 file. */
extern int __open __P ((__const char *__file, int __oflag, ...));
+extern int __open64 __P ((__const char *__file, int __oflag, ...));
+#ifndef __USE_FILE_OFFSET64
extern int open __P ((__const char *__file, int __oflag, ...));
+#else
+extern int open __P ((__const char *__file, int __oflag, ...))
+ __asm__ ("open64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int open64 __P ((__const char *__file, int __oflag, ...));
+#endif
/* Create and open FILE, with mode MODE.
This takes an `int' MODE argument because that is
what `mode_t' will be widened to. */
+#ifndef __USE_FILE_OFFSET64
extern int creat __P ((__const char *__file, __mode_t __mode));
+#else
+extern int creat __P ((__const char *__file, __mode_t __mode))
+ __asm__ ("creat64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int creat64 __P ((__const char *__file, __mode_t __mode));
+#endif
-#if !defined(F_LOCK) && (defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED))
+#if !defined F_LOCK && (defined __USE_MISC || defined __USE_XOPEN_EXTENDED)
/* NOTE: These declarations also appear in <unistd.h>; be sure to keep both
files consistent. Some systems have them there and some here, and some
software depends on the macros being defined without including both. */
@@ -68,12 +85,20 @@ extern int creat __P ((__const char *__file, __mode_t __mode));
LEN is always relative to the current file position.
The CMD argument is one of the following. */
-#define F_ULOCK 0 /* Unlock a previously locked region. */
-#define F_LOCK 1 /* Lock a region for exclusive use. */
-#define F_TLOCK 2 /* Test and lock a region for exclusive use. */
-#define F_TEST 3 /* Test a region for other processes locks. */
+# define F_ULOCK 0 /* Unlock a previously locked region. */
+# define F_LOCK 1 /* Lock a region for exclusive use. */
+# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
+# define F_TEST 3 /* Test a region for other processes locks. */
+# ifndef __USE_FILE_OFFSET64
extern int lockf __P ((int __fd, int __cmd, __off_t __len));
+# else
+extern int lockf __P ((int __fd, int __cmd, __off_t __len))
+ __asm__ ("lockf64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern int lockf64 __P ((int __fd, int __cmd, __off64_t __len));
+# endif
#endif
__END_DECLS
diff --git a/io/fstat64.c b/io/fstat64.c
new file mode 100644
index 00000000000..376a262a106
--- /dev/null
+++ b/io/fstat64.c
@@ -0,0 +1,43 @@
+/* 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Library 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 Library 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.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/stat.h>
+
+/* This definition is only used if inlining fails for this function; see
+ the last page of <sys/stat.h>. The real work is done by the `x'
+ function which is passed a version number argument. We arrange in the
+ makefile that when not inlined this function is always statically
+ linked; that way a dynamically-linked executable always encodes the
+ version number corresponding to the data structures it uses, so the `x'
+ functions in the shared library can adapt without needing to recompile
+ all callers. */
+
+int
+fstat64 (int fd, struct stat64 *buf)
+{
+ return __fxstat64 (_STAT_VER, fd, buf);
+}
diff --git a/io/fts.c b/io/fts.c
index f283c174507..255c53f5291 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -57,15 +57,15 @@ static char sccsid[] = "@(#)fts.c 8.2 (Berkeley) 1/2/94";
#endif
-static FTSENT *fts_alloc __P((FTS *, const char *, int));
-static FTSENT *fts_build __P((FTS *, int));
-static void fts_lfree __P((FTSENT *));
+static FTSENT *fts_alloc __P((FTS *, const char *, int)) internal_function;
+static FTSENT *fts_build __P((FTS *, int)) internal_function;
+static void fts_lfree __P((FTSENT *)) internal_function;
static void fts_load __P((FTS *, FTSENT *));
-static size_t fts_maxarglen __P((char * const *));
-static void fts_padjust __P((FTS *, void *));
-static int fts_palloc __P((FTS *, size_t));
-static FTSENT *fts_sort __P((FTS *, FTSENT *, int));
-static u_short fts_stat __P((FTS *, FTSENT *, int));
+static size_t fts_maxarglen __P((char * const *)) internal_function;
+static void fts_padjust __P((FTS *, void *)) internal_function;
+static int fts_palloc __P((FTS *, size_t)) internal_function;
+static FTSENT *fts_sort __P((FTS *, FTSENT *, int)) internal_function;
+static u_short fts_stat __P((FTS *, FTSENT *, int)) internal_function;
#ifndef MAX
#define MAX(a, b) ({ __typeof__ (a) _a = (a); \
@@ -566,6 +566,7 @@ fts_children(sp, instr)
* been found, cutting the stat calls by about 2/3.
*/
static FTSENT *
+internal_function
fts_build(sp, type)
register FTS *sp;
int type;
@@ -780,6 +781,7 @@ mem1: saved_errno = errno;
}
static u_short
+internal_function
fts_stat(sp, p, follow)
FTS *sp;
register FTSENT *p;
@@ -852,6 +854,7 @@ err: bzero(sbp, sizeof(struct stat));
}
static FTSENT *
+internal_function
fts_sort(sp, head, nitems)
FTS *sp;
FTSENT *head;
@@ -884,6 +887,7 @@ fts_sort(sp, head, nitems)
}
static FTSENT *
+internal_function
fts_alloc(sp, name, namelen)
FTS *sp;
const char *name;
@@ -922,6 +926,7 @@ fts_alloc(sp, name, namelen)
}
static void
+internal_function
fts_lfree(head)
register FTSENT *head;
{
@@ -941,6 +946,7 @@ fts_lfree(head)
* plus 256 bytes so don't realloc the path 2 bytes at a time.
*/
static int
+internal_function
fts_palloc(sp, more)
FTS *sp;
size_t more;
@@ -955,6 +961,7 @@ fts_palloc(sp, more)
* already returned.
*/
static void
+internal_function
fts_padjust(sp, addr)
FTS *sp;
void *addr;
@@ -978,6 +985,7 @@ fts_padjust(sp, addr)
}
static size_t
+internal_function
fts_maxarglen(argv)
char * const *argv;
{
diff --git a/io/ftw.c b/io/ftw.c
index 8cccbacd37f..e0835c2839c 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -31,6 +31,19 @@
/* #define NDEBUG 1 */
#include <assert.h>
+/* Support for the LFS API version. */
+#ifndef FTW_NAME
+# define FTW_NAME ftw
+# define NFTW_NAME nftw
+# define INO_T ino_t
+# define STAT stat
+# define DIRENT dirent
+# define READDIR readdir
+# define LXSTAT __lxstat
+# define XSTAT __xstat
+# define FTW_FUNC_T __ftw_func_t
+# define NFTW_FUNC_T __nftw_func_t
+#endif
struct dir_data
{
@@ -41,7 +54,7 @@ struct dir_data
struct known_object
{
dev_t dev;
- ino_t ino;
+ INO_T ino;
};
struct ftw_data
@@ -68,7 +81,7 @@ struct ftw_data
int *cvt_arr;
/* Callback function. We always use the `nftw' form. */
- __nftw_func_t func;
+ NFTW_FUNC_T func;
/* Device of starting point. Needed for FTW_MOUNT. */
dev_t dev;
@@ -94,7 +107,7 @@ static int ftw_arr[] =
/* Forward declarations of local functions. */
-static int ftw_dir (struct ftw_data *data, struct stat *st);
+static int ftw_dir (struct ftw_data *data, struct STAT *st) internal_function;
static int
@@ -113,7 +126,7 @@ object_compare (const void *p1, const void *p2)
static inline int
-add_object (struct ftw_data *data, struct stat *st)
+add_object (struct ftw_data *data, struct STAT *st)
{
struct known_object *newp = malloc (sizeof (struct known_object));
if (newp == NULL)
@@ -125,7 +138,7 @@ add_object (struct ftw_data *data, struct stat *st)
static inline int
-find_object (struct ftw_data *data, struct stat *st)
+find_object (struct ftw_data *data, struct STAT *st)
{
struct known_object obj = { dev: st->st_dev, ino: st->st_ino };
return __tfind (&obj, &data->known_objects, object_compare) != NULL;
@@ -150,10 +163,10 @@ open_dir_stream (struct ftw_data *data, struct dir_data *dirp)
else
{
DIR *st = data->dirstreams[data->actdir]->stream;
- struct dirent *d;
+ struct DIRENT *d;
size_t actsize = 0;
- while ((d = readdir (st)) != NULL)
+ while ((d = READDIR (st)) != NULL)
{
size_t this_len = _D_EXACT_NAMLEN (d);
if (actsize + this_len + 2 >= bufsize)
@@ -225,7 +238,7 @@ static inline int
process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
size_t namlen)
{
- struct stat st;
+ struct STAT st;
int result = 0;
int flag;
@@ -250,13 +263,13 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
data->dirbuf[data->ftw.base + namlen] = '\0';
if (((data->flags & FTW_PHYS)
- ? __lxstat (_STAT_VER, data->dirbuf, &st)
- : __xstat (_STAT_VER, data->dirbuf, &st)) < 0)
+ ? LXSTAT (_STAT_VER, data->dirbuf, &st)
+ : XSTAT (_STAT_VER, data->dirbuf, &st)) < 0)
{
if (errno != EACCES && errno != ENOENT)
result = -1;
else if (!(data->flags & FTW_PHYS)
- && __lxstat (_STAT_VER, data->dirbuf, &st) == 0
+ && LXSTAT (_STAT_VER, data->dirbuf, &st) == 0
&& S_ISLNK (st.st_mode))
flag = FTW_SLN;
else
@@ -324,10 +337,11 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
static int
-ftw_dir (struct ftw_data *data, struct stat *st)
+internal_function
+ftw_dir (struct ftw_data *data, struct STAT *st)
{
struct dir_data dir;
- struct dirent *d;
+ struct DIRENT *d;
int previous_base = data->ftw.base;
int result;
char *startp;
@@ -386,7 +400,7 @@ ftw_dir (struct ftw_data *data, struct stat *st)
*startp++ = '/';
data->ftw.base = startp - data->dirbuf;
- while (dir.stream != NULL && (d = readdir (dir.stream)) != NULL)
+ while (dir.stream != NULL && (d = READDIR (dir.stream)) != NULL)
{
result = process_entry (data, &dir, d->d_name, _D_EXACT_NAMLEN (d));
if (result != 0)
@@ -445,11 +459,12 @@ ftw_dir (struct ftw_data *data, struct stat *st)
static int
+internal_function
ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
int flags)
{
struct ftw_data data;
- struct stat st;
+ struct STAT st;
int result = 0;
int save_err;
char *cwd = NULL;
@@ -497,7 +512,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
every case the callback using the format of the `nftw' version
and get the correct result since the stack layout for a function
call in C allows this. */
- data.func = (__nftw_func_t) func;
+ data.func = (NFTW_FUNC_T) func;
/* Since we internally use the complete set of FTW_* values we need
to reduce the value range before calling a `ftw' callback. */
@@ -534,14 +549,14 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
/* Get stat info for start directory. */
if (result == 0)
if (((flags & FTW_PHYS)
- ? __lxstat (_STAT_VER, data.dirbuf, &st)
- : __xstat (_STAT_VER, data.dirbuf, &st)) < 0)
+ ? LXSTAT (_STAT_VER, data.dirbuf, &st)
+ : XSTAT (_STAT_VER, data.dirbuf, &st)) < 0)
{
if (errno == EACCES)
result = (*data.func) (data.dirbuf, &st, FTW_NS, &data.ftw);
else if (!(flags & FTW_PHYS)
&& errno == ENOENT
- && __lxstat (_STAT_VER, dir, &st) == 0
+ && LXSTAT (_STAT_VER, dir, &st) == 0
&& S_ISLNK (st.st_mode))
result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN],
&data.ftw);
@@ -597,18 +612,18 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
/* Entry points. */
int
-ftw (path, func, descriptors)
+FTW_NAME (path, func, descriptors)
const char *path;
- __ftw_func_t func;
+ FTW_FUNC_T func;
int descriptors;
{
return ftw_startup (path, 0, func, descriptors, 0);
}
int
-nftw (path, func, descriptors, flags)
+NFTW_NAME (path, func, descriptors, flags)
const char *path;
- __nftw_func_t func;
+ NFTW_FUNC_T func;
int descriptors;
int flags;
{
diff --git a/io/ftw.h b/io/ftw.h
index d377f2c947f..ac4abeeb18c 100644
--- a/io/ftw.h
+++ b/io/ftw.h
@@ -88,21 +88,45 @@ struct FTW
/* Convenient types for callback functions. */
typedef int (*__ftw_func_t) __P ((__const char *__filename,
__const struct stat *__status, int __flag));
+typedef int (*__ftw64_func_t) __P ((__const char *__filename,
+ __const struct stat64 *__status,
+ int __flag));
#ifdef __USE_XOPEN_EXTENDED
typedef int (*__nftw_func_t) __P ((__const char *__filename,
__const struct stat *__status, int __flag,
struct FTW *__info));
+typedef int (*__nftw64_func_t) __P ((__const char *__filename,
+ __const struct stat64 *__status,
+ int __flag, struct FTW *__info));
#endif
/* Call a function on every element in a directory tree. */
+#ifndef __USE_FILE_OFFSET64
extern int ftw __P ((__const char *__dir, __ftw_func_t __func,
int __descriptors));
+#else
+extern int ftw __P ((__const char *__dir, __ftw64_func_t __func,
+ int __descriptors)) __asm__ ("ftw64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int ftw64 __P ((__const char *__dir, __ftw64_func_t __func,
+ int __descriptors));
+#endif
#ifdef __USE_XOPEN_EXTENDED
/* Call a function on every element in a directory tree. FLAG allows
to specify the behaviour more detailed. */
+# ifndef __USE_FILE_OFFSET64
extern int nftw __P ((__const char *__dir, __nftw_func_t __func,
int __descriptors, int __flag));
+# else
+extern int nftw __P ((__const char *__dir, __nftw64_func_t __func,
+ int __descriptors, int __flag)) __asm__ ("nftw64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern int nftw64 __P ((__const char *__dir, __nftw64_func_t __func,
+ int __descriptors, int __flag));
+# endif
#endif
__END_DECLS
diff --git a/io/ftw64.c b/io/ftw64.c
new file mode 100644
index 00000000000..6dbd03e831e
--- /dev/null
+++ b/io/ftw64.c
@@ -0,0 +1,32 @@
+/* File tree walker functions. LFS version.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library 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. */
+
+#define FTW_NAME ftw64
+#define NFTW_NAME nftw64
+#define INO_T ino64_t
+#define STAT stat64
+#define DIRENT dirent64
+#define READDIR readdir64
+#define LXSTAT __lxstat64
+#define XSTAT __xstat64
+#define FTW_FUNC_T __ftw64_func_t
+#define NFTW_FUNC_T __nftw64_func_t
+
+#include "ftw.c"
diff --git a/io/lstat64.c b/io/lstat64.c
new file mode 100644
index 00000000000..ef2b1569172
--- /dev/null
+++ b/io/lstat64.c
@@ -0,0 +1,43 @@
+/* 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Library 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 Library 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.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/stat.h>
+
+/* This definition is only used if inlining fails for this function; see
+ the last page of <sys/stat.h>. The real work is done by the `x'
+ function which is passed a version number argument. We arrange in the
+ makefile that when not inlined this function is always statically
+ linked; that way a dynamically-linked executable always encodes the
+ version number corresponding to the data structures it uses, so the `x'
+ functions in the shared library can adapt without needing to recompile
+ all callers. */
+
+int
+lstat64 (const char *file, struct stat64 *buf)
+{
+ return __lxstat64 (_STAT_VER, file, buf);
+}
diff --git a/io/stat64.c b/io/stat64.c
new file mode 100644
index 00000000000..09eb38ae916
--- /dev/null
+++ b/io/stat64.c
@@ -0,0 +1,43 @@
+/* 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Library 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 Library 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.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/stat.h>
+
+/* This definition is only used if inlining fails for this function; see
+ the last page of <sys/stat.h>. The real work is done by the `x'
+ function which is passed a version number argument. We arrange in the
+ makefile that when not inlined this function is always statically
+ linked; that way a dynamically-linked executable always encodes the
+ version number corresponding to the data structures it uses, so the `x'
+ functions in the shared library can adapt without needing to recompile
+ all callers. */
+
+int
+stat64 (const char *file, struct stat64 *buf)
+{
+ return __xstat64 (_STAT_VER, file, buf);
+}
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 5485976ca64..01bc00165ee 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
+/* 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
@@ -31,42 +31,42 @@ __BEGIN_DECLS
#include <bits/stat.h>
-#if defined(__USE_BSD) || defined(__USE_MISC)
-#define S_IFMT __S_IFMT
-#define S_IFDIR __S_IFDIR
-#define S_IFCHR __S_IFCHR
-#define S_IFBLK __S_IFBLK
-#define S_IFREG __S_IFREG
-#ifdef __S_IFLNK
-#define S_IFLNK __S_IFLNK
-#endif
-#ifdef __S_IFSOCK
-#define S_IFSOCK __S_IFSOCK
-#endif
-#ifdef __S_IFIFO
-#define S_IFIFO __S_IFIFO
-#endif
+#if defined __USE_BSD || defined __USE_MISC
+# define S_IFMT __S_IFMT
+# define S_IFDIR __S_IFDIR
+# define S_IFCHR __S_IFCHR
+# define S_IFBLK __S_IFBLK
+# define S_IFREG __S_IFREG
+# ifdef __S_IFLNK
+# define S_IFLNK __S_IFLNK
+# endif
+# ifdef __S_IFSOCK
+# define S_IFSOCK __S_IFSOCK
+# endif
+# ifdef __S_IFIFO
+# define S_IFIFO __S_IFIFO
+# endif
#endif
/* Test macros for file types. */
#define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
-#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
-#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR)
-#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK)
-#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
+#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
+#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR)
+#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK)
+#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
#ifdef __S_IFIFO
-#define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO)
+# define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO)
#endif
#ifdef __USE_BSD
-#ifdef __S_IFLNK
-#define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
-#endif
-#ifdef __S_IFSOCK
-#define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
-#endif
+# ifdef __S_IFLNK
+# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
+# endif
+# ifdef __S_IFSOCK
+# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
+# endif
#endif
@@ -75,9 +75,9 @@ __BEGIN_DECLS
#define S_ISUID __S_ISUID /* Set user ID on execution. */
#define S_ISGID __S_ISGID /* Set group ID on execution. */
-#if defined(__USE_BSD) || defined(__USE_MISC)
+#if defined __USE_BSD || defined __USE_MISC
/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
-#define S_ISVTX __S_ISVTX
+# define S_ISVTX __S_ISVTX
#endif
#define S_IRUSR __S_IREAD /* Read by owner. */
@@ -86,10 +86,10 @@ __BEGIN_DECLS
/* Read, write, and execute by owner. */
#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
-#if defined(__USE_MISC) && defined(__USE_BSD)
-#define S_IREAD S_IRUSR
-#define S_IWRITE S_IWUSR
-#define S_IEXEC S_IXUSR
+#if defined __USE_MISC && defined __USE_BSD
+# define S_IREAD S_IRUSR
+# define S_IWRITE S_IWUSR
+# define S_IEXEC S_IXUSR
#endif
#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
@@ -107,28 +107,51 @@ __BEGIN_DECLS
#ifdef __USE_BSD
/* Macros for common mode bit masks. */
-#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
-#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
-#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666 */
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
-#define S_BLKSIZE 512 /* Block size for `st_blocks'. */
+# define S_BLKSIZE 512 /* Block size for `st_blocks'. */
#endif
/* Get file attributes for FILE and put them in BUF. */
extern int __stat __P ((__const char *__file, struct stat *__buf));
+#ifndef __USE_FILE_OFFSET64
extern int stat __P ((__const char *__file, struct stat *__buf));
+#else
+extern int stat __P ((__const char *__file, struct stat *__buf))
+ __asm__ ("stat64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int stat64 __P ((__const char *__file, struct stat64 *__buf));
+#endif
/* Get file attributes for the file, device, pipe, or socket
that file descriptor FD is open on and put them in BUF. */
extern int __fstat __P ((int __fd, struct stat *__buf));
+#ifndef __USE_FILE_OFFSET64
extern int fstat __P ((int __fd, struct stat *__buf));
+#else
+extern int fstat __P ((int __fd, struct stat *__buf)) __asm__ ("fstat64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int fstat64 __P ((int __fd, struct stat64 *__buf));
+#endif
/* Get file attributes about FILE and put them in BUF.
If FILE is a symbolic link, do not follow it. */
extern int __lstat __P ((__const char *__file, struct stat *__buf));
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+# ifndef __USE_FILE_OFFSET64
extern int lstat __P ((__const char *__file, struct stat *__buf));
+# else
+extern int lstat __P ((__const char *__file, struct stat *__buf))
+ __asm__ ("lstat64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern int lstat64 __P ((__const char *__file, struct stat64 *__buf));
+# endif
#endif
/* Set file access permissions for FILE to MODE.
@@ -139,7 +162,7 @@ extern int chmod __P ((__const char *__file, __mode_t __mode));
/* Set file access permissions of the file FD is open on to MODE. */
extern int __fchmod __P ((int __fd, __mode_t __mode));
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
extern int fchmod __P ((int __fd, __mode_t __mode));
#endif
@@ -164,7 +187,7 @@ extern int mkdir __P ((__const char *__path, __mode_t __mode));
device numbers with the `makedev' macro above). */
extern int __mknod __P ((__const char *__path,
__mode_t __mode, __dev_t __dev));
-#if defined(__USE_MISC) || defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
extern int mknod __P ((__const char *__path,
__mode_t __mode, __dev_t __dev));
#endif
@@ -189,10 +212,10 @@ extern int mkfifo __P ((__const char *__path, __mode_t __mode));
callers. */
#ifndef _STAT_VER
-#define _STAT_VER 0
+# define _STAT_VER 0
#endif
#ifndef _MKNOD_VER
-#define _MKNOD_VER 0
+# define _MKNOD_VER 0
#endif
/* Wrappers for stat and mknod system calls. */
@@ -204,35 +227,98 @@ extern int __lxstat __P ((int __ver, __const char *__filename,
struct stat *__stat_buf));
extern int __xmknod __P ((int __ver, __const char *__path,
__mode_t __mode, __dev_t *__dev));
+#if defined __USE_LARGEFILE64 || defined __USE_FILE_OFFSET64
+extern int __fxstat64 __P ((int __ver, int __fildes,
+ struct stat64 *__stat_buf));
+extern int __xstat64 __P ((int __ver, __const char *__filename,
+ struct stat64 *__stat_buf));
+extern int __lxstat64 __P ((int __ver, __const char *__filename,
+ struct stat64 *__stat_buf));
+#endif
-#if defined (__GNUC__) && __GNUC__ >= 2
+#if defined __GNUC__ && __GNUC__ >= 2
/* Inlined versions of the real stat and mknod functions. */
extern __inline__ int __stat (__const char *__path, struct stat *__statbuf)
-{ return __xstat (_STAT_VER, __path, __statbuf); }
+{
+# ifndef __USE_FILE_OFFSET64
+ return __xstat (_STAT_VER, __path, __statbuf);
+# else
+ return __xstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
extern __inline__ int stat (__const char *__path, struct stat *__statbuf)
-{ return __xstat (_STAT_VER, __path, __statbuf); }
-
-extern __inline__ int __lstat(__const char *__path, struct stat *__statbuf)
-{ return __lxstat (_STAT_VER, __path, __statbuf); }
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
-extern __inline__ int lstat(__const char *__path, struct stat *__statbuf)
-{ return __lxstat (_STAT_VER, __path, __statbuf); }
-#endif
+{
+# ifndef __USE_FILE_OFFSET64
+ return __xstat (_STAT_VER, __path, __statbuf);
+# else
+ return __xstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
+
+extern __inline__ int __lstat (__const char *__path, struct stat *__statbuf)
+{
+# ifndef __USE_FILE_OFFSET64
+ return __lxstat (_STAT_VER, __path, __statbuf);
+# else
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern __inline__ int lstat (__const char *__path, struct stat *__statbuf)
+{
+# ifndef __USE_FILE_OFFSET64
+ return __lxstat (_STAT_VER, __path, __statbuf);
+# else
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
+# endif
+}
+# endif
extern __inline__ int __fstat (int __fd, struct stat *__statbuf)
-{ return __fxstat (_STAT_VER, __fd, __statbuf); }
+{
+# ifndef __USE_FILE_OFFSET64
+ return __fxstat (_STAT_VER, __fd, __statbuf);
+# else
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
+# endif
+}
extern __inline__ int fstat (int __fd, struct stat *__statbuf)
-{ return __fxstat (_STAT_VER, __fd, __statbuf); }
+{
+# ifndef __USE_FILE_OFFSET64
+ return __fxstat (_STAT_VER, __fd, __statbuf);
+# else
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
+# endif
+}
extern __inline__ int __mknod (__const char *__path, __mode_t __mode,
__dev_t __dev)
{ return __xmknod (_MKNOD_VER, __path, __mode, &__dev); }
-#if defined(__USE_MISC) || defined(__USE_BSD)
+# if defined __USE_MISC || defined __USE_BSD
extern __inline__ int mknod (__const char *__path, __mode_t __mode,
__dev_t __dev)
{ return __xmknod (_MKNOD_VER, __path, __mode, &__dev); }
-#endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+extern __inline__ int stat64 (__const char *__path, struct stat64 *__statbuf)
+{
+ return __xstat64 (_STAT_VER, __path, __statbuf);
+}
+
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern __inline__ int lstat64 (__const char *__path, struct stat64 *__statbuf)
+{
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
+}
+# endif
+
+extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf)
+{
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
+}
+# endif
#endif
diff --git a/io/sys/statfs.h b/io/sys/statfs.h
index 49c154d2161..fbec44182b5 100644
--- a/io/sys/statfs.h
+++ b/io/sys/statfs.h
@@ -1,5 +1,5 @@
/* Definitions for getting information about a filesystem.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ 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
@@ -29,12 +29,28 @@ __BEGIN_DECLS
/* Return information about the filesystem on which FILE resides. */
extern int __statfs __P ((__const char *__file, struct statfs *__buf));
+#ifndef __USE_FILE_OFFSET64
extern int statfs __P ((__const char *__file, struct statfs *__buf));
+#else
+extern int statfs __P ((__const char *__file, struct statfs *__buf))
+ __asm__ ("statfs64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int statfs64 __P ((__const char *__file, struct statfs64 *__buf));
+#endif
/* Return information about the filesystem containing the file FILDES
refers to. */
extern int __fstatfs __P ((int __fildes, struct statfs *__buf));
+#ifndef __USE_FILE_OFFSET64
extern int fstatfs __P ((int __fildes, struct statfs *__buf));
+#else
+extern int fstatfs __P ((int __fildes, struct statfs *__buf))
+ __asm__ ("fstatfs64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int fstatfs64 __P ((int __fildes, struct statfs64 *__buf));
+#endif
__END_DECLS
diff --git a/libc.map b/libc.map
index 0abd31d5a10..20469efbe97 100644
--- a/libc.map
+++ b/libc.map
@@ -11,9 +11,12 @@ GLIBC_2.0 {
_nl_current_LC_COLLATE; __collate_element_hash;
__collate_element_strings; __collate_symbol_classes;
__collate_symbol_hash; __collate_symbol_strings;
- _obstack; _libio_using_thunks;
+ _obstack;
__progname_full; __progname;
+ # This is for ix86 only.
+ _fp_hw;
+
# helper functions
__errno_location; __libc_init_first; __h_errno_location;
@@ -55,19 +58,19 @@ GLIBC_2.0 {
_obstack_free; _obstack_memory_used; _obstack_newchunk;
__assert_fail; __assert_perror_fail;
_IO_getc; _IO_peekc_unlocked; _IO_putc; _IO_feof; _IO_ferror;
- __xstat; __fxstat; __lxstat; __xmknod; __dcgettext;
- __uflow; __underflow; __overflow; __iswctype; __sigpause;
- __ctype_get_mb_cur_max;
+ __xstat; __fxstat; __lxstat; __xstat64; __fxstat64; __lxstat64; __xmknod;
+ __dcgettext; __uflow; __underflow; __overflow; __iswctype; __sigpause;
+ __ctype_get_mb_cur_max; __bzero;
# functions used in other libraries
- __printf_fp; __stpncpy; __stpcpy; __strdup;
+ __printf_fp; __stpncpy; __stpcpy; __strdup; __mempcpy;
_nss_files_parse_grent; _nss_files_parse_pwent; _nss_files_parse_spent;
__nss_database_lookup; __internal_endnetgrent; __internal_getnetgrent_r;
__internal_setnetgrent; __gmtime_r; __secure_getenv;
__select; __sched_get_priority_max; __sched_get_priority_min;
__sched_getparam; __sched_getscheduler; __sched_setscheduler;
__sched_yield; __on_exit; __gettimeofday; __fork; __clone;
- __nss_configure_lookup; _dl_open; _dl_close; _IO_file_setbuf;
+ __nss_configure_lookup; _dl_open; _dl_close; _dl_addr; _IO_file_setbuf;
_IO_file_init; _IO_file_attach; _IO_do_write; _IO_seekoff;
_IO_link_in; _IO_file_open; _IO_file_doallocate; _IO_file_fopen;
_IO_file_overflow; _IO_file_underflow; _IO_file_sync; _IO_file_seekoff;
@@ -149,8 +152,8 @@ GLIBC_2.0 {
clntraw_create; clnttcp_create; clntudp_bufcreate; clntudp_create;
clock; clone; close; closedir; closelog; confstr; connect; copysign;
- copysignf; copysignl; creat; create_module; ctermid; ctime; ctime_r;
- cuserid;
+ copysignf; copysignl; creat; creat64; create_module; ctermid; ctime;
+ ctime_r; cuserid;
# d*
daemon; dcgettext; delete_module; des_setparity; dgettext;
@@ -173,13 +176,14 @@ GLIBC_2.0 {
fchdir; fchflags; fchmod; fchown; fclose; fcloseall; fcntl; fcvt;
fcvt_r; fdatasync; fdopen; feof; feof_unlocked; ferror;
ferror_unlocked; fexecve; fflush; fflush_unlocked; ffs; fgetc;
- fgetgrent; fgetgrent_r; fgetpos; fgetpwent; fgetpwent_r; fgets;
+ fgetgrent; fgetgrent_r; fgetpos; fgetpos64; fgetpwent; fgetpwent_r; fgets;
fgetspent; fgetspent_r; fileno; fileno_unlocked; finite; finitef;
- finitel; flock; flockfile; fmtmsg; fnmatch; fopen; fopencookie; fork;
- fpathconf; fprintf; fputc; fputc_unlocked; fputs; fread; free;
- freeaddrinfo; freopen; frexp; frexpf; frexpl; fscanf; fseek; fseeko;
- fsetpos; fstatfs; fsync; ftell; ftello; ftime; ftok; ftruncate;
- ftrylockfile; fts_children; fts_close; fts_open; fts_read; fts_set; ftw;
+ finitel; flock; flockfile; fmtmsg; fnmatch; fopen; fopen64; fopencookie;
+ fork; fpathconf; fprintf; fputc; fputc_unlocked; fputs; fread; free;
+ freeaddrinfo; freopen; freopen64; frexp; frexpf; frexpl; fscanf; fseek;
+ fseeko; fseeko64; fsetpos; fsetpos64; fstatfs; fstatfs64; fsync; ftell;
+ ftello; ftello64; ftime; ftok; ftruncate; ftruncate64; ftrylockfile;
+ fts_children; fts_close; fts_open; fts_read; fts_set; ftw; ftw64;
funlockfile; fwrite;
# g*
@@ -203,7 +207,7 @@ GLIBC_2.0 {
getprotobynumber_r; getprotoent; getprotoent_r; getpublickey; getpw;
getpwent; getpwent_r; getpwnam; getpwnam_r; getpwuid; getpwuid_r;
getresgid; getresuid;
- getrlimit; getrpcbyname; getrpcbyname_r; getrpcbynumber;
+ getrlimit; getrlimit64; getrpcbyname; getrpcbyname_r; getrpcbynumber;
getrpcbynumber_r; getrpcent; getrpcent_r; getrpcport; getrusage; gets;
getsecretkey; getservbyname; getservbyname_r; getservbyport;
getservbyport_r; getservent; getservent_r; getsid; getsockname;
@@ -244,8 +248,8 @@ GLIBC_2.0 {
# l*
l64a; labs; lchown; lckpwdf; lcong48; lcong48_r; ldexp; ldexpf;
ldexpl; ldiv; lfind; link; listen; llabs; lldiv; llseek; localeconv;
- localtime; localtime_r; lockf; longjmp; lrand48; lrand48_r; lsearch;
- lseek;
+ localtime; localtime_r; lockf; lockf64; longjmp; lrand48; lrand48_r;
+ lsearch; lseek; lseek64;
# m*
madvise;
@@ -257,27 +261,27 @@ GLIBC_2.0 {
mbtowc; mcheck; mcount;
memalign; memccpy; memchr; memcmp; memcpy; memfrob; memmem;
- memmove; memset;
+ memmove; mempcpy; memset;
mkdir; mkfifo; mkstemp; mktemp; mktime; mlock;
- mlockall; mmap; modf; modff; modfl; moncontrol; monstartup; mount;
+ mlockall; mmap; mmap64; modf; modff; modfl; moncontrol; monstartup; mount;
mprobe; mprotect; mrand48; mrand48_r; mremap; msgctl; msgget; msgrcv;
msgsnd; msync; mtrace; munlock; munlockall; munmap; muntrace;
# n*
- nanosleep; netname2host; netname2user; nftw; nfsservctl; nice; nl_langinfo;
- nrand48; nrand48_r; ntohl; ntohs;
+ nanosleep; netname2host; netname2user; nftw; nftw64; nfsservctl; nice;
+ nl_langinfo; nrand48; nrand48_r; ntohl; ntohs;
# o*
- obstack_free; obstack_printf; obstack_vprintf; on_exit; open;
+ obstack_free; obstack_printf; obstack_vprintf; on_exit; open; open64;
open_memstream; opendir; openlog;
# p*
parse_printf_format; passwd2des; pathconf; pause; pciconfig_read;
pciconfig_write; pclose; perror;
personality; pipe; pmap_getmaps; pmap_getport; pmap_rmtcall; pmap_set;
- pmap_unset; poll; popen; pread; printf; printf_size; printf_size_info;
- profil; profil_counter; pwrite; pselect; psignal;
+ pmap_unset; poll; popen; prctl; pread; printf; printf_size;
+ printf_size_info; profil; profil_counter; pwrite; pselect; psignal;
pthread_attr_destroy;
pthread_attr_getdetachstate; pthread_attr_getinheritsched;
@@ -307,10 +311,10 @@ GLIBC_2.0 {
re_comp; re_compile_fastmap; re_compile_pattern; re_exec; re_match;
re_match_2; re_search; re_search_2; re_set_registers; re_set_syntax;
- read; readdir; readdir_r; readlink; readv; realloc; realpath; reboot;
- recv; recvfrom; recvmsg; regcomp; regerror; regexec; regfree;
- register_printf_function; registerrpc; remove; remque; rename;
- res_init; revoke; rewind; rewinddir; rexec; rindex; rmdir; rpmatch;
+ read; readdir; readdir_r; readdir64; readdir64_r; readlink; readv;
+ realloc; realpath; reboot; recv; recvfrom; recvmsg; regcomp; regerror;
+ regexec; regfree; register_printf_function; registerrpc; remove; remque;
+ rename; res_init; revoke; rewind; rewinddir; rexec; rindex; rmdir; rpmatch;
rresvport; rtime; ruserok; ruserpass;
# s*
@@ -328,8 +332,8 @@ GLIBC_2.0 {
sethostid; sethostname; setitimer; setjmp; setlinebuf; setlocale;
setlogin; setlogmask; setmntent; setnetent; setnetgrent; setpgid;
setpgrp; setpriority; setprotoent; setpwent; setregid; setresgid;
- setresuid; setreuid;
- setrlimit; setrpcent; setservent; setsid; setsockopt; setspent;
+ setresuid; setreuid; setrlimit; setrlimit64; setrpcent; setservent;
+ setsid; setsockopt; setspent;
setstate; setstate_r; settimeofday; setttyent; setuid; setusershell;
setutent; setutxent; setvbuf; sgetspent; sgetspent_r; shmat; shmctl;
shmdt; shmget; shutdown;
@@ -341,8 +345,8 @@ GLIBC_2.0 {
sigwait;
sleep; snprintf; socket; socketpair; sprintf; srand; srand48;
- srand48_r; srandom; srandom_r; sscanf; ssignal; sstk; statfs; step;
- stime; stpcpy; stpncpy; strcasecmp; strcat; strchr; strcmp; strcoll;
+ srand48_r; srandom; srandom_r; sscanf; ssignal; sstk; statfs; statfs64;
+ step; stime; stpcpy; stpncpy; strcasecmp; strcat; strchr; strcmp; strcoll;
strcpy; strcspn; strdup; strerror; strerror_r; strfmon; strfry;
strftime; strlen; strncasecmp; strncat; strncmp; strncpy; strndup;
strnlen; strpbrk; strptime; strrchr; strsep; strsignal; strspn;
@@ -362,11 +366,12 @@ GLIBC_2.0 {
# t*
tcdrain; tcflow; tcflush; tcgetattr; tcgetpgrp; tcsendbreak;
tcsetattr; tcsetpgrp; tdelete; tdestroy; telldir; tempnam; textdomain;
- tfind; time; timegm; timelocal; times; tmpfile; tmpnam; tmpnam_r;
+ tfind; time; timegm; timelocal; times; tmpfile; tmpfile64; tmpnam;
+ tmpnam_r;
toascii; tolower; toupper; towctrans; towlower; towupper;
- tr_break; truncate; tsearch; ttyname; ttyname_r; ttyslot; twalk;
- tzset;
+ tr_break; truncate; truncate64; tsearch; ttyname; ttyname_r; ttyslot;
+ twalk; tzset;
# u*
ualarm; ulckpwdf; ulimit; umask; umount; uname; ungetc; unlink;
diff --git a/libio/Makefile b/libio/Makefile
index aea60f52260..4df874d722d 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -25,14 +25,16 @@ headers := stdio.h libio.h _G_config.h
routines := \
filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
- iofopncook iofprintf iofputs iofread iofsetpos ioftell \
+ iofopncook iofputs iofread iofsetpos ioftell \
iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
ioseekoff ioseekpos iosetbuffer iosetvbuf iosprintf ioungetc \
iovsprintf iovsscanf \
+ iofgetpos64 iofopen64 iofsetpos64 \
\
clearerr feof ferror fgetc fileno fputc freopen fseek getc getchar \
memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
iovdprintf vscanf vsnprintf obprintf fcloseall fseeko ftello \
+ freopen64 fseeko64 ftello64 \
\
libc_fatal
diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c
index f1b781e8a0f..6abab602d16 100644
--- a/libio/filedoalloc.c
+++ b/libio/filedoalloc.c
@@ -73,7 +73,7 @@ _IO_file_doallocate (fp)
_IO_size_t size;
int couldbetty;
char *p;
- struct stat st;
+ struct _G_stat64 st;
#ifndef _LIBC
/* If _IO_cleanup_registration_needed is non-zero, we should call the
diff --git a/libio/fileops.c b/libio/fileops.c
index 22feb74fdd8..ccfce3c7760 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -161,10 +161,11 @@ _IO_file_finish (fp, dummy)
}
_IO_FILE *
-_IO_file_fopen (fp, filename, mode)
+_IO_file_fopen (fp, filename, mode, is32not64)
_IO_FILE *fp;
const char *filename;
const char *mode;
+ int is32not64;
{
int oflags = 0, omode;
int read_write, fdesc;
@@ -196,13 +197,19 @@ _IO_file_fopen (fp, filename, mode)
omode = O_RDWR;
read_write &= _IO_IS_APPENDING;
}
+#ifdef _G_OPEN64
+ fdesc = (is32not64
+ ? open (filename, omode|oflags, oprot)
+ : _G_OPEN64 (filename, omode|oflags, oprot));
+#else
fdesc = open (filename, omode|oflags, oprot);
+#endif
if (fdesc < 0)
return NULL;
fp->_fileno = fdesc;
_IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
if (read_write & _IO_IS_APPENDING)
- if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
+ if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD && errno != ESPIPE)
return NULL;
_IO_link_in (fp);
@@ -222,7 +229,7 @@ _IO_file_attach (fp, fd)
/* Get the current position of the file. */
/* We have to do that since that may be junk. */
fp->_offset = _IO_pos_BAD;
- if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
+ if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD && errno != ESPIPE)
return NULL;
return fp;
@@ -265,7 +272,7 @@ _IO_do_write (fp, data, to_do)
fp->_offset = _IO_pos_BAD;
else if (fp->_IO_read_end != fp->_IO_write_base)
{
- _IO_pos_t new_pos
+ _IO_fpos64_t new_pos
= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
if (new_pos == _IO_pos_BAD)
return EOF;
@@ -406,8 +413,8 @@ _IO_file_sync (fp)
if (_IO_in_backup (fp))
delta -= eGptr () - Gbase ();
#endif
- _IO_off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
- if (new_pos != (_IO_off_t) EOF)
+ _IO_off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
+ if (new_pos != (_IO_off64_t) EOF)
fp->_IO_read_end = fp->_IO_read_ptr;
#ifdef ESPIPE
else if (errno == ESPIPE)
@@ -424,15 +431,15 @@ _IO_file_sync (fp)
return retval;
}
-_IO_pos_t
+_IO_fpos64_t
_IO_file_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
- _IO_off_t offset;
+ _IO_off64_t offset;
int dir;
int mode;
{
- _IO_pos_t result;
- _IO_off_t delta, new_offset;
+ _IO_fpos64_t result;
+ _IO_off64_t delta, new_offset;
long count;
/* POSIX.1 8.2.3.7 says that after a call the fflush() the file
offset of the underlying file must be exact. */
@@ -477,7 +484,7 @@ _IO_file_seekoff (fp, offset, dir, mode)
break;
case _IO_seek_end:
{
- struct stat st;
+ struct _G_stat64 st;
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
{
offset += st.st_size;
@@ -494,8 +501,8 @@ _IO_file_seekoff (fp, offset, dir, mode)
&& !_IO_in_backup (fp))
{
/* Offset relative to start of main get area. */
- _IO_pos_t rel_offset = (offset - fp->_offset
- + (fp->_IO_read_end - fp->_IO_read_base));
+ _IO_fpos64_t rel_offset = (offset - fp->_offset
+ + (fp->_IO_read_end - fp->_IO_read_base));
if (rel_offset >= 0)
{
#if 0
@@ -592,13 +599,17 @@ _IO_file_read (fp, buf, size)
return read (fp->_fileno, buf, size);
}
-_IO_pos_t
+_IO_fpos64_t
_IO_file_seek (fp, offset, dir)
_IO_FILE *fp;
- _IO_off_t offset;
+ _IO_off64_t offset;
int dir;
{
+#ifdef _G_LSEEK64
+ return _G_LSEEK64 (fp->_fileno, offset, dir);
+#else
return lseek (fp->_fileno, offset, dir);
+#endif
}
int
@@ -606,7 +617,11 @@ _IO_file_stat (fp, st)
_IO_FILE *fp;
void *st;
{
- return fstat (fp->_fileno, (struct stat *) st);
+#ifdef _G_STAT64
+ return _G_FSTAT64 (fp->_fileno, (struct _G_stat64 *) st);
+#else
+ return fstat (fp->_fileno, (struct _G_stat64 *) st);
+#endif
}
int
@@ -812,5 +827,7 @@ struct _IO_jump_t _IO_file_jumps =
JUMP_INIT(write, _IO_file_write),
JUMP_INIT(seek, _IO_file_seek),
JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat)
+ JUMP_INIT(stat, _IO_file_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue)
};
diff --git a/libio/freopen64.c b/libio/freopen64.c
new file mode 100644
index 00000000000..78e994df463
--- /dev/null
+++ b/libio/freopen64.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that 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 library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+#include "stdio.h"
+
+FILE *
+freopen64 (filename, mode, fp)
+ const char* filename;
+ const char* mode;
+ FILE *fp;
+{
+#ifdef _G_OPEN64
+ FILE *result;
+ CHECK_FILE (fp, NULL);
+ if (!(fp->_flags & _IO_IS_FILEBUF))
+ return NULL;
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ result = _IO_freopen64 (filename, mode, fp);
+ _IO_cleanup_region_end (1);
+ return result;
+#else
+ __set_errno (ENOSYS);
+ return NULL;
+#endif
+}
diff --git a/libio/fseeko64.c b/libio/fseeko64.c
new file mode 100644
index 00000000000..81c17b398ca
--- /dev/null
+++ b/libio/fseeko64.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that 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 library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include <errno.h>
+#include "libioP.h"
+#include "stdio.h"
+
+int
+fseeko64 (fp, offset, whence)
+ _IO_FILE* fp;
+ __off64_t offset;
+ int whence;
+{
+#ifdef _G_LSEEK64
+ int result;
+ CHECK_FILE (fp, -1);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ result = _IO_fseek (fp, offset, whence);
+ _IO_cleanup_region_end (1);
+ return result;
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+}
diff --git a/libio/ftello64.c b/libio/ftello64.c
new file mode 100644
index 00000000000..886591dca92
--- /dev/null
+++ b/libio/ftello64.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that 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 library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include <stdio.h>
+#include <libioP.h>
+#include <errno.h>
+
+
+off64_t
+ftello64 (fp)
+ _IO_FILE *fp;
+{
+#ifdef _G_LSEEK64
+ _IO_pos_t pos;
+ CHECK_FILE (fp, -1L);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
+ _IO_cleanup_region_end (1);
+ if (pos == _IO_pos_BAD)
+ {
+#ifdef EIO
+ if (errno == 0)
+ __set_errno (EIO);
+#endif
+ return -1L;
+ }
+ return _IO_pos_as_off (pos);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
+}
diff --git a/libio/genops.c b/libio/genops.c
index de9c826b9fe..71275da28c2 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -180,9 +180,16 @@ __overflow (f, ch)
return _IO_OVERFLOW (f, ch);
}
-static int save_for_backup __P ((_IO_FILE *fp));
+static int save_for_backup __P ((_IO_FILE *fp))
+#ifdef _LIBC
+ internal_function
+#endif
+ ;
static int
+#ifdef _LIBC
+ internal_function
+#endif
save_for_backup (fp)
_IO_FILE *fp;
{
@@ -467,10 +474,10 @@ _IO_default_setbuf (fp, p, len)
return fp;
}
-_IO_pos_t
+_IO_fpos64_t
_IO_default_seekpos (fp, pos, mode)
_IO_FILE *fp;
- _IO_pos_t pos;
+ _IO_fpos64_t pos;
int mode;
{
return _IO_SEEKOFF (fp, _IO_pos_as_off (pos), 0, mode);
@@ -551,10 +558,10 @@ _IO_default_finish (fp, dummy)
_IO_un_link (fp);
}
-_IO_pos_t
+_IO_fpos64_t
_IO_default_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
- _IO_off_t offset;
+ _IO_off64_t offset;
int dir;
int mode;
{
@@ -882,10 +889,10 @@ _IO_default_pbackfail (fp, c)
return (unsigned char) *fp->_IO_read_ptr;
}
-_IO_pos_t
+_IO_fpos64_t
_IO_default_seek (fp, offset, dir)
_IO_FILE *fp;
- _IO_off_t offset;
+ _IO_off64_t offset;
int dir;
{
return _IO_pos_BAD;
@@ -917,6 +924,20 @@ _IO_default_write (fp, data, n)
return 0;
}
+int
+_IO_default_showmanyc (fp)
+ _IO_FILE *fp;
+{
+ return -1;
+}
+
+void
+_IO_default_imbue (fp, locale)
+ _IO_FILE *fp;
+ void *locale;
+{
+}
+
#ifdef TODO
#if defined(linux)
diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c
index 08a3c20e867..6afc3231368 100644
--- a/libio/iofgetpos.c
+++ b/libio/iofgetpos.c
@@ -28,7 +28,7 @@
int
_IO_fgetpos (fp, posp)
- _IO_FILE* fp;
+ _IO_FILE *fp;
_IO_fpos_t *posp;
{
_IO_fpos_t pos;
diff --git a/libio/iofgetpos64.c b/libio/iofgetpos64.c
new file mode 100644
index 00000000000..0cb79d6619c
--- /dev/null
+++ b/libio/iofgetpos64.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that 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 library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+#include <errno.h>
+
+int
+_IO_fgetpos64 (fp, posp)
+ _IO_FILE *fp;
+ _IO_fpos64_t *posp;
+{
+#ifdef _G_LSEEK64
+ _IO_fpos64_t pos;
+ CHECK_FILE (fp, EOF);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
+ _IO_cleanup_region_end (1);
+ if (pos == _IO_pos_BAD)
+ {
+ /* ANSI explicitly requires setting errno to a positive value on
+ failure. */
+#ifdef EIO
+ if (errno == 0)
+ __set_errno (EIO);
+#endif
+ return EOF;
+ }
+ *posp = pos;
+ return 0;
+#else
+ __set_errno (ENOSYS);
+ return EOF;
+#endif
+}
+
+#ifdef weak_alias
+weak_alias (_IO_fgetpos64, fgetpos64)
+#endif
diff --git a/libio/iofopen.c b/libio/iofopen.c
index 1dbeccb81a8..5019e9a7989 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -52,7 +52,7 @@ _IO_fopen (filename, mode)
#if !_IO_UNIFIED_JUMPTABLES
new_f->fp.vtable = NULL;
#endif
- if (_IO_file_fopen (&new_f->fp.file, filename, mode) != NULL)
+ if (_IO_file_fopen (&new_f->fp.file, filename, mode, 0) != NULL)
return (_IO_FILE *) &new_f->fp;
_IO_un_link (&new_f->fp.file);
free (new_f);
diff --git a/libio/iofopen64.c b/libio/iofopen64.c
new file mode 100644
index 00000000000..cdd508d08a2
--- /dev/null
+++ b/libio/iofopen64.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that 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 library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include "libioP.h"
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+
+_IO_FILE *
+_IO_fopen64 (filename, mode)
+ const char *filename;
+ const char *mode;
+{
+#ifdef _G_OPEN64
+ struct locked_FILE
+ {
+ struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_t lock;
+#endif
+ } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+
+ if (new_f == NULL)
+ return NULL;
+#ifdef _IO_MTSAFE_IO
+ new_f->fp.file._lock = &new_f->lock;
+#endif
+ _IO_init (&new_f->fp.file, 0);
+ _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
+ _IO_file_init (&new_f->fp.file);
+#if !_IO_UNIFIED_JUMPTABLES
+ new_f->fp.vtable = NULL;
+#endif
+ if (_IO_file_fopen (&new_f->fp.file, filename, mode, 1) != NULL)
+ return (_IO_FILE *) &new_f->fp;
+ _IO_un_link (&new_f->fp.file);
+ free (new_f);
+ return NULL;
+#else
+ __set_errno (ENOSYS);
+ return NULL;
+#endif
+}
+
+#ifdef weak_alias
+weak_alias (_IO_fopen64, fopen64)
+#endif
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index 9bf29e71aec..4f28ec20a8a 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -33,8 +33,8 @@ static _IO_ssize_t _IO_cookie_read __P ((register _IO_FILE* fp, void* buf,
_IO_ssize_t size));
static _IO_ssize_t _IO_cookie_write __P ((register _IO_FILE* fp,
const void* buf, _IO_ssize_t size));
-static _IO_fpos_t _IO_cookie_seek __P ((_IO_FILE *fp, _IO_off_t offset,
- int dir));
+static _IO_fpos64_t _IO_cookie_seek __P ((_IO_FILE *fp, _IO_off64_t offset,
+ int dir));
static int _IO_cookie_close __P ((_IO_FILE* fp));
@@ -66,14 +66,14 @@ _IO_cookie_write (fp, buf, size)
return cfile->io_functions.write (cfile->cookie, buf, size);
}
-static _IO_fpos_t
+static _IO_fpos64_t
_IO_cookie_seek (fp, offset, dir)
_IO_FILE *fp;
- _IO_off_t offset;
+ _IO_off64_t offset;
int dir;
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
- _IO_fpos_t pos;
+ _IO_fpos64_t pos;
if (cfile->io_functions.seek == NULL)
return _IO_pos_BAD;
@@ -118,7 +118,9 @@ static struct _IO_jump_t _IO_cookie_jumps = {
JUMP_INIT(write, _IO_cookie_write),
JUMP_INIT(seek, _IO_cookie_seek),
JUMP_INIT(close, _IO_cookie_close),
- JUMP_INIT(stat, _IO_default_stat)
+ JUMP_INIT(stat, _IO_default_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue),
};
diff --git a/libio/iofsetpos64.c b/libio/iofsetpos64.c
new file mode 100644
index 00000000000..534e0cf3ca1
--- /dev/null
+++ b/libio/iofsetpos64.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU IO Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This library is distributed in the hope that 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 library; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ As a special exception, if you link this library with files
+ compiled with a GNU compiler to produce an executable, this does
+ not cause the resulting executable to be covered by the GNU General
+ Public License. This exception does not however invalidate any
+ other reasons why the executable file might be covered by the GNU
+ General Public License. */
+
+#include <libioP.h>
+#include <errno.h>
+
+int
+_IO_fsetpos64 (fp, posp)
+ _IO_FILE *fp;
+ const _IO_fpos64_t *posp;
+{
+#ifdef _G_LSEEK64
+ int result;
+ CHECK_FILE (fp, EOF);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
+ {
+ /* ANSI explicitly requires setting errno to a positive value on
+ failure. */
+#ifdef EIO
+ if (errno == 0)
+ __set_errno (EIO);
+#endif
+ result = EOF;
+ }
+ else
+ result = 0;
+ _IO_cleanup_region_end (1);
+ return result;
+#else
+ __set_errno (ENOSYS);
+ return EOF;
+#endif
+}
+
+#ifdef weak_alias
+weak_alias (_IO_fsetpos64, fsetpos64)
+#endif
diff --git a/libio/iolibio.h b/libio/iolibio.h
index 92df6a6fd2a..bcf8bbd775f 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -11,11 +11,14 @@ extern int _IO_fclose __P((_IO_FILE*));
extern _IO_FILE *_IO_fdopen __P((int, const char*));
extern int _IO_fflush __P((_IO_FILE*));
extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
+extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
extern char* _IO_fgets __P((char*, int, _IO_FILE*));
extern _IO_FILE *_IO_fopen __P((const char*, const char*));
+extern _IO_FILE *_IO_fopen64 __P((const char*, const char*));
extern int _IO_fprintf __P((_IO_FILE*, const char*, ...));
extern int _IO_fputs __P((const char*, _IO_FILE*));
extern int _IO_fsetpos __P((_IO_FILE*, const _IO_fpos_t *));
+extern int _IO_fsetpos64 __P((_IO_FILE*, const _IO_fpos64_t *));
extern long int _IO_ftell __P((_IO_FILE*));
extern _IO_size_t _IO_fread __P((void*, _IO_size_t, _IO_size_t, _IO_FILE*));
extern _IO_size_t _IO_fwrite __P((const void*,
@@ -46,7 +49,9 @@ extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
#define _IO_rewind(FILE) (void)_IO_seekoff(FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
#define _IO_vprintf(FORMAT, ARGS) _IO_vfprintf(_IO_stdout, FORMAT, ARGS)
#define _IO_freopen(FILENAME, MODE, FP) \
- (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE))
+ (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
+#define _IO_freopen64(FILENAME, MODE, FP) \
+ (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 1))
#define _IO_fileno(FP) ((FP)->_fileno)
extern _IO_FILE* _IO_popen __P((const char*, const char*));
#define _IO_pclose _IO_fclose
diff --git a/libio/iopopen.c b/libio/iopopen.c
index 59d4fc3f0ed..f0589bf184a 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -247,5 +247,7 @@ struct _IO_jump_t _IO_proc_jumps = {
JUMP_INIT(write, _IO_file_write),
JUMP_INIT(seek, _IO_file_seek),
JUMP_INIT(close, _IO_proc_close),
- JUMP_INIT(stat, _IO_file_stat)
+ JUMP_INIT(stat, _IO_file_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue)
};
diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c
index b1c4729b3d1..13086ee9127 100644
--- a/libio/ioseekoff.c
+++ b/libio/ioseekoff.c
@@ -25,14 +25,14 @@
#include <libioP.h>
-_IO_pos_t
+_IO_fpos64_t
_IO_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
- _IO_off_t offset;
+ _IO_off64_t offset;
int dir;
int mode;
{
- _IO_pos_t retval;
+ _IO_fpos64_t retval;
/* If we have a backup buffer, get rid of it, since the __seekoff
callback may not know to do the right thing about it.
diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c
index 2ce0c2224ec..5b59ed7d995 100644
--- a/libio/ioseekpos.c
+++ b/libio/ioseekpos.c
@@ -25,13 +25,13 @@
#include <libioP.h>
-_IO_pos_t
+_IO_fpos64_t
_IO_seekpos (fp, pos, mode)
_IO_FILE *fp;
- _IO_pos_t pos;
+ _IO_fpos64_t pos;
int mode;
{
- _IO_pos_t retval;
+ _IO_fpos64_t retval;
/* If we have a backup buffer, get rid of it, since the __seekoff
callback may not know to do the right thing about it.
diff --git a/libio/libio.h b/libio/libio.h
index 1dddaf27b70..ad5583f4865 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -30,9 +30,11 @@
#include <_G_config.h>
#define _IO_pos_t _G_fpos_t /* obsolete */
#define _IO_fpos_t _G_fpos_t
+#define _IO_fpos64_t _G_fpos64_t
#define _IO_size_t _G_size_t
#define _IO_ssize_t _G_ssize_t
#define _IO_off_t _G_off_t
+#define _IO_off64_t _G_off64_t
#define _IO_pid_t _G_pid_t
#define _IO_uid_t _G_uid_t
#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
@@ -205,7 +207,7 @@ struct _IO_FILE {
int _fileno;
int _blksize;
- _IO_off_t _offset;
+ _IO_off_t _unused2; /* This used to be _offset but it's too small. */
#define __HAVE_COLUMN /* temporary */
/* 1+column number of pbase(); 0 is unknown. */
@@ -216,6 +218,8 @@ struct _IO_FILE {
/* char* _save_gptr; char* _save_egptr; */
_IO_lock_t *_lock;
+
+ _IO_off64_t _offset;
};
#ifndef __cplusplus
@@ -303,8 +307,8 @@ extern int _IO_vfprintf __P ((_IO_FILE *, const char *, _IO_va_list));
extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t));
extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t));
-extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
-extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
extern void _IO_free_backup_area __P ((_IO_FILE *));
diff --git a/libio/libioP.h b/libio/libioP.h
index 2337071d396..5fe9598c0d0 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -134,16 +134,16 @@ typedef _IO_size_t (*_IO_xsgetn_t) __P ((_IO_FILE *FP, void *DATA,
(MODE==1), or the end of the file (MODE==2).
It matches the streambuf::seekoff virtual function.
It is also used for the ANSI fseek function. */
-typedef _IO_fpos_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off_t OFF,
+typedef _IO_fpos64_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off64_t OFF,
int DIR, int MODE));
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
/* The 'seekpos' hook also moves the stream position,
- but to an absolute position given by a fpos_t (seekpos).
+ but to an absolute position given by a fpos64_t (seekpos).
It matches the streambuf::seekpos virtual function.
It is also used for the ANSI fgetpos and fsetpos functions. */
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
-typedef _IO_fpos_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos_t, int));
+typedef _IO_fpos64_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos64_t, int));
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
/* The 'setbuf' hook gives a buffer to the file.
@@ -192,7 +192,7 @@ typedef _IO_ssize_t (*_IO_write_t) __P ((_IO_FILE *,const void *,_IO_ssize_t));
It generalizes the Unix lseek(2) function.
It matches the streambuf::sys_seek virtual function, which is
specific to this implementation. */
-typedef _IO_fpos_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off_t, int));
+typedef _IO_fpos64_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off64_t, int));
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
/* The 'sysclose' hook is used to finalize (close, finish up) an
@@ -209,6 +209,17 @@ typedef int (*_IO_close_t) __P ((_IO_FILE *)); /* finalize */
typedef int (*_IO_stat_t) __P ((_IO_FILE *, void *));
#define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
+/* The 'showmany' hook can be used to get an image how much input is
+ available. In many cases the answer will be 0 which means unknown
+ but some cases one can provide real information. */
+typedef int (*_IO_showmanyc_t) __P ((_IO_FILE *));
+#define _IO_SHOWMANYC(FP) JUMP0 (__showmanyc, FP)
+
+/* The 'imbue' hook is used to get information about the currently
+ installed locales. */
+typedef void (*_IO_imbue_t) __P ((_IO_FILE *, void *));
+#define _IO_IMBUE(FP, LOCALE) JUMP1 (__imbue, FP, LOCALE)
+
#define _IO_CHAR_TYPE char /* unsigned char ? */
#define _IO_INT_TYPE int
@@ -237,6 +248,8 @@ struct _IO_jump_t
JUMP_FIELD(_IO_seek_t, __seek);
JUMP_FIELD(_IO_close_t, __close);
JUMP_FIELD(_IO_stat_t, __stat);
+ JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
+ JUMP_FIELD(_IO_imbue_t, __imbue);
#if 0
get_column;
set_column;
@@ -256,8 +269,8 @@ struct _IO_FILE_plus
/* Generic functions */
-extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
-extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
@@ -293,15 +306,19 @@ extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
-extern _IO_fpos_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
-extern _IO_fpos_t _IO_default_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+extern _IO_fpos64_t _IO_default_seekoff __P ((_IO_FILE *,
+ _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_default_seekpos __P ((_IO_FILE *,
+ _IO_fpos64_t, int));
extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_default_stat __P ((_IO_FILE *, void *));
-extern _IO_fpos_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int));
+extern _IO_fpos64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
extern int _IO_default_sync __P ((_IO_FILE *));
#define _IO_default_close ((_IO_close_t) _IO_default_sync)
+extern int _IO_default_showmanyc __P ((_IO_FILE *));
+extern void _IO_default_imbue __P ((_IO_FILE *, void *));
extern struct _IO_jump_t _IO_file_jumps;
extern struct _IO_jump_t _IO_streambuf_jumps;
@@ -331,7 +348,7 @@ extern void _IO_flush_all_linebuffered __P ((void));
extern int _IO_file_doallocate __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
-extern _IO_fpos_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_fpos64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
extern int _IO_file_stat __P ((_IO_FILE *, void *));
extern int _IO_file_close __P ((_IO_FILE *));
@@ -340,13 +357,14 @@ extern int _IO_file_overflow __P ((_IO_FILE *, int));
#define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0)
extern void _IO_file_init __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
-extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *));
+extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *,
+ int));
extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_file_sync __P ((_IO_FILE *));
extern int _IO_file_close_it __P ((_IO_FILE *));
-extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int));
+extern _IO_fpos64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
extern void _IO_file_finish __P ((_IO_FILE *, int));
/* Jumptable functions for proc_files. */
@@ -357,7 +375,7 @@ extern int _IO_proc_close __P ((_IO_FILE *));
extern int _IO_str_underflow __P ((_IO_FILE *));
extern int _IO_str_overflow __P ((_IO_FILE *, int));
extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
-extern _IO_fpos_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_fpos64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
extern void _IO_str_finish __P ((_IO_FILE *, int));
/* Other strfile functions */
@@ -424,6 +442,7 @@ extern void (*_IO_cleanup_registration_needed) __P ((void));
/* When using this code in the GNU libc we must not pollute the name space. */
# define mmap __mmap
# define munmap __munmap
+# define ftruncate __ftruncate
# endif
# define ROUND_TO_PAGE(_S) \
@@ -459,31 +478,31 @@ extern void (*_IO_cleanup_registration_needed) __P ((void));
struct stat;
extern _IO_ssize_t _IO_read __P ((int, void *, _IO_size_t));
extern _IO_ssize_t _IO_write __P ((int, const void *, _IO_size_t));
-extern _IO_off_t _IO_lseek __P ((int, _IO_off_t, int));
+extern _IO_off64_t _IO_lseek __P ((int, _IO_off64_t, int));
extern int _IO_close __P ((int));
extern int _IO_fstat __P ((int, struct stat *));
extern int _IO_vscanf __P ((const char *, _IO_va_list));
-/* Operations on _IO_fpos_t.
+/* Operations on _IO_fpos64_t.
Normally, these are trivial, but we provide hooks for configurations
- where an _IO_fpos_t is a struct.
- Note that _IO_off_t must be an integral type. */
+ where an _IO_fpos64_t is a struct.
+ Note that _IO_off64_t must be an integral type. */
-/* _IO_pos_BAD is an _IO_fpos_t value indicating error, unknown, or EOF. */
+/* _IO_pos_BAD is an _IO_fpos64_t value indicating error, unknown, or EOF. */
#ifndef _IO_pos_BAD
-# define _IO_pos_BAD ((_IO_fpos_t) -1)
+# define _IO_pos_BAD ((_IO_fpos64_t) -1)
#endif
-/* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */
+/* _IO_pos_as_off converts an _IO_fpos64_t value to an _IO_off64_t value. */
#ifndef _IO_pos_as_off
-# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos))
+# define _IO_pos_as_off(__pos) ((_IO_off64_t) (__pos))
#endif
-/* _IO_pos_adjust adjust an _IO_fpos_t by some number of bytes. */
+/* _IO_pos_adjust adjust an _IO_fpos64_t by some number of bytes. */
#ifndef _IO_pos_adjust
# define _IO_pos_adjust(__pos, __delta) ((__pos) += (__delta))
#endif
-/* _IO_pos_0 is an _IO_fpos_t value indicating beginning of file. */
+/* _IO_pos_0 is an _IO_fpos64_t value indicating beginning of file. */
#ifndef _IO_pos_0
-# define _IO_pos_0 ((_IO_fpos_t) 0)
+# define _IO_pos_0 ((_IO_fpos64_t) 0)
#endif
#ifdef __cplusplus
diff --git a/libio/memstream.c b/libio/memstream.c
index 7b9ccd3d373..71aab2f6eab 100644
--- a/libio/memstream.c
+++ b/libio/memstream.c
@@ -53,7 +53,9 @@ static const struct _IO_jump_t _IO_mem_jumps =
JUMP_INIT (write, _IO_default_write),
JUMP_INIT (seek, _IO_default_seek),
JUMP_INIT (close, _IO_default_close),
- JUMP_INIT (stat, _IO_default_stat)
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue)
};
/* Open a stream that writes into a malloc'd buffer that is expanded as
diff --git a/libio/obprintf.c b/libio/obprintf.c
index 6b959e455a8..a0c4df62934 100644
--- a/libio/obprintf.c
+++ b/libio/obprintf.c
@@ -109,7 +109,9 @@ static struct _IO_jump_t _IO_obstack_jumps =
JUMP_INIT(write, NULL),
JUMP_INIT(seek, NULL),
JUMP_INIT(close, NULL),
- JUMP_INIT(stat, NULL)
+ JUMP_INIT(stat, NULL),
+ JUMP_INIT(showmanyc, NULL),
+ JUMP_INIT(imbue, NULL)
};
diff --git a/libio/stdio.h b/libio/stdio.h
index bbed2940562..a835fed6cc8 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -23,16 +23,16 @@
#ifndef _STDIO_H
#if !defined __need_FILE
-#define _STDIO_H 1
-#include <features.h>
+# define _STDIO_H 1
+# include <features.h>
__BEGIN_DECLS
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
+# define __need_size_t
+# define __need_NULL
+# include <stddef.h>
-#include <bits/types.h>
+# include <bits/types.h>
#endif /* Don't need FILE. */
#undef __need_FILE
@@ -42,7 +42,7 @@ __BEGIN_DECLS
/* The opaque type of streams. */
typedef struct _IO_FILE FILE;
-#define __FILE_defined 1
+# define __FILE_defined 1
#endif /* FILE not defined. */
@@ -58,8 +58,14 @@ typedef struct _IO_FILE FILE;
#endif
/* The type of the second argument to `fgetpos' and `fsetpos'. */
+#ifndef __USE_FILE_OFFSET64
typedef _G_fpos_t fpos_t;
-
+#else
+typedef _G_fpos64_t fpos_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef _G_fpos64_t fpos64_t;
+#endif
/* Generate a unique file name (and possibly open it with mode "w+b"). */
extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
@@ -67,7 +73,8 @@ extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
__const char *__pfx,
int __dir_search,
size_t *__lenptr,
- FILE **__streamptr));
+ FILE **__streamptr,
+ int __large_file));
/* Print out MESSAGE on the error output and abort. */
@@ -83,14 +90,14 @@ extern void __libc_fatal __P ((__const char *__message))
/* Default buffer size. */
#ifndef BUFSIZ
-#define BUFSIZ _IO_BUFSIZ
+# define BUFSIZ _IO_BUFSIZ
#endif
/* End of file character.
Some things throughout the library rely on this being -1. */
#ifndef EOF
-#define EOF (-1)
+# define EOF (-1)
#endif
@@ -103,7 +110,7 @@ extern void __libc_fatal __P ((__const char *__message))
#ifdef __USE_SVID
/* Default path prefix for `tempnam' and `tmpnam'. */
-#define P_tmpdir "/tmp"
+# define P_tmpdir "/tmp"
#endif
@@ -134,7 +141,14 @@ extern int rename __P ((__const char *__old, __const char *__new));
/* Create a temporary file and open it read/write. */
+#ifndef __USE_FILE_OFFSET64
extern FILE *tmpfile __P ((void));
+#else
+extern FILE *tmpfile __P ((void)) __asm__ ("tmpfile64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern FILE *tmpfile64 __P ((void));
+#endif
/* Generate a temporary filename. */
extern char *tmpnam __P ((char *__s));
@@ -176,11 +190,30 @@ extern int fcloseall __P ((void));
/* Open a file and create a new stream for it. */
+#ifndef __USE_FILE_OFFSET64
extern FILE *fopen __P ((__const char *__filename, __const char *__modes));
+#else
+extern FILE *fopen __P ((__const char *__filename, __const char *__modes))
+ __asm__ ("fopen64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern FILE *fopen64 __P ((__const char *__filename, __const char *__modes));
+#endif
/* Open a file, replacing an existing stream with it. */
+#ifndef __USE_FILE_OFFSET64
extern FILE *freopen __P ((__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream));
+#else
+extern FILE *freopen __P ((__const char *__restrict __filename,
+ __const char *__restrict __modes,
+ FILE *__restrict __stream)) __asm__ ("freopen64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern FILE *freopen64 __P ((__const char *__restrict __filename,
+ __const char *__restrict __modes,
+ FILE *__restrict __stream));
+#endif
#ifdef __USE_POSIX
/* Create a new stream that refers to an existing system file descriptor. */
@@ -242,7 +275,7 @@ extern int vsprintf __P ((char *__restrict __s,
#ifdef __OPTIMIZE__
__STDIO_INLINE int
-vprintf (const char *__restrict __fmt, _G_va_list __arg)
+vprintf (__const char *__restrict __fmt, _G_va_list __arg)
{
return vfprintf (stdout, __fmt, __arg);
}
@@ -349,7 +382,7 @@ getchar (void)
extern int getc_unlocked __P ((FILE *__stream));
extern int getchar_unlocked __P ((void));
-#ifdef __OPTIMIZE__
+# ifdef __OPTIMIZE__
__STDIO_INLINE int
getc_unlocked (FILE *__fp)
{
@@ -361,7 +394,7 @@ getchar_unlocked (void)
{
return _IO_getc_unlocked (stdin);
}
-#endif /* Optimizing. */
+# endif /* Optimizing. */
#endif /* Use POSIX or MISC. */
@@ -388,13 +421,13 @@ putchar (int __c)
/* Faster version when locking is not necessary. */
extern int fputc_unlocked __P ((int __c, FILE *__stream));
-#ifdef __OPTIMIZE__
+# ifdef __OPTIMIZE__
__STDIO_INLINE int
fputc_unlocked (int __c, FILE *__stream)
{
return _IO_putc_unlocked (__c, __stream);
}
-#endif /* Optimizing. */
+# endif /* Optimizing. */
#endif /* Use MISC. */
#if defined __USE_POSIX || defined __USE_MISC
@@ -402,7 +435,7 @@ fputc_unlocked (int __c, FILE *__stream)
extern int putc_unlocked __P ((int __c, FILE *__stream));
extern int putchar_unlocked __P ((int __c));
-#ifdef __OPTIMIZE__
+# ifdef __OPTIMIZE__
__STDIO_INLINE int
putc_unlocked (int __c, FILE *__stream)
{
@@ -414,7 +447,7 @@ putchar_unlocked (int __c)
{
return _IO_putc_unlocked (__c, stdout);
}
-#endif /* Optimizing. */
+# endif /* Optimizing. */
#endif /* Use POSIX or MISc. */
@@ -451,13 +484,13 @@ _IO_ssize_t getdelim __P ((char **__lineptr, size_t *__n,
_IO_ssize_t __getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
_IO_ssize_t getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
-#ifdef __OPTIMIZE__
+# ifdef __OPTIMIZE__
__STDIO_INLINE _IO_ssize_t
getline (char **__lineptr, size_t *__n, FILE *__stream)
{
return __getdelim (__lineptr, __n, '\n', __stream);
}
-#endif /* Optimizing. */
+# endif /* Optimizing. */
#endif
@@ -496,22 +529,72 @@ extern long int ftell __P ((FILE *__stream));
/* Rewind to the beginning of STREAM. */
extern void rewind __P ((FILE *__stream));
-#ifdef __USE_UNIX98
+#if (defined __USE_LARGEFILE || defined __USE_LARGEFILE64 \
+ || defined __USE_FILE_OFFSET64)
/* The Single Unix Specification, Version 2, specifies an alternative,
more adequate interface for the two functions above which deal with
- file offset. `long int' is not the right type. */
+ file offset. `long int' is not the right type. These definitions
+ are originally defined in the Large File Support API. */
+
+/* Types needed in these functions. */
+# ifndef off_t
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define off_t off_t
+# endif
+
+# if defined __USE_LARGEFILE64 && !defined off64_t
+typedef __off64_t off64_t;
+# define off64_t off64_t
+# endif
/* Seek to a certain position on STREAM. */
+# ifndef __USE_FILE_OFFSET64
extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence));
+# else
+extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence))
+ __asm__ ("fseeko64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern int fseeko64 __P ((FILE *__stream, __off64_t __off, int __whence));
+# endif
+
/* Return the current position of STREAM. */
+# ifndef __USE_FILE_OFFSET64
extern __off_t ftello __P ((FILE *__stream));
+# else
+extern __off_t ftello __P ((FILE *__stream)) __asm__ ("ftello");
+# endif
+# ifdef __USE_LARGEFILE64
+extern __off64_t ftello64 __P ((FILE *__stream));
+# endif
#endif
/* Get STREAM's position. */
+#ifndef __USE_FILE_OFFSET64
extern int fgetpos __P ((FILE *__restrict __stream,
fpos_t *__restrict __pos));
+#else
+extern int fgetpos __P ((FILE *__restrict __stream,
+ fpos_t *__restrict __pos)) __asm__ ("fgetpos64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int fgetpos64 __P ((FILE *__restrict __stream,
+ fpos64_t *__restrict __pos));
+#endif
/* Set STREAM's position. */
+#ifndef __USE_FILE_OFFSET64
extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos));
+#else
+extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos))
+ __asm__ ("fsetpos64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int fsetpos64 __P ((FILE *__stream, __const fpos64_t *__pos));
+#endif
/* Clear the error and EOF indicators for STREAM. */
@@ -527,7 +610,7 @@ extern void clearerr_unlocked __P ((FILE *__stream));
extern int feof_unlocked __P ((FILE *__stream));
extern int ferror_unlocked __P ((FILE *__stream));
-#ifdef __OPTIMIZE__
+# ifdef __OPTIMIZE__
__STDIO_INLINE int
feof_unlocked (FILE *__stream)
{
@@ -539,7 +622,7 @@ ferror_unlocked (FILE *__stream)
{
return _IO_ferror_unlocked (__stream);
}
-#endif /* Optimizing. */
+# endif /* Optimizing. */
#endif
diff --git a/libio/strops.c b/libio/strops.c
index a9f812e0451..c596315b609 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -205,15 +205,15 @@ _IO_str_count (fp)
- fp->_IO_read_base);
}
-_IO_pos_t
+_IO_fpos64_t
_IO_str_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
- _IO_off_t offset;
+ _IO_off64_t offset;
int dir;
int mode;
{
_IO_ssize_t cur_size = _IO_str_count (fp);
- _IO_pos_t new_pos = EOF;
+ _IO_fpos64_t new_pos = EOF;
/* Move the get pointer, if requested. */
if (mode & _IOS_INPUT)
@@ -299,5 +299,7 @@ struct _IO_jump_t _IO_str_jumps =
JUMP_INIT(write, _IO_default_write),
JUMP_INIT(seek, _IO_default_seek),
JUMP_INIT(close, _IO_default_close),
- JUMP_INIT(stat, _IO_default_stat)
+ JUMP_INIT(stat, _IO_default_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue)
};
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 3f35af299ab..5ac2317579a 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -94,7 +94,9 @@ static struct _IO_jump_t _IO_strn_jumps =
JUMP_INIT(write, _IO_default_write),
JUMP_INIT(seek, _IO_default_seek),
JUMP_INIT(close, _IO_default_close),
- JUMP_INIT(stat, _IO_default_stat)
+ JUMP_INIT(stat, _IO_default_stat),
+ JUMP_INIT(showmanyc, _IO_default_showmanyc),
+ JUMP_INIT(imbue, _IO_default_imbue)
};
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index 7749f6aebc1..6385df47e83 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -612,7 +612,7 @@ from-value of `collating-element' must be a string"));
now = lr_token (ldfile, charset);
}
while (now->tok == tok_comma
- && (now == lr_token (ldfile, charset) != tok_none));
+ && ((now = lr_token (ldfile, charset)) != tok_none));
/* Check for consistency: forward and backwards are
mutually exclusive. */
diff --git a/malloc/Makefile b/malloc/Makefile
index bad756aa640..8a7fe14d920 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -70,7 +70,7 @@ lib: $(objpfx)libmcheck.a
#CPPFLAGS-malloc.o += -DMALLOC_DEBUG
$(objpfx)mtrace: mtrace.pl
- rm -fr %@.new
+ rm -f $@.new
sed -e 's|@PERL@|$(PERL)|' -e 's|@XXX@|$(address-width)|' \
-e 's|@VERSION@|$(version)|' $^ > $@.new \
&& rm -fr $@ && mv $@.new $@ && chmod +x $@
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 17350eb4261..06fbf844f4d 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -297,7 +297,7 @@
#if __STD_C
# include <stddef.h> /* for size_t */
-# if defined(_LIBC) || defined(MALLOC_HOOKS)
+# if defined _LIBC || defined MALLOC_HOOKS
# include <stdlib.h> /* for getenv(), abort() */
# endif
#else
@@ -1168,17 +1168,19 @@ typedef struct _heap_info {
#if __STD_C
-static void chunk_free(arena *ar_ptr, mchunkptr p);
-static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size);
+static void chunk_free(arena *ar_ptr, mchunkptr p) internal_function;
+static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size)
+ internal_function;
static mchunkptr chunk_realloc(arena *ar_ptr, mchunkptr oldp,
- INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb);
+ INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb)
+ internal_function;
static mchunkptr chunk_align(arena *ar_ptr, INTERNAL_SIZE_T nb,
- size_t alignment);
-static int main_trim(size_t pad);
+ size_t alignment) internal_function;
+static int main_trim(size_t pad) internal_function;
#ifndef NO_THREADS
-static int heap_trim(heap_info *heap, size_t pad);
+static int heap_trim(heap_info *heap, size_t pad) internal_function;
#endif
-#ifdef _LIBC
+#if defined _LIBC || defined MALLOC_HOOKS
static Void_t* malloc_check(size_t sz, const Void_t *caller);
static void free_check(Void_t* mem, const Void_t *caller);
static Void_t* realloc_check(Void_t* oldmem, size_t bytes,
@@ -1189,17 +1191,6 @@ static Void_t* malloc_starter(size_t sz, const Void_t *caller);
static void free_starter(Void_t* mem, const Void_t *caller);
static Void_t* malloc_atfork(size_t sz, const Void_t *caller);
static void free_atfork(Void_t* mem, const Void_t *caller);
-#else
-#ifdef MALLOC_HOOKS
-static Void_t* malloc_check(size_t sz);
-static void free_check(Void_t* mem);
-static Void_t* realloc_check(Void_t* oldmem, size_t bytes);
-static Void_t* memalign_check(size_t alignment, size_t bytes);
-static Void_t* malloc_starter(size_t sz);
-static void free_starter(Void_t* mem);
-static Void_t* malloc_atfork(size_t sz);
-static void free_atfork(Void_t* mem);
-#endif
#endif
#else
@@ -1212,7 +1203,7 @@ static int main_trim();
#ifndef NO_THREADS
static int heap_trim();
#endif
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
static Void_t* malloc_check();
static void free_check();
static Void_t* realloc_check();
@@ -1225,6 +1216,13 @@ static void free_atfork();
#endif
+/* On some platforms we can compile internal, not exported functions better.
+ Let the environment provide a macro and define it to be empty if it
+ is not available. */
+#ifndef internal_function
+# define internal_function
+#endif
+
/* sizes, alignments */
@@ -1387,13 +1385,13 @@ static void free_atfork();
Indexing into bins
*/
-#define bin_index(sz) \
-(((((unsigned long)(sz)) >> 9) == 0) ? (((unsigned long)(sz)) >> 3): \
- ((((unsigned long)(sz)) >> 9) <= 4) ? 56 + (((unsigned long)(sz)) >> 6): \
- ((((unsigned long)(sz)) >> 9) <= 20) ? 91 + (((unsigned long)(sz)) >> 9): \
- ((((unsigned long)(sz)) >> 9) <= 84) ? 110 + (((unsigned long)(sz)) >> 12): \
- ((((unsigned long)(sz)) >> 9) <= 340) ? 119 + (((unsigned long)(sz)) >> 15): \
- ((((unsigned long)(sz)) >> 9) <= 1364) ? 124 + (((unsigned long)(sz)) >> 18): \
+#define bin_index(sz) \
+(((((unsigned long)(sz)) >> 9) == 0) ? (((unsigned long)(sz)) >> 3):\
+ ((((unsigned long)(sz)) >> 9) <= 4) ? 56 + (((unsigned long)(sz)) >> 6):\
+ ((((unsigned long)(sz)) >> 9) <= 20) ? 91 + (((unsigned long)(sz)) >> 9):\
+ ((((unsigned long)(sz)) >> 9) <= 84) ? 110 + (((unsigned long)(sz)) >> 12):\
+ ((((unsigned long)(sz)) >> 9) <= 340) ? 119 + (((unsigned long)(sz)) >> 15):\
+ ((((unsigned long)(sz)) >> 9) <= 1364) ? 124 + (((unsigned long)(sz)) >> 18):\
126)
/*
bins for chunks < 512 are all spaced 8 bytes apart, and hold
@@ -1533,18 +1531,12 @@ int __malloc_initialized = 0;
temporarily, because the `atfork' handler mechanism may use
malloc/free internally (e.g. in LinuxThreads). */
-#ifdef _LIBC
+#if defined _LIBC || defined MALLOC_HOOKS
static __malloc_ptr_t (*save_malloc_hook) __MALLOC_P ((size_t __size,
const __malloc_ptr_t));
static void (*save_free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
const __malloc_ptr_t));
static Void_t* save_arena;
-#else
-#ifdef MALLOC_HOOKS
-static __malloc_ptr_t (*save_malloc_hook) __MALLOC_P ((size_t __size));
-static void (*save_free_hook) __MALLOC_P ((__malloc_ptr_t __ptr));
-static Void_t* save_arena;
-#endif
#endif
static void
@@ -1558,7 +1550,7 @@ ptmalloc_lock_all __MALLOC_P((void))
ar_ptr = ar_ptr->next;
if(ar_ptr == &main_arena) break;
}
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
save_malloc_hook = __malloc_hook;
save_free_hook = __free_hook;
__malloc_hook = malloc_atfork;
@@ -1574,7 +1566,7 @@ ptmalloc_unlock_all __MALLOC_P((void))
{
arena *ar_ptr;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
tsd_setspecific(arena_key, save_arena);
__malloc_hook = save_malloc_hook;
__free_hook = save_free_hook;
@@ -1600,13 +1592,13 @@ void
ptmalloc_init __MALLOC_P((void))
#endif
{
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
const char* s;
#endif
if(__malloc_initialized) return;
__malloc_initialized = 1;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
/* With some threads implementations, creating thread-specific data
or initializing a mutex may call malloc() itself. Provide a
simple starter version (realloc() won't work). */
@@ -1615,7 +1607,7 @@ ptmalloc_init __MALLOC_P((void))
__malloc_hook = malloc_starter;
__free_hook = free_starter;
#endif
-#if defined(_LIBC) && !defined (NO_THREADS)
+#if defined _LIBC && !defined NO_THREADS
/* Initialize the pthreads interface. */
if (__pthread_initialize != NULL)
__pthread_initialize();
@@ -1627,7 +1619,7 @@ ptmalloc_init __MALLOC_P((void))
tsd_setspecific(arena_key, (Void_t *)&main_arena);
thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_unlock_all);
#endif
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_TOP_PAD_")))
@@ -1654,7 +1646,7 @@ thread_atfork_static(ptmalloc_lock_all, ptmalloc_unlock_all, \
ptmalloc_unlock_all)
#endif
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
/* Hooks for debugging versions. The initial hooks just call the
initialization routine, then do the normal work. */
@@ -1678,14 +1670,11 @@ malloc_hook_ini(sz) size_t sz;
}
static Void_t*
-#ifdef _LIBC
-realloc_hook_ini(Void_t* ptr, size_t sz, const __malloc_ptr_t caller)
-#else
#if __STD_C
-realloc_hook_ini(Void_t* ptr, size_t sz)
+realloc_hook_ini(Void_t* ptr, size_t sz, const __malloc_ptr_t caller)
#else
-realloc_hook_ini(ptr, sz) Void_t* ptr; size_t sz;
-#endif
+realloc_hook_ini(ptr, sz, caller)
+ Void_t* ptr; size_t sz; const __malloc_ptr_t caller;
#endif
{
__malloc_hook = NULL;
@@ -1696,14 +1685,11 @@ realloc_hook_ini(ptr, sz) Void_t* ptr; size_t sz;
}
static Void_t*
-#ifdef _LIBC
-memalign_hook_ini(size_t sz, size_t alignment, const __malloc_ptr_t caller)
-#else
#if __STD_C
-memalign_hook_ini(size_t sz, size_t alignment)
+memalign_hook_ini(size_t sz, size_t alignment, const __malloc_ptr_t caller)
#else
-memalign_hook_ini(sz, alignment) size_t sz; size_t alignment;
-#endif
+memalign_hook_ini(sz, alignment, caller)
+ size_t sz; size_t alignment; const __malloc_ptr_t caller;
#endif
{
__malloc_hook = NULL;
@@ -1714,7 +1700,6 @@ memalign_hook_ini(sz, alignment) size_t sz; size_t alignment;
}
void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
-#ifdef _LIBC
void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
const __malloc_ptr_t)) = NULL;
__malloc_ptr_t weak_variable (*__malloc_hook)
@@ -1725,15 +1710,6 @@ __malloc_ptr_t weak_variable (*__realloc_hook)
__malloc_ptr_t weak_variable (*__memalign_hook)
__MALLOC_P ((size_t __size, size_t __alignment, const __malloc_ptr_t))
= memalign_hook_ini;
-#else
-void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)) = NULL;
-__malloc_ptr_t weak_variable (*__malloc_hook)
- __MALLOC_P ((size_t __size)) = malloc_hook_ini;
-__malloc_ptr_t weak_variable (*__realloc_hook)
- __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size)) = realloc_hook_ini;
-__malloc_ptr_t weak_variable (*__memalign_hook)
- __MALLOC_P ((size_t __size, size_t __alignment)) = memalign_hook_ini;
-#endif
void weak_variable (*__after_morecore_hook) __MALLOC_P ((void)) = NULL;
/* Activate a standard set of debugging hooks. */
@@ -1774,10 +1750,16 @@ static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
#endif
+static mchunkptr
+#if defined __GNUC__ && __GNUC__ >= 2
+/* This function is only called from one place, inline it. */
+inline
+#endif
+internal_function
#if __STD_C
-static mchunkptr mmap_chunk(size_t size)
+mmap_chunk(size_t size)
#else
-static mchunkptr mmap_chunk(size) size_t size;
+mmap_chunk(size) size_t size;
#endif
{
size_t page_mask = malloc_getpagesize - 1;
@@ -1897,6 +1879,7 @@ static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size;
of the page size. */
static heap_info *
+internal_function
#if __STD_C
new_heap(size_t size)
#else
@@ -1986,6 +1969,7 @@ grow_heap(h, diff) heap_info *h; long diff;
} while(0)
static arena *
+internal_function
#if __STD_C
arena_get2(arena *a_tsd, size_t size)
#else
@@ -2302,10 +2286,16 @@ arena *ar_ptr; mchunkptr p; INTERNAL_SIZE_T s;
Main interface to sbrk (but see also malloc_trim).
*/
+static void
+#if defined __GNUC__ && __GNUC__ >= 2
+/* This function is called only from one place, inline it. */
+inline
+#endif
+internal_function
#if __STD_C
-static void malloc_extend_top(arena *ar_ptr, INTERNAL_SIZE_T nb)
+malloc_extend_top(arena *ar_ptr, INTERNAL_SIZE_T nb)
#else
-static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
+malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
#endif
{
unsigned long pagesz = malloc_getpagesize;
@@ -2340,7 +2330,7 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
(brk < old_end && old_top != initial_top(&main_arena)))
return;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
/* Call the `morecore' hook if necessary. */
if (__after_morecore_hook)
(*__after_morecore_hook) ();
@@ -2374,7 +2364,7 @@ static void malloc_extend_top(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
new_brk = (char*)(MORECORE (correction));
if (new_brk == (char*)(MORECORE_FAILURE)) return;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
/* Call the `morecore' hook if necessary. */
if (__after_morecore_hook)
(*__after_morecore_hook) ();
@@ -2531,14 +2521,14 @@ Void_t* mALLOc(bytes) size_t bytes;
INTERNAL_SIZE_T nb; /* padded request size */
mchunkptr victim;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
if (__malloc_hook != NULL) {
Void_t* result;
-#ifdef _LIBC
+#if defined __GNUC__ && __GNUC__ >= 2
result = (*__malloc_hook)(bytes, __builtin_return_address (0));
#else
- result = (*__malloc_hook)(bytes);
+ result = (*__malloc_hook)(bytes, NULL);
#endif
return result;
}
@@ -2563,6 +2553,7 @@ Void_t* mALLOc(bytes) size_t bytes;
}
static mchunkptr
+internal_function
#if __STD_C
chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T nb)
#else
@@ -2828,12 +2819,12 @@ void fREe(mem) Void_t* mem;
arena *ar_ptr;
mchunkptr p; /* chunk corresponding to mem */
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
if (__free_hook != NULL) {
-#ifdef _LIBC
+#if defined __GNUC__ && __GNUC__ >= 2
(*__free_hook)(mem, __builtin_return_address (0));
#else
- (*__free_hook)(mem);
+ (*__free_hook)(mem, NULL);
#endif
return;
}
@@ -2868,6 +2859,7 @@ void fREe(mem) Void_t* mem;
}
static void
+internal_function
#if __STD_C
chunk_free(arena *ar_ptr, mchunkptr p)
#else
@@ -3030,14 +3022,14 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
mchunkptr newp; /* chunk to return */
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
if (__realloc_hook != NULL) {
Void_t* result;
-#ifdef _LIBC
+#if defined __GNUC__ && __GNUC__ >= 2
result = (*__realloc_hook)(oldmem, bytes, __builtin_return_address (0));
#else
- result = (*__realloc_hook)(oldmem, bytes);
+ result = (*__realloc_hook)(oldmem, bytes, NULL);
#endif
return result;
}
@@ -3099,6 +3091,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
}
static mchunkptr
+internal_function
#if __STD_C
chunk_realloc(arena* ar_ptr, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
INTERNAL_SIZE_T nb)
@@ -3296,15 +3289,15 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
INTERNAL_SIZE_T nb; /* padded request size */
mchunkptr p;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
if (__memalign_hook != NULL) {
Void_t* result;
-#ifdef _LIBC
+#if defined __GNUC__ && __GNUC__ >= 2
result = (*__memalign_hook)(alignment, bytes,
__builtin_return_address (0));
#else
- result = (*__memalign_hook)(alignment, bytes);
+ result = (*__memalign_hook)(alignment, bytes, NULL);
#endif
return result;
}
@@ -3337,6 +3330,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
}
static mchunkptr
+internal_function
#if __STD_C
chunk_align(arena* ar_ptr, INTERNAL_SIZE_T nb, size_t alignment)
#else
@@ -3473,13 +3467,13 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
INTERNAL_SIZE_T sz, csz, oldtopsize;
Void_t* mem;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
if (__malloc_hook != NULL) {
sz = n * elem_size;
-#ifdef _LIBC
+#if defined __GNUC__ && __GNUC__ >= 2
mem = (*__malloc_hook)(sz, __builtin_return_address (0));
#else
- mem = (*__malloc_hook)(sz);
+ mem = (*__malloc_hook)(sz, NULL);
#endif
if(mem == 0)
return 0;
@@ -3597,6 +3591,7 @@ int mALLOC_TRIm(pad) size_t pad;
/* Trim the main arena. */
static int
+internal_function
#if __STD_C
main_trim(size_t pad)
#else
@@ -3625,7 +3620,7 @@ main_trim(pad) size_t pad;
new_brk = (char*)(MORECORE (-extra));
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
/* Call the `morecore' hook if necessary. */
if (__after_morecore_hook)
(*__after_morecore_hook) ();
@@ -3654,6 +3649,7 @@ main_trim(pad) size_t pad;
#ifndef NO_THREADS
static int
+internal_function
#if __STD_C
heap_trim(heap_info *heap, size_t pad)
#else
@@ -4114,7 +4110,7 @@ mALLOC_SET_STATe(msptr) Void_t* msptr;
-#if defined(_LIBC) || defined(MALLOC_HOOKS)
+#if defined _LIBC || defined MALLOC_HOOKS
/* A simple, standard set of debugging hooks. Overhead is `only' one
byte per chunk; still this will catch most cases of double frees or
@@ -4127,6 +4123,7 @@ mALLOC_SET_STATe(msptr) Void_t* msptr;
goal here is to avoid crashes, unlike in the MALLOC_DEBUG code. */
static mchunkptr
+internal_function
#if __STD_C
mem2chunk_check(Void_t* mem)
#else
@@ -4173,14 +4170,10 @@ mem2chunk_check(mem) Void_t* mem;
}
static Void_t*
-#ifdef _LIBC
-malloc_check(size_t sz, const Void_t *caller)
-#else
#if __STD_C
-malloc_check(size_t sz)
+malloc_check(size_t sz, const Void_t *caller)
#else
-malloc_check(sz) size_t sz;
-#endif
+malloc_check(sz, caller) size_t sz; const Void_t *caller;
#endif
{
mchunkptr victim;
@@ -4200,14 +4193,10 @@ malloc_check(sz) size_t sz;
}
static void
-#ifdef _LIBC
-free_check(Void_t* mem, const Void_t *caller)
-#else
#if __STD_C
-free_check(Void_t* mem)
+free_check(Void_t* mem, const Void_t *caller)
#else
-free_check(mem) Void_t* mem;
-#endif
+free_check(mem, caller) Void_t* mem; const Void_t *caller;
#endif
{
mchunkptr p;
@@ -4241,24 +4230,17 @@ free_check(mem) Void_t* mem;
}
static Void_t*
-#ifdef _LIBC
-realloc_check(Void_t* oldmem, size_t bytes, const Void_t *caller)
-#else
#if __STD_C
-realloc_check(Void_t* oldmem, size_t bytes)
+realloc_check(Void_t* oldmem, size_t bytes, const Void_t *caller)
#else
-realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes;
-#endif
+realloc_check(oldmem, bytes, caller)
+ Void_t* oldmem; size_t bytes; const Void_t *caller;
#endif
{
mchunkptr oldp, newp;
INTERNAL_SIZE_T nb, oldsize;
-#ifdef _LIBC
if (oldmem == 0) return malloc_check(bytes, NULL);
-#else
- if (oldmem == 0) return malloc_check(bytes);
-#endif
(void)mutex_lock(&main_arena.mutex);
oldp = mem2chunk_check(oldmem);
if(!oldp) {
@@ -4270,11 +4252,7 @@ realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes;
case 2:
abort();
}
-#ifdef _LIBC
return malloc_check(bytes, NULL);
-#else
- return malloc_check(bytes);
-#endif
}
oldsize = chunksize(oldp);
@@ -4327,24 +4305,17 @@ realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes;
}
static Void_t*
-#ifdef _LIBC
-memalign_check(size_t alignment, size_t bytes, const Void_t *caller)
-#else
#if __STD_C
-memalign_check(size_t alignment, size_t bytes)
+memalign_check(size_t alignment, size_t bytes, const Void_t *caller)
#else
-memalign_check(alignment, bytes) size_t alignment; size_t bytes;
-#endif
+memalign_check(alignment, bytes, caller)
+ size_t alignment; size_t bytes; const Void_t *caller;
#endif
{
INTERNAL_SIZE_T nb;
mchunkptr p;
-#ifdef _LIBC
if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes, NULL);
-#else
- if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes);
-#endif
if (alignment < MINSIZE) alignment = MINSIZE;
nb = request2size(bytes+1);
@@ -4365,14 +4336,10 @@ memalign_check(alignment, bytes) size_t alignment; size_t bytes;
ptmalloc_init() hasn't completed yet. */
static Void_t*
-#ifdef _LIBC
-malloc_starter(size_t sz, const Void_t *caller)
-#else
#if __STD_C
-malloc_starter(size_t sz)
+malloc_starter(size_t sz, const Void_t *caller)
#else
-malloc_starter(sz) size_t sz;
-#endif
+malloc_starter(sz, caller) size_t sz; const Void_t *caller;
#endif
{
mchunkptr victim = chunk_alloc(&main_arena, request2size(sz));
@@ -4381,14 +4348,10 @@ malloc_starter(sz) size_t sz;
}
static void
-#ifdef _LIBC
-free_starter(Void_t* mem, const Void_t *caller)
-#else
#if __STD_C
-free_starter(Void_t* mem)
+free_starter(Void_t* mem, const Void_t *caller)
#else
-free_starter(mem) Void_t* mem;
-#endif
+free_starter(mem, caller) Void_t* mem; const Void_t *caller;
#endif
{
mchunkptr p;
@@ -4408,14 +4371,10 @@ free_starter(mem) Void_t* mem;
is active. */
static Void_t*
-#ifdef _LIBC
-malloc_atfork (size_t sz, const Void_t *caller)
-#else
#if __STD_C
-malloc_atfork(size_t sz)
+malloc_atfork (size_t sz, const Void_t *caller)
#else
-malloc_atfork(sz) size_t sz;
-#endif
+malloc_atfork(sz, caller) size_t sz; const Void_t *caller;
#endif
{
Void_t *vptr = NULL;
@@ -4435,14 +4394,10 @@ malloc_atfork(sz) size_t sz;
}
static void
-#ifdef _LIBC
-free_atfork(Void_t* mem, const Void_t *caller)
-#else
#if __STD_C
-free_atfork(Void_t* mem)
+free_atfork(Void_t* mem, const Void_t *caller)
#else
-free_atfork(mem) Void_t* mem;
-#endif
+free_atfork(mem, caller) Void_t* mem; const Void_t *caller;
#endif
{
Void_t *vptr = NULL;
@@ -4471,7 +4426,7 @@ free_atfork(mem) Void_t* mem;
(void)mutex_unlock(&ar_ptr->mutex);
}
-#endif /* defined(_LIBC) || defined(MALLOC_HOOKS) */
+#endif /* defined _LIBC || defined MALLOC_HOOKS */
diff --git a/malloc/malloc.h b/malloc/malloc.h
index 65381705df8..81966b856cb 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -39,34 +39,34 @@
*/
#if defined(__STDC__) || defined (__cplusplus)
-#include <stddef.h>
-#define __malloc_ptr_t void *
+# include <stddef.h>
+# define __malloc_ptr_t void *
#else
-#undef size_t
-#define size_t unsigned int
-#undef ptrdiff_t
-#define ptrdiff_t int
-#define __malloc_ptr_t char *
+# undef size_t
+# define size_t unsigned int
+# undef ptrdiff_t
+# define ptrdiff_t int
+# define __malloc_ptr_t char *
#endif
#ifdef _LIBC
/* Used by GNU libc internals. */
-#define __malloc_size_t size_t
-#define __malloc_ptrdiff_t ptrdiff_t
+# define __malloc_size_t size_t
+# define __malloc_ptrdiff_t ptrdiff_t
#endif
-#if defined (__STDC__) || defined (__cplusplus) || defined (__GNUC__)
-#define __MALLOC_P(args) args
+#if defined __STDC__ || defined __cplusplus || defined __GNUC__
+# define __MALLOC_P(args) args
#else
-#define __MALLOC_P(args) ()
+# define __MALLOC_P(args) ()
#endif
#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL ((__malloc_ptr_t) 0)
-#endif
+# ifdef __cplusplus
+# define NULL 0
+# else
+# define NULL ((__malloc_ptr_t) 0)
+# endif
#endif
#ifdef __cplusplus
@@ -77,7 +77,7 @@ extern "C" {
#ifdef _LIBC
/* In the GNU libc we rename the global variable
`__malloc_initialized' to `__libc_malloc_initialized'. */
-#define __malloc_initialized __libc_malloc_initialized
+# define __malloc_initialized __libc_malloc_initialized
#endif
extern int __malloc_initialized;
@@ -138,16 +138,16 @@ extern struct mallinfo mallinfo __MALLOC_P ((void));
/* SVID2/XPG mallopt options */
#ifndef M_MXFAST
-#define M_MXFAST 1 /* UNUSED in this malloc */
+# define M_MXFAST 1 /* UNUSED in this malloc */
#endif
#ifndef M_NLBLKS
-#define M_NLBLKS 2 /* UNUSED in this malloc */
+# define M_NLBLKS 2 /* UNUSED in this malloc */
#endif
#ifndef M_GRAIN
-#define M_GRAIN 3 /* UNUSED in this malloc */
+# define M_GRAIN 3 /* UNUSED in this malloc */
#endif
#ifndef M_KEEP
-#define M_KEEP 4 /* UNUSED in this malloc */
+# define M_KEEP 4 /* UNUSED in this malloc */
#endif
/* mallopt options that actually do something */
@@ -178,7 +178,7 @@ extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
malloc_get_state(). */
extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
-#ifdef __GLIBC__
+#if defined __GLIBC__ || defined MALLOC_HOOKS
/* Hooks for debugging versions. */
extern void (*__malloc_initialize_hook) __MALLOC_P ((void));
extern void (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
@@ -195,21 +195,6 @@ extern void (*__after_morecore_hook) __MALLOC_P ((void));
/* Activate a standard set of debugging hooks. */
extern void __malloc_check_init __MALLOC_P ((void));
-#else
-#ifdef MALLOC_HOOKS
-/* Hooks for debugging versions. */
-extern void (*__malloc_initialize_hook) __MALLOC_P ((void));
-extern void (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr));
-extern __malloc_ptr_t (*__malloc_hook) __MALLOC_P ((size_t __size));
-extern __malloc_ptr_t (*__realloc_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
- size_t __size));
-extern __malloc_ptr_t (*__memalign_hook) __MALLOC_P ((size_t __size,
- size_t __alignment));
-extern void (*__after_morecore_hook) __MALLOC_P ((void));
-
-/* Activate a standard set of debugging hooks. */
-extern void __malloc_check_init __MALLOC_P ((void));
-#endif
#endif
#ifdef __cplusplus
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 54c9dfffbd0..c1704d00eaf 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -73,8 +73,9 @@ tr_break ()
{
}
-static void tr_where __P ((const __ptr_t));
+static void tr_where __P ((const __ptr_t)) internal_function;
static void
+internal_function
tr_where (caller)
const __ptr_t caller;
{
diff --git a/malloc/obstack.h b/malloc/obstack.h
index ad6b830fcb9..49492eb73cb 100644
--- a/malloc/obstack.h
+++ b/malloc/obstack.h
@@ -379,6 +379,11 @@ __extension__ \
_obstack_newchunk (__o, __len); \
(void) 0; })
+#define obstack_empty_p(OBSTACK) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
+
#define obstack_grow(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
@@ -492,6 +497,9 @@ __extension__ \
#define obstack_room(h) \
(unsigned) ((h)->chunk_limit - (h)->next_free)
+#define obstack_empty_p(h) \
+ (h->chunk->prev == 0 && h->next_free - h->chunk->contents == 0)
+
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
so that we can avoid having void expressions
in the arms of the conditional expression.
diff --git a/manual/arith.texi b/manual/arith.texi
index 7f8c205ebbf..2e418838db3 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -414,13 +414,19 @@ This function returns the absolute value of the floating-point number
@deftypefunx float cabsf (complex float @var{z})
@deftypefunx {long double} cabsl (complex long double @var{z})
These functions return the absolute value of the complex number @var{z}.
-The compiler must support complex numbers to use these functions. (See
-also the function @code{hypot} in @ref{Exponents and Logarithms}.) The
+The compiler must support complex numbers to use these functions. The
value is:
@smallexample
sqrt (creal (@var{z}) * creal (@var{z}) + cimag (@var{z}) * cimag (@var{z}))
@end smallexample
+
+This function should always be used instead of the direct formula since
+using the simple straight-forward method can mean to loose accuracy. If
+one of the squared values is neglectable in size compared to the other
+value the result should be the same as the larger value. But squaring
+the value and afterwards using the square root function leads to
+unaccuracy. See @code{hypot} in @xref{Exponents and Logarithms}.
@end deftypefun
@node Normalization Functions
diff --git a/manual/conf.texi b/manual/conf.texi
index 4f9326e9d46..64591ee9f27 100644
--- a/manual/conf.texi
+++ b/manual/conf.texi
@@ -236,7 +236,7 @@ always defines this as @code{1}, on the assumption that you had to have
@deftypevr Macro {long int} _POSIX_VERSION
This constant represents the version of the POSIX.1 standard to which
the implementation conforms. For an implementation conforming to the
-1990 POSIX.1 standard, the value is the integer @code{199009L}.
+1995 POSIX.1 standard, the value is the integer @code{199506L}.
@code{_POSIX_VERSION} is always defined (in @file{unistd.h}) in any
POSIX system.
@@ -368,6 +368,294 @@ Inquire about the parameter corresponding to @code{CLOCKS_PER_SEC};
@pxref{Basic CPU Time}.
@comment unistd.h
+@comment GNU
+@item _SC_CHARCLASS_NAME_MAX
+Inquire about the parameter corresponding to maximal length allowed for
+a character class name in an extended locale specification. These
+extensions are not yet standardized and so this option is not standardized
+as well.
+
+@comment unistdh.h
+@comment POSIX.1
+@item _SC_REALTIME_SIGNALS
+Inquire about the parameter corresponding to @code{_POSIX_REALTIME_SIGNALS}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_PRIORITY_SCHEDULING
+Inquire about the parameter corresponding to @code{_POSIX_PRIORITY_SCHEDULING}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_TIMERS
+Inquire about the parameter corresponding to @code{_POSIX_TIMERS}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_ASYNCHRONOUS_IO
+Inquire about the parameter corresponding to @code{_POSIX_ASYNCHRONOUS_IO}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_PRIORITIZED_IO
+Inquire about the parameter corresponding to @code{_POSIX_PRIORITIZED_IO}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_SYNCHRONIZED_IO
+Inquire about the parameter corresponding to @code{_POSIX_SYNCHRONIZED_IO}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_FSYNC
+Inquire about the parameter corresponding to @code{_POSIX_FSYNC}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_MAPPED_FILES
+Inquire about the parameter corresponding to @code{_POSIX_MAPPED_FILES}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_MEMLOCK
+Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_MEMLOCK_RANGE
+Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK_RANGE}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_MEMORY_PROTECTION
+Inquire about the parameter corresponding to @code{_POSIX_MEMORY_PROTECTION}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_MESSAGE_PASSING
+Inquire about the parameter corresponding to @code{_POSIX_MESSAGE_PASSING}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_SEMAPHORES
+Inquire about the parameter corresponding to @code{_POSIX_SEMAPHORES}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_SHARED_MEMORY_OBJECTS
+Inquire about the parameter corresponding to
+@code{_POSIX_SHARED_MEMORY_OBJECTS}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_AIO_LISTIO_MAX
+Inquire about the parameter corresponding to @code{_POSIX_AIO_LISTIO_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_AIO_MAX
+Inquire about the parameter corresponding to @code{_POSIX_AIO_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_AIO_PRIO_DELTA_MAX
+Inquire the value by which a process can decrease its asynchronous I/O
+priority level from its own scheduling priority. This corresponds to the
+run-time invariant value @code{AIO_PRIO_DELTA_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_DELAYTIMER_MAX
+Inquire about the parameter corresponding to @code{_POSIX_DELAYTIMER_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_MQ_OPEN_MAX
+Inquire about the parameter corresponding to @code{_POSIX_MQ_OPEN_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_MQ_PRIO_MAX
+Inquire about the parameter corresponding to @code{_POSIX_MQ_PRIO_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_RTSIG_MAX
+Inquire about the parameter corresponding to @code{_POSIX_RTSIG_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_SEM_NSEMS_MAX
+Inquire about the parameter corresponding to @code{_POSIX_SEM_NSEMS_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_SEM_VALUE_MAX
+Inquire about the parameter corresponding to @code{_POSIX_SEM_VALUE_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_SIGQUEUE_MAX
+Inquire about the parameter corresponding to @code{_POSIX_SIGQUEUE_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_TIMER_MAX
+Inquire about the parameter corresponding to @code{_POSIX_TIMER_MAX}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII
+Inquire about the parameter corresponding to @code{_POSIX_PII}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_XTI
+Inquire about the parameter corresponding to @code{_POSIX_PII_XTI}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_SOCKET
+Inquire about the parameter corresponding to @code{_POSIX_PII_SOCKET}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_INTERNET
+Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_OSI
+Inquire about the parameter corresponding to @code{_POSIX_PII_OSI}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_SELECT
+Inquire about the parameter corresponding to @code{_POSIX_SELECT}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_UIO_MAXIOV
+Inquire about the parameter corresponding to @code{_POSIX_UIO_MAXIOV}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_INTERNET_STREAM
+Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_STREAM}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_INTERNET_DGRAM
+Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_DGRAM}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_OSI_COTS
+Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_COTS}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_OSI_CLTS
+Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_CLTS}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_PII_OSI_M
+Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_M}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _SC_T_IOV_MAX
+Inquire the value of the value associated with the @code{T_IOV_MAX}
+variable.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREADS
+Inquire about the parameter corresponding to @code{_POSIX_THREADS}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_SAFE_FUNCTIONS
+Inquire about the parameter corresponding to
+@code{_POSIX_THREAD_SAFE_FUNCTIONS}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_GETGR_R_SIZE_MAX
+Inquire about the parameter corresponding to @code{_POSIX_GETGR_R_SIZE_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_GETPW_R_SIZE_MAX
+Inquire about the parameter corresponding to @code{_POSIX_GETPW_R_SIZE_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_LOGIN_NAME_MAX
+Inquire about the parameter corresponding to @code{_POSIX_LOGIN_NAME_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_TTY_NAME_MAX
+Inquire about the parameter corresponding to @code{_POSIX_TTY_NAME_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_DESTRUCTOR_ITERATIONS
+Inquire about the parameter corresponding to
+@code{_POSIX_THREAD_DESTRUCTOR_ITERATIONS}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_KEYS_MAX
+Inquire about the parameter corresponding to @code{_POSIX_THREAD_KEYS_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_STACK_MIN
+Inquire about the parameter corresponding to @code{_POSIX_THREAD_STACK_MIN}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_THREADS_MAX
+Inquire about the parameter corresponding to @code{_POSIX_THREAD_THREADS_MAX}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_ATTR_STACKADDR
+Inquire about the parameter corresponding to
+@code{_POSIX_THREAD_ATTR_STACKADDR}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_ATTR_STACKSIZE
+Inquire about the parameter corresponding to
+@code{_POSIX_THREAD_ATTR_STACKSIZE}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_PRIORITY_SCHEDULING
+Inquire about the parameter corresponding to
+@code{_POSIX_THREAD_PRIORITY_SCHEDULING}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_PRIO_INHERIT
+Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_INHERIT}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_PRIO_PROTECT
+Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_PROTECT}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _SC_THREAD_PROCESS_SHARED
+Inquire about the parameter corresponding to
+@code{_POSIX_THREAD_PROCESS_SHARED}.
+
+@comment unistd.h
@comment POSIX.2
@item _SC_2_C_DEV
Inquire about whether the system has the POSIX.2 C compiler command,
@@ -465,6 +753,212 @@ support.
Inquire about the virtual memory page size of the machine.
@code{getpagesize} returns the same value.
@c @xref{XXX getpagesize}. !!! ???
+
+@comment unistd.h
+@comment GNU
+@item _SC_NPROCESSORS_CONF
+Inquire about number of configured processors.
+
+@comment unistd.h
+@comment GNU
+@item _SC_NPROCESSORS_ONLN
+Inquire about number of processors online.
+
+@comment unistd.h
+@comment GNU
+@item _SC_PHYS_PAGES
+Inquire about number of physical pages in the system.
+
+@comment unistd.h
+@comment GNU
+@item _SC_AVPHYS_PAGES
+Inquire about number of available physical pages in the system.
+
+@comment unistd.h
+@comment GNU
+@item _SC_ATEXIT_MAX
+Inquire about number of functions which can be registered as termination
+functions for @code{atexit}; @pxref{Cleanups on Exit}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_VERSION
+Inquire about the parameter corresponding to @code{_XOPEN_VERSION}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_XCU_VERSION
+Inquire about the parameter corresponding to @code{_XOPEN_XCU_VERSION}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_UNIX
+Inquire about the parameter corresponding to @code{_XOPEN_UNIX}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_CRYPT
+Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_ENH_I18N
+Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_SHM
+Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_XPG2
+Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_XPG3
+Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_XOPEN_XPG4
+Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_CHAR_BIT
+Inquire about number of bits in a variable of type @code{char}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_CHAR_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{char}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_CHAR_MIN
+Inquire about minimum value which can be stored in a variable of type
+@code{char}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_INT_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_INT_MIN
+Inquire about minimum value which can be stored in a variable of type
+@code{int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_LONG_BIT
+Inquire about number of bits in a variable of type @code{long int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_WORD_BIT
+Inquire about number of bits in a variable of a register word.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_MB_LEN_MAX
+Inquire the maximum length of a multi-byte representation of a wide
+character value.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_NZERO
+Inquire value used to internally represent the zero priority level for
+the process execution.
+
+@comment unistd.h
+@comment X/Open
+@item SC_SSIZE_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{ssize_t}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_SCHAR_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{signed char}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_SCHAR_MIN
+Inquire about minimum value which can be stored in a variable of type
+@code{signed char}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_SHRT_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{short int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_SHRT_MIN
+Inquire about minimum value which can be stored in a variable of type
+@code{short int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_UCHAR_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{unsigned char}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_UINT_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{unsigned int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_ULONG_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{unsigned long int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_USHRT_MAX
+Inquire about maximum value which can be stored in a variable of type
+@code{unsigned short int}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_NL_ARGMAX
+Inquire about the parameter corresponding to @code{NL_ARGMAX}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_NL_LANGMAX
+Inquire about the parameter corresponding to @code{NL_LANGMAX}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_NL_MSGMAX
+Inquire about the parameter corresponding to @code{NL_MSGMAX}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_NL_NMAX
+Inquire about the parameter corresponding to @code{NL_NMAX}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_NL_SETMAX
+Inquire about the parameter corresponding to @code{NL_SETMAX}.
+
+@comment unistd.h
+@comment X/Open
+@item _SC_NL_TEXTMAX
+Inquire about the parameter corresponding to @code{NL_TEXTMAX}.
@end table
@node Examples of Sysconf
@@ -522,6 +1016,23 @@ system you are using can go that far.
@table @code
@comment limits.h
@comment POSIX.1
+@item _POSIX_AIO_LISTIO_MAX
+The most restrictive limit permitted by POSIX for the maximum number of
+I/O operations that can be specified in a list I/O call. The value of
+this constant is @code{2}; thus you can add up to two new entries
+of the list of outstandard operations.
+
+@comment limits.h
+@comment POSIX.1
+@item _POSIX_AIO_MAX
+The most restrictive limit permitted by POSIX for the maximum number of
+outstanding asynchronous I/O operations. The value of this constant is
+@code{1}. So you cannot expect that you can issue more than one
+operation and immediately continue with the normal work, receiving the
+notifications asynchronously.
+
+@comment limits.h
+@comment POSIX.1
@item _POSIX_ARG_MAX
The value of this macro is the most restrictive limit permitted by POSIX
for the maximum combined length of the @var{argv} and @var{environ}
@@ -732,7 +1243,9 @@ particular file, call @code{pathconf} or @code{fpathconf}.
Here are the names for the POSIX minimum upper bounds for some of the
above parameters. The significance of these values is that you can
safely push to these limits without checking whether the particular
-system you are using can go that far.
+system you are using can go that far. In most cases GNU systems do not
+have these strict limitations. The actual limit should be requested if
+necessary.
@table @code
@comment limits.h
@@ -883,6 +1396,26 @@ Inquire about the value of @code{_POSIX_NO_TRUNC}.
@comment POSIX.1
@item _PC_VDISABLE
Inquire about the value of @code{_POSIX_VDISABLE}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _PC_SYNC_IO
+Inquire about the value of @code{_POSIX_SYNC_IO}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _PC_ASYNC_IO
+Inquire about the value of @code{_POSIX_ASYNC_IO}.
+
+@comment unistd.h
+@comment POSIX.1
+@item _PC_PRIO_IO
+Inquire about the value of @code{_POSIX_PRIO_IO}.
+
+@comment unistd.h
+@comment POSIX.1g
+@item _PC_SOCK_MAXBUF
+Inquire about the value of @code{_POSIX_PIPE_BUF}.
@end table
@node Utility Limits
@@ -1064,6 +1597,62 @@ Currently there is just one parameter you can read with @code{confstr}:
This parameter's value is the recommended default path for searching for
executable files. This is the path that a user has by default just
after logging in.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS_CFLAGS
+The returned string specifies which additionals flags must be given to
+the C compiler if a source is compiled using the
+@code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS_LDFLAGS
+The returned string specifies which additionals flags must be given to
+the linker if a source is compiled using the
+@code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS_LIBS
+The returned string specifies which additionals libraries must be linked
+to the application if a source is compiled using the
+@code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS_LINTFLAGS
+The returned string specifies which additionals flags must be given to
+the the lint tool if a source is compiled using the
+@code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS64_CFLAGS
+The returned string specifies which additionals flags must be given to
+the C compiler if a source is compiled using the
+@code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS64_LDFLAGS
+The returned string specifies which additionals flags must be given to
+the linker if a source is compiled using the
+@code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS64_LIBS
+The returned string specifies which additionals libraries must be linked
+to the application if a source is compiled using the
+@code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
+
+@comment unistd.h
+@comment Unix98
+@item _CS_LFS64_LINTFLAGS
+The returned string specifies which additionals flags must be given to
+the the lint tool if a source is compiled using the
+@code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
@end table
The way to use @code{confstr} without any arbitrary limit on string size
diff --git a/manual/creature.texi b/manual/creature.texi
index 9d9b451a948..2e0c62e1f72 100644
--- a/manual/creature.texi
+++ b/manual/creature.texi
@@ -71,7 +71,7 @@ included as well as the @w{ISO C}, POSIX.1, POSIX.2, and X/Open material.
@end defvr
@comment (none)
-@comment XOPEN
+@comment X/Open
@defvr Macro _XOPEN_SOURCE
@defvrx Macro _XOPEN_SOURCE_EXTENDED
If you define this macro, functionality described in the X/Open
@@ -91,11 +91,72 @@ all functionality described so far plus some new definitions from the
Single Unix specification, @w{version 2}.
@end defvr
+@comment (NONE)
+@comment X/Open
+@defvr Macro _LARGEFILE_SOURCE
+If this macro is defined some extra functions are available which
+rectify a few shortcomings in all previous standards. More concreten
+the functions @code{fseeko} and @code{ftello} are available. Without
+these functions the difference between the @w{ISO C} interface
+(@code{fseek}, @code{ftell}) and the low-level POSIX interface
+(@code{lseek}) would lead to problems.
+
+This macro was introduced as part of the Large File Support extension (LFS).
+@end defvr
+
+@comment (NONE)
+@comment X/Open
+@defvar Macro _LARGEFILE64_SOURCE
+If you define this macro an additional set of function gets available
+which enables to use on @w{32 bit} systems to use files of sizes beyond
+the usual limit of 2GB. This interface is not available if the system
+does not support files that large. On systems where the natural file
+size limit is greater than 2GB (i.e., on @w{64 bit} systems) the new
+functions are identical to the replaced functions.
+
+The new functionality is made available by a new set of types and
+functions which replace existing. The names of these new objects
+contain @code{64} to indicate the intention, e.g., @code{off_t}
+vs. @code{off64_t} and @code{fseeko} vs. @code{fseeko64}.
+
+This macro was introduced as part of the Large File Support extension
+(LFS). It is a transition interface for the time @w{64 bit} offsets are
+not generally used (see @code{_FILE_OFFSET_BITS}.
+@end defvar
+
+@comment (NONE)
+@comment X/Open
+@defvar _FILE_OFFSET_BITS
+This macro lets decide which file system interface shall be used, one
+replacing the other. While @code{_LARGEFILE64_SOURCE} makes the @w{64
+bit} interface available as an additional interface
+@code{_FILE_OFFSET_BITS} allows to use the @w{64 bit} interface to
+replace the old interface.
+
+If @code{_FILE_OFFSET_BITS} is undefined or if it is defined to the
+value @code{32} nothing changes. The @w{32 bit} interface is used and
+types like @code{off_t} have a size of @w{32 bits} on @w{32 bit}
+systems.
+
+If the macro is defined to the value @code{64} the large file interface
+replaces the old interface. I.e., the functions are not made available
+under different names as @code{_LARGEFILE64_SOURCE} does. Instead the
+old function names now reference the new functions, e.g., a call to
+@code{fseeko} now indeed calls @code{fseeko64}.
+
+This macro should only be selected if the system provides mechanisms for
+handling large files. On @w{64 bit} systems this macro has no effect
+since the @code{*64} functions are identical to the normal functions.
+
+This macro was introduced as part of the Large File Support extension
+(LFS).
+@end defvar
+
@comment (none)
@comment GNU
@defvr Macro _GNU_SOURCE
If you define this macro, everything is included: @w{ISO C}, POSIX.1,
-POSIX.2, BSD, SVID, X/Open, and GNU extensions. In the cases where
+POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions. In the cases where
POSIX.1 conflicts with BSD, the POSIX definitions take precedence.
If you want to get the full effect of @code{_GNU_SOURCE} but make the
diff --git a/manual/llio.texi b/manual/llio.texi
index 4c10b725784..23c5f767f13 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -32,6 +32,7 @@ directly.)
@menu
* Opening and Closing Files:: How to open and close file
descriptors.
+* Truncating Files:: Change the size of a file.
* I/O Primitives:: Reading and writing data.
* File Position Primitive:: Setting a descriptor's file
position.
@@ -41,6 +42,7 @@ directly.)
descriptors and streams.
* Waiting for I/O:: How to check for input or output
on multiple file descriptors.
+* Synchronizing I/O:: Making sure all I/O actions completed.
* Control Operations:: Various other operations on file
descriptors.
* Duplicating Descriptors:: Fcntl commands for duplicating
@@ -136,6 +138,14 @@ or @code{O_CREAT} is set and the file does not already exist.
@c !!! umask
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{open} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{open} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The @code{open} function is the underlying primitive for the @code{fopen}
and @code{freopen} functions, that create streams.
@end deftypefun
@@ -175,6 +185,14 @@ When all file descriptors associated with a pipe or FIFO have been closed,
any unread data is discarded.
@end itemize
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{close} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{close} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The normal return value from @code{close} is @code{0}; a value of @code{-1}
is returned in case of failure. The following @code{errno} error
conditions are defined for this function:
@@ -206,6 +224,73 @@ of trying to close its underlying file descriptor with @code{close}.
This flushes any buffered output and updates the stream object to
indicate that it is closed.
+
+@node Truncating Files
+@section Change the size of a file
+
+In some situations it is useful to explicitly determine the size of a
+file. Since the 4.2BSD days there is a function to truncate a file to
+at most a given number of bytes and POSIX defines one additional
+function. The prototypes for these functions are in @file{unistd.h}.
+
+@comment unistd.h
+@comment X/Open
+@deftypefun int truncate (const char *@var{name}, size_t @var{length})
+The @code{truncation} function truncates the file named by @var{name} to
+at most @var{length} bytes. I.e., if the file was larger before the
+extra bytes are stripped of. If the file was small or equal to
+@var{length} in size before nothing is done. The file must be writable
+by the user to perform this operation.
+
+The return value is zero is everything wnet ok. Otherwise the return
+value is @math{-1} and the global variable @var{errno} is set to:
+@table @code
+@item EACCES
+The file is not accessible to the user.
+@item EINVAL
+The @var{length} value is illegal.
+@item EISDIR
+The object named by @var{name} is a directory.
+@item ENOENT
+The file named by @var{name} does not exist.
+@item ENOTDIR
+One part of the @var{name} is not a directory.
+@end table
+
+This function was introduced in 4.2BSD but also was available in later
+@w{System V} systems. It is not added to POSIX since the authors felt
+it is only of marginally additional utility. See below.
+@end deftypefun
+
+@comment unistd.h
+@comment POSIX
+@deftypefun int ftruncate (int @var{fd}, size_t @var{length})
+The @code{ftruncate} function is similar to the @code{truncate}
+function. The main difference is that it takes a descriptor for an
+opened file instead of a file name to identify the object. The file
+must be opened for writing to successfully carry out the operation.
+
+The POSIX standard leaves it implementation defined what happens if the
+specified new @var{length} of the file is bigger than the original size.
+The @code{ftruncate} function might simply leave the file alone and do
+nothing or it can increase the size to the desired size. In this later
+case the extended area should be zero-filled. So using @code{ftruncate}
+is no reliable way to increase the file size but if it is possible it is
+probably the fastest way. The function also operates on POSIX shared
+memory segments if these are implemented by the system.
+
+On success the function returns zero. Otherwise it returns @math{-1}
+and set @var{errno} to one of these values:
+@table @code
+@item EBADF
+@var{fd} is no valid file descriptor or is not opened for writing.
+@item EINVAL
+The object referred to by @var{fd} does not permit this operation.
+@item EROFS
+The file is on a read-only file system.
+@end table
+@end deftypefun
+
@node I/O Primitives
@section Input and Output Primitives
@@ -297,6 +382,14 @@ orphaned. @xref{Job Control}, for more information about job control,
and @ref{Signal Handling}, for information about signals.
@end table
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{read} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{read} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The @code{read} function is the underlying primitive for all of the
functions that read from streams, such as @code{fgetc}.
@end deftypefun
@@ -419,6 +512,14 @@ macro @code{TEMP_FAILURE_RETRY}, as follows:
nbytes = TEMP_FAILURE_RETRY (write (desc, buffer, count));
@end smallexample
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{write} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{write} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The @code{write} function is the underlying primitive for all of the
functions that write to streams, such as @code{fputc}.
@end deftypefun
@@ -537,9 +638,18 @@ only for pipes and FIFOs, but in the GNU system, you always get
@code{ESPIPE} if the object is not seekable.)
@end table
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{lseek} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{lseek} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The @code{lseek} function is the underlying primitive for the
-@code{fseek}, @code{ftell} and @code{rewind} functions, which operate on
-streams instead of file descriptors.
+@code{fseek}, @code{fseeko}, @code{ftell}, @code{ftello} and
+@code{rewind} functions, which operate on streams instead of file
+descriptors.
@end deftypefun
You can have multiple descriptors for the same file if you open the file
@@ -1007,6 +1117,100 @@ There is another example showing the use of @code{select} to multiplex
input from multiple sockets in @ref{Server Example}.
+@node Synchronizing I/O
+@section Synchronizing I/O operations
+
+@cindex synchronizing
+In most modern operation systems the normal I/O operations are not
+executed synchronously. I.e., even if a @code{write} system call
+returns this does not mean the data is actually written to the media,
+e.g., the disk.
+
+In situations where synchronization points are necessary the user can
+use special functions which ensure that all operations finished before
+they return.
+
+@comment unistd.h
+@comment X/Open
+@deftypefun int sync (void)
+A call to this function will not return as long as there is data which
+that is not written to the device. All dirty buffers in the kernel will
+be written and so an overall consistent system can be achieved (if no
+other process in parallel writes data).
+
+A prototype for @code{sync} can be found in @file{unistd.h}.
+
+The return value is zero to indicate no error.
+@end deftypefun
+
+More often it is wanted that not all data in the system is committed.
+Programs want to ensure that data written to a given file are all
+committed and in this situation @code{sync} is overkill.
+
+@comment unistd.h
+@comment POSIX
+@deftypefun int fsync (int @var{fildes})
+The @code{fsync} can be used to make sure all data associated with the
+open file @var{fildes} is written to the device associated with the
+descriptor. The function call does not return unless all actions have
+finished.
+
+A prototype for @code{fsync} can be found in @file{unistd.h}.
+
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{fsync} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{fsync} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
+The return value of the function is zero if no error occured. Otherwise
+it is @math{-1} and the global variable @var{errno} is set to the
+following values:
+@table @code
+@item EBADF
+The descriptor @var{fildes} is not valid.
+
+@item EINVAL
+No synchronization is possible since the system does not implement this.
+@end table
+@end deftypefun
+
+Sometimes it is not even necessary to write all data associated with a
+file descriptor. E.g., in database files which do not change in size it
+is enough to write all the file content data to the device.
+Metainformation like the modification time etc. are not that important
+and leaving such information uncommitted does not prevent a successful
+recovering of the file in case of a problem.
+
+@comment unistd.h
+@comment POSIX
+@deftypefun int fdatasync (int @var{fildes})
+When a call to the @code{fdatasync} function returns it is maed sure
+that all of the file data is written to the device. For all pending I/O
+operations the parts guaranteeing data integrety finished.
+
+Not all systems implement the @code{fdatasync} operation. On systems
+missing this functionality @code{fdatasync} is emulated by a call to
+@code{fsync} since the performed actions are a superset of those
+required by @code{fdatasyn}.
+
+The prototype for @code{fdatasync} is in @file{unistd.h}.
+
+The return value of the function is zero if no error occured. Otherwise
+it is @math{-1} and the global variable @var{errno} is set to the
+following values:
+@table @code
+@item EBADF
+The descriptor @var{fildes} is not valid.
+
+@item EINVAL
+No synchronization is possible since the system does not implement this.
+@end table
+@end deftypefun
+
+
@node Control Operations
@section Control Operations on Files
@@ -1069,6 +1273,14 @@ Get process or process group ID to receive @code{SIGIO} signals.
Set process or process group ID to receive @code{SIGIO} signals.
@xref{Interrupt Input}.
@end table
+
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{fcntl} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{fcntl} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
@end deftypefun
diff --git a/manual/maint.texi b/manual/maint.texi
index 28182701036..e6fc47f8e1b 100644
--- a/manual/maint.texi
+++ b/manual/maint.texi
@@ -50,28 +50,21 @@ Here are some options that you should specify (if appropriate) when
you run @code{configure}:
@table @samp
-@item --with-gnu-ld
-Use this option if you plan to use GNU @code{ld} to link programs with
-the GNU C Library. (We strongly recommend that you do.) This option
-enables use of features that exist only in GNU @code{ld}; so if you
-configure for GNU @code{ld} you must use GNU @code{ld} @emph{every time}
-you link with the GNU C Library, and when building it.
-
-@item --with-gnu-as
-Use this option if you plan to use the GNU assembler, @code{gas}, when
-building the GNU C Library. On some systems, the library may not build
-properly if you do @emph{not} use @code{gas}.
-
-@item --with-gnu-binutils
-This option implies both @w{@samp{--with-gnu-ld}} and @w{@samp{--with-gnu-as}}.
-On systems where GNU tools are the system tools, there is no need to
-specify this option. These include GNU, GNU/Linux, and free BSD systems.
+@item --with-binutils=@var{directory}
+Use the binutils (assembler and linker) in @file{@var{directory}}, not
+the ones the C compiler would default to. You could use this option if
+the default binutils on your system cannot deal with all the constructs
+in the GNU C library. (@code{configure} will detect the problem and
+suppress these constructs, so the library will still be usable, but
+functionality may be lost---for example, you can not build a shared libc
+with old binutils.)
@c extra blank line makes it look better
@item --without-fp
@itemx --nfp
-Use this option if your computer lacks hardware floating-point support.
+Use this option if your computer lacks hardware floating-point support
+and your operating system does not emulate an FPU.
@item --prefix=@var{directory}
Install machine-independent data files in subdirectories of
@@ -1133,6 +1126,114 @@ extensions that they make and grant Carnegie Mellon the rights to
redistribute these changes.
@end quotation
+@item
+The code for the database library @file{libdb} comes from the 2.3
+release of Berkeley DB. That code is under the same copyright as 4.4 BSD
+and also:
+
+@quotation
+@display
+Copyright @copyright{} 1990, 1993, 1994, 1995, 1996, 1997
+Sleepycat Software. All rights reserved.
+@end display
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+@enumerate
+@item
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+@item
+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.
+@item
+Redistributions in any form must be accompanied by information on
+how to obtain complete source code for the DB software and any
+accompanying software that uses the DB software. The source code
+must either be included in the distribution or be available for no
+more than the cost of distribution plus a nominal fee, and must be
+freely redistributable under reasonable conditions. For an
+executable file, complete source code means the source code for all
+modules it contains. It does not mean source code for modules or
+files that typically accompany the operating system on which the
+executable file runs, e.g., standard library modules or system
+header files.
+@end enumerate
+
+@sc{this software is provided by sleepycat software ``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 sleepycat software 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.}
+
+@display
+Portions copyright @copyright{} 1995, 1996
+The President and Fellows of Harvard University.
+All rights reserved.
+@end display
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+@enumerate
+@item
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+@item
+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.
+@item
+All advertising materials mentioning features or use of this software
+must display the following acknowledgement:
+@quotation
+ This product includes software developed by Harvard University
+ and its contributors.
+@end quotation
+@item
+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.
+@end enumerate
+
+@sc{this software is provided by harvard and its 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 harvard or its 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.}
+
+@noindent
+For a license to use, redistribute or sell DB software under conditions
+other than those described above, or to purchase support for this
+software, please contact Sleepycat Software at
+
+@display
+ Sleepycat Software
+ 394 E. Riding Dr.
+ Carlisle, MA 01741
+ USA
+ +1-508-287-4781
+@end display
+
+or @email{db@@sleepycat.com}.
+
+@end quotation
+
@end itemize
@c @bye
diff --git a/manual/math.texi b/manual/math.texi
index 15a2075d336..fe9394b22de 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -1259,6 +1259,31 @@ $$\log(z) = \log(|z|) + i \arg(z)$$
@end iftex
@end deftypefun
+
+@comment complex.h
+@comment GNU
+@deftypefun {complex double} clog10 (complex double @var{z})
+@deftypefunx {complex float} clog10f (complex float @var{z})
+@deftypefunx {complex long double} clog10l (complex long double @var{z})
+These functions return the base 10 logarithm of the complex value
+@var{z}. Unlike the real value version @code{log} and its variants,
+@code{clog} has no limit for the range of its argument @var{z}.
+
+@noindent
+Mathematically this corresponds to the value
+
+@ifinfo
+@math{log (z) = log10 (cabs (z)) + I * carg (z)}
+@end ifinfo
+@iftex
+@tex
+$$\log_{10}(z) = \log_{10}(|z|) + i \arg(z)$$
+@end tex
+@end iftex
+
+This function is a GNU extension.
+@end deftypefun
+
@comment complex.h
@comment ISO
@deftypefun {complex double} csqrt (complex double @var{z})
@@ -1274,7 +1299,7 @@ the value of the argument.
@deftypefun {complex double} cpow (complex double @var{base}, complex double @var{power})
@deftypefunx {complex float} cpowf (complex float @var{base}, complex float @var{power})
@deftypefunx {complex long double} cpowl (complex long double @var{base}, complex long double @var{power})
-These functions return the complex value @var{BASE} raised to the power of
+These functions return the complex value @var{base} raised to the power of
@var{power}. This is computed as
@ifinfo
diff --git a/manual/process.texi b/manual/process.texi
index d382df5df10..43230154f61 100644
--- a/manual/process.texi
+++ b/manual/process.texi
@@ -62,6 +62,14 @@ possible to create the shell process, and otherwise is the status of the
shell process. @xref{Process Completion}, for details on how this
status code can be interpreted.
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{system} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{system} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
@pindex stdlib.h
The @code{system} function is declared in the header file
@file{stdlib.h}.
@@ -477,6 +485,14 @@ processes as well as processes that have terminated.
The status information from the child process is stored in the object
that @var{status-ptr} points to, unless @var{status-ptr} is a null pointer.
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{waitpid} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{waitpid} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The return value is normally the process ID of the child process whose
status is reported. If the @code{WNOHANG} option was specified and no
child process is waiting to be noticed, the value is zero. A value of
@@ -547,6 +563,14 @@ is exactly equivalent to:
@smallexample
waitpid (-1, &status, 0)
@end smallexample
+
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{wait} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{wait} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
@end deftypefun
@comment sys/wait.h
diff --git a/manual/signal.texi b/manual/signal.texi
index bc69019e639..79482298713 100644
--- a/manual/signal.texi
+++ b/manual/signal.texi
@@ -2927,6 +2927,14 @@ The function was interrupted by delivery of a signal.
If the signal causes program termination, @code{pause} doesn't return
(obviously).
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{pause} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{pause} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The @code{pause} function is declared in @file{unistd.h}.
@end deftypefun
diff --git a/manual/stdio.texi b/manual/stdio.texi
index 4c90b25447f..fbf218ebf37 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -895,7 +895,7 @@ The conversion specifications in a @code{printf} template string have
the general form:
@example
-% @var{flags} @var{width} @r{[} . @var{precision} @r{]} @var{type} @var{conversion}
+% @r{[} @var{param-no} @r{$]} @var{flags} @var{width} @r{[} . @var{precision} @r{]} @var{type} @var{conversion}
@end example
For example, in the conversion specifier @samp{%-10.8ld}, the @samp{-}
@@ -910,6 +910,33 @@ initial @samp{%} character followed in sequence by:
@itemize @bullet
@item
+An optional specification of the parameter used for this format.
+Normally the parameters to the @code{printf} function a assigned to the
+formats in the order of appearence in the format string. But in some
+situations (such as message translation) this is not desirable and this
+extension allows to specify and explicit parameter to be used.
+
+The @var{param-no} part of the format must be an integer in the range of
+1 to the maximum number of arguments present to the function call. Some
+implementations limit this number to a certainly upper bound. The exact
+limit can be retrieved by the following constant.
+
+@defvr Macro NL_ARGMAX
+The value of @code{ARGMAX} is the maximum value allowed for the
+specification of an positional parameter in a @code{printf} call. The
+actual value in effect at runtime can be retrieved by using
+@code{sysconf} using the @code{_SC_NL_ARGMAX} parameter @pxref{Sysconf
+Definition}.
+
+Some system have a quite low limit such as @math{9} for @w{System V}
+systems. The GNU C library has no real limit.
+@end defvr
+
+If any of the formats has a specification for the parameter position all
+of them in the format string shall have one. Otherwise the behaviour is
+undefined.
+
+@item
Zero or more @dfn{flag characters} that modify the normal behavior of
the conversion specification.
@cindex flag character (@code{printf})
diff --git a/manual/terminal.texi b/manual/terminal.texi
index fcd30a11aaf..7e0f9852202 100644
--- a/manual/terminal.texi
+++ b/manual/terminal.texi
@@ -1638,6 +1638,14 @@ The @var{filedes} is not associated with a terminal device.
The @code{tcdrain} function waits until all queued
output to the terminal @var{filedes} has been transmitted.
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{tcdrain} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{tcdrain} should be
+protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
The return value is normally zero. In the event of an error, a value
of @code{-1} is returned. The following @code{errno} error conditions
are defined for this function:
diff --git a/manual/time.texi b/manual/time.texi
index 7a5cd655c02..c2b2378da8c 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -1455,6 +1455,42 @@ On the GNU system, it is safe to use @code{sleep} and @code{SIGALRM} in
the same program, because @code{sleep} does not work by means of
@code{SIGALRM}.
+@comment time.h
+@comment POSIX.1
+@deftypefun int nanosleep (const struct timespec *@var{requested_time}, struct timespec *@var{remaining})
+If the resolution of seconds is not enough the @code{nanosleep} function
+can be used. As the name suggests the sleeping period can be specified
+in nanoseconds. The actual period of waiting time might be longer since
+the requested time in the @var{requested_time} parameter is rounded up
+to the next integer multiple of the actual resolution of the system.
+
+If the function returns because the time has elapsed the return value is
+zero. If the function return @math{-1} the global variable @var{errno}
+is set to the following values:
+
+@table @code
+@item EINTR
+The call was interrupted because a signal was delivered to the thread.
+If the @var{remaining} parameter is not the null pointer the structure
+pointed to by @var{remaining} is updated to contain the remaining time.
+
+@item EINVAL
+The nanosecond value in the @var{requested_time} parameter contains an
+illegal value. Either the value is negative or greater than or equal to
+1000 million.
+@end table
+
+This function is a cancelation point in multi-threaded programs. This
+is a problem if the thread allocates some resources (like memory, file
+descriptors, semaphores or whatever) at the time @code{nanosleep} is
+called. If the thread gets canceled these resources stay allocated
+until the program ends. To avoid this calls to @code{nanosleep} should
+be protected using cancelation handlers.
+@c ref pthread_cleanup_push / pthread_cleanup_pop
+
+The @code{nanosleep} function is declared in @file{time.h}.
+@end deftypefun
+
@node Resource Usage
@section Resource Usage
diff --git a/math/Makefile b/math/Makefile
index bc54d57c43f..d7525d084d2 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -23,7 +23,7 @@ subdir := math
# Installed header files.
headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
bits/nan.h fpu_control.h complex.h bits/cmathcalls.h \
- fenv.h bits/fenv.h bits/mathdef.h
+ fenv.h bits/fenv.h bits/mathdef.h tgmath.h
# Internal header files.
distribute := math_private.h machine/asm.h machine/endian.h
@@ -39,7 +39,6 @@ extra-libs-others = $(extra-libs)
libm-map := libm.map
libm-support = k_standard s_lib_version s_matherr s_signgam \
- s_lrint s_llrint s_lround s_llround \
fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \
ftestexcept fegetround fesetround fegetenv feholdexcpt \
fesetenv feupdateenv
@@ -49,8 +48,8 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
k_cos k_rem_pio2 k_sin k_tan s_asinh s_atan s_cbrt \
s_ceil s_copysign s_cos s_erf s_expm1 s_fabs s_finite \
s_floor s_frexp s_ilogb s_ldexp s_log1p s_logb \
- s_modf s_nextafter s_rint s_scalbn s_significand \
- s_sin s_tan s_tanh w_acos w_acosh w_asin \
+ s_modf s_nextafter s_nextafterx s_rint s_scalbn s_scalbln \
+ s_significand s_sin s_tan s_tanh w_acos w_acosh w_asin \
w_atan2 w_atanh w_cosh w_drem w_exp w_exp2 w_fmod w_gamma \
w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r \
w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt \
@@ -58,7 +57,8 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
s_remquo s_log2 s_exp2 s_round s_nearbyint s_sincos \
conj cimag creal cabs carg s_cexp s_csinh s_ccosh s_clog \
s_catan s_casin s_ccos s_csin s_ctan s_ctanh s_cacos \
- s_casinh s_cacosh s_catanh s_csqrt s_cpow s_cproj
+ s_casinh s_cacosh s_catanh s_csqrt s_cpow s_cproj s_clog10 \
+ s_fma s_lrint s_llrint s_lround s_llround
libm-routines = $(libm-support) $(libm-calls) \
$(patsubst %_rf,%f_r,$(libm-calls:=f)) \
$(long-m-$(long-double-fcts))
diff --git a/math/bits/cmathcalls.h b/math/bits/cmathcalls.h
index d94e7649306..ca0dfe1b9cd 100644
--- a/math/bits/cmathcalls.h
+++ b/math/bits/cmathcalls.h
@@ -90,6 +90,11 @@ __MATHCALL (cexp, (_Mdouble_complex_ __z));
/* Natural logarithm of Z. */
__MATHCALL (clog, (_Mdouble_complex_ __z));
+#ifdef __USE_GNU
+/* The base 10 logarithm is not defined by the standard but to implement
+ the standard C++ library it is handy. */
+__MATHCALL (clog10, (_Mdouble_complex_ __z));
+#endif
/* Power functions. */
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index e0bf1008d39..dacc264136a 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -232,6 +232,9 @@ __MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+#ifdef __USE_ISOC9X
+__MATHCALLX (nextafterx,, (_Mdouble_ __x, long double __y), (__const__));
+#endif
/* Return the remainder of integer divison X / Y with infinite precision. */
__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
@@ -240,13 +243,16 @@ __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
/* Return X times (2 to the Nth power). */
-__MATHCALL (scalbn,, (_Mdouble_ __x, long int __n));
+__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
/* Return the binary exponent of X, which must be nonzero. */
__MATHDECL (int,ilogb,, (_Mdouble_ __x));
#endif
#ifdef __USE_ISOC9X
+/* Return X times (2 to the Nth power). */
+__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
+
/* Round X to integral valuein floating-point format using current
rounding direction, but do not raise inexact exception. */
__MATHCALL (nearbyint,, (_Mdouble_ __x));
@@ -265,6 +271,19 @@ __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
+/* Conversion functions. */
+
+/* Round X to nearest integral value according to current rounding
+ direction. */
+__MATHDECL (long int, lrint,, (_Mdouble_ __x));
+__MATHDECL (long long int, llrint,, (_Mdouble_ __x));
+
+/* Round X to nearest integral value, rounding halfway cases away from
+ zero. */
+__MATHDECL (long int, lround,, (_Mdouble_ __x));
+__MATHDECL (long long int, llround,, (_Mdouble_ __x));
+
+
/* Return positive difference between X and Y. */
__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
@@ -282,4 +301,8 @@ __MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
/* Test for negative number. */
__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
__attribute__ ((__const__));
+
+
+/* Multiply-add function computed as a ternary operation. */
+__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
#endif /* Use ISO C 9X. */
diff --git a/math/libm-test.c b/math/libm-test.c
index 2075adcb598..c24b5f0f833 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -4301,6 +4301,160 @@ clog_test (void)
static void
+clog10_test (void)
+{
+ __complex__ MATHTYPE result;
+
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, 0));
+ check_isinfn_exc ("real(clog10(-0 + i0)) = -Inf plus divide-by-zero exception",
+ __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
+ check ("imag(clog10(-0 + i0)) = pi plus divide-by-zero exception",
+ __imag__ result, M_PI);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, minus_zero));
+ check_isinfn_exc ("real(clog10(-0 - i0)) = -Inf plus divide-by-zero exception",
+ __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
+ check ("imag(clog10(-0 - i0)) = -pi plus divide-by-zero exception",
+ __imag__ result, -M_PI);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (0, 0));
+ check_isinfn_exc ("real(clog10(0 + i0)) = -Inf plus divide-by-zero exception",
+ __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
+ check ("imag(clog10(0 + i0)) = 0 plus divide-by-zero exception",
+ __imag__ result, 0);
+ result = FUNC(clog10) (BUILD_COMPLEX (0, minus_zero));
+ check_isinfn_exc ("real(clog10(0 - i0)) = -Inf plus divide-by-zero exception",
+ __real__ result, DIVIDE_BY_ZERO_EXCEPTION);
+ check ("imag(clog10(0 - i0)) = -0 plus divide-by-zero exception",
+ __imag__ result, minus_zero);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, plus_infty));
+ check_isinfp ("real(clog10(-Inf + i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(-Inf + i Inf)) = 3*pi/4", __imag__ result, M_PI - M_PI_4);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, minus_infty));
+ check_isinfp ("real(clog10(-Inf - i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(-Inf - i Inf)) = -3*pi/4", __imag__ result, M_PI_4 - M_PI);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, plus_infty));
+ check_isinfp ("real(clog10(+Inf + i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
+ result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, minus_infty));
+ check_isinfp ("real(clog10(+Inf - i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (0, plus_infty));
+ check_isinfp ("real(clog10(0 + i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+ result = FUNC(clog10) (BUILD_COMPLEX (3, plus_infty));
+ check_isinfp ("real(clog10(3 + i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, plus_infty));
+ check_isinfp ("real(clog10(-0 + i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+ result = FUNC(clog10) (BUILD_COMPLEX (-3, plus_infty));
+ check_isinfp ("real(clog10(-3 + i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(-3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+ result = FUNC(clog10) (BUILD_COMPLEX (0, minus_infty));
+ check_isinfp ("real(clog10(0 - i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+ result = FUNC(clog10) (BUILD_COMPLEX (3, minus_infty));
+ check_isinfp ("real(clog10(3 - i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, minus_infty));
+ check_isinfp ("real(clog10(-0 - i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+ result = FUNC(clog10) (BUILD_COMPLEX (-3, minus_infty));
+ check_isinfp ("real(clog10(-3 - i Inf)) = +Inf", __real__ result);
+ check ("imag(clog10(-3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, 0));
+ check_isinfp ("real(clog10(-Inf + i0)) = +Inf", __real__ result);
+ check ("imag(clog10(-Inf + i0)) = pi", __imag__ result, M_PI);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, 1));
+ check_isinfp ("real(clog10(-Inf + i1)) = +Inf", __real__ result);
+ check ("imag(clog10(-Inf + i1)) = pi", __imag__ result, M_PI);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, minus_zero));
+ check_isinfp ("real(clog10(-Inf - i0)) = +Inf", __real__ result);
+ check ("imag(clog10(-Inf - i0)) = -pi", __imag__ result, -M_PI);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, -1));
+ check_isinfp ("real(clog10(-Inf - i1)) = +Inf", __real__ result);
+ check ("imag(clog10(-Inf - i1)) = -pi", __imag__ result, -M_PI);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, 0));
+ check_isinfp ("real(clog10(+Inf + i0)) = +Inf", __real__ result);
+ check ("imag(clog10(+Inf + i0)) = 0", __imag__ result, 0);
+ result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, 1));
+ check_isinfp ("real(clog10(+Inf + i1)) = +Inf", __real__ result);
+ check ("imag(clog10(+Inf + i1)) = 0", __imag__ result, 0);
+ result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, minus_zero));
+ check_isinfp ("real(clog10(+Inf - i0)) = +Inf", __real__ result);
+ check ("imag(clog10(+Inf - i0)) = -0", __imag__ result, minus_zero);
+ result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, -1));
+ check_isinfp ("real(clog10(+Inf - i1)) = +Inf", __real__ result);
+ check ("imag(clog10(+Inf - i1)) = -0", __imag__ result, minus_zero);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, nan_value));
+ check_isinfp ("real(clog10(+Inf + i NaN)) = +Inf", __real__ result);
+ check_isnan ("imag(clog10(+Inf + i NaN)) = NaN", __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, nan_value));
+ check_isinfp ("real(clog10(-Inf + i NaN)) = +Inf", __real__ result);
+ check_isnan ("imag(clog10(-Inf + i NaN)) = NaN", __imag__ result);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (nan_value, plus_infty));
+ check_isinfp ("real(clog10(NaN + i Inf)) = +Inf", __real__ result);
+ check_isnan ("imag(clog10(NaN + i Inf)) = NaN", __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (nan_value, minus_infty));
+ check_isinfp ("real(clog10(NaN - i Inf)) = +Inf", __real__ result);
+ check_isnan ("imag(clog10(NaN - i Inf)) = NaN", __imag__ result);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (0, nan_value));
+ check_isnan_maybe_exc ("real(clog10(0 + i NaN)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(0 + i NaN)) = NaN plus maybe invalid exception",
+ __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (3, nan_value));
+ check_isnan_maybe_exc ("real(clog10(3 + i NaN)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(3 + i NaN)) = NaN plus maybe invalid exception",
+ __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, nan_value));
+ check_isnan_maybe_exc ("real(clog10(-0 + i NaN)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(-0 + i NaN)) = NaN plus maybe invalid exception",
+ __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (-3, nan_value));
+ check_isnan_maybe_exc ("real(clog10(-3 + i NaN)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(-3 + i NaN)) = NaN plus maybe invalid exception",
+ __imag__ result);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (nan_value, 0));
+ check_isnan_maybe_exc ("real(clog10(NaN + i0)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(NaN + i0)) = NaN plus maybe invalid exception",
+ __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (nan_value, 5));
+ check_isnan_maybe_exc ("real(clog10(NaN + i5)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(NaN + i5)) = NaN plus maybe invalid exception",
+ __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (nan_value, minus_zero));
+ check_isnan_maybe_exc ("real(clog10(NaN - i0)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(NaN - i0)) = NaN plus maybe invalid exception",
+ __imag__ result);
+ result = FUNC(clog10) (BUILD_COMPLEX (nan_value, -5));
+ check_isnan_maybe_exc ("real(clog10(NaN - i5)) = NaN plus maybe invalid exception",
+ __real__ result, INVALID_EXCEPTION);
+ check_isnan ("imag(clog10(NaN - i5)) = NaN plus maybe invalid exception",
+ __imag__ result);
+
+ result = FUNC(clog10) (BUILD_COMPLEX (nan_value, nan_value));
+ check_isnan ("real(clog10(NaN + i NaN)) = NaN", __real__ result);
+ check_isnan ("imag(clog10(NaN + i NaN)) = NaN", __imag__ result);
+}
+
+
+static void
csqrt_test (void)
{
__complex__ MATHTYPE result;
@@ -4539,43 +4693,52 @@ round_test (void)
static void
lround_test (void)
{
- check_long ("lround(0) = 0", lround (0), 0);
- check_long ("lround(-0) = 0", lround (minus_zero), 0);
- check_long ("lround(0.2) = 0", lround (0.2), 0.0);
- check_long ("lround(-0.2) = 0", lround (-0.2), 0);
- check_long ("lround(0.5) = 1", lround (0.5), 1);
- check_long ("lround(-0.5) = -1", lround (-0.5), -1);
- check_long ("lround(0.8) = 1", lround (0.8), 1);
- check_long ("lround(-0.8) = -1", lround (-0.8), -1);
- check_long ("lround(1.5) = 2", lround (1.5), 2);
- check_long ("lround(-1.5) = -2", lround (-1.5), -2);
- check_long ("lround(2097152.5) = 2097153", lround (2097152.5), 2097153);
- check_long ("lround(-2097152.5) = -2097153", lround (-2097152.5),
+ check_long ("lround(0) = 0", FUNC(lround) (0), 0);
+ check_long ("lround(-0) = 0", FUNC(lround) (minus_zero), 0);
+ check_long ("lround(0.2) = 0", FUNC(lround) (0.2), 0.0);
+ check_long ("lround(-0.2) = 0", FUNC(lround) (-0.2), 0);
+ check_long ("lround(0.5) = 1", FUNC(lround) (0.5), 1);
+ check_long ("lround(-0.5) = -1", FUNC(lround) (-0.5), -1);
+ check_long ("lround(0.8) = 1", FUNC(lround) (0.8), 1);
+ check_long ("lround(-0.8) = -1", FUNC(lround) (-0.8), -1);
+ check_long ("lround(1.5) = 2", FUNC(lround) (1.5), 2);
+ check_long ("lround(-1.5) = -2", FUNC(lround) (-1.5), -2);
+ check_long ("lround(22514.5) = 22514", FUNC(lround) (1.5), 2);
+ check_long ("lround(-22514.5) = -22514", FUNC(lround) (-1.5), -2);
+#ifndef TEST_FLOAT
+ check_long ("lround(2097152.5) = 2097153", FUNC(lround) (2097152.5),
+ 2097153);
+ check_long ("lround(-2097152.5) = -2097153", FUNC(lround) (-2097152.5),
-2097153);
+#endif
}
static void
llround_test (void)
{
- check_longlong ("llround(0) = 0", llround (0), 0);
- check_longlong ("llround(-0) = 0", llround (minus_zero), 0);
- check_longlong ("llround(0.2) = 0", llround (0.2), 0.0);
- check_longlong ("llround(-0.2) = 0", llround (-0.2), 0);
- check_longlong ("llround(0.5) = 1", llround (0.5), 1);
- check_longlong ("llround(-0.5) = -1", llround (-0.5), -1);
- check_longlong ("llround(0.8) = 1", llround (0.8), 1);
- check_longlong ("llround(-0.8) = -1", llround (-0.8), -1);
- check_longlong ("llround(1.5) = 2", llround (1.5), 2);
- check_longlong ("llround(-1.5) = -2", llround (-1.5), -2);
+ check_longlong ("llround(0) = 0", FUNC(llround) (0), 0);
+ check_longlong ("llround(-0) = 0", FUNC(llround) (minus_zero), 0);
+ check_longlong ("llround(0.2) = 0", FUNC(llround) (0.2), 0.0);
+ check_longlong ("llround(-0.2) = 0", FUNC(llround) (-0.2), 0);
+ check_longlong ("llround(0.5) = 1", FUNC(llround) (0.5), 1);
+ check_longlong ("llround(-0.5) = -1", FUNC(llround) (-0.5), -1);
+ check_longlong ("llround(0.8) = 1", FUNC(llround) (0.8), 1);
+ check_longlong ("llround(-0.8) = -1", FUNC(llround) (-0.8), -1);
+ check_longlong ("llround(1.5) = 2", FUNC(llround) (1.5), 2);
+ check_longlong ("llround(-1.5) = -2", FUNC(llround) (-1.5), -2);
+ check_longlong ("llround(22514.5) = 22514", FUNC(llround) (1.5), 2);
+ check_longlong ("llround(-22514.5) = -22514", FUNC(llround) (-1.5), -2);
+#ifndef TEST_FLOAT
check_longlong ("llround(2097152.5) = 2097153",
- llround (2097152.5), 2097153);
+ FUNC(llround) (2097152.5), 2097153);
check_longlong ("llround(-2097152.5) = -2097153",
- llround (-2097152.5), -2097153);
+ FUNC(llround) (-2097152.5), -2097153);
check_longlong ("llround(34359738368.5) = 34359738369",
- llround (34359738368.5), 34359738369ll);
+ FUNC(llround) (34359738368.5), 34359738369ll);
check_longlong ("llround(-34359738368.5) = -34359738369",
- llround (-34359738368.5), -34359738369ll);
+ FUNC(llround) (-34359738368.5), -34359738369ll);
+#endif
}
@@ -4962,6 +5125,7 @@ main (int argc, char *argv[])
ccos_test ();
ccosh_test ();
clog_test ();
+ clog10_test ();
cacos_test ();
cacosh_test ();
casin_test ();
diff --git a/math/libm.map b/math/libm.map
index 2a1aa6cfbec..296d55d6759 100644
--- a/math/libm.map
+++ b/math/libm.map
@@ -23,6 +23,7 @@ GLIBC_2.0 {
fdim; fdimf; fdiml;
finite; finitef; finitel;
floor; floorf; floorl;
+ fma; fmaf; fmal;
fmax; fmaxf; fmaxl;
fmin; fminf; fminl;
fmod; fmodf; fmodl;
@@ -47,15 +48,19 @@ GLIBC_2.0 {
nan; nanf; nanl;
nearbyint; nearbyintf; nearbyintl;
nextafter; nextafterf; nextafterl;
+ nextafterx; nextafterxf; nextafterxl;
pow; powf; powl;
remainder; remainderf; remainderl;
remquo; remquof; remquol;
rint; rintf; rintl;
- lrint; llrint;
+ lrint; lrintf; lrintl;
+ llrint; llrintf; llrintl;
round; roundf; roundl;
- lround; llround;
+ lround; lroundf; lroundl;
+ llround; llroundf; llroundl;
scalb; scalbf; scalbl;
scalbn; scalbnf; scalbnl;
+ scalbln; scalblnf; scalblnl;
significand; significandf; significandl;
sin; sinf; sinl;
sincos; sincosf; sincosl;
@@ -82,6 +87,8 @@ GLIBC_2.0 {
cexp; cexpf; cexpl;
cimag; cimagf; cimagl;
clog; clogf; clogl;
+ clog10; clog10f; clog10l;
+ __clog10; __clog10f; __clog10l;
conj; conjf; conjl;
cpow; cpowf; cpowl;
cproj; cprojf; cprojl;
diff --git a/math/math.h b/math/math.h
index 762ccbe4095..51055849ce9 100644
--- a/math/math.h
+++ b/math/math.h
@@ -131,6 +131,18 @@ extern int signgam;
else `float_t' and `double_t' are unspecified
INFINITY representation of the infinity value of type `float_t'
+
+ FP_FAST_FMA
+ FP_FAST_FMAF
+ FP_FAST_FMAL
+ If defined it indicates that the the `fma' function
+ generally executes about as fast as a multiply and an add.
+ This macro is defined only iff the `fma' function is
+ implemented directly with a hardware multiply-add instructions.
+
+ FP_ILOGB0 Expands to a value returned by `ilogb (0.0)'.
+ FP_ILOGBNAN Expands to a value returned by `ilogb (NAN)'.
+
*/
# include <bits/mathdef.h>
@@ -181,19 +193,6 @@ enum
: sizeof (x) == sizeof (double) ? \
__isnan (x) : __isnanl (x))
-
-/* Conversion functions. */
-
-/* Round X to nearest integral value according to current rounding
- direction. */
-extern long int lrint __P ((long double __x));
-extern long long int llrint __P ((long double __x));
-
-/* Round X to nearest integral value, rounding halfway cases away from
- zero. */
-extern long int lround __P ((long double __x));
-extern long long int llround __P ((long double __x));
-
#endif /* Use ISO C 9X. */
#ifdef __USE_MISC
diff --git a/math/test-double.c b/math/test-double.c
index 1f4ff8e0d03..c2e7dc92b3e 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -23,6 +23,7 @@
#define MATHCONST(x) x
#define CHOOSE(Clongdouble,Cdouble,Cfloat) Cdouble
#define PRINTF_EXPR "e"
+#define TEST_DOUBLE 1
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES
diff --git a/math/test-float.c b/math/test-float.c
index de918a38860..849067c8da7 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -23,6 +23,7 @@
#define MATHCONST(x) x
#define CHOOSE(Clongdouble,Cdouble,Cfloat) Cfloat
#define PRINTF_EXPR "e"
+#define TEST_FLOAT 1
#ifndef __NO_MATH_INLINES
# define __NO_MATH_INLINES
diff --git a/math/test-idouble.c b/math/test-idouble.c
index 614f10feb48..3039ccf5b47 100644
--- a/math/test-idouble.c
+++ b/math/test-idouble.c
@@ -24,6 +24,7 @@
#define MATHCONST(x) x
#define CHOOSE(Clongdouble,Cdouble,Cfloat) Cdouble
#define PRINTF_EXPR "e"
+#define TEST_DOUBLE 1
#define TEST_INLINE
#ifdef __NO_MATH_INLINES
diff --git a/math/test-ifloat.c b/math/test-ifloat.c
index 05e5de62ffd..d6f96f8622c 100644
--- a/math/test-ifloat.c
+++ b/math/test-ifloat.c
@@ -23,7 +23,8 @@
#define MATHCONST(x) x
#define CHOOSE(Clongdouble,Cdouble,Cfloat) Cfloat
#define PRINTF_EXPR "e"
-#define TEST_INLINE
+#define TEST_FLOAT 1
+#define TEST_INLINE 1
#ifdef __NO_MATH_INLINES
# undef __NO_MATH_INLINES
diff --git a/math/tgmath.h b/math/tgmath.h
new file mode 100644
index 00000000000..4c7d957b37c
--- /dev/null
+++ b/math/tgmath.h
@@ -0,0 +1,312 @@
+/* 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library 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. */
+
+/*
+ * ISO C 9X Standard: 7.9 Type-generic math <tgmath.h>
+ */
+
+#ifndef _TGMATH_H
+#define _TGMATH_H 1
+
+/* Include the needed headers. */
+#include <math.h>
+#include <complex.h>
+
+
+/* Since `complex' is currently not really implemented in most C compilers
+ and if it is implemented, the implementations differ. This makes it
+ quite difficult to write a generic implementation of this header. We
+ do not try this for now and instead concentrate only on GNU CC. Once
+ we have more information support for other compilers might follow. */
+
+#if defined __GNUC__ && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+/* We have two kinds of generic macros: to support functions which are
+ only defined on real valued parameters and those which are defined
+ for complex functions as well. */
+# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
+ (__extension__ (sizeof (__real__ (Val)) == sizeof (long double) \
+ ? Fct##l (Val) \
+ : (sizeof (__real__ (Val)) == sizeof (double) \
+ ? Fct (Val) \
+ : Fct##f (Val))))
+
+# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
+ (__extension__ (sizeof (__real__ (Val1)) == sizeof (long double) \
+ ? Fct##l (Val1, Val2) \
+ : (sizeof (__real__ (Val1)) == sizeof (double) \
+ ? Fct (Val1, Val2) \
+ : Fct##f (Val1, Val2))))
+
+# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
+ (__extension__ (sizeof (Val1) == sizeof (long double) \
+ || sizeof (Val2) == sizeof (long double) \
+ ? Fct##l (Val1, Val2) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ ? Fct (Val1, Val2) \
+ : Fct##f (Val1, Val2))))
+
+# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
+ (__extension__ (sizeof (Val1) == sizeof (long double) \
+ || sizeof (Val2) == sizeof (long double) \
+ ? Fct##l (Val1, Val2, Val3) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ ? Fct (Val1, Val2, Val3) \
+ : Fct##f (Val1, Val2, Val3))))
+
+# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
+ (__extension__ (sizeof (__real__ (Val)) == sizeof (long double) \
+ ? (sizeof (__real__ (Val)) == sizeof (Val) \
+ ? Fct##l (Val) \
+ : Cfct##l (Val)) \
+ : (sizeof (__real__ (Val)) == sizeof (double) \
+ ? (sizeof (__real__ (Val)) == sizeof (Val) \
+ ? Fct (Val) \
+ : Cfct (Val)) \
+ : (sizeof (__real__ (Val)) == sizeof (Val) \
+ ? Fct##f (Val) \
+ : Cfct##f (Val)))))
+
+# define __TGMATH_UNARY_IMAG_ONLY(Val, Fct) \
+ (__extension__ (sizeof (Val) == sizeof (__complex__ long double) \
+ ? Fct##l (Val) \
+ : (sizeof (Val) == sizeof (__complex__ double) \
+ ? Fct (Val) \
+ : Fct##f (Val))))
+
+# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
+ (__extension__ (sizeof (__real__ (Val1)) == sizeof (long double) \
+ || sizeof (__real__ (Val2)) == sizeof (long double) \
+ ? (sizeof (__real__ (Val1)) == sizeof (Val1) \
+ && sizeof (__real__ (Val2)) == sizeof (Val2) \
+ ? Fct##l (Val1, Val2) \
+ : Cfct##l (Val1, Val2)) \
+ : (sizeof (__real__ (Val1)) == sizeof (double) \
+ || sizeof (__real__ (Val2)) == sizeof (double) \
+ ? (sizeof (__real__ (Val1)) == sizeof (Val1) \
+ && sizeof (__real__ (Val2)) == sizeof (Val2) \
+ ? Fct (Val1, Val2) \
+ : Cfct (Val1, Val2)) \
+ : (sizeof (__real__ (Val1)) == sizeof (Val1) \
+ && sizeof (__real__ (Val2)) == sizeof (Val2) \
+ ? Fct##f (Val1, Val2) \
+ : Cfct##f (Val1, Val2)))))
+#else
+# error "Unsupported compiler; you cannot use <tgmath.h>"
+#endif
+
+
+/* Unary functions defined for real and complex values. */
+
+
+/* Trigonometric functions. */
+
+/* Arc cosine of X. */
+#define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
+/* Arc sine of X. */
+#define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
+/* Arc tangent of X. */
+#define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
+/* Arc tangent of Y/X. */
+#define atan2(Val) __TGMATH_UNARY_REAL_ONLY (Val, atan2)
+
+/* Cosine of X. */
+#define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
+/* Sine of X. */
+#define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
+/* Tangent of X. */
+#define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
+
+
+/* Hyperbolic functions. */
+
+/* Hyperbolic arc cosine of X. */
+#define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
+/* Hyperbolic arc sine of X. */
+#define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
+/* Hyperbolic arc tangent of X. */
+#define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
+
+/* Hyperbolic cosine of X. */
+#define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
+/* Hyperbolic sine of X. */
+#define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
+/* Hyperbolic tangent of X. */
+#define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
+
+
+/* Exponential and logarithmic functions. */
+
+/* Exponential function of X. */
+#define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
+
+/* Break VALUE into a normalized fraction and an integral power of 2. */
+#define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
+
+/* X times (two to the EXP power). */
+#define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
+
+/* Natural logarithm of X. */
+#define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
+
+/* Base-ten logarithm of X. */
+#define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10)
+
+/* Return exp(X) - 1. */
+#define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
+
+/* Return log(1 + X). */
+#define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
+
+/* Return the base 2 signed integral exponent of X. */
+#define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
+
+/* Compute base-2 exponential of X. */
+#define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
+
+/* Compute base-2 logarithm of X. */
+#define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
+
+
+/* Power functions. */
+
+/* Return X to the Y power. */
+#define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
+
+/* Return the square root of X. */
+#define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
+
+/* Return `sqrt(X*X + Y*Y)'. */
+#define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
+
+/* Return the cube root of X. */
+#define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
+
+
+/* Nearest integer, absolute value, and remainder functions. */
+
+/* Smallest integral value not less than X. */
+#define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
+
+/* Absolute value of X. */
+#define fabs(Val) __TGMATH_UNARY_REAL_IMAG (Val, fabs, cabs)
+
+/* Largest integer not greater than X. */
+#define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
+
+/* Floating-point modulo remainder of X/Y. */
+#define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
+
+/* Round X to integral valuein floating-point format using current
+ rounding direction, but do not raise inexact exception. */
+#define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
+
+/* Round X to nearest integral value, rounding halfway cases away from
+ zero. */
+#define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
+
+/* Round X to the integral value in floating-point format nearest but
+ not larger in magnitude. */
+#define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
+
+/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
+ and magnitude congruent `mod 2^n' to the magnitude of the integral
+ quotient x/y, with n >= 3. */
+#define remquo(Val1, Val2, Val3) \
+ __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
+
+/* Round X to nearest integral value according to current rounding
+ direction. */
+#define lrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, lrint)
+#define llrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, llrint)
+
+/* Round X to nearest integral value, rounding halfway cases away from
+ zero. */
+#define lround(Val) __TGMATH_UNARY_REAL_ONLY (Val, lround)
+#define llround(Val) __TGMATH_UNARY_REAL_ONLY (Val, llround)
+
+
+/* Return X with its signed changed to Y's. */
+#define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
+
+/* Error and gamma functions. */
+#define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
+#define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
+#define gamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, gamma)
+#define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
+
+
+/* Return the integer nearest X in the direction of the
+ prevailing rounding mode. */
+#define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
+
+/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
+#define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
+#define nextafterx(Val1, Val2) \
+ __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nextafterx)
+
+/* Return the remainder of integer divison X / Y with infinite precision. */
+#define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
+
+/* Return X times (2 to the Nth power). */
+#define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
+
+/* Return X times (2 to the Nth power). */
+#define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
+
+/* Return X times (2 to the Nth power). */
+#define scalbln(Val1, Val2) \
+ __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
+
+/* Return the binary exponent of X, which must be nonzero. */
+#define ilogb(Val) __TGMATH_UNARY_REAL_ONLY (Val, ilogb)
+
+
+/* Return positive difference between X and Y. */
+#define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
+
+/* Return maximum numeric value from X and Y. */
+#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
+
+/* Return minimum numeric value from X and Y. */
+#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
+
+
+/* Absolute value, conjugates, and projection. */
+
+/* Argument value of Z. */
+#define carg(Val) __TGMATH_UNARY_IMAG_ONLY (Val, carg)
+
+/* Complex conjugate of Z. */
+#define conj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, conj)
+
+/* Projection of Z onto the Riemann sphere. */
+#define cproj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cproj)
+
+
+/* Decomposing complex values. */
+
+/* Imaginary part of Z. */
+#define cimag(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cimag)
+
+/* Real part of Z. */
+#define creal(Val) __TGMATH_UNARY_IMAG_ONLY (Val, creal)
+
+#endif /* tgmath.h */
diff --git a/misc/err.h b/misc/err.h
index fa971cabf0d..643e96f2f5f 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -1,5 +1,5 @@
-/* err.h -- 4.4BSD utility functions for error messages.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* 4.4BSD utility functions for error messages.
+ 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
@@ -25,7 +25,7 @@
#define __need___va_list
#include <stdarg.h>
#ifndef __GNUC_VA_LIST
-#define __gnuc_va_list __ptr_t
+# define __gnuc_va_list __ptr_t
#endif
__BEGIN_DECLS
diff --git a/misc/fstab.c b/misc/fstab.c
index 7f68cb13095..8b87a1f1f0e 100644
--- a/misc/fstab.c
+++ b/misc/fstab.c
@@ -47,6 +47,7 @@ setfsent (void)
}
static struct fstab *
+internal_function
mnt2fs (struct mntent *m)
{
static struct fstab f;
diff --git a/misc/getttyent.c b/misc/getttyent.c
index 777108ff709..6743ac5d7dc 100644
--- a/misc/getttyent.c
+++ b/misc/getttyent.c
@@ -57,7 +57,8 @@ getttynam(tty)
return (t);
}
-static char *skip __P((char *)), *value __P((char *));
+static char *skip __P((char *)) internal_function;
+static char *value __P((char *)) internal_function;
struct ttyent *
getttyent()
@@ -133,6 +134,7 @@ getttyent()
* the next field.
*/
static char *
+internal_function
skip(p)
register char *p;
{
@@ -167,6 +169,7 @@ skip(p)
}
static char *
+internal_function
value(p)
register char *p;
{
diff --git a/misc/regexp.h b/misc/regexp.h
index 04da70a5346..384001366e7 100644
--- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -28,6 +28,7 @@
included only for compatibility reasons. Use the POSIX definition
in <regex.h> for portable applications and a reasonable interface. */
+#include <features.h>
#include <alloca.h>
#include <regex.h>
#include <stdlib.h>
@@ -110,13 +111,13 @@ compile (char *__instring, char *__expbuf, __const char *__endbuf, int __eof)
of type `regex_t'. Then check for minimum size of the buffer for
the compiled regular expression. */
regex_t *__expr_ptr;
-#if defined __GNUC__ && __GNUC__ >= 2
+# if defined __GNUC__ && __GNUC__ >= 2
const size_t __req = __alignof__ (regex_t *);
-#else
+# else
/* How shall we find out? We simply guess it and can change it is
this really proofs to be wrong. */
const size_t __req = 8;
-#endif
+# endif
__expbuf += __req;
__expbuf -= (__expbuf - ((char *) 0)) % __req;
if (__endbuf < __expbuf + sizeof (regex_t))
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 602779ebb79..5f40a0a45dc 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -26,61 +26,61 @@
#ifdef __GNUC__
-#define __P(args) args /* GCC can always grok prototypes. */
-#define __DOTS , ...
+# define __P(args) args /* GCC can always grok prototypes. */
+# define __DOTS , ...
#else /* Not GCC. */
-#define __inline /* No inline functions. */
+# define __inline /* No inline functions. */
-#if (defined (__STDC__) && __STDC__) || defined (__cplusplus)
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
-#define __P(args) args
-#define __const const
-#define __signed signed
-#define __volatile volatile
-#define __DOTS , ...
+# define __P(args) args
+# define __const const
+# define __signed signed
+# define __volatile volatile
+# define __DOTS , ...
-#else /* Not ANSI C or C++. */
+# else /* Not ANSI C or C++. */
-#define __P(args) () /* No prototypes. */
-#define __const /* No ANSI C keywords. */
-#define __signed
-#define __volatile
-#define __DOTS
+# define __P(args) () /* No prototypes. */
+# define __const /* No ANSI C keywords. */
+# define __signed
+# define __volatile
+# define __DOTS
-#endif /* ANSI C or C++. */
+# endif /* ANSI C or C++. */
#endif /* GCC. */
/* For these things, GCC behaves the ANSI way normally,
and the non-ANSI way under -traditional. */
-#if defined (__STDC__) && __STDC__
+#if defined __STDC__ && __STDC__
-#define __CONCAT(x,y) x ## y
-#define __STRING(x) #x
+# define __CONCAT(x,y) x ## y
+# define __STRING(x) #x
/* This is not a typedef so `const __ptr_t' does the right thing. */
-#define __ptr_t void *
-#define __long_double_t long double
+# define __ptr_t void *
+# define __long_double_t long double
#else
-#define __CONCAT(x,y) x/**/y
-#define __STRING(x) "x"
+# define __CONCAT(x,y) x/**/y
+# define __STRING(x) "x"
-#define __ptr_t char *
-#define __long_double_t long double
+# define __ptr_t char *
+# define __long_double_t long double
/* The BSD header files use the ANSI keywords unmodified (this means that
old programs may lose if they use the new keywords as identifiers), but
those names are not available under -traditional. We define them to
their __ versions, which are taken care of above. */
#ifdef __USE_BSD
-#define const __const
-#define signed __signed
-#define volatile __volatile
+# define const __const
+# define signed __signed
+# define volatile __volatile
#endif
#endif /* __STDC__ */
@@ -88,18 +88,18 @@
/* C++ needs to know that types and declarations are C, not C++. */
#ifdef __cplusplus
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS }
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
#else
-#define __BEGIN_DECLS
-#define __END_DECLS
+# define __BEGIN_DECLS
+# define __END_DECLS
#endif
/* GCC2 has various useful declarations that can be made with the
`__attribute__' syntax. All of the ways we use this do fine if
they are omitted for compilers that don't understand it. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-#define __attribute__(xyz) /* Ignore. */
+#if !defined __GNUC__ || __GNUC__ < 2
+# define __attribute__(xyz) /* Ignore. */
#endif
diff --git a/misc/sys/file.h b/misc/sys/file.h
index 9f946fb327f..02285938cf1 100644
--- a/misc/sys/file.h
+++ b/misc/sys/file.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+/* 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
@@ -22,7 +22,7 @@
#include <features.h>
#ifndef _FCNTL_H
-#include <fcntl.h>
+# include <fcntl.h>
#endif
__BEGIN_DECLS
@@ -31,19 +31,19 @@ __BEGIN_DECLS
/* Alternate names for values for the WHENCE argument to `lseek'.
These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */
#ifndef L_SET
-#define L_SET 0 /* Seek from beginning of file. */
-#define L_INCR 1 /* Seek from current position. */
-#define L_XTND 2 /* Seek from end of file. */
+# define L_SET 0 /* Seek from beginning of file. */
+# define L_INCR 1 /* Seek from current position. */
+# define L_XTND 2 /* Seek from end of file. */
#endif
/* Operations for the `flock' call. */
-#define LOCK_SH 1 /* Shared lock. */
-#define LOCK_EX 2 /* Exclusive lock. */
-#define LOCK_UN 8 /* Unlock. */
+#define LOCK_SH 1 /* Shared lock. */
+#define LOCK_EX 2 /* Exclusive lock. */
+#define LOCK_UN 8 /* Unlock. */
/* Can be OR'd in to one of the above. */
-#define LOCK_NB 4 /* Don't block when locking. */
+#define LOCK_NB 4 /* Don't block when locking. */
/* Apply or remove an advisory lock, according to OPERATION,
diff --git a/misc/syslog.c b/misc/syslog.c
index acb1b69e001..7aa29dad7d1 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -70,7 +70,7 @@ 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);
+static void openlog_internal(const char *, int, int) internal_function;
static void closelog_internal(void);
static void sigpipe_handler (int);
#ifdef _LIBC_REENTRANT
@@ -230,6 +230,7 @@ vsyslog(pri, fmt, ap)
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)
diff --git a/misc/tsearch.c b/misc/tsearch.c
index e372a9e971d..c5af3ec689c 100644
--- a/misc/tsearch.c
+++ b/misc/tsearch.c
@@ -593,6 +593,7 @@ weak_alias (__tdelete, tdelete)
ROOT is the root of the tree to be walked, ACTION the function to be
called at each node. LEVEL is the level of ROOT in the whole tree. */
static void
+internal_function
trecurse (const void *vroot, __action_fn_t action, int level)
{
node root = (node ) vroot;
@@ -632,6 +633,7 @@ weak_alias (__twalk, twalk)
/* The standardized functions miss an important functionality: the
tree cannot be removed easily. We provide a function to do this. */
static void
+internal_function
tdestroy_recurse (node root, __free_fn_t freefct)
{
if (root->left != NULL)
diff --git a/nis/Banner b/nis/Banner
index d6cf7a9f5e7..c280caad63b 100644
--- a/nis/Banner
+++ b/nis/Banner
@@ -1 +1 @@
-NIS(YP)/NIS+ NSS modules 0.14 by Thorsten Kukuk
+NIS(YP)/NIS+ NSS modules 0.15 by Thorsten Kukuk
diff --git a/nis/Makefile b/nis/Makefile
index 82c5f24963a..e114faf1c75 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -44,14 +44,15 @@ vpath %.c $(subdir-dirs)
libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
nis_subr nis_local_names nis_free nis_file \
- nis_print nis_error nis_call nis_lookup nis_clone\
- nis_cache nis_table nis_xdr nis_server nis_ping\
+ nis_print nis_error nis_call nis_lookup\
+ nis_table nis_xdr nis_server nis_ping\
nis_checkpoint nis_mkdir nis_rmdir nis_getservlist\
nis_verifygroup nis_ismember nis_addmember nis_util\
nis_removemember nis_creategroup nis_destroygroup\
nis_print_group_entry nis_domain_of nis_domain_of_r\
- nis_modify nis_remove nis_add nis_defaults lckcache\
- nis_findserv nis_callback
+ nis_modify nis_remove nis_add nis_defaults\
+ nis_findserv nis_callback nis_clone_dir nis_clone_obj\
+ nis_clone_res
libnsl-map = libnsl.map
libnss_compat-routines := $(addprefix compat-,grp pwd spwd) nisplus-parser
diff --git a/nis/TODO b/nis/TODO
deleted file mode 100644
index 8528de7e1a6..00000000000
--- a/nis/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-
- * nis_addmember: Where checks for duplicate group members ? nisgrpadm or
- nis_addmember ?
diff --git a/nis/lckcache.c b/nis/lckcache.c
deleted file mode 100644
index f8c0a97296d..00000000000
--- a/nis/lckcache.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Handle locking of NIS+ cache file.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library and based on shadow/lckfile.c.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library 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 <fcntl.h>
-#include <bits/libc-lock.h>
-#include <shadow.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/file.h>
-#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
-#include <rpcsvc/nis_cache.h>
-
-/* How long to wait for getting the lock before returning with an
- error. */
-#define TIMEOUT 5 /* sec */
-
-
-/* File descriptor for lock file. */
-static int lock_fd = -1;
-
-/* Prevent problems in multithreaded program by using mutex. */
-__libc_lock_define_initialized (static, lock)
-
-
-/* Prototypes for local functions. */
-static void noop_handler __P ((int __sig));
-
-
-/* We cannot simply return in error cases. We have to close the file
- and perhaps restore the signal handler. */
-#define RETURN_CLOSE_FD(code) \
- do { \
- if ((code) < 0 && lock_fd >= 0) \
- { \
- close (lock_fd); \
- lock_fd = -1; \
- } \
- __libc_lock_unlock (lock); \
- return (code); \
- } while (0)
-
-#define RETURN_RESTORE_HANDLER(code) \
- do { \
- /* Restore old action handler for alarm. We don't need to know \
- about the current one. */ \
- sigaction (SIGALRM, &saved_act, NULL); \
- RETURN_CLOSE_FD (code); \
- } while (0)
-
-#define RETURN_CLEAR_ALARM(code) \
- do { \
- /* Clear alarm. */ \
- alarm (0); \
- /* Restore old set of handled signals. We don't need to know \
- about the current one.*/ \
- sigprocmask (SIG_SETMASK, &saved_set, NULL); \
- RETURN_RESTORE_HANDLER (code); \
- } while (0)
-
-
-int
-__nis_lock_cache (void)
-{
- int flags;
- sigset_t saved_set; /* Saved set of caught signals. */
- struct sigaction saved_act; /* Saved signal action. */
- sigset_t new_set; /* New set of caught signals. */
- struct sigaction new_act; /* New signal action. */
- struct flock fl; /* Information struct for locking. */
- int result;
-
- if (lock_fd != -1)
- /* Still locked by own process. */
- return -1;
-
- /* Prevent problems caused by multiple threads. */
- __libc_lock_lock (lock);
-
- lock_fd = open (CACHELOCK, O_RDONLY|O_CREAT, 0666);
- if (lock_fd == -1)
- /* Cannot create lock file. */
- RETURN_CLOSE_FD (-1);
-
- /* Make sure file gets correctly closed when process finished. */
- flags = fcntl (lock_fd, F_GETFD, 0);
- if (flags == -1)
- /* Cannot get file flags. */
- RETURN_CLOSE_FD (-1);
- flags |= FD_CLOEXEC; /* Close on exit. */
- if (fcntl (lock_fd, F_SETFD, flags) < 0)
- /* Cannot set new flags. */
- RETURN_CLOSE_FD (-1);
-
- /* Now we have to get exclusive write access. Since multiple
- process could try this we won't stop when it first fails.
- Instead we set a timeout for the system call. Once the timer
- expires it is likely that there are some problems which cannot be
- resolved by waiting.
-
- It is important that we don't change the signal state. We must
- restore the old signal behaviour. */
- memset (&new_act, '\0', sizeof (struct sigaction));
- new_act.sa_handler = noop_handler;
- sigfillset (&new_act.sa_mask);
- new_act.sa_flags = 0ul;
-
- /* Install new action handler for alarm and save old. */
- if (sigaction (SIGALRM, &new_act, &saved_act) < 0)
- /* Cannot install signal handler. */
- RETURN_CLOSE_FD (-1);
-
- /* Now make sure the alarm signal is not blocked. */
- sigemptyset (&new_set);
- sigaddset (&new_set, SIGALRM);
- if (sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0)
- RETURN_RESTORE_HANDLER (-1);
-
- /* Start timer. If we cannot get the lock in the specified time we
- get a signal. */
- alarm (TIMEOUT);
-
- /* Try to get the lock. */
- memset (&fl, '\0', sizeof (struct flock));
- fl.l_type = F_RDLCK;
- fl.l_whence = SEEK_SET;
- result = fcntl (lock_fd, F_SETLKW, &fl);
-
- RETURN_CLEAR_ALARM (result);
-}
-
-
-int
-__nis_unlock_cache ()
-{
- int result;
-
- if (lock_fd == -1)
- /* There is no lock set. */
- result = -1;
- else
- {
- /* Prevent problems caused by multiple threads. */
- __libc_lock_lock (lock);
-
- result = close (lock_fd);
-
- /* Mark descriptor as unused. */
- lock_fd = -1;
-
- /* Clear mutex. */
- __libc_lock_unlock (lock);
- }
-
- return result;
-}
-
-
-static void
-noop_handler (sig)
- int sig;
-{
- /* We simply return which makes the `fcntl' call return with an error. */
-}
diff --git a/nis/libnsl.map b/nis/libnsl.map
index cf22d27d2fc..49b3754e6df 100644
--- a/nis/libnsl.map
+++ b/nis/libnsl.map
@@ -1,20 +1,12 @@
GLIBC_2.0 {
global:
- __nis_default_access; __nis_default_group; __nis_default_owner;
- __nis_default_ttl; __nis_finddirectory; __nis_lock_cache;
- __nis_unlock_cache; __nis_hash;
- nis_add;
- nis_add_entry; nis_addmember; nis_checkpoint;
- nis_clone_directory; nis_clone_entry; nis_clone_group;
- nis_clone_link; nis_clone_nis_attr; nis_clone_objdata;
- nis_clone_object; nis_clone_result; nis_clone_table;
- nis_creategroup; nis_destroy_object; nis_destroygroup;
- nis_dir_cmp; nis_domain_of; nis_domain_of_r;
- nis_first_entry; nis_free_attr; nis_free_directory;
- nis_free_endpoints; nis_free_entry; nis_free_group;
- nis_free_link; nis_free_object; nis_free_request;
- nis_free_servers; nis_free_table; nis_freenames;
+ nis_add; nis_add_entry; nis_addmember;
+ nis_checkpoint; nis_clone_directory; nis_clone_object;
+ nis_clone_result; nis_creategroup; nis_destroy_object;
+ nis_destroygroup; nis_dir_cmp; nis_domain_of;
+ nis_domain_of_r; nis_first_entry; nis_free_directory;
+ nis_free_object; nis_free_request; nis_freenames;
nis_freeresult; nis_freeservlist; nis_freetags;
nis_getnames; nis_getservlist; nis_ismember;
nis_leaf_of; nis_leaf_of_r; nis_lerror;
@@ -31,8 +23,15 @@ GLIBC_2.0 {
nis_sperror; nis_sperror_r; nis_stats;
nis_verifygroup; nis_write_obj;
- readColdStartFile; writeColdStartFile;
+ # This functions are needed by the NIS+ tools and rpc.nisd,
+ # they should never be used in a normal user program !
+ __nis_default_access; __nis_default_group; __nis_default_owner;
+ __nis_default_ttl; __nis_free_fdresult; __nis_finddirectory;
+ __nis_hash; readColdStartFile; writeColdStartFile;
+ # Many programs expect this, but every user program should
+ # have it's own version, since the interface is different on
+ # various platforms.
xdr_cp_result; xdr_directory_obj; xdr_domainname;
xdr_dump_args; xdr_endpoint; xdr_entry_col;
xdr_entry_obj; xdr_fd_args; xdr_fd_result;
@@ -54,7 +53,7 @@ GLIBC_2.0 {
xdr_ypresp_xfr; xdr_ypstat; xdr_ypupdate_args;
xdr_ypxfrstat; xdr_zotypes;
- __yp_check;
+ __yp_check;
yp_all; yp_bind; yp_first;
yp_get_default_domain; yp_maplist; yp_master;
yp_match; yp_next; yp_order;
diff --git a/nis/nis_add.c b/nis/nis_add.c
index 6693a25766a..d30ccde2f6e 100644
--- a/nis/nis_add.c
+++ b/nis/nis_add.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
diff --git a/nis/nis_addmember.c b/nis/nis_addmember.c
index 8fd7e12a588..6d55bd0d070 100644
--- a/nis/nis_addmember.c
+++ b/nis/nis_addmember.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_addmember (const_nis_name member, const_nis_name group)
@@ -42,28 +41,28 @@ nis_addmember (const_nis_name member, const_nis_name group)
stpcpy (cp, cp2);
}
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
- if (res->status != NIS_SUCCESS)
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS)
{
- status = res->status;
+ status = NIS_RES_STATUS (res);
nis_freeresult (res);
return status;
}
- if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
+ if ((NIS_RES_NUMOBJ (res) != 1) ||
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
return NIS_INVALIDOBJ;
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val
- = realloc (res->objects.objects_val[0].GR_data.gr_members.gr_members_val,
- (res->objects.objects_val[0].GR_data.gr_members.gr_members_len + 1)
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val
+ = realloc (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val,
+ (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len + 1)
* sizeof (char *));
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val[res->objects.objects_val[0].GR_data.gr_members.gr_members_len] = strdup (member);
- ++res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len] = strdup (member);
+ ++NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len;
- cp = stpcpy (buf, res->objects.objects_val->zo_name);
+ cp = stpcpy (buf, NIS_RES_OBJECT(res)->zo_name);
*cp++ = '.';
- strncpy (cp, res->objects.objects_val->zo_domain, NIS_MAXNAMELEN);
- res2 = nis_modify (buf, res->objects.objects_val);
- status = res2->status;
+ strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN);
+ res2 = nis_modify (buf, NIS_RES_OBJECT (res));
+ status = NIS_RES_STATUS (res2);
nis_freeresult (res);
nis_freeresult (res2);
diff --git a/nis/nis_cache.c b/nis/nis_cache.c
deleted file mode 100644
index e10b8c07fd3..00000000000
--- a/nis/nis_cache.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library 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 <fcntl.h>
-#include <unistd.h>
-#include <syslog.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <rpcsvc/nis.h>
-#include <rpcsvc/nis_cache.h>
-#include <bits/libc-lock.h>
-
-#include "nis_intern.h"
-
-static struct timeval TIMEOUT = {10, 0};
-
-#define HEADER_MAGIC 0x07021971
-#define SPACER_MAGIC 0x07654321
-
-#define CACHE_VERSION 0x00000001
-
-struct cache_header
-{
- u_long magic; /* Magic number */
- u_long vers; /* Cache file format version */
- u_short tcp_port; /* tcp port of nis_cachemgr */
- u_short udp_port; /* udp port of nis_cachemgr */
- u_long entries; /* Number of cached objs. */
- off_t used; /* How many space are used ? */
-};
-typedef struct cache_header cache_header;
-
-struct cache_spacer
-{
- u_long magic; /* Magic number */
- u_long hashval;
- time_t ctime; /* time we have created this object */
- time_t ttl; /* time to life of this object */
- off_t next_offset;
-};
-typedef struct cache_spacer cache_spacer;
-
-static int cache_fd = -1;
-static int clnt_sock;
-static caddr_t maddr = NULL;
-static size_t msize;
-static CLIENT *cache_clnt = NULL;
-
-/* If there is no cachemgr, we shouldn't use NIS_SHARED_DIRCACHE, if
- there is no NIS_SHARED_DIRCACHE, we couldn't use nis_cachemgr.
- So, if the clnt_call to nis_cachemgr fails, we also close the cache file.
- But another thread could read the cache => lock the cache_fd and cache_clnt
- variables with the same lock */
-__libc_lock_define_initialized (static, mgrlock)
-
-/* close file handles and nis_cachemgr connection */
-static void
-__cache_close (void)
-{
- if (cache_fd != -1)
- {
- close (cache_fd);
- cache_fd = -1;
- }
- if (cache_clnt != NULL)
- {
- clnt_destroy (cache_clnt);
- close (clnt_sock);
- cache_clnt = NULL;
- }
-}
-
-/* open the cache file and connect to nis_cachemgr */
-static bool_t
-__cache_open (void)
-{
- struct sockaddr_in sin;
- cache_header hptr;
-
- if ((cache_fd = open (CACHEFILE, O_RDONLY)) == -1)
- return FALSE;
-
- if (read (cache_fd, &hptr, sizeof (cache_header)) == -1
- || lseek (cache_fd, 0, SEEK_SET) < 0)
- {
- close (cache_fd);
- cache_fd = -1;
- return FALSE;
- }
- if (hptr.magic != HEADER_MAGIC)
- {
- close (cache_fd);
- cache_fd = -1;
- syslog (LOG_ERR, _("NIS+: cache file is corrupt!"));
- return FALSE;
- }
-
- memset (&sin, '\0', sizeof (sin));
- sin.sin_family = AF_INET;
- clnt_sock = RPC_ANYSOCK;
- sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- sin.sin_port = htons (hptr.tcp_port);
- cache_clnt = clnttcp_create (&sin, CACHEPROG, CACHE_VER_1, &clnt_sock, 0, 0);
- if (cache_clnt == NULL)
- {
- close (cache_fd);
- cache_fd = -1;
- return FALSE;
- }
- /* If the program exists, close the socket */
- if (fcntl (clnt_sock, F_SETFD, FD_CLOEXEC) == -1)
- perror (_("fcntl: F_SETFD"));
- return TRUE;
-}
-
-/* Ask the cache manager to update directory 'name'
- for us (because the ttl has expired). */
-static nis_error
-__cache_refresh (nis_name name)
-{
- char clnt_res = 0;
- nis_error result = NIS_SUCCESS;
-
- __libc_lock_lock (mgrlock);
-
- if (cache_clnt == NULL)
- result = NIS_FAIL;
- else if (clnt_call (cache_clnt, NIS_CACHE_REFRESH_ENTRY,
- (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
- (xdrproc_t) xdr_void, &clnt_res, TIMEOUT)
- != RPC_SUCCESS)
- {
- __cache_close ();
- result = NIS_FAIL;
- }
-
- __libc_lock_unlock (mgrlock);
-
- return result;
-}
-
-static nis_error
-__cache_find (const_nis_name name, directory_obj **obj)
-{
- unsigned long hash;
- struct cache_header *hptr;
- struct cache_spacer *cs;
- struct directory_obj *dir;
- XDR xdrs;
- caddr_t addr, ptr;
- time_t now = time (NULL);
-
- if (maddr == NULL)
- return NIS_FAIL;
-
- hash = __nis_hash (name, strlen(name));
- hptr = (cache_header *)maddr;
- if ((hptr->magic != HEADER_MAGIC) || (hptr->vers != CACHE_VERSION))
- {
- syslog (LOG_ERR, _("NIS+: cache file is corrupt!"));
- return NIS_SYSTEMERROR;
- }
- cs = (cache_spacer *)(maddr + sizeof (cache_header));
- while (cs->next_offset)
- {
- if (cs->magic != SPACER_MAGIC)
- {
- syslog (LOG_ERR, _("NIS+: cache file is corrupt!"));
- return NIS_SYSTEMERROR;
- }
- if (cs->hashval == hash)
- {
- if ((now - cs->ctime) > cs->ttl)
- return NIS_CACHEEXPIRED;
- dir = calloc (1, sizeof (directory_obj));
- addr = (caddr_t)cs + sizeof (cache_spacer);
- xdrmem_create (&xdrs, addr, cs->next_offset, XDR_DECODE);
- xdr_directory_obj (&xdrs, dir);
- xdr_destroy (&xdrs);
- *obj = dir;
- return NIS_SUCCESS;
- }
- ptr = (caddr_t)cs;
- ptr += cs->next_offset + sizeof (struct cache_spacer);
- cs = (struct cache_spacer *)ptr;
- }
- return NIS_NOTFOUND;
-}
-
-static directory_obj *
-internal_cache_search (const_nis_name name)
-{
- directory_obj *dir;
- nis_error res;
- int second_refresh = 0;
- struct stat s;
-
- if (cache_fd == -1)
- if (__cache_open () == FALSE)
- return NULL;
-
- again:
- /* This lock is for nis_cachemgr, so it couldn't write a new cache
- file if we reading it */
- if (__nis_lock_cache () == -1)
- return NULL;
-
- if (maddr != NULL)
- munmap (maddr, msize);
- if (fstat (cache_fd, &s) < 0)
- maddr = MAP_FAILED;
- else
- {
- msize = s.st_size;
- maddr = mmap (0, msize, PROT_READ, MAP_SHARED, cache_fd, 0);
- }
- if (maddr == MAP_FAILED)
- {
- __nis_unlock_cache ();
- return NULL;
- }
-
- res = __cache_find (name, &dir);
-
- munmap (maddr, msize);
- maddr = NULL;
- /* Allow nis_cachemgr to write a new cachefile */
- __nis_unlock_cache ();
-
- switch(res)
- {
- case NIS_CACHEEXPIRED:
- if (second_refresh)
- {
- __cache_close ();
- syslog (LOG_WARNING,
- _("NIS+: nis_cachemgr failed to refresh object for us"));
- return NULL;
- }
- ++second_refresh;
- if (__cache_refresh ((char *) name) != NIS_SUCCESS)
- return NULL;
- goto again;
- break;
- case NIS_SUCCESS:
- return dir;
- default:
- return NULL;
- }
-}
-
-directory_obj *
-__cache_search (const_nis_name name)
-{
- directory_obj *dir;
-
- __libc_lock_lock (mgrlock);
-
- dir = internal_cache_search (name);
-
- __libc_lock_unlock (mgrlock);
-
- return dir;
-}
-
-nis_error
-__cache_add (fd_result *fd)
-{
- char clnt_res = 0;
- nis_error result = NIS_SUCCESS;
-
- __libc_lock_lock (mgrlock);
-
- if (cache_clnt == NULL)
- if (__cache_open () == FALSE)
- result = NIS_FAIL;
-
- if (cache_clnt != NULL &&
- (clnt_call (cache_clnt, NIS_CACHE_ADD_ENTRY, (xdrproc_t) xdr_fd_result,
- (caddr_t)fd, (xdrproc_t) xdr_void, &clnt_res, TIMEOUT)
- != RPC_SUCCESS))
- {
- __cache_close ();
- result = NIS_RPCERROR;
- }
-
- __libc_lock_unlock (mgrlock);
-
- return result;
-}
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 06f63ee52e4..aaefdd22ba7 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -462,13 +462,12 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
return NULL;
}
- __cache_add (fd_res);
obj = calloc(1, sizeof(directory_obj));
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
fd_res->dir_data.dir_data_len, XDR_DECODE);
xdr_directory_obj(&xdrs, obj);
xdr_destroy(&xdrs);
- xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
+ __free_fdresult (fd_res);
if (obj != NULL)
{
/* We have found a NIS+ server serving ndomain, now
@@ -515,13 +514,12 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
return NULL;
}
- __cache_add (fd_res);
obj = calloc(1, sizeof(directory_obj));
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
fd_res->dir_data.dir_data_len, XDR_DECODE);
xdr_directory_obj(&xdrs, obj);
xdr_destroy(&xdrs);
- xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
+ __free_fdresult (fd_res);
if (obj != NULL)
{
/* We have found a NIS+ server serving ndomain, now
@@ -554,9 +552,6 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
if (name == NULL)
return NIS_BADNAME;
- if ((flags & NO_CACHE) != NO_CACHE)
- dir = __cache_search (name);
-
if (dir == NULL)
{
nis_error status;
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 15cdd58402e..f4bd07252c8 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_result *
@@ -35,26 +34,25 @@ nis_checkpoint(const_nis_name dirname)
u_int i;
res2 = nis_lookup (dirname, EXPAND_NAME);
- if (res2->status != NIS_SUCCESS && res2->status != NIS_S_SUCCESS)
+ if (NIS_RES_STATUS (res2) != NIS_SUCCESS)
return res2;
/* Check if obj is really a diryectory object */
- if (res2->objects.objects_val[0].zo_data.zo_type != DIRECTORY_OBJ)
+ if (__type_of (NIS_RES_OBJECT (res2)) != NIS_DIRECTORY_OBJ)
{
nis_freeresult (res);
- res->status = NIS_INVALIDOBJ;
+ NIS_RES_STATUS (res) = NIS_INVALIDOBJ;
return res;
}
for (i = 0;
- i < res2->objects.objects_val[0].DI_data.do_servers.do_servers_len;
- ++i)
+ i < NIS_RES_OBJECT (res2)->DI_data.do_servers.do_servers_len; ++i)
{
- if (__do_niscall2 (&res2->objects.objects_val[0].DI_data.do_servers.do_servers_val[i],
- 1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
- (caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
- (caddr_t) &cpres, 0, NULL) != RPC_SUCCESS)
- res->status = NIS_RPCERROR;
+ if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i],
+ 1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
+ (caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
+ (caddr_t) &cpres, 0, NULL) != RPC_SUCCESS)
+ NIS_RES_STATUS (res) = NIS_RPCERROR;
else
{
res->status += cpres->cp_status;
@@ -65,7 +63,7 @@ nis_checkpoint(const_nis_name dirname)
nis_freeresult (res2);
}
else
- res->status = NIS_NOSUCHNAME;
+ NIS_RES_STATUS (res) = NIS_NOSUCHNAME;
return res;
}
diff --git a/nis/nis_clone.c b/nis/nis_clone.c
deleted file mode 100644
index a1d753692cf..00000000000
--- a/nis/nis_clone.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <string.h>
-#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
-
-directory_obj *
-nis_clone_directory (const directory_obj *src, directory_obj *dest)
-{
- directory_obj *res;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (directory_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- if (src->do_name)
- res->do_name = strdup (src->do_name);
- else
- res->do_name = NULL;
- res->do_type = src->do_type;
- if (src->do_servers.do_servers_len > 0)
- {
- size_t i;
-
- res->do_servers.do_servers_len = src->do_servers.do_servers_len;
- if ((res->do_servers.do_servers_val =
- malloc (src->do_servers.do_servers_len * sizeof (nis_server)))
- == NULL)
- return NULL;
-
- for (i = 0; i < src->do_servers.do_servers_len; ++i)
- {
- if (src->do_servers.do_servers_val[i].name != NULL)
- res->do_servers.do_servers_val[i].name =
- strdup (src->do_servers.do_servers_val[i].name);
- else
- res->do_servers.do_servers_val[i].name = NULL;
-
- res->do_servers.do_servers_val[i].ep.ep_len =
- src->do_servers.do_servers_val[i].ep.ep_len;
- if (res->do_servers.do_servers_val[i].ep.ep_len > 0)
- {
- size_t j;
-
- res->do_servers.do_servers_val[i].ep.ep_val =
- malloc (src->do_servers.do_servers_val[i].ep.ep_len *
- sizeof (endpoint));
- for (j = 0; j < res->do_servers.do_servers_val[i].ep.ep_len; ++j)
- {
- if (src->do_servers.do_servers_val[i].ep.ep_val[j].uaddr)
- res->do_servers.do_servers_val[i].ep.ep_val[j].uaddr
- = strdup (src->do_servers.do_servers_val[i].ep.ep_val[j].uaddr);
- else
- res->do_servers.do_servers_val[i].ep.ep_val[j].uaddr = NULL;
-
- if (src->do_servers.do_servers_val[i].ep.ep_val[j].family)
- res->do_servers.do_servers_val[i].ep.ep_val[j].family
- = strdup (src->do_servers.do_servers_val[i].ep.ep_val[j].family);
- else
- res->do_servers.do_servers_val[i].ep.ep_val[j].family = NULL;
-
- if (src->do_servers.do_servers_val[i].ep.ep_val[j].proto)
- res->do_servers.do_servers_val[i].ep.ep_val[j].proto
- = strdup (src->do_servers.do_servers_val[i].ep.ep_val[j].proto);
- else
- res->do_servers.do_servers_val[i].ep.ep_val[j].proto = NULL;
- }
- }
- else
- {
- res->do_servers.do_servers_val[i].ep.ep_val = NULL;
- }
- res->do_servers.do_servers_val[i].key_type =
- src->do_servers.do_servers_val[i].key_type;
- res->do_servers.do_servers_val[i].pkey.n_len =
- src->do_servers.do_servers_val[i].pkey.n_len;
- if (res->do_servers.do_servers_val[i].pkey.n_len > 0)
- {
- res->do_servers.do_servers_val[i].pkey.n_bytes =
- malloc (src->do_servers.do_servers_val[i].pkey.n_len);
- if (res->do_servers.do_servers_val[i].pkey.n_bytes == NULL)
- return NULL;
- memcpy (res->do_servers.do_servers_val[i].pkey.n_bytes,
- src->do_servers.do_servers_val[i].pkey.n_bytes,
- src->do_servers.do_servers_val[i].pkey.n_len);
- }
- else
- res->do_servers.do_servers_val[i].pkey.n_bytes = NULL;
- }
- }
- else
- {
- res->do_servers.do_servers_len = 0;
- res->do_servers.do_servers_val = NULL;
- }
- res->do_ttl = src->do_ttl;
- res->do_armask.do_armask_len = src->do_armask.do_armask_len;
- if (res->do_armask.do_armask_len > 0)
- {
- if ((res->do_armask.do_armask_val =
- malloc (src->do_armask.do_armask_len * sizeof (oar_mask))) == NULL)
- return NULL;
- memcpy (res->do_armask.do_armask_val, src->do_armask.do_armask_val,
- src->do_armask.do_armask_len * sizeof (oar_mask));
- }
- else
- {
- res->do_armask.do_armask_val = NULL;
- }
-
- return res;
-}
-
-group_obj *
-nis_clone_group (const group_obj *src, group_obj *dest)
-{
- size_t i;
- group_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (group_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->gr_flags = src->gr_flags;
-
- res->gr_members.gr_members_len = src->gr_members.gr_members_len;
- if (res->gr_members.gr_members_len > 0)
- {
- if (res->gr_members.gr_members_val == NULL)
- {
- if ((res->gr_members.gr_members_val =
- malloc (res->gr_members.gr_members_len * sizeof (nis_name))) == NULL)
- return NULL;
- }
- for (i = 0; i < res->gr_members.gr_members_len; ++i)
- if (src->gr_members.gr_members_val[i] != NULL)
- res->gr_members.gr_members_val[i] =
- strdup (src->gr_members.gr_members_val[i]);
- else
- res->gr_members.gr_members_val[i] = NULL;
- }
-
- return res;
-}
-
-table_obj *
-nis_clone_table (const table_obj *src, table_obj *dest)
-{
- size_t i;
- table_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (table_obj));
- if (res == NULL)
- return res;
- }
- else
- res = dest;
-
- if (src->ta_type != NULL)
- {
- if ((res->ta_type = strdup (src->ta_type)) == NULL)
- return NULL;
- }
- else
- res->ta_type = NULL;
-
- res->ta_maxcol = src->ta_maxcol;
- res->ta_sep = src->ta_sep;
- res->ta_cols.ta_cols_len = src->ta_cols.ta_cols_len;
- if (res->ta_cols.ta_cols_val == NULL)
- {
- if ((res->ta_cols.ta_cols_val =
- calloc (1, src->ta_cols.ta_cols_len * sizeof (table_col))) == NULL)
- return NULL;
- }
- for (i = 0; i < res->ta_cols.ta_cols_len; i++)
- {
- if (src->ta_cols.ta_cols_val[i].tc_name == NULL)
- res->ta_cols.ta_cols_val[i].tc_name = NULL;
- else
- res->ta_cols.ta_cols_val[i].tc_name =
- strdup (src->ta_cols.ta_cols_val[i].tc_name);
- res->ta_cols.ta_cols_val[i].tc_flags =
- src->ta_cols.ta_cols_val[i].tc_flags;
- res->ta_cols.ta_cols_val[i].tc_rights =
- src->ta_cols.ta_cols_val[i].tc_rights;
- }
-
- if (src->ta_path != NULL)
- {
- if ((res->ta_path = strdup (src->ta_path)) == NULL)
- return NULL;
- }
- else
- res->ta_path = NULL;
-
- return res;
-}
-
-entry_obj *
-nis_clone_entry (const entry_obj *src, entry_obj *dest)
-{
- size_t i;
- entry_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (entry_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- if (src->en_type)
- res->en_type = strdup (src->en_type);
- else
- res->en_type = NULL;
-
- res->en_cols.en_cols_len = src->en_cols.en_cols_len;
- if (res->en_cols.en_cols_val == NULL && src->en_cols.en_cols_len > 0)
- {
- res->en_cols.en_cols_val =
- calloc (1, src->en_cols.en_cols_len * sizeof (entry_col));
- if (res->en_cols.en_cols_val == NULL)
- return NULL;
- }
- for (i = 0; i < res->en_cols.en_cols_len; ++i)
- {
- res->en_cols.en_cols_val[i].ec_flags =
- src->en_cols.en_cols_val[i].ec_flags;
- res->en_cols.en_cols_val[i].ec_value.ec_value_len =
- src->en_cols.en_cols_val[i].ec_value.ec_value_len;
- if (res->en_cols.en_cols_val[i].ec_value.ec_value_val == NULL &&
- src->en_cols.en_cols_val[i].ec_value.ec_value_len > 0)
- res->en_cols.en_cols_val[i].ec_value.ec_value_val =
- malloc (src->en_cols.en_cols_val[i].ec_value.ec_value_len);
- memcpy (res->en_cols.en_cols_val[i].ec_value.ec_value_val,
- src->en_cols.en_cols_val[i].ec_value.ec_value_val,
- res->en_cols.en_cols_val[i].ec_value.ec_value_len);
- }
-
- return res;
-}
-
-nis_attr *
-nis_clone_nis_attr (const nis_attr *src, nis_attr *dest)
-{
- nis_attr *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (nis_attr));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- if (src->zattr_ndx != NULL)
- {
- if ((res->zattr_ndx = strdup (src->zattr_ndx)) == NULL)
- return NULL;
- }
- else
- res->zattr_ndx = NULL;
-
- res->zattr_val.zattr_val_len = src->zattr_val.zattr_val_len;
- if (res->zattr_val.zattr_val_len > 0)
- {
- if (res->zattr_val.zattr_val_val == NULL)
- {
- if ((res->zattr_val.zattr_val_val =
- calloc (1, src->zattr_val.zattr_val_len)) == NULL)
- return NULL;
- }
- memcpy (res->zattr_val.zattr_val_val, src->zattr_val.zattr_val_val,
- src->zattr_val.zattr_val_len);
- }
- else
- res->zattr_val.zattr_val_val = NULL;
- return res;
-}
-
-static nis_attr *
-__nis_clone_attrs (const nis_attr *src, nis_attr *dest, u_int len)
-{
- unsigned int i;
- nis_attr *res;
-
- if (len == 0)
- return dest;
-
- if (dest == NULL)
- {
- res = calloc (len, sizeof (nis_attr));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- for (i = 0; i < len; i++)
- nis_clone_nis_attr(&src[i], &res[i]);
-
- return res;
-}
-
-link_obj *
-nis_clone_link (const link_obj *src, link_obj *dest)
-{
- link_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (link_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->li_rtype = src->li_rtype;
-
- res->li_attrs.li_attrs_len = src->li_attrs.li_attrs_len;
- res->li_attrs.li_attrs_val =
- __nis_clone_attrs (src->li_attrs.li_attrs_val,
- res->li_attrs.li_attrs_val,
- src->li_attrs.li_attrs_len);
-
- if (src->li_name)
- {
- if ((res->li_name = strdup (src->li_name)) == NULL)
- return NULL;
- }
- else
- res->li_name = NULL;
-
- return res;
-}
-
-objdata *
-nis_clone_objdata (const objdata *src, objdata *dest)
-{
- objdata *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (objdata));
- if (res == NULL)
- return res;
- }
- else
- res = dest;
-
- res->zo_type = src->zo_type;
-
- switch (src->zo_type)
- {
- case BOGUS_OBJ:
- break;
- case NO_OBJ:
- break;
- case DIRECTORY_OBJ:
- if (nis_clone_directory (&src->objdata_u.di_data,
- &res->objdata_u.di_data) == NULL)
- return NULL;
- break;
- case GROUP_OBJ:
- if (nis_clone_group (&src->objdata_u.gr_data,
- &res->objdata_u.gr_data) == NULL)
- return NULL;
- break;
- case TABLE_OBJ:
- if (nis_clone_table (&src->objdata_u.ta_data,
- &res->objdata_u.ta_data) == NULL)
- return NULL;
- break;
- case ENTRY_OBJ:
- if (nis_clone_entry (&src->objdata_u.en_data,
- &res->objdata_u.en_data) == NULL)
- return NULL;
- break;
- case LINK_OBJ:
- if (nis_clone_link (&src->objdata_u.li_data,
- &res->objdata_u.li_data) == NULL)
- return NULL;
- break;
- case PRIVATE_OBJ:
- res->objdata_u.po_data.po_data_len =
- src->objdata_u.po_data.po_data_len;
- if (src->objdata_u.po_data.po_data_val)
- {
- if ((res->objdata_u.po_data.po_data_val =
- malloc (res->objdata_u.po_data.po_data_len)) == NULL)
- return NULL;
- memcpy (res->objdata_u.po_data.po_data_val,
- src->objdata_u.po_data.po_data_val,
- src->objdata_u.po_data.po_data_len);
- }
- else
- {
- res->objdata_u.po_data.po_data_val = NULL;
- res->objdata_u.po_data.po_data_len = 0;
- }
- break;
- default:
- return NULL;
- }
-
- return res;
-}
-
-nis_object *
-nis_clone_object (const nis_object *src, nis_object *dest)
-{
- nis_object *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (nis_object));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->zo_oid = src->zo_oid;
-
- if (src->zo_name)
- {
- if ((res->zo_name = strdup (src->zo_name)) == NULL)
- return NULL;
- }
- else
- res->zo_name = NULL;
- if (src->zo_owner)
- {
- if ((res->zo_owner = strdup (src->zo_owner)) == NULL)
- return NULL;
- }
- else
- res->zo_owner = NULL;
- if (src->zo_group)
- {
- if ((res->zo_group = strdup (src->zo_group)) == NULL)
- return NULL;
- }
- else
- res->zo_group = NULL;
- if (src->zo_domain)
- {
- if ((res->zo_domain = strdup (src->zo_domain)) == NULL)
- return NULL;
- }
- else
- res->zo_domain = NULL;
- res->zo_access = src->zo_access;
- res->zo_ttl = src->zo_ttl;
-
- if (nis_clone_objdata (&src->zo_data, &res->zo_data) == NULL)
- return NULL;
-
- return res;
-}
-
-static nis_object *
-__nis_clone_objects (const nis_object *src, nis_object *dest, u_int len)
-{
- unsigned int i;
- nis_object *res;
-
- if (len == 0)
- return dest;
-
- if (dest == NULL)
- {
- res = calloc (len, sizeof (nis_object));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- for (i = 0; i < len; ++i)
- nis_clone_object(&src[i], &res[i]);
-
- return res;
-}
-
-nis_result *
-nis_clone_result (const nis_result *src, nis_result *dest)
-{
- nis_result *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (nis_result));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->status = src->status;
- res->objects.objects_len = src->objects.objects_len;
- res->objects.objects_val =
- __nis_clone_objects (src->objects.objects_val,
- res->objects.objects_val,
- src->objects.objects_len);
- res->zticks = src->zticks;
- res->dticks = src->dticks;
- res->aticks = src->aticks;
- res->cticks = src->cticks;
-
- return res;
-}
diff --git a/nis/nis_clone_dir.c b/nis/nis_clone_dir.c
new file mode 100644
index 00000000000..4d641e58f75
--- /dev/null
+++ b/nis/nis_clone_dir.c
@@ -0,0 +1,69 @@
+/* Copyright (c) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
+
+directory_obj *
+nis_clone_directory (const directory_obj *src, directory_obj *dest)
+{
+ unsigned char *addr;
+ unsigned int size;
+ XDR xdrs;
+ directory_obj *res;
+
+ if (src == NULL)
+ return (NULL);
+
+ size = xdr_sizeof ((xdrproc_t)xdr_directory_obj, (char *)src);
+ if ((addr = calloc(1, size)) == NULL)
+ return NULL;
+
+ if (dest == NULL)
+ {
+ if ((res = calloc (1, sizeof (directory_obj))) == NULL)
+ {
+ free (addr);
+ return NULL;
+ }
+ }
+ else
+ res = dest;
+
+ xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
+ if (!xdr_directory_obj (&xdrs, (directory_obj *)src))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ xdrmem_create (&xdrs, addr, size, XDR_DECODE);
+ if (!xdr_directory_obj (&xdrs, res))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ free (addr);
+
+ return res;
+}
diff --git a/nis/nis_clone_obj.c b/nis/nis_clone_obj.c
new file mode 100644
index 00000000000..291148fc0fc
--- /dev/null
+++ b/nis/nis_clone_obj.c
@@ -0,0 +1,69 @@
+/* Copyright (c) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
+
+nis_object *
+nis_clone_object (const nis_object *src, nis_object *dest)
+{
+ unsigned char *addr;
+ unsigned int size;
+ XDR xdrs;
+ nis_object *res;
+
+ if (src == NULL)
+ return (NULL);
+
+ size = xdr_sizeof ((xdrproc_t)xdr_nis_object, (char *)src);
+ if ((addr = calloc(1, size)) == NULL)
+ return NULL;
+
+ if (dest == NULL)
+ {
+ if ((res = calloc (1, sizeof (nis_object))) == NULL)
+ {
+ free (addr);
+ return NULL;
+ }
+ }
+ else
+ res = dest;
+
+ xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
+ if (!xdr_nis_object (&xdrs, (nis_object *)src))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ xdrmem_create(&xdrs, addr, size, XDR_DECODE);
+ if (!xdr_nis_object(&xdrs, res))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ free (addr);
+
+ return res;
+}
diff --git a/nis/nis_clone_res.c b/nis/nis_clone_res.c
new file mode 100644
index 00000000000..9bdc4d8835d
--- /dev/null
+++ b/nis/nis_clone_res.c
@@ -0,0 +1,69 @@
+/* Copyright (c) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
+
+nis_result *
+nis_clone_result (const nis_result *src, nis_result *dest)
+{
+ unsigned char *addr;
+ unsigned int size;
+ XDR xdrs;
+ nis_result *res;
+
+ if (src == NULL)
+ return (NULL);
+
+ size = xdr_sizeof ((xdrproc_t)xdr_nis_result, (char *)src);
+ if ((addr = calloc(1, size)) == NULL)
+ return NULL;
+
+ if (dest == NULL)
+ {
+ if ((res = calloc (1, sizeof (nis_result))) == NULL)
+ {
+ free (addr);
+ return NULL;
+ }
+ }
+ else
+ res = dest;
+
+ xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
+ if (!xdr_nis_result (&xdrs, (nis_result *)src))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ xdrmem_create(&xdrs, addr, size, XDR_DECODE);
+ if (!xdr_nis_result(&xdrs, res))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ free (addr);
+
+ return res;
+}
diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index d1de08c08d0..240573145f9 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_creategroup (const_nis_name group, u_long flags)
@@ -50,7 +49,7 @@ nis_creategroup (const_nis_name group, u_long flags)
obj->zo_group = strdup (__nis_default_group (NULL));
obj->zo_access = __nis_default_access (NULL, 0);
obj->zo_ttl = __nis_default_ttl (0);
- obj->zo_data.zo_type = GROUP_OBJ;
+ obj->zo_data.zo_type = NIS_GROUP_OBJ;
obj->zo_data.objdata_u.gr_data.gr_flags = flags;
obj->zo_data.objdata_u.gr_data.gr_members.gr_members_len = 0;
obj->zo_data.objdata_u.gr_data.gr_members.gr_members_val = NULL;
diff --git a/nis/nis_defaults.c b/nis/nis_defaults.c
index 53a585b5169..21a80506ffe 100644
--- a/nis/nis_defaults.c
+++ b/nis/nis_defaults.c
@@ -23,7 +23,6 @@
#include <sys/types.h>
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#define DEFAULT_TTL 43200
@@ -33,8 +32,7 @@
static nis_name
searchgroup (char *str)
{
- static char default_group[NIS_MAXNAMELEN];
- char *cptr;
+ char *cptr;
int i;
cptr = strstr (str, "group=");
@@ -48,13 +46,12 @@ searchgroup (char *str)
if (i == 0) /* only "group=" ? */
return (nis_name) "";
- return strncpy (default_group, cptr, i);
+ return strndup (cptr, i);
}
static nis_name
searchowner (char *str)
{
- static char default_owner[NIS_MAXNAMELEN];
char *cptr;
int i;
@@ -67,9 +64,9 @@ searchowner (char *str)
while (cptr[i] != '\0' && cptr[i] != ':')
i++;
if (i == 0) /* only "owner=" ? */
- return (nis_name)"";
+ return strdup ("");
- return strncpy (default_owner, cptr, i);
+ return strndup (cptr, i);
}
static u_long
@@ -134,9 +131,9 @@ searchttl (char *str)
static u_long
searchaccess (char *str, u_long access)
{
- static char buf[NIS_MAXNAMELEN];
+ char buf[NIS_MAXNAMELEN];
char *cptr;
- u_long result;
+ u_long result = access;
int i;
int n, o, g, w;
@@ -153,7 +150,7 @@ searchaccess (char *str, u_long access)
strncpy (buf, cptr, i);
- result = n = o = g = w = 0;
+ n = o = g = w = 0;
cptr = buf;
while (*cptr != '\0')
{
@@ -221,11 +218,11 @@ searchaccess (char *str, u_long access)
result = result & ~(NIS_DESTROY_ACC);
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return ULONG_MAX;
}
cptr++;
}
+ n = o = g = w = 0;
break;
case '+':
cptr++; /* Remove "=" from beginning */
@@ -274,11 +271,11 @@ searchaccess (char *str, u_long access)
result = result | (NIS_DESTROY_ACC);
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return ULONG_MAX;
}
cptr++;
}
+ n = o = g = w = 0;
break;
case '=':
cptr++; /* Remove "=" from beginning */
@@ -341,26 +338,25 @@ searchaccess (char *str, u_long access)
result = result | (NIS_DESTROY_ACC);
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return result = ULONG_MAX;
}
cptr++;
}
+ n = o = g = w = 0;
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return result = ULONG_MAX;
}
cptr++;
}
- return 0;
+ return result;
}
nis_name
__nis_default_owner (char *defaults)
{
- static char default_owner[NIS_MAXNAMELEN];
+ char default_owner[NIS_MAXNAMELEN];
char *cptr, *dptr;
strcpy (default_owner, nis_local_principal ());
@@ -369,7 +365,11 @@ __nis_default_owner (char *defaults)
{
dptr = strstr (defaults, "owner=");
if (dptr != NULL)
- strcpy (default_owner, searchowner (defaults));
+ {
+ char *p = searchowner (defaults);
+ strcpy (default_owner, p);
+ free (p);
+ }
}
else
{
@@ -378,17 +378,21 @@ __nis_default_owner (char *defaults)
{
dptr = strstr (cptr, "owner=");
if (dptr != NULL)
- strcpy (default_owner, searchowner (cptr));
+ {
+ char *p = searchowner (cptr);
+ strcpy (default_owner, p);
+ free (p);
+ }
}
}
- return default_owner;
+ return strdup (default_owner);
}
nis_name
__nis_default_group (char *defaults)
{
- static char default_group[NIS_MAXNAMELEN];
+ char default_group[NIS_MAXNAMELEN];
char *cptr, *dptr;
strcpy (default_group, nis_local_group ());
@@ -397,7 +401,11 @@ __nis_default_group (char *defaults)
{
dptr = strstr (defaults, "group=");
if (dptr != NULL)
- strcpy (default_group, searchgroup (defaults));
+ {
+ char *p = searchgroup (defaults);
+ strcpy (default_group, p);
+ free (p);
+ }
}
else
{
@@ -406,11 +414,15 @@ __nis_default_group (char *defaults)
{
dptr = strstr (cptr, "group=");
if (dptr != NULL)
- strcpy (default_group, searchgroup (cptr));
+ {
+ char *p = searchgroup (cptr);
+ strcpy (default_group, p);
+ free (p);
+ }
}
}
- return default_group;
+ return strdup (default_group);
}
u_long
diff --git a/nis/nis_destroygroup.c b/nis/nis_destroygroup.c
index 6ece45345d7..5b70a67b683 100644
--- a/nis/nis_destroygroup.c
+++ b/nis/nis_destroygroup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_destroygroup (const_nis_name group)
@@ -42,7 +41,7 @@ nis_destroygroup (const_nis_name group)
stpcpy (cp, cp2);
}
res = nis_remove (buf, NULL);
- status = res->status;
+ status = NIS_RES_STATUS (res);
nis_freeresult (res);
return status;
}
diff --git a/nis/nis_domain_of.c b/nis/nis_domain_of.c
index f0cfe316e69..f6cca815b45 100644
--- a/nis/nis_domain_of.c
+++ b/nis/nis_domain_of.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_domain_of (const_nis_name name)
diff --git a/nis/nis_domain_of_r.c b/nis/nis_domain_of_r.c
index 3435233aef4..00238d06939 100644
--- a/nis/nis_domain_of_r.c
+++ b/nis/nis_domain_of_r.c
@@ -20,7 +20,6 @@
#include <errno.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
diff --git a/nis/nis_error.c b/nis/nis_error.c
index 6ed1cc914ab..ced0f716fd5 100644
--- a/nis/nis_error.c
+++ b/nis/nis_error.c
@@ -21,7 +21,6 @@
#include <syslog.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
static const char *nis_errlist[] =
diff --git a/nis/nis_file.c b/nis/nis_file.c
index c32d54a622e..fdd7cd4214a 100644
--- a/nis/nis_file.c
+++ b/nis/nis_file.c
@@ -21,8 +21,6 @@
#include <stdlib.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
-
static const char cold_start_file[] = "/var/nis/NIS_COLD_START";
diff --git a/nis/nis_free.c b/nis/nis_free.c
index a4ab7378e6a..5d08882f845 100644
--- a/nis/nis_free.c
+++ b/nis/nis_free.c
@@ -18,317 +18,53 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
void
-nis_free_attr (nis_attr *obj)
+__free_fdresult (fd_result *res)
{
- if (obj == NULL)
- return;
-
- if (obj->zattr_ndx)
- {
- free (obj->zattr_ndx);
- obj->zattr_ndx = NULL;
- }
-
- if (obj->zattr_val.zattr_val_val)
+ if (res != NULL)
{
- free (obj->zattr_val.zattr_val_val);
- obj->zattr_val.zattr_val_val = NULL;
- obj->zattr_val.zattr_val_len = 0;
+ xdr_free ((xdrproc_t)xdr_fd_result, (char *)res);
+ free (res);
}
}
void
nis_free_request (ib_request *ibreq)
{
- unsigned int i;
-
- for (i = 0; i < ibreq->ibr_srch.ibr_srch_len; ++i)
- {
- nis_free_attr (&(ibreq->ibr_srch.ibr_srch_val)[i]);
- ibreq->ibr_srch.ibr_srch_val = NULL;
- ibreq->ibr_srch.ibr_srch_len = 0;
- }
-
- if (ibreq->ibr_name)
- {
- free (ibreq->ibr_name);
- ibreq->ibr_name = NULL;
- }
-
- if (ibreq->ibr_cookie.n_bytes)
- {
- free (ibreq->ibr_cookie.n_bytes);
- ibreq->ibr_cookie.n_bytes = NULL;
- ibreq->ibr_cookie.n_len = 0;
- }
-}
-
-void
-nis_free_endpoints (endpoint *ep, unsigned int len)
-{
- unsigned int i;
-
- if (ep == NULL)
- return;
-
- for (i = 0; i < len; ++i)
- {
- if (ep[i].uaddr)
- {
- free (ep[i].uaddr);
- ep[i].uaddr = NULL;
- }
- if (ep[i].family)
- {
- free (ep[i].family);
- ep[i].family = NULL;
- }
- if (ep[i].proto)
- {
- free (ep[i].proto);
- ep[i].proto = NULL;
- }
- }
-}
-
-void
-nis_free_servers (nis_server *obj, unsigned int len)
-{
- unsigned int i;
-
- if (obj == NULL)
- return;
-
- for (i = 0; i < len; i++)
+ if (ibreq != NULL)
{
- if (obj[i].name)
- {
- free (obj[i].name);
- obj[i].name = NULL;
- }
- if (obj[i].ep.ep_len > 0)
- {
- nis_free_endpoints (obj[i].ep.ep_val, obj[i].ep.ep_len);
- free (obj[i].ep.ep_val);
- obj[i].ep.ep_val = NULL;
- obj[i].ep.ep_len = 0;
- }
- if (obj[i].pkey.n_bytes && obj[i].pkey.n_len > 0)
- {
- free (obj[i].pkey.n_bytes);
- obj[i].pkey.n_bytes = NULL;
- obj[i].pkey.n_len = 0;
- }
+ xdr_free ((xdrproc_t)xdr_ib_request, (char *)ibreq);
+ free (ibreq);
}
}
void
nis_free_directory (directory_obj *obj)
{
- if (obj == NULL)
- return;
- if (obj->do_name)
- {
- free (obj->do_name);
- obj->do_name = NULL;
- }
- if (obj->do_servers.do_servers_len > 0)
+ if (obj != NULL)
{
- nis_free_servers (obj->do_servers.do_servers_val,
- obj->do_servers.do_servers_len);
- free (obj->do_servers.do_servers_val);
- obj->do_servers.do_servers_val = NULL;
- obj->do_servers.do_servers_len = 0;
- }
- if (obj->do_armask.do_armask_len > 0)
- {
- free (obj->do_armask.do_armask_val);
- obj->do_armask.do_armask_val = NULL;
- obj->do_armask.do_armask_len = 0;
- }
-}
-
-void
-nis_free_group (group_obj *obj)
-{
- unsigned int i;
-
- if (obj->gr_members.gr_members_len > 0)
- {
- for (i = 0; i < obj->gr_members.gr_members_len; ++i)
- if (obj->gr_members.gr_members_val[i])
- free (obj->gr_members.gr_members_val[i]);
- free (obj->gr_members.gr_members_val);
- obj->gr_members.gr_members_val = NULL;
- obj->gr_members.gr_members_len = 0;
- }
-}
-
-void
-nis_free_table (table_obj *obj)
-{
- if (obj == NULL)
- return;
-
- if (obj->ta_type)
- {
- free (obj->ta_type);
- obj->ta_type = NULL;
- }
-
- if (obj->ta_cols.ta_cols_val)
- {
- unsigned int i;
-
- for (i = 0; i < obj->ta_cols.ta_cols_len; ++i)
- if (obj->ta_cols.ta_cols_val[i].tc_name)
- free (obj->ta_cols.ta_cols_val[i].tc_name);
- free (obj->ta_cols.ta_cols_val);
- obj->ta_cols.ta_cols_val = NULL;
- obj->ta_cols.ta_cols_len = 0;
- }
-
- if (obj->ta_path)
- {
- free (obj->ta_path);
- obj->ta_path = NULL;
- }
-}
-
-void
-nis_free_entry (entry_obj *obj)
-{
- if (obj == NULL)
- return;
-
- if (obj->en_type)
- {
- free (obj->en_type);
- obj->en_type = 0;
- }
-
- if (obj->en_cols.en_cols_val)
- {
- unsigned int i;
-
- for (i = 0; i < obj->en_cols.en_cols_len; ++i)
- if (obj->en_cols.en_cols_val[i].ec_value.ec_value_val)
- free (obj->en_cols.en_cols_val[i].ec_value.ec_value_val);
- free (obj->en_cols.en_cols_val);
- obj->en_cols.en_cols_val = NULL;
- obj->en_cols.en_cols_len = 0;
- }
-}
-
-void
-nis_free_link (link_obj *obj)
-{
- if (obj == NULL)
- return;
-
- if (obj->li_attrs.li_attrs_val)
- {
- unsigned int i;
-
- for (i = 0; i < obj->li_attrs.li_attrs_len; ++i)
- {
- if (obj->li_attrs.li_attrs_val[i].zattr_ndx)
- free (obj->li_attrs.li_attrs_val[i].zattr_ndx);
- if (obj->li_attrs.li_attrs_val[i].zattr_val.zattr_val_val)
- free (obj->li_attrs.li_attrs_val[i].zattr_val.zattr_val_val);
- }
- free (obj->li_attrs.li_attrs_val);
- obj->li_attrs.li_attrs_val = NULL;
- obj->li_attrs.li_attrs_len = 0;
- }
-
- if (obj->li_name)
- {
- free (obj->li_name);
- obj->li_name = NULL;
+ xdr_free ((xdrproc_t)xdr_directory_obj, (char *)obj);
+ free (obj);
}
}
void
nis_free_object (nis_object *obj)
{
-
- if (obj == NULL)
- return;
-
- if (obj->zo_name)
- {
- free (obj->zo_name);
- obj->zo_name = NULL;
- }
- if (obj->zo_owner)
- {
- free (obj->zo_owner);
- obj->zo_owner = NULL;
- }
- if (obj->zo_group)
+ if (obj != NULL)
{
- free (obj->zo_group);
- obj->zo_group = NULL;
+ xdr_free ((xdrproc_t)xdr_nis_object, (char *)obj);
+ free (obj);
}
- if (obj->zo_domain)
- {
- free (obj->zo_domain);
- obj->zo_domain = NULL;
- }
- switch (obj->zo_data.zo_type)
- {
- case BOGUS_OBJ:
- break;
- case NO_OBJ:
- break;
- case DIRECTORY_OBJ:
- nis_free_directory (&obj->zo_data.objdata_u.di_data);
- break;
- case GROUP_OBJ:
- nis_free_group (&obj->zo_data.objdata_u.gr_data);
- break;
- case TABLE_OBJ:
- nis_free_table (&obj->zo_data.objdata_u.ta_data);
- break;
- case ENTRY_OBJ:
- nis_free_entry (&obj->zo_data.objdata_u.en_data);
- break;
- case LINK_OBJ:
- nis_free_link (&obj->zo_data.objdata_u.li_data);
- break;
- case PRIVATE_OBJ:
- if (obj->zo_data.objdata_u.po_data.po_data_val)
- {
- free (obj->zo_data.objdata_u.po_data.po_data_val);
- obj->zo_data.objdata_u.po_data.po_data_val = NULL;
- }
- break;
- default:
- break;
- }
- obj->zo_data.zo_type = NO_OBJ;
}
void
nis_freeresult (nis_result *res)
{
- unsigned int i;
-
- if (res == NULL)
- return;
-
- for (i = 0; i < res->objects.objects_len; i++)
- nis_free_object (&(res->objects.objects_val)[i]);
-
- if (res->objects.objects_val != NULL)
- free (res->objects.objects_val);
-
- if (res->cookie.n_bytes != NULL && res->cookie.n_len > 0)
- free (res->cookie.n_bytes);
-
- free (res);
+ if (res != NULL)
+ {
+ xdr_free ((xdrproc_t)xdr_nis_result, (char *)res);
+ free (res);
+ }
}
diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c
index b30b70b584f..1629c24053a 100644
--- a/nis/nis_getservlist.c
+++ b/nis/nis_getservlist.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_server **
@@ -30,19 +29,21 @@ nis_getservlist (const_nis_name dir)
res = nis_lookup (dir, FOLLOW_LINKS);
- if (res->status == NIS_SUCCESS || res->status == NIS_S_SUCCESS)
+ if (NIS_RES_STATUS (res) == NIS_SUCCESS)
{
unsigned long i;
nis_server *server;
- serv = calloc (1, sizeof (nis_server *) *
- (res->objects.objects_val->DI_data.do_servers.do_servers_len + 1));
+ serv =
+ calloc (1, sizeof (nis_server *) *
+ (NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len + 1));
if (serv == NULL)
return NULL;
- for (i = 0; i < res->objects.objects_val->DI_data.do_servers.do_servers_len; ++i)
+ for (i = 0; i < NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len;
+ ++i)
{
server =
- &res->objects.objects_val->DI_data.do_servers.do_servers_val[i];
+ &NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_val[i];
serv[i] = calloc (1, sizeof (nis_server));
if (server->name != NULL)
serv[i]->name = strdup (server->name);
@@ -110,7 +111,7 @@ nis_freeservlist (nis_server **serv)
i = 0;
while (serv[i] != NULL)
{
- nis_free_servers (serv[i], 1);
+ xdr_free ((xdrproc_t)xdr_nis_server, (char *)serv[i]);
free (serv[i]);
++i;
}
diff --git a/nis/nis_intern.h b/nis/nis_intern.h
index ce88f0790dd..e714621f1b7 100644
--- a/nis/nis_intern.h
+++ b/nis/nis_intern.h
@@ -67,10 +67,6 @@ extern nis_error __do_niscall __P ((const_nis_name name, u_long prog,
extern AUTH *authdes_pk_create __P ((const char *, const netobj *, u_int,
struct sockaddr *, des_block *));
-/* NIS+ cache */
-extern directory_obj *__cache_search __P ((const_nis_name name));
-extern nis_error __cache_add __P ((fd_result *));
-
/* NIS+ callback */
extern nis_error __nis_do_callback __P ((struct dir_binding *bptr,
netobj *cookie, struct nis_cb *cb));
diff --git a/nis/nis_ismember.c b/nis/nis_ismember.c
index 85c401531e5..aadd19753ac 100644
--- a/nis/nis_ismember.c
+++ b/nis/nis_ismember.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
/* internal_nis_ismember ()
return codes: -1 principal is in -group
@@ -28,105 +27,97 @@
static int
internal_ismember (const_nis_name principal, const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
- {
- char buf[strlen (group) + 50];
- char leafbuf[strlen (group) + 2];
- char domainbuf[strlen (group) + 2];
- nis_result *res;
- char *cp, *cp2;
- u_int i;
+ char buf[strlen (group) + 50];
+ char leafbuf[strlen (group) + 2];
+ char domainbuf[strlen (group) + 2];
+ nis_result *res;
+ char *cp, *cp2;
+ u_int i;
- cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
- cp = stpcpy (cp, ".groups_dir");
- cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
- {
- *cp++ = '.';
- strcpy (cp, cp2);
- }
- res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
- if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
- return 0;
+ cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
+ cp = stpcpy (cp, ".groups_dir");
+ cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
+ if (cp2 != NULL && strlen (cp2) > 0)
+ {
+ *cp++ = '.';
+ strcpy (cp, cp2);
+ }
+ res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS)
+ return 0;
- if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
- return 0;
+ if ((NIS_RES_NUMOBJ (res) != 1) ||
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
+ return 0;
- /* We search twice in the list, at first, if we have the name
- with a "-", then if without. "-member" has priority */
- for (i = 0;
- i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
- ++i)
+ /* We search twice in the list, at first, if we have the name
+ with a "-", then if without. "-member" has priority */
+ for (i = 0; i < NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len; ++i)
+ {
+ cp = NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[i];
+ if (cp[0] == '-')
{
- cp =res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
- if (cp[0] == '-')
- {
- if (strcmp (&cp[1], principal) == 0)
+ if (strcmp (&cp[1], principal) == 0)
+ return -1;
+ if (cp[1] == '@')
+ switch (internal_ismember (principal, &cp[2]))
+ {
+ case -1:
return -1;
- if (cp[1] == '@')
- switch (internal_ismember (principal, &cp[2]))
- {
- case -1:
- return -1;
- case 1:
- return -1;
- default:
- break;
- }
- else
- if (cp[1] == '*')
- {
- char buf1[strlen (principal) + 2];
- char buf2[strlen (cp) + 2];
+ case 1:
+ return -1;
+ default:
+ break;
+ }
+ else
+ if (cp[1] == '*')
+ {
+ char buf1[strlen (principal) + 2];
+ char buf2[strlen (cp) + 2];
- strcpy (buf1, nis_domain_of (principal));
- strcpy (buf2, nis_domain_of (cp));
- if (strcmp (buf1, buf2) == 0)
- return -1;
- }
- }
+ strcpy (buf1, nis_domain_of (principal));
+ strcpy (buf2, nis_domain_of (cp));
+ if (strcmp (buf1, buf2) == 0)
+ return -1;
+ }
}
- for (i = 0;
- i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
- ++i)
+ }
+ for (i = 0; i < NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; ++i)
+ {
+ cp = NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[i];
+ if (cp[0] != '-')
{
- cp =res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
- if (cp[0] != '-')
- {
- if (strcmp (cp, principal) == 0)
+ if (strcmp (cp, principal) == 0)
+ return 1;
+ if (cp[0] == '@')
+ switch (internal_ismember (principal, &cp[1]))
+ {
+ case -1:
+ return -1;
+ case 1:
return 1;
- if (cp[0] == '@')
- switch (internal_ismember (principal, &cp[1]))
- {
- case -1:
- return -1;
- case 1:
- return 1;
- default:
- break;
- }
- else
- if (cp[0] == '*')
- {
- char buf1[strlen (principal) + 2];
- char buf2[strlen (cp) + 2];
+ default:
+ break;
+ }
+ else
+ if (cp[0] == '*')
+ {
+ char buf1[strlen (principal) + 2];
+ char buf2[strlen (cp) + 2];
- if (strcmp (nis_domain_of_r (principal, buf1, sizeof buf1),
- nis_domain_of_r (cp, buf2, sizeof buf2)) == 0)
- return 1;
- }
- }
+ if (strcmp (nis_domain_of_r (principal, buf1, sizeof buf1),
+ nis_domain_of_r (cp, buf2, sizeof buf2)) == 0)
+ return 1;
+ }
}
}
-
return 0;
}
bool_t
nis_ismember (const_nis_name principal, const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && strlen (group) > 0 && principal != NULL)
return internal_ismember (principal, group) == 1 ? TRUE : FALSE;
else
return FALSE;
diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c
index 348c7534a36..bcae9958378 100644
--- a/nis/nis_local_names.c
+++ b/nis/nis_local_names.c
@@ -21,7 +21,6 @@
#include <string.h>
#include <unistd.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_local_group (void)
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index bdce5d5a0ac..cbc64c34a49 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
@@ -72,7 +71,7 @@ nis_lookup (const_nis_name name, const u_long flags)
case NIS_PARTIAL:
case NIS_SUCCESS:
case NIS_S_SUCCESS:
- if (__type_of(NIS_RES_OBJECT (res)) == LINK_OBJ &&
+ if (__type_of(NIS_RES_OBJECT (res)) == NIS_LINK_OBJ &&
flags & FOLLOW_LINKS) /* We are following links */
{
/* if we hit the link limit, bail */
@@ -93,7 +92,7 @@ nis_lookup (const_nis_name name, const u_long flags)
++done;
break;
case NIS_CBRESULTS:
- /* XXX Implement CALLBACK here ! */
+ /* The callback is handled in __do_niscall2 */
++done;
break;
case NIS_UNAVAIL:
diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c
index ab693d7da16..acd0122bdf1 100644
--- a/nis/nis_mkdir.c
+++ b/nis/nis_mkdir.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_error
diff --git a/nis/nis_modify.c b/nis/nis_modify.c
index 739ae0c3517..3f2cca46986 100644
--- a/nis/nis_modify.c
+++ b/nis/nis_modify.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
@@ -60,7 +59,7 @@ nis_modify (const_nis_name name, const nis_object *obj)
(caddr_t) & req, (xdrproc_t) xdr_nis_result,
(caddr_t) res, MASTER_ONLY,
NULL)) != RPC_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
req.ns_object.ns_object_val[0].zo_name = p1;
req.ns_object.ns_object_val[0].zo_owner = p2;
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index a06dfdee8d6..1397cb9c98c 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
void
@@ -35,7 +34,7 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
if (dirobj == NULL)
{
res = nis_lookup (dirname, MASTER_ONLY);
- if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
+ if (res->status != NIS_SUCCESS)
return;
obj = res->objects.objects_val;
}
@@ -43,7 +42,7 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
obj = (nis_object *) dirobj;
/* Check if obj is really a diryectory object */
- if (obj->zo_data.zo_type != DIRECTORY_OBJ)
+ if (__type_of (obj) != NIS_DIRECTORY_OBJ)
{
if (res != NULL)
nis_freeresult (res);
diff --git a/nis/nis_print.c b/nis/nis_print.c
index 1914840e863..5aa43c340f3 100644
--- a/nis/nis_print.c
+++ b/nis/nis_print.c
@@ -21,7 +21,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
static const char *
nis_nstype2str (const nstype type)
@@ -49,10 +48,9 @@ nis_nstype2str (const nstype type)
}
}
-static char *
-nis_ttl2str (const u_long ttl)
+static void
+print_ttl (const u_long ttl)
{
- static char buf[64];
unsigned long int time, s, m, h;
time = ttl;
@@ -62,19 +60,40 @@ nis_ttl2str (const u_long ttl)
m = time / 60;
time %= 60;
s = time;
- snprintf (buf, 63, "%lu:%02lu:%02lu", h, m, s);
-
- return buf;
+ printf ("%lu:%lu:%lu\n", h, m, s);
}
-static char *
-nis_flags2str (const u_long flags)
+static void
+print_flags (const u_long flags)
{
- static char buf[1024];
+ fputs ("(", stdout);
- snprintf (buf, 1023, "%lu", flags);
+ if (flags & TA_SEARCHABLE)
+ fputs ("SEARCHABLE, ", stdout);
- return buf;
+ if (flags & TA_BINARY)
+ {
+ fputs ("BINARY DATA", stdout);
+ if (flags & TA_XDR)
+ fputs (", XDR ENCODED", stdout);
+ if (flags & TA_ASN1)
+ fputs (", ASN.1 ENCODED", stdout);
+ if (flags & TA_CRYPT)
+ fputs (", ENCRYPTED", stdout);
+ }
+ else
+ {
+ fputs("TEXTUAL DATA", stdout);
+ if (flags & TA_SEARCHABLE)
+ {
+ if (flags & TA_CASE)
+ fputs (", CASE INSENSITIVE", stdout);
+ else
+ fputs (", CASE SENSITIVE", stdout);
+ }
+ }
+
+ fputs (")\n", stdout);
}
static void
@@ -82,28 +101,28 @@ nis_print_objtype (enum zotypes type)
{
switch (type)
{
- case BOGUS_OBJ:
+ case NIS_BOGUS_OBJ:
fputs (_("BOGUS OBJECT\n"), stdout);
break;
- case NO_OBJ:
+ case NIS_NO_OBJ:
fputs (_("NO OBJECT\n"), stdout);
break;
- case DIRECTORY_OBJ:
+ case NIS_DIRECTORY_OBJ:
fputs (_("DIRECTORY\n"), stdout);
break;
- case GROUP_OBJ:
+ case NIS_GROUP_OBJ:
fputs (_("GROUP\n"), stdout);
break;
- case TABLE_OBJ:
+ case NIS_TABLE_OBJ:
fputs (_("TABLE\n"), stdout);
break;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
fputs (_("ENTRY\n"), stdout);
break;
- case LINK_OBJ:
+ case NIS_LINK_OBJ:
fputs (_("LINK\n"), stdout);
break;
- case PRIVATE_OBJ:
+ case NIS_PRIVATE_OBJ:
fputs (_("PRIVATE\n"), stdout);
break;
default:
@@ -141,7 +160,7 @@ nis_print_directory (const directory_obj *dir)
unsigned int i;
printf (_("Name : '%s'\n"), dir->do_name);
- printf (_("Type : %s\n"), gettext (nis_nstype2str (dir->do_type)));
+ printf (_("Type : %s\n"), nis_nstype2str (dir->do_type));
sptr = dir->do_servers.do_servers_val;
for (i = 0; i < dir->do_servers.do_servers_len; i++)
{
@@ -157,16 +176,20 @@ nis_print_directory (const directory_obj *dir)
fputs (_("None.\n"), stdout);
break;
case NIS_PK_DH:
- fputs (_("DH.\n"), stdout);
+ fprintf (stdout, _("Diffie-Hellmann (%d bits)\n"),
+ (sptr->pkey.n_len - 1) * 4);
+ /* sptr->pkey.n_len counts the last 0, too */
break;
case NIS_PK_RSA:
- fputs (_("RSA.\n"), stdout);
+ fprintf (stdout, _("RSA (%d bits)\n"),
+ (sptr->pkey.n_len - 1) * 4);
break;
case NIS_PK_KERB:
- fputs (_("Kerberous.\n"), stdout);
+ fputs (_("Kerberos.\n"), stdout);
break;
default:
- fputs (_("Unknown.\n"), stdout);
+ fprintf (stdout, _("Unknown (type = %d, bits = %d)\n"),
+ sptr->key_type, (sptr->pkey.n_len - 1) * 4);
break;
}
@@ -198,7 +221,9 @@ nis_print_directory (const directory_obj *dir)
sptr++;
}
- printf (_("Time to live : %s\n"), nis_ttl2str (dir->do_ttl));
+ fputs (_("Time to live : "), stdout);
+ print_ttl (dir->do_ttl);
+ fputs (_("Default Access rights :\n"), stdout);
if (dir->do_armask.do_armask_len != 0)
{
oar_mask *ptr;
@@ -206,9 +231,11 @@ nis_print_directory (const directory_obj *dir)
ptr = dir->do_armask.do_armask_val;
for (i = 0; i < dir->do_armask.do_armask_len; i++)
{
- fputs (_("Default Access rights: "), stdout);
nis_print_rights (ptr->oa_rights);
- printf (_("\nDirect Type : %d\n"), ptr->oa_otype);
+ printf (_("\tType : %s\n"), nis_nstype2str (ptr->oa_otype));
+ printf (_("\tAccess rights: "));
+ nis_print_rights (ptr->oa_rights);
+ fputs ("\n", stdout);
ptr++;
}
}
@@ -242,8 +269,8 @@ nis_print_table (const table_obj *obj)
{
printf (_("\t[%d]\tName : %s\n"), i,
obj->ta_cols.ta_cols_val[i].tc_name);
- printf (_("\t\tAttributes : %s\n"),
- nis_flags2str (obj->ta_cols.ta_cols_val[i].tc_flags));
+ fputs (_("\t\tAttributes : "), stdout);
+ print_flags (obj->ta_cols.ta_cols_val[i].tc_flags);
fputs (_("\t\tAccess Rights : "), stdout);
nis_print_rights (obj->ta_cols.ta_cols_val[i].tc_rights);
fputc ('\n', stdout);
@@ -274,7 +301,8 @@ nis_print_entry (const entry_obj *obj)
else if ((obj->en_cols.en_cols_val[i].ec_flags & EN_BINARY) == EN_BINARY)
fputs (_("Binary data\n"), stdout);
else
- printf ("%s\n", obj->en_cols.en_cols_val[i].ec_value.ec_value_val);
+ printf ("%.*s\n", (int)obj->en_cols.en_cols_val[i].ec_value.ec_value_len,
+ obj->en_cols.en_cols_val[i].ec_value.ec_value_val);
}
}
@@ -287,29 +315,30 @@ nis_print_object (const nis_object * obj)
printf (_("Group : %s\n"), obj->zo_group);
fputs (_("Access Rights : "), stdout);
nis_print_rights (obj->zo_access);
- printf (_("\nTime to Live : %lu (seconds)\n"), obj->zo_ttl);
+ printf (_("\nTime to Live : "));
+ print_ttl (obj->zo_ttl);
printf (_("Creation Time : %s"), ctime (&obj->zo_oid.ctime));
printf (_("Mod. Time : %s"), ctime (&obj->zo_oid.mtime));
fputs (_("Object Type : "), stdout);
nis_print_objtype (obj->zo_data.zo_type);
switch (obj->zo_data.zo_type)
{
- case DIRECTORY_OBJ:
+ case NIS_DIRECTORY_OBJ:
nis_print_directory (&obj->zo_data.objdata_u.di_data);
break;
- case GROUP_OBJ:
+ case NIS_GROUP_OBJ:
nis_print_group (&obj->zo_data.objdata_u.gr_data);
break;
- case TABLE_OBJ:
+ case NIS_TABLE_OBJ:
nis_print_table (&obj->zo_data.objdata_u.ta_data);
break;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
nis_print_entry (&obj->zo_data.objdata_u.en_data);
break;
- case LINK_OBJ:
+ case NIS_LINK_OBJ:
nis_print_link (&obj->zo_data.objdata_u.li_data);
break;
- case PRIVATE_OBJ:
+ case NIS_PRIVATE_OBJ:
printf (_(" Data Length = %u\n"),
obj->zo_data.objdata_u.po_data.po_data_len);
break;
diff --git a/nis/nis_print_group_entry.c b/nis/nis_print_group_entry.c
index 1063ef84119..fbc9ad11bae 100644
--- a/nis/nis_print_group_entry.c
+++ b/nis/nis_print_group_entry.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
void
nis_print_group_entry (const_nis_name group)
@@ -29,6 +28,10 @@ nis_print_group_entry (const_nis_name group)
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 3];
char domainbuf[strlen (group) + 3];
+ unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
+ unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
+ char **mem_exp, **mem_imp, **mem_rec;
+ char **nomem_exp, **nomem_imp, **nomem_rec;
nis_result *res;
char *cp, *cp2;
u_int i;
@@ -41,19 +44,132 @@ nis_print_group_entry (const_nis_name group)
*cp++ = '.';
stpcpy (cp, cp2);
}
- res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
+ res = nis_lookup (buf, FOLLOW_LINKS | EXPAND_NAME);
- if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
+ if (NIS_RES_STATUS(res) != NIS_SUCCESS)
return;
- if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
+ if ((NIS_RES_NUMOBJ (res) != 1) ||
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
return;
+ mem_exp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ mem_imp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ mem_rec = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ nomem_exp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ nomem_imp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ nomem_rec = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+
for (i = 0;
- i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
- ++i)
- fprintf (stdout, " %s\n",
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i]);
+ i < NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; ++i)
+ {
+ char *grmem =
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[i];
+ int neg = grmem[0] == '-';
+
+ switch (grmem[neg])
+ {
+ case '*':
+ if (neg)
+ {
+ nomem_imp[nomem_imp_cnt] = grmem;
+ ++nomem_imp_cnt;
+ }
+ else
+ {
+ mem_imp[mem_imp_cnt] = grmem;
+ ++mem_imp_cnt;
+ }
+ break;
+ case '@':
+ if (neg)
+ {
+ nomem_rec[nomem_rec_cnt] = grmem;
+ ++nomem_rec_cnt;
+ }
+ else
+ {
+ mem_rec[mem_rec_cnt] = grmem;
+ ++mem_rec_cnt;
+ }
+ break;
+ default:
+ if (neg)
+ {
+ nomem_exp[nomem_exp_cnt] = grmem;
+ ++nomem_exp_cnt;
+ }
+ else
+ {
+ mem_exp[mem_exp_cnt] = grmem;
+ ++mem_exp_cnt;
+ }
+ break;
+ }
+ }
+ {
+ char buf[strlen (NIS_RES_OBJECT (res)->zo_domain) + 10];
+ printf (_("Group entry for \"%s.%s\" group:\n"),
+ NIS_RES_OBJECT (res)->zo_name,
+ nis_domain_of_r (NIS_RES_OBJECT (res)->zo_domain,
+ buf, strlen (NIS_RES_OBJECT (res)->zo_domain)
+ + 10));
+ }
+ if (mem_exp_cnt)
+ {
+ fputs (_(" Explicit members:\n"), stdout);
+ for (i = 0; i < mem_exp_cnt; ++i)
+ printf ("\t%s\n", mem_exp[i]);
+ }
+ else
+ fputs (_(" No explicit members\n"), stdout);
+ if (mem_imp_cnt)
+ {
+ fputs (_(" Implicit members:\n"), stdout);
+ for (i = 0; i < mem_imp_cnt; ++i)
+ printf ("\t%s\n", &mem_imp[i][2]);
+ }
+ else
+ fputs (_(" No implicit members\n"), stdout);
+ if (mem_rec_cnt)
+ {
+ fputs (_(" Recursive members:\n"), stdout);
+ for (i = 0; i < mem_rec_cnt; ++i)
+ printf ("\t%s\n", &mem_rec[i][1]);
+ }
+ else
+ fputs (_(" No recursive members\n"), stdout);
+ if (nomem_exp_cnt)
+ {
+ fputs (_(" Explicit nonmembers:\n"), stdout);
+ for (i = 0; i < nomem_exp_cnt; ++i)
+ printf ("\t%s\n", &nomem_exp[i][1]);
+ }
+ else
+ fputs (_(" No explicit nonmembers\n"), stdout);
+ if (nomem_imp_cnt)
+ {
+ fputs (_(" Implicit nonmembers:\n"), stdout);
+ for (i = 0; i < nomem_imp_cnt; ++i)
+ printf ("\t%s\n", &mem_imp[i][3]);
+ }
+ else
+ fputs (_(" No implicit nonmembers\n"), stdout);
+ if (nomem_rec_cnt)
+ {
+ fputs (_(" Explicit nonmembers:\n"), stdout);
+ for (i = 0; i < nomem_rec_cnt; ++i)
+ printf ("\t%s=n", &nomem_rec[i][2]);
+ }
+ else
+ fputs (_(" No recursive nonmembers\n"), stdout);
+
+ free (mem_exp);
+ free (mem_imp);
+ free (mem_rec);
+ free (nomem_exp);
+ free (nomem_imp);
+ free (nomem_rec);
+ nis_freeresult (res);
}
}
diff --git a/nis/nis_remove.c b/nis/nis_remove.c
index 2fa9ecc3534..cbbbdfcfd04 100644
--- a/nis/nis_remove.c
+++ b/nis/nis_remove.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
@@ -48,7 +47,7 @@ nis_remove (const_nis_name name, const nis_object *obj)
(caddr_t) & req, (xdrproc_t) xdr_nis_result,
(caddr_t) res, MASTER_ONLY,
NULL)) != RPC_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
nis_destroy_object (req.ns_object.ns_object_val);
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index 8ed67caf982..71807a3ffe2 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_removemember (const_nis_name member, const_nis_name group)
@@ -50,40 +49,40 @@ nis_removemember (const_nis_name member, const_nis_name group)
nis_freeresult (res);
return status;
}
+
if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
return NIS_INVALIDOBJ;
-
- newmem = calloc (1, res->objects.objects_val[0].GR_data.gr_members.gr_members_len *
- sizeof (char *));
-
- k = res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
+ newmem =
+ calloc (1, NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len *
+ sizeof (char *));
+ k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len;
j = 0;
- for (i = 0; i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
+ for (i = 0; i < NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len;
++i)
{
- if (strcmp (res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i],
+ if (strcmp (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i],
member) != 0)
{
- newmem[j] = res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
+ newmem[j] = NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i];
++j;
}
else
{
- free (res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i]);
+ free (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i]);
--k;
}
}
- free (res->objects.objects_val[0].GR_data.gr_members.gr_members_val);
+ free (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val);
newmem = realloc (newmem, k * sizeof (char*));
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val = newmem;
- res->objects.objects_val[0].GR_data.gr_members.gr_members_len = k;
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val = newmem;
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len = k;
- cp = stpcpy (buf, res->objects.objects_val->zo_name);
+ cp = stpcpy (buf, NIS_RES_OBJECT (res)->zo_name);
*cp++ = '.';
- strncpy (cp, res->objects.objects_val->zo_domain, NIS_MAXNAMELEN);
- res2 = nis_modify (buf, res->objects.objects_val);
+ strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN);
+ res2 = nis_modify (buf, NIS_RES_OBJECT (res));
status = res2->status;
nis_freeresult (res);
nis_freeresult (res2);
diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c
index ff84ed81e25..f1214f9f804 100644
--- a/nis/nis_rmdir.c
+++ b/nis/nis_rmdir.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_error
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index fcd19036386..3283e4cf939 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -20,7 +20,6 @@
#include <errno.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_leaf_of (const_nis_name name)
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 3efba6084e3..d2a1df76b2c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
static void
@@ -146,9 +145,7 @@ __create_ib_request (const_nis_name name, struct ib_request *ibreq,
if (ibreq->ibr_name == NULL)
return NULL;
- ibreq->ibr_flags = (flags & (RETURN_RESULT | ADD_OVERWRITE | REM_MULTIPLE |
- MOD_SAMEOBJ | ADD_RESERVED | REM_RESERVED |
- MOD_EXCLUSIVE | ALL_RESULTS));
+ ibreq->ibr_flags = flags;
ibreq->ibr_obj.ibr_obj_len = 0;
ibreq->ibr_obj.ibr_obj_val = NULL;
ibreq->ibr_cbhost.ibr_cbhost_len = 0;
@@ -168,7 +165,7 @@ nis_list (const_nis_name name, u_long flags,
const void *userdata)
{
nis_result *res = NULL;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
int status;
int count_links = 0; /* We will only follow NIS_MAXLINKS links! */
int done = 0;
@@ -179,7 +176,7 @@ nis_list (const_nis_name name, u_long flags,
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
@@ -187,20 +184,20 @@ nis_list (const_nis_name name, u_long flags,
if (flags & EXPAND_NAME)
{
- names = nis_getnames (ibreq.ibr_name);
- free (ibreq.ibr_name);
- ibreq.ibr_name = NULL;
+ names = nis_getnames (ibreq->ibr_name);
+ free (ibreq->ibr_name);
+ ibreq->ibr_name = NULL;
if (names == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_name = strdup (names[name_nr]);
+ ibreq->ibr_name = strdup (names[name_nr]);
}
else
{
names = namebuf;
- names[name_nr] = ibreq.ibr_name;
+ names[name_nr] = ibreq->ibr_name;
}
cb = NULL;
@@ -228,7 +225,7 @@ nis_list (const_nis_name name, u_long flags,
/* nis_lookup handles FOLLOW_LINKS,
so we must have a table object. */
- if (__type_of (NIS_RES_OBJECT (lres)) != TABLE_OBJ)
+ if (__type_of (NIS_RES_OBJECT (lres)) != NIS_TABLE_OBJ)
{
nis_freeresult (lres);
res->status = NIS_INVALIDOBJ;
@@ -276,17 +273,17 @@ nis_list (const_nis_name name, u_long flags,
if (callback != NULL)
{
cb = __nis_create_callback (callback, userdata, flags);
- ibreq.ibr_cbhost.ibr_cbhost_len = 1;
- ibreq.ibr_cbhost.ibr_cbhost_val = cb->serv;
+ ibreq->ibr_cbhost.ibr_cbhost_len = 1;
+ ibreq->ibr_cbhost.ibr_cbhost_val = cb->serv;
}
while (!done)
{
memset (res, '\0', sizeof (nis_result));
- status = __do_niscall (ibreq.ibr_name, NIS_IBLIST,
+ status = __do_niscall (ibreq->ibr_name, NIS_IBLIST,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, flags, cb);
if (status != NIS_SUCCESS)
res->status = status;
@@ -296,7 +293,7 @@ nis_list (const_nis_name name, u_long flags,
case NIS_PARTIAL:
case NIS_SUCCESS:
case NIS_S_SUCCESS:
- if (__type_of (NIS_RES_OBJECT (res)) == LINK_OBJ &&
+ if (__type_of (NIS_RES_OBJECT (res)) == NIS_LINK_OBJ &&
flags & FOLLOW_LINKS) /* We are following links. */
{
/* If we hit the link limit, bail. */
@@ -307,17 +304,17 @@ nis_list (const_nis_name name, u_long flags,
break;
}
if (count_links)
- free (ibreq.ibr_name);
+ free (ibreq->ibr_name);
++count_links;
- free (ibreq.ibr_name);
- ibreq.ibr_name =
+ free (ibreq->ibr_name);
+ ibreq->ibr_name =
strdup (NIS_RES_OBJECT (res)->LI_data.li_name);
if (NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_len)
- if (ibreq.ibr_srch.ibr_srch_len == 0)
+ if (ibreq->ibr_srch.ibr_srch_len == 0)
{
- ibreq.ibr_srch.ibr_srch_len =
+ ibreq->ibr_srch.ibr_srch_len =
NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_len;
- ibreq.ibr_srch.ibr_srch_val =
+ ibreq->ibr_srch.ibr_srch_val =
NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_val;
}
nis_freeresult (res);
@@ -338,7 +335,7 @@ nis_list (const_nis_name name, u_long flags,
/* Try the next domainname if we don't follow a link. */
if (count_links)
{
- free (ibreq.ibr_name);
+ free (ibreq->ibr_name);
res->status = NIS_LINKNAMEERROR;
++done;
break;
@@ -349,7 +346,7 @@ nis_list (const_nis_name name, u_long flags,
++done;
break;
}
- ibreq.ibr_name = names[name_nr];
+ ibreq->ibr_name = names[name_nr];
break;
}
}
@@ -358,10 +355,14 @@ nis_list (const_nis_name name, u_long flags,
if (names != namebuf)
nis_freenames (names);
- nis_free_request (&ibreq);
-
if (cb)
- __nis_destroy_callback (cb);
+ {
+ __nis_destroy_callback (cb);
+ ibreq->ibr_cbhost.ibr_cbhost_len = 0;
+ ibreq->ibr_cbhost.ibr_cbhost_val = NULL;
+ }
+
+ nis_free_request (ibreq);
return res;
}
@@ -372,53 +373,52 @@ nis_add_entry (const_nis_name name, const nis_object *obj,
{
nis_result *res;
nis_error status;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
char *p1, *p2, *p3, *p4;
char buf1[strlen (name) + 20];
char buf4[strlen (name) + 20];
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_flags = flags;
- ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq.ibr_obj.ibr_obj_len = 1;
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
+ ibreq->ibr_obj.ibr_obj_len = 1;
- p1 = ibreq.ibr_obj.ibr_obj_val->zo_name;
+ p1 = ibreq->ibr_obj.ibr_obj_val->zo_name;
if (p1 == NULL || strlen (p1) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_name =
+ ibreq->ibr_obj.ibr_obj_val->zo_name =
nis_leaf_of_r (name, buf1, sizeof (buf1));
- p2 = ibreq.ibr_obj.ibr_obj_val->zo_owner;
+ p2 = ibreq->ibr_obj.ibr_obj_val->zo_owner;
if (p2 == NULL || strlen (p2) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
- p3 = ibreq.ibr_obj.ibr_obj_val->zo_group;
+ p3 = ibreq->ibr_obj.ibr_obj_val->zo_group;
if (p3 == NULL || strlen (p3) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
+ ibreq->ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
- p4 = ibreq.ibr_obj.ibr_obj_val->zo_domain;
- ibreq.ibr_obj.ibr_obj_val->zo_domain =
+ p4 = ibreq->ibr_obj.ibr_obj_val->zo_domain;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain =
nis_domain_of_r (name, buf4, sizeof (buf4));
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBADD,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq,
+ (caddr_t) ibreq,
(xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- ibreq.ibr_obj.ibr_obj_val->zo_name = p1;
- ibreq.ibr_obj.ibr_obj_val->zo_owner = p2;
- ibreq.ibr_obj.ibr_obj_val->zo_group = p3;
- ibreq.ibr_obj.ibr_obj_val->zo_domain = p4;
+ ibreq->ibr_obj.ibr_obj_val->zo_name = p1;
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = p2;
+ ibreq->ibr_obj.ibr_obj_val->zo_group = p3;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain = p4;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -429,52 +429,51 @@ nis_modify_entry (const_nis_name name, const nis_object *obj,
{
nis_result *res;
nis_error status;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
char *p1, *p2, *p3, *p4;
char buf1[strlen (name) + 20];
char buf4[strlen (name) + 20];
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_flags = flags;
- ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq.ibr_obj.ibr_obj_len = 1;
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
+ ibreq->ibr_obj.ibr_obj_len = 1;
- p1 = ibreq.ibr_obj.ibr_obj_val->zo_name;
+ p1 = ibreq->ibr_obj.ibr_obj_val->zo_name;
if (p1 == NULL || strlen (p1) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_name =
+ ibreq->ibr_obj.ibr_obj_val->zo_name =
nis_leaf_of_r (name, buf1, sizeof (buf1));
- p2 = ibreq.ibr_obj.ibr_obj_val->zo_owner;
+ p2 = ibreq->ibr_obj.ibr_obj_val->zo_owner;
if (p2 == NULL || strlen (p2) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
- p3 = ibreq.ibr_obj.ibr_obj_val->zo_group;
+ p3 = ibreq->ibr_obj.ibr_obj_val->zo_group;
if (p3 == NULL || strlen (p3) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
+ ibreq->ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
- p4 = ibreq.ibr_obj.ibr_obj_val->zo_domain;
- ibreq.ibr_obj.ibr_obj_val->zo_domain =
+ p4 = ibreq->ibr_obj.ibr_obj_val->zo_domain;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain =
nis_domain_of_r (name, buf4, sizeof (buf4));
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBMODIFY,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- ibreq.ibr_obj.ibr_obj_val->zo_name = p1;
- ibreq.ibr_obj.ibr_obj_val->zo_owner = p2;
- ibreq.ibr_obj.ibr_obj_val->zo_group = p3;
- ibreq.ibr_obj.ibr_obj_val->zo_domain = p4;
+ ibreq->ibr_obj.ibr_obj_val->zo_name = p1;
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = p2;
+ ibreq->ibr_obj.ibr_obj_val->zo_group = p3;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain = p4;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -484,31 +483,30 @@ nis_remove_entry (const_nis_name name, const nis_object *obj,
u_long flags)
{
nis_result *res;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
nis_error status;
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_flags = flags;
if (obj != NULL)
{
- ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq.ibr_obj.ibr_obj_len = 1;
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
+ ibreq->ibr_obj.ibr_obj_len = 1;
}
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBREMOVE,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBREMOVE,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -517,24 +515,24 @@ nis_result *
nis_first_entry (const_nis_name name)
{
nis_result *res;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
nis_error status;
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, 0) == NULL)
+ if (__create_ib_request (name, ibreq, 0) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBFIRST,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -543,12 +541,12 @@ nis_result *
nis_next_entry (const_nis_name name, const netobj *cookie)
{
nis_result *res;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
nis_error status;
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, 0) == NULL)
+ if (__create_ib_request (name, ibreq, 0) == NULL)
{
res->status = NIS_BADNAME;
return res;
@@ -556,24 +554,24 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
if (cookie != NULL)
{
- ibreq.ibr_cookie.n_bytes = malloc (cookie->n_len);
- if (ibreq.ibr_cookie.n_bytes == NULL)
+ ibreq->ibr_cookie.n_bytes = malloc (cookie->n_len);
+ if (ibreq->ibr_cookie.n_bytes == NULL)
{
res->status = NIS_NOMEMORY;
free (res);
return NULL;
}
- memcpy (ibreq.ibr_cookie.n_bytes, cookie->n_bytes, cookie->n_len);
- ibreq.ibr_cookie.n_len = cookie->n_len;
+ memcpy (ibreq->ibr_cookie.n_bytes, cookie->n_bytes, cookie->n_len);
+ ibreq->ibr_cookie.n_len = cookie->n_len;
}
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBNEXT,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
diff --git a/nis/nis_verifygroup.c b/nis/nis_verifygroup.c
index 6a8ab01bd78..be65120ae84 100644
--- a/nis/nis_verifygroup.c
+++ b/nis/nis_verifygroup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_verifygroup (const_nis_name group)
diff --git a/nis/nis_xdr.c b/nis/nis_xdr.c
index 82df04e4499..0c253da1270 100644
--- a/nis/nis_xdr.c
+++ b/nis/nis_xdr.c
@@ -198,34 +198,34 @@ xdr_objdata (XDR *xdrs, objdata *objp)
return FALSE;
switch (objp->zo_type)
{
- case DIRECTORY_OBJ:
+ case NIS_DIRECTORY_OBJ:
if (!xdr_directory_obj (xdrs, &objp->objdata_u.di_data))
return FALSE;
break;
- case GROUP_OBJ:
+ case NIS_GROUP_OBJ:
if (!xdr_group_obj (xdrs, &objp->objdata_u.gr_data))
return FALSE;
break;
- case TABLE_OBJ:
+ case NIS_TABLE_OBJ:
if (!xdr_table_obj (xdrs, &objp->objdata_u.ta_data))
return FALSE;
break;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
if (!xdr_entry_obj (xdrs, &objp->objdata_u.en_data))
return FALSE;
break;
- case LINK_OBJ:
+ case NIS_LINK_OBJ:
if (!xdr_link_obj (xdrs, &objp->objdata_u.li_data))
return FALSE;
break;
- case PRIVATE_OBJ:
+ case NIS_PRIVATE_OBJ:
if (!xdr_bytes (xdrs, (char **) &objp->objdata_u.po_data.po_data_val,
(u_int *) & objp->objdata_u.po_data.po_data_len, ~0))
return FALSE;
break;
- case NO_OBJ:
+ case NIS_NO_OBJ:
break;
- case BOGUS_OBJ:
+ case NIS_BOGUS_OBJ:
break;
default:
break;
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index f074c5fa632..76c6f258132 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -67,7 +67,7 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (&result->objects.objects_val[entry]) != ENTRY_OBJ ||
+ __type_of (&result->objects.objects_val[entry]) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[entry].EN_data.en_type,
"mail_aliases") != 0 ||
result->objects.objects_val[entry].EN_data.en_cols.en_cols_len < 2)
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index b21c276df29..8ca6935cc7e 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -63,7 +63,7 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
result->objects.objects_len != 1 ||
- __type_of (NIS_RES_OBJECT (result)) != ENTRY_OBJ ||
+ __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ ||
strcmp(NIS_RES_OBJECT (result)->EN_data.en_type,
"ethers_tbl") != 0 ||
NIS_RES_OBJECT(result)->EN_data.en_cols.en_cols_len < 2)
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 7fefec0fd34..d1aa5ef7879 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -57,7 +57,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"hosts_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 4)
@@ -340,7 +340,7 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
/* If we do not find it, try it as original name. But if the
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val->EN_data.en_type,
"hosts_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index 8aa8bc0f9ea..e548017068a 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -54,7 +54,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"networks_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
@@ -310,7 +310,7 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"networks_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index db5f487159a..b700fa66b47 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -44,7 +44,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
result->objects.objects_len != 1 ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val->EN_data.en_type,
"passwd_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 7)
@@ -141,7 +141,7 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of(result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of(result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val[entry].EN_data.en_type,
"group_tbl") != 0 ||
result->objects.objects_val[entry].EN_data.en_cols.en_cols_len < 4)
@@ -250,7 +250,7 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
result->objects.objects_len != 1 ||
- __type_of(result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of(result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"passwd_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 8)
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index b64d4bdd025..2cbd9fe2fa6 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -52,7 +52,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (NIS_RES_OBJECT (result)) != ENTRY_OBJ ||
+ __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ ||
strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "protocols_tbl") != 0
|| NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 3)
return 0;
@@ -282,7 +282,7 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"protocols_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index e93a51652ee..77a7248305e 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -53,7 +53,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"rpc_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
@@ -282,7 +282,7 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"rpc_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index e1a89f92bed..95a8cfa74bf 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -52,7 +52,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"services_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 4)
@@ -294,7 +294,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"services_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 4)
diff --git a/nis/rpcsvc/nis.h b/nis/rpcsvc/nis.h
index f94b96cba4d..c0d25325c1d 100644
--- a/nis/rpcsvc/nis.h
+++ b/nis/rpcsvc/nis.h
@@ -46,14 +46,15 @@ __BEGIN_DECLS
* which defines the tag values. This allows the tags to change without
* having to change the nis.x file.
*
- * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when
- * rpcgen is run on the nis.x file. Note that there is a
- * simple sed script to remove some unneeded lines. (See the
- * Makefile target nis.h)
+ * NOTE : THIS FILE IS NOT GENERATED WITH RPCGEN ! SO YOU HAVE TO
+ * ADD ALL THE CHANGES ON nis_*.x FILES HERE AGAIN !
*
+ * I have removed all the Solaris internal structs and variables,
+ * because they are not supported, Sun changed them between various
+ * releases and they shouldn't be used in user programs.
+ * <kukuk@vt.uni-paderborn.de>
*/
-#pragma ident "@(#)nis_object.x 1.7 92/07/14 SMI"
#ifndef __nis_object_h
#define __nis_object_h
@@ -94,6 +95,14 @@ enum zotypes {
ENTRY_OBJ = 5,
LINK_OBJ = 6,
PRIVATE_OBJ = 7,
+ NIS_BOGUS_OBJ = 0,
+ NIS_NO_OBJ = 1,
+ NIS_DIRECTORY_OBJ = 2,
+ NIS_GROUP_OBJ = 3,
+ NIS_TABLE_OBJ = 4,
+ NIS_ENTRY_OBJ = 5,
+ NIS_LINK_OBJ = 6,
+ NIS_PRIVATE_OBJ = 7
};
typedef enum zotypes zotypes;
extern bool_t xdr_zotypes __P ((XDR *, zotypes*));
@@ -472,30 +481,6 @@ struct fd_result {
typedef struct fd_result fd_result;
extern bool_t xdr_fd_result __P ((XDR *, fd_result*));
-/*
- * Generic "hash" datastructures, used by all types of hashed data.
- */
-struct nis_hash_data {
- nis_name name; /* NIS name of hashed item */
- int keychain; /* It's hash key (for pop) */
- struct nis_hash_data *next; /* Hash collision pointer */
- struct nis_hash_data *prv_item; /* A serial, doubly linked list */
- struct nis_hash_data *nxt_item; /* of items in the hash table */
-};
-typedef struct nis_hash_data NIS_HASH_ITEM;
-
-struct nis_hash_table {
- NIS_HASH_ITEM *keys[64]; /* A hash table of items */
- NIS_HASH_ITEM *first; /* The first "item" in serial list */
-};
-typedef struct nis_hash_table NIS_HASH_TABLE;
-
-/* Structure for storing dynamically allocated static data */
-struct nis_sdata {
- void *buf; /* Memory allocation pointer */
- u_long size; /* Buffer size */
-};
-
/* Generic client creating flags */
#define ZMH_VC 1
#define ZMH_DG 2
@@ -508,6 +493,15 @@ struct nis_sdata {
#define NIS_CREATE_ACC 4
#define NIS_DESTROY_ACC 8
/* Test macros. a == access rights, m == desired rights. */
+#define NIS_WORLD(a, m) (((a) & (m)) != 0)
+#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0)
+#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0)
+#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0)
+/*
+ * EOL Alert - The following non-prefixed test macros are
+ * here for backward compatability, and will be not be present
+ * in future releases - use the NIS_*() macros above.
+ */
#define WORLD(a, m) (((a) & (m)) != 0)
#define GROUP(a, m) (((a) & ((m) << 8)) != 0)
#define OWNER(a, m) (((a) & ((m) << 16)) != 0)
diff --git a/nis/rpcsvc/nis.x b/nis/rpcsvc/nis.x
index 20a4733741f..2d19f379314 100644
--- a/nis/rpcsvc/nis.x
+++ b/nis/rpcsvc/nis.x
@@ -28,13 +28,6 @@
% * Mountain View, California 94043
% */
-/*
- * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems
- *
- * RPC Language Protocol description file for NIS Plus
- * This version : 1.61
- * Last Modified : 3/19/91
- */
#ifdef RPC_HDR
%/*
% * nis.h
@@ -44,9 +37,9 @@
% * structures used by the NIS service. It includes the file nis_tags.h
% * which defines the tag values. This allows the tags to change without
% * having to change the nis.x file.
-% *
+% *
% * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when
-% * rpcgen is run on the nis.x file. Note that there is a
+% * rpcgen is run on the nis.x file. Note that there is a
% * simple sed script to remove some unneeded lines. (See the
% * Makefile target nis.h)
% *
@@ -75,7 +68,7 @@ enum nis_error {
NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */
NIS_UNKNOWNOBJ = 6, /* Object type is bogus */
NIS_TRYAGAIN = 7, /* I'm busy, call back */
- NIS_SYSTEMERROR = 8, /* Out of band failure */
+ NIS_SYSTEMERROR = 8, /* Generic system error */
NIS_CHAINBROKEN = 9, /* First/Next warning */
NIS_PERMISSION = 10, /* Not enough permission to access */
NIS_NOTOWNER = 11, /* You don't own it, sorry */
@@ -118,11 +111,11 @@ enum nis_error {
};
-/*
+/*
* Structure definitions for the parameters and results of the actual
* NIS RPC calls.
*
- * This is the standard result (in the protocol) of most of the nis
+ * This is the standard result (in the protocol) of most of the nis
* requests.
*/
@@ -136,11 +129,11 @@ struct nis_result {
u_long cticks; /* Client ticks */
};
-/*
- * A Name Service request
- * This request is used to access the name space, ns_name is the name
+/*
+ * A Name Service request
+ * This request is used to access the name space, ns_name is the name
* of the object within the namespace and the object is it's value, for
- * add/modify, a copy of the original for remove.
+ * add/modify, a copy of the original for remove.
*/
struct ns_request {
@@ -148,7 +141,7 @@ struct ns_request {
nis_object ns_object<1>; /* Optional Object (add/remove) */
};
-/*
+/*
* An information base request
* This request includes the NIS name of the table we wish to search, the
* search criteria in the form of attribute/value pairs and an optional
@@ -168,7 +161,7 @@ struct ib_request {
};
/*
- * This argument to the PING call notifies the replicas that something in
+ * This argument to the PING call notifies the replicas that something in
* a directory has changed and this is it's timestamp. The replica will use
* the timestamp to determine if its resync operation was successful.
*/
@@ -177,8 +170,8 @@ struct ping_args {
u_long stamp; /* timestamp of the transaction */
};
-/*
- * These are the type of entries that are stored in the transaction log,
+/*
+ * These are the type of entries that are stored in the transaction log,
* note that modifications will appear as two entries, for names, they have
* a "OLD" entry followed by a "NEW" entry. For entries in tables, there
* is a remove followed by an add. It is done this way so that we can read
@@ -196,13 +189,13 @@ enum log_entry_t {
MOD_IBASE = 7, /* Entry was modified in information base */
UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */
};
-
+
/*
- * This result is returned from the name service when it is requested to
+ * This result is returned from the name service when it is requested to
* dump logged entries from its transaction log. Information base updates
* will have the name of the information base in the le_name field and
* a canonical set of attribute/value pairs to fully specify the entry's
- * 'name'.
+ * 'name'.
*/
struct log_entry {
u_long le_time; /* Time in seconds */
@@ -218,7 +211,7 @@ struct log_result {
netobj lr_cookie; /* Used by the dump callback */
log_entry lr_entries<>; /* zero or more entries */
};
-
+
struct cp_result {
nis_error cp_status; /* Status of the checkpoint */
u_long cp_zticks; /* Service 'ticks' */
@@ -227,7 +220,7 @@ struct cp_result {
/*
* This structure defines a generic NIS tag list. The taglist contains
- * zero or tags, each of which is a type and a value. (u_long).
+ * zero or tags, each of which is a type and a value. (u_long).
* These are used to report statistics (see tag definitions below)
* and to set or reset state variables.
*/
@@ -254,17 +247,59 @@ struct fd_args {
struct fd_result {
nis_error status; /* Status returned by function */
nis_name source; /* Source of this answer */
- opaque dir_data<>; /* Directory Data (XDR'ed) */
+ opaque dir_data<>; /* Directory Data (XDR'ed) */
opaque signature<>; /* Signature of the source */
};
+%/*
+% * Structures used for server binding.
+% */
+struct nis_bound_endpoint {
+ endpoint ep;
+ int generation;
+ int rank;
+ u_long flags;
+ int hostnum;
+ int epnum;
+ nis_name uaddr;
+ endpoint cbep;
+};
+typedef struct nis_bound_endpoint nis_bound_endpoint;
+
+struct nis_bound_directory {
+ int generation;
+ int min_rank; /* minimum rank of bound endpoints */
+ int optimal_rank; /* best possible rank of all endpoints */
+ directory_obj dobj;
+ nis_bound_endpoint BEP<>;
+};
+typedef struct nis_bound_directory nis_bound_directory;
+%#define bep_len BEP.BEP_len
+%#define bep_val BEP.BEP_val
+
+struct nis_active_endpoint {
+ endpoint ep;
+ nis_name hostname;
+ int rank;
+ int uaddr_generation;
+ nis_name uaddr;
+ int cbep_generation;
+ endpoint cbep;
+};
+typedef struct nis_active_endpoint nis_active_endpoint;
+
+%/* defines for nis_bound_endpoint.flags */
+%#define NIS_BOUND 0x1
+%#define NIS_TRANSIENT_ERRORS 0x2
+
-/*
+
+/*
* What's going on here? Well, it's like this. When the service
* is being compiled it wants to have the service definition specific
* info included, and when the client is being compiled it wants that
* info. This includes the appropriate file which was generated by
- * make in the protocols directory (probably /usr/include/rpcsvc).
+ * make in the protocols directory (probably /usr/include/rpcsvc).
*/
#ifdef RPC_SVC
%#include "nis_svc.h"
@@ -296,10 +331,10 @@ program NIS_PROG {
/* If fetch and optionally reset statistics */
nis_taglist NIS_STATUS(nis_taglist) = 14;
-
+
/* Dump changes to directory since time in da_time */
log_result NIS_DUMPLOG(dump_args) = 15;
-
+
/* Dump contents of directory named */
log_result NIS_DUMP(dump_args) = 16;
@@ -314,16 +349,16 @@ program NIS_PROG {
/* Send 'status changed' ping to replicates */
void NIS_PING(ping_args) = 20;
-
+
/* Modify server behaviour (such as debugging) */
nis_taglist NIS_SERVSTATE(nis_taglist) = 21;
-
+
/* Create a Directory */
nis_error NIS_MKDIR(nis_name) = 22;
-
+
/* Remove a Directory */
nis_error NIS_RMDIR(nis_name) = 23;
-
+
/* Update public keys of a directory object */
nis_error NIS_UPDKEYS(nis_name) = 24;
} = 3;
@@ -372,6 +407,15 @@ program NIS_PROG {
%#define NIS_CREATE_ACC 4
%#define NIS_DESTROY_ACC 8
%/* Test macros. a == access rights, m == desired rights. */
+%#define NIS_WORLD(a, m) (((a) & (m)) != 0)
+%#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0)
+%#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0)
+%#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0)
+%/*
+% * EOL Alert - The following non-prefixed test macros are
+% * here for backward compatability, and will be not be present
+% * in future releases - use the NIS_*() macros above.
+% */
%#define WORLD(a, m) (((a) & (m)) != 0)
%#define GROUP(a, m) (((a) & ((m) << 8)) != 0)
%#define OWNER(a, m) (((a) & ((m) << 16)) != 0)
@@ -418,6 +462,8 @@ program NIS_PROG {
%#define ENTRY_LEN(obj, col) \
% (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
%
+%
+%
%#ifdef __cplusplus
%}
%#endif
@@ -429,12 +475,12 @@ program NIS_PROG {
%
%/*
% * nis_3.h
-% *
+% *
% * This file contains definitions that are only of interest to the actual
% * service daemon and client stubs. Normal users of NIS will not include
% * this file.
% *
-% * NOTE : This include file is automatically created by a combination
+% * NOTE : This include file is automatically created by a combination
% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
% * and then remake this file.
% */
diff --git a/nis/rpcsvc/nis_cache.h b/nis/rpcsvc/nis_cache.h
deleted file mode 100644
index ca91a22cd40..00000000000
--- a/nis/rpcsvc/nis_cache.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef __RPCSVC_NIS_CACHE_H_
-#define __RPCSVC_NIS_CACHE_H_
-
-#include <features.h>
-#include <rpc/rpc.h>
-#include <rpc/types.h>
-#include <rpcsvc/nis.h>
-
-__BEGIN_DECLS
-
-/* default cache file */
-#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE"
-
-/* clients have to read-lock the cache file, and SVR4 locking requires that */
-/* the file be writable, but we don't want a world-writable cache file. */
-/* So... everyone agrees to use a different, world-writable file for the */
-/* locking operations, but the data is in CACHEFILE. */
-#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK"
-
-/* the file containing one trusted XDR'ed directory object.
- * This has to be present for the system to work.
- */
-#define COLD_START_FILE "/var/nis/NIS_COLD_START"
-
-enum pc_status {HIT, MISS, NEAR_MISS};
-
-#define CACHEPROG ((u_long)100301)
-#define CACHE_VER_1 ((u_long)1)
-
-#define NIS_CACHE_ADD_ENTRY ((u_long)1)
-#define NIS_CACHE_REMOVE_ENTRY ((u_long)2)
-#define NIS_CACHE_READ_COLDSTART ((u_long)3)
-#define NIS_CACHE_REFRESH_ENTRY ((u_long)4)
-
-extern void *nis_cache_add_entry_1 __P ((fd_result *, CLIENT *));
-extern void *nis_cache_add_entry_1_svc __P ((fd_result *, struct svc_req *));
-extern void *nis_cache_remove_entry_1 __P ((directory_obj *, CLIENT *));
-extern void *nis_cache_remove_entry_1_svc __P ((directory_obj *,
- struct svc_req *));
-extern void *nis_cache_read_coldstart_1 __P ((void *, CLIENT *));
-extern void *nis_cache_read_coldstart_1_svc __P ((void *, struct svc_req *));
-extern void *nis_cache_refresh_entry_1 __P ((char **, CLIENT *));
-extern void *nis_cache_refresh_entry_1_svc __P ((char **, struct svc_req *));
-
-__END_DECLS
-
-#endif /* !_RPCSVC_NIS_CACHE_H_ */
diff --git a/nis/rpcsvc/nis_cache.x b/nis/rpcsvc/nis_cache.x
deleted file mode 100644
index 91870d8a48c..00000000000
--- a/nis/rpcsvc/nis_cache.x
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * nis_cache.x
- *
- * Copyright (c) 1988-1992 Sun Microsystems Inc
- * All Rights Reserved.
- */
-
-%#pragma ident "@(#)nis_cache.x 1.8 92/07/14 SMI"
-
-
-#ifdef RPC_HDR
-%#include <rpc/types.h>
-%#include <rpcsvc/nis.h>
-%
-%/* default cache file */
-%#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE"
-%
-%/* clients have to read-lock the cache file, and SVR4 locking requires that */
-%/* the file be writable, but we don't want a world-writable cache file. */
-%/* So... everyone agrees to use a different, world-writable file for the */
-%/* locking operations, but the data is in CACHEFILE. */
-%#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK"
-%
-%/* the file containing one trusted XDR'ed directory object.
-% * This has to be present for the system to work.
-% */
-%#define COLD_START_FILE "/var/nis/NIS_COLD_START"
-%
-%enum pc_status {HIT, MISS, NEAR_MISS};
-%
-%extern int __nis_debuglevel;
-%
-%
-#endif
-
-#ifdef RPC_CLNT
-%#include "../gen/nis_clnt.h"
-#endif
-
-program CACHEPROG {
- version CACHE_VER_1 {
- void NIS_CACHE_ADD_ENTRY(fd_result) = 1;
- void NIS_CACHE_REMOVE_ENTRY(directory_obj) = 2;
- void NIS_CACHE_READ_COLDSTART(void) = 3;
- void NIS_CACHE_REFRESH_ENTRY(string<>) = 4;
- } = 1;
-} = 100301;
diff --git a/nis/rpcsvc/nis_object.x b/nis/rpcsvc/nis_object.x
index e13ae47b70a..496a16a1e10 100644
--- a/nis/rpcsvc/nis_object.x
+++ b/nis/rpcsvc/nis_object.x
@@ -5,7 +5,7 @@
* All Rights Reserved.
*/
-%#pragma ident "@(#)nis_object.x 1.7 92/07/14 SMI"
+%#pragma ident "@(#)nis_object.x 1.9 96/07/09 SMI"
#if RPC_HDR
%
@@ -65,9 +65,14 @@ typedef string nis_name<>; /* The NIS name itself. */
* 1024 - 2047 are defined to be private to a particular tree.
* 2048 - 4095 are defined to be user defined.
* 4096 - ... are reserved for future use.
+ *
+ * EOL Alert - The non-prefixed names are present for backward
+ * compatability only, and will not exist in future releases. Use
+ * the NIS_* names for future compatability.
*/
enum zotypes {
+
BOGUS_OBJ = 0, /* Uninitialized object structure */
NO_OBJ = 1, /* NULL object (no data) */
DIRECTORY_OBJ = 2, /* Directory object describing domain */
@@ -75,7 +80,16 @@ enum zotypes {
TABLE_OBJ = 4, /* Table object (a database schema) */
ENTRY_OBJ = 5, /* Entry object (a database record) */
LINK_OBJ = 6, /* A name link. */
- PRIVATE_OBJ = 7 /* Private object (all opaque data) */
+ PRIVATE_OBJ = 7, /* Private object (all opaque data) */
+
+ NIS_BOGUS_OBJ = 0, /* Uninitialized object structure */
+ NIS_NO_OBJ = 1, /* NULL object (no data) */
+ NIS_DIRECTORY_OBJ = 2, /* Directory object describing domain */
+ NIS_GROUP_OBJ = 3, /* Group object (a list of names) */
+ NIS_TABLE_OBJ = 4, /* Table object (a database schema) */
+ NIS_ENTRY_OBJ = 5, /* Entry object (a database record) */
+ NIS_LINK_OBJ = 6, /* A name link. */
+ NIS_PRIVATE_OBJ = 7 /* Private object (all opaque data) */
};
/*
@@ -230,21 +244,21 @@ struct table_obj {
* This union joins together all of the currently known objects.
*/
union objdata switch (zotypes zo_type) {
- case DIRECTORY_OBJ :
+ case NIS_DIRECTORY_OBJ :
struct directory_obj di_data;
- case GROUP_OBJ :
+ case NIS_GROUP_OBJ :
struct group_obj gr_data;
- case TABLE_OBJ :
+ case NIS_TABLE_OBJ :
struct table_obj ta_data;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
struct entry_obj en_data;
- case LINK_OBJ :
+ case NIS_LINK_OBJ :
struct link_obj li_data;
- case PRIVATE_OBJ :
+ case NIS_PRIVATE_OBJ :
opaque po_data<>;
- case NO_OBJ :
+ case NIS_NO_OBJ :
void;
- case BOGUS_OBJ :
+ case NIS_BOGUS_OBJ :
void;
default :
void;
diff --git a/nis/rpcsvc/nis_tags.h b/nis/rpcsvc/nis_tags.h
index 30bdff6d1a4..19a5bcab19f 100644
--- a/nis/rpcsvc/nis_tags.h
+++ b/nis/rpcsvc/nis_tags.h
@@ -12,7 +12,7 @@
#ifndef _RPCSVC_NIS_TAGS_H
#define _RPCSVC_NIS_TAGS_H
-#pragma ident "@(#)nis_tags.h 1.13 95/02/17 SMI"
+#pragma ident "@(#)nis_tags.h 1.16 96/10/25 SMI"
/* from file: zns_tags.h 1.7 Copyright (c) 1990 Sun Microsystems */
#ifdef __cplusplus
@@ -40,6 +40,9 @@ extern "C" {
#define REM_RESERVED (1<<12) /* Spare REM semantic */
#define MOD_EXCLUSIVE (1<<13) /* Modify no overwrite on modified keys */
+/* Lookup and List function flags (continued) */
+#define SOFT_LOOKUP (1<<14) /* The "old default" return on failure */
+
/* Transport specific modifications to the operation */
#define USE_DGRAM (1<<16) /* Use a datagram transport */
#define NO_AUTHINFO (1<<17) /* Don't bother attaching auth info */
@@ -63,6 +66,8 @@ extern "C" {
#define TAG_TCACHE_ALL 9 /* Flush entire table cache */
#define TAG_GCACHE_ONE 10 /* Flush one group object */
#define TAG_DCACHE_ONE_REFRESH 11 /* Flush and refresh one DO */
+#define TAG_READONLY 12 /* Set read only mode */
+#define TAG_READWRITE 14 /* Reset read-write mode */
#define TAG_OPSTATS 2048 /* NIS+ operations statistics */
#define TAG_THREADS 2049 /* Child process/thread status */
diff --git a/nis/rpcsvc/nislib.h b/nis/rpcsvc/nislib.h
index 73b3804e85c..016bedc769c 100644
--- a/nis/rpcsvc/nislib.h
+++ b/nis/rpcsvc/nislib.h
@@ -224,29 +224,14 @@ extern bool_t nis_write_obj __P ((const char *file, const nis_object *obj));
*/
extern directory_obj *nis_clone_directory __P ((const directory_obj *src,
directory_obj *dest));
-extern group_obj *nis_clone_group __P ((const group_obj *src,
- group_obj *dest));
-extern table_obj *nis_clone_table __P ((const table_obj *src,
- table_obj *dest));
-extern entry_obj *nis_clone_entry __P ((const entry_obj *src,
- entry_obj *dest));
-extern link_obj *nis_clone_link __P ((const link_obj *src, link_obj *dest));
-extern objdata *nis_clone_objdata __P ((const objdata *src, objdata *dest));
extern nis_result *nis_clone_result __P ((const nis_result *src,
nis_result *dest));
/* nis_free - nis_freeresult */
extern void nis_freeresult __P ((nis_result *result));
/* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
-extern void nis_free_attr __P ((nis_attr *attr));
extern void nis_free_request __P ((ib_request *req));
-extern void nis_free_endpoints __P ((endpoint *ep, unsigned int count));
-extern void nis_free_servers __P ((nis_server *machine, unsigned int count));
extern void nis_free_directory __P ((directory_obj *dirobj));
-extern void nis_free_group __P ((group_obj *grpobj));
-extern void nis_free_table __P ((table_obj *tblobj));
-extern void nis_free_entry __P ((entry_obj *enobj));
-extern void nis_free_link __P ((link_obj *lnkobj));
extern void nis_free_object __P ((nis_object *obj));
/* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
@@ -255,10 +240,9 @@ extern nis_name __nis_default_group __P ((char *));
extern u_long __nis_default_ttl __P ((char *));
extern u_long __nis_default_access __P ((char *, u_long));
extern fd_result *__nis_finddirectory __P ((directory_obj *, const_nis_name));
+extern void __free_fdresult __P ((fd_result *));
extern u_long __nis_hash __P ((const void *keyarg, register size_t len));
-extern log_result *__nis_dumplog __P ((nis_server *,nis_name, u_long));
-extern log_result *__nis_dump __P ((nis_server *, nis_name,
- int (*)(nis_name, nis_object *, void *)));
+
/* NIS+ cache locking */
extern int __nis_lock_cache __P ((void));
extern int __nis_unlock_cache __P ((void));
diff --git a/nis/rpcsvc/ypupd.h b/nis/rpcsvc/ypupd.h
index dace7824d4c..d7ce0d76d0c 100644
--- a/nis/rpcsvc/ypupd.h
+++ b/nis/rpcsvc/ypupd.h
@@ -85,4 +85,6 @@ extern u_int * ypu_delete_1_svc __P ((ypdelete_args *, struct svc_req *));
extern u_int * ypu_store_1 __P ((ypupdate_args *, CLIENT *));
extern u_int * ypu_store_1_svc __P ((ypupdate_args *, struct svc_req *));
+__END_DECLS
+
#endif /* !__RPCSVC_YPUPD_H__ */
diff --git a/nss/digits_dots.c b/nss/digits_dots.c
index e1baafa843e..dab64bfe1f0 100644
--- a/nss/digits_dots.c
+++ b/nss/digits_dots.c
@@ -25,7 +25,6 @@
{
const char *cp;
char *hostname;
- struct hostent *host;
typedef unsigned char host_addr_t [16];
host_addr_t *host_addr;
typedef char *host_addr_list_t [2];
@@ -53,7 +52,7 @@
break;
}
- size_needed = (sizeof (*host) + sizeof (*host_addr)
+ size_needed = (sizeof (*host_addr)
+ sizeof (*host_aliases) + sizeof (*h_addr_ptrs)
+ strlen (name) + 1);
@@ -86,8 +85,7 @@
memset (buffer, 0, size_needed);
- host = (struct hostent *) buffer;
- host_addr = (host_addr_t *) ((char *) host + sizeof (*host));
+ host_addr = (host_addr_t *) buffer;
host_aliases = (host_addr_list_t *)
((char *) host_addr + sizeof (*host_addr));
h_addr_ptrs = (host_addr_list_t *)
@@ -115,13 +113,12 @@
goto done;
}
- strcpy (hostname, name);
- host->h_name = hostname;
- host->h_aliases = *host_aliases;
+ resbuf.h_name = strcpy (hostname, name);
+ resbuf.h_aliases = *host_aliases;
(*host_aliases)[0] = NULL;
(*h_addr_ptrs)[0] = (char *)host_addr;
(*h_addr_ptrs)[1] = (char *)0;
- host->h_addr_list = *h_addr_ptrs;
+ resbuf.h_addr_list = *h_addr_ptrs;
if (_res.options & RES_USE_INET6 && af == AF_INET)
{
/* We need to change the IP v4 address into the
@@ -138,19 +135,19 @@
*p++ = 0xff;
/* Copy the IP v4 address. */
memcpy (p, tmp, INADDRSZ);
- host->h_addrtype = AF_INET6;
- host->h_length = IN6ADDRSZ;
+ resbuf.h_addrtype = AF_INET6;
+ resbuf.h_length = IN6ADDRSZ;
}
else
{
- host->h_addrtype = af;
- host->h_length = addr_size;
+ resbuf.h_addrtype = af;
+ resbuf.h_length = addr_size;
}
__set_h_errno (NETDB_SUCCESS);
#ifdef HAVE_LOOKUP_BUFFER
status = NSS_STATUS_SUCCESS;
#else
- result = host;
+ result = &resbuf;
#endif
goto done;
}
@@ -164,7 +161,6 @@
{
const char *cp;
char *hostname;
- struct hostent *host;
typedef unsigned char host_addr_t [16];
host_addr_t *host_addr;
typedef char *host_addr_list_t [2];
@@ -192,7 +188,7 @@
break;
}
- size_needed = (sizeof (*host) + sizeof (*host_addr)
+ size_needed = (sizeof (*host_addr)
+ sizeof (*host_aliases) + sizeof (*h_addr_ptrs)
+ strlen (name) + 1);
@@ -225,8 +221,7 @@
memset (buffer, 0, size_needed);
- host = (struct hostent *) buffer;
- host_addr = (host_addr_t *) ((char *) host + sizeof (*host));
+ host_addr = (host_addr_t *) buffer;
host_aliases = (host_addr_list_t *)
((char *) host_addr + sizeof (*host_addr));
h_addr_ptrs = (host_addr_list_t *)
@@ -252,19 +247,19 @@
}
strcpy (hostname, name);
- host->h_name = hostname;
- host->h_aliases = *host_aliases;
+ resbuf.h_name = hostname;
+ resbuf.h_aliases = *host_aliases;
(*host_aliases)[0] = NULL;
(*h_addr_ptrs)[0] = (char *) host_addr;
(*h_addr_ptrs)[1] = (char *) 0;
- host->h_addr_list = *h_addr_ptrs;
- host->h_addrtype = af;
- host->h_length = addr_size;
+ resbuf.h_addr_list = *h_addr_ptrs;
+ resbuf.h_addrtype = af;
+ resbuf.h_length = addr_size;
__set_h_errno (NETDB_SUCCESS);
#ifdef HAVE_LOOKUP_BUFFER
status = NSS_STATUS_SUCCESS;
#else
- result = host;
+ result = &resbuf;
#endif
goto done;
}
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 988f46c88e6..18f0bae03aa 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -94,7 +94,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
enum nss_status status = NSS_STATUS_UNAVAIL;
#ifdef HANDLE_DIGITS_DOTS
+# define resbuf (*resbuf)
# include "digits_dots.c"
+# undef resbuf
#endif
if (startp == NULL)
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 7dd3e0526f8..18129bb5c01 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -35,12 +35,14 @@
#include "nsswitch.h"
/* Prototypes for the local functions. */
-static void *nss_lookup_function (service_user *ni, const char *fct_name);
-static name_database *nss_parse_file (const char *fname);
-static name_database_entry *nss_getline (char *line);
-static service_user *nss_parse_service_list (const char *line);
+static void *nss_lookup_function (service_user *ni, const char *fct_name)
+ internal_function;
+static name_database *nss_parse_file (const char *fname) internal_function;
+static name_database_entry *nss_getline (char *line) internal_function;
+static service_user *nss_parse_service_list (const char *line)
+ internal_function;
static service_library *nss_new_service (name_database *database,
- const char *name);
+ const char *name) internal_function;
/* Declare external database variables. */
@@ -310,6 +312,7 @@ known_compare (const void *p1, const void *p2)
static void *
+internal_function
nss_lookup_function (service_user *ni, const char *fct_name)
{
void **found, *result;
@@ -476,6 +479,7 @@ nss_lookup_function (service_user *ni, const char *fct_name)
static name_database *
+internal_function
nss_parse_file (const char *fname)
{
FILE *fp;
@@ -548,6 +552,7 @@ nss_parse_file (const char *fname)
`( <source> ( "[" "!"? (<status> "=" <action> )+ "]" )? )*'
*/
static service_user *
+internal_function
nss_parse_service_list (const char *line)
{
service_user *result = NULL, **nextp = &result;
@@ -697,6 +702,7 @@ nss_parse_service_list (const char *line)
}
static name_database_entry *
+internal_function
nss_getline (char *line)
{
const char *name;
@@ -743,6 +749,7 @@ nss_getline (char *line)
static service_library *
+internal_function
nss_new_service (name_database *database, const char *name)
{
service_library **currentp = &database->library;
diff --git a/posix/Makefile b/posix/Makefile
index a8adb1fe810..b7050867e42 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -49,7 +49,7 @@ routines := \
sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
sched_primin sched_rr_gi \
getaddrinfo gai_strerror wordexp \
- pread pwrite
+ pread pwrite pread64 pwrite64
aux := init-posix environ
tests := tstgetopt testfnm runtests
@@ -65,7 +65,7 @@ include ../Rules
ifeq (no,$(cross-compiling))
tests: $(objpfx)globtest
- $(SHELL) -e globtest.sh $(common-objpfx)
+ $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) $(rtld-installed-name)
endif
CFLAGS-regex.c = -Wno-unused -Wno-strict-prototypes
diff --git a/posix/confstr.c b/posix/confstr.c
index 850130b2a99..98bdc65d0b6 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -44,6 +44,19 @@ confstr (name, buf, len)
}
break;
+ case _CS_LFS_CFLAGS:
+ case _CS_LFS_LINTFLAGS:
+ case _CS_LFS_LDFLAGS:
+ case _CS_LFS_LIBS:
+ case _CS_LFS64_CFLAGS:
+ case _CS_LFS64_LINTFLAGS:
+ case _CS_LFS64_LDFLAGS:
+ case _CS_LFS64_LIBS:
+ /* GNU libc does not require special actions to use LFS. */
+ string = "";
+ string_len = 1;
+ break;
+
default:
__set_errno (EINVAL);
return 0;
diff --git a/posix/execvp.c b/posix/execvp.c
index fc37638f06b..26c7be99ab9 100644
--- a/posix/execvp.c
+++ b/posix/execvp.c
@@ -23,6 +23,41 @@
#include <errno.h>
#include <paths.h>
+
+static void
+internal_function
+execute (const char *file, char *const argv[])
+{
+ execv (file, argv);
+
+ if (errno == ENOEXEC)
+ {
+ /* The file is accessible but it is not an executable file.
+ Invoke the shell to interpret it as a script. */
+
+ /* Count the arguments. */
+ int argc = 0;
+ while (argv[argc++])
+ ;
+
+ /* Construct an argument list for the shell. */
+ {
+ char *new_argv[argc + 1];
+ new_argv[0] = (char *) _PATH_BSHELL;
+ new_argv[1] = (char *) file;
+ while (argc > 1)
+ {
+ new_argv[argc] = argv[argc - 1];
+ --argc;
+ }
+
+ /* Execute the shell. */
+ execv (new_argv[0], new_argv);
+ }
+ }
+}
+
+
/* Execute FILE, searching in the `PATH' environment variable if it contains
no slashes, with arguments ARGV and environment from `environ'. */
int
@@ -32,37 +67,6 @@ execvp (file, argv)
{
int got_eacces = 0;
- void execute (const char *file, char *const argv[])
- {
- execv (file, argv);
-
- if (errno == ENOEXEC)
- {
- /* The file is accessible but it is not an executable file.
- Invoke the shell to interpret it as a script. */
-
- /* Count the arguments. */
- int argc = 0;
- while (argv[argc++])
- ;
-
- /* Construct an argument list for the shell. */
- {
- char *new_argv[argc + 1];
- new_argv[0] = (char *) _PATH_BSHELL;
- new_argv[1] = (char *) file;
- while (argc > 1)
- {
- new_argv[argc] = argv[argc - 1];
- --argc;
- }
-
- /* Execute the shell. */
- execv (new_argv[0], new_argv);
- }
- }
- }
-
if (strchr (file, '/') != NULL)
/* Don't search when it contains a slash. */
execute (file, argv);
diff --git a/posix/getconf.c b/posix/getconf.c
index 5b67a281df4..c6371cb60b7 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
+/* 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
@@ -31,7 +31,7 @@ struct conf
const enum { SYSCONF, CONFSTR, PATHCONF } call;
};
-static struct conf vars[] =
+static const struct conf vars[] =
{
{ "LINK_MAX", _PC_LINK_MAX, PATHCONF },
{ "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
@@ -188,6 +188,16 @@ static struct conf vars[] =
{ "PATH", _CS_PATH, CONFSTR },
{ "CS_PATH", _CS_PATH, CONFSTR },
+ /* LFS */
+ { "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
+ { "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
+ { "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
+ { "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
+ { "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
+ { "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
+ { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
+ { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
+
{ NULL, 0, SYSCONF }
};
diff --git a/posix/globtest.sh b/posix/globtest.sh
index 61fec9874c5..48328af032a 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -1,6 +1,8 @@
#! /bin/sh
common_objpfx=$1; shift
+elf_objpfx=$1; shift
+rtld_installed_name=$1; shift
# Create the arena
: ${TMPDIR=/tmp}
@@ -22,7 +24,7 @@ echo 1_2 > $testdir/dir1/file1_2
result=0
LD_LIBRARY_PATH=$common_objpfx \
-${common_objpfx}posix/globtest "$testdir" "*" |
+${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1'
@@ -33,7 +35,7 @@ not NULL
EOF
LD_LIBRARY_PATH=$common_objpfx \
-${common_objpfx}posix/globtest "$testdir" "*/*" |
+${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/*" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1/file1_1'
@@ -42,7 +44,7 @@ not NULL
EOF
LD_LIBRARY_PATH=$common_objpfx \
-${common_objpfx}posix/globtest "$testdir" "*/1" |
+${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/1" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
@@ -50,7 +52,7 @@ NULL
EOF
LD_LIBRARY_PATH=$common_objpfx \
-${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
+${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/*1_1" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1/file1_1'
@@ -58,7 +60,7 @@ not NULL
EOF
LD_LIBRARY_PATH=$common_objpfx \
-${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
+${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*/file1_1" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
`dir1/file1_1'
@@ -66,7 +68,7 @@ not NULL
EOF
LD_LIBRARY_PATH=$common_objpfx \
-${common_objpfx}posix/globtest "$testdir" "*-/*" |
+${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*-/*" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
@@ -74,7 +76,7 @@ NULL
EOF
LD_LIBRARY_PATH=$common_objpfx \
-${common_objpfx}posix/globtest "$testdir" "*-" |
+${elf_objpfx}${rtld_installed_name} ${common_objpfx}posix/globtest "$testdir" "*-" |
sort > $testout
cat <<"EOF" | cmp - $testout || result=1
GLOB_NOMATCH
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 675e2522fad..ab28d39aaf2 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -40,11 +40,19 @@ typedef __fsid_t fsid_t;
#endif
typedef __dev_t dev_t;
-typedef __ino_t ino_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __loff_t loff_t;
+#ifndef __USE_FILE_OFFSET64
+typedef __ino_t ino_t;
+#else
+typedef __ino64_t ino_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __ino64_t ino64_t;
+#endif
+
#ifndef gid_t
typedef __gid_t gid_t;
# define gid_t gid_t
@@ -56,9 +64,17 @@ typedef __uid_t uid_t;
#endif
#ifndef off_t
+# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
# define off_t off_t
#endif
+#if defined __USE_LARGEFILE64 && !defined off64_t
+typedef __off64_t off64_t;
+# define off64_t off64_t
+#endif
#ifndef pid_t
typedef __pid_t pid_t;
@@ -156,6 +172,23 @@ typedef int register_t __attribute__ ((__mode__ (__word__)));
#endif /* Use BSD. */
+/* Types from the Large File Support interface. */
+#ifndef __USE_FILE_OFFSET64
+typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
+typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
+typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
+#else
+typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
+typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
+typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
+#endif
+
+#ifdef __USE_LARGEFILE64
+typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
+typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
+typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
+#endif
+
__END_DECLS
#endif /* sys/types.h */
diff --git a/posix/sys/utsname.h b/posix/sys/utsname.h
index bebef5d4563..629dd5902a1 100644
--- a/posix/sys/utsname.h
+++ b/posix/sys/utsname.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1994, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@ __BEGIN_DECLS
#include <bits/utsname.h>
#ifndef _UTSNAME_NODENAME_LENGTH
-#define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
+# define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
#endif
/* Structure describing the system and machine. */
@@ -52,16 +52,16 @@ struct utsname
#if _UTSNAME_DOMAIN_LENGTH - 0
/* Name of the domain of this node on the network. */
-#ifdef __USE_GNU
+# ifdef __USE_GNU
char domainname[_UTSNAME_DOMAIN_LENGTH];
-#else
+# else
char __domainname[_UTSNAME_DOMAIN_LENGTH];
-#endif
+# endif
#endif
};
#ifdef __USE_SVID
-#define SYS_NMLN _UTSNAME_LENGTH
+# define SYS_NMLN _UTSNAME_LENGTH
#endif
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index f573d778f72..9b5025ab83b 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 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
@@ -38,43 +38,37 @@ __BEGIN_DECLS
/* Lots of hair to allow traditional BSD use of `union wait'
as well as POSIX.1 use of `int' for the status word. */
-#ifdef __GNUC__
-#define __WAIT_INT(status) \
+# ifdef __GNUC__
+# define __WAIT_INT(status) \
(__extension__ ({ union { __typeof(status) __in; int __i; } __u; \
__u.__in = (status); __u.__i; }))
-#else
-#define __WAIT_INT(status) (*(int *) &(status))
-#endif
-
-/* This is the type of the argument to `wait'.
-
- NOTE: Since this functionality is volatile, I'm disabling the use of it for
- now.
-
-With GCC 2.6.1 and later, the funky union causes redeclarations with either
- `int *' or `union wait *' to be allowed without complaint.
- __WAIT_STATUS_DEFN is the type used in the actual function
- definitions. */
-
-#if (!defined (__GNUC__) || __GNUC__ < 2 || \
- /*(__GNUC__ == 2 && __GNUC_MINOR__ < 6)*/ 1)
-#define __WAIT_STATUS __ptr_t
-#define __WAIT_STATUS_DEFN __ptr_t
-#else
+# else
+# define __WAIT_INT(status) (*(int *) &(status))
+# endif
+
+/* This is the type of the argument to `wait'. The funky union
+ causes redeclarations with ether `int *' or `union wait *' to be
+ allowed without complaint. __WAIT_STATUS_DEFN is the type used in
+ the actual function definitions. */
+
+# if !defined __GNUC__ || __GNUC__ < 2
+# define __WAIT_STATUS __ptr_t
+# define __WAIT_STATUS_DEFN __ptr_t
+# else
/* This works in GCC 2.6.1 and later. */
typedef union
{
union wait *__uptr;
int *__iptr;
} __WAIT_STATUS __attribute__ ((transparent_union));
-#define __WAIT_STATUS_DEFN int *
+# define __WAIT_STATUS_DEFN int *
#endif
#else /* Don't use BSD. */
-#define __WAIT_INT(status) (status)
-#define __WAIT_STATUS int *
-#define __WAIT_STATUS_DEFN int *
+# define __WAIT_INT(status) (status)
+# define __WAIT_STATUS int *
+# define __WAIT_STATUS_DEFN int *
#endif /* Use BSD. */
@@ -89,10 +83,10 @@ typedef union
#define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
#ifdef __USE_BSD
-#define WCOREFLAG __WCOREFLAG
-#define WCOREDUMP(status) __WCOREDUMP(__WAIT_INT(status))
-#define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig)
-#define W_STOPCODE(sig) __W_STOPCODE(sig)
+# define WCOREFLAG __WCOREFLAG
+# define WCOREDUMP(status) __WCOREDUMP(__WAIT_INT(status))
+# define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig)
+# define W_STOPCODE(sig) __W_STOPCODE(sig)
#endif
@@ -103,8 +97,8 @@ extern __pid_t wait __P ((__WAIT_STATUS __stat_loc));
#ifdef __USE_BSD
/* Special values for the PID argument to `waitpid' and `wait4'. */
-#define WAIT_ANY (-1) /* Any process. */
-#define WAIT_MYPGRP 0 /* Any process in my process group. */
+# define WAIT_ANY (-1) /* Any process. */
+# define WAIT_MYPGRP 0 /* Any process in my process group. */
#endif
/* Wait for a child matching PID to die.
@@ -124,7 +118,7 @@ extern __pid_t __waitpid __P ((__pid_t __pid, int *__stat_loc,
extern __pid_t waitpid __P ((__pid_t __pid, int *__stat_loc,
int __options));
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* This being here makes the prototypes valid whether or not
we have already included <sys/resource.h> to define `struct rusage'. */
struct rusage;
diff --git a/posix/unistd.h b/posix/unistd.h
index 9fcad90cb14..e44dcff84f1 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -133,6 +133,11 @@ __BEGIN_DECLS
_POSIX_SYNC_IO Synchronous I/O may be performed.
_POSIX_ASYNC_IO Asynchronous I/O may be performed.
_POSIX_PRIO_IO Prioritized Asynchronous I/O may be performed.
+
+ Support for the Large File Support interface is not generally available.
+ If it is available the following constants are defined to one.
+ _LFS64_LARGEFILE Low-level I/O supports large files.
+ _LFS64_STDIO Standard I/O supports large files.
*/
#include <bits/posix_opt.h>
@@ -171,15 +176,23 @@ typedef __uid_t uid_t;
# endif
# ifndef off_t
+# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
# define off_t off_t
# endif
+# if defined __USE_LARGEFILE64 && !defined off64_t
+typedef __off64_t off64_t;
+# define off64_t off64_t
+# endif
# ifndef pid_t
typedef __pid_t pid_t;
# define pid_t pid_t
# endif
-#endif
+#endif /* Unix98 */
/* Values for the second argument to access.
These may be OR'd together. */
@@ -221,7 +234,15 @@ extern int euidaccess __P ((__const char *__name, int __type));
or the end of the file (if WHENCE is SEEK_END).
Return the new file position. */
extern __off_t __lseek __P ((int __fd, __off_t __offset, int __whence));
+#ifndef __USE_FILE_OFFSET64
extern __off_t lseek __P ((int __fd, __off_t __offset, int __whence));
+#else
+extern __off_t lseek __P ((int __fd, __off_t __offset, int __whence))
+ __asm__ ("lseek64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
+#endif
/* Close the file descriptor FD. */
extern int __close __P ((int __fd));
@@ -240,13 +261,31 @@ extern ssize_t write __P ((int __fd, __const __ptr_t __buf, size_t __n));
/* Read NBYTES into BUF from FD at the given position OFFSET without
changing the file pointer. Return the number read, -1 for errors
or 0 for EOF. */
+# ifndef __USE_FILE_OFFSET64
extern ssize_t pread __P ((int __fd, __ptr_t __buf, size_t __nbytes,
__off_t __offset));
+# else
+extern ssize_t pread __P ((int __fd, __ptr_t __buf, size_t __nbytes,
+ __off_t __offset)) __asm__ ("pread64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern ssize_t pread64 __P ((int __fd, __ptr_t __buf, size_t __nbytes,
+ __off64_t __offset));
+# endif
/* Write N bytes of BUF to FD at the given position OFFSET without
changing the file pointer. Return the number written, or -1. */
+# ifndef __USE_FILE_OFFSET64
extern ssize_t pwrite __P ((int __fd, __const __ptr_t __buf, size_t __n,
__off_t __offset));
+# else
+extern ssize_t pwrite __P ((int __fd, __const __ptr_t __buf, size_t __n,
+ __off_t __offset)) __asm__ ("pwrite64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern ssize_t pwrite64 __P ((int __fd, __const __ptr_t __buf, size_t __n,
+ __off64_t __offset));
+# endif
#endif
@@ -489,18 +528,18 @@ extern __pid_t getpgid __P ((__pid_t __pid));
The default in GNU is to provide the System V function. The BSD
function is available under -D_BSD_SOURCE with -lbsd-compat. */
-#ifndef __FAVOR_BSD
+# ifndef __FAVOR_BSD
/* Set the process group ID of the calling process to its own PID.
This is exactly the same as `setpgid (0, 0)'. */
extern int setpgrp __P ((void));
-#else
+# else
/* Another name for `setpgid' (above). */
extern int setpgrp __P ((__pid_t __pid, __pid_t __pgrp));
-#endif /* Favor BSD. */
+# endif /* Favor BSD. */
#endif /* Use SVID or BSD. */
/* Create a new session with the calling process as its leader.
@@ -792,10 +831,26 @@ extern int getpagesize __P ((void));
/* Truncate FILE to LENGTH bytes. */
+#ifndef __USE_FILE_OFFSET64
extern int truncate __P ((__const char *__file, __off_t __length));
+#else
+extern int truncate __P ((__const char *__file, __off_t __length))
+ __asm__ ("truncate64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int truncate64 __P ((__const char *__file, __off64_t __length));
+#endif
/* Truncate the file FD is open on to LENGTH bytes. */
+#ifndef __USE_FILE_OFFSET64
extern int ftruncate __P ((int __fd, __off_t __length));
+#else
+extern int ftruncate __P ((int __fd, __off_t __length))
+ __asm__ ("ftruncate64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int ftruncate64 __P ((int __fd, __off64_t __length));
+#endif
/* Return the maximum number of file descriptors
@@ -855,7 +910,15 @@ extern long int syscall __P ((long int __sysno, ...));
# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
# define F_TEST 3 /* Test a region for other processes locks. */
+# ifndef __USE_FILE_OFFSET64
extern int lockf __P ((int __fd, int __cmd, __off_t __len));
+# else
+extern int lockf __P ((int __fd, int __cmd, __off_t __len))
+ __asm__ ("lockf64");
+# endif
+# ifdef __USE_LARGEFILE64
+extern int lockf64 __P ((int __fd, int __cmd, __off64_t __len));
+# endif
#endif /* Use misc and F_LOCK not already defined. */
diff --git a/posix/wordexp.c b/posix/wordexp.c
index e89f30d628d..651c67d5529 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -46,11 +46,13 @@
/* 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);
+ wordexp_t *pwordexp)
+ 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);
-static int eval_expr (char *expr, int *result);
+ size_t *offset, int flags, wordexp_t *pwordexp)
+ internal_function;
+static int eval_expr (char *expr, int *result) internal_function;
/* The w_*() functions manipulate word lists. */
@@ -138,6 +140,7 @@ w_addword (wordexp_t *pwordexp, char *word)
*/
static int
+internal_function
parse_backslash (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset)
{
@@ -166,6 +169,7 @@ parse_backslash (char **word, size_t *word_length, size_t *max_length,
}
static int
+internal_function
parse_qtd_backslash (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset)
{
@@ -208,6 +212,7 @@ parse_qtd_backslash (char **word, size_t *word_length, size_t *max_length,
}
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)
{
@@ -303,6 +308,7 @@ parse_tilde (char **word, size_t *word_length, size_t *max_length,
}
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, char *ifs)
@@ -431,6 +437,7 @@ parse_squote (char **word, size_t *word_length, size_t *max_length,
/* Functions to evaluate an arithmetic expression */
static int
+internal_function
eval_expr_val (char **expr, int *result)
{
int sgn = +1;
@@ -481,6 +488,7 @@ eval_expr_val (char **expr, int *result)
}
static int
+internal_function
eval_expr_multdiv (char **expr, int *result)
{
int arg;
@@ -517,6 +525,7 @@ eval_expr_multdiv (char **expr, int *result)
}
static int
+internal_function
eval_expr (char *expr, int *result)
{
int arg;
@@ -553,6 +562,7 @@ eval_expr (char *expr, int *result)
}
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)
{
@@ -680,6 +690,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
/* 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)
{
@@ -858,6 +869,7 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
}
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)
{
@@ -1173,6 +1185,7 @@ no_space:
}
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)
@@ -1281,6 +1294,7 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length,
}
static int
+internal_function
parse_dquote (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset, int flags)
{
diff --git a/pwd/pwd.h b/pwd/pwd.h
index 1910f07f77f..3b639305cf7 100644
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -45,9 +45,9 @@ struct passwd
};
-#if defined(__USE_SVID) || defined(__USE_GNU)
-#define __need_FILE
-#include <stdio.h>
+#if defined __USE_SVID || defined __USE_GNU
+# define __need_FILE
+# include <stdio.h>
#endif
#ifdef __USE_GNU
@@ -69,7 +69,7 @@ extern struct passwd *__pwdscan __P ((__ptr_t *__p,
#endif
-#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Rewind the password-file stream. */
extern void setpwent __P ((void));
@@ -96,11 +96,11 @@ extern struct passwd *getpwnam __P ((__const char *__name));
#if defined __USE_POSIX || defined __USE_MISC
-#ifdef __USE_MISC
+# ifdef __USE_MISC
/* Reasonable value for the buffer sized used in the reentrant
functions below. But better use `sysconf'. */
-#define NSS_BUFLEN_PASSWD 1024
-#endif
+# define NSS_BUFLEN_PASSWD 1024
+# endif
/* Reentrant versions of some of the functions above.
@@ -110,12 +110,12 @@ extern struct passwd *getpwnam __P ((__const char *__name));
other reentrant functions so the chances are good this is what the
POSIX people would choose. */
-#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED
extern int __getpwent_r __P ((struct passwd *__resultbuf, char *__buffer,
size_t __buflen, struct passwd **__result));
extern int getpwent_r __P ((struct passwd *__resultbuf, char *__buffer,
size_t __buflen, struct passwd **__result));
-#endif
+# endif
extern int __getpwuid_r __P ((__uid_t __uid, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
@@ -132,7 +132,7 @@ extern int getpwnam_r __P ((__const char *__name, struct passwd *__resultbuf,
struct passwd **__result));
-#ifdef __USE_SVID
+# ifdef __USE_SVID
/* Read an entry from STREAM. This function is not standardized and
probably never will. */
extern int __fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
@@ -141,7 +141,7 @@ extern int __fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
extern int fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result));
-#endif
+# endif
#endif /* POSIX or reentrant */
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 49aea2a7195..5b9950af1f8 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -386,9 +386,10 @@ getanswer(answer, anslen, qname, qtype)
continue;
}
if (hap >= &h_addr_ptrs[MAXADDRS-1]) {
- if (!toobig++)
+ if (!toobig++) {
dprintf("Too many addresses (%d)\n",
MAXADDRS);
+ }
cp += n;
continue;
}
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index bbdabd0fe00..644abee4a77 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -40,8 +40,10 @@ static char rcsid[] = "$Id$";
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size));
-static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size));
+static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size))
+ internal_function;
+static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size))
+ internal_function;
/* char *
* inet_ntop(af, src, dst, size)
@@ -82,6 +84,7 @@ inet_ntop(af, src, dst, size)
* Paul Vixie, 1996.
*/
static const char *
+internal_function
inet_ntop4(src, dst, size)
const u_char *src;
char *dst;
@@ -105,6 +108,7 @@ inet_ntop4(src, dst, size)
* Paul Vixie, 1996.
*/
static const char *
+internal_function
inet_ntop6(src, dst, size)
const u_char *src;
char *dst;
diff --git a/resolv/inet_pton.c b/resolv/inet_pton.c
index 3593da262b0..0c8f79f2c52 100644
--- a/resolv/inet_pton.c
+++ b/resolv/inet_pton.c
@@ -33,8 +33,8 @@ static char rcsid[] = "$Id$";
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-static int inet_pton4 __P((const char *src, u_char *dst));
-static int inet_pton6 __P((const char *src, u_char *dst));
+static int inet_pton4 __P((const char *src, u_char *dst)) internal_function;
+static int inet_pton6 __P((const char *src, u_char *dst)) internal_function;
/* int
* inet_pton(af, src, dst)
@@ -76,6 +76,7 @@ inet_pton(af, src, dst)
* Paul Vixie, 1996.
*/
static int
+internal_function
inet_pton4(src, dst)
const char *src;
u_char *dst;
@@ -130,6 +131,7 @@ inet_pton4(src, dst)
* Paul Vixie, 1996.
*/
static int
+internal_function
inet_pton6(src, dst)
const char *src;
u_char *dst;
diff --git a/resolv/netdb.h b/resolv/netdb.h
index c59553c7ed3..fdfc056750a 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -413,30 +413,30 @@ struct addrinfo
};
/* Possible values for `ai_flags' field in `addrinfo' structure. */
-#define AI_PASSIVE 1 /* Socket address is intended for `bind'. */
-#define AI_CANONNAME 2 /* Request for canonical name. */
+# define AI_PASSIVE 1 /* Socket address is intended for `bind'. */
+# define AI_CANONNAME 2 /* Request for canonical name. */
/* Error values for `getaddrinfo' function. */
-#define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
-#define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
-#define EAI_AGAIN -3 /* Temporary failure in name resolution. */
-#define EAI_FAIL -4 /* Non-recoverable failure in name res. */
-#define EAI_NODATA -5 /* No address associated with NAME. */
-#define EAI_FAMILY -6 /* `ai_family' not supported. */
-#define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
-#define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
-#define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
-#define EAI_MEMORY -10 /* Memory allocation failure. */
-#define EAI_SYSTEM -11 /* System error returned in `errno'. */
-
-#define NI_MAXHOST 1025
-#define NI_MAXSERV 32
-
-#define NI_NUMERICHOST 1
-#define NI_NUMERICSERV 2
-#define NI_NOFQDN 4
-#define NI_NAMEREQD 8
-#define NI_DGRAM 16
+# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
+# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
+# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
+# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
+# define EAI_NODATA -5 /* No address associated with NAME. */
+# define EAI_FAMILY -6 /* `ai_family' not supported. */
+# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
+# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
+# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
+# define EAI_MEMORY -10 /* Memory allocation failure. */
+# define EAI_SYSTEM -11 /* System error returned in `errno'. */
+
+# define NI_MAXHOST 1025
+# define NI_MAXSERV 32
+
+# define NI_NUMERICHOST 1
+# define NI_NUMERICSERV 2
+# define NI_NOFQDN 4
+# define NI_NAMEREQD 8
+# define NI_DGRAM 16
/* Translate name of a service location and/or a service name to set of
socket addresses. */
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 755b88d4668..a2de01f1a22 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -110,7 +110,7 @@ static int netinfo_res_init __P((int *haveenv, int *havesearch));
# include "../conf/options.h"
#endif
-static void res_setoptions __P((char *, char *));
+static void res_setoptions __P((char *, char *)) internal_function;
#ifdef RESOLVSORT
static const char sort_mask[] = "/&";
@@ -428,6 +428,7 @@ res_init()
}
static void
+internal_function
res_setoptions(options, source)
char *options, *source;
{
diff --git a/resource/Makefile b/resource/Makefile
index 38d5a2c3799..1ad0bb3bc47 100644
--- a/resource/Makefile
+++ b/resource/Makefile
@@ -20,7 +20,7 @@ subdir := resource
headers := sys/resource.h bits/resource.h sys/vlimit.h sys/vtimes.h
-routines := getrlimit setrlimit getrusage ulimit vlimit vtimes \
- getpriority setpriority nice
+routines := getrlimit setrlimit getrlimit64 setrlimit64 getrusage ulimit \
+ vlimit vtimes getpriority setpriority nice
include ../Rules
diff --git a/resource/sys/resource.h b/resource/sys/resource.h
index e0158767f6c..f9c6bb24883 100644
--- a/resource/sys/resource.h
+++ b/resource/sys/resource.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -30,14 +30,32 @@ __BEGIN_DECLS
Returns 0 if successful, -1 if not (and sets errno). */
extern int __getrlimit __P ((enum __rlimit_resource __resource,
struct rlimit *__rlimits));
+#ifndef __USE_FILE_OFFSET64
extern int getrlimit __P ((enum __rlimit_resource __resource,
struct rlimit *__rlimits));
+#else
+extern int getrlimit __P ((enum __rlimit_resource __resource,
+ struct rlimit *__rlimits)) __asm__ ("getrlimit64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int getrlimit64 __P ((enum __rlimit_resource __resource,
+ struct rlimit64 *__rlimits));
+#endif
/* 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). */
+#ifndef __USE_FILE_OFFSET64
extern int setrlimit __P ((enum __rlimit_resource __resource,
struct rlimit *__rlimits));
+#else
+extern int setrlimit __P ((enum __rlimit_resource __resource,
+ struct rlimit *__rlimits)) __asm__ ("setrlimit64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern int setrlimit64 __P ((enum __rlimit_resource __resource,
+ struct rlimit64 *__rlimits));
+#endif
/* Return resource usage information on process indicated by WHO
and put it in *USAGE. Returns 0 for success, -1 for failure. */
diff --git a/signal/signal.h b/signal/signal.h
index 588c779f113..5fb4bc2a142 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -23,8 +23,8 @@
#ifndef _SIGNAL_H
#if !defined __need_sig_atomic_t && !defined __need_sigset_t
-#define _SIGNAL_H 1
-#include <features.h>
+# define _SIGNAL_H 1
+# include <features.h>
#endif
__BEGIN_DECLS
@@ -47,22 +47,26 @@ typedef __sig_atomic_t sig_atomic_t;
/* Type of a signal handler. */
typedef void (*__sighandler_t) __P ((int));
-/* Set the handler for the signal SIG to HANDLER, returning the old
- handler, or SIG_ERR on error.
- By default `signal' has the BSD semantic. */
-extern __sighandler_t signal __P ((int __sig, __sighandler_t __handler));
-
/* The X/Open definition of `signal' specifies the SVID semantic. Use
the additional function `sysv_signal' when X/Open compatibility is
requested. */
extern __sighandler_t __sysv_signal __P ((int __sig,
__sighandler_t __handler));
-#if defined __USE_XOPEN && !defined __USE_GNU
-extern __sighandler_t sysv_signal __P ((int __sig, __sighandler_t __handler));
-
-/* Make sure the used `signal' implementation is the SVID version. */
-#define signal(sig, handler) __sysv_signal ((sig), (handler))
+/* Set the handler for the signal SIG to HANDLER, returning the old
+ handler, or SIG_ERR on error.
+ By default `signal' has the BSD semantic. */
+#if !defined __USE_XOPEN || defined __USE_GNU
+extern __sighandler_t signal __P ((int __sig, __sighandler_t __handler));
+#else
+/* Make sure the used `signal' implementation is the SVID version.
+ When GNU CC is used we have a clean way to write this. */
+# if defined __GNUC__ && __GNUC__ >= 2
+extern __sighandler_t signal __P ((int __sig, __sighandler_t __handler))
+ __asm__ ("__sysv_signal");
+# else
+# define signal(sig, handler) __sysv_signal ((sig), (handler))
+# endif
#endif
#ifdef __USE_XOPEN
@@ -120,17 +124,17 @@ extern int __sigpause __P ((int __sig_or_mask, int __is_sig));
/* Set the mask of blocked signals to MASK,
wait for a signal to arrive, and then restore the mask. */
extern int sigpause __P ((int __mask));
-#define sigpause(mask) __sigpause ((mask), 0)
+# define sigpause(mask) __sigpause ((mask), 0)
#else
-#ifdef __USE_XOPEN
+# ifdef __USE_XOPEN
/* Remove a signal from the signal mask and suspend the process. */
-#define sigpause(sig) __sigpause ((sig), 1)
-#endif
+# define sigpause(sig) __sigpause ((sig), 1)
+# endif
#endif
#ifdef __USE_BSD
-#define sigmask(sig) __sigmask(sig)
+# define sigmask(sig) __sigmask(sig)
extern int sigblock __P ((int __mask));
extern int sigsetmask __P ((int __mask));
@@ -142,7 +146,7 @@ extern int siggetmask __P ((void));
#ifdef __USE_MISC
-#define NSIG _NSIG
+# define NSIG _NSIG
#endif
#ifdef __USE_GNU
@@ -159,14 +163,14 @@ typedef __sighandler_t sig_t;
#ifdef __USE_POSIX
-#if !defined __sigset_t_defined \
+# if !defined __sigset_t_defined \
&& (defined _SIGNAL_H || defined __need_sigset_t)
typedef __sigset_t sigset_t;
-#define __sigset_t_defined 1
-#endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'. */
-#undef __need_sigset_t
+# define __sigset_t_defined 1
+# endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'. */
+# undef __need_sigset_t
-#ifdef _SIGNAL_H
+# ifdef _SIGNAL_H
/* Clear all signals from SET. */
extern int sigemptyset __P ((sigset_t *__set));
@@ -183,7 +187,7 @@ extern int sigdelset __P ((sigset_t *__set, int __signo));
/* Return 1 if SIGNO is in SET, 0 if not. */
extern int sigismember __P ((__const sigset_t *__set, int __signo));
-#ifdef __USE_GNU
+# ifdef __USE_GNU
/* Return non-empty value is SET is not empty. */
extern int sigisemptyset __P ((__const sigset_t *__set));
@@ -194,11 +198,11 @@ extern int sigandset __P ((sigset_t *__set, __const sigset_t *__left,
/* Build new signal set by combining the two inputs set using logical OR. */
extern int sigorset __P ((sigset_t *__set, __const sigset_t *__left,
__const sigset_t *__right));
-#endif /* GNU */
+# endif /* GNU */
/* Get the system-specific definitions of `struct sigaction'
and the `SA_*' and `SIG_*'. constants. */
-#include <bits/sigaction.h>
+# include <bits/sigaction.h>
/* Get and/or change the set of blocked signals. */
extern int __sigprocmask __P ((int __how,
@@ -225,7 +229,7 @@ extern int sigpending __P ((sigset_t *__set));
extern int __sigwait __P ((__const sigset_t *__set, int *__sig));
extern int sigwait __P ((__const sigset_t *__set, int *__sig));
-#endif /* <signal.h> included. */
+# endif /* <signal.h> included. */
#endif /* Use POSIX. */
@@ -243,13 +247,13 @@ struct sigvec
int sv_mask; /* Mask of signals to be blocked. */
int sv_flags; /* Flags (see below). */
-#define sv_onstack sv_flags /* 4.2 BSD compatibility. */
+# define sv_onstack sv_flags /* 4.2 BSD compatibility. */
};
/* Bits in `sv_flags'. */
-#define SV_ONSTACK (1 << 0)/* Take the signal on the signal stack. */
-#define SV_INTERRUPT (1 << 1)/* Do not restart system calls. */
-#define SV_RESETHAND (1 << 2)/* Reset handler to SIG_DFL on receipt. */
+# define SV_ONSTACK (1 << 0)/* Take the signal on the signal stack. */
+# define SV_INTERRUPT (1 << 1)/* Do not restart system calls. */
+# define SV_RESETHAND (1 << 2)/* Reset handler to SIG_DFL on receipt. */
/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
@@ -264,7 +268,7 @@ extern int sigvec __P ((int __sig, __const struct sigvec *__vec,
/* Get machine-dependent `struct sigcontext' and signal subcodes. */
-#include <bits/sigcontext.h>
+# include <bits/sigcontext.h>
/* Restore the state saved in SCP. */
extern int __sigreturn __P ((struct sigcontext *__scp));
@@ -275,8 +279,8 @@ extern int sigreturn __P ((struct sigcontext *__scp));
#if defined _SIGNAL_H && (defined __USE_BSD || defined __USE_XOPEN_EXTENDED)
-#define __need_size_t
-#include <stddef.h>
+# define __need_size_t
+# include <stddef.h>
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
(causing them to fail with EINTR); if INTERRUPT is zero, make system
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 95a606230a5..362c77c24fb 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -30,7 +30,7 @@ routines := \
vfscanf \
fscanf scanf sscanf \
perror psignal \
- tmpfile tmpnam tmpnam_r tempnam tempname \
+ tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
getline getw putw \
remove rename \
lockfile
diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c
index 969f338f482..fd6d20d11c6 100644
--- a/stdio-common/fprintf.c
+++ b/stdio-common/fprintf.c
@@ -34,3 +34,10 @@ fprintf (FILE *stream, const char *format, ...)
return done;
}
+
+#ifdef USE_IN_LIBIO
+/* We define the function with the real name here. But deep down in
+ libio the original function _IO_fprintf is also needed. So make
+ an alias. */
+weak_alias (fprintf, _IO_fprintf)
+#endif
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 85286bec158..33bc25bfd27 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -125,7 +125,8 @@ extern unsigned int __guess_grouping (unsigned int intdig_max,
static char *group_number (char *buf, char *bufend, unsigned int intdig_no,
- const char *grouping, wchar_t thousands_sep);
+ const char *grouping, wchar_t thousands_sep)
+ internal_function;
int
@@ -1016,6 +1017,7 @@ __guess_grouping (unsigned int intdig_max, const char *grouping,
Return the new end of buffer. */
static char *
+internal_function
group_number (char *buf, char *bufend, unsigned int intdig_no,
const char *grouping, wchar_t thousands_sep)
{
diff --git a/stdio-common/tempnam.c b/stdio-common/tempnam.c
index 5f8635cfb8b..987fbbbabe9 100644
--- a/stdio-common/tempnam.c
+++ b/stdio-common/tempnam.c
@@ -37,7 +37,7 @@ tempnam (const char *dir, const char *pfx)
size_t len;
char *s;
char *t = __stdio_gen_tempname (buf, sizeof (buf), dir, pfx, 1,
- &len, (FILE **) NULL);
+ &len, (FILE **) NULL, 0);
if (t == NULL)
return NULL;
diff --git a/stdio-common/tmpfile.c b/stdio-common/tmpfile.c
index 2cc03d6b89e..c3afd3f78b6 100644
--- a/stdio-common/tmpfile.c
+++ b/stdio-common/tmpfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@ tmpfile ()
FILE *f;
filename = __stdio_gen_tempname (buf, sizeof (buf), (char *) NULL, "tmpf", 0,
- (size_t *) NULL, &f);
+ (size_t *) NULL, &f, 0);
if (filename == NULL)
return NULL;
diff --git a/stdio-common/tmpfile64.c b/stdio-common/tmpfile64.c
new file mode 100644
index 00000000000..67d4bd82910
--- /dev/null
+++ b/stdio-common/tmpfile64.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library 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 <stdio.h>
+
+
+/* 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 *
+tmpfile64 ()
+{
+#ifdef _G_OPEN64
+ char buf[FILENAME_MAX];
+ char *filename;
+ FILE *f;
+
+ filename = __stdio_gen_tempname (buf, sizeof (buf), (char *) NULL, "tmpf", 0,
+ (size_t *) NULL, &f, 1);
+ if (filename == NULL)
+ return NULL;
+
+ /* Note that this relies on the Unix semantics that
+ a file is not really removed until it is closed. */
+ (void) remove (filename);
+
+ return f;
+#else
+ __set_errno (ENOSYS);
+ return NULL;
+#endif
+}
diff --git a/stdio-common/tmpnam.c b/stdio-common/tmpnam.c
index 6e6dd510eae..3389ff57b49 100644
--- a/stdio-common/tmpnam.c
+++ b/stdio-common/tmpnam.c
@@ -37,7 +37,7 @@ tmpnam (char *s)
to FILENAME_MAX characters in any case. */
result = __stdio_gen_tempname (s ?: tmpbuf, L_tmpnam, (const char *) NULL,
(const char *) NULL, 0,
- (size_t *) NULL, (FILE **) NULL);
+ (size_t *) NULL, (FILE **) NULL, 0);
if (result != NULL && s == NULL)
{
diff --git a/stdio-common/tmpnam_r.c b/stdio-common/tmpnam_r.c
index a509a071d65..5e67cc68456 100644
--- a/stdio-common/tmpnam_r.c
+++ b/stdio-common/tmpnam_r.c
@@ -33,5 +33,5 @@ tmpnam_r (char *s)
to L_tmpnam characters in any case. */
return __stdio_gen_tempname (s, L_tmpnam, (const char *) NULL,
(const char *) NULL, 0,
- (size_t *) NULL, (FILE **) NULL);
+ (size_t *) NULL, (FILE **) NULL, 0);
}
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 1cd8d2178a5..ef9e62ffccc 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -176,14 +176,16 @@ static const char null[] = "(null)";
/* Helper function to provide temporary buffering for unbuffered streams. */
-static int buffered_vfprintf __P ((FILE *stream, const CHAR_T *fmt, va_list));
+static int buffered_vfprintf __P ((FILE *stream, const CHAR_T *fmt, va_list))
+ internal_function;
/* Handle unknown format specifier. */
static int printf_unknown __P ((FILE *, const struct printf_info *,
const void *const *));
/* Group digits of number string. */
-static char *group_number __P ((CHAR_T *, CHAR_T *, const CHAR_T *, wchar_t));
+static char *group_number __P ((CHAR_T *, CHAR_T *, const CHAR_T *, wchar_t))
+ internal_function;
/* The function itself. */
@@ -1480,6 +1482,7 @@ printf_unknown (FILE *s, const struct printf_info *info,
/* Group the digits according to the grouping rules of the current locale.
The interpretation of GROUPING is as in `struct lconv' from <locale.h>. */
static char *
+internal_function
group_number (CHAR_T *w, CHAR_T *rear_ptr, const CHAR_T *grouping,
wchar_t thousands_sep)
{
@@ -1579,6 +1582,7 @@ static const struct _IO_jump_t _IO_helper_jumps =
};
static int
+internal_function
buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
_IO_va_list args)
{
@@ -1615,6 +1619,7 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
#else /* !USE_IN_LIBIO */
static int
+internal_function
buffered_vfprintf (register FILE *s, const CHAR_T *format, va_list args)
{
char buf[BUFSIZ];
diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c
index e7aab90046f..69ed9034a98 100644
--- a/stdlib/fmtmsg.c
+++ b/stdlib/fmtmsg.c
@@ -92,7 +92,8 @@ static int print;
/* Prototypes for local functions. */
static void init (void);
-static int internal_addseverity (int severity, const char *string);
+static int internal_addseverity (int severity, const char *string)
+ internal_function;
int
@@ -273,6 +274,7 @@ init (void)
/* Add the new entry to the list. */
static int
+internal_function
internal_addseverity (int severity, const char *string)
{
struct severity_info *runp, *lastp;
diff --git a/stdlib/longlong.h b/stdlib/longlong.h
index 8bb6995cd06..40ccc89cc3c 100644
--- a/stdlib/longlong.h
+++ b/stdlib/longlong.h
@@ -1139,7 +1139,7 @@ extern USItype __udiv_qrnnd ();
(q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
(r) = __r; \
} while (0)
-extern USItype __udiv_qrnnd ();
+extern USItype __udiv_qrnnd __P ((USItype *, USItype, USItype, USItype));
#define UDIV_TIME 140
#endif /* LONGLONG_STANDALONE */
#endif /* udiv_qrnnd */
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index a92df4bc9ed..2adefb508f8 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -188,23 +188,35 @@ extern __long_double_t __strtold_internal __P ((__const char *
__restrict __nptr,
char **__restrict __endptr,
int __group));
+#ifndef __strtol_internal_defined
extern long int __strtol_internal __P ((__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group));
+# define __strtol_internal_defined 1
+#endif
+#ifndef __strtoul_internal_defined
extern unsigned long int __strtoul_internal __P ((__const char *
__restrict __nptr,
char **__restrict __endptr,
int __base, int __group));
-#ifdef __GNUC__
+# define __strtoul_internal_defined 1
+#endif
+#if defined __GNUC__ || defined __USE_ISOC9X
+# ifndef __strtoll_internal_defined
extern long long int __strtoll_internal __P ((__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group));
+# define __strtoll_internal_defined 1
+# endif
+# ifndef __strtoull_internal_defined
extern unsigned long long int __strtoull_internal __P ((__const char *
__restrict __nptr,
char **
__restrict __endptr,
int __base,
int __group));
+# define __strtoull_internal_defined 1
+# endif
#endif /* GCC */
#if defined __OPTIMIZE__ && __GNUC__ >= 2
@@ -307,7 +319,7 @@ extern char *l64a __P ((long int __n));
extern long int a64l __P ((__const char *__s));
-#include <sys/types.h> /* we need int32_t... */
+# include <sys/types.h> /* we need int32_t... */
/* These are the functions that actually do things. The `random', `srandom',
`initstate' and `setstate' functions are those from BSD Unices.
@@ -411,7 +423,7 @@ struct drand48_data
int init; /* Flag for initializing. */
};
-#ifdef __USE_MISC
+# ifdef __USE_MISC
/* Return non-negative, double-precision floating-point value in [0.0,1.0). */
extern int drand48_r __P ((struct drand48_data *__buffer, double *__result));
extern int __erand48_r __P ((unsigned short int __xsubi[3],
@@ -449,7 +461,7 @@ extern int __lcong48_r __P ((unsigned short int __param[7],
struct drand48_data *__buffer));
extern int lcong48_r __P ((unsigned short int __param[7],
struct drand48_data *__buffer));
-#endif /* Use misc. */
+# endif /* Use misc. */
/* Internal function to compute next state of the generator. */
extern int __drand48_iterate __P ((unsigned short int __xsubi[3],
@@ -647,7 +659,7 @@ extern char *qfcvt __P ((__long_double_t __value, int __ndigit, int *__decpt,
extern char *qgcvt __P ((__long_double_t __value, int __ndigit, char *__buf));
-#ifdef __USE_MISC
+# ifdef __USE_MISC
/* Reentrant version of the functions above which provide their own
buffers. */
extern int ecvt_r __P ((double __value, int __ndigit, int *__decpt,
@@ -659,7 +671,7 @@ extern int qecvt_r __P ((__long_double_t __value, int __ndigit, int *__decpt,
int *__sign, char *__buf, size_t __len));
extern int qfcvt_r __P ((__long_double_t __value, int __ndigit, int *__decpt,
int *__sign, char *__buf, size_t __len));
-#endif /* misc */
+# endif /* misc */
#endif /* use MISC || use X/Open Unix */
diff --git a/stdlib/ucontext.h b/stdlib/ucontext.h
new file mode 100644
index 00000000000..2fd65767a6a
--- /dev/null
+++ b/stdlib/ucontext.h
@@ -0,0 +1,52 @@
+/* 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library 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. */
+
+/* System V ABI compliant user-level context switching support. */
+
+#ifndef _UCONTEXT_H
+#define _UCONTEXT_H 1
+
+#include <features.h>
+
+/* Get machine dependent definition of data structures. */
+#include <sys/ucontext.h>
+
+__BEGIN_DECLS
+
+/* Get user context and store it in variable pointed to by UCP. */
+extern int getcontext __P ((ucontext_t *__ucp));
+
+/* Set user context from information of variable pointed to by UCP. */
+extern int setcontext __P ((ucontext_t *__ucp));
+
+/* Save current context in context variable pointed to by OUCP and set
+ context from variable pointed to by UCP. */
+extern int swapcontext __P ((ucontext_t *__oucp, ucontext_t *__ucp));
+
+/* Manipulate user context UCP to continue with calling functions FUNC
+ and the ARGC-1 parameters following ARGC when the context is used
+ the next time in `setcontext' or `swapcontext'.
+
+ We cannot say anything about the parameters FUNC takes; `void'
+ is as good as any other choice. */
+extern void makecontext __P ((ucontext_t *__ucp, void (*__func) __P ((void)),
+ int __argc, ...));
+
+__END_DECLS
+
+#endif /* ucontext.h */
diff --git a/string/bits/string2.h b/string/bits/string2.h
index e0a8e75311b..c2e63b6ebcc 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -79,6 +79,10 @@ __STRING2_COPY_TYPE (8);
# undef __STRING2_COPY_TYPE
#endif
+/* Dereferencing a pointer arg to run sizeof on it fails for the
+ void pointer case, so we use this instead. */
+#define __string2_1bptr_p(x) (((size_t) ((x) + 1) - (size_t) (x)) == 1)
+
/* Set N bytes of S to C. */
#ifndef _HAVE_STRING_ARCH_memset
@@ -93,7 +97,7 @@ __STRING2_COPY_TYPE (8);
#ifndef _HAVE_STRING_ARCH_strcpy
# define strcpy(dest, src) \
(__extension__ (__builtin_constant_p (src) \
- ? (sizeof ((src)[0]) == 1 && strlen (src) + 1 <= 8 \
+ ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \
? __strcpy_small (dest, src, strlen (src) + 1) \
: (char *) memcpy (dest, src, strlen (src) + 1)) \
: strcpy (dest, src)))
@@ -204,7 +208,7 @@ __STRING2_COPY_TYPE (8);
# ifndef _HAVE_STRING_ARCH_stpcpy
# define __stpcpy(dest, src) \
(__extension__ (__builtin_constant_p (src) \
- ? (sizeof ((src)[0]) == 1 && strlen (src) + 1 <= 8 \
+ ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \
? __stpcpy_small (dest, src, strlen (src) + 1) \
: ((char *) __mempcpy (dest, src, strlen (src) + 1) - 1))\
: __stpcpy (dest, src)))
@@ -369,17 +373,17 @@ __STRING2_COPY_TYPE (8);
#ifndef _HAVE_STRING_ARCH_strcmp
# define strcmp(s1, s2) \
(__extension__ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \
- && (sizeof ((s1)[0]) != 1 || strlen (s1) >= 4) \
- && (sizeof ((s2)[0]) != 1 || strlen (s2) >= 4) \
+ && (!__string2_1bptr_p (s1) || strlen (s1) >= 4) \
+ && (!__string2_1bptr_p (s2) || strlen (s2) >= 4) \
? memcmp (s1, s2, (strlen (s1) < strlen (s2) \
? strlen (s1) : strlen (s2)) + 1) \
- : (__builtin_constant_p (s1) && sizeof ((s1)[0]) == 1 \
- && sizeof ((s2)[0]) == 1 && strlen (s1) < 4 \
+ : (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \
+ && __string2_1bptr_p (s2) && strlen (s1) < 4 \
? (__builtin_constant_p (s2) \
? __strcmp_cc (s1, s2, strlen (s1)) \
: __strcmp_cg (s1, s2, strlen (s1))) \
- : (__builtin_constant_p (s2) && sizeof ((s1)[0]) == 1 \
- && sizeof ((s2)[0]) == 1 && strlen (s2) < 4 \
+ : (__builtin_constant_p (s2) && __string2_1bptr_p (s1) \
+ && __string2_1bptr_p (s2) && strlen (s2) < 4 \
? (__builtin_constant_p (s1) \
? __strcmp_cc (s1, s2, strlen (s2)) \
: __strcmp_gc (s1, s2, strlen (s2))) \
@@ -450,7 +454,7 @@ __STRING2_COPY_TYPE (8);
consists entirely of characters not in REJECT. */
#ifndef _HAVE_STRING_ARCH_strcspn
# define strcspn(s, reject) \
- (__extension__ (__builtin_constant_p (reject) && sizeof ((reject)[0]) == 1 \
+ (__extension__ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \
? ((reject)[0] == '\0' \
? strlen (s) \
: ((reject)[1] == '\0' \
@@ -474,7 +478,7 @@ __strcspn_c1 (__const char *__s, char __reject)
consists entirely of characters in ACCEPT. */
#ifndef _HAVE_STRING_ARCH_strspn
# define strspn(s, accept) \
- (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \
+ (__extension__ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \
? ((accept)[0] == '\0' \
? 0 \
: ((accept)[1] == '\0' \
@@ -498,7 +502,7 @@ __strspn_c1 (__const char *__s, char __accept)
/* Find the first occurrence in S of any character in ACCEPT. */
#ifndef _HAVE_STRING_ARCH_strpbrk
# define strpbrk(s, accept) \
- (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \
+ (__extension__ (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \
? ((accept)[0] == '\0' \
? NULL \
: ((accept)[1] == '\0' \
@@ -511,7 +515,7 @@ __strspn_c1 (__const char *__s, char __accept)
/* Find the first occurrence of NEEDLE in HAYSTACK. */
#ifndef _HAVE_STRING_ARCH_strstr
# define strstr(haystack, needle) \
- (__extension__ (__builtin_constant_p (needle) && sizeof ((needle)[0]) == 1 \
+ (__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p (needle) \
? ((needle)[0] == '\0' \
? haystack \
: ((needle)[1] == '\0' \
@@ -538,7 +542,7 @@ strnlen (__const char *__string, size_t __maxlen)
# ifndef _HAVE_STRING_ARCH_strsep
# define strsep(s, reject) \
- (__extension__ (__builtin_constant_p (reject) && sizeof ((reject)[0]) == 1 \
+ (__extension__ (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \
? ((reject)[0] != '\0' && (reject)[1] == '\0' \
? __strsep_1c (s, (reject)[0]) \
: __strsep_g (s, reject)) \
diff --git a/string/endian.h b/string/endian.h
index 338c42ec35a..03e802f6cb9 100644
--- a/string/endian.h
+++ b/string/endian.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+/* 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
@@ -35,10 +35,10 @@
#include <bits/endian.h>
#ifdef __USE_BSD
-#define LITTLE_ENDIAN __LITTLE_ENDIAN
-#define BIG_ENDIAN __BIG_ENDIAN
-#define PDP_ENDIAN __PDP_ENDIAN
-#define BYTE_ORDER __BYTE_ORDER
+# define LITTLE_ENDIAN __LITTLE_ENDIAN
+# define BIG_ENDIAN __BIG_ENDIAN
+# define PDP_ENDIAN __PDP_ENDIAN
+# define BYTE_ORDER __BYTE_ORDER
#endif
#endif /* endian.h */
diff --git a/string/memory.h b/string/memory.h
index 952060d431b..d6aaa5994bb 100644
--- a/string/memory.h
+++ b/string/memory.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
+/* 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
@@ -27,7 +27,7 @@
#ifndef _STRING_H
-#include <string.h>
+# include <string.h>
#endif /* string.h */
diff --git a/string/tester.c b/string/tester.c
index 5b7b2f97f9f..d74ab72852b 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -695,13 +695,12 @@ test_strsep (void)
{
char text[] = "This,is,a,test";
- char *list = text;
- it = "strsep";
- check (!strcmp ("This", strsep (&list, ",")), 1);
- check (!strcmp ("is", strsep (&list, ",")), 2);
- check (!strcmp ("a", strsep (&list, ",")), 3);
- check (!strcmp ("test", strsep (&list, ",")), 4);
- check (strsep (&list, ",") == NULL, 5);
+ char *list = strdupa (text);
+ equal (strsep (&list, ","), "This", 47);
+ equal (strsep (&list, ","), "is", 48);
+ equal (strsep (&list, ","), "a", 49);
+ equal (strsep (&list, ","), "test", 50);
+ check (strsep (&list, ",") == NULL, 51);
}
}
diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c
index 9b030567d3b..bd29abd3bc3 100644
--- a/sunrpc/auth_des.c
+++ b/sunrpc/auth_des.c
@@ -71,7 +71,8 @@ static bool_t authdes_marshal (AUTH *, XDR *);
static bool_t authdes_validate (AUTH *, struct opaque_auth *);
static bool_t authdes_refresh (AUTH *);
static void authdes_destroy (AUTH *);
-static bool_t synchronize (struct sockaddr *, struct timeval *);
+static bool_t synchronize (struct sockaddr *, struct timeval *)
+ internal_function;
static struct auth_ops authdes_ops =
{
@@ -140,6 +141,7 @@ authdes_pk_create (const char *servername, netobj * pkey, u_int window,
*/
auth = ALLOC (AUTH);
ad = ALLOC (struct ad_private);
+ memset (ad, 0, sizeof (struct ad_private));
memcpy (ad->ad_pkey, pkey->n_bytes, pkey->n_len);
if (!getnetname (namebuf))
goto failed;
@@ -200,11 +202,11 @@ failed:
FREE (auth, sizeof (AUTH));
if (ad != NULL)
{
- FREE (ad, sizeof (struct ad_private));
if (ad->ad_fullname != NULL)
FREE (ad->ad_fullname, ad->ad_fullnamelen + 1);
if (ad->ad_servername != NULL)
FREE (ad->ad_servername, ad->ad_servernamelen + 1);
+ FREE (ad, sizeof (struct ad_private));
}
return (NULL);
}
@@ -440,6 +442,7 @@ authdes_destroy (AUTH * auth)
* adjust timep to reflect the delta between our clocks
*/
static bool_t
+internal_function