Index: linux/libc/ChangeLog diff -c linux/libc/ChangeLog:1.155 linux/libc/ChangeLog:1.167 *** linux/libc/ChangeLog:1.155 Fri Dec 6 15:35:01 1996 --- linux/libc/ChangeLog Fri Feb 14 19:42:59 1997 *************** *** 1,3 **** --- 1,218 ---- + Fri Feb 14 19:41:54 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.23 is released. + + * <_G_config.h>: change version to 5.4.23. + + * elf/libc/jump.params: set version to 5.4.23. + + * release.libc: update. + + * time/strptime.c (strptime): fix definition. + + Fri Feb 14 04:27:57 1997 Ulrich Windl + + * (strptime): fix the prototype. + + Sun Feb 9 12:05:06 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * : update copyright. + (__libc_malloc_initialized): new. + + * dl-malloc/malloc.c (__libc_malloc_initialized): changed + from __malloc_initialized so that this variable is not + shared with other users of GNU malloc. + + Fri Feb 7 19:14:31 1997 "Ronald F. Guilmette" + + * inet/gethstnmad.c (gethostbyname): change sizeof (buf) + to sizeof (buf.buf) while calling res_search (). + + Wed Feb 5 16:25:14 1997 "Ronald F. Guilmette" + + * (prioritynames, prioritynames, facilitynames): + add missing '{' and '}'. + + Mon Feb 3 19:57:45 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.22 is released. + + * <_G_config.h>: change version to 5.4.22. + + * elf/libc/jump.params: set version to 5.4.22. + + * elf/libm/jump.params: set version to 5.0.8. + + * release.libc: update. + + * : + * : + * : update from glibc 2.0.1. + + Sun Feb 2 23:41:28 1997 "Hans-Frieder Vogt" + + * bsd/realbsd.c: return the offending path in error. + + Sat Feb 1 11:47:26 1997 Stephen L Moshier + + * sysdeps/linux/i386/math/frexpl.c: Preserve sign of input. + + Wed Jan 29 20:50:53 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * sysdeps/linux/i386/crt/crt0.S: align stack to 8 bytes. + + Sun Jan 26 21:03:51 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.21 is released. + + * <_G_config.h>: change version to 5.4.21. + + * elf/libc/jump.params: set version to 5.4.21. + + * release.libc: update. + + * (vm86old): renamed from vm86. + (vm86): new. + + * (SYS_vm86old): renamed from SYS_vm86. + (SYS_setresuid, SYS_getresuid, SYS_vm86, SYS_query_module): new. + + * sysdeps/linux/Makefile (SRC1S): remove vm86.S. + + * sysdeps/linux/Makefile (SRC3S): add vm86old.S and vm86.S. + + * sysdeps/linux/vm86.S: removed. + + * sysdeps/linux/i386/vm86.S: new. + + * sysdeps/linux/i386/vm86old.S: new. + + Thu Jan 23 13:22:34 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * yp/yp.h: + * yp/yppasswd.h: removed. + + * yp/yppasswd_xdr.c: + * yp/yplib.c: + * yp/yp_xdr.c: modified for new . + + * yp/yp_xdr.c (xdr_domainname): changed to + + bool_t xdr_domainname(XDR *xdrs, domainname *objp) + + * : new. + + * (_YPBIND, struct ypbind_binding): + defined before include . + don't duplicate anything defined in . + + * : new. generated from yp.x. + + Sat Jan 11 11:20:04 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.20 is released. + + * <_G_config.h>: change version to 5.4.20. + + * elf/libc/jump.params: set version to 5.4.20. + + * release.libc: update. + + * rpc/xdr.c (xdr_string): return FALSE if the + pointer is NULL for XDR_ENCODE. + + Sun Jan 5 01:26:54 1997 Greg Stark + + * regex/rx.c: protect and release cdr. + + Sat Jan 4 10:46:30 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.19 is released. + + * <_G_config.h>: change version to 5.4.19. + + * elf/libc/jump.params: set version to 5.4.19. + + * release.libc: update. + + * login/getpass.c: disable ICANON. + + Tue Dec 31 06:13:14 1996 Wolfram Gloger + + * libio/stdio/stdio.h: + * libio/stdio/setfileno.c: + * stdlib/strtod.c: + * sysdeps/linux/connect.c: + * sysdeps/linux/getsocknam.c: + * sysdeps/linux/getsockopt.c: + * sysdeps/linux/recv.c: + * sysdeps/linux/recvfrom.c: + * sysdeps/linux/send.c: + * sysdeps/linux/sendto.c: + * sysdeps/linux/setsockopt.c: + * sysdeps/linux/shutdown.c: + * sysdeps/linux/socket.c: + * sysdeps/linux/sysctl.c: + * sysdeps/linux/accept.c: + * sysdeps/linux/bind.c: + * sysdeps/linux/listen.c: + * sysdeps/linux/getpeernam.c: + * sysdeps/linux/sendmsg.c: + * sysdeps/linux/socketpair.c: + * sysdeps/linux/recvmsg.c: update. + + * dl-malloc/Makefile (VSCFLAGS): add -DMALLOC_HOOKS and remove + -D__MALLOC_0_RETURNS_NULL + + * dl-malloc/malloc.c: update from Doug Lea's 2.6.4 plus debug + hooks. + + Sun Dec 29 10:45:59 1996 H.J. Lu (hjl@gnu.ai.mit.edu) + + * README: update. + + * sysdeps/linux/i386/__init_brk.c (__curbrk): + * sysdeps/linux/m68k/__init_brk.c (__curbrk): new, weak aliase + of ___brk_addr. + + Thu Dec 12 01:20:42 1996 Geert Uytterhoeven + + * sysdeps/linux/m68k/gmon/gmon.c: fix a typo. + + Tue Dec 17 08:16:37 1996 H.J. Lu (hjl@gnu.ai.mit.edu) + + * version 5.4.18 is released. + + * <_G_config.h>: change version to 5.4.18. + + * elf/libc/jump.params: set version to 5.4.18. + + * release.libc: update. + + Mon Dec 16 18:17:37 1996 H.J. Lu (hjl@gnu.ai.mit.edu) + + * sysdeps/linux/i386/math/exp.S: fix a typo. + + * inet/rcmd.c, inet/rexec.c: check the size of the IP address + from gethosybyname () against sizeof (sin_addr). + + Sat Dec 7 21:41:48 1996 H.J. Lu (hjl@gnu.ai.mit.edu) + + * (_PATH_LOCALE): changed to /usr/share/locale. + + Mon Dec 9 20:30:59 1996 Ed Doolittle + + * (_PATH_PRESERVE): new, defined as + "/var/preserve". + + Mon Dec 9 21:59:52 1996 Ruediger Helsch + + * libio/printf_fp.c: fix locale. + + Sat Dec 7 21:41:48 1996 H.J. Lu (hjl@gnu.ai.mit.edu) + + * : include . + Fri Dec 6 13:35:05 1996 H.J. Lu (hjl@gnu.ai.mit.edu) * version 5.4.17 is released. Index: linux/libc/README diff -c linux/libc/README:1.8 linux/libc/README:1.9 *** linux/libc/README:1.8 Fri Sep 13 01:44:18 1996 --- linux/libc/README Sat Jan 4 10:49:27 1997 *************** *** 23,39 **** make # compile all the ELF libraries. - make LITE=true # for light version shared library. no libm.a. - # no stub libraries are built. - Don't try to add SHADOW_COMPAT=whatever, since this support is not the right way. It WILL cause your passwords reappear in /etc/passwd, which is clearly not the right way. Shadow passwords are supported correctly without this option too. make install # install the ELF libraries - make install.lite # install the light version of the shared a.out - $ library. Any other switches are used at your own risk :-). --- 23,34 ---- Index: linux/libc/release.libc diff -c linux/libc/release.libc:1.31 linux/libc/release.libc:1.38 *** linux/libc/release.libc:1.31 Fri Dec 6 14:37:06 1996 --- linux/libc/release.libc Fri Feb 14 19:42:59 1997 *************** *** 1,5 **** --- 1,14 ---- Hi, Gals and Guys, + I have modified the NIS support in glibc. Please get the latst + ypclients at where you get this C library. Please test NIS programs + as much as you can. Thanks. + + There is a NYS bug. If a service is not available, the some NIS/NIS+ + routines will give back a NULL pointer, but the other functions expect a + struct with the error code. The easiest way to fix it is to remove the + services (nis, yp, ...) which are not available on your machine. + Binaries of locale and localedef are included in the binary release. I added the support for larger PATH_MAX in linux 2.1.x. The old binaries *************** *** 10,29 **** so that the old XFree86 binaries will run fine with the new XFree86 shared librraries compiled with libc 6.x/glibc 2.x. ! If you use linux 2.1.x, you need libc 5.4.17 or above to compile libc yourself. The pre-compiled libc should run fine under linux 2.1.x. Also this library is compiled with -D_REENTRANT so that errno is MT safe. The shared libraries are now compiled with -g1 which can provide minimum information when core dump happens. You can strip ! libc.so.5.4.17 if you want. ! Due to the new, improved locale, the Linux C library 5.4.17 is binary compatible with libc 5.3.12 but not vice versa. The binaries ! compiled/linked with libc.so.5.4.17 may not run with libc.so.5.3.12. You may need to regenerate locale files for the new locale in libc ! 5.4.17 if you use locales other tha C/POSIX which are the defaults. The locale sources are at --- 19,38 ---- so that the old XFree86 binaries will run fine with the new XFree86 shared librraries compiled with libc 6.x/glibc 2.x. ! If you use linux 2.1.x, you need libc 5.4.23 or above to compile libc yourself. The pre-compiled libc should run fine under linux 2.1.x. Also this library is compiled with -D_REENTRANT so that errno is MT safe. The shared libraries are now compiled with -g1 which can provide minimum information when core dump happens. You can strip ! libc.so.5.4.23 if you want. ! Due to the new, improved locale, the Linux C library 5.4.23 is binary compatible with libc 5.3.12 but not vice versa. The binaries ! compiled/linked with libc.so.5.4.23 may not run with libc.so.5.3.12. You may need to regenerate locale files for the new locale in libc ! 5.4.23 if you use locales other tha C/POSIX which are the defaults. The locale sources are at *************** *** 32,38 **** There are many security bug fixes. Please consult ChangeLog for details. Please let me know if there are more security bugs remains. ! This is the beta release of the Linux C library 5.4.17. Please read the ChangeLog for details regarding changes/bug fixes. DISTRIBUTION SITES: --- 41,47 ---- There are many security bug fixes. Please consult ChangeLog for details. Please let me know if there are more security bugs remains. ! This is the beta release of the Linux C library 5.4.23. Please read the ChangeLog for details regarding changes/bug fixes. DISTRIBUTION SITES: *************** *** 53,63 **** DISTRIBUTION FILES: ! 1. libc-5.4.17.bin.tar.gz REQUIRED. This package contains the header files for libc, shared and static ELF libraries libc and libm, and the static ELF library libbsd.a. ! The header files in libc-5.4.17.bin.tar.gz are not complete. You need to install the kernel source tree for the system-dependent header files. The header files are in lib-x.y.z.bin.tar.gz and libc-x.y.z.tar.gz. You --- 62,72 ---- DISTRIBUTION FILES: ! 1. libc-5.4.23.bin.tar.gz REQUIRED. This package contains the header files for libc, shared and static ELF libraries libc and libm, and the static ELF library libbsd.a. ! The header files in libc-5.4.23.bin.tar.gz are not complete. You need to install the kernel source tree for the system-dependent header files. The header files are in lib-x.y.z.bin.tar.gz and libc-x.y.z.tar.gz. You *************** *** 68,78 **** to extract the header files without the binaries files. A separate tar file for the header files may cause unnecessary confusion. ! 2. libc-5.4.17.tar.gz Source tree for libc and header files. ! 3. libc-5.4.16-5.4.17.diff.gz Context diffs against the source tree from the previous libc release. Please make sure the empty libc/regex/rx.h is deleted. --- 77,87 ---- to extract the header files without the binaries files. A separate tar file for the header files may cause unnecessary confusion. ! 2. libc-5.4.23.tar.gz Source tree for libc and header files. ! 3. libc-5.4.22-5.4.23.diff.gz Context diffs against the source tree from the previous libc release. Please make sure the empty libc/regex/rx.h is deleted. *************** *** 143,149 **** rm -f /usr/include/wcstr.h /usr/include/mbstr.h rm -f /usr/include/ld_so_config.h /usr/include/localeinfo.h rm -rf /usr/include/netinet /usr/include/net /usr/include/pthread ! gzip -dc libc-5.4.17.bin.tar.gz | tar xvf - SOURCE INSTALLATION: --- 152,158 ---- rm -f /usr/include/wcstr.h /usr/include/mbstr.h rm -f /usr/include/ld_so_config.h /usr/include/localeinfo.h rm -rf /usr/include/netinet /usr/include/net /usr/include/pthread ! gzip -dc libc-5.4.23.bin.tar.gz | tar xvf - SOURCE INSTALLATION: *************** *** 184,201 **** PTHREAD NOTES: ! The MIT pthread library 1.60 beta4 seems to work. It passed most of tests ! in the MIT pthread package. The pthread libraries are not installed by ! default, nor are binaries included. You may want to remove "-g" from the ! default CFLAGS for the pthread library. You need to install the ! library "elfshared/libpthread.so.1.60.beta4" in either /usr/local/lib ! or /usr/lib manually. You must run ldconfig after installing them. ! ! To compile pthread programs, you need to add -D_MIT_POSIX_THREADS to ! CFLAGS and -lpthread to LDFLAGS. The network _r functions are still ! missing. Due to the limitation of the static ELF library, pthread only ! works with the shared libpthread and libc. It is very tricky to make ! static libpthread and libc work. NYS NOTES: --- 193,200 ---- PTHREAD NOTES: ! The MIT pthread library is not supported in libc 5.4.x. The new ! kernel-based pthread will be in libc 6.0. NYS NOTES: *************** *** 220,226 **** H.J. hjl@gnu.ai.mit.edu ! 12/05/96 ---- RCS file: /home/cvs/gnu/make/dir.c,v retrieving revision 1.1.1.1 --- 219,225 ---- H.J. hjl@gnu.ai.mit.edu ! 02/14/97 ---- RCS file: /home/cvs/gnu/make/dir.c,v retrieving revision 1.1.1.1 Index: linux/libc/bsd/realpath.c diff -c linux/libc/bsd/realpath.c:1.6 linux/libc/bsd/realpath.c:1.7 *** linux/libc/bsd/realpath.c:1.6 Fri Dec 6 17:36:00 1996 --- linux/libc/bsd/realpath.c Mon Feb 3 19:54:15 1997 *************** *** 139,146 **** n = readlink(got_path, link_path, PATH_MAX - 1); if (n < 0) { /* EINVAL means the file exists but isn't a symlink. */ ! if (errno != EINVAL) return NULL; } else { /* Note: readlink doesn't add the null byte. */ --- 139,150 ---- n = readlink(got_path, link_path, PATH_MAX - 1); if (n < 0) { /* EINVAL means the file exists but isn't a symlink. */ ! if (errno != EINVAL) { ! /* Make sure it's null terminated. */ ! *new_path = '\0'; ! strcpy (resolved_path, got_path); return NULL; + } } else { /* Note: readlink doesn't add the null byte. */ Index: linux/libc/dl-malloc/Makefile diff -c linux/libc/dl-malloc/Makefile:1.2 linux/libc/dl-malloc/Makefile:1.3 *** linux/libc/dl-malloc/Makefile:1.2 Sun Dec 17 20:26:37 1995 --- linux/libc/dl-malloc/Makefile Sat Jan 4 10:49:29 1997 *************** *** 12,18 **** INC_CFLAGS= -I. -I. -I. VSCFLAGS=-D_default_morecore=__default_morecore \ -D__MALLOC_0_RETURNS_NULL -D_morecore=__morecore ! VSCFLAGS=-D__MALLOC_0_RETURNS_NULL # -DDEBUG #PIC_OPT_CFLAGS=-O -g -DDEBUG BASE_CFLAGS := $(BASE_CFLAGS) $(VSCFLAGS) --- 12,18 ---- INC_CFLAGS= -I. -I. -I. VSCFLAGS=-D_default_morecore=__default_morecore \ -D__MALLOC_0_RETURNS_NULL -D_morecore=__morecore ! VSCFLAGS=-DMALLOC_HOOKS # -DDEBUG #PIC_OPT_CFLAGS=-O -g -DDEBUG BASE_CFLAGS := $(BASE_CFLAGS) $(VSCFLAGS) Index: linux/libc/dl-malloc/malloc.c diff -c linux/libc/dl-malloc/malloc.c:1.8 linux/libc/dl-malloc/malloc.c:1.10 *** linux/libc/dl-malloc/malloc.c:1.8 Fri Oct 4 15:52:49 1996 --- linux/libc/dl-malloc/malloc.c Fri Feb 14 19:38:14 1997 *************** *** 1,16 **** /* ---------- To make a malloc.h, start cutting here ------------ */ ! /* ! A version of malloc/free/realloc written by Doug Lea and released to the public domain. Send questions/comments/complaints/performance data to dl@cs.oswego.edu ! * VERSION 2.6.3f Sun Jun 2 17:39:38 1996 Doug Lea (dl at gee) ! Note: There may be an updated version of this malloc obtainable at ftp://g.oswego.edu/pub/misc/malloc.c Check before installing! * Synopsis of public routines (Much fuller descriptions are contained in the program documentation below.) --- 1,25 ---- /* ---------- To make a malloc.h, start cutting here ------------ */ ! /* ! A version of malloc/free/realloc written by Doug Lea and released to the public domain. Send questions/comments/complaints/performance data to dl@cs.oswego.edu ! * VERSION 2.6.4 Thu Nov 28 07:54:55 1996 Doug Lea (dl at gee) ! Note: There may be an updated version of this malloc obtainable at ftp://g.oswego.edu/pub/misc/malloc.c Check before installing! + * Why use this malloc? + + This is not the fastest, most space-conserving, most portable, or + most tunable malloc ever written. However it is among the fastest + while also being among the most space-conserving, portable and tunable. + Consistent balance across these factors results in a good general-purpose + allocator. For a high-level description, see + http://g.oswego.edu/dl/html/malloc.html + * Synopsis of public routines (Much fuller descriptions are contained in the program documentation below.) *************** *** 35,47 **** Equivalent to memalign(pagesize, n), where pagesize is the page size of the system (or as near to this as can be figured out from all the includes/defines below.) calloc(size_t unit, size_t quantity); Returns a pointer to quantity * unit bytes, with all locations set to zero. cfree(Void_t* p); Equivalent to free(p). malloc_trim(size_t pad); ! Release all but pad bytes of freed top-most memory back to the system. Return 1 if successful, else 0. malloc_usable_size(Void_t* p); Report the number usable allocated bytes associated with allocated --- 44,59 ---- Equivalent to memalign(pagesize, n), where pagesize is the page size of the system (or as near to this as can be figured out from all the includes/defines below.) + pvalloc(size_t n); + Equivalent to valloc(minimum-page-that-holds(n)), that is, + round up n to nearest pagesize. calloc(size_t unit, size_t quantity); Returns a pointer to quantity * unit bytes, with all locations set to zero. cfree(Void_t* p); Equivalent to free(p). malloc_trim(size_t pad); ! Release all but pad bytes of freed top-most memory back to the system. Return 1 if successful, else 0. malloc_usable_size(Void_t* p); Report the number usable allocated bytes associated with allocated *************** *** 58,98 **** * Vital statistics: Alignment: 8-byte - 8 byte alignment is currently hardwired into the design. This seems to suffice for all current machines and C compilers. ! Assumed pointer representation: 4 bytes ! Assumed size_t representation: 4 bytes ! Minimum overhead per allocated chunk: 4 bytes Each malloced chunk has a hidden overhead of 4 bytes holding size ! and status information. ! Minimum allocated size: 16 bytes (12 bytes usable, 4 overhead) ! When a chunk is freed, 12 additional bytes are needed; 4 for a ! trailing size field and 8 bytes for free list pointers. Thus, ! the minimum allocatable size is 16 bytes, of which 12 bytes are ! usable. Even a request for zero bytes (i.e., malloc(0)) returns ! a pointer to something of the minimum allocatable size. ! Maximum allocated size: 2147483640 (2^31 - 8) bytes ! It is assumed that (possibly signed) 32 bit values suffice to represent chunk sizes. `Possibly signed' is due to the fact that `size_t' may be defined on a system as either a signed or an unsigned type. To be conservative, values that would appear ! as negative numbers are avoided. The maximum size chunk is ! 2^31 - 8 bytes. Requests for negative sizes (when size_t is ! signed) or those greater than (2^31 - 8) bytes will return a minimum-sized chunk. Maximum overhead wastage per allocated chunk: normally 15 bytes ! Alignnment demands, plus the minimum allocatable size restriction make the normal worst-case wastage 15 bytes (i.e., up to 15 ! more bytes will be allocated than were requested in malloc), with two exceptions: 1. Because requests for zero bytes allocate non-zero space, the worst case wastage for a request of zero bytes is 24 bytes. --- 70,118 ---- * Vital statistics: Alignment: 8-byte 8 byte alignment is currently hardwired into the design. This seems to suffice for all current machines and C compilers. ! Assumed pointer representation: 4 or 8 bytes ! Code for 8-byte pointers is untested by me but has worked ! reliably by Wolfram Gloger, who contributed most of the ! changes supporting this. + Assumed size_t representation: 4 or 8 bytes + Note that size_t is allowed to be 4 bytes even if pointers are 8. + + Minimum overhead per allocated chunk: 4 or 8 bytes Each malloced chunk has a hidden overhead of 4 bytes holding size ! and status information. ! ! Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead) ! 8-byte ptrs: 24/32 bytes (including, 4/8 overhead) ! When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte ! ptrs but 4 byte size) or 24 (for 8/8) additional bytes are ! needed; 4 (8) for a trailing size field ! and 8 (16) bytes for free list pointers. Thus, the minimum ! allocatable size is 16/24/32 bytes. ! Even a request for zero bytes (i.e., malloc(0)) returns a ! pointer to something of the minimum allocatable size. ! Maximum allocated size: 4-byte size_t: 2^31 - 8 bytes ! 8-byte size_t: 2^63 - 16 bytes ! It is assumed that (possibly signed) size_t bit values suffice to represent chunk sizes. `Possibly signed' is due to the fact that `size_t' may be defined on a system as either a signed or an unsigned type. To be conservative, values that would appear ! as negative numbers are avoided. ! Requests for sizes with a negative sign bit will return a minimum-sized chunk. Maximum overhead wastage per allocated chunk: normally 15 bytes ! Alignment demands, plus the minimum allocatable size restriction make the normal worst-case wastage 15 bytes (i.e., up to 15 ! more bytes will be allocated than were requested in malloc), with two exceptions: 1. Because requests for zero bytes allocate non-zero space, the worst case wastage for a request of zero bytes is 24 bytes. *************** *** 104,111 **** Here are some features that are NOT currently supported - * No support for 64-bit pointers. - * No user-definable hooks for callbacks and the like. * No automated mechanism for fully checking that all accesses to malloced memory stay within their bounds. * No support for compaction. --- 124,129 ---- *************** *** 115,121 **** People have reported using previous versions of this malloc on all versions of Unix, sometimes by tweaking some of the defines below. It has been tested most extensively on Solaris and ! Linux. People have also reported adapting this malloc for use in stand-alone embedded systems. The implementation is in straight, hand-tuned ANSI C. Among other --- 133,140 ---- People have reported using previous versions of this malloc on all versions of Unix, sometimes by tweaking some of the defines below. It has been tested most extensively on Solaris and ! Linux. It is also reported to work on WIN32 platforms. ! People have also reported adapting this malloc for use in stand-alone embedded systems. The implementation is in straight, hand-tuned ANSI C. Among other *************** *** 128,162 **** Nonzero if using ANSI-standard C compiler, a C++ compiler, or a C compiler sufficiently close to ANSI to get away with it. DEBUG (default: NOT defined) ! Define to enable debugging. Adds fairly extensive assertion-based checking to help track down memory errors, but noticeably slows down execution. ! REALLOC_ZERO_BYTES_FREES (default: NOT defined) Define this if you think that realloc(p, 0) should be equivalent to free(p). Otherwise, since malloc returns a unique pointer for malloc(0), so does realloc(p, 0). HAVE_MEMCPY (default: defined) ! Define if you are not otherwise using ANSI STD C, but still have memcpy and memset in your C library and want to use them. Otherwise, simple internal versions are supplied. HAVE_MMAP (default: defined as 1) Define to non-zero to optionally make malloc() use mmap() to ! allocate very large blocks. HAVE_MREMAP (default: defined as 0 unless Linux libc set) Define to non-zero to optionally make realloc() use mremap() to ! reallocate very large blocks. malloc_getpagesize (default: derived from system #includes) Either a constant or routine call returning the system page size. ! HAVE_USR_INCLUDE_MALLOC_H (default: NOT defined) Optionally define if you are on a system with a /usr/include/malloc.h that declares struct mallinfo. It is not at all necessary to define this even if you do, but will ensure consistency. INTERNAL_LINUX_C_LIB (default: NOT defined) Defined only when compiled as part of Linux libc. ! Also note that there is some odd internal name-magling via defines (for example, internally, `malloc' is named `mALLOc') needed when compiling in this case. These look funny but don't otherwise affect anything. MORECORE (default: sbrk) The name of the routine to call to obtain more memory from the system. MORECORE_FAILURE (default: -1) --- 147,198 ---- Nonzero if using ANSI-standard C compiler, a C++ compiler, or a C compiler sufficiently close to ANSI to get away with it. DEBUG (default: NOT defined) ! Define to enable debugging. Adds fairly extensive assertion-based checking to help track down memory errors, but noticeably slows down execution. ! MALLOC_HOOKS (default: NOT defined) ! Define to enable support run-time replacement of the allocation ! functions through user-defined `hooks'. ! REALLOC_ZERO_BYTES_FREES (default: NOT defined) Define this if you think that realloc(p, 0) should be equivalent to free(p). Otherwise, since malloc returns a unique pointer for malloc(0), so does realloc(p, 0). HAVE_MEMCPY (default: defined) ! Define if you are not otherwise using ANSI STD C, but still have memcpy and memset in your C library and want to use them. Otherwise, simple internal versions are supplied. + USE_MEMCPY (default: 1 if HAVE_MEMCPY is defined, 0 otherwise) + Define as 1 if you want the C library versions of memset and + memcpy called in realloc and calloc (otherwise macro versions are used). + At least on some platforms, the simple macro versions usually + outperform libc versions. HAVE_MMAP (default: defined as 1) Define to non-zero to optionally make malloc() use mmap() to ! allocate very large blocks. HAVE_MREMAP (default: defined as 0 unless Linux libc set) Define to non-zero to optionally make realloc() use mremap() to ! reallocate very large blocks. malloc_getpagesize (default: derived from system #includes) Either a constant or routine call returning the system page size. ! HAVE_USR_INCLUDE_MALLOC_H (default: NOT defined) Optionally define if you are on a system with a /usr/include/malloc.h that declares struct mallinfo. It is not at all necessary to define this even if you do, but will ensure consistency. + INTERNAL_SIZE_T (default: size_t) + Define to a 32-bit type (probably `unsigned int') if you are on a + 64-bit machine, yet do not want or need to allow malloc requests of + greater than 2^31 to be handled. This saves space, especially for + very small chunks. INTERNAL_LINUX_C_LIB (default: NOT defined) Defined only when compiled as part of Linux libc. ! Also note that there is some odd internal name-mangling via defines (for example, internally, `malloc' is named `mALLOc') needed when compiling in this case. These look funny but don't otherwise affect anything. + WIN32 (default: undefined) + Define this on MS win (95, nt) platforms to compile in sbrk emulation. + LACKS_UNISTD_H (default: undefined) + Define this if your system does not have a . MORECORE (default: sbrk) The name of the routine to call to obtain more memory from the system. MORECORE_FAILURE (default: -1) *************** *** 165,178 **** True (1) if the routine mapped to MORECORE zeroes out memory (which holds for sbrk). DEFAULT_TRIM_THRESHOLD ! DEFAULT_TOP_PAD DEFAULT_MMAP_THRESHOLD ! DEFAULT_MMAP_MAX Default values of tunable parameters (described in detail below) controlling interaction with host system routines (sbrk, mmap, etc). These values may also be changed dynamically via mallopt(). The preset defaults are those that give best performance for typical programs/systems. */ --- 201,218 ---- True (1) if the routine mapped to MORECORE zeroes out memory (which holds for sbrk). DEFAULT_TRIM_THRESHOLD ! DEFAULT_TOP_PAD DEFAULT_MMAP_THRESHOLD ! DEFAULT_MMAP_MAX Default values of tunable parameters (described in detail below) controlling interaction with host system routines (sbrk, mmap, etc). These values may also be changed dynamically via mallopt(). The preset defaults are those that give best performance for typical programs/systems. + DEFAULT_CHECK_ACTION + When the standard debugging hooks are in place, and a pointer is + detected as corrupt, do nothing (0), print an error message (1), + or call abort() (2). */ *************** *** 203,211 **** #endif /*Void_t*/ #if __STD_C ! #include /* for size_t */ #else ! #include #endif #ifdef __cplusplus --- 243,254 ---- #endif /*Void_t*/ #if __STD_C ! # include /* for size_t */ ! # if defined(MALLOC_HOOKS) ! # include /* for getenv(), abort() */ ! # endif #else ! # include #endif #ifdef __cplusplus *************** *** 235,262 **** checking is fairly extensive, and will slow down execution noticeably. Calling malloc_stats or mallinfo with DEBUG set will attempt to check every non-mmapped allocated and free chunk in the ! course of computing the summmaries. (By nature, mmapped regions cannot be checked very much automatically.) ! Setting DEBUG may also be helpful if you are trying to modify ! this code. The assertions in the check routines spell out in more detail the assumptions and invariants underlying the algorithms. */ ! #if DEBUG #include #else #define assert(x) ((void)0) #endif /* REALLOC_ZERO_BYTES_FREES should be set if a call to realloc with zero bytes should be the same as a call to free. Some people think it should. Otherwise, since this malloc ! returns a unique pointer for malloc(0), so does realloc(p, 0). */ --- 278,317 ---- checking is fairly extensive, and will slow down execution noticeably. Calling malloc_stats or mallinfo with DEBUG set will attempt to check every non-mmapped allocated and free chunk in the ! course of computing the summaries. (By nature, mmapped regions cannot be checked very much automatically.) ! Setting DEBUG may also be helpful if you are trying to modify ! this code. The assertions in the check routines spell out in more detail the assumptions and invariants underlying the algorithms. */ ! #if DEBUG #include #else #define assert(x) ((void)0) #endif + /* + INTERNAL_SIZE_T is the word-size used for internal bookkeeping + of chunk sizes. On a 64-bit machine, you can reduce malloc + overhead by defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' + at the expense of not being able to handle requests greater than + 2^31. This limitation is hardly ever a concern; you are encouraged + to set this. However, the default version is the same as size_t. + */ + + #ifndef INTERNAL_SIZE_T + #define INTERNAL_SIZE_T size_t + #endif /* REALLOC_ZERO_BYTES_FREES should be set if a call to realloc with zero bytes should be the same as a call to free. Some people think it should. Otherwise, since this malloc ! returns a unique pointer for malloc(0), so does realloc(p, 0). */ *************** *** 264,306 **** /* HAVE_MEMCPY should be defined if you are not otherwise using ANSI STD C, but still have memcpy and memset in your C library and want to use them in calloc and realloc. Otherwise simple macro versions are defined here. */ ! #define HAVE_MEMCPY ! #if __STD_C || defined(HAVE_MEMCPY) void* memset(void*, int, size_t); void* memcpy(void*, const void*, size_t); ! #define MALLOC_ZERO(charp, nbytes) memset(charp, 0, nbytes) ! #define MALLOC_COPY(dest,src,nbytes) memcpy((dest), (src), (nbytes)) ! #else ! /* We only invoke with multiples of size_t units, with size_t alignment */ #define MALLOC_ZERO(charp, nbytes) \ ! { \ ! size_t* mzp = (size_t*)(charp); \ ! size_t mzn = (nbytes) / sizeof(size_t); \ ! while (mzn-- > 0) *mzp++ = 0; \ ! } #define MALLOC_COPY(dest,src,nbytes) \ ! { \ ! size_t* mcsrc = (size_t*) src; \ ! size_t* mcdst = (size_t*) dest; \ ! long mcn = (nbytes) / sizeof(size_t); \ ! while (mcn-- > 0) *mcdst++ = *mcsrc++; \ ! } #endif /* Define HAVE_MMAP to optionally make malloc() use mmap() to allocate very large blocks. These will be returned to the --- 319,452 ---- /* + WIN32 causes an emulation of sbrk to be compiled in + mmap-based options are not currently supported in WIN32. + */ + + /* #define WIN32 */ + #ifdef WIN32 + #define MORECORE wsbrk + #define HAVE_MMAP 0 + #endif + + + /* HAVE_MEMCPY should be defined if you are not otherwise using ANSI STD C, but still have memcpy and memset in your C library and want to use them in calloc and realloc. Otherwise simple macro versions are defined here. + + USE_MEMCPY should be defined as 1 if you actually want to + have memset and memcpy called. People report that the macro + versions are often enough faster than libc versions on many + systems that it is better to use them. + */ ! #define HAVE_MEMCPY ! #ifndef USE_MEMCPY ! #ifdef HAVE_MEMCPY ! #define USE_MEMCPY 1 ! #else ! #define USE_MEMCPY 0 ! #endif ! #endif + #if (__STD_C || defined(HAVE_MEMCPY)) + + #if __STD_C void* memset(void*, int, size_t); void* memcpy(void*, const void*, size_t); + #else + Void_t* memset(); + Void_t* memcpy(); + #endif + #endif ! #if USE_MEMCPY ! /* The following macros are only invoked with (2n+1)-multiples of ! INTERNAL_SIZE_T units, with a positive integer n. This is exploited ! for fast inline execution when n is small. */ ! #define MALLOC_ZERO(charp, nbytes) \ ! do { \ ! INTERNAL_SIZE_T mzsz = (nbytes); \ ! if(mzsz <= 9*sizeof(mzsz)) { \ ! INTERNAL_SIZE_T* mz = (INTERNAL_SIZE_T*) (charp); \ ! if(mzsz >= 5*sizeof(mzsz)) { *mz++ = 0; \ ! *mz++ = 0; \ ! if(mzsz >= 7*sizeof(mzsz)) { *mz++ = 0; \ ! *mz++ = 0; \ ! if(mzsz >= 9*sizeof(mzsz)) { *mz++ = 0; \ ! *mz++ = 0; }}} \ ! *mz++ = 0; \ ! *mz++ = 0; \ ! *mz = 0; \ ! } else memset((charp), 0, mzsz); \ ! } while(0) ! ! #define MALLOC_COPY(dest,src,nbytes) \ ! do { \ ! INTERNAL_SIZE_T mcsz = (nbytes); \ ! if(mcsz <= 9*sizeof(mcsz)) { \ ! INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) (src); \ ! INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) (dest); \ ! if(mcsz >= 5*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ ! *mcdst++ = *mcsrc++; \ ! if(mcsz >= 7*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ ! *mcdst++ = *mcsrc++; \ ! if(mcsz >= 9*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \ ! *mcdst++ = *mcsrc++; }}} \ ! *mcdst++ = *mcsrc++; \ ! *mcdst++ = *mcsrc++; \ ! *mcdst = *mcsrc ; \ ! } else memcpy(dest, src, mcsz); \ ! } while(0) ! ! #else /* !USE_MEMCPY */ ! ! /* Use Duff's device for good zeroing/copying performance. */ #define MALLOC_ZERO(charp, nbytes) \ ! do { \ ! INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \ ! long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ ! if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ ! switch (mctmp) { \ ! case 0: for(;;) { *mzp++ = 0; \ ! case 7: *mzp++ = 0; \ ! case 6: *mzp++ = 0; \ ! case 5: *mzp++ = 0; \ ! case 4: *mzp++ = 0; \ ! case 3: *mzp++ = 0; \ ! case 2: *mzp++ = 0; \ ! case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \ ! } \ ! } while(0) #define MALLOC_COPY(dest,src,nbytes) \ ! do { \ ! INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \ ! INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \ ! long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \ ! if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ ! switch (mctmp) { \ ! case 0: for(;;) { *mcdst++ = *mcsrc++; \ ! case 7: *mcdst++ = *mcsrc++; \ ! case 6: *mcdst++ = *mcsrc++; \ ! case 5: *mcdst++ = *mcsrc++; \ ! case 4: *mcdst++ = *mcsrc++; \ ! case 3: *mcdst++ = *mcsrc++; \ ! case 2: *mcdst++ = *mcsrc++; \ ! case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \ ! } \ ! } while(0) #endif + /* Define HAVE_MMAP to optionally make malloc() use mmap() to allocate very large blocks. These will be returned to the *************** *** 318,324 **** */ #ifndef HAVE_MREMAP ! #ifdef INTERNAL_LINUX_C_LIB #define HAVE_MREMAP 1 #else #define HAVE_MREMAP 0 --- 464,470 ---- */ #ifndef HAVE_MREMAP ! #ifdef __linux__ #define HAVE_MREMAP 1 #else #define HAVE_MREMAP 0 *************** *** 340,380 **** /* Access to system page size. To the extent possible, this malloc manages memory from the system in page-size units. ! ! The following mechanics for getpagesize were adapted from ! bsd/gnu getpagesize.h */ #ifndef malloc_getpagesize ! #if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) ! extern size_t getpagesize(); ! # define malloc_getpagesize getpagesize() ! #else ! # include ! # ifdef EXEC_PAGESIZE ! # define malloc_getpagesize EXEC_PAGESIZE # else ! # ifdef NBPG ! # ifndef CLSIZE ! # define malloc_getpagesize NBPG # else ! # define malloc_getpagesize (NBPG * CLSIZE) ! # endif ! # else ! # ifdef NBPC ! # define malloc_getpagesize NBPC ! # else ! # ifdef PAGESIZE ! # define malloc_getpagesize PAGESIZE # else ! # define malloc_getpagesize (4096) /* just guess */ # endif # endif ! # endif # endif - #endif #endif /* This version of malloc supports the standard SVID/XPG mallinfo --- 486,541 ---- /* Access to system page size. To the extent possible, this malloc manages memory from the system in page-size units. ! ! The following mechanics for getpagesize were adapted from ! bsd/gnu getpagesize.h */ + #ifndef LACKS_UNISTD_H + # include + #endif + #ifndef malloc_getpagesize ! # ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ ! # ifndef _SC_PAGE_SIZE ! # define _SC_PAGE_SIZE _SC_PAGESIZE ! # endif ! # endif ! # ifdef _SC_PAGE_SIZE ! # define malloc_getpagesize sysconf(_SC_PAGE_SIZE) # else ! # if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) ! extern size_t getpagesize(); ! # define malloc_getpagesize getpagesize() ! # else ! # include ! # ifdef EXEC_PAGESIZE ! # define malloc_getpagesize EXEC_PAGESIZE # else ! # ifdef NBPG ! # ifndef CLSIZE ! # define malloc_getpagesize NBPG ! # else ! # define malloc_getpagesize (NBPG * CLSIZE) ! # endif # else ! # ifdef NBPC ! # define malloc_getpagesize NBPC ! # else ! # ifdef PAGESIZE ! # define malloc_getpagesize PAGESIZE ! # else ! # define malloc_getpagesize (4096) /* just guess */ ! # endif ! # endif # endif # endif ! # endif # endif #endif + + /* This version of malloc supports the standard SVID/XPG mallinfo *************** *** 419,425 **** int uordblks; /* total allocated space */ int fordblks; /* total non-inuse space */ int keepcost; /* top-most, releasable (via malloc_trim) space */ ! }; /* SVID2/XPG mallopt options */ --- 580,586 ---- int uordblks; /* total allocated space */ int fordblks; /* total non-inuse space */ int keepcost; /* top-most, releasable (via malloc_trim) space */ ! }; /* SVID2/XPG mallopt options */ *************** *** 436,441 **** --- 597,603 ---- #define M_TOP_PAD -2 #define M_MMAP_THRESHOLD -3 #define M_MMAP_MAX -4 + #define M_CHECK_ACTION -5 *************** *** 444,450 **** #endif /* ! M_TRIM_THRESHOLD is the maximum amount of unused top-most memory to keep before releasing via malloc_trim in free(). Automatic trimming is mainly useful in long-lived programs. --- 606,612 ---- #endif /* ! M_TRIM_THRESHOLD is the maximum amount of unused top-most memory to keep before releasing via malloc_trim in free(). Automatic trimming is mainly useful in long-lived programs. *************** *** 452,458 **** sometimes be wasteful (in cases where programs immediately afterward allocate more large chunks) the value should be high enough so that your overall system performance would improve by ! releasing. The trim threshold and the mmap control parameters (see below) can be traded off with one another. Trimming and mmapping are --- 614,620 ---- sometimes be wasteful (in cases where programs immediately afterward allocate more large chunks) the value should be high enough so that your overall system performance would improve by ! releasing. The trim threshold and the mmap control parameters (see below) can be traded off with one another. Trimming and mmapping are *************** *** 462,475 **** minimum. For example, in one test suite of sessions measuring the XF86 X server on Linux, using a trim threshold of 128K and a mmap threshold of 192K led to near-minimal long term resource ! consumption. If you are using this malloc in a long-lived program, it should pay to experiment with these values. As a rough guide, you might set to a value close to the average size of a process (program) running on your system. Releasing this much memory would allow such a process to run in memory. Generally, it's ! worth it to tune for trimming rather tham memory mapping when a program undergoes phases where several large chunks are allocated and released in ways that can reuse each other's storage, perhaps mixed with phases where there are no such --- 624,637 ---- minimum. For example, in one test suite of sessions measuring the XF86 X server on Linux, using a trim threshold of 128K and a mmap threshold of 192K led to near-minimal long term resource ! consumption. If you are using this malloc in a long-lived program, it should pay to experiment with these values. As a rough guide, you might set to a value close to the average size of a process (program) running on your system. Releasing this much memory would allow such a process to run in memory. Generally, it's ! worth it to tune for trimming rather than memory mapping when a program undergoes phases where several large chunks are allocated and released in ways that can reuse each other's storage, perhaps mixed with phases where there are no such *************** *** 498,504 **** #endif /* ! M_TOP_PAD is the amount of extra `padding' space to allocate or retain whenever sbrk is called. It is used in two ways internally: * When sbrk is called to extend the top of the arena to satisfy --- 660,666 ---- #endif /* ! M_TOP_PAD is the amount of extra `padding' space to allocate or retain whenever sbrk is called. It is used in two ways internally: * When sbrk is called to extend the top of the arena to satisfy *************** *** 508,526 **** * When malloc_trim is called automatically from free(), it is used as the `pad' argument. ! In both cases, the actual amount of padding is rounded so that the end of the arena is always a system page boundary. The main reason for using padding is to avoid calling sbrk so often. Having even a small pad greatly reduces the likelihood that nearly every malloc request during program start-up (or after trimming) will invoke sbrk, which needlessly wastes ! time. Automatic rounding-up to page-size units is normally sufficient to avoid measurable overhead, so the default is 0. However, in systems where sbrk is relatively slow, it can pay to increase ! this value, at the expense of carrying around more memory than the program needs. */ --- 670,688 ---- * When malloc_trim is called automatically from free(), it is used as the `pad' argument. ! In both cases, the actual amount of padding is rounded so that the end of the arena is always a system page boundary. The main reason for using padding is to avoid calling sbrk so often. Having even a small pad greatly reduces the likelihood that nearly every malloc request during program start-up (or after trimming) will invoke sbrk, which needlessly wastes ! time. Automatic rounding-up to page-size units is normally sufficient to avoid measurable overhead, so the default is 0. However, in systems where sbrk is relatively slow, it can pay to increase ! this value, at the expense of carrying around more memory than the program needs. */ *************** *** 532,540 **** /* ! M_MMAP_THRESHOLD is the request size threshold for using mmap() ! to service a request. Requests of at least this size that cannot ! be allocated using already-existing space will be serviced via mmap. (If enough normal freed space already exists it is used instead.) Using mmap segregates relatively large chunks of memory so that --- 694,702 ---- /* ! M_MMAP_THRESHOLD is the request size threshold for using mmap() ! to service a request. Requests of at least this size that cannot ! be allocated using already-existing space will be serviced via mmap. (If enough normal freed space already exists it is used instead.) Using mmap segregates relatively large chunks of memory so that *************** *** 553,559 **** However, it has the disadvantages that: 1. The space cannot be reclaimed, consolidated, and then ! used to service later requests, as happens with normal chunks. 2. It can lead to more wastage because of mmap page alignment requirements 3. It causes malloc performance to be more dependent on host --- 715,721 ---- However, it has the disadvantages that: 1. The space cannot be reclaimed, consolidated, and then ! used to service later requests, as happens with normal chunks. 2. It can lead to more wastage because of mmap page alignment requirements 3. It causes malloc performance to be more dependent on host *************** *** 563,569 **** malloc steps is faster than going through a system's mmap. All together, these considerations should lead you to use mmap ! only for relatively large requests. */ --- 725,731 ---- malloc steps is faster than going through a system's mmap. All together, these considerations should lead you to use mmap ! only for relatively large requests. */ *************** *** 579,585 **** #endif /* ! M_MMAP_MAX is the maximum number of requests to simultaneously service using mmap. This parameter exists because: 1. Some systems have a limited number of internal tables for --- 741,747 ---- #endif /* ! M_MMAP_MAX is the maximum number of requests to simultaneously service using mmap. This parameter exists because: 1. Some systems have a limited number of internal tables for *************** *** 599,605 **** ! /* Special defines for linux libc --- 761,777 ---- ! #ifndef DEFAULT_CHECK_ACTION ! #define DEFAULT_CHECK_ACTION 1 ! #endif ! ! /* What to do if the standard debugging hooks are in place and a ! corrupt pointer is detected: do nothing (0), print an error message ! (1), or call abort() (2). */ ! ! ! ! /* Special defines for linux libc *************** *** 631,637 **** #define MORECORE (*__morecore) #define MORECORE_FAILURE 0 ! #define MORECORE_CLEARS 1 #else /* INTERNAL_LINUX_C_LIB */ --- 803,819 ---- #define MORECORE (*__morecore) #define MORECORE_FAILURE 0 ! #define MORECORE_CLEARS 1 ! #define mmap __mmap ! #define munmap __munmap ! #define mremap __mremap ! #undef malloc_getpagesize ! #define malloc_getpagesize __getpagesize() ! ! /* Linux libc 5.4.x lacks prototypes for the `__' versions. */ ! extern __ptr_t __mmap __P((__ptr_t, size_t, int, int, int, off_t)); ! extern int __munmap __P((__ptr_t, size_t)); ! extern __ptr_t __mremap __P((__ptr_t, size_t, size_t, int)); #else /* INTERNAL_LINUX_C_LIB */ *************** *** 663,670 **** --- 845,856 ---- #define mEMALIGn __libc_memalign #define rEALLOc __libc_realloc #define vALLOc __libc_valloc + #define pvALLOc __libc_pvalloc #define mALLINFo __libc_mallinfo #define mALLOPt __libc_mallopt + #define mALLOC_TRIm __malloc_trim + #define mALLOC_USABLE_SIZe __malloc_usable_size + #define mALLOC_STATs __malloc_stats #pragma weak calloc = __libc_calloc #pragma weak free = __libc_free *************** *** 673,680 **** --- 859,870 ---- #pragma weak memalign = __libc_memalign #pragma weak realloc = __libc_realloc #pragma weak valloc = __libc_valloc + #pragma weak pvalloc = __libc_pvalloc #pragma weak mallinfo = __libc_mallinfo #pragma weak mallopt = __libc_mallopt + #pragma weak malloc_trim = __malloc_trim + #pragma weak malloc_usable_size = __malloc_usable_size + #pragma weak malloc_stats = __malloc_stats #else *************** *** 684,691 **** --- 874,885 ---- #define mEMALIGn memalign #define rEALLOc realloc #define vALLOc valloc + #define pvALLOc pvalloc #define mALLINFo mallinfo #define mALLOPt mallopt + #define mALLOC_TRIm malloc_trim + #define mALLOC_USABLE_SIZe malloc_usable_size + #define mALLOC_STATs malloc_stats #endif *************** *** 698,725 **** Void_t* rEALLOc(Void_t*, size_t); Void_t* mEMALIGn(size_t, size_t); Void_t* vALLOc(size_t); Void_t* cALLOc(size_t, size_t); void cfree(Void_t*); ! int malloc_trim(size_t); ! size_t malloc_usable_size(Void_t*); ! void malloc_stats(void); int mALLOPt(int, int); struct mallinfo mALLINFo(void); ! #else Void_t* mALLOc(); void fREe(); Void_t* rEALLOc(); Void_t* mEMALIGn(); Void_t* vALLOc(); Void_t* cALLOc(); void cfree(); ! int malloc_trim(); ! size_t malloc_usable_size(); ! void malloc_stats(); int mALLOPt(); struct mallinfo mALLINFo(); #endif #ifdef __cplusplus }; /* end of extern "C" */ --- 892,946 ---- Void_t* rEALLOc(Void_t*, size_t); Void_t* mEMALIGn(size_t, size_t); Void_t* vALLOc(size_t); + Void_t* pvALLOc(size_t); Void_t* cALLOc(size_t, size_t); void cfree(Void_t*); ! int mALLOC_TRIm(size_t); ! size_t mALLOC_USABLE_SIZe(Void_t*); ! void mALLOC_STATs(); int mALLOPt(int, int); struct mallinfo mALLINFo(void); ! ! #if defined(MALLOC_HOOKS) ! /* Hooks for debugging versions. */ ! extern void (*__malloc_initialize_hook) (void); ! extern void (*__free_hook) (Void_t* __ptr); ! extern Void_t* (*__malloc_hook) (size_t __size); ! extern Void_t* (*__realloc_hook) (Void_t* __ptr, size_t __size); ! extern Void_t* (*__memalign_hook) (size_t __size, size_t __alignment); ! /* Activate a standard set of debugging hooks. */ ! extern void __malloc_check_init (void); ! #endif ! ! #else /* !__STD_C */ ! Void_t* mALLOc(); void fREe(); Void_t* rEALLOc(); Void_t* mEMALIGn(); Void_t* vALLOc(); + Void_t* pvALLOc(); Void_t* cALLOc(); void cfree(); ! int mALLOC_TRIm(); ! size_t mALLOC_USABLE_SIZe(); ! void mALLOC_STATs(); int mALLOPt(); struct mallinfo mALLINFo(); + + #if defined(MALLOC_HOOKS) + /* Hooks for debugging versions. */ + extern void (*__malloc_initialize_hook) (); + extern void (*__free_hook) (); + extern Void_t* (*__malloc_hook) (); + extern Void_t* (*__realloc_hook) (); + extern Void_t* (*__memalign_hook) (); + /* Activate a standard set of debugging hooks. */ + extern void __malloc_check_init (); #endif + #endif /* __STD_C */ + #ifdef __cplusplus }; /* end of extern "C" */ *************** *** 728,733 **** --- 949,1119 ---- /* ---------- To make a malloc.h, end cutting here ------------ */ + /* + Emulation of sbrk for WIN32 + All code within the ifdef WIN32 is untested by me. + */ + + + #ifdef WIN32 + + #define AlignPage(add) (((add) + (malloc_getpagesize-1)) & + ~(malloc_getpagesize-1)) + + /* resrve 64MB to insure large contiguous space */ + #define RESERVED_SIZE (1024*1024*64) + #define NEXT_SIZE (2048*1024) + #define TOP_MEMORY ((unsigned long)2*1024*1024*1024) + + struct GmListElement; + typedef struct GmListElement GmListElement; + + struct GmListElement + { + GmListElement* next; + void* base; + }; + + static GmListElement* head = 0; + static unsigned int gNextAddress = 0; + static unsigned int gAddressBase = 0; + static unsigned int gAllocatedSize = 0; + + static + GmListElement* makeGmListElement (void* bas) + { + GmListElement* this; + this = (GmListElement*)(void*)LocalAlloc (0, sizeof (GmListElement)); + ASSERT (this); + if (this) + { + this->base = bas; + this->next = head; + head = this; + } + return this; + } + + void gcleanup () + { + BOOL rval; + ASSERT ( (head == NULL) || (head->base == (void*)gAddressBase)); + if (gAddressBase && (gNextAddress - gAddressBase)) + { + rval = VirtualFree ((void*)gAddressBase, + gNextAddress - gAddressBase, + MEM_DECOMMIT); + ASSERT (rval); + } + while (head) + { + GmListElement* next = head->next; + rval = VirtualFree (head->base, 0, MEM_RELEASE); + ASSERT (rval); + LocalFree (head); + head = next; + } + } + + static + void* findRegion (void* start_address, unsigned long size) + { + MEMORY_BASIC_INFORMATION info; + while ((unsigned long)start_address < TOP_MEMORY) + { + VirtualQuery (start_address, &info, sizeof (info)); + if (info.State != MEM_FREE) + start_address = (char*)info.BaseAddress + info.RegionSize; + else if (info.RegionSize >= size) + return start_address; + else + start_address = (char*)info.BaseAddress + info.RegionSize; + } + return NULL; + + } + + + void* wsbrk (long size) + { + void* tmp; + if (size > 0) + { + if (gAddressBase == 0) + { + gAllocatedSize = max (RESERVED_SIZE, AlignPage (size)); + gNextAddress = gAddressBase = + (unsigned int)VirtualAlloc (NULL, gAllocatedSize, + MEM_RESERVE, PAGE_NOACCESS); + } else if (AlignPage (gNextAddress + size) > (gAddressBase + + gAllocatedSize)) + { + long new_size = max (NEXT_SIZE, AlignPage (size)); + void* new_address = (void*)(gAddressBase+gAllocatedSize); + do + { + new_address = findRegion (new_address, new_size); + + if (new_address == 0) + return (void*)-1; + + gAddressBase = gNextAddress = + (unsigned int)VirtualAlloc (new_address, new_size, + MEM_RESERVE, PAGE_NOACCESS); + // repeat in case of race condition + // The region that we found has been snagged + // by another thread + } + while (gAddressBase == 0); + + ASSERT (new_address == (void*)gAddressBase); + + gAllocatedSize = new_size; + + if (!makeGmListElement ((void*)gAddressBase)) + return (void*)-1; + } + if ((size + gNextAddress) > AlignPage (gNextAddress)) + { + void* res; + res = VirtualAlloc ((void*)AlignPage (gNextAddress), + (size + gNextAddress - + AlignPage (gNextAddress)), + MEM_COMMIT, PAGE_READWRITE); + if (res == 0) + return (void*)-1; + } + tmp = (void*)gNextAddress; + gNextAddress = (unsigned int)tmp + size; + return tmp; + } + else if (size < 0) + { + unsigned int alignedGoal = AlignPage (gNextAddress + size); + /* Trim by releasing the virtual memory */ + if (alignedGoal >= gAddressBase) + { + VirtualFree ((void*)alignedGoal, gNextAddress - alignedGoal, + MEM_DECOMMIT); + gNextAddress = gNextAddress + size; + return (void*)gNextAddress; + } + else + { + VirtualFree ((void*)gAddressBase, gNextAddress - gAddressBase, + MEM_DECOMMIT); + gNextAddress = gAddressBase; + return (void*)-1; + } + } + else + { + return (void*)gNextAddress; + } + } + + #endif + /* *************** *** 737,746 **** struct malloc_chunk { ! size_t size; /* Size in bytes, including overhead. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; - size_t unused; /* fake decl to pad out to min chunk size */ }; typedef struct malloc_chunk* mchunkptr; --- 1123,1132 ---- struct malloc_chunk { ! INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */ ! INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; }; typedef struct malloc_chunk* mchunkptr; *************** *** 760,769 **** size fields also hold bits representing whether chunks are free or in use. ! An allocated chunk looks like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | User data starts here... . --- 1146,1157 ---- size fields also hold bits representing whether chunks are free or in use. ! An allocated chunk looks like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk, if allocated | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | User data starts here... . *************** *** 771,777 **** . (malloc_usable_space() bytes) . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! | Size of next chunk |1| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ --- 1159,1165 ---- . (malloc_usable_space() bytes) . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! | Size of chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ *************** *** 779,791 **** the malloc code, but "mem" is the pointer that is returned to the user. "Nextchunk" is the beginning of the next contiguous chunk. ! Chunks always begin on odd-word boundries, so the mem portion ! (which is returned to the user) is on an even word boundary, and thus double-word aligned. Free chunks are stored in circular doubly-linked lists, and look like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk in list | --- 1167,1181 ---- the malloc code, but "mem" is the pointer that is returned to the user. "Nextchunk" is the beginning of the next contiguous chunk. ! Chunks always begin on even word boundaries, so the mem portion ! (which is returned to the user) is also on an even word boundary, and thus double-word aligned. Free chunks are stored in circular doubly-linked lists, and look like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk in list | *************** *** 795,804 **** | Unused space (may be 0 bytes long) . . . . | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `foot:' | Size of chunk, in bytes | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! | Size of next chunk |0| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The P (PREV_INUSE) bit, stored in the unused low-order bit of the --- 1185,1192 ---- | Unused space (may be 0 bytes long) . . . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The P (PREV_INUSE) bit, stored in the unused low-order bit of the *************** *** 809,817 **** (The very first chunk allocated always has this bit set, preventing access to non-existent (or non-owned) memory.) ! The two exceptions to all this are ! 1. The special chunk `top', which doesn't bother using the trailing size field since there is no next contiguous chunk that would have to index off it. (After initialization, `top' is forced to always exist. If it would --- 1197,1209 ---- (The very first chunk allocated always has this bit set, preventing access to non-existent (or non-owned) memory.) ! Note that the `foot' of the current chunk is actually represented ! as the prev_size of the NEXT chunk. (This makes it easier to ! deal with alignments etc). ! The two exceptions to all this are ! ! 1. The special chunk `top', which doesn't bother using the trailing size field since there is no next contiguous chunk that would have to index off it. (After initialization, `top' is forced to always exist. If it would *************** *** 844,850 **** are taken from the back. This results in LRU or FIFO allocation order, which tends to give each chunk an equal opportunity to be consolidated with adjacent freed chunks, resulting in larger free ! chunks and less fragmentation. * `top': The top-most available chunk (i.e., the one bordering the end of available memory) is treated specially. It is never --- 1236,1242 ---- are taken from the back. This results in LRU or FIFO allocation order, which tends to give each chunk an equal opportunity to be consolidated with adjacent freed chunks, resulting in larger free ! chunks and less fragmentation. * `top': The top-most available chunk (i.e., the one bordering the end of available memory) is treated specially. It is never *************** *** 855,864 **** * `last_remainder': A bin holding only the remainder of the most recently split (non-top) chunk. This bin is checked before other non-fitting chunks, so as to provide better ! locality for runs of sequentially allocated chunks. * Implicitly, through the host system's memory mapping tables. ! If supported, requests greater than a threshold are usually serviced via calls to mmap, and then later released via munmap. */ --- 1247,1256 ---- * `last_remainder': A bin holding only the remainder of the most recently split (non-top) chunk. This bin is checked before other non-fitting chunks, so as to provide better ! locality for runs of sequentially allocated chunks. * Implicitly, through the host system's memory mapping tables. ! If supported, requests greater than a threshold are usually serviced via calls to mmap, and then later released via munmap. */ *************** *** 868,907 **** ! /* sizes, alignments */ ! #define SIZE_SZ (sizeof(size_t)) #define MALLOC_ALIGNMENT (SIZE_SZ + SIZE_SZ) #define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1) #define MINSIZE (sizeof(struct malloc_chunk)) /* conversion from malloc headers to user pointers, and back */ ! #define chunk2mem(p) ((Void_t*)((char*)(p) + SIZE_SZ)) ! #define mem2chunk(mem) ((mchunkptr)((char*)(mem) - SIZE_SZ)) /* pad request bytes into a usable size */ #define request2size(req) \ ! (((long)(req) < (long)(MINSIZE - SIZE_SZ)) ? MINSIZE : \ ! (((req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~(MALLOC_ALIGN_MASK))) ! /* Check if m has acceptable alignment */ ! #define aligned_OK(m) (((size_t)((m)) & (MALLOC_ALIGN_MASK)) == 0) ! /* ! Physical chunk operations */ /* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */ ! #define PREV_INUSE 0x1 /* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */ --- 1260,1299 ---- ! /* sizes, alignments */ ! #define SIZE_SZ (sizeof(INTERNAL_SIZE_T)) #define MALLOC_ALIGNMENT (SIZE_SZ + SIZE_SZ) #define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1) #define MINSIZE (sizeof(struct malloc_chunk)) /* conversion from malloc headers to user pointers, and back */ ! #define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ)) ! #define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ)) /* pad request bytes into a usable size */ #define request2size(req) \ ! (((long)((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \ ! (long)(MINSIZE + MALLOC_ALIGN_MASK)) ? MINSIZE : \ ! (((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) & ~(MALLOC_ALIGN_MASK))) /* Check if m has acceptable alignment */ ! #define aligned_OK(m) (((unsigned long)((m)) & (MALLOC_ALIGN_MASK)) == 0) ! /* ! Physical chunk operations */ /* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */ ! #define PREV_INUSE 0x1 /* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */ *************** *** 918,925 **** /* Ptr to previous physical malloc_chunk */ ! #define prev_chunk(p)\ ! ((mchunkptr)( ((char*)(p)) - *((size_t*)((char*)(p) - SIZE_SZ)))) /* Treat space at ptr + offset as a chunk */ --- 1310,1316 ---- /* Ptr to previous physical malloc_chunk */ ! #define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) )) /* Treat space at ptr + offset as a chunk */ *************** *** 929,936 **** ! /* ! Dealing with use bits */ /* extract p's inuse bit */ --- 1320,1327 ---- ! /* ! Dealing with use bits */ /* extract p's inuse bit */ *************** *** 968,975 **** ! /* ! Dealing with size fields */ /* Get size, ignoring use bits */ --- 1359,1366 ---- ! /* ! Dealing with size fields */ /* Get size, ignoring use bits */ *************** *** 986,996 **** /* Set size at footer (only when chunk is not in use) */ ! #define set_foot(p, s) (*((size_t*)((char*)(p) + (s) - SIZE_SZ)) = (s)) ! ! /* Get size of previous (but not inuse) chunk */ ! ! #define prev_size(p) (*((size_t*)((char*)(p) - SIZE_SZ))) --- 1377,1383 ---- /* Set size at footer (only when chunk is not in use) */ ! #define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_size = (s)) *************** *** 1036,1042 **** /* access macros */ ! #define bin_at(i) ((mbinptr)(&(av_[2 * (i)]))) #define next_bin(b) ((mbinptr)((char*)(b) + 2 * sizeof(mbinptr))) #define prev_bin(b) ((mbinptr)((char*)(b) - 2 * sizeof(mbinptr))) --- 1423,1429 ---- /* access macros */ ! #define bin_at(i) ((mbinptr)((char*)&(av_[2*(i) + 2]) - 2*SIZE_SZ)) #define next_bin(b) ((mbinptr)((char*)(b) + 2 * sizeof(mbinptr))) #define prev_bin(b) ((mbinptr)((char*)(b) - 2 * sizeof(mbinptr))) *************** *** 1052,1070 **** /* Because top initially points to its own bin with initial ! zero size, thus forcing extension on the first malloc request, ! we avoid having any special code in malloc to check whether it even exists yet. But we still need to in malloc_extend_top. */ ! #define initial_top ((mchunkptr)(av_)) /* Helper macro to initialize bins */ ! #define IAV(i) (mbinptr)(av_ + 2 * i), (mbinptr)(av_ + 2 * i) static mbinptr av_[NAV * 2 + 2] = { ! 0, IAV(0), IAV(1), IAV(2), IAV(3), IAV(4), IAV(5), IAV(6), IAV(7), IAV(8), IAV(9), IAV(10), IAV(11), IAV(12), IAV(13), IAV(14), IAV(15), IAV(16), IAV(17), IAV(18), IAV(19), IAV(20), IAV(21), IAV(22), IAV(23), --- 1439,1457 ---- /* Because top initially points to its own bin with initial ! zero size, thus forcing extension on the first malloc request, ! we avoid having any special code in malloc to check whether it even exists yet. But we still need to in malloc_extend_top. */ ! #define initial_top ((mchunkptr)(bin_at(0))) /* Helper macro to initialize bins */ ! #define IAV(i) bin_at(i), bin_at(i) static mbinptr av_[NAV * 2 + 2] = { ! 0, 0, IAV(0), IAV(1), IAV(2), IAV(3), IAV(4), IAV(5), IAV(6), IAV(7), IAV(8), IAV(9), IAV(10), IAV(11), IAV(12), IAV(13), IAV(14), IAV(15), IAV(16), IAV(17), IAV(18), IAV(19), IAV(20), IAV(21), IAV(22), IAV(23), *************** *** 1080,1087 **** IAV(96), IAV(97), IAV(98), IAV(99), IAV(100), IAV(101), IAV(102), IAV(103), IAV(104), IAV(105), IAV(106), IAV(107), IAV(108), IAV(109), IAV(110), IAV(111), IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), ! IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127), ! 0 }; --- 1467,1473 ---- IAV(96), IAV(97), IAV(98), IAV(99), IAV(100), IAV(101), IAV(102), IAV(103), IAV(104), IAV(105), IAV(106), IAV(107), IAV(108), IAV(109), IAV(110), IAV(111), IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119), ! IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127) }; *************** *** 1091,1097 **** #define first(b) ((b)->fd) #define last(b) ((b)->bk) ! /* Indexing into bins */ --- 1477,1483 ---- #define first(b) ((b)->fd) #define last(b) ((b)->bk) ! /* Indexing into bins */ *************** *** 1102,1109 **** ((((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 identically sized chunks. This is exploited in malloc. */ --- 1488,1495 ---- ((((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 identically sized chunks. This is exploited in malloc. */ *************** *** 1114,1124 **** #define smallbin_index(sz) (((unsigned long)(sz)) >> 3) ! /* Requests are `small' if both the corresponding and the next bin are small */ ! #define is_small_request(nb) (nb < MAX_SMALLBIN_SIZE - SMALLBIN_WIDTH) --- 1500,1510 ---- #define smallbin_index(sz) (((unsigned long)(sz)) >> 3) ! /* Requests are `small' if both the corresponding and the next bin are small */ ! #define is_small_request(nb) ((nb) < MAX_SMALLBIN_SIZE - SMALLBIN_WIDTH) *************** *** 1138,1150 **** /* bin<->block macros */ ! #define idx2binblock(ix) (1 << (ix / BINBLOCKWIDTH)) #define mark_binblock(ii) (binblocks |= idx2binblock(ii)) #define clear_binblock(ii) (binblocks &= ~(idx2binblock(ii))) /* Other static bookkeeping data */ /* variables holding tunable values */ --- 1524,1537 ---- /* bin<->block macros */ ! #define idx2binblock(ix) ((unsigned)1 << (ix / BINBLOCKWIDTH)) #define mark_binblock(ii) (binblocks |= idx2binblock(ii)) #define clear_binblock(ii) (binblocks &= ~(idx2binblock(ii))) + /* Other static bookkeeping data */ /* variables holding tunable values */ *************** *** 1153,1167 **** static unsigned long top_pad = DEFAULT_TOP_PAD; static unsigned int n_mmaps_max = DEFAULT_MMAP_MAX; static unsigned long mmap_threshold = DEFAULT_MMAP_THRESHOLD; /* The first value returned from sbrk */ static char* sbrk_base = (char*)(-1); /* The maximum memory obtained from system via sbrk */ ! static unsigned long max_sbrked_mem = 0; /* The maximum via either sbrk or mmap */ ! static unsigned long max_total_mem = 0; /* internal working copy of mallinfo */ static struct mallinfo current_mallinfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; --- 1540,1555 ---- static unsigned long top_pad = DEFAULT_TOP_PAD; static unsigned int n_mmaps_max = DEFAULT_MMAP_MAX; static unsigned long mmap_threshold = DEFAULT_MMAP_THRESHOLD; + static int check_action = DEFAULT_CHECK_ACTION; /* The first value returned from sbrk */ static char* sbrk_base = (char*)(-1); /* The maximum memory obtained from system via sbrk */ ! static unsigned long max_sbrked_mem = 0; /* The maximum via either sbrk or mmap */ ! static unsigned long max_total_mem = 0; /* internal working copy of mallinfo */ static struct mallinfo current_mallinfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; *************** *** 1178,1185 **** ! /* ! Debugging support */ #if DEBUG --- 1566,1573 ---- ! /* ! Debugging support */ #if DEBUG *************** *** 1194,1212 **** */ #if __STD_C ! static void do_check_chunk(mchunkptr p) #else static void do_check_chunk(p) mchunkptr p; #endif ! { ! size_t sz = p->size & ~PREV_INUSE; /* No checkable chunk is mmapped */ assert(!chunk_is_mmapped(p)); /* Check for legal address ... */ assert((char*)p >= sbrk_base); ! if (p != top) assert((char*)p + sz <= (char*)top); else assert((char*)p + sz <= sbrk_base + sbrked_mem); --- 1582,1600 ---- */ #if __STD_C ! static void do_check_chunk(mchunkptr p) #else static void do_check_chunk(p) mchunkptr p; #endif ! { ! INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; /* No checkable chunk is mmapped */ assert(!chunk_is_mmapped(p)); /* Check for legal address ... */ assert((char*)p >= sbrk_base); ! if (p != top) assert((char*)p + sz <= (char*)top); else assert((char*)p + sz <= sbrk_base + sbrked_mem); *************** *** 1215,1226 **** #if __STD_C ! static void do_check_free_chunk(mchunkptr p) #else static void do_check_free_chunk(p) mchunkptr p; #endif ! { ! size_t sz = p->size & ~PREV_INUSE; mchunkptr next = chunk_at_offset(p, sz); do_check_chunk(p); --- 1603,1614 ---- #if __STD_C ! static void do_check_free_chunk(mchunkptr p) #else static void do_check_free_chunk(p) mchunkptr p; #endif ! { ! INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; mchunkptr next = chunk_at_offset(p, sz); do_check_chunk(p); *************** *** 1232,1258 **** if ((long)sz >= (long)MINSIZE) { assert((sz & MALLOC_ALIGN_MASK) == 0); ! assert((((size_t)((char*)(p) + SIZE_SZ)) & MALLOC_ALIGN_MASK) == 0); /* ... matching footer field */ ! assert(*((size_t*)((char*)(p) + sz - SIZE_SZ)) == sz); /* ... and is fully consolidated */ assert(prev_inuse(p)); assert (next == top || inuse(next)); ! /* ... and has minimally sane links */ assert(p->fd->bk == p); assert(p->bk->fd == p); } else /* markers are always of size SIZE_SZ */ ! assert(sz == SIZE_SZ); } #if __STD_C ! static void do_check_inuse_chunk(mchunkptr p) #else static void do_check_inuse_chunk(p) mchunkptr p; #endif ! { mchunkptr next = next_chunk(p); do_check_chunk(p); --- 1620,1646 ---- if ((long)sz >= (long)MINSIZE) { assert((sz & MALLOC_ALIGN_MASK) == 0); ! assert(aligned_OK(chunk2mem(p))); /* ... matching footer field */ ! assert(next->prev_size == sz); /* ... and is fully consolidated */ assert(prev_inuse(p)); assert (next == top || inuse(next)); ! /* ... and has minimally sane links */ assert(p->fd->bk == p); assert(p->bk->fd == p); } else /* markers are always of size SIZE_SZ */ ! assert(sz == SIZE_SZ); } #if __STD_C ! static void do_check_inuse_chunk(mchunkptr p) #else static void do_check_inuse_chunk(p) mchunkptr p; #endif ! { mchunkptr next = next_chunk(p); do_check_chunk(p); *************** *** 1263,1269 **** Since more things can be checked with free chunks than inuse ones, if an inuse chunk borders them and debug is on, it's worth doing them. */ ! if (!prev_inuse(p)) { mchunkptr prv = prev_chunk(p); assert(next_chunk(prv) == p); --- 1651,1657 ---- Since more things can be checked with free chunks than inuse ones, if an inuse chunk borders them and debug is on, it's worth doing them. */ ! if (!prev_inuse(p)) { mchunkptr prv = prev_chunk(p); assert(next_chunk(prv) == p); *************** *** 1280,1291 **** } #if __STD_C ! static void do_check_malloced_chunk(mchunkptr p, size_t s) #else ! static void do_check_malloced_chunk(p, s) mchunkptr p; size_t s; #endif { ! size_t sz = p->size & ~PREV_INUSE; long room = sz - s; do_check_inuse_chunk(p); --- 1668,1679 ---- } #if __STD_C ! static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s) #else ! static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s; #endif { ! INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; long room = sz - s; do_check_inuse_chunk(p); *************** *** 1297,1303 **** assert(room < (long)MINSIZE); /* ... and alignment */ ! assert((((size_t)((char*)(p) + SIZE_SZ)) & MALLOC_ALIGN_MASK) == 0); /* ... and was allocated at front of an available chunk */ --- 1685,1691 ---- assert(room < (long)MINSIZE); /* ... and alignment */ ! assert(aligned_OK(chunk2mem(p))); /* ... and was allocated at front of an available chunk */ *************** *** 1311,1317 **** #define check_chunk(P) do_check_chunk(P) #define check_malloced_chunk(P,N) do_check_malloced_chunk(P,N) #else ! #define check_free_chunk(P) #define check_inuse_chunk(P) #define check_chunk(P) #define check_malloced_chunk(P,N) --- 1699,1705 ---- #define check_chunk(P) do_check_chunk(P) #define check_malloced_chunk(P,N) do_check_malloced_chunk(P,N) #else ! #define check_free_chunk(P) #define check_inuse_chunk(P) #define check_chunk(P) #define check_malloced_chunk(P,N) *************** *** 1319,1335 **** ! /* Macro-based internal utilities */ ! /* Linking chunks in bin lists. Call these only with variables, not arbitrary expressions, as arguments. */ ! /* Place chunk p of size s in its bin, in size order, putting it ahead of others of same size. */ --- 1707,1723 ---- ! /* Macro-based internal utilities */ ! /* Linking chunks in bin lists. Call these only with variables, not arbitrary expressions, as arguments. */ ! /* Place chunk p of size s in its bin, in size order, putting it ahead of others of same size. */ *************** *** 1403,1411 **** static mchunkptr mmap_chunk(size) size_t size; #endif { - size_t offset = (MALLOC_ALIGNMENT) - SIZE_SZ; size_t page_mask = malloc_getpagesize - 1; - char *cp; mchunkptr p; #ifndef MAP_ANONYMOUS --- 1791,1797 ---- *************** *** 1414,1453 **** if(n_mmaps >= n_mmaps_max) return 0; /* too many regions */ ! /* The offset to the start of the mmapped region is stored ! * in a size_t field immediately before the chunk. */ ! size = (size + offset + page_mask) & ~page_mask; #ifdef MAP_ANONYMOUS ! cp = (char *)mmap(0, size, PROT_READ|PROT_WRITE, ! MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); #else /* !MAP_ANONYMOUS */ ! if (fd < 0) { fd = open("/dev/zero", O_RDWR); if(fd < 0) return 0; } ! cp = (char *)mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); #endif ! if(cp == (char *)-1) return 0; n_mmaps++; if (n_mmaps > max_n_mmaps) max_n_mmaps = n_mmaps; - - p = (mchunkptr)(cp + offset); /* We demand that eight bytes into a page must be 8-byte aligned. */ assert(aligned_OK(chunk2mem(p))); ! *((size_t *)p - 1) = offset; ! set_head(p, (size - offset)|IS_MMAPPED); ! mmapped_mem += size; ! if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) max_mmapped_mem = mmapped_mem; ! if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; return p; } --- 1800,1841 ---- if(n_mmaps >= n_mmaps_max) return 0; /* too many regions */ ! /* For mmapped chunks, the overhead is one SIZE_SZ unit larger, because ! * there is no following chunk whose prev_size field could be used. */ ! size = (size + SIZE_SZ + page_mask) & ~page_mask; #ifdef MAP_ANONYMOUS ! p = (mchunkptr)mmap(0, size, PROT_READ|PROT_WRITE, ! MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); #else /* !MAP_ANONYMOUS */ ! if (fd < 0) { fd = open("/dev/zero", O_RDWR); if(fd < 0) return 0; } ! p = (mchunkptr)mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); #endif ! if(p == (mchunkptr)-1) return 0; n_mmaps++; if (n_mmaps > max_n_mmaps) max_n_mmaps = n_mmaps; /* We demand that eight bytes into a page must be 8-byte aligned. */ assert(aligned_OK(chunk2mem(p))); ! /* The offset to the start of the mmapped region is stored ! * in the prev_size field of the chunk; normally it is zero, ! * but that can be changed in memalign(). ! */ ! p->prev_size = 0; ! set_head(p, size|IS_MMAPPED); ! mmapped_mem += size; ! if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) max_mmapped_mem = mmapped_mem; ! if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; return p; } *************** *** 1458,1485 **** static void munmap_chunk(p) mchunkptr p; #endif { ! size_t offset = *((size_t *)p - 1); ! size_t size = chunksize(p); int ret; assert (chunk_is_mmapped(p)); assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); assert((n_mmaps > 0)); ! assert(((size + offset) & (malloc_getpagesize-1)) == 0); ! ret = munmap((char *)p - offset, size + offset); /* munmap returns non-zero on failure */ assert(ret == 0); - - n_mmaps--; - mmapped_mem -= (size + offset); } #if HAVE_MREMAP - #include - #if __STD_C static mchunkptr mremap_chunk(mchunkptr p, size_t new_size) #else --- 1846,1870 ---- static void munmap_chunk(p) mchunkptr p; #endif { ! INTERNAL_SIZE_T size = chunksize(p); int ret; assert (chunk_is_mmapped(p)); assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem)); assert((n_mmaps > 0)); ! assert(((p->prev_size + size) & (malloc_getpagesize-1)) == 0); ! ! n_mmaps--; ! mmapped_mem -= (size + p->prev_size); ! ret = munmap((char *)p - p->prev_size, size + p->prev_size); /* munmap returns non-zero on failure */ assert(ret == 0); } #if HAVE_MREMAP #if __STD_C static mchunkptr mremap_chunk(mchunkptr p, size_t new_size) #else *************** *** 1487,1494 **** #endif { size_t page_mask = malloc_getpagesize - 1; ! size_t offset = *((size_t *)p - 1); ! size_t size = chunksize(p); char *cp; assert (chunk_is_mmapped(p)); --- 1872,1879 ---- #endif { size_t page_mask = malloc_getpagesize - 1; ! INTERNAL_SIZE_T offset = p->prev_size; ! INTERNAL_SIZE_T size = chunksize(p); char *cp; assert (chunk_is_mmapped(p)); *************** *** 1496,1502 **** assert((n_mmaps > 0)); assert(((size + offset) & (malloc_getpagesize-1)) == 0); ! new_size = (new_size + offset + page_mask) & ~page_mask; cp = (char *)mremap((char *)p - offset, size + offset, new_size, 1); --- 1881,1888 ---- assert((n_mmaps > 0)); assert(((size + offset) & (malloc_getpagesize-1)) == 0); ! /* Note the extra SIZE_SZ overhead as in mmap_chunk(). */ ! new_size = (new_size + offset + SIZE_SZ + page_mask) & ~page_mask; cp = (char *)mremap((char *)p - offset, size + offset, new_size, 1); *************** *** 1506,1517 **** assert(aligned_OK(chunk2mem(p))); ! assert((*((size_t *)p - 1) == offset)); set_head(p, (new_size - offset)|IS_MMAPPED); mmapped_mem -= size + offset; mmapped_mem += new_size; ! if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) max_mmapped_mem = mmapped_mem; if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; --- 1892,1903 ---- assert(aligned_OK(chunk2mem(p))); ! assert((p->prev_size == offset)); set_head(p, (new_size - offset)|IS_MMAPPED); mmapped_mem -= size + offset; mmapped_mem += new_size; ! if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem) max_mmapped_mem = mmapped_mem; if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; *************** *** 1525,1554 **** ! /* Extend the top-most chunk by obtaining memory from system. Main interface to sbrk (but see also malloc_trim). */ #if __STD_C ! static void malloc_extend_top(size_t nb) #else ! static void malloc_extend_top(nb) size_t nb; #endif { ! char* brk; /* return value from sbrk */ ! size_t front_misalign; /* unusable bytes at front of sbrked space */ ! size_t correction; /* bytes for 2nd sbrk call */ ! char* new_brk; /* return of 2nd sbrk call */ ! size_t top_size; /* new size of top chunk */ ! mchunkptr old_top = top; /* Record state of old top */ ! size_t old_top_size = chunksize(old_top); char* old_end = (char*)(chunk_at_offset(old_top, old_top_size)); /* Pad request with top_pad plus minimal overhead */ ! ! size_t sbrk_size = nb + top_pad + MINSIZE; unsigned long pagesz = malloc_getpagesize; /* If not the first time through, round to preserve page boundary */ --- 1911,1940 ---- ! /* Extend the top-most chunk by obtaining memory from system. Main interface to sbrk (but see also malloc_trim). */ #if __STD_C ! static void malloc_extend_top(INTERNAL_SIZE_T nb) #else ! static void malloc_extend_top(nb) INTERNAL_SIZE_T nb; #endif { ! char* brk; /* return value from sbrk */ ! INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of sbrked space */ ! INTERNAL_SIZE_T correction; /* bytes for 2nd sbrk call */ ! char* new_brk; /* return of 2nd sbrk call */ ! INTERNAL_SIZE_T top_size; /* new size of top chunk */ ! mchunkptr old_top = top; /* Record state of old top */ ! INTERNAL_SIZE_T old_top_size = chunksize(old_top); char* old_end = (char*)(chunk_at_offset(old_top, old_top_size)); /* Pad request with top_pad plus minimal overhead */ ! ! INTERNAL_SIZE_T sbrk_size = nb + top_pad + MINSIZE; unsigned long pagesz = malloc_getpagesize; /* If not the first time through, round to preserve page boundary */ *************** *** 1561,1569 **** brk = (char*)(MORECORE (sbrk_size)); /* Fail if sbrk failed or if a foreign sbrk call killed our space */ ! if (brk == (char*)(MORECORE_FAILURE) || (brk < old_end && old_top != initial_top)) ! return; sbrked_mem += sbrk_size; --- 1947,1955 ---- brk = (char*)(MORECORE (sbrk_size)); /* Fail if sbrk failed or if a foreign sbrk call killed our space */ ! if (brk == (char*)(MORECORE_FAILURE) || (brk < old_end && old_top != initial_top)) ! return; sbrked_mem += sbrk_size; *************** *** 1580,1587 **** sbrked_mem += brk - (char*)old_end; /* Guarantee alignment of first new chunk made from this space */ ! front_misalign = (size_t)chunk2mem(brk) & MALLOC_ALIGN_MASK; ! if (front_misalign > 0) { correction = (MALLOC_ALIGNMENT) - front_misalign; brk += correction; --- 1966,1973 ---- sbrked_mem += brk - (char*)old_end; /* Guarantee alignment of first new chunk made from this space */ ! front_misalign = (unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK; ! if (front_misalign > 0) { correction = (MALLOC_ALIGNMENT) - front_misalign; brk += correction; *************** *** 1590,1600 **** correction = 0; /* Guarantee the next brk will be at a page boundary */ ! correction += pagesz - ((size_t)(brk + sbrk_size) & (pagesz - 1)); /* Allocate correction */ new_brk = (char*)(MORECORE (correction)); ! if (new_brk == (char*)(MORECORE_FAILURE)) return; sbrked_mem += correction; --- 1976,1986 ---- correction = 0; /* Guarantee the next brk will be at a page boundary */ ! correction += pagesz - ((unsigned long)(brk + sbrk_size) & (pagesz - 1)); /* Allocate correction */ new_brk = (char*)(MORECORE (correction)); ! if (new_brk == (char*)(MORECORE_FAILURE)) return; sbrked_mem += correction; *************** *** 1609,1645 **** /* A double fencepost is necessary to prevent consolidation */ /* If not enough space to do this, then user did something very wrong */ ! if (old_top_size < MINSIZE) { set_head(top, PREV_INUSE); /* will force null return from malloc */ return; } ! chunk_at_offset(old_top, old_top_size - 2*SIZE_SZ)->size = ! SIZE_SZ|PREV_INUSE; ! chunk_at_offset(old_top, old_top_size - SIZE_SZ)->size = ! SIZE_SZ|PREV_INUSE; ! ! /* Also keep size a multiple of MINSIZE */ ! old_top_size = (old_top_size - 2*SIZE_SZ) & ~MALLOC_ALIGN_MASK; chunk_at_offset(old_top, old_top_size )->size = SIZE_SZ|PREV_INUSE; chunk_at_offset(old_top, old_top_size + SIZE_SZ)->size = SIZE_SZ|PREV_INUSE; set_head_size(old_top, old_top_size); /* If possible, release the rest. */ ! if (old_top_size >= MINSIZE) fREe(chunk2mem(old_top)); } } ! if ((unsigned long)sbrked_mem > (unsigned long)max_sbrked_mem) max_sbrked_mem = sbrked_mem; ! if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; /* We always land on a page boundary */ ! assert(((size_t)((char*)top + top_size) & (pagesz - 1)) == 0); } --- 1995,2026 ---- /* A double fencepost is necessary to prevent consolidation */ /* If not enough space to do this, then user did something very wrong */ ! if (old_top_size < MINSIZE) { set_head(top, PREV_INUSE); /* will force null return from malloc */ return; } ! /* Also keep size a multiple of MALLOC_ALIGNMENT */ ! old_top_size = (old_top_size - 3*SIZE_SZ) & ~MALLOC_ALIGN_MASK; chunk_at_offset(old_top, old_top_size )->size = SIZE_SZ|PREV_INUSE; chunk_at_offset(old_top, old_top_size + SIZE_SZ)->size = SIZE_SZ|PREV_INUSE; set_head_size(old_top, old_top_size); /* If possible, release the rest. */ ! if (old_top_size >= MINSIZE) fREe(chunk2mem(old_top)); } } ! if ((unsigned long)sbrked_mem > (unsigned long)max_sbrked_mem) max_sbrked_mem = sbrked_mem; ! if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem) max_total_mem = mmapped_mem + sbrked_mem; /* We always land on a page boundary */ ! assert(((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0); } *************** *** 1649,1661 **** /* ! Malloc Algorthim: The requested size is first converted into a usable form, `nb'. This currently means to add 4 bytes overhead plus possibly more to obtain 8-byte alignment and/or to obtain a size of at least ! MINSIZE (currently 16 bytes), the smallest allocatable size. ! (All fits are considered `exact' if they are within MINSIZE bytes.) From there, the first successful of the following steps is taken: --- 2030,2043 ---- /* ! Malloc Algorithm: The requested size is first converted into a usable form, `nb'. This currently means to add 4 bytes overhead plus possibly more to obtain 8-byte alignment and/or to obtain a size of at least ! MINSIZE (currently 16, 24, or 32 bytes), the smallest allocatable ! size. (All fits are considered `exact' if they are within MINSIZE ! bytes.) From there, the first successful of the following steps is taken: *************** *** 1714,1720 **** #endif { mchunkptr victim; /* inspected/selected chunk */ ! size_t victim_size; /* its size */ int idx; /* index for bin traversal */ mbinptr bin; /* associated bin */ mchunkptr remainder; /* remainder from a split */ --- 2096,2102 ---- #endif { mchunkptr victim; /* inspected/selected chunk */ ! INTERNAL_SIZE_T victim_size; /* its size */ int idx; /* index for bin traversal */ mbinptr bin; /* associated bin */ mchunkptr remainder; /* remainder from a split */ *************** *** 1726,1738 **** mchunkptr bck; /* misc temp for linking */ mbinptr q; /* misc temp */ ! size_t nb = request2size(bytes); /* padded request size; */ /* Check for exact match in a bin */ if (is_small_request(nb)) /* Faster version for small requests */ { ! idx = smallbin_index(nb); /* No traversal or size check necessary for small bins. */ --- 2108,2131 ---- mchunkptr bck; /* misc temp for linking */ mbinptr q; /* misc temp */ ! INTERNAL_SIZE_T nb; /* padded request size; */ ! ! #if defined(MALLOC_HOOKS) ! if (__malloc_hook != NULL) { ! Void_t* result; ! ! result = (*__malloc_hook)(bytes); ! return result; ! } ! #endif ! ! nb = request2size(bytes); /* Check for exact match in a bin */ if (is_small_request(nb)) /* Faster version for small requests */ { ! idx = smallbin_index(nb); /* No traversal or size check necessary for small bins. */ *************** *** 1766,1776 **** { victim_size = chunksize(victim); remainder_size = victim_size - nb; ! if (remainder_size >= (long)MINSIZE) /* too big */ { --idx; /* adjust to rescan below after checking last remainder */ ! break; } else if (remainder_size >= 0) /* exact fit */ --- 2159,2169 ---- { victim_size = chunksize(victim); remainder_size = victim_size - nb; ! if (remainder_size >= (long)MINSIZE) /* too big */ { --idx; /* adjust to rescan below after checking last remainder */ ! break; } else if (remainder_size >= 0) /* exact fit */ *************** *** 1782,1788 **** } } ! ++idx; } --- 2175,2181 ---- } } ! ++idx; } *************** *** 1818,1834 **** frontlink(victim, victim_size, remainder_index, bck, fwd); } ! /* ! If there are any possibly nonempty big-enough blocks, search for best fitting chunk by scanning bins in blockwidth units. */ ! if ( (block = idx2binblock(idx)) <= binblocks) { /* Get to the first marked block */ ! if ( (block & binblocks) == 0) { /* force to an even block boundary */ idx = (idx & ~(BINBLOCKWIDTH - 1)) + BINBLOCKWIDTH; --- 2211,2227 ---- frontlink(victim, victim_size, remainder_index, bck, fwd); } ! /* ! If there are any possibly nonempty big-enough blocks, search for best fitting chunk by scanning bins in blockwidth units. */ ! if ( (block = idx2binblock(idx)) <= binblocks) { /* Get to the first marked block */ ! if ( (block & binblocks) == 0) { /* force to an even block boundary */ idx = (idx & ~(BINBLOCKWIDTH - 1)) + BINBLOCKWIDTH; *************** *** 1839,1847 **** block <<= 1; } } ! /* For each possibly nonempty block ... */ ! for (;;) { startidx = idx; /* (track incomplete blocks) */ q = bin = bin_at(idx); --- 2232,2240 ---- block <<= 1; } } ! /* For each possibly nonempty block ... */ ! for (;;) { startidx = idx; /* (track incomplete blocks) */ q = bin = bin_at(idx); *************** *** 1892,1903 **** break; } --startidx; ! q = prev_bin(q); } while (first(q) == q); /* Get to the next possibly nonempty block */ ! if ( (block <<= 1) <= binblocks && (block != 0) ) { while ((block & binblocks) == 0) { --- 2285,2296 ---- break; } --startidx; ! q = prev_bin(q); } while (first(q) == q); /* Get to the next possibly nonempty block */ ! if ( (block <<= 1) <= binblocks && (block != 0) ) { while ((block & binblocks) == 0) { *************** *** 1948,1956 **** cases: ! 1. free(0) has no effect. ! 2. If the chunk was allocated via mmap, it is release via munmap(). 3. If a returned chunk borders the current high end of memory, it is consolidated into the top, and if the total unused --- 2341,2349 ---- cases: ! 1. free(0) has no effect. ! 2. If the chunk was allocated via mmap, it is released via munmap(). 3. If a returned chunk borders the current high end of memory, it is consolidated into the top, and if the total unused *************** *** 1971,1986 **** #endif { mchunkptr p; /* chunk corresponding to mem */ ! size_t hd; /* its head field */ ! size_t sz; /* its size */ int idx; /* its bin index */ mchunkptr next; /* next contiguous chunk */ ! size_t nextsz; /* its size */ ! size_t prevsz; /* size of previous contiguous chunk */ mchunkptr bck; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */ int islr; /* track whether merging with last_remainder */ if (mem == 0) /* free(0) has no effect */ return; --- 2364,2386 ---- #endif { mchunkptr p; /* chunk corresponding to mem */ ! INTERNAL_SIZE_T hd; /* its head field */ ! INTERNAL_SIZE_T sz; /* its size */ int idx; /* its bin index */ mchunkptr next; /* next contiguous chunk */ ! INTERNAL_SIZE_T nextsz; /* its size */ ! INTERNAL_SIZE_T prevsz; /* size of previous contiguous chunk */ mchunkptr bck; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */ int islr; /* track whether merging with last_remainder */ + #if defined(MALLOC_HOOKS) + if (__free_hook != NULL) { + (*__free_hook)(mem); + return; + } + #endif + if (mem == 0) /* free(0) has no effect */ return; *************** *** 1994,2013 **** return; } #endif ! check_inuse_chunk(p); ! sz = hd & ~PREV_INUSE; next = chunk_at_offset(p, sz); nextsz = chunksize(next); ! if (next == top) /* merge with top */ { sz += nextsz; if (!(hd & PREV_INUSE)) /* consolidate backward */ { ! prevsz = prev_size(p); p = chunk_at_offset(p, -prevsz); sz += prevsz; unlink(p, bck, fwd); --- 2394,2413 ---- return; } #endif ! check_inuse_chunk(p); ! sz = hd & ~PREV_INUSE; next = chunk_at_offset(p, sz); nextsz = chunksize(next); ! if (next == top) /* merge with top */ { sz += nextsz; if (!(hd & PREV_INUSE)) /* consolidate backward */ { ! prevsz = p->prev_size; p = chunk_at_offset(p, -prevsz); sz += prevsz; unlink(p, bck, fwd); *************** *** 2015,2022 **** set_head(p, sz | PREV_INUSE); top = p; ! if ((unsigned long)(sz) >= (unsigned long)trim_threshold) ! malloc_trim(top_pad); return; } --- 2415,2422 ---- set_head(p, sz | PREV_INUSE); top = p; ! if ((unsigned long)(sz) >= (unsigned long)trim_threshold) ! mALLOC_TRIm(top_pad); return; } *************** *** 2026,2059 **** if (!(hd & PREV_INUSE)) /* consolidate backward */ { ! prevsz = prev_size(p); p = chunk_at_offset(p, -prevsz); sz += prevsz; ! if (p->fd == last_remainder) /* keep as last_remainder */ islr = 1; else unlink(p, bck, fwd); } ! if (!(inuse_bit_at_offset(next, nextsz))) /* consolidate forward */ { sz += nextsz; ! if (!islr && next->fd == last_remainder) /* re-insert last_remainder */ { islr = 1; ! link_last_remainder(p); } else unlink(next, bck, fwd); } - set_head(p, sz | PREV_INUSE); set_foot(p, sz); if (!islr) ! frontlink(p, sz, idx, bck, fwd); } --- 2426,2458 ---- if (!(hd & PREV_INUSE)) /* consolidate backward */ { ! prevsz = p->prev_size; p = chunk_at_offset(p, -prevsz); sz += prevsz; ! if (p->fd == last_remainder) /* keep as last_remainder */ islr = 1; else unlink(p, bck, fwd); } ! if (!(inuse_bit_at_offset(next, nextsz))) /* consolidate forward */ { sz += nextsz; ! if (!islr && next->fd == last_remainder) /* re-insert last_remainder */ { islr = 1; ! link_last_remainder(p); } else unlink(next, bck, fwd); } set_head(p, sz | PREV_INUSE); set_foot(p, sz); if (!islr) ! frontlink(p, sz, idx, bck, fwd); } *************** *** 2065,2078 **** Realloc algorithm: Chunks that were obtained via mmap cannot be extended or shrunk ! unless HAVE_MREMAP is defined, in wchi case mrep is used. Otherwise, if their reallocation is for additional space, they are copied. If for less, they are just left alone. ! Otherwise, if the reallocation is for additional space, and the chunk can be ! extended, it is, else a malloc-copy-free sequence is taken. There ! are several different ways that a chunk could be extended. All are ! tried: * Extending forward into following adjacent free chunk. * Shifting backwards, joining preceding adjacent space --- 2464,2477 ---- Realloc algorithm: Chunks that were obtained via mmap cannot be extended or shrunk ! unless HAVE_MREMAP is defined, in which case mremap is used. Otherwise, if their reallocation is for additional space, they are copied. If for less, they are just left alone. ! Otherwise, if the reallocation is for additional space, and the ! chunk can be extended, it is, else a malloc-copy-free sequence is ! taken. There are several different ways that a chunk could be ! extended. All are tried: * Extending forward into following adjacent free chunk. * Shifting backwards, joining preceding adjacent space *************** *** 2089,2095 **** The old unix realloc convention of allowing the last-free'd chunk to be used as an argument to realloc is no longer supported. I don't know of any programs still relying on this feature, ! and allowing it would also allow too many other incorrect usages of realloc to be sensible. --- 2488,2494 ---- The old unix realloc convention of allowing the last-free'd chunk to be used as an argument to realloc is no longer supported. I don't know of any programs still relying on this feature, ! and allowing it would also allow too many other incorrect usages of realloc to be sensible. *************** *** 2102,2133 **** Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; #endif { ! size_t nb; /* padded request size */ mchunkptr oldp; /* chunk corresponding to oldmem */ ! size_t oldsize; /* its size */ mchunkptr newp; /* chunk to return */ ! size_t newsize; /* its size */ Void_t* newmem; /* corresponding user mem */ mchunkptr next; /* next contiguous chunk after oldp */ ! size_t nextsize; /* its size */ mchunkptr prev; /* previous contiguous chunk before oldp */ ! size_t prevsize; /* its size */ mchunkptr remainder; /* holds split off extra space from newp */ ! size_t remainder_size; /* its size */ mchunkptr bck; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */ #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { fREe(oldmem); return 0; } #endif - /* realloc of null is supposed to be same as malloc */ if (oldmem == 0) return mALLOc(bytes); --- 2501,2540 ---- Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; #endif { ! INTERNAL_SIZE_T nb; /* padded request size */ mchunkptr oldp; /* chunk corresponding to oldmem */ ! INTERNAL_SIZE_T oldsize; /* its size */ mchunkptr newp; /* chunk to return */ ! INTERNAL_SIZE_T newsize; /* its size */ Void_t* newmem; /* corresponding user mem */ mchunkptr next; /* next contiguous chunk after oldp */ ! INTERNAL_SIZE_T nextsize; /* its size */ mchunkptr prev; /* previous contiguous chunk before oldp */ ! INTERNAL_SIZE_T prevsize; /* its size */ mchunkptr remainder; /* holds split off extra space from newp */ ! INTERNAL_SIZE_T remainder_size; /* its size */ mchunkptr bck; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */ + #if defined(MALLOC_HOOKS) + if (__realloc_hook != NULL) { + Void_t* result; + + result = (*__realloc_hook)(oldmem, bytes); + return result; + } + #endif + #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { fREe(oldmem); return 0; } #endif /* realloc of null is supposed to be same as malloc */ if (oldmem == 0) return mALLOc(bytes); *************** *** 2138,2154 **** nb = request2size(bytes); #if HAVE_MMAP ! if (chunk_is_mmapped(oldp)) { #if HAVE_MREMAP newp = mremap_chunk(oldp, nb); if(newp) return chunk2mem(newp); #endif ! if(oldsize >= nb) return oldmem; /* do nothing */ /* Must alloc, copy, free. */ newmem = mALLOc(bytes); if (newmem == 0) return 0; /* propagate failure */ ! MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); munmap_chunk(oldp); return newmem; } --- 2545,2562 ---- nb = request2size(bytes); #if HAVE_MMAP ! if (chunk_is_mmapped(oldp)) { #if HAVE_MREMAP newp = mremap_chunk(oldp, nb); if(newp) return chunk2mem(newp); #endif ! /* Note the extra SIZE_SZ overhead. */ ! if(oldsize - SIZE_SZ >= nb) return oldmem; /* do nothing */ /* Must alloc, copy, free. */ newmem = mALLOc(bytes); if (newmem == 0) return 0; /* propagate failure */ ! MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ); munmap_chunk(oldp); return newmem; } *************** *** 2156,2168 **** check_inuse_chunk(oldp); ! if ((long)(oldsize) < (long)(nb)) { /* Try expanding forward */ next = chunk_at_offset(oldp, oldsize); ! if (next == top || !inuse(next)) { nextsize = chunksize(next); --- 2564,2576 ---- check_inuse_chunk(oldp); ! if ((long)(oldsize) < (long)(nb)) { /* Try expanding forward */ next = chunk_at_offset(oldp, oldsize); ! if (next == top || !inuse(next)) { nextsize = chunksize(next); *************** *** 2181,2187 **** /* Forward into next chunk */ else if (((long)(nextsize + newsize) >= (long)(nb))) ! { unlink(next, bck, fwd); newsize += nextsize; goto split; --- 2589,2595 ---- /* Forward into next chunk */ else if (((long)(nextsize + newsize) >= (long)(nb))) ! { unlink(next, bck, fwd); newsize += nextsize; goto split; *************** *** 2217,2223 **** top = chunk_at_offset(newp, nb); set_head(top, (newsize - nb) | PREV_INUSE); set_head_size(newp, nb); ! return chunk2mem(newp); } } --- 2625,2631 ---- top = chunk_at_offset(newp, nb); set_head(top, (newsize - nb) | PREV_INUSE); set_head_size(newp, nb); ! return newmem; } } *************** *** 2233,2241 **** goto split; } } ! /* backward only */ ! if (prev != 0 && (long)(prevsize + newsize) >= (long)nb) { unlink(prev, bck, fwd); newp = prev; --- 2641,2649 ---- goto split; } } ! /* backward only */ ! if (prev != 0 && (long)(prevsize + newsize) >= (long)nb) { unlink(prev, bck, fwd); newp = prev; *************** *** 2251,2262 **** newmem = mALLOc (bytes); if (newmem == 0) /* propagate failure */ ! return 0; /* Avoid copy if newp is next chunk after oldp. */ /* (This can only happen when new chunk is sbrk'ed.) */ ! if ( (newp = mem2chunk(newmem)) == next_chunk(oldp)) { newsize += chunksize(newp); newp = oldp; --- 2659,2670 ---- newmem = mALLOc (bytes); if (newmem == 0) /* propagate failure */ ! return 0; /* Avoid copy if newp is next chunk after oldp. */ /* (This can only happen when new chunk is sbrk'ed.) */ ! if ( (newp = mem2chunk(newmem)) == next_chunk(oldp)) { newsize += chunksize(newp); newp = oldp; *************** *** 2300,2306 **** memalign requests more than enough space from malloc, finds a spot within that chunk that meets the alignment request, and then ! possibly frees the leading and trailing space. The alignment argument must be a power of two. This property is not checked by memalign, so misuse may result in random runtime errors. --- 2708,2714 ---- memalign requests more than enough space from malloc, finds a spot within that chunk that meets the alignment request, and then ! possibly frees the leading and trailing space. The alignment argument must be a power of two. This property is not checked by memalign, so misuse may result in random runtime errors. *************** *** 2319,2340 **** Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; #endif { ! size_t nb; /* padded request size */ char* m; /* memory returned by malloc call */ mchunkptr p; /* corresponding chunk */ char* brk; /* alignment point within p */ mchunkptr newp; /* chunk to return */ ! size_t newsize; /* its size */ ! size_t leadsize; /* leading space befor alignment point */ mchunkptr remainder; /* spare room at end to split off */ long remainder_size; /* its size */ /* If need less alignment than we give anyway, just relay to malloc */ if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes); /* Otherwise, ensure that it is at least a minimum chunk size */ ! if (alignment < MINSIZE) alignment = MINSIZE; /* Call malloc with worst case padding to hit alignment. */ --- 2727,2757 ---- Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; #endif { ! INTERNAL_SIZE_T nb; /* padded request size */ char* m; /* memory returned by malloc call */ mchunkptr p; /* corresponding chunk */ char* brk; /* alignment point within p */ mchunkptr newp; /* chunk to return */ ! INTERNAL_SIZE_T newsize; /* its size */ ! INTERNAL_SIZE_T leadsize; /* leading space befor alignment point */ mchunkptr remainder; /* spare room at end to split off */ long remainder_size; /* its size */ + #if defined(MALLOC_HOOKS) + if (__memalign_hook != NULL) { + Void_t* result; + + result = (*__memalign_hook)(alignment, bytes); + return result; + } + #endif + /* If need less alignment than we give anyway, just relay to malloc */ if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes); /* Otherwise, ensure that it is at least a minimum chunk size */ ! if (alignment < MINSIZE) alignment = MINSIZE; /* Call malloc with worst case padding to hit alignment. */ *************** *** 2346,2352 **** p = mem2chunk(m); ! if ((((size_t)(m)) % alignment) == 0) /* aligned */ { #if HAVE_MMAP if(chunk_is_mmapped(p)) --- 2763,2769 ---- p = mem2chunk(m); ! if ((((unsigned long)(m)) % alignment) == 0) /* aligned */ { #if HAVE_MMAP if(chunk_is_mmapped(p)) *************** *** 2355,2380 **** } else /* misaligned */ { ! /* Find an aligned spot inside chunk. ! Since we need to give back leading space in a chunk of at least MINSIZE, if the first calculation places us at a spot with less than MINSIZE leader, we can move to the next aligned spot -- we've allocated enough total room so that this is always possible. */ ! brk = (char*) ( (((size_t)(m + alignment - 1)) & -alignment) - SIZE_SZ ); ! if ((long)(brk - (char*)(p)) < MINSIZE) brk = brk + alignment; newp = (mchunkptr)brk; leadsize = brk - (char*)(p); newsize = chunksize(p) - leadsize; #if HAVE_MMAP ! if(chunk_is_mmapped(p)) { ! *((size_t *)newp - 1) = *((size_t *)p - 1) + leadsize; set_head(newp, newsize|IS_MMAPPED); return chunk2mem(newp); } --- 2772,2797 ---- } else /* misaligned */ { ! /* Find an aligned spot inside chunk. ! Since we need to give back leading space in a chunk of at least MINSIZE, if the first calculation places us at a spot with less than MINSIZE leader, we can move to the next aligned spot -- we've allocated enough total room so that this is always possible. */ ! brk = (char*)mem2chunk(((unsigned long)(m + alignment - 1)) & -alignment); ! if ((long)(brk - (char*)(p)) < (long)MINSIZE) brk += alignment; newp = (mchunkptr)brk; leadsize = brk - (char*)(p); newsize = chunksize(p) - leadsize; #if HAVE_MMAP ! if(chunk_is_mmapped(p)) { ! newp->prev_size = p->prev_size + leadsize; set_head(newp, newsize|IS_MMAPPED); return chunk2mem(newp); } *************** *** 2388,2394 **** fREe(chunk2mem(p)); p = newp; ! assert (newsize >= nb && (((size_t)(chunk2mem(p))) % alignment) == 0); } /* Also give back spare room at the end */ --- 2805,2811 ---- fREe(chunk2mem(p)); p = newp; ! assert (newsize>=nb && (((unsigned long)(chunk2mem(p))) % alignment) == 0); } /* Also give back spare room at the end */ *************** *** 2405,2411 **** check_inuse_chunk(p); return chunk2mem(p); - } --- 2822,2827 ---- *************** *** 2426,2431 **** --- 2842,2862 ---- return mEMALIGn (malloc_getpagesize, bytes); } + /* + pvalloc just invokes valloc for the nearest pagesize + that will accommodate request + */ + + + #if __STD_C + Void_t* pvALLOc(size_t bytes) + #else + Void_t* pvALLOc(bytes) size_t bytes; + #endif + { + size_t pagesize = malloc_getpagesize; + return mEMALIGn (pagesize, (bytes + pagesize - 1) & ~(pagesize - 1)); + } /* *************** *** 2439,2457 **** Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size; #endif { ! mchunkptr p; ! size_t csz; ! ! size_t sz = n * elem_size; /* check if expand_top called, in which case don't need to clear */ #if MORECORE_CLEARS ! mchunkptr oldtop = top; ! size_t oldtopsize = chunksize(top); #endif ! Void_t* mem = mALLOc (sz); ! if (mem == 0) return 0; else { --- 2870,2900 ---- Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size; #endif { ! mchunkptr p, oldtop; ! INTERNAL_SIZE_T csz, sz = n * elem_size, oldtopsize; ! Void_t* mem; ! ! #if defined(MALLOC_HOOKS) ! if (__malloc_hook != NULL) { ! mem = (*__malloc_hook)(sz); ! if(!mem) return 0; ! #ifdef HAVE_MEMCPY ! memset(mem, 0, sz); ! #else ! while(sz > 0) ((char*)mem)[--sz] = 0; /* rather inefficient */ ! #endif ! return mem; ! } ! #endif /* check if expand_top called, in which case don't need to clear */ #if MORECORE_CLEARS ! oldtop = top; ! oldtopsize = chunksize(top); #endif ! mem = mALLOc (sz); ! if (mem == 0) return 0; else { *************** *** 2459,2465 **** /* Two optional cases in which clearing not necessary */ - #if HAVE_MMAP if (chunk_is_mmapped(p)) return mem; #endif --- 2902,2907 ---- *************** *** 2467,2478 **** csz = chunksize(p); #if MORECORE_CLEARS ! if (p == oldtop && csz > oldtopsize) ! { ! /* clear only the bytes from non-freshly-sbrked memory */ ! MALLOC_ZERO(mem, oldtopsize - SIZE_SZ); ! return mem; ! } #endif MALLOC_ZERO(mem, csz - SIZE_SZ); --- 2909,2919 ---- csz = chunksize(p); #if MORECORE_CLEARS ! if (p == oldtop && csz > oldtopsize) ! { ! /* clear only the bytes from non-freshly-sbrked memory */ ! csz = oldtopsize; ! } #endif MALLOC_ZERO(mem, csz - SIZE_SZ); *************** *** 2481,2487 **** } /* ! cfree just calls free. It is needed/defined on some systems that pair it with calloc, presumably for odd historical reasons. --- 2922,2928 ---- } /* ! cfree just calls free. It is needed/defined on some systems that pair it with calloc, presumably for odd historical reasons. *************** *** 2524,2532 **** */ #if __STD_C ! int malloc_trim(size_t pad) #else ! int malloc_trim(pad) size_t pad; #endif { long top_size; /* Amount of top-most memory */ --- 2965,2973 ---- */ #if __STD_C ! int mALLOC_TRIm(size_t pad) #else ! int mALLOC_TRIm(pad) size_t pad; #endif { long top_size; /* Amount of top-most memory */ *************** *** 2552,2558 **** else { new_brk = (char*)(MORECORE (-extra)); ! if (new_brk == (char*)(MORECORE_FAILURE)) /* sbrk failed? */ { /* Try to figure out what we have */ --- 2993,2999 ---- else { new_brk = (char*)(MORECORE (-extra)); ! if (new_brk == (char*)(MORECORE_FAILURE)) /* sbrk failed? */ { /* Try to figure out what we have */ *************** *** 2564,2570 **** set_head(top, top_size | PREV_INUSE); } check_chunk(top); ! return 0; } else --- 3005,3011 ---- set_head(top, top_size | PREV_INUSE); } check_chunk(top); ! return 0; } else *************** *** 2593,2604 **** */ #if __STD_C ! size_t malloc_usable_size(Void_t* mem) #else ! size_t malloc_usable_size(mem) Void_t* mem; #endif { mchunkptr p; if (mem == 0) return 0; else --- 3034,3046 ---- */ #if __STD_C ! size_t mALLOC_USABLE_SIZe(Void_t* mem) #else ! size_t mALLOC_USABLE_SIZe(mem) Void_t* mem; #endif { mchunkptr p; + if (mem == 0) return 0; else *************** *** 2608,2615 **** { if (!inuse(p)) return 0; check_inuse_chunk(p); } ! return chunksize(p) - SIZE_SZ; } } --- 3050,3058 ---- { if (!inuse(p)) return 0; check_inuse_chunk(p); + return chunksize(p) - SIZE_SZ; } ! return chunksize(p) - 2*SIZE_SZ; } } *************** *** 2618,2624 **** /* Utility to update current_mallinfo for malloc_stats and mallinfo() */ ! static void malloc_update_mallinfo(void) { int i; mbinptr b; --- 3061,3067 ---- /* Utility to update current_mallinfo for malloc_stats and mallinfo() */ ! static void malloc_update_mallinfo() { int i; mbinptr b; *************** *** 2627,2644 **** mchunkptr q; #endif ! size_t avail = chunksize(top); int navail = ((long)(avail) >= (long)MINSIZE)? 1 : 0; for (i = 1; i < NAV; ++i) { b = bin_at(i); ! for (p = last(b); p != b; p = p->bk) { #if DEBUG check_free_chunk(p); ! for (q = next_chunk(p); ! q < top && inuse(q) && (long)(chunksize(q)) >= (long)MINSIZE; q = next_chunk(q)) check_inuse_chunk(q); #endif --- 3070,3087 ---- mchunkptr q; #endif ! INTERNAL_SIZE_T avail = chunksize(top); int navail = ((long)(avail) >= (long)MINSIZE)? 1 : 0; for (i = 1; i < NAV; ++i) { b = bin_at(i); ! for (p = last(b); p != b; p = p->bk) { #if DEBUG check_free_chunk(p); ! for (q = next_chunk(p); ! q < top && inuse(q) && (long)(chunksize(q)) >= (long)MINSIZE; q = next_chunk(q)) check_inuse_chunk(q); #endif *************** *** 2662,2670 **** malloc_stats: ! Prints on stderr the amount of space obtain from the system (both ! via sbrk and mmap), the maximum amount (which may be more than ! current if malloc_trim and/or munmap got called), the maximum number of simultaneous mmap regions used, and the current number of bytes allocated via malloc (or realloc, etc) but not yet freed. (Note that this is the number of bytes allocated, not the --- 3105,3113 ---- malloc_stats: ! Prints on stderr the amount of space obtained from the system ! (both via sbrk and mmap), the maximum amount (which may be more ! than current if malloc_trim and/or munmap got called), the maximum number of simultaneous mmap regions used, and the current number of bytes allocated via malloc (or realloc, etc) but not yet freed. (Note that this is the number of bytes allocated, not the *************** *** 2673,2689 **** */ ! void malloc_stats(void) { malloc_update_mallinfo(); ! fprintf(stderr, "max system bytes = %10u\n", (unsigned int)(max_total_mem)); ! fprintf(stderr, "system bytes = %10u\n", (unsigned int)(sbrked_mem + mmapped_mem)); ! fprintf(stderr, "in use bytes = %10u\n", (unsigned int)(current_mallinfo.uordblks + mmapped_mem)); #if HAVE_MMAP ! fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)max_n_mmaps); #endif } --- 3116,3132 ---- */ ! void mALLOC_STATs() { malloc_update_mallinfo(); ! fprintf(stderr, "max system bytes = %10u\n", (unsigned int)(max_total_mem)); ! fprintf(stderr, "system bytes = %10u\n", (unsigned int)(sbrked_mem + mmapped_mem)); ! fprintf(stderr, "in use bytes = %10u\n", (unsigned int)(current_mallinfo.uordblks + mmapped_mem)); #if HAVE_MMAP ! fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)max_n_mmaps); #endif } *************** *** 2720,2731 **** int mALLOPt(param_number, value) int param_number; int value; #endif { ! switch(param_number) { case M_TRIM_THRESHOLD: ! trim_threshold = value; return 1; case M_TOP_PAD: ! top_pad = value; return 1; case M_MMAP_THRESHOLD: mmap_threshold = value; return 1; case M_MMAP_MAX: --- 3163,3174 ---- int mALLOPt(param_number, value) int param_number; int value; #endif { ! switch(param_number) { case M_TRIM_THRESHOLD: ! trim_threshold = value; return 1; case M_TOP_PAD: ! top_pad = value; return 1; case M_MMAP_THRESHOLD: mmap_threshold = value; return 1; case M_MMAP_MAX: *************** *** 2734,2769 **** #else if (value != 0) return 0; else n_mmaps_max = value; return 1; #endif default: return 0; } } /* History: V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) ! * Malloc, calloc: add optimizations from Raymond Nijssen * malloc_extend_top: fix mask error that caused wastage after foreign sbrks * Add linux mremap support code from HJ Liu ! V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) * Integrated most documentation with the code. ! * Add support for mmap, with help from Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Use last_remainder in more cases. * Pack bins using idea from colin@nyx10.cs.du.edu ! * Use ordered bins instead of best-fit threshhold * Eliminate block-local decls to simplify tracing and debugging. * Support another case of realloc via move into top ! * Fix error occuring when initial sbrk_base not word-aligned. * Rely on page size for units instead of SBRK_UNIT to avoid surprises about sbrk alignment conventions. * Add mallinfo, mallopt. Thanks to Raymond Nijssen ! (raymond@es.ele.tue.nl) for the suggestion. * Add `pad' argument to malloc_trim and top_pad mallopt parameter. * More precautions for cases where other routines call sbrk, courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). --- 3177,3519 ---- #else if (value != 0) return 0; else n_mmaps_max = value; return 1; #endif + case M_CHECK_ACTION: + check_action = value; return 1; default: return 0; } } + + + /* Malloc hooks: When compiling with MALLOC_HOOKS defined, all calls + to malloc(), realloc(), free() and memalign() are routed through + the global function pointers __malloc_hook, __realloc_hook, + __free_hook and __memalign_hook if they are not NULL. Therefore + the malloc implementation can be changed at runtime, if care is + taken not to call free() or realloc() on pointers obtained with a + different implementation than the one currently in effect. (The + easiest way to guarantee this is to set up the hooks before any + malloc call, e.g. with a function pointed to by the global + variable __malloc_initialize_hook). You can set the environment + variable `MALLOC_CHECK_' (note the trailing underscore) to activate + a standard set of debugging hooks automatically. Depending on the + value of check_action (which can be set with mallopt() or with a + single digit in the environment variable), an invalid free() or + realloc() will be silently ignored (check_action=0), diagnostics + will be printed on stderr (check_action=1), or abort() will be + called (check_action=2). */ + + #ifdef MALLOC_HOOKS + + /* Already initialized? */ + int __libc_malloc_initialized = 0; + + /* Initialization routine. */ + static void + malloc_init () + { + char* s; + + if(__libc_malloc_initialized) return; + __libc_malloc_initialized = 1; + s = getenv("MALLOC_CHECK_"); + if(s) { + if(s[0]) mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0')); + __malloc_check_init(); + } + if(__malloc_initialize_hook != NULL) + (*__malloc_initialize_hook)(); + } + + /* Hooks for debugging versions. The initial hooks just call the + initialization routine, then do the normal work. */ + + static Void_t* + #if __STD_C + malloc_hook_ini(size_t sz) + #else + malloc_hook_ini(sz) size_t sz; + #endif + { + __malloc_hook = NULL; + __realloc_hook = NULL; + __memalign_hook = NULL; + malloc_init(); + return mALLOc(sz); + } + + static Void_t* + #if __STD_C + realloc_hook_ini(Void_t* ptr, size_t sz) + #else + realloc_hook_ini(ptr, sz) Void_t* ptr; size_t sz; + #endif + { + __malloc_hook = NULL; + __realloc_hook = NULL; + __memalign_hook = NULL; + malloc_init(); + return rEALLOc(ptr, sz); + } + + static Void_t* + #if __STD_C + memalign_hook_ini(size_t sz, size_t alignment) + #else + memalign_hook_ini(sz, alignment) size_t sz; size_t alignment; + #endif + { + __malloc_hook = NULL; + __realloc_hook = NULL; + __memalign_hook = NULL; + malloc_init(); + return mEMALIGn(sz, alignment); + } + + void (*__malloc_initialize_hook) () = NULL; + void (*__free_hook) () = NULL; + Void_t* (*__malloc_hook) () = malloc_hook_ini; + Void_t* (*__realloc_hook) () = realloc_hook_ini; + Void_t* (*__memalign_hook) () = memalign_hook_ini; + + /* A simple, standard set of debugging hooks. Overhead is `only' one + byte per chunk; still this will catch most cases of double frees or + overruns. */ + + #if __STD_C + 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); + #else + static Void_t* malloc_check(); + static void free_check(); + static Void_t* realloc_check(); + static Void_t* memalign_check(); + #endif + + #define MAGICBYTE(p) ( ( ((unsigned)p >> 3) ^ ((unsigned)p >> 11)) & 0xFF ) + + /* Convert a pointer to be free()d or realloc()ed to a valid chunk + pointer. If the provided pointer is not valid, return NULL. The + goal here is to avoid crashes, unlike in the MALLOC_DEBUG code. */ + + static mchunkptr + #if __STD_C + mem2chunk_check(Void_t* mem) + #else + mem2chunk_check(mem) Void_t* mem; + #endif + { + mchunkptr p; + INTERNAL_SIZE_T sz; + + p = mem2chunk(mem); + if(!aligned_OK(p)) return NULL; + if( (char*)p>=sbrk_base && (char*)p<(sbrk_base+sbrked_mem) ) { + /* Must be a chunk in conventional heap memory. */ + if(chunk_is_mmapped(p) || + ( (sz = chunksize(p)), ((char*)p + sz)>=(sbrk_base+sbrked_mem) ) || + szprev_size&MALLOC_ALIGN_MASK || + (long)prev_chunk(p)<(long)sbrk_base || + next_chunk(prev_chunk(p))!=p) )) + return NULL; + if(*((unsigned char*)p + sz + (SIZE_SZ-1)) != MAGICBYTE(p)) + return NULL; + *((unsigned char*)p + sz + (SIZE_SZ-1)) ^= 0xFF; + } else { + unsigned long offset, page_mask = malloc_getpagesize-1; + + /* mmap()ed chunks have MALLOC_ALIGNMENT or higher power-of-two + alignment relative to the beginning of a page. Check this + first. */ + offset = (unsigned long)mem & page_mask; + if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 && + offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 && + offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 && + offset<0x2000) || + !chunk_is_mmapped(p) || (p->size & PREV_INUSE) || + ( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) || + ( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) ) + return NULL; + if(*((unsigned char*)p + sz - 1) != MAGICBYTE(p)) + return NULL; + *((unsigned char*)p + sz - 1) ^= 0xFF; + } + return p; + } + + static Void_t* + #if __STD_C + malloc_check(size_t sz) + #else + malloc_check(sz) size_t sz; + #endif + { + Void_t* mem; + mchunkptr victim; + INTERNAL_SIZE_T nb; + + __malloc_hook = NULL; + __free_hook = NULL; + mem = mALLOc(sz + 1); + __malloc_hook = malloc_check; + __free_hook = free_check; + if(!mem) return NULL; + victim = mem2chunk(mem); + nb = chunksize(victim); + if(chunk_is_mmapped(victim)) + --nb; + else + nb += SIZE_SZ - 1; + *((unsigned char*)victim + nb) = MAGICBYTE(victim); + return mem; + } + + static void + #if __STD_C + free_check(Void_t* mem) + #else + free_check(mem) Void_t* mem; + #endif + { + mchunkptr p; + + if(!mem) return; + p = mem2chunk_check(mem); + if(!p) { + switch(check_action) { + case 1: + fprintf(stderr, "free(): invalid pointer %lx!\n", (long)(mem)); + break; + case 2: + abort(); + } + return; + } + __free_hook = NULL; + fREe(mem); + __free_hook = free_check; + } + + static Void_t* + #if __STD_C + realloc_check(Void_t* oldmem, size_t bytes) + #else + realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes; + #endif + { + mchunkptr oldp, newp; + Void_t* newmem; + INTERNAL_SIZE_T nb; + + if (oldmem == 0) return malloc_check(bytes); + oldp = mem2chunk_check(oldmem); + if(!oldp) { + switch(check_action) { + case 1: + fprintf(stderr, "realloc(): invalid pointer %lx!\n", (long)(oldmem)); + break; + case 2: + abort(); + } + return malloc_check(bytes); + } + __realloc_hook = NULL; + __malloc_hook = NULL; + __free_hook = NULL; + newmem = rEALLOc(oldmem, bytes+1); + __realloc_hook = realloc_check; + __malloc_hook = malloc_check; + __free_hook = free_check; + if(!newmem) return NULL; + newp = mem2chunk(newmem); + nb = chunksize(newp); + if(chunk_is_mmapped(newp)) + --nb; + else + nb += SIZE_SZ - 1; + *((unsigned char*)newp + nb) = MAGICBYTE(newp); + return newmem; + } + + static Void_t* + #if __STD_C + memalign_check(size_t alignment, size_t bytes) + #else + memalign_check(alignment, bytes) size_t alignment; size_t bytes; + #endif + { + INTERNAL_SIZE_T nb; + Void_t* newmem; + mchunkptr p; + + if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes); + + __memalign_hook = NULL; + __malloc_hook = NULL; + __free_hook = NULL; + newmem = mEMALIGn(alignment, bytes+1); + __memalign_hook = memalign_check; + __malloc_hook = malloc_check; + __free_hook = free_check; + if(!newmem) return NULL; + p = mem2chunk(newmem); + nb = chunksize(p); + if(chunk_is_mmapped(p)) + --nb; + else + nb += SIZE_SZ - 1; + *((unsigned char*)p + nb) = MAGICBYTE(p); + return newmem; + } + + /* Activate a standard set of debugging hooks. */ + void + __malloc_check_init() + { + __malloc_hook = malloc_check; + __free_hook = free_check; + __realloc_hook = realloc_check; + __memalign_hook = memalign_check; + if(check_action == 1) + fprintf(stderr, "malloc: using debugging hooks\n"); + } + + #endif /* defined(MALLOC_HOOKS) */ + /* History: + V2.6.4 + * Added `hooks' (mostly for debugging at runtime) V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) ! * Added pvalloc, as recommended by H.J. Liu ! * Added 64bit pointer support mainly from Wolfram Gloger ! * Added anonymously donated WIN32 sbrk emulation ! * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen * malloc_extend_top: fix mask error that caused wastage after foreign sbrks * Add linux mremap support code from HJ Liu ! V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) * Integrated most documentation with the code. ! * Add support for mmap, with help from Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Use last_remainder in more cases. * Pack bins using idea from colin@nyx10.cs.du.edu ! * Use ordered bins instead of best-fit threshold * Eliminate block-local decls to simplify tracing and debugging. * Support another case of realloc via move into top ! * Fix error occurring when initial sbrk_base not word-aligned. * Rely on page size for units instead of SBRK_UNIT to avoid surprises about sbrk alignment conventions. * Add mallinfo, mallopt. Thanks to Raymond Nijssen ! (raymond@es.ele.tue.nl) for the suggestion. * Add `pad' argument to malloc_trim and top_pad mallopt parameter. * More precautions for cases where other routines call sbrk, courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). *************** *** 2787,2793 **** Paul Wilson (wilson@cs.texas.edu) for the suggestion. V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) ! * Added malloc_trim, with help from Wolfram Gloger (wmglo@Dent.MED.Uni-Muenchen.DE). V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) --- 3537,3543 ---- Paul Wilson (wilson@cs.texas.edu) for the suggestion. V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) ! * Added malloc_trim, with help from Wolfram Gloger (wmglo@Dent.MED.Uni-Muenchen.DE). V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) *************** *** 2807,2826 **** (eliminating old malloc_find_space & malloc_clean_bin) * Scan 2 returns chunks (not just 1) * Propagate failure in realloc if malloc returns 0 ! * Add stuff to allow compilation on non-ANSI compilers from kpv@research.att.com ! V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) * removed potential for odd address access in prev_chunk * removed dependency on getpagesize.h * misc cosmetics and a bit more internal documentation * anticosmetics: mangled names in macros to evade debugger strangeness ! * tested on sparc, hp-700, dec-mips, rs6000 with gcc & native cc (hp, dec only) allowing Detlefs & Zorn comparison study (in SIGPLAN Notices.) Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) ! * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) */ --- 3557,3576 ---- (eliminating old malloc_find_space & malloc_clean_bin) * Scan 2 returns chunks (not just 1) * Propagate failure in realloc if malloc returns 0 ! * Add stuff to allow compilation on non-ANSI compilers from kpv@research.att.com ! V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) * removed potential for odd address access in prev_chunk * removed dependency on getpagesize.h * misc cosmetics and a bit more internal documentation * anticosmetics: mangled names in macros to evade debugger strangeness ! * tested on sparc, hp-700, dec-mips, rs6000 with gcc & native cc (hp, dec only) allowing Detlefs & Zorn comparison study (in SIGPLAN Notices.) Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) ! * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) */ Index: linux/libc/elf/libc/jump.params diff -c linux/libc/elf/libc/jump.params:1.70 linux/libc/elf/libc/jump.params:1.76 *** linux/libc/elf/libc/jump.params:1.70 Fri Dec 6 07:40:02 1996 --- linux/libc/elf/libc/jump.params Fri Feb 14 19:38:15 1997 *************** *** 1 **** ! Version=5.4.17 --- 1 ---- ! Version=5.4.23 Index: linux/libc/elf/libm/jump.params diff -c linux/libc/elf/libm/jump.params:1.9 linux/libc/elf/libm/jump.params:1.10 *** linux/libc/elf/libm/jump.params:1.9 Tue Dec 3 19:11:11 1996 --- linux/libc/elf/libm/jump.params Mon Feb 3 19:54:18 1997 *************** *** 1 **** ! Version=5.0.7 --- 1 ---- ! Version=5.0.8 Index: linux/libc/inet/gethstnmad.c diff -c linux/libc/inet/gethstnmad.c:1.14 linux/libc/inet/gethstnmad.c:1.15 *** linux/libc/inet/gethstnmad.c:1.14 Fri Oct 4 15:52:51 1996 --- linux/libc/inet/gethstnmad.c Fri Feb 14 19:38:15 1997 *************** *** 1024,1030 **** switch (service_order[cc]) { case SERVICE_BIND: if ((n = res_search(name, C_IN, T_A, ! buf.buf, sizeof(buf))) < 0) { #ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_search failed\n"); --- 1024,1030 ---- switch (service_order[cc]) { case SERVICE_BIND: if ((n = res_search(name, C_IN, T_A, ! buf.buf, sizeof(buf.buf))) < 0) { #ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_search failed\n"); Index: linux/libc/inet/rcmd.c diff -c linux/libc/inet/rcmd.c:1.6 linux/libc/inet/rcmd.c:1.7 *** linux/libc/inet/rcmd.c:1.6 Fri Sep 13 01:44:20 1996 --- linux/libc/inet/rcmd.c Tue Dec 17 08:22:49 1996 *************** *** 68,74 **** pid = getpid(); #endif hp = gethostbyname(*ahost); ! if (hp == 0) { #if NLS fprintf(stderr, "%s: %s\n", *ahost, catgets(_libc_cat, HerrorListSet, --- 68,74 ---- pid = getpid(); #endif hp = gethostbyname(*ahost); ! if (hp == 0 || sizeof (sin.sin_addr) < hp->h_length) { #if NLS fprintf(stderr, "%s: %s\n", *ahost, catgets(_libc_cat, HerrorListSet, Index: linux/libc/inet/rexec.c diff -c linux/libc/inet/rexec.c:1.5 linux/libc/inet/rexec.c:1.6 *** linux/libc/inet/rexec.c:1.5 Mon Oct 14 11:13:31 1996 --- linux/libc/inet/rexec.c Tue Dec 17 08:22:49 1996 *************** *** 60,66 **** libc_nls_init(); #endif hp = gethostbyname(*ahost); ! if (hp == 0) { #if NLS fprintf(stderr, "%s: %s\n", *ahost, catgets(_libc_cat, HerrorListSet, --- 60,66 ---- libc_nls_init(); #endif hp = gethostbyname(*ahost); ! if (hp == 0 || sizeof (sin.sin_addr) < hp->h_length) { #if NLS fprintf(stderr, "%s: %s\n", *ahost, catgets(_libc_cat, HerrorListSet, Index: linux/libc/libio/printf_fp.c diff -c linux/libc/libio/printf_fp.c:1.6 linux/libc/libio/printf_fp.c:1.7 *** linux/libc/libio/printf_fp.c:1.6 Fri Oct 4 15:52:58 1996 --- linux/libc/libio/printf_fp.c Tue Dec 17 08:22:50 1996 *************** *** 969,975 **** else if (*grouping == 0) { /* Same grouping repeats. */ ! groups += intdig_max / grouping[-1]; break; } } --- 969,975 ---- else if (*grouping == 0) { /* Same grouping repeats. */ ! groups += (intdig_max - 1) / grouping[-1]; break; } } Index: linux/libc/libio/stdio/setfileno.c diff -c linux/libc/libio/stdio/setfileno.c:1.4 linux/libc/libio/stdio/setfileno.c:1.5 *** linux/libc/libio/stdio/setfileno.c:1.4 Fri Oct 4 15:53:00 1996 --- linux/libc/libio/stdio/setfileno.c Sat Jan 4 10:49:32 1997 *************** *** 8,13 **** --- 8,15 ---- void setfileno( _IO_FILE *, int ); + void setfileno(_IO_FILE* fp, int fd) _IO_attr_weak; + void setfileno( _IO_FILE *fp, int fd ) { Index: linux/libc/libio/stdio/stdio.h diff -c linux/libc/libio/stdio/stdio.h:1.5 linux/libc/libio/stdio/stdio.h:1.6 *** linux/libc/libio/stdio/stdio.h:1.5 Tue Mar 12 21:08:25 1996 --- linux/libc/libio/stdio/stdio.h Sat Jan 4 10:49:32 1997 *************** *** 109,146 **** #endif __BEGIN_DECLS ! extern void clearerr __P((FILE*)); extern int fclose __P((FILE*)); extern int feof __P((FILE*)); extern int ferror __P((FILE*)); extern int fflush __P((FILE*)); ! extern int fgetc __P((FILE *)); extern int fgetpos __P((FILE* fp, fpos_t *pos)); extern char* fgets __P((char*, int, FILE*)); extern FILE* fopen __P((__const char*, __const char*)); extern int fprintf __P((FILE*, __const char* format, ...)); ! extern int fputc __P((int, FILE*)); extern int fputs __P((__const char *str, FILE *fp)); extern size_t fread __P((void*, size_t, size_t, FILE*)); ! extern FILE* freopen __P((__const char*, __const char*, FILE*)); extern int fscanf __P((FILE *fp, __const char* format, ...)); ! extern int fseek __P((FILE* fp, long int offset, int whence)); extern int fsetpos __P((FILE* fp, __const fpos_t *pos)); extern long int ftell __P((FILE* fp)); extern size_t fwrite __P((__const void*, size_t, size_t, FILE*)); ! extern int getc __P((FILE *)); ! extern int getchar __P((void)); extern char* gets __P((char*)); extern void perror __P((__const char *)); extern int printf __P((__const char* format, ...)); ! extern int putc __P((int, FILE *)); ! extern int putchar __P((int)); extern int puts __P((__const char *str)); extern int remove __P((__const char*)); extern int rename __P((__const char* _old, __const char* _new)); ! extern void rewind __P((FILE*)); extern int scanf __P((__const char* format, ...)); extern void setbuf __P((FILE*, char*)); extern void setlinebuf __P((FILE*)); --- 109,152 ---- #endif + #if !defined(_LIBPTHREAD) && defined(__ELF__) + #define _IO_attr_weak __attribute__((weak)) + #else + #define _IO_attr_weak /* nothing */ + #endif + __BEGIN_DECLS ! extern void clearerr __P((FILE*)) _IO_attr_weak; extern int fclose __P((FILE*)); extern int feof __P((FILE*)); extern int ferror __P((FILE*)); extern int fflush __P((FILE*)); ! extern int fgetc __P((FILE *)) _IO_attr_weak; extern int fgetpos __P((FILE* fp, fpos_t *pos)); extern char* fgets __P((char*, int, FILE*)); extern FILE* fopen __P((__const char*, __const char*)); extern int fprintf __P((FILE*, __const char* format, ...)); ! extern int fputc __P((int, FILE*)) _IO_attr_weak; extern int fputs __P((__const char *str, FILE *fp)); extern size_t fread __P((void*, size_t, size_t, FILE*)); ! extern FILE* freopen __P((__const char*, __const char*, FILE*)) _IO_attr_weak; extern int fscanf __P((FILE *fp, __const char* format, ...)); ! extern int fseek __P((FILE* fp, long int offset, int whence)) _IO_attr_weak; extern int fsetpos __P((FILE* fp, __const fpos_t *pos)); extern long int ftell __P((FILE* fp)); extern size_t fwrite __P((__const void*, size_t, size_t, FILE*)); ! extern int getc __P((FILE *)) _IO_attr_weak; ! extern int getchar __P((void)) _IO_attr_weak; extern char* gets __P((char*)); extern void perror __P((__const char *)); extern int printf __P((__const char* format, ...)); ! extern int putc __P((int, FILE *)) _IO_attr_weak; ! extern int putchar __P((int)) _IO_attr_weak; extern int puts __P((__const char *str)); extern int remove __P((__const char*)); extern int rename __P((__const char* _old, __const char* _new)); ! extern void rewind __P((FILE*)) _IO_attr_weak; extern int scanf __P((__const char* format, ...)); extern void setbuf __P((FILE*, char*)); extern void setlinebuf __P((FILE*)); *************** *** 156,167 **** extern int vsprintf __P((char* string, __const char* format, _G_va_list)); #if !defined(__STRICT_ANSI__) ! extern int vfscanf __P((FILE*, __const char *, _G_va_list)); extern int vscanf __P((__const char *, _G_va_list)); extern int vsscanf __P((__const char *, __const char *, _G_va_list)); ! extern int getw __P((FILE*)); ! extern int putw __P((int, FILE*)); extern char* tempnam __P((__const char *__dir, __const char *__pfx)); --- 162,173 ---- extern int vsprintf __P((char* string, __const char* format, _G_va_list)); #if !defined(__STRICT_ANSI__) ! extern int vfscanf __P((FILE*, __const char *, _G_va_list)) _IO_attr_weak; extern int vscanf __P((__const char *, _G_va_list)); extern int vsscanf __P((__const char *, __const char *, _G_va_list)); ! extern int getw __P((FILE*)) _IO_attr_weak; ! extern int putw __P((int, FILE*)) _IO_attr_weak; extern char* tempnam __P((__const char *__dir, __const char *__pfx)); Index: linux/libc/login/getpass.c diff -c linux/libc/login/getpass.c:1.1.1.1 linux/libc/login/getpass.c:1.2 *** linux/libc/login/getpass.c:1.1.1.1 Fri Feb 17 21:33:22 1995 --- linux/libc/login/getpass.c Sat Jan 4 10:49:33 1997 *************** *** 21,29 **** setbuf(tty, (char *)NULL); ioctl(fileno(tty), TCGETS, &ttyb); ioctl(fileno(tty), TCGETS, &ttysav); ! ttyb.c_lflag &= ~(ECHO|ISIG); ioctl(fileno(tty), TCSETS, &ttyb); fflush(stdout); --- 21,36 ---- setbuf(tty, (char *)NULL); ioctl(fileno(tty), TCGETS, &ttyb); + #if 0 ioctl(fileno(tty), TCGETS, &ttysav); + #else + ttysav = ttyb; + #endif ! /* Tricky, tricky. */ ! ttyb.c_cc[VTIME] = 0; ! ttyb.c_cc[VMIN] = 1; ! ttyb.c_lflag &= ~(ECHO|ISIG|ICANON); ioctl(fileno(tty), TCSETS, &ttyb); fflush(stdout); Index: linux/libc/regex/rx.c diff -c linux/libc/regex/rx.c:1.9 linux/libc/regex/rx.c:1.11 *** linux/libc/regex/rx.c:1.9 Fri Oct 4 15:53:11 1996 --- linux/libc/regex/rx.c Sun Jan 5 17:07:01 1997 *************** *** 3431,3440 **** --- 3431,3445 ---- template.car = car; template.cdr = cdr; template.id = car->id; + /* While hash_store will protect cdr itself it might first allocate hash + tables and stuff which might cause it to be garbage collected before + it's protected -- [gsstark:19961026.2155EST] */ + rx_protect_superset (rx, cdr); hit = rx_hash_store (&cache->superset_table, (unsigned long)car ^ car->id ^ (unsigned long)cdr, (void *)&template, &cache->superset_hash_rules); + rx_release_superset (rx, cdr); return (hit ? (struct rx_superset *)hit->data : 0); Index: linux/libc/rpc/xdr.c diff -c linux/libc/rpc/xdr.c:1.3 linux/libc/rpc/xdr.c:1.4 *** linux/libc/rpc/xdr.c:1.3 Sun Oct 20 21:40:19 1996 --- linux/libc/rpc/xdr.c Sat Jan 11 11:22:09 1997 *************** *** 671,676 **** --- 671,677 ---- } /* fall through... */ case XDR_ENCODE: + if (sp == NULL) return (FALSE); size = strlen(sp); break; default: break; Index: linux/libc/stdlib/strtod.c diff -c linux/libc/stdlib/strtod.c:1.10 linux/libc/stdlib/strtod.c:1.11 *** linux/libc/stdlib/strtod.c:1.10 Fri Oct 4 15:53:21 1996 --- linux/libc/stdlib/strtod.c Sat Jan 4 10:49:36 1997 *************** *** 406,412 **** /* If no other digit but a '0' is found the result is 0.0. Return current read pointer. */ ! if (!isdigit (c) && c != decimal) { tp = correctly_grouped_prefix (start_of_digits, cp, thousands, grouping); /* If TP is at the start of the digits, there was no correctly --- 406,412 ---- /* If no other digit but a '0' is found the result is 0.0. Return current read pointer. */ ! if (!isdigit (c) && c != decimal && tolower (c) != 'e') { tp = correctly_grouped_prefix (start_of_digits, cp, thousands, grouping); /* If TP is at the start of the digits, there was no correctly Index: linux/libc/sysdeps/linux/Makefile diff -c linux/libc/sysdeps/linux/Makefile:1.21 linux/libc/sysdeps/linux/Makefile:1.22 *** linux/libc/sysdeps/linux/Makefile:1.21 Tue Dec 3 07:34:22 1996 --- linux/libc/sysdeps/linux/Makefile Sun Jan 26 22:33:22 1997 *************** *** 60,66 **** rename.S setdnnm.S setgroups.S sethstnm.S setpgid.S \ setprio.S setrlimit.S sigpending.S stime.S swapoff.S \ swapon.S sync.S time.S truncate.S umount.S uselib.S \ ! utime.S vhangup.S vm86.S mprotect.S \ __adjtimex.S getpgid.S __ipc.S __setfsgid.S __setfsuid.S \ __syscall_flock.S __getdents.S \ __prev_fstat.S __prev_lstat.S __prev_stat.S __prev_mknod.S \ --- 60,66 ---- rename.S setdnnm.S setgroups.S sethstnm.S setpgid.S \ setprio.S setrlimit.S sigpending.S stime.S swapoff.S \ swapon.S sync.S time.S truncate.S umount.S uselib.S \ ! utime.S vhangup.S mprotect.S \ __adjtimex.S getpgid.S __ipc.S __setfsgid.S __setfsuid.S \ __syscall_flock.S __getdents.S \ __prev_fstat.S __prev_lstat.S __prev_stat.S __prev_mknod.S \ Index: linux/libc/sysdeps/linux/accept.c diff -c linux/libc/sysdeps/linux/accept.c:1.6 linux/libc/sysdeps/linux/accept.c:1.7 *** linux/libc/sysdeps/linux/accept.c:1.6 Fri Oct 4 15:53:26 1996 --- linux/libc/sysdeps/linux/accept.c Sat Jan 4 10:49:37 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + struct sockaddr; + int accept ( int, const struct sockaddr *, int * ) __attribute__ ((weak)); + #else + #pragma weak accept + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 19,29 **** args[2] = (unsigned long)paddrlen; return socketcall(SYS_ACCEPT, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int accept ( int, const struct sockaddr *, int * ) __attribute__ ((weak)); - #else - #pragma weak accept - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 28,30 ---- Index: linux/libc/sysdeps/linux/bind.c diff -c linux/libc/sysdeps/linux/bind.c:1.6 linux/libc/sysdeps/linux/bind.c:1.7 *** linux/libc/sysdeps/linux/bind.c:1.6 Fri Oct 4 15:53:27 1996 --- linux/libc/sysdeps/linux/bind.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + struct sockaddr; + int bind ( int, const struct sockaddr *, int ) __attribute__ (( weak )); + #else + #pragma weak bind + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 19,29 **** args[2] = addrlen; return socketcall(SYS_BIND, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int bind ( int, const struct sockaddr *, int ) __attribute__ (( weak )); - #else - #pragma weak bind - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 28,30 ---- Index: linux/libc/sysdeps/linux/connect.c diff -c linux/libc/sysdeps/linux/connect.c:1.6 linux/libc/sysdeps/linux/connect.c:1.7 *** linux/libc/sysdeps/linux/connect.c:1.6 Fri Oct 4 15:53:27 1996 --- linux/libc/sysdeps/linux/connect.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + struct sockaddr; + int connect ( int, const struct sockaddr *, int ) __attribute__ (( weak )); + #else + #pragma weak connect + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 19,29 **** args[2] = addrlen; return socketcall(SYS_CONNECT, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int connect ( int, const struct sockaddr *, int ) __attribute__ (( weak )); - #else - #pragma weak connect - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 28,30 ---- Index: linux/libc/sysdeps/linux/getpeernam.c diff -c linux/libc/sysdeps/linux/getpeernam.c:1.5 linux/libc/sysdeps/linux/getpeernam.c:1.6 *** linux/libc/sysdeps/linux/getpeernam.c:1.5 Fri Oct 4 15:53:27 1996 --- linux/libc/sysdeps/linux/getpeernam.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + struct sockaddr; + int getpeername( int, struct sockaddr *, int * ) __attribute__ (( weak )); + #else + #pragma weak getpeername + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 19,29 **** args[2] = (unsigned long)paddrlen; return socketcall(SYS_GETPEERNAME, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int getpeernam( int, struct sockaddr *, int * ) __attribute__ (( weak )); - #else - #pragma weak getpeername - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 28,30 ---- Index: linux/libc/sysdeps/linux/getsocknam.c diff -c linux/libc/sysdeps/linux/getsocknam.c:1.5 linux/libc/sysdeps/linux/getsocknam.c:1.6 *** linux/libc/sysdeps/linux/getsocknam.c:1.5 Fri Oct 4 15:53:27 1996 --- linux/libc/sysdeps/linux/getsocknam.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + struct sockaddr; + int getsockname( int, struct sockaddr *, int * ) __attribute__ ((weak)); + #else + #pragma weak getsockname + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 19,29 **** args[2] = (unsigned long)paddrlen; return socketcall(SYS_GETSOCKNAME, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int getsocknam( int, struct sockaddr *, int * ) __attribute__ ((weak)); - #else - #pragma weak getsockname - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 28,30 ---- Index: linux/libc/sysdeps/linux/getsockopt.c diff -c linux/libc/sysdeps/linux/getsockopt.c:1.5 linux/libc/sysdeps/linux/getsockopt.c:1.6 *** linux/libc/sysdeps/linux/getsockopt.c:1.5 Fri Oct 4 15:53:27 1996 --- linux/libc/sysdeps/linux/getsockopt.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,9 ---- + #ifdef __ELF__ + /* #pragma weak getsockopt */ + int getsockopt (int, int, int, void *, int *) __attribute__ (( weak )); + + #endif + #include #include #include *************** *** 20,28 **** args[4]=(unsigned long)optlen; return (socketcall (SYS_GETSOCKOPT, args)); } - - #ifdef __ELF__ - /* #pragma weak getsockopt */ - int getsockopt (int, int, int, void *, int *) __attribute__ (( weak )); - - #endif --- 26,28 ---- Index: linux/libc/sysdeps/linux/listen.c diff -c linux/libc/sysdeps/linux/listen.c:1.5 linux/libc/sysdeps/linux/listen.c:1.6 *** linux/libc/sysdeps/linux/listen.c:1.5 Fri Oct 4 15:53:27 1996 --- linux/libc/sysdeps/linux/listen.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,11 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + int listen(int, int) __attribute__ ((weak)); + #else + #pragma weak listen + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 18,28 **** args[1] = backlog; return socketcall(SYS_LISTEN, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int listen(int, int) __attribute ((weak)); - #else - #pragma weak listen - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 26,28 ---- Index: linux/libc/sysdeps/linux/recv.c diff -c linux/libc/sysdeps/linux/recv.c:1.6 linux/libc/sysdeps/linux/recv.c:1.7 *** linux/libc/sysdeps/linux/recv.c:1.6 Fri Oct 4 15:53:28 1996 --- linux/libc/sysdeps/linux/recv.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + #include /* for size_t */ + int recv (int, void *, size_t, unsigned) __attribute__ ((weak)); + #else + #pragma weak recv + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 21,31 **** args[3] = flags; return (socketcall (SYS_RECV, args)); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int recv (int, void *, size_t, unsigned) __attribute__ ((weak)); - #else - #pragma weak recv - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 30,32 ---- Index: linux/libc/sysdeps/linux/recvfrom.c diff -c linux/libc/sysdeps/linux/recvfrom.c:1.5 linux/libc/sysdeps/linux/recvfrom.c:1.6 *** linux/libc/sysdeps/linux/recvfrom.c:1.5 Fri Oct 4 15:53:28 1996 --- linux/libc/sysdeps/linux/recvfrom.c Sat Jan 4 10:49:38 1997 *************** *** 1,3 **** --- 1,14 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + #include /* for size_t */ + struct sockaddr; + int recvfrom (int, void *, size_t, unsigned, struct sockaddr *, int *) + __attribute__ ((weak)); + #else + #pragma weak recvfrom + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 24,35 **** args[5] = (unsigned long) tolen; return (socketcall (SYS_RECVFROM, args)); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int recvfrom (int, void *, size_t, unsigned, struct sockaddr *, int *) - __attribute__ ((weak)); - #else - #pragma weak recvfrom - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 35,37 ---- Index: linux/libc/sysdeps/linux/recvmsg.c diff -c linux/libc/sysdeps/linux/recvmsg.c:1.1 linux/libc/sysdeps/linux/recvmsg.c:1.2 *** linux/libc/sysdeps/linux/recvmsg.c:1.1 Sun Sep 10 19:26:33 1995 --- linux/libc/sysdeps/linux/recvmsg.c Sat Jan 4 10:49:39 1997 *************** *** 1,3 **** --- 1,7 ---- + #ifdef __ELF__ + int recvmsg() __attribute__((weak)); + #endif + #include #include #include *************** *** 18,24 **** args[2] = flags; return (socketcall (SYS_RECVMSG, args)); } - - #ifdef __ELF__ - #pragma weak sendmsg - #endif --- 22,24 ---- Index: linux/libc/sysdeps/linux/send.c diff -c linux/libc/sysdeps/linux/send.c:1.6 linux/libc/sysdeps/linux/send.c:1.7 *** linux/libc/sysdeps/linux/send.c:1.6 Fri Oct 4 15:53:28 1996 --- linux/libc/sysdeps/linux/send.c Sat Jan 4 10:49:40 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + #include /* for size_t */ + int send (int, const void *, size_t, unsigned) __attribute__ ((weak)); + #else + #pragma weak send + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 21,31 **** args[3] = flags; return (socketcall (SYS_SEND, args)); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int send (int, const void *, size_t, unsigned) __attribute__ ((weak)); - #else - #pragma weak send - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 30,32 ---- Index: linux/libc/sysdeps/linux/sendmsg.c diff -c linux/libc/sysdeps/linux/sendmsg.c:1.2 linux/libc/sysdeps/linux/sendmsg.c:1.3 *** linux/libc/sysdeps/linux/sendmsg.c:1.2 Fri Oct 4 15:53:28 1996 --- linux/libc/sysdeps/linux/sendmsg.c Sat Jan 4 10:49:40 1997 *************** *** 1,3 **** --- 1,12 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + struct msghdr; + int sendmsg (int, const struct msghdr *, unsigned) __attribute__ ((weak)); + #else + #pragma weak sendmsg + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 18,28 **** args[2] = flags; return (socketcall (SYS_SENDMSG, args)); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int sendmsg (int, const struct msghdr *, unsigned) __attribute__ ((weak)); - #else - #pragma weak sendmsg - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 27,29 ---- Index: linux/libc/sysdeps/linux/sendto.c diff -c linux/libc/sysdeps/linux/sendto.c:1.6 linux/libc/sysdeps/linux/sendto.c:1.7 *** linux/libc/sysdeps/linux/sendto.c:1.6 Fri Oct 4 15:53:29 1996 --- linux/libc/sysdeps/linux/sendto.c Sat Jan 4 10:49:40 1997 *************** *** 1,3 **** --- 1,14 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + #include /* for size_t */ + struct sockaddr; + int sendto (int, const void *, size_t, unsigned, const struct sockaddr *, int) + __attribute__ ((weak)); + #else + #pragma weak sendto + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 24,35 **** args[5] = tolen; return (socketcall (SYS_SENDTO, args)); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int sendto (int, const void *, size_t, unsigned, const struct sockaddr *, int) - __attribute__ ((weak)); - #else - #pragma weak sendto - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 35,37 ---- Index: linux/libc/sysdeps/linux/setsockopt.c diff -c linux/libc/sysdeps/linux/setsockopt.c:1.5 linux/libc/sysdeps/linux/setsockopt.c:1.6 *** linux/libc/sysdeps/linux/setsockopt.c:1.5 Fri Oct 4 15:53:29 1996 --- linux/libc/sysdeps/linux/setsockopt.c Sat Jan 4 10:49:40 1997 *************** *** 1,3 **** --- 1,11 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + int setsockopt (int, int, int, const void *, int) __attribute__ ((weak)); + #else + #pragma weak setsockopt + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 10,15 **** --- 18,24 ---- #endif /* [sg]etsockoptions by bir7@leland.stanford.edu */ + int setsockopt (int fd, int level, int optname, const void *optval, int optlen) *************** *** 22,32 **** args[4]=optlen; return (socketcall (SYS_SETSOCKOPT, args)); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int setsockopt (int, int, int, const void *, int) __attribute__ ((weak)); - #else - #pragma weak setsockopt - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 31,33 ---- Index: linux/libc/sysdeps/linux/shutdown.c diff -c linux/libc/sysdeps/linux/shutdown.c:1.5 linux/libc/sysdeps/linux/shutdown.c:1.6 *** linux/libc/sysdeps/linux/shutdown.c:1.5 Fri Oct 4 15:53:29 1996 --- linux/libc/sysdeps/linux/shutdown.c Sat Jan 4 10:49:41 1997 *************** *** 1,3 **** --- 1,11 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + int shutdown (int, int) __attribute__ ((weak)); + #else + #pragma weak shutdown + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 10,15 **** --- 18,24 ---- #endif /* shutdown by bir7@leland.stanford.edu */ + int shutdown (int sockfd, int how) { *************** *** 18,28 **** args[1] = how; return (socketcall (SYS_SHUTDOWN, args)); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int shutdown (int, int) __attribute__ ((weak)); - #else - #pragma weak shutdown - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 27,29 ---- Index: linux/libc/sysdeps/linux/socket.c diff -c linux/libc/sysdeps/linux/socket.c:1.5 linux/libc/sysdeps/linux/socket.c:1.6 *** linux/libc/sysdeps/linux/socket.c:1.5 Fri Oct 4 15:53:29 1996 --- linux/libc/sysdeps/linux/socket.c Sat Jan 4 10:49:41 1997 *************** *** 1,3 **** --- 1,11 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + int socket(int, int, int) __attribute__ ((weak)); + #else + #pragma weak socket + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 19,29 **** args[2] = protocol; return socketcall(SYS_SOCKET, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int socket(int, int, int) __attribute__ ((weak)); - #else - #pragma weak socket - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 27,29 ---- Index: linux/libc/sysdeps/linux/socketpair.c diff -c linux/libc/sysdeps/linux/socketpair.c:1.5 linux/libc/sysdeps/linux/socketpair.c:1.6 *** linux/libc/sysdeps/linux/socketpair.c:1.5 Fri Oct 4 15:53:29 1996 --- linux/libc/sysdeps/linux/socketpair.c Sat Jan 4 10:49:41 1997 *************** *** 1,3 **** --- 1,11 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + int socketpair(int, int, int, int sockvec[2]) __attribute__ ((weak)); + #else + #pragma weak socketpair + #endif /* __GNUC__ */ + #endif /* __ELF__ */ + #include #include #include *************** *** 20,30 **** args[3] = (unsigned long)sockvec; return socketcall(SYS_SOCKETPAIR, args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int socketpair(int, int, int, int sockvec[2]) __attribute__ ((weak)); - #else - #pragma weak socketpair - #endif /* __GNUC__ */ - #endif /* __ELF__ */ --- 28,30 ---- Index: linux/libc/sysdeps/linux/sysctl.c diff -c linux/libc/sysdeps/linux/sysctl.c:1.2 linux/libc/sysdeps/linux/sysctl.c:1.3 *** linux/libc/sysdeps/linux/sysctl.c:1.2 Fri Oct 4 15:53:29 1996 --- linux/libc/sysdeps/linux/sysctl.c Sat Jan 4 10:49:41 1997 *************** *** 1,3 **** --- 1,13 ---- + #ifdef __ELF__ + #ifdef __GNUC__ + #include /* for size_t */ + int sysctl(int *, int, void *, size_t *, void *, size_t) + __attribute__ ((weak)); + #else + #pragma weak sysctl + #endif + #endif + #include #include #include *************** *** 19,30 **** args.newlen = newlen; return _sysctl(&args); } - - #ifdef __ELF__ - #ifdef __GNUC__ - int sysctl(int *, int, void *, size_t *, void *, size_t) - __attribute__ ((weak)); - #else - #pragma weak sysctl - #endif - #endif --- 29,31 ---- Index: linux/libc/sysdeps/linux/vm86.S diff -c linux/libc/sysdeps/linux/vm86.S:1.2 linux/libc/sysdeps/linux/vm86.S:removed *** linux/libc/sysdeps/linux/vm86.S:1.2 Wed Dec 13 20:25:34 1995 --- linux/libc/sysdeps/linux/vm86.S Mon Feb 17 14:47:07 1997 *************** *** 1,22 **** - /* Copyright (C) 1991, 1992 Free Software Foundation, Inc. - This file is part of the 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., 675 Mass Ave, - Cambridge, MA 02139, USA. */ - - #include - - SYSCALL__ (vm86, 1) - ret --- 0 ---- Index: linux/libc/sysdeps/linux/i386/Makefile diff -c linux/libc/sysdeps/linux/i386/Makefile:1.6 linux/libc/sysdeps/linux/i386/Makefile:1.7 *** linux/libc/sysdeps/linux/i386/Makefile:1.6 Wed Apr 10 00:56:26 1996 --- linux/libc/sysdeps/linux/i386/Makefile Sun Jan 26 22:33:26 1997 *************** *** 35,41 **** # shutdown.c connect.c getpeernam.c getsocknam.c getsockopt.c # shmget.c shmat.c shmdt.c shmctl.c #SRC2S = __vfork.c vfork.c ! SRC3S = ____sig.S syscall.S # __adjtimex.S SRCS= $(SRC1S) $(SRC2S) $(SRC3S) ASMS= $(SRC1S:.c=.s) $(SRC2S:.c=.s) $(SRC3S:.S=.s) --- 35,41 ---- # shutdown.c connect.c getpeernam.c getsocknam.c getsockopt.c # shmget.c shmat.c shmdt.c shmctl.c #SRC2S = __vfork.c vfork.c ! SRC3S = ____sig.S syscall.S vm86.S vm86old.S # __adjtimex.S SRCS= $(SRC1S) $(SRC2S) $(SRC3S) ASMS= $(SRC1S:.c=.s) $(SRC2S:.c=.s) $(SRC3S:.S=.s) Index: linux/libc/sysdeps/linux/i386/__init_brk.c diff -c linux/libc/sysdeps/linux/i386/__init_brk.c:1.2 linux/libc/sysdeps/linux/i386/__init_brk.c:1.3 *** linux/libc/sysdeps/linux/i386/__init_brk.c:1.2 Fri Oct 4 15:53:31 1996 --- linux/libc/sysdeps/linux/i386/__init_brk.c Sat Jan 4 10:49:42 1997 *************** *** 1,6 **** --- 1,7 ---- #include #include #include + #include void * ___brk_addr = 0; *************** *** 31,33 **** --- 32,36 ---- } return 0; } + + weak_alias (___brk_addr, __curbrk); Index: linux/libc/sysdeps/linux/i386/vm86.S diff -c /dev/null linux/libc/sysdeps/linux/i386/vm86.S:1.1 *** /dev/null Mon Feb 17 14:47:07 1997 --- linux/libc/sysdeps/linux/i386/vm86.S Sun Jan 26 22:33:26 1997 *************** *** 0 **** --- 1,22 ---- + /* Copyright (C) 1991, 1992 Free Software Foundation, Inc. + This file is part of the 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., 675 Mass Ave, + Cambridge, MA 02139, USA. */ + + #include + + SYSCALL__ (vm86, 2) + ret Index: linux/libc/sysdeps/linux/i386/vm86old.S diff -c /dev/null linux/libc/sysdeps/linux/i386/vm86old.S:1.1 *** /dev/null Mon Feb 17 14:47:07 1997 --- linux/libc/sysdeps/linux/i386/vm86old.S Sun Jan 26 22:33:26 1997 *************** *** 0 **** --- 1,22 ---- + /* Copyright (C) 1991, 1992 Free Software Foundation, Inc. + This file is part of the 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., 675 Mass Ave, + Cambridge, MA 02139, USA. */ + + #include + + SYSCALL__ (vm86old, 1) + ret Index: linux/libc/sysdeps/linux/i386/crt/crt0.S diff -c linux/libc/sysdeps/linux/i386/crt/crt0.S:1.13 linux/libc/sysdeps/linux/i386/crt/crt0.S:1.14 *** linux/libc/sysdeps/linux/i386/crt/crt0.S:1.13 Wed Apr 10 00:56:28 1996 --- linux/libc/sysdeps/linux/i386/crt/crt0.S Mon Feb 3 19:54:22 1997 *************** *** 113,118 **** --- 113,119 ---- popl %ecx movl %esp,%ebx /* Points to the arguments */ movl %esp,%eax /* Same here */ + andl $0xfffffff8,%esp movl %ecx,%edx addl %edx,%edx addl %edx,%edx Index: linux/libc/sysdeps/linux/i386/math/exp.S diff -c linux/libc/sysdeps/linux/i386/math/exp.S:1.2 linux/libc/sysdeps/linux/i386/math/exp.S:1.3 *** linux/libc/sysdeps/linux/i386/math/exp.S:1.2 Wed Apr 10 00:56:30 1996 --- linux/libc/sysdeps/linux/i386/math/exp.S Tue Dec 17 08:22:53 1996 *************** *** 120,124 **** ret #ifdef __ELF__ ! .type exp,@function #endif --- 120,124 ---- ret #ifdef __ELF__ ! .type _exp,@function #endif Index: linux/libc/sysdeps/linux/i386/math/frexpl.c diff -c linux/libc/sysdeps/linux/i386/math/frexpl.c:1.3 linux/libc/sysdeps/linux/i386/math/frexpl.c:1.4 *** linux/libc/sysdeps/linux/i386/math/frexpl.c:1.3 Fri Oct 4 15:53:33 1996 --- linux/libc/sysdeps/linux/i386/math/frexpl.c Mon Feb 3 19:54:24 1997 *************** *** 68,73 **** } *pw2 = i - 0x3ffe; ! *q = 0x3ffe; return( u.y ); } --- 68,74 ---- } *pw2 = i - 0x3ffe; ! *q &= 0x8000; /* Let the original sign bit pass through. */ ! *q |= 0x3ffe; return( u.y ); } Index: linux/libc/sysdeps/linux/m68k/__init_brk.c diff -c linux/libc/sysdeps/linux/m68k/__init_brk.c:1.2 linux/libc/sysdeps/linux/m68k/__init_brk.c:1.3 *** linux/libc/sysdeps/linux/m68k/__init_brk.c:1.2 Fri Oct 4 15:53:34 1996 --- linux/libc/sysdeps/linux/m68k/__init_brk.c Sat Jan 4 10:49:43 1997 *************** *** 1,6 **** --- 1,7 ---- #include #include #include + #include void *___brk_addr = 0; *************** *** 24,26 **** --- 25,29 ---- } return 0; } + + weak_alias (___brk_addr, __curbrk); Index: linux/libc/sysdeps/linux/m68k/gmon/gmon.c diff -c linux/libc/sysdeps/linux/m68k/gmon/gmon.c:1.3 linux/libc/sysdeps/linux/m68k/gmon/gmon.c:1.4 *** linux/libc/sysdeps/linux/m68k/gmon/gmon.c:1.3 Fri Oct 4 15:53:34 1996 --- linux/libc/sysdeps/linux/m68k/gmon/gmon.c Sat Jan 4 10:49:43 1997 *************** *** 252,258 **** close( fd ); } ! #ifdef __ELF__ || defined __STDC__ void _mcount( void ) #else --- 252,258 ---- close( fd ); } ! #if defined(__ELF__) || defined(__STDC__) void _mcount( void ) #else Index: linux/libc/time/strptime.c diff -c linux/libc/time/strptime.c:1.3 linux/libc/time/strptime.c:1.4 *** linux/libc/time/strptime.c:1.3 Fri Sep 13 01:44:30 1996 --- linux/libc/time/strptime.c Fri Feb 14 19:38:18 1997 *************** *** 75,81 **** char * DEFUN (strptime, (buf, format, tm), ! char *buf AND CONST char *format AND register struct tm *tm) { const char *rp; const char *fmt; --- 75,81 ---- char * DEFUN (strptime, (buf, format, tm), ! CONST char *buf AND CONST char *format AND register struct tm *tm) { const char *rp; const char *fmt; Index: linux/libc/yp/yp.h diff -c linux/libc/yp/yp.h:1.2 linux/libc/yp/yp.h:removed *** linux/libc/yp/yp.h:1.2 Fri Oct 4 15:53:40 1996 --- linux/libc/yp/yp.h Mon Feb 17 14:47:11 1997 *************** *** 1,356 **** - /* - * Please do not edit this file. - * It was generated using rpcgen. - */ - - #ifndef _YP_H_RPCGEN - #define _YP_H_RPCGEN - - #include - #include - - enum ypxfrstat - { - YPXFR_SUCC = 1, - YPXFR_AGE = 2, - YPXFR_NOMAP = -1, - YPXFR_NODOM = -2, - YPXFR_RSRC = -3, - YPXFR_RPC = -4, - YPXFR_MADDR = -5, - YPXFR_YPERR = -6, - YPXFR_BADARGS = -7, - YPXFR_DBM = -8, - YPXFR_FILE = -9, - YPXFR_SKEW = -10, - YPXFR_CLEAR = -11, - YPXFR_FORCE = -12, - YPXFR_XFRERR = -13, - YPXFR_REFUSED = -14 - }; - - #ifdef __cplusplus - extern "C" bool_t xdr_ypxfrstat(XDR *, ypxfrstat*); - #elif __STDC__ - extern bool_t xdr_ypxfrstat(XDR *, enum ypxfrstat*); - #else /* Old Style C */ - bool_t xdr_ypxfrstat(); - #endif /* Old Style C */ - - - typedef char *domainname; - #ifdef __cplusplus - extern "C" bool_t xdr_domainname(XDR *, char *); - #elif __STDC__ - extern bool_t xdr_domainname(XDR *, char*); - #else /* Old Style C */ - bool_t xdr_domainname(); - #endif /* Old Style C */ - - - typedef char *mapname; - #ifdef __cplusplus - extern "C" bool_t xdr_mapname(XDR *, mapname*); - #elif __STDC__ - extern bool_t xdr_mapname(XDR *, mapname*); - #else /* Old Style C */ - bool_t xdr_mapname(); - #endif /* Old Style C */ - - typedef char *peername; - #ifdef __cplusplus - extern "C" bool_t xdr_peername(XDR *, peername*); - #elif __STDC__ - extern bool_t xdr_peername(XDR *, peername*); - #else /* Old Style C */ - bool_t xdr_peername(); - #endif /* Old Style C */ - - struct keydat { - u_int keydat_len; - char *keydat_val; - }; - #ifdef __cplusplus - extern "C" bool_t xdr_keydat(XDR *, keydat*); - #elif __STDC__ - extern bool_t xdr_keydat(XDR *, struct keydat*); - #else /* Old Style C */ - bool_t xdr_keydat(); - #endif /* Old Style C */ - - - typedef struct { - u_int valdat_len; - char *valdat_val; - } valdat; - #ifdef __cplusplus - extern "C" bool_t xdr_valdat(XDR *, valdat*); - #elif __STDC__ - extern bool_t xdr_valdat(XDR *, valdat*); - #else /* Old Style C */ - bool_t xdr_valdat(); - #endif /* Old Style C */ - - #ifdef __cplusplus - extern "C" bool_t xdr_ypresp_all(XDR *, struct ypresp_all*); - extern "C" bool_t xdr_ypresp_all_seq(XDR *, u_long *); - extern "C" int (*ypresp_allfn) (int, char *, int, char *, int, char *); - extern "C" char *ypresp_data; - #elif __STDC__ - extern bool_t xdr_ypresp_all(XDR *, struct ypresp_all*); - extern bool_t xdr_ypresp_all_seq(XDR *, u_long *); - extern int (*ypresp_allfn) (int, char *, int, char *, int, char *); - extern char *ypresp_data; - #else /* Old Style C */ - bool_t xdr_ypresp_all(); - bool_t xdr_ypresp_all_seq(); - extern int (*ypresp_allfn) (); - extern char *ypresp_data; - #endif /* Old Style C */ - - - struct ypresp_xfr { - u_int transid; - enum ypxfrstat xfrstat; - }; - #ifdef __cplusplus - extern "C" bool_t xdr_ypresp_xfr(XDR *, struct ypresp_xfr*); - #elif __STDC__ - extern bool_t xdr_ypresp_xfr(XDR *, struct ypresp_xfr*); - #else /* Old Style C */ - bool_t xdr_ypresp_xfr(); - #endif /* Old Style C */ - - #ifdef __cplusplus - extern "C" bool_t xdr_ypmaplist_str(XDR *xdrs, char *objp); - extern "C" bool_t xdr_ypmaplist(XDR *, struct ypmaplist*); - #elif __STDC__ - extern bool_t xdr_ypmaplist_str(XDR *xdrs, char *objp); - extern bool_t xdr_ypmaplist(XDR *, struct ypmaplist*); - #else /* Old Style C */ - bool_t xdr_ypmaplist_str(); - bool_t xdr_ypmaplist(); - #endif /* Old Style C */ - - #ifdef __cplusplus - extern "C" bool_t xdr_ypbind_resptype(XDR *, enum ypbind_resptype*); - #elif __STDC__ - extern bool_t xdr_ypbind_resptype(XDR *, enum ypbind_resptype*); - #else /* Old Style C */ - bool_t xdr_ypbind_resptype(); - #endif /* Old Style C */ - - #ifdef __cplusplus - extern "C" bool_t xdr_ypbind_binding(XDR *, struct ypbind_binding*); - #elif __STDC__ - extern bool_t xdr_ypbind_binding(XDR *, struct ypbind_binding*); - #else /* Old Style C */ - bool_t xdr_ypbind_binding(); - #endif /* Old Style C */ - - - #ifdef __cplusplus - extern "C" bool_t xdr_ypbind_resp(XDR *, struct ypbind_resp*); - #elif __STDC__ - extern bool_t xdr_ypbind_resp(XDR *, struct ypbind_resp*); - #else /* Old Style C */ - bool_t xdr_ypbind_resp(); - #endif /* Old Style C */ - - #define YPBIND_ERR_ERR 1 - #define YPBIND_ERR_NOSERV 2 - #define YPBIND_ERR_RESC 3 - - #ifdef __cplusplus - extern "C" bool_t xdr_ypbind_setdom(XDR *, struct ypbind_setdom*); - #elif __STDC__ - extern bool_t xdr_ypbind_setdom(XDR *, struct ypbind_setdom*); - #else /* Old Style C */ - bool_t xdr_ypbind_setdom(); - #endif /* Old Style C */ - - - #define YPPROG ((u_long)100004) - #define YPVERS ((u_long)2) - - #ifdef __cplusplus - #define YPPROC_NULL ((u_long)0) - extern "C" void * ypproc_null_2(CLIENT *); - extern "C" void * ypproc_null_2_svc(struct svc_req *); - #define YPPROC_DOMAIN ((u_long)1) - extern "C" bool_t * ypproc_domain_2(domainname , CLIENT *); - extern "C" bool_t * ypproc_domain_2_svc(domainname , struct svc_req *); - #define YPPROC_DOMAIN_NONACK ((u_long)2) - extern "C" bool_t * ypproc_domain_nonack_2(domainname , CLIENT *); - extern "C" bool_t * ypproc_domain_nonack_2_svc(domainname , struct svc_req *); - #define YPPROC_MATCH ((u_long)3) - extern "C" ypresp_val * ypproc_match_2(ypreq_key , CLIENT *); - extern "C" ypresp_val * ypproc_match_2_svc(ypreq_key , struct svc_req *); - #define YPPROC_FIRST ((u_long)4) - extern "C" ypresp_key_val * ypproc_first_2(ypreq_key , CLIENT *); - extern "C" ypresp_key_val * ypproc_first_2_svc(ypreq_key , struct svc_req *); - #define YPPROC_NEXT ((u_long)5) - extern "C" ypresp_key_val * ypproc_next_2(ypreq_key , CLIENT *); - extern "C" ypresp_key_val * ypproc_next_2_svc(ypreq_key , struct svc_req *); - #define YPPROC_XFR ((u_long)6) - extern "C" ypresp_xfr * ypproc_xfr_2(ypreq_xfr , CLIENT *); - extern "C" ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr , struct svc_req *); - #define YPPROC_CLEAR ((u_long)7) - extern "C" void * ypproc_clear_2(CLIENT *); - extern "C" void * ypproc_clear_2_svc(struct svc_req *); - #define YPPROC_ALL ((u_long)8) - extern "C" ypresp_all * ypproc_all_2(ypreq_nokey , CLIENT *); - extern "C" ypresp_all * ypproc_all_2_svc(ypreq_nokey , struct svc_req *); - #define YPPROC_MASTER ((u_long)9) - extern "C" ypresp_master * ypproc_master_2(ypreq_nokey , CLIENT *); - extern "C" ypresp_master * ypproc_master_2_svc(ypreq_nokey , struct svc_req *); - #define YPPROC_ORDER ((u_long)10) - extern "C" ypresp_order * ypproc_order_2(ypreq_nokey , CLIENT *); - extern "C" ypresp_order * ypproc_order_2_svc(ypreq_nokey , struct svc_req *); - #define YPPROC_MAPLIST ((u_long)11) - extern "C" ypresp_maplist * ypproc_maplist_2(domainname , CLIENT *); - extern "C" ypresp_maplist * ypproc_maplist_2_svc(domainname , struct svc_req *); - - #elif __STDC__ - #define YPPROC_NULL ((u_long)0) - extern void * ypproc_null_2(CLIENT *); - extern void * ypproc_null_2_svc(struct svc_req *); - #define YPPROC_DOMAIN ((u_long)1) - extern bool_t * ypproc_domain_2(domainname , CLIENT *); - extern bool_t * ypproc_domain_2_svc(domainname , struct svc_req *); - #define YPPROC_DOMAIN_NONACK ((u_long)2) - extern bool_t * ypproc_domain_nonack_2(domainname , CLIENT *); - extern bool_t * ypproc_domain_nonack_2_svc(domainname , struct svc_req *); - #define YPPROC_MATCH ((u_long)3) - extern struct ypresp_val * ypproc_match_2(struct ypreq_key , CLIENT *); - extern struct ypresp_val * ypproc_match_2_svc(struct ypreq_key , struct svc_req *); - #define YPPROC_FIRST ((u_long)4) - extern struct ypresp_key_val * ypproc_first_2(struct ypreq_key , CLIENT *); - extern struct ypresp_key_val * ypproc_first_2_svc(struct ypreq_key , struct svc_req *); - #define YPPROC_NEXT ((u_long)5) - extern struct ypresp_key_val * ypproc_next_2(struct ypreq_key , CLIENT *); - extern struct ypresp_key_val * ypproc_next_2_svc(struct ypreq_key , struct svc_req *); - #define YPPROC_XFR ((u_long)6) - extern struct ypresp_xfr * ypproc_xfr_2(struct ypreq_xfr , CLIENT *); - extern struct ypresp_xfr * ypproc_xfr_2_svc(struct ypreq_xfr , struct svc_req *); - #define YPPROC_CLEAR ((u_long)7) - extern void * ypproc_clear_2(CLIENT *); - extern void * ypproc_clear_2_svc(struct svc_req *); - #define YPPROC_ALL ((u_long)8) - extern struct ypresp_all * ypproc_all_2(struct ypreq_nokey , CLIENT *); - extern struct ypresp_all * ypproc_all_2_svc(struct ypreq_nokey , struct svc_req *); - #define YPPROC_MASTER ((u_long)9) - extern struct ypresp_master * ypproc_master_2(struct ypreq_nokey , CLIENT *); - extern struct ypresp_master * ypproc_master_2_svc(struct ypreq_nokey , struct svc_req *); - #define YPPROC_ORDER ((u_long)10) - extern struct ypresp_order * ypproc_order_2(struct ypreq_nokey , CLIENT *); - extern struct ypresp_order * ypproc_order_2_svc(struct ypreq_nokey , struct svc_req *); - #define YPPROC_MAPLIST ((u_long)11) - extern struct ypresp_maplist * ypproc_maplist_2(domainname , CLIENT *); - extern struct ypresp_maplist * ypproc_maplist_2_svc(domainname , struct svc_req *); - - #else /* Old Style C */ - #define YPPROC_NULL ((u_long)0) - extern void * ypproc_null_2(); - extern void * ypproc_null_2_svc(); - #define YPPROC_DOMAIN ((u_long)1) - extern bool_t * ypproc_domain_2(); - extern bool_t * ypproc_domain_2_svc(); - #define YPPROC_DOMAIN_NONACK ((u_long)2) - extern bool_t * ypproc_domain_nonack_2(); - extern bool_t * ypproc_domain_nonack_2_svc(); - #define YPPROC_MATCH ((u_long)3) - extern ypresp_val * ypproc_match_2(); - extern ypresp_val * ypproc_match_2_svc(); - #define YPPROC_FIRST ((u_long)4) - extern ypresp_key_val * ypproc_first_2(); - extern ypresp_key_val * ypproc_first_2_svc(); - #define YPPROC_NEXT ((u_long)5) - extern ypresp_key_val * ypproc_next_2(); - extern ypresp_key_val * ypproc_next_2_svc(); - #define YPPROC_XFR ((u_long)6) - extern ypresp_xfr * ypproc_xfr_2(); - extern ypresp_xfr * ypproc_xfr_2_svc(); - #define YPPROC_CLEAR ((u_long)7) - extern void * ypproc_clear_2(); - extern void * ypproc_clear_2_svc(); - #define YPPROC_ALL ((u_long)8) - extern ypresp_all * ypproc_all_2(); - extern ypresp_all * ypproc_all_2_svc(); - #define YPPROC_MASTER ((u_long)9) - extern ypresp_master * ypproc_master_2(); - extern ypresp_master * ypproc_master_2_svc(); - #define YPPROC_ORDER ((u_long)10) - extern ypresp_order * ypproc_order_2(); - extern ypresp_order * ypproc_order_2_svc(); - #define YPPROC_MAPLIST ((u_long)11) - extern struct ypresp_maplist * ypproc_maplist_2(); - extern struct ypresp_maplist * ypproc_maplist_2_svc(); - #endif /* Old Style C */ - - #define YPPUSH_XFRRESPPROG ((u_long)0x40000000) - #define YPPUSH_XFRRESPVERS ((u_long)1) - - #ifdef __cplusplus - #define YPPUSHPROC_NULL ((u_long)0) - extern "C" void * yppushproc_null_1(CLIENT *); - extern "C" void * yppushproc_null_1_svc(struct svc_req *); - #define YPPUSHPROC_XFRRESP ((u_long)1) - extern "C" yppushresp_xfr * yppushproc_xfrresp_1(CLIENT *); - extern "C" yppushresp_xfr * yppushproc_xfrresp_1_svc(struct svc_req *); - - #elif __STDC__ - #define YPPUSHPROC_NULL ((u_long)0) - extern void * yppushproc_null_1(CLIENT *); - extern void * yppushproc_null_1_svc(struct svc_req *); - #define YPPUSHPROC_XFRRESP ((u_long)1) - extern struct yppushresp_xfr * yppushproc_xfrresp_1(CLIENT *); - extern struct yppushresp_xfr * yppushproc_xfrresp_1_svc(struct svc_req *); - - #else /* Old Style C */ - #define YPPUSHPROC_NULL ((u_long)0) - extern void * yppushproc_null_1(); - extern void * yppushproc_null_1_svc(); - #define YPPUSHPROC_XFRRESP ((u_long)1) - extern struct yppushresp_xfr * yppushproc_xfrresp_1(); - extern struct yppushresp_xfr * yppushproc_xfrresp_1_svc(); - #endif /* Old Style C */ - - #define YPBINDPROG ((u_long)100007) - #define YPBINDVERS ((u_long)2) - - #ifdef __cplusplus - #define YPBINDPROC_NULL ((u_long)0) - extern "C" void * ypbindproc_null_2(CLIENT *); - extern "C" void * ypbindproc_null_2_svc(struct svc_req *); - #define YPBINDPROC_DOMAIN ((u_long)1) - extern "C" ypbind_resp * ypbindproc_domain_2(domainname , CLIENT *); - extern "C" ypbind_resp * ypbindproc_domain_2_svc(domainname , struct svc_req *); - #define YPBINDPROC_SETDOM ((u_long)2) - extern "C" void * ypbindproc_setdom_2(ypbind_setdom , CLIENT *); - extern "C" void * ypbindproc_setdom_2_svc(ypbind_setdom , struct svc_req *); - - #elif __STDC__ - #define YPBINDPROC_NULL ((u_long)0) - extern void * ypbindproc_null_2(CLIENT *); - extern void * ypbindproc_null_2_svc(struct svc_req *); - #define YPBINDPROC_DOMAIN ((u_long)1) - extern struct ypbind_resp * ypbindproc_domain_2(domainname , CLIENT *); - extern struct ypbind_resp * ypbindproc_domain_2_svc(domainname , struct svc_req *); - #define YPBINDPROC_SETDOM ((u_long)2) - extern void * ypbindproc_setdom_2(struct ypbind_setdom , CLIENT *); - extern void * ypbindproc_setdom_2_svc(struct ypbind_setdom , struct svc_req *); - - #else /* Old Style C */ - #define YPBINDPROC_NULL ((u_long)0) - extern void * ypbindproc_null_2(); - extern void * ypbindproc_null_2_svc(); - #define YPBINDPROC_DOMAIN ((u_long)1) - extern struct ypbind_resp * ypbindproc_domain_2(); - extern struct ypbind_resp * ypbindproc_domain_2_svc(); - #define YPBINDPROC_SETDOM ((u_long)2) - extern void * ypbindproc_setdom_2(); - extern void * ypbindproc_setdom_2_svc(); - #endif /* Old Style C */ - - #endif /* !_YP_H_RPCGEN */ --- 0 ---- Index: linux/libc/yp/yp_xdr.c diff -c linux/libc/yp/yp_xdr.c:1.2 linux/libc/yp/yp_xdr.c:1.3 *** linux/libc/yp/yp_xdr.c:1.2 Fri Oct 4 15:53:40 1996 --- linux/libc/yp/yp_xdr.c Sun Jan 26 10:00:50 1997 *************** *** 31,58 **** * Modifications for linux by Swen Thuemmler */ ! #include "yp.h" ! #include #include /* * Prototypes */ ! #if 0 ! bool_t xdr_ypxfrstat (XDR *, enum ypxfrstat *); ! #endif ! bool_t xdr_domainname (XDR *, char *); bool_t xdr_mapname (XDR *, mapname *); bool_t xdr_peername (XDR *, peername *); - bool_t xdr_datum (XDR *, datum *); - #if 0 bool_t xdr_ypmap_parms (XDR *, struct ypmap_parms *); - #endif bool_t xdr_ypreq_key (XDR *, struct ypreq_key *); bool_t xdr_ypreq_nokey (XDR *, struct ypreq_nokey *); - #if 0 bool_t xdr_ypreq_xfr (XDR *, struct ypreq_xfr *); - #endif bool_t xdr_ypresp_val (XDR *, struct ypresp_val *); bool_t xdr_ypresp_key_val (XDR *, struct ypresp_key_val *); bool_t xdr_ypresp_master (XDR *, struct ypresp_master *); --- 31,50 ---- * Modifications for linux by Swen Thuemmler */ ! #include #include /* * Prototypes */ ! bool_t xdr_ypxfrstat (XDR *, ypxfrstat *); ! bool_t xdr_domainname (XDR *, domainname *); bool_t xdr_mapname (XDR *, mapname *); bool_t xdr_peername (XDR *, peername *); bool_t xdr_ypmap_parms (XDR *, struct ypmap_parms *); bool_t xdr_ypreq_key (XDR *, struct ypreq_key *); bool_t xdr_ypreq_nokey (XDR *, struct ypreq_nokey *); bool_t xdr_ypreq_xfr (XDR *, struct ypreq_xfr *); bool_t xdr_ypresp_val (XDR *, struct ypresp_val *); bool_t xdr_ypresp_key_val (XDR *, struct ypresp_key_val *); bool_t xdr_ypresp_master (XDR *, struct ypresp_master *); *************** *** 60,82 **** bool_t xdr_ypresp_all (XDR *, struct ypresp_all *); bool_t xdr_ypmaplist_str (XDR *, char *); bool_t xdr_ypresp_maplist (XDR *, struct ypresp_maplist *); - #if 0 bool_t xdr_yppushresp_xfr (XDR *, struct yppushresp_xfr *); - #endif bool_t xdr_ypbind_resptype (XDR *, enum ypbind_resptype *); bool_t xdr_ypbind_binding (XDR *, struct ypbind_binding *); bool_t xdr_ypbind_resp (XDR *, struct ypbind_resp *); bool_t xdr_ypbind_setdom (XDR *, struct ypbind_setdom *); bool_t xdr_ypresp_all_seq (XDR *, u_long *); bool_t xdr_yp_inaddr (XDR *, struct in_addr *); ! bool_t xdr_ypstat (XDR *, enum ypbind_resptype *); /* * Begin functions */ - #if 0 bool_t ! xdr_ypxfrstat(XDR *xdrs, enum ypxfrstat *objp) { if (!xdr_enum(xdrs, (enum_t *)objp)) { --- 52,71 ---- bool_t xdr_ypresp_all (XDR *, struct ypresp_all *); bool_t xdr_ypmaplist_str (XDR *, char *); bool_t xdr_ypresp_maplist (XDR *, struct ypresp_maplist *); bool_t xdr_yppushresp_xfr (XDR *, struct yppushresp_xfr *); bool_t xdr_ypbind_resptype (XDR *, enum ypbind_resptype *); bool_t xdr_ypbind_binding (XDR *, struct ypbind_binding *); bool_t xdr_ypbind_resp (XDR *, struct ypbind_resp *); bool_t xdr_ypbind_setdom (XDR *, struct ypbind_setdom *); bool_t xdr_ypresp_all_seq (XDR *, u_long *); bool_t xdr_yp_inaddr (XDR *, struct in_addr *); ! bool_t xdr_ypstat (XDR *, ypstat *); /* * Begin functions */ bool_t ! xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp) { if (!xdr_enum(xdrs, (enum_t *)objp)) { *************** *** 84,95 **** } return (TRUE); } - #endif bool_t ! xdr_domainname(XDR *xdrs, char *objp) { ! if (!xdr_string(xdrs, &objp, YPMAXDOMAIN)) { return (FALSE); } --- 73,83 ---- } return (TRUE); } bool_t ! xdr_domainname(XDR *xdrs, domainname *objp) { ! if (!xdr_string(xdrs, objp, YPMAXDOMAIN)) { return (FALSE); } *************** *** 117,139 **** } bool_t ! xdr_datum(XDR *xdrs, datum *objp) { ! if (!xdr_bytes(xdrs, ! (char **)&objp->dptr, ! (u_int *)&objp->dsize, ! YPMAXRECORD)) ! { ! return (FALSE); ! } return (TRUE); } - #if 0 bool_t xdr_ypmap_parms(XDR *xdrs, struct ypmap_parms *objp) { ! if (!xdr_domainname(xdrs, objp->domain)) { return (FALSE); } --- 105,135 ---- } bool_t ! xdr_keydat(XDR *xdrs, keydat *objp) { ! if (!xdr_bytes(xdrs, (char **)&objp->keydat_val, ! (u_int *)&objp->keydat_len, YPMAXRECORD)) ! { ! return (FALSE); ! } ! return (TRUE); ! } ! ! bool_t ! xdr_valdat(XDR *xdrs, valdat *objp) ! { ! if (!xdr_bytes(xdrs, (char **)&objp->valdat_val, ! (u_int *)&objp->valdat_len, YPMAXRECORD)) ! { ! return (FALSE); ! } return (TRUE); } bool_t xdr_ypmap_parms(XDR *xdrs, struct ypmap_parms *objp) { ! if (!xdr_domainname(xdrs, &objp->domain)) { return (FALSE); } *************** *** 141,162 **** { return (FALSE); } ! if (!xdr_u_long(xdrs, &objp->ordernum)) { return (FALSE); } ! if (!xdr_peername(xdrs, &objp->owner)) { return (FALSE); } return (TRUE); } - #endif bool_t xdr_ypreq_key(XDR *xdrs, struct ypreq_key *objp) { ! if (!xdr_domainname(xdrs, objp->domain)) { return (FALSE); } --- 137,157 ---- { return (FALSE); } ! if (!xdr_u_int (xdrs, &objp->ordernum)) { return (FALSE); } ! if (!xdr_peername(xdrs, &objp->peer)) { return (FALSE); } return (TRUE); } bool_t xdr_ypreq_key(XDR *xdrs, struct ypreq_key *objp) { ! if (!xdr_domainname(xdrs, &objp->domain)) { return (FALSE); } *************** *** 164,170 **** { return (FALSE); } ! if (!xdr_datum(xdrs, &objp->keydat)) { return (FALSE); } --- 159,165 ---- { return (FALSE); } ! if (!xdr_keydat (xdrs, &objp->key)) { return (FALSE); } *************** *** 174,180 **** bool_t xdr_ypreq_nokey(XDR *xdrs, struct ypreq_nokey *objp) { ! if (!xdr_domainname(xdrs, objp->domain)) { return (FALSE); } --- 169,175 ---- bool_t xdr_ypreq_nokey(XDR *xdrs, struct ypreq_nokey *objp) { ! if (!xdr_domainname(xdrs, &objp->domain)) { return (FALSE); } *************** *** 185,191 **** return (TRUE); } - #if 0 bool_t xdr_ypreq_xfr(XDR *xdrs, struct ypreq_xfr *objp) { --- 180,185 ---- *************** *** 193,222 **** { return (FALSE); } ! if (!xdr_u_long(xdrs, &objp->transid)) { return (FALSE); } ! if (!xdr_u_long(xdrs, &objp->proto)) { return (FALSE); } ! if (!xdr_u_short(xdrs, &objp->port)) { return (FALSE); } return (TRUE); } - #endif bool_t xdr_ypresp_val(XDR *xdrs, struct ypresp_val *objp) { ! if (!xdr_u_long(xdrs, &objp->status)) { return (FALSE); } ! if (!xdr_datum(xdrs, &objp->valdat)) { return (FALSE); } --- 187,215 ---- { return (FALSE); } ! if (!xdr_u_int (xdrs, &objp->transid)) { return (FALSE); } ! if (!xdr_u_int (xdrs, &objp->prog)) { return (FALSE); } ! if (!xdr_u_int (xdrs, &objp->port)) { return (FALSE); } return (TRUE); } bool_t xdr_ypresp_val(XDR *xdrs, struct ypresp_val *objp) { ! if (!xdr_ypstat (xdrs, &objp->stat)) { return (FALSE); } ! if (!xdr_valdat (xdrs, &objp->val)) { return (FALSE); } *************** *** 226,241 **** bool_t xdr_ypresp_key_val(XDR *xdrs, struct ypresp_key_val *objp) { ! if (!xdr_u_long(xdrs, &objp->status)) { return (FALSE); } /* Silly. The server responds in wrong order !? */ ! if (!xdr_datum(xdrs, &objp->valdat)) { return (FALSE); } ! if (!xdr_datum(xdrs, &objp->keydat)) { return (FALSE); } --- 219,234 ---- bool_t xdr_ypresp_key_val(XDR *xdrs, struct ypresp_key_val *objp) { ! if (!xdr_ypstat (xdrs, &objp->stat)) { return (FALSE); } /* Silly. The server responds in wrong order !? */ ! if (!xdr_valdat (xdrs, &objp->val)) { return (FALSE); } ! if (!xdr_keydat (xdrs, &objp->key)) { return (FALSE); } *************** *** 245,255 **** bool_t xdr_ypresp_master(XDR *xdrs, struct ypresp_master *objp) { ! if (!xdr_u_long(xdrs, &objp->status)) { return (FALSE); } ! if (!xdr_peername(xdrs, &objp->master)) { return (FALSE); } --- 238,248 ---- bool_t xdr_ypresp_master(XDR *xdrs, struct ypresp_master *objp) { ! if (!xdr_ypstat (xdrs, &objp->stat)) { return (FALSE); } ! if (!xdr_peername(xdrs, &objp->peer)) { return (FALSE); } *************** *** 259,269 **** bool_t xdr_ypresp_order(XDR *xdrs, struct ypresp_order *objp) { ! if (!xdr_u_long(xdrs, &objp->status)) { return (FALSE); } ! if (!xdr_u_long(xdrs, &objp->ordernum)) { return (FALSE); } --- 252,262 ---- bool_t xdr_ypresp_order(XDR *xdrs, struct ypresp_order *objp) { ! if (!xdr_ypstat (xdrs, &objp->stat)) { return (FALSE); } ! if (!xdr_u_int (xdrs, &objp->ordernum)) { return (FALSE); } *************** *** 305,316 **** bool_t xdr_ypmaplist(XDR *xdrs, struct ypmaplist *objp) { ! if (!xdr_ypmaplist_str(xdrs, objp->ypml_name)) { return (FALSE); } if (!xdr_pointer(xdrs, ! (char **)&objp->ypml_next, sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist)) { --- 298,309 ---- bool_t xdr_ypmaplist(XDR *xdrs, struct ypmaplist *objp) { ! if (!xdr_ypmaplist_str(xdrs, objp->map)) { return (FALSE); } if (!xdr_pointer(xdrs, ! (char **)&objp->next, sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist)) { *************** *** 322,332 **** bool_t xdr_ypresp_maplist(XDR *xdrs, struct ypresp_maplist *objp) { ! if (!xdr_u_long(xdrs, &objp->status)) { return (FALSE); } ! if (!xdr_pointer(xdrs, (char **)&objp->list, sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist)) { return (FALSE); --- 315,325 ---- bool_t xdr_ypresp_maplist(XDR *xdrs, struct ypresp_maplist *objp) { ! if (!xdr_ypstat (xdrs, &objp->stat)) { return (FALSE); } ! if (!xdr_pointer(xdrs, (char **)&objp->maps, sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist)) { return (FALSE); *************** *** 334,354 **** return (TRUE); } ! #if 0 bool_t xdr_yppushresp_xfr(XDR *xdrs, struct yppushresp_xfr *objp) { ! if (!xdr_u_long(xdrs, &objp->transid)) { return (FALSE); } ! if (!xdr_u_long(xdrs, &objp->status)) { return (FALSE); } return (TRUE); } - #endif bool_t xdr_ypbind_resptype(XDR *xdrs, enum ypbind_resptype *objp) --- 327,354 ---- return (TRUE); } ! bool_t ! xdr_yppush_status(XDR *xdrs, yppush_status *objp) ! { ! if (!xdr_enum(xdrs, (enum_t *)objp)) { ! return (FALSE); ! } ! return (TRUE); ! } ! bool_t xdr_yppushresp_xfr(XDR *xdrs, struct yppushresp_xfr *objp) { ! if (!xdr_u_int(xdrs, &objp->transid)) { return (FALSE); } ! if (!xdr_yppush_status (xdrs, &objp->status)) { return (FALSE); } return (TRUE); } bool_t xdr_ypbind_resptype(XDR *xdrs, enum ypbind_resptype *objp) *************** *** 383,395 **** } switch (objp->ypbind_status) { case YPBIND_FAIL_VAL: ! if (!xdr_u_long(xdrs, &objp->ypbind_respbody.ypbind_error)) { return (FALSE); } break; case YPBIND_SUCC_VAL: ! if (!xdr_ypbind_binding(xdrs, &objp->ypbind_respbody.ypbind_bindinfo)) { return (FALSE); } --- 383,395 ---- } switch (objp->ypbind_status) { case YPBIND_FAIL_VAL: ! if (!xdr_u_int (xdrs, &objp->ypbind_resp_u.ypbind_error)) { return (FALSE); } break; case YPBIND_SUCC_VAL: ! if (!xdr_ypbind_binding(xdrs, &objp->ypbind_resp_u.ypbind_bindinfo)) { return (FALSE); } *************** *** 403,409 **** bool_t xdr_ypbind_setdom(XDR *xdrs, struct ypbind_setdom *objp) { ! if (!xdr_domainname(xdrs, objp->ypsetdom_domain)) { return (FALSE); } --- 403,409 ---- bool_t xdr_ypbind_setdom(XDR *xdrs, struct ypbind_setdom *objp) { ! if (!xdr_domainname(xdrs, &objp->ypsetdom_domain)) { return (FALSE); } *************** *** 411,423 **** { return (FALSE); } ! if (!xdr_u_short(xdrs, &objp->ypsetdom_vers)) { return (FALSE); } return (TRUE); } bool_t xdr_ypresp_all_seq (XDR *xdrs, u_long *objp) { --- 411,426 ---- { return (FALSE); } ! if (!xdr_u_int (xdrs, &objp->ypsetdom_vers)) { return (FALSE); } return (TRUE); } + extern int (*ypresp_allfn) (int, char *, int, char *, int, char *); + extern char *ypresp_data; + bool_t xdr_ypresp_all_seq (XDR *xdrs, u_long *objp) { *************** *** 440,462 **** xdr_free((xdrproc_t) xdr_ypresp_all, (char *) &out); return FALSE; } ! status = out.ypresp_all_u.val.status; switch (status) { case YP_TRUE: ! key = (char *) malloc (out.ypresp_all_u.val.keydat.dsize + 1); ! bcopy (out.ypresp_all_u.val.keydat.dptr, key, ! out.ypresp_all_u.val.keydat.dsize); ! key[out.ypresp_all_u.val.keydat.dsize] = '\0'; ! val = (char *) malloc (out.ypresp_all_u.val.valdat.dsize + 1); ! bcopy (out.ypresp_all_u.val.valdat.dptr, val, ! out.ypresp_all_u.val.valdat.dsize); ! val[out.ypresp_all_u.val.valdat.dsize] = '\0'; xdr_free((xdrproc_t) xdr_ypresp_all, (char *) &out); r = (*ypresp_allfn) (status, key, ! out.ypresp_all_u.val.keydat.dsize, val, ! out.ypresp_all_u.val.valdat.dsize, ypresp_data); *objp = status; free (key); free (val); --- 443,465 ---- xdr_free((xdrproc_t) xdr_ypresp_all, (char *) &out); return FALSE; } ! status = out.ypresp_all_u.val.stat; switch (status) { case YP_TRUE: ! key = (char *) malloc (out.ypresp_all_u.val.key.keydat_len + 1); ! bcopy (out.ypresp_all_u.val.key.keydat_val, key, ! out.ypresp_all_u.val.key.keydat_len); ! key[out.ypresp_all_u.val.key.keydat_len] = '\0'; ! val = (char *) malloc (out.ypresp_all_u.val.val.valdat_len + 1); ! bcopy (out.ypresp_all_u.val.val.valdat_val, val, ! out.ypresp_all_u.val.val.valdat_len); ! val[out.ypresp_all_u.val.val.valdat_len] = '\0'; xdr_free((xdrproc_t) xdr_ypresp_all, (char *) &out); r = (*ypresp_allfn) (status, key, ! out.ypresp_all_u.val.key.keydat_len, val, ! out.ypresp_all_u.val.val.valdat_len, ypresp_data); *objp = status; free (key); free (val); *************** *** 485,491 **** } bool_t ! xdr_ypstat (XDR *xdrs, enum ypbind_resptype *objp) { if (!xdr_enum (xdrs, (enum_t *) objp)) { --- 488,494 ---- } bool_t ! xdr_ypstat (XDR *xdrs, ypstat *objp) { if (!xdr_enum (xdrs, (enum_t *) objp)) { Index: linux/libc/yp/yplib.c diff -c linux/libc/yp/yplib.c:1.6 linux/libc/yp/yplib.c:1.7 *** linux/libc/yp/yplib.c:1.6 Fri Oct 4 15:53:40 1996 --- linux/libc/yp/yplib.c Sun Jan 26 10:00:50 1997 *************** *** 45,51 **** #include #include #include ! #include "yp.h" #include #ifndef BINDINGDIR --- 45,51 ---- #include #include #include ! #include #include #ifndef BINDINGDIR *************** *** 58,63 **** --- 58,73 ---- * End of Prototypes */ + struct dom_binding { + struct dom_binding *dom_pnext; + char dom_domain[YPMAXDOMAIN + 1]; + struct sockaddr_in dom_server_addr; + unsigned short int dom_server_port; + int dom_socket; + CLIENT *dom_client; + unsigned short int dom_local_port; + long int dom_vers; + }; #ifdef YPMATCHCACHE static void ypmatch_add (char *, char *, int, char *, int); static bool_t ypmatch_find (char *, char *, int, char **, int *); *************** *** 458,468 **** #ifdef YPMATCHCACHE if (!strcmp(__yp_domain, indomain) && ypmatch_find (inmap, inkey, inkeylen, ! &yprv.valdat.dptr, &yprv.valdat.dsize)) { ! *outvallen = yprv.valdat.dsize; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprv.valdat.dptr, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; return 0; --- 468,478 ---- #ifdef YPMATCHCACHE if (!strcmp(__yp_domain, indomain) && ypmatch_find (inmap, inkey, inkeylen, ! &yprv.valdat.valdat_val, &yprv.valdat.valdat_len)) { ! *outvallen = yprv.valdat.valdat_len; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprv.valdat.valdat_val, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; return 0; *************** *** 474,481 **** yprk.domain = indomain; yprk.map = inmap; ! yprk.keydat.dptr = inkey; ! yprk.keydat.dsize = inkeylen; bzero ((char *) &yprv, sizeof yprv); --- 484,491 ---- yprk.domain = indomain; yprk.map = inmap; ! yprk.keydat.keydat_val = inkey; ! yprk.keydat.keydat_len = inkeylen; bzero ((char *) &yprv, sizeof yprv); *************** *** 495,503 **** result = ypprot_err (yprv.status); if (0 == result) { ! *outvallen = yprv.valdat.dsize; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprv.valdat.dptr, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; #ifdef YPMATCHCACHE --- 505,513 ---- result = ypprot_err (yprv.status); if (0 == result) { ! *outvallen = yprv.valdat.valdat_len; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprv.valdat.valdat_val, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; #ifdef YPMATCHCACHE *************** *** 566,579 **** result = ypprot_err (yprkv.status); if (0 == result) { ! *outkeylen = yprkv.keydat.dsize; *outkey = (char *) malloc (*outkeylen + 2); ! bcopy (yprkv.keydat.dptr, *outkey, *outkeylen); (*outkey)[*outkeylen] = '\n'; (*outkey)[*outkeylen + 1] = '\0'; ! *outvallen = yprkv.valdat.dsize; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprkv.valdat.dptr, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; } --- 576,589 ---- result = ypprot_err (yprkv.status); if (0 == result) { ! *outkeylen = yprkv.keydat.keydat_len; *outkey = (char *) malloc (*outkeylen + 2); ! bcopy (yprkv.keydat.keydat_val, *outkey, *outkeylen); (*outkey)[*outkeylen] = '\n'; (*outkey)[*outkeylen + 1] = '\0'; ! *outvallen = yprkv.valdat.valdat_len; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprkv.valdat.valdat_val, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; } *************** *** 609,616 **** yprk.domain = indomain; yprk.map = inmap; ! yprk.keydat.dptr = inkey; ! yprk.keydat.dsize = inkeylen; bzero ((char *) &yprkv, sizeof yprkv); result = clnt_call (ysd->dom_client, YPPROC_NEXT, --- 619,626 ---- yprk.domain = indomain; yprk.map = inmap; ! yprk.keydat.keydat_val = inkey; ! yprk.keydat.keydat_len = inkeylen; bzero ((char *) &yprkv, sizeof yprkv); result = clnt_call (ysd->dom_client, YPPROC_NEXT, *************** *** 629,642 **** result = ypprot_err (yprkv.status); if (0 == result) { ! *outkeylen = yprkv.keydat.dsize; *outkey = (char *) malloc (*outkeylen + 2); ! bcopy (yprkv.keydat.dptr, *outkey, *outkeylen); (*outkey)[*outkeylen] = '\n'; (*outkey)[*outkeylen + 1] = '\0'; ! *outvallen = yprkv.valdat.dsize; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprkv.valdat.dptr, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; } --- 639,652 ---- result = ypprot_err (yprkv.status); if (0 == result) { ! *outkeylen = yprkv.keydat.keydat_len; *outkey = (char *) malloc (*outkeylen + 2); ! bcopy (yprkv.keydat.keydat_val, *outkey, *outkeylen); (*outkey)[*outkeylen] = '\n'; (*outkey)[*outkeylen + 1] = '\0'; ! *outvallen = yprkv.valdat.valdat_len; *outval = (char *) malloc (*outvallen + 2); ! bcopy (yprkv.valdat.valdat_val, *outval, *outvallen); (*outval)[*outvallen] = '\n'; (*outval)[*outvallen + 1] = '\0'; } Index: linux/libc/yp/yppasswd.h diff -c linux/libc/yp/yppasswd.h:1.1.1.1 linux/libc/yp/yppasswd.h:removed *** linux/libc/yp/yppasswd.h:1.1.1.1 Fri Feb 17 21:33:39 1995 --- linux/libc/yp/yppasswd.h Mon Feb 17 14:47:11 1997 *************** *** 1,99 **** - /* - * Please do not edit this file. - * It was generated using rpcgen. - */ - - #ifndef _YPPASSWD_H_RPCGEN - #define _YPPASSWD_H_RPCGEN - - #include - - /* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * 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 or with the express written consent of - * Sun Microsystems, Inc. - * - * 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 - */ - /* - * Copyright (c) 1986, 1990 by Sun Microsystems, Inc. - */ - - /* from @(#)yppasswd.x 1.3 91/03/11 TIRPC 1.0 */ - #ifndef _rpcsvc_yppasswd_h - #define _rpcsvc_yppasswd_h - - struct passwd { - char *pw_name; - char *pw_passwd; - int pw_uid; - int pw_gid; - char *pw_gecos; - char *pw_dir; - char *pw_shell; - }; - #ifdef __cplusplus - extern "C" bool_t xdr_passwd(XDR *, passwd*); - #elif __STDC__ - extern bool_t xdr_passwd(XDR *, struct passwd*); - #else /* Old Style C */ - bool_t xdr_passwd(); - #endif /* Old Style C */ - - - struct yppasswd { - char *oldpass; - struct passwd newpw; - }; - #ifdef __cplusplus - extern "C" bool_t xdr_yppasswd(XDR *, yppasswd*); - #elif __STDC__ - extern bool_t xdr_yppasswd(XDR *, struct yppasswd*); - #else /* Old Style C */ - bool_t xdr_yppasswd(); - #endif /* Old Style C */ - - #endif /* !_rpcsvc_yppasswd_h */ - - #define YPPASSWDPROG ((u_long)100009) - #define YPPASSWDVERS ((u_long)1) - - #ifdef __cplusplus - #define YPPASSWDPROC_UPDATE ((u_long)1) - extern "C" int * yppasswdproc_update_1(yppasswd , CLIENT *); - extern "C" int * yppasswdproc_update_1_svc(yppasswd , struct svc_req *); - - #elif __STDC__ - #define YPPASSWDPROC_UPDATE ((u_long)1) - extern int * yppasswdproc_update_1(struct yppasswd , CLIENT *); - extern int * yppasswdproc_update_1_svc(struct yppasswd , struct svc_req *); - - #else /* Old Style C */ - #define YPPASSWDPROC_UPDATE ((u_long)1) - extern int * yppasswdproc_update_1(); - extern int * yppasswdproc_update_1_svc(); - #endif /* Old Style C */ - - #endif /* !_YPPASSWD_H_RPCGEN */ --- 0 ---- Index: linux/libc/yp/yppasswd_xdr.c diff -c linux/libc/yp/yppasswd_xdr.c:1.1.1.1 linux/libc/yp/yppasswd_xdr.c:1.2 *** linux/libc/yp/yppasswd_xdr.c:1.1.1.1 Fri Feb 17 21:33:39 1995 --- linux/libc/yp/yppasswd_xdr.c Sun Jan 26 10:00:50 1997 *************** *** 3,9 **** * It was generated using rpcgen. */ ! #include "yppasswd.h" /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape --- 3,9 ---- * It was generated using rpcgen. */ ! #include /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape Index: linux/include/_G_config.h diff -c linux/include/_G_config.h:1.76 linux/include/_G_config.h:1.82 *** linux/include/_G_config.h:1.76 Fri Dec 6 07:39:34 1996 --- linux/include/_G_config.h Fri Feb 14 19:37:18 1997 *************** *** 2,11 **** #ifndef _G_config_h #define _G_config_h ! #define _LINUX_C_LIB_VERSION "5.4.17" #define _LINUX_C_LIB_VERSION_MAJOR 5 #define _LINUX_C_LIB_VERSION_MINOR 4 ! #define _LINUX_C_LIB_VERSION_SUBMINOR 17 #define _G_LIB_VERSION "2.7.2" --- 2,11 ---- #ifndef _G_config_h #define _G_config_h ! #define _LINUX_C_LIB_VERSION "5.4.23" #define _LINUX_C_LIB_VERSION_MAJOR 5 #define _LINUX_C_LIB_VERSION_MINOR 4 ! #define _LINUX_C_LIB_VERSION_SUBMINOR 23 #define _G_LIB_VERSION "2.7.2" Index: linux/include/malloc.h diff -c linux/include/malloc.h:1.5 linux/include/malloc.h:1.6 *** linux/include/malloc.h:1.5 Fri Jan 19 14:02:39 1996 --- linux/include/malloc.h Fri Feb 14 19:37:18 1997 *************** *** 1,24 **** ! /* Declarations for `malloc' and friends. ! Copyright 1990, 1991, 1992 Free Software Foundation, Inc. ! Written May 1989 by Mike Haertel. ! ! This 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. ! ! 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 ! Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with this library; see the file COPYING.LIB. If ! not, write to the Free Software Foundation, Inc., 675 Mass Ave, ! Cambridge, MA 02139, USA. ! ! The author may be reached (Email) at the address mike@ai.mit.edu, ! or (US mail) as Mike Haertel c/o Free Software Foundation. */ #ifndef _MALLOC_H #define _MALLOC_H 1 --- 1,21 ---- ! /* Prototypes and definition for malloc implementation. ! 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 _MALLOC_H #define _MALLOC_H 1 *************** *** 41,46 **** --- 38,45 ---- #undef ptrdiff_t #define ptrdiff_t int #endif + + extern int __libc_malloc_initialized; /* For backward compatibilities and X11R5 */ #if (defined(MALLOC_0_RETURNS_NULL) || defined(NO_FIX_MALLOC)) \ Index: linux/include/paths.h diff -c linux/include/paths.h:1.4 linux/include/paths.h:1.5 *** linux/include/paths.h:1.4 Wed May 22 08:50:30 1996 --- linux/include/paths.h Tue Dec 17 08:24:15 1996 *************** *** 64,69 **** --- 64,70 ---- #define _PATH_TTY "/dev/tty" #define _PATH_UNIX "/vmlinux" #define _PATH_VI "/usr/bin/vi" + #define _PATH_PRESERVE "/var/preserve" /* Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" *************** *** 91,97 **** #define _PATH_LASTLOG "/var/log/lastlog" #endif ! #define _PATH_LOCALE "/usr/lib/locale" #define _PATH_RWHODIR "/var/spool/rwho" --- 92,98 ---- #define _PATH_LASTLOG "/var/log/lastlog" #endif ! #define _PATH_LOCALE "/usr/share/locale" #define _PATH_RWHODIR "/var/spool/rwho" Index: linux/include/time.h diff -c linux/include/time.h:1.6 linux/include/time.h:1.7 *** linux/include/time.h:1.6 Wed May 22 08:50:30 1996 --- linux/include/time.h Fri Feb 14 19:37:18 1997 *************** *** 88,94 **** extern char * ctime __P ((__const time_t * __tp)); extern size_t strftime __P ((char * __s, size_t __smax, __const char * __fmt, __const struct tm * __tp)); ! extern char * strptime __P ((char * __s, __const char * __fmt, struct tm * __tm)); extern void tzset __P ((void)); --- 88,94 ---- extern char * ctime __P ((__const time_t * __tp)); extern size_t strftime __P ((char * __s, size_t __smax, __const char * __fmt, __const struct tm * __tp)); ! extern char * strptime __P ((__const char * __s, __const char * __fmt, struct tm * __tm)); extern void tzset __P ((void)); Index: linux/include/netinet/ip.h diff -c linux/include/netinet/ip.h:1.4 linux/include/netinet/ip.h:1.5 *** linux/include/netinet/ip.h:1.4 Wed Jul 17 01:06:08 1996 --- linux/include/netinet/ip.h Sat Dec 7 21:42:00 1996 *************** *** 2,7 **** --- 2,8 ---- #define _NETINET_IP_H #include + #include #include #ifdef _BSD_SOURCE Index: linux/include/rpcsvc/yp.h diff -c /dev/null linux/include/rpcsvc/yp.h:1.2 *** /dev/null Mon Feb 17 14:47:13 1997 --- linux/include/rpcsvc/yp.h Mon Feb 3 19:54:48 1997 *************** *** 0 **** --- 1,621 ---- + /* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * 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 + */ + + #ifndef __RPCSVC_YP_H__ + #define __RPCSVC_YP_H__ + + #include + + #define YPMAXRECORD 1024 + #define YPMAXDOMAIN 64 + #define YPMAXMAP 64 + #define YPMAXPEER 64 + + enum ypstat { + YP_TRUE = 1, + YP_NOMORE = 2, + YP_FALSE = 0, + YP_NOMAP = -1, + YP_NODOM = -2, + YP_NOKEY = -3, + YP_BADOP = -4, + YP_BADDB = -5, + YP_YPERR = -6, + YP_BADARGS = -7, + YP_VERS = -8, + }; + typedef enum ypstat ypstat; + #ifdef __cplusplus + extern "C" bool_t xdr_ypstat(XDR *, ypstat*); + #elif __STDC__ + extern bool_t xdr_ypstat(XDR *, ypstat*); + #else /* Old Style C */ + bool_t xdr_ypstat(); + #endif /* Old Style C */ + + + enum ypxfrstat { + YPXFR_SUCC = 1, + YPXFR_AGE = 2, + YPXFR_NOMAP = -1, + YPXFR_NODOM = -2, + YPXFR_RSRC = -3, + YPXFR_RPC = -4, + YPXFR_MADDR = -5, + YPXFR_YPERR = -6, + YPXFR_BADARGS = -7, + YPXFR_DBM = -8, + YPXFR_FILE = -9, + YPXFR_SKEW = -10, + YPXFR_CLEAR = -11, + YPXFR_FORCE = -12, + YPXFR_XFRERR = -13, + YPXFR_REFUSED = -14, + }; + typedef enum ypxfrstat ypxfrstat; + #ifdef __cplusplus + extern "C" bool_t xdr_ypxfrstat(XDR *, ypxfrstat*); + #elif __STDC__ + extern bool_t xdr_ypxfrstat(XDR *, ypxfrstat*); + #else /* Old Style C */ + bool_t xdr_ypxfrstat(); + #endif /* Old Style C */ + + + typedef char *domainname; + #ifdef __cplusplus + extern "C" bool_t xdr_domainname(XDR *, domainname*); + #elif __STDC__ + extern bool_t xdr_domainname(XDR *, domainname*); + #else /* Old Style C */ + bool_t xdr_domainname(); + #endif /* Old Style C */ + + + typedef char *mapname; + #ifdef __cplusplus + extern "C" bool_t xdr_mapname(XDR *, mapname*); + #elif __STDC__ + extern bool_t xdr_mapname(XDR *, mapname*); + #else /* Old Style C */ + bool_t xdr_mapname(); + #endif /* Old Style C */ + + + typedef char *peername; + #ifdef __cplusplus + extern "C" bool_t xdr_peername(XDR *, peername*); + #elif __STDC__ + extern bool_t xdr_peername(XDR *, peername*); + #else /* Old Style C */ + bool_t xdr_peername(); + #endif /* Old Style C */ + + + typedef struct { + u_int keydat_len; + char *keydat_val; + } keydat; + #ifdef __cplusplus + extern "C" bool_t xdr_keydat(XDR *, keydat*); + #elif __STDC__ + extern bool_t xdr_keydat(XDR *, keydat*); + #else /* Old Style C */ + bool_t xdr_keydat(); + #endif /* Old Style C */ + + + typedef struct { + u_int valdat_len; + char *valdat_val; + } valdat; + #ifdef __cplusplus + extern "C" bool_t xdr_valdat(XDR *, valdat*); + #elif __STDC__ + extern bool_t xdr_valdat(XDR *, valdat*); + #else /* Old Style C */ + bool_t xdr_valdat(); + #endif /* Old Style C */ + + + struct ypmap_parms { + domainname domain; + mapname map; + u_int ordernum; + peername peer; + }; + typedef struct ypmap_parms ypmap_parms; + #ifdef __cplusplus + extern "C" bool_t xdr_ypmap_parms(XDR *, ypmap_parms*); + #elif __STDC__ + extern bool_t xdr_ypmap_parms(XDR *, ypmap_parms*); + #else /* Old Style C */ + bool_t xdr_ypmap_parms(); + #endif /* Old Style C */ + + + struct ypreq_key { + domainname domain; + mapname map; + keydat key; + }; + typedef struct ypreq_key ypreq_key; + #ifdef __cplusplus + extern "C" bool_t xdr_ypreq_key(XDR *, ypreq_key*); + #elif __STDC__ + extern bool_t xdr_ypreq_key(XDR *, ypreq_key*); + #else /* Old Style C */ + bool_t xdr_ypreq_key(); + #endif /* Old Style C */ + + + struct ypreq_nokey { + domainname domain; + mapname map; + }; + typedef struct ypreq_nokey ypreq_nokey; + #ifdef __cplusplus + extern "C" bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*); + #elif __STDC__ + extern bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*); + #else /* Old Style C */ + bool_t xdr_ypreq_nokey(); + #endif /* Old Style C */ + + + struct ypreq_xfr { + ypmap_parms map_parms; + u_int transid; + u_int prog; + u_int port; + }; + typedef struct ypreq_xfr ypreq_xfr; + #ifdef __cplusplus + extern "C" bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*); + #elif __STDC__ + extern bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*); + #else /* Old Style C */ + bool_t xdr_ypreq_xfr(); + #endif /* Old Style C */ + + + struct ypresp_val { + ypstat stat; + valdat val; + }; + typedef struct ypresp_val ypresp_val; + #ifdef __cplusplus + extern "C" bool_t xdr_ypresp_val(XDR *, ypresp_val*); + #elif __STDC__ + extern bool_t xdr_ypresp_val(XDR *, ypresp_val*); + #else /* Old Style C */ + bool_t xdr_ypresp_val(); + #endif /* Old Style C */ + + + struct ypresp_key_val { + ypstat stat; + #ifdef STUPID_SUN_BUG + /* This is the form as distributed by Sun. But even the Sun NIS + servers expect the values in the other order. So their + implementation somehow must change the order internally. We + don't want to follow this bad example since the user should be + able to use rpcgen on this file. */ + keydat key; + valdat val; + #else + valdat val; + keydat key; + #endif + }; + typedef struct ypresp_key_val ypresp_key_val; + #ifdef __cplusplus + extern "C" bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*); + #elif __STDC__ + extern bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*); + #else /* Old Style C */ + bool_t xdr_ypresp_key_val(); + #endif /* Old Style C */ + + + struct ypresp_master { + ypstat stat; + peername peer; + }; + typedef struct ypresp_master ypresp_master; + #ifdef __cplusplus + extern "C" bool_t xdr_ypresp_master(XDR *, ypresp_master*); + #elif __STDC__ + extern bool_t xdr_ypresp_master(XDR *, ypresp_master*); + #else /* Old Style C */ + bool_t xdr_ypresp_master(); + #endif /* Old Style C */ + + + struct ypresp_order { + ypstat stat; + u_int ordernum; + }; + typedef struct ypresp_order ypresp_order; + #ifdef __cplusplus + extern "C" bool_t xdr_ypresp_order(XDR *, ypresp_order*); + #elif __STDC__ + extern bool_t xdr_ypresp_order(XDR *, ypresp_order*); + #else /* Old Style C */ + bool_t xdr_ypresp_order(); + #endif /* Old Style C */ + + + struct ypresp_all { + bool_t more; + union { + ypresp_key_val val; + } ypresp_all_u; + }; + typedef struct ypresp_all ypresp_all; + #ifdef __cplusplus + extern "C" bool_t xdr_ypresp_all(XDR *, ypresp_all*); + #elif __STDC__ + extern bool_t xdr_ypresp_all(XDR *, ypresp_all*); + #else /* Old Style C */ + bool_t xdr_ypresp_all(); + #endif /* Old Style C */ + + + struct ypresp_xfr { + u_int transid; + ypxfrstat xfrstat; + }; + typedef struct ypresp_xfr ypresp_xfr; + #ifdef __cplusplus + extern "C" bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*); + #elif __STDC__ + extern bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*); + #else /* Old Style C */ + bool_t xdr_ypresp_xfr(); + #endif /* Old Style C */ + + + struct ypmaplist { + mapname map; + struct ypmaplist *next; + }; + typedef struct ypmaplist ypmaplist; + #ifdef __cplusplus + extern "C" bool_t xdr_ypmaplist(XDR *, ypmaplist*); + #elif __STDC__ + extern bool_t xdr_ypmaplist(XDR *, ypmaplist*); + #else /* Old Style C */ + bool_t xdr_ypmaplist(); + #endif /* Old Style C */ + + + struct ypresp_maplist { + ypstat stat; + ypmaplist *maps; + }; + typedef struct ypresp_maplist ypresp_maplist; + #ifdef __cplusplus + extern "C" bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*); + #elif __STDC__ + extern bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*); + #else /* Old Style C */ + bool_t xdr_ypresp_maplist(); + #endif /* Old Style C */ + + + enum yppush_status { + YPPUSH_SUCC = 1, + YPPUSH_AGE = 2, + YPPUSH_NOMAP = -1, + YPPUSH_NODOM = -2, + YPPUSH_RSRC = -3, + YPPUSH_RPC = -4, + YPPUSH_MADDR = -5, + YPPUSH_YPERR = -6, + YPPUSH_BADARGS = -7, + YPPUSH_DBM = -8, + YPPUSH_FILE = -9, + YPPUSH_SKEW = -10, + YPPUSH_CLEAR = -11, + YPPUSH_FORCE = -12, + YPPUSH_XFRERR = -13, + YPPUSH_REFUSED = -14, + }; + typedef enum yppush_status yppush_status; + #ifdef __cplusplus + extern "C" bool_t xdr_yppush_status(XDR *, yppush_status*); + #elif __STDC__ + extern bool_t xdr_yppush_status(XDR *, yppush_status*); + #else /* Old Style C */ + bool_t xdr_yppush_status(); + #endif /* Old Style C */ + + + struct yppushresp_xfr { + u_int transid; + yppush_status status; + }; + typedef struct yppushresp_xfr yppushresp_xfr; + #ifdef __cplusplus + extern "C" bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); + #elif __STDC__ + extern bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); + #else /* Old Style C */ + bool_t xdr_yppushresp_xfr(); + #endif /* Old Style C */ + + + enum ypbind_resptype { + YPBIND_SUCC_VAL = 1, + YPBIND_FAIL_VAL = 2, + }; + typedef enum ypbind_resptype ypbind_resptype; + #ifdef __cplusplus + extern "C" bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*); + #elif __STDC__ + extern bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*); + #else /* Old Style C */ + bool_t xdr_ypbind_resptype(); + #endif /* Old Style C */ + + + struct ypbind_binding { + char ypbind_binding_addr[4]; + char ypbind_binding_port[2]; + }; + typedef struct ypbind_binding ypbind_binding; + #ifdef __cplusplus + extern "C" bool_t xdr_ypbind_binding(XDR *, ypbind_binding*); + #elif __STDC__ + extern bool_t xdr_ypbind_binding(XDR *, ypbind_binding*); + #else /* Old Style C */ + bool_t xdr_ypbind_binding(); + #endif /* Old Style C */ + + + struct ypbind_resp { + ypbind_resptype ypbind_status; + union { + u_int ypbind_error; + ypbind_binding ypbind_bindinfo; + } ypbind_resp_u; + }; + typedef struct ypbind_resp ypbind_resp; + #ifdef __cplusplus + extern "C" bool_t xdr_ypbind_resp(XDR *, ypbind_resp*); + #elif __STDC__ + extern bool_t xdr_ypbind_resp(XDR *, ypbind_resp*); + #else /* Old Style C */ + bool_t xdr_ypbind_resp(); + #endif /* Old Style C */ + + #define YPBIND_ERR_ERR 1 + #define YPBIND_ERR_NOSERV 2 + #define YPBIND_ERR_RESC 3 + + struct ypbind_setdom { + domainname ypsetdom_domain; + ypbind_binding ypsetdom_binding; + u_int ypsetdom_vers; + }; + typedef struct ypbind_setdom ypbind_setdom; + #ifdef __cplusplus + extern "C" bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*); + #elif __STDC__ + extern bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*); + #else /* Old Style C */ + bool_t xdr_ypbind_setdom(); + #endif /* Old Style C */ + + + #define YPPROG ((u_long)100004) + #define YPVERS ((u_long)2) + + #ifdef __cplusplus + #define YPPROC_NULL ((u_long)0) + extern "C" void * ypproc_null_2(void *, CLIENT *); + extern "C" void * ypproc_null_2_svc(void *, struct svc_req *); + #define YPPROC_DOMAIN ((u_long)1) + extern "C" bool_t * ypproc_domain_2(domainname *, CLIENT *); + extern "C" bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *); + #define YPPROC_DOMAIN_NONACK ((u_long)2) + extern "C" bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *); + extern "C" bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *); + #define YPPROC_MATCH ((u_long)3) + extern "C" ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *); + extern "C" ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *); + #define YPPROC_FIRST ((u_long)4) + extern "C" ypresp_key_val * ypproc_first_2(ypreq_key *, CLIENT *); + extern "C" ypresp_key_val * ypproc_first_2_svc(ypreq_key *, struct svc_req *); + #define YPPROC_NEXT ((u_long)5) + extern "C" ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *); + extern "C" ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *); + #define YPPROC_XFR ((u_long)6) + extern "C" ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *); + extern "C" ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *); + #define YPPROC_CLEAR ((u_long)7) + extern "C" void * ypproc_clear_2(void *, CLIENT *); + extern "C" void * ypproc_clear_2_svc(void *, struct svc_req *); + #define YPPROC_ALL ((u_long)8) + extern "C" ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *); + extern "C" ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *); + #define YPPROC_MASTER ((u_long)9) + extern "C" ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *); + extern "C" ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *); + #define YPPROC_ORDER ((u_long)10) + extern "C" ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *); + extern "C" ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *); + #define YPPROC_MAPLIST ((u_long)11) + extern "C" ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *); + extern "C" ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *); + + #elif __STDC__ + #define YPPROC_NULL ((u_long)0) + extern void * ypproc_null_2(void *, CLIENT *); + extern void * ypproc_null_2_svc(void *, struct svc_req *); + #define YPPROC_DOMAIN ((u_long)1) + extern bool_t * ypproc_domain_2(domainname *, CLIENT *); + extern bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *); + #define YPPROC_DOMAIN_NONACK ((u_long)2) + extern bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *); + extern bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *); + #define YPPROC_MATCH ((u_long)3) + extern ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *); + extern ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *); + #define YPPROC_FIRST ((u_long)4) + extern ypresp_key_val * ypproc_first_2(ypreq_key *, CLIENT *); + extern ypresp_key_val * ypproc_first_2_svc(ypreq_key *, struct svc_req *); + #define YPPROC_NEXT ((u_long)5) + extern ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *); + extern ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *); + #define YPPROC_XFR ((u_long)6) + extern ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *); + extern ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *); + #define YPPROC_CLEAR ((u_long)7) + extern void * ypproc_clear_2(void *, CLIENT *); + extern void * ypproc_clear_2_svc(void *, struct svc_req *); + #define YPPROC_ALL ((u_long)8) + extern ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *); + extern ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *); + #define YPPROC_MASTER ((u_long)9) + extern ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *); + extern ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *); + #define YPPROC_ORDER ((u_long)10) + extern ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *); + extern ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *); + #define YPPROC_MAPLIST ((u_long)11) + extern ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *); + extern ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *); + + #else /* Old Style C */ + #define YPPROC_NULL ((u_long)0) + extern void * ypproc_null_2(); + extern void * ypproc_null_2_svc(); + #define YPPROC_DOMAIN ((u_long)1) + extern bool_t * ypproc_domain_2(); + extern bool_t * ypproc_domain_2_svc(); + #define YPPROC_DOMAIN_NONACK ((u_long)2) + extern bool_t * ypproc_domain_nonack_2(); + extern bool_t * ypproc_domain_nonack_2_svc(); + #define YPPROC_MATCH ((u_long)3) + extern ypresp_val * ypproc_match_2(); + extern ypresp_val * ypproc_match_2_svc(); + #define YPPROC_FIRST ((u_long)4) + extern ypresp_key_val * ypproc_first_2(); + extern ypresp_key_val * ypproc_first_2_svc(); + #define YPPROC_NEXT ((u_long)5) + extern ypresp_key_val * ypproc_next_2(); + extern ypresp_key_val * ypproc_next_2_svc(); + #define YPPROC_XFR ((u_long)6) + extern ypresp_xfr * ypproc_xfr_2(); + extern ypresp_xfr * ypproc_xfr_2_svc(); + #define YPPROC_CLEAR ((u_long)7) + extern void * ypproc_clear_2(); + extern void * ypproc_clear_2_svc(); + #define YPPROC_ALL ((u_long)8) + extern ypresp_all * ypproc_all_2(); + extern ypresp_all * ypproc_all_2_svc(); + #define YPPROC_MASTER ((u_long)9) + extern ypresp_master * ypproc_master_2(); + extern ypresp_master * ypproc_master_2_svc(); + #define YPPROC_ORDER ((u_long)10) + extern ypresp_order * ypproc_order_2(); + extern ypresp_order * ypproc_order_2_svc(); + #define YPPROC_MAPLIST ((u_long)11) + extern ypresp_maplist * ypproc_maplist_2(); + extern ypresp_maplist * ypproc_maplist_2_svc(); + #endif /* Old Style C */ + + #define YPPUSH_XFRRESPPROG ((u_long)0x40000000) + #define YPPUSH_XFRRESPVERS ((u_long)1) + + #ifdef __cplusplus + #define YPPUSHPROC_NULL ((u_long)0) + extern "C" void * yppushproc_null_1(void *, CLIENT *); + extern "C" void * yppushproc_null_1_svc(void *, struct svc_req *); + #define YPPUSHPROC_XFRRESP ((u_long)1) + extern "C" void * yppushproc_xfrresp_1(yppushresp_xfr *, CLIENT *); + extern "C" void * yppushproc_xfrresp_1_svc(yppushresp_xfr *, struct svc_req *); + + #elif __STDC__ + #define YPPUSHPROC_NULL ((u_long)0) + extern void * yppushproc_null_1(void *, CLIENT *); + extern void * yppushproc_null_1_svc(void *, struct svc_req *); + #define YPPUSHPROC_XFRRESP ((u_long)1) + extern void * yppushproc_xfrresp_1(yppushresp_xfr *, CLIENT *); + extern void * yppushproc_xfrresp_1_svc(yppushresp_xfr *, struct svc_req *); + + #else /* Old Style C */ + #define YPPUSHPROC_NULL ((u_long)0) + extern void * yppushproc_null_1(); + extern void * yppushproc_null_1_svc(); + #define YPPUSHPROC_XFRRESP ((u_long)1) + extern void * yppushproc_xfrresp_1(); + extern void * yppushproc_xfrresp_1_svc(); + #endif /* Old Style C */ + + #define YPBINDPROG ((u_long)100007) + #define YPBINDVERS ((u_long)2) + + #ifdef __cplusplus + #define YPBINDPROC_NULL ((u_long)0) + extern "C" void * ypbindproc_null_2(void *, CLIENT *); + extern "C" void * ypbindproc_null_2_svc(void *, struct svc_req *); + #define YPBINDPROC_DOMAIN ((u_long)1) + extern "C" ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *); + extern "C" ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *); + #define YPBINDPROC_SETDOM ((u_long)2) + extern "C" void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *); + extern "C" void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *); + + #elif __STDC__ + #define YPBINDPROC_NULL ((u_long)0) + extern void * ypbindproc_null_2(void *, CLIENT *); + extern void * ypbindproc_null_2_svc(void *, struct svc_req *); + #define YPBINDPROC_DOMAIN ((u_long)1) + extern ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *); + extern ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *); + #define YPBINDPROC_SETDOM ((u_long)2) + extern void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *); + extern void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *); + + #else /* Old Style C */ + #define YPBINDPROC_NULL ((u_long)0) + extern void * ypbindproc_null_2(); + extern void * ypbindproc_null_2_svc(); + #define YPBINDPROC_DOMAIN ((u_long)1) + extern ypbind_resp * ypbindproc_domain_2(); + extern ypbind_resp * ypbindproc_domain_2_svc(); + #define YPBINDPROC_SETDOM ((u_long)2) + extern void * ypbindproc_setdom_2(); + extern void * ypbindproc_setdom_2_svc(); + #endif /* Old Style C */ + + #endif /* !__RPCSVC_YP_H__ */ Index: linux/include/rpcsvc/yp.x diff -c linux/include/rpcsvc/yp.x:1.1.1.1 linux/include/rpcsvc/yp.x:1.3 *** linux/include/rpcsvc/yp.x:1.1.1.1 Fri Feb 17 21:34:09 1995 --- linux/include/rpcsvc/yp.x Mon Feb 3 19:54:48 1997 *************** *** 7,29 **** * 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 --- 7,29 ---- * 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 *************** *** 82,88 **** struct ypmap_parms { ! domainname domain; mapname map; unsigned int ordernum; peername peer; --- 82,88 ---- struct ypmap_parms { ! domainname domain; mapname map; unsigned int ordernum; peername peer; *************** *** 95,104 **** }; struct ypreq_nokey { ! domainname domain; mapname map; }; ! struct ypreq_xfr { ypmap_parms map_parms; unsigned int transid; --- 95,104 ---- }; struct ypreq_nokey { ! domainname domain; mapname map; }; ! struct ypreq_xfr { ypmap_parms map_parms; unsigned int transid; *************** *** 114,126 **** struct ypresp_key_val { ypstat stat; keydat key; valdat val; }; struct ypresp_master { ! ypstat stat; peername peer; }; --- 114,136 ---- struct ypresp_key_val { ypstat stat; + #ifdef STUPID_SUN_BUG + /* This is the form as distributed by Sun. But even the Sun NIS + servers expect the values in the other order. So their + implementation somehow must change the order internally. We + don't want to follow this bad example since the user should be + able to use rpcgen on this file. */ keydat key; valdat val; + #else + valdat val; + keydat key; + #endif }; struct ypresp_master { ! ypstat stat; peername peer; }; *************** *** 179,209 **** * Response structure and overall result status codes. Success and failure * represent two separate response message types. */ ! enum ypbind_resptype { ! YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2 }; ! struct ypbind_binding { opaque ypbind_binding_addr[4]; /* In network order */ opaque ypbind_binding_port[2]; /* In network order */ ! }; union ypbind_resp switch (ypbind_resptype ypbind_status) { case YPBIND_FAIL_VAL: unsigned ypbind_error; case YPBIND_SUCC_VAL: ypbind_binding ypbind_bindinfo; ! }; /* Detailed failure reason codes for response field ypbind_error*/ ! const YPBIND_ERR_ERR = 1; /* Internal error */ const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ ! ! /* * Request data structure for ypbind "Set domain" procedure. */ --- 189,219 ---- * Response structure and overall result status codes. Success and failure * represent two separate response message types. */ ! enum ypbind_resptype { ! YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2 }; ! struct ypbind_binding { opaque ypbind_binding_addr[4]; /* In network order */ opaque ypbind_binding_port[2]; /* In network order */ ! }; union ypbind_resp switch (ypbind_resptype ypbind_status) { case YPBIND_FAIL_VAL: unsigned ypbind_error; case YPBIND_SUCC_VAL: ypbind_binding ypbind_bindinfo; ! }; /* Detailed failure reason codes for response field ypbind_error*/ ! const YPBIND_ERR_ERR = 1; /* Internal error */ const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ ! ! /* * Request data structure for ypbind "Set domain" procedure. */ *************** *** 219,229 **** */ program YPPROG { version YPVERS { ! void YPPROC_NULL(void) = 0; ! bool ! YPPROC_DOMAIN(domainname) = 1; bool YPPROC_DOMAIN_NONACK(domainname) = 2; --- 229,239 ---- */ program YPPROG { version YPVERS { ! void YPPROC_NULL(void) = 0; ! bool ! YPPROC_DOMAIN(domainname) = 1; bool YPPROC_DOMAIN_NONACK(domainname) = 2; *************** *** 231,240 **** ypresp_val YPPROC_MATCH(ypreq_key) = 3; ! ypresp_key_val YPPROC_FIRST(ypreq_key) = 4; ! ypresp_key_val YPPROC_NEXT(ypreq_key) = 5; ypresp_xfr --- 241,250 ---- ypresp_val YPPROC_MATCH(ypreq_key) = 3; ! ypresp_key_val YPPROC_FIRST(ypreq_key) = 4; ! ypresp_key_val YPPROC_NEXT(ypreq_key) = 5; ypresp_xfr *************** *** 252,258 **** ypresp_order YPPROC_ORDER(ypreq_nokey) = 10; ! ypresp_maplist YPPROC_MAPLIST(domainname) = 11; } = 2; } = 100004; --- 262,268 ---- ypresp_order YPPROC_ORDER(ypreq_nokey) = 10; ! ypresp_maplist YPPROC_MAPLIST(domainname) = 11; } = 2; } = 100004; *************** *** 266,277 **** void YPPUSHPROC_NULL(void) = 0; ! yppushresp_xfr YPPUSHPROC_XFRRESP(void) = 1; } = 1; } = 0x40000000; /* transient: could be anything up to 0x5fffffff */ - /* * YP binding protocol */ --- 276,297 ---- void YPPUSHPROC_NULL(void) = 0; ! #ifdef STUPID_SUN_BUG ! /* This is the form as distributed by Sun. But even ! the Sun NIS servers expect the values in the other ! order. So their implementation somehow must change ! the order internally. We don't want to follow this ! bad example since the user should be able to use ! rpcgen on this file. */ ! yppushresp_xfr YPPUSHPROC_XFRRESP(void) = 1; + #else + void + YPPUSHPROC_XFRRESP(yppushresp_xfr) = 1; + #endif } = 1; } = 0x40000000; /* transient: could be anything up to 0x5fffffff */ /* * YP binding protocol */ *************** *** 279,285 **** version YPBINDVERS { void YPBINDPROC_NULL(void) = 0; ! ypbind_resp YPBINDPROC_DOMAIN(domainname) = 1; --- 299,305 ---- version YPBINDVERS { void YPBINDPROC_NULL(void) = 0; ! ypbind_resp YPBINDPROC_DOMAIN(domainname) = 1; *************** *** 287,291 **** YPBINDPROC_SETDOM(ypbind_setdom) = 2; } = 2; } = 100007; - - --- 307,309 ---- Index: linux/include/rpcsvc/yp_prot.h diff -c linux/include/rpcsvc/yp_prot.h:1.1.1.1 linux/include/rpcsvc/yp_prot.h:1.4 *** linux/include/rpcsvc/yp_prot.h:1.1.1.1 Fri Feb 17 21:34:09 1995 --- linux/include/rpcsvc/yp_prot.h Mon Feb 3 19:54:48 1997 *************** *** 1,9 **** - /* @(#)yp_prot.h 1.15 90/01/03 Copyr 1990 Sun Microsystems, Inc */ - /* * This file contains symbols and structures defining the rpc protocol * between the NIS clients and the NIS servers. The servers ! * are the NIS database servers, and the NIS binders. */ #ifndef _RPCSVC_YP_PROT_H --- 1,7 ---- /* * This file contains symbols and structures defining the rpc protocol * between the NIS clients and the NIS servers. The servers ! * are the NIS database servers, and the NIS binders. */ #ifndef _RPCSVC_YP_PROT_H *************** *** 16,39 **** /* * The following procedures are supported by the protocol: ! * * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates * that the NIS server is alive. ! * * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the * responding NIS server does serve the named domain; FALSE indicates no * support. ! * * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve * the named domain, otherwise does not return. Used in the broadcast case. ! * * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the * right-hand value for a passed left-hand key, within a named map and * domain. ! * * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). * Returns the first key-value pair from a named domain and map. ! * * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns * the key-value pair following a passed key-value pair within a named * domain and map. --- 14,37 ---- /* * The following procedures are supported by the protocol: ! * * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates * that the NIS server is alive. ! * * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the * responding NIS server does serve the named domain; FALSE indicates no * support. ! * * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve * the named domain, otherwise does not return. Used in the broadcast case. ! * * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the * right-hand value for a passed left-hand key, within a named map and * domain. ! * * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). * Returns the first key-value pair from a named domain and map. ! * * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns * the key-value pair following a passed key-value pair within a named * domain and map. *************** *** 44,50 **** * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to * close the current map, so that old versions of the disk file don't get * held open. ! * * YPPROC_ALL (struct ypreq_nokey), returns * union switch (bool_t more) { * TRUE: (struct ypresp_key_val); --- 42,48 ---- * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to * close the current map, so that old versions of the disk file don't get * held open. ! * * YPPROC_ALL (struct ypreq_nokey), returns * union switch (bool_t more) { * TRUE: (struct ypresp_key_val); *************** *** 63,89 **** #define YPPROG ((u_long)100004) #define YPVERS ((u_long)2) #define YPVERS_ORIG ((u_long)1) ! #define YPMAXRECORD ((u_long)1024) ! #define YPMAXDOMAIN ((u_long)256) ! #define YPMAXMAP ((u_long)64) ! #define YPMAXPEER ((u_long)256) /* byte size of a large NIS packet */ #define YPMSGSZ 1600 - #ifndef DATUM typedef struct { ! char *dptr; ! int dsize; ! } datum; ! #define DATUM ! #endif struct ypmap_parms { ! char *domain; /* Null string means not available */ ! char *map; /* Null string means not available */ ! unsigned long int ordernum; /* 0 means not available */ ! char *owner; /* Null string means not available */ }; /* --- 61,89 ---- #define YPPROG ((u_long)100004) #define YPVERS ((u_long)2) #define YPVERS_ORIG ((u_long)1) ! #define YPMAXRECORD 1024 ! #define YPMAXDOMAIN 64 /* XXX orig. yp_prot.h defines ((u_long)256) */ ! #define YPMAXMAP 64 ! #define YPMAXPEER 64 /* XXX orig. yp_prot.h defines ((u_long)256) */ /* byte size of a large NIS packet */ #define YPMSGSZ 1600 typedef struct { ! u_int keydat_len; ! char *keydat_val; ! } keydat; ! ! typedef struct { ! u_int valdat_len; ! char *valdat_val; ! } valdat; struct ypmap_parms { ! char *domain; /* Null string means not available */ ! char *map; /* Null string means not available */ ! unsigned int ordernum; /* 0 means not available */ ! char *owner; /* Null string means not available */ }; /* *************** *** 91,118 **** */ struct ypreq_key { ! char *domain; ! char *map; ! datum keydat; }; struct ypreq_nokey { ! char *domain; ! char *map; }; struct ypreq_xfr { ! struct ypmap_parms map_parms; ! unsigned long transid; ! unsigned long proto; ! unsigned short port; ! }; ! ! struct ypreq_newxfr { ! struct ypmap_parms map_parms; ! unsigned long transid; ! unsigned long proto; ! char *name; }; #define ypxfr_domain map_parms.domain --- 91,111 ---- */ struct ypreq_key { ! const char *domain; ! const char *map; ! keydat keydat; }; struct ypreq_nokey { ! char *domain; ! char *map; }; struct ypreq_xfr { ! struct ypmap_parms map_parms; ! u_int transid; ! u_int proto; ! u_int port; }; #define ypxfr_domain map_parms.domain *************** *** 120,158 **** #define ypxfr_ordernum map_parms.ordernum #define ypxfr_owner map_parms.owner /* * Response parameter structures */ struct ypresp_val { ! long unsigned status; ! datum valdat; }; struct ypresp_key_val { ! long unsigned status; ! datum keydat; ! datum valdat; }; struct ypresp_master { ! long unsigned status; ! char *master; }; struct ypresp_order { ! long unsigned status; ! unsigned long int ordernum; }; struct ypmaplist { ! char ypml_name[YPMAXMAP + 1]; ! struct ypmaplist *ypml_next; }; struct ypresp_maplist { ! long unsigned status; ! struct ypmaplist *list; }; /* --- 113,193 ---- #define ypxfr_ordernum map_parms.ordernum #define ypxfr_owner map_parms.owner + /* Return status values */ + + enum ypstat { + YP_TRUE = 1, /* General purpose success code */ + #define YP_TRUE YP_TRUE + YP_NOMORE = 2, /* No more entries in map */ + #define YP_NOMORE YP_NOMORE + YP_FALSE = 0, /* General purpose failure code */ + #define YP_FALSE YP_FALSE + YP_NOMAP = -1, /* No such map in domain */ + #define YP_NOMAP YP_NOMAP + YP_NODOM = -2, /* Domain not supported */ + #define YP_NODOM YP_NODOM + YP_NOKEY = -3, /* No such key in map */ + #define YP_NOKEY YP_NOKEY + YP_BADOP = -4, /* Invalid operation */ + #define YP_BADOP YP_BADOP + YP_BADDB = -5, /* Server data base is bad */ + #define YP_BADDB YP_BADDB + YP_YPERR = -6, /* NIS server error */ + #define YP_YPERR YP_YPERR + YP_BADARGS = -7, /* Request arguments bad */ + #define YP_BADARGS YP_BADARGS + YP_VERS = -8, /* NIS server version mismatch - server can't supply + requested service. */ + #define YP_VERS YP_VERS + }; + /* * Response parameter structures */ + typedef enum ypstat ypstat; + struct ypresp_val { ! ypstat status; ! valdat valdat; }; struct ypresp_key_val { ! ypstat status; ! #ifdef STUPID_SUN_BUG ! /* This is the form as distributed by Sun. But even the Sun NIS ! servers expect the values in the other order. So their ! implementation somehow must change the order internally. We ! don't want to follow this bad example since the user should be ! able to use rpcgen on this file. */ ! keydat keydat; ! valdat valdat; ! #else ! valdat valdat; ! keydat keydat; ! #endif }; struct ypresp_master { ! ypstat status; ! char *master; }; struct ypresp_order { ! ypstat status; ! u_int ordernum; }; struct ypmaplist { ! char *map; ! #define ypml_name map ! struct ypmaplist *next; ! #define ypml_next next }; struct ypresp_maplist { ! ypstat status; ! struct ypmaplist *list; }; /* *************** *** 175,214 **** #define YPPROC_MAPLIST ((u_long)11) #define YPPROC_NEWXFR ((u_long)12) - /* Return status values */ - - #define YP_TRUE ((long)1) /* General purpose success code */ - #define YP_NOMORE ((long)2) /* No more entries in map */ - #define YP_FALSE ((long)0) /* General purpose failure code */ - #define YP_NOMAP ((long)-1) /* No such map in domain */ - #define YP_NODOM ((long)-2) /* Domain not supported */ - #define YP_NOKEY ((long)-3) /* No such key in map */ - #define YP_BADOP ((long)-4) /* Invalid operation */ - #define YP_BADDB ((long)-5) /* Server data base is bad */ - #define YP_YPERR ((long)-6) /* NIS server error */ - #define YP_BADARGS ((long)-7) /* Request arguments bad */ - #define YP_VERS ((long)-8) /* NIS server version mismatch - server - * can't supply requested service. */ - - /* - * Domain binding data structure, used by ypclnt package and ypserv modules. - * Users of the ypclnt package (or of this protocol) don't HAVE to know about - * it, but it must be available to users because _yp_dobind is a public - * interface. - */ - - struct dom_binding { - struct dom_binding *dom_pnext; - char dom_domain[YPMAXDOMAIN + 1]; - struct sockaddr_in dom_server_addr; - unsigned short int dom_server_port; - int dom_socket; - CLIENT *dom_client; - unsigned short int dom_local_port; - long int dom_vers; - }; - - /* * Protocol between clients and NIS binder servers */ --- 210,215 ---- *************** *** 223,229 **** * * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing */ ! /* Program and version symbols, magic numbers */ #define YPBINDPROG ((u_long)100007) --- 224,230 ---- * * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing */ ! /* Program and version symbols, magic numbers */ #define YPBINDPROG ((u_long)100007) *************** *** 243,257 **** enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2}; struct ypbind_binding { ! struct in_addr ypbind_binding_addr; /* In network order */ ! unsigned short int ypbind_binding_port; /* In network order */ }; struct ypbind_resp { ! enum ypbind_resptype ypbind_status; ! union { ! unsigned long ypbind_error; ! struct ypbind_binding ypbind_bindinfo; ! } ypbind_respbody; }; --- 244,259 ---- enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2}; struct ypbind_binding { ! struct in_addr ypbind_binding_addr; /* In network order */ ! unsigned short int ypbind_binding_port; /* In network order */ }; + struct ypbind_resp { ! enum ypbind_resptype ypbind_status; ! union { ! u_int ypbind_error; ! struct ypbind_binding ypbind_bindinfo; ! } ypbind_respbody; }; *************** *** 265,273 **** * Request data structure for ypbind "Set domain" procedure. */ struct ypbind_setdom { ! char ypsetdom_domain[YPMAXDOMAIN + 1]; ! struct ypbind_binding ypsetdom_binding; ! unsigned short ypsetdom_vers; }; #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr #define ypsetdom_port ypsetdom_binding.ypbind_binding_port --- 267,275 ---- * Request data structure for ypbind "Set domain" procedure. */ struct ypbind_setdom { ! char *ypsetdom_domain; ! struct ypbind_binding ypsetdom_binding; ! u_int ypsetdom_vers; }; #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr #define ypsetdom_port ypsetdom_binding.ypbind_binding_port *************** *** 278,284 **** * is supplied to ypxfr as a command-line parameter when it * is activated by ypserv. */ ! #define YPPUSHVERS ((u_long) 1) #define YPPUSHVERS_ORIG ((u_long)1) /* Procedure symbols */ --- 280,286 ---- * is supplied to ypxfr as a command-line parameter when it * is activated by ypserv. */ ! #define YPPUSHVERS ((u_long)1) #define YPPUSHVERS_ORIG ((u_long)1) /* Procedure symbols */ *************** *** 286,354 **** #define YPPUSHPROC_NULL ((u_long)0) #define YPPUSHPROC_XFRRESP ((u_long)1) - struct yppushresp_xfr { - unsigned long transid; - unsigned long status; - }; - /* Status values for yppushresp_xfr.status */ ! #define YPPUSH_SUCC ((long)1) /* Success */ ! #define YPPUSH_AGE ((long)2) /* Master's version not newer */ ! #define YPPUSH_NOMAP ((long)-1) /* Can't find server for map */ ! #define YPPUSH_NODOM ((long)-2) /* Domain not supported */ ! #define YPPUSH_RSRC ((long)-3) /* Local resouce alloc failure */ ! #define YPPUSH_RPC ((long)-4) /* RPC failure talking to server */ ! #define YPPUSH_MADDR ((long)-5) /* Can't get master address */ ! #define YPPUSH_YPERR ((long)-6) /* NIS server/map db error */ ! #define YPPUSH_BADARGS ((long)-7) /* Request arguments bad */ ! #define YPPUSH_DBM ((long)-8) /* Local dbm operation failed */ ! #define YPPUSH_FILE ((long)-9) /* Local file I/O operation failed */ ! #define YPPUSH_SKEW ((long)-10) /* Map version skew during transfer */ ! #define YPPUSH_CLEAR ((long)-11) /* Can't send "Clear" req to local ! * ypserv */ ! #define YPPUSH_FORCE ((long)-12) /* No local order number in map - ! * use -f flag. */ ! #define YPPUSH_XFRERR ((long)-13) /* ypxfr error */ ! #define YPPUSH_REFUSED ((long)-14) /* Transfer request refused by ypserv */ ! #define YPPUSH_NOALIAS ((long)-15) /* Alias not found for map or domain */ struct ypresp_all { ! bool_t more; ! union { ! struct ypresp_key_val val; ! } ypresp_all_u; }; ! __BEGIN_DECLS - extern bool_t xdr_datum __P ((XDR *__xdrs, datum * __objp)); - extern bool_t xdr_ypdomain_wrap_string __P ((XDR *__xdrs, char ** __objp)); - extern bool_t xdr_ypmap_wrap_string __P ((XDR *__xdrs, char ** __objp)); extern bool_t xdr_ypreq_key __P ((XDR *__xdrs, struct ypreq_key * __objp)); extern bool_t xdr_ypreq_nokey __P ((XDR *__xdrs, struct ypreq_nokey * __objp)); extern bool_t xdr_ypreq_xfr __P ((XDR *__xdrs, struct ypreq_xfr * __objp)); - extern bool_t xdr_ypreq_newxfr __P ((XDR *__xdrs, struct ypreq_newxfr * __objp)); extern bool_t xdr_ypresp_val __P ((XDR *__xdrs, struct ypresp_val * __objp)); extern bool_t xdr_ypresp_key_val __P ((XDR *__xdrs, struct ypresp_key_val * __objp)); extern bool_t xdr_ypbind_resp __P ((XDR *__xdrs, struct ypbind_resp * __objp)); extern bool_t xdr_ypbind_setdom __P ((XDR *__xdrs, struct ypbind_setdom * __objp)); extern bool_t xdr_ypmap_parms __P ((XDR *__xdrs, struct ypmap_parms * __objp)); - extern bool_t xdr_ypowner_wrap_string __P ((XDR *__xdrs, char ** __objp)); extern bool_t xdr_yppushresp_xfr __P ((XDR *__xdrs, struct yppushresp_xfr * __objp)); extern bool_t xdr_ypresp_order __P ((XDR *__xdrs, struct ypresp_order * __objp)); extern bool_t xdr_ypresp_master __P ((XDR *__xdrs, struct ypresp_master * __objp)); extern bool_t xdr_ypall __P ((XDR *__xdrs, struct ypall_callback * __objp)); extern bool_t xdr_ypresp_maplist __P ((XDR *__xdrs, struct ypresp_maplist * __objp)); - - extern bool_t xdr_domainname __P ((XDR *__xdrs, char * __objp)); extern bool_t xdr_ypbind_binding __P ((XDR *__xdrs, struct ypbind_binding * __objp)); extern bool_t xdr_ypbind_resptype __P ((XDR *__xdrs, enum ypbind_resptype * __objp)); extern bool_t xdr_ypstat __P ((XDR *__xdrs, enum ypbind_resptype * __objp)); extern bool_t xdr_ypresp_all __P ((XDR *__xdrs, struct ypresp_all * __objp)); extern bool_t xdr_ypresp_all_seq __P ((XDR *__xdrs, u_long * __objp)); - extern bool_t xdr_ypmaplist_str __P ((XDR *__xdrs, char * __objp)); extern bool_t xdr_ypmaplist __P ((XDR *__xdrs, struct ypmaplist * __objp)); __END_DECLS --- 288,367 ---- #define YPPUSHPROC_NULL ((u_long)0) #define YPPUSHPROC_XFRRESP ((u_long)1) /* Status values for yppushresp_xfr.status */ ! enum yppush_status { ! YPPUSH_SUCC = 1, /* Success */ ! #define YPPUSH_SUCC YPPUSH_SUCC ! YPPUSH_AGE = 2, /* Master's version not newer */ ! #define YPPUSH_AGE YPPUSH_AGE ! YPPUSH_NOMAP = -1, /* Can't find server for map */ ! #define YPPUSH_NOMAP YPPUSH_NOMAP ! YPPUSH_NODOM = -2, /* Domain not supported */ ! #define YPPUSH_NODOM YPPUSH_NODOM ! YPPUSH_RSRC = -3, /* Local resouce alloc failure */ ! #define YPPUSH_RSRC YPPUSH_RSRC ! YPPUSH_RPC = -4, /* RPC failure talking to server */ ! #define YPPUSH_RPC YPPUSH_RPC ! YPPUSH_MADDR = -5, /* Can't get master address */ ! #define YPPUSH_MADDR YPPUSH_MADDR ! YPPUSH_YPERR = -6, /* NIS server/map db error */ ! #define YPPUSH_YPERR YPPUSH_YPERR ! YPPUSH_BADARGS = -7, /* Request arguments bad */ ! #define YPPUSH_BADARGS YPPUSH_BADARGS ! YPPUSH_DBM = -8, /* Local dbm operation failed */ ! #define YPPUSH_DBM YPPUSH_DBM ! YPPUSH_FILE = -9, /* Local file I/O operation failed */ ! #define YPPUSH_FILE YPPUSH_FILE ! YPPUSH_SKEW = -10, /* Map version skew during transfer */ ! #define YPPUSH_SKEW YPPUSH_SKEW ! YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ ! #define YPPUSH_CLEAR YPPUSH_CLEAR ! YPPUSH_FORCE = -12, /* No local order number in map - use -f flag*/ ! #define YPPUSH_FORCE YPPUSH_FORCE ! YPPUSH_XFRERR = -13, /* ypxfr error */ ! #define YPPUSH_XFRERR YPPUSH_XFRERR ! YPPUSH_REFUSED = -14, /* Transfer request refused by ypserv */ ! #define YPPUSH_REFUSED YPPUSH_REFUSED ! YPPUSH_NOALIAS = -15 /* Alias not found for map or domain */ ! #define YPPUSH_NOALIAS YPPUSH_NOALIAS ! }; ! typedef enum yppush_status yppush_status; ! ! struct yppushresp_xfr { ! u_int transid; ! yppush_status status; ! }; struct ypresp_all { ! bool_t more; ! union { ! struct ypresp_key_val val; ! } ypresp_all_u; }; ! __BEGIN_DECLS extern bool_t xdr_ypreq_key __P ((XDR *__xdrs, struct ypreq_key * __objp)); extern bool_t xdr_ypreq_nokey __P ((XDR *__xdrs, struct ypreq_nokey * __objp)); extern bool_t xdr_ypreq_xfr __P ((XDR *__xdrs, struct ypreq_xfr * __objp)); extern bool_t xdr_ypresp_val __P ((XDR *__xdrs, struct ypresp_val * __objp)); extern bool_t xdr_ypresp_key_val __P ((XDR *__xdrs, struct ypresp_key_val * __objp)); extern bool_t xdr_ypbind_resp __P ((XDR *__xdrs, struct ypbind_resp * __objp)); extern bool_t xdr_ypbind_setdom __P ((XDR *__xdrs, struct ypbind_setdom * __objp)); extern bool_t xdr_ypmap_parms __P ((XDR *__xdrs, struct ypmap_parms * __objp)); extern bool_t xdr_yppushresp_xfr __P ((XDR *__xdrs, struct yppushresp_xfr * __objp)); extern bool_t xdr_ypresp_order __P ((XDR *__xdrs, struct ypresp_order * __objp)); extern bool_t xdr_ypresp_master __P ((XDR *__xdrs, struct ypresp_master * __objp)); extern bool_t xdr_ypall __P ((XDR *__xdrs, struct ypall_callback * __objp)); extern bool_t xdr_ypresp_maplist __P ((XDR *__xdrs, struct ypresp_maplist * __objp)); extern bool_t xdr_ypbind_binding __P ((XDR *__xdrs, struct ypbind_binding * __objp)); extern bool_t xdr_ypbind_resptype __P ((XDR *__xdrs, enum ypbind_resptype * __objp)); extern bool_t xdr_ypstat __P ((XDR *__xdrs, enum ypbind_resptype * __objp)); extern bool_t xdr_ypresp_all __P ((XDR *__xdrs, struct ypresp_all * __objp)); extern bool_t xdr_ypresp_all_seq __P ((XDR *__xdrs, u_long * __objp)); extern bool_t xdr_ypmaplist __P ((XDR *__xdrs, struct ypmaplist * __objp)); + extern bool_t xdr_domainname __P ((XDR *__xdrs, char ** __objp)); __END_DECLS Index: linux/include/rpcsvc/yppasswd.h diff -c /dev/null linux/include/rpcsvc/yppasswd.h:1.1 *** /dev/null Mon Feb 17 14:47:14 1997 --- linux/include/rpcsvc/yppasswd.h Sun Jan 26 10:09:42 1997 *************** *** 0 **** --- 1,99 ---- + /* + * Please do not edit this file. + * It was generated using rpcgen. + */ + + #ifndef _YPPASSWD_H_RPCGEN + #define _YPPASSWD_H_RPCGEN + + #include + + /* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * 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 or with the express written consent of + * Sun Microsystems, Inc. + * + * 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 + */ + /* + * Copyright (c) 1986, 1990 by Sun Microsystems, Inc. + */ + + /* from @(#)yppasswd.x 1.3 91/03/11 TIRPC 1.0 */ + #ifndef _rpcsvc_yppasswd_h + #define _rpcsvc_yppasswd_h + + struct passwd { + char *pw_name; + char *pw_passwd; + int pw_uid; + int pw_gid; + char *pw_gecos; + char *pw_dir; + char *pw_shell; + }; + #ifdef __cplusplus + extern "C" bool_t xdr_passwd(XDR *, passwd*); + #elif __STDC__ + extern bool_t xdr_passwd(XDR *, struct passwd*); + #else /* Old Style C */ + bool_t xdr_passwd(); + #endif /* Old Style C */ + + + struct yppasswd { + char *oldpass; + struct passwd newpw; + }; + #ifdef __cplusplus + extern "C" bool_t xdr_yppasswd(XDR *, yppasswd*); + #elif __STDC__ + extern bool_t xdr_yppasswd(XDR *, struct yppasswd*); + #else /* Old Style C */ + bool_t xdr_yppasswd(); + #endif /* Old Style C */ + + #endif /* !_rpcsvc_yppasswd_h */ + + #define YPPASSWDPROG ((u_long)100009) + #define YPPASSWDVERS ((u_long)1) + + #ifdef __cplusplus + #define YPPASSWDPROC_UPDATE ((u_long)1) + extern "C" int * yppasswdproc_update_1(yppasswd , CLIENT *); + extern "C" int * yppasswdproc_update_1_svc(yppasswd , struct svc_req *); + + #elif __STDC__ + #define YPPASSWDPROC_UPDATE ((u_long)1) + extern int * yppasswdproc_update_1(struct yppasswd , CLIENT *); + extern int * yppasswdproc_update_1_svc(struct yppasswd , struct svc_req *); + + #else /* Old Style C */ + #define YPPASSWDPROC_UPDATE ((u_long)1) + extern int * yppasswdproc_update_1(); + extern int * yppasswdproc_update_1_svc(); + #endif /* Old Style C */ + + #endif /* !_YPPASSWD_H_RPCGEN */ Index: linux/include/sys/syscall.h diff -c linux/include/sys/syscall.h:1.9 linux/include/sys/syscall.h:1.10 *** linux/include/sys/syscall.h:1.9 Fri Mar 29 23:35:03 1996 --- linux/include/sys/syscall.h Sun Jan 26 22:29:08 1997 *************** *** 114,120 **** #define SYS_iopl 110 #define SYS_vhangup 111 #define SYS_idle 112 ! #define SYS_vm86 113 #define SYS_wait4 114 #define SYS_swapoff 115 #define SYS_sysinfo 116 --- 114,120 ---- #define SYS_iopl 110 #define SYS_vhangup 111 #define SYS_idle 112 ! #define SYS_vm86old 113 #define SYS_wait4 114 #define SYS_swapoff 115 #define SYS_sysinfo 116 *************** *** 168,172 **** --- 168,176 ---- #define SYS_sched_rr_get_interval 161 #define SYS_nanosleep 162 #define SYS_mremap 163 + #define SYS_setresuid 164 + #define SYS_getresuid 165 + #define SYS_vm86 166 + #define SYS_query_module 167 #endif /* */ Index: linux/include/sys/syslog.h diff -c linux/include/sys/syslog.h:1.3 linux/include/sys/syslog.h:1.4 *** linux/include/sys/syslog.h:1.3 Sat Jun 10 17:26:07 1995 --- linux/include/sys/syslog.h Fri Feb 14 19:37:19 1997 *************** *** 73,91 **** } CODE; CODE prioritynames[] = { ! "alert", LOG_ALERT, ! "crit", LOG_CRIT, ! "debug", LOG_DEBUG, ! "emerg", LOG_EMERG, ! "err", LOG_ERR, ! "error", LOG_ERR, /* DEPRECATED */ ! "info", LOG_INFO, ! "none", INTERNAL_NOPRI, /* INTERNAL */ ! "notice", LOG_NOTICE, ! "panic", LOG_EMERG, /* DEPRECATED */ ! "warn", LOG_WARNING, /* DEPRECATED */ ! "warning", LOG_WARNING, ! NULL, -1, }; #endif --- 73,91 ---- } CODE; CODE prioritynames[] = { ! { "alert", LOG_ALERT }, ! { "crit", LOG_CRIT }, ! { "debug", LOG_DEBUG }, ! { "emerg", LOG_EMERG }, ! { "err", LOG_ERR }, ! { "error", LOG_ERR }, /* DEPRECATED */ ! { "info", LOG_INFO }, ! { "none", INTERNAL_NOPRI }, /* INTERNAL */ ! { "notice", LOG_NOTICE }, ! { "panic", LOG_EMERG }, /* DEPRECATED */ ! { "warn", LOG_WARNING }, /* DEPRECATED */ ! { "warning", LOG_WARNING }, ! { NULL, -1 } }; #endif *************** *** 119,146 **** #ifdef SYSLOG_NAMES CODE facilitynames[] = { ! "auth", LOG_AUTH, ! "authpriv", LOG_AUTHPRIV, ! "cron", LOG_CRON, ! "daemon", LOG_DAEMON, ! "kern", LOG_KERN, ! "lpr", LOG_LPR, ! "mail", LOG_MAIL, ! "mark", INTERNAL_MARK, /* INTERNAL */ ! "news", LOG_NEWS, ! "security", LOG_AUTH, /* DEPRECATED */ ! "syslog", LOG_SYSLOG, ! "user", LOG_USER, ! "uucp", LOG_UUCP, ! "local0", LOG_LOCAL0, ! "local1", LOG_LOCAL1, ! "local2", LOG_LOCAL2, ! "local3", LOG_LOCAL3, ! "local4", LOG_LOCAL4, ! "local5", LOG_LOCAL5, ! "local6", LOG_LOCAL6, ! "local7", LOG_LOCAL7, ! NULL, -1, }; #endif --- 119,146 ---- #ifdef SYSLOG_NAMES CODE facilitynames[] = { ! { "auth", LOG_AUTH }, ! { "authpriv", LOG_AUTHPRIV }, ! { "cron", LOG_CRON }, ! { "daemon", LOG_DAEMON }, ! { "kern", LOG_KERN }, ! { "lpr", LOG_LPR }, ! { "mail", LOG_MAIL }, ! { "mark", INTERNAL_MARK }, /* INTERNAL */ ! { "news", LOG_NEWS }, ! { "security", LOG_AUTH }, /* DEPRECATED */ ! { "syslog", LOG_SYSLOG }, ! { "user", LOG_USER }, ! { "uucp", LOG_UUCP }, ! { "local0", LOG_LOCAL0 }, ! { "local1", LOG_LOCAL1 }, ! { "local2", LOG_LOCAL2 }, ! { "local3", LOG_LOCAL3 }, ! { "local4", LOG_LOCAL4 }, ! { "local5", LOG_LOCAL5 }, ! { "local6", LOG_LOCAL6 }, ! { "local7", LOG_LOCAL7 }, ! { NULL, -1 } }; #endif Index: linux/include/sys/vm86.h diff -c linux/include/sys/vm86.h:1.2 linux/include/sys/vm86.h:1.3 *** linux/include/sys/vm86.h:1.2 Wed May 22 08:50:31 1996 --- linux/include/sys/vm86.h Sun Jan 26 22:29:08 1997 *************** *** 8,14 **** __BEGIN_DECLS ! extern vm86(struct vm86_struct * __info); __END_DECLS --- 8,15 ---- __BEGIN_DECLS ! extern vm86old __P ((struct vm86_struct * __info)); ! extern vm86 __P ((unsigned long __subfunction, struct vm86plus_struct * __info)); __END_DECLS