Commit 7678f440 authored by Andrei Vagin's avatar Andrei Vagin

test/zdtm: a few fixes to compile tests on Alpine

Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 0a303160
......@@ -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>";
......
......@@ -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
......
......@@ -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 */
......
#include <unistd.h>
#include <stdlib.h>
#include <dirent.h>
#include <linux/limits.h>
#include "zdtmtst.h"
......
......@@ -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>
......
......@@ -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)
......
......@@ -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++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment