summaryrefslogtreecommitdiff
path: root/hurd/process_request.defs
blob: fc9127ab0e18d016397bf0ac8b4b6fec815ca850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
/* Definitions for process server interface (request-only version)

   Copyright (C) 1992, 93, 94, 95, 96, 98, 2013 Free Software Foundation, Inc.

This file is part of the GNU Hurd.

The GNU Hurd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

The GNU Hurd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with the GNU Hurd; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

subsystem process_request 24000;

#include <hurd/hurd_types.defs>

#ifdef PROCESS_IMPORTS
PROCESS_IMPORTS
#endif

type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
        ctype: mach_port_t;


/*** Host management ***/

skip;  /* Was proc_sethostid */
skip;  /* Was proc_gethostid */
skip;  /* Was proc_sethostname */
skip;  /* Was proc_gethostname */

/* Get the privileged host port and the device master port.  */
simpleroutine proc_getprivports_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Return all the pids of all live processes.  */
simpleroutine proc_getallpids_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Set the "standard exec data", used by programs that want predefined
   values for exec.  */
simpleroutine proc_setexecdata_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	ports: portarray_t;
	ints: intarray_t);

/* Get the standard exec data */
simpleroutine proc_getexecdata_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Request notification with exec_setexecdata on NOTIFY.  */
simpleroutine proc_execdata_notify_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	notify: mach_port_send_t);

/* Return a uname structure for the currently running system. */
simpleroutine proc_uname_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Tell the server who we are for inclusion in the uname string. */
simpleroutine proc_register_version_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	credential: host_priv_t;
	name: string_t;
	release: string_t;
	version: string_t);

/*** Process creation and simple management.  ***/

/* There is a 1-1 relationship between tasks and processes; to create
   a new process, just create a new task and use proc_task2proc. */

/* Change the current authentication of the process.  The user should
   follow this call with a call to auth_user_authenticate.  The
   new_port passed back through the auth server will be
   MACH_PORT_NULL.  */
simpleroutine proc_reauthenticate_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	rendezvous2: mach_port_send_t);

/* Declare that a task is a child of the caller.  The task's state
   will then inherit from the caller.  This call can be made only once
   per task. */
simpleroutine proc_child_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	child: task_t);

/* Atomically change the message port of a process.  */
simpleroutine proc_setmsgport_request (
	process: process_t;
	replyport reply: reply_port_t;
	newmsgport: mach_port_t);

/* Cause a task to take over the pid and all other state from an
   existing task, and kill the old task with task_terminate.  The
   message port will be set to MACH_PORT_NULL.  This is principally
   used for doing exec's with the EXEC_NEWTASK bit set.  The request
   port assigned to NEWTASK does not change.  The new task cannot have
   had proc_child called on its behalf, it cannot have a pgrp, a session,
   a login name set with proc_setlogin, it cannot have called proc_child,
   and it cannot have a message port.  */
/* If this call is made for a process which is no longer alive or
   does not exist, then newtask will be killed (and no error
   is returned). */
simpleroutine proc_reassign_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	newtask: task_t);

/* Set the owner of the process.  The new owner must be within the
   current authentication of the caller.  */
simpleroutine proc_setowner_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	owner: uid_t;
	clear: int);

/* Get the process ID and the parent process ID, also find out if we
   are orphaned.  */
simpleroutine proc_getpids_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Set the locations of ARGV and ENVP which will be examined
   by proc_getprocargs and proc_getprocenv.  */
simpleroutine proc_set_arg_locations_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	argv: vm_address_t;
	envp: vm_address_t);

/* Fetch the locations set by proc_set_arg_locations.  */
simpleroutine proc_get_arg_locations_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Fetch the message port of a process */
simpleroutine proc_getmsgport_request (
	process: process_t;
	replyport reply: reply_port_t;
	pid: pid_t);

/* Wait for a child process to exit.  If pid is zero, it waits for any
   child in the same pgrp as the parent.  If pid is -1, it waits for
   any child.  Otherwise, if pid is negative, it waits for any process
   in the specified process group.  If pid is positive, it waits for
   the specified process.  The exit status and resource usage of the
   process are returned in status and rusage respectively.  */
simpleroutine proc_wait_request (
	process: process_t;
	replyport reply: reply_port_t;
	pid: pid_t;
	options: int);

/* Have the process server stop all threads except contthread.  */
simpleroutine proc_dostop_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	contthread: thread_t);

/* Take over exception messages received on MSGPORT.  Any exception
   messages received will be forwarded to FORWARDPORT.  In addition,
   the thread causing the exception will be aborted (with thread_abort)
   and have its state adjusted (as by thread_set_state).  */
simpleroutine proc_handle_exceptions_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	msgport: mach_port_move_receive_t;
	forwardport: mach_port_send_t;
	flavor: int;
	new_state: thread_state_t);



/*** Mark bits.  Some of these (exec, traced, eg) modify small pieces
   of the proc server's behavior; others are purely informational. ***/

