diff options
author | Andrei Vagin <avagin@virtuozzo.com> | 2017-09-30 01:41:44 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@virtuozzo.com> | 2017-10-17 08:40:44 +0300 |
commit | 7678f440cac6ea74040bff82b8d7964b3640c8e6 (patch) | |
tree | 6daeda2e0421827167c801b7381d8312985ff226 | |
parent | 0a303160774f9e807dee4194cf591f153a2382cc (diff) |
test/zdtm: a few fixes to compile tests on Alpine
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
-rw-r--r-- | test/zdtm/static/file_locks01.c | 8 | ||||
-rw-r--r-- | test/zdtm/static/ghost_holes00.c | 5 | ||||
-rw-r--r-- | test/zdtm/static/ipc_namespace.c | 6 | ||||
-rw-r--r-- | test/zdtm/static/netns-dev.c | 1 | ||||
-rw-r--r-- | test/zdtm/static/poll.c | 2 | ||||
-rw-r--r-- | test/zdtm/static/pthread01.c | 2 | ||||
-rw-r--r-- | test/zdtm/static/sigpending.c | 26 |
7 files changed, 41 insertions, 9 deletions
diff --git a/test/zdtm/static/file_locks01.c b/test/zdtm/static/file_locks01.c index aadc5e422..399a42835 100644 --- a/test/zdtm/static/file_locks01.c +++ b/test/zdtm/static/file_locks01.c @@ -10,6 +10,14 @@ #include "zdtmtst.h" #include "fs.h" +#ifndef LOCK_MAND +#define LOCK_MAND 32 +#endif + +#ifndef LOCK_READ +#define LOCK_READ 64 +#endif + const char *test_doc = "Check that flock locks are restored"; const char *test_author = "Qiang Huang <h.huangqiang@huawei.com>"; diff --git a/test/zdtm/static/ghost_holes00.c b/test/zdtm/static/ghost_holes00.c index 11561d9fe..214a39141 100644 --- a/test/zdtm/static/ghost_holes00.c +++ b/test/zdtm/static/ghost_holes00.c @@ -19,6 +19,11 @@ TEST_OPTION(filename, string, "file name", 1); #define BUFSIZE 4096 static unsigned char buf4k[BUFSIZE]; +#ifndef SEEK_DATA +#define SEEK_DATA 3 +#define SEEK_HOLE 4 +#endif + #ifdef HEAD_HOLE #define HH 1 #else diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c index 84331d370..a7f0fd103 100644 --- a/test/zdtm/static/ipc_namespace.c +++ b/test/zdtm/static/ipc_namespace.c @@ -12,9 +12,9 @@ #define CLONE_NEWIPC 0x08000000 -extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; -extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; -extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; +extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf); +extern int semctl (int __semid, int __semnum, int __cmd, ...); +extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf); struct ipc_ids { int in_use; /* TODO: Check for 0 */ diff --git a/test/zdtm/static/netns-dev.c b/test/zdtm/static/netns-dev.c index 4efbeba7e..8763773cc 100644 --- a/test/zdtm/static/netns-dev.c +++ b/test/zdtm/static/netns-dev.c @@ -1,6 +1,7 @@ #include <unistd.h> #include <stdlib.h> #include <dirent.h> +#include <linux/limits.h> #include "zdtmtst.h" diff --git a/test/zdtm/static/poll.c b/test/zdtm/static/poll.c index 33bc0bd4a..53d801a0b 100644 --- a/test/zdtm/static/poll.c +++ b/test/zdtm/static/poll.c @@ -9,7 +9,7 @@ #include <time.h> #include <sys/stat.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/time.h> #include <sys/types.h> #include <sys/wait.h> diff --git a/test/zdtm/static/pthread01.c b/test/zdtm/static/pthread01.c index 2520fcfee..1e84463ee 100644 --- a/test/zdtm/static/pthread01.c +++ b/test/zdtm/static/pthread01.c @@ -33,7 +33,7 @@ static char *decode_signal(const sigset_t *s, char *buf) #define COLLECT(sig) \ do { \ - if ((long)s->__val[0] & (long)sigmask(sig)) \ + if (sigismember(s, sig)) \ strcat(buf, #sig " "); \ } while (0) diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c index 4adcfa626..b6d224c75 100644 --- a/test/zdtm/static/sigpending.c +++ b/test/zdtm/static/sigpending.c @@ -28,6 +28,24 @@ static int thread_nr; # define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif +/* cr_siginfo is declared to get an offset of _sifields */ +union cr_siginfo { + struct { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[10]; + /* ... */ + } _sifields; + } _info; + siginfo_t info; +}; +typedef union cr_siginfo cr_siginfo_t; + +#define siginf_body(s) (&((cr_siginfo_t *)(s))->_info._sifields) + #ifdef __i386__ /* * On x86_32 kernel puts only relevant union member when signal arrives, @@ -44,9 +62,9 @@ static int thread_nr; */ # define _si_fields_sz 12 #else -# define _si_fields_sz (sizeof(siginfo_t) - offsetof(siginfo_t, _sifields)) +# define _si_fields_sz (sizeof(siginfo_t) - offsetof(cr_siginfo_t, _info._sifields)) #endif -#define siginfo_filled (offsetof(siginfo_t, _sifields) + _si_fields_sz) +#define siginfo_filled (offsetof(cr_siginfo_t, _info._sifields) + _si_fields_sz) static pthread_mutex_t exit_lock; static pthread_mutex_t init_lock; @@ -90,7 +108,7 @@ static void sig_handler(int signal, siginfo_t *info, void *data) } crc = ~0; - if (datachk((uint8_t *) &info->_sifields, _si_fields_sz, &crc)) { + if (datachk((uint8_t *) siginf_body(info), _si_fields_sz, &crc)) { fail("CRC mismatch\n"); return; } @@ -172,7 +190,7 @@ int send_siginfo(int signo, pid_t pid, pid_t tid, int group, siginfo_t *info) info->si_code = si_code; si_code--; info->si_signo = signo; - datagen((uint8_t *) &info->_sifields, _si_fields_sz, &crc); + datagen((uint8_t *) siginf_body(info), _si_fields_sz, &crc); sent_sigs++; |