about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/getresgid.c39
-rw-r--r--sysdeps/unix/sysv/linux/getresuid.c39
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c8
-rw-r--r--sysdeps/unix/sysv/linux/mips/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/ptsname.c27
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c8
-rw-r--r--sysdeps/unix/sysv/linux/sigpending.c10
-rw-r--r--sysdeps/unix/sysv/linux/sigprocmask.c10
-rw-r--r--sysdeps/unix/sysv/linux/sigsuspend.c10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list6
15 files changed, 137 insertions, 44 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 0dece5642a..5173b2122d 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -9,7 +9,7 @@ CPPFLAGS += -DHAVE_LLSEEK=1
 endif
 
 ifeq ($(subdir),misc)
-sysdep_routines += sysctl clone llseek
+sysdep_routines += sysctl clone llseek getresuid getresgid
 
 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
 		  sys/io.h sys/klog.h sys/kdaemon.h \
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 3166531d2b..59c0cb8a09 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -54,6 +54,9 @@ shutdown	-	shutdown	2	__shutdown	shutdown
 socketpair	-	socketpair	4	__socketpair	socketpair
 sysctl		-	_sysctl		6	sysctl
 
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresuid
+
 # access pci space protected from machine checks:
 pciconfig_read	EXTRA	pciconfig_read	5	pciconfig_read
 pciconfig_write	EXTRA	pciconfig_write	5	pciconfig_write
