2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * bootstrap -- fundamental service initiator and port server
26 * Mike DeMoney, NeXT, Inc.
27 * Copyright, 1990. All rights reserved.
29 * lists.h -- interface to list routines
33 #import <mach/boolean.h>
34 #import <servers/bootstrap_defs.h>
37 #define NULL ((void *)0)
40 typedef struct bootstrap bootstrap_info_t
;
41 typedef struct service service_t
;
42 typedef struct server server_t
;
46 bootstrap_info_t
*next
; /* list of all bootstraps */
47 bootstrap_info_t
*prev
;
48 bootstrap_info_t
*parent
;
49 mach_port_name_t bootstrap_port
;
50 mach_port_name_t requestor_port
;
55 DECLARED
, /* Declared in config file */
56 REGISTERED
, /* Registered dynamically */
57 SELF
/* Name bound bootstrap service itself */
61 service_t
*next
; /* list of all services */
63 name_t name
; /* service name */
64 mach_port_name_t port
; /* service port,
65 may have all rights if inactive */
66 bootstrap_info_t
*bootstrap
; /* bootstrap port(s) used at this
68 boolean_t isActive
; /* server is running */
69 servicetype_t servicetype
; /* Declared, Registered, or Machport */
70 server_t
*server
; /* server, declared services only */
75 SERVER
, /* Launchable server */
76 RESTARTABLE
, /* Restartable server */
77 ETCINIT
, /* Special processing for /etc/init */
78 MACHINIT
/* mach_init doesn't get launched. */
81 #define NULL_SERVER NULL
85 server_t
*next
; /* list of all servers */
87 servertype_t servertype
;
88 cmd_t cmd
; /* server command to exec */
89 int priority
; /* priority to give server */
90 mach_port_t port
; /* server's priv bootstrap port */
91 mach_port_name_t task_port
; /* server's task port */
96 extern void init_lists(void);
97 extern server_t
*new_server(
98 servertype_t servertype
,
101 extern service_t
*new_service(
102 bootstrap_info_t
*bootstrap
,
104 mach_port_t service_port
,
106 servicetype_t servicetype
,
108 extern bootstrap_info_t
*new_bootstrap(
109 bootstrap_info_t
*parent
,
110 mach_port_name_t bootstrap_port
,
111 mach_port_name_t requestor_port
);
113 extern server_t
*lookup_server_by_port(mach_port_t port
);
114 extern server_t
*lookup_server_by_task_port(mach_port_t port
);
115 extern bootstrap_info_t
*lookup_bootstrap_by_port(mach_port_t port
);
116 extern bootstrap_info_t
*lookup_bootstrap_req_by_port(mach_port_t port
);
117 extern service_t
*lookup_service_by_name(bootstrap_info_t
*bootstrap
, name_t name
);
118 extern service_t
*lookup_service_by_port(mach_port_t port
);
119 extern server_t
*find_init_server(void);
120 extern void delete_service(service_t
*servicep
);
121 extern void delete_bootstrap(bootstrap_info_t
*bootstrap
);
122 extern void *ckmalloc(unsigned nbytes
);
124 extern bootstrap_info_t bootstraps
; /* head of list of bootstrap ports */
125 extern server_t servers
; /* head of list of all servers */
126 extern service_t services
; /* head of list of all services */
127 extern unsigned nservices
; /* number of services in list */
129 #define FIRST(q) ((q).next)
130 #define NEXT(qe) ((qe)->next)
131 #define PREV(qe) ((qe)->prev)
132 #define IS_END(qe, q) ((qe) == &(q))