]> git.saurik.com Git - apple/system_cmds.git/blob - mach_init.tproj/Notes
system_cmds-175.tar.gz
[apple/system_cmds.git] / mach_init.tproj / Notes
1 # gvdl@next 3 Aug 1995
2 # Need to get the bootstrap .defs stuff working properly
3
4 Format of /etc/bootstrap.conf
5
6 [[restartable] (server|init) "SERVER_PATH ARGS"] [services { SERVICE_NAME
7 [, SERVICE_NAME]* }]
8
9 struct service {
10 struct service *next;
11 struct service *prev;
12 char *name;
13 port_t port;
14 struct server *server;
15 struct service *server_link;
16 };
17
18 struct server {
19 struct server *next;
20 struct server *prev;
21 boolean_t restartable;
22 boolean_t isEtcInit;
23 char **argv;
24 struct service *services;
25 };
26
27 Service entries create service-port pairs. Lookup rpc's return send rights. Checkin rpc's return all rights. Checkin's can only be done from "privileged" bootstrap ports (see server, below). Bootstrap is the default backup for service ports, if bootstrap receives the port back, it holds onto all rights (to give out on a later checkin), and marks the service inactive. Lookup's on inactive services continue to return the service port. Lookup's on unregistered services return PORT_NULL.
28
29 Server entries initiate server tasks. Server tasks receive a privileged bootstrap port that allows the server task to register new service-port pairs and perform checkin's. Servers can obtain an unprivileged lookup/status-only port with an rpc; that port should be passed to untrusted progeny. Servers are initiated in the order that they appear in bootstrap.conf. Restartable servers are re-initiated if port destroyed or port deleted notification is received for all of the service ports declared by that server in bootstrap.conf. On restart, a server may reobtain receive rights for service ports that were returned to bootstrap via the port backup mechanism. New ports for are created for declared service ports without back-up when bootstrap receives a port deleted notification. If bootstrap receives a port deleted notification for a registered, but undeclared service port, further lookups on that name return PORT_NULL. Runtime registered ports are not associated with a server and are not involved in restart determination. Rights for registered ports that specify bootstrap as backup will be held and may later be transfered to a new server instantiation via the checkin. Should a new server instantiation re-register the service, the port and associated receive rights will be deallocated.
30
31 There may only be a single init entry; it is a special server entry and provides a (hack) mechanism to allow /etc/init to be exec'ed as pid 1. In the longer run, bootstrap should take over system shutdown/reconfig responsibilities and this won't be necessary.
32
33 As a compatability hack, the initial version of bootstrap will initialize the ports inherited on task_create() via mach_ports_register(). Existing services utilizing service_checkin() will have to be modified to use bootstrap_checkin().
34
35 Bootstrap rpc's:
36
37 bootstrap_checkin(port_t priv_bootstrap_port, char *service_name,
38 port *service_port);
39
40 Returns receive rights in service_port for service named by service_name.
41 FIXME: Success/Failure indication???
42
43 bootstrap_register(port_t priv_bootstrap_port, char *service_name,
44 port service_port);
45
46 Registers service_name -- service_port pair.
47 FIXME: Success/Failure indication???
48
49 bootstrap_checkout(port_t priv_bootstrap_port, char *service_name);
50
51 Removes registration for service named by service_name.
52 Fails is service is currently active.
53 FIXME: Success/Failure indication???
54
55 bootstrap_lookup(port_t bootstrap_port, char *service_name, port_t service_port);
56
57 Returns service port for service named by service_name.
58
59 bootstrap_lookup_array(port_t bootstrap_port, name_array_t service_names, port_array_t service_ports, int service_count);
60
61 Returns service ports for all services named in service_names array.
62
63 boostrap_status(port_t bootstrap_port, name_array_t service_names,
64 bool_array_t service_actives, int *service_count);
65
66 Returns names and active status for all known services.
67
68 bootstrap_get_unpriv_port(port_t bootstrap_port, port_t *unpriv_bootstrap_port);
69
70 Returns the unprivileged bootstrap service port.
71