about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c10
-rw-r--r--sysdeps/unix/sysv/linux/m68k/brk.c35
-rw-r--r--sysdeps/unix/sysv/linux/socketbits.h11
3 files changed, 38 insertions, 18 deletions
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index 7c5b510956..cbb5fa8a23 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -1,5 +1,5 @@
 /* Initialization code run first thing by the ELF startup code.  Linux version.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,7 @@
 #include <fpu_control.h>
 #include <linux/personality.h>
 #include <init-first.h>
+#include <sys/types.h>
 
 extern void __libc_init (int, char **, char **);
 extern void __libc_global_ctors (void);
@@ -41,11 +42,15 @@ int __libc_multiple_libcs = 1;
 int __libc_argc;
 char **__libc_argv;
 
+/* We often need the PID.  Cache this value.  */
+pid_t __libc_pid;
+
 
 static void
 init (int argc, char **argv, char **envp)
 {
   extern int __personality (int);
+  extern void __getopt_clean_environment (void);
 
   /* We must not call `personality' twice.  */
   if (!__libc_multiple_libcs)
@@ -68,6 +73,9 @@ init (int argc, char **argv, char **envp)
 
   __libc_init (argc, argv, envp);
 
+  /* This is a hack to make the special getopt in GNU libc working.  */
+  __getopt_clean_environment ();
+
 #ifdef PIC
   __libc_global_ctors ();
 #endif
diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c
index 402dfc56f7..bbbcf84188 100644
--- a/sysdeps/unix/sysv/linux/m68k/brk.c
+++ b/sysdeps/unix/sysv/linux/m68k/brk.c
@@ -1,27 +1,32 @@
 /* brk system call for Linux/m68k.
-Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   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 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.
+   The GNU C Library is distributed in the hope that 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.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
 
-void *__curbrk;
+void *__curbrk = 0;
+
+/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
+   to work around different old braindamage in the old Linux/x86 ELF
+   dynamic linker.  Sigh.  */
+weak_alias (__curbrk, ___brk_addr)
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/socketbits.h
index 91deb6c815..915e0f001e 100644
--- a/sysdeps/unix/sysv/linux/socketbits.h
+++ b/sysdeps/unix/sysv/linux/socketbits.h
@@ -23,6 +23,7 @@
 #include <features.h>
 
 #define	__need_size_t
+#define __need_NULL
 #include <stddef.h>
 
 
@@ -134,13 +135,19 @@ struct cmsghdr
     /* XXX Should be type `size_t' according to POSIX.1g.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
     unsigned char __cmsg_data[0]; /* Ancillary data.  */
+#endif
   };
 
 /* Ancillary data object manipulation macros.  */
-#define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#else
+# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+#endif
 #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
-#define CMSG_FIRSTHDR(mhdr) (mhdr) \
+#define CMSG_FIRSTHDR(mhdr) \
   ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)			      \
    ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)