Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135855874
D24296.id70196.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
13 KB
Referenced Files
None
Subscribers
None
D24296.id70196.diff
View Options
Index: tests/sys/kqueue/libkqueue/Makefile
===================================================================
--- tests/sys/kqueue/libkqueue/Makefile
+++ tests/sys/kqueue/libkqueue/Makefile
@@ -16,6 +16,5 @@
proc.c \
signal.c \
user.c
-WARNS?= 2
.include <bsd.test.mk>
Index: tests/sys/kqueue/libkqueue/common.h
===================================================================
--- tests/sys/kqueue/libkqueue/common.h
+++ tests/sys/kqueue/libkqueue/common.h
@@ -41,7 +41,7 @@
#include <sys/event.h>
extern char *cur_test_id;
-int vnode_fd;
+extern int vnode_fd;
extern char * kevent_to_str(struct kevent *);
struct kevent * kevent_get(int);
@@ -76,4 +76,13 @@
extern void test_begin(const char *);
extern void success(void);
+extern void test_evfilt_read(void);
+extern void test_evfilt_signal(void);
+extern void test_evfilt_vnode(void);
+extern void test_evfilt_timer(void);
+extern void test_evfilt_proc(void);
+#if HAVE_EVFILT_USER
+extern void test_evfilt_user(void);
+#endif
+
#endif /* _COMMON_H */
Index: tests/sys/kqueue/libkqueue/main.c
===================================================================
--- tests/sys/kqueue/libkqueue/main.c
+++ tests/sys/kqueue/libkqueue/main.c
@@ -21,21 +21,12 @@
#include "config.h"
#include "common.h"
-int testnum = 1;
char *cur_test_id = NULL;
-int kqfd;
-
-extern void test_evfilt_read();
-extern void test_evfilt_signal();
-extern void test_evfilt_vnode();
-extern void test_evfilt_timer();
-extern void test_evfilt_proc();
-#if HAVE_EVFILT_USER
-extern void test_evfilt_user();
-#endif
+static int testnum = 1;
+static int kqfd;
/* Checks if any events are pending, which is an error. */
-void
+void
test_no_kevents(void)
{
int nfds;
@@ -58,7 +49,7 @@
/* Checks if any events are pending, which is an error. Do not print
* out anything unless events are found.
*/
-void
+void
test_no_kevents_quietly(void)
{
int nfds;
@@ -79,7 +70,7 @@
/* Retrieve a single kevent */
struct kevent *
-kevent_get(int kqfd)
+kevent_get(int fd)
{
int nfds;
struct kevent *kev;
@@ -87,7 +78,7 @@
if ((kev = calloc(1, sizeof(*kev))) == NULL)
err(1, "out of memory");
- nfds = kevent(kqfd, NULL, 0, kev, 1, NULL);
+ nfds = kevent(fd, NULL, 0, kev, 1, NULL);
if (nfds < 1)
err(1, "kevent(2)");
@@ -96,7 +87,7 @@
/* Retrieve a single kevent, specifying a maximum time to wait for it. */
struct kevent *
-kevent_get_timeout(int kqfd, int seconds)
+kevent_get_timeout(int fd, int seconds)
{
int nfds;
struct kevent *kev;
@@ -105,7 +96,7 @@
if ((kev = calloc(1, sizeof(*kev))) == NULL)
err(1, "out of memory");
- nfds = kevent(kqfd, NULL, 0, kev, 1, &timeout);
+ nfds = kevent(fd, NULL, 0, kev, 1, &timeout);
if (nfds < 0) {
err(1, "kevent(2)");
} else if (nfds == 0) {
@@ -116,7 +107,7 @@
return (kev);
}
-char *
+static char *
kevent_fflags_dump(struct kevent *kev)
{
char *buf;
@@ -166,7 +157,7 @@
return (buf);
}
-char *
+static char *
kevent_flags_dump(struct kevent *kev)
{
char *buf;
@@ -227,7 +218,7 @@
}
void
-kevent_add(int kqfd, struct kevent *kev,
+kevent_add(int fd, struct kevent *kev,
uintptr_t ident,
short filter,
u_short flags,
@@ -238,7 +229,7 @@
char *kev_str;
EV_SET(kev, ident, filter, flags, fflags, data, NULL);
- if (kevent(kqfd, kev, 1, NULL, 0, NULL) < 0) {
+ if (kevent(fd, kev, 1, NULL, 0, NULL) < 0) {
kev_str = kevent_to_str(kev);
printf("Unable to add the following kevent:\n%s\n",
kev_str);
@@ -295,7 +286,7 @@
cur_test_id = NULL;
}
-void
+static void
test_kqueue(void)
{
test_begin("kqueue()");
@@ -305,7 +296,7 @@
success();
}
-void
+static void
test_kqueue_close(void)
{
test_begin("close(kq)");
Index: tests/sys/kqueue/libkqueue/proc.c
===================================================================
--- tests/sys/kqueue/libkqueue/proc.c
+++ tests/sys/kqueue/libkqueue/proc.c
@@ -24,8 +24,7 @@
#include "common.h"
static int sigusr1_caught = 0;
-
-int kqfd;
+static int kqfd;
static void
sig_handler(int signum)
@@ -204,10 +203,10 @@
}
if (kevp->fflags & NOTE_EXIT) {
- if ((kevp->ident == pid) && (!child_exit)) {
+ if ((kevp->ident == (uintptr_t)pid) && (!child_exit)) {
++child_exit;
++handled;
- } else if ((kevp->ident == gchild_pid) && (!gchild_exit)) {
+ } else if ((kevp->ident == (uintptr_t)gchild_pid) && (!gchild_exit)) {
++gchild_exit;
++handled;
} else {
@@ -216,7 +215,7 @@
}
if (kevp->fflags & NOTE_FORK) {
- if ((kevp->ident == pid) && (!child_fork)) {
+ if ((kevp->ident == (uintptr_t)pid) && (!child_fork)) {
++child_fork;
++handled;
} else {
@@ -274,7 +273,7 @@
success();
}
-void
+static void
test_kevent_signal_disable(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_DISABLE)";
@@ -398,7 +397,7 @@
#endif
void
-test_evfilt_proc()
+test_evfilt_proc(void)
{
kqfd = kqueue();
Index: tests/sys/kqueue/libkqueue/read.c
===================================================================
--- tests/sys/kqueue/libkqueue/read.c
+++ tests/sys/kqueue/libkqueue/read.c
@@ -18,8 +18,8 @@
#include "common.h"
-int kqfd;
-int sockfd[2];
+static int kqfd;
+static int sockfd[2];
static void
kevent_socket_drain(void)
@@ -41,7 +41,7 @@
}
-void
+static void
test_kevent_socket_add(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_ADD)";
@@ -55,7 +55,7 @@
success();
}
-void
+static void
test_kevent_socket_get(void)
{
const char *test_id = "kevent(EVFILT_READ) wait";
@@ -82,7 +82,7 @@
success();
}
-void
+static void
test_kevent_socket_clear(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_CLEAR)";
@@ -116,7 +116,7 @@
success();
}
-void
+static void
test_kevent_socket_disable_and_enable(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_DISABLE)";
@@ -154,7 +154,7 @@
success();
}
-void
+static void
test_kevent_socket_del(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_DELETE)";
@@ -173,7 +173,7 @@
success();
}
-void
+static void
test_kevent_socket_oneshot(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_ONESHOT)";
@@ -208,7 +208,7 @@
#if HAVE_EV_DISPATCH
-void
+static void
test_kevent_socket_dispatch(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_DISPATCH)";
@@ -243,7 +243,7 @@
#endif /* HAVE_EV_DISPATCH */
#if BROKEN
-void
+static void
test_kevent_socket_lowat(void)
{
const char *test_id = "kevent(EVFILT_READ, NOTE_LOWAT)";
@@ -276,7 +276,7 @@
}
#endif
-void
+static void
test_kevent_socket_eof(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_EOF)";
@@ -305,7 +305,7 @@
}
void
-test_evfilt_read()
+test_evfilt_read(void)
{
/* Create a connected pair of full-duplex sockets for testing socket events */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd) < 0)
Index: tests/sys/kqueue/libkqueue/signal.c
===================================================================
--- tests/sys/kqueue/libkqueue/signal.c
+++ tests/sys/kqueue/libkqueue/signal.c
@@ -18,9 +18,9 @@
#include "common.h"
-int kqfd;
+static int kqfd;
-void
+static void
test_kevent_signal_add(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_ADD)";
@@ -35,7 +35,7 @@
success();
}
-void
+static void
test_kevent_signal_get(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, wait)";
@@ -63,7 +63,7 @@
success();
}
-void
+static void
test_kevent_signal_disable(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_DISABLE)";
@@ -89,7 +89,7 @@
success();
}
-void
+static void
test_kevent_signal_enable(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_ENABLE)";
@@ -126,7 +126,7 @@
success();
}
-void
+static void
test_kevent_signal_del(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_DELETE)";
@@ -152,7 +152,7 @@
success();
}
-void
+static void
test_kevent_signal_oneshot(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_ONESHOT)";
@@ -186,7 +186,7 @@
}
void
-test_evfilt_signal()
+test_evfilt_signal(void)
{
kqfd = kqueue();
test_kevent_signal_add();
Index: tests/sys/kqueue/libkqueue/timer.c
===================================================================
--- tests/sys/kqueue/libkqueue/timer.c
+++ tests/sys/kqueue/libkqueue/timer.c
@@ -26,7 +26,7 @@
#define MS_TO_US(t) ((t) * THOUSAND) /* Convert milliseconds to microseconds. */
#define US_TO_NS(t) ((t) * THOUSAND) /* Convert microseconds to nanoseconds. */
-int kqfd;
+static int kqfd;
/* Get the current time with microsecond precision. Used for
* sub-second timing to make some timer tests run faster.
@@ -43,7 +43,7 @@
/* Sleep for a given number of milliseconds. The timeout is assumed to
* be less than 1 second.
*/
-void
+static void
mssleep(int t)
{
struct timespec stime = {
@@ -57,7 +57,7 @@
/* Sleep for a given number of microseconds. The timeout is assumed to
* be less than 1 second.
*/
-void
+static void
ussleep(int t)
{
struct timespec stime = {
@@ -68,7 +68,7 @@
nanosleep(&stime, NULL);
}
-void
+static void
test_kevent_timer_add(void)
{
const char *test_id = "kevent(EVFILT_TIMER, EV_ADD)";
@@ -83,7 +83,7 @@
success();
}
-void
+static void
test_kevent_timer_del(void)
{
const char *test_id = "kevent(EVFILT_TIMER, EV_DELETE)";
@@ -100,7 +100,7 @@
success();
}
-void
+static void
test_kevent_timer_get(void)
{
const char *test_id = "kevent(EVFILT_TIMER, wait)";
@@ -510,7 +510,7 @@
}
void
-test_evfilt_timer()
+test_evfilt_timer(void)
{
kqfd = kqueue();
test_kevent_timer_add();
Index: tests/sys/kqueue/libkqueue/user.c
===================================================================
--- tests/sys/kqueue/libkqueue/user.c
+++ tests/sys/kqueue/libkqueue/user.c
@@ -18,7 +18,7 @@
#include "common.h"
-int kqfd;
+static int kqfd;
static void
add_and_delete(void)
@@ -115,7 +115,7 @@
}
void
-test_evfilt_user()
+test_evfilt_user(void)
{
kqfd = kqueue();
Index: tests/sys/kqueue/libkqueue/vnode.c
===================================================================
--- tests/sys/kqueue/libkqueue/vnode.c
+++ tests/sys/kqueue/libkqueue/vnode.c
@@ -18,10 +18,10 @@
#include "common.h"
-int kqfd;
+static int kqfd;
int vnode_fd;
-void
+static void
test_kevent_vnode_add(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_ADD)";
@@ -45,7 +45,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_delete(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_DELETE)";
@@ -65,7 +65,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_write(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_WRITE)";
@@ -89,7 +89,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_attrib(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_ATTRIB)";
@@ -108,7 +108,7 @@
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
if (nfds < 1)
err(1, "%s", test_id);
- if (kev.ident != vnode_fd ||
+ if (kev.ident != (uintptr_t)vnode_fd ||
kev.filter != EVFILT_VNODE ||
kev.fflags != NOTE_ATTRIB)
err(1, "%s - incorrect event (sig=%u; filt=%d; flags=%d)",
@@ -117,7 +117,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_rename(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_RENAME)";
@@ -136,7 +136,7 @@
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
if (nfds < 1)
err(1, "%s", test_id);
- if (kev.ident != vnode_fd ||
+ if (kev.ident != (uintptr_t)vnode_fd ||
kev.filter != EVFILT_VNODE ||
kev.fflags != NOTE_RENAME)
err(1, "%s - incorrect event (sig=%u; filt=%d; flags=%d)",
@@ -148,7 +148,7 @@
success();
}
-void
+static void
test_kevent_vnode_del(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_DELETE)";
@@ -163,7 +163,7 @@
success();
}
-void
+static void
test_kevent_vnode_disable_and_enable(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_DISABLE and EV_ENABLE)";
@@ -196,7 +196,7 @@
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
if (nfds < 1)
err(1, "%s", test_id);
- if (kev.ident != vnode_fd ||
+ if (kev.ident != (uintptr_t)vnode_fd ||
kev.filter != EVFILT_VNODE ||
kev.fflags != NOTE_ATTRIB)
err(1, "%s - incorrect event (sig=%u; filt=%d; flags=%d)",
@@ -206,7 +206,7 @@
}
#if HAVE_EV_DISPATCH
-void
+static void
test_kevent_vnode_dispatch(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_DISPATCH)";
@@ -227,7 +227,7 @@
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
if (nfds < 1)
err(1, "%s", test_id);
- if (kev.ident != vnode_fd ||
+ if (kev.ident != (uintptr_t)vnode_fd ||
kev.filter != EVFILT_VNODE ||
kev.fflags != NOTE_ATTRIB)
err(1, "%s - incorrect event (sig=%u; filt=%d; flags=%d)",
@@ -249,7 +249,7 @@
#endif /* HAVE_EV_DISPATCH */
void
-test_evfilt_vnode()
+test_evfilt_vnode(void)
{
kqfd = kqueue();
test_kevent_vnode_add();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 14, 1:57 PM (10 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25289681
Default Alt Text
D24296.id70196.diff (13 KB)
Attached To
Mode
D24296: Fix tests/sys/kqueue without -fcommon and bump WARNS
Attached
Detach File
Event Timeline
Log In to Comment