[CRIU] [PATCH] zdtm: replace err() on pr_perror()
Andrey Vagin
avagin at openvz.org
Tue Oct 20 08:10:33 PDT 2015
From: Andrew Vagin <avagin at openvz.org>
There is an another err() in glibc
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
test/zdtm/lib/lock.c | 6 +--
test/zdtm/lib/msg.c | 4 +-
test/zdtm/lib/tcp.c | 14 +++----
test/zdtm/lib/test.c | 28 ++++++-------
test/zdtm/lib/zdtmtst.h | 2 +-
test/zdtm/live/static/aio00.c | 2 +-
test/zdtm/live/static/bind-mount.c | 8 ++--
test/zdtm/live/static/caps00.c | 10 ++---
test/zdtm/live/static/cgroup00.c | 10 ++---
test/zdtm/live/static/cgroup01.c | 10 ++---
test/zdtm/live/static/cgroup02.c | 10 ++---
test/zdtm/live/static/child_opened_proc.c | 10 ++---
test/zdtm/live/static/chroot-file.c | 10 ++---
test/zdtm/live/static/chroot.c | 8 ++--
test/zdtm/live/static/clean_mntns.c | 4 +-
test/zdtm/live/static/cmdlinenv00.c | 2 +-
test/zdtm/live/static/console.c | 8 ++--
test/zdtm/live/static/cow00.c | 14 +++----
test/zdtm/live/static/cow01.c | 36 ++++++++--------
test/zdtm/live/static/cwd00.c | 12 +++---
test/zdtm/live/static/cwd01.c | 16 +++----
test/zdtm/live/static/cwd02.c | 12 +++---
test/zdtm/live/static/deleted_dev.c | 6 +--
test/zdtm/live/static/deleted_unix_sock.c | 16 +++----
test/zdtm/live/static/different_creds.c | 20 ++++-----
test/zdtm/live/static/dumpable01.c | 4 +-
test/zdtm/live/static/dumpable02.c | 30 +++++++-------
test/zdtm/live/static/env00.c | 2 +-
test/zdtm/live/static/fanotify00.c | 24 +++++------
test/zdtm/live/static/fd.c | 6 +--
test/zdtm/live/static/fdt_shared.c | 20 ++++-----
test/zdtm/live/static/fifo-ghost.c | 10 ++---
test/zdtm/live/static/fifo-rowo-pair.c | 28 ++++++-------
test/zdtm/live/static/fifo.c | 8 ++--
test/zdtm/live/static/fifo_ro.c | 10 ++---
test/zdtm/live/static/fifo_wronly.c | 14 +++----
test/zdtm/live/static/file_append.c | 4 +-
test/zdtm/live/static/file_attr.c | 10 ++---
test/zdtm/live/static/file_fown.c | 4 +-
test/zdtm/live/static/file_locks00.c | 14 +++----
test/zdtm/live/static/file_locks01.c | 10 ++---
test/zdtm/live/static/file_locks02.c | 4 +-
test/zdtm/live/static/file_locks03.c | 4 +-
test/zdtm/live/static/file_locks04.c | 8 ++--
test/zdtm/live/static/file_locks05.c | 4 +-
test/zdtm/live/static/file_shared.c | 4 +-
test/zdtm/live/static/futex.c | 6 +--
test/zdtm/live/static/get_smaps_bits.c | 4 +-
test/zdtm/live/static/groups.c | 6 +--
test/zdtm/live/static/grow_map.c | 8 ++--
test/zdtm/live/static/grow_map02.c | 6 +--
test/zdtm/live/static/grow_map03.c | 2 +-
test/zdtm/live/static/inotify00.c | 28 ++++++-------
test/zdtm/live/static/inotify_irmap.c | 2 +-
test/zdtm/live/static/inotify_system.c | 36 ++++++++--------
test/zdtm/live/static/inotify_system_nodel.c | 36 ++++++++--------
test/zdtm/live/static/ipc_namespace.c | 62 ++++++++++++++--------------
test/zdtm/live/static/jobctl00.c | 10 ++---
test/zdtm/live/static/link10.c | 8 ++--
test/zdtm/live/static/maps00.c | 10 ++---
test/zdtm/live/static/maps01.c | 4 +-
test/zdtm/live/static/maps02.c | 8 ++--
test/zdtm/live/static/maps03.c | 2 +-
test/zdtm/live/static/maps04.c | 4 +-
test/zdtm/live/static/maps05.c | 8 ++--
test/zdtm/live/static/maps_file_prot.c | 2 +-
test/zdtm/live/static/mlock_setuid.c | 6 +--
test/zdtm/live/static/mnt_ext_auto.c | 6 +--
test/zdtm/live/static/mnt_ext_master.c | 8 ++--
test/zdtm/live/static/mntns_deleted.c | 18 ++++----
test/zdtm/live/static/mntns_link_remap.c | 28 ++++++-------
test/zdtm/live/static/mntns_open.c | 4 +-
test/zdtm/live/static/mntns_root_bind.c | 12 +++---
test/zdtm/live/static/mntns_rw_ro_rw.c | 6 +--
test/zdtm/live/static/mntns_shared_bind.c | 18 ++++----
test/zdtm/live/static/mount_paths.c | 4 +-
test/zdtm/live/static/mountpoints.c | 34 +++++++--------
test/zdtm/live/static/mprotect00.c | 6 +--
test/zdtm/live/static/msgque.c | 6 +--
test/zdtm/live/static/mtime_mmap.c | 14 +++----
test/zdtm/live/static/netns-dev.c | 16 +++----
test/zdtm/live/static/netns-nf.c | 4 +-
test/zdtm/live/static/overmount_dev.c | 10 ++---
test/zdtm/live/static/overmount_fifo.c | 10 ++---
test/zdtm/live/static/overmount_file.c | 8 ++--
test/zdtm/live/static/overmount_sock.c | 18 ++++----
test/zdtm/live/static/packet_sock.c | 28 ++++++-------
test/zdtm/live/static/packet_sock_mmap.c | 8 ++--
test/zdtm/live/static/pdeath_sig.c | 2 +-
test/zdtm/live/static/pipe00.c | 24 +++++------
test/zdtm/live/static/pipe01.c | 20 ++++-----
test/zdtm/live/static/pipe02.c | 4 +-
test/zdtm/live/static/poll.c | 14 +++----
test/zdtm/live/static/posix_timers.c | 18 ++++----
test/zdtm/live/static/proc-self.c | 10 ++---
test/zdtm/live/static/pthread01.c | 12 +++---
test/zdtm/live/static/ptrace_sig.c | 32 +++++++-------
test/zdtm/live/static/pty00.c | 18 ++++----
test/zdtm/live/static/pty01.c | 14 +++----
test/zdtm/live/static/pty02.c | 12 +++---
test/zdtm/live/static/pty03.c | 12 +++---
test/zdtm/live/static/pty04.c | 8 ++--
test/zdtm/live/static/rlimits00.c | 6 +--
test/zdtm/live/static/rmdir_open.c | 6 +--
test/zdtm/live/static/rtc.c | 8 ++--
test/zdtm/live/static/sched_policy00.c | 2 +-
test/zdtm/live/static/sched_prio00.c | 2 +-
test/zdtm/live/static/seccomp_strict.c | 20 ++++-----
test/zdtm/live/static/selfexe00.c | 4 +-
test/zdtm/live/static/sem.c | 6 +--
test/zdtm/live/static/session00.c | 22 +++++-----
test/zdtm/live/static/session01.c | 14 +++----
test/zdtm/live/static/session02.c | 28 ++++++-------
test/zdtm/live/static/session03.c | 34 +++++++--------
test/zdtm/live/static/shm.c | 18 ++++----
test/zdtm/live/static/sigaltstack.c | 14 +++----
test/zdtm/live/static/sigpending.c | 28 ++++++-------
test/zdtm/live/static/sk-netlink.c | 26 ++++++------
test/zdtm/live/static/sk-unix-unconn.c | 6 +--
test/zdtm/live/static/sock_filter.c | 10 ++---
test/zdtm/live/static/sock_opts00.c | 12 +++---
test/zdtm/live/static/sock_opts01.c | 6 +--
test/zdtm/live/static/socket-closed-tcp.c | 4 +-
test/zdtm/live/static/socket-ext.c | 12 +++---
test/zdtm/live/static/socket-tcp.c | 32 +++++++-------
test/zdtm/live/static/socket-tcpbuf.c | 36 ++++++++--------
test/zdtm/live/static/socket6_udp.c | 10 ++---
test/zdtm/live/static/socket_aio.c | 20 ++++-----
test/zdtm/live/static/socket_close_data.c | 4 +-
test/zdtm/live/static/socket_dgram_data.c | 8 ++--
test/zdtm/live/static/socket_listen.c | 14 +++----
test/zdtm/live/static/socket_snd_addr.c | 4 +-
test/zdtm/live/static/socket_udp.c | 10 ++---
test/zdtm/live/static/socket_udplite.c | 10 ++---
test/zdtm/live/static/sockets00.c | 4 +-
test/zdtm/live/static/sockets01.c | 2 +-
test/zdtm/live/static/stopped.c | 8 ++--
test/zdtm/live/static/tempfs.c | 10 ++---
test/zdtm/live/static/tempfs_ro.c | 6 +--
test/zdtm/live/static/timerfd.c | 8 ++--
test/zdtm/live/static/timers.c | 4 +-
test/zdtm/live/static/tty00.c | 10 ++---
test/zdtm/live/static/tty02.c | 4 +-
test/zdtm/live/static/tty03.c | 14 +++----
test/zdtm/live/static/tun.c | 28 ++++++-------
test/zdtm/live/static/unbound_sock.c | 2 +-
test/zdtm/live/static/unhashed_proc.c | 10 ++---
test/zdtm/live/static/unlink_fifo.c | 6 +--
test/zdtm/live/static/unlink_fifo_wronly.c | 8 ++--
test/zdtm/live/static/unlink_fstat00.c | 20 ++++-----
test/zdtm/live/static/unlink_fstat01.c | 12 +++---
test/zdtm/live/static/unlink_fstat02.c | 20 ++++-----
test/zdtm/live/static/unlink_fstat03.c | 16 +++----
test/zdtm/live/static/unlink_largefile.c | 8 ++--
test/zdtm/live/static/unlink_mmap00.c | 10 ++---
test/zdtm/live/static/unlink_mmap01.c | 18 ++++----
test/zdtm/live/static/unlink_mmap02.c | 10 ++---
test/zdtm/live/static/uptime_grow.c | 4 +-
test/zdtm/live/static/utsname.c | 8 ++--
test/zdtm/live/static/vdso01.c | 26 ++++++------
test/zdtm/live/static/vt.c | 8 ++--
test/zdtm/live/static/wait00.c | 2 +-
test/zdtm/live/static/write_read00.c | 4 +-
test/zdtm/live/static/write_read01.c | 8 ++--
test/zdtm/live/static/write_read02.c | 6 +--
test/zdtm/live/static/write_read10.c | 8 ++--
test/zdtm/live/static/xids00.c | 8 ++--
test/zdtm/live/static/zombie00.c | 4 +-
test/zdtm/live/streaming/fifo_dyn.c | 14 +++----
test/zdtm/live/streaming/fifo_loop.c | 18 ++++----
test/zdtm/live/streaming/file_aio.c | 16 +++----
test/zdtm/live/streaming/netlink00.c | 10 ++---
test/zdtm/live/streaming/pipe_loop00.c | 12 +++---
test/zdtm/live/streaming/pipe_shared00.c | 10 ++---
test/zdtm/live/streaming/socket_loop00.c | 12 +++---
test/zdtm/live/streaming/unix_sock.c | 26 ++++++------
test/zdtm/live/transition/epoll.c | 20 ++++-----
test/zdtm/live/transition/file_read.c | 8 ++--
test/zdtm/live/transition/fork.c | 10 ++---
test/zdtm/live/transition/ipc.c | 22 +++++-----
test/zdtm/live/transition/maps007.c | 12 +++---
test/zdtm/live/transition/ptrace.c | 10 ++---
182 files changed, 1092 insertions(+), 1092 deletions(-)
diff --git a/test/zdtm/lib/lock.c b/test/zdtm/lib/lock.c
index 13f367b..9d2a646 100644
--- a/test/zdtm/lib/lock.c
+++ b/test/zdtm/lib/lock.c
@@ -23,7 +23,7 @@ void task_waiter_init(task_waiter_t *t)
t->seed = t->seed % TASK_WAITER_INITIAL;
if (pipe(t->pipes)) {
- err("task_waiter_init failed: %m");
+ pr_perror("task_waiter_init failed");
exit(1);
}
}
@@ -69,14 +69,14 @@ void task_waiter_wait4(task_waiter_t *t, unsigned int lockid)
return;
err:
- err("task_waiter_wait4 failed: %m");
+ pr_perror("task_waiter_wait4 failed");
exit(errno);
}
void task_waiter_complete(task_waiter_t *t, unsigned int lockid)
{
if (write(t->pipes[1], &lockid, sizeof(lockid)) != sizeof(lockid)) {
- err("task_waiter_complete failed: %m");
+ pr_perror("task_waiter_complete failed");
exit(1);
}
}
diff --git a/test/zdtm/lib/msg.c b/test/zdtm/lib/msg.c
index b366e4f..012dd84 100644
--- a/test/zdtm/lib/msg.c
+++ b/test/zdtm/lib/msg.c
@@ -19,7 +19,7 @@ int test_log_init(const char *fname, const char *suffix)
snprintf(path, sizeof(path), "%s%s", fname, suffix);
logfd = open(path, O_WRONLY | O_EXCL | O_CREAT | O_APPEND, 0644);
if (logfd < 0) {
- err("Can't open file %s", fname);
+ pr_perror("Can't open file %s", path);
return -1;
}
@@ -50,7 +50,7 @@ void test_msg(const char *format, ...)
gettimeofday(&tv, NULL);
tm = localtime(&tv.tv_sec);
if (tm == NULL) {
- err("localtime() failed");
+ pr_perror("localtime() failed");
} else {
off += strftime(buf, sizeof(buf), "%H:%M:%S", tm);
}
diff --git a/test/zdtm/lib/tcp.c b/test/zdtm/lib/tcp.c
index 5c387b8..b6a3062 100644
--- a/test/zdtm/lib/tcp.c
+++ b/test/zdtm/lib/tcp.c
@@ -27,12 +27,12 @@ int tcp_init_server(int family, int *port)
sock = socket(family, SOCK_STREAM, IPPROTO_TCP);
if (sock == -1) {
- err ("socket() failed %m");
+ pr_perror("socket() failed %m");
return -1;
}
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) {
- err("setsockopt() error");
+ pr_perror("setsockopt() error");
return -1;
}
@@ -54,12 +54,12 @@ int tcp_init_server(int family, int *port)
}
if (ret == -1) {
- err ("bind() failed %m");
+ pr_perror("bind() failed %m");
return -1;
}
if (listen(sock, 1) == -1) {
- err ("listen() failed %m");
+ pr_perror("listen() failed %m");
return -1;
}
return sock;
@@ -77,7 +77,7 @@ int tcp_accept_server(int sock)
sock2 = accept(sock,(struct sockaddr *) &maddr, &addrlen);
if (sock2 == -1) {
- err ("accept() failed %m");
+ pr_perror("accept() failed %m");
return -1;
}
@@ -93,7 +93,7 @@ int tcp_init_client(int family, char *servIP, unsigned short servPort)
union sockaddr_inet servAddr;
if ((sock = socket(family, SOCK_STREAM, IPPROTO_TCP)) < 0) {
- err("can't create socket %m");
+ pr_perror("can't create socket %m");
return -1;
}
/* Construct the server address structure */
@@ -108,7 +108,7 @@ int tcp_init_client(int family, char *servIP, unsigned short servPort)
inet_pton(AF_INET6, servIP, &servAddr.v6.sin6_addr);
}
if (connect(sock, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0) {
- err("can't connect to server %m");
+ pr_perror("can't connect to server %m");
return -1;
}
return sock;
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index fe0e648..ad8f814 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -75,7 +75,7 @@ static void redir_stdfds()
nullfd = open("/dev/null", O_RDWR);
if (nullfd < 0) {
- err("Can't open /dev/null");
+ pr_perror("Can't open /dev/null");
exit(1);
}
@@ -174,13 +174,13 @@ void test_init(int argc, char **argv)
pidf = fopen(pidfile, "wx");
if (!pidf) {
- err("Can't create pid file %s", pidfile);
+ pr_perror("Can't create pid file %s", pidfile);
exit(1);
}
pid = fork();
if (pid < 0) {
- err("Daemonizing failed");
+ pr_perror("Daemonizing failed");
exit(1);
}
@@ -192,11 +192,11 @@ void test_init(int argc, char **argv)
waitpid(pid, &ret, 0);
if (WIFEXITED(ret)) {
- err("Test exited with unexpectedly with code %d", WEXITSTATUS(ret));
+ pr_perror("Test exited with unexpectedly with code %d", WEXITSTATUS(ret));
exit(0);
}
if (WIFSIGNALED(ret)) {
- err("Test exited on unexpected signal %d", WTERMSIG(ret));
+ pr_perror("Test exited on unexpected signal %d", WTERMSIG(ret));
exit(0);
}
}
@@ -209,7 +209,7 @@ void test_init(int argc, char **argv)
fclose(pidf);
if (setsid() < 0) {
- err("Can't become session group leader");
+ pr_perror("Can't become session group leader");
exit(1);
}
@@ -219,7 +219,7 @@ skip_pid:
sa.sa_handler = SIG_DFL;
if (sigaction(SIGCHLD, &sa, NULL)) {
- err("Can't reset SIGCHLD handler");
+ pr_perror("Can't reset SIGCHLD handler");
exit(1);
}
@@ -252,12 +252,12 @@ static int do_test_fn(void *_arg)
sigemptyset(&sa.sa_mask);
if (sigaction(SIGCHLD, &sa, NULL)) {
- err("Can't reset SIGCHLD handler");
+ pr_perror("Can't reset SIGCHLD handler");
exit(1);
}
if (setsid() < 0) {
- err("Can't become session group leader");
+ pr_perror("Can't become session group leader");
exit(1);
}
@@ -302,7 +302,7 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags,
pidf = fopen(pidfile, "wx");
if (!pidf) {
- err("Can't create pid file %s", pidfile);
+ pr_perror("Can't create pid file %s", pidfile);
exit(1);
}
@@ -312,7 +312,7 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags,
ca.argv = argv;
pid = clone(do_test_fn, ca.stack_ptr, clone_flags | SIGCHLD, &ca);
if (pid < 0) {
- err("Daemonizing failed");
+ pr_perror("Daemonizing failed");
exit(1);
}
@@ -324,11 +324,11 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags,
waitpid(pid, &ret, 0);
if (WIFEXITED(ret)) {
- err("Test exited with unexpectedly with code %d", WEXITSTATUS(ret));
+ pr_perror("Test exited with unexpectedly with code %d", WEXITSTATUS(ret));
exit(0);
}
if (WIFSIGNALED(ret)) {
- err("Test exited on unexpected signal %d", WTERMSIG(ret));
+ pr_perror("Test exited on unexpected signal %d", WTERMSIG(ret));
exit(0);
}
}
@@ -344,7 +344,7 @@ void test_daemon()
ppid = getppid();
if (ppid <= 1) {
- err("Test orphaned");
+ pr_perror("Test orphaned");
goto out;
}
diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index db00cad..0b91065 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -102,7 +102,7 @@ extern int parse_opt_string(char *param, void *arg);
extern void setup_outfile(void);
extern int test_log_init(const char *outfile, const char *suffix);
extern int zdtm_seccomp;
-#define err(format, arg...) \
+#define pr_perror(format, arg...) \
test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", \
__FILE__, __LINE__, ## arg, errno, strerror(errno))
#define fail(format, arg...) \
diff --git a/test/zdtm/live/static/aio00.c b/test/zdtm/live/static/aio00.c
index e8aefe0..93ca7aa 100644
--- a/test/zdtm/live/static/aio00.c
+++ b/test/zdtm/live/static/aio00.c
@@ -16,7 +16,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (io_setup(1, &ctx) < 0) {
- err("Can't setup io ctx");
+ pr_perror("Can't setup io ctx");
return 1;
}
diff --git a/test/zdtm/live/static/bind-mount.c b/test/zdtm/live/static/bind-mount.c
index d4f9a4f..06c5cf1 100644
--- a/test/zdtm/live/static/bind-mount.c
+++ b/test/zdtm/live/static/bind-mount.c
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
mkdir(test_bind, 0700);
if (mount(test_dir, test_bind, NULL, MS_BIND, NULL)) {
- err("Unable to mount %s to %s", test_dir, test_bind);
+ pr_perror("Unable to mount %s to %s", test_dir, test_bind);
return 1;
}
@@ -42,18 +42,18 @@ int main(int argc, char **argv)
fd = open(test_file, O_CREAT | O_WRONLY | O_EXCL, 0600);
if (fd < 0) {
- err("Unable to open %s", test_file);
+ pr_perror("Unable to open %s", test_file);
return 1;
}
close(fd);
if (access(test_bind_file, F_OK)) {
- err("%s doesn't exist", test_bind_file);
+ pr_perror("%s doesn't exist", test_bind_file);
return 1;
}
if (umount(test_bind)) {
- err("Unable to umount %s", test_bind);
+ pr_perror("Unable to umount %s", test_bind);
return 1;
}
diff --git a/test/zdtm/live/static/caps00.c b/test/zdtm/live/static/caps00.c
index 87179c5..5911fa1 100644
--- a/test/zdtm/live/static/caps00.c
+++ b/test/zdtm/live/static/caps00.c
@@ -47,7 +47,7 @@ int main(int argc, char **argv)
f = fopen("/proc/sys/kernel/cap_last_cap", "r");
if (f) {
if (fscanf(f, "%d", &cap_last_cap) != 1) {
- err("Unable to read cal_last_cap");
+ pr_perror("Unable to read cal_last_cap");
return 1;
}
fclose(f);
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
test_msg("/proc/sys/kernel/cap_last_cap is not available\n");
if (pipe(result_pipe)) {
- err("Can't create pipe");
+ pr_perror("Can't create pipe");
return 1;
}
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
hdr.pid = 0;
if (capget(&hdr, data) < 0) {
- err("capget");
+ pr_perror("capget");
return -1;
}
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
data[0].prm &= ~(1 << CAP_DAC_OVERRIDE);
if (capset(&hdr, data) < 0) {
- err("capset");
+ pr_perror("capset");
return -1;
}
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
hdr.pid = 0;
if (capget(&hdr, data_2) < 0) {
- err("second capget");
+ pr_perror("second capget");
return -1;
}
diff --git a/test/zdtm/live/static/cgroup00.c b/test/zdtm/live/static/cgroup00.c
index b590156..ee14d1f 100644
--- a/test/zdtm/live/static/cgroup00.c
+++ b/test/zdtm/live/static/cgroup00.c
@@ -28,7 +28,7 @@ static int cg_move(char *name)
cgfd = open(paux, O_WRONLY);
if (cgfd < 0) {
- err("Can't open tasks");
+ pr_perror("Can't open tasks");
return -1;
}
@@ -36,7 +36,7 @@ static int cg_move(char *name)
close(cgfd);
if (l < 0) {
- err("Can't move self to subcg");
+ pr_perror("Can't move self to subcg");
return -1;
}
@@ -90,13 +90,13 @@ int main(int argc, char **argv)
pipe(pr);
if (mkdir(dirname, 0700) < 0) {
- err("Can't make dir");
+ pr_perror("Can't make dir");
goto out;
}
sprintf(aux, "none,name=%s", cgname);
if (mount("none", dirname, "cgroup", 0, aux)) {
- err("Can't mount cgroups");
+ pr_perror("Can't mount cgroups");
goto out_rd;
}
@@ -199,7 +199,7 @@ out:
return 0;
out_ks:
- err("Error moving into cgroups");
+ pr_perror("Error moving into cgroups");
close(pr[0]);
goto out_rs;
}
diff --git a/test/zdtm/live/static/cgroup01.c b/test/zdtm/live/static/cgroup01.c
index 9868cca..7f964cf 100644
--- a/test/zdtm/live/static/cgroup01.c
+++ b/test/zdtm/live/static/cgroup01.c
@@ -25,13 +25,13 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mkdir(dirname, 0700) < 0) {
- err("Can't make dir");
+ pr_perror("Can't make dir");
goto out;
}
sprintf(aux, "none,name=%s", cgname);
if (mount("none", dirname, "cgroup", 0, aux)) {
- err("Can't mount cgroups");
+ pr_perror("Can't mount cgroups");
goto out_rd;
}
@@ -43,7 +43,7 @@ int main(int argc, char **argv)
cgfd = open(paux, O_WRONLY);
if (cgfd < 0) {
- err("Can't open tasks");
+ pr_perror("Can't open tasks");
goto out_rs;
}
@@ -51,14 +51,14 @@ int main(int argc, char **argv)
close(cgfd);
if (l < 0) {
- err("Can't move self to subcg");
+ pr_perror("Can't move self to subcg");
goto out_rs;
}
for (i = 0; i < 2; i++) {
sprintf(paux, "%s/%s/%s.%d", dirname, subname, empty, i);
if (mkdir(paux, 0600)) {
- err("mkdir %s", paux);
+ pr_perror("mkdir %s", paux);
return 1;
}
}
diff --git a/test/zdtm/live/static/cgroup02.c b/test/zdtm/live/static/cgroup02.c
index 6bc0e54..d892b2f 100644
--- a/test/zdtm/live/static/cgroup02.c
+++ b/test/zdtm/live/static/cgroup02.c
@@ -23,19 +23,19 @@ int mount_and_add(const char *controller, const char *path)
int cgfd, l;
if (mkdir(dirname, 0700) < 0 && errno != EEXIST) {
- err("Can't make dir");
+ pr_perror("Can't make dir");
return -1;
}
sprintf(subdir, "%s/%s", dirname, controller);
if (mkdir(subdir, 0700) < 0) {
- err("Can't make dir");
+ pr_perror("Can't make dir");
return -1;
}
sprintf(aux, "none,name=%s", controller);
if (mount("none", subdir, "cgroup", 0, aux)) {
- err("Can't mount cgroups");
+ pr_perror("Can't mount cgroups");
goto err_rd;
}
@@ -47,7 +47,7 @@ int mount_and_add(const char *controller, const char *path)
cgfd = open(paux, O_WRONLY);
if (cgfd < 0) {
- err("Can't open tasks");
+ pr_perror("Can't open tasks");
goto err_rs;
}
@@ -55,7 +55,7 @@ int mount_and_add(const char *controller, const char *path)
close(cgfd);
if (l < 0) {
- err("Can't move self to subcg");
+ pr_perror("Can't move self to subcg");
goto err_rs;
}
diff --git a/test/zdtm/live/static/child_opened_proc.c b/test/zdtm/live/static/child_opened_proc.c
index b7e7f1b..2a1fa8c 100644
--- a/test/zdtm/live/static/child_opened_proc.c
+++ b/test/zdtm/live/static/child_opened_proc.c
@@ -22,7 +22,7 @@ int main(int argc, char ** argv)
pid = test_fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
exit(1);
}
@@ -34,7 +34,7 @@ int main(int argc, char ** argv)
sprintf(name, "/proc/%d/stat", pid);
proc_fd = open(name, O_RDONLY);
if (proc_fd == -1) {
- err("can't open %s", name);
+ pr_perror("can't open %s", name);
err++;
goto out;
}
@@ -42,16 +42,16 @@ int main(int argc, char ** argv)
test_waitsig();
if (close(proc_fd) == -1) {
- err("Failed to close %s", name);
+ pr_perror("Failed to close %s", name);
err++;
}
out:
if (kill(pid, SIGTERM) == -1) {
- err("Failed to terminate child");
+ pr_perror("Failed to terminate child");
err++;
} else {
if (waitpid(pid, NULL, 0) != pid) {
- err("Failed to collect killed child");
+ pr_perror("Failed to collect killed child");
err++;
}
}
diff --git a/test/zdtm/live/static/chroot-file.c b/test/zdtm/live/static/chroot-file.c
index 4e2f956..70abf52 100644
--- a/test/zdtm/live/static/chroot-file.c
+++ b/test/zdtm/live/static/chroot-file.c
@@ -76,16 +76,16 @@ int main(int argc, char **argv)
read(pipe_prep[0], &res, 1);
if (res != SUCCESS) {
if (res == ERR_PIPES)
- err("broken pipes");
+ pr_perror("broken pipes");
else {
if (res & ERR_IN_FILE)
- err("inside-root file fail");
+ pr_perror("inside-root file fail");
if (res & ERR_ROOT)
- err("chroot fail");
+ pr_perror("chroot fail");
if (res & ERR_DIR)
- err("mkdir fail");
+ pr_perror("mkdir fail");
if (res & ERR_CHDIR)
- err("chrid fail");
+ pr_perror("chrid fail");
}
return 0;
}
diff --git a/test/zdtm/live/static/chroot.c b/test/zdtm/live/static/chroot.c
index 89aa51b..a7069a8 100644
--- a/test/zdtm/live/static/chroot.c
+++ b/test/zdtm/live/static/chroot.c
@@ -80,14 +80,14 @@ int main(int argc, char **argv)
read(pipe_prep[0], &res, 1);
if (res != SUCCESS) {
if (res == ERR_PIPES)
- err("broken pipes");
+ pr_perror("broken pipes");
else {
if (res & ERR_IN_FILE)
- err("inside-root file fail");
+ pr_perror("inside-root file fail");
if (res & ERR_ROOT)
- err("chroot fail");
+ pr_perror("chroot fail");
if (res & ERR_DIR)
- err("mkdir fail");
+ pr_perror("mkdir fail");
}
return 0;
}
diff --git a/test/zdtm/live/static/clean_mntns.c b/test/zdtm/live/static/clean_mntns.c
index defba07..7628946 100644
--- a/test/zdtm/live/static/clean_mntns.c
+++ b/test/zdtm/live/static/clean_mntns.c
@@ -12,10 +12,10 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (umount("/proc") < 0)
- err("Can't umount proc");
+ pr_perror("Can't umount proc");
if (umount("/dev/pts") < 0)
- err("Can't umount devpts");
+ pr_perror("Can't umount devpts");
test_daemon();
test_waitsig();
diff --git a/test/zdtm/live/static/cmdlinenv00.c b/test/zdtm/live/static/cmdlinenv00.c
index dae1d97..9d3fe6c 100644
--- a/test/zdtm/live/static/cmdlinenv00.c
+++ b/test/zdtm/live/static/cmdlinenv00.c
@@ -33,7 +33,7 @@ static void read_from_proc(const char *path, char *buf, size_t size)
while (r < size) {
ret = read(fd, buf + r, size - r);
if (ret < 0) {
- err("Read failed");
+ pr_perror("Read failed");
exit(1);
} else if (ret == 0) {
break;
diff --git a/test/zdtm/live/static/console.c b/test/zdtm/live/static/console.c
index 0a27521..a86b146 100644
--- a/test/zdtm/live/static/console.c
+++ b/test/zdtm/live/static/console.c
@@ -25,18 +25,18 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, makedev(5,1))) {
- err("Can't create console %s", filename);
+ pr_perror("Can't create console %s", filename);
return 1;
}
fd = open(filename, O_RDONLY);
if (fd < 0) {
- err("Open console %s failed", filename);
+ pr_perror("Open console %s failed", filename);
return 1;
}
if (fstat(fd, &st1)) {
- err("Can't stat %s console", filename);
+ pr_perror("Can't stat %s console", filename);
return 1;
}
@@ -44,7 +44,7 @@ int main(int argc, char ** argv)
test_waitsig();
if (fstat(fd, &st2)) {
- err("Can't stat %s console", filename);
+ pr_perror("Can't stat %s console", filename);
return 1;
}
diff --git a/test/zdtm/live/static/cow00.c b/test/zdtm/live/static/cow00.c
index bcb1595..92446a1 100644
--- a/test/zdtm/live/static/cow00.c
+++ b/test/zdtm/live/static/cow00.c
@@ -23,14 +23,14 @@ static int is_cow(void *addr, pid_t p1, pid_t p2)
snprintf(buf, sizeof(buf), "/proc/%d/pagemap", p1);
fd1 = open(buf, O_RDONLY);
if (fd1 < 0) {
- err("Unable to open file %s", buf);
+ pr_perror("Unable to open file %s", buf);
return -1;
}
snprintf(buf, sizeof(buf), "/proc/%d/pagemap", p2);
fd2 = open(buf, O_RDONLY);
if (fd1 < 0) {
- err("Unable to open file %s", buf);
+ pr_perror("Unable to open file %s", buf);
return -1;
}
@@ -44,12 +44,12 @@ static int is_cow(void *addr, pid_t p1, pid_t p2)
ret = read(fd1, &map1, sizeof(map1));
if (ret != sizeof(map1)) {
- err("Unable to read data");
+ pr_perror("Unable to read data");
return -1;
}
ret = read(fd2, &map2, sizeof(map2));
if (ret != sizeof(map2)) {
- err("Unable to read data");
+ pr_perror("Unable to read data");
return -1;
}
@@ -73,7 +73,7 @@ int main(int argc, char ** argv)
addr = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (addr == MAP_FAILED) {
- err("Can't allocate memory");
+ pr_perror("Can't allocate memory");
return 1;
}
@@ -81,7 +81,7 @@ int main(int argc, char ** argv)
pid = test_fork();
if (pid < 0) {
- err("Unable to fork a new process");
+ pr_perror("Unable to fork a new process");
return 1;
} else if (pid == 0) {
test_waitsig();
@@ -91,7 +91,7 @@ int main(int argc, char ** argv)
if (is_cow(addr, pid, getpid()) == 1)
test_msg("OK\n");
else {
- err("A page is not shared");
+ pr_perror("A page is not shared");
goto out;
}
diff --git a/test/zdtm/live/static/cow01.c b/test/zdtm/live/static/cow01.c
index b02528d..895dd90 100644
--- a/test/zdtm/live/static/cow01.c
+++ b/test/zdtm/live/static/cow01.c
@@ -84,14 +84,14 @@ static int is_cow(void *addr, pid_t pid_child, pid_t pid_parent,
snprintf(buf, sizeof(buf), "/proc/%d/pagemap", pid_child);
fd_child = open(buf, O_RDONLY);
if (fd_child < 0) {
- err("Unable to open child pagemap file %s", buf);
+ pr_perror("Unable to open child pagemap file %s", buf);
return -1;
}
snprintf(buf, sizeof(buf), "/proc/%d/pagemap", pid_parent);
fd_parent = open(buf, O_RDONLY);
if (fd_parent < 0) {
- err("Unable to open parent pagemap file %s", buf);
+ pr_perror("Unable to open parent pagemap file %s", buf);
return -1;
}
@@ -104,28 +104,28 @@ static int is_cow(void *addr, pid_t pid_child, pid_t pid_parent,
lseek_ret = lseek(fd_child, pfn * sizeof(map_child), SEEK_SET);
if (lseek_ret == (off_t) -1) {
- err("Unable to seek child pagemap to virtual addr %#08lx",
+ pr_perror("Unable to seek child pagemap to virtual addr %#08lx",
pfn * PAGE_SIZE);
return -1;
}
lseek_ret = lseek(fd_parent, pfn * sizeof(map_parent), SEEK_SET);
if (lseek_ret == (off_t) -1) {
- err("Unable to seek parent pagemap to virtual addr %#08lx",
+ pr_perror("Unable to seek parent pagemap to virtual addr %#08lx",
pfn * PAGE_SIZE);
return -1;
}
ret = read(fd_child, &map_child, sizeof(map_child));
if (ret != sizeof(map_child)) {
- err("Unable to read child pagemap at virtual addr %#08lx",
+ pr_perror("Unable to read child pagemap at virtual addr %#08lx",
pfn * PAGE_SIZE);
return -1;
}
ret = read(fd_parent, &map_parent, sizeof(map_parent));
if (ret != sizeof(map_parent)) {
- err("Unable to read parent pagemap at virtual addr %#08lx",
+ pr_perror("Unable to read parent pagemap at virtual addr %#08lx",
pfn * PAGE_SIZE);
return -1;
}
@@ -136,11 +136,11 @@ static int is_cow(void *addr, pid_t pid_child, pid_t pid_parent,
p = (void **)(addr + i * PAGE_SIZE);
test_msg("Read *%p = %p\n", p, p[0]);
if (write(fd, &p, sizeof(p)) != sizeof(p)) {
- err("write");
+ pr_perror("write");
return -1;
}
if (read(fd, &p, sizeof(p)) != sizeof(p)) {
- err("read");
+ pr_perror("read");
return -1;
}
test_msg("Child %p\n", p);
@@ -304,7 +304,7 @@ static int __init_cow(struct test_cases *tcs, int flags)
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (addr == MAP_FAILED) {
- err("Can't allocate memory");
+ pr_perror("Can't allocate memory");
return -1;
}
@@ -348,7 +348,7 @@ static int init_sep(struct test_cases *tcs)
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (tcs->addr == MAP_FAILED) {
- err("Can't allocate memory");
+ pr_perror("Can't allocate memory");
return -1;
}
@@ -370,7 +370,7 @@ static int init_file(struct test_cases *tcs)
fd = open(filename, O_TRUNC | O_CREAT | O_RDWR, 0600);
if (fd < 0) {
- err("Unable to create a test file");
+ pr_perror("Unable to create a test file");
return -1;
}
@@ -380,7 +380,7 @@ static int init_file(struct test_cases *tcs)
datagen2(buf, sizeof(buf), &crc);
ret = write(fd, buf, sizeof(buf));
if (ret != sizeof(buf)) {
- err("Unable to write data in test file %s", filename);
+ pr_perror("Unable to write data in test file %s", filename);
return -1;
}
@@ -392,7 +392,7 @@ static int init_file(struct test_cases *tcs)
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_FILE, fd, 0);
if (tcs->addr == MAP_FAILED) {
- err("Can't allocate memory");
+ pr_perror("Can't allocate memory");
return -1;
}
@@ -410,7 +410,7 @@ static int child(task_waiter_t *child_waiter, int fd)
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
if (sep_tcs.addr == MAP_FAILED) {
- err("Can't allocate memory");
+ pr_perror("Can't allocate memory");
return -1;
}
@@ -424,13 +424,13 @@ static int child(task_waiter_t *child_waiter, int fd)
if (ret == 0)
break;
if (ret != sizeof(p)) {
- err("read");
+ pr_perror("read");
return -1;
}
test_msg("Read *%p = %p\n", p, p[0]);
p = ((void **)p)[0];
if (write(fd, &p, sizeof(p)) != sizeof(p)) {
- err("write");
+ pr_perror("write");
return -1;
}
ret = 0;
@@ -460,7 +460,7 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, pfd)) {
- err("pipe");
+ pr_perror("pipe");
return 1;
}
@@ -469,7 +469,7 @@ int main(int argc, char ** argv)
child_pid = test_fork();
if (child_pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
return 2;
}
diff --git a/test/zdtm/live/static/cwd00.c b/test/zdtm/live/static/cwd00.c
index e7240a6..b0736f5 100644
--- a/test/zdtm/live/static/cwd00.c
+++ b/test/zdtm/live/static/cwd00.c
@@ -23,22 +23,22 @@ int main(int argc, char **argv)
fd = open(".", O_DIRECTORY | O_RDONLY);
if (fd == -1) {
- err("Unable to open the current dir");
+ pr_perror("Unable to open the current dir");
exit(1);
}
if (mkdir(dirname, 0700)) {
- err("can't make directory %s", dirname);
+ pr_perror("can't make directory %s", dirname);
exit(1);
}
if (chdir(dirname)) {
- err("can't change directory to %s", dirname);
+ pr_perror("can't change directory to %s", dirname);
goto cleanup;
}
if (!getcwd(cwd1, sizeof(cwd1))) {
- err("can't get cwd");
+ pr_perror("can't get cwd");
goto cleanup;
}
@@ -57,11 +57,11 @@ int main(int argc, char **argv)
cleanup:
/* return to the initial dir before writing out results */
if (fchdir(fd)) {
- err("can't restore cwd");
+ pr_perror("can't restore cwd");
exit(1);
}
if (rmdir(dirname)) {
- err("can't remove directory %s", dirname);
+ pr_perror("can't remove directory %s", dirname);
exit(1);
}
return 0;
diff --git a/test/zdtm/live/static/cwd01.c b/test/zdtm/live/static/cwd01.c
index 2adecd6..4e10a6b 100644
--- a/test/zdtm/live/static/cwd01.c
+++ b/test/zdtm/live/static/cwd01.c
@@ -35,17 +35,17 @@ int main(int argc, char **argv)
fd = open(".", O_DIRECTORY | O_RDONLY);
if (fd == -1) {
- err("Unable to open the current dir");
+ pr_perror("Unable to open the current dir");
exit(1);
}
if (mkdir(dirname, 0700)) {
- err("can't make directory %s", dirname);
+ pr_perror("can't make directory %s", dirname);
exit(1);
}
if (chdir(dirname)) {
- err("can't change directory to %s", dirname);
+ pr_perror("can't change directory to %s", dirname);
goto cleanup;
}
@@ -53,17 +53,17 @@ int main(int argc, char **argv)
close(p[0]);
waitpid(pid, &aux, 0);
if (!WIFEXITED(aux) || WEXITSTATUS(aux) != 0) {
- err("can't remove dir");
+ pr_perror("can't remove dir");
goto cleanup;
}
aux = readlink("/proc/self/cwd", cwd1, sizeof(cwd1));
if (aux < 0) {
- err("can't get cwd");
+ pr_perror("can't get cwd");
goto cleanup;
}
if (aux == sizeof(cwd1)) {
- err("A buffer is too small");
+ pr_perror("A buffer is too small");
goto cleanup;
}
@@ -78,7 +78,7 @@ int main(int argc, char **argv)
goto cleanup;
}
if (aux2 == sizeof(cwd2)) {
- err("A buffer is too small");
+ pr_perror("A buffer is too small");
goto cleanup;
}
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
cleanup:
/* return to the initial dir before writing out results */
if (fchdir(fd)) {
- err("can't restore cwd");
+ pr_perror("can't restore cwd");
exit(1);
}
diff --git a/test/zdtm/live/static/cwd02.c b/test/zdtm/live/static/cwd02.c
index c4bcf30..1237445 100644
--- a/test/zdtm/live/static/cwd02.c
+++ b/test/zdtm/live/static/cwd02.c
@@ -32,22 +32,22 @@ int main(int argc, char **argv)
cwd = open(".", O_DIRECTORY | O_RDONLY);
if (cwd == -1) {
- err("Unable to open the current dir");
+ pr_perror("Unable to open the current dir");
exit(1);
}
if (mkdir(dirname, 0700)) {
- err("can't make directory %s", dirname);
+ pr_perror("can't make directory %s", dirname);
exit(1);
}
if ((fd = open(dirname, O_DIRECTORY)) < 0) {
- err("can't open dir %s", dirname);
+ pr_perror("can't open dir %s", dirname);
goto cleanup;
}
if (chdir(dirname)) {
- err("can't change directory to %s", dirname);
+ pr_perror("can't change directory to %s", dirname);
goto cleanup;
}
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
close(p[0]);
waitpid(pid, &aux, 0);
if (!WIFEXITED(aux) || WEXITSTATUS(aux) != 0) {
- err("can't remove dir");
+ pr_perror("can't remove dir");
goto cleanup;
}
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
cleanup:
/* return to the initial dir before writing out results */
if (fchdir(cwd)) {
- err("can't restore cwd");
+ pr_perror("can't restore cwd");
exit(1);
}
diff --git a/test/zdtm/live/static/deleted_dev.c b/test/zdtm/live/static/deleted_dev.c
index 75d769f..e855aed 100644
--- a/test/zdtm/live/static/deleted_dev.c
+++ b/test/zdtm/live/static/deleted_dev.c
@@ -25,18 +25,18 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, mode, dev)) {
- err("can't make device file \"%s\"", filename);
+ pr_perror("can't make device file \"%s\"", filename);
exit(1);
}
fd = open(filename, O_RDWR);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
goto out;
}
if (unlink(filename) < 0) {
- err("can't unlink %s: %m", filename);
+ pr_perror("can't unlink %s", filename);
goto out;
}
diff --git a/test/zdtm/live/static/deleted_unix_sock.c b/test/zdtm/live/static/deleted_unix_sock.c
index d088c71..3562e26 100644
--- a/test/zdtm/live/static/deleted_unix_sock.c
+++ b/test/zdtm/live/static/deleted_unix_sock.c
@@ -37,23 +37,23 @@ static int setup_srv_sock(void)
int sock;
if (fill_sock_name(&name, filename) < 0) {
- err("filename \"%s\" is too long", filename);
+ pr_perror("filename \"%s\" is too long", filename);
return -1;
}
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
- err("can't create socket: %m");
+ pr_perror("can't create socket");
return -1;
}
if (bind(sock, (struct sockaddr *) &name, SUN_LEN(&name)) < 0) {
- err("can't bind to socket \"%s\": %m", filename);
+ pr_perror("can't bind to socket \"%s\"", filename);
goto err;
}
if (listen(sock, 1) < 0) {
- err("can't listen on a socket \"%s\"", filename);
+ pr_perror("can't listen on a socket \"%s\"", filename);
goto err;
}
@@ -99,7 +99,7 @@ int main(int argc, char ** argv)
pid = test_fork();
if (pid < 0) {
- err("can't fork");
+ pr_perror("can't fork");
exit(1);
}
@@ -115,7 +115,7 @@ int main(int argc, char ** argv)
crc = ~0;
datagen(buf, sizeof(buf), &crc);
if (write(sock, buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write to socket: %m");
+ pr_perror("can't write to socket");
exit(errno);
}
@@ -125,7 +125,7 @@ int main(int argc, char ** argv)
acc_sock = accept(sock, NULL, NULL);
if (acc_sock < 0) {
- err("can't accept() the connection on \"%s\": %m", filename);
+ pr_perror("can't accept() the connection on \"%s\"", filename);
goto out_kill;
}
@@ -133,7 +133,7 @@ int main(int argc, char ** argv)
sock = acc_sock;
if (unlink(filename)) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
goto out_kill;
}
diff --git a/test/zdtm/live/static/different_creds.c b/test/zdtm/live/static/different_creds.c
index c18216a..3bdc9c6 100644
--- a/test/zdtm/live/static/different_creds.c
+++ b/test/zdtm/live/static/different_creds.c
@@ -24,27 +24,27 @@ void *drop_caps_and_wait(void *arg)
caps = cap_get_proc();
if (!caps) {
- err("cap_get_proc");
+ pr_perror("cap_get_proc");
return NULL;
}
if (cap_clear_flag(caps, CAP_EFFECTIVE) < 0) {
- err("cap_clear_flag");
+ pr_perror("cap_clear_flag");
goto die;
}
if (cap_set_proc(caps) < 0) {
- err("cap_set_proc");
+ pr_perror("cap_set_proc");
goto die;
}
if (write(fd, "a", 1) != 1) {
- err("Unable to send a status");
+ pr_perror("Unable to send a status");
goto die;
}
if (read(fd, &c, 1) != 1) {
- err("Unable to read a status");
+ pr_perror("Unable to read a status");
goto die;
}
@@ -64,12 +64,12 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (socketpair(AF_FILE, SOCK_SEQPACKET, 0, pipefd)) {
- err("pipe");
+ pr_perror("pipe");
return -1;
}
if (pthread_create(&thr, NULL, drop_caps_and_wait, &pipefd[0])) {
- err("Unable to create thread");
+ pr_perror("Unable to create thread");
return -1;
}
@@ -77,7 +77,7 @@ int main(int argc, char ** argv)
* Wait for child to signal us that it has droped caps.
*/
if (read(pipefd[1], &c, 1) != 1) {
- err("read");
+ pr_perror("read");
return 1;
}
@@ -85,12 +85,12 @@ int main(int argc, char ** argv)
test_waitsig();
if (write(pipefd[1], &c, 1) != 1) {
- err("write");
+ pr_perror("write");
return 1;
}
if (pthread_join(thr, &retcode)) {
- err("Unable to jount a thread");
+ pr_perror("Unable to jount a thread");
return 1;
}
if (retcode != NULL)
diff --git a/test/zdtm/live/static/dumpable01.c b/test/zdtm/live/static/dumpable01.c
index 2d03c10..e5dfc9a 100644
--- a/test/zdtm/live/static/dumpable01.c
+++ b/test/zdtm/live/static/dumpable01.c
@@ -17,7 +17,7 @@ int main(int argc, char **argv)
save_dumpable = prctl(PR_GET_DUMPABLE);
if (save_dumpable < 0) {
- err("error getting prctl(PR_GET_DUMPABLE) before dump");
+ pr_perror("error getting prctl(PR_GET_DUMPABLE) before dump");
return 1;
}
#ifdef DEBUG
@@ -30,7 +30,7 @@ int main(int argc, char **argv)
dumpable = prctl(PR_GET_DUMPABLE);
if (dumpable < 0) {
- err("error getting prctl(PR_GET_DUMPABLE) after restore");
+ pr_perror("error getting prctl(PR_GET_DUMPABLE) after restore");
return 1;
}
#ifdef DEBUG
diff --git a/test/zdtm/live/static/dumpable02.c b/test/zdtm/live/static/dumpable02.c
index 48b0e40..3463ded 100644
--- a/test/zdtm/live/static/dumpable02.c
+++ b/test/zdtm/live/static/dumpable02.c
@@ -38,18 +38,18 @@ int get_dumpable_from_pipes(int pipe_input, int pipe_output) {
write(pipe_input, "GET\n", 4);
len = read(pipe_output, buf, sizeof(buf));
if (len < 0) {
- err("error in parent reading from pipe");
+ pr_perror("error in parent reading from pipe");
return -1;
}
if (memcmp(buf, "DUMPABLE:", 9) != 0) {
- err("child returned [%s]", buf);
+ pr_perror("child returned [%s]", buf);
return -1;
}
value = strtol(&buf[9], &endptr, 10);
if (!endptr || *endptr != '\n' || endptr != buf + len - 1) {
- err("child returned [%s]", buf);
+ pr_perror("child returned [%s]", buf);
return -1;
}
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
*/
ret = chmod(argv[0], 0111);
if (ret < 0) {
- err("error chmodding %s", argv[0]);
+ pr_perror("error chmodding %s", argv[0]);
return 1;
}
@@ -94,19 +94,19 @@ int main(int argc, char **argv)
ret = pipe(pipe_input);
if (ret < 0) {
- err("error creating input pipe");
+ pr_perror("error creating input pipe");
return 1;
}
ret = pipe(pipe_output);
if (ret < 0) {
- err("error creating output pipe");
+ pr_perror("error creating output pipe");
return 1;
}
pid = fork();
if (pid < 0) {
- err("error forking the dumpable server");
+ pr_perror("error forking the dumpable server");
return 1;
}
@@ -121,13 +121,13 @@ int main(int argc, char **argv)
ret = dup2(pipe_input[0], 0);
if (ret < 0) {
- err("could not dup2 pipe into child's stdin");
+ pr_perror("could not dup2 pipe into child's stdin");
return 1;
}
ret = dup2(pipe_output[1], 1);
if (ret < 0) {
- err("could not dup2 pipe into child's stdout");
+ pr_perror("could not dup2 pipe into child's stdout");
return 1;
}
@@ -138,12 +138,12 @@ int main(int argc, char **argv)
ret = setenv("DUMPABLE_SERVER", "yes", 1);
if (ret < 0) {
- err("could not set the DUMPABLE_SERVER env variable");
+ pr_perror("could not set the DUMPABLE_SERVER env variable");
return 1;
}
ret = execl(argv[0], "dumpable_server", NULL);
- err("could not execv %s as a dumpable_server", argv[0]);
+ pr_perror("could not execv %s as a dumpable_server", argv[0]);
return 1;
}
@@ -182,22 +182,22 @@ int main(int argc, char **argv)
waited = wait(&status);
if (waited < 0) {
- err("error calling wait on the child");
+ pr_perror("error calling wait on the child");
return 1;
}
errno = 0;
if (waited != pid) {
- err("waited pid %d did not match child pid %d",
+ pr_perror("waited pid %d did not match child pid %d",
waited, pid);
return 1;
}
if (!WIFEXITED(status)) {
- err("child dumpable server returned abnormally with status=%d",
+ pr_perror("child dumpable server returned abnormally with status=%d",
status);
return 1;
}
if (WEXITSTATUS(status) != 0) {
- err("child dumpable server returned rc=%d",
+ pr_perror("child dumpable server returned rc=%d",
WEXITSTATUS(status));
return 1;
}
diff --git a/test/zdtm/live/static/env00.c b/test/zdtm/live/static/env00.c
index afca275..1feabfa 100644
--- a/test/zdtm/live/static/env00.c
+++ b/test/zdtm/live/static/env00.c
@@ -17,7 +17,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (setenv(envname, test_author, 1)) {
- err("Can't set env var \"%s\" to \"%s\"", envname, test_author);
+ pr_perror("Can't set env var \"%s\" to \"%s\"", envname, test_author);
exit(1);
}
diff --git a/test/zdtm/live/static/fanotify00.c b/test/zdtm/live/static/fanotify00.c
index 80bd0a2..58b890b 100644
--- a/test/zdtm/live/static/fanotify00.c
+++ b/test/zdtm/live/static/fanotify00.c
@@ -147,7 +147,7 @@ int parse_fanotify_fdinfo(int fd, struct fanotify_obj *obj, unsigned int expecte
sprintf(str, "/proc/self/fdinfo/%d", fd);
f = fopen(str, "r");
if (!f) {
- err("Can't open fdinfo to parse");
+ pr_perror("Can't open fdinfo to parse");
return -1;
}
@@ -188,7 +188,7 @@ int parse_fanotify_fdinfo(int fd, struct fanotify_obj *obj, unsigned int expecte
}
if (expected_to_meet != met) {
- err("Expected to meet %d entries but got %d",
+ pr_perror("Expected to meet %d entries but got %d",
expected_to_meet, met);
return -1;
}
@@ -196,7 +196,7 @@ int parse_fanotify_fdinfo(int fd, struct fanotify_obj *obj, unsigned int expecte
return 0;
parse_err:
- err("Can't parse '%s'", str);
+ pr_perror("Can't parse '%s'", str);
return -1;
}
@@ -212,11 +212,11 @@ int main (int argc, char *argv[])
if (ns) {
if (mkdir("/tmp", 666) && errno != EEXIST) {
- err("Unable to create the /tmp directory");
+ pr_perror("Unable to create the /tmp directory");
return -1;
}
if (mount("zdtm", "/tmp", "tmpfs", 0, NULL)) {
- err("Unable to mount tmpfs into %s", "/tmp");
+ pr_perror("Unable to mount tmpfs into %s", "/tmp");
}
}
@@ -224,27 +224,27 @@ int main (int argc, char *argv[])
FAN_CLASS_NOTIF | FAN_UNLIMITED_QUEUE,
0);
if (fa_fd < 0) {
- err("fanotify_init failed");
+ pr_perror("fanotify_init failed");
exit(1);
}
del_after = open(fanotify_path, O_CREAT | O_TRUNC);
if (del_after < 0) {
- err("open failed");
+ pr_perror("open failed");
exit(1);
}
if (fanotify_mark(fa_fd, FAN_MARK_ADD,
FAN_MODIFY | FAN_ACCESS | FAN_OPEN | FAN_CLOSE,
AT_FDCWD, fanotify_path)) {
- err("fanotify_mark failed");
+ pr_perror("fanotify_mark failed");
exit(1);
}
if (fanotify_mark(fa_fd, FAN_MARK_ADD | FAN_MARK_MOUNT,
FAN_ONDIR | FAN_OPEN | FAN_CLOSE,
AT_FDCWD, "/tmp")) {
- err("fanotify_mark failed");
+ pr_perror("fanotify_mark failed");
exit(1);
}
@@ -252,12 +252,12 @@ int main (int argc, char *argv[])
FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY,
FAN_MODIFY | FAN_ACCESS,
AT_FDCWD, "/tmp")) {
- err("fanotify_mark failed");
+ pr_perror("fanotify_mark failed");
exit(1);
}
if (parse_fanotify_fdinfo(fa_fd, &old, 3)) {
- err("parsing fanotify fdinfo failed");
+ pr_perror("parsing fanotify fdinfo failed");
exit(1);
}
@@ -298,7 +298,7 @@ int main (int argc, char *argv[])
if (fanotify_mark(fa_fd, FAN_MARK_REMOVE | FAN_MARK_MOUNT,
FAN_ONDIR | FAN_OPEN | FAN_CLOSE,
AT_FDCWD, "/tmp")) {
- err("fanotify_mark failed");
+ pr_perror("fanotify_mark failed");
exit(1);
}
diff --git a/test/zdtm/live/static/fd.c b/test/zdtm/live/static/fd.c
index 12bda5f..a2e89d9 100644
--- a/test/zdtm/live/static/fd.c
+++ b/test/zdtm/live/static/fd.c
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
pid = fork();
if (pid < 0) {
- err("fork()");
+ pr_perror("fork()");
return 1;
}
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
ret = readlinkat(dirfd(d), de->d_name, pfd, sizeof(pfd) - 1);
if (ret < 0) {
- err("readlink");
+ pr_perror("readlink");
ret = 0;
}
pfd[ret] = '\0';
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
kill(pid, SIGTERM);
if (waitpid(pid, &status, 0) != pid) {
- err("waitpid()");
+ pr_perror("waitpid()");
return 1;
}
diff --git a/test/zdtm/live/static/fdt_shared.c b/test/zdtm/live/static/fdt_shared.c
index ea4ca8d..e31191f 100644
--- a/test/zdtm/live/static/fdt_shared.c
+++ b/test/zdtm/live/static/fdt_shared.c
@@ -28,7 +28,7 @@ static void forked()
char c = 0;
if (write(fork_pfd[1], &c, 1) != 1) {
- err("Unable to send a signal to the parent");
+ pr_perror("Unable to send a signal to the parent");
exit(5);
}
}
@@ -40,7 +40,7 @@ static void wait_children()
for (i = 0; i < CHILDREN; i++) {
if (read(fork_pfd[0], &c, 1) != 1) {
- err("Unable to read a signal from a child");
+ pr_perror("Unable to read a signal from a child");
exit(5);
}
}
@@ -54,7 +54,7 @@ static pid_t clone_child(int (*fn)(void *), int flags)
pid = clone(fn, stack + STACK_SIZE,
flags | SIGCHLD, NULL);
if (pid == -1) {
- err("Unable to clone a new process");
+ pr_perror("Unable to clone a new process");
return -1;
}
@@ -69,7 +69,7 @@ static int child2(void *_arg)
test_waitsig();
if (read(TEST_FD, buf, sizeof(TEST_STRING)) != sizeof(TEST_STRING)) {
- err("Unable to read from %d", TEST_FD);
+ pr_perror("Unable to read from %d", TEST_FD);
return 1;
}
@@ -123,12 +123,12 @@ static int child(void *_arg)
}
if (read(TEST_FD, buf, sizeof(TEST_STRING)) != sizeof(TEST_STRING)) {
- err("Unable to read from %d", TEST_FD);
+ pr_perror("Unable to read from %d", TEST_FD);
return 1;
}
if (close(TEST_FD) == -1) {
- err("Unable to close(%d)", TEST_FD);
+ pr_perror("Unable to close(%d)", TEST_FD);
return 1;
}
@@ -144,7 +144,7 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (pipe(fork_pfd)) {
- err("pipe");
+ pr_perror("pipe");
return 1;
}
@@ -163,19 +163,19 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDWR | O_CREAT, 0666);
if (fd == -1) {
- err("Can't open /dev/zero");
+ pr_perror("Can't open /dev/zero");
return -1;
}
for (i = 0; i < 3; i++)
if (write(fd, TEST_STRING, sizeof(TEST_STRING)) != sizeof(TEST_STRING)) {
- err("Unable to write a test string");
+ pr_perror("Unable to write a test string");
return -1;
}
fd = dup2(fd, TEST_FD);
if (fd == -1) {
- err("Can't dup fd to %d", fd, TEST_FD);
+ pr_perror("Can't dup fd to %d", fd, TEST_FD);
return -1;
}
diff --git a/test/zdtm/live/static/fifo-ghost.c b/test/zdtm/live/static/fifo-ghost.c
index 13d5ee1..94a8c57 100644
--- a/test/zdtm/live/static/fifo-ghost.c
+++ b/test/zdtm/live/static/fifo-ghost.c
@@ -25,19 +25,19 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, mode, 0)) {
- err("can't make fifo \"%s\"", filename);
+ pr_perror("can't make fifo \"%s\"", filename);
exit(1);
}
fd = open(filename, O_RDWR);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
return 1;
}
fd_ro = open(filename, O_RDONLY);
if (fd_ro < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
return 1;
}
@@ -45,7 +45,7 @@ int main(int argc, char **argv)
datagen(buf, sizeof(buf), &crc);
ret = write(fd, buf, sizeof(buf));
if (ret != sizeof(buf)) {
- err("write() failed");
+ pr_perror("write() failed");
return 1;
}
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
ret = read(fd_ro, buf, sizeof(buf));
if (ret != sizeof(buf)) {
- err("read() failed");
+ pr_perror("read() failed");
return 1;
}
diff --git a/test/zdtm/live/static/fifo-rowo-pair.c b/test/zdtm/live/static/fifo-rowo-pair.c
index f0f14bb..b967147 100644
--- a/test/zdtm/live/static/fifo-rowo-pair.c
+++ b/test/zdtm/live/static/fifo-rowo-pair.c
@@ -44,18 +44,18 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(name_master, S_IFIFO | 0700, 0)) {
- err("can't make fifo \"%s\"", name_master);
+ pr_perror("can't make fifo \"%s\"", name_master);
exit(1);
}
if (mknod(name_slave, S_IFIFO | 0700, 0)) {
- err("can't make fifo \"%s\"", name_slave);
+ pr_perror("can't make fifo \"%s\"", name_slave);
exit(1);
}
fd_slave = open(name_slave, O_RDWR);
if (fd_slave < 0) {
- err("can't open %s", name_slave);
+ pr_perror("can't open %s", name_slave);
exit(1);
}
@@ -67,13 +67,13 @@ int main(int argc, char **argv)
fd_master = open(name_master, O_WRONLY);
if (fd_master < 0) {
- err("can't open %s", name_master);
+ pr_perror("can't open %s", name_master);
exit_shot_parent(1);
}
new_slave = dup2(fd_slave, 64);
if (new_slave < 0) {
- err("can't dup %s", name_slave);
+ pr_perror("can't dup %s", name_slave);
exit_shot_parent(1);
}
@@ -83,13 +83,13 @@ int main(int argc, char **argv)
v = TEST_VALUE;
if (write(new_slave, &v, sizeof(v)) != sizeof(v)) {
- err("write failed");
+ pr_perror("write failed");
exit_shot_parent(1);
}
v = TEST_VALUE;
if (write(fd_master, &v, sizeof(v)) != sizeof(v)) {
- err("write failed");
+ pr_perror("write failed");
exit_shot_parent(1);
}
@@ -98,13 +98,13 @@ int main(int argc, char **argv)
exit(0);
} else if (pid < 0) {
- err("test_fork failed");
+ pr_perror("test_fork failed");
exit(1);
}
fd_master = open(name_master, O_RDONLY);
if (fd_master < 0) {
- err("can't open %s", name_master);
+ pr_perror("can't open %s", name_master);
exit_shot(pid, 1);
}
@@ -115,7 +115,7 @@ int main(int argc, char **argv)
test_waitsig();
if (read(fd_master, &v, sizeof(v)) != sizeof(v)) {
- err("read failed");
+ pr_perror("read failed");
exit_shot(pid, 1);
}
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
}
if (read(fd_slave, &v, sizeof(v)) != sizeof(v)) {
- err("read failed");
+ pr_perror("read failed");
exit_shot(pid, 1);
}
if (v != TEST_VALUE) {
@@ -138,13 +138,13 @@ int main(int argc, char **argv)
waitpid(pid, &status, P_ALL);
if (unlink(name_master) < 0)
- err("can't unlink %s: %m", name_master);
+ pr_perror("can't unlink %s", name_master);
if (unlink(name_slave) < 0)
- err("can't unlink %s: %m", name_slave);
+ pr_perror("can't unlink %s", name_slave);
if (!WIFEXITED(status)) {
- err("child %d is still running", pid);
+ pr_perror("child %d is still running", pid);
exit_shot(pid, 1);
}
diff --git a/test/zdtm/live/static/fifo.c b/test/zdtm/live/static/fifo.c
index 10c4221..c8437d9 100644
--- a/test/zdtm/live/static/fifo.c
+++ b/test/zdtm/live/static/fifo.c
@@ -28,13 +28,13 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, mode, 0)) {
- err("can't make fifo \"%s\"", filename);
+ pr_perror("can't make fifo \"%s\"", filename);
exit(1);
}
fd = open(filename, O_RDWR);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
return 1;
}
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
datagen(buf, BUF_SIZE, &crc);
ret = write(fd, buf, BUF_SIZE);
if (ret != BUF_SIZE) {
- err("write() failed");
+ pr_perror("write() failed");
return 1;
}
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
ret = read(fd, buf, BUF_SIZE);
if (ret != BUF_SIZE) {
- err("read() failed");
+ pr_perror("read() failed");
return 1;
}
diff --git a/test/zdtm/live/static/fifo_ro.c b/test/zdtm/live/static/fifo_ro.c
index 1c83b05..63c4d29 100644
--- a/test/zdtm/live/static/fifo_ro.c
+++ b/test/zdtm/live/static/fifo_ro.c
@@ -28,19 +28,19 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, mode, 0)) {
- err("can't make fifo \"%s\"", filename);
+ pr_perror("can't make fifo \"%s\"", filename);
exit(1);
}
fd = open(filename, O_RDWR);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
return 1;
}
fd_ro = open(filename, O_RDONLY);
if (fd_ro < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
return 1;
}
@@ -48,7 +48,7 @@ int main(int argc, char **argv)
datagen(buf, BUF_SIZE, &crc);
ret = write(fd, buf, BUF_SIZE);
if (ret != BUF_SIZE) {
- err("write() failed");
+ pr_perror("write() failed");
return 1;
}
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
ret = read(fd_ro, buf, BUF_SIZE);
if (ret != BUF_SIZE) {
- err("read() failed");
+ pr_perror("read() failed");
return 1;
}
diff --git a/test/zdtm/live/static/fifo_wronly.c b/test/zdtm/live/static/fifo_wronly.c
index 12556a7..fb18b78 100644
--- a/test/zdtm/live/static/fifo_wronly.c
+++ b/test/zdtm/live/static/fifo_wronly.c
@@ -27,13 +27,13 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, mode, 0)) {
- err("can't make fifo \"%s\"", filename);
+ pr_perror("can't make fifo \"%s\"", filename);
exit(1);
}
pid = test_fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
exit(1);
}
@@ -42,18 +42,18 @@ int main(int argc, char **argv)
int res;
fd1 = open(filename, O_RDONLY);
if (fd1 < 0) {
- err("open(%s, O_RDONLY) Failed", filename);
+ pr_perror("open(%s, O_RDONLY) Failed", filename);
chret = errno;
return chret;
}
res = read(fd1, rbuf, 7);
if (res < 0) {
- err("read error %s", filename);
+ pr_perror("read error %s", filename);
chret = errno;
return chret;
}
else if (res == 0) {
- err("read(%d, rbuf, 7) return 0", fd1);
+ pr_perror("read(%d, rbuf, 7) return 0", fd1);
return 1;
}
if (close(fd1) < 0) {
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
fd = open(filename, O_WRONLY);
if (fd < 0) {
- err("open(%s, O_WRONLY) Failed", filename);
+ pr_perror("open(%s, O_WRONLY) Failed", filename);
kill(pid, SIGKILL);
wait(NULL);
return 1;
@@ -76,7 +76,7 @@ int main(int argc, char **argv)
test_waitsig();
if (write(fd, "string", 7) == -1) {
- err("write(%d, 'string', 7) Failed", fd);
+ pr_perror("write(%d, 'string', 7) Failed", fd);
return 1;
}
diff --git a/test/zdtm/live/static/file_append.c b/test/zdtm/live/static/file_append.c
index cca542d..14f1877 100644
--- a/test/zdtm/live/static/file_append.c
+++ b/test/zdtm/live/static/file_append.c
@@ -34,12 +34,12 @@ int main(int argc, char **argv)
test_waitsig();
if (write(fd2, "x", 1) != 1) {
- err("Can't write x");
+ pr_perror("Can't write x");
return 1;
}
if (write(fd, "y", 1) != 1) {
- err("Can't write y");
+ pr_perror("Can't write y");
return 1;
}
diff --git a/test/zdtm/live/static/file_attr.c b/test/zdtm/live/static/file_attr.c
index 45dd150..80ad789 100644
--- a/test/zdtm/live/static/file_attr.c
+++ b/test/zdtm/live/static/file_attr.c
@@ -38,14 +38,14 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
crc = ~0;
datagen(buf, sizeof(buf), &crc);
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write to %s: %m", filename);
+ pr_perror("can't write to %s", filename);
exit(1);
}
@@ -54,17 +54,17 @@ int main(int argc, char ** argv)
.modtime = mtime,
};
if (utime(filename, &ut)) {
- err("can't set modtime %d on %s", mtime, filename);
+ pr_perror("can't set modtime %d on %s", mtime, filename);
exit(1);
}
if (fchmod(fd, perms)) {
- err("can't set perms %o on %s", perms, filename);
+ pr_perror("can't set perms %o on %s", perms, filename);
exit(1);
}
if (unlink(filename)) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
exit(1);
}
diff --git a/test/zdtm/live/static/file_fown.c b/test/zdtm/live/static/file_fown.c
index 4dbc9ef..9b71507 100644
--- a/test/zdtm/live/static/file_fown.c
+++ b/test/zdtm/live/static/file_fown.c
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
}
if (pipe(pipes)) {
- err("Can't create pipe");
+ pr_perror("Can't create pipe");
exit(1);
}
@@ -132,7 +132,7 @@ int main(int argc, char *argv[])
pid = test_fork();
if (pid < 0) {
- err("can't fork %m");
+ pr_perror("can't fork %m");
exit(1);
}
diff --git a/test/zdtm/live/static/file_locks00.c b/test/zdtm/live/static/file_locks00.c
index 77ae118..f701e00 100644
--- a/test/zdtm/live/static/file_locks00.c
+++ b/test/zdtm/live/static/file_locks00.c
@@ -52,7 +52,7 @@ static int check_read_lock(int fd, int whence, off_t offset, off_t len)
ret = fcntl(fd, F_GETLK, &lock);
if (ret == -1) {
- err("F_GETLK failed.");
+ pr_perror("F_GETLK failed.");
return -1;
}
@@ -80,7 +80,7 @@ static int check_write_lock(int fd, int whence, off_t offset, off_t len)
ret = fcntl(fd, F_GETLK, &lock);
if (ret == -1) {
- err("F_GETLK failed.");
+ pr_perror("F_GETLK failed.");
return -1;
}
@@ -107,7 +107,7 @@ static int check_file_locks()
fd_0 = open(file0, O_RDWR | O_CREAT, 0644);
if (fd_0 < 0) {
- err("Unable to open file %s", file0);
+ pr_perror("Unable to open file %s", file0);
return -1;
}
ret0 = check_read_lock(fd_0, SEEK_SET, 0, 0);
@@ -116,7 +116,7 @@ static int check_file_locks()
if (fd_1 < 0) {
close(fd_0);
unlink(file0);
- err("Unable to open file %s", file1);
+ pr_perror("Unable to open file %s", file1);
return -1;
}
ret1 = check_write_lock(fd_1, SEEK_SET, 0, 0);
@@ -138,7 +138,7 @@ int main(int argc, char **argv)
snprintf(file1, sizeof(file0), "%s.1", filename);
fd_0 = open(file0, O_RDWR | O_CREAT | O_EXCL, 0666);
if (fd_0 < 0) {
- err("Unable to open file %s", file0);
+ pr_perror("Unable to open file %s", file0);
return -1;
}
@@ -146,13 +146,13 @@ int main(int argc, char **argv)
if (fd_1 < 0) {
close(fd_0);
unlink(file0);
- err("Unable to open file %s", file1);
+ pr_perror("Unable to open file %s", file1);
return -1;
}
pid = fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
return -1;
}
diff --git a/test/zdtm/live/static/file_locks01.c b/test/zdtm/live/static/file_locks01.c
index be905ff..24f54ac 100644
--- a/test/zdtm/live/static/file_locks01.c
+++ b/test/zdtm/live/static/file_locks01.c
@@ -34,7 +34,7 @@ static int open_all_files(int *fd_0, int *fd_1, int *fd_2)
snprintf(file2, sizeof(file0), "%s.2", filename);
*fd_0 = open(file0, O_RDWR | O_CREAT | O_EXCL, 0666);
if (*fd_0 < 0) {
- err("Unable to open file %s", file0);
+ pr_perror("Unable to open file %s", file0);
return -1;
}
@@ -50,7 +50,7 @@ static int open_all_files(int *fd_0, int *fd_1, int *fd_2)
if (*fd_1 < 0) {
close(*fd_0);
unlink(file0);
- err("Unable to open file %s", file1);
+ pr_perror("Unable to open file %s", file1);
return -1;
}
@@ -63,7 +63,7 @@ static int open_all_files(int *fd_0, int *fd_1, int *fd_2)
close(*fd_1);
unlink(file0);
unlink(file1);
- err("Unable to open file %s", file1);
+ pr_perror("Unable to open file %s", file1);
return -1;
}
@@ -107,7 +107,7 @@ static int check_file_locks()
&fl_owner, &maj, &min, &i_no, &start, end);
if (num < 10) {
- err("Invalid lock info.");
+ pr_perror("Invalid lock info.");
break;
}
@@ -156,7 +156,7 @@ int main(int argc, char **argv)
m = get_cwd_mnt_info();
if (!m) {
- err("Can't fetch mountinfo");
+ pr_perror("Can't fetch mountinfo");
return -1;
}
if (!strcmp(m->fsname, "btrfs"))
diff --git a/test/zdtm/live/static/file_locks02.c b/test/zdtm/live/static/file_locks02.c
index 48e4bd3..2db3bd0 100644
--- a/test/zdtm/live/static/file_locks02.c
+++ b/test/zdtm/live/static/file_locks02.c
@@ -40,7 +40,7 @@ static int check_file_locks(pid_t child)
fl_flag, fl_type, fl_option, &fl_owner);
if (num < 4) {
- err("Invalid lock info.");
+ pr_perror("Invalid lock info.");
break;
}
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
fd = open(filename, O_CREAT | O_RDWR, 0600);
if (fd < 0) {
- err("No file");
+ pr_perror("No file");
return -1;
}
diff --git a/test/zdtm/live/static/file_locks03.c b/test/zdtm/live/static/file_locks03.c
index 9166974..167fd2e 100644
--- a/test/zdtm/live/static/file_locks03.c
+++ b/test/zdtm/live/static/file_locks03.c
@@ -40,7 +40,7 @@ static int check_file_locks(int alt_pid)
fl_flag, fl_type, fl_option, &fl_owner);
if (num < 4) {
- err("Invalid lock info.");
+ pr_perror("Invalid lock info.");
break;
}
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
fd = open(filename, O_CREAT | O_RDWR, 0600);
if (fd < 0) {
- err("No file");
+ pr_perror("No file");
return -1;
}
diff --git a/test/zdtm/live/static/file_locks04.c b/test/zdtm/live/static/file_locks04.c
index f625e9b..05e9bd2 100644
--- a/test/zdtm/live/static/file_locks04.c
+++ b/test/zdtm/live/static/file_locks04.c
@@ -40,7 +40,7 @@ static int check_file_locks(int alt_pid, int fd)
fl_flag, fl_type, fl_option, &fl_owner);
if (num < 4) {
- err("Invalid lock info.");
+ pr_perror("Invalid lock info.");
break;
}
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
fd = open(filename, O_CREAT | O_RDWR, 0600);
if (fd < 0) {
- err("No file");
+ pr_perror("No file");
return -1;
}
@@ -93,14 +93,14 @@ int main(int argc, char **argv)
fd = open(filename, O_RDONLY);
if (fd < 0) {
- err("No file 2");
+ pr_perror("No file 2");
close(pf[1]);
waitpid(pid, NULL, 0);
return -1;
}
if (flock(fd, LOCK_EX | LOCK_NB) == 0) {
- err("Bogus locks");
+ pr_perror("Bogus locks");
close(pf[1]);
waitpid(pid, NULL, 0);
return -1;
diff --git a/test/zdtm/live/static/file_locks05.c b/test/zdtm/live/static/file_locks05.c
index 202704f..f7d34b1 100644
--- a/test/zdtm/live/static/file_locks05.c
+++ b/test/zdtm/live/static/file_locks05.c
@@ -24,13 +24,13 @@ int main(int argc, char **argv)
fd = open(filename, O_CREAT | O_RDWR, 0600);
if (fd < 0) {
- err("No file");
+ pr_perror("No file");
return -1;
}
fd2 = open(filename, O_RDWR);
if (fd2 < 0) {
- err("No file2");
+ pr_perror("No file2");
return -1;
}
diff --git a/test/zdtm/live/static/file_shared.c b/test/zdtm/live/static/file_shared.c
index 3547146..8f1acb1 100644
--- a/test/zdtm/live/static/file_shared.c
+++ b/test/zdtm/live/static/file_shared.c
@@ -55,12 +55,12 @@ int main(int argc, char **argv)
ret = kill(pid, SIGTERM);
if (ret == -1) {
- err("kill() failed: %m");
+ pr_perror("kill() failed");
}
ret = wait(&status);
if (ret == -1) {
- err("wait() failed: %m");
+ pr_perror("wait() failed");
return 1;
}
diff --git a/test/zdtm/live/static/futex.c b/test/zdtm/live/static/futex.c
index 8a5e040..2ad82d2 100644
--- a/test/zdtm/live/static/futex.c
+++ b/test/zdtm/live/static/futex.c
@@ -38,7 +38,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (num_threads > MAX_NUM_THREADS) {
- err("%d threads it too much. max is %d",
+ pr_perror("%d threads it too much. max is %d",
num_threads, MAX_NUM_THREADS);
goto out;
}
@@ -48,7 +48,7 @@ int main(int argc, char **argv)
for (i = 0; i < num_threads; i++)
if (pthread_create(&thr[i], NULL, thread_fn, &m)) {
- err("Can't create %d'th thread", i + 1);
+ pr_perror("Can't create %d'th thread", i + 1);
goto out_kill;
}
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
if (errno == EBUSY)
fail("kids left my mutex locked\n");
else
- err("kids spoiled my mutex");
+ pr_perror("kids spoiled my mutex");
}
if (kid_passed != num_threads)
diff --git a/test/zdtm/live/static/get_smaps_bits.c b/test/zdtm/live/static/get_smaps_bits.c
index e7f736a..9253f4d 100644
--- a/test/zdtm/live/static/get_smaps_bits.c
+++ b/test/zdtm/live/static/get_smaps_bits.c
@@ -102,7 +102,7 @@ int get_smaps_bits(unsigned long where, unsigned long *flags, unsigned long *mad
smaps = fopen("/proc/self/smaps", "r");
if (!smaps) {
- err("Can't open smaps: %m");
+ pr_perror("Can't open smaps");
return -1;
}
@@ -119,7 +119,7 @@ int get_smaps_bits(unsigned long where, unsigned long *flags, unsigned long *mad
fclose(smaps);
if (!found) {
- err("VmFlags not found for %lx", where);
+ pr_perror("VmFlags not found for %lx", where);
return -1;
}
diff --git a/test/zdtm/live/static/groups.c b/test/zdtm/live/static/groups.c
index 24495bf..1aed8f5 100644
--- a/test/zdtm/live/static/groups.c
+++ b/test/zdtm/live/static/groups.c
@@ -20,14 +20,14 @@ int main(int argc, char **argv)
ng = getgroups(0, NULL);
if (ng < 0) {
- err("Can't get groups");
+ pr_perror("Can't get groups");
return -1;
}
grp = malloc((ng + 1) * sizeof(*grp));
ng = getgroups(ng, grp);
if (ng < 0) {
- err("Can't get groups2");
+ pr_perror("Can't get groups2");
return -1;
}
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
grp[ng++] = max + 1;
if (setgroups(ng, grp) < 0) {
- err("Can't set groups");
+ pr_perror("Can't set groups");
return -1;
}
diff --git a/test/zdtm/live/static/grow_map.c b/test/zdtm/live/static/grow_map.c
index 7ce0eb8..c26cfc8 100644
--- a/test/zdtm/live/static/grow_map.c
+++ b/test/zdtm/live/static/grow_map.c
@@ -15,7 +15,7 @@ int main(int argc, char **argv)
start_addr = mmap(NULL, PAGE_SIZE * 10, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (start_addr == MAP_FAILED) {
- err("Can't mal a new region");
+ pr_perror("Can't mal a new region");
return 1;
}
munmap(start_addr, PAGE_SIZE * 10);
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED | MAP_GROWSDOWN, -1, 0);
if (fake_grow_down == MAP_FAILED) {
- err("Can't mal a new region");
+ pr_perror("Can't mal a new region");
return 1;
}
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
if (test_addr == MAP_FAILED) {
- err("Can't mal a new region");
+ pr_perror("Can't mal a new region");
return 1;
}
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED | MAP_GROWSDOWN, -1, 0);
if (grow_down == MAP_FAILED) {
- err("Can't mal a new region");
+ pr_perror("Can't mal a new region");
return 1;
}
diff --git a/test/zdtm/live/static/grow_map02.c b/test/zdtm/live/static/grow_map02.c
index 122dd7d..0b93714 100644
--- a/test/zdtm/live/static/grow_map02.c
+++ b/test/zdtm/live/static/grow_map02.c
@@ -18,7 +18,7 @@ int main(int argc, char **argv)
start_addr = mmap(NULL, PAGE_SIZE * 10, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (start_addr == MAP_FAILED) {
- err("Can't mal a new region");
+ pr_perror("Can't mal a new region");
return 1;
}
munmap(start_addr, PAGE_SIZE * 10);
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED | MAP_GROWSDOWN, -1, 0);
if (grow_down == MAP_FAILED) {
- err("Can't mal a new region");
+ pr_perror("Can't mal a new region");
return 1;
}
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
* Only the irst one will have a guard page
*/
if (mprotect(grow_down + PAGE_SIZE, PAGE_SIZE, PROT_READ)) {
- err("Can't change set protection on a region of memory");
+ pr_perror("Can't change set protection on a region of memory");
return 1;
}
diff --git a/test/zdtm/live/static/grow_map03.c b/test/zdtm/live/static/grow_map03.c
index d9a750b..6310386 100644
--- a/test/zdtm/live/static/grow_map03.c
+++ b/test/zdtm/live/static/grow_map03.c
@@ -21,7 +21,7 @@ int main(int argc, char **argv)
start_addr = mmap(NULL, PAGE_SIZE * 10, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (start_addr == MAP_FAILED) {
- err("Can't mal a new region");
+ pr_perror("Can't mal a new region");
return 1;
}
munmap(start_addr, PAGE_SIZE * 10);
diff --git a/test/zdtm/live/static/inotify00.c b/test/zdtm/live/static/inotify00.c
index 8254048..00190dc 100644
--- a/test/zdtm/live/static/inotify00.c
+++ b/test/zdtm/live/static/inotify00.c
@@ -83,7 +83,7 @@ static int inotify_read_events(char *prefix, int inotify_fd, unsigned int *expec
ret = read(inotify_fd, buf, sizeof(buf));
if (ret < 0) {
if (errno != EAGAIN) {
- err("Can't read inotify queue");
+ pr_perror("Can't read inotify queue");
return -1;
} else {
ret = 0;
@@ -119,7 +119,7 @@ int main (int argc, char *argv[])
test_init(argc, argv);
if (mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) {
- err("Can't create directory %s", dirname);
+ pr_perror("Can't create directory %s", dirname);
exit(1);
}
@@ -131,13 +131,13 @@ int main (int argc, char *argv[])
static char buf[PATH_MAX];
if (mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL)) {
- err("Unable to remount /");
+ pr_perror("Unable to remount /");
return 1;
}
pid = fork();
if (pid < 0) {
- err("Can't fork a test process");
+ pr_perror("Can't fork a test process");
exit(1);
}
if (pid == 0) {
@@ -145,17 +145,17 @@ int main (int argc, char *argv[])
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
if (unshare(CLONE_NEWNS)) {
- err("Unable to unshare mount namespace");
+ pr_perror("Unable to unshare mount namespace");
exit(1);
}
if (mount("zdtm", dirname, "tmpfs", 0, NULL)) {
- err("Unable to mount tmpfs");
+ pr_perror("Unable to mount tmpfs");
exit(1);
}
fd = open(dirname, O_RDONLY);
if (fd < 0) {
- err("Unable to open %s", dirname);
+ pr_perror("Unable to open %s", dirname);
exit(1);
}
dup2(fd, 100);
@@ -172,7 +172,7 @@ int main (int argc, char *argv[])
fd = inotify_init1(IN_NONBLOCK);
if (fd < 0) {
- err("inotify_init failed");
+ pr_perror("inotify_init failed");
exit(1);
}
@@ -180,17 +180,17 @@ int main (int argc, char *argv[])
real_fd = open(test_file_path, O_CREAT | O_TRUNC | O_RDWR, 0644);
if (real_fd < 0) {
- err("Can't create %s", test_file_path);
+ pr_perror("Can't create %s", test_file_path);
exit(1);
}
if (inotify_add_watch(fd, dirname, mask) < 0) {
- err("inotify_add_watch failed");
+ pr_perror("inotify_add_watch failed");
exit(1);
}
if (inotify_add_watch(fd, test_file_path, mask) < 0) {
- err("inotify_add_watch failed");
+ pr_perror("inotify_add_watch failed");
exit(1);
}
@@ -202,7 +202,7 @@ int main (int argc, char *argv[])
#ifndef INOTIFY01
if (unlink(test_file_path)) {
- err("can't unlink %s", test_file_path);
+ pr_perror("can't unlink %s", test_file_path);
exit(1);
}
@@ -211,7 +211,7 @@ int main (int argc, char *argv[])
if (emask) {
char emask_bits[128];
decode_event_mask(emask_bits, sizeof(emask_bits), emask);
- err("Unhandled events in emask %#x -> %s",
+ pr_perror("Unhandled events in emask %#x -> %s",
emask, emask_bits);
exit(1);
}
@@ -235,7 +235,7 @@ int main (int argc, char *argv[])
#ifndef INOTIFY01
real_fd = open(test_file_path, O_CREAT | O_TRUNC | O_RDWR, 0644);
if (real_fd < 0) {
- err("Can't create %s", test_file_path);
+ pr_perror("Can't create %s", test_file_path);
exit(1);
}
close(real_fd);
diff --git a/test/zdtm/live/static/inotify_irmap.c b/test/zdtm/live/static/inotify_irmap.c
index 011fb81..e16a418 100644
--- a/test/zdtm/live/static/inotify_irmap.c
+++ b/test/zdtm/live/static/inotify_irmap.c
@@ -32,7 +32,7 @@ int main (int argc, char *argv[])
unlink(TFIL);
if (creat(TFIL, 0600) < 0) {
- err("Can't make test file");
+ pr_perror("Can't make test file");
exit(1);
}
diff --git a/test/zdtm/live/static/inotify_system.c b/test/zdtm/live/static/inotify_system.c
index 6a0074c..6a95f5b 100644
--- a/test/zdtm/live/static/inotify_system.c
+++ b/test/zdtm/live/static/inotify_system.c
@@ -77,12 +77,12 @@ int createFiles(char *path, char *target, char *link) {
int fd;
fd = open(path,O_CREAT, 0644);
if (fd < 0) {
- err("can't open %s: %m", path);
+ pr_perror("can't open %s", path);
return -1;
}
close(fd);
if (symlink(target, link) < 0) {
- err("can't symlink %s to %s: %m", path, link);
+ pr_perror("can't symlink %s to %s", path, link);
return -1;
}
return 0;
@@ -92,7 +92,7 @@ int addWatcher(int fd, const char *path) {
int wd;
wd = inotify_add_watch(fd, path, IN_ALL_EVENTS | IN_DONT_FOLLOW);
if (wd < 0) {
- err("inotify_add_watch(%d, %s, IN_ALL_EVENTS) Failed, %s",
+ pr_perror("inotify_add_watch(%d, %s, IN_ALL_EVENTS) Failed, %s",
fd, path, strerror(errno));
return -1;
}
@@ -101,7 +101,7 @@ int addWatcher(int fd, const char *path) {
int fChmod(char *path) {
if (chmod(path, 0755) < 0) {
- err("chmod(%s, 0755) Failed, %s",
+ pr_perror("chmod(%s, 0755) Failed, %s",
path, strerror(errno));
return -1;
}
@@ -111,16 +111,16 @@ int fChmod(char *path) {
int fWriteClose(char *path) {
int fd = open(path, O_RDWR | O_CREAT, 0700);
if (fd == -1) {
- err("open(%s, O_RDWR|O_CREAT,0700) Failed, %s",
+ pr_perror("open(%s, O_RDWR|O_CREAT,0700) Failed, %s",
path, strerror(errno));
return -1;
}
if (write(fd, "string", 7) == -1) {
- err("write(%d, %s, 1) Failed, %s", fd, path, strerror(errno));
+ pr_perror("write(%d, %s, 1) Failed, %s", fd, path, strerror(errno));
return -1;
}
if (close(fd) == -1) {
- err("close(%s) Failed, %s", path, strerror(errno));
+ pr_perror("close(%s) Failed, %s", path, strerror(errno));
return -1;
}
return 0;
@@ -130,17 +130,17 @@ int fNoWriteClose(char *path) {
char buf[BUF_SIZE];
int fd = open(path, O_RDONLY);
if ( fd < 0 ) {
- err("open(%s, O_RDONLY) Failed, %s",
+ pr_perror("open(%s, O_RDONLY) Failed, %s",
path, strerror(errno));
return -1;
}
if (read(fd, buf, BUF_SIZE) == -1) {
- err("read error: %s", strerror(errno));
+ pr_perror("read error: %s", strerror(errno));
close(fd);
return -1;
}
if (close(fd) == -1) {
- err("close(%s) Failed, %s", path, strerror(errno));
+ pr_perror("close(%s) Failed, %s", path, strerror(errno));
return -1;
}
return 0;
@@ -148,7 +148,7 @@ int fNoWriteClose(char *path) {
int fMove(char *from, char *to) {
if (rename(from, to) == -1) {
- err("rename error (from: %s to: %s) : %s",
+ pr_perror("rename error (from: %s to: %s) : %s",
from, to, strerror(errno));
return -1;
}
@@ -158,25 +158,25 @@ int fMove(char *from, char *to) {
desc init_env(const char *dir, char *file_path, char *link_path) {
desc in_desc = {-1, -1, -1, -1};
if (mkdir(dir, 0777) < 0) {
- err("error in creating directory: %s, %s",
+ pr_perror("error in creating directory: %s, %s",
dir, strerror(errno));
return in_desc;
}
in_desc.inot = inotify_init();
if (in_desc.inot < 0) {
- err("inotify_init () Failed, %s", strerror(errno));
+ pr_perror("inotify_init () Failed, %s", strerror(errno));
rmdir(dir);
return in_desc;
}
if (snprintf(file_path, BUF_SIZE, "%s/%s", dir, filename) >= BUF_SIZE) {
- err("filename %s is too long", filename);
+ pr_perror("filename %s is too long", filename);
rmdir(dir);
return in_desc;
}
if (snprintf(link_path, BUF_SIZE, "%s/%s", dir, linkname) >= BUF_SIZE) {
- err("filename %s is too long", linkname);
+ pr_perror("filename %s is too long", linkname);
rmdir(dir);
return in_desc;
}
@@ -193,7 +193,7 @@ desc init_env(const char *dir, char *file_path, char *link_path) {
int fDelete(char *path) {
if (unlink(path) != 0) {
- err("unlink: (%s)", strerror(errno));
+ pr_perror("unlink: (%s)", strerror(errno));
return -1;
}
return 0;
@@ -201,7 +201,7 @@ int fDelete(char *path) {
int fRemDir(const char *target) {
if(rmdir(target)) {
- err("rmdir: (%s)", strerror(errno));
+ pr_perror("rmdir: (%s)", strerror(errno));
return -1;
}
return 0;
@@ -296,7 +296,7 @@ next_event:
int read_set(int inot_fd, char *event_set) {
int len;
if ((len = read(inot_fd, event_set, EVENT_BUF_LEN)) < 0) {
- err("read(%d, buf, %d) Failed, errno=%d : %s",
+ pr_perror("read(%d, buf, %d) Failed, errno=%d : %s",
inot_fd, EVENT_BUF_LEN, errno, strerror(errno));
return -1;
}
diff --git a/test/zdtm/live/static/inotify_system_nodel.c b/test/zdtm/live/static/inotify_system_nodel.c
index 6a0074c..6a95f5b 100644
--- a/test/zdtm/live/static/inotify_system_nodel.c
+++ b/test/zdtm/live/static/inotify_system_nodel.c
@@ -77,12 +77,12 @@ int createFiles(char *path, char *target, char *link) {
int fd;
fd = open(path,O_CREAT, 0644);
if (fd < 0) {
- err("can't open %s: %m", path);
+ pr_perror("can't open %s", path);
return -1;
}
close(fd);
if (symlink(target, link) < 0) {
- err("can't symlink %s to %s: %m", path, link);
+ pr_perror("can't symlink %s to %s", path, link);
return -1;
}
return 0;
@@ -92,7 +92,7 @@ int addWatcher(int fd, const char *path) {
int wd;
wd = inotify_add_watch(fd, path, IN_ALL_EVENTS | IN_DONT_FOLLOW);
if (wd < 0) {
- err("inotify_add_watch(%d, %s, IN_ALL_EVENTS) Failed, %s",
+ pr_perror("inotify_add_watch(%d, %s, IN_ALL_EVENTS) Failed, %s",
fd, path, strerror(errno));
return -1;
}
@@ -101,7 +101,7 @@ int addWatcher(int fd, const char *path) {
int fChmod(char *path) {
if (chmod(path, 0755) < 0) {
- err("chmod(%s, 0755) Failed, %s",
+ pr_perror("chmod(%s, 0755) Failed, %s",
path, strerror(errno));
return -1;
}
@@ -111,16 +111,16 @@ int fChmod(char *path) {
int fWriteClose(char *path) {
int fd = open(path, O_RDWR | O_CREAT, 0700);
if (fd == -1) {
- err("open(%s, O_RDWR|O_CREAT,0700) Failed, %s",
+ pr_perror("open(%s, O_RDWR|O_CREAT,0700) Failed, %s",
path, strerror(errno));
return -1;
}
if (write(fd, "string", 7) == -1) {
- err("write(%d, %s, 1) Failed, %s", fd, path, strerror(errno));
+ pr_perror("write(%d, %s, 1) Failed, %s", fd, path, strerror(errno));
return -1;
}
if (close(fd) == -1) {
- err("close(%s) Failed, %s", path, strerror(errno));
+ pr_perror("close(%s) Failed, %s", path, strerror(errno));
return -1;
}
return 0;
@@ -130,17 +130,17 @@ int fNoWriteClose(char *path) {
char buf[BUF_SIZE];
int fd = open(path, O_RDONLY);
if ( fd < 0 ) {
- err("open(%s, O_RDONLY) Failed, %s",
+ pr_perror("open(%s, O_RDONLY) Failed, %s",
path, strerror(errno));
return -1;
}
if (read(fd, buf, BUF_SIZE) == -1) {
- err("read error: %s", strerror(errno));
+ pr_perror("read error: %s", strerror(errno));
close(fd);
return -1;
}
if (close(fd) == -1) {
- err("close(%s) Failed, %s", path, strerror(errno));
+ pr_perror("close(%s) Failed, %s", path, strerror(errno));
return -1;
}
return 0;
@@ -148,7 +148,7 @@ int fNoWriteClose(char *path) {
int fMove(char *from, char *to) {
if (rename(from, to) == -1) {
- err("rename error (from: %s to: %s) : %s",
+ pr_perror("rename error (from: %s to: %s) : %s",
from, to, strerror(errno));
return -1;
}
@@ -158,25 +158,25 @@ int fMove(char *from, char *to) {
desc init_env(const char *dir, char *file_path, char *link_path) {
desc in_desc = {-1, -1, -1, -1};
if (mkdir(dir, 0777) < 0) {
- err("error in creating directory: %s, %s",
+ pr_perror("error in creating directory: %s, %s",
dir, strerror(errno));
return in_desc;
}
in_desc.inot = inotify_init();
if (in_desc.inot < 0) {
- err("inotify_init () Failed, %s", strerror(errno));
+ pr_perror("inotify_init () Failed, %s", strerror(errno));
rmdir(dir);
return in_desc;
}
if (snprintf(file_path, BUF_SIZE, "%s/%s", dir, filename) >= BUF_SIZE) {
- err("filename %s is too long", filename);
+ pr_perror("filename %s is too long", filename);
rmdir(dir);
return in_desc;
}
if (snprintf(link_path, BUF_SIZE, "%s/%s", dir, linkname) >= BUF_SIZE) {
- err("filename %s is too long", linkname);
+ pr_perror("filename %s is too long", linkname);
rmdir(dir);
return in_desc;
}
@@ -193,7 +193,7 @@ desc init_env(const char *dir, char *file_path, char *link_path) {
int fDelete(char *path) {
if (unlink(path) != 0) {
- err("unlink: (%s)", strerror(errno));
+ pr_perror("unlink: (%s)", strerror(errno));
return -1;
}
return 0;
@@ -201,7 +201,7 @@ int fDelete(char *path) {
int fRemDir(const char *target) {
if(rmdir(target)) {
- err("rmdir: (%s)", strerror(errno));
+ pr_perror("rmdir: (%s)", strerror(errno));
return -1;
}
return 0;
@@ -296,7 +296,7 @@ next_event:
int read_set(int inot_fd, char *event_set) {
int len;
if ((len = read(inot_fd, event_set, EVENT_BUF_LEN)) < 0) {
- err("read(%d, buf, %d) Failed, errno=%d : %s",
+ pr_perror("read(%d, buf, %d) Failed, errno=%d : %s",
inot_fd, EVENT_BUF_LEN, errno, strerror(errno));
return -1;
}
diff --git a/test/zdtm/live/static/ipc_namespace.c b/test/zdtm/live/static/ipc_namespace.c
index 9a74e6b..6237309 100644
--- a/test/zdtm/live/static/ipc_namespace.c
+++ b/test/zdtm/live/static/ipc_namespace.c
@@ -71,12 +71,12 @@ static int read_ipc_sysctl(char *name, int *data, size_t size)
fd = open(name, O_RDONLY);
if (fd < 0) {
- err("Can't open %d", name);
+ pr_perror("Can't open %d", name);
return fd;
}
ret = read(fd, buf, 32);
if (ret < 0) {
- err("Can't read %s", name);
+ pr_perror("Can't read %s", name);
ret = -errno;
goto err;
}
@@ -94,7 +94,7 @@ static int get_messages_info(struct ipc_ns *ipc)
ret = msgctl(0, MSG_INFO, (struct msqid_ds *)&info);
if (ret < 0) {
- err("msgctl failed with %d", errno);
+ pr_perror("msgctl failed with %d", errno);
return ret;
}
@@ -118,7 +118,7 @@ static int get_semaphores_info(struct ipc_ns *ipc)
err = semctl(0, 0, SEM_INFO, &info);
if (err < 0)
- err("semctl failed with %d", errno);
+ pr_perror("semctl failed with %d", errno);
ipc->sem_ctls[0] = info.semmsl;
ipc->sem_ctls[1] = info.semmns;
@@ -141,7 +141,7 @@ static int get_shared_memory_info(struct ipc_ns *ipc)
ret = shmctl(0, IPC_INFO, &u.shmid);
if (ret < 0)
- err("semctl failed with %d", errno);
+ pr_perror("semctl failed with %d", errno);
ipc->shm_ctlmax = u.shminfo64.shmmax;
ipc->shm_ctlall = u.shminfo64.shmall;
@@ -149,7 +149,7 @@ static int get_shared_memory_info(struct ipc_ns *ipc)
ret = shmctl(0, SHM_INFO, &u.shmid);
if (ret < 0)
- err("semctl failed with %d", errno);
+ pr_perror("semctl failed with %d", errno);
ipc->shm_tot = u.shminfo.shm_tot;
ipc->ids[IPC_SHM_IDS].in_use = u.shminfo.used_ids;
@@ -177,19 +177,19 @@ int fill_ipc_ns(struct ipc_ns *ipc)
ret = get_messages_info(ipc);
if (ret < 0) {
- err("Failed to collect messages");
+ pr_perror("Failed to collect messages");
return ret;
}
ret = get_semaphores_info(ipc);
if (ret < 0) {
- err("Failed to collect semaphores");
+ pr_perror("Failed to collect semaphores");
return ret;
}
ret = get_shared_memory_info(ipc);
if (ret < 0) {
- err("Failed to collect shared memory");
+ pr_perror("Failed to collect shared memory");
return ret;
}
return 0;
@@ -203,13 +203,13 @@ static int rand_ipc_sysctl(char *name, unsigned int val)
fd = open(name, O_WRONLY);
if (fd < 0) {
- err("Can't open %d", name);
+ pr_perror("Can't open %d", name);
return fd;
}
sprintf(buf, "%d\n", val);
ret = write(fd, buf, strlen(buf));
if (ret < 0) {
- err("Can't write %u into %s", val, name);
+ pr_perror("Can't write %u into %s", val, name);
return -errno;
}
close(fd);
@@ -225,14 +225,14 @@ static int rand_ipc_sem(void)
fd = open(name, O_WRONLY);
if (fd < 0) {
- err("Can't open %s", name);
+ pr_perror("Can't open %s", name);
return fd;
}
sprintf(buf, "%d %d %d %d\n", (unsigned)lrand48(), (unsigned)lrand48(),
(unsigned)lrand48(), (unsigned)lrand48());
ret = write(fd, buf, 128);
if (ret < 0) {
- err("Can't write %s: %d", name, errno);
+ pr_perror("Can't write %s: %d", name, errno);
return -errno;
}
close(fd);
@@ -270,7 +270,7 @@ static int rand_ipc_ns(void)
ret = rand_ipc_sysctl("/proc/sys/fs/mqueue/msgsize_max", ((unsigned)lrand48() & (8192 * 128 - 1)) | 128);
if (ret < 0)
- err("Failed to randomize ipc namespace tunables");
+ pr_perror("Failed to randomize ipc namespace tunables");
return ret;
}
@@ -281,49 +281,49 @@ static void show_ipc_entry(struct ipc_ns *old, struct ipc_ns *new)
for (i = 0; i < 3; i++) {
if (old->ids[i].in_use != new->ids[i].in_use)
- err("ids[%d].in_use differs: %d ---> %d", i,
+ pr_perror("ids[%d].in_use differs: %d ---> %d", i,
old->ids[i].in_use, new->ids[i].in_use);
}
for (i = 0; i < 4; i++) {
if (old->sem_ctls[i] != new->sem_ctls[i])
- err("sem_ctls[%d] differs: %d ---> %d", i,
+ pr_perror("sem_ctls[%d] differs: %d ---> %d", i,
old->sem_ctls[i], new->sem_ctls[i]);
}
if (old->msg_ctlmax != new->msg_ctlmax)
- err("msg_ctlmax differs: %d ---> %d",
+ pr_perror("msg_ctlmax differs: %d ---> %d",
old->msg_ctlmax, new->msg_ctlmax);
if (old->msg_ctlmnb != new->msg_ctlmnb)
- err("msg_ctlmnb differs: %d ---> %d",
+ pr_perror("msg_ctlmnb differs: %d ---> %d",
old->msg_ctlmnb, new->msg_ctlmnb);
if (old->msg_ctlmni != new->msg_ctlmni)
- err("msg_ctlmni differs: %d ---> %d",
+ pr_perror("msg_ctlmni differs: %d ---> %d",
old->msg_ctlmni, new->msg_ctlmni);
if (old->auto_msgmni != new->auto_msgmni)
- err("auto_msgmni differs: %d ---> %d",
+ pr_perror("auto_msgmni differs: %d ---> %d",
old->auto_msgmni, new->auto_msgmni);
if (old->shm_ctlmax != new->shm_ctlmax)
- err("shm_ctlmax differs: %d ---> %d",
+ pr_perror("shm_ctlmax differs: %d ---> %d",
old->shm_ctlmax, new->shm_ctlmax);
if (old->shm_ctlall != new->shm_ctlall)
- err("shm_ctlall differs: %d ---> %d",
+ pr_perror("shm_ctlall differs: %d ---> %d",
old->shm_ctlall, new->shm_ctlall);
if (old->shm_ctlmni != new->shm_ctlmni)
- err("shm_ctlmni differs: %d ---> %d",
+ pr_perror("shm_ctlmni differs: %d ---> %d",
old->shm_ctlmni, new->shm_ctlmni);
if (old->shm_rmid_forced != new->shm_rmid_forced)
- err("shm_rmid_forced differs: %d ---> %d",
+ pr_perror("shm_rmid_forced differs: %d ---> %d",
old->shm_rmid_forced, new->shm_rmid_forced);
if (old->mq_queues_max != new->mq_queues_max)
- err("mq_queues_max differs: %d ---> %d",
+ pr_perror("mq_queues_max differs: %d ---> %d",
old->mq_queues_max, new->mq_queues_max);
if (old->mq_msg_max != new->mq_msg_max)
- err("mq_msg_max differs: %d ---> %d",
+ pr_perror("mq_msg_max differs: %d ---> %d",
old->mq_msg_max, new->mq_msg_max);
if (old->mq_msgsize_max != new->mq_msgsize_max)
- err("mq_msgsize_max differs: %d ---> %d",
+ pr_perror("mq_msgsize_max differs: %d ---> %d",
old->mq_msgsize_max, new->mq_msgsize_max);
}
@@ -333,13 +333,13 @@ static int test_fn(int argc, char **argv)
ret = rand_ipc_ns();
if (ret) {
- err("Failed to randomize ipc ns before migration");
+ pr_perror("Failed to randomize ipc ns before migration");
return -1;
}
ret = fill_ipc_ns(&ipc_before);
if (ret) {
- err("Failed to collect ipc ns before migration");
+ pr_perror("Failed to collect ipc ns before migration");
return ret;
}
@@ -348,12 +348,12 @@ static int test_fn(int argc, char **argv)
ret = fill_ipc_ns(&ipc_after);
if (ret) {
- err("Failed to collect ipc ns after migration");
+ pr_perror("Failed to collect ipc ns after migration");
return ret;
}
if (memcmp(&ipc_before, &ipc_after, sizeof(ipc_after))) {
- err("IPC's differ");
+ pr_perror("IPC's differ");
show_ipc_entry(&ipc_before, &ipc_after);
return -EINVAL;
}
diff --git a/test/zdtm/live/static/jobctl00.c b/test/zdtm/live/static/jobctl00.c
index 368ddc7..397747b 100644
--- a/test/zdtm/live/static/jobctl00.c
+++ b/test/zdtm/live/static/jobctl00.c
@@ -197,7 +197,7 @@ int start_jobs(pid_t *jobs, int njobs, int fdmaster, int fdslave)
* exit :) and signal that via SIGCHLD */
if (signal(SIGUSR2, record_sig) == SIG_ERR ||
signal(SIGCHLD, record_sig) == SIG_ERR) {
- err("can't install signal handler: %m");
+ pr_perror("can't install signal handler");
return -1;
}
@@ -206,7 +206,7 @@ int start_jobs(pid_t *jobs, int njobs, int fdmaster, int fdslave)
jobs[i] = fork();
if (jobs[i] < 0) { /* we're busted - bail out */
- err("fork failed: %m");
+ pr_perror("fork failed");
goto killout;
}
@@ -273,19 +273,19 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (num_jobs > JOBS_MAX) {
- err("%d jobs is too many", num_jobs);
+ pr_perror("%d jobs is too many", num_jobs);
exit(1);
}
if (make_pty_pair(&fdmaster, &fdslave) < 0) {
- err("can't make pty pair: %m");
+ pr_perror("can't make pty pair");
exit(1);
}
sleep(30);
if (start_jobs(jobs, num_jobs, fdmaster, fdslave)) {
- err("failed to start jobs");
+ pr_perror("failed to start jobs");
exit(1);
}
diff --git a/test/zdtm/live/static/link10.c b/test/zdtm/live/static/link10.c
index 3855d58..9f4c7f0 100644
--- a/test/zdtm/live/static/link10.c
+++ b/test/zdtm/live/static/link10.c
@@ -25,24 +25,24 @@ int main(int argc, char ** argv)
if (snprintf(filename2, sizeof(filename2), "%s.lnk", filename) >=
sizeof(filename2)) {
- err("filename %s is too long", filename);
+ pr_perror("filename %s is too long", filename);
exit(1);
}
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644);
if (fd < 0) {
- err("can't open %s: %m", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
if (link(filename, filename2) < 0) {
- err("can't link %s to %s: %m", filename, filename2);
+ pr_perror("can't link %s to %s", filename, filename2);
goto unlink;
}
fd2 = open(filename2, O_RDONLY);
if (fd < 0) {
- err("can't open %s: %m", filename2);
+ pr_perror("can't open %s", filename2);
goto unlink;
}
diff --git a/test/zdtm/live/static/maps00.c b/test/zdtm/live/static/maps00.c
index 685b349..aa3c29e 100644
--- a/test/zdtm/live/static/maps00.c
+++ b/test/zdtm/live/static/maps00.c
@@ -77,27 +77,27 @@ static int make_map(struct map *map)
/* need file */
if (snprintf(map->filename, sizeof(map->filename),
"%s-%02d", filename, i++) >= sizeof(map->filename)) {
- err("filename %s is too long", filename);
+ pr_perror("filename %s is too long", filename);
return -1;
}
map->fd = open(map->filename, O_RDWR | O_CREAT, 0600);
if (map->fd < 0) {
- err("can't open %s", map->filename);
+ pr_perror("can't open %s", map->filename);
return -1;
}
crc = ~0;
datagen(buf, sizeof(buf), &crc);
if (write(map->fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("failed to write %s", map->filename);
+ pr_perror("failed to write %s", map->filename);
return -1;
}
}
map->ptr = mmap(NULL, ONE_MAP_SIZE, map->prot, map->flag, map->fd, 0);
if (map->ptr == MAP_FAILED) {
- err("can't create mapping");
+ pr_perror("can't create mapping");
return -1;
}
@@ -178,7 +178,7 @@ static int check_map(struct map *map)
if (!(map->flag & MAP_ANONYMOUS)) {
lseek(map->fd,0,SEEK_SET);
if (write(map->fd,test_func,check_map - test_func)<check_map - test_func) {
- err("failed to write %s", map->filename);
+ pr_perror("failed to write %s", map->filename);
return -1;
}
}
diff --git a/test/zdtm/live/static/maps01.c b/test/zdtm/live/static/maps01.c
index 6deaf87..d25e805 100644
--- a/test/zdtm/live/static/maps01.c
+++ b/test/zdtm/live/static/maps01.c
@@ -109,13 +109,13 @@ int main(int argc, char ** argv)
(unsigned long) m + MEM_SIZE);
fd = open(path, O_RDWR);
if (fd == -1) {
- err("Can't open file %s: %m", path);
+ pr_perror("Can't open file %s", path);
goto err;
}
m2 = mmap(NULL, PAGE_SIZE, PROT_WRITE | PROT_READ, MAP_SHARED, fd, MEM_OFFSET3);
if (m2 == MAP_FAILED) {
- err("Can't map file %s", path);
+ pr_perror("Can't map file %s", path);
goto err;
}
close(fd);
diff --git a/test/zdtm/live/static/maps02.c b/test/zdtm/live/static/maps02.c
index 55fae70..4c12bec 100644
--- a/test/zdtm/live/static/maps02.c
+++ b/test/zdtm/live/static/maps02.c
@@ -23,7 +23,7 @@ static int alloc_anon_mmap(struct mmap_data *m, int flags, int adv)
m->start = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE,
flags, -1, 0);
if (m->start == MAP_FAILED) {
- err("mmap failed: %m");
+ pr_perror("mmap failed");
return -1;
}
@@ -33,7 +33,7 @@ static int alloc_anon_mmap(struct mmap_data *m, int flags, int adv)
munmap(m->start, MEM_SIZE);
*m = (struct mmap_data){ };
} else {
- err("madvise failed: %m");
+ pr_perror("madvise failed");
return -1;
}
}
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
return -1;
if (m[i].orig_flags != m[i].new_flags) {
- err("Flags are changed %lx %lx -> %lx (%d)",
+ pr_perror("Flags are changed %lx %lx -> %lx (%d)",
(unsigned long)m[i].start,
m[i].orig_flags, m[i].new_flags, i);
fail();
@@ -95,7 +95,7 @@ int main(int argc, char **argv)
}
if (m[i].orig_madv != m[i].new_madv) {
- err("Madvs are changed %lx %lx -> %lx (%d)",
+ pr_perror("Madvs are changed %lx %lx -> %lx (%d)",
(unsigned long)m[i].start,
m[i].orig_madv, m[i].new_madv, i);
fail();
diff --git a/test/zdtm/live/static/maps03.c b/test/zdtm/live/static/maps03.c
index d5d6451..c4aba19 100644
--- a/test/zdtm/live/static/maps03.c
+++ b/test/zdtm/live/static/maps03.c
@@ -15,7 +15,7 @@ int main(int argc, char **argv)
mem = (void *)mmap(NULL, (10L << 30), PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if ((void *)mem == MAP_FAILED) {
- err("mmap failed: %m");
+ pr_perror("mmap failed");
return -1;
}
diff --git a/test/zdtm/live/static/maps04.c b/test/zdtm/live/static/maps04.c
index aba85c0..780c566 100644
--- a/test/zdtm/live/static/maps04.c
+++ b/test/zdtm/live/static/maps04.c
@@ -37,7 +37,7 @@ int main(int argc, char ** argv)
for (i = 0; i < MEM_SIZE / (1<<20); i++)
if (mprotect(m + (lrand48() * PAGE_SIZE % MEM_SIZE), PAGE_SIZE, PROT_NONE)) {
- err("mprotect");
+ pr_perror("mprotect");
return 1;
}
@@ -45,7 +45,7 @@ int main(int argc, char ** argv)
test_waitsig();
if (mprotect(m, MEM_SIZE, PROT_READ))
- err("mprotect");
+ pr_perror("mprotect");
crc = ~0;
if (datachk(m, MEM_SIZE, &crc))
diff --git a/test/zdtm/live/static/maps05.c b/test/zdtm/live/static/maps05.c
index c5bea2f..faa09ee 100644
--- a/test/zdtm/live/static/maps05.c
+++ b/test/zdtm/live/static/maps05.c
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
addr = mmap(NULL, summary, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (addr == MAP_FAILED) {
- err("Can't mmap");
+ pr_perror("Can't mmap");
return 1;
}
munmap(addr, summary);
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
map[i] = mmap(i > 0 ? map[i - 1] + 8192 : addr, 4096, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (map[i] == MAP_FAILED) {
- err("Can't mmap");
+ pr_perror("Can't mmap");
return 1;
} else {
/* Dirtify it */
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
map[NR_MAPS_1] = mmap(map[NR_MAPS_1 - 1] + 8192, MAPS_SIZE_1, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_GROWSDOWN, -1, 0);
if (map[NR_MAPS_1] == MAP_FAILED) {
- err("Can't mmap");
+ pr_perror("Can't mmap");
return 1;
} else {
/* Dirtify it */
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
map[NR_MAPS_2] = mmap(map[NR_MAPS_1] + MAPS_SIZE_1, MAPS_SIZE_2, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_GROWSDOWN, -1, 0);
if (map[NR_MAPS_2] == MAP_FAILED) {
- err("Can't mmap");
+ pr_perror("Can't mmap");
return 1;
} else {
/* Dirtify it */
diff --git a/test/zdtm/live/static/maps_file_prot.c b/test/zdtm/live/static/maps_file_prot.c
index 570191f..3b28c1f 100644
--- a/test/zdtm/live/static/maps_file_prot.c
+++ b/test/zdtm/live/static/maps_file_prot.c
@@ -13,7 +13,7 @@ const char *test_author = "Jamie Liu <jamieliu at google.com>";
char *filename;
TEST_OPTION(filename, string, "file name", 1);
-#define die(fmt, arg...) do { err(fmt, ## arg); return 1; } while (0)
+#define die(fmt, arg...) do { pr_perror(fmt, ## arg); return 1; } while (0)
int main(int argc, char ** argv)
{
diff --git a/test/zdtm/live/static/mlock_setuid.c b/test/zdtm/live/static/mlock_setuid.c
index b961d1c..92b313e 100644
--- a/test/zdtm/live/static/mlock_setuid.c
+++ b/test/zdtm/live/static/mlock_setuid.c
@@ -17,14 +17,14 @@ int main(int argc, char **argv)
start = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (start == MAP_FAILED) {
- err("mmap failed");
+ pr_perror("mmap failed");
return -1;
}
test_msg("Lock vma from %lx to %lx\n", start, start + MEM_SIZE);
ret = mlock(start, MEM_SIZE);
if (ret < 0) {
- err("mlock");
+ pr_perror("mlock");
return -1;
}
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
test_msg("Setuid to 18943\n");
ret = setuid(18943);
if (ret < 0) {
- err("setuid");
+ pr_perror("setuid");
return -1;
}
diff --git a/test/zdtm/live/static/mnt_ext_auto.c b/test/zdtm/live/static/mnt_ext_auto.c
index d780a61..4a931b9 100644
--- a/test/zdtm/live/static/mnt_ext_auto.c
+++ b/test/zdtm/live/static/mnt_ext_auto.c
@@ -24,7 +24,7 @@ int main(int argc, char ** argv)
root = getenv("ZDTM_ROOT");
if (root == NULL) {
- err("root");
+ pr_perror("root");
return 1;
}
@@ -42,13 +42,13 @@ int main(int argc, char ** argv)
mkdir(dname, 755);
sprintf(src, "%s/test", dname);
if (mount("zdtm_auto_ext_mnt", dname, "tmpfs", 0, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
mkdir(src, 755);
mkdir(dst, 755);
if (mount(src, dst, NULL, MS_BIND, NULL)) {
- err("bind");
+ pr_perror("bind");
return 1;
}
return 0;
diff --git a/test/zdtm/live/static/mnt_ext_master.c b/test/zdtm/live/static/mnt_ext_master.c
index 0caf6ed..290868e 100644
--- a/test/zdtm/live/static/mnt_ext_master.c
+++ b/test/zdtm/live/static/mnt_ext_master.c
@@ -24,7 +24,7 @@ int main(int argc, char ** argv)
root = getenv("ZDTM_ROOT");
if (root == NULL) {
- err("root");
+ pr_perror("root");
return 1;
}
@@ -42,19 +42,19 @@ int main(int argc, char ** argv)
mkdir(dname, 755);
sprintf(src, "%s/test", dname);
if (mount("zdtm_auto_ext_mnt", dname, "tmpfs", 0, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
mkdir(src, 755);
mkdir(dst, 755);
if (mount(src, dst, NULL, MS_BIND, NULL)) {
- err("bind");
+ pr_perror("bind");
return 1;
}
if (mount(src, dst, NULL, MS_SLAVE, NULL)) {
- err("slave");
+ pr_perror("slave");
return 1;
}
diff --git a/test/zdtm/live/static/mntns_deleted.c b/test/zdtm/live/static/mntns_deleted.c
index c6e24d8..d899150 100644
--- a/test/zdtm/live/static/mntns_deleted.c
+++ b/test/zdtm/live/static/mntns_deleted.c
@@ -40,12 +40,12 @@ int main(int argc, char *argv[])
test_init(argc, argv);
if (mkdir(dirname, 0700)) {
- err("mkdir %s", dirname);
+ pr_perror("mkdir %s", dirname);
exit(1);
}
if (mount("none", dirname, "tmpfs", MS_MGC_VAL, NULL)) {
- err("mount %s", dirname);
+ pr_perror("mount %s", dirname);
return 1;
}
@@ -60,39 +60,39 @@ int main(int argc, char *argv[])
if (mkdir(path_src, 0700) ||
mkdir(path_dst, 0700)) {
- err("mkdir");
+ pr_perror("mkdir");
return 1;
}
if ((fd1 = open(TEST_FILE_SRC, O_WRONLY | O_CREAT | O_TRUNC) < 0)) {
- err("touching %s", TEST_FILE_SRC);
+ pr_perror("touching %s", TEST_FILE_SRC);
return 1;
}
close(fd1);
if ((fd2 = open(TEST_FILE_DST, O_WRONLY | O_CREAT | O_TRUNC) < 0)) {
- err("touching %s", TEST_FILE_DST);
+ pr_perror("touching %s", TEST_FILE_DST);
return 1;
}
close(fd2);
if (mount(path_src, path_dst, NULL, MS_BIND | MS_MGC_VAL, NULL)) {
- err("mount %s -> %s", path_src, path_dst);
+ pr_perror("mount %s -> %s", path_src, path_dst);
return 1;
}
if (mount(TEST_FILE_SRC, TEST_FILE_DST, NULL, MS_BIND | MS_MGC_VAL, NULL)) {
- err("mount %s -> %s", TEST_FILE_SRC, TEST_FILE_DST);
+ pr_perror("mount %s -> %s", TEST_FILE_SRC, TEST_FILE_DST);
return 1;
}
if (rmdir(path_src)) {
- err("rmdir %s", path_src);
+ pr_perror("rmdir %s", path_src);
return 1;
}
if (unlink(TEST_FILE_SRC)) {
- err("unlink %s", TEST_FILE_SRC);
+ pr_perror("unlink %s", TEST_FILE_SRC);
return 1;
}
diff --git a/test/zdtm/live/static/mntns_link_remap.c b/test/zdtm/live/static/mntns_link_remap.c
index c031dd3..d8e1fb9 100644
--- a/test/zdtm/live/static/mntns_link_remap.c
+++ b/test/zdtm/live/static/mntns_link_remap.c
@@ -47,7 +47,7 @@ static int get_mntid(int fd)
snprintf(str, sizeof(str), "/proc/self/fdinfo/%d", fd);
f = fopen(str, "r");
if (!f) {
- err("Can't open %s to parse", str);
+ pr_perror("Can't open %s to parse", str);
return -1;
}
while (fgets(str, sizeof(str), f)) {
@@ -69,7 +69,7 @@ int ns_child(void *_arg)
snprintf(fpath, sizeof(fpath), "%s/1", dirname);
if (umount(fpath)) {
- err("umount");
+ pr_perror("umount");
return 1;
}
@@ -82,20 +82,20 @@ int ns_child(void *_arg)
}
if (mount(lpath, fpath, NULL, MS_BIND, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
snprintf(fpath, sizeof(fpath), "%s/0", dirname);
if (umount(fpath)) {
- err("umount");
+ pr_perror("umount");
return 1;
}
snprintf(fpath, sizeof(fpath), "%s/2/%s", dirname, MPTS_FILE);
fd2 = open(fpath, O_RDWR);
if (fd2 < 0) {
- err("open");
+ pr_perror("open");
return -1;
}
close(args->sync);
@@ -107,7 +107,7 @@ int ns_child(void *_arg)
exit(1);
if (fstat(args->fd, &st1) || fstat(fd2, &st2)) {
- err("stat");
+ pr_perror("stat");
exit(1);
}
@@ -118,7 +118,7 @@ int ns_child(void *_arg)
#else
if (st1.st_nlink != 0) {
#endif
- err("Wrong number of links: %d", st1.st_nlink);
+ pr_perror("Wrong number of links: %d", st1.st_nlink);
exit(1);
}
@@ -144,7 +144,7 @@ int main(int argc, char **argv)
}
if (mount("test", dirname, "tmpfs", 0, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
return 1;
}
if (mount("test", fpath, "tmpfs", 0, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
return 1;
}
if (mount(lpath, fpath, NULL, MS_BIND, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
snprintf(lpath, sizeof(lpath), "%s/0/2", dirname);
@@ -179,7 +179,7 @@ int main(int argc, char **argv)
}
if (pipe(p) == -1) {
- err("pipe");
+ pr_perror("pipe");
return 1;
}
@@ -194,13 +194,13 @@ int main(int argc, char **argv)
snprintf(fpath, sizeof(fpath), "%s/0/1/%s", dirname, MPTS_FILE);
snprintf(lpath, sizeof(fpath), "%s/0/2/%s", dirname, MPTS_FILE);
if (link(fpath, lpath) == -1) {
- err("link");
+ pr_perror("link");
return -1;
}
#ifdef ZDTM_LINK_REMAP
snprintf(lpath, sizeof(fpath), "%s/0/%s", dirname, MPTS_FILE);
if (link(fpath, lpath) == -1) {
- err("link");
+ pr_perror("link");
return -1;
}
#endif
@@ -208,7 +208,7 @@ int main(int argc, char **argv)
pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
if (pid < 0) {
- err("Unable to fork child");
+ pr_perror("Unable to fork child");
return 1;
}
diff --git a/test/zdtm/live/static/mntns_open.c b/test/zdtm/live/static/mntns_open.c
index a40de96..99c2209 100644
--- a/test/zdtm/live/static/mntns_open.c
+++ b/test/zdtm/live/static/mntns_open.c
@@ -46,7 +46,7 @@ static int get_mntid(int fd)
snprintf(str, sizeof(str), "/proc/self/fdinfo/%d", fd);
f = fopen(str, "r");
if (!f) {
- err("Can't open %s to parse", str);
+ pr_perror("Can't open %s to parse", str);
return -1;
}
while (fgets(str, sizeof(str), f)) {
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
if (pid < 0) {
- err("Unable to fork child");
+ pr_perror("Unable to fork child");
return 1;
}
diff --git a/test/zdtm/live/static/mntns_root_bind.c b/test/zdtm/live/static/mntns_root_bind.c
index 6826820..72d8800 100644
--- a/test/zdtm/live/static/mntns_root_bind.c
+++ b/test/zdtm/live/static/mntns_root_bind.c
@@ -47,19 +47,19 @@ int main(int argc, char **argv)
mkdir(path, 0700) ||
mkdir(spath, 0700) ||
mkdir(bpath, 0700)) {
- err("mkdir");
+ pr_perror("mkdir");
return 1;
}
pid = fork();
if (pid < 0) {
- err("fork");
+ pr_perror("fork");
return 1;
}
if (pid == 0) {
unshare(CLONE_NEWNS);
if (mount(path, bpath, NULL, MS_BIND, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
task_waiter_wait4(&t, 1);
if (mount("test", spath, "tmpfs", 0, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
@@ -93,12 +93,12 @@ int main(int argc, char **argv)
task_waiter_complete(&t, 2);
if (waitpid(pid, &status, 0) != pid) {
- err("waitpid %d", pid);
+ pr_perror("waitpid %d", pid);
return 1;
}
if (status) {
- err("%d/%d/%d/%d", WIFEXITED(status), WEXITSTATUS(status), WIFSIGNALED(status), WTERMSIG(status));
+ pr_perror("%d/%d/%d/%d", WIFEXITED(status), WEXITSTATUS(status), WIFSIGNALED(status), WTERMSIG(status));
return 1;
}
diff --git a/test/zdtm/live/static/mntns_rw_ro_rw.c b/test/zdtm/live/static/mntns_rw_ro_rw.c
index 14a134c..5aac87c 100644
--- a/test/zdtm/live/static/mntns_rw_ro_rw.c
+++ b/test/zdtm/live/static/mntns_rw_ro_rw.c
@@ -15,15 +15,15 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mount("/proc/sys/", "/proc/sys", NULL, MS_BIND, NULL)) {
- err("Unable to bind-mount /proc/sys");
+ pr_perror("Unable to bind-mount /proc/sys");
return 1;
}
if (mount("/proc/sys/net", "/proc/sys/net", NULL, MS_BIND, NULL)) {
- err("Unable to bind-mount /proc/sys/net");
+ pr_perror("Unable to bind-mount /proc/sys/net");
return 1;
}
if (mount("/proc/sys/", "/proc/sys", NULL, MS_RDONLY|MS_BIND|MS_REMOUNT, NULL)) {
- err("Unable to remount /proc/sys");
+ pr_perror("Unable to remount /proc/sys");
return 1;
}
diff --git a/test/zdtm/live/static/mntns_shared_bind.c b/test/zdtm/live/static/mntns_shared_bind.c
index 28b5ffa..d90f969 100644
--- a/test/zdtm/live/static/mntns_shared_bind.c
+++ b/test/zdtm/live/static/mntns_shared_bind.c
@@ -40,12 +40,12 @@ int main(int argc, char **argv)
snprintf(bpath, sizeof(bpath), "%s/test.bind", dirname);
snprintf(spath, sizeof(spath), "%s/test/sub", dirname);
if (mkdir(dirname, 0700)) {
- err("mkdir");
+ pr_perror("mkdir");
return 1;
}
if (mount(NULL, "/", NULL, MS_SHARED, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
@@ -53,7 +53,7 @@ int main(int argc, char **argv)
/* */
if (mount(dirname, dirname, "tmpfs", 0, NULL) ||
mount(NULL, dirname, NULL, MS_SHARED, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
#endif
@@ -61,19 +61,19 @@ int main(int argc, char **argv)
if (mkdir(path, 0700) ||
mkdir(spath, 0700) ||
mkdir(bpath, 0700)) {
- err("mkdir");
+ pr_perror("mkdir");
return 1;
}
pid = fork();
if (pid < 0) {
- err("fork");
+ pr_perror("fork");
return 1;
}
if (pid == 0) {
unshare(CLONE_NEWNS);
if (mount(path, bpath, NULL, MS_BIND, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
task_waiter_wait4(&t, 1);
if (mount("test", spath, "tmpfs", 0, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
@@ -107,12 +107,12 @@ int main(int argc, char **argv)
task_waiter_complete(&t, 2);
if (waitpid(pid, &status, 0) != pid) {
- err("waitpid %d", pid);
+ pr_perror("waitpid %d", pid);
return 1;
}
if (status) {
- err("%d/%d/%d/%d", WIFEXITED(status), WEXITSTATUS(status), WIFSIGNALED(status), WTERMSIG(status));
+ pr_perror("%d/%d/%d/%d", WIFEXITED(status), WEXITSTATUS(status), WIFSIGNALED(status), WTERMSIG(status));
return 1;
}
diff --git a/test/zdtm/live/static/mount_paths.c b/test/zdtm/live/static/mount_paths.c
index 543d8b7..a42b0eb 100644
--- a/test/zdtm/live/static/mount_paths.c
+++ b/test/zdtm/live/static/mount_paths.c
@@ -29,13 +29,13 @@ int main(int argc, char **argv)
mkdir(test_dir, 0700);
if (mount("", test_dir, "tmpfs", 0, NULL)) {
- err("mount");
+ pr_perror("mount");
return 1;
}
snprintf(fname, sizeof(buf), "%s/\\\t \\\\ \\tt", test_dir);
if (mkdir(fname, 0700)) {
- err("mkdir");
+ pr_perror("mkdir");
return 1;
}
diff --git a/test/zdtm/live/static/mountpoints.c b/test/zdtm/live/static/mountpoints.c
index 2b5c8a0..0df5ddc 100644
--- a/test/zdtm/live/static/mountpoints.c
+++ b/test/zdtm/live/static/mountpoints.c
@@ -63,7 +63,7 @@ int ns_child(void *_arg)
}
if (stat(MPTS_ROOT"/dev/mntns2/test", &st)) {
- err("Can't stat /dev/share-1/test.share/test.share");
+ pr_perror("Can't stat /dev/share-1/test.share/test.share");
return 1;
}
@@ -95,7 +95,7 @@ again:
}
if (mount(NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL)) {
- err("Can't remount / with MS_PRIVATE");
+ pr_perror("Can't remount / with MS_PRIVATE");
return -1;
}
@@ -151,7 +151,7 @@ done:
}
tmpfs_fd = open(MPTS_ROOT"/dev/test", O_WRONLY | O_CREAT);
if (write(tmpfs_fd, "hello", 5) <= 0) {
- err("write() failed");
+ pr_perror("write() failed");
return 1;
}
@@ -159,18 +159,18 @@ done:
mkdir(MPTS_ROOT"/dev/overmount", 0600);
fd = open(MPTS_ROOT"/dev/overmount/test.over", O_WRONLY | O_CREAT);
if (fd == -1) {
- err("Unable to open "MPTS_ROOT"/dev/overmount");
+ pr_perror("Unable to open "MPTS_ROOT"/dev/overmount");
return -1;
}
close(fd);
if (mount("none", MPTS_ROOT"/dev/overmount", "tmpfs", 0, "") < 0) {
- err("Can't mount "MPTS_ROOT"/dev/overmount");
+ pr_perror("Can't mount "MPTS_ROOT"/dev/overmount");
return 1;
}
mkdir(MPTS_ROOT"/dev/non-root", 0600);
if (mount(MPTS_ROOT"/dev/non-root", MPTS_ROOT"/module", NULL, MS_BIND, NULL) < 0) {
- err("Can't bind-mount %s -> %s", MPTS_ROOT"/dev/tdir", MPTS_ROOT"/module");
+ pr_perror("Can't bind-mount %s -> %s", MPTS_ROOT"/dev/tdir", MPTS_ROOT"/module");
}
mkdir(MPTS_ROOT"/dev/non-root/test", 0600);
@@ -232,7 +232,7 @@ done:
mkdir(MPTS_ROOT"/dev/share-1/test.mnt.share/test.share", 0600);
if (umount(MPTS_ROOT"/dev/slave2/test.mnt.share")) {
- err("Can't umount "MPTS_ROOT"/dev/slave2/test.mnt.share: %m");
+ pr_perror("Can't umount "MPTS_ROOT"/dev/slave2/test.mnt.share");
return 1;
}
@@ -245,14 +245,14 @@ done:
fd = open(MPTS_ROOT"/dev/bmfile", O_CREAT | O_WRONLY);
if (fd < 0) {
- err("Can't create " MPTS_ROOT "/dev/share-1/bmfile");
+ pr_perror("Can't create " MPTS_ROOT "/dev/share-1/bmfile");
return 1;
}
close(fd);
fd = open(MPTS_ROOT"/dev/bmfile-mount", O_CREAT | O_WRONLY);
if (fd < 0) {
- err("Can't create " MPTS_ROOT "/dev/share-1/bmfile");
+ pr_perror("Can't create " MPTS_ROOT "/dev/share-1/bmfile");
return 1;
}
close(fd);
@@ -289,7 +289,7 @@ done:
if (getenv("ZDTM_NOSUBNS") == NULL) {
pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
if (pid < 0) {
- err("Unable to fork child");
+ pr_perror("Unable to fork child");
return 1;
}
}
@@ -309,7 +309,7 @@ done:
}
if (umount(MPTS_ROOT"/dev/overmount") == -1) {
- err("Can't umount "MPTS_ROOT"/dev/overmount");
+ pr_perror("Can't umount "MPTS_ROOT"/dev/overmount");
return -1;
}
if (access(MPTS_ROOT"/dev/overmount/test.over", F_OK)) {
@@ -320,11 +320,11 @@ done:
{
struct stat st1, st2;
if (stat(MPTS_ROOT"/dev/share-1/test.mnt.share/test.share", &st1)) {
- err("Can't stat /dev/share-1/test.share/test.share");
+ pr_perror("Can't stat /dev/share-1/test.share/test.share");
return 1;
}
if (stat(MPTS_ROOT"/dev/share-2/test.mnt.share/test.share", &st2)) {
- err("Can't stat /dev/share-2/test.mnt.share/test.share");
+ pr_perror("Can't stat /dev/share-2/test.mnt.share/test.share");
return 1;
}
if (st1.st_ino != st2.st_ino) {
@@ -332,7 +332,7 @@ done:
return 1;
}
if (stat(MPTS_ROOT"/dev/slave/test.mnt.share/test.share", &st2)) {
- err("Can't stat /dev/slave/test.mnt.share/test.share");
+ pr_perror("Can't stat /dev/slave/test.mnt.share/test.share");
return 1;
}
if (st1.st_ino != st2.st_ino) {
@@ -340,15 +340,15 @@ done:
return 1;
}
if (stat(MPTS_ROOT"/dev/share-1/test.mnt.slave/test.slave", &st1) != -1 || errno != ENOENT) {
- err("/dev/share-1/test.mnt.slave/test.slave exists");
+ pr_perror("/dev/share-1/test.mnt.slave/test.slave exists");
return 1;
}
if (stat(MPTS_ROOT"/dev/slave/test.mnt.slave/test.slave", &st2)) {
- err("Can't stat /dev/slave/test.mnt.slave/test.slave");
+ pr_perror("Can't stat /dev/slave/test.mnt.slave/test.slave");
return 1;
}
if (stat(MPTS_ROOT"/dev/non-root/test", &st1)) {
- err("Can't stat /dev/non-root/test");
+ pr_perror("Can't stat /dev/non-root/test");
return 1;
}
}
diff --git a/test/zdtm/live/static/mprotect00.c b/test/zdtm/live/static/mprotect00.c
index 4138ab5..be70135 100644
--- a/test/zdtm/live/static/mprotect00.c
+++ b/test/zdtm/live/static/mprotect00.c
@@ -83,13 +83,13 @@ int main(int argc, char ** argv)
pagesize = sysconf(_SC_PAGESIZE);
if (pagesize < 0) {
- err("can't get PAGE_SIZE: %m");
+ pr_perror("can't get PAGE_SIZE");
exit(1);
}
ptr = mmap(NULL, pagesize * (NUM_MPROTS + 1), PROT_NONE, MAP_PRIVATE | MAP_ANON, 0, 0);
if (ptr == MAP_FAILED) {
- err("calloc failed: %m");
+ pr_perror("calloc failed");
return -1;
}
@@ -99,7 +99,7 @@ int main(int argc, char ** argv)
for (i = 0; i < NUM_MPROTS; i++)
if (mprotect(ptr_aligned + pagesize * i,
pagesize / 2, prots[i]) < 0) {
- err("mprotect failed: %m");
+ pr_perror("mprotect failed");
exit(1);
}
diff --git a/test/zdtm/live/static/msgque.c b/test/zdtm/live/static/msgque.c
index c4bc7a3..f90b7d8 100644
--- a/test/zdtm/live/static/msgque.c
+++ b/test/zdtm/live/static/msgque.c
@@ -37,13 +37,13 @@ static int test_fn(int argc, char **argv)
key = ftok(argv[0], 822155650);
if (key == -1) {
- err("Can't make key");
+ pr_perror("Can't make key");
exit(1);
}
pid = test_fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
exit(1);
}
@@ -51,7 +51,7 @@ static int test_fn(int argc, char **argv)
if (msg == -1) {
msg = msgget(key, 0666);
if (msg == -1) {
- err("Can't get queue");
+ pr_perror("Can't get queue");
goto err_kill;
}
}
diff --git a/test/zdtm/live/static/mtime_mmap.c b/test/zdtm/live/static/mtime_mmap.c
index 29413a4..6c97487 100644
--- a/test/zdtm/live/static/mtime_mmap.c
+++ b/test/zdtm/live/static/mtime_mmap.c
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
fd = open(filename, O_RDWR | O_CREAT, 0666);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
@@ -42,19 +42,19 @@ int main(int argc, char **argv)
count = sizeof(buf);
memset(buf, 1, count);
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("failed to write %s", filename);
+ pr_perror("failed to write %s", filename);
exit(1);
}
if (fstat(fd, &fst) < 0) {
- err("can't get %s file info", filename);
+ pr_perror("can't get %s file info", filename);
goto failed;
}
ptr = (char *)mmap(NULL, count, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
- err("mmap() Failed, errno=%d : %s", errno, strerror(errno));
+ pr_perror("mmap() Failed, errno=%d : %s", errno, strerror(errno));
goto failed;
}
@@ -66,12 +66,12 @@ int main(int argc, char **argv)
ptr[i]++;
if (munmap(ptr, count)) {
- err("munmap Failed, errno=%d : %s", errno, strerror(errno));
+ pr_perror("munmap Failed, errno=%d : %s", errno, strerror(errno));
goto failed;
}
if (fstat(fd, &fst) < 0) {
- err("can't get %s file info", filename);
+ pr_perror("can't get %s file info", filename);
goto failed;
}
@@ -96,7 +96,7 @@ int main(int argc, char **argv)
test_waitsig();
if (fstat(fd, &fst) < 0) {
- err("can't get %s file info", filename);
+ pr_perror("can't get %s file info", filename);
goto failed;
}
diff --git a/test/zdtm/live/static/netns-dev.c b/test/zdtm/live/static/netns-dev.c
index 4d7fede..43b25b9 100644
--- a/test/zdtm/live/static/netns-dev.c
+++ b/test/zdtm/live/static/netns-dev.c
@@ -87,13 +87,13 @@ static int save_and_set(int opt, FILE *fp, struct test_conf *tc) {
*/
ret = fscanf(fp, "%d", &tc->ipv4_conf[opt]);
if (ret != 1) {
- err("fscanf");
+ pr_perror("fscanf");
return -1;
}
ret = fseek(fp, 0, SEEK_SET);
if (ret) {
- err("fseek");
+ pr_perror("fseek");
return -1;
}
@@ -109,7 +109,7 @@ static int save_and_set(int opt, FILE *fp, struct test_conf *tc) {
ret = fprintf(fp, "%d", tc->ipv4_conf_rand[opt]);
if (ret < 0) {
- err("fprintf");
+ pr_perror("fprintf");
return -1;
}
@@ -125,7 +125,7 @@ static int check_and_restore(int opt, FILE *fp, struct test_conf *tc) {
*/
ret = fscanf(fp, "%d", &val);
if (ret != 1) {
- err("fscanf");
+ pr_perror("fscanf");
return -1;
}
@@ -137,7 +137,7 @@ static int check_and_restore(int opt, FILE *fp, struct test_conf *tc) {
ret = fseek(fp, 0, SEEK_SET);
if (ret) {
- err("fseek");
+ pr_perror("fseek");
return -1;
}
@@ -146,7 +146,7 @@ static int check_and_restore(int opt, FILE *fp, struct test_conf *tc) {
*/
ret = fprintf(fp, "%d", tc->ipv4_conf[opt]);
if (ret < 0) {
- err("fprintf");
+ pr_perror("fprintf");
return -1;
}
@@ -163,7 +163,7 @@ static int for_each_option_do(int (*f)(int opt, FILE *fp, struct test_conf *tc),
ret = snprintf(path, sizeof(path), "%s/%s", tc->dir, devconfs[i]);
if (ret < 0) {
- err("snprintf");
+ pr_perror("snprintf");
return -1;
}
@@ -173,7 +173,7 @@ static int for_each_option_do(int (*f)(int opt, FILE *fp, struct test_conf *tc),
fp = fopen(path, "r+");
if (fp == NULL) {
- err("fopen");
+ pr_perror("fopen");
return -1;
}
diff --git a/test/zdtm/live/static/netns-nf.c b/test/zdtm/live/static/netns-nf.c
index 11ad52e..39cf8e1 100644
--- a/test/zdtm/live/static/netns-nf.c
+++ b/test/zdtm/live/static/netns-nf.c
@@ -16,13 +16,13 @@ static int test_fn(int argc, char **argv)
char cmd[128];
if (system("iptables -A INPUT -t filter --protocol icmp -j DROP")) {
- err("Can't set input rule");
+ pr_perror("Can't set input rule");
return -1;
}
sprintf(cmd, "iptables -L > pre-%s", filename);
if (system(cmd)) {
- err("Can't save iptables");
+ pr_perror("Can't save iptables");
return -1;
}
diff --git a/test/zdtm/live/static/overmount_dev.c b/test/zdtm/live/static/overmount_dev.c
index c99b6a5..b3dd4e0 100644
--- a/test/zdtm/live/static/overmount_dev.c
+++ b/test/zdtm/live/static/overmount_dev.c
@@ -27,28 +27,28 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (snprintf(path, sizeof(path), "%s/foo", dirname) >= sizeof(path)) {
- err("directory name \"%s\"is too long", dirname);
+ pr_perror("directory name \"%s\"is too long", dirname);
exit(1);
}
if (mkdir(dirname, 0700)) {
- err("can't make directory %s", dirname);
+ pr_perror("can't make directory %s", dirname);
exit(1);
}
if (mknod(path, mode, dev)) {
- err("can't make device file \"%s\"", path);
+ pr_perror("can't make device file \"%s\"", path);
exit(1);
}
fd = open(path, O_RDWR);
if (fd < 0) {
- err("can't open %s", path);
+ pr_perror("can't open %s", path);
goto rmdir;
}
if (mount("rien", dirname, "tmpfs", 0, 0) < 0) {
- err("can't mount tmpfs over %s: %m", dirname);
+ pr_perror("can't mount tmpfs over %s", dirname);
goto cleanup;
}
diff --git a/test/zdtm/live/static/overmount_fifo.c b/test/zdtm/live/static/overmount_fifo.c
index a9fd6c4..2de2a8a 100644
--- a/test/zdtm/live/static/overmount_fifo.c
+++ b/test/zdtm/live/static/overmount_fifo.c
@@ -25,28 +25,28 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (snprintf(path, sizeof(path), "%s/foo", dirname) >= sizeof(path)) {
- err("directory name \"%s\"is too long", dirname);
+ pr_perror("directory name \"%s\"is too long", dirname);
exit(1);
}
if (mkdir(dirname, 0700)) {
- err("can't make directory %s", dirname);
+ pr_perror("can't make directory %s", dirname);
exit(1);
}
if (mknod(path, mode, 0)) {
- err("can't make fifo \"%s\"", path);
+ pr_perror("can't make fifo \"%s\"", path);
exit(1);
}
fd = open(path, O_RDWR);
if (fd < 0) {
- err("can't open %s", path);
+ pr_perror("can't open %s", path);
goto rmdir;
}
if (mount("rien", dirname, "tmpfs", 0, 0) < 0) {
- err("can't mount tmpfs over %s: %m", dirname);
+ pr_perror("can't mount tmpfs over %s", dirname);
goto cleanup;
}
diff --git a/test/zdtm/live/static/overmount_file.c b/test/zdtm/live/static/overmount_file.c
index 20ae2bd..5c370e0 100644
--- a/test/zdtm/live/static/overmount_file.c
+++ b/test/zdtm/live/static/overmount_file.c
@@ -23,23 +23,23 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (snprintf(path, sizeof(path), "%s/foo", dirname) >= sizeof(path)) {
- err("directory name \"%s\"is too long", dirname);
+ pr_perror("directory name \"%s\"is too long", dirname);
exit(1);
}
if (mkdir(dirname, 0700)) {
- err("can't make directory %s", dirname);
+ pr_perror("can't make directory %s", dirname);
exit(1);
}
fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", path);
+ pr_perror("can't open %s", path);
goto rmdir;
}
if (mount("rien", dirname, "tmpfs", 0, 0) < 0) {
- err("can't mount tmpfs over %s: %m", dirname);
+ pr_perror("can't mount tmpfs over %s", dirname);
goto cleanup;
}
diff --git a/test/zdtm/live/static/overmount_sock.c b/test/zdtm/live/static/overmount_sock.c
index 13a6140..94e4c7e 100644
--- a/test/zdtm/live/static/overmount_sock.c
+++ b/test/zdtm/live/static/overmount_sock.c
@@ -34,23 +34,23 @@ static int setup_srv_sock(const char *filename)
int sock;
if (fill_sock_name(&name, filename) < 0) {
- err("filename \"%s\" is too long", filename);
+ pr_perror("filename \"%s\" is too long", filename);
return -1;
}
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
- err("can't create socket: %m");
+ pr_perror("can't create socket");
return -1;
}
if (bind(sock, (struct sockaddr *) &name, SUN_LEN(&name)) < 0) {
- err("can't bind to socket \"%s\": %m", filename);
+ pr_perror("can't bind to socket \"%s\"", filename);
goto err;
}
if (listen(sock, 1) < 0) {
- err("can't listen on a socket \"%s\"", filename);
+ pr_perror("can't listen on a socket \"%s\"", filename);
goto err;
}
@@ -92,12 +92,12 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (snprintf(path, sizeof(path), "%s/foo", dirname) >= sizeof(path)) {
- err("directory name \"%s\"is too long", dirname);
+ pr_perror("directory name \"%s\"is too long", dirname);
exit(1);
}
if (mkdir(dirname, 0700)) {
- err("can't make directory %s", dirname);
+ pr_perror("can't make directory %s", dirname);
exit(1);
}
@@ -107,7 +107,7 @@ int main(int argc, char ** argv)
pid = fork();
if (pid < 0) {
- err("can't fork");
+ pr_perror("can't fork");
goto out;
}
@@ -131,7 +131,7 @@ int main(int argc, char ** argv)
acc_sock = accept(sock, NULL, NULL);
if (acc_sock < 0) {
- err("can't accept() the connection on \"%s\": %m", path);
+ pr_perror("can't accept() the connection on \"%s\"", path);
goto out_kill;
}
@@ -139,7 +139,7 @@ int main(int argc, char ** argv)
sock = acc_sock;
if (mount("rien", dirname, "tmpfs", 0, 0) < 0) {
- err("can't mount tmpfs over %s: %m", dirname);
+ pr_perror("can't mount tmpfs over %s", dirname);
goto out_kill;
}
diff --git a/test/zdtm/live/static/packet_sock.c b/test/zdtm/live/static/packet_sock.c
index 5931a55..db1e159 100644
--- a/test/zdtm/live/static/packet_sock.c
+++ b/test/zdtm/live/static/packet_sock.c
@@ -95,13 +95,13 @@ int main(int argc, char **argv)
sk1 = socket(PF_PACKET, SOCK_RAW, 0);
if (sk1 < 0) {
- err("Can't create socket 1");
+ pr_perror("Can't create socket 1");
return 1;
}
sk2 = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP));
if (sk2 < 0) {
- err("Can't create socket 2");
+ pr_perror("Can't create socket 2");
return 1;
}
@@ -109,31 +109,31 @@ int main(int argc, char **argv)
addr.sll_family = AF_PACKET;
addr.sll_ifindex = 1; /* loopback should be 1 in all namespaces */
if (bind(sk2, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- err("Can't bind socket %m");
+ pr_perror("Can't bind socket %m");
return 1;
}
alen = sizeof(addr1);
if (getsockname(sk1, (struct sockaddr *)&addr1, &alen) < 0) {
- err("Can't get sockname 1");
+ pr_perror("Can't get sockname 1");
return 1;
}
alen = sizeof(addr2);
if (getsockname(sk2, (struct sockaddr *)&addr2, &alen) < 0) {
- err("Can't get sockname 2");
+ pr_perror("Can't get sockname 2");
return 1;
}
ver = TPACKET_V2;
if (setsockopt(sk1, SOL_PACKET, PACKET_VERSION, &ver, sizeof(ver)) < 0) {
- err("Can't set version %m");
+ pr_perror("Can't set version %m");
return 1;
}
yes = 1;
if (setsockopt(sk1, SOL_PACKET, PACKET_AUXDATA, &yes, sizeof(yes)) < 0) {
- err("Can't set auxdata %m");
+ pr_perror("Can't set auxdata %m");
return 1;
}
@@ -143,25 +143,25 @@ int main(int argc, char **argv)
ring.tp_frame_size = 1024;
ring.tp_frame_nr = (ring.tp_block_size / ring.tp_frame_size) * ring.tp_block_nr;
if (setsockopt(sk1, SOL_PACKET, PACKET_RX_RING, &ring, sizeof(ring)) < 0) {
- err("Can't set rx ring %m");
+ pr_perror("Can't set rx ring %m");
return 1;
}
rsv = SK_RESERVE;
if (setsockopt(sk2, SOL_PACKET, PACKET_RESERVE, &rsv, sizeof(rsv)) < 0) {
- err("Can't set reserve %m");
+ pr_perror("Can't set reserve %m");
return 1;
}
yes = 1;
if (setsockopt(sk2, SOL_PACKET, PACKET_ORIGDEV, &yes, sizeof(yes)) < 0) {
- err("Can't set origdev %m");
+ pr_perror("Can't set origdev %m");
return 1;
}
yes = DEF_FANOUT;
if (setsockopt(sk2, SOL_PACKET, PACKET_FANOUT, &yes, sizeof(yes)) < 0) {
- err("Can't configure fanout %m");
+ pr_perror("Can't configure fanout %m");
return 1;
}
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
mreq.mr_ifindex = 1;
mreq.mr_type = PACKET_MR_PROMISC;
if (setsockopt(sk1, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
- err("Can't add promisc member %m");
+ pr_perror("Can't add promisc member %m");
return 1;
}
@@ -178,7 +178,7 @@ int main(int argc, char **argv)
mreq.mr_type = PACKET_MR_UNICAST;
mreq.mr_alen = LO_ADDR_LEN;
if (setsockopt(sk2, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
- err("Can't add ucast member %m");
+ pr_perror("Can't add ucast member %m");
return 1;
}
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
ring.tp_frame_size = 1024;
ring.tp_frame_nr = (ring.tp_block_size / ring.tp_frame_size) * ring.tp_block_nr;
if (setsockopt(sk2, SOL_PACKET, PACKET_TX_RING, &ring, sizeof(ring)) < 0) {
- err("Can't set tx ring %m");
+ pr_perror("Can't set tx ring %m");
return 1;
}
diff --git a/test/zdtm/live/static/packet_sock_mmap.c b/test/zdtm/live/static/packet_sock_mmap.c
index 942868f..b1e94ad 100644
--- a/test/zdtm/live/static/packet_sock_mmap.c
+++ b/test/zdtm/live/static/packet_sock_mmap.c
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
sk = socket(PF_PACKET, SOCK_RAW, 0);
if (sk < 0) {
- err("Can't create socket 1");
+ pr_perror("Can't create socket 1");
return 1;
}
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
ring.tp_frame_size = 1024;
ring.tp_frame_nr = (ring.tp_block_size / ring.tp_frame_size) * ring.tp_block_nr;
if (setsockopt(sk, SOL_PACKET, PACKET_RX_RING, &ring, sizeof(ring)) < 0) {
- err("Can't set rx ring %m");
+ pr_perror("Can't set rx ring %m");
return 1;
}
@@ -84,13 +84,13 @@ int main(int argc, char **argv)
ring.tp_frame_size = 1024;
ring.tp_frame_nr = (ring.tp_block_size / ring.tp_frame_size) * ring.tp_block_nr;
if (setsockopt(sk, SOL_PACKET, PACKET_TX_RING, &ring, sizeof(ring)) < 0) {
- err("Can't set tx ring %m");
+ pr_perror("Can't set tx ring %m");
return 1;
}
mem = mmap(NULL, 2 * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, sk, 0);
if (mem == MAP_FAILED) {
- err("Can't mmap socket %m");
+ pr_perror("Can't mmap socket %m");
return 1;
}
diff --git a/test/zdtm/live/static/pdeath_sig.c b/test/zdtm/live/static/pdeath_sig.c
index 09b3257..0f7436f 100644
--- a/test/zdtm/live/static/pdeath_sig.c
+++ b/test/zdtm/live/static/pdeath_sig.c
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
ret = -1;
read(pr[0], &ret, sizeof(ret));
if (ret != 0) {
- err("C start error");
+ pr_perror("C start error");
goto out;
}
diff --git a/test/zdtm/live/static/pipe00.c b/test/zdtm/live/static/pipe00.c
index 04c45cb..0446c42 100644
--- a/test/zdtm/live/static/pipe00.c
+++ b/test/zdtm/live/static/pipe00.c
@@ -31,16 +31,16 @@ int main(int argc, char ** argv)
pid = test_fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
exit(1);
} else if (pid == 0) {
if (dup2(pipe1[1], 11) == -1 || dup2(pipe2[0], 12) == -1) {
- err("dup2 failed");
+ pr_perror("dup2 failed");
return 1;
}
} else {
if (dup2(pipe1[0], 12) == -1 || dup2(pipe2[1], 11) == -1) {
- err("dup2 failed");
+ pr_perror("dup2 failed");
goto err;
}
}
@@ -59,22 +59,22 @@ int main(int argc, char ** argv)
ret = read(12, buf, sizeof(TEST_STRING));
if (ret != sizeof(TEST_STRING)) {
- err("read failed: %d", ret);
+ pr_perror("read failed: %d", ret);
goto err;
}
ret = write(11, TEST_STRING, sizeof(TEST_STRING));
if (ret != sizeof(TEST_STRING)) {
- err("write failed: %d", ret);
+ pr_perror("write failed: %d", ret);
goto err;
}
close(11);
ret = read(12, buf, sizeof(TEST_STRING));
if (ret != sizeof(TEST_STRING)) {
- err("read failed: %d", ret);
+ pr_perror("read failed: %d", ret);
goto err;
}
if (strcmp(TEST_STRING, buf)) {
- err("data curruption");
+ pr_perror("data curruption");
goto err;
}
@@ -88,28 +88,28 @@ int main(int argc, char ** argv)
} else {
ret = write(11, TEST_STRING, sizeof(TEST_STRING));
if (ret != sizeof(TEST_STRING)) {
- err("write failed: %d", ret);
+ pr_perror("write failed: %d", ret);
return 1;
}
ret = read(12, buf, sizeof(TEST_STRING));
if (ret != sizeof(TEST_STRING)) {
- err("read failed: %d", ret);
+ pr_perror("read failed: %d", ret);
return 1;
}
ret = write(11, TEST_STRING, sizeof(TEST_STRING));
if (ret != sizeof(TEST_STRING)) {
- err("write failed: %d", ret);
+ pr_perror("write failed: %d", ret);
return 1;
}
close(11);
if (strcmp(TEST_STRING, buf)) {
- err("data curruption");
+ pr_perror("data curruption");
return 1;
}
}
return 0;
err:
- err("FAIL");
+ pr_perror("FAIL");
return 1;
}
diff --git a/test/zdtm/live/static/pipe01.c b/test/zdtm/live/static/pipe01.c
index db3f424..85478b6 100644
--- a/test/zdtm/live/static/pipe01.c
+++ b/test/zdtm/live/static/pipe01.c
@@ -31,7 +31,7 @@ int main(int argc, char ** argv)
ret = pipe(pfd);
if (ret) {
- err("pipe() failed: %m");
+ pr_perror("pipe() failed");
return 1;
}
@@ -45,19 +45,19 @@ int main(int argc, char ** argv)
if (pfd_rop[0] == -1 || pfd_rop[1] == -1 ||
pfd_dup[0] == -1 || pfd_dup[1] == -1) {
- err("dup() failed");
+ pr_perror("dup() failed");
return 1;
}
flags = fcntl(pfd[1], F_GETFL, 0);
if (flags == -1) {
- err("fcntl() failed");
+ pr_perror("fcntl() failed");
return 1;
}
ret = fcntl(pfd[1], F_SETFL, flags | O_NONBLOCK);
if (ret == -1) {
- err("fcntl() failed");
+ pr_perror("fcntl() failed");
return 1;
}
@@ -66,7 +66,7 @@ int main(int argc, char ** argv)
if (ret == -1) {
if (errno == EAGAIN)
break;
- err("write() failed: %m");
+ pr_perror("write() failed");
goto err;
}
@@ -79,24 +79,24 @@ int main(int argc, char ** argv)
flags = fcntl(pfd[1], F_GETFL, 0);
if (!(flags & O_NONBLOCK)) {
- err("O_NONBLOCK is absent");
+ pr_perror("O_NONBLOCK is absent");
goto err;
}
flags = fcntl(pfd_dup[1], F_GETFL, 0);
if (!(flags & O_NONBLOCK)) {
- err("O_NONBLOCK is absent");
+ pr_perror("O_NONBLOCK is absent");
goto err;
}
flags = fcntl(pfd_rop[1], F_GETFL, 0);
if (flags & O_NONBLOCK) {
- err("O_NONBLOCK appeared");
+ pr_perror("O_NONBLOCK appeared");
goto err;
}
if (close(pfd[1]) == -1) {
- err("close() failed");
+ pr_perror("close() failed");
goto err;
}
@@ -109,7 +109,7 @@ int main(int argc, char ** argv)
break;
if (ret == -1) {
goto err;
- err("read() failed: %m");
+ pr_perror("read() failed");
}
size -= ret;
diff --git a/test/zdtm/live/static/pipe02.c b/test/zdtm/live/static/pipe02.c
index 7582ffb..2a8cca7 100644
--- a/test/zdtm/live/static/pipe02.c
+++ b/test/zdtm/live/static/pipe02.c
@@ -30,12 +30,12 @@ int main(int argc, char ** argv)
fd = open(path, O_RDONLY);
if (fd == -1) {
- err("open");
+ pr_perror("open");
return 1;
};
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK) == -1) {
- err("fcntl");
+ pr_perror("fcntl");
return 1;
}
diff --git a/test/zdtm/live/static/poll.c b/test/zdtm/live/static/poll.c
index 85f5455..c0f7574 100644
--- a/test/zdtm/live/static/poll.c
+++ b/test/zdtm/live/static/poll.c
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
task_waiter_init(&t);
if (pipe(pipes)) {
- err("Can't create pipes");
+ pr_perror("Can't create pipes");
exit(1);
}
@@ -62,18 +62,18 @@ int main(int argc, char *argv[])
show_pollfd(ufds, 2);
if (gettimeofday(&time1, NULL)) {
- err("Can't get first delta");
+ pr_perror("Can't get first delta");
exit(1);
}
show_timestamp("Init", time1.tv_sec, time1.tv_usec);
pid = test_fork();
if (pid < 0) {
- err("Fork failed");
+ pr_perror("Fork failed");
exit(1);
} else if (pid == 0) {
if (gettimeofday(&time1, NULL)) {
- err("Can't get from times");
+ pr_perror("Can't get from times");
exit(1);
}
@@ -85,12 +85,12 @@ int main(int argc, char *argv[])
ret = poll(ufds, 2, delta * 1000);
show_pollfd(ufds, 2);
if (ret && errno != EINTR) {
- err("Poll-2 returned %d (events?!)", ret);
+ pr_perror("Poll-2 returned %d (events?!)", ret);
exit(1);
}
if (gettimeofday(&time2, NULL)) {
- err("Can't get from times");
+ pr_perror("Can't get from times");
exit(1);
}
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
/* Return immediately if child run or stopped(by SIGSTOP) */
if (waitpid(pid, &status, 0) == -1) {
- err("Unable to wait child");
+ pr_perror("Unable to wait child");
exit(1);
}
diff --git a/test/zdtm/live/static/posix_timers.c b/test/zdtm/live/static/posix_timers.c
index 1dca0d5..fa8311f 100644
--- a/test/zdtm/live/static/posix_timers.c
+++ b/test/zdtm/live/static/posix_timers.c
@@ -308,7 +308,7 @@ static int setup_timers(void)
}
if (sigprocmask(SIG_SETMASK, &mask, NULL) == -1) {
- err("Failed to unlock signal");
+ pr_perror("Failed to unlock signal");
return -errno;
}
@@ -319,12 +319,12 @@ static int setup_timers(void)
for (i = 0; i < 10; i++) {
ret = timer_create(CLOCK_REALTIME, NULL, &timeridt);
if (ret < 0) {
- err("Can't create temporary posix timer %lx", (long) timeridt);
+ pr_perror("Can't create temporary posix timer %lx", (long) timeridt);
return -errno;
}
ret = timer_delete(timeridt);
if (ret < 0) {
- err("Can't remove temporaty posix timer %lx", (long) timeridt);
+ pr_perror("Can't remove temporaty posix timer %lx", (long) timeridt);
return -errno;
}
}
@@ -334,7 +334,7 @@ static int setup_timers(void)
sigemptyset(&info->sa.sa_mask);
if (sigaction(info->sig, &info->sa, NULL) == -1) {
- err("Failed to set SIGALRM handler");
+ pr_perror("Failed to set SIGALRM handler");
return -errno;
}
@@ -346,7 +346,7 @@ static int setup_timers(void)
sev.sigev_value.sival_ptr = info;
if (timer_create(info->clock, &sev, &info->timerid) == -1) {
- err("Can't create timer");
+ pr_perror("Can't create timer");
return -errno;
}
@@ -359,12 +359,12 @@ static int setup_timers(void)
its.it_interval.tv_sec = its.it_interval.tv_nsec = 0;
if (clock_gettime(info->clock, &info->start) == -1) {
- err("Can't get %s start time", info->name);
+ pr_perror("Can't get %s start time", info->name);
return -errno;
}
if (timer_settime(info->timerid, 0, &its, NULL) == -1) {
- err("Can't set timer");
+ pr_perror("Can't set timer");
return -errno;
}
info++;
@@ -383,12 +383,12 @@ static int get_total_sleep_time(struct timespec *tv, char *type)
struct timespec boottime;
if (clock_gettime(CLOCK_BOOTTIME, &boottime) == -1) {
- err("Can't get CLOCK_BOOTTIME %s time", type);
+ pr_perror("Can't get CLOCK_BOOTTIME %s time", type);
return -errno;
}
if (clock_gettime(CLOCK_MONOTONIC_COARSE, &boottime_coarse) == -1) {
- err("Can't get CLOCK_MONOTONIC_COARSE %s time", type);
+ pr_perror("Can't get CLOCK_MONOTONIC_COARSE %s time", type);
return -errno;
}
diff --git a/test/zdtm/live/static/proc-self.c b/test/zdtm/live/static/proc-self.c
index 07e5300..54cc5f1 100644
--- a/test/zdtm/live/static/proc-self.c
+++ b/test/zdtm/live/static/proc-self.c
@@ -26,7 +26,7 @@ int read_fd_link(int lfd, char *buf, size_t size)
snprintf(t, sizeof(t), "/proc/self/fd/%d", lfd);
ret = readlink(t, buf, size - 1);
if (ret < 0) {
- err("Can't read link of fd %d", lfd);
+ pr_perror("Can't read link of fd %d", lfd);
return -1;
}
buf[ret] = 0;
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
fd_self = open(nspath, O_RDONLY);
if (fd_self < 0) {
- err("Can't open %s", nspath);
+ pr_perror("Can't open %s", nspath);
return -1;
}
@@ -54,18 +54,18 @@ int main(int argc, char *argv[])
test_waitsig();
if (read_fd_link(fd_self, path_orig, sizeof(path_orig))) {
- err("Can't fill original path");
+ pr_perror("Can't fill original path");
return -1;
}
fd_new = open(nspath, O_RDONLY);
if (fd_new < 0) {
- err("Can't open %s", nspath);
+ pr_perror("Can't open %s", nspath);
return -1;
}
if (read_fd_link(fd_new, path_new, sizeof(path_new))) {
- err("Can't fill new path");
+ pr_perror("Can't fill new path");
return -1;
}
diff --git a/test/zdtm/live/static/pthread01.c b/test/zdtm/live/static/pthread01.c
index 3389ea6..52f849c 100644
--- a/test/zdtm/live/static/pthread01.c
+++ b/test/zdtm/live/static/pthread01.c
@@ -81,20 +81,20 @@ static void *ch_thread_2(void *arg)
task_waiter_wait4(&t2, 2);
if (memcmp(tls_data.rand_string, __tls_data, sizeof(tls_data.rand_string))) {
- err("Failed to restore tls_data.rand_string in thread 2");
+ pr_perror("Failed to restore tls_data.rand_string in thread 2");
results_map[2] = -1;
} else
results_map[2] = 1;
if (memcmp(&tls_data.blk_sigset, &blk_sigset, sizeof(tls_data.blk_sigset))) {
- err("Failed to restore tls_data.blk_sigset in thread 2");
+ pr_perror("Failed to restore tls_data.blk_sigset in thread 2");
results_map[4] = -1;
} else
results_map[4] = 1;
pthread_sigmask(SIG_SETMASK, NULL, &new);
if (memcmp(&tls_data.blk_sigset, &new, sizeof(tls_data.blk_sigset))) {
- err("Failed to restore blk_sigset in thread 2");
+ pr_perror("Failed to restore blk_sigset in thread 2");
results_map[6] = -1;
show_sigset(&tls_data.blk_sigset);
@@ -128,13 +128,13 @@ static void *ch_thread_1(void *arg)
task_waiter_wait4(&t1, 2);
if (memcmp(tls_data.rand_string, __tls_data, sizeof(tls_data.rand_string))) {
- err("Failed to restore tls_data.rand_string in thread 1");
+ pr_perror("Failed to restore tls_data.rand_string in thread 1");
results_map[1] = -1;
} else
results_map[1] = 1;
if (memcmp(&tls_data.blk_sigset, &blk_sigset, sizeof(tls_data.blk_sigset))) {
- err("Failed to restore tls_data.blk_sigset in thread 1");
+ pr_perror("Failed to restore tls_data.blk_sigset in thread 1");
results_map[3] = -1;
} else
results_map[3] = 1;
@@ -142,7 +142,7 @@ static void *ch_thread_1(void *arg)
sigemptyset(&new);
pthread_sigmask(SIG_SETMASK, NULL, &new);
if (memcmp(&tls_data.blk_sigset, &new, sizeof(tls_data.blk_sigset))) {
- err("Failed to restore blk_sigset in thread 1");
+ pr_perror("Failed to restore blk_sigset in thread 1");
results_map[5] = -1;
show_sigset(&tls_data.blk_sigset);
diff --git a/test/zdtm/live/static/ptrace_sig.c b/test/zdtm/live/static/ptrace_sig.c
index edbb06c..a8e1dc5 100644
--- a/test/zdtm/live/static/ptrace_sig.c
+++ b/test/zdtm/live/static/ptrace_sig.c
@@ -21,7 +21,7 @@ void sig_handler(int signo, siginfo_t *siginfo, void *data)
pid = siginfo->si_pid;
ret = write(child_fd, &pid, sizeof(pid));
if (ret != sizeof(pid))
- err("write");
+ pr_perror("write");
child_exit = 1;
}
@@ -44,13 +44,13 @@ int child(int fd)
ret = sigaction(SIGUSR2, &act, &old_act);
if (ret < 0) {
- err("signal failed");
+ pr_perror("signal failed");
return 1;
}
ret = ptrace(PTRACE_TRACEME, 0, 0, 0);
if (ret < 0) {
- err("ptrace failed");
+ pr_perror("ptrace failed");
return 1;
}
ret = write(child_fd, &ret, sizeof(ret));
@@ -72,13 +72,13 @@ int main(int argc, char ** argv)
ret = pipe(child_pipe);
if (ret < 0) {
- err("pipe failed");
+ pr_perror("pipe failed");
return 1;
}
cpid = test_fork();
if (cpid < 0) {
- err("fork failed");
+ pr_perror("fork failed");
return 1;
}
else if (cpid == 0) {
@@ -89,25 +89,25 @@ int main(int argc, char ** argv)
close(child_pipe[1]);
ret = pipe(signal_pipe);
if (ret < 0) {
- err("pipe failed");
+ pr_perror("pipe failed");
return 1;
}
spid = test_fork();
if (spid < 0) {
- err("Can't fork signal process");
+ pr_perror("Can't fork signal process");
return 1;
} else if (spid == 0) {
close(signal_pipe[1]);
ret = read(signal_pipe[0], &status, sizeof(status));
if (ret != sizeof(status)) {
- err("read");
+ pr_perror("read");
return 1;
}
test_msg("send signal to %d\n", cpid);
ret = kill(cpid, SIGUSR2);
if (ret < 0) {
- err("kill failed");
+ pr_perror("kill failed");
}
return 0;
}
@@ -115,20 +115,20 @@ int main(int argc, char ** argv)
sh = signal(SIGCHLD, sig_chld_handler);
if (sh == SIG_ERR) {
- err("signal failed");
+ pr_perror("signal failed");
return 1;
}
test_msg("wait while child initialized");
ret = read(child_pipe[0], &status, sizeof(status));
if (ret != sizeof(status)) {
- err("read from child process failed");
+ pr_perror("read from child process failed");
return 1;
}
ret = write(signal_pipe[1], &status, sizeof(status));
if (ret != sizeof(status)) {
- err("write to signal process failed");
+ pr_perror("write to signal process failed");
}
close(signal_pipe[1]);
@@ -140,7 +140,7 @@ int main(int argc, char ** argv)
pid = wait(&status);
if (pid < 0) {
if (errno != ECHILD)
- err("wait");
+ pr_perror("wait");
break;
}
@@ -151,18 +151,18 @@ int main(int argc, char ** argv)
ret = ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);
if (ret < 0) {
- err("ptrace failed");
+ pr_perror("ptrace failed");
return 1;
} else
test_msg("pid=%d sends signal\n", siginfo.si_pid);
ret = ptrace(PTRACE_CONT, pid, 0, WSTOPSIG(status));
if (ret < 0)
- err("ptrace failed");
+ pr_perror("ptrace failed");
ret = read(child_pipe[0], &status, sizeof(status));
if (ret != sizeof(status)) {
- err("read");
+ pr_perror("read");
return 1;
}
diff --git a/test/zdtm/live/static/pty00.c b/test/zdtm/live/static/pty00.c
index 030b996..7aa9c8a 100644
--- a/test/zdtm/live/static/pty00.c
+++ b/test/zdtm/live/static/pty00.c
@@ -44,7 +44,7 @@ int main(int argc, char ** argv)
fdm = open("/dev/ptmx", O_RDWR);
if (fdm == -1) {
- err("open(%s) failed", "/dev/ptmx");
+ pr_perror("open(%s) failed", "/dev/ptmx");
return 1;
}
grantpt(fdm);
@@ -52,26 +52,26 @@ int main(int argc, char ** argv)
slavename = ptsname(fdm);
fds = open(slavename, O_RDWR);
if (fds == -1) {
- err("open(%s) failed", slavename);
+ pr_perror("open(%s) failed", slavename);
return 1;
}
tty = open("/dev/tty", O_RDWR);
if (tty < 0) {
- err("open(%s) failed", "/dev/tty");
+ pr_perror("open(%s) failed", "/dev/tty");
return 1;
}
/* Try to reproduce a deadlock */
if (dup2(fdm, 101) != 101) {
- err("dup( , 101) failed");
+ pr_perror("dup( , 101) failed");
return 1;
}
close(fdm);
fdm = 101;
if (dup2(fds, 100) != 100) {
- err("dup( , 100) failed");
+ pr_perror("dup( , 100) failed");
return 1;
}
close(fds);
@@ -84,13 +84,13 @@ int main(int argc, char ** argv)
/* Check connectivity */
ret = write(fdm, teststr, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("write(fdm) failed");
+ pr_perror("write(fdm) failed");
return 1;
}
ret = read(fds, buf, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("read(fds) failed");
+ pr_perror("read(fds) failed");
return 1;
}
@@ -101,13 +101,13 @@ int main(int argc, char ** argv)
ret = write(fdm, teststr, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("write(fdm) failed");
+ pr_perror("write(fdm) failed");
return 1;
}
ret = read(tty, buf, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("read(tty) failed");
+ pr_perror("read(tty) failed");
return 1;
}
diff --git a/test/zdtm/live/static/pty01.c b/test/zdtm/live/static/pty01.c
index a6b58ba..46710e2 100644
--- a/test/zdtm/live/static/pty01.c
+++ b/test/zdtm/live/static/pty01.c
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
master = open("/dev/ptmx", O_RDWR);
if (master == -1) {
- err("open(%s) failed", "/dev/ptmx");
+ pr_perror("open(%s) failed", "/dev/ptmx");
return 1;
}
@@ -34,13 +34,13 @@ int main(int argc, char *argv[])
slavename = ptsname(master);
slave1 = open(slavename, O_RDWR);
if (slave1 == -1) {
- err("open(%s) failed", slavename);
+ pr_perror("open(%s) failed", slavename);
return 1;
}
slave2 = open(slavename, O_RDWR);
if (slave2 == -1) {
- err("open(%s) failed", slavename);
+ pr_perror("open(%s) failed", slavename);
return 1;
}
@@ -51,13 +51,13 @@ int main(int argc, char *argv[])
ret = write(master, teststr, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("write(master) failed");
+ pr_perror("write(master) failed");
return 1;
}
ret = read(slave1, buf, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("read(slave1) failed");
+ pr_perror("read(slave1) failed");
return 1;
}
@@ -68,13 +68,13 @@ int main(int argc, char *argv[])
ret = write(master, teststr, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("write(master) failed");
+ pr_perror("write(master) failed");
return 1;
}
ret = read(slave2, buf, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("read(slave1) failed");
+ pr_perror("read(slave1) failed");
return 1;
}
diff --git a/test/zdtm/live/static/pty02.c b/test/zdtm/live/static/pty02.c
index 1195ebb..0074bbd 100644
--- a/test/zdtm/live/static/pty02.c
+++ b/test/zdtm/live/static/pty02.c
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
master = open("/dev/ptmx", O_RDWR);
if (master == -1) {
- err("open(%s) failed", "/dev/ptmx");
+ pr_perror("open(%s) failed", "/dev/ptmx");
return 1;
}
@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
slavename = ptsname(master);
slave = open(slavename, O_RDWR);
if (slave == -1) {
- err("open(%s) failed", slavename);
+ pr_perror("open(%s) failed", slavename);
return 1;
}
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
new_master = dup(master);
if (new_master < 0) {
- err("can't dup master");
+ pr_perror("can't dup master");
exit_shot_parent(1);
}
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
ret = write(new_master, teststr, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("write(new_master) failed (ret = %d)", ret);
+ pr_perror("write(new_master) failed (ret = %d)", ret);
exit_shot_parent(1);
}
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
close(new_master);
exit(0);
} else if (pid < 0) {
- err("test_fork failed");
+ pr_perror("test_fork failed");
exit(1);
}
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
ret = read(slave, buf, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("read(slave) failed (ret = %d)", ret);
+ pr_perror("read(slave) failed (ret = %d)", ret);
return 1;
}
diff --git a/test/zdtm/live/static/pty03.c b/test/zdtm/live/static/pty03.c
index c253683..f60d30d 100644
--- a/test/zdtm/live/static/pty03.c
+++ b/test/zdtm/live/static/pty03.c
@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
master = open("/dev/ptmx", O_RDWR);
if (master == -1) {
- err("open(%s) failed", "/dev/ptmx");
+ pr_perror("open(%s) failed", "/dev/ptmx");
return 1;
}
@@ -35,12 +35,12 @@ int main(int argc, char *argv[])
slavename = ptsname(master);
slave = open(slavename, O_RDWR);
if (slave == -1) {
- err("open(%s) failed", slavename);
+ pr_perror("open(%s) failed", slavename);
return 1;
}
if (ioctl(slave, TIOCSCTTY, 1)) {
- err("Can't set a controll terminal");
+ pr_perror("Can't set a controll terminal");
return 1;
}
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
slave = open("/dev/tty", O_RDWR);
if (slave == -1) {
- err("Can't open the controll terminal");
+ pr_perror("Can't open the controll terminal");
return -1;
}
@@ -59,13 +59,13 @@ int main(int argc, char *argv[])
ret = write(master, teststr, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("write(master) failed");
+ pr_perror("write(master) failed");
return 1;
}
ret = read(slave, buf, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
- err("read(slave1) failed");
+ pr_perror("read(slave1) failed");
return 1;
}
diff --git a/test/zdtm/live/static/pty04.c b/test/zdtm/live/static/pty04.c
index 79048f3..199d2c7 100644
--- a/test/zdtm/live/static/pty04.c
+++ b/test/zdtm/live/static/pty04.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
master = open("/dev/ptmx", O_RDWR);
if (master == -1) {
- err("open(%s) failed", "/dev/ptmx");
+ pr_perror("open(%s) failed", "/dev/ptmx");
return 1;
}
@@ -33,18 +33,18 @@ int main(int argc, char *argv[])
slave1 = open(slavename, O_RDWR);
if (slave1 == -1) {
- err("open(%s) failed", slavename);
+ pr_perror("open(%s) failed", slavename);
return 1;
}
slave2 = open(slavename, O_RDWR);
if (slave2 == -1) {
- err("open(%s) failed", slavename);
+ pr_perror("open(%s) failed", slavename);
return 1;
}
if (ioctl(slave1, TIOCSCTTY, 1)) {
- err("Can't set a controll terminal");
+ pr_perror("Can't set a controll terminal");
return 1;
}
diff --git a/test/zdtm/live/static/rlimits00.c b/test/zdtm/live/static/rlimits00.c
index d3e78af..17ea8da 100644
--- a/test/zdtm/live/static/rlimits00.c
+++ b/test/zdtm/live/static/rlimits00.c
@@ -17,7 +17,7 @@ int main(int argc, char **argv)
for (r = 0; r < RLIM_NLIMITS; r++) {
if (getrlimit(r, &rlims[r])) {
- err("Can't get rlimit");
+ pr_perror("Can't get rlimit");
goto out;
}
@@ -26,7 +26,7 @@ int main(int argc, char **argv)
rlims[r].rlim_cur--;
if (setrlimit(r, &rlims[r])) {
- err("Can't set rlimit");
+ pr_perror("Can't set rlimit");
goto out;
}
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
}
if (!changed) {
- err("Can't change any rlimir");
+ pr_perror("Can't change any rlimir");
goto out;
}
diff --git a/test/zdtm/live/static/rmdir_open.c b/test/zdtm/live/static/rmdir_open.c
index 86bf630..a4fb5b0 100644
--- a/test/zdtm/live/static/rmdir_open.c
+++ b/test/zdtm/live/static/rmdir_open.c
@@ -21,18 +21,18 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mkdir(dirname, 0700)) {
- err("Can't make dir");
+ pr_perror("Can't make dir");
goto out;
}
fd = open(dirname, O_DIRECTORY);
if (fd < 0) {
- err("Can't open dir");
+ pr_perror("Can't open dir");
goto outr;
}
if (rmdir(dirname)) {
- err("Can't remove dir");
+ pr_perror("Can't remove dir");
goto outr;
}
diff --git a/test/zdtm/live/static/rtc.c b/test/zdtm/live/static/rtc.c
index 86bd955..e082edc 100644
--- a/test/zdtm/live/static/rtc.c
+++ b/test/zdtm/live/static/rtc.c
@@ -23,17 +23,17 @@ int main(int argc, char **argv)
fd = open("/dev/rtc", O_RDWR);
if (fd < 0) {
- err("open");
+ pr_perror("open");
return 1;
}
if (ioctl(fd, RTC_IRQP_SET, TEST_HZ) == -1) {
- err("RTC_IRQP_SET");
+ pr_perror("RTC_IRQP_SET");
return 1;
}
if (ioctl(fd, RTC_PIE_ON, 0) == -1) {
- err("RTC_PIE_ON");
+ pr_perror("RTC_PIE_ON");
return 1;
}
@@ -48,7 +48,7 @@ int main(int argc, char **argv)
end.tv_usec += end.tv_sec * 1000000;
delta = end.tv_usec - start.tv_usec;
if (labs(delta - 1000000 / TEST_HZ ) > 100000) {
- err("delta = %ld", delta);
+ pr_perror("delta = %ld", delta);
fail--;
if (fail == 0)
return 1;
diff --git a/test/zdtm/live/static/sched_policy00.c b/test/zdtm/live/static/sched_policy00.c
index e4612ba..9fe89a1 100644
--- a/test/zdtm/live/static/sched_policy00.c
+++ b/test/zdtm/live/static/sched_policy00.c
@@ -35,7 +35,7 @@ int main(int argc, char ** argv)
p.sched_priority = parm;
if (sched_setscheduler(pid, SCHED_RR, &p)) {
- err("Can't set policy");
+ pr_perror("Can't set policy");
kill(pid, SIGKILL);
return -1;
}
diff --git a/test/zdtm/live/static/sched_prio00.c b/test/zdtm/live/static/sched_prio00.c
index 3b678ce..ea4a2ee 100644
--- a/test/zdtm/live/static/sched_prio00.c
+++ b/test/zdtm/live/static/sched_prio00.c
@@ -48,7 +48,7 @@ int main(int argc, char ** argv)
return do_nothing();
if (setpriority(PRIO_PROCESS, pid[i], parm[i])) {
- err("Can't set prio %d", i);
+ pr_perror("Can't set prio %d", i);
kill_all(pid, i);
return -1;
}
diff --git a/test/zdtm/live/static/seccomp_strict.c b/test/zdtm/live/static/seccomp_strict.c
index 833e5c6..8b1a37a 100644
--- a/test/zdtm/live/static/seccomp_strict.c
+++ b/test/zdtm/live/static/seccomp_strict.c
@@ -22,7 +22,7 @@ int get_seccomp_mode(pid_t pid)
sprintf(buf, "/proc/%d/status", pid);
f = fopen(buf, "r+");
if (!f) {
- err("fopen failed");
+ pr_perror("fopen failed");
return -1;
}
@@ -50,13 +50,13 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair)) {
- err("socketpair");
+ pr_perror("socketpair");
return -1;
}
pid = fork();
if (pid < 0) {
- err("fork");
+ pr_perror("fork");
return -1;
}
@@ -66,18 +66,18 @@ int main(int argc, char ** argv)
zdtm_seccomp = 1;
if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT) < 0) {
- err("prctl failed");
+ pr_perror("prctl failed");
return -1;
}
test_msg("SECCOMP_MODE_STRICT is enabled\n");
if (write(sk, &c, 1) != 1) {
- err("write");
+ pr_perror("write");
return -1;
}
if (read(sk, &c, 1) != 1) {
_exit(1);
- err("read");
+ pr_perror("read");
return -1;
}
@@ -88,7 +88,7 @@ int main(int argc, char ** argv)
close(sk_pair[1]);
if (read(sk, &c, 1) != 1) {
- err("read");
+ pr_perror("read");
goto err;
}
@@ -97,15 +97,15 @@ int main(int argc, char ** argv)
mode = get_seccomp_mode(pid);
if (write(sk, &c, 1) != 1) {
- err("write");
+ pr_perror("write");
goto err;
}
if (waitpid(pid, &status, 0) != pid) {
- err("waitpid");
+ pr_perror("waitpid");
exit(1);
}
if (status != 0) {
- err("The child exited with an unexpected code %d", status);
+ pr_perror("The child exited with an unexpected code %d", status);
exit(1);
}
if (mode != SECCOMP_MODE_STRICT) {
diff --git a/test/zdtm/live/static/selfexe00.c b/test/zdtm/live/static/selfexe00.c
index 2c1d39c..bc61172 100644
--- a/test/zdtm/live/static/selfexe00.c
+++ b/test/zdtm/live/static/selfexe00.c
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
test_msg("%s pid %d\n", argv[0], getpid());
ret = readlink("/proc/self/exe", path_before, sizeof(path_before) - 1);
if (ret < 0) {
- err("Can't read selflink");
+ pr_perror("Can't read selflink");
fail();
exit(1);
}
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
ret = readlink("/proc/self/exe", path_after, sizeof(path_after) - 1);
if (ret < 0) {
- err("Can't read selflink");
+ pr_perror("Can't read selflink");
fail();
exit(1);
}
diff --git a/test/zdtm/live/static/sem.c b/test/zdtm/live/static/sem.c
index fae91a2..3bbbfdd 100644
--- a/test/zdtm/live/static/sem.c
+++ b/test/zdtm/live/static/sem.c
@@ -112,7 +112,7 @@ static int test_fn(int argc, char **argv)
key = ftok(argv[0], 89063453);
if (key == -1) {
- err("Can't make key");
+ pr_perror("Can't make key");
return -1;
}
@@ -121,12 +121,12 @@ static int test_fn(int argc, char **argv)
id = semget(key, 1, 0777 | IPC_CREAT | IPC_EXCL);
if (id == -1) {
fail_count++;
- err("Can't get sem");
+ pr_perror("Can't get sem");
goto out;
}
if (semctl(id, 0, SETVAL, val) == -1) {
fail_count++;
- err("Can't init sem");
+ pr_perror("Can't init sem");
goto out_destroy;
}
diff --git a/test/zdtm/live/static/session00.c b/test/zdtm/live/static/session00.c
index 1712eee..1cae1f5 100644
--- a/test/zdtm/live/static/session00.c
+++ b/test/zdtm/live/static/session00.c
@@ -50,13 +50,13 @@ static int fork_child(int i)
ret = pipe(p);
if (ret) {
- err("pipe() failed");
+ pr_perror("pipe() failed");
return 1;
}
pid = test_fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
return 1;
}
@@ -64,7 +64,7 @@ static int fork_child(int i)
if (testcases[i].flags & NEWSID) {
sid = setsid();
if (sid == -1) {
- err("setsid failed");
+ pr_perror("setsid failed");
write(p[1], &sid, sizeof(sid));
exit(1);
}
@@ -84,7 +84,7 @@ static int fork_child(int i)
sid = setsid();
if (sid == -1) {
- err("setsid failed");
+ pr_perror("setsid failed");
write(p[1], &sid, sizeof(sid));
exit(1);
}
@@ -110,7 +110,7 @@ static int fork_child(int i)
sid = setsid();
if (sid == -1) {
- err("setsid failed");
+ pr_perror("setsid failed");
write(p[1], &sid, sizeof(sid));
exit(1);
}
@@ -140,7 +140,7 @@ child:
pid_t ret;
ret = wait(&status);
if (ret != pid) {
- err("wait return %d instead of %d", ret, pid);
+ pr_perror("wait return %d instead of %d", ret, pid);
kill(pid, SIGKILL);
return 1;
}
@@ -148,14 +148,14 @@ child:
ret = read(p[0], &testcases[i].pid, sizeof(pid));
if (ret != sizeof(ret)) {
- err("read failed");
+ pr_perror("read failed");
return 1;
}
close(p[0]);
if (testcases[i].pid < 0) {
- err("child failed");
+ pr_perror("child failed");
return 1;
}
@@ -198,7 +198,7 @@ int main(int argc, char ** argv)
ret = kill(pid, SIGKILL);
if (ret == -1) {
- err("kill failed");
+ pr_perror("kill failed");
err++;
}
waitpid(pid, NULL, 0);
@@ -206,7 +206,7 @@ int main(int argc, char ** argv)
if (testcases[i].flags & CHANGESID) {
pid = wait(&status);
if (pid == -1) {
- err("wait() failed");
+ pr_perror("wait() failed");
err++;
}
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
@@ -218,7 +218,7 @@ int main(int argc, char ** argv)
pid = wait(&status);
if (pid != -1 || errno != ECHILD) {
- err("%d isn't waited");
+ pr_perror("%d isn't waited");
err++;
}
diff --git a/test/zdtm/live/static/session01.c b/test/zdtm/live/static/session01.c
index a8d8a3c..9bea83d 100644
--- a/test/zdtm/live/static/session01.c
+++ b/test/zdtm/live/static/session01.c
@@ -61,7 +61,7 @@ static struct testcase __testcases[] = {
#define TESTS (sizeof(__testcases) / sizeof(struct testcase))
-#define check(n, a, b) do { if ((a) != (b)) { err("%s mismatch %d != %d", n, a, b); goto err; } } while (0)
+#define check(n, a, b) do { if ((a) != (b)) { pr_perror("%s mismatch %d != %d", n, a, b); goto err; } } while (0)
static int child(const int c);
static int fork_children(struct testcase *t, int leader)
@@ -112,7 +112,7 @@ static int child(const int c)
if (t->pid == t->pgid) {
if (getpid() != getpgid(getpid()))
if (setpgid(getpid(), getpid()) < 0) {
- err("setpgid() failed");
+ pr_perror("setpgid() failed");
goto err;
}
t->master.pgid = t->master.pid;
@@ -132,7 +132,7 @@ static int child(const int c)
continue;
if (getpgid(getpid()) != testcases[i].master.pid)
if (setpgid(getpid(), testcases[i].master.pid) < 0) {
- err("setpgid() failed (%d) (%d)", c, i);
+ pr_perror("setpgid() failed (%d) (%d)", c, i);
goto err;
}
@@ -273,12 +273,12 @@ int main(int argc, char ** argv)
struct testcase *p = testcases + j;
/* sanity check */
if (p->pid == t->sid && t->master.sid != p->master.pid) {
- err("session mismatch (%d) %d != (%d) %d",
+ pr_perror("session mismatch (%d) %d != (%d) %d",
i, t->master.sid, j, p->master.pid);
err++;
}
if (p->pid == t->pgid && t->master.pgid != p->master.pid) {
- err("pgid mismatch (%d) %d != (%d) %d",
+ pr_perror("pgid mismatch (%d) %d != (%d) %d",
i, t->master.pgid, j, p->master.pid);
err++;
}
@@ -286,14 +286,14 @@ int main(int argc, char ** argv)
sid = getsid(t->master.pid);
if (t->master.sid != sid) {
- err("%d: session mismatch %d (expected %d)",
+ pr_perror("%d: session mismatch %d (expected %d)",
i, sid, t->master.sid);
err++;
}
pgid = getpgid(t->master.pid);
if (t->master.pgid != pgid) {
- err("%d: pgid mismatch %d (expected %d)",
+ pr_perror("%d: pgid mismatch %d (expected %d)",
i, t->master.pgid, pgid);
err++;
}
diff --git a/test/zdtm/live/static/session02.c b/test/zdtm/live/static/session02.c
index 89d8419..02d29f9 100644
--- a/test/zdtm/live/static/session02.c
+++ b/test/zdtm/live/static/session02.c
@@ -94,7 +94,7 @@ static int make_child(int id, int flags)
flags | SIGCHLD, &args);
if (cid < 0)
- err("clone(%d, %d)", id, flags);
+ pr_perror("clone(%d, %d)", id, flags);
processes[id].pid = cid;
@@ -108,7 +108,7 @@ static void handle_command()
ret = read(sk, &cmd, sizeof(cmd));
if (ret != sizeof(cmd)) {
- err("Unable to get command");
+ pr_perror("Unable to get command");
goto err;
}
@@ -133,21 +133,21 @@ static void handle_command()
cmd.arg1, processes[cmd.arg1].pid);
if (waitpid(processes[cmd.arg1].pid, NULL, 0) == -1) {
- err("waitpid(%d)", processes[cmd.arg1].pid);
+ pr_perror("waitpid(%d)", processes[cmd.arg1].pid);
status = -1;
}
break;
case TEST_SUBREAPER:
test_msg("%3d: subreaper(%d)\n", current, cmd.arg1);
if (prctl(PR_SET_CHILD_SUBREAPER, cmd.arg1, 0, 0, 0) == -1) {
- err("PR_SET_CHILD_SUBREAPER");
+ pr_perror("PR_SET_CHILD_SUBREAPER");
status = -1;
}
break;
case TEST_SETSID:
test_msg("%3d: setsid()\n", current);
if(setsid() == -1) {
- err("setsid");
+ pr_perror("setsid");
status = -1;
}
break;
@@ -160,7 +160,7 @@ static void handle_command()
ret = write(sk, &status, sizeof(status));
if (ret != sizeof(status)) {
- err("Unable to answer");
+ pr_perror("Unable to answer");
goto err;
}
@@ -180,26 +180,26 @@ static int send_command(int id, enum commands op, int arg1, int arg2)
if (op == TEST_FORK) {
if (processes[arg1].pid) {
- err("%d is busy", arg1);
+ pr_perror("%d is busy", arg1);
return -1;
}
}
ret = write(sk, &cmd, sizeof(cmd));
if (ret != sizeof(cmd)) {
- err("Unable to send command");
+ pr_perror("Unable to send command");
goto err;
}
status = 0;
ret = read(sk, &status, sizeof(status));
if (ret != sizeof(status) && !(status == 0 && op == TEST_DIE)) {
- err("Unable to get answer");
+ pr_perror("Unable to get answer");
goto err;
}
if (status) {
- err("The command(%d, %d, %d) failed");
+ pr_perror("The command(%d, %d, %d) failed");
goto err;
}
@@ -219,13 +219,13 @@ int main(int argc, char ** argv)
processes = mmap(NULL, PAGE_SIZE, PROT_WRITE | PROT_READ,
MAP_SHARED | MAP_ANONYMOUS, 0, 0);
if (processes == NULL) {
- err("Unable to map share memory");
+ pr_perror("Unable to map share memory");
return 1;
}
for (i = 0; i < nr_processes; i++) {
if (socketpair(PF_UNIX, SOCK_STREAM, 0, processes[i].sks) == -1) {
- err("socketpair");
+ pr_perror("socketpair");
return 1;
}
}
@@ -286,7 +286,7 @@ int main(int argc, char ** argv)
processes[i].sid = getsid(processes[i].pid);
if (processes[i].sid == -1) {
- err("getsid(%d)", i);
+ pr_perror("getsid(%d)", i);
goto err;
}
}
@@ -305,7 +305,7 @@ int main(int argc, char ** argv)
sid = getsid(processes[i].pid);
if (sid == -1) {
- err("getsid(%d)", i);
+ pr_perror("getsid(%d)", i);
goto err;
}
diff --git a/test/zdtm/live/static/session03.c b/test/zdtm/live/static/session03.c
index 872d227..f10e1ef 100644
--- a/test/zdtm/live/static/session03.c
+++ b/test/zdtm/live/static/session03.c
@@ -55,7 +55,7 @@ static void cleanup()
if (ret == -1) {
if (errno == ECHILD)
break;
- err("wait");
+ pr_perror("wait");
exit(1);
}
}
@@ -136,7 +136,7 @@ static int make_child(int id, int flags)
flags | SIGCHLD, &args);
if (cid < 0)
- err("clone(%d, %d)", id, flags);
+ pr_perror("clone(%d, %d)", id, flags);
processes[id].pid = cid;
@@ -150,7 +150,7 @@ static void handle_command()
ret = read(sk, &cmd, sizeof(cmd));
if (ret != sizeof(cmd)) {
- err("Unable to get command");
+ pr_perror("Unable to get command");
goto err;
}
@@ -173,7 +173,7 @@ static void handle_command()
case TEST_SUBREAPER:
test_msg("%3d: subreaper(%d)\n", current, cmd.arg1);
if (prctl(PR_SET_CHILD_SUBREAPER, cmd.arg1, 0, 0, 0) == -1) {
- err("PR_SET_CHILD_SUBREAPER");
+ pr_perror("PR_SET_CHILD_SUBREAPER");
status = -1;
}
break;
@@ -182,7 +182,7 @@ static void handle_command()
break;
test_msg("%3d: setsid()\n", current);
if(setsid() == -1) {
- err("setsid");
+ pr_perror("setsid");
status = -1;
}
break;
@@ -196,14 +196,14 @@ static void handle_command()
exit(2);
exit(0);
default:
- err("Unknown operation %d", cmd.cmd);
+ pr_perror("Unknown operation %d", cmd.cmd);
status = -1;
break;
}
ret = write(sk, &status, sizeof(status));
if (ret != sizeof(status)) {
- err("Unable to answer");
+ pr_perror("Unable to answer");
goto err;
}
@@ -231,7 +231,7 @@ static int send_command(int id, enum commands op, int arg)
ret = write(sk, &cmd, sizeof(cmd));
if (ret != sizeof(cmd)) {
- err("Unable to send command");
+ pr_perror("Unable to send command");
goto err;
}
@@ -239,12 +239,12 @@ static int send_command(int id, enum commands op, int arg)
ret = read(sk, &status, sizeof(status));
if (ret != sizeof(status) &&
!(status == 0 && (op == TEST_DIE || op == TEST_DIE_WAIT))) {
- err("Unable to get answer");
+ pr_perror("Unable to get answer");
goto err;
}
if (status) {
- err("The command(%d, %d, %d) failed");
+ pr_perror("The command(%d, %d, %d) failed");
goto err;
}
@@ -263,13 +263,13 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) == -1) {
- err("PR_SET_CHILD_SUBREAPER");
+ pr_perror("PR_SET_CHILD_SUBREAPER");
return -1;
}
ret = sigaction(SIGCHLD, NULL, &act);
if (ret < 0) {
- err("sigaction() failed");
+ pr_perror("sigaction() failed");
return -1;
}
@@ -280,20 +280,20 @@ int main(int argc, char ** argv)
ret = sigaction(SIGCHLD, &act, NULL);
if (ret < 0) {
- err("sigaction() failed");
+ pr_perror("sigaction() failed");
return -1;
}
processes = mmap(NULL, MEM_SIZE, PROT_WRITE | PROT_READ,
MAP_SHARED | MAP_ANONYMOUS, 0, 0);
if (processes == NULL) {
- err("Unable to map share memory");
+ pr_perror("Unable to map share memory");
return 1;
}
for (i = 0; i < PR_MAX; i++) {
if (socketpair(PF_UNIX, SOCK_STREAM, 0, processes[i].sks) == -1) {
- err("socketpair");
+ pr_perror("socketpair");
return 1;
}
}
@@ -334,7 +334,7 @@ int main(int argc, char ** argv)
processes[i].sid = getsid(processes[i].pid);
if (processes[i].sid == -1) {
- err("getsid(%d)", i);
+ pr_perror("getsid(%d)", i);
goto err;
}
}
@@ -353,7 +353,7 @@ int main(int argc, char ** argv)
sid = getsid(processes[i].pid);
if (sid == -1) {
- err("getsid(%d)", i);
+ pr_perror("getsid(%d)", i);
goto err;
}
diff --git a/test/zdtm/live/static/shm.c b/test/zdtm/live/static/shm.c
index e26de48..05b2c33 100644
--- a/test/zdtm/live/static/shm.c
+++ b/test/zdtm/live/static/shm.c
@@ -30,14 +30,14 @@ static int fill_shm_seg(int id, size_t size)
mem = shmat(id, NULL, 0);
if (mem == (void *)-1) {
- err("Can't attach shm: %d", -errno);
+ pr_perror("Can't attach shm: %d", -errno);
return -1;
}
datagen(mem, size, &crc);
if (shmdt(mem) < 0) {
- err("Can't detach shm: %d", -errno);
+ pr_perror("Can't detach shm: %d", -errno);
return -1;
}
return 0;
@@ -49,7 +49,7 @@ static int get_shm_seg(int key, size_t size, unsigned int flags)
id = shmget(key, size, 0777 | flags);
if (id == -1) {
- err("Can't get shm: %d", -errno);
+ pr_perror("Can't get shm: %d", -errno);
return -1;
}
return id;
@@ -75,7 +75,7 @@ static int check_shm_id(int id, size_t size)
mem = shmat(id, NULL, 0);
if (mem == (void *)-1) {
- err("Can't attach shm: %d", -errno);
+ pr_perror("Can't attach shm: %d", -errno);
return -1;
}
crc = INIT_CRC;
@@ -84,7 +84,7 @@ static int check_shm_id(int id, size_t size)
return -1;
}
if (shmdt(mem) < 0) {
- err("Can't detach shm: %d", -errno);
+ pr_perror("Can't detach shm: %d", -errno);
return -1;
}
return 0;
@@ -112,19 +112,19 @@ static int test_fn(int argc, char **argv)
key = ftok(argv[0], 822155666);
if (key == -1) {
- err("Can't make key");
+ pr_perror("Can't make key");
goto out;
}
shm = prepare_shm(key, shmem_size);
if (shm == -1) {
- err("Can't prepare shm (1)");
+ pr_perror("Can't prepare shm (1)");
goto out;
}
mem = shmat(shm, NULL, 0);
if (mem == (void *)-1) {
- err("Can't shmat");
+ pr_perror("Can't shmat");
goto out;
}
@@ -151,7 +151,7 @@ static int test_fn(int argc, char **argv)
}
if (shmdt(mem) < 0) {
- err("Can't detach shm");
+ pr_perror("Can't detach shm");
return -1;
}
diff --git a/test/zdtm/live/static/sigaltstack.c b/test/zdtm/live/static/sigaltstack.c
index 087b88c..d84c35c 100644
--- a/test/zdtm/live/static/sigaltstack.c
+++ b/test/zdtm/live/static/sigaltstack.c
@@ -50,7 +50,7 @@ static void show_ss(char *prefix, stack_t *s)
void thread_sigaction(int signo, siginfo_t *info, void *context)
{
if (sigaltstack(NULL, &sas_state[SAS_THRD_NEW]))
- err("thread sigaltstack");
+ pr_perror("thread sigaltstack");
show_ss("thread in sas", &sas_state[SAS_THRD_NEW]);
@@ -77,14 +77,14 @@ static void *thread_func(void *arg)
sigemptyset(&sa.sa_mask);
if (sigaction(SIGUSR2, &sa, NULL)) {
- err("Can't set SIGUSR2 handler");
+ pr_perror("Can't set SIGUSR2 handler");
exit_group(-1);
}
task_waiter_wait4(&t, 1);
if (sigaltstack(&sas_state[SAS_THRD_OLD], NULL)) {
- err("thread sigaltstack");
+ pr_perror("thread sigaltstack");
exit_group(-1);
}
@@ -96,7 +96,7 @@ static void *thread_func(void *arg)
void leader_sigaction(int signo, siginfo_t *info, void *context)
{
if (sigaltstack(NULL, &sas_state[SAS_MAIN_NEW]))
- err("leader sigaltstack");
+ pr_perror("leader sigaltstack");
show_ss("leader in sas", &sas_state[SAS_MAIN_NEW]);
}
@@ -122,17 +122,17 @@ int main(int argc, char *argv[])
task_waiter_init(&t);
if (sigaction(SIGUSR1, &sa, NULL)) {
- err("Can't set SIGUSR1 handler");
+ pr_perror("Can't set SIGUSR1 handler");
exit(-1);
}
if (pthread_create(&thread, NULL, &thread_func, NULL)) {
- err("Can't create thread");
+ pr_perror("Can't create thread");
exit(-1);
}
if (sigaltstack(&sas_state[SAS_MAIN_OLD], NULL)) {
- err("sigaltstack");
+ pr_perror("sigaltstack");
exit(-1);
}
diff --git a/test/zdtm/live/static/sigpending.c b/test/zdtm/live/static/sigpending.c
index 3464d77..b0b7f8c 100644
--- a/test/zdtm/live/static/sigpending.c
+++ b/test/zdtm/live/static/sigpending.c
@@ -38,7 +38,7 @@ static void sig_handler(int signal, siginfo_t *info, void *data)
test_msg("signo=%d si_code=%x\n", signal, info->si_code);
if (test_go()) {
- err("The signal is received before unlocking");
+ pr_perror("The signal is received before unlocking");
return;
}
@@ -85,7 +85,7 @@ static void sig_handler(int signal, siginfo_t *info, void *data)
return;
}
- err("Unexpected signal");
+ pr_perror("Unexpected signal");
exit(1);
}
@@ -103,12 +103,12 @@ static void *thread_fn(void *args)
sigdelset(&blockmask, SIGTERM);
if (sigprocmask(SIG_BLOCK, &blockmask, NULL) == -1) {
- err("sigprocmask");
+ pr_perror("sigprocmask");
return NULL;
}
if (sigprocmask(SIG_SETMASK, NULL, &oldset) == -1) {
- err("sigprocmask");
+ pr_perror("sigprocmask");
return NULL;
}
@@ -121,7 +121,7 @@ static void *thread_fn(void *args)
sigaddset(&act.sa_mask, TESTSIG);
sigaddset(&act.sa_mask, THREADSIG);
if (sigaction(TESTSIG, &act, NULL)) {
- err("sigaction() failed");
+ pr_perror("sigaction() failed");
return NULL;
}
@@ -129,7 +129,7 @@ static void *thread_fn(void *args)
pthread_mutex_lock(&exit_lock);
if (sigprocmask(SIG_UNBLOCK, &blockmask, &newset) == -1) {
- err("sigprocmask");
+ pr_perror("sigprocmask");
return NULL;
}
@@ -181,7 +181,7 @@ int main(int argc, char ** argv)
pthread_mutex_lock(&init_lock);
if (pthread_create(&pthrd, NULL, thread_fn, NULL)) {
- err("Can't create a thread");
+ pr_perror("Can't create a thread");
return 1;
}
@@ -191,18 +191,18 @@ int main(int argc, char ** argv)
sigdelset(&blockmask, SIGTERM);
if (sigprocmask(SIG_BLOCK, &blockmask, NULL) == -1) {
- err("sigprocmask");
+ pr_perror("sigprocmask");
return -1;
}
if (sigprocmask(SIG_BLOCK, NULL, &oldset) == -1) {
- err("sigprocmask");
+ pr_perror("sigprocmask");
return -1;
}
child = fork();
if (child == -1) {
- err("fork");
+ pr_perror("fork");
return -1;
}
@@ -228,19 +228,19 @@ int main(int argc, char ** argv)
sigemptyset(&act.sa_mask);
if (sigaction(SIGCHLD, &act, NULL)) {
- err("sigaction() failed");
+ pr_perror("sigaction() failed");
return -1;
}
sigaddset(&act.sa_mask, TESTSIG);
sigaddset(&act.sa_mask, THREADSIG);
if (sigaction(TESTSIG, &act, NULL)) {
- err("sigaction() failed");
+ pr_perror("sigaction() failed");
return -1;
}
if (sigaction(THREADSIG, &act, NULL)) {
- err("sigaction() failed");
+ pr_perror("sigaction() failed");
return -1;
}
@@ -249,7 +249,7 @@ int main(int argc, char ** argv)
test_waitsig();
if (sigprocmask(SIG_UNBLOCK, &blockmask, &newset) == -1) {
- err("sigprocmask");
+ pr_perror("sigprocmask");
return -1;
}
pthread_mutex_unlock(&exit_lock);
diff --git a/test/zdtm/live/static/sk-netlink.c b/test/zdtm/live/static/sk-netlink.c
index 7b384ad..f334246 100644
--- a/test/zdtm/live/static/sk-netlink.c
+++ b/test/zdtm/live/static/sk-netlink.c
@@ -30,12 +30,12 @@ int main(int argc, char ** argv)
ssk = socket(PF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
if (ssk < 0) {
- err("Can't create sock diag socket");
+ pr_perror("Can't create sock diag socket");
return -1;
}
bsk = socket(PF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
if (bsk < 0) {
- err("Can't create sock diag socket");
+ pr_perror("Can't create sock diag socket");
return -1;
}
#if 0
@@ -43,7 +43,7 @@ int main(int argc, char ** argv)
bbsk = socket(PF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
if (bbsk < 0) {
- err("Can't create sock diag socket");
+ pr_perror("Can't create sock diag socket");
return -1;
}
@@ -52,12 +52,12 @@ int main(int argc, char ** argv)
#endif
csk = socket(PF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
if (csk < 0) {
- err("Can't create sock diag socket");
+ pr_perror("Can't create sock diag socket");
return -1;
}
dsk = socket(PF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
if (dsk < 0) {
- err("Can't create sock diag socket");
+ pr_perror("Can't create sock diag socket");
return -1;
}
@@ -65,21 +65,21 @@ int main(int argc, char ** argv)
addr.nl_groups = 0;
addr.nl_pid = getpid();
if (bind(ssk, (struct sockaddr *) &addr, sizeof(struct sockaddr_nl))) {
- err("bind");
+ pr_perror("bind");
return 1;
}
addr.nl_groups = 1 << (UDEV_MONITOR_TEST - 1);
addr.nl_pid = 0;
if (bind(bsk, (struct sockaddr *) &addr, sizeof(struct sockaddr_nl))) {
- err("bind");
+ pr_perror("bind");
return 1;
}
addr.nl_pid = getpid();;
addr.nl_groups = 1 << (UDEV_MONITOR_TEST - 1);
if (connect(csk, (struct sockaddr *) &addr, sizeof(struct sockaddr_nl))) {
- err("connect");
+ pr_perror("connect");
return 1;
}
@@ -101,7 +101,7 @@ int main(int argc, char ** argv)
iov.iov_len = sizeof(req);;
if (sendmsg(csk, &msg, 0) < 0) {
- err("Can't send request message");
+ pr_perror("Can't send request message");
return 1;
}
@@ -114,12 +114,12 @@ int main(int argc, char ** argv)
iov.iov_len = sizeof(buf);
if (recvmsg(ssk, &msg, 0) < 0) {
- err("Can't recv request message");
+ pr_perror("Can't recv request message");
return 1;
}
if (recvmsg(bsk, &msg, 0) < 0) {
- err("Can't recv request message");
+ pr_perror("Can't recv request message");
return 1;
}
@@ -137,7 +137,7 @@ int main(int argc, char ** argv)
iov.iov_len = sizeof(req);;
if (sendmsg(dsk, &msg, 0) < 0) {
- err("Can't send request message");
+ pr_perror("Can't send request message");
return 1;
}
@@ -150,7 +150,7 @@ int main(int argc, char ** argv)
iov.iov_len = sizeof(buf);
if (recvmsg(ssk, &msg, 0) < 0) {
- err("Can't recv request message");
+ pr_perror("Can't recv request message");
return 1;
}
diff --git a/test/zdtm/live/static/sk-unix-unconn.c b/test/zdtm/live/static/sk-unix-unconn.c
index 282c6fb..8e60013 100644
--- a/test/zdtm/live/static/sk-unix-unconn.c
+++ b/test/zdtm/live/static/sk-unix-unconn.c
@@ -21,13 +21,13 @@ int main(int argc, char ** argv)
sk = socket(AF_UNIX, SOCK_STREAM, 0);
if (sk == -1) {
- err("socket");
+ pr_perror("socket");
return 1;
}
skc = socket(AF_UNIX, SOCK_STREAM, 0);
if (skc == -1) {
- err("socket");
+ pr_perror("socket");
return 1;
}
@@ -49,7 +49,7 @@ int main(int argc, char ** argv)
test_waitsig();
if (listen(sk, 1) == -1) {
- err("listen");
+ pr_perror("listen");
return 1;
}
diff --git a/test/zdtm/live/static/sock_filter.c b/test/zdtm/live/static/sock_filter.c
index b377f93..e2475cd 100644
--- a/test/zdtm/live/static/sock_filter.c
+++ b/test/zdtm/live/static/sock_filter.c
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
sk = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sk < 0) {
- err("No socket");
+ pr_perror("No socket");
return 1;
}
@@ -52,18 +52,18 @@ int main(int argc, char **argv)
p.filter = f;
if (setsockopt(sk, SOL_SOCKET, SO_ATTACH_FILTER, &p, sizeof(p))) {
- err("No filter");
+ pr_perror("No filter");
return 1;
}
len = 0;
if (getsockopt(sk, SOL_SOCKET, SO_GET_FILTER, NULL, &len)) {
- err("No len");
+ pr_perror("No len");
return 1;
}
if (len != SFLEN) {
- err("Len mismatch");
+ pr_perror("Len mismatch");
return 1;
}
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
}
if (len != SFLEN) {
- err("Len mismatch2");
+ pr_perror("Len mismatch2");
return 1;
}
diff --git a/test/zdtm/live/static/sock_opts00.c b/test/zdtm/live/static/sock_opts00.c
index c360aa9..08fc1d3 100644
--- a/test/zdtm/live/static/sock_opts00.c
+++ b/test/zdtm/live/static/sock_opts00.c
@@ -31,14 +31,14 @@ int main(int argc, char ** argv)
sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock < 0) {
- err("can't create socket: %m");
+ pr_perror("can't create socket");
return 1;
}
for (i = 0; i < NOPTS; i++) {
ret = getsockopt(sock, SOL_SOCKET, vname[i], &val[i], &len);
if (ret) {
- err("can't get option %d", i);
+ pr_perror("can't get option %d", i);
return 1;
}
@@ -46,19 +46,19 @@ int main(int argc, char ** argv)
ret = setsockopt(sock, SOL_SOCKET, vname[i], &val[i], len);
if (ret) {
- err("can't set option %d", i);
+ pr_perror("can't set option %d", i);
return 1;
}
ret = getsockopt(sock, SOL_SOCKET, vname[i], &rval, &len);
if (ret) {
- err("can't get option %d 2", i);
+ pr_perror("can't get option %d 2", i);
return 1;
}
if (rval != val[i]) {
if (rval + 1 == val[i]) {
- err("can't reset option %d want %d have %d", i,
+ pr_perror("can't reset option %d want %d have %d", i,
val[i], rval);
return 1;
}
@@ -74,7 +74,7 @@ int main(int argc, char ** argv)
for (i = 0; i < NOPTS; i++) {
ret = getsockopt(sock, SOL_SOCKET, vname[i], &rval, &len);
if (ret) {
- err("can't get option %d again", i);
+ pr_perror("can't get option %d again", i);
return 1;
}
diff --git a/test/zdtm/live/static/sock_opts01.c b/test/zdtm/live/static/sock_opts01.c
index 4b33fbb..7dfce22 100644
--- a/test/zdtm/live/static/sock_opts01.c
+++ b/test/zdtm/live/static/sock_opts01.c
@@ -21,7 +21,7 @@ int main(int argc, char ** argv)
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sock < 0) {
- err("can't create socket: %m");
+ pr_perror("can't create socket");
return 1;
}
@@ -29,14 +29,14 @@ int main(int argc, char ** argv)
if (ret < 0)
ret = setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, "lo", 3);
if (ret < 0) {
- err("can't bind to eth0");
+ pr_perror("can't bind to eth0");
return 1;
}
len = sizeof(dev);
ret = getsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, &dev, &len);
if (ret < 0) {
- err("can't get dev binding");
+ pr_perror("can't get dev binding");
return 1;
}
diff --git a/test/zdtm/live/static/socket-closed-tcp.c b/test/zdtm/live/static/socket-closed-tcp.c
index 32ca56f..bda14ad 100644
--- a/test/zdtm/live/static/socket-closed-tcp.c
+++ b/test/zdtm/live/static/socket-closed-tcp.c
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
- err("initializing server failed");
+ pr_perror("initializing server failed");
return 1;
}
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
*/
fd = tcp_accept_server(fd_s);
if (fd < 0) {
- err("can't accept client connection %m");
+ pr_perror("can't accept client connection %m");
return 1;
}
close(fd_s);
diff --git a/test/zdtm/live/static/socket-ext.c b/test/zdtm/live/static/socket-ext.c
index bcf5d64..bfc2925 100644
--- a/test/zdtm/live/static/socket-ext.c
+++ b/test/zdtm/live/static/socket-ext.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[])
pid = fork();
if (pid < 0) {
- err("fork() failed");
+ pr_perror("fork() failed");
return 1;
} else if (pid == 0) {
char c;
@@ -48,12 +48,12 @@ int main(int argc, char *argv[])
sk = socket(AF_UNIX, SOCK_DGRAM, 0);
if (sk < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
ret = bind(sk, &addr, addrlen);
if (ret < 0) {
- err("Can't bind socket to %s", path);
+ pr_perror("Can't bind socket to %s", path);
return 1;
}
chmod(path, 0777);
@@ -73,13 +73,13 @@ int main(int argc, char *argv[])
sk = socket(AF_UNIX, SOCK_DGRAM, 0);
if (sk < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
ret = connect(sk, &addr, addrlen);
if (ret < 0) {
- err("Can't connect socket");
+ pr_perror("Can't connect socket");
return 1;
}
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
ret = send(sk, "H", 1, 0);
if (ret != 1) {
- err("Can't send a symbol");
+ pr_perror("Can't send a symbol");
fail();
return 1;
}
diff --git a/test/zdtm/live/static/socket-tcp.c b/test/zdtm/live/static/socket-tcp.c
index d3d1074..b179a9b 100644
--- a/test/zdtm/live/static/socket-tcp.c
+++ b/test/zdtm/live/static/socket-tcp.c
@@ -62,20 +62,20 @@ int main(int argc, char **argv)
socklen_t optlen;
if (pipe(pfd)) {
- err("pipe() failed");
+ pr_perror("pipe() failed");
return 1;
}
extpid = fork();
if (extpid < 0) {
- err("fork() failed");
+ pr_perror("fork() failed");
return 1;
} else if (extpid == 0) {
test_ext_init(argc, argv);
close(pfd[1]);
if (read(pfd[0], &port, sizeof(port)) != sizeof(port)) {
- err("Can't read port");
+ pr_perror("Can't read port");
return 1;
}
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
#ifdef STREAM
while (1) {
if (read_data(fd, buf, BUF_SIZE)) {
- err("read less then have to");
+ pr_perror("read less then have to");
return 1;
}
if (datachk(buf, BUF_SIZE, &crc))
@@ -94,13 +94,13 @@ int main(int argc, char **argv)
datagen(buf, BUF_SIZE, &crc);
if (write_data(fd, buf, BUF_SIZE)) {
- err("can't write");
+ pr_perror("can't write");
return 1;
}
}
#else
if (read_data(fd, buf, BUF_SIZE)) {
- err("read less then have to");
+ pr_perror("read less then have to");
return 1;
}
if (datachk(buf, BUF_SIZE, &crc))
@@ -108,7 +108,7 @@ int main(int argc, char **argv)
datagen(buf, BUF_SIZE, &crc);
if (write_data(fd, buf, BUF_SIZE)) {
- err("can't write");
+ pr_perror("can't write");
return 1;
}
#endif
@@ -118,13 +118,13 @@ int main(int argc, char **argv)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
- err("initializing server failed");
+ pr_perror("initializing server failed");
return 1;
}
close(pfd[0]);
if (write(pfd[1], &port, sizeof(port)) != sizeof(port)) {
- err("Can't send port");
+ pr_perror("Can't send port");
return 1;
}
close(pfd[1]);
@@ -134,13 +134,13 @@ int main(int argc, char **argv)
*/
fd = tcp_accept_server(fd_s);
if (fd < 0) {
- err("can't accept client connection %m");
+ pr_perror("can't accept client connection %m");
return 1;
}
val = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val))) {
- err("setsockopt");
+ pr_perror("setsockopt");
return 1;
}
@@ -149,12 +149,12 @@ int main(int argc, char **argv)
while (test_go()) {
datagen(buf, BUF_SIZE, &crc);
if (write_data(fd, buf, BUF_SIZE)) {
- err("can't write");
+ pr_perror("can't write");
return 1;
}
if (read_data(fd, buf, BUF_SIZE)) {
- err("read less then have to");
+ pr_perror("read less then have to");
return 1;
}
if (datachk(buf, BUF_SIZE, &crc))
@@ -166,12 +166,12 @@ int main(int argc, char **argv)
datagen(buf, BUF_SIZE, &crc);
if (write_data(fd, buf, BUF_SIZE)) {
- err("can't write");
+ pr_perror("can't write");
return 1;
}
if (read_data(fd, buf, BUF_SIZE)) {
- err("read less then have to");
+ pr_perror("read less then have to");
return 1;
}
if (datachk(buf, BUF_SIZE, &crc))
@@ -179,7 +179,7 @@ int main(int argc, char **argv)
#endif
optlen = sizeof(val);
if (getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, &optlen)) {
- err("getsockopt");
+ pr_perror("getsockopt");
return 1;
}
if (val != 1) {
diff --git a/test/zdtm/live/static/socket-tcpbuf.c b/test/zdtm/live/static/socket-tcpbuf.c
index 51592a1..58c3b34 100644
--- a/test/zdtm/live/static/socket-tcpbuf.c
+++ b/test/zdtm/live/static/socket-tcpbuf.c
@@ -28,7 +28,7 @@ static int port = 8880;
static void read_safe(int fd, void *buf, size_t size)
{
if (read(fd, buf, size) != size) {
- err("Unable to read from %d", fd);
+ pr_perror("Unable to read from %d", fd);
exit(1);
}
}
@@ -36,7 +36,7 @@ static void read_safe(int fd, void *buf, size_t size)
static void write_safe(int fd, void *buf, size_t size)
{
if (write(fd, buf, size) != size) {
- err("Unable to write from %d", fd);
+ pr_perror("Unable to write from %d", fd);
exit(1);
}
}
@@ -49,11 +49,11 @@ static int fill_sock_buf(int fd)
flags = fcntl(fd, F_GETFL, 0);
if (flags == -1) {
- err("Can't get flags");
+ pr_perror("Can't get flags");
return -1;
}
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
- err("Can't set flags");
+ pr_perror("Can't set flags");
return -1;
}
@@ -64,14 +64,14 @@ static int fill_sock_buf(int fd)
if (ret == -1) {
if (errno == EAGAIN)
break;
- err("write");
+ pr_perror("write");
return -1;
}
size += ret;
}
if (fcntl(fd, F_SETFL, flags) == -1) {
- err("Can't set flags");
+ pr_perror("Can't set flags");
return -1;
}
@@ -87,7 +87,7 @@ static int clean_sk_buf(int fd, int limit)
while (1) {
ret = read(fd, buf, sizeof(buf));
if (ret == -1) {
- err("read");
+ pr_perror("read");
return -11;
}
@@ -116,13 +116,13 @@ int main(int argc, char **argv)
#endif
if (pipe(pfd)) {
- err("pipe() failed");
+ pr_perror("pipe() failed");
return 1;
}
extpid = fork();
if (extpid < 0) {
- err("fork() failed");
+ pr_perror("fork() failed");
return 1;
} else if (extpid == 0) {
int size;
@@ -182,12 +182,12 @@ int main(int argc, char **argv)
write_safe(ctl_fd, &snd_size, sizeof(snd_size));
if (read(ctl_fd, &c, 1) != 0) {
- err("read");
+ pr_perror("read");
return 1;
}
if (shutdown(fd, SHUT_WR) == -1) {
- err("shutdown");
+ pr_perror("shutdown");
return 1;
}
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
#endif
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
- err("initializing server failed");
+ pr_perror("initializing server failed");
return 1;
}
@@ -225,27 +225,27 @@ int main(int argc, char **argv)
*/
fd = tcp_accept_server(fd_s);
if (fd < 0) {
- err("can't accept client connection %m");
+ pr_perror("can't accept client connection %m");
return 1;
}
ctl_fd = tcp_accept_server(fd_s);
if (ctl_fd < 0) {
- err("can't accept client connection %m");
+ pr_perror("can't accept client connection %m");
return 1;
}
sk_bsize = TCP_MAX_BUF;
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
&sk_bsize, sizeof(sk_bsize)) == -1) {
- err("Can't set snd buf");
+ pr_perror("Can't set snd buf");
return 1;
}
sk_bsize = TCP_MAX_BUF;
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
&sk_bsize, sizeof(sk_bsize)) == -1) {
- err("Can't set snd buf");
+ pr_perror("Can't set snd buf");
return 1;
}
@@ -289,12 +289,12 @@ int main(int argc, char **argv)
read_safe(ctl_fd, &snd, sizeof(snd));
if (shutdown(ctl_fd, SHUT_WR) == -1) {
- err("shutdown");
+ pr_perror("shutdown");
return 1;
}
if (shutdown(fd, SHUT_WR) == -1) {
- err("shutdown");
+ pr_perror("shutdown");
return 1;
}
diff --git a/test/zdtm/live/static/socket6_udp.c b/test/zdtm/live/static/socket6_udp.c
index c9fd2fa..30ddc9a 100644
--- a/test/zdtm/live/static/socket6_udp.c
+++ b/test/zdtm/live/static/socket6_udp.c
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
sk1 = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (sk1 < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
@@ -42,13 +42,13 @@ int main(int argc, char **argv)
ret = bind(sk1, (struct sockaddr *)&addr1, len);
if (ret < 0) {
- err("Can't bind socket");
+ pr_perror("Can't bind socket");
return 1;
}
sk2 = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (sk2 < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
@@ -59,13 +59,13 @@ int main(int argc, char **argv)
ret = bind(sk2, (struct sockaddr *)&addr2, len);
if (ret < 0) {
- err("Can't bind socket");
+ pr_perror("Can't bind socket");
return 1;
}
ret = connect(sk2, (struct sockaddr *)&addr1, len);
if (ret < 0) {
- err("Can't connect");
+ pr_perror("Can't connect");
return 1;
}
diff --git a/test/zdtm/live/static/socket_aio.c b/test/zdtm/live/static/socket_aio.c
index b7925f2..50d326e 100644
--- a/test/zdtm/live/static/socket_aio.c
+++ b/test/zdtm/live/static/socket_aio.c
@@ -36,13 +36,13 @@ int main(int argc, char **argv)
test_init(argc, argv);
if ((fd_s = tcp_init_server(AF_INET, &port)) < 0) {
- err("initializing server failed");
+ pr_perror("initializing server failed");
return 1;
}
pid = test_fork();
if (pid < 0) {
- err("fork failed. Return %d %m", pid);
+ pr_perror("fork failed. Return %d %m", pid);
return 1;
}
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
aiocb.aio_nbytes = BUF_SIZE;
ret = aio_read(&aiocb);
if (ret < 0) {
- err("aio_read failed %m");
+ pr_perror("aio_read failed %m");
return 1;
}
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
res = 0;
again:
if (aio_suspend(aioary, 1, NULL) < 0 && errno != EINTR) {
- err("aio_suspend failed %m");
+ pr_perror("aio_suspend failed %m");
res = 1;
}
@@ -86,12 +86,12 @@ again:
goto again;
}
if (ret != 0) {
- err("Error at aio_error() %s", strerror(ret));
+ pr_perror("Error at aio_error() %s", strerror(ret));
res = 1;
}
if (aio_return(&aiocb) != BUF_SIZE) {
- err("Error at aio_return() %m");
+ pr_perror("Error at aio_return() %m");
res = 1;
}
@@ -105,7 +105,7 @@ again:
fd = tcp_accept_server(fd_s);
close(fd_s);
if (fd < 0) {
- err("can't accept client connection %m");
+ pr_perror("can't accept client connection %m");
goto error;
}
@@ -113,19 +113,19 @@ again:
test_waitsig();
if (write(fd, buf, BUF_SIZE) < BUF_SIZE) {
- err("can't write");
+ pr_perror("can't write");
goto error;
}
close(fd);
if (wait(&status) < 0) {
- err("wait failed %m");
+ pr_perror("wait failed %m");
goto error;
}
if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
- err("chiled failed. Return %d", WEXITSTATUS(status));
+ pr_perror("chiled failed. Return %d", WEXITSTATUS(status));
return 1;
}
diff --git a/test/zdtm/live/static/socket_close_data.c b/test/zdtm/live/static/socket_close_data.c
index a23eff6..de552ad 100644
--- a/test/zdtm/live/static/socket_close_data.c
+++ b/test/zdtm/live/static/socket_close_data.c
@@ -18,12 +18,12 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (socketpair(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, sks) < 0) {
- err("socketpair");
+ pr_perror("socketpair");
return 1;
}
if (write(sks[1], MSG, sizeof(MSG)) != sizeof(MSG)) {
- err("write");
+ pr_perror("write");
return 1;
}
close(sks[1]);
diff --git a/test/zdtm/live/static/socket_dgram_data.c b/test/zdtm/live/static/socket_dgram_data.c
index aa41792..ec79a38 100644
--- a/test/zdtm/live/static/socket_dgram_data.c
+++ b/test/zdtm/live/static/socket_dgram_data.c
@@ -25,17 +25,17 @@ int main(int argc, char **argv)
srv = socket(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0);
if (srv < 0) {
- err("socket");
+ pr_perror("socket");
return 1;
}
clnt1 = socket(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0);
if (clnt1 < 0) {
- err("socket");
+ pr_perror("socket");
return 1;
}
clnt2 = socket(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0);
if (clnt2 < 0) {
- err("socket");
+ pr_perror("socket");
return 1;
}
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
}
if (write(clnt1, MSG, sizeof(MSG)) != sizeof(MSG)) {
- err("write");
+ pr_perror("write");
return 1;
}
diff --git a/test/zdtm/live/static/socket_listen.c b/test/zdtm/live/static/socket_listen.c
index 6aef4a6..70e27cc 100644
--- a/test/zdtm/live/static/socket_listen.c
+++ b/test/zdtm/live/static/socket_listen.c
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if ((fd_s = tcp_init_server(ZDTM_FAMILY, &port)) < 0) {
- err("initializing server failed");
+ pr_perror("initializing server failed");
return 1;
}
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
pid = test_fork();
if (pid < 0) {
- err("fork failed. Return %d %m", pid);
+ pr_perror("fork failed. Return %d %m", pid);
return 1;
}
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
res = read(fd, buf, BUF_SIZE);
close(fd);
if (res != BUF_SIZE) {
- err("read less then have to: %d instead of %d", res, BUF_SIZE);
+ pr_perror("read less then have to: %d instead of %d", res, BUF_SIZE);
return -1;
}
if (datachk(buf, BUF_SIZE, &crc))
@@ -87,25 +87,25 @@ int main(int argc, char **argv)
fd = tcp_accept_server(fd_s);
close(fd_s);
if (fd < 0) {
- err("can't accept client connection %m");
+ pr_perror("can't accept client connection %m");
goto error;
}
datagen(buf, BUF_SIZE, &crc);
if (write(fd, buf, BUF_SIZE) < BUF_SIZE) {
- err("can't write");
+ pr_perror("can't write");
goto error;
}
close(fd);
if (wait(&status) < 0) {
- err("wait failed %m");
+ pr_perror("wait failed %m");
goto error;
}
if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
- err("chiled failed. Return %d", WEXITSTATUS(status));
+ pr_perror("chiled failed. Return %d", WEXITSTATUS(status));
return 1;
}
diff --git a/test/zdtm/live/static/socket_snd_addr.c b/test/zdtm/live/static/socket_snd_addr.c
index 906abae..1d72d4e 100644
--- a/test/zdtm/live/static/socket_snd_addr.c
+++ b/test/zdtm/live/static/socket_snd_addr.c
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
}
if (send(clnt, MSG, sizeof(MSG), 0) != sizeof(MSG)) {
- err("write");
+ pr_perror("write");
return 1;
}
}
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
return 1;
}
if (hdr.msg_namelen > sizeof(addr.sun_family) + 1)
- err("%d, %s", hdr.msg_namelen, addr.sun_path + 1);
+ pr_perror("%d, %s", hdr.msg_namelen, addr.sun_path + 1);
if (memcmp(addr.sun_path, sk_names[i], sizeof(SK_NAME))) {
fail("A sender address is mismatch");
return 1;
diff --git a/test/zdtm/live/static/socket_udp.c b/test/zdtm/live/static/socket_udp.c
index 4694fce..e84e8bf 100644
--- a/test/zdtm/live/static/socket_udp.c
+++ b/test/zdtm/live/static/socket_udp.c
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
sk1 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sk1 < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
@@ -47,13 +47,13 @@ int main(int argc, char **argv)
ret = bind(sk1, (struct sockaddr *)&addr1, len);
if (ret < 0) {
- err("Can't bind socket");
+ pr_perror("Can't bind socket");
return 1;
}
sk2 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sk2 < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
@@ -64,13 +64,13 @@ int main(int argc, char **argv)
ret = bind(sk2, (struct sockaddr *)&addr2, len);
if (ret < 0) {
- err("Can't bind socket");
+ pr_perror("Can't bind socket");
return 1;
}
ret = connect(sk2, (struct sockaddr *)&addr1, len);
if (ret < 0) {
- err("Can't connect");
+ pr_perror("Can't connect");
return 1;
}
diff --git a/test/zdtm/live/static/socket_udplite.c b/test/zdtm/live/static/socket_udplite.c
index d6db209..aaa40e1 100644
--- a/test/zdtm/live/static/socket_udplite.c
+++ b/test/zdtm/live/static/socket_udplite.c
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
sk1 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDPLITE);
if (sk1 < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
@@ -47,13 +47,13 @@ int main(int argc, char **argv)
ret = bind(sk1, (struct sockaddr *)&addr1, len);
if (ret < 0) {
- err("Can't bind socket");
+ pr_perror("Can't bind socket");
return 1;
}
sk2 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDPLITE);
if (sk2 < 0) {
- err("Can't create socket");
+ pr_perror("Can't create socket");
return 1;
}
@@ -64,13 +64,13 @@ int main(int argc, char **argv)
ret = bind(sk2, (struct sockaddr *)&addr2, len);
if (ret < 0) {
- err("Can't bind socket");
+ pr_perror("Can't bind socket");
return 1;
}
ret = connect(sk2, (struct sockaddr *)&addr1, len);
if (ret < 0) {
- err("Can't connect");
+ pr_perror("Can't connect");
return 1;
}
diff --git a/test/zdtm/live/static/sockets00.c b/test/zdtm/live/static/sockets00.c
index 28beb08..9d00957 100644
--- a/test/zdtm/live/static/sockets00.c
+++ b/test/zdtm/live/static/sockets00.c
@@ -73,13 +73,13 @@ int main(int argc, char *argv[])
ret = chmod(path, TEST_MODE);
if (ret) {
- err("chmod");
+ pr_perror("chmod");
exit(1);
}
ret = chown(path, uid, gid);
if (ret) {
- err("chown");
+ pr_perror("chown");
exit(1);
}
diff --git a/test/zdtm/live/static/sockets01.c b/test/zdtm/live/static/sockets01.c
index d8aeeb3..a111e9d 100644
--- a/test/zdtm/live/static/sockets01.c
+++ b/test/zdtm/live/static/sockets01.c
@@ -18,7 +18,7 @@
const char *test_doc = "Test unix sockets shutdown";
const char *test_author = "Pavel Emelyanov <xemul at parallels.com>";
-#define fin(msg) do { err(msg); exit(1); } while (0)
+#define fin(msg) do { pr_perror(msg); exit(1); } while (0)
#define ffin(msg) do { fail(msg); exit(1); } while (0)
#define TEST_MSG "test-message"
diff --git a/test/zdtm/live/static/stopped.c b/test/zdtm/live/static/stopped.c
index b74b7ff..6417088 100644
--- a/test/zdtm/live/static/stopped.c
+++ b/test/zdtm/live/static/stopped.c
@@ -16,7 +16,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (pipe(p)) {
- err("Unable to create pipe");
+ pr_perror("Unable to create pipe");
return 1;
}
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
close(p[1]);
ret = read(p[0], &c, 1);
if (ret != 1) {
- err("Unable to read: %d", ret);
+ pr_perror("Unable to read: %d", ret);
return 1;
}
@@ -47,7 +47,7 @@ int main(int argc, char **argv)
// Return immediately if child run or stopped(by SIGSTOP)
if (waitpid(pid, &status, WUNTRACED | WCONTINUED) == -1) {
- err("Unable to wait child");
+ pr_perror("Unable to wait child");
goto out;
}
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
kill(pid, SIGCONT);
if (waitpid(pid, &status, 0) == -1) {
- err("Unable to wait child");
+ pr_perror("Unable to wait child");
goto out;
}
diff --git a/test/zdtm/live/static/tempfs.c b/test/zdtm/live/static/tempfs.c
index b6b0bac..66c51a5 100644
--- a/test/zdtm/live/static/tempfs.c
+++ b/test/zdtm/live/static/tempfs.c
@@ -33,12 +33,12 @@ int main(int argc, char **argv)
snprintf(fname, sizeof(buf), "%s/test.file", dirname);
fdo = open(fname, O_RDWR | O_CREAT, 0644);
if (fdo < 0) {
- err("open failed");
+ pr_perror("open failed");
goto err;
}
if (write(fdo, TEST_WORD, sizeof(TEST_WORD)) != sizeof(TEST_WORD)) {
- err("write() failed");
+ pr_perror("write() failed");
goto err;
}
@@ -48,12 +48,12 @@ int main(int argc, char **argv)
snprintf(fname, sizeof(buf), "%s/test.file", overmount);
fd = open(fname, O_RDWR | O_CREAT, 0644);
if (fd < 0) {
- err("open failed");
+ pr_perror("open failed");
goto err;
}
if (write(fd, TEST_WORD2, sizeof(TEST_WORD2)) != sizeof(TEST_WORD2)) {
- err("write() failed");
+ pr_perror("write() failed");
goto err;
}
close(fd);
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
fd = open(fname, O_RDONLY);
if (fd < 0) {
- err("open failed");
+ pr_perror("open failed");
goto err;
}
diff --git a/test/zdtm/live/static/tempfs_ro.c b/test/zdtm/live/static/tempfs_ro.c
index ff421e2..f30ae8d 100644
--- a/test/zdtm/live/static/tempfs_ro.c
+++ b/test/zdtm/live/static/tempfs_ro.c
@@ -32,12 +32,12 @@ int main(int argc, char **argv)
snprintf(fname, sizeof(buf), "%s/test.file", dirname);
fd = open(fname, O_RDWR | O_CREAT, 0644);
if (fd < 0) {
- err("open failed");
+ pr_perror("open failed");
goto err;
}
if (write(fd, TEST_WORD, sizeof(TEST_WORD)) != sizeof(TEST_WORD)) {
- err("write() failed");
+ pr_perror("write() failed");
goto err;
}
close(fd);
@@ -53,7 +53,7 @@ int main(int argc, char **argv)
fd = open(fname, O_RDONLY);
if (fd < 0) {
- err("open failed");
+ pr_perror("open failed");
goto err;
}
diff --git a/test/zdtm/live/static/timerfd.c b/test/zdtm/live/static/timerfd.c
index 9fb6819..132c3ac 100644
--- a/test/zdtm/live/static/timerfd.c
+++ b/test/zdtm/live/static/timerfd.c
@@ -43,7 +43,7 @@ static int parse_self_fdinfo(int fd, struct timerfd_status *s)
sprintf(buf, "/proc/self/fdinfo/%d", fd);
f = fopen(buf, "r");
if (!f) {
- err("Can't open %s to parse", buf);
+ pr_perror("Can't open %s to parse", buf);
return -1;
}
@@ -98,7 +98,7 @@ err:
return ret;
parse_err:
- err("Format error");
+ pr_perror("Format error");
goto err;
}
@@ -143,13 +143,13 @@ int main(int argc, char *argv[])
timerfd = timerfd_create(old.clockid, 0);
if (timerfd < 0) {
- err("timerfd_create failed");
+ pr_perror("timerfd_create failed");
return -1;
}
show_timerfd("setup", &old);
if (timerfd_settime(timerfd, old.settime_flags, &old.v, NULL)) {
- err("timerfd_settime failed");
+ pr_perror("timerfd_settime failed");
return -1;
}
sleep(1);
diff --git a/test/zdtm/live/static/timers.c b/test/zdtm/live/static/timers.c
index 310321c..256a5c1 100644
--- a/test/zdtm/live/static/timers.c
+++ b/test/zdtm/live/static/timers.c
@@ -48,12 +48,12 @@ static void setup_timers(void)
for (i = 0; i < NUM_TIMERS; i++) {
if (signal(timer_tests[i].signal, timer_tick) == SIG_ERR) {
- err("can't set signal handler %d", i);
+ pr_perror("can't set signal handler %d", i);
exit(1);
}
if (setitimer(timer_tests[i].timer_type, &tv, NULL) < 0) {
- err("can't set timer %d", i);
+ pr_perror("can't set timer %d", i);
exit(1);
}
}
diff --git a/test/zdtm/live/static/tty00.c b/test/zdtm/live/static/tty00.c
index c35e9b4..749b9bc 100644
--- a/test/zdtm/live/static/tty00.c
+++ b/test/zdtm/live/static/tty00.c
@@ -30,7 +30,7 @@ int main(int argc, char ** argv)
fdm = open("/dev/ptmx", O_RDWR);
if (fdm == -1) {
- err("Can't open a master pseudoterminal");
+ pr_perror("Can't open a master pseudoterminal");
return 1;
}
@@ -40,7 +40,7 @@ int main(int argc, char ** argv)
pid = test_fork();
if (pid < 0) {
- err("fork() failed");
+ pr_perror("fork() failed");
return 1;
}
@@ -54,12 +54,12 @@ int main(int argc, char ** argv)
/* set up a controlling terminal */
fds = open(slavename, O_RDWR);
if (fds == -1) {
- err("Can't open a slave pseudoterminal %s", slavename);
+ pr_perror("Can't open a slave pseudoterminal %s", slavename);
return 1;
}
if (ioctl(fdm, TIOCSCTTY, 1) < 0) {
- err("Can't setup a controlling terminal");
+ pr_perror("Can't setup a controlling terminal");
return 1;
}
close(fds);
@@ -78,7 +78,7 @@ int main(int argc, char ** argv)
close(fdm);
if (kill(pid, SIGTERM) == -1) {
- err("kill failed");
+ pr_perror("kill failed");
return 1;
}
diff --git a/test/zdtm/live/static/tty02.c b/test/zdtm/live/static/tty02.c
index 866bd3b..b179e2f 100644
--- a/test/zdtm/live/static/tty02.c
+++ b/test/zdtm/live/static/tty02.c
@@ -24,7 +24,7 @@ int main(int argc, char ** argv)
fdm = open("/dev/ptmx", O_RDWR);
if (fdm == -1) {
- err("Can't open a master pseudoterminal");
+ pr_perror("Can't open a master pseudoterminal");
return 1;
}
@@ -35,7 +35,7 @@ int main(int argc, char ** argv)
/* set up a controlling terminal */
fds = open(slavename, O_RDWR | O_NOCTTY);
if (fds == -1) {
- err("Can't open a slave pseudoterminal %s", slavename);
+ pr_perror("Can't open a slave pseudoterminal %s", slavename);
return 1;
}
diff --git a/test/zdtm/live/static/tty03.c b/test/zdtm/live/static/tty03.c
index 0f2b932..c9d4a25 100644
--- a/test/zdtm/live/static/tty03.c
+++ b/test/zdtm/live/static/tty03.c
@@ -22,13 +22,13 @@ int main(int argc, char ** argv)
test_init(argc, argv);
if (pipe(pfd) == -1) {
- err("pipe");
+ pr_perror("pipe");
return 1;
}
fdm = open("/dev/ptmx", O_RDWR);
if (fdm == -1) {
- err("Can't open a master pseudoterminal");
+ pr_perror("Can't open a master pseudoterminal");
return 1;
}
@@ -39,7 +39,7 @@ int main(int argc, char ** argv)
pid = test_fork();
if (pid == 0) {
if (setsid() == -1) {
- err("setsid");
+ pr_perror("setsid");
return 1;
}
@@ -48,7 +48,7 @@ int main(int argc, char ** argv)
/* set up a controlling terminal */
fds = open(slavename, O_RDWR | O_NOCTTY);
if (fds == -1) {
- err("Can't open a slave pseudoterminal %s", slavename);
+ pr_perror("Can't open a slave pseudoterminal %s", slavename);
return 1;
}
ioctl(fds, TIOCSCTTY, 1);
@@ -56,7 +56,7 @@ int main(int argc, char ** argv)
pid = test_fork();
if (pid == 0) {
if (setsid() == -1) {
- err("setsid");
+ pr_perror("setsid");
return 1;
}
@@ -79,12 +79,12 @@ int main(int argc, char ** argv)
close(pfd[1]);
if (read(pfd[0], &sid_a, 1) != 0) {
- err("read");
+ pr_perror("read");
goto out;
}
if (ioctl(fdm, TIOCGSID, &sid_b) == -1) {
- err("The tty is not a controlling");
+ pr_perror("The tty is not a controlling");
goto out;
}
diff --git a/test/zdtm/live/static/tun.c b/test/zdtm/live/static/tun.c
index a28596e..c53b8fa 100644
--- a/test/zdtm/live/static/tun.c
+++ b/test/zdtm/live/static/tun.c
@@ -31,7 +31,7 @@ static int __open_tun(void)
fd = open(TUN_DEVICE, O_RDWR);
if (fd < 0)
- err("Can't open tun file");
+ pr_perror("Can't open tun file");
return fd;
}
@@ -44,7 +44,7 @@ static int set_tun_queue(int fd, unsigned flags)
ifr.ifr_flags = flags;
if (ioctl(fd, TUNSETQUEUE, &ifr) < 0) {
- err("Can't set queue");
+ pr_perror("Can't set queue");
return -1;
}
@@ -61,7 +61,7 @@ static int __attach_tun(int fd, char *name, unsigned flags)
if (ioctl(fd, TUNSETIFF, &ifr) < 0) {
if (!(flags & IFF_TUN_EXCL))
- err("Can't attach iff %s", name);
+ pr_perror("Can't attach iff %s", name);
return -1;
}
@@ -104,7 +104,7 @@ static int dev_get_hwaddr(int fd, char *a)
struct ifreq ifr;
if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) {
- err("Can't get hwaddr");
+ pr_perror("Can't get hwaddr");
return -1;
}
@@ -122,27 +122,27 @@ int main(int argc, char **argv)
/* fd[0] -- opened file */
fds[0] = __open_tun();
if (fds[0] < 0) {
- err("No file 0");
+ pr_perror("No file 0");
return -1;
}
/* fd[1] -- opened file with tun device */
fds[1] = open_tun("tunx0", IFF_TUN);
if (fds[1] < 0) {
- err("No file 1");
+ pr_perror("No file 1");
return -1;
}
/* fd[2] and [3] -- two-queued device, with 3 detached */
fds[2] = open_tun("tunx1", IFF_TUN | IFF_MULTI_QUEUE);
if (fds[2] < 0) {
- err("No file 2");
+ pr_perror("No file 2");
return -1;
}
fds[3] = open_tun("tunx1", IFF_TUN | IFF_MULTI_QUEUE);
if (fds[3] < 0) {
- err("No file 3");
+ pr_perror("No file 3");
return -1;
}
@@ -153,24 +153,24 @@ int main(int argc, char **argv)
/* special case -- persistent device */
ret = open_tun("tunx2", IFF_TUN);
if (ret < 0) {
- err("No persistent device");
+ pr_perror("No persistent device");
return -1;
}
if (ioctl(ret, TUNSETPERSIST, 1) < 0) {
- err("Can't make persistent");
+ pr_perror("Can't make persistent");
return -1;
}
/* and one tap in fd[4] */
fds[4] = open_tun("tapx0", IFF_TAP);
if (fds[4] < 0) {
- err("No tap");
+ pr_perror("No tap");
return -1;
}
if (dev_get_hwaddr(fds[4], addr) < 0) {
- err("No hwaddr for tap?");
+ pr_perror("No hwaddr for tap?");
return -1;
}
@@ -213,14 +213,14 @@ int main(int argc, char **argv)
} else {
ret = open_tun("tunx2", IFF_TUN);
if (ret < 0)
- err("Can't attach tun2");
+ pr_perror("Can't attach tun2");
else
ioctl(ret, TUNSETPERSIST, 0);
}
check_tun(fds[4], "tapx0", IFF_TAP);
if (dev_get_hwaddr(fds[4], a2) < 0) {
- err("No hwaddr for tap? (2)");
+ pr_perror("No hwaddr for tap? (2)");
any_fail = 1;
} else if (memcmp(addr, a2, sizeof(addr))) {
fail("Address mismatch on tap %x:%x -> %x:%x",
diff --git a/test/zdtm/live/static/unbound_sock.c b/test/zdtm/live/static/unbound_sock.c
index 3fa3d99..be8318c 100644
--- a/test/zdtm/live/static/unbound_sock.c
+++ b/test/zdtm/live/static/unbound_sock.c
@@ -25,7 +25,7 @@ int main(int argc, char ** argv)
sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock < 0) {
- err("can't create socket: %m");
+ pr_perror("can't create socket");
return 1;
}
diff --git a/test/zdtm/live/static/unhashed_proc.c b/test/zdtm/live/static/unhashed_proc.c
index 0ba3ae8..30b5e75 100644
--- a/test/zdtm/live/static/unhashed_proc.c
+++ b/test/zdtm/live/static/unhashed_proc.c
@@ -21,7 +21,7 @@ int main(int argc, char ** argv)
pid = fork();
if (pid < 0) {
- err("Fork failed %m");
+ pr_perror("Fork failed %m");
exit(1);
} else if (!pid) {
pause();
@@ -32,7 +32,7 @@ int main(int argc, char ** argv)
if (chdir(cwd1) < 0) {
kill(pid, SIGKILL);
- err("Chdir failed %m");
+ pr_perror("Chdir failed %m");
exit(1);
}
@@ -40,16 +40,16 @@ int main(int argc, char ** argv)
waitpid(pid, NULL, 0);
if (getcwd(cwd1, sizeof(cwd1))) {
- err("successful getcwd: %s", cwd1);
+ pr_perror("successful getcwd: %s", cwd1);
exit(1);
} else if (errno != ENOENT) {
- err("wrong errno");
+ pr_perror("wrong errno");
exit(1);
}
len = readlink("/proc/self/cwd", cwd1, sizeof(cwd1));
if (len < 0) {
- err("can't read cwd symlink %m");
+ pr_perror("can't read cwd symlink %m");
exit(1);
}
cwd1[len] = 0;
diff --git a/test/zdtm/live/static/unlink_fifo.c b/test/zdtm/live/static/unlink_fifo.c
index 2822ac9..765f5eb 100644
--- a/test/zdtm/live/static/unlink_fifo.c
+++ b/test/zdtm/live/static/unlink_fifo.c
@@ -22,18 +22,18 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, mode, 0)) {
- err("can't make fifo \"%s\"", filename);
+ pr_perror("can't make fifo \"%s\"", filename);
exit(1);
}
fd = open(filename, O_RDWR);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
return 1;
}
if (unlink(filename) < 0) {
- err("can't unlink %s: %m", filename);
+ pr_perror("can't unlink %s", filename);
return 1;
}
diff --git a/test/zdtm/live/static/unlink_fifo_wronly.c b/test/zdtm/live/static/unlink_fifo_wronly.c
index 2d5c446..5fb4c34 100644
--- a/test/zdtm/live/static/unlink_fifo_wronly.c
+++ b/test/zdtm/live/static/unlink_fifo_wronly.c
@@ -20,25 +20,25 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, mode, 0)) {
- err("can't make fifo \"%s\"", filename);
+ pr_perror("can't make fifo \"%s\"", filename);
exit(1);
}
fd = open(filename, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
- err("open(%s, O_RDONLY | O_NONBLOCK) Failed",
+ pr_perror("open(%s, O_RDONLY | O_NONBLOCK) Failed",
filename);
return 1;
}
fd1 = open(filename, O_WRONLY);
if (fd1 < 0) {
- err("open(%s, O_WRONLY) Failed", filename);
+ pr_perror("open(%s, O_WRONLY) Failed", filename);
return 1;
}
if (unlink(filename) < 0) {
- err("can't unlink %s: %m", filename);
+ pr_perror("can't unlink %s", filename);
return 1;
}
diff --git a/test/zdtm/live/static/unlink_fstat00.c b/test/zdtm/live/static/unlink_fstat00.c
index 0428b7f..4965dbc 100644
--- a/test/zdtm/live/static/unlink_fstat00.c
+++ b/test/zdtm/live/static/unlink_fstat00.c
@@ -28,29 +28,29 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
if (fstat(fd, &fst) < 0) {
- err("can't get file info %s before", filename);
+ pr_perror("can't get file info %s before", filename);
goto failed;
}
if (unlink(filename) < 0) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
goto failed;
}
/* Change file size */
if (fst.st_size != 0) {
- err("%s file size eq %d", fst.st_size);
+ pr_perror("%s file size eq %d", fst.st_size);
goto failed;
}
crc = ~0;
datagen(buf, sizeof(buf), &crc);
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
goto failed;
}
/* Change file mode */
@@ -60,7 +60,7 @@ int main(int argc, char ** argv)
mode = (fst.st_mode ^ S_IXOTH);
if (fchmod(fd, mode) < 0) {
- err("can't chmod %s", filename);
+ pr_perror("can't chmod %s", filename);
goto failed;
}
@@ -70,13 +70,13 @@ int main(int argc, char ** argv)
} else {
/* Change uid, gid */
if (fchown(fd, (uid = fst.st_uid + 1), (gid = fst.st_gid + 1)) < 0) {
- err("can't chown %s", filename);
+ pr_perror("can't chown %s", filename);
goto failed;
}
}
if (lseek(fd, 0, SEEK_SET) != 0) {
- err("can't reposition to 0: %m");
+ pr_perror("can't reposition to 0");
goto failed;
}
@@ -84,7 +84,7 @@ int main(int argc, char ** argv)
test_waitsig();
if (fstat(fd, &fst) < 0) {
- err("can't get %s file info after", filename);
+ pr_perror("can't get %s file info after", filename);
goto failed;
}
@@ -111,7 +111,7 @@ int main(int argc, char ** argv)
}
if (lseek(fd, 0, SEEK_SET) != 0) {
- err("can't reposition to 0: %m");
+ pr_perror("can't reposition to 0");
goto failed;
}
if (read(fd, buf, sizeof(buf)) != sizeof(buf)) {
diff --git a/test/zdtm/live/static/unlink_fstat01.c b/test/zdtm/live/static/unlink_fstat01.c
index 06c06b5..7e03a2a 100644
--- a/test/zdtm/live/static/unlink_fstat01.c
+++ b/test/zdtm/live/static/unlink_fstat01.c
@@ -24,28 +24,28 @@ int main(int argc, char ** argv)
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
if (fstat(fd, &fst) < 0) {
- err("can't get file info %s before", filename);
+ pr_perror("can't get file info %s before", filename);
goto failed;
}
if (fst.st_size != 0) {
- err("%s file size eq %d", fst.st_size);
+ pr_perror("%s file size eq %d", fst.st_size);
goto failed;
}
if (unlink(filename) < 0) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
goto failed;
}
memset(buf, '0', sizeof(buf));
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
goto failed;
}
@@ -53,7 +53,7 @@ int main(int argc, char ** argv)
test_waitsig();
if (fstat(fd, &fst) < 0) {
- err("can't get %s file info after", filename);
+ pr_perror("can't get %s file info after", filename);
goto failed;
}
diff --git a/test/zdtm/live/static/unlink_fstat02.c b/test/zdtm/live/static/unlink_fstat02.c
index ae791aa..dd18b8f 100644
--- a/test/zdtm/live/static/unlink_fstat02.c
+++ b/test/zdtm/live/static/unlink_fstat02.c
@@ -25,45 +25,45 @@ int main(int argc, char ** argv)
fd[0] = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd[0] < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
sprintf(link_name, "%s.link", filename);
if (link(filename, link_name)) {
- err("can't link files");
+ pr_perror("can't link files");
goto failed0;
}
fd[1] = open(link_name, O_RDONLY);
if (fd[1] < 0) {
- err("can't open %s", link_name);
+ pr_perror("can't open %s", link_name);
goto failed0;
}
if (fstat(fd[0], &fst) < 0) {
- err("can't get file info %s before", filename);
+ pr_perror("can't get file info %s before", filename);
goto failed;
}
if (fst.st_size != 0) {
- err("%s file size eq %d", fst.st_size);
+ pr_perror("%s file size eq %d", fst.st_size);
goto failed;
}
if (unlink(filename) < 0) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
goto failed;
}
if (unlink(link_name) < 0) {
- err("can't unlink %s", link_name);
+ pr_perror("can't unlink %s", link_name);
goto failed;
}
memset(buf, '0', sizeof(buf));
if (write(fd[0], buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
goto failed;
}
@@ -71,12 +71,12 @@ int main(int argc, char ** argv)
test_waitsig();
if (fstat(fd[0], &fst) < 0) {
- err("can't get %s file info after", filename);
+ pr_perror("can't get %s file info after", filename);
goto failed;
}
if (fstat(fd[1], &fst2) < 0) {
- err("can't get %s file2 info after", link_name);
+ pr_perror("can't get %s file2 info after", link_name);
goto failed;
}
diff --git a/test/zdtm/live/static/unlink_fstat03.c b/test/zdtm/live/static/unlink_fstat03.c
index 7a5ed2e..06268e3 100644
--- a/test/zdtm/live/static/unlink_fstat03.c
+++ b/test/zdtm/live/static/unlink_fstat03.c
@@ -28,34 +28,34 @@ int main(int argc, char ** argv)
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
sprintf(link_name, "%s.link", filename);
if (link(filename, link_name)) {
- err("can't link files");
+ pr_perror("can't link files");
goto failed0;
}
if (fstat(fd, &fst) < 0) {
- err("can't get file info %s before", filename);
+ pr_perror("can't get file info %s before", filename);
goto failed;
}
if (fst.st_size != 0) {
- err("%s file size eq %d", fst.st_size);
+ pr_perror("%s file size eq %d", fst.st_size);
goto failed;
}
if (unlink(filename) < 0) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
goto failed;
}
memset(buf, '0', sizeof(buf));
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
goto failed;
}
@@ -63,12 +63,12 @@ int main(int argc, char ** argv)
test_waitsig();
if (statfs(link_name, &fsst) < 0) {
- err("statfs(%s)", link_name);
+ pr_perror("statfs(%s)", link_name);
goto failed;
}
if (fstat(fd, &fst2) < 0) {
- err("can't get %s file info after", filename);
+ pr_perror("can't get %s file info after", filename);
goto failed;
}
diff --git a/test/zdtm/live/static/unlink_largefile.c b/test/zdtm/live/static/unlink_largefile.c
index 5f0e35a..b1f8079 100644
--- a/test/zdtm/live/static/unlink_largefile.c
+++ b/test/zdtm/live/static/unlink_largefile.c
@@ -23,12 +23,12 @@ int main(int argc, char ** argv)
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
if (lseek64(fd, offset, SEEK_SET) < 0) {
- err("can't lseek %s, offset= %x", filename,
+ pr_perror("can't lseek %s, offset= %x", filename,
offset);
goto failed;
}
@@ -36,12 +36,12 @@ int main(int argc, char ** argv)
count = sizeof(buf);
memset(buf, 0, count);
if (write(fd, buf, count) != count) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
goto failed;
}
if (unlink(filename) < 0) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
goto failed;
}
diff --git a/test/zdtm/live/static/unlink_mmap00.c b/test/zdtm/live/static/unlink_mmap00.c
index 80fd1c2..03509aa 100644
--- a/test/zdtm/live/static/unlink_mmap00.c
+++ b/test/zdtm/live/static/unlink_mmap00.c
@@ -21,12 +21,12 @@ TEST_OPTION(filename, string, "file name", 1);
static void touch_file_page(int fd, unsigned long off, char c)
{
if (lseek(fd, off, SEEK_SET) != off) {
- err("Lseek fail");
+ pr_perror("Lseek fail");
exit(1);
}
if (write(fd, &c, 1) != 1) {
- err("Write fail");
+ pr_perror("Write fail");
exit(1);
}
}
@@ -40,7 +40,7 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open file");
+ pr_perror("can't open file");
exit(1);
}
@@ -53,12 +53,12 @@ int main(int argc, char ** argv)
mem_a = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_FILE, fd, 0);
mem_b = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, PAGE_SIZE);
if (mem_a == MAP_FAILED || mem_b == MAP_FAILED) {
- err("can't map file");
+ pr_perror("can't map file");
exit(1);
}
if (unlink(filename) < 0) {
- err("can't unlink file");
+ pr_perror("can't unlink file");
exit(1);
}
diff --git a/test/zdtm/live/static/unlink_mmap01.c b/test/zdtm/live/static/unlink_mmap01.c
index c31df51..66c1bc3 100644
--- a/test/zdtm/live/static/unlink_mmap01.c
+++ b/test/zdtm/live/static/unlink_mmap01.c
@@ -24,12 +24,12 @@ static char linkname[4096];
static void touch_file_page(int fd, unsigned long off, char c)
{
if (lseek(fd, off, SEEK_SET) != off) {
- err("Lseek fail");
+ pr_perror("Lseek fail");
exit(1);
}
if (write(fd, &c, 1) != 1) {
- err("Write fail");
+ pr_perror("Write fail");
exit(1);
}
}
@@ -43,7 +43,7 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open file");
+ pr_perror("can't open file");
exit(1);
}
@@ -52,18 +52,18 @@ int main(int argc, char ** argv)
mem_a = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_FILE, fd, 0);
if (mem_a == MAP_FAILED) {
- err("can't map file");
+ pr_perror("can't map file");
exit(1);
}
sprintf(linkname, "%s.lnk", filename);
if (link(filename, linkname)) {
- err("can't link file");
+ pr_perror("can't link file");
exit(1);
}
if (unlink(filename) < 0) {
- err("can't unlink file");
+ pr_perror("can't unlink file");
exit(1);
}
@@ -71,18 +71,18 @@ int main(int argc, char ** argv)
fd = open(linkname, O_RDWR);
if (fd < 0) {
- err("can't open link");
+ pr_perror("can't open link");
exit(1);
}
mem_b = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_FILE, fd, 0);
if (mem_b == MAP_FAILED) {
- err("can't map link");
+ pr_perror("can't map link");
exit(1);
}
if (unlink(linkname) < 0) {
- err("can't unlink link");
+ pr_perror("can't unlink link");
exit(1);
}
diff --git a/test/zdtm/live/static/unlink_mmap02.c b/test/zdtm/live/static/unlink_mmap02.c
index 6853efd..85d6b38 100644
--- a/test/zdtm/live/static/unlink_mmap02.c
+++ b/test/zdtm/live/static/unlink_mmap02.c
@@ -21,12 +21,12 @@ TEST_OPTION(filename, string, "file name", 1);
static void touch_file_page(int fd, unsigned long off, char c)
{
if (lseek(fd, off, SEEK_SET) != off) {
- err("Lseek fail");
+ pr_perror("Lseek fail");
exit(1);
}
if (write(fd, &c, 1) != 1) {
- err("Write fail");
+ pr_perror("Write fail");
exit(1);
}
}
@@ -40,7 +40,7 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open file");
+ pr_perror("can't open file");
exit(1);
}
@@ -51,12 +51,12 @@ int main(int argc, char ** argv)
mem_a = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_FILE, fd, 0);
mem_b = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, PAGE_SIZE);
if (mem_a == MAP_FAILED || mem_b == MAP_FAILED) {
- err("can't map file");
+ pr_perror("can't map file");
exit(1);
}
if (unlink(filename) < 0) {
- err("can't unlink file");
+ pr_perror("can't unlink file");
exit(1);
}
diff --git a/test/zdtm/live/static/uptime_grow.c b/test/zdtm/live/static/uptime_grow.c
index 0a93d40..6d99509 100644
--- a/test/zdtm/live/static/uptime_grow.c
+++ b/test/zdtm/live/static/uptime_grow.c
@@ -21,7 +21,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (clock_gettime(CLOCK_MONOTONIC, &tm_old)) {
- err("clock_gettime failed");
+ pr_perror("clock_gettime failed");
exit(1);
}
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
while (test_go()) {
if (clock_gettime(CLOCK_MONOTONIC, &tm)) {
- err("clock_gettime failed");
+ pr_perror("clock_gettime failed");
exit(1);
}
if (!tv_ge(&tm, &tm_old)) {
diff --git a/test/zdtm/live/static/utsname.c b/test/zdtm/live/static/utsname.c
index 1037b8b..eb4518f 100644
--- a/test/zdtm/live/static/utsname.c
+++ b/test/zdtm/live/static/utsname.c
@@ -20,13 +20,13 @@ static int test_fn(int argc, char **argv)
fd = open("/proc/sys/kernel/hostname", O_WRONLY);
if (fd < 0) {
- err("Can't open hostname");
+ pr_perror("Can't open hostname");
return 1;
}
ret = write(fd, ZDTM_NODE, sizeof(ZDTM_NODE));
if (ret != sizeof(ZDTM_NODE)) {
- err("Can't write nodename");
+ pr_perror("Can't write nodename");
return 1;
}
@@ -34,13 +34,13 @@ static int test_fn(int argc, char **argv)
fd = open("/proc/sys/kernel/domainname", O_WRONLY);
if (fd < 0) {
- err("Can't open domainname");
+ pr_perror("Can't open domainname");
return -errno;
}
ret = write(fd, ZDTM_DOMAIN, sizeof(ZDTM_DOMAIN));
if (ret != sizeof(ZDTM_DOMAIN)) {
- err("Can't write domainname");
+ pr_perror("Can't write domainname");
return 1;
}
diff --git a/test/zdtm/live/static/vdso01.c b/test/zdtm/live/static/vdso01.c
index 9be9a60..57d947c 100644
--- a/test/zdtm/live/static/vdso01.c
+++ b/test/zdtm/live/static/vdso01.c
@@ -135,7 +135,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t)
* Make sure it's a file we support.
*/
if (memcmp(ehdr->e_ident, elf_ident, sizeof(elf_ident))) {
- err("Elf header magic mismatch");
+ pr_perror("Elf header magic mismatch");
return -EINVAL;
}
@@ -149,14 +149,14 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t)
switch (phdr->p_type) {
case PT_DYNAMIC:
if (dynamic) {
- err("Second PT_DYNAMIC header");
+ pr_perror("Second PT_DYNAMIC header");
return -EINVAL;
}
dynamic = phdr;
break;
case PT_LOAD:
if (load) {
- err("Second PT_LOAD header");
+ pr_perror("Second PT_LOAD header");
return -EINVAL;
}
load = phdr;
@@ -165,7 +165,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t)
}
if (!load || !dynamic) {
- err("One of obligated program headers is missed");
+ pr_perror("One of obligated program headers is missed");
return -EINVAL;
}
@@ -196,7 +196,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t)
}
if (!dyn_strtab || !dyn_symtab || !dyn_strsz || !dyn_syment || !dyn_hash) {
- err("Not all dynamic entries are present");
+ pr_perror("Not all dynamic entries are present");
return -EINVAL;
}
@@ -248,7 +248,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t)
return 0;
err_oob:
- err("Corrupted Elf data");
+ pr_perror("Corrupted Elf data");
return -EFAULT;
}
@@ -262,7 +262,7 @@ static int vdso_fill_self_symtable(struct vdso_symtable *s)
maps = fopen("/proc/self/maps", "r");
if (!maps) {
- err("Can't open self-vma");
+ pr_perror("Can't open self-vma");
return -1;
}
@@ -275,7 +275,7 @@ static int vdso_fill_self_symtable(struct vdso_symtable *s)
ret = sscanf(buf, "%lx-%lx", &start, &end);
if (ret != 2) {
ret = -1;
- err("Can't find vDSO bounds");
+ pr_perror("Can't find vDSO bounds");
goto err;
}
@@ -304,7 +304,7 @@ static int vdso_clock_gettime_handler(void *func)
ts1.tv_sec, ts2.tv_sec);
if (abs(ts1.tv_sec - ts2.tv_sec) > TIME_DELTA_SEC) {
- err("Delta is too big");
+ pr_perror("Delta is too big");
return -1;
}
@@ -335,7 +335,7 @@ static int vdso_gettimeofday_handler(void *func)
tv1.tv_sec, tv2.tv_sec);
if (abs(tv1.tv_sec - tv2.tv_sec) > TIME_DELTA_SEC) {
- err("Delta is too big");
+ pr_perror("Delta is too big");
return -1;
}
@@ -353,7 +353,7 @@ static int vdso_time_handler(void *func)
test_msg("time: %li vdso_time: %li\n", (long)t1, (long)t1);
if (abs(t1 - t2) > TIME_DELTA_SEC) {
- err("Delta is too big");
+ pr_perror("Delta is too big");
return -1;
}
@@ -377,7 +377,7 @@ int main(int argc, char *argv[])
test_init(argc, argv);
if (vdso_fill_self_symtable(&symtable)) {
- err("Faied to parse vdso");
+ pr_perror("Faied to parse vdso");
return -1;
}
@@ -390,7 +390,7 @@ int main(int argc, char *argv[])
func = handlers[i];
if (func((void *)(s->offset + symtable.vma_start))) {
- err("Handler error");
+ pr_perror("Handler error");
return -1;
}
}
diff --git a/test/zdtm/live/static/vt.c b/test/zdtm/live/static/vt.c
index 631a765..1726a6f 100644
--- a/test/zdtm/live/static/vt.c
+++ b/test/zdtm/live/static/vt.c
@@ -25,18 +25,18 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, makedev(4, 5))) {
- err("Can't create virtual terminal %s", filename);
+ pr_perror("Can't create virtual terminal %s", filename);
return 1;
}
fd = open(filename, O_RDONLY);
if (fd < 0) {
- err("Open virtual terminal %s failed", filename);
+ pr_perror("Open virtual terminal %s failed", filename);
return 1;
}
if (fstat(fd, &st1)) {
- err("Can't stat %s virtual terminal", filename);
+ pr_perror("Can't stat %s virtual terminal", filename);
return 1;
}
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
test_waitsig();
if (fstat(fd, &st2)) {
- err("Can't stat %s virtual terminal", filename);
+ pr_perror("Can't stat %s virtual terminal", filename);
return 1;
}
diff --git a/test/zdtm/live/static/wait00.c b/test/zdtm/live/static/wait00.c
index 984b920..f16505c 100644
--- a/test/zdtm/live/static/wait00.c
+++ b/test/zdtm/live/static/wait00.c
@@ -20,7 +20,7 @@ int main(int argc, char ** argv)
pid = fork();
if (pid < 0) {
- err("fork failed");
+ pr_perror("fork failed");
exit(1);
}
diff --git a/test/zdtm/live/static/write_read00.c b/test/zdtm/live/static/write_read00.c
index fa48c2b..1648e35 100644
--- a/test/zdtm/live/static/write_read00.c
+++ b/test/zdtm/live/static/write_read00.c
@@ -21,14 +21,14 @@ int main(int argc, char ** argv)
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
crc = ~0;
datagen(buf, sizeof(buf), &crc);
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
exit(1);
}
diff --git a/test/zdtm/live/static/write_read01.c b/test/zdtm/live/static/write_read01.c
index 4d96b66..0d41767 100644
--- a/test/zdtm/live/static/write_read01.c
+++ b/test/zdtm/live/static/write_read01.c
@@ -22,14 +22,14 @@ int main(int argc, char ** argv)
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
crc = ~0;
datagen(buf, sizeof(buf), &crc);
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
exit(1);
}
@@ -37,13 +37,13 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDONLY);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
len = sizeof(buf) / 2;
if (read(fd, buf, len) != len) {
- err("can't read %s", filename);
+ pr_perror("can't read %s", filename);
exit(1);
}
diff --git a/test/zdtm/live/static/write_read02.c b/test/zdtm/live/static/write_read02.c
index 0ac5580..0a80558 100644
--- a/test/zdtm/live/static/write_read02.c
+++ b/test/zdtm/live/static/write_read02.c
@@ -23,7 +23,7 @@ int main(int argc, char ** argv)
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
@@ -35,14 +35,14 @@ int main(int argc, char ** argv)
sprintf(str, "standard_%s", filename);
fd1 = open(str, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (write(fd1, buf, full_len) != full_len) {
- err("can't write %s", str);
+ pr_perror("can't write %s", str);
exit(1);
}
close(fd1);
len = sizeof(buf) / 2;
if (write(fd, buf, len) != len) {
- err("can't write %s", filename);
+ pr_perror("can't write %s", filename);
exit(1);
}
diff --git a/test/zdtm/live/static/write_read10.c b/test/zdtm/live/static/write_read10.c
index 88a4256..363384a 100644
--- a/test/zdtm/live/static/write_read10.c
+++ b/test/zdtm/live/static/write_read10.c
@@ -27,24 +27,24 @@ int main(int argc, char ** argv)
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
child_fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- err("can't open %s", filename);
+ pr_perror("can't open %s", filename);
exit(1);
}
if (unlink(filename)) {
- err("can't unlink %s", filename);
+ pr_perror("can't unlink %s", filename);
exit(1);
}
pid = fork();
if (pid < 0) {
- err("can't fork");
+ pr_perror("can't fork");
exit(1);
}
diff --git a/test/zdtm/live/static/xids00.c b/test/zdtm/live/static/xids00.c
index d9eece6..c3ddfb4 100644
--- a/test/zdtm/live/static/xids00.c
+++ b/test/zdtm/live/static/xids00.c
@@ -84,10 +84,10 @@ int main(int argc, char **argv)
kill(pid, SIGTERM);
if (waitpid(pid, &stat, 0) < 0) {
- err("Unable to wait P2 %d", pid);
+ pr_perror("Unable to wait P2 %d", pid);
exit(3);
} else if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
- err("P2 stat %d/%d/%d/%d", WIFEXITED(stat), WEXITSTATUS(stat),
+ pr_perror("P2 stat %d/%d/%d/%d", WIFEXITED(stat), WEXITSTATUS(stat),
WIFSIGNALED(stat), WTERMSIG(stat));
exit(3);
}
@@ -110,10 +110,10 @@ int main(int argc, char **argv)
for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) {
if (waitpid(pids[i], &stat, 0) < 0) {
- err("Unable to wait %d", pids[i]);
+ pr_perror("Unable to wait %d", pids[i]);
fail = 1;
} else if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
- err("P%d stat %d/%d/%d/%d", i, WIFEXITED(stat), WEXITSTATUS(stat),
+ pr_perror("P%d stat %d/%d/%d/%d", i, WIFEXITED(stat), WEXITSTATUS(stat),
WIFSIGNALED(stat), WTERMSIG(stat));
fail = 1;
}
diff --git a/test/zdtm/live/static/zombie00.c b/test/zdtm/live/static/zombie00.c
index eb5a9ef..9a35b92 100644
--- a/test/zdtm/live/static/zombie00.c
+++ b/test/zdtm/live/static/zombie00.c
@@ -41,7 +41,7 @@ int main(int argc, char ** argv)
for (i = 0; i < NR_ZOMBIES; i++) {
zombie[i].pid = fork();
if (zombie[i].pid < 0) {
- err("Fork failed %m");
+ pr_perror("Fork failed %m");
exit(1);
}
@@ -68,7 +68,7 @@ int main(int argc, char ** argv)
for (i = 0; i < NR_ZOMBIES; i++) {
siginfo_t siginfo;
if (waitid(P_PID, zombie[i].pid, &siginfo, WNOWAIT | WEXITED)) {
- err("Unable to wait %d", zombie[i].pid);
+ pr_perror("Unable to wait %d", zombie[i].pid);
exit(1);
}
}
diff --git a/test/zdtm/live/streaming/fifo_dyn.c b/test/zdtm/live/streaming/fifo_dyn.c
index 9c77d8c..62ebce4 100644
--- a/test/zdtm/live/streaming/fifo_dyn.c
+++ b/test/zdtm/live/streaming/fifo_dyn.c
@@ -37,18 +37,18 @@ int main(int argc, char **argv)
for (i = 0; i < PROCS_DEF; i++) {
file_path = path[i];
if (snprintf(file_path, BUF_SIZE, "%s-%02d", filename, i) >= BUF_SIZE) {
- err("filename %s is too long", filename);
+ pr_perror("filename %s is too long", filename);
exit(1);
}
if (mkfifo(file_path, mode)) {
- err("can't make fifo \"%s\"", file_path);
+ pr_perror("can't make fifo \"%s\"", file_path);
exit(1);
}
}
pid = test_fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
kill(0, SIGKILL);
exit(1);
}
@@ -56,14 +56,14 @@ int main(int argc, char **argv)
file_path = path[0];
readfd = open(file_path, O_RDONLY);
if (readfd < 0) {
- err("open(%s, O_RDONLY) Failed", file_path);
+ pr_perror("open(%s, O_RDONLY) Failed", file_path);
ret = errno;
return ret;
}
file_path = path[1];
writefd = open(file_path, O_WRONLY);
if (writefd < 0) {
- err("open(%s, O_WRONLY) Failed", file_path);
+ pr_perror("open(%s, O_WRONLY) Failed", file_path);
ret = errno;
return ret;
}
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
file_path = path[0];
writefd = open(file_path, O_WRONLY);
if (writefd < 0) {
- err("open(%s, O_WRONLY) Failed", file_path);
+ pr_perror("open(%s, O_WRONLY) Failed", file_path);
kill(pid, SIGKILL);
return 1;
}
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
file_path = path[1];
readfd = open(file_path, O_RDONLY);
if (readfd < 0) {
- err("open(%s, O_RDONLY) Failed", file_path);
+ pr_perror("open(%s, O_RDONLY) Failed", file_path);
kill(pid, SIGKILL);
return 1;
}
diff --git a/test/zdtm/live/streaming/fifo_loop.c b/test/zdtm/live/streaming/fifo_loop.c
index 30d401f..abba802 100644
--- a/test/zdtm/live/streaming/fifo_loop.c
+++ b/test/zdtm/live/streaming/fifo_loop.c
@@ -45,24 +45,24 @@ int main(int argc, char **argv)
for (i = 0; i < PROCS_DEF; i++) {
file_path = path[i];
if (snprintf(file_path, BUF_SIZE, "%s-%02d", filename, i) >= BUF_SIZE) {
- err("filename %s is too long\n", filename);
+ pr_perror("filename %s is too long\n", filename);
exit(1);
}
if (mkfifo(file_path, mode)) {
- err("can't make fifo \"%s\": %m\n", file_path);
+ pr_perror("can't make fifo \"%s\"\n", file_path);
exit(1);
}
}
if (signal(SIGCHLD, inc_num_exited) == SIG_ERR) {
- err("can't set SIGCHLD handler: %m\n");
+ pr_perror("can't set SIGCHLD handler\n");
exit(1);
}
for (i = 1; i < num_procs; i++) { /* i = 0 - parent */
pid = test_fork();
if (pid < 0) {
- err("Can't fork: %m\n");
+ pr_perror("Can't fork\n");
kill(0, SIGKILL);
exit(1);
}
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
file_path = path[i - 1];
readfd = open(file_path, O_RDONLY);
if (readfd < 0) {
- err("open(%s, O_RDONLY) Failed: %m\n",
+ pr_perror("open(%s, O_RDONLY) Failed\n",
file_path);
ret = errno;
return ret;
@@ -78,7 +78,7 @@ int main(int argc, char **argv)
file_path = path[i];
writefd = open(file_path, O_WRONLY);
if (writefd < 0) {
- err("open(%s, O_WRONLY) Failed: %m\n",
+ pr_perror("open(%s, O_WRONLY) Failed\n",
file_path);
ret = errno;
return ret;
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
file_path = path[0];
writefd = open(file_path, O_WRONLY);
if (writefd < 0) {
- err("open(%s, O_WRONLY) Failed: %m\n", file_path);
+ pr_perror("open(%s, O_WRONLY) Failed\n", file_path);
kill(0, SIGKILL);
exit(1);
}
@@ -107,13 +107,13 @@ int main(int argc, char **argv)
file_path = path[i - 1];
readfd = open(file_path, O_RDONLY);
if (readfd < 0) {
- err("open(%s, O_RDONLY) Failed: %m\n", file_path);
+ pr_perror("open(%s, O_RDONLY) Failed\n", file_path);
kill(0, SIGKILL);
exit(1);
}
if (num_exited) {
- err("Some children died unexpectedly\n");
+ pr_perror("Some children died unexpectedly\n");
kill(0, SIGKILL);
exit(1);
}
diff --git a/test/zdtm/live/streaming/file_aio.c b/test/zdtm/live/streaming/file_aio.c
index e4f6cd4..3743776 100644
--- a/test/zdtm/live/streaming/file_aio.c
+++ b/test/zdtm/live/streaming/file_aio.c
@@ -27,14 +27,14 @@ int main(int argc, char **argv)
fd = mkstemp(tmpfname);
if (fd == -1) {
- err("Error at open(): %s", strerror(errno));
+ pr_perror("Error at open(): %s", strerror(errno));
exit(1);
}
unlink(tmpfname);
if (write(fd, buf, BUF_SIZE) != BUF_SIZE) {
- err("Error at write(): %s",
+ pr_perror("Error at write(): %s",
strerror(errno));
exit(1);
}
@@ -52,12 +52,12 @@ int main(int argc, char **argv)
if (ret < 0) {
if ((errno == EINTR) && (!test_go()))
break;
- err("aio_read failed %m");
+ pr_perror("aio_read failed %m");
return 1;
}
if (ret < 0) {
- err("aio_read failed %s\n", strerror(errno));
+ pr_perror("aio_read failed %s\n", strerror(errno));
exit(1);
}
/* Wait for request completion */
@@ -68,7 +68,7 @@ again:
if ((errno == EINTR) && (! test_go()))
break;
if (errno != EINTR) {
- err("aio_suspend failed %m");
+ pr_perror("aio_suspend failed %m");
return 1;
}
}
@@ -81,7 +81,7 @@ again:
goto again;
}
if (ret != 0) {
- err("Error at aio_error() %s", strerror(ret));
+ pr_perror("Error at aio_error() %s", strerror(ret));
return 1;
}
@@ -89,11 +89,11 @@ again:
if (ret < 0) {
if ((errno == EINTR) && (!test_go()))
break;
- err("aio_return failed %m");
+ pr_perror("aio_return failed %m");
return 1;
}
if (ret != BUF_SIZE) {
- err("Error at aio_return()\n");
+ pr_perror("Error at aio_return()\n");
exit(1);
}
}
diff --git a/test/zdtm/live/streaming/netlink00.c b/test/zdtm/live/streaming/netlink00.c
index d27d430..479d3b5 100644
--- a/test/zdtm/live/streaming/netlink00.c
+++ b/test/zdtm/live/streaming/netlink00.c
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (fd<0){
- err("socket: %m ");
+ pr_perror("socket ");
goto out;
}
// setup local address & bind using
@@ -83,7 +83,7 @@ int main(int argc, char *argv[])
la.nl_family = AF_NETLINK;
la.nl_pid = getpid();
if (bind(fd, (struct sockaddr*) &la, sizeof(la))){
- err("bind failed: %m ");
+ pr_perror("bind failed ");
goto out;
}
//Preperation:
@@ -140,7 +140,7 @@ int send_request()
// send the RTNETLINK message to kernel
rtn = sendmsg(fd, &msg, 0);
if (rtn<0){
- err("sendmsg failed: %m");
+ pr_perror("sendmsg failed");
return -1;
}
return 0;
@@ -158,12 +158,12 @@ int recv_reply()
while(1) {
rtn = recv(fd, p, sizeof(buf) - nll, 0);
if (rtn < 0) {
- err("recv failed: %m");
+ pr_perror("recv failed");
return -1;
}
if (rtn == 0) {
- err("EOF on netlink\n");
+ pr_perror("EOF on netlink\n");
return -1;
}
diff --git a/test/zdtm/live/streaming/pipe_loop00.c b/test/zdtm/live/streaming/pipe_loop00.c
index e078787..d42b928 100644
--- a/test/zdtm/live/streaming/pipe_loop00.c
+++ b/test/zdtm/live/streaming/pipe_loop00.c
@@ -38,25 +38,25 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (num_procs > PROCS_MAX) {
- err("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
+ pr_perror("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
exit(1);
}
for (i = 0; i < num_procs; i++)
if (pipe(pipes + i * 2)) {
- err("Can't create pipes: %m\n");
+ pr_perror("Can't create pipes\n");
exit(1);
}
if (signal(SIGCHLD, inc_num_exited) == SIG_ERR) {
- err("can't set SIGCHLD handler: %m\n");
+ pr_perror("can't set SIGCHLD handler\n");
exit(1);
}
for (i = 1; i < num_procs; i++) { /* i = 0 - parent */
pid = test_fork();
if (pid < 0) {
- err("Can't fork: %m\n");
+ pr_perror("Can't fork\n");
kill(0, SIGKILL);
exit(1);
}
@@ -91,12 +91,12 @@ int main(int argc, char **argv)
/* don't block on writing, _do_ block on reading */
if (set_nonblock(out,1) < 0) {
- err("setting O_NONBLOCK failed: %m");
+ pr_perror("setting O_NONBLOCK failed");
exit(1);
}
if (num_exited) {
- err("Some children died unexpectedly\n");
+ pr_perror("Some children died unexpectedly\n");
kill(0, SIGKILL);
exit(1);
}
diff --git a/test/zdtm/live/streaming/pipe_shared00.c b/test/zdtm/live/streaming/pipe_shared00.c
index 5989e87..a28b1e5 100644
--- a/test/zdtm/live/streaming/pipe_shared00.c
+++ b/test/zdtm/live/streaming/pipe_shared00.c
@@ -39,24 +39,24 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (num_procs > PROCS_MAX) {
- err("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
+ pr_perror("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
exit(1);
}
if (pipe(pipes)) {
- err("Can't create pipes: %m\n");
+ pr_perror("Can't create pipes\n");
exit(1);
}
if (signal(SIGCHLD, inc_num_exited) == SIG_ERR) {
- err("can't set SIGCHLD handler: %m\n");
+ pr_perror("can't set SIGCHLD handler\n");
exit(1);
}
for (i = 1; i < num_procs; i++) { /* i = 0 - parent */
pid = test_fork();
if (pid < 0) {
- err("Can't fork: %m\n");
+ pr_perror("Can't fork\n");
kill(0, SIGKILL);
exit(1);
}
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
close(pipes[0]);
if (num_exited) {
- err("Some children died unexpectedly\n");
+ pr_perror("Some children died unexpectedly\n");
kill(0, SIGKILL);
exit(1);
}
diff --git a/test/zdtm/live/streaming/socket_loop00.c b/test/zdtm/live/streaming/socket_loop00.c
index 076b14c..e20e234 100644
--- a/test/zdtm/live/streaming/socket_loop00.c
+++ b/test/zdtm/live/streaming/socket_loop00.c
@@ -39,25 +39,25 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (num_procs > PROCS_MAX) {
- err("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
+ pr_perror("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
exit(1);
}
for (i = 0; i < num_procs; i++)
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, socks + i * 2)) {
- err("Can't create socks: %m\n");
+ pr_perror("Can't create socks\n");
exit(1);
}
if (signal(SIGCHLD, inc_num_exited) == SIG_ERR) {
- err("can't set SIGCHLD handler: %m\n");
+ pr_perror("can't set SIGCHLD handler\n");
exit(1);
}
for (i = 1; i < num_procs; i++) { /* i = 0 - parent */
pid = test_fork();
if (pid < 0) {
- err("Can't fork: %m\n");
+ pr_perror("Can't fork\n");
kill(0, SIGKILL);
exit(1);
}
@@ -93,12 +93,12 @@ int main(int argc, char **argv)
/* don't block on writing, _do_ block on reading */
if (set_nonblock(out,1) < 0) {
- err("setting O_NONBLOCK failed: %m");
+ pr_perror("setting O_NONBLOCK failed");
exit(1);
}
if (num_exited) {
- err("Some children died unexpectedly\n");
+ pr_perror("Some children died unexpectedly\n");
kill(0, SIGKILL);
exit(1);
}
diff --git a/test/zdtm/live/streaming/unix_sock.c b/test/zdtm/live/streaming/unix_sock.c
index d8bc1be..798da77 100644
--- a/test/zdtm/live/streaming/unix_sock.c
+++ b/test/zdtm/live/streaming/unix_sock.c
@@ -44,28 +44,28 @@ static int setup_srv_sock(void)
int sock;
if (fill_sock_name(&name, filename) < 0) {
- err("filename \"%s\" is too long", filename);
+ pr_perror("filename \"%s\" is too long", filename);
return -1;
}
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
- err("can't create socket: %m");
+ pr_perror("can't create socket");
return -1;
}
if (bind(sock, (struct sockaddr *) &name, SUN_LEN(&name)) < 0) {
- err("can't bind to socket \"%s\": %m", filename);
+ pr_perror("can't bind to socket \"%s\"", filename);
goto err;
}
if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
- err("can't make socket \"%s\" non-blocking: %m", filename);
+ pr_perror("can't make socket \"%s\" non-blocking", filename);
goto err;
}
if (listen(sock, 1) < 0) {
- err("can't listen on a socket \"%s\": %m\n", filename);
+ pr_perror("can't listen on a socket \"%s\"\n", filename);
goto err;
}
@@ -90,16 +90,16 @@ static int accept_one_conn(int sock)
case 1:
break;
case 0:
- err("timeout accepting a connection");
+ pr_perror("timeout accepting a connection");
return -1;
default:
- err("error while waiting for a connection: %m");
+ pr_perror("error while waiting for a connection");
return -1;
}
acc_sock = accept(sock, NULL, NULL);
if (acc_sock < 0)
- err("error accepting a connection: %m");
+ pr_perror("error accepting a connection");
return acc_sock;
}
@@ -111,20 +111,20 @@ static int setup_clnt_sock(void)
if (fill_sock_name(&name, filename) < 0) {
ret = -errno;
- err("filename \"%s\" is too long", filename);
+ pr_perror("filename \"%s\" is too long", filename);
return ret;
}
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
ret = -errno;
- err("can't create socket: %m");
+ pr_perror("can't create socket");
return ret;
}
if (connect(sock, (struct sockaddr *) &name, SUN_LEN(&name)) < 0) {
ret = -errno;
- err("can't connect: %m");
+ pr_perror("can't connect");
goto err;
}
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (num_procs > PROCS_MAX) {
- err("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
+ pr_perror("%d processes is too many: max = %d\n", num_procs, PROCS_MAX);
exit(1);
}
@@ -194,7 +194,7 @@ int main(int argc, char **argv)
for (nproc = 0; nproc < num_procs; nproc++) {
child_desc[nproc].pid = test_fork();
if (child_desc[nproc].pid < 0) {
- err("can't fork: %m");
+ pr_perror("can't fork");
goto cleanup;
}
diff --git a/test/zdtm/live/transition/epoll.c b/test/zdtm/live/transition/epoll.c
index 91db02f..5fd0628 100644
--- a/test/zdtm/live/transition/epoll.c
+++ b/test/zdtm/live/transition/epoll.c
@@ -106,40 +106,40 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (scale > MAX_SCALE) {
- err("Too many children specified\n");
+ pr_perror("Too many children specified\n");
exit(1);
}
if (signal(SIGUSR2, do_stop) == SIG_ERR) {
- err("Can't setup handler\n");
+ pr_perror("Can't setup handler\n");
exit(1);
}
if ((efd = epoll_create(scale)) < 0) {
- err("Can't create epoll: %m\n");
+ pr_perror("Can't create epoll\n");
exit(1);
}
for (i = 0; i < scale; i++) {
if (pipe(fds[i]) < 0) {
- err("Can't create pipe[%d]: %m\n", i);
+ pr_perror("Can't create pipe[%d]\n", i);
killall();
exit(1);
}
if (fcntl(fds[i][0], F_SETFL, O_NONBLOCK) < 0) {
- err("Can't set O_NONBLOCK flag on fd[%d]: %m\n", i);
+ pr_perror("Can't set O_NONBLOCK flag on fd[%d]\n", i);
killall();
exit(1);
}
event.data.fd = fds[i][0];
if (epoll_ctl(efd, EPOLL_CTL_ADD, fds[i][0], &event) < 0) {
- err("Can't add fd[%d]: %m\n", i);
+ pr_perror("Can't add fd[%d]\n", i);
killall();
exit(1);
}
if ((rv = test_fork()) < 0) {
- err("Can't fork[%d]: %m\n", i);
+ pr_perror("Can't fork[%d]\n", i);
killall();
exit(1);
}
@@ -150,7 +150,7 @@ int main(int argc, char **argv)
}
if ((events = (struct epoll_event*) malloc (sizeof(struct epoll_event)*scale)) == NULL) {
- err("Can't allocate memory: %m\n");
+ pr_perror("Can't allocate memory\n");
killall();
exit(1);
}
@@ -159,14 +159,14 @@ int main(int argc, char **argv)
while (test_go()) {
if ((rv = epoll_wait(efd, events, scale, rand() % 999)) < 0 && errno != EINTR) {
- err("epoll_wait error: %m\n");
+ pr_perror("epoll_wait error\n");
killall();
exit(1);
}
for (i = 0; i < rv; i++) {
while (read(events[i].data.fd, buf, buf_size) > 0);
if (errno != EAGAIN && errno != 0 && errno) {
- err("read error: %m\n");
+ pr_perror("read error\n");
killall();
exit(1);
}
diff --git a/test/zdtm/live/transition/file_read.c b/test/zdtm/live/transition/file_read.c
index bed8935..f7e6757 100644
--- a/test/zdtm/live/transition/file_read.c
+++ b/test/zdtm/live/transition/file_read.c
@@ -165,7 +165,7 @@ static void chew_some_file(int num)
sprintf(str, "standard_%s.%d", filename, num);
fd1 = open(str, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (write(fd1, buf, FILE_SIZE) != FILE_SIZE)
- err("can't write %s: %m\n", str);
+ pr_perror("can't write %s\n", str);
close(fd1);
goto out_exit;
}
@@ -187,19 +187,19 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (scale > MAX_SCALE) {
- err("Too many children specified\n");
+ pr_perror("Too many children specified\n");
exit(-1);
}
if (signal(SIGUSR2, do_stop) == SIG_ERR) {
- err("Can't setup handler\n");
+ pr_perror("Can't setup handler\n");
exit(-1);
}
for (i = 0; i < scale; i++) {
rv = test_fork();
if (rv == -1) {
- err("Can't fork\n");
+ pr_perror("Can't fork\n");
killall();
exit(-1);
}
diff --git a/test/zdtm/live/transition/fork.c b/test/zdtm/live/transition/fork.c
index b9fc567..4940bc5 100644
--- a/test/zdtm/live/transition/fork.c
+++ b/test/zdtm/live/transition/fork.c
@@ -25,12 +25,12 @@ int main(int argc, char **argv)
test_init(argc, argv);
if (pipe(p)) {
- err("pipe");
+ pr_perror("pipe");
return -1;
}
if (write(p[1], children, sizeof(children)) != sizeof(children)) {
- err("write");
+ pr_perror("write");
return -1;
}
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
ret = read(p[0], &children, sizeof(children));
if (ret <= 0) {
- err("read");
+ pr_perror("read");
return 1;
}
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
usleep(10000);
#endif
if (write(p[1], &c, 1) != 1) {
- err("write");
+ pr_perror("write");
return 1;
}
exit(0);
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
if (wpid < 0) {
if (errno == ECHILD)
break;
- err("waitpid");
+ pr_perror("waitpid");
return -1;
}
if (wpid == 0)
diff --git a/test/zdtm/live/transition/ipc.c b/test/zdtm/live/transition/ipc.c
index 5910f13..c8d7aac 100644
--- a/test/zdtm/live/transition/ipc.c
+++ b/test/zdtm/live/transition/ipc.c
@@ -91,32 +91,32 @@ static int test_fn(int argc, char **argv)
key = ftok(argv[0], 822155650);
if (key == -1) {
- err("Can't make key");
+ pr_perror("Can't make key");
goto out;
}
sem = semget(key, 1, 0777 | IPC_CREAT | IPC_EXCL);
if (sem == -1) {
- err("Can't get sem");
+ pr_perror("Can't get sem");
goto out;
}
if (semctl(sem, 0, SETVAL, 1) == -1) {
- err("Can't init sem");
+ pr_perror("Can't init sem");
fail_count++;
goto out_sem;
}
shm = shmget(key, shmem_size, 0777 | IPC_CREAT | IPC_EXCL);
if (shm == -1) {
- err("Can't get shm");
+ pr_perror("Can't get shm");
fail_count++;
goto out_sem;
}
mem = shmat(shm, NULL, 0);
if (mem == (void *)-1) {
- err("Can't attach shm");
+ pr_perror("Can't attach shm");
fail_count++;
goto out_shm;
}
@@ -125,14 +125,14 @@ static int test_fn(int argc, char **argv)
pid1 = test_fork();
if (pid1 == -1) {
- err("Can't fork 1st time");
+ pr_perror("Can't fork 1st time");
goto out_shdt;
} else if (pid1 == 0)
exit(child(key));
pid2 = test_fork();
if (pid2 == -1) {
- err("Can't fork 2nd time");
+ pr_perror("Can't fork 2nd time");
fail_count++;
goto out_child;
} else if (pid2 == 0)
@@ -172,20 +172,20 @@ static int test_fn(int argc, char **argv)
waitpid(pid2, &ret, 0);
if (!WIFEXITED(ret)) {
fail_count++;
- err("Child 2 was killed");
+ pr_perror("Child 2 was killed");
} else if (WEXITSTATUS(ret)) {
fail_count++;
- err("Child 2 couldn't inititalise");
+ pr_perror("Child 2 couldn't inititalise");
}
out_child:
kill(pid1, SIGTERM);
waitpid(pid1, &ret, 0);
if (!WIFEXITED(ret)) {
fail_count++;
- err("Child 1 was killed");
+ pr_perror("Child 1 was killed");
} else if (WEXITSTATUS(ret)) {
fail_count++;
- err("Child 1 couldn't inititalise");
+ pr_perror("Child 1 couldn't inititalise");
}
out_shdt:
shmdt(mem);
diff --git a/test/zdtm/live/transition/maps007.c b/test/zdtm/live/transition/maps007.c
index e3cfb76..96e401e 100644
--- a/test/zdtm/live/transition/maps007.c
+++ b/test/zdtm/live/transition/maps007.c
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
child = fork();
if (child < 0) {
- err("fork");
+ pr_perror("fork");
return 1;
}
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
ret = mmap(p, size, prot, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
if (ret == MAP_FAILED) {
- err("%p-%p", p, p + size);
+ pr_perror("%p-%p", p, p + size);
goto err;
}
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
if (child == 0) {
if (!test_go())
- err("unexpected state");
+ pr_perror("unexpected state");
futex_set_and_wake(&shm->stop, 2);
test_waitsig();
return 0;
@@ -148,14 +148,14 @@ int main(int argc, char **argv)
lret = sys_process_vm_readv(getpid(), p, lbuf, PAGE_SIZE);
rret = sys_process_vm_readv(child, p, rbuf, PAGE_SIZE);
if (rret != lret) {
- err("%p %d %d", p, lret, rret);
+ pr_perror("%p %d %d", p, lret, rret);
goto err;
}
if (lret < 0)
continue;
readable++;
if (memcmp(rbuf, lbuf, PAGE_SIZE)) {
- err("%p", p);
+ pr_perror("%p", p);
goto err;
}
}
@@ -163,7 +163,7 @@ int main(int argc, char **argv)
kill(child, SIGTERM);
wait(&status);
if (status != 0) {
- err("Non-zero exit code: %d", status);
+ pr_perror("Non-zero exit code: %d", status);
goto err;
}
pass();
diff --git a/test/zdtm/live/transition/ptrace.c b/test/zdtm/live/transition/ptrace.c
index 2c04997..dc6eca2 100644
--- a/test/zdtm/live/transition/ptrace.c
+++ b/test/zdtm/live/transition/ptrace.c
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANON, 0, 0);
if (pids == MAP_FAILED) {
- err("Can't map");
+ pr_perror("Can't map");
exit(1);
}
@@ -50,14 +50,14 @@ int main(int argc, char **argv)
pid = fork();
if (pid < 0) {
- err("Can't fork");
+ pr_perror("Can't fork");
goto out;
} else if (pid == 0) {
pthread_t pt[nr_threads];
for (i = 0; i < nr_threads - 1; i++) {
if (pthread_create(&pt[i], NULL, thread, pids + i)) {
- err("Can't make thread");
+ pr_perror("Can't make thread");
goto out_th;
}
}
@@ -74,7 +74,7 @@ out_th:
while (pids[i] == 0)
sched_yield();
if (ptrace(PTRACE_ATTACH, pids[i], (char *)1, NULL) == -1) {
- err("Can't attach");
+ pr_perror("Can't attach");
goto out_pt;
}
}
@@ -89,7 +89,7 @@ out_th:
break;
stopped = wait4(-1, &status, __WALL, NULL);
if (stopped == -1) {
- err("Can't wait");
+ pr_perror("Can't wait");
break;
}
--
2.4.3
More information about the CRIU
mailing list