diff --git a/sysdeps/unix/sysv/linux/getresgid.c b/sysdeps/unix/sysv/linux/getresgid.c
new file mode 100644
index 0000000000..2fe461a787
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getresgid.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1998 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 <unistd.h>
+#include <sys/types.h>
+
+#include <linux/posix_types.h>
+
+extern int __syscall_getresgid (__kernel_gid_t *rgid, __kernel_gid_t *egid,
+				__kernel_gid_t *sgid);
+
+int
+getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
+{
+  __kernel_gid_t k_rgid, k_egid, k_sgid;
+
+  if (__syscall_getresgid (&k_rgid, &k_egid, &k_sgid) < 0)
+    return -1;
+
+  *rgid = (gid_t) k_rgid;
+  *egid = (gid_t) k_egid;
+  *sgid = (gid_t) k_sgid;
+  return 0;
+}
diff --git a/sysdeps/unix/sysv/linux/getresuid.c b/sysdeps/unix/sysv/linux/getresuid.c
new file mode 100644
index 0000000000..89b8fa7cfe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getresuid.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1998 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 <unistd.h>
+#include <sys/types.h>
+
+#include <linux/posix_types.h>
+
+extern int __syscall_getresuid (__kernel_uid_t *ruid, __kernel_uid_t *euid,
+				__kernel_uid_t *suid);
+
+int
+getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
+{
+  __kernel_uid_t k_ruid, k_euid, k_suid;
+
+  if (__syscall_getresuid (&k_ruid, &k_euid, &k_suid) < 0)
+    return -1;
+
+  *ruid = (uid_t) k_ruid;
+  *euid = (uid_t) k_euid;
+  *suid = (uid_t) k_suid;
+  return 0;
+}
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index 90818c1dff..6e26a5e6e2 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/i386.
-   Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1995, 1996, 1997, 1998 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
@@ -33,7 +33,7 @@ extern int __syscall_rt_sigaction (int, const struct sigaction *,
 
 /* The variable is shared between all wrappers around signal handling
    functions which have RT equivalents.  */
-int __libc_have_rt_sigs = -1;
+int __libc_missing_rt_sigs;
 
 
 /* If ACT is not NULL, change the action for SIG to *ACT.
@@ -45,7 +45,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
   int result;
 
   /* First try the RT signals.  */
-  if (__libc_have_rt_sigs)
+  if (!__libc_missing_rt_sigs)
     {
       struct sigaction nact, *nactp;
 
@@ -69,7 +69,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   if (act)
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index d026910ee2..c00ee6bed4 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -34,6 +34,9 @@ shutdown	-	shutdown	2	__shutdown	shutdown
 socket		-	socket		3	__socket	socket
 socketpair	-	socketpair	4	__socketpair	socketpair
 
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresuid
+
 #
 # There are defined locally because the caller is also defined in this dir.
 #
diff --git a/sysdeps/unix/sysv/linux/powerpc/socket.S b/sysdeps/unix/sysv/linux/powerpc/socket.S
index 681f7e6445..d6306bbf01 100644
--- a/sysdeps/unix/sysv/linux/powerpc/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/socket.S
@@ -41,8 +41,12 @@
 
 #define stackblock 20
 
+#ifndef __socket
+#define __socket P(__,socket)
+#endif
+
 	.text
-ENTRY(P(__,socket))
+ENTRY(__socket)
 	stwu %r1,-48(%r1)
 #if NARGS >= 1
 	stw  %r3,stackblock(%r1)
@@ -76,6 +80,6 @@ ENTRY(P(__,socket))
 	DO_CALL(SYS_ify(socketcall))
 	addi	%r1,%r1,48
 	PSEUDO_RET
-PSEUDO_END (P(__,socket))
+PSEUDO_END (__socket)
 
-weak_alias (P(__,socket), socket)
+weak_alias (__socket, socket)
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
index 7883d70719..c5f7725269 100644
--- a/sysdeps/unix/sysv/linux/powerpc/syscalls.list
+++ b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
@@ -1,3 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 s_llseek	llseek	_llseek		5	__sys_llseek
+
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresuid
diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c
index 04feadd436..77b6d80ac8 100644
--- a/sysdeps/unix/sysv/linux/ptsname.c
+++ b/sysdeps/unix/sysv/linux/ptsname.c
@@ -31,10 +31,10 @@
 #include <sys/sysmacros.h>
 
 /* Given the file descriptor of a master pty, return the pathname
-   of the associated slave. */
+   of the associated slave.  */
 
 static char namebuf[PTYNAMELEN];
-extern const char __ptyname1[], __ptyname2[]; /* defined in getpt.c */
+extern const char __ptyname1[], __ptyname2[]; /* Defined in getpt.c.  */
 
 char *
 ptsname (fd)
@@ -57,7 +57,7 @@ __ptsname_r (fd, buf, len)
   static int tiocgptn_works = 1;
   if (tiocgptn_works)
     {
-      if (!ioctl (fd, TIOCGPTN, &ptyno))
+      if (ioctl (fd, TIOCGPTN, &ptyno) == 0)
 	goto gotit;
       else
 	{
@@ -70,10 +70,12 @@ __ptsname_r (fd, buf, len)
 #endif
   /* /dev/ptmx will make it into the kernel before 32 bit dev_t, so
      this should be safe.  */
-  if (fstat (fd, &st))
+  if (__fxstat (_STAT_VER, fd, &st))
     return 0;
 
   ptyno = minor (st.st_rdev);
+  if (major (st.st_rdev) == 4)
+    ptyno -= 128;
 
 #ifdef TIOCGPTN
 gotit:
@@ -82,27 +84,24 @@ gotit:
      the SVr4 way.  */
 
   idbuf[5] = '\0';
-  stpcpy (stpcpy (nbuf, "/dev/pts/"),
-	  _itoa_word (ptyno, &idbuf[4], 10, 0));
-  if (!stat (nbuf, &st))
-    {
-      strncpy (buf, nbuf, len);
-      return buf;
-    }
+  __stpcpy (__stpcpy (nbuf, "/dev/pts/"),
+	    _itoa_word (ptyno, &idbuf[4], 10, 0));
+  if (!__xstat (_STAT_VER, nbuf, &st))
+    return strncpy (buf, nbuf, len);
   else
     if (errno != ENOENT)
       return NULL;
 
   /* ...and the BSD way.  */
+  nbuf[5]  = 't';
   nbuf[7]  = 'y';
   nbuf[8]  = __ptyname1[ptyno / 16];
   nbuf[9]  = __ptyname2[ptyno % 16];
   nbuf[10] = '\0';
 
-  if (stat (nbuf, &st))
+  if (__xstat (_STAT_VER, nbuf, &st))
     return NULL;
 
-  strncpy (buf, nbuf, len);
-  return buf;
+  return strncpy (buf, nbuf, len);
 }
 weak_alias (__ptsname_r, ptsname_r)
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 6b3d69d451..510cbe7040 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 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
@@ -31,7 +31,7 @@ extern int __syscall_rt_sigaction (int, const struct sigaction *,
 
 /* The variable is shared between all wrappers around signal handling
    functions which have RT equivalents.  */
-int __libc_have_rt_sigs = -1;
+int __libc_missing_rt_sigs;
 
 
 /* If ACT is not NULL, change the action for SIG to *ACT.
@@ -46,7 +46,7 @@ __sigaction (sig, act, oact)
   int error;
 
   /* First try the RT signals.  */
-  if (__libc_have_rt_sigs)
+  if (!__libc_missing_rt_sigs)
     {
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
@@ -55,7 +55,7 @@ __sigaction (sig, act, oact)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   if (act)
diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c
index fade020d26..4d5514a1bc 100644
--- a/sysdeps/unix/sysv/linux/sigpending.c
+++ b/sysdeps/unix/sysv/linux/sigpending.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 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
@@ -25,8 +25,8 @@ extern int __syscall_rt_sigpending (sigset_t *, size_t);
 
 
 /* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  It is defined in sigaction.c.  */
-extern int __libc_have_rt_sigs;
+   functions which have RT equivalents.  */
+int __libc_missing_rt_sigs;
 
 
 /* Change the set of blocked signals to SET,
@@ -36,7 +36,7 @@ sigpending (set)
      sigset_t *set;
 {
   /* First try the RT signals.  */
-  if (__libc_have_rt_sigs)
+  if (!__libc_missing_rt_sigs)
     {
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
@@ -45,7 +45,7 @@ sigpending (set)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   return __syscall_sigpending (set);
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index 63889a61dd..476f46a8e6 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 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
@@ -25,8 +25,8 @@ extern int __syscall_rt_sigprocmask (int, const sigset_t *, sigset_t *,
 				     size_t);
 
 /* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  It is defined in sigaction.c.  */
-extern int __libc_have_rt_sigs;
+   functions which have RT equivalents.  */
+int __libc_missing_rt_sigs;
 
 
 /* Get and/or change the set of blocked signals.  */
@@ -37,7 +37,7 @@ __sigprocmask (how, set, oset)
      sigset_t *oset;
 {
   /* First try the RT signals.  */
-  if (__libc_have_rt_sigs)
+  if (!__libc_missing_rt_sigs)
     {
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
@@ -46,7 +46,7 @@ __sigprocmask (how, set, oset)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   return __syscall_sigprocmask (how, set, oset);
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index 8d8fa8e709..197015401d 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 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
@@ -25,8 +25,8 @@ extern int __syscall_rt_sigsuspend (const sigset_t *, size_t);
 
 
 /* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  It is defined in sigaction.c.  */
-extern int __libc_have_rt_sigs;
+   functions which have RT equivalents.  */
+int __libc_missing_rt_sigs;
 
 
 /* Change the set of blocked signals to SET,
@@ -36,7 +36,7 @@ __sigsuspend (set)
      const sigset_t *set;
 {
   /* First try the RT signals.  */
-  if (__libc_have_rt_sigs)
+  if (!__libc_missing_rt_sigs)
     {
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
@@ -45,7 +45,7 @@ __sigsuspend (set)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   return __syscall_sigsuspend (0, 0, set->__val[0]);
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 3f62a7cd53..5da202541f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -30,3 +30,6 @@ sendto		-	sendto		6	__libc_sendto	__sendto sendto
 setsockopt	-	setsockopt	5	__setsockopt	setsockopt
 shutdown	-	shutdown	2	__shutdown	shutdown
 socketpair	-	socketpair	4	__socketpair	socketpair
+
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresuid
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 3f1491f7bd..6bcd6dab18 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -13,15 +13,13 @@ geteuid		-	geteuid		0	__geteuid	geteuid
 getpgid		-	getpgid		1	__getpgid	getpgid
 getpgrp		-	getpgrp		0	getpgrp
 getppid		-	getppid		0	__getppid	getppid
-getresgid	EXTRA	getresgid	3	getresgid
-getresuid	EXTRA	getresuid	3	getresuid
 getsid		-	getsid		1	getsid
 init_module	EXTRA	init_module	5	init_module
 ioperm		-	ioperm		3	ioperm
 iopl		-	iopl		1	iopl
 ipc		msgget	ipc		5	__ipc
 klogctl		EXTRA	syslog		3	klogctl
-lchown		EXATR	lchown		3	__lchown	lchown
+lchown		EXTRA	lchown		3	__lchown	lchown
 mlock		EXTRA	mlock		2	__mlock	mlock
 mlockall	EXTRA	mlockall	1	__mlockall	mlockall
 mount		EXTRA	mount		5	__mount	mount
@@ -44,6 +42,8 @@ rt_sigsuspend	-	rt_sigsuspend	2	__syscall_rt_sigsuspend
 rt_sigtimedwait	-	rt_sigtimedwait	4	__syscall_rt_sigtimedwait
 s_getdents	EXTRA	getdents	3	__getdents
 s_getpriority	getpriority getpriority	2	__syscall_getpriority
+s_getresgid	getresgid getresgid	3	__syscall_getresgid
+s_getresuid	getresuid getresuid	3	__syscall_getresuid
 s_poll		poll	poll		3	__syscall_poll
 s_pread64	EXTRA	pread		5	__syscall_pread64
 s_ptrace	ptrace	ptrace		4	__syscall_ptrace