+2003-02-21 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/i386/getuid.c: Use INTERNAL_SYSCALL and do
+ not chechk for errors (unless testing for 32bit variant).
+ * sysdeps/unix/sysv/linux/i386/getgid.c: Likewise.
+ * sysdeps/unix/sysv/linux/i386/geteuid.c: Likewise.
+ * sysdeps/unix/sysv/linux/i386/getegid.c: Likewise.
+
2003-02-21 Jakub Jelinek <jakub@redhat.com>
* sysdeps/x86_64/dl-machine.h (elf_machine_rela) <R_X86_64_PC32>:
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 \
tst-barrier1 tst-barrier2 tst-barrier3 \
tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
- tst-kill1 tst-kill2 tst-kill3 tst-kill4 \
+ tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 \
tst-tsd1 tst-tsd2 \
tst-fork1 tst-fork2 tst-fork3 \
--- /dev/null
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static pthread_t receiver;
+static sem_t sem;
+static pthread_barrier_t b;
+
+static void
+handler (int sig)
+{
+ if (sig != SIGUSR1)
+ {
+ write (STDOUT_FILENO, "wrong signal\n", 13);
+ _exit (1);
+ }
+
+ if (pthread_self () != receiver)
+ {
+ write (STDOUT_FILENO, "not the intended receiver\n", 26);
+ _exit (1);
+ }
+
+ if (sem_post (&sem) != 0)
+ {
+ write (STDOUT_FILENO, "sem_post failed\n", 16);
+ _exit (1);
+ }
+}
+
+
+static void *
+tf (void *a)
+{
+ int e = pthread_barrier_wait (&b);
+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("child: barrier_wait failed");
+ exit (1);
+ }
+
+ return NULL;
+}
+
+
+int
+do_test (void)
+{
+ struct sigaction sa;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = handler;
+ if (sigaction (SIGUSR1, &sa, NULL) != 0)
+ {
+ puts ("sigaction failed");
+ exit (1);
+ }
+
+#define N 20
+
+ if (pthread_barrier_init (&b, NULL, N + 1) != 0)
+ {
+ puts ("barrier_init failed");
+ exit (1);
+ }
+
+ pthread_t th[N];
+ int i;
+ for (i = 0; i < N; ++i)
+ if (pthread_create (&th[i], NULL, tf, NULL) != 0)
+ {
+ puts ("create failed");
+ exit (1);
+ }
+
+ if (sem_init (&sem, 0, 0) != 0)
+ {
+ puts ("sem_init failed");
+ exit (1);
+ }
+
+ for (i = 0; i < N * 10; ++i)
+ {
+ receiver = th[i % N];
+
+ if (pthread_kill (receiver, SIGUSR1) != 0)
+ {
+ puts ("kill failed");
+ exit (1);
+ }
+
+ if (sem_wait (&sem) != 0)
+ {
+ puts ("sem_wait failed");
+ exit (1);
+ }
+ }
+
+ int e = pthread_barrier_wait (&b);
+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("barrier_wait failed");
+ exit (1);
+ }
+
+ for (i = 0; i < N; ++i)
+ if (pthread_join (th[i], NULL) != 0)
+ {
+ puts ("join failed");
+ exit (1);
+ }
+
+ return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003 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
# if __ASSUME_32BITUIDS == 0
/* This variable is shared with all files that need to check for 32bit
uids. */
-extern int __libc_missing_32bit_uids;
+extern int __libc_missing_32bit_uids attribute_hidden;
# endif
#endif /* __NR_getegid32 */
gid_t
__getegid (void)
{
+ INTERNAL_SYSCALL_DECL (err);
#if __ASSUME_32BITUIDS > 0
- return INLINE_SYSCALL (getegid32, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (getegid32, err, 0);
#else
# ifdef __NR_getegid32
if (__libc_missing_32bit_uids <= 0)
{
int result;
- int saved_errno = errno;
- result = INLINE_SYSCALL (getegid32, 0);
- if (result == 0 || errno != ENOSYS)
+ result = INTERNAL_SYSCALL (getegid32, err, 0);
+ if (! INTERNAL_SYSCALL_ERROR_P (result, err)
+ || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
return result;
- __set_errno (saved_errno);
__libc_missing_32bit_uids = 1;
}
# endif /* __NR_getegid32 */
- return INLINE_SYSCALL (getegid, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (getegid, err, 0);
#endif
}
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003 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
# if __ASSUME_32BITUIDS == 0
/* This variable is shared with all files that need to check for 32bit
uids. */
-extern int __libc_missing_32bit_uids;
+extern int __libc_missing_32bit_uids attribute_hidden;
# endif
#endif /* __NR_geteuid32 */
uid_t
__geteuid (void)
{
+ INTERNAL_SYSCALL_DECL (err);
#if __ASSUME_32BITUIDS > 0
- return INLINE_SYSCALL (geteuid32, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (geteuid32, err, 0);
#else
# ifdef __NR_geteuid32
if (__libc_missing_32bit_uids <= 0)
{
int result;
- int saved_errno = errno;
- result = INLINE_SYSCALL (geteuid32, 0);
- if (result == 0 || errno != ENOSYS)
+ result = INTERNAL_SYSCALL (geteuid32, err, 0);
+ if (! INTERNAL_SYSCALL_ERROR_P (result, err)
+ || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
return result;
- __set_errno (saved_errno);
__libc_missing_32bit_uids = 1;
}
# endif /* __NR_geteuid32 */
- return INLINE_SYSCALL (geteuid, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (getugid, err, 0);
#endif
}
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003 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
# if __ASSUME_32BITUIDS == 0
/* This variable is shared with all files that need to check for 32bit
uids. */
-extern int __libc_missing_32bit_uids;
+extern int __libc_missing_32bit_uids attribute_hidden;
# endif
#endif /* __NR_getgid32 */
gid_t
__getgid (void)
{
+ INTERNAL_SYSCALL_DECL (err);
#if __ASSUME_32BITUIDS > 0
- return INLINE_SYSCALL (getgid32, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (getgid32, err, 0);
#else
# ifdef __NR_getgid32
if (__libc_missing_32bit_uids <= 0)
{
int result;
- int saved_errno = errno;
- result = INLINE_SYSCALL (getgid32, 0);
- if (result == 0 || errno != ENOSYS)
+ result = INTERNAL_SYSCALL (getdid32, err, 0);
+ if (! INTERNAL_SYSCALL_ERROR_P (result, err)
+ || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
return result;
- __set_errno (saved_errno);
__libc_missing_32bit_uids = 1;
}
# endif /* __NR_getgid32 */
- return INLINE_SYSCALL (getgid, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (getgid, err, 0);
#endif
}
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003 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
-1 if libc does not know yet whether kernel has 32bit uids or not.
0 if it does have them.
1 if it does not have them. */
-int __libc_missing_32bit_uids = -1;
+int __libc_missing_32bit_uids attribute_hidden = -1;
# endif
#endif /* __NR_getuid32 */
uid_t
__getuid (void)
{
+ INTERNAL_SYSCALL_DECL (err);
#if __ASSUME_32BITUIDS > 0
- return INLINE_SYSCALL (getuid32, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (getuid32, err, 0);
#else
# ifdef __NR_getuid32
if (__libc_missing_32bit_uids <= 0)
{
int result;
- int saved_errno = errno;
- result = INLINE_SYSCALL (getuid32, 0);
- if (result == 0 || errno != ENOSYS)
+ result = INTERNAL_SYSCALL (getuid32, err, 0);
+ if (! INTERNAL_SYSCALL_ERROR_P (result, err)
+ || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
return result;
- __set_errno (saved_errno);
__libc_missing_32bit_uids = 1;
}
# endif /* __NR_getuid32 */
- return INLINE_SYSCALL (getuid, 0);
+ /* No error checking. */
+ return INTERNAL_SYSCALL (getuid, err, 0);
#endif
}