-/* $OpenBSD: kern_event.c,v 1.198 2023/08/20 15:13:43 visa Exp $ */
+/* $OpenBSD: kern_event.c,v 1.199 2024/07/29 12:42:53 claudio Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
int filt_procattach(struct knote *kn);
void filt_procdetach(struct knote *kn);
int filt_proc(struct knote *kn, long hint);
+int filt_sigattach(struct knote *kn);
+void filt_sigdetach(struct knote *kn);
+int filt_signal(struct knote *kn, long hint);
int filt_fileattach(struct knote *kn);
void filt_timerexpire(void *knx);
int filt_timerattach(struct knote *kn);
.f_event = filt_proc,
};
+const struct filterops sig_filtops = {
+ .f_flags = 0,
+ .f_attach = filt_sigattach,
+ .f_detach = filt_sigdetach,
+ .f_event = filt_signal,
+};
+
const struct filterops file_filtops = {
.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
.f_attach = filt_fileattach,
return (kn->kn_fflags != 0);
}
+/*
+ * signal knotes are shared with proc knotes, so we apply a mask to
+ * the hint in order to differentiate them from process hints. This
+ * could be avoided by using a signal-specific knote list, but probably
+ * isn't worth the trouble.
+ */
+int
+filt_sigattach(struct knote *kn)
+{
+ struct process *pr = curproc->p_p;
+ int s;
+
+ if (kn->kn_id >= NSIG)
+ return EINVAL;
+
+ kn->kn_ptr.p_process = pr;
+ kn->kn_flags |= EV_CLEAR; /* automatically set */
+
+ s = splhigh();
+ klist_insert_locked(&pr->ps_klist, kn);
+ splx(s);
+
+ return (0);
+}
+
+void
+filt_sigdetach(struct knote *kn)
+{
+ struct process *pr = kn->kn_ptr.p_process;
+ int s;
+
+ s = splhigh();
+ klist_remove_locked(&pr->ps_klist, kn);
+ splx(s);
+}
+
+int
+filt_signal(struct knote *kn, long hint)
+{
+
+ if (hint & NOTE_SIGNAL) {
+ hint &= ~NOTE_SIGNAL;
+
+ if (kn->kn_id == hint)
+ kn->kn_data++;
+ }
+ return (kn->kn_data != 0);
+}
+
#define NOTE_TIMER_UNITMASK \
(NOTE_SECONDS|NOTE_MSECONDS|NOTE_USECONDS|NOTE_NSECONDS)
-/* $OpenBSD: kern_sig.c,v 1.335 2024/07/29 09:49:49 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.336 2024/07/29 12:42:53 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
int nosuidcoredump = 1;
-int filt_sigattach(struct knote *kn);
-void filt_sigdetach(struct knote *kn);
-int filt_signal(struct knote *kn, long hint);
-
-const struct filterops sig_filtops = {
- .f_flags = 0,
- .f_attach = filt_sigattach,
- .f_detach = filt_sigdetach,
- .f_event = filt_signal,
-};
-
/*
* The array below categorizes the signals and their default actions.
*/
}
}
-int
-filt_sigattach(struct knote *kn)
-{
- struct process *pr = curproc->p_p;
- int s;
-
- if (kn->kn_id >= NSIG)
- return EINVAL;
-
- kn->kn_ptr.p_process = pr;
- kn->kn_flags |= EV_CLEAR; /* automatically set */
-
- s = splhigh();
- klist_insert_locked(&pr->ps_klist, kn);
- splx(s);
-
- return (0);
-}
-
-void
-filt_sigdetach(struct knote *kn)
-{
- struct process *pr = kn->kn_ptr.p_process;
- int s;
-
- s = splhigh();
- klist_remove_locked(&pr->ps_klist, kn);
- splx(s);
-}
-
-/*
- * signal knotes are shared with proc knotes, so we apply a mask to
- * the hint in order to differentiate them from process hints. This
- * could be avoided by using a signal-specific knote list, but probably
- * isn't worth the trouble.
- */
-int
-filt_signal(struct knote *kn, long hint)
-{
-
- if (hint & NOTE_SIGNAL) {
- hint &= ~NOTE_SIGNAL;
-
- if (kn->kn_id == hint)
- kn->kn_data++;
- }
- return (kn->kn_data != 0);
-}
-
void
userret(struct proc *p)
{
-/* $OpenBSD: event.h,v 1.71 2023/08/20 15:13:43 visa Exp $ */
+/* $OpenBSD: event.h,v 1.72 2024/07/29 12:42:53 claudio Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
struct rwlock;
struct timespec;
-extern const struct filterops sig_filtops;
extern const struct filterops dead_filtops;
extern void kqpoll_init(unsigned int);