CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: rillig Date: Wed Jul 10 22:03:59 UTC 2024 Modified Files: src/tests/kernel/kqueue: t_sig.c Log Message: tests/kqueue: fix mismatch between '=' and '==' To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/t_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/t_sig.c diff -u src/tests/kernel/kqueue/t_sig.c:1.4 src/tests/kernel/kqueue/t_sig.c:1.5 --- src/tests/kernel/kqueue/t_sig.c:1.4 Sun Oct 10 18:11:31 2021 +++ src/tests/kernel/kqueue/t_sig.c Wed Jul 10 22:03:59 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: t_sig.c,v 1.4 2021/10/10 18:11:31 thorpej Exp $ */ +/* $NetBSD: t_sig.c,v 1.5 2024/07/10 22:03:59 rillig Exp $ */ /*- * Copyright (c) 2002, 2008, 2021 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_sig.c,v 1.4 2021/10/10 18:11:31 thorpej Exp $"); +__RCSID("$NetBSD: t_sig.c,v 1.5 2024/07/10 22:03:59 rillig Exp $"); #include #include @@ -199,7 +199,7 @@ ATF_TC_BODY(sig_and_proc, tc) ATF_REQUIRE(kevent(kq, NULL, 0, events, 1, NULL) == 1); ATF_REQUIRE(events[0].filter == EVFILT_PROC); ATF_REQUIRE(events[0].ident == (uintptr_t)pid); - ATF_REQUIRE(events[0].fflags = NOTE_EXIT); + ATF_REQUIRE(events[0].fflags == NOTE_EXIT); } ATF_TP_ADD_TCS(tp)
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: rillig Date: Wed Jul 10 22:03:59 UTC 2024 Modified Files: src/tests/kernel/kqueue: t_sig.c Log Message: tests/kqueue: fix mismatch between '=' and '==' To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/t_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: hannken Date: Sun Nov 21 09:35:39 UTC 2021 Modified Files: src/tests/kernel/kqueue: Makefile t_timer.c Log Message: Test kernel/kqueue/t_timer, subtests abstime, basic_timer and timer_units often fail when run on QEMU because QEMU misses clock interrupts. Always check timespec against expected "tv_sec" and use an "4 * tv_sec" upper bound when run under QEMU. Now becomes part of PR kern/43997 "Kernel timer discrepancies". To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/kernel/kqueue/Makefile cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/t_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/Makefile diff -u src/tests/kernel/kqueue/Makefile:1.9 src/tests/kernel/kqueue/Makefile:1.10 --- src/tests/kernel/kqueue/Makefile:1.9 Sat Oct 23 18:46:26 2021 +++ src/tests/kernel/kqueue/Makefile Sun Nov 21 09:35:39 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2021/10/23 18:46:26 thorpej Exp $ +# $NetBSD: Makefile,v 1.10 2021/11/21 09:35:39 hannken Exp $ WARNS?=6 NOMAN= # defined @@ -24,4 +24,6 @@ TESTS_C+= t_vnode LDADD.t_scan+= -lpthread +CPPFLAGS.t_timer.c+= -I${.CURDIR}/../../lib/libc/gen + .include Index: src/tests/kernel/kqueue/t_timer.c diff -u src/tests/kernel/kqueue/t_timer.c:1.3 src/tests/kernel/kqueue/t_timer.c:1.4 --- src/tests/kernel/kqueue/t_timer.c:1.3 Fri Oct 22 13:53:20 2021 +++ src/tests/kernel/kqueue/t_timer.c Sun Nov 21 09:35:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_timer.c,v 1.3 2021/10/22 13:53:20 thorpej Exp $ */ +/* $NetBSD: t_timer.c,v 1.4 2021/11/21 09:35:39 hannken Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_timer.c,v 1.3 2021/10/22 13:53:20 thorpej Exp $"); +__RCSID("$NetBSD: t_timer.c,v 1.4 2021/11/21 09:35:39 hannken Exp $"); #include #include @@ -39,6 +39,36 @@ __RCSID("$NetBSD: t_timer.c,v 1.3 2021/1 #include +#include "isqemu.h" + +static bool +check_timespec(struct timespec *ts, time_t seconds) +{ + time_t upper = seconds; + bool result = true; + + /* + * If running under QEMU make sure the upper bound is large + * enough for the effect of kern/43997 + */ + if (isQEMU()) { + upper *= 4; + } + + if (ts->tv_sec < seconds - 1 || + (ts->tv_sec == seconds - 1 && ts->tv_nsec < 5)) + result = false; + else if (ts->tv_sec > upper || + (ts->tv_sec == upper && ts->tv_nsec >= 5)) + result = false; + + printf("time %" PRId64 ".%09ld %sin [ %" PRId64 ".5, %" PRId64 ".5 )\n", + ts->tv_sec, ts->tv_nsec, (result ? "" : "not "), + seconds - 1, upper); + + return result; +} + ATF_TC(basic_timer); ATF_TC_HEAD(basic_timer, tc) { @@ -83,13 +113,8 @@ ATF_TC_BODY(basic_timer, tc) ATF_REQUIRE(clock_gettime(CLOCK_MONOTONIC, ) == 0); timespecsub(, , ); -ATF_REQUIRE(ts.tv_sec == - (TIME1_TOTAL_SEC - 1) || -ts.tv_sec == TIME1_TOTAL_SEC); -if (ts.tv_sec == TIME1_TOTAL_SEC - 1) { - ATF_REQUIRE(ts.tv_nsec >= - 9); -} +ATF_REQUIRE(check_timespec(, +TIME1_TOTAL_SEC)); EV_SET([0], 1, EVFILT_TIMER, EV_DELETE, 0, 0, NULL); ATF_REQUIRE(kevent(kq, event, 1, NULL, 0, @@ -106,12 +131,7 @@ ATF_TC_BODY(basic_timer, tc) ATF_REQUIRE(clock_gettime(CLOCK_MONOTONIC, ) == 0); timespecsub(, , ); - ATF_REQUIRE(ts.tv_sec == -(TIME2_TOTAL_SEC - 1) || - ts.tv_sec == TIME2_TOTAL_SEC); - if (ts.tv_sec == TIME2_TOTAL_SEC - 1) { -ATF_REQUIRE(ts.tv_nsec >= 9); - } + ATF_REQUIRE(check_timespec(, TIME2_TOTAL_SEC)); EV_SET([0], 2, EVFILT_TIMER, EV_DELETE, 0, 0, NULL); ATF_REQUIRE_ERRNO(ENOENT, @@ -130,14 +150,7 @@ ATF_TC_BODY(basic_timer, tc) ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, ) == 0); ATF_REQUIRE(clock_gettime(CLOCK_MONOTONIC, ) == 0); timespecsub(, , ); - ATF_REQUIRE(ts.tv_sec == (TIME2_TOTAL_SEC - 1) || - ts.tv_sec == TIME2_TOTAL_SEC || - ts.tv_sec == (TIME2_TOTAL_SEC + 1)); - if (ts.tv_sec == TIME2_TOTAL_SEC - 1) { - ATF_REQUIRE(ts.tv_nsec >= 9); - } else if (ts.tv_sec == TIME2_TOTAL_SEC + 1) { - ATF_REQUIRE(ts.tv_nsec < 5); - } + ATF_REQUIRE(check_timespec(, TIME2_TOTAL_SEC)); } ATF_TC(count_expirations); @@ -272,9 +285,6 @@ ATF_TC_BODY(abstime, tc) ATF_REQUIRE(ots.tv_sec < INTPTR_MAX - TIME1_TOTAL_SEC); seconds = ots.tv_sec + TIME1_TOTAL_SEC; - if (ots.tv_nsec >= 5) { - seconds++; - } EV_SET([0], 1, EVFILT_TIMER, EV_ADD, NOTE_ABSTIME | NOTE_SECONDS, seconds, NULL); @@ -287,10 +297,7 @@ ATF_TC_BODY(abstime, tc) * We're not going for precision here; just verify that it was * delivered anywhere between 4.5-6.whatever seconds later. */ - ATF_REQUIRE(ts.tv_sec >= 4 && ts.tv_sec <= 6); - if (ts.tv_sec == 4) { - ATF_REQUIRE(ts.tv_nsec >= 5); - } +
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: hannken Date: Sun Nov 21 09:35:39 UTC 2021 Modified Files: src/tests/kernel/kqueue: Makefile t_timer.c Log Message: Test kernel/kqueue/t_timer, subtests abstime, basic_timer and timer_units often fail when run on QEMU because QEMU misses clock interrupts. Always check timespec against expected "tv_sec" and use an "4 * tv_sec" upper bound when run under QEMU. Now becomes part of PR kern/43997 "Kernel timer discrepancies". To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/kernel/kqueue/Makefile cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/t_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: thorpej Date: Fri Oct 22 13:53:20 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_timer.c Log Message: In the "modify" test case, immediately after modifying the timer, validate that its associated knote in the kernel has actually been deactivated. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/kqueue/t_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: thorpej Date: Fri Oct 22 13:53:20 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_timer.c Log Message: In the "modify" test case, immediately after modifying the timer, validate that its associated knote in the kernel has actually been deactivated. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/kqueue/t_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/t_timer.c diff -u src/tests/kernel/kqueue/t_timer.c:1.2 src/tests/kernel/kqueue/t_timer.c:1.3 --- src/tests/kernel/kqueue/t_timer.c:1.2 Fri Oct 22 04:49:24 2021 +++ src/tests/kernel/kqueue/t_timer.c Fri Oct 22 13:53:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_timer.c,v 1.2 2021/10/22 04:49:24 thorpej Exp $ */ +/* $NetBSD: t_timer.c,v 1.3 2021/10/22 13:53:20 thorpej Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_timer.c,v 1.2 2021/10/22 04:49:24 thorpej Exp $"); +__RCSID("$NetBSD: t_timer.c,v 1.3 2021/10/22 13:53:20 thorpej Exp $"); #include #include @@ -208,6 +208,12 @@ ATF_TC_BODY(modify, tc) EV_SET([0], 1, EVFILT_TIMER, EV_ADD, 0, 4000, NULL); ATF_REQUIRE(kevent(kq, event, 1, NULL, 0, NULL) == 0); + /* + * Before we sleep, verify that the knote for this timer is + * no longer activated. + */ + ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, ) == 0); + sleepts.tv_sec = 5; sleepts.tv_nsec = 0; ATF_REQUIRE(nanosleep(, NULL) == 0);
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: thorpej Date: Wed Oct 20 14:33:14 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_vnode.c Log Message: Add a test case for PR kern/56460. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/kqueue/t_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/t_vnode.c diff -u src/tests/kernel/kqueue/t_vnode.c:1.2 src/tests/kernel/kqueue/t_vnode.c:1.3 --- src/tests/kernel/kqueue/t_vnode.c:1.2 Wed Oct 20 03:08:19 2021 +++ src/tests/kernel/kqueue/t_vnode.c Wed Oct 20 14:33:14 2021 @@ -671,6 +671,53 @@ ATF_TC_CLEANUP(interest, tc) (void)unlink(testfile); } +ATF_TC_WITH_CLEANUP(rename_over_self_hardlink); +ATF_TC_HEAD(rename_over_self_hardlink, tc) +{ + atf_tc_set_md_var(tc, "descr", "This test case tests " + "renaming a file over a hard-link to itself"); +} +ATF_TC_BODY(rename_over_self_hardlink, tc) +{ + struct kevent event[2], *dir_ev, *file_ev; + int dir_fd, file_fd; + + ATF_REQUIRE((kq = kqueue()) != -1); + + ATF_REQUIRE((mkdir(dir_target, 0700)) == 0); + ATF_REQUIRE((dir_fd = open(dir_target, O_RDONLY)) != -1); + + ATF_REQUIRE((file_fd = open(file_inside1, O_RDONLY | O_CREAT, + 0600)) != -1); + ATF_REQUIRE(link(file_inside1, file_inside2) == 0); + + EV_SET([0], dir_fd, EVFILT_VNODE, EV_ADD, + NOTE_WRITE | NOTE_EXTEND | NOTE_LINK, 0, NULL); + EV_SET([1], file_fd, EVFILT_VNODE, EV_ADD, + NOTE_LINK | NOTE_DELETE, 0, NULL); + ATF_REQUIRE(kevent(kq, event, 2, NULL, 0, NULL) == 0); + + ATF_REQUIRE(rename(file_inside1, file_inside2) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, event, 2, ) == 2); + ATF_REQUIRE(event[0].ident == (uintptr_t)dir_fd || + event[0].ident == (uintptr_t)file_fd); + ATF_REQUIRE(event[1].ident == (uintptr_t)dir_fd || + event[1].ident == (uintptr_t)file_fd); + if (event[0].ident == (uintptr_t)dir_fd) { + dir_ev = [0]; + file_ev = [1]; + } else { + dir_ev = [1]; + file_ev = [0]; + } + ATF_REQUIRE(dir_ev->fflags == NOTE_WRITE); + ATF_REQUIRE(file_ev->fflags == NOTE_LINK); +} +ATF_TC_CLEANUP(rename_over_self_hardlink, tc) +{ + cleanup(); +} ATF_TP_ADD_TCS(tp) { @@ -699,6 +746,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, dir_note_write_mv_file_out); ATF_TP_ADD_TC(tp, dir_note_write_mv_file_within); + ATF_TP_ADD_TC(tp, rename_over_self_hardlink); + ATF_TP_ADD_TC(tp, open_write_read_close); ATF_TP_ADD_TC(tp, interest);
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: thorpej Date: Wed Oct 20 14:33:14 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_vnode.c Log Message: Add a test case for PR kern/56460. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/kqueue/t_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: wiz Date: Sun Oct 10 19:17:32 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_scan.c Log Message: Fix typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/kqueue/t_scan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/t_scan.c diff -u src/tests/kernel/kqueue/t_scan.c:1.1 src/tests/kernel/kqueue/t_scan.c:1.2 --- src/tests/kernel/kqueue/t_scan.c:1.1 Sun Oct 10 17:47:39 2021 +++ src/tests/kernel/kqueue/t_scan.c Sun Oct 10 19:17:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_scan.c,v 1.1 2021/10/10 17:47:39 thorpej Exp $ */ +/* $NetBSD: t_scan.c,v 1.2 2021/10/10 19:17:31 wiz Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_scan.c,v 1.1 2021/10/10 17:47:39 thorpej Exp $"); +__RCSID("$NetBSD: t_scan.c,v 1.2 2021/10/10 19:17:31 wiz Exp $"); #include #include @@ -44,7 +44,7 @@ __RCSID("$NetBSD: t_scan.c,v 1.1 2021/10 /* * Each kevent thread will make this many kevent() calls, and if it * achieves this mark, we assume the race condition has not occurred - * the delcare the test passes. + * the declare the test passes. */ #define NKEVENT_CALLS 1
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: wiz Date: Sun Oct 10 19:17:32 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_scan.c Log Message: Fix typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/kqueue/t_scan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: thorpej Date: Sun Oct 10 18:11:31 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_sig.c Log Message: The knotes for EVFILT_SIGNAL and EVFILT_PROC are maintained on a single per-process list, and kern_event.c,v 1.129 has several KASSERT()s in various code paths that process this list related to the mixing of these two knote types. This new unit test is designed specifically to exercise those KASSERT()s and thus validate their assumptions. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/t_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/t_sig.c diff -u src/tests/kernel/kqueue/t_sig.c:1.3 src/tests/kernel/kqueue/t_sig.c:1.4 --- src/tests/kernel/kqueue/t_sig.c:1.3 Fri Jan 13 21:30:41 2017 +++ src/tests/kernel/kqueue/t_sig.c Sun Oct 10 18:11:31 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ +/* $NetBSD: t_sig.c,v 1.4 2021/10/10 18:11:31 thorpej Exp $ */ /*- - * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. + * Copyright (c) 2002, 2008, 2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); +__RCSID("$NetBSD: t_sig.c,v 1.4 2021/10/10 18:11:31 thorpej Exp $"); #include #include @@ -125,9 +125,87 @@ ATF_TC_BODY(sig, tc) (void)printf("sig: finished successfully\n"); } +/* + * This test case exercises code paths in the kernel that KASSERT() + * some assumptions about EVFILT_SIGNAL and EVFILT_PROC implementation + * details. + */ +ATF_TC(sig_and_proc); +ATF_TC_HEAD(sig_and_proc, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Validates implementation detail assumptions about " + "EVFILT_SIGNAL and EVFILT_PROC"); +} +ATF_TC_BODY(sig_and_proc, tc) +{ + struct kevent events[3]; + pid_t pid; + int kq; + + pid = fork(); + ATF_REQUIRE(pid != -1); + + if (pid == 0) { + /* + * Child: create a kqueue and attach signal knotes + * to curproc->p_klist. + */ + kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + ATF_REQUIRE(signal(SIGUSR1, SIG_IGN) != SIG_ERR); + ATF_REQUIRE(signal(SIGUSR2, SIG_IGN) != SIG_ERR); + + EV_SET([0], SIGUSR1, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); + EV_SET([1], SIGUSR2, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); + + ATF_REQUIRE(kevent(kq, events, 2, [2], 1, NULL) == 1); + ATF_REQUIRE(events[2].filter == EVFILT_SIGNAL); + ATF_REQUIRE(events[2].ident == SIGUSR1); + + /* + * When we exit here, the kernel will close all of + * its file descriptors (including our kq), which + * will in turn remove the signal notes from + * curproc->p_klist. + * + * Then, later on, the kernel will post a NOTE_EXIT + * on our parent's kqueue using the proc note that + * our parent attached to (our) curproc->p_klist. + * That code path KASSERT()s that the signal knotes + * have already been removed. + */ + _exit(0); + } + + /* + * Parent: create a kqueue and attach a proc note to + * child->p_klist. + */ + kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + EV_SET([0], pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL); + + ATF_REQUIRE(kevent(kq, events, 1, NULL, 0, NULL) == 0); + + /* Ensure we never see stale data. */ + memset(events, 0, sizeof(events)); + + /* Signal child to exit. */ + ATF_REQUIRE(kill(pid, SIGUSR1) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, events, 1, NULL) == 1); + ATF_REQUIRE(events[0].filter == EVFILT_PROC); + ATF_REQUIRE(events[0].ident == (uintptr_t)pid); + ATF_REQUIRE(events[0].fflags = NOTE_EXIT); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, sig); + ATF_TP_ADD_TC(tp, sig_and_proc); return atf_no_error(); }
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: thorpej Date: Sun Oct 10 18:11:31 UTC 2021 Modified Files: src/tests/kernel/kqueue: t_sig.c Log Message: The knotes for EVFILT_SIGNAL and EVFILT_PROC are maintained on a single per-process list, and kern_event.c,v 1.129 has several KASSERT()s in various code paths that process this list related to the mixing of these two knote types. This new unit test is designed specifically to exercise those KASSERT()s and thus validate their assumptions. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/t_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue/read
Module Name:src Committed By: thorpej Date: Sat Oct 2 18:21:05 UTC 2021 Modified Files: src/tests/kernel/kqueue/read: t_fifo.c Log Message: New EVFILT_READ test case for FIFOs; validates readability threshold and EV_EOF behavior. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/read/t_fifo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue/read
Module Name:src Committed By: thorpej Date: Sat Oct 2 18:21:05 UTC 2021 Modified Files: src/tests/kernel/kqueue/read: t_fifo.c Log Message: New EVFILT_READ test case for FIFOs; validates readability threshold and EV_EOF behavior. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/read/t_fifo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/read/t_fifo.c diff -u src/tests/kernel/kqueue/read/t_fifo.c:1.4 src/tests/kernel/kqueue/read/t_fifo.c:1.5 --- src/tests/kernel/kqueue/read/t_fifo.c:1.4 Fri Jan 13 21:30:41 2017 +++ src/tests/kernel/kqueue/read/t_fifo.c Sat Oct 2 18:21:05 2021 @@ -1,11 +1,11 @@ -/* $NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */ +/* $NetBSD: t_fifo.c,v 1.5 2021/10/02 18:21:05 thorpej Exp $ */ /*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. + * Copyright (c) 2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Luke Mewburn and Jaromir Dolecek. + * by Jason R. Thorpe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,13 +30,14 @@ */ #include -__COPYRIGHT("@(#) Copyright (c) 2008\ +__COPYRIGHT("@(#) Copyright (c) 2021\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $"); +__RCSID("$NetBSD: t_fifo.c,v 1.5 2021/10/02 18:21:05 thorpej Exp $"); #include #include +#include #include #include #include @@ -46,48 +47,94 @@ __RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01 #include -#include "h_macros.h" +static const char fifo_path[] = "fifo"; -#define FIFONAME "fifo" +static void +fifo_support(void) +{ + errno = 0; + if (mkfifo(fifo_path, 0600) == 0) { + ATF_REQUIRE(unlink(fifo_path) == 0); + return; + } + + if (errno == EOPNOTSUPP) { + atf_tc_skip("the kernel does not support FIFOs"); + } else { + atf_tc_fail("mkfifo(2) failed"); + } +} -ATF_TC(fifo); +ATF_TC_WITH_CLEANUP(fifo); ATF_TC_HEAD(fifo, tc) { atf_tc_set_md_var(tc, "descr", "Checks EVFILT_READ on fifo"); } ATF_TC_BODY(fifo, tc) { - int kq, n, fd; + const struct timespec to = { 0, 0 }; struct kevent event[1]; - char buffer[128]; - - RL(mkfifo(FIFONAME, 0644)); - RL(fd = open(FIFONAME, O_RDWR, 0644)); - - RL(kq = kqueue()); - - EV_SET([0], fd, EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, 0); - RL(kevent(kq, event, 1, NULL, 0, NULL)); - - /* make sure there is something in the fifo */ - RL(write(fd, "foo", 3)); - (void)printf("fifo: wrote 'foo'\n"); - - (void)memset(event, 0, sizeof(event)); - - RL(n = kevent(kq, NULL, 0, event, 1, NULL)); - - (void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, " - "data: %" PRId64 "\n", n, event[0].filter, event[0].flags, - event[0].fflags, event[0].data); - - ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ); - - RL(n = read(fd, buffer, event[0].data)); - buffer[n] = '\0'; - (void)printf("fifo: read '%s'\n", buffer); + char *buf; + int rfd, wfd, kq; + long pipe_buf; + + fifo_support(); + + ATF_REQUIRE(mkfifo(fifo_path, 0600) == 0); + ATF_REQUIRE((rfd = open(fifo_path, O_RDONLY | O_NONBLOCK)) >= 0); + ATF_REQUIRE((wfd = open(fifo_path, O_WRONLY | O_NONBLOCK)) >= 0); + ATF_REQUIRE((kq = kqueue()) >= 0); + + /* Get the maximum atomic pipe write size. */ + pipe_buf = fpathconf(wfd, _PC_PIPE_BUF); + ATF_REQUIRE(pipe_buf > 1); + + buf = malloc(pipe_buf); + ATF_REQUIRE(buf != NULL); + + EV_SET([0], rfd, EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, 0); + ATF_REQUIRE(kevent(kq, event, 1, NULL, 0, NULL) == 0); + + /* We expect the FIFO to not be readable. */ + ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, ) == 0); + + /* Write a single byte of data into the FIFO. */ + ATF_REQUIRE(write(wfd, buf, 1) == 1); + + /* We expect the FIFO to be readable. */ + ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, ) == 1); + ATF_REQUIRE(event[0].ident == (uintptr_t)rfd); + ATF_REQUIRE(event[0].filter == EVFILT_READ); + ATF_REQUIRE((event[0].flags & EV_EOF) == 0); + + /* Read that single byte back out. */ + ATF_REQUIRE(read(rfd, buf, 1) == 1); + + /* We expect the FIFO to not be readable. */ + ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, ) == 0); + + /* Close the writer. We expect to get EV_EOF. */ + (void)close(wfd); + ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, ) == 1); + ATF_REQUIRE(event[0].ident == (uintptr_t)rfd); + ATF_REQUIRE(event[0].filter == EVFILT_READ); + ATF_REQUIRE((event[0].flags & EV_EOF) != 0); + + /* + * Reconect the writer. We expect EV_EOF to be cleared and + * for the FIFO to no longer be readable once again. + */ + ATF_REQUIRE((wfd = open(fifo_path, O_WRONLY | O_NONBLOCK)) >= 0); + ATF_REQUIRE(kevent(kq, NULL, 0, event, 1, ) == 0); + + (void)close(wfd); + (void)close(rfd); + (void)close(kq); +} - RL(close(fd));
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: christos Date: Sat Oct 31 14:57:02 UTC 2020 Modified Files: src/tests/kernel/kqueue: t_ioctl.c Log Message: Avoid hard-coding names and limits so this will not break again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/t_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/t_ioctl.c diff -u src/tests/kernel/kqueue/t_ioctl.c:1.4 src/tests/kernel/kqueue/t_ioctl.c:1.5 --- src/tests/kernel/kqueue/t_ioctl.c:1.4 Tue Jan 9 12:35:29 2018 +++ src/tests/kernel/kqueue/t_ioctl.c Sat Oct 31 10:57:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ioctl.c,v 1.4 2018/01/09 17:35:29 martin Exp $ */ +/* $NetBSD: t_ioctl.c,v 1.5 2020/10/31 14:57:02 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,8 +32,9 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_ioctl.c,v 1.4 2018/01/09 17:35:29 martin Exp $"); +__RCSID("$NetBSD: t_ioctl.c,v 1.5 2020/10/31 14:57:02 christos Exp $"); +#define EVFILT_NAMES #include #include @@ -61,13 +62,13 @@ ATF_TC_BODY(kfilter_byfilter, tc) km.name = buf; km.len = sizeof(buf) - 1; - for (i = 0; i < 8; ++i) { + for (i = 0; i < EVFILT_SYSCOUNT; ++i) { km.filter = i; RL(ioctl(kq, KFILTER_BYFILTER, )); (void)printf(" map %d -> %s\n", km.filter, km.name); } - km.filter = 8; + km.filter = EVFILT_SYSCOUNT; ATF_REQUIRE_EQ(ioctl(kq, KFILTER_BYFILTER, ), -1); } @@ -78,28 +79,16 @@ ATF_TC_HEAD(kfilter_byname, tc) } ATF_TC_BODY(kfilter_byname, tc) { - const char *tests[] = { - "EVFILT_READ", - "EVFILT_WRITE", - "EVFILT_AIO", - "EVFILT_VNODE", - "EVFILT_PROC", - "EVFILT_SIGNAL", - "EVFILT_TIMER", - "EVFILT_FS", - NULL - }; char buf[32]; struct kfilter_mapping km; - const char **test; int kq; RL(kq = kqueue()); km.name = buf; - for (test = [0]; *test != NULL; ++test) { - (void)strlcpy(buf, *test, sizeof(buf)); + for (size_t i = 0; i < EVFILT_SYSCOUNT; i++) { + (void)strlcpy(buf, evfiltnames[i], sizeof(buf)); RL(ioctl(kq, KFILTER_BYNAME, )); (void)printf(" map %s -> %d\n", km.name, km.filter); }
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: christos Date: Sat Oct 31 14:57:02 UTC 2020 Modified Files: src/tests/kernel/kqueue: t_ioctl.c Log Message: Avoid hard-coding names and limits so this will not break again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/t_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: martin Date: Tue Jan 9 17:35:29 UTC 2018 Modified Files: src/tests/kernel/kqueue: t_ioctl.c Log Message: Add EVFILT_FS To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/t_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: martin Date: Tue Jan 9 17:35:29 UTC 2018 Modified Files: src/tests/kernel/kqueue: t_ioctl.c Log Message: Add EVFILT_FS To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/t_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/t_ioctl.c diff -u src/tests/kernel/kqueue/t_ioctl.c:1.3 src/tests/kernel/kqueue/t_ioctl.c:1.4 --- src/tests/kernel/kqueue/t_ioctl.c:1.3 Fri Jan 13 21:30:41 2017 +++ src/tests/kernel/kqueue/t_ioctl.c Tue Jan 9 17:35:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ +/* $NetBSD: t_ioctl.c,v 1.4 2018/01/09 17:35:29 martin Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); +__RCSID("$NetBSD: t_ioctl.c,v 1.4 2018/01/09 17:35:29 martin Exp $"); #include #include @@ -61,13 +61,13 @@ ATF_TC_BODY(kfilter_byfilter, tc) km.name = buf; km.len = sizeof(buf) - 1; - for (i = 0; i < 7; ++i) { + for (i = 0; i < 8; ++i) { km.filter = i; RL(ioctl(kq, KFILTER_BYFILTER, )); (void)printf(" map %d -> %s\n", km.filter, km.name); } - km.filter = 7; + km.filter = 8; ATF_REQUIRE_EQ(ioctl(kq, KFILTER_BYFILTER, ), -1); } @@ -86,6 +86,7 @@ ATF_TC_BODY(kfilter_byname, tc) "EVFILT_PROC", "EVFILT_SIGNAL", "EVFILT_TIMER", + "EVFILT_FS", NULL }; char buf[32];
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: ryoon Date: Fri Apr 29 07:12:34 UTC 2016 Modified Files: src/tests/kernel/kqueue: Makefile Log Message: Tab alignment To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/Makefile diff -u src/tests/kernel/kqueue/Makefile:1.4 src/tests/kernel/kqueue/Makefile:1.5 --- src/tests/kernel/kqueue/Makefile:1.4 Wed Jan 14 22:22:32 2015 +++ src/tests/kernel/kqueue/Makefile Fri Apr 29 07:12:34 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2015/01/14 22:22:32 christos Exp $ +# $NetBSD: Makefile,v 1.5 2016/04/29 07:12:34 ryoon Exp $ WARNS?=6 NOMAN= # defined @@ -7,7 +7,7 @@ NOMAN= # defined TESTSDIR= ${TESTSBASE}/kernel/kqueue -TESTS_SUBDIRS= read +TESTS_SUBDIRS= read TESTS_SUBDIRS+= write TESTS_C= t_ioctl
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: ryoon Date: Fri Apr 29 07:12:34 UTC 2016 Modified Files: src/tests/kernel/kqueue: Makefile Log Message: Tab alignment To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/kqueue/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: christos Date: Wed Jan 14 22:22:14 UTC 2015 Added Files: src/tests/kernel/kqueue: t_vnode.c Log Message: PR/48958: rudolf: EVFILT_VNODE filter miscounting hardlinks (add test) To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/kernel/kqueue/t_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/kernel/kqueue/t_vnode.c diff -u /dev/null src/tests/kernel/kqueue/t_vnode.c:1.1 --- /dev/null Wed Jan 14 17:22:14 2015 +++ src/tests/kernel/kqueue/t_vnode.c Wed Jan 14 17:22:14 2015 @@ -0,0 +1,533 @@ +#include sys/event.h +#include sys/stat.h +#include sys/time.h +#include fcntl.h +#include stdio.h +#include unistd.h + +#include atf-c.h + +/* + * Test cases for events triggered by manipulating a target directory + * content. Using EVFILT_VNODE filter on the target directory descriptor. + * + */ + +static const char *dir_target = foo; +static const char *dir_inside1 = foo/bar1; +static const char *dir_inside2 = foo/bar2; +static const char *dir_outside = bar; +static const char *file_inside1 = foo/baz1; +static const char *file_inside2 = foo/baz2; +static const char *file_outside = qux; +static const struct timespec ts = {0, 0}; +static int kq = -1; +static int target = -1; + +int init_target(void); +int init_kqueue(void); +int create_file(const char *); +void cleanup(void); + +int +init_target(void) +{ + if (mkdir(dir_target, S_IRWXU) 0) { + return -1; + } + target = open(dir_target, O_RDONLY, 0); + return target; +} + +int +init_kqueue(void) +{ + struct kevent eventlist[1]; + + kq = kqueue(); + if (kq 0) { + return -1; + } + EV_SET(eventlist[0], (uintptr_t)target, EVFILT_VNODE, + EV_ADD | EV_ONESHOT, NOTE_DELETE | + NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | + NOTE_LINK | NOTE_RENAME | NOTE_REVOKE, 0, 0); + return kevent(kq, eventlist, 1, NULL, 0, NULL); +} + +int +create_file(const char *file) +{ + int fd; + + fd = open(file, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + if (fd 0) { + return -1; + } + return close(fd); +} + +void +cleanup(void) +{ + (void)unlink(file_inside1); + (void)unlink(file_inside2); + (void)unlink(file_outside); + (void)rmdir(dir_inside1); + (void)rmdir(dir_inside2); + (void)rmdir(dir_outside); + (void)rmdir(dir_target); + (void)close(kq); + (void)close(target); +} + +ATF_TC_WITH_CLEANUP(dir_no_note_link_create_file_in); +ATF_TC_HEAD(dir_no_note_link_create_file_in, tc) +{ + atf_tc_set_md_var(tc, descr, This test case ensures + that kevent(2) does not return NOTE_LINK for the directory + 'foo' if a file 'foo/baz' is created.); +} +ATF_TC_BODY(dir_no_note_link_create_file_in, tc) +{ + struct kevent changelist[1]; + + ATF_REQUIRE(init_target() != -1); + ATF_REQUIRE(init_kqueue() != -1); + + ATF_REQUIRE(create_file(file_inside1) != -1); + ATF_REQUIRE(kevent(kq, NULL, 0, changelist, 1, ts) != -1); + ATF_CHECK_EQ(changelist[0].fflags NOTE_LINK, 0); +} +ATF_TC_CLEANUP(dir_no_note_link_create_file_in, tc) +{ + cleanup(); +} + +ATF_TC_WITH_CLEANUP(dir_no_note_link_delete_file_in); +ATF_TC_HEAD(dir_no_note_link_delete_file_in, tc) +{ + atf_tc_set_md_var(tc, descr, This test case ensures + that kevent(2) does not return NOTE_LINK for the directory + 'foo' if a file 'foo/baz' is deleted.); +} +ATF_TC_BODY(dir_no_note_link_delete_file_in, tc) +{ + struct kevent changelist[1]; + + ATF_REQUIRE(init_target() != -1); + ATF_REQUIRE(create_file(file_inside1) != -1); + ATF_REQUIRE(init_kqueue() != -1); + + ATF_REQUIRE(unlink(file_inside1) != -1); + ATF_REQUIRE(kevent(kq, NULL, 0, changelist, 1, ts) != -1); + ATF_CHECK_EQ(changelist[0].fflags NOTE_LINK, 0); +} +ATF_TC_CLEANUP(dir_no_note_link_delete_file_in, tc) +{ + cleanup(); +} + +ATF_TC_WITH_CLEANUP(dir_no_note_link_mv_dir_within); +ATF_TC_HEAD(dir_no_note_link_mv_dir_within, tc) +{ + atf_tc_set_md_var(tc, descr, This test case ensures + that kevent(2) does not return NOTE_LINK for the directory + 'foo' if a directory 'foo/bar' is renamed to 'foo/baz'.); +} +ATF_TC_BODY(dir_no_note_link_mv_dir_within, tc) +{ + struct kevent changelist[1]; + + ATF_REQUIRE(init_target() != -1); + ATF_REQUIRE(mkdir(dir_inside1, S_IRWXU) != -1); + ATF_REQUIRE(init_kqueue() != -1); + + ATF_REQUIRE(rename(dir_inside1, dir_inside2) != -1); + ATF_REQUIRE(kevent(kq, NULL, 0, changelist, 1, ts) != -1); + ATF_CHECK_EQ(changelist[0].fflags NOTE_LINK, 0); +} +ATF_TC_CLEANUP(dir_no_note_link_mv_dir_within, tc) +{ + cleanup(); +} + +ATF_TC_WITH_CLEANUP(dir_no_note_link_mv_file_within); +ATF_TC_HEAD(dir_no_note_link_mv_file_within, tc) +{ + atf_tc_set_md_var(tc, descr, This test case ensures + that kevent(2) does not return NOTE_LINK for the directory + 'foo' if a file 'foo/baz' is renamed to 'foo/qux'.); +} +ATF_TC_BODY(dir_no_note_link_mv_file_within, tc) +{ + struct kevent changelist[1]; + + ATF_REQUIRE(init_target() != -1); + ATF_REQUIRE(create_file(file_inside1) != -1); +
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: christos Date: Wed Jan 14 22:22:14 UTC 2015 Added Files: src/tests/kernel/kqueue: t_vnode.c Log Message: PR/48958: rudolf: EVFILT_VNODE filter miscounting hardlinks (add test) To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/kernel/kqueue/t_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: christos Date: Wed Jan 14 22:22:32 UTC 2015 Modified Files: src/tests/kernel/kqueue: Makefile t_ioctl.c t_proc1.c t_proc2.c t_proc3.c Log Message: bump warns. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/kqueue/t_ioctl.c \ src/tests/kernel/kqueue/t_proc1.c src/tests/kernel/kqueue/t_proc2.c \ src/tests/kernel/kqueue/t_proc3.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/kernel/kqueue/Makefile diff -u src/tests/kernel/kqueue/Makefile:1.3 src/tests/kernel/kqueue/Makefile:1.4 --- src/tests/kernel/kqueue/Makefile:1.3 Sat Nov 17 16:55:24 2012 +++ src/tests/kernel/kqueue/Makefile Wed Jan 14 17:22:32 2015 @@ -1,5 +1,6 @@ -# $NetBSD: Makefile,v 1.3 2012/11/17 21:55:24 joerg Exp $ +# $NetBSD: Makefile,v 1.4 2015/01/14 22:22:32 christos Exp $ +WARNS?=6 NOMAN= # defined .include bsd.own.mk @@ -14,5 +15,6 @@ TESTS_C+= t_proc1 TESTS_C+= t_proc2 TESTS_C+= t_proc3 TESTS_C+= t_sig +TESTS_C+= t_vnode .include bsd.test.mk Index: src/tests/kernel/kqueue/t_ioctl.c diff -u src/tests/kernel/kqueue/t_ioctl.c:1.1 src/tests/kernel/kqueue/t_ioctl.c:1.2 --- src/tests/kernel/kqueue/t_ioctl.c:1.1 Fri Feb 20 16:39:57 2009 +++ src/tests/kernel/kqueue/t_ioctl.c Wed Jan 14 17:22:32 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ioctl.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ +/* $NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: t_ioctl.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $); +__RCSID($NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $); #include sys/event.h #include sys/ioctl.h @@ -53,7 +53,8 @@ ATF_TC_BODY(kfilter_byfilter, tc) { char buf[32]; struct kfilter_mapping km; - int i, kq; + int kq; + uint32_t i; RL(kq = kqueue()); Index: src/tests/kernel/kqueue/t_proc1.c diff -u src/tests/kernel/kqueue/t_proc1.c:1.1 src/tests/kernel/kqueue/t_proc1.c:1.2 --- src/tests/kernel/kqueue/t_proc1.c:1.1 Fri Feb 20 16:39:57 2009 +++ src/tests/kernel/kqueue/t_proc1.c Wed Jan 14 17:22:32 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: t_proc1.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ +/* $NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: t_proc1.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $); +__RCSID($NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $); /* * this also used to trigger problem fixed in @@ -99,7 +99,8 @@ ATF_TC_BODY(proc1, tc) { struct kevent event[1]; pid_t pid; - int kq, want, status; + int kq, status; + u_int want; RL(kq = kqueue()); @@ -112,7 +113,7 @@ ATF_TC_BODY(proc1, tc) (void)sleep(1); /* give child some time to come up */ - event[0].ident = pid; + event[0].ident = (uintptr_t)pid; event[0].filter = EVFILT_PROC; event[0].flags = EV_ADD | EV_ENABLE; event[0].fflags = NOTE_EXIT | NOTE_FORK | NOTE_EXEC; /* | NOTE_TRACK;*/ Index: src/tests/kernel/kqueue/t_proc2.c diff -u src/tests/kernel/kqueue/t_proc2.c:1.1 src/tests/kernel/kqueue/t_proc2.c:1.2 --- src/tests/kernel/kqueue/t_proc2.c:1.1 Fri Feb 20 16:39:57 2009 +++ src/tests/kernel/kqueue/t_proc2.c Wed Jan 14 17:22:32 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: t_proc2.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ +/* $NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: t_proc2.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $); +__RCSID($NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $); #include sys/event.h #include sys/time.h @@ -106,7 +106,8 @@ ATF_TC_BODY(proc2, tc) /* NOTREACHED */ } - EV_SET(ke, pid, EVFILT_PROC, EV_ADD, NOTE_FORK|NOTE_TRACK, 0, 0); + EV_SET(ke, (uintptr_t)pid, EVFILT_PROC, EV_ADD, NOTE_FORK|NOTE_TRACK, + 0, 0); RL(kevent(kq, ke, 1, NULL, 0, timeout)); Index: src/tests/kernel/kqueue/t_proc3.c diff -u src/tests/kernel/kqueue/t_proc3.c:1.1 src/tests/kernel/kqueue/t_proc3.c:1.2 --- src/tests/kernel/kqueue/t_proc3.c:1.1 Sat Nov 17 16:55:24 2012 +++ src/tests/kernel/kqueue/t_proc3.c Wed Jan 14 17:22:32 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: t_proc3.c,v 1.1 2012/11/17 21:55:24 joerg Exp $ */ +/* $NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: t_proc3.c,v 1.1 2012/11/17
CVS commit: src/tests/kernel/kqueue
Module Name:src Committed By: christos Date: Wed Jan 14 22:22:32 UTC 2015 Modified Files: src/tests/kernel/kqueue: Makefile t_ioctl.c t_proc1.c t_proc2.c t_proc3.c Log Message: bump warns. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/kqueue/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/kqueue/t_ioctl.c \ src/tests/kernel/kqueue/t_proc1.c src/tests/kernel/kqueue/t_proc2.c \ src/tests/kernel/kqueue/t_proc3.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.