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/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile5
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile8
-rw-r--r--sysdeps/unix/sysv/linux/i386/sys/perm.h36
-rw-r--r--sysdeps/unix/sysv/linux/i386/sys/vm86.h34
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/schedbits.h1
-rw-r--r--sysdeps/unix/sysv/linux/sys/acct.h34
-rw-r--r--sysdeps/unix/sysv/linux/sys/socket.h168
-rw-r--r--sysdeps/unix/sysv/linux/sys/sysinfo.h30
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list10
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c294
13 files changed, 340 insertions, 290 deletions
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index e6505c0ed9..8c8be26b92 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -1,3 +1,4 @@
+sys/acct.h
 sys/socketcall.h
 sys/sysctl.h
 sys/timex.h
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 4d484ab092..53837ab53f 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -15,8 +15,9 @@ sysdep_routines += fxstat lxstat xstat
 endif
 
 ifeq ($(subdir), misc)
-sysdep_routines += xmknod s_ptrace s_sysctl sysctl
-headers += sys/mount.h
+sysdep_routines += mount umount xmknod s_ptrace s_sysctl sysctl llseek \
+setfsgid setfsuid sysinfo uselib
+headers += sys/mount.h sys/sysinfo.h
 endif
 
 ifeq ($(subdir), time)
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index 94f4a1ece7..5fd25ba2e7 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 
 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
@@ -80,14 +80,14 @@ gethostid ()
     /* This also fails.  Return and arbitrary value.  */
     return 0;
 
-  /* To get the IP address we need to knoe the host name.  */
+  /* To get the IP address we need to know the host name.  */
   hp = gethostbyname (hostname);
   if (hp == NULL)
     return 0;
 
   in.s_addr = 0;
   memcpy (&in, hp->h_addr,
-	  sizeof (in) < hp->h_length ? sizeof (in) : hp->h_length);
+	  (int) sizeof (in) < hp->h_length ? sizeof (in) : hp->h_length);
 
   /* For the return value to be not exactly the IP address we do some
      bit fiddling.  */
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 19eb60fb6d..bd345b6fc6 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -1,4 +1,4 @@
-# Set the shared library version numbers for Linux/i386.
-
-libc.so-version = .6
-libm.so-version = .6
+ifeq ($(subdir), misc)
+sysdep_routines += ioperm iopl vm86
+headers += sys/perm.h sys/vm86.h
+endif
diff --git a/sysdeps/unix/sysv/linux/i386/sys/perm.h b/sysdeps/unix/sysv/linux/i386/sys/perm.h
new file mode 100644
index 0000000000..1ae5f2e1db
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/sys/perm.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996 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_PERM_H
+
+#define _SYS_PERM_H	1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Set port input/output permissions.  */
+extern int ioperm __P ((unsigned long __from, unsigned long __num,
+			int __turn_on));
+
+
+/* Change I/O privilege level.  */
+extern int iopl __P ((int __level));
+
+__END_DECLS
+
+#endif	/* sys/perm.h */
diff --git a/sysdeps/unix/sysv/linux/i386/sys/vm86.h b/sysdeps/unix/sysv/linux/i386/sys/vm86.h
new file mode 100644
index 0000000000..32e0055ce8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/sys/vm86.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996 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_VM86_H
+
+#define _SYS_VM86_H	1
+#include <features.h>
+
+/* Get constants and data types from kernel header file.  */
+#include <linux/vm86.h>
+
+__BEGIN_DECLS
+
+/* Enter virtual 8086 mode.  */
+extern int vm86 __P ((struct vm86_struct *__info));
+
+__END_DECLS
+
+#endif	/* sys/vm86.h */
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
new file mode 100644
index 0000000000..63dd0bd8e2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -0,0 +1,3 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+vm86		-	vm86		1	__vm86		vm86
diff --git a/sysdeps/unix/sysv/linux/schedbits.h b/sysdeps/unix/sysv/linux/schedbits.h
new file mode 100644
index 0000000000..7b887aab25
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/schedbits.h
@@ -0,0 +1 @@
+#include <linux/posix_sched.h>
diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h
new file mode 100644
index 0000000000..adb2da7a99
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/acct.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996 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_ACCT_H
+
+#define _SYS_ACCT_H	1
+#include <features.h>
+
+/* Get needed constants.  */
+#include <linux/acct.h>
+
+__BEGIN_DECLS
+
+/* Switch process accounting on and off.  */
+extern int acct __P ((__const char *__filename));
+
+__END_DECLS
+
+#endif	/* sys/acct.h */
diff --git a/sysdeps/unix/sysv/linux/sys/socket.h b/sysdeps/unix/sysv/linux/sys/socket.h
index cd6c58bd32..a680d5fb29 100644
--- a/sysdeps/unix/sysv/linux/sys/socket.h
+++ b/sysdeps/unix/sysv/linux/sys/socket.h
@@ -1 +1,169 @@
+/* Copyright (C) 1991, 92, 94, 95, 96 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.  */
+
+#ifndef	_SYS_SOCKET_H
+
+#define	_SYS_SOCKET_H	1
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define	__need_size_t
+#include <stddef.h>
+
+
+/* Get Linux specific constants and data types.  */
 #include <linux/socket.h>
