From owner-svn-src-head@freebsd.org Sat Apr 18 12:54:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0C4B2C8898; Sat, 18 Apr 2020 12:54:50 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 494CbY33QGz4BgK; Sat, 18 Apr 2020 12:54:49 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16BBECB6C; Sat, 18 Apr 2020 12:54:49 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03ICsn6c028332; Sat, 18 Apr 2020 12:54:49 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03ICslhN028317; Sat, 18 Apr 2020 12:54:47 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202004181254.03ICslhN028317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Sat, 18 Apr 2020 12:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360073 - head/tests/sys/kqueue/libkqueue X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/tests/sys/kqueue/libkqueue X-SVN-Commit-Revision: 360073 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2020 12:54:51 -0000 Author: arichardson Date: Sat Apr 18 12:54:47 2020 New Revision: 360073 URL: https://svnweb.freebsd.org/changeset/base/360073 Log: Fix various warnings in tests/sys/kqueue and bump WARNS Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D24296 Modified: head/tests/sys/kqueue/libkqueue/Makefile head/tests/sys/kqueue/libkqueue/common.h head/tests/sys/kqueue/libkqueue/main.c head/tests/sys/kqueue/libkqueue/proc.c head/tests/sys/kqueue/libkqueue/read.c head/tests/sys/kqueue/libkqueue/signal.c head/tests/sys/kqueue/libkqueue/timer.c head/tests/sys/kqueue/libkqueue/user.c head/tests/sys/kqueue/libkqueue/vnode.c Modified: head/tests/sys/kqueue/libkqueue/Makefile ============================================================================== --- head/tests/sys/kqueue/libkqueue/Makefile Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/Makefile Sat Apr 18 12:54:47 2020 (r360073) @@ -16,6 +16,5 @@ SRCS.kqtest= \ proc.c \ signal.c \ user.c -WARNS?= 2 .include Modified: head/tests/sys/kqueue/libkqueue/common.h ============================================================================== --- head/tests/sys/kqueue/libkqueue/common.h Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/common.h Sat Apr 18 12:54:47 2020 (r360073) @@ -40,7 +40,6 @@ #include -extern char *cur_test_id; extern int vnode_fd; extern int kqfd; @@ -76,5 +75,14 @@ extern void test_no_kevents_quietly(void); 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 */ Modified: head/tests/sys/kqueue/libkqueue/main.c ============================================================================== --- head/tests/sys/kqueue/libkqueue/main.c Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/main.c Sat Apr 18 12:54:47 2020 (r360073) @@ -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 @@ test_no_kevents(void) /* 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 @@ test_no_kevents_quietly(void) /* Retrieve a single kevent */ struct kevent * -kevent_get(int kqfd) +kevent_get(int fd) { int nfds; struct kevent *kev; @@ -87,7 +78,7 @@ kevent_get(int kqfd) 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 @@ kevent_get(int kqfd) /* 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 @@ kevent_get_timeout(int kqfd, int seconds) 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 @@ kevent_get_timeout(int kqfd, int seconds) return (kev); } -char * +static char * kevent_fflags_dump(struct kevent *kev) { char *buf; @@ -166,7 +157,7 @@ kevent_fflags_dump(struct kevent *kev) return (buf); } -char * +static char * kevent_flags_dump(struct kevent *kev) { char *buf; @@ -227,7 +218,7 @@ kevent_to_str(struct kevent *kev) } 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 @@ kevent_add(int kqfd, struct kevent *kev, { 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 @@ success(void) cur_test_id = NULL; } -void +static void test_kqueue(void) { test_begin("kqueue()"); @@ -305,7 +296,7 @@ test_kqueue(void) success(); } -void +static void test_kqueue_close(void) { test_begin("close(kq)"); Modified: head/tests/sys/kqueue/libkqueue/proc.c ============================================================================== --- head/tests/sys/kqueue/libkqueue/proc.c Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/proc.c Sat Apr 18 12:54:47 2020 (r360073) @@ -27,7 +27,7 @@ static int sigusr1_caught = 0; static void -sig_handler(int signum) +sig_handler(__unused int signum) { sigusr1_caught = 1; } @@ -203,10 +203,10 @@ proc_track(int sleep_time) } 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 @@ proc_track(int sleep_time) } 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 @@ event_trigger(void) success(); } -void +static void test_kevent_signal_disable(void) { const char *test_id = "kevent(EVFILT_SIGNAL, EV_DISABLE)"; @@ -397,7 +397,7 @@ test_kevent_signal_oneshot(void) #endif void -test_evfilt_proc() +test_evfilt_proc(void) { kqfd = kqueue(); Modified: head/tests/sys/kqueue/libkqueue/read.c ============================================================================== --- head/tests/sys/kqueue/libkqueue/read.c Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/read.c Sat Apr 18 12:54:47 2020 (r360073) @@ -18,7 +18,7 @@ #include "common.h" -int sockfd[2]; +static int sockfd[2]; static void kevent_socket_drain(void) @@ -40,7 +40,7 @@ kevent_socket_fill(void) } -void +static void test_kevent_socket_add(void) { const char *test_id = "kevent(EVFILT_READ, EV_ADD)"; @@ -54,7 +54,7 @@ test_kevent_socket_add(void) success(); } -void +static void test_kevent_socket_get(void) { const char *test_id = "kevent(EVFILT_READ) wait"; @@ -81,7 +81,7 @@ test_kevent_socket_get(void) success(); } -void +static void test_kevent_socket_clear(void) { const char *test_id = "kevent(EVFILT_READ, EV_CLEAR)"; @@ -115,7 +115,7 @@ test_kevent_socket_clear(void) success(); } -void +static void test_kevent_socket_disable_and_enable(void) { const char *test_id = "kevent(EVFILT_READ, EV_DISABLE)"; @@ -153,7 +153,7 @@ test_kevent_socket_disable_and_enable(void) success(); } -void +static void test_kevent_socket_del(void) { const char *test_id = "kevent(EVFILT_READ, EV_DELETE)"; @@ -172,7 +172,7 @@ test_kevent_socket_del(void) success(); } -void +static void test_kevent_socket_oneshot(void) { const char *test_id = "kevent(EVFILT_READ, EV_ONESHOT)"; @@ -207,7 +207,7 @@ test_kevent_socket_oneshot(void) #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 @@ test_kevent_socket_dispatch(void) #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 @@ test_kevent_socket_lowat(void) } #endif -void +static void test_kevent_socket_eof(void) { const char *test_id = "kevent(EVFILT_READ, EV_EOF)"; @@ -304,7 +304,7 @@ test_kevent_socket_eof(void) } 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) Modified: head/tests/sys/kqueue/libkqueue/signal.c ============================================================================== --- head/tests/sys/kqueue/libkqueue/signal.c Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/signal.c Sat Apr 18 12:54:47 2020 (r360073) @@ -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 @@ test_kevent_signal_add(void) success(); } -void +static void test_kevent_signal_get(void) { const char *test_id = "kevent(EVFILT_SIGNAL, wait)"; @@ -62,7 +62,7 @@ test_kevent_signal_get(void) success(); } -void +static void test_kevent_signal_disable(void) { const char *test_id = "kevent(EVFILT_SIGNAL, EV_DISABLE)"; @@ -88,7 +88,7 @@ test_kevent_signal_disable(void) success(); } -void +static void test_kevent_signal_enable(void) { const char *test_id = "kevent(EVFILT_SIGNAL, EV_ENABLE)"; @@ -125,7 +125,7 @@ test_kevent_signal_enable(void) success(); } -void +static void test_kevent_signal_del(void) { const char *test_id = "kevent(EVFILT_SIGNAL, EV_DELETE)"; @@ -151,7 +151,7 @@ test_kevent_signal_del(void) success(); } -void +static void test_kevent_signal_oneshot(void) { const char *test_id = "kevent(EVFILT_SIGNAL, EV_ONESHOT)"; @@ -185,7 +185,7 @@ test_kevent_signal_oneshot(void) } void -test_evfilt_signal() +test_evfilt_signal(void) { kqfd = kqueue(); test_kevent_signal_add(); Modified: head/tests/sys/kqueue/libkqueue/timer.c ============================================================================== --- head/tests/sys/kqueue/libkqueue/timer.c Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/timer.c Sat Apr 18 12:54:47 2020 (r360073) @@ -42,7 +42,7 @@ now(void) /* 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 @@ mssleep(int t) /* 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 @@ ussleep(int t) nanosleep(&stime, NULL); } -void +static void test_kevent_timer_add(void) { const char *test_id = "kevent(EVFILT_TIMER, EV_ADD)"; @@ -82,7 +82,7 @@ test_kevent_timer_add(void) success(); } -void +static void test_kevent_timer_del(void) { const char *test_id = "kevent(EVFILT_TIMER, EV_DELETE)"; @@ -99,7 +99,7 @@ test_kevent_timer_del(void) success(); } -void +static void test_kevent_timer_get(void) { const char *test_id = "kevent(EVFILT_TIMER, wait)"; @@ -509,7 +509,7 @@ test_update_timing(void) } void -test_evfilt_timer() +test_evfilt_timer(void) { kqfd = kqueue(); test_kevent_timer_add(); Modified: head/tests/sys/kqueue/libkqueue/user.c ============================================================================== --- head/tests/sys/kqueue/libkqueue/user.c Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/user.c Sat Apr 18 12:54:47 2020 (r360073) @@ -114,7 +114,7 @@ oneshot(void) } void -test_evfilt_user() +test_evfilt_user(void) { kqfd = kqueue(); Modified: head/tests/sys/kqueue/libkqueue/vnode.c ============================================================================== --- head/tests/sys/kqueue/libkqueue/vnode.c Sat Apr 18 12:54:40 2020 (r360072) +++ head/tests/sys/kqueue/libkqueue/vnode.c Sat Apr 18 12:54:47 2020 (r360073) @@ -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 @@ test_kevent_vnode_add(void) success(); } -void +static void test_kevent_vnode_note_delete(void) { const char *test_id = "kevent(EVFILT_VNODE, NOTE_DELETE)"; @@ -64,7 +64,7 @@ test_kevent_vnode_note_delete(void) success(); } -void +static void test_kevent_vnode_note_write(void) { const char *test_id = "kevent(EVFILT_VNODE, NOTE_WRITE)"; @@ -88,7 +88,7 @@ test_kevent_vnode_note_write(void) success(); } -void +static void test_kevent_vnode_note_attrib(void) { const char *test_id = "kevent(EVFILT_VNODE, NOTE_ATTRIB)"; @@ -107,7 +107,7 @@ test_kevent_vnode_note_attrib(void) 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 @@ test_kevent_vnode_note_attrib(void) success(); } -void +static void test_kevent_vnode_note_rename(void) { const char *test_id = "kevent(EVFILT_VNODE, NOTE_RENAME)"; @@ -135,7 +135,7 @@ test_kevent_vnode_note_rename(void) 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 @@ test_kevent_vnode_note_rename(void) success(); } -void +static void test_kevent_vnode_del(void) { const char *test_id = "kevent(EVFILT_VNODE, EV_DELETE)"; @@ -162,7 +162,7 @@ test_kevent_vnode_del(void) 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 @@ test_kevent_vnode_disable_and_enable(void) 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 @@ test_kevent_vnode_disable_and_enable(void) } #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 @@ test_kevent_vnode_dispatch(void) 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 @@ test_kevent_vnode_dispatch(void) #endif /* HAVE_EV_DISPATCH */ void -test_evfilt_vnode() +test_evfilt_vnode(void) { kqfd = kqueue(); test_kevent_vnode_add();