/* Mark the process as stopped on a signal. */
simpleroutine proc_mark_stop_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	signo: int;
	sigcode: int);

/* Mark the process as continued after a stop.  */
simpleroutine proc_mark_cont_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Tell the process server that the process is going away.  If it dies
   without calling this, it will look to the parent like the process
   died with SIGKILL.  This call allows for a cleaner exit.  */
simpleroutine proc_mark_exit_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	status: int;
	sigcode:int );

/* Inform the process server that the process has completed an exec.  */
simpleroutine proc_mark_exec_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Inform the process server that the process has asked to be traced.
   The only result of this is to change the behavior of wait by the
   parent slightly.  */
simpleroutine proc_mark_traced_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Inform the process server whether SIGCHLD should be sent for stopped
   child processes.  */
simpleroutine proc_mod_stopchild_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	doit: int);


/*** Miscellaneous process information queries. ***/

simpleroutine proc_pid2task_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pid: pid_t);

simpleroutine proc_task2pid_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	task: task_t);

/* Return the procserver port for the specified task.  */
simpleroutine proc_task2proc_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	task: task_t);

simpleroutine proc_proc2task_request (
	process: process_t;
	ureplyport reply: reply_port_t);

simpleroutine proc_pid2proc_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pid: pid_t);

simpleroutine proc_getprocinfo_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	which: pid_t;
	flags: int);

simpleroutine proc_getprocargs_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	which: pid_t);

simpleroutine proc_getprocenv_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	which: pid_t);

/* Create a new login collection.  The pid of PROCESS will be the id
   of the collection.  All the children (and their children, and so forth) of
   PROCESS will automatically join the collection.  If PROCESS dies its
   children (and their children, and so forth) will become part of init's
   process collection.  */
simpleroutine proc_make_login_coll_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Get the process collection ID for the process specified by pid.  */
simpleroutine proc_getloginid_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pid: pid_t);

/* Get the pids of all the members of process collection ID. */
simpleroutine proc_getloginpids_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	id: pid_t);

/* These next two should not actually be used; they are here
   for "historic reasons."  You are not expected to understand this. */
simpleroutine proc_setlogin_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	logname: string_t);

simpleroutine proc_getlogin_request (
	process: process_t;
	ureplyport reply: reply_port_t);


/*** Sessions and process groups.  ***/

/* Create a new session.  The process's pgrp is set to its pid, and
   becomes the session leader.  */
simpleroutine proc_setsid_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Return the pid of a process's session leader.  */
simpleroutine proc_getsid_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pid: pid_t);

/* Get the pgids of all the members of a session.  */
simpleroutine proc_getsessionpgids_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	sid: pid_t);

/* Get the pids of all the members of a session. */
simpleroutine proc_getsessionpids_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	sid: pid_t);

/* Return a "session ID" port for the session of the caller.
   This port is generally only available to members of the session.
   (It has no listener, but is useful for identification purposes.)  */
simpleroutine proc_getsidport_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Set the process group of a process.  */
simpleroutine proc_setpgrp_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pid: pid_t;
	pgrp: pid_t);

/* Get the process group of a process.  */
simpleroutine proc_getpgrp_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pid: pid_t);

/* Get the pids of all the members of a pgrp.  */
simpleroutine proc_getpgrppids_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pgrp: pid_t);

simpleroutine proc_get_tty_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	pid: pid_t);

/* Return the number of Mach ports used by PID */
simpleroutine proc_getnports_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	which: pid_t);

/*** Routines related to early server bootstrapping ***/

/* Set the task of process HURD_PID_INIT. Only the startup process
   HURD_PID_STARTUP may use this interface.  */
simpleroutine proc_set_init_task_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	task: task_t);

/* Inform the process server that the process is important.  */
simpleroutine proc_mark_important_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Query whether the process is important.  */
simpleroutine proc_is_important_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Set the processes start_code and end_code locations.  Any
   executable segments loaded from the ELF binary are in this
   range.  */
simpleroutine proc_set_code_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	start_code: vm_address_t;
	end_code: vm_address_t);

/* Get the processes start_code and end_code locations.  Any
   executable segments loaded from the ELF binary are in this range.
   If zero is returned for these values, the requested information has
   never been set.  */
simpleroutine proc_get_code_request (
	process: process_t;
	ureplyport reply: reply_port_t);

/* Create a new task namespace.  PROCESS claims the responsibility to
   manage all tasks in this namespace.  Any task created in this
   namespace will automatically be declared a child of PROCESS, and a
   `mach_notify_new_task' message is sent to NOTIFY.  If PROCESS dies,
   the proc server will terminate all tasks in the namespace.  */
simpleroutine proc_make_task_namespace_request (
	process: process_t;
	ureplyport reply: reply_port_t;
	notify: mach_port_send_t);

skip; /* proc_set_exe */
skip; /* proc_get_exe */

skip; /* proc_set_entry */
skip; /* proc_get_entry */