mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
Update.
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.
This commit is contained in:
parent
e814f74891
commit
1c848253fc
@ -1,3 +1,11 @@
|
|||||||
|
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>
|
2003-02-21 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* sysdeps/x86_64/dl-machine.h (elf_machine_rela) <R_X86_64_PC32>:
|
* sysdeps/x86_64/dl-machine.h (elf_machine_rela) <R_X86_64_PC32>:
|
||||||
|
@ -138,7 +138,7 @@ tests = tst-attr1 tst-attr2 \
|
|||||||
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 \
|
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 \
|
||||||
tst-barrier1 tst-barrier2 tst-barrier3 \
|
tst-barrier1 tst-barrier2 tst-barrier3 \
|
||||||
tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
|
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-join1 tst-join2 tst-join3 tst-join4 tst-join5 \
|
||||||
tst-tsd1 tst-tsd2 \
|
tst-tsd1 tst-tsd2 \
|
||||||
tst-fork1 tst-fork2 tst-fork3 \
|
tst-fork1 tst-fork2 tst-fork3 \
|
||||||
|
141
nptl/tst-kill6.c
Normal file
141
nptl/tst-kill6.c
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
/* 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"
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -30,32 +30,34 @@ extern int __syscall_getegid32 (void);
|
|||||||
# if __ASSUME_32BITUIDS == 0
|
# if __ASSUME_32BITUIDS == 0
|
||||||
/* This variable is shared with all files that need to check for 32bit
|
/* This variable is shared with all files that need to check for 32bit
|
||||||
uids. */
|
uids. */
|
||||||
extern int __libc_missing_32bit_uids;
|
extern int __libc_missing_32bit_uids attribute_hidden;
|
||||||
# endif
|
# endif
|
||||||
#endif /* __NR_getegid32 */
|
#endif /* __NR_getegid32 */
|
||||||
|
|
||||||
gid_t
|
gid_t
|
||||||
__getegid (void)
|
__getegid (void)
|
||||||
{
|
{
|
||||||
|
INTERNAL_SYSCALL_DECL (err);
|
||||||
#if __ASSUME_32BITUIDS > 0
|
#if __ASSUME_32BITUIDS > 0
|
||||||
return INLINE_SYSCALL (getegid32, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (getegid32, err, 0);
|
||||||
#else
|
#else
|
||||||
# ifdef __NR_getegid32
|
# ifdef __NR_getegid32
|
||||||
if (__libc_missing_32bit_uids <= 0)
|
if (__libc_missing_32bit_uids <= 0)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int saved_errno = errno;
|
|
||||||
|
|
||||||
result = INLINE_SYSCALL (getegid32, 0);
|
result = INTERNAL_SYSCALL (getegid32, err, 0);
|
||||||
if (result == 0 || errno != ENOSYS)
|
if (! INTERNAL_SYSCALL_ERROR_P (result, err)
|
||||||
|
|| INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
__set_errno (saved_errno);
|
|
||||||
__libc_missing_32bit_uids = 1;
|
__libc_missing_32bit_uids = 1;
|
||||||
}
|
}
|
||||||
# endif /* __NR_getegid32 */
|
# endif /* __NR_getegid32 */
|
||||||
|
|
||||||
return INLINE_SYSCALL (getegid, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (getegid, err, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -30,32 +30,34 @@ extern int __syscall_geteuid32 (void);
|
|||||||
# if __ASSUME_32BITUIDS == 0
|
# if __ASSUME_32BITUIDS == 0
|
||||||
/* This variable is shared with all files that need to check for 32bit
|
/* This variable is shared with all files that need to check for 32bit
|
||||||
uids. */
|
uids. */
|
||||||
extern int __libc_missing_32bit_uids;
|
extern int __libc_missing_32bit_uids attribute_hidden;
|
||||||
# endif
|
# endif
|
||||||
#endif /* __NR_geteuid32 */
|
#endif /* __NR_geteuid32 */
|
||||||
|
|
||||||
uid_t
|
uid_t
|
||||||
__geteuid (void)
|
__geteuid (void)
|
||||||
{
|
{
|
||||||
|
INTERNAL_SYSCALL_DECL (err);
|
||||||
#if __ASSUME_32BITUIDS > 0
|
#if __ASSUME_32BITUIDS > 0
|
||||||
return INLINE_SYSCALL (geteuid32, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (geteuid32, err, 0);
|
||||||
#else
|
#else
|
||||||
# ifdef __NR_geteuid32
|
# ifdef __NR_geteuid32
|
||||||
if (__libc_missing_32bit_uids <= 0)
|
if (__libc_missing_32bit_uids <= 0)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int saved_errno = errno;
|
|
||||||
|
|
||||||
result = INLINE_SYSCALL (geteuid32, 0);
|
result = INTERNAL_SYSCALL (geteuid32, err, 0);
|
||||||
if (result == 0 || errno != ENOSYS)
|
if (! INTERNAL_SYSCALL_ERROR_P (result, err)
|
||||||
|
|| INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
__set_errno (saved_errno);
|
|
||||||
__libc_missing_32bit_uids = 1;
|
__libc_missing_32bit_uids = 1;
|
||||||
}
|
}
|
||||||
# endif /* __NR_geteuid32 */
|
# endif /* __NR_geteuid32 */
|
||||||
|
|
||||||
return INLINE_SYSCALL (geteuid, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (getugid, err, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -31,32 +31,34 @@ extern int __syscall_getgid32 (void);
|
|||||||
# if __ASSUME_32BITUIDS == 0
|
# if __ASSUME_32BITUIDS == 0
|
||||||
/* This variable is shared with all files that need to check for 32bit
|
/* This variable is shared with all files that need to check for 32bit
|
||||||
uids. */
|
uids. */
|
||||||
extern int __libc_missing_32bit_uids;
|
extern int __libc_missing_32bit_uids attribute_hidden;
|
||||||
# endif
|
# endif
|
||||||
#endif /* __NR_getgid32 */
|
#endif /* __NR_getgid32 */
|
||||||
|
|
||||||
gid_t
|
gid_t
|
||||||
__getgid (void)
|
__getgid (void)
|
||||||
{
|
{
|
||||||
|
INTERNAL_SYSCALL_DECL (err);
|
||||||
#if __ASSUME_32BITUIDS > 0
|
#if __ASSUME_32BITUIDS > 0
|
||||||
return INLINE_SYSCALL (getgid32, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (getgid32, err, 0);
|
||||||
#else
|
#else
|
||||||
# ifdef __NR_getgid32
|
# ifdef __NR_getgid32
|
||||||
if (__libc_missing_32bit_uids <= 0)
|
if (__libc_missing_32bit_uids <= 0)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int saved_errno = errno;
|
|
||||||
|
|
||||||
result = INLINE_SYSCALL (getgid32, 0);
|
result = INTERNAL_SYSCALL (getdid32, err, 0);
|
||||||
if (result == 0 || errno != ENOSYS)
|
if (! INTERNAL_SYSCALL_ERROR_P (result, err)
|
||||||
|
|| INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
__set_errno (saved_errno);
|
|
||||||
__libc_missing_32bit_uids = 1;
|
__libc_missing_32bit_uids = 1;
|
||||||
}
|
}
|
||||||
# endif /* __NR_getgid32 */
|
# endif /* __NR_getgid32 */
|
||||||
|
|
||||||
return INLINE_SYSCALL (getgid, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (getgid, err, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -34,32 +34,34 @@ extern int __syscall_getuid32 (void);
|
|||||||
-1 if libc does not know yet whether kernel has 32bit uids or not.
|
-1 if libc does not know yet whether kernel has 32bit uids or not.
|
||||||
0 if it does have them.
|
0 if it does have them.
|
||||||
1 if it does not 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
|
||||||
#endif /* __NR_getuid32 */
|
#endif /* __NR_getuid32 */
|
||||||
|
|
||||||
uid_t
|
uid_t
|
||||||
__getuid (void)
|
__getuid (void)
|
||||||
{
|
{
|
||||||
|
INTERNAL_SYSCALL_DECL (err);
|
||||||
#if __ASSUME_32BITUIDS > 0
|
#if __ASSUME_32BITUIDS > 0
|
||||||
return INLINE_SYSCALL (getuid32, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (getuid32, err, 0);
|
||||||
#else
|
#else
|
||||||
# ifdef __NR_getuid32
|
# ifdef __NR_getuid32
|
||||||
if (__libc_missing_32bit_uids <= 0)
|
if (__libc_missing_32bit_uids <= 0)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int saved_errno = errno;
|
|
||||||
|
|
||||||
result = INLINE_SYSCALL (getuid32, 0);
|
result = INTERNAL_SYSCALL (getuid32, err, 0);
|
||||||
if (result == 0 || errno != ENOSYS)
|
if (! INTERNAL_SYSCALL_ERROR_P (result, err)
|
||||||
|
|| INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
__set_errno (saved_errno);
|
|
||||||
__libc_missing_32bit_uids = 1;
|
__libc_missing_32bit_uids = 1;
|
||||||
}
|
}
|
||||||
# endif /* __NR_getuid32 */
|
# endif /* __NR_getuid32 */
|
||||||
|
|
||||||
return INLINE_SYSCALL (getuid, 0);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (getuid, err, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user