File uClibc.ia64-fake-getpgrp-syscall.patch of Package uClibc

Subject: proper handling for syscall getpgrp

From: Stefan Assmann <sassmann@suse.de>

This patch tries to emulate the behaviour of getpgrp by using getpgid, on
platforms that do not implement getpgrp. Otherwise ENOSYS will be returned. This
patch is necessary at least on ia64 where getpgrp is not available.

Signed-off-by: Stefan Assmann <sassmann@suse.de>
---
 libc/sysdeps/linux/common/getpgrp.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/libc/sysdeps/linux/common/getpgrp.c
+++ b/libc/sysdeps/linux/common/getpgrp.c
@@ -13,4 +13,14 @@
 #ifdef __NR_getpgrp
 /* According to the manpage the POSIX.1 version is favoured */
 _syscall0(pid_t, getpgrp)
+#else
+pid_t getpgrp(void)
+{
+#ifdef __NR_getpgid
+	return getpgid(getpid());
+#else
+        __set_errno(ENOSYS);
+        return -1;
+#endif
+}
 #endif
openSUSE Build Service is sponsored by