[git commit branch/0.9.33] getpgrp: fix fallback handling

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue May 15 07:13:15 UTC 2012


commit: http://git.uclibc.org/uClibc/commit/?id=032c938d2899e94b08ae5fe8d0004f7e20e5ee1b
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/0.9.33

The test for generating a stub for getpgrp was wrong and would
result in duplicate symbols when building without __NR_getpgrp,
but with __NR_getpgid and __NR_getpid.

A closer look at the getpgrp implementation using getpgid showed
that getpid was being called to pass the current pid to getpgid.
This is unnecessary because passing 0 to getpgid returns the
pgid of the current process.

This patch cleans up the getpgrp implementation and the stub test.

Signed-off-by: Mark Salter <msalter at redhat.com>
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/sysdeps/linux/common/getpgrp.c |    5 ++---
 libc/sysdeps/linux/common/stubs.c   |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c
index 0af9dc4..14912c3 100644
--- a/libc/sysdeps/linux/common/getpgrp.c
+++ b/libc/sysdeps/linux/common/getpgrp.c
@@ -13,10 +13,9 @@
 #ifdef __NR_getpgrp
 /* According to the manpage the POSIX.1 version is favoured */
 _syscall_noerr0(pid_t, getpgrp)
-#elif defined __NR_getpgid && (defined __NR_getpid || defined __NR_getxpid)
-/* IA64 doesn't have a getpgrp syscall */
+#elif defined __NR_getpgid
 pid_t getpgrp(void)
 {
-	return getpgid(getpid());
+	return getpgid(0);
 }
 #endif
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index dd1a8d1..4d1e26c 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -137,7 +137,7 @@ make_stub(sched_getcpu)
 make_stub(getpeername)
 #endif
 
-#if !defined(__NR_getpgrp) && (defined(__NR_getpgid) && (defined(__NR_getpid) || defined(__NR_getxpid)))
+#if !defined __NR_getpgrp && !defined __NR_getpgid
 make_stub(getpgrp)
 #endif
 


More information about the uClibc-cvs mailing list