summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-10-12 04:05:44 +0000
committerUlrich Drepper <drepper@redhat.com>1997-10-12 04:05:44 +0000
commitdfd2257ad98eb0f6eab167e5fe5ff68ca87172e3 (patch)
tree598abc70247c1d029e6ac2ddb8cf127b81e442e4
parenta5a0310d8e9d7176bb17e91c916272006a871016 (diff)
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.
-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 e78451a71f..40e559d74a 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 bba8bef434..14d1886d05 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 e87100e9af..45e792fbc7 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 4477110d97..b5c48b861d 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 5b5cf742b6..6926cad0ad 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 2c35c12a47..46cf9a7af5 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 10bc0728b2..9fa3388801 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 c264adc917..fdb36f0b54 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 1301d9ea68..f2fa9167d3 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 2ab552c309..6081b3b064 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 b0bb90543a..992f1ee592 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 922f5b38c8..37e2cbeb35 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 68c9514882..69a4029066 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 a7f3553df0..7c36510ca1 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 a9b7a7474d..e2fab0ab03 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 3f09d72c32..8087fbd3be 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 10ae215c80..787da5a7e7 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 72b8925a8c..f5db84f7dc 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 52aeaabb4c..e8c97f800e 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 07a35f1b53..66d7eed0d0 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 31d8792d9d..160fc5f41c 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 26421724c4..afbd72d861 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 2bba606ec7..a7cdb07742 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 5afe82561c..a388d86ba8 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 6a680c18b7..92ce094807 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 692ce45bcf..3557202ea5 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 43158c4cfa..a67223ff7e 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 46d570f88f..05832f0e36 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 3f37e37c8a..e5c86b4cf6 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 0000000000..6e51dc0ff4
--- /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 519230019c..d47da0a1ff 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 0000000000..376a262a10
--- /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 f283c17450..255c53f529 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 8cccbacd37..e0835c2839 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 d377f2c947..ac4abeeb18 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 0000000000..6dbd03e831
--- /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 0000000000..ef2b156917
--- /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 0000000000..09eb38ae91
--- /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 5485976ca6..01bc00165e 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 49c154d216..fbec44182b 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 0abd31d5a1..20469efbe9 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 aea60f5226..4df874d722 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 f1b781e8a0..6abab602d1 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 22feb74fdd..ccfce3c776 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 0000000000..78e994df46
--- /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 0000000000..81c17b398c
--- /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 0000000000..886591dca9
--- /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 de9c826b9f..71275da28c 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 08a3c20e86..6afc323136 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 0000000000..0cb79d6619
--- /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 1dbeccb81a..5019e9a798 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 0000000000..cdd508d08a
--- /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 9bf29e71ae..4f28ec20a8 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 0000000000..534e0cf3ca
--- /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 92df6a6fd2..bcf8bbd775 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 59d4fc3f0e..f0589bf184 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 b1c4729b3d..13086ee912 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 2ce0c2224e..5b59ed7d99 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 1dddaf27b7..ad5583f486 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 2337071d39..5fe9598c0d 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 7b9ccd3d37..71aab2f6ea 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 6b959e455a..a0c4df6293 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 bbed294056..a835fed6cc 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 a9f812e045..c596315b60 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 3f35af299a..5ac2317579 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 7749f6aebc..6385df47e8 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 bad756aa64..8a7fe14d92 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 17350eb426..06fbf844f4 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 65381705df..81966b856c 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 54c9dfffbd..c1704d00ea 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 ad6b830fcb..49492eb73c 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 7f8c205ebb..2e418838db 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 4f9326e9d4..64591ee9f2 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 9d9b451a94..2e0c62e1f7 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 4c10b72578..23c5f767f1 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 2818270103..e6fc47f8e1 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 15a2075d33..fe9394b22d 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 d382df5df1..43230154f6 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 bc69019e63..7948229871 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 4c90b25447..fbf218ebf3 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 fcd30a11aa..7e0f985220 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 7a5cd655c0..c2b2378da8 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 bc54d57c43..d7525d084d 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 d94e764930..ca0dfe1b9c 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 e0bf1008d3..dacc264136 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 2075adcb59..c24b5f0f83 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 2a1aa6cfbe..296d55d675 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 762ccbe409..51055849ce 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 1f4ff8e0d0..c2e7dc92b3 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 de918a3886..849067c8da 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 614f10feb4..3039ccf5b4 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 05e5de62ff..d6f96f8622 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 0000000000..4c7d957b37
--- /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 fa971cabf0..643e96f2f5 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 7f68cb1309..8b87a1f1f0 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 777108ff70..6743ac5d7d 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 04da70a534..384001366e 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 602779ebb7..5f40a0a45d 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 9f946fb327..02285938cf 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 acb1b69e00..7aa29dad7d 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 e372a9e971..c5af3ec689 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 d6cf7a9f5e..c280caad63 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 82c5f24963..e114faf1c7 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 8528de7e1a..0000000000
--- 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 f8c0a97296..0000000000
--- 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 cf22d27d2f..49b3754e6d 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 6693a25766..d30ccde2f6 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 8fd7e12a58..6d55bd0d07 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 e10b8c07fd..0000000000
--- 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 06f63ee52e..aaefdd22ba 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 15cdd58402..f4bd07252c 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 a1d753692c..0000000000
--- 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 0000000000..4d641e58f7
--- /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 0000000000..291148fc0f
--- /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 0000000000..9bdc4d8835
--- /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 d1de08c08d..240573145f 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 53a585b516..21a80506ff 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 6ece45345d..5b70a67b68 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 f0cfe316e6..f6cca815b4 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 3435233aef..00238d0693 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 6ed1cc914a..ced0f716fd 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 c32d54a622..fdd7cd4214 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 a4ab7378e6..5d08882f84 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 b30b70b584..1629c24053 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 ce88f0790d..e714621f1b 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 85c401531e..aadd19753a 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 348c7534a3..bcae995837 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 bdce5d5a0a..cbc64c34a4 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 ab693d7da1..acd0122bdf 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 739ae0c351..3f2cca4698 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 a06dfdee8d..1397cb9c98 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 1914840e86..5aa43c340f 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 1063ef8411..fbc9ad11ba 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 2fa9ecc353..cbbbdfcfd0 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 8ed67caf98..71807a3ffe 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 ff84ed81e2..f1214f9f80 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 fcd1903638..3283e4cf93 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 3efba6084e..d2a1df76b2 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 6a8ab01bd7..be65120ae8 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 82df04e449..0c253da127 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 f074c5fa63..76c6f25813 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 b21c276df2..8ca6935cc7 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 7fefec0fd3..d1aa5ef787 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 8aa8bc0f9e..e548017068 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 db5f487159..b700fa66b4 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 b64d4bdd02..2cbd9fe2fa 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 e93a51652e..77a7248305 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 e1a89f92be..95a8cfa74b 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 f94b96cba4..c0d25325c1 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 20a4733741..2d19f37931 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 ca91a22cd4..0000000000
--- 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 91870d8a48..0000000000
--- 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 e13ae47b70..496a16a1e1 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 30bdff6d1a..19a5bcab19 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 73b3804e85..016bedc769 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 dace7824d4..d7ce0d76d0 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 e1baafa843..dab64bfe1f 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 988f46c88e..18f0bae03a 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 7dd3e0526f..18129bb5c0 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 a8adb1fe81..b7050867e4 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 850130b2a9..98bdc65d0b 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 fc37638f06..26c7be99ab 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 5b67a281df..c6371cb60b 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 61fec9874c..48328af032 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 675e2522fa..ab28d39aaf 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 bebef5d456..629dd5902a 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 f573d778f7..9b5025ab83 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 9fcad90cb1..e44dcff84f 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 e89f30d628..651c67d552 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 1910f07f77..3b639305cf 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 49aea2a719..5b9950af1f 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 bbdabd0fe0..644abee4a7 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 3593da262b..0c8f79f2c5 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 c59553c7ed..fdfc056750 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 755b88d466..a2de01f1a2 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 38d5a2c379..1ad0bb3bc4 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 e0158767f6..f9c6bb2488 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 588c779f11..5fb4bc2a14 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 95a606230a..362c77c24f 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 969f338f48..fd6d20d11c 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 85286bec15..33bc25bfd2 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 5f8635cfb8..987fbbbabe 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 2cc03d6b89..c3afd3f78b 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 0000000000..67d4bd8291
--- /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 6e6dd510ea..3389ff57b4 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 a509a071d6..5e67cc6845 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 1cd8d2178a..ef9e62ffcc 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 e7aab90046..69ed9034a9 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 8bb6995cd0..40ccc89cc3 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 a92df4bc9e..2adefb508f 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 0000000000..2fd65767a6
--- /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 e0a8e75311..c2e63b6ebc 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 338c42ec35..03e802f6cb 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 952060d431..d6aaa5994b 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 5b7b2f97f9..d74ab72852 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 9b030567d3..bd29abd3bc 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
synchronize (struct sockaddr *syncaddr, struct timeval *timep)
{
struct timeval mytime;
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c
index ac9b53a3e3..091735e519 100644
--- a/sunrpc/auth_unix.c
+++ b/sunrpc/auth_unix.c
@@ -85,7 +85,7 @@ struct audata
};
#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private)
-static bool_t marshal_new_auth (AUTH *);
+static bool_t marshal_new_auth (AUTH *) internal_function;
/*
@@ -307,6 +307,7 @@ authunix_destroy (AUTH *auth)
* sets private data, au_marshed and au_mpos
*/
static bool_t
+internal_function
marshal_new_auth (AUTH *auth)
{
XDR xdr_stream;
diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c
index 73ec6a12e9..89f61f0d64 100644
--- a/sunrpc/clnt_perr.c
+++ b/sunrpc/clnt_perr.c
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
#include <rpc/auth.h>
#include <rpc/clnt.h>
-static char *auth_errmsg (enum auth_stat stat);
+static char *auth_errmsg (enum auth_stat stat) internal_function;
static char *buf;
@@ -288,6 +288,7 @@ static const struct auth_errtab auth_errlist[] =
};
static char *
+internal_function
auth_errmsg (enum auth_stat stat)
{
size_t i;
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index dff7da6a7a..a497bc7cad 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -57,7 +57,7 @@ extern int _openchild (char *command, FILE **fto, FILE **ffrom);
static int key_call (u_long, xdrproc_t xdr_arg, char *,
- xdrproc_t xdr_rslt, char *);
+ xdrproc_t xdr_rslt, char *) internal_function;
static struct timeval trytimeout = {KEY_TIMEOUT, 0};
static struct timeval tottimeout = {KEY_TIMEOUT *KEY_NRETRY, 0};
@@ -267,6 +267,7 @@ cryptkeyres *(*__key_decryptsession_pk_LOCAL) (uid_t, char *) = 0;
des_block *(*__key_gendes_LOCAL) (uid_t, char *) = 0;
static int
+internal_function
key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
xdrproc_t xdr_rslt, char *rslt)
{
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index 6117c365d5..9115491028 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -167,6 +167,7 @@ xdr_rmtcallres (xdrs, crp)
*/
static int
+internal_function
getbroadcastnets (struct in_addr *addrs, int sock, char *buf)
/* int sock: any valid socket will do */
/* char *buf: why allocate more when we can use existing... */
diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
index ec7de3b80a..e14a9ad770 100644
--- a/sunrpc/svc_tcp.c
+++ b/sunrpc/svc_tcp.c
@@ -87,7 +87,7 @@ static const struct xp_ops svctcp_rendezvous_op =
static int readtcp (char*, char *, int);
static int writetcp (char *, char *, int);
-static SVCXPRT *makefd_xprt (int, u_int, u_int);
+static SVCXPRT *makefd_xprt (int, u_int, u_int) internal_function;
struct tcp_rendezvous
{ /* kept in xprt->xp_p1 */
@@ -191,6 +191,7 @@ svcfd_create (int fd, u_int sendsize, u_int recvsize)
}
static SVCXPRT *
+internal_function
makefd_xprt (int fd, u_int sendsize, u_int recvsize)
{
SVCXPRT *xprt;
diff --git a/sunrpc/svcauth_des.c b/sunrpc/svcauth_des.c
index 3547830267..c2dde692f4 100644
--- a/sunrpc/svcauth_des.c
+++ b/sunrpc/svcauth_des.c
@@ -80,12 +80,14 @@ struct cache_entry
static struct cache_entry *authdes_cache /* [AUTHDES_CACHESZ] */ ;
static short *authdes_lru /* [AUTHDES_CACHESZ] */ ;
-static void cache_init (void); /* initialize the cache */
-static short cache_spot (des_block *, char *, struct timeval *);
- /* find an entry in the cache */
-static void cache_ref (short sid); /* note that sid was ref'd */
+static void cache_init (void) internal_function; /* initialize the cache */
+static short cache_spot (des_block *, char *, struct timeval *)
+ internal_function; /* find an entry in the cache */
+static void cache_ref (short sid) internal_function;
+ /* note that sid was ref'd */
-static void invalidate (char *cred); /* invalidate entry in cache */
+static void invalidate (char *cred) internal_function;
+ /* invalidate entry in cache */
/*
* cache statistics
@@ -364,6 +366,7 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
* Initialize the cache
*/
static void
+internal_function
cache_init (void)
{
register int i;
@@ -397,6 +400,7 @@ cache_victim (void)
* Note that sid was referenced
*/
static void
+internal_function
cache_ref (register short sid)
{
register int i;
@@ -420,6 +424,7 @@ cache_ref (register short sid)
* return the spot in the cache.
*/
static short
+internal_function
cache_spot (register des_block * key, char *name, struct timeval *timestamp)
{
register struct cache_entry *cp;
@@ -538,6 +543,7 @@ authdes_getucred (const struct authdes_cred *adc, uid_t * uid, gid_t * gid,
}
static void
+internal_function
invalidate (char *cred)
{
if (cred == NULL)
diff --git a/sunrpc/xcrypt.c b/sunrpc/xcrypt.c
index 97c30d149f..df191f5ad2 100644
--- a/sunrpc/xcrypt.c
+++ b/sunrpc/xcrypt.c
@@ -5,23 +5,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#)xcrypt.c 1.3 89/03/24 Copyr 1986 Sun Micro";
* xcrypt.c: Hex encryption/decryption and utility routines
*/
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -53,9 +54,19 @@ static char hex[16] =
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
};
-static char hexval (char);
-static void hex2bin (int, char *, char *);
-static void bin2hex (int, unsigned char *, char *);
+
+#ifdef _LIBC
+# define hexval(c) \
+ (c >= '0' && c <= '9' \
+ ? c - '0' \
+ : ({ int upp = toupper (c); \
+ upp >= 'a' && upp <= 'z' ? upp - 'a' + 10 : -1; }))
+#else
+static char hexval (char) internal_function;
+#endif
+
+static void hex2bin (int, char *, char *) internal_function;
+static void bin2hex (int, unsigned char *, char *) internal_function;
void passwd2des (char *pw, char *key);
/*
@@ -140,6 +151,7 @@ passwd2des (char *pw, char *key)
* Hex to binary conversion
*/
static void
+internal_function
hex2bin (int len, char *hexnum, char *binnum)
{
int i;
@@ -152,6 +164,7 @@ hex2bin (int len, char *hexnum, char *binnum)
* Binary to hex conversion
*/
static void
+internal_function
bin2hex (int len, unsigned char *binnum, char *hexnum)
{
int i;
@@ -166,6 +179,7 @@ bin2hex (int len, unsigned char *binnum, char *hexnum)
hexnum[len * 2] = 0;
}
+#ifndef _LIBC
static char
hexval (char c)
{
@@ -178,3 +192,4 @@ hexval (char c)
else
return -1;
}
+#endif
diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c
index b8a4f511a7..db5684bcab 100644
--- a/sunrpc/xdr_rec.c
+++ b/sunrpc/xdr_rec.c
@@ -117,11 +117,11 @@ typedef struct rec_strm
}
RECSTREAM;
-static u_int fix_buf_size (u_int);
-static bool_t skip_input_bytes (RECSTREAM *, long);
-static bool_t flush_out (RECSTREAM *, bool_t);
-static bool_t set_input_fragment (RECSTREAM *);
-static bool_t get_input_bytes (RECSTREAM *, caddr_t, int);
+static u_int fix_buf_size (u_int) internal_function;
+static bool_t skip_input_bytes (RECSTREAM *, long) internal_function;
+static bool_t flush_out (RECSTREAM *, bool_t) internal_function;
+static bool_t set_input_fragment (RECSTREAM *) internal_function;
+static bool_t get_input_bytes (RECSTREAM *, caddr_t, int) internal_function;
/*
* Create an xdr handle for xdrrec
@@ -497,6 +497,7 @@ xdrrec_endofrecord (xdrs, sendnow)
* Internal useful routines
*/
static bool_t
+internal_function
flush_out (RECSTREAM *rstrm, bool_t eor)
{
u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
@@ -533,6 +534,7 @@ fill_input_buf (RECSTREAM *rstrm)
}
static bool_t /* knows nothing about records! Only about input buffers */
+internal_function
get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len)
{
int current;
@@ -556,6 +558,7 @@ get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len)
}
static bool_t /* next two bytes of the input stream are treated as a header */
+internal_function
set_input_fragment (RECSTREAM *rstrm)
{
u_long header;
@@ -569,6 +572,7 @@ set_input_fragment (RECSTREAM *rstrm)
}
static bool_t /* consumes input bytes; knows nothing about records! */
+internal_function
skip_input_bytes (RECSTREAM *rstrm, long cnt)
{
int current;
@@ -590,6 +594,7 @@ skip_input_bytes (RECSTREAM *rstrm, long cnt)
}
static u_int
+internal_function
fix_buf_size (u_int s)
{
if (s < 100)
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index d3eb242c04..3f65ae99a3 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -353,6 +353,14 @@ elf_machine_fixup_plt(struct link_map *l, const Elf64_Rela *reloc,
hasn't made it into Icache yet, so there's nothing to clean up. */
}
+/* Return the final value of a plt relocation. */
+static inline Elf64_Addr
+elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
+ Elf64_Addr value)
+{
+ return value + reloc->r_addend;
+}
+
#endif /* !dl_machine_h */
#ifdef RESOLVE
diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S
index 48fe33b3ec..ae3ceb517d 100644
--- a/sysdeps/alpha/setjmp.S
+++ b/sysdeps/alpha/setjmp.S
@@ -70,11 +70,11 @@ END(__sigsetjmp)
/* Put these traditional entry points in the same file so that we can
elide much of the nonsense in trying to jmp to the real function. */
-ENTRY(_setjmp)
+ENTRY(__setjmp)
ldgp gp, 0(pv)
mov 0, a1
br $sigsetjmp_local
-END(_setjmp)
+END(__setjmp)
ENTRY(setjmp)
ldgp gp, 0(pv)
@@ -82,5 +82,5 @@ ENTRY(setjmp)
br $sigsetjmp_local
END(setjmp)
-weak_extern(_setjmp)
+weak_alias(__setjmp, _setjmp)
weak_extern(setjmp)
diff --git a/sysdeps/generic/_G_config.h b/sysdeps/generic/_G_config.h
index 84a552b41e..a9a182169b 100644
--- a/sysdeps/generic/_G_config.h
+++ b/sysdeps/generic/_G_config.h
@@ -15,16 +15,19 @@
hold any value corresponding to members of the extended character
set, as well as at least one value that does not correspond to any
member of the extended character set. */
-#define _WINT_T
+# define _WINT_T
typedef unsigned int wint_t;
#endif
#define _G_size_t size_t
#define _G_fpos_t __off_t
+#define _G_fpos64_t __off_t
#define _G_ssize_t __ssize_t
#define _G_off_t __off_t
+#define _G_off64_t __off_t
#define _G_pid_t __pid_t
#define _G_uid_t __uid_t
#define _G_wint_t wint_t
+#define _G_stat64 stat
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
@@ -57,9 +60,9 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#if defined (__cplusplus) || defined (__STDC__)
-#define _G_ARGS(ARGLIST) ARGLIST
+# define _G_ARGS(ARGLIST) ARGLIST
#else
-#define _G_ARGS(ARGLIST) ()
+# define _G_ARGS(ARGLIST) ()
#endif
#endif /* _G_config.h */
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
index 5b5cf742b6..6926cad0ad 100644
--- a/sysdeps/generic/bits/confname.h
+++ b/sysdeps/generic/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/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
index 2c35c12a47..46cf9a7af5 100644
--- a/sysdeps/generic/bits/resource.h
+++ b/sysdeps/generic/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/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
index 10bc0728b2..9fa3388801 100644
--- a/sysdeps/generic/bits/statfs.h
+++ b/sysdeps/generic/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/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h
index c264adc917..fdb36f0b54 100644
--- a/sysdeps/generic/bits/types.h
+++ b/sysdeps/generic/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/sysdeps/generic/memcmp.c b/sysdeps/generic/memcmp.c
index 8fa371192c..844cdc6afb 100644
--- a/sysdeps/generic/memcmp.c
+++ b/sysdeps/generic/memcmp.c
@@ -132,6 +132,7 @@ memcmp_common_alignment (srcp1, srcp2, len)
switch (len % 4)
{
+ default: /* Avoid warning about uninitialized local variables. */
case 2:
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
@@ -233,6 +234,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
switch (len % 4)
{
+ default: /* Avoid warning about uninitialized local variables. */
case 2:
a1 = ((op_t *) srcp1)[0];
a2 = ((op_t *) srcp1)[1];
diff --git a/sysdeps/generic/memset.c b/sysdeps/generic/memset.c
index 1369698652..239dc21e3c 100644
--- a/sysdeps/generic/memset.c
+++ b/sysdeps/generic/memset.c
@@ -38,7 +38,8 @@ memset (dstpp, c, len)
cccc |= cccc << 8;
cccc |= cccc << 16;
if (OPSIZ > 4)
- cccc |= cccc << 32;
+ /* Do the shift in two steps to avoid warning if long has 32 bits. */
+ cccc |= (cccc << 16) << 16;
/* There are at least some bytes to set.
No need to test for LEN == 0 in this alignment loop. */
diff --git a/sysdeps/generic/strchr.c b/sysdeps/generic/strchr.c
index 3663382556..7c1eb9578a 100644
--- a/sysdeps/generic/strchr.c
+++ b/sysdeps/generic/strchr.c
@@ -63,7 +63,7 @@ strchr (s, c)
switch (sizeof (longword))
{
case 4: magic_bits = 0x7efefeffL; break;
- case 8: magic_bits = (0x7efefefeL << 32) | 0xfefefeffL; break;
+ case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
default:
abort ();
}
@@ -72,7 +72,8 @@ strchr (s, c)
charmask = c | (c << 8);
charmask |= charmask << 16;
if (sizeof (longword) > 4)
- charmask |= charmask << 32;
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ charmask |= (charmask << 16) << 16;
if (sizeof (longword) > 8)
abort ();
diff --git a/sysdeps/generic/strlen.c b/sysdeps/generic/strlen.c
index 1fb8b1c97c..b031df8103 100644
--- a/sysdeps/generic/strlen.c
+++ b/sysdeps/generic/strlen.c
@@ -60,9 +60,10 @@ strlen (str)
if (sizeof (longword) > 4)
{
/* 64-bit version of the magic. */
- magic_bits = (0x7efefefeL << 32) | 0xfefefeffL;
- himagic = (himagic << 32) | himagic;
- lomagic = (lomagic << 32) | lomagic;
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+ himagic = ((himagic << 16) << 16) | himagic;
+ lomagic = ((lomagic << 16) << 16) | lomagic;
}
if (sizeof (longword) > 8)
abort ();
diff --git a/sysdeps/generic/sys/mman.h b/sysdeps/generic/sys/mman.h
index 6484e028c9..6e41a923d5 100644
--- a/sysdeps/generic/sys/mman.h
+++ b/sysdeps/generic/sys/mman.h
@@ -91,8 +91,18 @@ __BEGIN_DECLS
extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
int __flags, int __fd, __off_t __offset));
+#ifndef __USE_FILE_OFFSET64
extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
int __flags, int __fd, __off_t __offset));
+#else
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+ int __flags, int __fd, __off_t __offset))
+ __asm__ ("mmap64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern __caddr_t mmap64 __P ((__caddr_t __addr, size_t __len, int __prot,
+ int __flags, int __fd, __off64_t __offset));
+#endif
/* Deallocate any mapping for the region starting at ADDR and extending LEN
bytes. Returns 0 if successful, -1 for errors (and sets errno). */
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 0ac67c05d9..c347a515a4 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -290,6 +290,14 @@ elf_machine_fixup_plt (struct link_map *map, const Elf32_Rel *reloc,
*reloc_addr = value;
}
+/* Return the final value of a plt relocation. */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
+ Elf32_Addr value)
+{
+ return value;
+}
+
#endif /* !dl_machine_h */
#ifdef RESOLVE
diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S
index 706e5c963f..7416c0ace9 100644
--- a/sysdeps/i386/elf/start.S
+++ b/sysdeps/i386/elf/start.S
@@ -94,6 +94,13 @@ _start:
call exit
hlt /* Crash if somehow `exit' does return. */
+/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so
+ meaningless since we don't support machines < 80386. */
+ .section .rodata
+ .globl _fp_hw
+ .long 3
+ .size _fp_hw, 4
+
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 1ba3fc5a75..598eef78e7 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -20,6 +20,7 @@
#include <sysdep.h>
#define _ASM
#include <bits/setjmp.h>
+#include <asm-syntax.h>
/* Binary compatibility entry point. */
ENTRY (__setjmp)
@@ -47,9 +48,10 @@ ENTRY (__sigsetjmp)
we can't save and restore our caller's value. Instead, we do an
indirect jump through the GOT, using for the temporary register
%ecx, which is call-clobbered. */
- call here
-here: popl %ecx
- addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
+ call L(here)
+L(here):
+ popl %ecx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ecx
movl C_SYMBOL_NAME(__sigjmp_save@GOT)(%ecx), %ecx
jmp *%ecx
#else
diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/sys/ucontext.h
new file mode 100644
index 0000000000..17b6b6c76b
--- /dev/null
+++ b/sysdeps/i386/sys/ucontext.h
@@ -0,0 +1,120 @@
+/* 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/i386 ABI compliant context switching support. */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H 1
+
+#include <features.h>
+#include <signal.h>
+
+/* Type for general register. */
+typedef int greg_t;
+
+/* Number of general registers. */
+#define NGREG 19
+
+/* Container for all general registers. */
+typedef greg_t gregset_t[NGREG];
+
+/* Number of each register is the `gregset_t' array. */
+enum
+{
+ GS = 0,
+#define GS GS
+ FS,
+#define FS FS
+ ES,
+#define ES ES
+ DS,
+#define DS DS
+ EDI
+#define EDI EDI
+ ESI
+#define ESI ESI
+ EBP,
+#define EBP EBP
+ ESP,
+#define ESP ESP
+ EBX,
+#define EBX EBX
+ EDX,
+#define EDX EDX
+ ECX,
+#define ECX ECX
+ EAX,
+#define EAX EAX
+ TRAPNO,
+#define TRAPNO TRAPNO
+ ERR,
+#define ERR ERR
+ EIP,
+#define EIP EIP
+ CS,
+#define CS CS
+ EFL,
+#define EFL EFL
+ UESP,
+#define UESP UESP
+ SS
+#define SS SS
+};
+
+/* Structure to describe FPU registers. */
+typedef struct fpregset
+ {
+ union
+ {
+ struct fpchip_state
+ {
+ int state[27];
+ int status;
+ } fpchip_state;
+
+ struct fp_emul_space
+ {
+ char fp_emul[246];
+ char fp_epad[2];
+ } fp_emul_space;
+
+ int f_fpregs[62];
+ } fp_reg_set;
+
+ long int f_wregs[33];
+ } fpregset_t;
+
+/* Context to describe whole processor state. */
+typedef struct
+ {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ } mcontext_t;
+
+/* Userlevel context. */
+typedef struct ucontext
+ {
+ unsigned long int uc_flags;
+ struct ucontext *uc_links;
+ __sigset_t uc_sigmask;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ long int uc_filler[5];
+ } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/libm-i387/s_fma.S b/sysdeps/libm-i387/s_fma.S
new file mode 100644
index 0000000000..deeac574a7
--- /dev/null
+++ b/sysdeps/libm-i387/s_fma.S
@@ -0,0 +1,32 @@
+/* Compute (X * Y) + Z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+
+ .text
+ENTRY(__fma)
+ fldl 4(%esp) // x
+ fldl 12(%esp) // x : y
+ fmulp // x * y
+ fldl 20(%esp) // z : x * y
+ fmulp // (x * y) + z
+ ret
+END(__fma)
+weak_alias (__fma, fma)
diff --git a/sysdeps/libm-i387/s_fmaf.S b/sysdeps/libm-i387/s_fmaf.S
new file mode 100644
index 0000000000..726c49d12c
--- /dev/null
+++ b/sysdeps/libm-i387/s_fmaf.S
@@ -0,0 +1,32 @@
+/* Compute (X * Y) + Z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+
+ .text
+ENTRY(__fmaf)
+ flds 4(%esp) // x
+ flds 8(%esp) // x : y
+ fmulp // x * y
+ flds 12(%esp) // z : x * y
+ fmulp // (x * y) + z
+ ret
+END(__fmaf)
+weak_alias (__fmaf, fmaf)
diff --git a/sysdeps/libm-i387/s_fmal.S b/sysdeps/libm-i387/s_fmal.S
new file mode 100644
index 0000000000..be8b557902
--- /dev/null
+++ b/sysdeps/libm-i387/s_fmal.S
@@ -0,0 +1,32 @@
+/* Compute (X * Y) + Z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+
+ .text
+ENTRY(__fmal)
+ fldt 4(%esp) // x
+ fldt 16(%esp) // x : y
+ fmulp // x * y
+ fldt 28(%esp) // z : x * y
+ fmulp // (x * y) + z
+ ret
+END(__fmal)
+weak_alias (__fmal, fmal)
diff --git a/sysdeps/libm-i387/s_llrint.S b/sysdeps/libm-i387/s_llrint.S
index 49bfebc993..6109ec45c3 100644
--- a/sysdeps/libm-i387/s_llrint.S
+++ b/sysdeps/libm-i387/s_llrint.S
@@ -23,7 +23,7 @@
.text
ENTRY(__llrint)
- fldt 4(%esp)
+ fldl 4(%esp)
subl $8, %esp
fistpll (%esp)
fwait
diff --git a/sysdeps/libm-i387/s_llrintf.S b/sysdeps/libm-i387/s_llrintf.S
new file mode 100644
index 0000000000..c1e1c225c0
--- /dev/null
+++ b/sysdeps/libm-i387/s_llrintf.S
@@ -0,0 +1,34 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+
+ .text
+ENTRY(__llrintf)
+ flds 4(%esp)
+ subl $8, %esp
+ fistpll (%esp)
+ fwait
+ popl %eax
+ popl %edx
+ ret
+END(__llrintf)
+weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/libm-i387/s_llrintl.S b/sysdeps/libm-i387/s_llrintl.S
new file mode 100644
index 0000000000..d894897d5e
--- /dev/null
+++ b/sysdeps/libm-i387/s_llrintl.S
@@ -0,0 +1,34 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+
+ .text
+ENTRY(__llrintl)
+ fldt 4(%esp)
+ subl $8, %esp
+ fistpll (%esp)
+ fwait
+ popl %eax
+ popl %edx
+ ret
+END(__llrintl)
+weak_alias (__llrintl, llrintl)
diff --git a/sysdeps/libm-i387/s_lrint.S b/sysdeps/libm-i387/s_lrint.S
index 3be4ca7903..40956ab0d0 100644
--- a/sysdeps/libm-i387/s_lrint.S
+++ b/sysdeps/libm-i387/s_lrint.S
@@ -23,7 +23,7 @@
.text
ENTRY(__lrint)
- fldt 4(%esp)
+ fldl 4(%esp)
subl $4, %esp
fistpl (%esp)
fwait
diff --git a/sysdeps/libm-i387/s_lrintf.S b/sysdeps/libm-i387/s_lrintf.S
new file mode 100644
index 0000000000..2f49bdbabe
--- /dev/null
+++ b/sysdeps/libm-i387/s_lrintf.S
@@ -0,0 +1,33 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+
+ .text
+ENTRY(__lrintf)
+ flds 4(%esp)
+ subl $4, %esp
+ fistpl (%esp)
+ fwait
+ popl %eax
+ ret
+END(__lrintf)
+weak_alias (__lrintf, lrintf)
diff --git a/sysdeps/libm-i387/s_lrintl.S b/sysdeps/libm-i387/s_lrintl.S
new file mode 100644
index 0000000000..3a06c91b29
--- /dev/null
+++ b/sysdeps/libm-i387/s_lrintl.S
@@ -0,0 +1,33 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+
+ .text
+ENTRY(__lrintl)
+ fldt 4(%esp)
+ subl $4, %esp
+ fistpl (%esp)
+ fwait
+ popl %eax
+ ret
+END(__lrintl)
+weak_alias (__lrintl, lrintl)
diff --git a/sysdeps/libm-i387/s_scalbln.c b/sysdeps/libm-i387/s_scalbln.c
new file mode 100644
index 0000000000..1009713fbc
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalbln.c
@@ -0,0 +1,2 @@
+/* Nothing to do. This function is the same as scalbn. So we define an
+ alias. */
diff --git a/sysdeps/libm-i387/s_scalblnf.c b/sysdeps/libm-i387/s_scalblnf.c
new file mode 100644
index 0000000000..5e558c3540
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalblnf.c
@@ -0,0 +1,2 @@
+/* Nothing to do. This function is the same as scalbnf. So we define an
+ alias. */
diff --git a/sysdeps/libm-i387/s_scalblnl.c b/sysdeps/libm-i387/s_scalblnl.c
new file mode 100644
index 0000000000..cda2ec11c8
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalblnl.c
@@ -0,0 +1,2 @@
+/* Nothing to do. This function is the same as scalbnl. So we define an
+ alias. */
diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S
index 709b7a47f5..ea9e25f094 100644
--- a/sysdeps/libm-i387/s_scalbn.S
+++ b/sysdeps/libm-i387/s_scalbn.S
@@ -15,3 +15,5 @@ ENTRY(__scalbn)
ret
END (__scalbn)
weak_alias (__scalbn, scalbn)
+strong_alias (__scalbn, __scalbln)
+weak_alias (__scalbn, scalbln)
diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S
index ce92113844..dc8cfb4296 100644
--- a/sysdeps/libm-i387/s_scalbnf.S
+++ b/sysdeps/libm-i387/s_scalbnf.S
@@ -15,3 +15,5 @@ ENTRY(__scalbnf)
ret
END (__scalbnf)
weak_alias (__scalbnf, scalbnf)
+strong_alias (__scalbnf, __scalblnf)
+weak_alias (__scalbnf, scalblnf)
diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S
index 09e06457b8..295494b3d2 100644
--- a/sysdeps/libm-i387/s_scalbnl.S
+++ b/sysdeps/libm-i387/s_scalbnl.S
@@ -16,3 +16,5 @@ ENTRY(__scalbnl)
ret
END (__scalbnl)
weak_alias (__scalbnl, scalbnl)
+strong_alias (__scalbnl, __scalblnl)
+weak_alias (__scalbnl, scalblnl)
diff --git a/sysdeps/libm-ieee754/s_clog10.c b/sysdeps/libm-ieee754/s_clog10.c
new file mode 100644
index 0000000000..5a9de75733
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_clog10.c
@@ -0,0 +1,65 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ double
+__clog10 (__complex__ double x)
+{
+ __complex__ double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysign (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabs (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nan ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = __nan ("");
+ }
+
+ return result;
+}
+weak_alias (__clog10, clog10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__clog10, __clog10l)
+weak_alias (__clog10, clog10l)
+#endif
diff --git a/sysdeps/libm-ieee754/s_clog10f.c b/sysdeps/libm-ieee754/s_clog10f.c
new file mode 100644
index 0000000000..4e2fa83edf
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_clog10f.c
@@ -0,0 +1,61 @@
+/* Compute complex base 10 logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ float
+__clog10f (__complex__ float x)
+{
+ __complex__ float result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysignf (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsf (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanf ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALF;
+ else
+ __real__ result = __nanf ("");
+ }
+
+ return result;
+}
+weak_alias (__clog10f, clog10f)
diff --git a/sysdeps/libm-ieee754/s_clog10l.c b/sysdeps/libm-ieee754/s_clog10l.c
new file mode 100644
index 0000000000..bf7d394c42
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_clog10l.c
@@ -0,0 +1,61 @@
+/* Compute complex natural logarithm.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <complex.h>
+#include <math.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__clog10l (__complex__ long double x)
+{
+ __complex__ long double result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (rcls == FP_ZERO && icls == FP_ZERO)
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+ __imag__ result = __copysignl (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -1.0 / fabsl (__real__ x);
+ }
+ else if (rcls != FP_NAN && icls != FP_NAN)
+ {
+ /* Neither real nor imaginary part is NaN. */
+ __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
+ __imag__ x));
+ __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nanl ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VALL;
+ else
+ __real__ result = __nanl ("");
+ }
+
+ return result;
+}
+weak_alias (__clog10l, clog10l)
diff --git a/sysdeps/libm-ieee754/s_fma.c b/sysdeps/libm-ieee754/s_fma.c
new file mode 100644
index 0000000000..53974dc40c
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fma.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+double
+__fma (double x, double y, double z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fma, fma)
diff --git a/sysdeps/libm-ieee754/s_fmaf.c b/sysdeps/libm-ieee754/s_fmaf.c
new file mode 100644
index 0000000000..44e5e15def
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmaf.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+float
+__fmaf (float x, float y, float z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fmaf, fmaf)
diff --git a/sysdeps/libm-ieee754/s_fmal.c b/sysdeps/libm-ieee754/s_fmal.c
new file mode 100644
index 0000000000..f73751f4db
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmal.c
@@ -0,0 +1,28 @@
+/* Compute x * y + z as ternary operation.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+long double
+__fmal (long double x, long double y, long double z)
+{
+ return (x * y) + z;
+}
+weak_alias (__fmal, fmal)
diff --git a/sysdeps/libm-ieee754/s_llrint.c b/sysdeps/libm-ieee754/s_llrint.c
index faae106ece..a50ba96952 100644
--- a/sysdeps/libm-ieee754/s_llrint.c
+++ b/sysdeps/libm-ieee754/s_llrint.c
@@ -23,9 +23,7 @@
#include "math_private.h"
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type. */
-static long double two52[2] =
+static const long double two52[2] =
{
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
@@ -33,210 +31,65 @@ static long double two52[2] =
long long int
-__llrint (long double x)
+__llrint (double x)
{
- int32_t j0,sx;
- u_int32_t i0, i1, i;
- long double t, w;
+ int32_t j0;
+ u_int32_t i1, i0;
long long int result;
+ volatile double w;
+ double t;
+ int sx;
EXTRACT_WORDS (i0, i1, x);
-
- sx = i0 >> 31;
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ sx = i0 >> 31;
+ i0 &= 0xfffff;
+ i0 |= 0x100000;
if (j0 < 20)
{
- if (j0 < 0)
- {
- if (((i0 & 0x7fffffff) | i1) == 0)
- /* The number is 0. */
- result = 0;
- else
- {
- i1 |= i0;
- i0 &= 0xfffe0000;
- i0 |= ((i1 | -i1) >> 12) & 0x80000;
- SET_HIGH_WORD (x, i0);
- w = two52[sx] + x;
- t = w - two52[sx];
- GET_HIGH_WORD (i0, t);
- if ((i0 & 0x7fffffff) >= 0x3fff0000)
- result = sx ? -1 : 1;
- else
- result = 0;
- }
- }
+ if (j0 < -1)
+ return 0;
else
{
- u_int32_t i = 0x000fffff >> j0;
- if (((i0 & i) | i1) == 0)
- {
- /* X is not integral. */
- i >>= 1;
- if (((i0 & i) | i1) != 0)
- {
- if (j0 == 19)
- i1 = 0x40000000;
- else
- i0 = (i0 & (~i)) | (0x20000 >> j0);
-
- INSERT_WORDS (x, i0, i1);
- w = two52[sx] + x;
- x = w - two52[sx];
- EXTRACT_WORDS (i0, i1, x);
-
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
- }
- }
-
- result = ((i0 >> (20 - j0)) & 0xfffff) | (0x00100000 >> (20 - j0));
- if (sx)
- result = -result;
+ w = two52[sx] + x;
+ t = w - two52[sx];
+ EXTRACT_WORDS (i0, i1, t);
+ i0 = i & 0xfffff;
+ i0 |= 0x100000;
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+ result = i0 >> (20 - j0);
}
}
- else if ((unsigned int) j0 < sizeof (long long int) * 8 && j0 < 53)
- {
- i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
- if ((i1 & i) != 0)
- {
- /* x is not integral. */
- i >>= 1;
- if ((i1 & i) != 0)
- i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 20));
- }
-
- INSERT_WORDS (x, i0, i1);
- w = two52[sx] + x;
- x = w - two52[sx];
- EXTRACT_WORDS (i0, i1, x);
-
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-
- result = i0 | 0x00100000;
- if (j0 > 20)
- {
- result <<= j0 - 20;
- result |= i1 >> (52 - j0);
- }
- if (sx)
- result = -result;
- }
- else
- /* Too large. The number is either +-inf or NaN or it is too
- large to be effected by rounding. The standard leaves it
- undefined what to return when the number is too large to fit in
- a `long int'. */
- result = (long long int) x;
-
- return result;
-}
-
-#else
-static long double two63[2] =
-{
- 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
- -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
-};
-
-
-long long int
-__llrint (long double x)
-{
- int32_t se,j0,sx;
- u_int32_t i0, i1, i;
- long long int result;
- long double w, t;
-
- GET_LDOUBLE_WORDS (se, i0, i1, x);
-
- sx = (se >> 15) & 1;
- j0 = (se & 0x7fff) - 0x3fff;
-
- if (j0 < 31)
+ else if (j0 < (int32_t) (8 * sizeof (long long int)))
{
- if (j0 < 0)
- {
- if (((se & 0x7fff) | i0 | i1) == 0)
- /* The number is 0. */
- result = 0;
- else
- {
- i1 |= i0;
- i0 &= 0xe0000000;
- i0 |= (i1 | -i1) & 0x80000000;
- SET_LDOUBLE_MSW (x, i0);
- w = two63[sx] + x;
- t = w - two63[sx];
- GET_LDOUBLE_EXP (i0, t);
- if ((i0 & 0x7fff) >= 0x3fff)
- result = sx ? -1 : 1;
- else
- result = 0;
- }
- }
+ if (j0 >= 52)
+ result = ((long long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
else
{
- u_int32_t i = 0x7fffffff >> j0;
- if (((i0 & i) | i1) == 0)
- {
- /* X is not integral. */
- i >>= 1;
- if (((i0 & i) | i1) != 0)
- {
- if (j0 == 31)
- i1 = 0x40000000;
- else
- i0 = (i0 & (~i)) | (0x20000000 >> j0);
-
- SET_LDOUBLE_WORDS (x, se, i0, i1);
- w = two63[sx] + x;
- x = w - two63[sx];
- GET_LDOUBLE_WORDS (se, i0, i1, x);
-
- sx = (se >> 15) & 1;
- j0 = (se & 0x7fff) - 0x3fff;
- }
- }
-
-
- result = i0 >> (31 - j0);
+ w = two52[sx] + x;
+ t = w - two52[sx];
+ EXTRACT_WORDS (i0, i1, t);
+ i0 = i & 0xfffff;
+ i0 |= 0x100000;
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+ result = ((long long int) i0 << (j0 - 20)) | (j >> (52 - j0));
}
}
- else if ((unsigned int) j0 < sizeof (long long int) * 8 && j0 < 64)
+ else
{
- i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
- if ((i1 & i) != 0)
- {
- /* x is not integral. */
- i >>= 1;
- if ((i1 & i) != 0)
- i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 31));
- }
-
- SET_LDOUBLE_WORDS (x, se, i0, i1);
- w = two63[sx] + x;
- x = w - two63[sx];
- GET_LDOUBLE_WORDS (se, i0, i1, x);
-
- j0 = (se & 0x7fff) - 0x3fff;
-
- result = i0;
- if (j0 > 31)
- {
- result <<= j0 - 31;
- result |= i1 >> (63 - j0);
- }
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long long int) x;
}
- else
- /* Too large. The number is either +-inf or NaN or it is too
- large to be effected by rounding. The standard leaves it
- undefined what to return when the number is too large to fit in
- a `long int'. */
- result = (long long int) x;
- return result;
+ return sx ? -result : result;
}
-#endif
weak_alias (__llrint, llrint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llrint, __llrintl)
+weak_alias (__llrint, llrintl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_llrintf.c b/sysdeps/libm-ieee754/s_llrintf.c
new file mode 100644
index 0000000000..f73afd0fd2
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llrintf.c
@@ -0,0 +1,78 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+static const double two23[2] =
+{
+ 8.3886080000e+06, /* 0x4B000000 */
+ -8.3886080000e+06, /* 0xCB000000 */
+};
+
+
+long long int
+__llrintf (float x)
+{
+ int32_t j0;
+ u_int32_t i, i0;
+ volatile float w;
+ float t;
+ long long int result;
+ int sx;
+
+ GET_FLOAT_WORD (i, x);
+
+ sx = i0 >> 31;
+ j0 = ((i0 >> 23) & 0xff) - 0x7f;
+ i0 = i & 0x7fffff;
+ i0 |= 0x800000;
+
+ if (j0 < (int32_t) (sizeof (long long int) * 8))
+ {
+ if (j0 < -1)
+ return 0;
+ else if (j0 >= 23)
+ result = (long long int) i0 << (j0 - 23);
+ else
+ {
+ w = two23[sx] + x;
+ t = w - two23[sx];
+ GET_FLOAT_WORD (i, t);
+ i0 = i & 0x7fffff;
+ i0 |= 0x800000;
+ j0 = ((i0 >> 23) & 0xff) - 0x7f;
+
+ result = i0 >> (23 - j0);
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long long int) x;
+ }
+
+ return sx ? -result : result;
+}
+
+weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/libm-ieee754/s_llrintl.c b/sysdeps/libm-ieee754/s_llrintl.c
new file mode 100644
index 0000000000..29fc3a300d
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llrintl.c
@@ -0,0 +1,86 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+static const long double two63[2] =
+{
+ 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
+ -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
+};
+
+
+long long int
+__llrintl (long double x)
+{
+ int32_t se,j0;
+ u_int32_t i0, i1, i;
+ long long int result;
+ volatile long double w;
+ long double t;
+ int sx;
+
+ GET_LDOUBLE_WORDS (se, i0, i1, x);
+
+ sx = (se >> 15) & 1;
+ j0 = (se & 0x7fff) - 0x3fff;
+
+ if (j0 < 31)
+ {
+ if (j0 < -1)
+ return 0;
+ else
+ {
+ w = two63[sx] + x;
+ t = w - two63[sx];
+ GET_LDOUBLE_WORDS (se, i0, i1, t);
+ j0 = (se & 0x7fff) - 0x3fff;
+
+ result = i0 >> (31 - j0);
+ }
+ }
+ else if (j0 < (int32_t) (8 * sizeof (long long int)))
+ {
+ if (j0 >= 63)
+ result = ((long long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+ else
+ {
+ w = two63[sx] + x;
+ t = w - two63[sx];
+ GET_LDOUBLE_WORDS (se, i0, i1, t);
+ j0 = (se & 0x7fff) - 0x3fff;
+
+ result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long long int) x;
+ }
+
+ return sx ? -result : result;
+}
+
+weak_alias (__llrintl, llrintl)
diff --git a/sysdeps/libm-ieee754/s_llround.c b/sysdeps/libm-ieee754/s_llround.c
index aee0e31fc0..1deb630e96 100644
--- a/sysdeps/libm-ieee754/s_llround.c
+++ b/sysdeps/libm-ieee754/s_llround.c
@@ -1,4 +1,4 @@
-/* Round long double value to long long int.
+/* Round double value to long long int.
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,157 +23,56 @@
#include "math_private.h"
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type. */
-
long long int
-__llround (long double x)
+__llround (double x)
{
int32_t j0;
u_int32_t i1, i0;
long long int result;
+ int sign;
EXTRACT_WORDS (i0, i1, x);
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ sign = (i0 & 0x80000000) != 0 ? -1 : 1;
+ i0 &= 0xfffff;
+ i0 |= 0x100000;
+
if (j0 < 20)
{
if (j0 < 0)
- result = j0 < -1 ? 0 : ((i0 & 0x80000000) ? -1 : 1);
+ return j0 < -1 ? 0 : sign;
else
{
- u_int32_t i = 0xfffff >> j0;
- if (((i0 & i) | i1) == 0)
- result = (long long int) ((i0 & 0xfffff) | 0x100000) >> j0;
- else
- {
- /* X is not integral. */
- u_int32_t j = i0 + (0x80000 >> j0);
- if (j < i0)
- result = (long long int) 0x80000 >> (20 - j0);
- else
- result = (j | 0x100000) >> (20 - j0);
- }
+ i0 += 0x80000 >> j0;
+
+ result = i0 >> (20 - j0);
}
}
- else if (j0 >= 8 * sizeof (long long int) || j0 > 51)
- {
- /* The number is too large. It is left implementation defined
- what happens. */
- result = (long long int) x;
- }
- else
+ else if (j0 < (int32_t) (8 * sizeof (long long int)))
{
- u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
- if ((i1 & i) != 0)
+ if (j0 >= 52)
+ result = ((long long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
+ else
{
- /* x is not integral. */
u_int32_t j = i1 + (0x80000000 >> (j0 - 20));
if (j < i1)
- {
- j = i0 + 1;
- if ((j & 0xfffff) == 0)
- {
- if (sizeof (long long int) <= 4)
- /* Overflow. */
- result = (long long int) x;
- else
- result = 1ll << (j0 + 1);
- }
- else
- result = ((long long int) ((i0 & 0xfffff) | 0x100000)
- << (j0 - 31));
- }
- else
- {
- result = ((long long int) ((i0 & 0xfffff) | 0x100000)
- << (j0 - 31));
- if (sizeof (long long int) > 4 && j0 > 31)
- result |= j >> (63 - j0);
- }
- }
- else
- {
- result = (long long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
- if (sizeof (long long int) > 4 && j0 > 31)
- result |= i1 >> (63 - j0);
- }
- }
+ ++i0;
- return i0 & 0x80000000 ? -result : result;
-}
-#else
-long long int
-__llround (long double x)
-{
- int32_t j0;
- u_int32_t se, i1, i0;
- long long int result;
-
- GET_LDOUBLE_WORDS (se, i0, i1, x);
- j0 = (se & 0x7fff) - 0x3fff;
- if (j0 < 31)
- {
- if (j0 < 0)
- result = j0 < -1 ? 0 : 1;
- else
- {
- u_int32_t i = 0x7fffffff >> j0;
- if (((i0 & i) | i1) == 0)
- result = (long long int) i0 >> j0;
- else
- {
- /* X is not integral. */
- u_int32_t j = i0 + (0x40000000 >> j0);
- if (j < i0)
- result = 0x80000000l >> (30 - j0);
- else
- result = j >> (31 - j0);
- }
+ result = ((long long int) i0 << (j0 - 20)) | (j >> (52 - j0));
}
}
- else if ((unsigned int) j0 >= 8 * sizeof (long long int) || j0 > 62)
+ else
{
/* The number is too large. It is left implementation defined
what happens. */
- result = (long long int) x;
- }
- else
- {
- u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
- if ((i1 & i) != 0)
- {
- /* x is not integral. */
- u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
- if (j < i1)
- {
- j = i0 + 1;
- if (j == 0)
- {
- if (sizeof (long long int) <= 4)
- /* Overflow. */
- result = (long long int) x;
- else
- result = 1ll << (j0 + 1);
- }
- else
- result = (long long int) i0 << (j0 - 31);
- }
- else
- {
- result = (long long int) i0 << (j0 - 31);
- if (sizeof (long long int) > 4 && j0 > 31)
- result |= j >> (63 - j0);
- }
- }
- else
- {
- result = (long long int) i0 << (j0 - 31);
- if (sizeof (long long int) > 4 && j0 > 31)
- result |= i1 >> (63 - j0);
- }
+ return (long long int) x;
}
- return se & 0x8000 ? -result : result;
+ return sign * result;
}
-#endif
+
weak_alias (__llround, llround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llround, __llroundl)
+weak_alias (__llround, llroundl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_llroundf.c b/sysdeps/libm-ieee754/s_llroundf.c
new file mode 100644
index 0000000000..87ed1a3117
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llroundf.c
@@ -0,0 +1,63 @@
+/* Round float value to long long int.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+
+long long int
+__llroundf (float x)
+{
+ int32_t j0;
+ u_int32_t i;
+ long long int result;
+ int sign;
+
+ GET_FLOAT_WORD (i, x);
+ j0 = ((i >> 23) & 0xff) - 0x7f;
+ sign = (i & 0x80000000) != 0 ? -1 : 1;
+ i &= 0x7fffff;
+ i |= 0x800000;
+
+ if (j0 < (int32_t) (8 * sizeof (long long int)))
+ {
+ if (j0 < 0)
+ return j0 < -1 ? 0 : sign;
+ else if (j0 >= 23)
+ result = (long int) i << (j0 - 23);
+ else
+ {
+ i += 0x400000 >> j0;
+
+ result = i >> (23 - j0);
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long long int) x;
+ }
+
+ return sign * result;
+}
+
+weak_alias (__llroundf, llroundf)
diff --git a/sysdeps/libm-ieee754/s_llroundl.c b/sysdeps/libm-ieee754/s_llroundl.c
new file mode 100644
index 0000000000..959b1e3fe9
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_llroundl.c
@@ -0,0 +1,78 @@
+/* Round long double value to long long int.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+
+long long int
+__llroundl (long double x)
+{
+ int32_t j0;
+ u_int32_t se, i1, i0;
+ long long int result;
+ int sign;
+
+ GET_LDOUBLE_WORDS (se, i0, i1, x);
+ j0 = (se & 0x7fff) - 0x3fff;
+ sign = (se & 0x8000) != 0 ? -1 : 1;
+
+ if (j0 < 31)
+ {
+ if (j0 < 0)
+ return j0 < -1 ? 0 : sign;
+ else
+ {
+ u_int32_t j = i0 + (0x40000000 >> j0);
+ if (j < i0)
+ {
+ j >>= 1;
+ j |= 0x80000000;
+ ++j0;
+ }
+
+ result = j >> (31 - j0);
+ }
+ }
+ else if (j0 < (int32_t) (8 * sizeof (long long int)))
+ {
+ if (j0 >= 63)
+ result = ((long long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+ else
+ {
+ u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
+ if (j < i1)
+ ++i0;
+
+ result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long long int) x;
+ }
+
+ return sign * result;
+}
+
+weak_alias (__llroundl, llroundl)
diff --git a/sysdeps/libm-ieee754/s_lrint.c b/sysdeps/libm-ieee754/s_lrint.c
index 6779f974bd..0ccd06a061 100644
--- a/sysdeps/libm-ieee754/s_lrint.c
+++ b/sysdeps/libm-ieee754/s_lrint.c
@@ -23,9 +23,7 @@
#include "math_private.h"
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type. */
-static long double two52[2] =
+static const double two52[2] =
{
4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
@@ -33,210 +31,65 @@ static long double two52[2] =
long int
-__lrint (long double x)
+__lrint (double x)
{
- int32_t j0,sx;
+ int32_t j0;
u_int32_t i0,i1,i;
- long double t, w;
+ volatile double w;
+ double t;
long int result;
+ int sx;
EXTRACT_WORDS (i0, i1, x);
-
- sx = i0 >> 31;
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ sx = i0 >> 31;
+ i0 &= 0xfffff;
+ i0 |= 0x100000;
if (j0 < 20)
{
- if (j0 < 0)
- {
- if (((i0 & 0x7fffffff) | i1) == 0)
- /* The number is 0. */
- result = 0;
- else
- {
- i1 |= i0;
- i0 &= 0xfffe0000;
- i0 |= ((i1 | -i1) >> 12) & 0x80000;
- SET_HIGH_WORD (x, i0);
- w = two52[sx] + x;
- t = w - two52[sx];
- GET_HIGH_WORD (i0, t);
- if ((i0 & 0x7fffffff) >= 0x3fff0000)
- result = sx ? -1 : 1;
- else
- result = 0;
- }
- }
+ if (j0 < -1)
+ return 0;
else
{
- u_int32_t i = 0x000fffff >> j0;
- if (((i0 & i) | i1) == 0)
- {
- /* X is not integral. */
- i >>= 1;
- if (((i0 & i) | i1) != 0)
- {
- if (j0 == 19)
- i1 = 0x40000000;
- else
- i0 = (i0 & (~i)) | (0x20000 >> j0);
-
- INSERT_WORDS (x, i0, i1);
- w = two52[sx] + x;
- x = w - two52[sx];
- EXTRACT_WORDS (i0, i1, x);
-
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
- }
- }
-
- result = ((i0 >> (20 - j0)) & 0xfffff) | (0x00100000 >> (20 - j0));
- if (sx)
- result = -result;
+ w = two52[sx] + x;
+ t = w - two52[sx];
+ EXTRACT_WORDS (i0, i1, t);
+ i0 = i & 0xfffff;
+ i0 |= 0x100000;
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+ result = i0 >> (20 - j0);
}
}
- else if ((unsigned int) j0 < sizeof (long int) * 8 && j0 < 53)
+ else if (j0 < (int32_t) (8 * sizeof (long int)))
{
- i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
- if ((i1 & i) != 0)
- {
- /* x is not integral. */
- i >>= 1;
- if ((i1 & i) != 0)
- i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 20));
- }
-
- INSERT_WORDS (x, i0, i1);
- w = two52[sx] + x;
- x = w - two52[sx];
- EXTRACT_WORDS (i0, i1, x);
-
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-
- result = i0 | 0x00100000;
- if (j0 > 20)
- {
- result <<= j0 - 20;
- result |= i1 >> (52 - j0);
- }
- if (sx)
- result = -result;
- }
- else
- /* Too large. The number is either +-inf or NaN or it is too
- large to be effected by rounding. The standard leaves it
- undefined what to return when the number is too large to fit in
- a `long int'. */
- result = (long int) x;
-
- return result;
-}
-
-#else
-static long double two63[2] =
-{
- 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
- -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
-};
-
-
-long int
-__lrint (long double x)
-{
- int32_t se,j0,sx;
- u_int32_t i0,i1,i;
- long int result;
- long double w, t;
-
- GET_LDOUBLE_WORDS (se, i0, i1, x);
-
- sx = (se >> 15) & 1;
- j0 = (se & 0x7fff) - 0x3fff;
-
- if (j0 < 31)
- {
- if (j0 < 0)
- {
- if (((se & 0x7fff) | i0 | i1) == 0)
- /* The number is 0. */
- result = 0;
- else
- {
- i1 |= i0;
- i0 &= 0xe0000000;
- i0 |= (i1 | -i1) & 0x80000000;
- SET_LDOUBLE_MSW (x, i0);
- w = two63[sx] + x;
- t = w - two63[sx];
- GET_LDOUBLE_EXP (i0, t);
- if ((i0 & 0x7fff) >= 0x3fff)
- result = sx ? -1 : 1;
- else
- result = 0;
- }
- }
+ if (j0 >= 52)
+ result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
else
{
- u_int32_t i = 0x7fffffff >> j0;
- if (((i0 & i) | i1) == 0)
- {
- /* X is not integral. */
- i >>= 1;
- if (((i0 & i) | i1) != 0)
- {
- if (j0 == 31)
- i1 = 0x40000000;
- else
- i0 = (i0 & (~i)) | (0x20000000 >> j0);
-
- SET_LDOUBLE_WORDS (x, se, i0, i1);
- w = two63[sx] + x;
- x = w - two63[sx];
- GET_LDOUBLE_WORDS (se, i0, i1, x);
-
- sx = (se >> 15) & 1;
- j0 = (se & 0x7fff) - 0x3fff;
- }
- }
-
-
- result = i0 >> (31 - j0);
+ w = two52[sx] + x;
+ t = w - two52[sx];
+ EXTRACT_WORDS (i0, i1, t);
+ i0 = i & 0xfffff;
+ i0 |= 0x100000;
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+
+ result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
}
}
- else if ((unsigned int) j0 < sizeof (long int) * 8 && j0 < 64)
+ else
{
- i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
- if ((i1 & i) != 0)
- {
- /* x is not integral. */
- i >>= 1;
- if ((i1 & i) != 0)
- i1 = (i1 & (~i)) | (0x40000000 >> (j0 - 31));
- }
-
- SET_LDOUBLE_WORDS (x, se, i0, i1);
- w = two63[sx] + x;
- x = w - two63[sx];
- GET_LDOUBLE_WORDS (se, i0, i1, x);
-
- j0 = (se & 0x7fff) - 0x3fff;
-
- result = i0;
- if (j0 > 31)
- {
- result <<= j0 - 31;
- result |= i1 >> (63 - j0);
- }
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long int) x;
}
- else
- /* Too large. The number is either +-inf or NaN or it is too
- large to be effected by rounding. The standard leaves it
- undefined what to return when the number is too large to fit in
- a `long int'. */
- result = (long int) x;
- return result;
+ return sx ? -result : result;
}
-#endif
weak_alias (__lrint, lrint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lrint, __lrintl)
+weak_alias (__lrint, lrintl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_lrintf.c b/sysdeps/libm-ieee754/s_lrintf.c
new file mode 100644
index 0000000000..6d74b362f5
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lrintf.c
@@ -0,0 +1,78 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+static const double two23[2] =
+{
+ 8.3886080000e+06, /* 0x4B000000 */
+ -8.3886080000e+06, /* 0xCB000000 */
+};
+
+
+long int
+__lrintf (float x)
+{
+ int32_t j0;
+ u_int32_t i, i0;
+ volatile float w;
+ float t;
+ long int result;
+ int sx;
+
+ GET_FLOAT_WORD (i, x);
+
+ sx = i0 >> 31;
+ j0 = ((i0 >> 23) & 0xff) - 0x7f;
+ i0 = i & 0x7fffff;
+ i0 |= 0x800000;
+
+ if (j0 < (int32_t) (sizeof (long int) * 8))
+ {
+ if (j0 < -1)
+ return 0;
+ else if (j0 >= 23)
+ result = (long int) i0 << (j0 - 23);
+ else
+ {
+ w = two23[sx] + x;
+ t = w - two23[sx];
+ GET_FLOAT_WORD (i, t);
+ i0 = i & 0x7fffff;
+ i0 |= 0x800000;
+ j0 = ((i0 >> 23) & 0xff) - 0x7f;
+
+ result = i0 >> (23 - j0);
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long int) x;
+ }
+
+ return sx ? -result : result;
+}
+
+weak_alias (__lrintf, lrintf)
diff --git a/sysdeps/libm-ieee754/s_lrintl.c b/sysdeps/libm-ieee754/s_lrintl.c
new file mode 100644
index 0000000000..8607851669
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lrintl.c
@@ -0,0 +1,86 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+static const long double two63[2] =
+{
+ 9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
+ -9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
+};
+
+
+long int
+__lrintl (long double x)
+{
+ int32_t se,j0;
+ u_int32_t i0,i1,i;
+ long int result;
+ volatile long double w;
+ long double t;
+ int sx;
+
+ GET_LDOUBLE_WORDS (se, i0, i1, x);
+
+ sx = (se >> 15) & 1;
+ j0 = (se & 0x7fff) - 0x3fff;
+
+ if (j0 < 31)
+ {
+ if (j0 < -1)
+ return 0;
+ else
+ {
+ w = two63[sx] + x;
+ t = w - two63[sx];
+ GET_LDOUBLE_WORDS (se, i0, i1, t);
+ j0 = (se & 0x7fff) - 0x3fff;
+
+ result = i0 >> (31 - j0);
+ }
+ }
+ else if (j0 < (int32_t) (8 * sizeof (long int)))
+ {
+ if (j0 >= 63)
+ result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+ else
+ {
+ w = two63[sx] + x;
+ t = w - two63[sx];
+ GET_LDOUBLE_WORDS (se, i0, i1, t);
+ j0 = (se & 0x7fff) - 0x3fff;
+
+ result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long int) x;
+ }
+
+ return sx ? -result : result;
+}
+
+weak_alias (__lrintl, lrintl)
diff --git a/sysdeps/libm-ieee754/s_lround.c b/sysdeps/libm-ieee754/s_lround.c
index 974dbde050..a6468ba78a 100644
--- a/sysdeps/libm-ieee754/s_lround.c
+++ b/sysdeps/libm-ieee754/s_lround.c
@@ -1,4 +1,4 @@
-/* Round long double value to long int.
+/* Round double value to long int.
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,13 +23,8 @@
#include "math_private.h"
-#ifdef NO_LONG_DOUBLE
-/* The `long double' is in fact the IEEE `double' type. */
-
-/* This code does not presently work. */
-
long int
-__lround (long double x)
+__lround (double x)
{
int32_t j0;
u_int32_t i1, i0;
@@ -40,138 +35,44 @@ __lround (long double x)
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
sign = (i0 & 0x80000000) != 0 ? -1 : 1;
i0 &= 0xfffff;
+ i0 |= 0x100000;
+
if (j0 < 20)
{
if (j0 < 0)
- result = j0 < -1 ? 0 : sign;
+ return j0 < -1 ? 0 : sign;
else
{
- u_int32_t i = 0xfffff >> j0;
- i0 |= 0x100000;
- if (((i0 & i) | i1) == 0)
- result = i0 >> j0;
- else
- /* X is not integral. */
- result = (i0 + (0x80000 >> j0)) >> (20 - j0);
+ i0 += 0x80000 >> j0;
+
+ result = i0 >> (20 - j0);
}
}
- else if (j0 >= 8 * sizeof (long int) || j0 > 51)
- {
- /* The number is too large. It is left implementation defined
- what happens. */
- return (long int) x;
- }
- else
+ else if (j0 < (int32_t) (8 * sizeof (long int)))
{
- u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
- if ((i1 & i) != 0)
+ if (j0 >= 52)
+ result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52));
+ else
{
- /* x is not integral. */
u_int32_t j = i1 + (0x80000000 >> (j0 - 20));
if (j < i1)
- {
- j = i0 + 1;
- if ((j & 0xfffff) == 0)
- {
- if (sizeof (long int) <= 4)
- /* Overflow. */
- result = (long int) x;
- else
- result = 1l << (j0 + 1);
- }
- else
- result = (long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
- }
- else
- {
- result = (long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
- if (sizeof (long int) > 4 && j0 > 31)
- result |= j >> (63 - j0);
- }
- }
- else
- {
- result = (long int) ((i0 & 0xfffff) | 0x100000) << (j0 - 31);
- if (sizeof (long int) > 4 && j0 > 31)
- result |= i1 >> (63 - j0);
- }
- }
-
- return sign * result;
-}
-#else
-long int
-__lround (long double x)
-{
- int32_t j0;
- u_int32_t se, i1, i0;
- long int result;
+ ++i0;
- GET_LDOUBLE_WORDS (se, i0, i1, x);
- j0 = (se & 0x7fff) - 0x3fff;
- if (j0 < 31)
- {
- if (j0 < 0)
- result = j0 < -1 ? 0 : 1;
- else
- {
- u_int32_t i = 0x7fffffff >> j0;
- if (((i0 & i) | i1) == 0)
- result = (long int) i0 >> j0;
- else
- {
- /* X is not integral. */
- u_int32_t j = i0 + (0x40000000 >> j0);
- if (j < i0)
- result = 0x80000000l >> (30 - j0);
- else
- result = j >> (31 - j0);
- }
+ result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
}
}
- else if ((unsigned int) j0 >= 8 * sizeof (long int) || j0 > 62)
+ else
{
/* The number is too large. It is left implementation defined
what happens. */
- result = (long int) x;
- }
- else
- {
- u_int32_t i = ((u_int32_t) (0xffffffff)) >> (j0 - 31);
- if ((i1 & i) != 0)
- {
- /* x is not integral. */
- u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
- if (j < i1)
- {
- j = i0 + 1;
- if (j == 0)
- {
- if (sizeof (long int) <= 4)
- /* Overflow. */
- result = (long int) x;
- else
- result = 1l << (j0 + 1);
- }
- else
- result = (long int) i0 << (j0 - 31);
- }
- else
- {
- result = (long int) i0 << (j0 - 31);
- if (sizeof (long int) > 4 && j0 > 31)
- result |= j >> (63 - j0);
- }
- }
- else
- {
- result = (long int) i0 << (j0 - 31);
- if (sizeof (long int) > 4 && j0 > 31)
- result |= i1 >> (63 - j0);
- }
+ return (long int) x;
}
- return se & 0x8000 ? -result : result;
+ return sign * result;
}
-#endif
+
weak_alias (__lround, lround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lround, __lroundl)
+weak_alias (__lround, lroundl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_lroundf.c b/sysdeps/libm-ieee754/s_lroundf.c
new file mode 100644
index 0000000000..0d3889c24a
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lroundf.c
@@ -0,0 +1,63 @@
+/* Round float value to long int.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+
+long int
+__lroundf (float x)
+{
+ int32_t j0;
+ u_int32_t i;
+ long int result;
+ int sign;
+
+ GET_FLOAT_WORD (i, x);
+ j0 = ((i >> 23) & 0xff) - 0x7f;
+ sign = (i & 0x80000000) != 0 ? -1 : 1;
+ i &= 0x7fffff;
+ i |= 0x800000;
+
+ if (j0 < (int32_t) (8 * sizeof (long int)))
+ {
+ if (j0 < 0)
+ return j0 < -1 ? 0 : sign;
+ else if (j0 >= 23)
+ result = (long int) i << (j0 - 23);
+ else
+ {
+ i += 0x400000 >> j0;
+
+ result = i >> (23 - j0);
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long int) x;
+ }
+
+ return sign * result;
+}
+
+weak_alias (__lroundf, lroundf)
diff --git a/sysdeps/libm-ieee754/s_lroundl.c b/sysdeps/libm-ieee754/s_lroundl.c
new file mode 100644
index 0000000000..d8b7db4b5c
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_lroundl.c
@@ -0,0 +1,78 @@
+/* Round long double value to long int.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <math.h>
+
+#include "math_private.h"
+
+
+long int
+__lroundl (long double x)
+{
+ int32_t j0;
+ u_int32_t se, i1, i0;
+ long int result;
+ int sign;
+
+ GET_LDOUBLE_WORDS (se, i0, i1, x);
+ j0 = (se & 0x7fff) - 0x3fff;
+ sign = (se & 0x8000) != 0 ? -1 : 1;
+
+ if (j0 < 31)
+ {
+ if (j0 < 0)
+ return j0 < -1 ? 0 : sign;
+ else
+ {
+ u_int32_t j = i0 + (0x40000000 >> j0);
+ if (j < i0)
+ {
+ j >>= 1;
+ j |= 0x80000000;
+ ++j0;
+ }
+
+ result = j >> (31 - j0);
+ }
+ }
+ else if (j0 < (int32_t) (8 * sizeof (long int)))
+ {
+ if (j0 >= 63)
+ result = ((long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
+ else
+ {
+ u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
+ if (j < i1)
+ ++i0;
+
+ result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+ }
+ }
+ else
+ {
+ /* The number is too large. It is left implementation defined
+ what happens. */
+ return (long int) x;
+ }
+
+ return sign * result;
+}
+
+weak_alias (__lroundl, lroundl)
diff --git a/sysdeps/libm-ieee754/s_nextafterl.c b/sysdeps/libm-ieee754/s_nextafterl.c
index 1d3fc86c44..d7bdf026e7 100644
--- a/sysdeps/libm-ieee754/s_nextafterl.c
+++ b/sysdeps/libm-ieee754/s_nextafterl.c
@@ -97,3 +97,5 @@ static char rcsid[] = "$NetBSD: $";
return x;
}
weak_alias (__nextafterl, nextafterl)
+strong_alias (__nextafterl, __nextafterxl)
+weak_alias (__nextafterl, nextafterxl)
diff --git a/sysdeps/libm-ieee754/s_nextafterx.c b/sysdeps/libm-ieee754/s_nextafterx.c
new file mode 100644
index 0000000000..745ceaf34d
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterx.c
@@ -0,0 +1,98 @@
+/* s_nextafterx.c
+ * Conversion freom s_nextafter.c by Ulrich Drepper, Cygnus Support,
+ * drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ * nextafterx(x,y)
+ * return the next machine floating-point number of x in the
+ * direction toward y.
+ * Special cases:
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ double __nextafterx(double x, long double y)
+#else
+ double __nextafterx(x,y)
+ double x;
+ long double y;
+#endif
+{
+ int32_t hx,ix,iy;
+ u_int32_t lx,hy,ly,esy;
+
+ EXTRACT_WORDS(hx,lx,x);
+ GET_LDOUBLE_WORDS(esy,hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = esy&0x7fff; /* |y| */
+
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
+ ((iy>=0x7fff)&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */
+ return x+y;
+ if((long double) x==y) return x; /* x=y, return x */
+ if((ix|lx)==0) { /* x == 0 */
+ double x2;
+ INSERT_WORDS(x,esy&0x8000?0x80000000:0,1);/* return +-minsub */
+ x2 = x*x;
+ if(x2==x) return x2; else return x; /* raise underflow flag */
+ }
+ if(hx>=0) { /* x > 0 */
+ if (esy>=0x8000||((ix>>20)&0x7ff)>iy
+ || (((ix>>20)&0x7ff)==iy
+ && (((hx<<11)|(lx>>21))>(hy&0x7fffffff)
+ || (((hx<<11)|(lx>>21))==(hy&0x7fffffff)
+ && (lx<<11)>ly)))) { /* x > y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x < y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ } else { /* x < 0 */
+ if (esy<0x8000||((ix>>20)&0x7ff)>iy
+ || (((ix>>20)&0x7ff)==iy
+ && (((hx<<11)|(lx>>21))>(hy&0x7fffffff)
+ || (((hx<<11)|(lx>>21))==(hy&0x7fffffff)
+ && (lx<<11)>ly)))) {/* x < y, x -= ulp */
+ if(lx==0) hx -= 1;
+ lx -= 1;
+ } else { /* x > y, x += ulp */
+ lx += 1;
+ if(lx==0) hx += 1;
+ }
+ }
+ hy = hx&0x7ff00000;
+ if(hy>=0x7ff00000) return x+x; /* overflow */
+ if(hy<0x00100000) { /* underflow */
+ double x2 = x*x;
+ if(x2!=x) { /* raise underflow flag */
+ INSERT_WORDS(x2,hx,lx);
+ return x2;
+ }
+ }
+ INSERT_WORDS(x,hx,lx);
+ return x;
+}
+weak_alias (__nextafterx, nextafterx)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nextafterx, __nextafterxl)
+weak_alias (__nextafterx, nextafterxl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_nextafterxf.c b/sysdeps/libm-ieee754/s_nextafterxf.c
new file mode 100644
index 0000000000..7e870805e2
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterxf.c
@@ -0,0 +1,78 @@
+/* s_nextafterxf.c -- float version of s_nextafter.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ float __nextafterxf(float x, long double y)
+#else
+ float __nextafterxf(x,y)
+ float x;
+ log double y;
+#endif
+{
+ int32_t hx,ix,iy;
+ u_int32_t hy,ly,esy;
+
+ GET_FLOAT_WORD(hx,x);
+ GET_LDOUBLE_WORDS(esy,hy,ly,y);
+ ix = hx&0x7fffffff; /* |x| */
+ iy = esy&0x7fff; /* |y| */
+
+ if((ix>0x7f800000) || /* x is nan */
+ (iy>=0x7fff&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */
+ return x+y;
+ if((long double) x==y) return y; /* x=y, return y */
+ if(ix==0) { /* x == 0 */
+ float x2;
+ SET_FLOAT_WORD(x,(esy&0x8000?0x80000000:0)|1);/* return +-minsub*/
+ x2 = x*x;
+ if(x2==x) return x2; else return x; /* raise underflow flag */
+ }
+ if(hx>=0) { /* x > 0 */
+ if(esy>=0x8000||((ix>>23)&0xff)>iy
+ || (((ix>>23)&0xff)==iy
+ && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x > y, x -= ulp */
+ hx -= 1;
+ } else { /* x < y, x += ulp */
+ hx += 1;
+ }
+ } else { /* x < 0 */
+ if(esy<0x8000||((ix>>23)&0xff)>iy
+ || (((ix>>23)&0xff)==iy
+ && ((ix&0x7fffff)<<8)>(hy&0x7fffffff))) {/* x < y, x -= ulp */
+ hx -= 1;
+ } else { /* x > y, x += ulp */
+ hx += 1;
+ }
+ }
+ hy = hx&0x7f800000;
+ if(hy>=0x7f800000) return x+x; /* overflow */
+ if(hy<0x00800000) { /* underflow */
+ float x2 = x*x;
+ if(x2!=x) { /* raise underflow flag */
+ SET_FLOAT_WORD(x2,hx);
+ return x2;
+ }
+ }
+ SET_FLOAT_WORD(x,hx);
+ return x;
+}
+weak_alias (__nextafterxf, nextafterxf)
diff --git a/sysdeps/libm-ieee754/s_nextafterxl.c b/sysdeps/libm-ieee754/s_nextafterxl.c
new file mode 100644
index 0000000000..73c3610fc1
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nextafterxl.c
@@ -0,0 +1 @@
+/* This function is the same as nextafterl so we use an alias there. */
diff --git a/sysdeps/libm-ieee754/s_scalbln.c b/sysdeps/libm-ieee754/s_scalbln.c
new file mode 100644
index 0000000000..aa6134f093
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalbln.c
@@ -0,0 +1,70 @@
+/* @(#)s_scalbn.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $";
+#endif
+
+/*
+ * scalbn (double x, int n)
+ * scalbn(x,n) returns x* 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
+twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
+huge = 1.0e+300,
+tiny = 1.0e-300;
+
+#ifdef __STDC__
+ double __scalbln (double x, long int n)
+#else
+ double __scalbln (x,n)
+ double x; long int n;
+#endif
+{
+ int32_t k,hx,lx;
+ EXTRACT_WORDS(hx,lx,x);
+ k = (hx&0x7ff00000)>>20; /* extract exponent */
+ if (k==0) { /* 0 or subnormal x */
+ if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+ x *= two54;
+ GET_HIGH_WORD(hx,x);
+ k = ((hx&0x7ff00000)>>20) - 54;
+ }
+ if (k==0x7ff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (n> 50000 || k > 0x7fe)
+ return huge*__copysign(huge,x); /* overflow */
+ if (n< -50000) return tiny*__copysign(tiny,x); /*underflow*/
+ if (k > 0) /* normal result */
+ {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
+ if (k <= -54)
+ return tiny*__copysign(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
+ return x*twom54;
+}
+weak_alias (__scalbln, scalbln)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__scalbln, __scalblnl)
+weak_alias (__scalbln, scalblnl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_scalblnf.c b/sysdeps/libm-ieee754/s_scalblnf.c
new file mode 100644
index 0000000000..4ed48733cf
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalblnf.c
@@ -0,0 +1,63 @@
+/* s_scalbnf.c -- float version of s_scalbn.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $";
+#endif
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const float
+#else
+static float
+#endif
+two25 = 3.355443200e+07, /* 0x4c000000 */
+twom25 = 2.9802322388e-08, /* 0x33000000 */
+huge = 1.0e+30,
+tiny = 1.0e-30;
+
+#ifdef __STDC__
+ float __scalblnf (float x, long int n)
+#else
+ float __scalblnf (x,n)
+ float x; long int n;
+#endif
+{
+ int32_t k,ix;
+ GET_FLOAT_WORD(ix,x);
+ k = (ix&0x7f800000)>>23; /* extract exponent */
+ if (k==0) { /* 0 or subnormal x */
+ if ((ix&0x7fffffff)==0) return x; /* +-0 */
+ x *= two25;
+ GET_FLOAT_WORD(ix,x);
+ k = ((ix&0x7f800000)>>23) - 25;
+ }
+ if (k==0xff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (n> 50000 || k > 0xfe)
+ return huge*copysignf(huge,x); /* overflow */
+ if (n< -50000)
+ return tiny*copysignf(tiny,x); /*underflow*/
+ if (k > 0) /* normal result */
+ {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
+ if (k <= -25)
+ return tiny*copysignf(tiny,x); /*underflow*/
+ k += 25; /* subnormal result */
+ SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
+ return x*twom25;
+}
+weak_alias (__scalblnf, scalblnf)
diff --git a/sysdeps/libm-ieee754/s_scalblnl.c b/sysdeps/libm-ieee754/s_scalblnl.c
new file mode 100644
index 0000000000..aafb73e688
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_scalblnl.c
@@ -0,0 +1,71 @@
+/* s_scalbnl.c -- long double version of s_scalbn.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * scalbnl (long double x, int n)
+ * scalbnl(x,n) returns x* 2**n computed by exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+two63 = 4.50359962737049600000e+15,
+twom63 = 1.08420217248550443400e-19;
+huge = 1.0e+4900L,
+tiny = 1.0e-4900L;
+
+#ifdef __STDC__
+ long double __scalblnl (long double x, long int n)
+#else
+ long double __scalblnl (x,n)
+ long double x; long int n;
+#endif
+{
+ int32_t k,es,hx,lx;
+ GET_LDOUBLE_WORDS(es,hx,lx,x);
+ k = es&0x7fff; /* extract exponent */
+ if (k==0) { /* 0 or subnormal x */
+ if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
+ x *= two63;
+ GET_LDOUBLE_EXP(es,x);
+ k = (hx&0x7fff) - 63;
+ }
+ if (k==0x7fff) return x+x; /* NaN or Inf */
+ k = k+n;
+ if (n> 50000 || k > 0x7ffe)
+ return huge*__copysignl(huge,x); /* overflow */
+ if (n< -50000)
+ return tiny*__copysignl(tiny,x);
+ if (k > 0) /* normal result */
+ {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;}
+ if (k <= -63)
+ return tiny*__copysignl(tiny,x); /*underflow*/
+ k += 54; /* subnormal result */
+ SET_LDOUBLE_EXP(x,(es&0x8000)|k);
+ return x*twom63;
+}
+weak_alias (__scalblnl, scalblnl)
diff --git a/sysdeps/libm-ieee754/s_scalbn.c b/sysdeps/libm-ieee754/s_scalbn.c
index 0ce0ffdf2f..3dbfe8fef0 100644
--- a/sysdeps/libm-ieee754/s_scalbn.c
+++ b/sysdeps/libm-ieee754/s_scalbn.c
@@ -35,10 +35,10 @@ huge = 1.0e+300,
tiny = 1.0e-300;
#ifdef __STDC__
- double __scalbn (double x, long int n)
+ double __scalbn (double x, int n)
#else
double __scalbn (x,n)
- double x; long int n;
+ double x; int n;
#endif
{
int32_t k,hx,lx;
diff --git a/sysdeps/libm-ieee754/s_scalbnf.c b/sysdeps/libm-ieee754/s_scalbnf.c
index 4799c825c9..11b77bd6c2 100644
--- a/sysdeps/libm-ieee754/s_scalbnf.c
+++ b/sysdeps/libm-ieee754/s_scalbnf.c
@@ -31,10 +31,10 @@ huge = 1.0e+30,
tiny = 1.0e-30;
#ifdef __STDC__
- float __scalbnf (float x, long int n)
+ float __scalbnf (float x, int n)
#else
float __scalbnf (x,n)
- float x; long int n;
+ float x; int n;
#endif
{
int32_t k,ix;
diff --git a/sysdeps/libm-ieee754/s_scalbnl.c b/sysdeps/libm-ieee754/s_scalbnl.c
index 3e80d85136..4e1d08ef90 100644
--- a/sysdeps/libm-ieee754/s_scalbnl.c
+++ b/sysdeps/libm-ieee754/s_scalbnl.c
@@ -39,10 +39,10 @@ huge = 1.0e+4900L,
tiny = 1.0e-4900L;
#ifdef __STDC__
- long double __scalbnl (long double x, long int n)
+ long double __scalbnl (long double x, int n)
#else
long double __scalbnl (x,n)
- long double x; long int n;
+ long double x; int n;
#endif
{
int32_t k,es,hx,lx;
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index cc0fb56189..1d2045dd87 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -223,7 +223,16 @@ static inline void
elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
Elf32_Addr *reloc_addr, Elf32_Addr value)
{
- *reloc_addr = value + reloc->r_addend;
+ *reloc_addr = value;
+}
+
+/* Return the final value of a plt relocation. On the m68k the JMP_SLOT
+ relocation ignores the addend. */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+ Elf32_Addr value)
+{
+ return value;
}
#endif /* !dl_machine_h */
@@ -272,7 +281,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
break;
case R_68K_GLOB_DAT:
case R_68K_JMP_SLOT:
- *reloc_addr = value + reloc->r_addend;
+ *reloc_addr = value;
break;
case R_68K_8:
*(char *) reloc_addr = value + reloc->r_addend;
diff --git a/sysdeps/m68k/m68020/bits/string.h b/sysdeps/m68k/m68020/bits/string.h
new file mode 100644
index 0000000000..6462ef0d83
--- /dev/null
+++ b/sysdeps/m68k/m68020/bits/string.h
@@ -0,0 +1,26 @@
+/* Optimized, inlined string functions. m680x0 version, x >= 2.
+ 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. */
+
+#ifndef _STRING_H
+# error "Never use <bits/string.h> directly; include <string.h> instead."
+#endif
+
+/* Currently the only purpose of this file is to tell the generic inline
+ macros that unaligned memory access is possible. */
+#define _STRING_ARCH_unaligned 1
diff --git a/sysdeps/mach/hurd/bits/fcntl.h b/sysdeps/mach/hurd/bits/fcntl.h
index c3d187ae0e..102c2a574f 100644
--- a/sysdeps/mach/hurd/bits/fcntl.h
+++ b/sysdeps/mach/hurd/bits/fcntl.h
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */
#ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
/* File access modes. These are understood by io servers; they can be
@@ -29,10 +29,10 @@
/* In GNU, read and write are bits (unlike BSD). */
#ifdef __USE_GNU
-#define O_READ O_RDONLY /* Open for reading. */
-#define O_WRITE O_WRONLY /* Open for writing. */
-#define O_EXEC 0x0004 /* Open for execution. */
-#define O_NORW 0 /* Open without R/W access. */
+# define O_READ O_RDONLY /* Open for reading. */
+# define O_WRITE O_WRONLY /* Open for writing. */
+# define O_EXEC 0x0004 /* Open for execution. */
+# define O_NORW 0 /* Open without R/W access. */
#endif
/* POSIX.1 standard names. */
#define O_RDONLY 0x0001 /* Open read-only. */
@@ -49,8 +49,8 @@
#define O_CREAT 0x0010 /* Create file if it doesn't exist. */
#define O_EXCL 0x0020 /* Fail if file already exists. */
#ifdef __USE_GNU
-#define O_NOLINK 0x0040 /* No name mappings on final component. */
-#define O_NOTRANS 0x0080 /* No translator on final component. */
+# define O_NOLINK 0x0040 /* No name mappings on final component. */
+# define O_NOTRANS 0x0080 /* No translator on final component. */
#endif
@@ -62,16 +62,16 @@
#define O_APPEND 0x0100 /* Writes always append to the file. */
#ifdef __USE_BSD
-#define O_ASYNC 0x0200 /* Send SIGIO to owner when data is ready. */
-#define O_FSYNC 0x0400 /* Synchronous writes. */
-#define O_SYNC O_FSYNC
+# define O_ASYNC 0x0200 /* Send SIGIO to owner when data is ready. */
+# define O_FSYNC 0x0400 /* Synchronous writes. */
+# define O_SYNC O_FSYNC
#endif
#ifdef __USE_GNU
-#define O_NOATIME 0x0800 /* Don't set access time on read (owner). */
+# define O_NOATIME 0x0800 /* Don't set access time on read (owner). */
#endif
#ifdef __USE_MISC
-#define O_SHLOCK 0x00020000 /* Open with shared file lock. */
-#define O_EXLOCK 0x00040000 /* Open with exclusive file lock. */
+# define O_SHLOCK 0x00020000 /* Open with shared file lock. */
+# define O_EXLOCK 0x00040000 /* Open with exclusive file lock. */
#endif
@@ -92,13 +92,13 @@
#define O_NONBLOCK 0x0008 /* Non-blocking open or non-blocking I/O. */
#ifdef __USE_BSD
-#define O_NDELAY O_NONBLOCK /* Deprecated. */
+# define O_NDELAY O_NONBLOCK /* Deprecated. */
#endif
#ifdef __USE_GNU
/* Mask of bits which are understood by io servers. */
-#define O_HURD (0xffff | O_EXLOCK | O_SHLOCK)
+# define O_HURD (0xffff | O_EXLOCK | O_SHLOCK)
#endif
@@ -113,7 +113,7 @@
and are not preserved once the file has been opened. */
#ifdef __USE_GNU
-#define O_IGNORE_CTTY 0x00080000 /* Don't do any ctty magic at all. */
+# define O_IGNORE_CTTY 0x00080000 /* Don't do any ctty magic at all. */
#endif
/* `open' never assigns a controlling terminal in GNU. */
#define O_NOCTTY 0 /* Don't assign a controlling terminal. */
@@ -121,20 +121,20 @@
#ifdef __USE_BSD
/* Bits in the file status flags returned by F_GETFL. */
-#define FREAD O_RDONLY
-#define FWRITE O_WRONLY
+# define FREAD O_RDONLY
+# define FWRITE O_WRONLY
/* Traditional BSD names the O_* bits. */
-#define FASYNC O_ASYNC
-#define FCREAT O_CREAT
-#define FEXCL O_EXCL
-#define FTRUNC O_TRUNC
-#define FNOCTTY O_NOCTTY
-#define FFSYNC O_FSYNC
-#define FSYNC O_SYNC
-#define FAPPEND O_APPEND
-#define FNONBLOCK O_NONBLOCK
-#define FNDELAY O_NDELAY
+# define FASYNC O_ASYNC
+# define FCREAT O_CREAT
+# define FEXCL O_EXCL
+# define FTRUNC O_TRUNC
+# define FNOCTTY O_NOCTTY
+# define FFSYNC O_FSYNC
+# define FSYNC O_SYNC
+# define FAPPEND O_APPEND
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
#endif
@@ -145,8 +145,8 @@
#define F_GETFL 3 /* Get file status flags. */
#define F_SETFL 4 /* Set file status flags. */
#ifdef __USE_BSD
-#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
-#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
+# define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
+# define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
#endif
#define F_GETLK 7 /* Get record locking info. */
#define F_SETLK 8 /* Set record locking info (non-blocking). */
@@ -164,10 +164,26 @@ struct flock
{
int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
__off_t l_start; /* Offset where the lock begins. */
__off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
};
+#endif
/* Values for the `l_type' field of a `struct flock'. */
#define F_RDLCK 1 /* Read lock. */
diff --git a/sysdeps/mach/hurd/bits/stat.h b/sysdeps/mach/hurd/bits/stat.h
index 2110a73aae..4679c589ee 100644
--- a/sysdeps/mach/hurd/bits/stat.h
+++ b/sysdeps/mach/hurd/bits/stat.h
@@ -39,7 +39,11 @@ struct stat
__fsid_t st_fsid; /* File system ID. */
#define st_dev st_fsid
+#ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File number. */
+#else
+ __ino64_t st_ino; /* File number. */
+#endif
unsigned int st_gen; /* To detect reuse of file numbers. */
__dev_t st_rdev; /* Device if special file. */
__mode_t st_mode; /* File mode. */
@@ -48,7 +52,11 @@ struct stat
__uid_t st_uid; /* Owner. */
__gid_t st_gid; /* Owning group. */
+#ifndef __USE_FILE_OFFSET64
__off_t st_size; /* Size in bytes. */
+#else
+ __off64_t st_size; /* Size in bytes. */
+#endif
__time_t st_atime; /* Access time, seconds */
unsigned long int st_atime_usec; /* and microseconds. */
@@ -59,9 +67,56 @@ struct stat
unsigned int st_blksize; /* Optimal size for I/O. */
-#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated.
+ Not related to `st_blksize'. */
+#else
+ __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
+ Not related to `st_blksize'. */
+#endif
+
+ __uid_t st_author; /* File author. */
+
+ unsigned int st_flags; /* User-defined flags.
+ High 16 bits can be set only by root. */
- unsigned int st_blocks; /* Number of 512-byte blocks allocated.
+#ifndef __USE_FILE_OFFSET64
+# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
+#else
+# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
+#endif
+ int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
+#undef _SPARE_SIZE
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ int st_fstype; /* File system type. */
+ __fsid_t st_fsid; /* File system ID. */
+# define st_dev st_fsid
+
+ __ino64_t st_ino; /* File number. */
+ unsigned int st_gen; /* To detect reuse of file numbers. */
+ __dev_t st_rdev; /* Device if special file. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Number of links. */
+
+ __uid_t st_uid; /* Owner. */
+ __gid_t st_gid; /* Owning group. */
+
+ __off64_t st_size; /* Size in bytes. */
+
+ __time_t st_atime; /* Access time, seconds */
+ unsigned long int st_atime_usec; /* and microseconds. */
+ __time_t st_mtime; /* Modification time, seconds */
+ unsigned long int st_mtime_usec; /* and microseconds. */
+ __time_t st_ctime; /* Status change time, seconds */
+ unsigned long int st_ctime_usec; /* and microseconds. */
+
+ unsigned int st_blksize; /* Optimal size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
Not related to `st_blksize'. */
__uid_t st_author; /* File author. */
@@ -69,10 +124,13 @@ struct stat
unsigned int st_flags; /* User-defined flags.
High 16 bits can be set only by root. */
-#define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
+#define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
#undef _SPARE_SIZE
};
+#endif
+
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
/* Encoding of the file mode. */
diff --git a/sysdeps/mach/hurd/sys/param.h b/sysdeps/mach/hurd/sys/param.h
index 55d47f74de..bd9ca412ba 100644
--- a/sysdeps/mach/hurd/sys/param.h
+++ b/sysdeps/mach/hurd/sys/param.h
@@ -71,7 +71,7 @@
#include <endian.h>
#include <limits.h>
#ifdef notyet
-#include <ufs/param.h>
+# include <ufs/param.h>
#endif
@@ -113,7 +113,7 @@
/* Macros for counting and rounding. */
#ifndef howmany
-#define howmany(x, y) (((x)+((y)-1))/(y))
+# define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
#define powerof2(x) ((((x)-1)&(x))==0)
diff --git a/sysdeps/posix/open64.c b/sysdeps/posix/open64.c
new file mode 100644
index 0000000000..e409891980
--- /dev/null
+++ b/sysdeps/posix/open64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <stdarg.h>
+
+/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+ a third argument is the file protection. */
+int
+__open64 (file, oflag)
+ const char *file;
+ int oflag;
+{
+ int mode;
+
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, int);
+ va_end (arg);
+ }
+ else
+ mode = 0;
+
+ return __open (file, oflag | O_LARGEFILE, mode);
+}
+weak_alias (__open64, open64)
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 3b82d3d366..291817c9ef 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -83,7 +83,7 @@ static const char letters[] =
char *
__stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
const char *pfx, int dir_search, size_t *lenptr,
- FILE **streamptr)
+ FILE **streamptr, int large_file)
{
int saverrno = errno;
static const char tmpdir[] = P_tmpdir;
@@ -186,7 +186,13 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
if (streamptr != NULL)
{
/* Try to create the file atomically. */
+#ifdef _G_OPEN64
+ int fd = (large_file
+ ? __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666)
+ : _G_OPEN64 (buf, O_RDWR|O_CREAT|O_EXCL, 0666));
+#else
int fd = __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666);
+#endif
if (fd >= 0)
{
/* We got a new file that did not previously exist.
diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h
index beabc1d4ff..6ab79e79ac 100644
--- a/sysdeps/powerpc/dl-machine.h
+++ b/sysdeps/powerpc/dl-machine.h
@@ -613,6 +613,14 @@ elf_machine_fixup_plt(struct link_map *map, const Elf32_Rela *reloc,
MODIFIED_CODE (reloc_addr);
}
+/* Return the final value of a plt relocation. */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+ Elf32_Addr value)
+{
+ return value + reloc->r_addend;
+}
+
#endif /* dl_machine_h */
#ifdef RESOLVE
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 288a140245..224c6bafff 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -240,6 +240,8 @@ static inline void
elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
Elf32_Addr *reloc_addr, Elf32_Addr value)
{
+ extern unsigned long _dl_hwcap;
+
/* For thread safety, write the instructions from the bottom and
flush before we overwrite the critical "b,a". This of course
need not be done during bootstrapping, since there are no threads.
@@ -258,6 +260,14 @@ elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
#endif
}
+/* Return the final value of a plt relocation. */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+ Elf32_Addr value)
+{
+ return value + reloc->r_addend;
+}
+
#ifdef RESOLVE
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
@@ -268,8 +278,6 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
const Elf32_Sym *sym, const struct r_found_version *version,
Elf32_Addr *const reloc_addr)
{
- extern unsigned long _dl_hwcap;
-
if (ELF32_R_TYPE (reloc->r_info) == R_SPARC_RELATIVE)
{
#ifndef RTLD_BOOTSTRAP
diff --git a/sysdeps/sparc/sparc32/setjmp.S b/sysdeps/sparc/sparc32/setjmp.S
index 58d94119ef..44dcadb66e 100644
--- a/sysdeps/sparc/sparc32/setjmp.S
+++ b/sysdeps/sparc/sparc32/setjmp.S
@@ -22,10 +22,10 @@
#define _ASM 1
#include <bits/setjmp.h>
-ENTRY(_setjmp)
+ENTRY(__setjmp)
b 1f
set 0, %o1
-END(_setjmp)
+END(__setjmp)
ENTRY(setjmp)
set 1, %o1
@@ -46,5 +46,5 @@ ENTRY (__sigsetjmp)
mov %g1, %o7
END(__sigsetjmp)
-weak_extern(_setjmp)
+weak_alias(__setjmp, _setjmp)
weak_extern(setjmp)
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index 226623152d..354fea6ce5 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -85,6 +85,14 @@ elf_machine_fixup_plt(struct link_map *map, const Elf64_Rela *reloc,
}
}
+/* Return the final value of a plt relocation. */
+static inline Elf64_Addr
+elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
+ Elf64_Addr value)
+{
+ return value + reloc->r_addend;
+}
+
#ifdef RESOLVE
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
diff --git a/sysdeps/sparc/sparc64/sub_n.S b/sysdeps/sparc/sparc64/sub_n.S
index 93f8a8235d..403d50c704 100644
--- a/sysdeps/sparc/sparc64/sub_n.S
+++ b/sysdeps/sparc/sparc64/sub_n.S
@@ -1,7 +1,7 @@
/* SPARC v9 __mpn_sub_n -- Subtract two limb vectors of the same length > 0
and store difference in a third limb vector.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -43,7 +43,7 @@ ENTRY(__mpn_sub_n)
ldx [%o1+%o5],%g2 ! load s1 limb
addcc %g1,%o4,%g1 ! add s2 limb and carry variable
movcc %xcc,0,%o4 ! if carry-out, o4 was 1; clear it
- subcc %g1,%g2,%g1 ! subtract s1 limb from sum
+ subcc %g2,%g1,%g1 ! subtract s1 limb from sum
stx %g1,[%o0+%o5] ! store result
add %o5,8,%o5 ! increment address index
brnz,pt %g3,1b
diff --git a/sysdeps/stub/fstatfs.c b/sysdeps/stub/fstatfs.c
index 71502c5e9f..e7c40d8006 100644
--- a/sysdeps/stub/fstatfs.c
+++ b/sysdeps/stub/fstatfs.c
@@ -1,4 +1,4 @@
-/* fstatfs -- Return information about the filesystem on which FD resides.
+/* Return information about the filesystem on which FD resides.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -28,6 +28,6 @@ __fstatfs (int fd, struct statfs *buf)
__set_errno (ENOSYS);
return -1;
}
-stub_warning (statfs)
+stub_warning (fstatfs)
weak_alias (__fstatfs, fstatfs)
diff --git a/sysdeps/stub/setenv.c b/sysdeps/stub/fstatfs64.c
index 15ba9bd524..b2dba0f38b 100644
--- a/sysdeps/stub/setenv.c
+++ b/sysdeps/stub/fstatfs64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
+/* Return information about the filesystem on which FD resides.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,36 +17,15 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <stdlib.h>
#include <errno.h>
+#include <sys/statfs.h>
+#include <stddef.h>
+/* Return information about the filesystem on which FD resides. */
int
-setenv (name, value, replace)
- const char *name;
- const char *value;
- int replace;
+fstatfs64 (int fd, struct statfs64 *buf)
{
__set_errno (ENOSYS);
return -1;
}
-
-stub_warning (setenv)
-
-void
-unsetenv (name)
- const char *name;
-{
- __set_errno (ENOSYS);
-}
-
-stub_warning (unsetenv)
-
-
-int
-clearenv (void)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-stub_warning (clearenv)
+stub_warning (fstatfs64)
diff --git a/sysdeps/stub/fxstat.c b/sysdeps/stub/fxstat.c
index 21c9098d17..0110c5fda0 100644
--- a/sysdeps/stub/fxstat.c
+++ b/sysdeps/stub/fxstat.c
@@ -44,6 +44,6 @@ __fxstat (int vers, int fd, struct stat *buf)
__set_errno (ENOSYS);
return -1;
}
-stub_warning (__fxstat)
+stub_warning (fstat)
weak_alias (__fxstat, _fxstat)
diff --git a/sysdeps/stub/morecore.c b/sysdeps/stub/fxstat64.c
index c2b1cb1985..93ec312d3e 100644
--- a/sysdeps/stub/morecore.c
+++ b/sysdeps/stub/fxstat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,22 +16,32 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <stddef.h>
#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-
-/* Allocate INCREMENT more bytes of data space,
- and return the start of data space, or NULL on errors.
- If INCREMENT is negative, shrink data space. */
-__ptr_t
-__default_morecore (increment)
- ptrdiff_t increment;
+/* Get information about the file descriptor FD in BUF. */
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
{
+ if (vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ else if (buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
__set_errno (ENOSYS);
- return NULL;
+ return -1;
}
-
-
-stub_warning (__default_morecore)
+stub_warning (fstat64)
diff --git a/sysdeps/stub/putenv.c b/sysdeps/stub/getrlimit64.c
index 68a4a4552f..6f12cad84b 100644
--- a/sysdeps/stub/putenv.c
+++ b/sysdeps/stub/getrlimit64.c
@@ -16,18 +16,16 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <sys/resource.h>
#include <errno.h>
-#include <stdlib.h>
-/* Put STRING, which is of the form "NAME=VALUE", in the environment.
- If there is no `=', remove NAME from the environment. */
+/* Put the soft and hard limits for RESOURCE in *RLIMITS.
+ Returns 0 if successful, -1 if not (and sets errno). */
int
-putenv (string)
- const char *string;
+getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
{
__set_errno (ENOSYS);
return -1;
}
-
-stub_warning (putenv)
+stub_warning (getrlimit64)
diff --git a/sysdeps/stub/lseek64.c b/sysdeps/stub/lseek64.c
new file mode 100644
index 0000000000..71d58ba1a6
--- /dev/null
+++ b/sysdeps/stub/lseek64.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the 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 <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Seek to OFFSET on FD, starting from WHENCE. */
+off64_t
+lseek64 (fd, offset, whence)
+ int fd;
+ off64_t offset;
+ int whence;
+{
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ switch (whence)
+ {
+ case SEEK_SET:
+ case SEEK_CUR:
+ case SEEK_END:
+ break;
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (lseek64)
diff --git a/sysdeps/stub/lxstat.c b/sysdeps/stub/lxstat64.c
index 3a7d64bedb..78e0b82bde 100644
--- a/sysdeps/stub/lxstat.c
+++ b/sysdeps/stub/lxstat64.c
@@ -23,7 +23,7 @@
/* Get file information about FILE in BUF.
If FILE is a symbolic link, do not follow it. */
int
-__lxstat (int vers, const char *file, struct stat *buf)
+__lxstat64 (int vers, const char *file, struct stat64 *buf)
{
if (vers != _STAT_VER || file == NULL || buf == NULL)
{
@@ -34,6 +34,4 @@ __lxstat (int vers, const char *file, struct stat *buf)
__set_errno (ENOSYS);
return -1;
}
-stub_warning (__lxstat)
-
-weak_alias (__lxstat, _lxstat)
+stub_warning (lstat64)
diff --git a/sysdeps/stub/open64.c b/sysdeps/stub/open64.c
new file mode 100644
index 0000000000..c020d887bd
--- /dev/null
+++ b/sysdeps/stub/open64.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the 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 <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+ a third argument is the file protection. */
+int
+__open64 (file, oflag)
+ const char *file;
+ int oflag;
+{
+ int mode;
+
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, int);
+ va_end (arg);
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__open64, open64)
+
+stub_warning (open64)
diff --git a/sysdeps/stub/pread64.c b/sysdeps/stub/pread64.c
new file mode 100644
index 0000000000..4223646576
--- /dev/null
+++ b/sysdeps/stub/pread64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <errno.h>
+#include <unistd.h>
+
+/* Read NBYTES into BUF from FD at the given position OFFSET without
+ changing the file pointer. Return the number read or -1. */
+ssize_t
+pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || offset < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (pread64)
diff --git a/sysdeps/stub/pwrite64.c b/sysdeps/stub/pwrite64.c
new file mode 100644
index 0000000000..c8c77a1880
--- /dev/null
+++ b/sysdeps/stub/pwrite64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <errno.h>
+#include <unistd.h>
+
+/* Write NBYTES of BUF to FD at given position OFFSET without changing
+ the file position. Return the number written, or -1. */
+ssize_t
+pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset)
+{
+ if (nbytes == 0)
+ return 0;
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == NULL || offset < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (pwrite64)
diff --git a/sysdeps/stub/getenv.c b/sysdeps/stub/readdir64.c
index ec378f63cc..fbf4bf4d54 100644
--- a/sysdeps/stub/getenv.c
+++ b/sysdeps/stub/readdir64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,16 +17,14 @@
Boston, MA 02111-1307, USA. */
#include <errno.h>
-#include <stdlib.h>
+#include <stddef.h>
+#include <dirent.h>
-/* Return the value of the environment variable NAME. */
-char *
-getenv (name)
- const char *name;
+/* Read a directory entry from DIRP. */
+struct dirent64 *
+readdir64 (DIR *dirp)
{
__set_errno (ENOSYS);
return NULL;
}
-
-
-stub_warning (getenv)
+stub_warning (readdir64)
diff --git a/sysdeps/stub/sbrk.c b/sysdeps/stub/readdir64_r.c
index a85b1bdb3e..cb143cb40c 100644
--- a/sysdeps/stub/sbrk.c
+++ b/sysdeps/stub/readdir64_r.c
@@ -17,17 +17,16 @@
Boston, MA 02111-1307, USA. */
#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
-/* Extend the process's data space by INCREMENT.
- If INCREMENT is negative, shrink data space by - INCREMENT.
- Return the address of the start of data space, or -1 for errors. */
-void *
-__sbrk (increment)
- int increment;
+/* Read a directory entry from DIRP, store result in ENTRY and return
+ pointer to result in *RESULT. */
+int
+readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
{
__set_errno (ENOSYS);
- return (void *) -1;
+ *result = NULL;
+ return -1;
}
-stub_warning (sbrk)
-
-weak_alias (__sbrk, sbrk)
+stub_warning (readdir64_r)
diff --git a/sysdeps/stub/setrlimit64.c b/sysdeps/stub/setrlimit64.c
new file mode 100644
index 0000000000..0f223f246c
--- /dev/null
+++ b/sysdeps/stub/setrlimit64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sys/resource.h>
+#include <errno.h>
+
+/* Set the soft and hard limits for RESOURCE to *RLIMITS.
+ Only the super-user can increase hard limits.
+ Return 0 if successful, -1 if not (and sets errno). */
+int
+setrlimit64 (resource, rlimits)
+ enum __rlimit_resource resource;
+ struct rlimit64 *rlimits;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (setrlimit64)
diff --git a/sysdeps/stub/statfs64.c b/sysdeps/stub/statfs64.c
new file mode 100644
index 0000000000..51cde7dd27
--- /dev/null
+++ b/sysdeps/stub/statfs64.c
@@ -0,0 +1,31 @@
+/* Return information about the filesystem on which FILE resides.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <errno.h>
+#include <sys/statfs.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FILE resides. */
+int
+statfs64 (const char *file, struct statfs64 *buf)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (statfs64)
diff --git a/sysdeps/stub/sysd-stdio.c b/sysdeps/stub/sysd-stdio.c
deleted file mode 100644
index 2c2dc3c1f2..0000000000
--- a/sysdeps/stub/sysd-stdio.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU 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 <errno.h>
-#include <stdio.h>
-
-
-/* Read up to N chars into BUF from COOKIE.
- Return how many chars were read, 0 for EOF or -1 for error. */
-int
-__stdio_read (cookie, buf, n)
- void *cookie;
- register char *buf;
- register size_t n;
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-/* Write up to N chars from BUF to COOKIE.
- Return how many chars were written or -1 for error. */
-int
-__stdio_write (cookie, buf, n)
- void *cookie;
- register const char *buf;
- register size_t n;
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-/* Move COOKIE's file position *POS bytes, according to WHENCE.
- The new file position is stored in *POS.
- Returns zero if successful, nonzero if not. */
-int
-__stdio_seek (cookie, pos, whence)
- void *cookie;
- fpos_t *pos;
- int whence;
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-/* Close the file associated with COOKIE.
- Return 0 for success or -1 for failure. */
-int
-__stdio_close (cookie)
- void *cookie;
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-/* Return the POSIX.1 file descriptor associated with COOKIE,
- or -1 for errors. If COOKIE does not relate to any POSIX.1 file
- descriptor, this should return -1 with errno set to EOPNOTSUPP. */
-int
-__stdio_fileno (cookie)
- void *cookie;
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-
-/* Open FILENAME with the mode in M.
- Store the magic cookie associated with the opened file in *COOKIEPTR.
- Return zero on success and nonzero on failure. */
-int
-__stdio_open (filename, m, cookieptr)
- const char *filename;
- __io_mode m;
- void **cookieptr;
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-
-/* Open FILENAME with the mode in M. Use the same magic cookie
- already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN. */
-int
-__stdio_reopen (filename, m, cookieptr)
- const char *filename;
- __io_mode m;
- void **cookieptr;
- __io_close_fn closefn;
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
-
-stub_warning (__stdio_read)
-stub_warning (__stdio_write)
-stub_warning (__stdio_seek)
-stub_warning (__stdio_close)
-stub_warning (__stdio_fileno)
-stub_warning (__stdio_open)
-stub_warning (__stdio_reopen)
diff --git a/sysdeps/stub/sysdep.h b/sysdeps/stub/sysdep.h
deleted file mode 100644
index 8c3184bf03..0000000000
--- a/sysdeps/stub/sysdep.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* This file should contain any system-dependent types and macros
- that will be used by many parts of the library. It should also
- contain declarations for any functions defined in sysdep.c. */
diff --git a/sysdeps/stub/tempname.c b/sysdeps/stub/tempname.c
index b93b948ca6..d87c54f86a 100644
--- a/sysdeps/stub/tempname.c
+++ b/sysdeps/stub/tempname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +26,8 @@
Return the generated filename or NULL if one could not
be generated, putting the length of the string in *LENPTR. */
char *
-__stdio_gen_tempname (buf, bufsize, dir, pfx, dir_search, lenptr, streamptr)
+__stdio_gen_tempname (buf, bufsize, dir, pfx, dir_search, lenptr, streamptr,
+ large_file)
char *buf;
size_t bufsize;
const char *dir;
@@ -34,11 +35,11 @@ __stdio_gen_tempname (buf, bufsize, dir, pfx, dir_search, lenptr, streamptr)
int dir_search;
size_t *lenptr;
FILE **streamptr;
+ int large_file;
{
*lenptr = 0;
__set_errno (ENOSYS);
return NULL;
}
-
stub_warning (__stdio_gen_tempname)
diff --git a/sysdeps/stub/xstat64.c b/sysdeps/stub/xstat64.c
new file mode 100644
index 0000000000..8eb1d177df
--- /dev/null
+++ b/sysdeps/stub/xstat64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <errno.h>
+#include <sys/stat.h>
+#include <stddef.h>
+
+/* Get file information about FILE in BUF. */
+int
+__xstat64 (int vers, const char *file, struct stat64 *buf)
+{
+ if (vers != _STAT_VER || file == NULL || buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (stat64)
diff --git a/sysdeps/unix/bsd/bits/fcntl.h b/sysdeps/unix/bsd/bits/fcntl.h
index 3d9bcb5c60..8565170fa5 100644
--- a/sysdeps/unix/bsd/bits/fcntl.h
+++ b/sysdeps/unix/bsd/bits/fcntl.h
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */
#ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
@@ -35,10 +35,10 @@
/* Apparently not assigning a controlling terminal is the default
behavior in BSD, so no bit is required to request that behavior. */
#define O_NOCTTY 0 /* Don't assign a controlling terminal. */
-#if defined (__USE_BSD) || defined (__USE_SVID)
-#define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */
-#define O_FSYNC 0x2000 /* Synchronous writes. */
-#define O_SYNC O_FSYNC
+#if defined __USE_BSD || defined __USE_SVID
+# define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */
+# define O_FSYNC 0x2000 /* Synchronous writes. */
+# define O_SYNC O_FSYNC
#endif
/* File status flags for `open' and `fcntl'. */
@@ -48,7 +48,7 @@
#ifdef __USE_BSD
/* BSD before 4.4 doesn't support POSIX.1 O_NONBLOCK,
but O_NDELAY is close. */
-#define O_NDELAY O_NONBLOCK
+# define O_NDELAY O_NONBLOCK
#endif
#ifdef __USE_BSD
@@ -56,26 +56,29 @@
These are all the O_* flags, plus FREAD and FWRITE, which are
independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
given to `open'. */
-#define FREAD 1
-#define FWRITE 2
+# define FREAD 1
+# define FWRITE 2
/* Traditional BSD names the O_* bits. */
-#define FASYNC O_ASYNC
-#define FCREAT O_CREAT
-#define FEXCL O_EXCL
-#define FTRUNC O_TRUNC
-#define FNOCTTY O_NOCTTY
-#define FFSYNC O_FSYNC
-#define FSYNC O_SYNC
-#define FAPPEND O_APPEND
-#define FNONBLOCK O_NONBLOCK
-#define FNDELAY O_NDELAY
+# define FASYNC O_ASYNC
+# define FCREAT O_CREAT
+# define FEXCL O_EXCL
+# define FTRUNC O_TRUNC
+# define FNOCTTY O_NOCTTY
+# define FFSYNC O_FSYNC
+# define FSYNC O_SYNC
+# define FAPPEND O_APPEND
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
#endif
/* Mask for file access modes. This is system-dependent in case
some system ever wants to define some other flavor of access. */
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+/* XXX missing */
+#define O_LARGEFILE 0
+
/* Values for the second argument to `fcntl'. */
#define F_DUPFD 0 /* Duplicate file descriptor. */
#define F_GETFD 1 /* Get file descriptor flags. */
@@ -83,13 +86,18 @@
#define F_GETFL 3 /* Get file status flags. */
#define F_SETFL 4 /* Set file status flags. */
#ifdef __USE_BSD
-#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
-#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
+# define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
+# define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
#endif
#define F_GETLK 7 /* Get record locking info. */
#define F_SETLK 8 /* Set record locking info (non-blocking). */
#define F_SETLKW 9 /* Set record locking info (blocking). */
+/* XXX missing */
+#define F_GETLK64 7 /* Get record locking info. */
+#define F_SETLK64 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 9 /* Set record locking info (blocking). */
+
/* File descriptor flags used with F_GETFD and F_SETFD. */
#define FD_CLOEXEC 1 /* Close on exec. */
@@ -102,12 +110,29 @@ struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
__off_t l_start; /* Offset where the lock begins. */
__off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
short int l_pid; /* Process holding the lock. */
short int l_xxx; /* Reserved for future use. */
};
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ short int l_pid; /* Process holding the lock. */
+ short int l_xxx; /* Reserved for future use. */
+ };
+#endif
+
/* Values for the `l_type' field of a `struct flock'. */
#define F_RDLCK 1 /* Read lock. */
#define F_WRLCK 2 /* Write lock. */
diff --git a/sysdeps/unix/bsd/bits/stat.h b/sysdeps/unix/bsd/bits/stat.h
index 037433f388..71130f3fcb 100644
--- a/sysdeps/unix/bsd/bits/stat.h
+++ b/sysdeps/unix/bsd/bits/stat.h
@@ -56,7 +56,7 @@ struct stat
unsigned long int st_blksize; /* Optimal block size for I/O. */
#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
- unsigned long int st_blocks; /* Number of 512-byte blocks allocated. */
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
long int st_spare[2];
};
diff --git a/sysdeps/unix/bsd/bsd4.4/wait3.c b/sysdeps/unix/bsd/bsd4.4/wait3.c
index 5caee579b7..b3802aee69 100644
--- a/sysdeps/unix/bsd/bsd4.4/wait3.c
+++ b/sysdeps/unix/bsd/bsd4.4/wait3.c
@@ -27,7 +27,7 @@
children; otherwise don't. */
pid_t
__wait3 (stat_loc, options, usage)
- __WAIT_STATUS_DEFN stat_loc;
+ __WAIT_STATUS stat_loc;
int options;
struct rusage *usage;
{
diff --git a/sysdeps/unix/bsd/osf/alpha/bits/stat.h b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
index 752d4eede1..ab0fa48f68 100644
--- a/sysdeps/unix/bsd/osf/alpha/bits/stat.h
+++ b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
@@ -49,7 +49,7 @@ struct stat
unsigned int st_blksize; /* Optimal block size for I/O. */
#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
- int st_blocks; /* Number of 512-byte blocks allocated. */
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
unsigned int st_flags;
unsigned int st_gen;
};
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
index ff55773e69..f51262d92d 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
@@ -22,6 +22,8 @@
and `setrlimit' are not system calls, these are the values used by the C
library to emulate them. */
+#include <bits/types.h>
+
/* Kinds of resource limit. */
enum __rlimit_resource
{
@@ -52,19 +54,47 @@ enum __rlimit_resource
#define RLIMIT_NOFILE RLIMIT_NOFILE
#define RLIMIT_OFILE RLIMIT_OFILE
- RLIM_NLIMITS,
-
- RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit. */
-#define RLIM_INFINITY RLIM_INFINITY
+ RLIM_NLIMITS
};
+/* Value to indicate that there is no limit. */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY 0x7fffffff
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffL
+#endif
+
+
+/* Type to represent quantities in resource limits. */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+
struct rlimit
{
/* The current (soft) limit. */
- int rlim_cur;
+ rlim_t rlim_cur;
+ /* The hard limit. */
+ rlim_t rlim_max;
+ };
+
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+
+struct rlimit64
+ {
+ /* The current (soft) limit. */
+ rlim64_t rlim_cur;
/* The hard limit. */
- int rlim_max;
+ rlim64_t rlim_max;
};
+#endif
/* Whose usage statistics do you want? */
enum __rusage_who
diff --git a/sysdeps/unix/sysv/i386/i686/time.S b/sysdeps/unix/sysv/i386/i686/time.S
new file mode 100644
index 0000000000..c5d27635c9
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/i686/time.S
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 <sysdep.h>
+#include <asm-syntax.h>
+
+SYSCALL (time, 1)
+ movl 4(%esp), %edx /* Put passed pointer in %edx. */
+ testl %edx, %edx /* Is it non-nil? */
+ cmovnel %eax, (%edx) /* Yes; store the time there. */
+ ret
+PSEUDO_END (time)
diff --git a/sysdeps/unix/sysv/i386/time.S b/sysdeps/unix/sysv/i386/time.S
index 3a7069c848..158ae6c31e 100644
--- a/sysdeps/unix/sysv/i386/time.S
+++ b/sysdeps/unix/sysv/i386/time.S
@@ -17,11 +17,13 @@
Boston, MA 02111-1307, USA. */
#include <sysdep.h>
+#include <asm-syntax.h>
SYSCALL (time, 1)
movl 4(%esp), %edx /* Put passed pointer in %edx. */
testl %edx, %edx /* Is it non-nil? */
- je null
+ je L(null)
movl %eax, (%edx) /* Yes; store the time there. */
-null: ret
+L(null):
+ ret
PSEUDO_END (time)
diff --git a/sysdeps/unix/sysv/linux/_G_config.h b/sysdeps/unix/sysv/linux/_G_config.h
index 8dc9221519..ccb84ad8f7 100644
--- a/sysdeps/unix/sysv/linux/_G_config.h
+++ b/sysdeps/unix/sysv/linux/_G_config.h
@@ -15,16 +15,19 @@
hold any value corresponding to members of the extended character
set, as well as at least one value that does not correspond to any
member of the extended character set. */
-#define _WINT_T
+# define _WINT_T
typedef unsigned int wint_t;
#endif
#define _G_size_t size_t
#define _G_fpos_t __off_t
+#define _G_fpos64_t __off64_t
#define _G_ssize_t __ssize_t
#define _G_off_t __off_t
+#define _G_off64_t __off64_t
#define _G_pid_t __pid_t
#define _G_uid_t __uid_t
#define _G_wint_t wint_t
+#define _G_stat64 stat
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
@@ -45,6 +48,10 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
#define _G_HAVE_MMAP 1
#define _G_HAVE_LONG_DOUBLE_IO 1
+#define _G_OPEN64 open64
+#define _G_LSEEK64 lseek64
+#define _G_FSTAT64 fstat64
+
/* This is defined by <bits/stat.h> if `st_blksize' exists. */
#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
@@ -53,15 +60,15 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
/* These are the vtbl details for ELF. */
#define _G_NAMES_HAVE_UNDERSCORE 0
#define _G_VTABLE_LABEL_HAS_LENGTH 1
-#define _G_USING_THUNKS
+#define _G_USING_THUNKS 1
#define _G_VTABLE_LABEL_PREFIX "__vt_"
#define _G_VTABLE_LABEL_PREFIX_ID __vt_
#if defined (__cplusplus) || defined (__STDC__)
-#define _G_ARGS(ARGLIST) ARGLIST
+# define _G_ARGS(ARGLIST) ARGLIST
#else
-#define _G_ARGS(ARGLIST) ()
+# define _G_ARGS(ARGLIST) ()
#endif
#endif /* _G_config.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/dirent.h b/sysdeps/unix/sysv/linux/alpha/bits/dirent.h
new file mode 100644
index 0000000000..4d717e4194
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/dirent.h
@@ -0,0 +1,50 @@
+/* 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.
+
+ The GNU C Library is distributed in the hope that 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. */
+
+#ifndef _BITS_DIRENT_H
+#define _BITS_DIRENT_H 1
+
+/* We don't have to make a difference for __USE_FILE_OFFSET64. */
+struct dirent
+ {
+ long int d_ino;
+ __off_t d_off;
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+ {
+ __ino64_t d_ino;
+ __off64_t d_off;
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ };
+#endif
+
+#define d_fileno d_ino /* Backwards compatibility. */
+
+#undef _DIRENT_HAVE_D_NAMLEN
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+#endif /* bits/dirent.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index b70502f21a..14840649ea 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */
#ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
@@ -27,8 +27,8 @@
/* In GNU, read and write are bits (unlike BSD). */
#ifdef __USE_GNU
-#define O_READ O_RDONLY /* Open for reading. */
-#define O_WRITE O_WRONLY /* Open for writing. */
+# define O_READ O_RDONLY /* Open for reading. */
+# define O_WRITE O_WRONLY /* Open for writing. */
#endif
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
@@ -48,25 +48,36 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000 /* fcntl, for BSD compatibility */
-#define F_DUPFD 0 /* dup */
-#define F_GETFD 1 /* get f_flags */
-#define F_SETFD 2 /* set f_flags */
-#define F_GETFL 3 /* more flags (cloexec) */
-#define F_SETFL 4
-#define F_GETLK 7
-#define F_SETLK 8
-#define F_SETLKW 9
-
-#define F_SETOWN 5 /* for sockets. */
-#define F_GETOWN 6 /* for sockets. */
+/* XXX missing */
+#define O_LARGEFILE 0
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#define F_GETLK 7 /* Get record locking info. */
+#define F_SETLK 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW 9 /* Set record locking info (blocking). */
+
+/* XXX missing */
+#define F_GETLK64 7 /* Get record locking info. */
+#define F_SETLK64 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 9 /* Set record locking info (blocking). */
+
+#ifdef __USE_BSD
+# define F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */
+# define F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */
+#endif
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-/* for posix fcntl() and lockf() */
-#define F_RDLCK 1
-#define F_WRLCK 2
-#define F_UNLCK 8
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */
+#define F_RDLCK 1 /* Read lock. */
+#define F_WRLCK 2 /* Write lock. */
+#define F_UNLCK 8 /* Remove lock. */
/* for old implementation of bsd flock () */
#define F_EXLCK 16 /* or 3 */
@@ -79,22 +90,34 @@
blocking */
#define LOCK_UN 8 /* remove lock */
+/* We don't need to support __USE_FILE_OFFSET64. */
struct flock
{
- short int l_type;
- short int l_whence;
- __off_t l_start;
- __off_t l_len;
- __pid_t l_pid;
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
};
+#endif
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
-#define FAPPEND O_APPEND
-#define FFSYNC O_FSYNC
-#define FASYNC O_ASYNC
-#define FNONBLOCK O_NONBLOCK
-#define FNDELAY O_NDELAY
+# define FAPPEND O_APPEND
+# define FFSYNC O_FSYNC
+# define FASYNC O_ASYNC
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
#endif /* Use BSD. */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index 768b8192ff..cc2a2eac90 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -46,7 +46,7 @@ struct stat
__time_t st_ctime; /* Time of last status change. */
unsigned int st_blksize; /* Optimal block size for I/O. */
#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
- int st_blocks; /* Nr. of 512-byte blocks allocated. */
+ __blkcnt_t st_blocks; /* Nr. of 512-byte blocks allocated. */
unsigned int st_flags;
unsigned int st_gen;
};
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 9a4666a508..cf2668a0e6 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -27,9 +27,9 @@
/* Convenience types. */
typedef unsigned char __u_char;
-typedef unsigned short __u_short;
+typedef unsigned short int __u_short;
typedef unsigned int __u_int;
-typedef unsigned long __u_long;
+typedef unsigned long int __u_long;
typedef unsigned long int __u_quad_t;
typedef long int __quad_t;
typedef signed char __int8_t;
@@ -52,6 +52,8 @@ typedef long int __off_t; /* Type of file sizes and offsets. */
typedef __quad_t __loff_t; /* Type of file sizes and offsets. */
typedef int __pid_t; /* Type of process identifications. */
typedef long int __ssize_t; /* Type of a byte count, or error. */
+typedef long int __rlim_t; /* Type of resource counts. */
+typedef long int __rlim64_t; /* Type of resource counts (LFS). */
typedef struct
{
@@ -92,4 +94,19 @@ typedef struct
typedef int __key_t;
+
+/* Types from the Large File Support interface. */
+
+/* Type to count number os disk blocks. */
+typedef 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/sysdeps/unix/sysv/linux/bits/dirent.h b/sysdeps/unix/sysv/linux/bits/dirent.h
index ccf5080151..1f8ff1e3d0 100644
--- a/sysdeps/unix/sysv/linux/bits/dirent.h
+++ b/sysdeps/unix/sysv/linux/bits/dirent.h
@@ -16,17 +16,34 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _DIRENTRY_H
-#define _DIRENTRY_H 1
+#ifndef _BITS_DIRENT_H
+#define _BITS_DIRENT_H 1
struct dirent
{
- long int d_ino;
+#ifndef __USE_FILE_OFFSET64
+ __ino_t d_ino;
__off_t d_off;
+#else
+ __ino64_t d_ino;
+ __off64_t d_off;
+#endif
unsigned short int d_reclen;
unsigned char d_type;
char d_name[256]; /* We must not include limits.h! */
};
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+ {
+ __ino64_t d_ino;
+ __off64_t d_off;
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ };
+#endif
+
#define d_fileno d_ino /* Backwards compatibility. */
#undef _DIRENT_HAVE_D_NAMLEN
@@ -34,4 +51,4 @@ struct dirent
#define _DIRENT_HAVE_D_OFF
#define _DIRENT_HAVE_D_TYPE
-#endif /* _DIRENTRY_H */
+#endif /* bits/dirent.h */
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index 62c3052d8c..302fa00498 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */
#ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
@@ -27,8 +27,8 @@
/* In GNU, read and write are bits (unlike BSD). */
#ifdef __USE_GNU
-#define O_READ O_RDONLY /* Open for reading. */
-#define O_WRITE O_WRONLY /* Open for writing. */
+# define O_READ O_RDONLY /* Open for reading. */
+# define O_WRITE O_WRONLY /* Open for writing. */
#endif
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
@@ -47,25 +47,36 @@
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
-#define F_DUPFD 0 /* dup */
-#define F_GETFD 1 /* get f_flags */
-#define F_SETFD 2 /* set f_flags */
-#define F_GETFL 3 /* more flags (cloexec) */
-#define F_SETFL 4
-#define F_GETLK 5
-#define F_SETLK 6
-#define F_SETLKW 7
-
-#define F_SETOWN 8 /* for sockets. */
-#define F_GETOWN 9 /* for sockets. */
+/* XXX missing */
+#define O_LARGEFILE 0
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#define F_GETLK 5 /* Get record locking info. */
+#define F_SETLK 6 /* Set record locking info (non-blocking). */
+#define F_SETLKW 7 /* Set record locking info (blocking). */
+
+/* XXX missing */
+#define F_GETLK64 5 /* Get record locking info. */
+#define F_SETLK64 6 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 7 /* Set record locking info (blocking). */
+
+#ifdef __USE_BSD
+# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
+# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
+#endif
-/* for F_[GET|SET]FL */
+/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-/* for posix fcntl() and lockf() */
-#define F_RDLCK 0
-#define F_WRLCK 1
-#define F_UNLCK 2
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
+#define F_RDLCK 0 /* Read lock. */
+#define F_WRLCK 1 /* Write lock. */
+#define F_UNLCK 2 /* Remove lock. */
/* for old implementation of bsd flock () */
#define F_EXLCK 4 /* or 3 */
@@ -80,20 +91,35 @@
struct flock
{
- short int l_type;
- short int l_whence;
- __off_t l_start;
- __off_t l_len;
- __pid_t l_pid;
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ __pid_t l_pid; /* Process holding the lock. */
};
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+#endif
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
-#define FAPPEND O_APPEND
-#define FFSYNC O_FSYNC
-#define FASYNC O_ASYNC
-#define FNONBLOCK O_NONBLOCK
-#define FNDELAY O_NDELAY
+# define FAPPEND O_APPEND
+# define FFSYNC O_FSYNC
+# define FASYNC O_ASYNC
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
#endif /* Use BSD. */
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 05cae83244..9ee6ea5b27 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. Linux 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
@@ -18,6 +18,7 @@
Boston, MA 02111-1307, USA. */
#include <asm/resource.h>
+#include <bits/types.h>
/* Transmute defines to enumerations. The macro re-definitions are
necessary because some programs want to test for operating system
@@ -103,13 +104,33 @@ 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. */
- long int rlim_cur;
- /* The hard limit. */
- long int rlim_max;
-};
+ {
+ /* The current (soft) limit. */
+ rlim_t rlim_cur;
+ /* The hard limit. */
+ rlim_t rlim_max;
+ };
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+ {
+ /* The current (soft) limit. */
+ rlim64_t rlim_cur;
+ /* The hard limit. */
+ rlim64_t rlim_max;
+ };
+#endif
/* Whose usage statistics do you want? */
enum __rusage_who
@@ -131,46 +152,46 @@ enum __rusage_who
/* Structure which says how much of each resource has been used. */
struct rusage
-{
- /* Total amount of user time used. */
- struct timeval ru_utime;
- /* Total amount of system time used. */
- struct timeval ru_stime;
- /* Maximum resident set size (in kilobytes). */
- long int ru_maxrss;
- /* Amount of sharing of text segment memory
- with other processes (kilobyte-seconds). */
- long int ru_ixrss;
- /* Amount of data segment memory used (kilobyte-seconds). */
- long int ru_idrss;
- /* Amount of stack memory used (kilobyte-seconds). */
- long int ru_isrss;
- /* Number of soft page faults (i.e. those serviced by reclaiming
- a page from the list of pages awaiting reallocation. */
- long int ru_minflt;
- /* Number of hard page faults (i.e. those that required I/O). */
- long int ru_majflt;
- /* Number of times a process was swapped out of physical memory. */
- long int ru_nswap;
- /* Number of input operations via the file system. Note: This
- and `ru_oublock' do not include operations with the cache. */
- long int ru_inblock;
- /* Number of output operations via the file system. */
- long int ru_oublock;
- /* Number of IPC messages sent. */
- long int ru_msgsnd;
- /* Number of IPC messages received. */
- long int ru_msgrcv;
- /* Number of signals delivered. */
- long int ru_nsignals;
- /* Number of voluntary context switches, i.e. because the process
- gave up the process before it had to (usually to wait for some
- resource to be available). */
- long int ru_nvcsw;
- /* Number of involuntary context switches, i.e. a higher priority process
- became runnable or the current process used up its time slice. */
- long int ru_nivcsw;
-};
+ {
+ /* Total amount of user time used. */
+ struct timeval ru_utime;
+ /* Total amount of system time used. */
+ struct timeval ru_stime;
+ /* Maximum resident set size (in kilobytes). */
+ long int ru_maxrss;
+ /* Amount of sharing of text segment memory
+ with other processes (kilobyte-seconds). */
+ long int ru_ixrss;
+ /* Amount of data segment memory used (kilobyte-seconds). */
+ long int ru_idrss;
+ /* Amount of stack memory used (kilobyte-seconds). */
+ long int ru_isrss;
+ /* Number of soft page faults (i.e. those serviced by reclaiming
+ a page from the list of pages awaiting reallocation. */
+ long int ru_minflt;
+ /* Number of hard page faults (i.e. those that required I/O). */
+ long int ru_majflt;
+ /* Number of times a process was swapped out of physical memory. */
+ long int ru_nswap;
+ /* Number of input operations via the file system. Note: This
+ and `ru_oublock' do not include operations with the cache. */
+ long int ru_inblock;
+ /* Number of output operations via the file system. */
+ long int ru_oublock;
+ /* Number of IPC messages sent. */
+ long int ru_msgsnd;
+ /* Number of IPC messages received. */
+ long int ru_msgrcv;
+ /* Number of signals delivered. */
+ long int ru_nsignals;
+ /* Number of voluntary context switches, i.e. because the process
+ gave up the process before it had to (usually to wait for some
+ resource to be available). */
+ long int ru_nvcsw;
+ /* Number of involuntary context switches, i.e. a higher priority process
+ became runnable or the current process used up its time slice. */
+ long int ru_nivcsw;
+ };
/* Priority limits. */
#define PRIO_MIN -20 /* Minimum priority a process can have. */
diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h
index 1c6e5f84ca..aab025890c 100644
--- a/sysdeps/unix/sysv/linux/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/bits/stat.h
@@ -39,18 +39,29 @@ struct stat
{
__dev_t st_dev; /* Device. */
unsigned short int __pad1;
+#ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
__dev_t st_rdev; /* Device number, if device. */
unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
__off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
unsigned long int st_blksize; /* Optimal block size for I/O. */
-#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
- unsigned long int st_blocks; /* Number of 512-byte blocks allocated. */
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#endif
__time_t st_atime; /* Time of last access. */
unsigned long int __unused1;
__time_t st_mtime; /* Time of last modification. */
@@ -61,6 +72,36 @@ struct stat
unsigned long int __unused5;
};
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __dev_t st_dev; /* Device. */
+ unsigned short int __pad1;
+
+ __ino64_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+ __off64_t st_size; /* Size of file, in bytes. */
+ unsigned long int st_blksize; /* Optimal block size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+#endif
+
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+
/* Encoding of the file mode. */
#define __S_IFMT 0170000 /* These bits determine file type. */
diff --git a/sysdeps/unix/sysv/linux/bits/statfs.h b/sysdeps/unix/sysv/linux/bits/statfs.h
index 8b9501423c..c79c80e84c 100644
--- a/sysdeps/unix/sysv/linux/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/bits/statfs.h
@@ -23,20 +23,44 @@
#ifndef _BITS_STATFS_H
#define _BITS_STATFS_H
-#include <bits/types.h> /* for __fsid_t */
+#include <bits/types.h> /* for __fsid_t and __fsblkcnt_t*/
struct statfs
{
int f_type;
int f_bsize;
- int f_blocks;
- int f_bfree;
- int f_bavail;
- int f_files;
- int f_ffree;
+#ifndef __USE_FILE_OFFSET64
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_bavail;
+ __fsblkcnt_t f_files;
+ __fsblkcnt_t f_ffree;
+#else
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsblkcnt64_t f_files;
+ __fsblkcnt64_t f_ffree;
+#endif
__fsid_t f_fsid;
int f_namelen;
int f_spare[6];
};
+#ifdef __USE_LARGEFILE64
+struct statfs64
+ {
+ int f_type;
+ int f_bsize;
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsblkcnt64_t f_files;
+ __fsblkcnt64_t f_ffree;
+ __fsid_t f_fsid;
+ int f_namelen;
+ int f_spare[6];
+ };
+#endif
+
#endif /* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 34f4682b3c..daa94336de 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -65,6 +65,8 @@ typedef long int __off_t; /* Type of file sizes and offsets. */
typedef __quad_t __loff_t; /* Type of file sizes and offsets. */
typedef int __pid_t; /* Type of process identifications. */
typedef int __ssize_t; /* Type of a byte count, or error. */
+typedef long int __rlim_t; /* Type of resource counts. */
+typedef __quad_t __rlim64_t; /* Type of resource counts (LFS). */
typedef struct
{
@@ -100,4 +102,25 @@ typedef struct
typedef int __key_t;
+
+/* Types from the Large File Support interface. */
+
+/* Type to count number os disk blocks. */
+typedef __u_long __blkcnt_t;
+typedef __u_quad_t __blkcnt64_t;
+
+/* Type to count file system blocks. */
+typedef long int __fsblkcnt_t;
+typedef __quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes. */
+typedef __u_long __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
+/* Type of file serial numbers. */
+typedef __u_long __ino64_t;
+
+/* Type of file sizes and offsets. */
+typedef __loff_t __off64_t;
+
#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 2b855c7a84..dd1c77a99e 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
-/* getsysstats - Determine various system internal values, Linux version.
- Copyright (C) 1996 Free Software Foundation, Inc.
+/* Determine various system internal values, Linux 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.
@@ -30,6 +30,7 @@
/* Determine the path to the /proc filesystem if available. */
static char *
+internal_function
get_proc_path (char *buffer, size_t bufsize)
{
FILE *fp;
@@ -115,6 +116,7 @@ weak_alias (__get_nprocs, get_nprocs_conf)
/* General function to get information about memory status from proc
filesystem. */
static int
+internal_function
phys_pages_info (const char *format)
{
FILE *fp;
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 36863db486..2e0bc5bf8f 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -28,6 +28,7 @@
/* Try to get a socket to talk to the kernel. */
#if defined SIOGIFINDEX || defined SIOGIFNAME
static int
+internal_function
opensock (void)
{
/* Cache the last AF that worked, to avoid many redundant calls to
diff --git a/sysdeps/unix/sysv/linux/llseek.c b/sysdeps/unix/sysv/linux/llseek.c
index a1284db6be..31dd86f232 100644
--- a/sysdeps/unix/sysv/linux/llseek.c
+++ b/sysdeps/unix/sysv/linux/llseek.c
@@ -1,5 +1,5 @@
/* Long-long seek operation.
- 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
@@ -25,7 +25,7 @@ extern int __sys_llseek (int fd, off_t offset_hi, off_t offset_lo,
/* Seek to OFFSET on FD, starting from WHENCE. */
loff_t
-llseek (int fd, loff_t offset, int whence)
+__llseek (int fd, loff_t offset, int whence)
{
loff_t result;
@@ -33,3 +33,5 @@ llseek (int fd, loff_t offset, int whence)
(off_t) (offset & 0xffffffff),
&result, whence) ?: result);
}
+weak_alias (__llseek, llseek)
+weak_alias (__llseek, lseek64)
diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c
new file mode 100644
index 0000000000..d81e98fb51
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/lseek64.c
@@ -0,0 +1 @@
+/* We don't need a definition since the llseek function is what we need. */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
index 2586140fdc..09d6fb6d4c 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */
#ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
#include <sys/types.h>
@@ -26,8 +26,8 @@
/* In GNU, read and write are bits (unlike BSD). */
#ifdef __USE_GNU
-#define O_READ O_RDONLY /* Open for reading. */
-#define O_WRITE O_WRONLY /* Open for writing. */
+# define O_READ O_RDONLY /* Open for reading. */
+# define O_WRITE O_WRONLY /* Open for writing. */
#endif
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
@@ -47,25 +47,36 @@
#define O_NDELAY O_NONBLOCK
-#define F_DUPFD 0 /* dup */
-#define F_GETFD 1 /* get f_flags */
-#define F_SETFD 2 /* set f_flags */
-#define F_GETFL 3 /* more flags (cloexec) */
-#define F_SETFL 4
-#define F_GETLK 14
-#define F_SETLK 6
-#define F_SETLKW 7
-
-#define F_SETOWN 24 /* for sockets. */
-#define F_GETOWN 23 /* for sockets. */
+/* XXX missing */
+#define O_LARGEFILE 0
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#define F_GETLK 14 /* Get record locking info. */
+#define F_SETLK 6 /* Set record locking info (non-blocking). */
+#define F_SETLKW 7 /* Set record locking info (blocking). */
+
+/* XXX missing */
+#define F_GETLK64 14 /* Get record locking info. */
+#define F_SETLK64 6 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 7 /* Set record locking info (blocking). */
+
+#ifdef __USE_BSD
+# define F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */
+# define F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */
+#endif
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-/* for posix fcntl() and lockf() */
-#define F_RDLCK 0
-#define F_WRLCK 1
-#define F_UNLCK 2
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
+#define F_RDLCK 0 /* Read lock. */
+#define F_WRLCK 1 /* Write lock. */
+#define F_UNLCK 2 /* Remove lock. */
/* for old implementation of bsd flock () */
#define F_EXLCK 4 /* or 3 */
@@ -78,23 +89,42 @@
blocking */
#define LOCK_UN 8 /* remove lock */
-typedef struct flock {
- short l_type;
- short l_whence;
- __off_t l_start;
- __off_t l_len;
- long l_sysid; /* XXX */
- __pid_t l_pid;
- long pad[4]; /* XXX */
-} flock_t;
+typedef struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ long int l_sysid; /* XXX */
+ __pid_t l_pid; /* Process holding the lock. */
+ long int pad[4]; /* XXX */
+ } flock_t;
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ long int l_sysid; /* XXX */
+ __pid_t l_pid; /* Process holding the lock. */
+ long int pad[4]; /* XXX */
+ };
+#endif
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
-#define FAPPEND O_APPEND
-#define FFSYNC O_FSYNC
-#define FASYNC O_ASYNC
-#define FNONBLOCK O_NONBLOCK
-#define FNDELAY O_NDELAY
+# define FAPPEND O_APPEND
+# define FFSYNC O_FSYNC
+# define FASYNC O_ASYNC
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
#endif /* Use BSD. */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
index a797b34c38..f27a75eb9a 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -39,14 +39,22 @@ struct stat
{
unsigned long int st_dev;
long int st_pad1[3];
+#ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
unsigned long int st_rdev; /* Device number, if device. */
long int st_pad2[2];
+#ifndef __USE_FILE_OFFSET64
__off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
/* SVR4 added this extra long to allow for expansion of off_t. */
long int st_pad3;
/*
@@ -60,8 +68,11 @@ struct stat
__time_t st_ctime; /* Time of last status change. */
long int __reserved2;
long int st_blksize; /* Optimal block size for I/O. */
-#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
- long int st_blocks; /* Number of 512-byte blocks allocated. */
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
+#endif
char st_fstype[16]; /* Filesystem type name */
long int st_pad4[8];
/* Linux specific fields */
@@ -69,6 +80,42 @@ struct stat
unsigned int st_gen;
};
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ unsigned long int st_dev;
+ long int st_pad1[3];
+ __ino64_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ unsigned long int st_rdev; /* Device number, if device. */
+ long int st_pad2[2];
+ __off64_t st_size; /* Size of file, in bytes. */
+ /* SVR4 added this extra long to allow for expansion of off_t. */
+ long int st_pad3;
+ /*
+ * Actually this should be timestruc_t st_atime, st_mtime and
+ * st_ctime but we don't have it under Linux.
+ */
+ __time_t st_atime; /* Time of last access. */
+ long int __reserved0;
+ __time_t st_mtime; /* Time of last modification. */
+ long int __reserved1;
+ __time_t st_ctime; /* Time of last status change. */
+ long int __reserved2;
+ long int st_blksize; /* Optimal block size for I/O. */
+ __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
+ char st_fstype[16]; /* Filesystem type name */
+ long int st_pad4[8];
+ /* Linux specific fields */
+ unsigned int st_flags;
+ unsigned int st_gen;
+ };
+#endif
+
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
/* Encoding of the file mode. */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/statfs.h b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
index 3b2306147c..2727b27257 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
@@ -23,22 +23,52 @@
#ifndef _BITS_STATFS_H
#define _BITS_STATFS_H
+#include <bits/types.h> /* for __fsid_t and __fsblkcnt_t*/
+
struct statfs
{
long int f_type;
#define f_fstyp f_type
long int f_bsize;
long int f_frsize; /* Fragment size - unsupported */
- long int f_blocks;
- long int f_bfree;
- long int f_files;
- long int f_ffree;
+#ifndef __USE_FILE_OFFSET64
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_files;
+ __fsblkcnt_t f_ffree;
+ __fsblkcnt_t f_bavail;
+#else
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_files;
+ __fsblkcnt64_t f_ffree;
+ __fsblkcnt64_t f_bavail;
+#endif
+
+ /* Linux specials */
+ __fsid_t f_fsid;
+ long int f_namelen;
+ long int f_spare[6];
+ };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+ {
+ long int f_type;
+#define f_fstyp f_type
+ long int f_bsize;
+ long int f_frsize; /* Fragment size - unsupported */
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_files;
+ __fsblkcnt64_t f_ffree;
+ __fsblkcnt64_t f_bavail;
/* Linux specials */
- long int f_bavail;
__fsid_t f_fsid;
long int f_namelen;
long int f_spare[6];
};
+#endif
#endif /* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index b92139aab4..f6e71b79b6 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -25,7 +25,7 @@ extern int __syscall_poll __P ((struct pollfd *fds, unsigned int nfds,
weak_extern (__syscall_poll)
static int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
- int timeout));
+ int timeout)) internal_function;
/* The real implementation. */
int
@@ -58,5 +58,6 @@ poll (fds, nfds, timeout)
/* Get the emulation code. */
-#define poll(fds, nfds, timeout) static __emulate_poll (fds, nfds, timeout)
+#define poll(fds, nfds, timeout) \
+ static internal_function __emulate_poll (fds, nfds, timeout)
#include <sysdeps/unix/bsd/poll.c>
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index 2c215ce920..10cd519609 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -24,7 +24,7 @@
extern ssize_t __syscall_readv __P ((int, __const struct iovec *, int));
static ssize_t __atomic_readv_replacement __P ((int, __const struct iovec *,
- int));
+ int)) internal_function;
/* Not all versions of the kernel support the large number of records. */
@@ -56,5 +56,5 @@ __readv (fd, vector, count)
}
weak_alias (__readv, readv)
-#define __readv static __atomic_readv_replacement
+#define __readv static internal_function __atomic_readv_replacement
#include <sysdeps/posix/readv.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index ca4d34c14e..9e8c589b9a 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -24,8 +24,8 @@
/* In GNU, read and write are bits (unlike BSD). */
#ifdef __USE_GNU
-#define O_READ O_RDONLY /* Open for reading. */
-#define O_WRITE O_WRONLY /* Open for writing. */
+# define O_READ O_RDONLY /* Open for reading. */
+# define O_WRITE O_WRONLY /* Open for writing. */
#endif
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
@@ -44,24 +44,35 @@
#define O_NDELAY (0x0004 | O_NONBLOCK)
#define O_NOCTTY 0x8000 /* not fcntl */
-#define F_DUPFD 0 /* dup */
-#define F_GETFD 1 /* get f_flags */
-#define F_SETFD 2 /* set f_flags */
-#define F_GETFL 3 /* more flags (cloexec) */
-#define F_SETFL 4
-#define F_GETOWN 5 /* for sockets. */
-#define F_SETOWN 6 /* for sockets. */
-#define F_GETLK 7
-#define F_SETLK 8
-#define F_SETLKW 9
+/* XXX missing */
+#define O_LARGEFILE 0
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#ifdef __USE_BSD
+# define F_GETOWN 5 /* Get owner of socket (receiver of SIGIO). */
+# define F_SETOWN 6 /* Set owner of socket (receiver of SIGIO). */
+#endif
+#define F_GETLK 7 /* Get record locking info. */
+#define F_SETLK 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW 9 /* Set record locking info (blocking). */
+
+/* XXX missing */
+#define F_GETLK64 7 /* Get record locking info. */
+#define F_SETLK64 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 9 /* Set record locking info (blocking). */
/* for F_[GET|SET]FL */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-/* for posix fcntl() and lockf() */
-#define F_RDLCK 1
-#define F_WRLCK 2
-#define F_UNLCK 3
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
+#define F_RDLCK 1 /* Read lock. */
+#define F_WRLCK 2 /* Write lock. */
+#define F_UNLCK 3 /* Remove lock. */
/* for old implementation of bsd flock () */
#define F_EXLCK 4 /* or 3 */
@@ -76,22 +87,39 @@
struct flock
{
- short int l_type;
- short int l_whence;
- __off_t l_start;
- __off_t l_len;
- __pid_t l_pid;
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ __pid_t l_pid; /* Process holding the lock. */
short int __unused;
};
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ short int __unused;
+ };
+#endif
+
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
-#define FAPPEND O_APPEND
-#define FFSYNC O_FSYNC
-#define FASYNC O_ASYNC
-#define FNONBLOCK O_NONBLOCK
-#define FNDELAY O_NDELAY
+# define FAPPEND O_APPEND
+# define FFSYNC O_FSYNC
+# define FASYNC O_ASYNC
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
#endif /* Use BSD. */
#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
index 46867d8e41..b33493ee46 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
@@ -33,10 +33,10 @@
#undef TCSETS
#undef TCSETSW
#undef TCSETSF
-#define TCGETS _IOR ('T', 8, struct __kernel_termios)
-#define TCSETS _IOW ('T', 9, struct __kernel_termios)
-#define TCSETSW _IOW ('T', 10, struct __kernel_termios)
-#define TCSETSF _IOW ('T', 11, struct __kernel_termios)
+#define TCGETS _IOR ('T', 8, char[36])
+#define TCSETS _IOW ('T', 9, char[36])
+#define TCSETSW _IOW ('T', 10, char[36])
+#define TCSETSF _IOW ('T', 11, char[36])
#include <linux/sockios.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 462f7c2998..a417928863 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -27,9 +27,9 @@
/* Convenience types. */
typedef unsigned char __u_char;
-typedef unsigned short __u_short;
+typedef unsigned short int __u_short;
typedef unsigned int __u_int;
-typedef unsigned long __u_long;
+typedef unsigned long int __u_long;
typedef unsigned long int __u_quad_t;
typedef long int __quad_t;
typedef signed char __int8_t;
@@ -45,13 +45,15 @@ typedef __quad_t *__qaddr_t;
typedef __u_long __dev_t; /* Type of device numbers. */
typedef __u_int __uid_t; /* Type of user identifications. */
typedef __u_int __gid_t; /* Type of group identifications. */
-typedef __u_int __ino_t; /* Type of file serial numbers. */
+typedef __u_long __ino_t; /* Type of file serial numbers. */
typedef __u_int __mode_t; /* Type of file attribute bitmasks. */
typedef __u_int __nlink_t; /* Type of file link counts. */
typedef long int __off_t; /* Type of file sizes and offsets. */
typedef __quad_t __loff_t; /* Type of file sizes and offsets. */
typedef int __pid_t; /* Type of process identifications. */
typedef long long int __ssize_t; /* Type of a byte count, or error. */
+typedef long int __rlim_t; /* Type of resource counts. */
+typedef long int __rlim64_t; /* Type of resource counts (LFS). */
typedef struct
{
@@ -92,4 +94,19 @@ typedef struct
typedef int __key_t;
+
+/* 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/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
index fcb752e3ec..dd509a7e8a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
@@ -2,7 +2,7 @@
struct kernel_stat
{
unsigned int st_dev;
- unsigned int st_ino;
+ unsigned long int st_ino;
unsigned int st_mode;
short int st_nlink;
unsigned int st_uid;
@@ -18,5 +18,5 @@ struct kernel_stat
unsigned long int __unused2;
};
-#define _HAVE___UNUSED1
-#define _HAVE___UNUSED2
+#define _HAVE___UNUSED1
+#define _HAVE___UNUSED2
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
index fcc5cb5a48..65a1d34836 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
@@ -29,21 +29,15 @@
/* int _setjmp(jmp_buf) */
-.weak _setjmp
-ENTRY(_setjmp)
-
+ENTRY(__setjmp)
ba __sigsetjmp_local
set 0, %o1
-
-END(setjmp)
+END(__setjmp)
/* int setjmp(jmp_buf) */
-.weak setjmp
ENTRY(setjmp)
-
set 1, %o1
-
END(setjmp)
/* int __sigsetjmp(jmp_buf, savemask) */
@@ -65,3 +59,6 @@ __sigsetjmp_local:
mov %g1, %o0
END(__sigsetjmp)
+
+weak_alias(__setjmp, _setjmp)
+weak_extern(setjmp)
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
index c8f512c00c..129702e33c 100644
--- a/sysdeps/unix/sysv/linux/sys/mman.h
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -44,8 +44,18 @@ __BEGIN_DECLS
extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
int __flags, int __fd, __off_t __offset));
+#ifndef __USE_FILE_OFFSET64
extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
int __flags, int __fd, __off_t __offset));
+#else
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+ int __flags, int __fd, __off_t __offset))
+ __asm__ ("mmap64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern __caddr_t mmap64 __P ((__caddr_t __addr, size_t __len, int __prot,
+ int __flags, int __fd, __off64_t __offset));
+#endif
/* Deallocate any mapping for the region starting at ADDR and extending LEN
bytes. Returns 0 if successful, -1 for errors (and sets errno). */
diff --git a/sysdeps/unix/sysv/linux/sys/param.h b/sysdeps/unix/sysv/linux/sys/param.h
index d5f6239cd2..c2a56a2c29 100644
--- a/sysdeps/unix/sysv/linux/sys/param.h
+++ b/sysdeps/unix/sysv/linux/sys/param.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* 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
@@ -28,7 +28,7 @@
#define NBBY CHAR_BIT
#ifndef NGROUPS
-#define NGROUPS NGROUPS_MAX
+# define NGROUPS NGROUPS_MAX
#endif
#define MAXSYMLINKS 5
#define CANBSIZ MAX_CANON
@@ -47,7 +47,7 @@
/* Macros for counting and rounding. */
#ifndef howmany
-#define howmany(x, y) (((x)+((y)-1))/(y))
+# define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
#define powerof2(x) ((((x)-1)&(x))==0)
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 31e794fb04..3b3c5b65fc 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -24,7 +24,7 @@
extern ssize_t __syscall_writev __P ((int, const struct iovec *, int));
static ssize_t __atomic_writev_replacement __P ((int, const struct iovec *,
- int));
+ int)) internal_function;
/* Not all versions of the kernel support the large number of records. */
@@ -56,5 +56,5 @@ __writev (fd, vector, count)
}
weak_alias (__writev, writev)
-#define __writev static __atomic_writev_replacement
+#define __writev static internal_function __atomic_writev_replacement
#include <sysdeps/posix/writev.c>
diff --git a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
index 9b6fed083d..f3f4473032 100644
--- a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
@@ -58,7 +58,7 @@ struct stat
long st_blksize; /* Optimal block size for I/O. */
#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
- long st_blocks; /* Number of 512-byte blocks allocated. */
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
char st_fstype[16]; /* The type of this filesystem. */
int st_aclcnt;
unsigned long st_level;
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
index ea5f1f4279..82ab37fd93 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
@@ -52,7 +52,7 @@ struct stat
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctime_usec;
- long st_blksize; /* Optimal block size for I/O. */
+ __blkcnt_t st_blksize; /* Optimal block size for I/O. */
#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
long st_blocks; /* Number of 512-byte blocks allocated. */
diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h
index a5ff12e663..c0582c1876 100644
--- a/sysdeps/wordsize-32/inttypes.h
+++ b/sysdeps/wordsize-32/inttypes.h
@@ -341,4 +341,33 @@ typedef unsigned long long int uint_fast64_t;
#define SCNoPTR "o"
#define SCNxPTR "x"
+
+/* Macros for string conversion. */
+
+/* Like `strtol' but convert to `intmax_t'. */
+#define strtoimax(nptr, endptr, base) \
+ __strtoll_internal (nptr, endptr, base, 0)
+
+#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
+
+
+/* Like `strtoul' but convert to `uintmax_t'. */
+#define strtoumax(nptr, endptr, base) \
+ __strtoull_internal (nptr, endptr, base, 0)
+
+#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 /* inttypes.h */
diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h
index f1dd2ffee0..2a2628428d 100644
--- a/sysdeps/wordsize-64/inttypes.h
+++ b/sysdeps/wordsize-64/inttypes.h
@@ -341,4 +341,31 @@ typedef unsigned long int uint_fast64_t;
#define SCNoPTR "lo"
#define SCNxPTR "lx"
+
+/* Macros for string conversion. */
+
+/* Like `strtol' but convert to `intmax_t'. */
+#define strtoimax(nptr, endptr, base) \
+ __strtol_internal (nptr, endptr, base, 0)
+
+#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
+
+
+/* Like `strtoul' but convert to `uintmax_t'. */
+#define strtoumax(nptr, endptr, base) \
+ __strtoul_internal (nptr, endptr, base, 0)
+
+#ifndef __strtoul_internal_defined
+extern unsigned long int __strtoul_internal __P ((__const char *
+ __restrict __nptr,
+ char **__restrict __endptr,
+ int __base, int __group));
+# define __strtoul_internal_defined 1
+#endif
+
#endif /* inttypes.h */
diff --git a/termios/termios.h b/termios/termios.h
index a55ddbc7a2..3c8d16eed8 100644
--- a/termios/termios.h
+++ b/termios/termios.h
@@ -34,7 +34,7 @@ __BEGIN_DECLS
#ifdef __USE_BSD
/* Compare a character C to a value VAL from the `c_cc' array in a
`struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
-#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
+# define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
#endif
/* Return the output baud rate stored in *TERMIOS_P. */
@@ -86,7 +86,7 @@ extern int tcflow __P ((int __fd, int __action));
#ifdef __USE_BSD
-#include <sys/ttydefaults.h>
+# include <sys/ttydefaults.h>
#endif
__END_DECLS
diff --git a/time/README b/time/README
index c189555c40..1c3160106e 100644
--- a/time/README
+++ b/time/README
@@ -1,28 +1,14 @@
-The source files
- `zic.c'
- `zdump.c'
- `tzselect.ksh'
- `checktab.awk'
-come from the tzcode1997g package by Arthur David Olsen et.al.
+The files
+ zic.c zdump.c ialloc.c scheck.c tzfile.h
+ private.h tzselect.ksh checktab.awk
+come from the tzcode1997g package by Arthur David Olson et.al.
The files
- `africa'
- `antarctica'
- `asia'
- `australasia'
- `europe'
- `northamerica'
- `southamerica'
- `pacificnew'
- `etcetera'
- `factory'
- `backward'
- `systemv'
- `solar87'
- `solar88'
- `solar89'
- `iso3166.tab'
- `zone.tab'
- `leapseconds'
- `yearistype'
-come from the tzdata1997h package by Arthur David Olsen et.al.
+ africa antarctica asia australasia europe
+ northamerica southamerica pacificnew etcetera factory
+ backward systemv solar87 solar88 solar89
+ iso3166.tab zone.tab leapseconds yearistype
+come from the tzdata1997i package by Arthur David Olson et.al.
+
+These packages may be found at ftp://elsie.nci.nih.gov/pub/. Commentary
+should be addressed to tz@elsie.nci.nih.gov.
diff --git a/time/africa b/time/africa
index 5c9608ceaa..f58719da5b 100644
--- a/time/africa
+++ b/time/africa
@@ -1,14 +1,14 @@
-# @(#)africa 7.19
+# @(#)africa 7.20
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
-# From Paul Eggert <eggert@twinsun.com> (1996-11-22):
+# From Paul Eggert <eggert@twinsun.com> (1997-10-05):
#
# A good source for time zone historical data outside the U.S. is
-# Thomas G. Shanks, The International Atlas (3rd edition),
-# San Diego: ACS Publications, Inc. (1991).
+# Thomas G. Shanks, The International Atlas (4th edition),
+# San Diego: ACS Publications, Inc. (1995).
#
# Gwillim Law <LAW@encmail.encompass.com> writes that a good source
# for recent time zone data is the International Air Transport
@@ -27,16 +27,40 @@
# Derek Howse, Greenwich time and the discovery of the longitude,
# Oxford University Press (1980).
#
-# For Africa I invented the following time zone abbreviations.
-# LMT Local Mean Time
-# -1:00 AAT Atlantic Africa Time (no longer used)
-# 0:00 WAT West Africa Time
-# 1:00 CAT Central Africa Time
-# 2:00 SAT South Africa Time
+# Previous editions of this database used WAT, CAT, SAT, and EAT
+# for +0:00 through +3:00, respectively,
+# but Mark R V Murray <markm@iafrica.com> reports that
+# `SAST' is the official abbreviation for +2:00 in the country of South Africa,
+# `CAT' is commonly used for +2:00 in countries north of South Africa, and
+# `WAT' is probably the best name for +1:00, as the common phrase for
+# the area that includes Nigeria is ``West Africa''.
+# He has heard of ``Western Sahara Time'' for +0:00 but can find no reference.
+#
+# To make things confusing, `WAT' seems to have been used for -1:00 long ago;
+# I'd guess that this was because people needed _some_ name for -1:00,
+# and at the time, far west Africa was the only major land area in -1:00.
+# This usage is now obsolete, as the last use of -1:00 on the African
+# mainland seems to have been 1976 in Western Sahara.
+#
+# To summarize, the following abbreviations seem to have some currency:
+# -1:00 WAT West Africa Time (no longer used)
+# 0:00 GMT Greenwich Mean Time
+# 2:00 CAT Central Africa Time
+# 2:00 SAST South Africa Standard Time
+# and Murray suggests the following abbreviation:
+# 1:00 WAT West Africa Time
+# I realize that this leads to `WAT' being used for both -1:00 and 1:00
+# for times before 1976, but this is the best I can think of
+# until we get more information.
+#
+# I invented the following abbreviations; corrections are welcome!
+# 2:00 WAST West Africa Summer Time
+# 2:30 BEAT British East Africa Time (no longer used)
+# 2:45 BEAUT British East Africa Unified Time (no longer used)
+# 3:00 CAST Central Africa Summer Time (no longer used)
+# 3:00 SAST South Africa Summer Time (no longer used)
# 3:00 EAT East Africa Time
-# The final `T' is replaced by `ST' for summer time, e.g. `SAST'.
-# BEAT is British East Africa Time, which was 2:30 before 1948 and 2:45 after.
-
+# 4:00 EAST East Africa Summer Time (no longer used)
# Algeria
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@@ -79,7 +103,7 @@ Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Luanda 0:52:56 - LMT 1892
0:52:04 - LMT 1911 May 26 # Luanda Mean Time?
- 1:00 - CAT
+ 1:00 - WAT
# Bassas da India
# uninhabited
@@ -88,31 +112,31 @@ Zone Africa/Luanda 0:52:56 - LMT 1892
# Whitman says they switched to 1:00 in 1946, not 1934; go with Shanks.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Porto-Novo 0:10:28 - LMT 1912
- 0:00 - WAT 1934 Feb 26
- 1:00 - CAT
+ 0:00 - GMT 1934 Feb 26
+ 1:00 - WAT
# Botswana
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Gaborone 1:43:40 - LMT 1885
- 2:00 - SAT 1943 Sep 19 2:00
- 2:00 1:00 SAST 1944 Mar 19 2:00
- 2:00 - SAT
+ 2:00 - CAT 1943 Sep 19 2:00
+ 2:00 1:00 CAST 1944 Mar 19 2:00
+ 2:00 - CAT
# Burkina Faso
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Ouagadougou -0:06:04 - LMT 1912
- 0:00 - WAT
+ 0:00 - GMT
# Burundi
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Bujumbura 1:57:28 - LMT 1890
- 2:00 - SAT
+ 2:00 - CAT
# Cameroon
# Whitman says they switched to 1:00 in 1920; go with Shanks.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Douala 0:38:48 - LMT 1912
- 1:00 - CAT
+ 1:00 - WAT
# Cape Verde
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -125,14 +149,14 @@ Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia
# Central African Republic
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Bangui 1:14:20 - LMT 1912
- 1:00 - CAT
+ 1:00 - WAT
# Chad
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Ndjamena 1:00:12 - LMT 1912
- 1:00 - CAT 1979 Oct 14
- 1:00 1:00 CAST 1980 Mar 8
- 1:00 - CAT
+ 1:00 - WAT 1979 Oct 14
+ 1:00 1:00 WAST 1980 Mar 8
+ 1:00 - WAT
# Comoros
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -142,19 +166,19 @@ Zone Indian/Comoro 2:53:04 - LMT 1911 Jul # Moroni, Gran Comoro
# Democratic Republic of Congo
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Kinshasa 1:01:12 - LMT 1897 Nov 9
- 1:00 - CAT
+ 1:00 - WAT
Zone Africa/Lubumbashi 1:49:52 - LMT 1897 Nov 9
- 2:00 - SAT
+ 2:00 - CAT
# Republic of the Congo
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Brazzaville 1:01:08 - LMT 1912
- 1:00 - CAT
+ 1:00 - WAT
# Cote D'Ivoire
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Abidjan -0:16:08 - LMT 1912
- 0:00 - WAT
+ 0:00 - GMT
# Djibouti
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -165,18 +189,6 @@ Zone Africa/Djibouti 2:52:36 - LMT 1911 Jul
# Egypt
-# From Bob Devine (1988-01-28):
-# Egypt: DST from first day of May to first of October (ending may
-# also be on Sept 30th not 31st -- you might want to ask one of the
-# soc.* groups, you might hit someone who could ask an embassy).
-# DST since 1960 except for 1981-82.
-
-# From U. S. Naval Observatory (1989-01-19):
-# EGYPT 2 H AHEAD OF UTC
-# EGYPT 3 H AHEAD OF UTC MAY 17 - SEP 30 (AFTER
-# EGYPT RAMADAN)
-
-# From Shanks (1991):
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Egypt 1940 only - Jul 15 0:00 1:00 S
Rule Egypt 1940 only - Oct 1 0:00 0 -
@@ -191,16 +203,15 @@ Rule Egypt 1957 1958 - Oct 1 0:00 0 -
Rule Egypt 1958 only - May 1 0:00 1:00 S
Rule Egypt 1959 1981 - May 1 1:00 1:00 S
Rule Egypt 1959 1965 - Sep 30 3:00 0 -
-Rule Egypt 1966 1990 - Oct 1 3:00 0 -
+Rule Egypt 1966 1994 - Oct 1 3:00 0 -
Rule Egypt 1982 only - Jul 25 1:00 1:00 S
Rule Egypt 1983 only - Jul 12 1:00 1:00 S
Rule Egypt 1984 1988 - May 1 1:00 1:00 S
Rule Egypt 1989 only - May 6 1:00 1:00 S
-Rule Egypt 1990 only - May 1 1:00 1:00 S
-Rule Egypt 1991 1994 - May 1 0:00 1:00 S
-Rule Egypt 1991 1994 - Oct 1 0:00 0 -
-Rule Egypt 1995 max - Apr lastFri 0:00 1:00 S
-Rule Egypt 1995 max - Sep lastFri 0:00 0 -
+Rule Egypt 1990 1994 - May 1 1:00 1:00 S
+# IATA (after 1990) says transitions are at 0:00; go with Shanks.
+Rule Egypt 1995 max - Apr lastFri 1:00 1:00 S
+Rule Egypt 1995 max - Sep lastFri 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
@@ -209,20 +220,24 @@ Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
# Equatorial Guinea
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Malabo 0:35:08 - LMT 1912
- 0:00 - WAT 1963 Dec 15
- 1:00 - CAT
+ 0:00 - GMT 1963 Dec 15
+ 1:00 - WAT
# Eritrea
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Asmera 2:35:32 - LMT 1870
2:35:32 - AMT 1890 # Asmera Mean Time
- 2:35:20 - AAMT 1936 May 5 # Addis Ababa MT?
+ 2:35:20 - ADMT 1936 May 5 # Adis Dera MT
3:00 - EAT
# Ethiopia
+# From Paul Eggert (1997-10-05):
+# Shanks writes that Ethiopia had six narrowly-spaced time zones between
+# 1870 and 1890, and that they merged to 38E50 (2:35:20) in 1890.
+# We'll guess that 38E50 is for Adis Dera.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Addis_Ababa 2:34:48 - LMT 1870
- 2:35:20 - AAMT 1936 May 5 # Addis Ababa MT?
+ 2:35:20 - ADMT 1936 May 5 # Adis Dera MT
3:00 - EAT
# Europa Island
@@ -231,23 +246,20 @@ Zone Africa/Addis_Ababa 2:34:48 - LMT 1870
# Gabon
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Libreville 0:37:48 - LMT 1912
- 1:00 - CAT
+ 1:00 - WAT
# Gambia
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Banjul -1:06:36 - LMT 1912
-1:06:36 - BMT 1935 # Banjul Mean Time
- -1:00 - AAT 1964
- 0:00 - WAT
+ -1:00 - WAT 1964
+ 0:00 - GMT
# Ghana
-# From Paul Eggert <eggert@twinsun.com> (1996-09-03):
-# WATST is my invention for ``West Africa one-Third Summer Time''.
-# From Shanks (1991):
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
# Whitman says DST was observed from 1931 to ``the present''; go with Shanks.
-Rule Ghana 1936 1942 - Sep 1 0:00 0:20 WATST
-Rule Ghana 1936 1942 - Dec 31 0:00 0 WAT
+Rule Ghana 1936 1942 - Sep 1 0:00 0:20 GHST
+Rule Ghana 1936 1942 - Dec 31 0:00 0 GMT
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Accra -0:00:52 - LMT 1918
0:00 Ghana %s
@@ -258,35 +270,33 @@ Zone Africa/Accra -0:00:52 - LMT 1918
# Guinea
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Conakry -0:54:52 - LMT 1912
- 0:00 - WAT 1934 Feb 26
- 1:00 - CAT 1960
- 0:00 - WAT
+ 0:00 - GMT 1934 Feb 26
+ -1:00 - WAT 1960
+ 0:00 - GMT
# Guinea-Bissau
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Bissau -1:02:20 - LMT 1911 May 26
- 1:00 - CAT 1975
- 0:00 - WAT
+ -1:00 - WAT 1975
+ 0:00 - GMT
# Juan de Nova
# uninhabited
# Kenya
-# From Paul Eggert <eggert@twinsun.com> (1993-11-18):
-# Shanks says the transition to 2:45 was in 1940, but it must have been 1948.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Nairobi 2:27:16 - LMT 1928 Jul
3:00 - EAT 1930
- 2:30 - BEAT 1948
- 2:45 - BEAT 1960
+ 2:30 - BEAT 1940
+ 2:45 - BEAUT 1960
3:00 - EAT
# Lesotho
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Maseru 1:50:00 - LMT 1903 Mar
- 2:00 - SAT 1943 Sep 19 2:00
+ 2:00 - SAST 1943 Sep 19 2:00
2:00 1:00 SAST 1944 Mar 19 2:00
- 2:00 - SAT
+ 2:00 - SAST
# Liberia
# From Paul Eggert <eggert@twinsun.com> (1993-11-18):
@@ -297,25 +307,17 @@ Zone Africa/Maseru 1:50:00 - LMT 1903 Mar
# For Liberia before 1972, Shanks reports -0:44, whereas Howse and Whitman
# each report -0:44:30; go with the more precise figure.
#
-# From Shanks (1991), as corrected by Whitman:
+# From Shanks, as corrected by Whitman:
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Monrovia -0:43:08 - LMT 1882
-0:43:08 - MMT 1919 Mar # Monrovia Mean Time
-0:44:30 - LRT 1972 May # Liberia Time
- 0:00 - WAT
+ 0:00 - GMT
###############################################################################
# Libya
-# From Bob Devine (January 28 1988):
-# Libya: Since 1982 April 1st to September 30th (?)
-
-# From U. S. Naval Observatory (1989-01-19):
-# LIBYAN ARAB 1 H AHEAD OF UTC JAMAHIRIYA/LIBYA
-# LIBYAN ARAB 2 H AHEAD OF UTC APR 1 - SEP 30 JAMAHIRIYA/LIBYA
-
-# From Shanks (1991):
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Libya 1951 only - Oct 14 2:00 1:00 S
Rule Libya 1952 only - Jan 1 0:00 0 -
@@ -353,24 +355,24 @@ Zone Indian/Antananarivo 3:10:04 - LMT 1911 Jul
# Malawi
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Blantyre 2:20:00 - LMT 1903 Mar
- 2:00 - SAT
+ 2:00 - CAT
# Mali
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Bamako -0:32:00 - LMT 1912
- 0:00 - WAT 1934 Feb 26
- -1:00 - AAT 1960 Jun 20
- 0:00 - WAT
+ 0:00 - GMT 1934 Feb 26
+ -1:00 - WAT 1960 Jun 20
+ 0:00 - GMT
# no longer different from Bamako, but too famous to omit
Zone Africa/Timbuktu -0:12:04 - LMT 1912
- 0:00 - WAT
+ 0:00 - GMT
# Mauritania
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Nouakchott -1:03:48 - LMT 1912
- 0:00 - WAT 1934 Feb 26
- -1:00 - AAT 1960 Jun 20
- 0:00 - WAT
+ 0:00 - GMT 1934 Feb 26
+ -1:00 - WAT 1960 Nov 28
+ 0:00 - GMT
# Mauritius
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -385,6 +387,7 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
3:00 - EAT
# Morocco
+# See the `europe' file for Spanish Morocco (Africa/Ceuta).
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
Rule Morocco 1939 only - Nov 19 0:00 0 -
@@ -408,36 +411,40 @@ Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 - WET
# Western Sahara
Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan
- -1:00 - AAT 1976 Apr 14
+ -1:00 - WAT 1976 Apr 14
0:00 - WET
# Mozambique
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Maputo 2:10:20 - LMT 1903 Mar
- 2:00 - SAT
+ 2:00 - CAT
# Namibia
+# Shanks says DST transitions are at 0:00; go with IATA.
+# The 1994-04-03 transition is from Shanks.
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Namibia 1994 max - Sep Sun>=1 2:00 1:00 S
Rule Namibia 1995 max - Apr Sun>=1 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8
1:30 - SWAT 1903 Mar # SW Africa Time
- 2:00 - SAT 1942 Sep 20 2:00
+ 2:00 - SAST 1942 Sep 20 2:00
2:00 1:00 SAST 1943 Mar 21 2:00
- 2:00 Namibia SA%sT
+ 2:00 - SAST 1990 Mar 21 # independence
+ 2:00 - CAT 1994 Apr 3
+ 1:00 Namibia WA%sT
# Niger
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Africa/Niamey 0:08:28 - LMT 1912
- 1:00 - CAT 1934 Feb 26
- 0:00 - WAT 1960
- 1:00 - CAT
+Zone Africa/Niamey 0:08:28 - LMT 1912
+ -1:00 - WAT 1934 Feb 26
+ 0:00 - GMT 1960
+ 1:00 - WAT
# Nigeria
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Lagos 0:13:36 - LMT 1919 Sep
- 1:00 - CAT
+ 1:00 - WAT
# Reunion
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -447,12 +454,15 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis
# Rwanda
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Kigali 2:00:16 - LMT 1935 Jun
- 2:00 - SAT
+ 2:00 - CAT
# St Helena
+# From Paul Eggert (1997-10-05):
+# Shanks says St Helena was 1W26 (-0:05:44) from 1890 to 1951,
+# but this is most likely a typo for 5W42, the longitude of Jamestown.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Atlantic/St_Helena -0:22:48 - LMT 1890 # Jamestown
- -0:06 - SHT 1951 # St Helena Time (?)
+ -0:22:48 - JMT 1951 # Jamestown Mean Time
0:00 - GMT
# The other parts of the St Helena territory are similar:
# Tristan da Cunha: on GMT, say Whitman and the CIA
@@ -464,13 +474,13 @@ Zone Atlantic/St_Helena -0:22:48 - LMT 1890 # Jamestown
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Sao_Tome 0:26:56 - LMT 1884
-0:36:32 - LMT 1912 # Lisbon Mean Time
- 0:00 - WAT
+ 0:00 - GMT
# Senegal
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Dakar -1:09:44 - LMT 1912
- -1:00 - AAT 1941 Jun
- 0:00 - WAT
+ -1:00 - WAT 1941 Jun
+ 0:00 - GMT
# Seychelles
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -480,34 +490,34 @@ Zone Indian/Mahe 3:41:48 - LMT 1906 Jun # Victoria
# Sierra Leone
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
# Whitman gives Mar 31 - Aug 31 for 1931 on; go with Shanks.
-Rule SL 1935 1942 - Jun 1 0:00 1:00 S
-Rule SL 1935 1942 - Oct 1 0:00 0 -
-Rule SL 1957 1962 - Jun 1 0:00 1:00 S
-Rule SL 1957 1962 - Sep 1 0:00 0 -
+Rule SL 1935 1942 - Jun 1 0:00 0:40 SLST
+Rule SL 1935 1942 - Oct 1 0:00 0 WAT
+Rule SL 1957 1962 - Jun 1 0:00 1:00 SLST
+Rule SL 1957 1962 - Sep 1 0:00 0 GMT
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Freetown -0:53:00 - LMT 1882
-0:53:00 - FMT 1913 Jun # Freetown Mean Time
- -1:00 SL AA%sT 1957
- 0:00 SL WA%sT
+ -1:00 SL %s 1957
+ 0:00 SL %s
# Somalia
-# From Paul Eggert <eggert@twinsun.com> (1993-11-18):
-# Shanks omits the 1948 transition to 2:45; this is probably a typo.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Mogadishu 3:01:28 - LMT 1893 Nov
3:00 - EAT 1931
- 2:30 - BEAT 1948
- 2:45 - BEAT 1957 # not in Shanks
+ 2:30 - BEAT 1957
3:00 - EAT
# South Africa
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule SA 1942 1943 - Sep Sun>=15 2:00 1:00 S
+Rule SA 1942 1943 - Sep Sun>=15 2:00 1:00 -
Rule SA 1943 1944 - Mar Sun>=15 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8
- 1:30 - SAT 1903 Mar
- 2:00 SA SA%sT
+ 1:30 - SAST 1903 Mar
+ 2:00 SA SAST
+# Shanks erroneously claims that most of South Africa switched to 1:00
+# on 1994-04-03 at 00:00.
+#
# Marion and Prince Edward Is
# weather station since 1947
# no information
@@ -524,24 +534,24 @@ Rule Sudan 1971 only - Apr 30 0:00 1:00 S
Rule Sudan 1972 1985 - Apr lastSun 0:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Khartoum 2:10:08 - LMT 1931
- 2:00 Sudan EE%sT
+ 2:00 Sudan CA%sT
# Swaziland
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Mbabane 2:04:24 - LMT 1903 Mar
- 2:00 - SAT
+ 2:00 - SAST
# Tanzania
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Dar_es_Salaam 2:37:08 - LMT 1931
3:00 - EAT 1948
- 2:45 - BEAT 1961
+ 2:45 - BEAUT 1961
3:00 - EAT
# Togo
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Lome 0:04:52 - LMT 1893
- 0:00 - WAT
+ 0:00 - GMT
# Tromelin
# uninhabited
@@ -581,15 +591,15 @@ Zone Africa/Tunis 0:40:44 - LMT 1881 May 12
Zone Africa/Kampala 2:09:40 - LMT 1928 Jul
3:00 - EAT 1930
2:30 - BEAT 1948
- 2:45 - BEAT 1957
+ 2:45 - BEAUT 1957
3:00 - EAT
# Zambia
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Lusaka 1:53:08 - LMT 1903 Mar
- 2:00 - SAT
+ 2:00 - CAT
# Zimbabwe
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Harare 2:04:12 - LMT 1903 Mar
- 2:00 - SAT
+ 2:00 - CAT
diff --git a/time/strptime.c b/time/strptime.c
index 8d650716fe..4e91a719ac 100644
--- a/time/strptime.c
+++ b/time/strptime.c
@@ -180,10 +180,16 @@ static char const ab_month_name[][4] =
enum locale_status { not, loc, raw };
static char *
+#ifdef _LIBC
+internal_function
+#endif
strptime_internal __P ((const char *buf, const char *format, struct tm *tm,
enum locale_status *decided));
static char *
+#ifdef _LIBC
+internal_function
+#endif
strptime_internal (buf, format, tm, decided)
const char *buf;
const char *format;
diff --git a/time/tzfile.c b/time/tzfile.c
index 9289de63a0..4b891b469c 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -45,8 +45,8 @@ struct leap
extern char * __tzstring (const char *); /* Defined in tzset.c. */
-static struct ttinfo *find_transition (time_t timer);
-static void compute_tzname_max (size_t);
+static struct ttinfo *find_transition (time_t timer) internal_function;
+static void compute_tzname_max (size_t) internal_function;
static size_t num_transitions;
static time_t *transitions = NULL;
@@ -382,6 +382,7 @@ __tzfile_default (const char *std, const char *dst,
}
static struct ttinfo *
+internal_function
find_transition (time_t timer)
{
size_t i;
@@ -460,6 +461,7 @@ __tzfile_compute (time_t timer, int use_localtime,
}
static void
+internal_function
compute_tzname_max (size_t chars)
{
extern size_t __tzname_cur_max; /* Defined in tzset.c. */
diff --git a/time/tzset.c b/time/tzset.c
index 6c16091ef5..dcee9dd66c 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -82,9 +82,10 @@ typedef struct
static tz_rule tz_rules[2];
-static int compute_change __P ((tz_rule *rule, int year));
-static int tz_compute __P ((time_t timer, const struct tm *tm));
-static void tzset_internal __P ((int always));
+static int compute_change __P ((tz_rule *rule, int year)) internal_function;
+static int tz_compute __P ((time_t timer, const struct tm *tm))
+ internal_function;
+static void tzset_internal __P ((int always)) internal_function;
/* Header for a list of buffers containing time zone strings. */
struct tzstring_head
@@ -151,6 +152,7 @@ static char *old_tz = NULL;
/* Interpret the TZ envariable. */
static void
+internal_function
tzset_internal (always)
int always;
{
@@ -450,6 +452,7 @@ __tzname_max ()
put it in RULE->change, saving YEAR in RULE->computed_for.
Return nonzero if successful, zero on failure. */
static int
+internal_function
compute_change (rule, year)
tz_rule *rule;
int year;
@@ -535,6 +538,7 @@ compute_change (rule, year)
and set `__tzname', `__timezone', and `__daylight' accordingly.
Return nonzero on success, zero on failure. */
static int
+internal_function
tz_compute (timer, tm)
time_t timer;
const struct tm *tm;
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 8d152566fc..c7ab509448 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -43,7 +43,7 @@ __BEGIN_DECLS
hold any value corresponding to members of the extended character
set, as well as at least one value that does not correspond to any
member of the extended character set. */
-#define _WINT_T
+# define _WINT_T
typedef unsigned int wint_t;
#endif
@@ -212,7 +212,7 @@ extern size_t __mbrlen __P ((__const char *__restrict __s, size_t __n,
extern size_t mbrlen __P ((__const char *__restrict __s, size_t __n,
mbstate_t *__restrict __ps));
-#if defined (__OPTIMIZE__) \
+#if defined __OPTIMIZE__ \
&& (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
/* Define inline function as optimization. */
extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
@@ -410,7 +410,7 @@ extern unsigned long long int __wcstoull_internal __P ((__const wchar_t *
#endif /* GCC and use GNU. */
-#if defined (__OPTIMIZE__) && __GNUC__ >= 2
+#if defined __OPTIMIZE__ && __GNUC__ >= 2
/* Define inline functions which call the internal entry points. */
extern __inline double wcstod (__const wchar_t *__restrict __nptr,
@@ -424,7 +424,7 @@ extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
int __base)
{ return __wcstoul_internal (__nptr, __endptr, __base, 0); }
-#ifdef __USE_GNU
+# ifdef __USE_GNU
extern __inline float wcstof (__const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr)
{ return __wcstof_internal (__nptr, __endptr, 0); }
@@ -442,7 +442,7 @@ extern __inline unsigned long long int wcstouq (__const wchar_t *
wchar_t **__restrict __endptr,
int __base)
{ return __wcstoull_internal (__nptr, __endptr, __base, 0); }
-#endif /* Use GNU. */
+# endif /* Use GNU. */
#endif /* Optimizing GCC >=2. */
diff --git a/wctype/test_wctype.c b/wctype/test_wctype.c
index 350d02cb0c..300b86972d 100644
--- a/wctype/test_wctype.c
+++ b/wctype/test_wctype.c
@@ -48,7 +48,7 @@ main (int argc, char *argv[])
{
#define TEST(test) \
do \
- if ((is##test (ch) == 0) != (iswctype (ch, bit_##test)) == 0) \
+ if ((is##test (ch) == 0) != (iswctype (ch, bit_##test) == 0)) \
{ \
printf ("class `%s' test for character \\%o failed\n", \
#test, ch); \
diff --git a/wctype/wctype.h b/wctype/wctype.h
index 1862c6ca8f..91a1678192 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -38,7 +38,7 @@ __BEGIN_DECLS
hold any value corresponding to members of the extended character
set, as well as at least one value that does not correspond to any
member of the extended character set. */
-#define _WINT_T
+# define _WINT_T
typedef unsigned int wint_t;
#endif
@@ -53,7 +53,7 @@ typedef unsigned long int wctype_t;
/* Constant expression of type `wint_t' whose value does not correspond
to any member of the extended character set. */
#ifndef WEOF
-#define WEOF (0xffffffffu)
+# define WEOF (0xffffffffu)
#endif
#ifndef _ISbit
@@ -65,12 +65,12 @@ typedef unsigned long int wctype_t;
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
{
@@ -181,28 +181,28 @@ extern wint_t towctrans __P ((wint_t __wc, wctrans_t __desc));
#ifndef __NO_WCTYPE
-#define iswalnum(wc) __iswctype ((wc), _ISalnum)
-#define iswalpha(wc) __iswctype ((wc), _ISalpha)
-#define iswcntrl(wc) __iswctype ((wc), _IScntrl)
-#define iswdigit(wc) __iswctype ((wc), _ISdigit)
-#define iswlower(wc) __iswctype ((wc), _ISlower)
-#define iswgraph(wc) __iswctype ((wc), _ISgraph)
-#define iswprint(wc) __iswctype ((wc), _ISprint)
-#define iswpunct(wc) __iswctype ((wc), _ISpunct)
-#define iswspace(wc) __iswctype ((wc), _ISspace)
-#define iswupper(wc) __iswctype ((wc), _ISupper)
-#define iswxdigit(wc) __iswctype ((wc), _ISxdigit)
-
-#ifdef __USE_GNU
-#define iswblank(wc) __iswctype ((wc), _ISblank)
-#endif
+# define iswalnum(wc) __iswctype ((wc), _ISalnum)
+# define iswalpha(wc) __iswctype ((wc), _ISalpha)
+# define iswcntrl(wc) __iswctype ((wc), _IScntrl)
+# define iswdigit(wc) __iswctype ((wc), _ISdigit)
+# define iswlower(wc) __iswctype ((wc), _ISlower)
+# define iswgraph(wc) __iswctype ((wc), _ISgraph)
+# define iswprint(wc) __iswctype ((wc), _ISprint)
+# define iswpunct(wc) __iswctype ((wc), _ISpunct)
+# define iswspace(wc) __iswctype ((wc), _ISspace)
+# define iswupper(wc) __iswctype ((wc), _ISupper)
+# define iswxdigit(wc) __iswctype ((wc), _ISxdigit)
+
+# ifdef __USE_GNU
+# define iswblank(wc) __iswctype ((wc), _ISblank)
+# endif
/* Pointer to conversion tables. */
extern __const __int32_t *__ctype_tolower; /* Case conversions. */
extern __const __int32_t *__ctype_toupper; /* Case conversions. */
-#define towlower(wc) towctrans ((wc), __ctype_tolower)
-#define towupper(wc) towctrans ((wc), __ctype_toupper)
+# define towlower(wc) towctrans ((wc), __ctype_tolower)
+# define towupper(wc) towctrans ((wc), __ctype_toupper)
#endif /* Not __NO_WCTYPE. */
@@ -281,27 +281,27 @@ extern wint_t __towctrans_l __P ((wint_t __wc, wctrans_t __desc,
__locale_t locale));
-#ifndef __NO_WCTYPE
-#define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISalnum, (loc))
-#define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISalpha, (loc))
-#define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _IScntrl, (loc))
-#define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISdigit, (loc))
-#define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISlower, (loc))
-#define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISgraph, (loc))
-#define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISprint, (loc))
-#define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISpunct, (loc))
-#define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISspace, (loc))
-#define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISupper, (loc))
-#define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISxdigit, (loc))
-
-#define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISblank, (loc))
-
-#define __towlower_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_tolower, \
- (loc))
-#define __towupper_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_toupper, \
- (loc))
+# ifndef __NO_WCTYPE
+# define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISalnum, (loc))
+# define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISalpha, (loc))
+# define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _IScntrl, (loc))
+# define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISdigit, (loc))
+# define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISlower, (loc))
+# define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISgraph, (loc))
+# define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISprint, (loc))
+# define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISpunct, (loc))
+# define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISspace, (loc))
+# define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISupper, (loc))
+# define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISxdigit, (loc))
-#endif /* Not __NO_WCTYPE. */
+# define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISblank, (loc))
+
+# define __towlower_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_tolower, \
+ (loc))
+# define __towupper_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_toupper, \
+ (loc))
+
+# endif /* Not __NO_WCTYPE. */
#endif /* Use GNU. */