diff options
Diffstat (limited to 'rt')
66 files changed, 232 insertions, 100 deletions
@@ -1 +1,2 @@ nptl +htl diff --git a/rt/Makefile b/rt/Makefile index cfa68379c5..6d6b896ee9 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1997-2016 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 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 @@ -53,16 +53,18 @@ tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \ tst-timer3 tst-timer4 tst-timer5 \ tst-cpuclock1 tst-cpuclock2 \ tst-cputimer1 tst-cputimer2 tst-cputimer3 \ - tst-clock2 + tst-clock2 tst-shm-cancel extra-libs := librt extra-libs-others := $(extra-libs) include ../Rules -CFLAGS-aio_suspend.c = -fexceptions -CFLAGS-clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables -CFLAGS-librt-cancellation.c = -fasynchronous-unwind-tables +CFLAGS-aio_suspend.c += -fexceptions +CFLAGS-mq_timedreceive.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-mq_timedsend.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-clock_nanosleep.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-librt-cancellation.c += -fasynchronous-unwind-tables LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2016 Free Software Foundation, Inc. +/* Copyright (C) 1996-2018 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 @@ -24,10 +24,9 @@ #include <features.h> #include <sys/types.h> -#define __need_sigevent_t -#include <bits/siginfo.h> -#define __need_timespec -#include <time.h> +#include <bits/types/sigevent_t.h> +#include <bits/sigevent-consts.h> +#include <bits/types/struct_timespec.h> __BEGIN_DECLS diff --git a/rt/aio_cancel.c b/rt/aio_cancel.c index caf7d7441d..5b866fe620 100644 --- a/rt/aio_cancel.c +++ b/rt/aio_cancel.c @@ -1,5 +1,5 @@ /* Cancel requests associated with given file descriptor. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/aio_error.c b/rt/aio_error.c index 52bd85ca1d..b06ef7b84e 100644 --- a/rt/aio_error.c +++ b/rt/aio_error.c @@ -1,5 +1,5 @@ /* Return error status of asynchronous I/O request. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/rt/aio_fsync.c b/rt/aio_fsync.c index e532509800..7999672c53 100644 --- a/rt/aio_fsync.c +++ b/rt/aio_fsync.c @@ -1,5 +1,5 @@ /* Synchronize I/O in given file descriptor. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/aio_misc.c b/rt/aio_misc.c index c5502d36a8..51af173e14 100644 --- a/rt/aio_misc.c +++ b/rt/aio_misc.c @@ -1,5 +1,5 @@ /* Handle general operations. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/aio_notify.c b/rt/aio_notify.c index 876e170033..8ee822c1c0 100644 --- a/rt/aio_notify.c +++ b/rt/aio_notify.c @@ -1,5 +1,5 @@ /* Notify initiator of AIO request. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/aio_read.c b/rt/aio_read.c index e60837694d..15572fe9e2 100644 --- a/rt/aio_read.c +++ b/rt/aio_read.c @@ -1,5 +1,5 @@ /* Asynchronous read. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/aio_return.c b/rt/aio_return.c index 520870faf7..f8da674e03 100644 --- a/rt/aio_return.c +++ b/rt/aio_return.c @@ -1,5 +1,5 @@ /* Return exit value of asynchronous I/O request. - Copyright (C) 1997-2016 Free Software Foundation, Inc. + Copyright (C) 1997-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/rt/aio_sigqueue.c b/rt/aio_sigqueue.c index 0297eca0d7..af16d080e0 100644 --- a/rt/aio_sigqueue.c +++ b/rt/aio_sigqueue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 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 @@ -22,6 +22,7 @@ #include <aio_misc.h> int +attribute_hidden __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid) { __set_errno (ENOSYS); diff --git a/rt/aio_suspend.c b/rt/aio_suspend.c index 12f70573be..b33397132a 100644 --- a/rt/aio_suspend.c +++ b/rt/aio_suspend.c @@ -1,5 +1,5 @@ /* Suspend until termination of a requests. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/aio_write.c b/rt/aio_write.c index 242b6d624e..d986b85612 100644 --- a/rt/aio_write.c +++ b/rt/aio_write.c @@ -1,5 +1,5 @@ /* Asynchronous write. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/bits/mqueue2.h b/rt/bits/mqueue2.h index 712c8e295a..7d84bda6af 100644 --- a/rt/bits/mqueue2.h +++ b/rt/bits/mqueue2.h @@ -1,5 +1,5 @@ /* Checking macros for mq functions. - Copyright (C) 2007-2016 Free Software Foundation, Inc. + Copyright (C) 2007-2018 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 diff --git a/rt/clock-compat.c b/rt/clock-compat.c index dc69e4a161..f816973c05 100644 --- a/rt/clock-compat.c +++ b/rt/clock-compat.c @@ -1,5 +1,5 @@ /* ABI compatibility redirects for clock_* symbols in librt. - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 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 @@ -28,13 +28,9 @@ #include <time.h> #if HAVE_IFUNC -# define COMPAT_REDIRECT(name, proto, arglist) \ - __typeof (name) *name##_ifunc (void) asm (#name); \ - __typeof (name) *name##_ifunc (void) \ - { \ - return &__##name; \ - } \ - asm (".type " #name ", %gnu_indirect_function"); +# undef INIT_ARCH +# define INIT_ARCH() +# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) #else # define COMPAT_REDIRECT(name, proto, arglist) \ int \ @@ -45,21 +41,21 @@ #endif COMPAT_REDIRECT (clock_getres, - (clockid_t clock_id, struct timespec *res), - (clock_id, res)) + (clockid_t clock_id, struct timespec *res), + (clock_id, res)) COMPAT_REDIRECT (clock_gettime, - (clockid_t clock_id, struct timespec *tp), - (clock_id, tp)) + (clockid_t clock_id, struct timespec *tp), + (clock_id, tp)) COMPAT_REDIRECT (clock_settime, - (clockid_t clock_id, const struct timespec *tp), - (clock_id, tp)) + (clockid_t clock_id, const struct timespec *tp), + (clock_id, tp)) COMPAT_REDIRECT (clock_getcpuclockid, - (pid_t pid, clockid_t *clock_id), - (pid, clock_id)) + (pid_t pid, clockid_t *clock_id), + (pid, clock_id)) COMPAT_REDIRECT (clock_nanosleep, - (clockid_t clock_id, int flags, - const struct timespec *req, - struct timespec *rem), - (clock_id, flags, req, rem)) + (clockid_t clock_id, int flags, + const struct timespec *req, + struct timespec *rem), + (clock_id, flags, req, rem)) #endif diff --git a/rt/clock_getcpuclockid.c b/rt/clock_getcpuclockid.c index 08b0e0d5f9..6bc42a0863 100644 --- a/rt/clock_getcpuclockid.c +++ b/rt/clock_getcpuclockid.c @@ -1,5 +1,5 @@ /* Get a clockid_t for the process CPU clock of a given process. Generic. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/clock_getres.c b/rt/clock_getres.c index ff3625ffff..816f7b2a90 100644 --- a/rt/clock_getres.c +++ b/rt/clock_getres.c @@ -1,5 +1,5 @@ /* Get the resolution of a clock. Stub version. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 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 diff --git a/rt/clock_gettime.c b/rt/clock_gettime.c index ea4279239b..30a012473f 100644 --- a/rt/clock_gettime.c +++ b/rt/clock_gettime.c @@ -1,5 +1,5 @@ /* Get the current value of a clock. Stub version. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 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 diff --git a/rt/clock_nanosleep.c b/rt/clock_nanosleep.c index bd8cff44fd..15aa6f7c4f 100644 --- a/rt/clock_nanosleep.c +++ b/rt/clock_nanosleep.c @@ -1,5 +1,5 @@ /* High-resolution sleep with the specified clock. Stub version. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/clock_settime.c b/rt/clock_settime.c index 152b50b19c..0b6d4b2a2a 100644 --- a/rt/clock_settime.c +++ b/rt/clock_settime.c @@ -1,5 +1,5 @@ /* Set a clock to a given value. Stub version. - Copyright (C) 1999-2016 Free Software Foundation, Inc. + Copyright (C) 1999-2018 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 diff --git a/rt/get_clockfreq.c b/rt/get_clockfreq.c index a85d03def3..e695a6018c 100644 --- a/rt/get_clockfreq.c +++ b/rt/get_clockfreq.c @@ -1,5 +1,5 @@ /* Get frequency of the system processor. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/lio_listio.c b/rt/lio_listio.c index 1cfda141c1..d8d95a9015 100644 --- a/rt/lio_listio.c +++ b/rt/lio_listio.c @@ -1,5 +1,5 @@ /* Enqueue a list of read or write requests. Stub version. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/mq_close.c b/rt/mq_close.c index 996cad42ec..9c22b708d1 100644 --- a/rt/mq_close.c +++ b/rt/mq_close.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_getattr.c b/rt/mq_getattr.c index f98be8c6de..6d423cf06b 100644 --- a/rt/mq_getattr.c +++ b/rt/mq_getattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_notify.c b/rt/mq_notify.c index a66013bec1..9c4f61eb59 100644 --- a/rt/mq_notify.c +++ b/rt/mq_notify.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_open.c b/rt/mq_open.c index fb7a9bc636..4ad985225d 100644 --- a/rt/mq_open.c +++ b/rt/mq_open.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_receive.c b/rt/mq_receive.c index 7235d415ad..318acf28cb 100644 --- a/rt/mq_receive.c +++ b/rt/mq_receive.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_send.c b/rt/mq_send.c index e42a9313ad..ee62e30f1e 100644 --- a/rt/mq_send.c +++ b/rt/mq_send.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_setattr.c b/rt/mq_setattr.c index 972cbdac28..25d4759ec8 100644 --- a/rt/mq_setattr.c +++ b/rt/mq_setattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_timedreceive.c b/rt/mq_timedreceive.c index a87cd8d505..2c246f0a1d 100644 --- a/rt/mq_timedreceive.c +++ b/rt/mq_timedreceive.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_timedsend.c b/rt/mq_timedsend.c index 1a94f51d7e..74779dc9e5 100644 --- a/rt/mq_timedsend.c +++ b/rt/mq_timedsend.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mq_unlink.c b/rt/mq_unlink.c index a783ecebc3..11031449e9 100644 --- a/rt/mq_unlink.c +++ b/rt/mq_unlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 diff --git a/rt/mqueue.h b/rt/mqueue.h index 9700cdc93f..5f354b4d76 100644 --- a/rt/mqueue.h +++ b/rt/mqueue.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 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 @@ -21,10 +21,8 @@ #include <features.h> #include <sys/types.h> #include <fcntl.h> -#define __need_sigevent_t -#include <bits/siginfo.h> -#define __need_timespec -#include <time.h> +#include <bits/types/sigevent_t.h> +#include <bits/types/struct_timespec.h> /* Get the definition of mqd_t and struct mq_attr. */ #include <bits/mqueue.h> diff --git a/rt/shm_open.c b/rt/shm_open.c index cc6ae0e316..777f0469a4 100644 --- a/rt/shm_open.c +++ b/rt/shm_open.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 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 diff --git a/rt/shm_unlink.c b/rt/shm_unlink.c index 8a7dfa3035..96a210b9d0 100644 --- a/rt/shm_unlink.c +++ b/rt/shm_unlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 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 diff --git a/rt/timer_create.c b/rt/timer_create.c index 418124f830..19aae41651 100644 --- a/rt/timer_create.c +++ b/rt/timer_create.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 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 diff --git a/rt/timer_delete.c b/rt/timer_delete.c index fce07e2772..ff7a60155e 100644 --- a/rt/timer_delete.c +++ b/rt/timer_delete.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 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 diff --git a/rt/timer_getoverr.c b/rt/timer_getoverr.c index 09ac329dd1..7f38e661fd 100644 --- a/rt/timer_getoverr.c +++ b/rt/timer_getoverr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 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 diff --git a/rt/timer_gettime.c b/rt/timer_gettime.c index 9f9f7611cc..16a2ec7b16 100644 --- a/rt/timer_gettime.c +++ b/rt/timer_gettime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 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 diff --git a/rt/timer_settime.c b/rt/timer_settime.c index 1fb1f73741..d27c753e96 100644 --- a/rt/timer_settime.c +++ b/rt/timer_settime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 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 diff --git a/rt/tst-aio.c b/rt/tst-aio.c index 9ca377546f..f3b51d2183 100644 --- a/rt/tst-aio.c +++ b/rt/tst-aio.c @@ -1,5 +1,5 @@ /* Tests for AIO in librt. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -51,7 +51,7 @@ do_prepare (int argc, char *argv[]) size_t name_len; name_len = strlen (test_dir); - name = malloc (name_len + sizeof ("/aioXXXXXX")); + name = xmalloc (name_len + sizeof ("/aioXXXXXX")); mempcpy (mempcpy (name, test_dir, name_len), "/aioXXXXXX", sizeof ("/aioXXXXXX")); diff --git a/rt/tst-aio2.c b/rt/tst-aio2.c index 436988fbf4..1d926431c8 100644 --- a/rt/tst-aio2.c +++ b/rt/tst-aio2.c @@ -1,5 +1,5 @@ /* Test for notification mechanism in lio_listio. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000. diff --git a/rt/tst-aio3.c b/rt/tst-aio3.c index 9838e79aa5..ca2e6879ad 100644 --- a/rt/tst-aio3.c +++ b/rt/tst-aio3.c @@ -1,5 +1,5 @@ /* Test for notification mechanism in lio_listio. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/tst-aio4.c b/rt/tst-aio4.c index 90a5b7f42d..a86496b432 100644 --- a/rt/tst-aio4.c +++ b/rt/tst-aio4.c @@ -1,5 +1,5 @@ /* Test for completion signal handling. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/tst-aio5.c b/rt/tst-aio5.c index 0484147d59..20182a205c 100644 --- a/rt/tst-aio5.c +++ b/rt/tst-aio5.c @@ -1,5 +1,5 @@ /* Test for completion thread handling. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/tst-aio6.c b/rt/tst-aio6.c index 50dcf9dacd..886b2d81c3 100644 --- a/rt/tst-aio6.c +++ b/rt/tst-aio6.c @@ -1,5 +1,5 @@ /* Test for timeout handling. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/tst-aio64.c b/rt/tst-aio64.c index f67485c878..f572fad1dc 100644 --- a/rt/tst-aio64.c +++ b/rt/tst-aio64.c @@ -1,5 +1,5 @@ /* Tests for 64bit AIO in librt. - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -52,7 +52,7 @@ do_prepare (int argc, char *argv[]) size_t name_len; name_len = strlen (test_dir); - name = malloc (name_len + sizeof ("/aioXXXXXX")); + name = xmalloc (name_len + sizeof ("/aioXXXXXX")); mempcpy (mempcpy (name, test_dir, name_len), "/aioXXXXXX", sizeof ("/aioXXXXXX")); diff --git a/rt/tst-aio7.c b/rt/tst-aio7.c index db310d71ed..e0df6b0aac 100644 --- a/rt/tst-aio7.c +++ b/rt/tst-aio7.c @@ -1,5 +1,5 @@ /* Test for AIO POSIX compliance. - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2018 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 diff --git a/rt/tst-clock.c b/rt/tst-clock.c index bda2d4cd09..bec76d0152 100644 --- a/rt/tst-clock.c +++ b/rt/tst-clock.c @@ -1,5 +1,5 @@ /* Test program for POSIX clock_* functions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000. diff --git a/rt/tst-clock_nanosleep.c b/rt/tst-clock_nanosleep.c index 784ed515f5..eb2b906c07 100644 --- a/rt/tst-clock_nanosleep.c +++ b/rt/tst-clock_nanosleep.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2016 Free Software Foundation, Inc. +/* Copyright (C) 2003-2018 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 diff --git a/rt/tst-cpuclock1.c b/rt/tst-cpuclock1.c index 0bd78a074d..f6d76e3614 100644 --- a/rt/tst-cpuclock1.c +++ b/rt/tst-cpuclock1.c @@ -1,5 +1,5 @@ /* Test program for process CPU clocks. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 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 diff --git a/rt/tst-cpuclock2.c b/rt/tst-cpuclock2.c index ebcb73c58e..f57cfb4a0c 100644 --- a/rt/tst-cpuclock2.c +++ b/rt/tst-cpuclock2.c @@ -1,5 +1,5 @@ /* Test program for process and thread CPU clocks. - Copyright (C) 2005-2016 Free Software Foundation, Inc. + Copyright (C) 2005-2018 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 diff --git a/rt/tst-mqueue.h b/rt/tst-mqueue.h index f3e5b6655e..6e84985a8a 100644 --- a/rt/tst-mqueue.h +++ b/rt/tst-mqueue.h @@ -1,5 +1,5 @@ /* Common code for message queue passing tests. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-mqueue1.c b/rt/tst-mqueue1.c index 353419cf0b..5138d95e19 100644 --- a/rt/tst-mqueue1.c +++ b/rt/tst-mqueue1.c @@ -1,5 +1,5 @@ /* Test message queue passing. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-mqueue2.c b/rt/tst-mqueue2.c index f673f47872..bc15e2907f 100644 --- a/rt/tst-mqueue2.c +++ b/rt/tst-mqueue2.c @@ -1,5 +1,5 @@ /* Test message queue passing. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-mqueue3.c b/rt/tst-mqueue3.c index 9b3cca63c4..314525707b 100644 --- a/rt/tst-mqueue3.c +++ b/rt/tst-mqueue3.c @@ -1,5 +1,5 @@ /* Test SIGEV_THREAD handling for POSIX message queues. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. diff --git a/rt/tst-mqueue4.c b/rt/tst-mqueue4.c index a798b34c5e..4910755643 100644 --- a/rt/tst-mqueue4.c +++ b/rt/tst-mqueue4.c @@ -1,5 +1,5 @@ /* Test message queue passing. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. @@ -23,6 +23,7 @@ #include <limits.h> #include <signal.h> #include <stdio.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c index 25042bcc9f..e96d7c3dc5 100644 --- a/rt/tst-mqueue5.c +++ b/rt/tst-mqueue5.c @@ -1,5 +1,5 @@ /* Test mq_notify. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c index ed665b29af..cd11863bdf 100644 --- a/rt/tst-mqueue6.c +++ b/rt/tst-mqueue6.c @@ -1,5 +1,5 @@ /* Test mq_notify. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-mqueue7.c b/rt/tst-mqueue7.c index ea6bc7aa0f..9bbf2461b2 100644 --- a/rt/tst-mqueue7.c +++ b/rt/tst-mqueue7.c @@ -1,5 +1,5 @@ /* Test all open message queues descriptors are closed during exec*. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-mqueue8.c b/rt/tst-mqueue8.c index 8e95841c51..ae23ca9739 100644 --- a/rt/tst-mqueue8.c +++ b/rt/tst-mqueue8.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-mqueue9.c b/rt/tst-mqueue9.c index b40860f9f4..6b959242fd 100644 --- a/rt/tst-mqueue9.c +++ b/rt/tst-mqueue9.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/rt/tst-shm-cancel.c b/rt/tst-shm-cancel.c new file mode 100644 index 0000000000..acea6bfcad --- /dev/null +++ b/rt/tst-shm-cancel.c @@ -0,0 +1,130 @@ +/* Test for shm_open cancellation handling: BZ #18243. + Copyright (C) 2016-2018 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 + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <sys/mman.h> +#include <semaphore.h> +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include <stdlib.h> + +static sem_t sem; /* Use to sync with thread start. */ +static const char shm_name[] = "/glibc-shm_open-cancel"; + +static void +remove_shm (int status, void *arg) +{ + shm_unlink (shm_name); +} + +static void * +tf (void *arg) +{ + pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, 0); + + if (sem_wait (&sem) != 0) + { + printf ("error: sem_wait failed: %m"); + exit (1); + } + + if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0) != 0) + { + printf ("error: pthread_setcancelstate failed: %m"); + exit (1); + } + + /* Neither sem_unlink or sem_open should act on thread cancellation. */ + shm_unlink (shm_name); + on_exit (remove_shm, NULL); + + int fd = shm_open (shm_name, O_CREAT, 0600); + if (fd == -1) + { + int exit_code; + if (errno == ENOSYS || errno == EACCES) + exit_code = 77; + else + exit_code = 1; + exit (exit_code); + } + + if (pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, 0) != 0) + { + printf ("error: pthread_setcancelstate failed: %m"); + exit (1); + } + + if (close (fd) != 0) + { + printf ("error: pthread_setcancelstate failed: %m"); + exit (1); + } + + return NULL; +} + +static int +do_test (void) +{ + pthread_t td; + + if (sem_init (&sem, 0, 0)) + { + printf ("error: sem_init failed: %m\n"); + exit (1); + } + + if (pthread_create (&td, NULL, tf, NULL) != 0) + { + printf ("error: pthread_create failed: %m\n"); + exit (1); + } + + if (pthread_cancel (td) != 0) + { + printf ("error: pthread_cancel failed: %m\n"); + exit (1); + } + + if (sem_post (&sem) != 0) + { + printf ("error: sem_post failed: %m\n"); + exit (1); + } + + void *r; + if (pthread_join (td, &r) != 0) + { + printf ("error: pthread_join failed: %m\n"); + exit (1); + } + + if (r == PTHREAD_CANCELED) + { + puts ("error: pthread_join returned PTHREAD_CANCELED"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include <test-skeleton.c> diff --git a/rt/tst-shm.c b/rt/tst-shm.c index 36fb9ebcd0..618147b8cc 100644 --- a/rt/tst-shm.c +++ b/rt/tst-shm.c @@ -1,5 +1,5 @@ /* Test program for POSIX shm_* functions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000. @@ -199,9 +199,13 @@ do_test (void) return (!WIFEXITED (status1) || WEXITSTATUS (status1) != 0 || !WIFEXITED (status2) || WEXITSTATUS (status2) != 0); } -#define TEST_FUNCTION do_test () -#define CLEANUP_HANDLER shm_unlink ("/glibc-shm-test"); +static void +cleanup_handler (void) +{ + shm_unlink ("/glibc-shm-test"); +} +#define CLEANUP_HANDLER cleanup_handler -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/rt/tst-timer.c b/rt/tst-timer.c index 4ada836eae..776e222427 100644 --- a/rt/tst-timer.c +++ b/rt/tst-timer.c @@ -1,5 +1,5 @@ /* Tests for POSIX timer implementation. Dummy version. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 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 diff --git a/rt/tst-timer4.c b/rt/tst-timer4.c index 262c2d9c89..80e3051379 100644 --- a/rt/tst-timer4.c +++ b/rt/tst-timer4.c @@ -1,5 +1,5 @@ /* Tests for POSIX timer implementation. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004 |