about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/sysd-stdio.c30
-rw-r--r--sysdeps/libm-i387/e_exp.S2
-rw-r--r--sysdeps/libm-i387/e_expf.S2
-rw-r--r--sysdeps/libm-i387/e_expl.S2
-rw-r--r--sysdeps/libm-i387/s_expm1.S12
-rw-r--r--sysdeps/libm-i387/s_expm1f.S12
-rw-r--r--sysdeps/libm-i387/s_expm1l.S12
-rw-r--r--sysdeps/mach/hurd/posix_opt.h9
-rw-r--r--sysdeps/mach/hurd/vdprintf.c57
-rw-r--r--sysdeps/mach/libc-lock.h36
-rw-r--r--sysdeps/posix/vdprintf.c49
-rw-r--r--sysdeps/stub/vdprintf.c31
-rw-r--r--sysdeps/unix/Makefile2
-rw-r--r--sysdeps/unix/bsd/bsd4.4/direntry.h28
-rw-r--r--sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h7
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h85
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/procfs.h109
-rw-r--r--sysdeps/unix/sysv/linux/i386/getgroups.c43
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgroups.c41
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/kernel_sigaction.h10
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c63
-rw-r--r--sysdeps/unix/sysv/linux/sys/ipc_buf.h44
-rw-r--r--sysdeps/unix/sysv/linux/sys/mtio.h242
-rw-r--r--sysdeps/unix/sysv/linux/sys/procfs.h82
-rw-r--r--sysdeps/unix/sysv/linux/sys/sysmacros.h6
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list1
30 files changed, 895 insertions, 130 deletions
diff --git a/sysdeps/generic/sysd-stdio.c b/sysdeps/generic/sysd-stdio.c
index d28dde87f1..363a763449 100644
--- a/sysdeps/generic/sysd-stdio.c
+++ b/sysdeps/generic/sysd-stdio.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is 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 <stddef.h>
 #include <stdio.h>
@@ -163,7 +163,7 @@ __stdio_open (filename, m, cookieptr)
 /* Open FILENAME with the mode in M.  Use the same magic cookie
    already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN.  */
 int
-__stdio_reopen (filename, m, cookieptr)
+__stdio_reopen (filename, m, cookieptr, closefn)
      const char *filename;
      __io_mode m;
      void **cookieptr;
diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S
index 3c9d45b746..e76b9c63df 100644
--- a/sysdeps/libm-i387/e_exp.S
+++ b/sysdeps/libm-i387/e_exp.S
@@ -24,7 +24,7 @@ ENTRY(__ieee754_exp)
 	fmulp				/* x * log2(e) */
 	fstl	%st(1)
 	frndint				/* int(x * log2(e)) */
-	fsub	%st,%st(1)		/* fract(x * log2(e)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
 	f2xm1				/* 2^(fract(x * log2(e))) - 1 */
 	fld1
diff --git a/sysdeps/libm-i387/e_expf.S b/sysdeps/libm-i387/e_expf.S
index cd8dc7f0b9..9a669cf8d4 100644
--- a/sysdeps/libm-i387/e_expf.S
+++ b/sysdeps/libm-i387/e_expf.S
@@ -25,7 +25,7 @@ ENTRY(__ieee754_expf)
 	fmulp				/* x * log2(e) */
 	fstl	%st(1)
 	frndint				/* int(x * log2(e)) */
-	fsub	%st,%st(1)		/* fract(x * log2(e)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
 	f2xm1				/* 2^(fract(x * log2(e))) - 1 */
 	fld1
diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S
index e398a90ef6..e83d30640d 100644
--- a/sysdeps/libm-i387/e_expl.S
+++ b/sysdeps/libm-i387/e_expl.S
@@ -26,7 +26,7 @@ ENTRY(__ieee754_expl)
 	fmulp				/* x * log2(e) */
 	fstl	%st(1)
 	frndint				/* int(x * log2(e)) */
-	fsub	%st,%st(1)		/* fract(x * log2(e)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
 	f2xm1				/* 2^(fract(x * log2(e))) - 1 */
 	fld1
diff --git a/sysdeps/libm-i387/s_expm1.S b/sysdeps/libm-i387/s_expm1.S
index 2685d6e770..78e8013b7e 100644
--- a/sysdeps/libm-i387/s_expm1.S
+++ b/sysdeps/libm-i387/s_expm1.S
@@ -1,8 +1,9 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -64,15 +65,16 @@ ENTRY(__expm1)
 	fmulp			// log2(e)*x
 	fld	%st		// log2(e)*x : log2(e)*x
 	frndint			// int(log2(e)*x) : log2(e)*x
-	fsub	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
 	fxch			// fract(log2(e)*x) : int(log2(e)*x)
 	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
 	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
 	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	fscale			// 2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	faddp			// 2^(log2(e)*x)
-	fsubl	MO(one)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
 	ret
 
 2:	testl	$0x200, %eax	// Test sign.
