Changeset View
Changeset View
Standalone View
Standalone View
head/tests/sys/kqueue/libkqueue/common.h
Show All 13 Lines | |||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _COMMON_H | #ifndef _COMMON_H | ||||
#define _COMMON_H | #define _COMMON_H | ||||
#include "config.h" /* Needed for HAVE_* defines */ | |||||
#if HAVE_ERR_H | #if HAVE_ERR_H | ||||
# include <err.h> | # include <err.h> | ||||
#else | #else | ||||
# define err(rc,msg,...) do { perror(msg); exit(rc); } while (0) | # define err(rc,msg,...) do { perror(msg); exit(rc); } while (0) | ||||
# define errx(rc,msg,...) do { puts(msg); exit(rc); } while (0) | # define errx(rc,msg,...) do { puts(msg); exit(rc); } while (0) | ||||
#endif | #endif | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <sys/event.h> | #include <sys/event.h> | ||||
#include "config.h" | |||||
extern char *cur_test_id; | extern char *cur_test_id; | ||||
int vnode_fd; | int vnode_fd; | ||||
extern const char * kevent_to_str(struct kevent *); | extern const char * kevent_to_str(struct kevent *); | ||||
struct kevent * kevent_get(int); | struct kevent * kevent_get(int); | ||||
struct kevent * kevent_get_timeout(int, int); | struct kevent * kevent_get_timeout(int, int); | ||||
Show All 15 Lines | if (kev.ident != (_ident) || \ | ||||
kev.flags != (_flags)) \ | kev.flags != (_flags)) \ | ||||
err(1, "kevent mismatch: got [%d,%d,%d] but expecting [%d,%d,%d]", \ | err(1, "kevent mismatch: got [%d,%d,%d] but expecting [%d,%d,%d]", \ | ||||
(int)_ident, (int)_filter, (int)_flags,\ | (int)_ident, (int)_filter, (int)_flags,\ | ||||
(int)kev.ident, kev.filter, kev.flags);\ | (int)kev.ident, kev.filter, kev.flags);\ | ||||
} while (0); | } while (0); | ||||
/* Checks if any events are pending, which is an error. */ | /* Checks if any events are pending, which is an error. */ | ||||
extern void test_no_kevents(void); | extern void test_no_kevents(void); | ||||
extern void test_no_kevents_quietly(void); | |||||
extern void test_begin(const char *); | extern void test_begin(const char *); | ||||
extern void success(void); | extern void success(void); | ||||
#endif /* _COMMON_H */ | #endif /* _COMMON_H */ |