Lines Matching +full:ch +full:- +full:func

1 /*-
41 /*-
48 * - Test read/write filters for listen/accept sockets.
49 * - Handle the XXXRW below regarding datagram sockets.
50 * - Test that watermark/buffer size "data" fields returned by kqueue are
52 * - Check that kqueue does something sensible when the remote endpoing is
56 #define OK(testname) printf("ok %d - %s\n", curtest, testname); \
60 fail(int error, const char *func, const char *socktype, const char *rest) in fail() argument
66 printf("# %s(): %s\n", func, strerror(error)); in fail()
68 printf("# %s(%s): %s\n", func, socktype, in fail()
71 printf("# %s(%s, %s): %s\n", func, socktype, rest, in fail()
73 exit(-1); in fail()
77 fail_assertion(const char *func, const char *socktype, const char *rest, in fail_assertion() argument
81 printf("not ok %d - %s\n", curtest, assertion); in fail_assertion()
84 printf("# %s(): assertion %s failed\n", func, in fail_assertion()
87 printf("# %s(%s): assertion %s failed\n", func, in fail_assertion()
90 printf("# %s(%s, %s): assertion %s failed\n", func, in fail_assertion()
92 exit(-1); in fail_assertion()
99 * again. Use non-blocking kqueue operations and socket operations.
107 char ch; in test_evfilt_read() local
111 if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1) in test_evfilt_read()
121 if (i == -1) in test_evfilt_read()
132 ch = 'a'; in test_evfilt_read()
133 len = write(fd[1], &ch, sizeof(ch)); in test_evfilt_read()
134 if (len == -1) in test_evfilt_read()
137 if (len != sizeof(ch)) in test_evfilt_read()
147 if (i == -1) in test_evfilt_read()
152 "non-empty socket unreadable"); in test_evfilt_read()
153 OK("non-empty socket unreadable"); in test_evfilt_read()
158 len = read(fd[0], &ch, sizeof(ch)); in test_evfilt_read()
159 if (len == -1) in test_evfilt_read()
162 if (len != sizeof(ch)) in test_evfilt_read()
167 * Now re-check for readability. in test_evfilt_read()
172 if (i == -1) in test_evfilt_read()
181 if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1) in test_evfilt_read()
192 char ch; in test_evfilt_write() local
196 if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1) in test_evfilt_write()
206 if (i == -1) in test_evfilt_write()
217 ch = 'a'; in test_evfilt_write()
218 while ((len = write(fd[0], &ch, sizeof(ch))) == sizeof(ch)) {}; in test_evfilt_write()
219 if (len == -1 && errno != EAGAIN && errno != ENOBUFS) in test_evfilt_write()
222 if (len != -1 && len != sizeof(ch)) in test_evfilt_write()
232 if (i == -1) in test_evfilt_write()
241 if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1) in test_evfilt_write()
258 if (kq == -1) in main()
266 if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sv) == -1) in main()
279 if (close(sv[0]) == -1) in main()
282 if (close(sv[1]) == -1) in main()
297 if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sv) == -1) in main()
307 if (close(sv[0]) == -1) in main()
309 if (close(sv[1]) == -1) in main()
317 if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) == -1) in main()
330 if (close(sv[0]) == -1) in main()
333 if (close(sv[1]) == -1) in main()
341 if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) == -1) in main()
354 if (close(sv[0]) == -1) in main()
357 if (close(sv[1]) == -1) in main()
361 if (close(kq) == -1) in main()