mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
tests: replace write by xwrite
Using write without cheks leads to warn unused result when __wur is enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
parent
a8c8889978
commit
026a84a54d
@ -7,6 +7,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
#ifndef O_NOATIME
|
#ifndef O_NOATIME
|
||||||
# define O_NOATIME 0
|
# define O_NOATIME 0
|
||||||
#endif
|
#endif
|
||||||
@ -22,7 +24,7 @@ do_test (void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -96,7 +97,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
/* Before closing the file, try using this file descriptor to open
|
/* Before closing the file, try using this file descriptor to open
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -98,7 +99,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
struct stat64 st1;
|
struct stat64 st1;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -106,7 +107,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
struct stat64 st1;
|
struct stat64 st1;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -94,7 +95,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
struct stat64 st1;
|
struct stat64 st1;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <support/test-driver.h>
|
#include <support/test-driver.h>
|
||||||
#include <support/temp_file.h>
|
#include <support/temp_file.h>
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
#ifndef struct_stat
|
#ifndef struct_stat
|
||||||
# define struct_stat struct stat64
|
# define struct_stat struct stat64
|
||||||
@ -114,7 +115,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
struct_stat st1;
|
struct_stat st1;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -94,7 +95,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
struct stat64 st1;
|
struct stat64 st1;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -94,7 +95,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
|
|
||||||
/* Before closing the file, try using this file descriptor to open
|
/* Before closing the file, try using this file descriptor to open
|
||||||
another file. This must fail. */
|
another file. This must fail. */
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -94,7 +95,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
struct stat64 st1;
|
struct stat64 st1;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -94,7 +95,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
struct stat64 st1;
|
struct stat64 st1;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void prepare (void);
|
static void prepare (void);
|
||||||
#define PREPARE(argc, argv) prepare ()
|
#define PREPARE(argc, argv) prepare ()
|
||||||
@ -94,7 +95,7 @@ do_test (void)
|
|||||||
puts ("file creation failed");
|
puts ("file creation failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
write (fd, "hello", 5);
|
xwrite (fd, "hello", 5);
|
||||||
close (fd);
|
close (fd);
|
||||||
puts ("file created");
|
puts ("file created");
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void do_prepare (void);
|
static void do_prepare (void);
|
||||||
#define PREPARE(argc, argv) do_prepare ()
|
#define PREPARE(argc, argv) do_prepare ()
|
||||||
static int do_test (void);
|
static int do_test (void);
|
||||||
@ -20,7 +22,7 @@ do_prepare (void)
|
|||||||
printf ("cannot create temporary file: %m\n");
|
printf ("cannot create temporary file: %m\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
write (fd, pattern, sizeof (pattern));
|
xwrite (fd, pattern, sizeof (pattern));
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void do_prepare (void);
|
static void do_prepare (void);
|
||||||
#define PREPARE(argc, argv) do_prepare ()
|
#define PREPARE(argc, argv) do_prepare ()
|
||||||
static int do_test (void);
|
static int do_test (void);
|
||||||
@ -20,7 +22,7 @@ do_prepare (void)
|
|||||||
printf ("cannot create temporary file: %m\n");
|
printf ("cannot create temporary file: %m\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
write (fd, pattern, sizeof (pattern));
|
xwrite (fd, pattern, sizeof (pattern));
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void do_prepare (void);
|
static void do_prepare (void);
|
||||||
#define PREPARE(argc, argv) do_prepare ()
|
#define PREPARE(argc, argv) do_prepare ()
|
||||||
static int do_test (void);
|
static int do_test (void);
|
||||||
@ -36,7 +38,7 @@ do_prepare (void)
|
|||||||
printf ("cannot create temporary file: %m\n");
|
printf ("cannot create temporary file: %m\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
write (fd, pattern, sizeof (pattern) - 1);
|
xwrite (fd, pattern, sizeof (pattern) - 1);
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void do_prepare (void);
|
static void do_prepare (void);
|
||||||
#define PREPARE(argc, argv) do_prepare ()
|
#define PREPARE(argc, argv) do_prepare ()
|
||||||
static int do_test (void);
|
static int do_test (void);
|
||||||
@ -20,7 +22,7 @@ do_prepare (void)
|
|||||||
printf ("cannot create temporary file: %m\n");
|
printf ("cannot create temporary file: %m\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
write (fd, "1!", 2);
|
xwrite (fd, "1!", 2);
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void do_prepare (void);
|
static void do_prepare (void);
|
||||||
#define PREPARE(argc, argv) do_prepare ()
|
#define PREPARE(argc, argv) do_prepare ()
|
||||||
static int do_test (void);
|
static int do_test (void);
|
||||||
@ -22,7 +24,7 @@ do_prepare (void)
|
|||||||
printf ("cannot create temporary file: %m\n");
|
printf ("cannot create temporary file: %m\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
write (fd, pattern, sizeof (pattern));
|
xwrite (fd, pattern, sizeof (pattern));
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static const char *command;
|
static const char *command;
|
||||||
static bool child;
|
static bool child;
|
||||||
static uintptr_t stack_chk_guard_copy;
|
static uintptr_t stack_chk_guard_copy;
|
||||||
@ -96,7 +98,7 @@ do_test (void)
|
|||||||
else if (ret != NULL)
|
else if (ret != NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
write (2, &stack_chk_guard_copy, sizeof (stack_chk_guard_copy));
|
xwrite (2, &stack_chk_guard_copy, sizeof (stack_chk_guard_copy));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthreaddef.h>
|
#include <pthreaddef.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
#define THE_SIG SIGUSR1
|
#define THE_SIG SIGUSR1
|
||||||
|
|
||||||
/* The stack size can be overriden. With a sufficiently large stack
|
/* The stack size can be overriden. With a sufficiently large stack
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <pthreaddef.h>
|
#include <pthreaddef.h>
|
||||||
#include <descr.h>
|
#include <descr.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
extern pthread_barrier_t b;
|
extern pthread_barrier_t b;
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ handler (int sig)
|
|||||||
{
|
{
|
||||||
if (sig != THE_SIG)
|
if (sig != THE_SIG)
|
||||||
{
|
{
|
||||||
write (STDOUT_FILENO, "wrong signal\n", 13);
|
xwrite (STDOUT_FILENO, "wrong signal\n", 13);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ handler (int sig)
|
|||||||
|
|
||||||
if (sem_post (&s) != 0)
|
if (sem_post (&s) != 0)
|
||||||
{
|
{
|
||||||
write (STDOUT_FILENO, "sem_post failed\n", 16);
|
xwrite (STDOUT_FILENO, "sem_post failed\n", 16);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,8 @@ do_test ()
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static pthread_barrier_t barrier;
|
static pthread_barrier_t barrier;
|
||||||
|
|
||||||
/* This function is intended to rack up both user and system time. */
|
/* This function is intended to rack up both user and system time. */
|
||||||
@ -55,7 +57,7 @@ chew_cpu (void *arg)
|
|||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
for (size_t j = 0; j < sizeof buf; ++j)
|
for (size_t j = 0; j < sizeof buf; ++j)
|
||||||
buf[j] = 0xbb;
|
buf[j] = 0xbb;
|
||||||
write (nullfd, (char *) buf, sizeof buf);
|
xwrite (nullfd, (char *) buf, sizeof buf);
|
||||||
close (nullfd);
|
close (nullfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
#define TEST_CLOCK CLOCK_PROCESS_CPUTIME_ID
|
#define TEST_CLOCK CLOCK_PROCESS_CPUTIME_ID
|
||||||
#define TEST_CLOCK_MISSING(clock) \
|
#define TEST_CLOCK_MISSING(clock) \
|
||||||
(setup_test () ? "process CPU clock timer support" : NULL)
|
(setup_test () ? "process CPU clock timer support" : NULL)
|
||||||
@ -29,7 +31,7 @@ chew_cpu (void *arg)
|
|||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
for (size_t j = 0; j < sizeof buf; ++j)
|
for (size_t j = 0; j < sizeof buf; ++j)
|
||||||
buf[j] = 0xbb;
|
buf[j] = 0xbb;
|
||||||
write (nullfd, (char *) buf, sizeof buf);
|
xwrite (nullfd, (char *) buf, sizeof buf);
|
||||||
close (nullfd);
|
close (nullfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static clockid_t worker_thread_clock;
|
static clockid_t worker_thread_clock;
|
||||||
|
|
||||||
#define TEST_CLOCK worker_thread_clock
|
#define TEST_CLOCK worker_thread_clock
|
||||||
@ -32,7 +34,7 @@ chew_cpu (void *arg)
|
|||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
for (size_t j = 0; j < sizeof buf; ++j)
|
for (size_t j = 0; j < sizeof buf; ++j)
|
||||||
buf[j] = 0xbb;
|
buf[j] = 0xbb;
|
||||||
write (nullfd, (char *) buf, sizeof buf);
|
xwrite (nullfd, (char *) buf, sizeof buf);
|
||||||
close (nullfd);
|
close (nullfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static clockid_t child_clock;
|
static clockid_t child_clock;
|
||||||
|
|
||||||
#define TEST_CLOCK child_clock
|
#define TEST_CLOCK child_clock
|
||||||
@ -33,7 +35,7 @@ chew_cpu (void)
|
|||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
for (size_t j = 0; j < sizeof buf; ++j)
|
for (size_t j = 0; j < sizeof buf; ++j)
|
||||||
buf[j] = 0xbb;
|
buf[j] = 0xbb;
|
||||||
write (nullfd, (char *) buf, sizeof buf);
|
xwrite (nullfd, (char *) buf, sizeof buf);
|
||||||
close (nullfd);
|
close (nullfd);
|
||||||
if (getppid () == 1)
|
if (getppid () == 1)
|
||||||
_exit (2);
|
_exit (2);
|
||||||
|
@ -1186,7 +1186,7 @@ main (int argc, char **argv)
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* Send the child's "outside" pid to it. */
|
/* Send the child's "outside" pid to it. */
|
||||||
write (pipes[1], &child, sizeof(child));
|
xwrite (pipes[1], &child, sizeof(child));
|
||||||
close (pipes[0]);
|
close (pipes[0]);
|
||||||
close (pipes[1]);
|
close (pipes[1]);
|
||||||
|
|
||||||
@ -1255,7 +1255,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
sprintf (tmp, "%lld %lld 1\n",
|
sprintf (tmp, "%lld %lld 1\n",
|
||||||
(long long) (be_su ? 0 : original_uid), (long long) original_uid);
|
(long long) (be_su ? 0 : original_uid), (long long) original_uid);
|
||||||
write (UMAP, tmp, strlen (tmp));
|
xwrite (UMAP, tmp, strlen (tmp));
|
||||||
xclose (UMAP);
|
xclose (UMAP);
|
||||||
|
|
||||||
/* We must disable setgroups () before we can map our groups, else we
|
/* We must disable setgroups () before we can map our groups, else we
|
||||||
@ -1264,7 +1264,7 @@ main (int argc, char **argv)
|
|||||||
if (GMAP >= 0)
|
if (GMAP >= 0)
|
||||||
{
|
{
|
||||||
/* We support kernels old enough to not have this. */
|
/* We support kernels old enough to not have this. */
|
||||||
write (GMAP, "deny\n", 5);
|
xwrite (GMAP, "deny\n", 5);
|
||||||
xclose (GMAP);
|
xclose (GMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1276,7 +1276,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
sprintf (tmp, "%lld %lld 1\n",
|
sprintf (tmp, "%lld %lld 1\n",
|
||||||
(long long) (be_su ? 0 : original_gid), (long long) original_gid);
|
(long long) (be_su ? 0 : original_gid), (long long) original_gid);
|
||||||
write (GMAP, tmp, strlen (tmp));
|
xwrite (GMAP, tmp, strlen (tmp));
|
||||||
xclose (GMAP);
|
xclose (GMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
|
pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
|
||||||
pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
bool exiting;
|
bool exiting;
|
||||||
@ -40,7 +42,7 @@ tf (void *id)
|
|||||||
while (!exiting)
|
while (!exiting)
|
||||||
{
|
{
|
||||||
if ((spins++ % 1000) == 0)
|
if ((spins++ % 1000) == 0)
|
||||||
write (fd, ".", 1);
|
xwrite (fd, ".", 1);
|
||||||
pthread_mutex_unlock (&lock);
|
pthread_mutex_unlock (&lock);
|
||||||
|
|
||||||
pthread_mutex_lock (&lock);
|
pthread_mutex_lock (&lock);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ do_test (void)
|
|||||||
|
|
||||||
unlink (tmp);
|
unlink (tmp);
|
||||||
|
|
||||||
write (fd, "foobar xyzzy", 12);
|
xwrite (fd, "foobar xyzzy", 12);
|
||||||
|
|
||||||
if (flock (fd, LOCK_EX | LOCK_NB) != 0)
|
if (flock (fd, LOCK_EX | LOCK_NB) != 0)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER;
|
||||||
@ -70,7 +71,7 @@ do_test (void)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 20; ++i)
|
for (i = 0; i < 20; ++i)
|
||||||
write (fd, "foobar xyzzy", 12);
|
xwrite (fd, "foobar xyzzy", 12);
|
||||||
|
|
||||||
pthread_barrier_t *b;
|
pthread_barrier_t *b;
|
||||||
b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
|
b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static int do_test (void);
|
static int do_test (void);
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ do_test (void)
|
|||||||
|
|
||||||
if (pthread_setspecific (keys[i], (const void *) (i + 100l)) != 0)
|
if (pthread_setspecific (keys[i], (const void *) (i + 100l)) != 0)
|
||||||
{
|
{
|
||||||
write (2, "setspecific failed\n", 19);
|
xwrite (2, "setspecific failed\n", 19);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,13 +61,13 @@ do_test (void)
|
|||||||
{
|
{
|
||||||
if (pthread_getspecific (keys[i]) != (void *) (i + 100l))
|
if (pthread_getspecific (keys[i]) != (void *) (i + 100l))
|
||||||
{
|
{
|
||||||
write (2, "getspecific failed\n", 19);
|
xwrite (2, "getspecific failed\n", 19);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pthread_key_delete (keys[i]) != 0)
|
if (pthread_key_delete (keys[i]) != 0)
|
||||||
{
|
{
|
||||||
write (2, "key_delete failed\n", 18);
|
xwrite (2, "key_delete failed\n", 18);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,13 +75,13 @@ do_test (void)
|
|||||||
/* Now it must be once again possible to allocate keys. */
|
/* Now it must be once again possible to allocate keys. */
|
||||||
if (pthread_key_create (&keys[0], NULL) != 0)
|
if (pthread_key_create (&keys[0], NULL) != 0)
|
||||||
{
|
{
|
||||||
write (2, "2nd key_create failed\n", 22);
|
xwrite (2, "2nd key_create failed\n", 22);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pthread_key_delete (keys[0]) != 0)
|
if (pthread_key_delete (keys[0]) != 0)
|
||||||
{
|
{
|
||||||
write (2, "2nd key_delete failed\n", 22);
|
xwrite (2, "2nd key_delete failed\n", 22);
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static sigset_t ss;
|
static sigset_t ss;
|
||||||
static pthread_barrier_t *b;
|
static pthread_barrier_t *b;
|
||||||
@ -105,7 +106,7 @@ do_test (void)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 20; ++i)
|
for (i = 0; i < 20; ++i)
|
||||||
write (fd, "foobar xyzzy", 12);
|
xwrite (fd, "foobar xyzzy", 12);
|
||||||
|
|
||||||
b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
|
b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED, fd, 0);
|
MAP_SHARED, fd, 0);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static sigset_t ss;
|
static sigset_t ss;
|
||||||
static pthread_barrier_t *b;
|
static pthread_barrier_t *b;
|
||||||
@ -111,7 +112,7 @@ do_test (void)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 20; ++i)
|
for (i = 0; i < 20; ++i)
|
||||||
write (fd, "foobar xyzzy", 12);
|
xwrite (fd, "foobar xyzzy", 12);
|
||||||
|
|
||||||
b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
|
b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED, fd, 0);
|
MAP_SHARED, fd, 0);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
notify_func1 (union sigval sigval)
|
notify_func1 (union sigval sigval)
|
||||||
@ -44,7 +45,7 @@ signal_func (int sig)
|
|||||||
{
|
{
|
||||||
static const char text[] = "signal_func\n";
|
static const char text[] = "signal_func\n";
|
||||||
signal (sig, signal_func);
|
signal (sig, signal_func);
|
||||||
write (STDOUT_FILENO, text, sizeof text - 1);
|
xwrite (STDOUT_FILENO, text, sizeof text - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include <support/xunistd.h>
|
||||||
|
|
||||||
/* This function is intended to rack up both user and system time. */
|
/* This function is intended to rack up both user and system time. */
|
||||||
static void
|
static void
|
||||||
chew_cpu (void)
|
chew_cpu (void)
|
||||||
@ -41,7 +43,7 @@ chew_cpu (void)
|
|||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
for (size_t j = 0; j < sizeof buf; ++j)
|
for (size_t j = 0; j < sizeof buf; ++j)
|
||||||
buf[j] = 0xbb;
|
buf[j] = 0xbb;
|
||||||
write (nullfd, (char *) buf, sizeof buf);
|
xwrite (nullfd, (char *) buf, sizeof buf);
|
||||||
close (nullfd);
|
close (nullfd);
|
||||||
if (getppid () == 1)
|
if (getppid () == 1)
|
||||||
_exit (2);
|
_exit (2);
|
||||||
|
Loading…
Reference in New Issue
Block a user