diff --git a/sysdeps/libm-i387/s_expm1f.S b/sysdeps/libm-i387/s_expm1f.S
index 85c3c849f1..00f1562e73 100644
--- a/sysdeps/libm-i387/s_expm1f.S
+++ b/sysdeps/libm-i387/s_expm1f.S
@@ -1,8 +1,9 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -64,15 +65,16 @@ ENTRY(__expm1f)
 	fmulp			// log2(e)*x
 	fld	%st		// log2(e)*x : log2(e)*x
 	frndint			// int(log2(e)*x) : log2(e)*x
-	fsub	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
 	fxch			// fract(log2(e)*x) : int(log2(e)*x)
 	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
 	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
 	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	fscale			// 2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	faddp			// 2^(log2(e)*x)
-	fsubl	MO(one)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
 	ret
 
 2:	testl	$0x200, %eax	// Test sign.
diff --git a/sysdeps/libm-i387/s_expm1l.S b/sysdeps/libm-i387/s_expm1l.S
index 45aa753094..b7e6b36d39 100644
--- a/sysdeps/libm-i387/s_expm1l.S
+++ b/sysdeps/libm-i387/s_expm1l.S
@@ -1,8 +1,9 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -64,15 +65,16 @@ ENTRY(__expm1l)
 	fmulp			// log2(e)*x
 	fld	%st		// log2(e)*x : log2(e)*x
 	frndint			// int(log2(e)*x) : log2(e)*x
-	fsub	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
 	fxch			// fract(log2(e)*x) : int(log2(e)*x)
 	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
 	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
 	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	fscale			// 2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	faddp			// 2^(log2(e)*x)
-	fsubl	MO(one)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
 	ret
 
 2:	testl	$0x200, %eax	// Test sign.
diff --git a/sysdeps/mach/hurd/posix_opt.h b/sysdeps/mach/hurd/posix_opt.h
index 75a07e1539..045b4b6666 100644
--- a/sysdeps/mach/hurd/posix_opt.h
+++ b/sysdeps/mach/hurd/posix_opt.h
@@ -1,3 +1,12 @@
+/* Posix options supported by the GNU Hurd port of GNU libc. */
+
+#define _POSIX_JOB_CONTROL	1
+#define _POSIX_SAVED_IDS	1
+#define _POSIX_VDISABLE		((unsigned char) -1)
+
+/* Different Hurd filesystems might do these differently. */
+#undef _POSIX_CHOWN_RESTRICTED
+#undef _POSIX_NO_TRUNC
 /* Posix options supported by the GNU Hurd port of GNU libc. */ 
 
 #define _POSIX_JOB_CONTROL	1
diff --git a/sysdeps/mach/hurd/vdprintf.c b/sysdeps/mach/hurd/vdprintf.c
index 002f8c630a..a69607e663 100644
--- a/sysdeps/mach/hurd/vdprintf.c
+++ b/sysdeps/mach/hurd/vdprintf.c
@@ -55,3 +55,60 @@ vdprintf (int d, const char *format, va_list arg)
 
   return done;
 }
+/* Copyright (C) 1991, 1992, 1993, 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <hurd/fd.h>
+
+/* Write formatted output to file descriptor D according to the format string
+   FORMAT, using the argument list in ARG.  */
+int
+vdprintf (int d, const char *format, va_list arg)
+{
+  int done;
+  FILE f;
+  struct hurd_fd *fd;
+
+  HURD_CRITICAL_BEGIN;
+  fd = _hurd_fd_get (fd);
+  HURD_CRITICAL_END;
+
+  if (!fd)
+    return 0;
+
+  /* Create an unbuffered stream talking to D on the stack.  */
+  memset ((PTR) &f, 0, sizeof(f));
+  f.__magic = _IOMAGIC;
+  f.__mode.__write = 1;
+  f.__cookie = fd;
+  f.__room_funcs = __default_room_functions;
+  f.__io_funcs = __default_io_functions;
+  f.__seen = 1;
+  f.__userbuf = 1;
+
+  /* vfprintf will use a buffer on the stack for the life of the call,
+     and flush it when finished.  */
+  done = vfprintf (&f, format, arg);
+
+  return done;
+}
diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h
index 53dc8ee9e0..05eb70c56f 100644
--- a/sysdeps/mach/libc-lock.h
+++ b/sysdeps/mach/libc-lock.h
@@ -1,21 +1,21 @@
 /* libc-internal interface for mutex locks.  Mach cthreads version.
-Copyright (C) 1996, 1997 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.  */
 
 #ifndef _LIBC_LOCK_H
 #define _LIBC_LOCK_H 1
@@ -87,4 +87,12 @@ typedef struct __libc_lock_opaque__ __libc_lock_t;
 #define __libc_lock_unlock_recursive __libc_lock_unlock
 #define __libc_lock_lock_recursive __libc_lock_lock
 
+/* XXX until cthreads supports recursive locks */
+#define __libc_lock_define_initialized_recursive __libc_lock_define_initialized
+#define __libc_lock_init_recursive __libc_lock_init
+#define __libc_lock_fini_recursive __libc_lock_fini
+#define __libc_lock_trylock_recursive __libc_lock_trylock
+#define __libc_lock_unlock_recursive __libc_lock_unlock
+#define __libc_lock_lock_recursive __libc_lock_lock
+
 #endif	/* libc-lock.h */
