From c0e4567461c09ba47ddbc20e6b0ab09bdb0237ab Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 2 Feb 1997 01:50:11 +0000 Subject: update from main archive 970201 1997-02-02 00:39 Ulrich Drepper * dirent/dirent.h: Add description _DIRENT_HAVE_D_TYPE. 1997-02-01 17:04 Philip Blundell * inet/netinet/ip.h (MAX_IPOPTLEN): Add definition. 1997-02-01 17:00 Ulrich Drepper * sysdeps/unix/sysv/linux/socketbits.h: Add definition of cmsghdr structure plus related macros. * sysdeps/unix/sysv/linux/cmsg_nxthdr.c: New file. * sysdeps/unix/sysv/linux/Makefile [$(subdir)=socket] (sysdep_routines): Add cmsg_nxthdr. * sysdeps/unix/sysv/linux/Dist: Add cmsg_nxthdr.c. Suggested by Philip Blundell . 1997-02-01 12:34 Ulrich Drepper * time/strftime.c: Define _strftime_copytm without protecting arguments which breaks the definition. 1997-02-01 03:31 Thorsten Kukuk * nis/rpcsvc/yp_prot.h: Move definition of yppushresp_xfr after definition of type for element. 1997-02-01 03:28 Philip Blundell * sydsdeps/unix/sysv/linux/netinet/in.h: Add IPv6 related IPPROTO_* constants. 1997-02-01 03:09 H.J. Lu * Makefile: Pass PARALLELMFLAGS to sub-makes. * Makefile.in: Mention PARALLELMFLAGS and pass to main Makefile. 1997-01-31 Paul Eggert * time/mktime.c (HAVE_LIMITS_H, HAVE_LOCALTIME_R, STDC_HEADERS): Define if _LIBC is defined. : Include if HAVE_LIMITS_H instead of if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS. : Similarly, include if STDC_HEADERS. (localtime_r): Redo #ifdef to make it clear that glibc has localtime_r now. 1997-02-29 20:08 Andreas Schwab * sunrpc/Makefile ($(objpfx)rpcsvc/%.h, $(objpfx)x%.c): Use stamp file to avoid unnecessary recompilation. 1997-01-29 19:33 Andreas Schwab * Makefile: Set install-others, not install_others. (before-compile): Use += to preserve previous value. ($(inst_includedir)/gnu/lib-names.h): Remove obsolete comment and fix dependency name. ($(objpfx)lib-names.h): Remove rule. * Makeconfig ($(common-objpfx)gnu/lib-names.h): Generate it here, with correct name, using an intermediate stamp file. (common-generated): Add gnu/lib-names.h. (before-compile): Add $(common-objpfx)gnu/lib-names.h. 1997-01-30 18:29 Richard Henderson * malloc/malloc.c (MAGICBYTE): Use cast to size_t instead of unsigned to prevent warnings on 64 bit systems. Reported by Paul Wouters . * sysdeps/alpha/dl-machine.h: Revert check for broken gas. By default we assume it works. --- ChangeLog | 74 +++++++++++++++++++++++++++++++++++ ChangeLog.6 | 2 +- Makeconfig | 27 +++++++++++++ Makefile | 33 +++------------- Makefile.in | 5 ++- dirent/dirent.h | 73 +++++++++++++++++----------------- inet/netinet/ip.h | 2 + malloc/malloc.c | 2 +- nis/rpcsvc/yp_prot.h | 10 ++--- sunrpc/Makefile | 28 +++++++++---- sysdeps/alpha/dl-machine.h | 2 +- sysdeps/unix/sysv/linux/Dist | 1 + sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/cmsg_nxthdr.c | 38 ++++++++++++++++++ sysdeps/unix/sysv/linux/netinet/in.h | 24 ++++++------ sysdeps/unix/sysv/linux/socketbits.h | 41 +++++++++++++++++++ time/mktime.c | 14 +++++-- time/strftime.c | 2 +- 18 files changed, 284 insertions(+), 95 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/cmsg_nxthdr.c diff --git a/ChangeLog b/ChangeLog index 6b5e2023ca..3ea031bed0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,77 @@ +1997-02-02 00:39 Ulrich Drepper + + * dirent/dirent.h: Add description _DIRENT_HAVE_D_TYPE. + +1997-02-01 17:04 Philip Blundell + + * inet/netinet/ip.h (MAX_IPOPTLEN): Add definition. + +1997-02-01 17:00 Ulrich Drepper + + * sysdeps/unix/sysv/linux/socketbits.h: Add definition of cmsghdr + structure plus related macros. + * sysdeps/unix/sysv/linux/cmsg_nxthdr.c: New file. + * sysdeps/unix/sysv/linux/Makefile [$(subdir)=socket] + (sysdep_routines): Add cmsg_nxthdr. + * sysdeps/unix/sysv/linux/Dist: Add cmsg_nxthdr.c. + Suggested by Philip Blundell . + +1997-02-01 12:34 Ulrich Drepper + + * time/strftime.c: Define _strftime_copytm without protecting arguments + which breaks the definition. + +1997-02-01 03:31 Thorsten Kukuk + + * nis/rpcsvc/yp_prot.h: Move definition of yppushresp_xfr after + definition of type for element. + +1997-02-01 03:28 Philip Blundell + + * sydsdeps/unix/sysv/linux/netinet/in.h: Add IPv6 related IPPROTO_* + constants. + +1997-02-01 03:09 H.J. Lu + + * Makefile: Pass PARALLELMFLAGS to sub-makes. + * Makefile.in: Mention PARALLELMFLAGS and pass to main Makefile. + +1997-01-31 Paul Eggert + + * time/mktime.c (HAVE_LIMITS_H, HAVE_LOCALTIME_R, STDC_HEADERS): + Define if _LIBC is defined. + : Include if HAVE_LIMITS_H instead of if + __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS. + : Similarly, include if STDC_HEADERS. + (localtime_r): Redo #ifdef to make it clear that glibc has + localtime_r now. + +1997-02-29 20:08 Andreas Schwab + + * sunrpc/Makefile ($(objpfx)rpcsvc/%.h, $(objpfx)x%.c): Use stamp + file to avoid unnecessary recompilation. + +1997-01-29 19:33 Andreas Schwab + + * Makefile: Set install-others, not install_others. + (before-compile): Use += to preserve previous value. + ($(inst_includedir)/gnu/lib-names.h): Remove obsolete comment and + fix dependency name. + ($(objpfx)lib-names.h): Remove rule. + * Makeconfig ($(common-objpfx)gnu/lib-names.h): Generate it here, + with correct name, using an intermediate stamp file. + (common-generated): Add gnu/lib-names.h. + (before-compile): Add $(common-objpfx)gnu/lib-names.h. + +1997-01-30 18:29 Richard Henderson + + * malloc/malloc.c (MAGICBYTE): Use cast to size_t instead of unsigned + to prevent warnings on 64 bit systems. + Reported by Paul Wouters . + + * sysdeps/alpha/dl-machine.h: Revert check for broken gas. By default + we assume it works. + 1997-01-30 03:24 Ulrich Drepper * sysdeps/i386/elf/start.S (_start): Align stack pointer to diff --git a/ChangeLog.6 b/ChangeLog.6 index a4cdcf0eeb..e53adb1f17 100644 --- a/ChangeLog.6 +++ b/ChangeLog.6 @@ -194,7 +194,7 @@ Thu Jan 23 04:06:42 1997 Ulrich Drepper ldconfig. (CFLAGS-dl-load.c): New variable, avoid gcc warning. - * sysdeps/mach/hurd/configure.in: Add _LIBC_REENTRENT to DEFINES. + * sysdeps/mach/hurd/configure.in: Add _LIBC_REENTRANT to DEFINES. * sysdeps/mach/hurd/getdents.c: Update copyright. De-ANSI-declfy. * sysdeps/stub/getdents.c: Likewise. Correct return value. diff --git a/Makeconfig b/Makeconfig index 8b82a31124..74f8d795a4 100644 --- a/Makeconfig +++ b/Makeconfig @@ -566,6 +566,33 @@ $(common-objpfx)soversions.mk: $(..)shlib-versions $(..)Makeconfig \ # Get $(version) defined with the release version number. -include $(common-objpfx)version.mk +# Generate the header containing the names of all shared libraries. +# We use a stamp file to avoid uncessary recompilations. +before-compile += $(common-objpfx)gnu/lib-names.h +$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp +$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk + $(make-target-directory) + @rm -f ${@:stmp=T} $@ + (echo '/* This file is automatically generated.';\ + echo ' It defines macros to allow user program to find the shared';\ + echo ' library files which come as part of GNU libc. */';\ + echo '#ifndef __GNU_LIB_NAMES_H'; \ + echo '#define __GNU_LIB_NAMES_H 1'; \ + echo; \ + (libs='$(all-sonames)';\ + for l in $$libs; do \ + upname=`echo $$l | sed 's/[.]so.*//' | \ + tr '[:lower:]-' '[:upper:]_'`; \ + echo "#define $${upname}_SO \"$$l\""; \ + done;) | sort; \ + echo; \ + echo '#endif /* gnu/lib-names.h */';) > ${@:stmp=T} + if test -r ${@:stmp=h} && cmp -s ${@:stmp=h} ${@:stmp=T}; \ + then rm -f ${@:stmp=T}; \ + else mv -f ${@:stmp=T} ${@:stmp=h}; fi + touch $@ + +common-generated += gnu/lib-names.h gnu/lib-names.stmp # The name under which the run-time dynamic linker is installed. # We are currently going for the convention that `/lib/ld.so.1' diff --git a/Makefile b/Makefile index 61cf6904f6..03408c768e 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ install-bin = glibcbug ifeq (yes,$(build-shared)) before-compile += $(objpfx)gnu/lib-names.h -install_others += $(inst_includedir)/gnu/lib-names.h +install-others += $(inst_includedir)/gnu/lib-names.h endif ifeq (yes,$(gnu-ld)) @@ -194,31 +194,10 @@ $(inst_includedir)/gnu/stubs.h: subdir_install ifeq (yes,$(build-shared)) -# Like gnu/stubs.h the gnu/lib-names.h header is not used while building the -# libc itself. So we generate it while installing. -$(inst_includedir)/gnu/lib-names.h: $(objpfx)gnu/lib-names.h +$(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h if test -r $@ && cmp -s $< $@; \ then echo 'gnu/lib-names.h unchanged'; \ else $(INSTALL_DATA) $< $@; fi - -$(objpfx)gnu/lib-names.h: $(common-objpfx)soversions.mk - $(make-target-directory) - @rm -f $@ - (echo '/* This file is automatically generated.';\ - echo ' It defines macros to allow user program to find the shared';\ - echo ' library files which come as part of GNU libc. */';\ - echo '#ifndef __GNU_LIB_NAMES_H'; \ - echo '#define __GNU_LIB_NAMES_H 1'; \ - echo; \ - (libs='$(all-sonames)';\ - for l in $$libs; do \ - upname=`echo $$l | sed 's/[.]so.*//' | \ - tr '[:lower:]-' '[:upper:]_'`; \ - echo "#define $${upname}_SO \"$$l\""; \ - done;) | sort; \ - echo; \ - echo '#endif /* gnu/lib-names.h */';) > $@ -generated += gnu/lib-names.h endif # The `glibcbug' script contains the version number and it shall be rebuild @@ -229,7 +208,7 @@ $(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in # This makes the Info or DVI file of the documentation from the Texinfo source. .PHONY: info dvi info dvi: - $(MAKE) -C manual $@ + $(MAKE) $(PARALLELMFLAGS) -C manual $@ # This makes all the subdirectory targets. @@ -243,7 +222,7 @@ all-subdirs-targets := $(foreach dir,$(subdirs),\ # The action for each of those is to cd into the directory and make the # target there. $(all-subdirs-targets): - $(MAKE) -C $(@D) $(@F) + $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) .PHONY: $(+subdir_targets) $(all-subdirs-targets) @@ -326,10 +305,10 @@ INSTALL: manual/maint.texi; $(format-me) NOTES: manual/creature.texi; $(format-me) rpm/%: subdir_distinfo - $(MAKE) -C $(@D) subdirs='$(subdirs)' $(@F) + $(MAKE) $(PARALLELMFLAGS) -C $(@D) subdirs='$(subdirs)' $(@F) # This is a special goal for people making binary distributions. Normally # everybody uses the DES based crypt library but for the distribution we # need the only-MD5 based one as well. md5-crypt/libmd5crypt: - $(MAKE) -C $(@D) $(@F) + $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) diff --git a/Makefile.in b/Makefile.in index 6ec07a64c6..3cb24bf097 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2,5 +2,8 @@ srcdir = @srcdir@ +# Uncomment the line below if you want to do parallel build. +# PARALLELMFLAGS = -j 4 + all .DEFAULT: - $(MAKE) -C $(srcdir) objdir=`pwd` $@ + $(MAKE) PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@ diff --git a/dirent/dirent.h b/dirent/dirent.h index 449f485c83..3d187e1096 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -39,12 +39,15 @@ __BEGIN_DECLS It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off' member that gives the file offset of the next directory entry. + + It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type' + member that gives the type of the file. */ #include -#if (defined(__USE_BSD) || defined(__USE_MISC)) && !defined(d_fileno) -#define d_ino d_fileno /* Backward compatibility. */ +#if (defined __USE_BSD || defined __USE_MISC) && !defined d_fileno +# define d_ino d_fileno /* Backward compatibility. */ #endif /* These macros extract size information from a `struct dirent *'. @@ -62,16 +65,16 @@ __BEGIN_DECLS */ #ifdef _DIRENT_HAVE_D_NAMLEN -#define _D_EXACT_NAMLEN(d) ((d)->d_namlen) -#define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) -#else -#define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name)) -#ifdef _DIRENT_HAVE_D_RECLEN -#define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0]) +# define _D_EXACT_NAMLEN(d) ((d)->d_namlen) +# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) #else -#define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \ - _D_EXACT_NAMLEN (d) + 1) -#endif +# define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name)) +# ifdef _DIRENT_HAVE_D_RECLEN +# define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0]) +# else +# define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \ + _D_EXACT_NAMLEN (d) + 1) +# endif #endif @@ -90,8 +93,8 @@ enum }; /* Convert between stat structure types and directory types. */ -#define IFTODT(mode) (((mode) & 0170000) >> 12) -#define DTTOIF(dirtype) ((dirtype) << 12) +# define IFTODT(mode) (((mode) & 0170000) >> 12) +# define DTTOIF(dirtype) ((dirtype) << 12) #endif @@ -116,42 +119,42 @@ extern int closedir __P ((DIR *__dirp)); extern struct dirent *__readdir __P ((DIR *__dirp)); extern struct dirent *readdir __P ((DIR *__dirp)); -#if defined __USE_POSIX +#if defined __USE_POSIX || defined __USE_MISC /* Reentrant version of `readdir'. Return in RESULT a pointer to the next entry. */ -extern int __readdir_r __P ((DIR *__dirp, struct dirent *entry, - struct dirent **result)); -extern int readdir_r __P ((DIR *__dirp, struct dirent *entry, - struct dirent **result)); -#endif /* POSIX */ +extern int __readdir_r __P ((DIR *__dirp, struct dirent *__entry, + struct dirent **__result)); +extern int readdir_r __P ((DIR *__dirp, struct dirent *__entry, + struct dirent **__result)); +#endif /* POSIX or misc */ /* Rewind DIRP to the beginning of the directory. */ extern void rewinddir __P ((DIR *__dirp)); -#if defined(__USE_BSD) || defined(__USE_MISC) +#if defined __USE_BSD || defined __USE_MISC /* Return the file descriptor used by DIRP. */ extern int dirfd __P ((DIR *__dirp)); -#if defined (__OPTIMIZE__) && defined (_DIR_dirfd) -#define dirfd(dirp) _DIR_dirfd (dirp) -#endif +# if defined __OPTIMIZE__ && defined _DIR_dirfd +# define dirfd(dirp) _DIR_dirfd (dirp) +# endif -#ifndef MAXNAMLEN +# ifndef MAXNAMLEN /* Get the definitions of the POSIX.1 limits. */ -#include +# include /* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */ -#ifdef NAME_MAX -#define MAXNAMLEN NAME_MAX -#else -#define MAXNAMLEN 255 -#endif -#endif - -#include -#define __need_size_t -#include +# ifdef NAME_MAX +# define MAXNAMLEN NAME_MAX +# else +# define MAXNAMLEN 255 +# endif +# endif + +# include +# define __need_size_t +# include /* Seek to position POS on DIRP. */ extern void seekdir __P ((DIR *__dirp, __off_t __pos)); diff --git a/inet/netinet/ip.h b/inet/netinet/ip.h index 65338852ae..191ac8e9c8 100644 --- a/inet/netinet/ip.h +++ b/inet/netinet/ip.h @@ -122,6 +122,8 @@ struct ip { #define IPOPT_OFFSET 2 /* offset within option */ #define IPOPT_MINOFF 4 /* min value of above */ +#define MAX_IPOPTLEN 40 + /* * Time stamp option structure. */ diff --git a/malloc/malloc.c b/malloc/malloc.c index 8ec5f85800..57867c90c6 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3764,7 +3764,7 @@ int mALLOPt(param_number, value) int param_number; int value; byte per chunk; still this will catch most cases of double frees or overruns. */ -#define MAGICBYTE(p) ( ( ((unsigned)p >> 3) ^ ((unsigned)p >> 11)) & 0xFF ) +#define MAGICBYTE(p) ( ( ((size_t)p >> 3) ^ ((size_t)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 diff --git a/nis/rpcsvc/yp_prot.h b/nis/rpcsvc/yp_prot.h index f6e3f49783..bee84351bb 100644 --- a/nis/rpcsvc/yp_prot.h +++ b/nis/rpcsvc/yp_prot.h @@ -278,11 +278,6 @@ struct ypbind_setdom { #define YPPUSHPROC_NULL ((u_long)0) #define YPPUSHPROC_XFRRESP ((u_long)1) -struct yppushresp_xfr { - u_int transid; - yppush_status status; -}; - /* Status values for yppushresp_xfr.status */ enum yppush_status { @@ -323,6 +318,11 @@ enum yppush_status { }; typedef enum yppush_status yppush_status; +struct yppushresp_xfr { + u_int transid; + yppush_status status; +}; + struct ypresp_all { bool_t more; union { diff --git a/sunrpc/Makefile b/sunrpc/Makefile index 70f91d2bfd..e3e38d151a 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -118,17 +118,29 @@ $(inst_sysconfdir)/rpc: etc.rpc defines := $(defines) -D_PATH_RPC='"$(sysconfdir)/rpc"' # Generate the rpcsvc headers with rpcgen. -$(objpfx)rpcsvc/%.h: rpcsvc/%.x $(objpfx)rpcgen +# We use a stamp file to avoid unnessary recompilation each time rpcgen is +# relinked. +$(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp +$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen $(make-target-directory) - -@rm -f $@T - $(rpcgen-cmd) -h $< -o $@T - mv -f $@T $@ + -@rm -f ${@:stmp=T} $@ + $(rpcgen-cmd) -h $< -o ${@:stmp=T} + if test -r ${@:stmp=h} && cmp -s ${@:stmp=h} ${@:stmp=T}; \ + then rm -f ${@:stmp=T}; \ + else mv -f ${@:stmp=T} ${@:stmp=h}; fi + touch $@ # Generate the rpcsvc XDR functions with rpcgen. -$(objpfx)x%.c: rpcsvc/%.x $(objpfx)rpcgen - -@rm -f $@T - $(rpcgen-cmd) -c $< -o $@T - mv -f $@T $@ +$(objpfx)x%.c: $(objpfx)x%.stmp +$(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen + -@rm -f ${@:stmp=T} $@ + $(rpcgen-cmd) -c $< -o ${@:stmp=T} + if test -r ${@:stmp=c} && cmp -s ${@:stmp=c} ${@:stmp=T}; \ + then rm -f ${@:stmp=T}; \ + else mv -f ${@:stmp=T} ${@:stmp=c}; fi + touch $@ + +generated += $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp) # The generated source files depend on the corresponding generated headers. # Gratuitous dependency on generated .c file here just gets it mentioned to diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 1d01f035ea..b735e15ae3 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -43,7 +43,7 @@ elf_machine_matches_host (Elf64_Word e_machine) static inline Elf64_Addr elf_machine_dynamic (void) { -#ifdef AXP_MULTI_GOT_LD +#ifndef NO_AXP_MULTI_GOT_LD return (Elf64_Addr) &_DYNAMIC; #else register Elf64_Addr *gp __asm__ ("$29"); diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index c5a2f179ee..b757562124 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -1,3 +1,4 @@ +cmsg_nxthdr.c init-first.h kernel_sigaction.h llseek.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index ae2e294785..e02ee8cfe4 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -35,6 +35,7 @@ endif ifeq ($(subdir),socket) sysdep_headers += sys/socketcall.h net/if.h net/if_ppp.h net/ppp-comp.h \ net/ppp_defs.h net/if_arp.h net/route.h +sysdep_routines += cmsg_nxthdr endif ifeq ($(subdir),sunrpc) diff --git a/sysdeps/unix/sysv/linux/cmsg_nxthdr.c b/sysdeps/unix/sysv/linux/cmsg_nxthdr.c new file mode 100644 index 0000000000..2245db7f25 --- /dev/null +++ b/sysdeps/unix/sysv/linux/cmsg_nxthdr.c @@ -0,0 +1,38 @@ +/* Return point to next ancillary data entry in message header. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + + +struct cmsghdr * +__cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg) +{ + unsigned char *p; + + if ((size_t) cmsg->cmsg_len < sizeof (struct cmsghdr)) + /* The kernel header does this so there may be a reason. */ + return NULL; + + p = (((unsigned char *) cmsg) + + ((cmsg->cmsg_len + sizeof (long int) - 1) & ~sizeof (long int))); + if (p >= (unsigned char *) mhdr->msg_control + mhdr->msg_controllen) + /* No more entries. */ + return NULL; + return (struct cmsghdr *) p; +} diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h index c1df8250c0..0fec8ce3dd 100644 --- a/sysdeps/unix/sysv/linux/netinet/in.h +++ b/sysdeps/unix/sysv/linux/netinet/in.h @@ -27,17 +27,19 @@ /* Standard well-defined IP protocols. */ enum { - IPPROTO_IP = 0, /* Dummy protocol for TCP. */ - IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ - IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ - IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */ - IPPROTO_TCP = 6, /* Transmission Control Protocol. */ - IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */ - IPPROTO_PUP = 12, /* PUP protocol. */ - IPPROTO_UDP = 17, /* User Datagram Protocol. */ - IPPROTO_IDP = 22, /* XNS IDP protocol. */ - - IPPROTO_RAW = 255, /* Raw IP packets. */ + IPPROTO_IP = 0, /* Dummy protocol for TCP. */ + IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ + IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ + IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */ + IPPROTO_TCP = 6, /* Transmission Control Protocol. */ + IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */ + IPPROTO_PUP = 12, /* PUP protocol. */ + IPPROTO_UDP = 17, /* User Datagram Protocol. */ + IPPROTO_IDP = 22, /* XNS IDP protocol. */ + IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling. */ + IPPROTO_ICMPV6 = 58, /* ICMPv6. */ + + IPPROTO_RAW = 255, /* Raw IP packets. */ IPPROTO_MAX }; diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/socketbits.h index 1cf44b4347..91deb6c815 100644 --- a/sysdeps/unix/sysv/linux/socketbits.h +++ b/sysdeps/unix/sysv/linux/socketbits.h @@ -126,6 +126,47 @@ struct msghdr int msg_flags; /* Flags on received message. */ }; +/* Structure used for storage of ancillary data object information. */ +struct cmsghdr + { + int cmsg_len; /* Length of data in cmsg_data plus length + of cmsghdr structure. */ + /* XXX Should be type `size_t' according to POSIX.1g. */ + int cmsg_level; /* Originating protocol. */ + int cmsg_type; /* Protocol specific type. */ + unsigned char __cmsg_data[0]; /* Ancillary data. */ + }; + +/* Ancillary data object manipulation macros. */ +#define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) +#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) +#define CMSG_FIRSTHDR(mhdr) (mhdr) \ + ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ + ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) + + +#ifndef _EXTERN_INLINE +# define _EXTERN_INLINE extern __inline +#endif +extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr, + struct cmsghdr *__cmsg)); +_EXTERN_INLINE struct cmsghdr * +__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) +{ + unsigned char *__p; + + if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) + /* The kernel header does this so there may be a reason. */ + return NULL; + + __p = (((unsigned char *) __cmsg) + + ((__cmsg->cmsg_len + sizeof (long int) - 1) & ~sizeof (long int))); + if (__p >= (unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen) + /* No more entries. */ + return NULL; + return (struct cmsghdr *) __p; +} + /* Get socket manipulation related informations from kernel headers. */ #include diff --git a/time/mktime.c b/time/mktime.c index fd242b1545..d8fdf3a6c6 100644 --- a/time/mktime.c +++ b/time/mktime.c @@ -25,6 +25,12 @@ #include #endif +#ifdef _LIBC +# define HAVE_LIMITS_H 1 +# define HAVE_LOCALTIME_R 1 +# define STDC_HEADERS 1 +#endif + /* Assume that leap seconds are possible, unless told otherwise. If the host has a `zic' command with a `-L leapsecondfilename' option, then it supports leap seconds; otherwise it probably doesn't. */ @@ -35,13 +41,13 @@ #include /* Some systems define `time_t' here. */ #include -#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS +#if HAVE_LIMITS_H #include #endif #if DEBUG #include -#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS +#if STDC_HEADERS #include #endif /* Make it work even if the system's libc has its own mktime routine. */ @@ -100,10 +106,10 @@ time_t __mktime_internal __P ((struct tm *, time_t *)); -#if ! HAVE_LOCALTIME_R && ! defined (localtime_r) #ifdef _LIBC #define localtime_r __localtime_r #else +#if ! HAVE_LOCALTIME_R && ! defined (localtime_r) /* Approximate localtime_r as best we can in its absence. */ #define localtime_r my_localtime_r static struct tm *localtime_r __P ((const time_t *, struct tm *)); @@ -118,8 +124,8 @@ localtime_r (t, tp) *tp = *l; return tp; } -#endif /* ! _LIBC */ #endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */ +#endif /* ! _LIBC */ /* Yield the difference between (YEAR-YDAY HOUR:MIN:SEC) and (*TP), diff --git a/time/strftime.c b/time/strftime.c index ca3563c072..690cf2af0e 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -349,7 +349,7 @@ static char const month_name[][10] = # undef strftime # endif # define strftime(S, Maxsize, Format, Tp) \ - _strftime_copytm ((S), (Maxsize), (Format), (Tp)) + _strftime_copytm (S, Maxsize, Format, Tp) #endif -- cgit 1.4.1