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

40 lines
868 B
C

#ifndef _VMPROC_H
#define _VMPROC_H 1
#include <minix/bitmap.h>
#include <machine/archtypes.h>
#include "pt.h"
#include "vm.h"
#include "regionavl.h"
struct vmproc;
struct vmproc {
int vm_flags;
endpoint_t vm_endpoint;
pt_t vm_pt; /* page table data */
struct boot_image *vm_boot; /* if boot time process */
/* Regions in virtual address space. */
region_avl vm_regions_avl;
vir_bytes vm_region_top; /* highest vaddr last inserted */
int vm_acl;
int vm_slot; /* process table slot */
#if VMSTATS
int vm_bytecopies;
#endif
vir_bytes vm_total;
vir_bytes vm_total_max;
u64_t vm_minor_page_fault;
u64_t vm_major_page_fault;
};
/* Bits for vm_flags */
#define VMF_INUSE 0x001 /* slot contains a process */
#define VMF_EXITING 0x002 /* PM is cleaning up this process */
#define VMF_VM_INSTANCE 0x010 /* This is a VM process instance */
#endif