#define NOTE_EXEC 0x20000000 /* process exec'd */
#define NOTE_REAP ((unsigned int)eNoteReapDeprecated /* 0x10000000 */ ) /* process reaped */
#define NOTE_SIGNAL 0x08000000 /* shared with EVFILT_SIGNAL */
-#define NOTE_EXITSTATUS 0x04000000 /* exit status to be returned, valid for child process only */
+#define NOTE_EXITSTATUS 0x04000000 /* exit status to be returned, valid for child process or when allowed to signal target pid */
#define NOTE_EXIT_DETAIL 0x02000000 /* provide details on reasons for exit */
#define NOTE_PDATAMASK 0x000fffff /* mask for signal & exit status */
#ifdef XNU_KERNEL_PRIVATE
#include <sys/queue.h>
+#include <mach/vm_param.h>
#include <kern/kern_types.h>
#include <sys/fcntl.h> /* FREAD, FWRITE */
#include <kern/debug.h> /* panic */
KN_SUPPRESSED = 0x800, /* event is suppressed during delivery */
});
-#define KNOTE_KQ_BITSIZE 42
-_Static_assert(KNOTE_KQ_BITSIZE > VM_KERNEL_POINTER_SIGNIFICANT_BITS,
- "Make sure sign extending kn_kq_packed is legit");
+#if __LP64__
+#define KNOTE_KQ_PACKED_BITS 42
+#define KNOTE_KQ_PACKED_SHIFT 0
+#define KNOTE_KQ_PACKED_BASE 0
+#else
+#define KNOTE_KQ_PACKED_BITS 32
+#define KNOTE_KQ_PACKED_SHIFT 0
+#define KNOTE_KQ_PACKED_BASE 0
+#endif
+
+_Static_assert(!VM_PACKING_IS_BASE_RELATIVE(KNOTE_KQ_PACKED),
+ "Make sure the knote pointer packing is based on arithmetic shifts");
struct kqueue;
struct knote {
kn_vnode_kqok:1,
kn_vnode_use_ofst:1;
#if __LP64__
- intptr_t kn_kq_packed : KNOTE_KQ_BITSIZE;
+ uintptr_t kn_kq_packed : KNOTE_KQ_PACKED_BITS;
#else
- intptr_t kn_kq_packed;
+ uintptr_t kn_kq_packed;
#endif
/* per filter stash of data (pointer, uint32_t or uint64_t) */
static inline struct kqueue *
knote_get_kq(struct knote *kn)
{
- return (struct kqueue *)kn->kn_kq_packed;
+ return (struct kqueue *)VM_UNPACK_POINTER(kn->kn_kq_packed, KNOTE_KQ_PACKED);
}
static inline int
extern struct turnstile *kqueue_turnstile(struct kqueue *);
extern struct turnstile *kqueue_alloc_turnstile(struct kqueue *);
-int kevent_proc_copy_uptrs(void *proc, uint64_t *buf, int bufsize);
+int kevent_proc_copy_uptrs(void *proc, uint64_t *buf, uint32_t bufsize);
int kevent_copyout_proc_dynkqids(void *proc, user_addr_t ubuf,
uint32_t ubufsize, int32_t *nkqueues_out);
int kevent_copyout_dynkqinfo(void *proc, kqueue_id_t kq_id, user_addr_t ubuf,