Skip to content

Commit bac4a68

Browse files
committed
Only apple sets data to 1 on write events...
1 parent b45e2af commit bac4a68

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/linux/write.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ evfilt_write_copyout(struct kevent *dst, UNUSED int nevents, struct filter *filt
4141
/*
4242
* Fast path for files...
4343
*/
44-
if (src->kn_flags & KNFL_FILE) {
45-
dst->data = 1; /* To match macOS and FreeBSD */
46-
goto done;
47-
}
44+
if (src->kn_flags & KNFL_FILE) goto done;
4845

4946
if (ev->events & EPOLLHUP)
5047
dst->flags |= EV_EOF;

test/write.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ test_kevent_write_regular_file(struct test_context *ctx)
3636
kevent_rv_cmp(0, kevent(ctx->kqfd, &kev, 1, NULL, 0, NULL));
3737
kevent_get(ret, NUM_ELEMENTS(ret), ctx->kqfd, 1);
3838

39+
#ifdef __APPLE__
3940
/* macOS sets this high for some reason */
4041
kev.data = 1;
42+
#endif
4143

4244
/* File should appear immediately writable */
4345
kevent_get(NULL, 0, ctx->kqfd, 1);

0 commit comments

Comments
 (0)