David van Moolenbroek 910831cb5c PM: generic process event publish/subscribe system
Now that there are services other than PM and VFS that implement
userland system calls directly, these services may need to know about
events related to user processes.  In particular, signal delivery may
have to interrupt blocking system calls, and certain cleanup tasks may
have to be performed after a user process exits.

This patch aims to implement a generic, lasting solution for this
problem, by allowing services to subscribe to "signal delivered"
and/or "process exit" events from PM.  PM publishes such events by
sending messages to its subscribed services, which must then reply an
acknowledgment message.

For now, only the two aforementioned events are implemented, and only
the IPC service makes use of the process event facility.

The new process event publish/subscribe system replaces the previous
VM notify-sig/watch-exit/query-exit system, which was unsound: 1) it
allowed subscription to events from individual processes, and suffered
from fundamental race conditions as a result; 2) it relied on "not too
many" processes making use of the IPC server functionality in order to
avoid loss of notifications.  In addition, it had the "ipc" process
name hardcoded, did not distinguish between signal delivery and exits,
and added a roundtrip to VM for all events from all processes.

Change-Id: I75ebad4bc54e646c6433f473294cb4003b2c3430
2016-01-16 14:04:10 +01:00

22 lines
857 B
C

/* Constants used by the Process Manager. */
#define NR_PIDS 30000 /* process ids range from 0 to NR_PIDS-1.
* (magic constant: some old applications use
* a 'short' instead of pid_t.)
*/
#define NO_PID 0 /* pid value indicating no process */
#define INIT_PID 1 /* INIT's process id number */
#define NO_TRACER 0 /* process is not being traced */
#define NO_EVENTSUB ((char)-1) /* no current process event subscriber */
#define MAX_CLOCK_T ((unsigned long) 1 << ((sizeof(clock_t) * 8) - 1))
#define MAX_SECS ( (clock_t) (MAX_CLOCK_T/system_hz) )
/* max.secs for setitimer() ((2^31-1)/HZ) */
#define NR_ITIMERS 3 /* number of supported interval timers */
#define SEND_PRIORITY 1 /* send current priority queue to scheduler */
#define SEND_TIME_SLICE 2 /* send current time slice to scheduler */