diff --git a/sysdeps/posix/vdprintf.c b/sysdeps/posix/vdprintf.c
index 5147bb84bc..1cb05723b4 100644
--- a/sysdeps/posix/vdprintf.c
+++ b/sysdeps/posix/vdprintf.c
@@ -47,3 +47,52 @@ vdprintf (int d, const char *format, va_list arg)
 
   return done;
 }
+/* Copyright (C) 1991, 1992, 1993, 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+
+/* Write formatted output to file descriptor D according to the format string
+   FORMAT, using the argument list in ARG.  */
+int
+vdprintf (int d, const char *format, va_list arg)
+{
+  int done;
+  FILE f;
+
+  /* Create an unbuffered stream talking to D on the stack.  */
+  memset ((PTR) &f, 0, sizeof(f));
+  f.__magic = _IOMAGIC;
+  f.__mode.__write = 1;
+  f.__cookie = (PTR) (long int) d; /* Casting to long quiets GCC on Alpha.  */
+  f.__room_funcs = __default_room_functions;
+  f.__io_funcs = __default_io_functions;
+  f.__seen = 1;
+  f.__userbuf = 1;
+
+  /* vfprintf will use a buffer on the stack for the life of the call,
+     and flush it when finished.  */
+  done = vfprintf (&f, format, arg);
+
+  return done;
+}
diff --git a/sysdeps/stub/vdprintf.c b/sysdeps/stub/vdprintf.c
index 729f0123ca..f7ae121097 100644
--- a/sysdeps/stub/vdprintf.c
+++ b/sysdeps/stub/vdprintf.c
@@ -29,3 +29,34 @@ vdprintf (int d, const char *format, va_list arg)
 }
 
 stub_warning (vdprintf)
+/* 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+ 
+#include <errno.h>
+#include <stdio.h>
+
+/* Write formatted output to file descriptor D according to the format string
+   FORMAT, using the argument list in ARG.  */
+int
+vdprintf (int d, const char *format, va_list arg)
+{
+  __set_errno (ENOSYS);
+  return NULL;
+}
+
+stub_warning (vdprintf)
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 15993b34ac..1aea477064 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -289,7 +289,7 @@ $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
 	  test -f $$dir/syscalls.list && \
 	  { $(SHELL) $(dir $<)$(notdir $<) \
 		     $$dir $(object-suffixes) || exit 1; }; \
-	  test $$dir = sysdeps/unix && break; \
+	  test $$dir = $(..)sysdeps/unix && break; \
 	done > $@T
 	mv -f $@T $@
 
