Page MenuHomeFreeBSD

D24296.id70735.diff
No OneTemporary

D24296.id70735.diff

Index: head/tests/sys/kqueue/libkqueue/Makefile
===================================================================
--- head/tests/sys/kqueue/libkqueue/Makefile
+++ head/tests/sys/kqueue/libkqueue/Makefile
@@ -16,6 +16,5 @@
proc.c \
signal.c \
user.c
-WARNS?= 2
.include <bsd.test.mk>
Index: head/tests/sys/kqueue/libkqueue/common.h
===================================================================
--- head/tests/sys/kqueue/libkqueue/common.h
+++ head/tests/sys/kqueue/libkqueue/common.h
@@ -40,7 +40,6 @@
#include <sys/event.h>
-extern char *cur_test_id;
extern int vnode_fd;
extern int kqfd;
@@ -76,5 +75,14 @@
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: head/tests/sys/kqueue/libkqueue/main.c
===================================================================
--- head/tests/sys/kqueue/libkqueue/main.c
+++ head/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;
+static char *cur_test_id = NULL;
+static int testnum = 1;
-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
-
/* 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,
@@ -237,8 +228,8 @@
{
char *kev_str;
- EV_SET(kev, ident, filter, flags, fflags, data, NULL);
- if (kevent(kqfd, kev, 1, NULL, 0, NULL) < 0) {
+ EV_SET(kev, ident, filter, flags, fflags, data, udata);
+ 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: head/tests/sys/kqueue/libkqueue/proc.c
===================================================================
--- head/tests/sys/kqueue/libkqueue/proc.c
+++ head/tests/sys/kqueue/libkqueue/proc.c
@@ -27,7 +27,7 @@
static void
-sig_handler(int signum)
+sig_handler(__unused int signum)
{
sigusr1_caught = 1;
}
@@ -203,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 {
@@ -215,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 {
@@ -273,7 +273,7 @@
success();
}
-void
+static void
test_kevent_signal_disable(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_DISABLE)";
@@ -397,7 +397,7 @@
#endif
void
-test_evfilt_proc()
+test_evfilt_proc(void)
{
kqfd = kqueue();
Index: head/tests/sys/kqueue/libkqueue/read.c
===================================================================
--- head/tests/sys/kqueue/libkqueue/read.c
+++ head/tests/sys/kqueue/libkqueue/read.c
@@ -18,7 +18,7 @@
#include "common.h"
-int sockfd[2];
+static int sockfd[2];
static void
kevent_socket_drain(void)
@@ -40,7 +40,7 @@
}
-void
+static void
test_kevent_socket_add(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_ADD)";
@@ -54,7 +54,7 @@
success();
}
-void
+static void
test_kevent_socket_get(void)
{
const char *test_id = "kevent(EVFILT_READ) wait";
@@ -81,7 +81,7 @@
success();
}
-void
+static void
test_kevent_socket_clear(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_CLEAR)";
@@ -115,7 +115,7 @@
success();
}
-void
+static void
test_kevent_socket_disable_and_enable(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_DISABLE)";
@@ -153,7 +153,7 @@
success();
}
-void
+static void
test_kevent_socket_del(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_DELETE)";
@@ -172,7 +172,7 @@
success();
}
-void
+static void
test_kevent_socket_oneshot(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_ONESHOT)";
@@ -207,7 +207,7 @@
#if HAVE_EV_DISPATCH
-void
+static void
test_kevent_socket_dispatch(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_DISPATCH)";
@@ -242,7 +242,7 @@
#endif /* HAVE_EV_DISPATCH */
#if BROKEN
-void
+static void
test_kevent_socket_lowat(void)
{
const char *test_id = "kevent(EVFILT_READ, NOTE_LOWAT)";
@@ -275,7 +275,7 @@
}
#endif
-void
+static void
test_kevent_socket_eof(void)
{
const char *test_id = "kevent(EVFILT_READ, EV_EOF)";
@@ -304,7 +304,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: head/tests/sys/kqueue/libkqueue/signal.c
===================================================================
--- head/tests/sys/kqueue/libkqueue/signal.c
+++ head/tests/sys/kqueue/libkqueue/signal.c
@@ -19,7 +19,7 @@
#include "common.h"
-void
+static void
test_kevent_signal_add(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_ADD)";
@@ -34,7 +34,7 @@
success();
}
-void
+static void
test_kevent_signal_get(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, wait)";
@@ -62,7 +62,7 @@
success();
}
-void
+static void
test_kevent_signal_disable(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_DISABLE)";
@@ -88,7 +88,7 @@
success();
}
-void
+static void
test_kevent_signal_enable(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_ENABLE)";
@@ -125,7 +125,7 @@
success();
}
-void
+static void
test_kevent_signal_del(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_DELETE)";
@@ -151,7 +151,7 @@
success();
}
-void
+static void
test_kevent_signal_oneshot(void)
{
const char *test_id = "kevent(EVFILT_SIGNAL, EV_ONESHOT)";
@@ -185,7 +185,7 @@
}
void
-test_evfilt_signal()
+test_evfilt_signal(void)
{
kqfd = kqueue();
test_kevent_signal_add();
Index: head/tests/sys/kqueue/libkqueue/timer.c
===================================================================
--- head/tests/sys/kqueue/libkqueue/timer.c
+++ head/tests/sys/kqueue/libkqueue/timer.c
@@ -42,7 +42,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 = {
@@ -56,7 +56,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 = {
@@ -67,7 +67,7 @@
nanosleep(&stime, NULL);
}
-void
+static void
test_kevent_timer_add(void)
{
const char *test_id = "kevent(EVFILT_TIMER, EV_ADD)";
@@ -82,7 +82,7 @@
success();
}
-void
+static void
test_kevent_timer_del(void)
{
const char *test_id = "kevent(EVFILT_TIMER, EV_DELETE)";
@@ -99,7 +99,7 @@
success();
}
-void
+static void
test_kevent_timer_get(void)
{
const char *test_id = "kevent(EVFILT_TIMER, wait)";
@@ -509,7 +509,7 @@
}
void
-test_evfilt_timer()
+test_evfilt_timer(void)
{
kqfd = kqueue();
test_kevent_timer_add();
Index: head/tests/sys/kqueue/libkqueue/user.c
===================================================================
--- head/tests/sys/kqueue/libkqueue/user.c
+++ head/tests/sys/kqueue/libkqueue/user.c
@@ -114,7 +114,7 @@
}
void
-test_evfilt_user()
+test_evfilt_user(void)
{
kqfd = kqueue();
Index: head/tests/sys/kqueue/libkqueue/vnode.c
===================================================================
--- head/tests/sys/kqueue/libkqueue/vnode.c
+++ head/tests/sys/kqueue/libkqueue/vnode.c
@@ -20,7 +20,7 @@
int vnode_fd;
-void
+static void
test_kevent_vnode_add(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_ADD)";
@@ -44,7 +44,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_delete(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_DELETE)";
@@ -64,7 +64,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_write(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_WRITE)";
@@ -88,7 +88,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_attrib(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_ATTRIB)";
@@ -107,7 +107,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)",
@@ -116,7 +116,7 @@
success();
}
-void
+static void
test_kevent_vnode_note_rename(void)
{
const char *test_id = "kevent(EVFILT_VNODE, NOTE_RENAME)";
@@ -135,7 +135,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)",
@@ -147,7 +147,7 @@
success();
}
-void
+static void
test_kevent_vnode_del(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_DELETE)";
@@ -162,7 +162,7 @@
success();
}
-void
+static void
test_kevent_vnode_disable_and_enable(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_DISABLE and EV_ENABLE)";
@@ -195,7 +195,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)",
@@ -205,7 +205,7 @@
}
#if HAVE_EV_DISPATCH
-void
+static void
test_kevent_vnode_dispatch(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_DISPATCH)";
@@ -226,7 +226,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)",
@@ -248,7 +248,7 @@
#endif /* HAVE_EV_DISPATCH */
void
-test_evfilt_vnode()
+test_evfilt_vnode(void)
{
kqfd = kqueue();
test_kevent_vnode_add();

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 14, 4:33 PM (1 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25277240
Default Alt Text
D24296.id70735.diff (12 KB)

Event Timeline