+
+/* This is the type we use for generic socket address arguments.
+
+   With GCC 2.7 and later, the funky union causes redeclarations or uses with
+   any of the listed types to be allowed without complaint.  */
+#if	(!defined (__GNUC__) || __GNUC__ < 2 || \
+	 (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
+#define	__SOCKADDR_ARG		struct sockaddr *
+#define	__CONST_SOCKADDR_ARG	__const struct sockaddr *
+#else
+/* Add more `struct sockaddr_AF' types here as necessary.
+   These are all the ones I found on NetBSD and Linux.  */
+#define __SOCKADDR_ALLTYPES \
+  __SOCKADDR_ONETYPE (sockaddr) \
+  __SOCKADDR_ONETYPE (sockaddr_at) \
+  __SOCKADDR_ONETYPE (sockaddr_ax25) \
+  __SOCKADDR_ONETYPE (sockaddr_dl) \
+  __SOCKADDR_ONETYPE (sockaddr_eon) \
+  __SOCKADDR_ONETYPE (sockaddr_in) \
+  __SOCKADDR_ONETYPE (sockaddr_in6) \
+  __SOCKADDR_ONETYPE (sockaddr_inarp) \
+  __SOCKADDR_ONETYPE (sockaddr_ipx) \
+  __SOCKADDR_ONETYPE (sockaddr_iso) \
+  __SOCKADDR_ONETYPE (sockaddr_ns) \
+  __SOCKADDR_ONETYPE (sockaddr_un) \
+  __SOCKADDR_ONETYPE (sockaddr_x25)
+
+#define __SOCKADDR_ONETYPE(type) struct type *__##type##__;
+typedef union { __SOCKADDR_ALLTYPES
+	      } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
+#undef __SOCKADDR_ONETYPE
+#define __SOCKADDR_ONETYPE(type) __const struct type *__##type##__;
+typedef union { __SOCKADDR_ALLTYPES
+	      } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
+#undef __SOCKADDR_ONETYPE
+#endif
+
+
+/* Create a new socket of type TYPE in domain DOMAIN, using
+   protocol PROTOCOL.  If PROTOCOL is zero, one is chosen automatically.
+   Returns a file descriptor for the new socket, or -1 for errors.  */
+extern int socket __P ((int __domain, int __type, int __protocol));
+
+/* Create two new sockets, of type TYPE in domain DOMAIN and using
+   protocol PROTOCOL, which are connected to each other, and put file
+   descriptors for them in FDS[0] and FDS[1].  If PROTOCOL is zero,
+   one will be chosen automatically.  Returns 0 on success, -1 for errors.  */
+extern int socketpair __P ((int __domain, int __type, int __protocol,
+			    int __fds[2]));
+
+/* Give the socket FD the local address ADDR (which is LEN bytes long).  */
+extern int bind __P ((int __fd, __CONST_SOCKADDR_ARG __addr, size_t __len));
+
+/* Put the local address of FD into *ADDR and its length in *LEN.  */
+extern int getsockname __P ((int __fd, __SOCKADDR_ARG __addr,
+			     size_t *__len));
+
+/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
+   For connectionless socket types, just set the default address to send to
+   and the only address from which to accept transmissions.
+   Return 0 on success, -1 for errors.  */
+extern int connect __P ((int __fd,
+			 __CONST_SOCKADDR_ARG __addr, size_t __len));
+
+/* Put the address of the peer connected to socket FD into *ADDR
+   (which is *LEN bytes long), and its actual length into *LEN.  */
+extern int getpeername __P ((int __fd, __SOCKADDR_ARG __addr,
+			     size_t *__len));
+
+
+/* Send N bytes of BUF to socket FD.  Returns the number sent or -1.  */
+extern int send __P ((int __fd, __ptr_t __buf, size_t __n, int __flags));
+
+/* Read N bytes into BUF from socket FD.
+   Returns the number read or -1 for errors.  */
+extern int recv __P ((int __fd, __ptr_t __buf, size_t __n, int __flags));
+
+/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
+   ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.  */
+extern int sendto __P ((int __fd, __ptr_t __buf, size_t __n, int __flags,
+			__CONST_SOCKADDR_ARG __addr, size_t __addr_len));
+
+/* Read N bytes into BUF through socket FD.
+   If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
+   the sender, and store the actual size of the address in *ADDR_LEN.
+   Returns the number of bytes read or -1 for errors.  */
+extern int recvfrom __P ((int __fd, __ptr_t __buf, size_t __n, int __flags,
+			  __SOCKADDR_ARG __addr, size_t *__addr_len));
+
+
+/* Send a message described MESSAGE on socket FD.
+   Returns the number of bytes sent, or -1 for errors.  */
+extern int sendmsg __P ((int __fd, __const struct msghdr *__message,
+			 int __flags));
+
+/* Receive a message as described by MESSAGE from socket FD.
+   Returns the number of bytes read or -1 for errors.  */
+extern int recvmsg __P ((int __fd, struct msghdr *__message, int __flags));
+
+
+/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
+   into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
+   actual length.  Returns 0 on success, -1 for errors.  */
+extern int getsockopt __P ((int __fd, int __level, int __optname,
+			    __ptr_t __optval, size_t *__optlen));
+
+/* Set socket FD's option OPTNAME at protocol level LEVEL
+   to *OPTVAL (which is OPTLEN bytes long).
+   Returns 0 on success, -1 for errors.  */
+extern int setsockopt __P ((int __fd, int __level, int __optname,
+			    __ptr_t __optval, size_t __optlen));
+
+
+/* Prepare to accept connections on socket FD.
+   N connection requests will be queued before further requests are refused.
+   Returns 0 on success, -1 for errors.  */
+extern int listen __P ((int __fd, unsigned int __n));
+
+/* Await a connection on socket FD.
+   When a connection arrives, open a new socket to communicate with it,
+   set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+   peer and *ADDR_LEN to the address's actual length, and return the
+   new socket's descriptor, or -1 for errors.  */
+extern int accept __P ((int __fd, __SOCKADDR_ARG __addr,
+			size_t *__addr_len));
+
+/* Shut down all or part of the connection open on socket FD.
+   HOW determines what to shut down:
+     0 = No more receptions;
+     1 = No more transmissions;
+     2 = No more receptions or transmissions.
+   Returns 0 on success, -1 for errors.  */
+extern int shutdown __P ((int __fd, int __how));
+
+
+__END_DECLS
+
+#endif /* sys/socket.h */
diff --git a/sysdeps/unix/sysv/linux/sys/sysinfo.h b/sysdeps/unix/sysv/linux/sys/sysinfo.h
new file mode 100644
index 0000000000..c05da05b3d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/sysinfo.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996 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_SYSINFO_H
+
+#define _SYS_SYSINFO_H	1
+#include <features.h>
+
+/* Get sysinfo structure from kernel header.  */
+#include <linux/kernel.h>
+
+/* Returns information on overall system statistics.  */
+extern int sysinfo __P ((struct sysinfo *__info));
+
+#endif	/* sys/sysinfo.h */
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index d78a1f7e89..019d746a73 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -2,6 +2,7 @@
 
 adjtimex	adjtime	adjtimex	1	__adjtimex
 fdatasync	-	fdatasync	1	fdatasync
+flock		-	flock		2	__flock		flock
 fork		-	fork		0	__fork		fork
 getegid		-	getegid		0	__getegid	getegid
 geteuid		-	geteuid		0	__geteuid	geteuid
@@ -9,7 +10,10 @@ getpgid		-	getpgid		1	getpgid
 getpgrp		-	getpgrp		0	getpgrp
 getppid		-	getppid		0	__getppid	getppid
 getsid		-	getsid		1	getsid
+ioperm		-	ioperm		3	ioperm
+iopl		-	iopl		1	iopl
 ipc		msgget	ipc		5	__ipc
+llseek		-	_llseek		5	llseek
 mlock		-	mlock		2	__mlock	mlock
 mlockall	-	mlockall	1	__mlockall	mlockall
 mount		-	mount		5	__mount	mount
@@ -18,7 +22,7 @@ munlock		-	munlock		2	__munlock	munlock
 munlockall	-	munlockall	0	__munlockall	munlockall
 nanosleep	-	nanosleep	2	nanosleep
 personality	init-first personality	1	__personality	personality
-pipe		-	pipe		1	__pipe	pipe
+pipe		-	pipe		1	__pipe		pipe
 reboot		-	reboot		3	reboot
 s_getpriority	getpriority getpriority	2	__syscall_getpriority
 s_ptrace	ptrace	ptrace		4	__syscall_ptrace
@@ -31,9 +35,13 @@ sched_yield	-	sched_yield	0	__sched_yield	sched_yield
 sched_primax	-	sched_get_priority_max	1	__sched_get_priority_max	sched_get_priority_max
 sched_primin	-	sched_get_priority_min	1	__sched_get_priority_min	sched_get_priority_min
 sched_rr_gi	-	sched_rr_get_interval	2	__sched_rr_get_interval	sched_rr_get_interval
+setfsgid	-	setfsgid	1	setfsgid
+setfsuid	-	setfsuid	1	setfsuid
 setpgid		-	setpgid		2	setpgid
 sigpending	-	sigpending	1	sigpending
 sigprocmask	-	sigprocmask	3	__sigprocmask	sigprocmask
 s_sysctl	sysctl	_sysctl		1	__syscall__sysctl
+sysinfo		-	sysinfo		1	sysinfo
 umount		-	umount		1	__umount	umount
+uselib		-	uselib		1	uselib
 wait4		-	wait4		4	__wait4		wait4
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index d658165b07..2ae584f164 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 
 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
@@ -13,291 +12,26 @@ 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.  */
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* On Linux we must not ask __getdtablesize for te value for _SC_OPEN_MAX
+   because this would mean an endless loop.  */
 
-#include <ansidecl.h>
-#include <errno.h>
 #include <limits.h>
 #include <unistd.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
 
-extern size_t EXFUN(__getpagesize, (NOARGS));
+extern long int __default_sysconf (int name);
 
-/* Get the value of the system variable NAME.  */
 long int
-DEFUN(__sysconf, (name), int name)
+__sysconf (int name)
 {
-  switch (name)
-    {
-    default:
-      errno = EINVAL;
-      return -1;
-
-    case _SC_ARG_MAX:
-#ifdef	ARG_MAX
-      return ARG_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_CHILD_MAX:
-#ifdef	CHILD_MAX
-      return CHILD_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_CLK_TCK:
-#ifdef	CLK_TCK
-      return CLK_TCK;
-#else
-      return 60;
-#endif
-
-    case _SC_NGROUPS_MAX:
-#ifdef	NGROUPS_MAX
-      return NGROUPS_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_OPEN_MAX:
-      return OPEN_MAX;
-
-    case _SC_STREAM_MAX:
-#ifdef	STREAM_MAX
-      return STREAM_MAX;
-#else
-      return FOPEN_MAX;
-#endif
-
-    case _SC_TZNAME_MAX:
-      return __tzname_max ();
-
-    case _SC_JOB_CONTROL:
-#ifdef	_POSIX_JOB_CONTROL
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_SAVED_IDS:
-#ifdef	_POSIX_SAVED_IDS
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_REALTIME_SIGNALS:
-#ifdef	_POSIX_REALTIME_SIGNALS
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_PRIORITY_SCHEDULING:
-#ifdef	_POSIX_PRIORITY_SCHEDULING
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_TIMERS:
-#ifdef	_POSIX_TIMERS
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_ASYNCHRONOUS_IO:
-#ifdef	_POSIX_ASYNCHRONOUS_IO
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_PRIORITIZED_IO:
-#ifdef	_POSIX_PRIORITIZED_IO
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_SYNCHRONIZED_IO:
-#ifdef	_POSIX_SYNCHRONIZED_IO
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_FSYNC:
-#ifdef	_POSIX_FSYNC
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_MAPPED_FILES:
-#ifdef	_POSIX_MAPPED_FILES
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_MEMLOCK:
-#ifdef	_POSIX_MEMLOCK
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_MEMLOCK_RANGE:
-#ifdef	_POSIX_MEMLOCK_RANGE
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_MEMORY_PROTECTION:
-#ifdef	_POSIX_MEMORY_PROTECTION
-      return 1;
-#else
-      return -1;
-#endif
+  if (name == _SC_OPEN_MAX)
+    return OPEN_MAX;
 
-    case _SC_MESSAGE_PASSING:
-#ifdef	_POSIX_MESSAGE_PASSING
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_SEMAPHORES:
-#ifdef	_POSIX_SEMAPHORES
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_SHARED_MEMORY_OBJECTS:
-#ifdef	_POSIX_SHARED_MEMORY_OBJECTS
-      return 1;
-#else
-      return -1;
-#endif
-
-    case _SC_VERSION:
-      return _POSIX_VERSION;
-
-    case _SC_PAGESIZE:
-      return __getpagesize ();
-
-    case _SC_BC_BASE_MAX:
-#ifdef	BC_BASE_MAX
-      return BC_BASE_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_BC_DIM_MAX:
-#ifdef	BC_DIM_MAX
-      return BC_DIM_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_BC_SCALE_MAX:
-#ifdef	BC_SCALE_MAX
-      return BC_SCALE_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_BC_STRING_MAX:
-#ifdef	BC_STRING_MAX
-      return BC_STRING_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_EQUIV_CLASS_MAX:
-#ifdef	EQUIV_CLASS_MAX
-      return EQUIV_CLASS_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_EXPR_NEST_MAX:
-#ifdef	EXPR_NEST_MAX
-      return EXPR_NEST_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_LINE_MAX:
-#ifdef	LINE_MAX
-      return LINE_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_RE_DUP_MAX:
-#ifdef	RE_DUP_MAX
-      return RE_DUP_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_CHARCLASS_NAME_MAX:
-#ifdef	CHARCLASS_NAME_MAX
-      return CHARCLASS_NAME_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_2_VERSION:
-      /* This is actually supposed to return the version
-	 of the 1003.2 utilities on the system {POSIX2_VERSION}.  */
-      return _POSIX2_C_VERSION;
-
-    case _SC_2_C_BIND:
-#ifdef	_POSIX2_C_BIND
-      return _POSIX2_C_BIND;
-#else
-      return -1;
-#endif
-
-    case _SC_2_C_DEV:
-#ifdef	_POSIX2_C_DEV
-      return _POSIX2_C_DEV;
-#else
-      return -1;
-#endif
-
-    case _SC_2_FORT_DEV:
-#ifdef	_POSIX2_FORT_DEV
-      return _POSIX2_FORT_DEV;
-#else
-      return -1;
-#endif
-
-    case _SC_2_LOCALEDEF:
-#ifdef	_POSIX2_LOCALEDEF
-      return _POSIX2_LOCALEDEF;
-#else
-      return -1;
-#endif
-
-    case _SC_2_SW_DEV:
-#ifdef	_POSIX2_SW_DEV
-      return _POSIX2_SW_DEV;
-#else
-      return -1;
-#endif
-    }
+  return __default_sysconf (name);
 }
 
-weak_alias (__sysconf, sysconf)
+#define __sysconf __default_sysconf
+
+#include <sysdeps/posix/sysconf.c>