aboutsummaryrefslogtreecommitdiffstats
path: root/src/kqueue.c
diff options
context:
space:
mode:
authorPo Lu2024-06-23 12:49:45 +0800
committerPo Lu2024-06-23 12:49:45 +0800
commitcb7be6035eeb7165d6789bb62708a14607e84e5d (patch)
tree1e43a4de3c5ad9f7fea05a6fe6c4ba0d58515666 /src/kqueue.c
parent2b848a4e504319cce150000a2c3855f66d89714b (diff)
downloademacs-cb7be6035eeb7165d6789bb62708a14607e84e5d.tar.gz
emacs-cb7be6035eeb7165d6789bb62708a14607e84e5d.zip
Fix compilation on prerelease versions of Haiku
* src/kqueue.c (Fkqueue_add_watch): Don't specify EV_ENABLE unless it is defined.
Diffstat (limited to 'src/kqueue.c')
-rw-r--r--src/kqueue.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/kqueue.c b/src/kqueue.c
index 4693e130208..aabaab6c8c3 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -444,23 +444,29 @@ only when the upper directory of the renamed file is watched. */)
444 if (! NILP (Fmember (Qrevoke, flags))) fflags |= NOTE_REVOKE; 444 if (! NILP (Fmember (Qrevoke, flags))) fflags |= NOTE_REVOKE;
445 445
446 /* Register event. */ 446 /* Register event. */
447 EV_SET (&kev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, 447 EV_SET (&kev, fd, EVFILT_VNODE, (EV_ADD
448#ifdef EV_ENABLE
449 | EV_ENABLE
450#endif /* EV_ENABLE */
451 | EV_CLEAR),
448 fflags, 0, NULL); 452 fflags, 0, NULL);
449 453
450 if (kevent (kqueuefd, &kev, 1, NULL, 0, NULL) < 0) { 454 if (kevent (kqueuefd, &kev, 1, NULL, 0, NULL) < 0)
451 emacs_close (fd); 455 {
452 report_file_error ("Cannot watch file", file); 456 emacs_close (fd);
453 } 457 report_file_error ("Cannot watch file", file);
458 }
454 459
455 /* Store watch object in watch list. */ 460 /* Store watch object in watch list. */
456 Lisp_Object watch_descriptor = make_fixnum (fd); 461 Lisp_Object watch_descriptor = make_fixnum (fd);
457 if (NILP (Ffile_directory_p (file))) 462 if (NILP (Ffile_directory_p (file)))
458 watch_object = list4 (watch_descriptor, file, flags, callback); 463 watch_object = list4 (watch_descriptor, file, flags, callback);
459 else { 464 else
460 dir_list = directory_files_internal (file, Qnil, Qnil, Qnil, true, Qnil, 465 {
461 Qnil); 466 dir_list = directory_files_internal (file, Qnil, Qnil, Qnil, true, Qnil,
462 watch_object = list5 (watch_descriptor, file, flags, callback, dir_list); 467 Qnil);
463 } 468 watch_object = list5 (watch_descriptor, file, flags, callback, dir_list);
469 }
464 watch_list = Fcons (watch_object, watch_list); 470 watch_list = Fcons (watch_object, watch_list);
465 471
466 return watch_descriptor; 472 return watch_descriptor;
@@ -486,11 +492,12 @@ WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. */)
486 /* Remove watch descriptor from watch list. */ 492 /* Remove watch descriptor from watch list. */
487 watch_list = Fdelq (watch_object, watch_list); 493 watch_list = Fdelq (watch_object, watch_list);
488 494
489 if (NILP (watch_list) && (kqueuefd >= 0)) { 495 if (NILP (watch_list) && (kqueuefd >= 0))
490 delete_read_fd (kqueuefd); 496 {
491 emacs_close (kqueuefd); 497 delete_read_fd (kqueuefd);
492 kqueuefd = -1; 498 emacs_close (kqueuefd);
493 } 499 kqueuefd = -1;
500 }
494 501
495 return Qt; 502 return Qt;
496} 503}