@@ -17,5 +17,12 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define SIGACTION_FLAGS SA_SIGINFO
-#include <debug/tst-backtrace5.c>
+#include <signal.h>
+
+#ifdef SA_SIGINFO
+# define SIGACTION_FLAGS SA_SIGINFO
+# include <debug/tst-backtrace5.c>
+#else
+# define TEST_FUNCTION 0
+# include "../test-skeleton.c"
+#endif
@@ -6,6 +6,9 @@
#include <stdbool.h>
#include <string.h>
+#ifndef O_NOATIME
+# define O_NOATIME 0
+#endif
static int
do_test (void)
@@ -23,8 +23,6 @@ do_test (void)
int ch;
struct stat st1;
struct stat st2;
- struct statvfs sv;
- int e;
buf = (char *) malloc (strlen (test_dir) + sizeof "/tst-atime.XXXXXX");
if (buf == NULL)
@@ -44,7 +42,8 @@ do_test (void)
#ifdef ST_NOATIME
/* Make sure the filesystem doesn't have the noatime option set. If
statvfs is not available just continue. */
- e = fstatvfs (fd, &sv);
+ struct statvfs sv;
+ int e = fstatvfs (fd, &sv);
if (e != ENOSYS)
{
if (e != 0)
@@ -43,7 +43,7 @@ endif
subdir-dirs = programs
vpath %.c programs
-tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname
+tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname tst-getlogin
# Build the -lutil library with these extra functions.
extra-libs := libutil
similarity index 100%
rename from posix/tst-getlogin.c
rename to login/tst-getlogin.c
@@ -31,8 +31,6 @@ do_test (void)
}
sa.sa_handler = SIG_IGN;
- sa.sa_flags = SA_NOCLDWAIT;
-
if (sigaction (SIGCHLD, &sa, NULL) != 0)
{
puts ("2nd sigaction failed");
@@ -229,7 +229,7 @@ tests = tst-typesizes \
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \
tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
- tst-align tst-align2 tst-align3 \
+ tst-align tst-align3 \
tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
tst-basic7 \
tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
@@ -269,7 +269,7 @@ tests = tst-typesizes \
tst-backtrace1 \
tst-abstime \
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
- tst-getpid1 tst-getpid2 tst-getpid3 \
+ tst-getpid3 \
tst-setuid3 \
tst-initializers1 $(addprefix tst-initializers1-,c89 gnu89 c99 gnu99) \
tst-bad-schedattr
@@ -463,11 +463,6 @@ tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
tst-umask1-ARGS = $(objpfx)tst-umask1.temp
-# In this test, we create a CLONE_VM "thread" that shares TLS storage
-# with the original thread. Both threads then race in ld.so with lazy PLT
-# resolution. Avoid this race by disabling lazy binding. BZ #11214.
-tst-getpid2-ENV = LD_BIND_NOW=1
-
$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)
LDFLAGS-tst-atfork2 = -rdynamic
tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
@@ -227,6 +227,7 @@ do_test (void)
if (do_one_test ())
return 1;
+#ifdef SA_SIGINFO
sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
@@ -254,6 +255,7 @@ do_test (void)
puts ("sa_flags = SA_SIGINFO|SA_ONSTACK test");
if (do_one_test ())
return 1;
+#endif
return 0;
}
@@ -257,6 +257,7 @@ do_test (void)
if (do_one_test ())
return 1;
+#ifdef SA_SIGINFO
sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
@@ -284,6 +285,7 @@ do_test (void)
puts ("sa_flags = SA_SIGINFO|SA_ONSTACK test");
if (do_one_test ())
return 1;
+#endif
return 0;
}
@@ -11,6 +11,7 @@ static pthread_t th2;
static void *
tf2 (void *arg)
{
+#ifdef SIGCANCEL
sigset_t mask;
if (pthread_sigmask (SIG_SETMASK, NULL, &mask) != 0)
{
@@ -22,6 +23,7 @@ tf2 (void *arg)
puts ("SIGCANCEL blocked in new thread");
exit (1);
}
+#endif
/* Sync with the main thread so that we do not test anything else. */
int e = pthread_barrier_wait (&b);
@@ -40,16 +40,11 @@ do_test (void)
array. Mark the return value as volatile so that it gets reloaded on
return. */
volatile int ret = 0;
- struct sigaction sa;
- sa.sa_handler = sig_handler;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_SIGINFO;
-
- if (sigaction (SIGSEGV, &sa, 0))
+ if (signal (SIGSEGV, &sig_handler) == SIG_ERR)
{
- perror ("installing SIGSEGV handler\n");
- exit (1);
+ perror ("installing SIGSEGV handler");
+ return 1;
}
puts ("Attempting to sprintf to null ptr");
@@ -22,15 +22,15 @@
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
-#include <sys/syscall.h>
-#define wait_code() \
- do { \
- struct timespec ts = { .tv_sec = 0, .tv_nsec = 200000000 }; \
- while (syscall (__NR_nanosleep, &ts, &ts) < 0) \
- /* nothing */; \
- } while (0)
+static void
+wait_code (void)
+{
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 200000000 };
+ while (nanosleep (&ts, &ts) < 0)
+ ;
+}
#ifdef WAIT_IN_CHILD
@@ -21,6 +21,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
int
@@ -28,7 +29,7 @@ do_test (void)
{
/* XXX This test might require architecture and system specific changes.
There is no guarantee that this signal number is invalid. */
- int e = pthread_kill (pthread_self (), SIGRTMAX + 10);
+ int e = pthread_kill (pthread_self (), INT_MAX);
if (e == 0)
{
puts ("kill didn't failed");
@@ -12,7 +12,11 @@ useless (void)
{
pthread_t th;
pthread_create (&th, 0, (void *(*) (void *)) useless, 0);
+ int result = 0;
+#ifdef SIGRTMIN
/* This is to check __libc_current_sigrt* can be used in statically
linked apps. */
- return SIGRTMIN;
+ result = SIGRTMIN;
+#endif
+ return result;
}
@@ -27,6 +27,7 @@ do_test (void)
{
int result = 0;
+#ifdef SIGCANCEL
errno = 0;
if (sigaction (SIGCANCEL, NULL, NULL) == 0)
{
@@ -38,7 +39,9 @@ do_test (void)
puts ("sigaction(SIGCANCEL) did not set errno to EINVAL");
result = 1;
}
+#endif
+#ifdef SIGSETXID
errno = 0;
if (sigaction (SIGSETXID, NULL, NULL) == 0)
{
@@ -50,6 +53,7 @@ do_test (void)
puts ("sigaction(SIGSETXID) did not set errno to EINVAL");
result = 1;
}
+#endif
return result;
}
@@ -64,7 +64,7 @@ routines := \
aux := init-posix environ
tests := tstgetopt testfnm runtests runptests \
tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
- tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
+ tst-mmap tst-getaddrinfo tst-truncate \
tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
@@ -30,9 +30,8 @@ do_test (void)
itval.it_value.tv_nsec = 0;
sigev.sigev_notify = SIGEV_THREAD;
- sigev.sigev_signo = SIGRTMIN;
sigev.sigev_notify_function = thread;
- sigev.sigev_notify_attributes = 0;
+ sigev.sigev_notify_attributes = NULL;
sigev.sigev_value.sival_ptr = (void *) &timerId;
for (i = 0; i < 100; i++)
@@ -196,5 +196,10 @@ CFLAGS-gai.c += -DNEED_NETLINK
endif
ifeq ($(subdir),nptl)
-tests += tst-setgetname
+tests += tst-setgetname tst-align-clone tst-getpid1 tst-getpid2
+
+# In this test, we create a CLONE_VM "thread" that shares TLS storage
+# with the original thread. Both threads then race in ld.so with lazy PLT
+# resolution. Avoid this race by disabling lazy binding. BZ #11214.
+tst-getpid2-ENV = LD_BIND_NOW=1
endif
similarity index 100%
rename from nptl/tst-align2.c
rename to sysdeps/unix/sysv/linux/tst-align-clone.c
similarity index 100%
rename from nptl/tst-getpid1.c
rename to sysdeps/unix/sysv/linux/tst-getpid1.c
similarity index 100%
rename from nptl/tst-getpid2.c
rename to sysdeps/unix/sysv/linux/tst-getpid2.c