Subject: proper handling for syscall getpgrp

From: Stefan Assmann <[email protected]>

This patch tries to emulate the behavior 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 <[email protected]>
---
 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

  Stefan

-- 
Stefan Assmann          | SUSE LINUX Products GmbH
Software Engineer       | Maxfeldstr. 5, D-90409 Nuernberg
Mail: [email protected]  | GF: Markus Rex, HRB 16746 (AG Nuernberg)
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to