diff --git a/sysdeps/unix/bsd/bsd4.4/direntry.h b/sysdeps/unix/bsd/bsd4.4/direntry.h
index c221d55c0d..b9e0d7277e 100644
--- a/sysdeps/unix/bsd/bsd4.4/direntry.h
+++ b/sysdeps/unix/bsd/bsd4.4/direntry.h
@@ -1,21 +1,21 @@
 /* Directory entry structure `struct dirent'.  4.4BSD version.
-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.  */
 
 struct dirent
   {
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h b/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h
new file mode 100644
index 0000000000..900bff4aab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h
@@ -0,0 +1,7 @@
+/* This is the sigaction struction from the Linux 2.1.20 kernel.  */
+
+struct kernel_sigaction {
+	__sighandler_t sa_handler;
+	unsigned long sa_mask;
+	unsigned int sa_flags;
+};
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h b/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h
new file mode 100644
index 0000000000..57830daae1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h
@@ -0,0 +1,85 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   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 _SYS_IPC_BUF_H
+
+#define _SYS_IPC_BUF_H	1
+#include <features.h>
+
+#include <sys/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'.  */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'.  */
+#define IPC_RMID	0		/* Remove identifier.  */
+#define IPC_SET		1		/* Set `ipc_perm' options.  */
+#define IPC_STAT	2		/* Get `ipc_perm' options.  */
+#define IPC_INFO	3		/* See ipcs.  */
+
+
+__BEGIN_DECLS
+
+/* Special key values.  */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
+
+
+/* Data structure used to pass permission information to IPC operations.  */
+struct ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    unsigned int uid;			/* Owner's user ID.  */
+    unsigned int gid;			/* Owner's group ID.  */
+    unsigned int cuid;			/* Creator's user ID.  */
+    unsigned int cgid;			/* Creator's group ID.  */
+    unsigned int mode;			/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
+
+
+/* Kludge to work around Linux' restriction of only up to five
+   arguments to a system call.  */
+struct ipc_kludge
+  {
+    void *msgp;
+    long int msgtyp;
+  };
+
+/* The actual system call: all functions are multiplexed by this.  */
+extern int __ipc __P ((int __call, int __first, int __second, int __third,
+		       void *__ptr));
+
+/* The codes for the functions to use the multiplexer `__ipc'.  */
+#define IPCOP_semop	 1
+#define IPCOP_semget	 2
+#define IPCOP_semctl	 3
+#define IPCOP_msgsnd	11
+#define IPCOP_msgrcv	12
+#define IPCOP_msgget	13
+#define IPCOP_msgctl	14
+#define IPCOP_shmat	21
+#define IPCOP_shmdt	22
+#define IPCOP_shmget	23
+#define IPCOP_shmctl	24
+
+__END_DECLS
+
+#endif /* _SYS_IPC_BUF_H */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
new file mode 100644
index 0000000000..03af029254
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
@@ -0,0 +1,109 @@
+/* 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 _SYS_PROCFS_H
+
+#define _SYS_PROCFS_H	1
+#include <features.h>
+
+/* This is somehow modelled after the file of the same name on SysVr4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  */
+
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <asm/user.h>
+#include <asm/elf.h>
+
+__BEGIN_DECLS
+
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+typedef elf_greg_t greg_t;
+typedef elf_gregset_t gregset_t;
+typedef elf_fpregset_t fpregset_t;
+#define NGREG ELF_NGREG
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   gdb doesn't really use excluded.  Fields present but not used are
+   marked with "XXX".  */
+struct elf_prstatus
+  {
+#if 0
+    long int pr_flags;			/* XXX Process flags.  */
+    short int pr_why;			/* XXX Reason for process halt.  */
+    short int pr_what;			/* XXX More detailed reason.  */
+#endif
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+#if 0
+    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    struct sigaction pr_action;		/* Signal action for current sig.  */
+#endif
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+#if 0
+    long int pr_instr;			/* Current instruction.  */
+#endif
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned int pr_uid;
+    unsigned int pr_gid;
+    unsigned int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/i386/getgroups.c b/sysdeps/unix/sysv/linux/i386/getgroups.c
new file mode 100644
index 0000000000..2b8f9575fb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/getgroups.c
@@ -0,0 +1,43 @@
+/* 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 <sys/types.h>
+#include <unistd.h>
+
+#include <linux/posix_types.h>
+
+extern int __syscall_getgroups __P ((int, __kernel_gid_t *));
+
+/* For Linux we must convert the array of groups from the format that the
+   kernel returns.  */
+int
+__getgroups (n, groups)
+     int n;
+     gid_t *groups;
+{
+  int i, ngids;
+  __kernel_gid_t kernel_groups[n];
+
+  ngids = __syscall_getgroups (n, kernel_groups);
+  if (n != 0 && ngids > 0)
+    for (i = 0; i < ngids; i++)
+      groups[i] = kernel_groups[i];
+  return ngids;
+}
+
+weak_alias (__getgroups, getgroups)
diff --git a/sysdeps/unix/sysv/linux/i386/setgroups.c b/sysdeps/unix/sysv/linux/i386/setgroups.c
new file mode 100644
index 0000000000..8f8711913e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/setgroups.c
@@ -0,0 +1,41 @@
+/* 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 <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+
+#include <linux/posix_types.h>
+
+extern int __syscall_setgroups __P ((int, const __kernel_gid_t *));
+
+/* Set the group set for the current user to GROUPS (N of them).  For
+   Linux we must convert the array of groups into the format that the
+   kernel expects.  */
+int
+setgroups (n, groups)
+     size_t n;
+     const gid_t *groups;
+{
+  size_t i;
+  __kernel_gid_t kernel_groups[n];
+
+  for (i = 0; i < n; i++)
+    kernel_groups[i] = groups[i];
+  return __syscall_setgroups (n, kernel_groups);
+}
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index d95a120aa0..392a257194 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -1,4 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+s_getgroups	getgroups getgroups	2	__syscall_getgroups
 s_llseek	llseek	_llseek		5	__sys_llseek
+s_setgroups	setgroups setgroups	2	__syscall_setgroups
 vm86		-	vm86		1	__vm86		vm86
diff --git a/sysdeps/unix/sysv/linux/kernel_sigaction.h b/sysdeps/unix/sysv/linux/kernel_sigaction.h
new file mode 100644
index 0000000000..a058642d85
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/kernel_sigaction.h
@@ -0,0 +1,10 @@
+/* This is the sigaction structure from the Linux 2.1.20 kernel.  */
+
+#define HAVE_SA_RESTORER
+
+struct kernel_sigaction {
+	__sighandler_t sa_handler;
+	unsigned long sa_mask;
+	unsigned long sa_flags;
+	void (*sa_restorer) __P ((void));
+};
diff --git a/sysdeps/unix/sysv/linux/m68k/getgroups.c b/sysdeps/unix/sysv/linux/m68k/getgroups.c
new file mode 100644
index 0000000000..102ea24e14
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type.  */
+#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgroups.c b/sysdeps/unix/sysv/linux/m68k/setgroups.c
new file mode 100644
index 0000000000..0e7086278f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type.  */
+#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
index 7883d70719..9a3e4d0e58 100644
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -1,3 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+s_getgroups	getgroups getgroups	2	__syscall_getgroups
 s_llseek	llseek	_llseek		5	__sys_llseek
+s_setgroups	setgroups setgroups	2	__syscall_setgroups
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
new file mode 100644
index 0000000000..a7b3e07dae
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -0,0 +1,63 @@
+/* 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 <signal.h>
+
+/* The difference here is that the sigaction structure used in the
+   kernel is not the same as we use in the libc.  Therefore we must
+   translate it here.  */
+#include <kernel_sigaction.h>
+
+extern int __syscall_sigaction (int, const struct kernel_sigaction *,
+				struct kernel_sigaction *);
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+   If OACT is not NULL, put the old action for SIG in *OACT.  */
+int
+__sigaction (sig, act, oact)
+     int sig;
+     const struct sigaction *act;
+     struct sigaction *oact;
+{
+  struct kernel_sigaction k_sigact, k_osigact;
+  int error;
+
+  if (act)
+    {
+      k_sigact.sa_handler = act->sa_handler;
+      k_sigact.sa_mask = act->sa_mask.__val[0];
+      k_sigact.sa_flags = act->sa_flags;
+#ifdef HAVE_SA_RESTORER
+      k_sigact.sa_restorer = act->sa_restorer;
+#endif
+    }
+  error = __syscall_sigaction (sig, act ? &k_sigact : 0,
+			       oact ? &k_osigact : 0);
+  if (oact && error >= 0)
+    {
+      oact->sa_handler = k_osigact.sa_handler;
+      oact->sa_mask.__val[0] = k_osigact.sa_mask;
+      oact->sa_flags = k_osigact.sa_flags;
+#ifdef HAVE_SA_RESTORER
+      oact->sa_restorer = k_osigact.sa_restorer;
+#endif
+    }
+  return error;
+}
+
+weak_alias (__sigaction, sigaction)
diff --git a/sysdeps/unix/sysv/linux/sys/ipc_buf.h b/sysdeps/unix/sysv/linux/sys/ipc_buf.h
index a1eba68113..f5fea0d295 100644
--- a/sysdeps/unix/sysv/linux/sys/ipc_buf.h
+++ b/sysdeps/unix/sysv/linux/sys/ipc_buf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -25,43 +25,43 @@
 #include <sys/types.h>
 
 /* Mode bits for `msgget', `semget', and `shmget'.  */
-#define IPC_CREAT	01000		/* create key if key does not exist */
-#define IPC_EXCL	02000		/* fail if key exists */
-#define IPC_NOWAIT	04000		/* return error on wait */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
 
 /* Control commands for `msgctl', `semctl', and `shmctl'.  */
-#define IPC_RMID	0		/* remove identifier */
-#define IPC_SET		1		/* set `ipc_perm' options */
-#define IPC_STAT	2		/* get `ipc_perm' options */
-#define IPC_INFO	3		/* see ipcs */
+#define IPC_RMID	0		/* Remove identifier.  */
+#define IPC_SET		1		/* Set `ipc_perm' options.  */
+#define IPC_STAT	2		/* Get `ipc_perm' options.  */
+#define IPC_INFO	3		/* See ipcs.  */
 
 
 __BEGIN_DECLS
 
 /* Special key values.  */
-#define IPC_PRIVATE	((key_t) 0)	/* private key */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
 
 
 /* Data structure used to pass permission information to IPC operations.  */
 struct ipc_perm
-{
-  key_t __key;				/* key */
-  __uid_t uid;				/* owner's user ID */
-  __gid_t gid;				/* owner's group ID */
-  __uid_t cuid;				/* creator's user ID */
-  __gid_t cgid;				/* creator's group ID */
-  __mode_t mode;			/* read/write permission */
-  unsigned short int __seq;		/* sequence number */
-};
+  {
+    __key_t __key;			/* Key.  */
+    unsigned short int uid;		/* Owner's user ID.  */
+    unsigned short int gid;		/* Owner's group ID.  */
+    unsigned short int cuid;		/* Creator's user ID.  */
+    unsigned short int cgid;		/* Creator's group ID.  */
+    unsigned short int mode;		/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
 
 
 /* Kludge to work around Linux' restriction of only up to five
    arguments to a system call.  */
 struct ipc_kludge
-{
-  void *msgp;
-  long msgtyp;
-};
+  {
+    void *msgp;
+    long int msgtyp;
+  };
 
 /* The actual system call: all functions are multiplexed by this.  */
 extern int __ipc __P ((int __call, int __first, int __second, int __third,
diff --git a/sysdeps/unix/sysv/linux/sys/mtio.h b/sysdeps/unix/sysv/linux/sys/mtio.h
index 45db6a51b4..e238ef92d7 100644
--- a/sysdeps/unix/sysv/linux/sys/mtio.h
+++ b/sysdeps/unix/sysv/linux/sys/mtio.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Structures and definitions for magnetic tape I/O control commands.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,13 +17,250 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/* Written by H. Bergman <hennus@cybercomm.nl>.  */
+
 #ifndef _SYS_MTIO_H
 #define _SYS_MTIO_H	1
 
 /* Get necessary definitions from system and kernel headers.  */
 #include <sys/types.h>
 #include <sys/ioctl.h>
-#include <linux/mtio.h>
+
+
+/* Structure for MTIOCTOP - magnetic tape operation command.  */
+struct mtop
+  {
+    short int mt_op;		/* Operations defined below.  */
+    int mt_count;		/* How many of them.  */
+  };
+
+/* Magnetic Tape operations [Not all operations supported by all drivers].  */
+#define MTRESET 0	/* +reset drive in case of problems.  */
+#define MTFSF	1	/* Forward space over FileMark,
+			 * position at first record of next file.  */
+#define MTBSF	2	/* Backward space FileMark (position before FM).  */
+#define MTFSR	3	/* Forward space record.  */
+#define MTBSR	4	/* Backward space record.  */
+#define MTWEOF	5	/* Write an end-of-file record (mark).  */
+#define MTREW	6	/* Rewind.  */
+#define MTOFFL	7	/* Rewind and put the drive offline (eject?).  */
+#define MTNOP	8	/* No op, set status only (read with MTIOCGET).  */
+#define MTRETEN 9	/* Retension tape.  */
+#define MTBSFM	10	/* +backward space FileMark, position at FM.  */
+#define MTFSFM  11	/* +forward space FileMark, position at FM.  */
+#define MTEOM	12	/* Goto end of recorded media (for appending files).
+			   MTEOM positions after the last FM, ready for
+			   appending another file.  */
+#define MTERASE 13	/* Erase tape -- be careful!  */
+
+#define MTRAS1  14	/* Run self test 1 (nondestructive).  */
+#define MTRAS2	15	/* Run self test 2 (destructive).  */
+#define MTRAS3  16	/* Reserved for self test 3.  */
+
+#define MTSETBLK 20	/* Set block length (SCSI).  */
+#define MTSETDENSITY 21	/* Set tape density (SCSI).  */
+#define MTSEEK	22	/* Seek to block (Tandberg, etc.).  */
+#define MTTELL	23	/* Tell block (Tandberg, etc.).  */
+#define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2.
+			     Ordinary buffered operation with code 1.  */
+#define MTFSS	25	/* Space forward over setmarks.  */
+#define MTBSS	26	/* Space backward over setmarks.  */
+#define MTWSM	27	/* Write setmarks.  */
+
+#define MTLOCK  28	/* Lock the drive door.  */
+#define MTUNLOCK 29	/* Unlock the drive door.  */
+#define MTLOAD  30	/* Execute the SCSI load command.  */
+#define MTUNLOAD 31	/* Execute the SCSI unload command.  */
+#define MTCOMPRESSION 32/* Control compression with SCSI mode page 15.  */
+#define MTSETPART 33	/* Change the active tape partition.  */
+#define MTMKPART  34	/* Format the tape with one or two partitions.  */
+
+/* structure for MTIOCGET - mag tape get status command */
+
+struct mtget
+  {
+    long int mt_type;		/* Type of magtape device.  */
+    long int mt_resid;		/* Residual count: (not sure)
+				   number of bytes ignored, or
+				   number of files not skipped, or
+				   number of records not skipped.  */
+    /* The following registers are device dependent.  */
+    long int mt_dsreg;		/* Status register.  */
+    long int mt_gstat;		/* Generic (device independent) status.  */
+    long int mt_erreg;		/* Error register.  */
+    /* The next two fields are not always used.  */
+    __daddr_t mt_fileno;	/* Number of current file on tape.  */
+    __daddr_t mt_blkno;		/* Current block number.  */
+  };
+
+
+
+/* Constants for mt_type. Not all of these are supported, and
+   these are not all of the ones that are supported.  */
+#define MT_ISUNKNOWN		0x01
+#define MT_ISQIC02		0x02	/* Generic QIC-02 tape streamer.  */
+#define MT_ISWT5150		0x03	/* Wangtek 5150EQ, QIC-150, QIC-02.  */
+#define MT_ISARCHIVE_5945L2	0x04	/* Archive 5945L-2, QIC-24, QIC-02?. */
+#define MT_ISCMSJ500		0x05	/* CMS Jumbo 500 (QIC-02?).  */
+#define MT_ISTDC3610		0x06	/* Tandberg 6310, QIC-24.  */
+#define MT_ISARCHIVE_VP60I	0x07	/* Archive VP60i, QIC-02.  */
+#define MT_ISARCHIVE_2150L	0x08	/* Archive Viper 2150L.  */
+#define MT_ISARCHIVE_2060L	0x09	/* Archive Viper 2060L.  */
+#define MT_ISARCHIVESC499	0x0A	/* Archive SC-499 QIC-36 controller. */
+#define MT_ISQIC02_ALL_FEATURES	0x0F	/* Generic QIC-02 with all features. */
+#define MT_ISWT5099EEN24	0x11	/* Wangtek 5099-een24, 60MB, QIC-24. */
+#define MT_ISTEAC_MT2ST		0x12	/* Teac MT-2ST 155mb drive,
+					   Teac DC-1 card (Wangtek type).  */
+#define MT_ISEVEREX_FT40A	0x32	/* Everex FT40A (QIC-40).  */
+#define MT_ISDDS1		0x51	/* DDS device without partitions.  */
+#define MT_ISDDS2		0x52	/* DDS device with partitions.  */
+#define MT_ISSCSI1		0x71	/* Generic ANSI SCSI-1 tape unit.  */
+#define MT_ISSCSI2		0x72	/* Generic ANSI SCSI-2 tape unit.  */
+
+/* QIC-40/80/3010/3020 ftape supported drives.
+   20bit vendor ID + 0x800000 (see vendors.h in ftape distribution).  */
+#define MT_ISFTAPE_UNKNOWN	0x800000 /* obsolete */
+#define MT_ISFTAPE_FLAG		0x800000
+
+struct mt_tape_info
+  {
+    long int t_type;		/* Device type id (mt_type).  */
+    char *t_name;		/* Descriptive name.  */
+  };
+
+#define MT_TAPE_INFO \
+  {									      \
+	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
+	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
+	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
+	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
+	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
+	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
+	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
+	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
+	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
+	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
+	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
+	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
+	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
+	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
+	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
+	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
+	{0, NULL}							      \
+  }
+
+
+/* Structure for MTIOCPOS - mag tape get position command.  */
+
+struct mtpos
+  {
+    long int mt_blkno;	/* Current block number.  */
+  };
+
+
+/* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended
+   as an interim solution for QIC-02 until DDI is fully implemented.  */
+struct mtconfiginfo
+  {
+    long int mt_type;		/* Drive type.  */
+    long int ifc_type;		/* Interface card type.  */
+    unsigned short int irqnr;	/* IRQ number to use.  */
+    unsigned short int dmanr;	/* DMA channel to use.  */
+    unsigned short int port;	/* IO port base address.  */
+
+    unsigned long int debug;	/* Debugging flags.  */
+
+    unsigned have_dens:1;
+    unsigned have_bsf:1;
+    unsigned have_fsr:1;
+    unsigned have_bsr:1;
+    unsigned have_eod:1;
+    unsigned have_seek:1;
+    unsigned have_tell:1;
+    unsigned have_ras1:1;
+    unsigned have_ras2:1;
+    unsigned have_ras3:1;
+    unsigned have_qfa:1;
+
+    unsigned pad1:5;
+    char reserved[10];
+  };
+
+
+/* Magnetic tape I/O control commands.  */
+#define	MTIOCTOP	_IOW('m', 1, struct mtop)	/* Do a mag tape op. */
+#define	MTIOCGET	_IOR('m', 2, struct mtget)	/* Get tape status.  */
+#define	MTIOCPOS	_IOR('m', 3, struct mtpos)	/* Get tape position.*/
+
+/* The next two are used by the QIC-02 driver for runtime reconfiguration.
+   See tpqic02.h for struct mtconfiginfo.  */
+#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/
+#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/
+
+/* Generic Mag Tape (device independent) status macros for examining
+   mt_gstat -- HP-UX compatible.
+   There is room for more generic status bits here, but I don't
+   know which of them are reserved. At least three or so should
+   be added to make this really useful.  */
+#define GMT_EOF(x)              ((x) & 0x80000000)
+#define GMT_BOT(x)              ((x) & 0x40000000)
+#define GMT_EOT(x)              ((x) & 0x20000000)
+#define GMT_SM(x)               ((x) & 0x10000000)  /* DDS setmark */
+#define GMT_EOD(x)              ((x) & 0x08000000)  /* DDS EOD */
+#define GMT_WR_PROT(x)          ((x) & 0x04000000)
+/* #define GMT_ ? 		((x) & 0x02000000) */
+#define GMT_ONLINE(x)           ((x) & 0x01000000)
+#define GMT_D_6250(x)           ((x) & 0x00800000)
+#define GMT_D_1600(x)           ((x) & 0x00400000)
+#define GMT_D_800(x)            ((x) & 0x00200000)
+/* #define GMT_ ? 		((x) & 0x00100000) */
+/* #define GMT_ ? 		((x) & 0x00080000) */
+#define GMT_DR_OPEN(x)          ((x) & 0x00040000)  /* Door open (no tape).  */
+/* #define GMT_ ? 		((x) & 0x00020000) */
+#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)  /* Immediate report mode.*/
+/* 16 generic status bits unused.  */
+
+
+/* SCSI-tape specific definitions.  Bitfield shifts in the status  */
+#define MT_ST_BLKSIZE_SHIFT	0
+#define MT_ST_BLKSIZE_MASK	0xffffff
+#define MT_ST_DENSITY_SHIFT	24
+#define MT_ST_DENSITY_MASK	0xff000000
+
+#define MT_ST_SOFTERR_SHIFT	0
+#define MT_ST_SOFTERR_MASK	0xffff
+
+/* Bitfields for the MTSETDRVBUFFER ioctl.  */
+#define MT_ST_OPTIONS		0xf0000000
+#define MT_ST_BOOLEANS		0x10000000
+#define MT_ST_SETBOOLEANS	0x30000000
+#define MT_ST_CLEARBOOLEANS	0x40000000
+#define MT_ST_WRITE_THRESHOLD	0x20000000
+#define MT_ST_DEF_BLKSIZE	0x50000000
+#define MT_ST_DEF_OPTIONS	0x60000000
+
+#define MT_ST_BUFFER_WRITES	0x1
+#define MT_ST_ASYNC_WRITES	0x2
+#define MT_ST_READ_AHEAD	0x4
+#define MT_ST_DEBUGGING		0x8
+#define MT_ST_TWO_FM		0x10
+#define MT_ST_FAST_MTEOM	0x20
+#define MT_ST_AUTO_LOCK		0x40
+#define MT_ST_DEF_WRITES	0x80
+#define MT_ST_CAN_BSR		0x100
+#define MT_ST_NO_BLKLIMS	0x200
+#define MT_ST_CAN_PARTITIONS    0x400
+#define MT_ST_SCSI2LOGICAL      0x800
+
+/* The mode parameters to be controlled. Parameter chosen with bits 20-28.  */
+#define MT_ST_CLEAR_DEFAULT	0xfffff
+#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
+
+/* The offset for the arguments for the special HP changer load command.  */
+#define MT_ST_HPLOADER_OFFSET 10000
+
 
 /* Specify default tape device.  */
 #ifndef DEFTAPE
diff --git a/sysdeps/unix/sysv/linux/sys/procfs.h b/sysdeps/unix/sysv/linux/sys/procfs.h
index 59f0fcd594..e8d32390fa 100644
--- a/sysdeps/unix/sysv/linux/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/sys/procfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -34,11 +34,11 @@
 __BEGIN_DECLS
 
 struct elf_siginfo
-{
-  int si_signo;				/* signal number */
-  int si_code;				/* extra code */
-  int si_errno;				/* errno */
-};
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
 
 typedef elf_greg_t greg_t;
 typedef elf_gregset_t gregset_t;
@@ -53,52 +53,52 @@ typedef elf_fpregset_t fpregset_t;
    gdb doesn't really use excluded.  Fields present but not used are
    marked with "XXX".  */
 struct elf_prstatus
-{
+  {
 #if 0
-  long pr_flags;			/* XXX Process flags */
-  short pr_why;				/* XXX Reason for process halt */
-  short pr_what;			/* XXX More detailed reason */
+    long int pr_flags;			/* XXX Process flags.  */
+    short int pr_why;			/* XXX Reason for process halt.  */
+    short int pr_what;			/* XXX More detailed reason.  */
 #endif
-  struct elf_siginfo pr_info;		/* Info associated with signal */
-  short pr_cursig;			/* Current signal */
-  sigset_t pr_sigpend;			/* Set of pending signals */
-  sigset_t pr_sighold;			/* Set of held signals */
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
 #if 0
-  struct sigaltstack pr_altstack;	/* Alternate stack info */
-  struct sigaction pr_action;		/* Signal action for current sig */
+    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    struct sigaction pr_action;		/* Signal action for current sig.  */
 #endif
-  pid_t pr_pid;
-  pid_t pr_ppid;
-  pid_t pr_pgrp;
-  pid_t pr_sid;
-  struct timeval pr_utime;		/* User time */
-  struct timeval pr_stime;		/* System time */
-  struct timeval pr_cutime;		/* Cumulative user time */
-  struct timeval pr_cstime;		/* Cumulative system time */
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
 #if 0
-  long pr_instr;			/* Current instruction */
+    long int pr_instr;			/* Current instruction.  */
 #endif
-  elf_gregset_t pr_reg;			/* GP registers */
-  int pr_fpvalid;			/* True if math copro being used.  */
-};
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
 
 
 #define ELF_PRARGSZ     (80)    /* Number of chars for args */
 
 struct elf_prpsinfo
-{
-  char pr_state;			/* numeric process state */
-  char pr_sname;			/* char for pr_state */
-  char pr_zomb;				/* zombie */
-  char pr_nice;				/* nice val */
-  unsigned long pr_flag;		/* flags */
-  uid_t pr_uid;
-  gid_t pr_gid;
-  pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
-  /* Lots missing */
-  char pr_fname[16];			/* filename of executable */
-  char pr_psargs[ELF_PRARGSZ];		/* initial part of arg list */
-};
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned short int pr_uid;
+    unsigned short int pr_gid;
+    unsigned short int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
 
 
 typedef struct elf_prstatus prstatus_t;
diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h
index b859dc7d64..85b1b85d2e 100644
--- a/sysdeps/unix/sysv/linux/sys/sysmacros.h
+++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h
@@ -22,8 +22,8 @@
 #define _SYS_SYSMACROS_H	1
 
 /* For compatibility we provide alternative names.  */
-#define major(dev) ((dev) >> 32)
-#define minor(dev) ((dev) & 0xffffffff)
-#define makedev(major, minor) (((major) << 32) | (monor))
+#define major(dev) (((dev) >> 8) & 0xff)
+#define minor(dev) ((dev) & 0xff)
+#define makedev(major, minor) (((major) << 8) | (minor))
 
 #endif /* _SYS_SYSMACROS_H */
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 5367a2826b..20ac94ae26 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -35,6 +35,7 @@ s_getdents	EXTRA	getdents	3	__getdents
 s_getpriority	getpriority getpriority	2	__syscall_getpriority
 s_ptrace	ptrace	ptrace		4	__syscall_ptrace
 s_reboot	EXTRA	reboot		3	__syscall_reboot
+s_sigaction	sigaction sigaction	3	__syscall_sigaction
 s_sigsuspend	sigsuspend sigsuspend	3	__syscall_sigsuspend
 s_sysctl	sysctl	_sysctl		1	__syscall__sysctl
 s_ustat		ustat	ustat		2	__syscall_ustat