diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -250,6 +250,7 @@ /* Make sure all thread destructors are executed */ EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td); } + osd_proc_exit(p); EVENTHANDLER_DIRECT_INVOKE(process_dtor, p); #ifdef KDTRACE_HOOKS kdtrace_proc_dtor(p); diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -96,9 +96,9 @@ "struct proc KBI p_pid"); _Static_assert(offsetof(struct proc, p_filemon) == 0x3c8, "struct proc KBI p_filemon"); -_Static_assert(offsetof(struct proc, p_comm) == 0x3e0, +_Static_assert(offsetof(struct proc, p_comm) == 0x400, "struct proc KBI p_comm"); -_Static_assert(offsetof(struct proc, p_emuldata) == 0x4d0, +_Static_assert(offsetof(struct proc, p_emuldata) == 0x4f0, "struct proc KBI p_emuldata"); #endif #ifdef __i386__ @@ -116,9 +116,9 @@ "struct proc KBI p_pid"); _Static_assert(offsetof(struct proc, p_filemon) == 0x270, "struct proc KBI p_filemon"); -_Static_assert(offsetof(struct proc, p_comm) == 0x284, +_Static_assert(offsetof(struct proc, p_comm) == 0x294, "struct proc KBI p_comm"); -_Static_assert(offsetof(struct proc, p_emuldata) == 0x318, +_Static_assert(offsetof(struct proc, p_emuldata) == 0x328, "struct proc KBI p_emuldata"); #endif diff --git a/sys/sys/osd.h b/sys/sys/osd.h --- a/sys/sys/osd.h +++ b/sys/sys/osd.h @@ -47,9 +47,10 @@ #define OSD_THREAD 0 #define OSD_JAIL 1 #define OSD_KHELP 2 +#define OSD_PROC 3 #define OSD_FIRST OSD_THREAD -#define OSD_LAST OSD_KHELP +#define OSD_LAST OSD_PROC typedef void (*osd_destructor_t)(void *value); typedef int (*osd_method_t)(void *obj, void *data); @@ -110,6 +111,23 @@ #define osd_jail_exit(pr) \ osd_exit(OSD_JAIL, &(pr)->pr_osd) +#define osd_proc_register(destructor) \ + osd_register(OSD_PROC, (destructor), NULL) +#define osd_proc_deregister(slot) \ + osd_deregister(OSD_PROC, (slot)) +#define osd_proc_set(p, slot, value) \ + osd_set(OSD_PROC, &(p)->p_osd, (slot), (value)) +#define osd_proc_get(p, slot) \ + osd_get(OSD_PROC, &(p)->p_osd, (slot)) +#define osd_proc_del(p, slot) do { \ + KASSERT((p) == curproc, ("Not curproc.")); \ + osd_del(OSD_PROC, &(p)->p_osd, (slot)); \ +} while (0) +#define osd_proc_call(p, method, data) \ + osd_call(OSD_PROC, (method), (p), (data)) +#define osd_proc_exit(p) \ + osd_exit(OSD_PROC, &(p)->p_osd) + #endif /* _KERNEL */ #endif /* !_SYS_OSD_H_ */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -715,6 +715,7 @@ u_int p_treeflag; /* (e) P_TREE flags */ int p_pendingexits; /* (c) Count of pending thread exits. */ struct filemon *p_filemon; /* (c) filemon-specific data. */ + struct osd p_osd; /* (c) Object specific data. */ int p_pdeathsig; /* (c) Signal from parent on exit. */ /* End area that is zeroed on creation. */ #define p_endzero p_magic