Annotation of src/sys/sys/proc.h, Revision 1.179
1.179 ! manu 1: /* $NetBSD: proc.h,v 1.178 2003/11/27 23:16:47 manu Exp $ */
1.29 cgd 2:
3: /*-
4: * Copyright (c) 1986, 1989, 1991, 1993
5: * The Regents of the University of California. All rights reserved.
6: * (c) UNIX System Laboratories, Inc.
7: * All or some portions of this file are derived from material licensed
8: * to the University of California by American Telephone and Telegraph
9: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10: * the permission of UNIX System Laboratories, Inc.
11: *
12: * Redistribution and use in source and binary forms, with or without
13: * modification, are permitted provided that the following conditions
14: * are met:
15: * 1. Redistributions of source code must retain the above copyright
16: * notice, this list of conditions and the following disclaimer.
17: * 2. Redistributions in binary form must reproduce the above copyright
18: * notice, this list of conditions and the following disclaimer in the
19: * documentation and/or other materials provided with the distribution.
1.168 agc 20: * 3. Neither the name of the University nor the names of its contributors
1.29 cgd 21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
1.59 fvdl 36: * @(#)proc.h 8.15 (Berkeley) 5/19/95
1.29 cgd 37: */
38:
39: #ifndef _SYS_PROC_H_
40: #define _SYS_PROC_H_
1.57 mrg 41:
1.131 mrg 42: #if defined(_KERNEL_OPT)
1.83 thorpej 43: #include "opt_multiprocessor.h"
1.139 yamt 44: #include "opt_kstack.h"
1.83 thorpej 45: #endif
46:
1.122 lukem 47: #include <machine/proc.h> /* Machine-dependent proc substruct */
1.79 thorpej 48: #include <sys/lock.h>
1.153 thorpej 49: #include <sys/lwp.h>
1.32 mycroft 50: #include <sys/queue.h>
1.87 thorpej 51: #include <sys/callout.h>
1.118 jdolecek 52: #include <sys/signalvar.h>
1.170 christos 53: #include <sys/siginfo.h>
1.147 jdolecek 54: #include <sys/event.h>
1.29 cgd 55:
56: /*
57: * One structure allocated per session.
58: */
1.122 lukem 59: struct session {
60: int s_count; /* Ref cnt; pgrps in session */
1.159 dsl 61: u_int s_flags;
62: #define S_LOGIN_SET 1 /* s_login set in this session */
1.122 lukem 63: struct proc *s_leader; /* Session leader */
64: struct vnode *s_ttyvp; /* Vnode of controlling terminal */
65: struct tty *s_ttyp; /* Controlling terminal */
66: char s_login[MAXLOGNAME]; /* Setlogin() name */
67: pid_t s_sid; /* Session ID (pid of leader) */
1.29 cgd 68: };
69:
70: /*
71: * One structure allocated per process group.
72: */
1.122 lukem 73: struct pgrp {
74: LIST_HEAD(, proc) pg_members; /* Pointer to pgrp members */
75: struct session *pg_session; /* Pointer to session */
76: pid_t pg_id; /* Pgrp id */
77: int pg_jobc; /*
78: * Number of processes qualifying
79: * pgrp for job control
80: */
1.29 cgd 81: };
82:
83: /*
1.40 christos 84: * One structure allocated per emulation.
85: */
86: struct exec_package;
87: struct ps_strings;
1.144 gmcgarry 88: struct ras;
1.40 christos 89:
1.122 lukem 90: struct emul {
91: const char *e_name; /* Symbolic name */
92: const char *e_path; /* Extra emulation path (NULL if none)*/
1.130 manu 93: #ifndef __HAVE_MINIMAL_EMUL
1.129 manu 94: int e_flags; /* Miscellaneous flags, see above */
1.116 mycroft 95: /* Syscall handling function */
1.122 lukem 96: const int *e_errno; /* Errno array */
97: int e_nosys; /* Offset of the nosys() syscall */
98: int e_nsysent; /* Number of system call entries */
1.116 mycroft 99: #endif
1.111 jdolecek 100: const struct sysent *e_sysent; /* System call array */
1.122 lukem 101: const char * const *e_syscallnames; /* System call name array */
1.120 jdolecek 102: /* Signal sending function */
1.170 christos 103: #ifdef __HAVE_SIGINFO
1.172 christos 104: void (*e_sendsig) __P((const struct ksiginfo *,
105: const sigset_t *));
106: void (*e_trapsignal) __P((struct lwp *,
107: const struct ksiginfo *));
1.179 ! manu 108: int (*e_sigfilter) __P((struct lwp *,
! 109: const struct ksiginfo *));
1.170 christos 110: #else
1.173 simonb 111: void (*e_sendsig) __P((int, const sigset_t *, u_long));
1.153 thorpej 112: void (*e_trapsignal) __P((struct lwp *, int, u_long));
1.179 ! manu 113: int (*e_sigfilter) __P((struct lwp *, int, u_long));
1.170 christos 114: #endif
1.122 lukem 115: char *e_sigcode; /* Start of sigcode */
116: char *e_esigcode; /* End of sigcode */
1.134 jdolecek 117: /* Set registers before execution */
1.169 chs 118: struct uvm_object **e_sigobject;/* shared sigcode object */
1.153 thorpej 119: void (*e_setregs) __P((struct lwp *, struct exec_package *,
1.172 christos 120: u_long));
1.106 jdolecek 121:
1.112 jdolecek 122: /* Per-process hooks */
1.122 lukem 123: void (*e_proc_exec) __P((struct proc *,
124: struct exec_package *));
1.167 itojun 125: void (*e_proc_fork) __P((struct proc *, struct proc *));
1.122 lukem 126: void (*e_proc_exit) __P((struct proc *));
1.112 jdolecek 127:
1.116 mycroft 128: #ifdef __HAVE_SYSCALL_INTERN
1.122 lukem 129: void (*e_syscall_intern) __P((struct proc *));
1.116 mycroft 130: #else
1.122 lukem 131: void (*e_syscall) __P((void));
1.116 mycroft 132: #endif
1.137 jdolecek 133: /* Emulation specific sysctl */
134: int (*e_sysctl) __P((int *, u_int , void *, size_t *,
1.172 christos 135: void *, size_t, struct proc *));
1.151 manu 136: /* Specific VM fault handling */
1.145 manu 137: int (*e_fault) __P((struct proc *, vaddr_t, int, int));
1.40 christos 138: };
139:
1.127 manu 140: /*
141: * Emulation miscelaneous flags
142: */
1.122 lukem 143: #define EMUL_HAS_SYS___syscall 0x001 /* Has SYS___syscall */
1.114 mycroft 144:
1.40 christos 145: /*
1.29 cgd 146: * Description of a process.
147: *
148: * This structure contains the information needed to manage a thread of
149: * control, known in UN*X as a process; it has references to substructures
150: * containing descriptions of things that the process uses, but may share
151: * with related processes. The process structure and the substructures
152: * are always addressible except for those marked "(PROC ONLY)" below,
153: * which might be addressible only on a processor on which the process
154: * is running.
1.175 dsl 155: *
156: * Fields marked 'p:' are protected by the process's own p_lock.
1.176 dsl 157: * Fields marked 'l:' are protected by the proclist_lock
1.29 cgd 158: */
1.122 lukem 159: struct proc {
160: LIST_ENTRY(proc) p_list; /* List of all processes */
161:
162: /* Substructures: */
163: struct pcred *p_cred; /* Process owner's identity */
164: struct filedesc *p_fd; /* Ptr to open files structure */
165: struct cwdinfo *p_cwdi; /* cdir/rdir/cmask info */
166: struct pstats *p_stats; /* Accounting/statistics (PROC ONLY) */
167: struct plimit *p_limit; /* Process limits */
168: struct vmspace *p_vmspace; /* Address space */
169: struct sigacts *p_sigacts; /* Process sigactions (state is below)*/
1.155 thorpej 170:
171: void *p_ksems; /* p1003.1b semaphores */
1.29 cgd 172:
173: #define p_ucred p_cred->pc_ucred
174: #define p_rlimit p_limit->pl_rlimit
175:
1.153 thorpej 176: int p_exitsig; /* signal to sent to parent on exit */
177: int p_flag; /* P_* flags. */
178: char p_stat; /* S* process status. */
1.122 lukem 179: char p_pad1[3];
180:
1.153 thorpej 181: pid_t p_pid; /* Process identifier. */
1.162 dsl 182: SLIST_ENTRY(proc) p_dead; /* Processes waiting for reaper */
1.176 dsl 183: LIST_ENTRY(proc) p_pglist; /* l: List of processes in pgrp. */
184: struct proc *p_pptr; /* l: Pointer to parent process. */
185: LIST_ENTRY(proc) p_sibling; /* l: List of sibling processes. */
186: LIST_HEAD(, proc) p_children; /* l: Pointer to list of children. */
1.153 thorpej 187:
1.175 dsl 188: struct simplelock p_lock; /* Lock on proc state (p:) */
1.153 thorpej 189:
1.176 dsl 190: /* XXX dsl: locking of LWP info is suspect in schedcpu and kpsignal2 */
1.175 dsl 191: LIST_HEAD(, lwp) p_lwps; /* p: Pointer to list of LWPs. */
1.144 gmcgarry 192:
1.175 dsl 193: LIST_HEAD(, ras) p_raslist; /* p: Pointer to RAS queue */
1.29 cgd 194:
1.153 thorpej 195: /* The following fields are all zeroed upon creation in fork. */
196: #define p_startzero p_nlwps
197:
1.175 dsl 198: int p_nlwps; /* p: Number of LWPs */
199: int p_nrlwps; /* p: Number of running LWPs */
200: int p_nzlwps; /* p: Number of zombie LWPs */
201: int p_nlwpid; /* p: Next LWP ID */
1.29 cgd 202:
1.176 dsl 203: u_int p_nstopchild; /* l: Count of stopped/dead children */
204:
1.153 thorpej 205: struct sadata *p_sa; /* Scheduler activation information */
1.29 cgd 206:
1.153 thorpej 207: /* scheduling */
208: u_int p_estcpu; /* Time averaged value of p_cpticks XXX belongs in p_startcopy section */
1.122 lukem 209: int p_cpticks; /* Ticks of cpu time */
1.153 thorpej 210: fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */
211:
212: struct proc *p_opptr; /* Save parent during ptrace. */
213: struct ptimers *p_timers; /* Timers: real, virtual, profiling */
214: struct timeval p_rtime; /* Real time */
215: u_quad_t p_uticks; /* Statclock hits in user mode */
216: u_quad_t p_sticks; /* Statclock hits in system mode */
217: u_quad_t p_iticks; /* Statclock hits processing intr */
1.29 cgd 218:
1.122 lukem 219: int p_traceflag; /* Kernel trace points */
220: struct file *p_tracep; /* Trace to file */
1.138 christos 221: void *p_systrace; /* Back pointer to systrace */
1.29 cgd 222:
1.153 thorpej 223: struct vnode *p_textvp; /* Vnode of executable */
1.50 fvdl 224:
1.111 jdolecek 225: const struct emul *p_emul; /* Emulation information */
1.153 thorpej 226: void *p_emuldata; /* Per-process emulation data, or NULL.
227: * Malloc type M_EMULDATA
1.122 lukem 228: */
1.153 thorpej 229:
1.167 itojun 230: void (*p_userret)(struct lwp *, void *);
1.153 thorpej 231: /* Function to call at userret(). */
232: void *p_userret_arg;
233:
1.135 thorpej 234: const struct execsw *p_execsw; /* Exec package information */
1.147 jdolecek 235: struct klist p_klist; /* Knotes attached to this process */
1.29 cgd 236:
1.122 lukem 237: /*
238: * End area that is zeroed on creation
239: */
1.29 cgd 240: #define p_endzero p_startcopy
241:
1.122 lukem 242: /*
243: * The following fields are all copied upon creation in fork.
244: */
1.118 jdolecek 245: #define p_startcopy p_sigctx.ps_startcopy
1.29 cgd 246:
1.153 thorpej 247: struct sigctx p_sigctx; /* Signal state */
1.122 lukem 248:
249: u_char p_nice; /* Process "nice" value */
1.125 simonb 250: char p_comm[MAXCOMLEN+1]; /* basename of last exec file */
1.122 lukem 251:
1.153 thorpej 252: struct pgrp *p_pgrp; /* Pointer to process group */
1.29 cgd 253:
1.153 thorpej 254: struct ps_strings *p_psstr; /* address of process's ps_strings */
255: size_t p_psargv; /* offset of ps_argvstr in above */
256: size_t p_psnargv; /* offset of ps_nargvstr in above */
257: size_t p_psenv; /* offset of ps_envstr in above */
258: size_t p_psnenv; /* offset of ps_nenvstr in above */
1.29 cgd 259:
1.153 thorpej 260: /*
1.122 lukem 261: * End area that is copied on creation
262: */
1.153 thorpej 263: #define p_endcopy p_xstat
1.122 lukem 264:
265: u_short p_xstat; /* Exit status for wait; also stop signal */
266: u_short p_acflag; /* Accounting flags */
1.153 thorpej 267: struct rusage *p_ru; /* Exit information. XXX */
268:
269: struct mdproc p_md; /* Any machine-dependent fields */
1.29 cgd 270: };
271:
272: #define p_session p_pgrp->pg_session
273: #define p_pgid p_pgrp->pg_id
274:
1.91 thorpej 275: /*
276: * Status values.
277: *
278: */
1.122 lukem 279: #define SIDL 1 /* Process being created by fork */
1.153 thorpej 280: #define SACTIVE 2 /* Process is not stopped */
1.122 lukem 281: #define SSTOP 4 /* Process debugging or suspension */
282: #define SZOMB 5 /* Awaiting collection by parent */
283: #define SDEAD 6 /* Process is almost a zombie */
1.79 thorpej 284:
285: #define P_ZOMBIE(p) ((p)->p_stat == SZOMB || (p)->p_stat == SDEAD)
1.29 cgd 286:
1.41 mycroft 287: /* These flags are kept in p_flag. */
1.164 christos 288: #define P_ADVLOCK 0x00000001 /* Process may hold a POSIX advisory lock */
289: #define P_CONTROLT 0x00000002 /* Has a controlling terminal */
290: #define P_NOCLDSTOP 0x00000008 /* No SIGCHLD when children stop */
291: #define P_PPWAIT 0x00000010 /* Parent is waiting for child exec/exit */
292: #define P_PROFIL 0x00000020 /* Has started profiling */
293: #define P_SUGID 0x00000100 /* Had set id privileges since last exec */
294: #define P_SYSTEM 0x00000200 /* System proc: no sigs, stats or swapping */
295: #define P_SA 0x00000400 /* Using scheduler activations */
296: #define P_TRACED 0x00000800 /* Debugged process being traced */
297: #define P_WAITED 0x00001000 /* Debugging process has waited for child */
298: #define P_WEXIT 0x00002000 /* Working on exiting */
299: #define P_EXEC 0x00004000 /* Process called exec */
300: #define P_OWEUPC 0x00008000 /* Owe process an addupc() at next ast */
301: #define P_FSTRACE 0x00010000 /* Debugger process being traced by procfs */
302: #define P_NOCLDWAIT 0x00020000 /* No zombies if child dies */
303: #define P_32 0x00040000 /* 32-bit process (used on 64-bit kernels) */
304: #define P_INEXEC 0x00100000 /* Process is exec'ing and can't be traced */
305: #define P_SYSTRACE 0x00200000 /* Process system call tracing active */
306: #define P_CHTRACED 0x00400000 /* Child has been traced & reparented */
307: #define P_STOPFORK 0x00800000 /* Child will be stopped on fork(2) */
308: #define P_STOPEXEC 0x01000000 /* Will be stopped on exec(2) */
1.29 cgd 309:
310: /*
1.78 thorpej 311: * Macro to compute the exit signal to be delivered.
1.76 thorpej 312: */
1.78 thorpej 313: #define P_EXITSIG(p) (((p)->p_flag & (P_TRACED|P_FSTRACE)) ? SIGCHLD : \
314: p->p_exitsig)
1.76 thorpej 315:
316: /*
1.29 cgd 317: * MOVE TO ucred.h?
318: *
319: * Shareable process credentials (always resident). This includes a reference
320: * to the current user credentials as well as real and saved ids that may be
321: * used to change ids.
322: */
1.122 lukem 323: struct pcred {
324: struct ucred *pc_ucred; /* Current credentials */
325: uid_t p_ruid; /* Real user id */
326: uid_t p_svuid; /* Saved effective user id */
327: gid_t p_rgid; /* Real group id */
328: gid_t p_svgid; /* Saved effective group id */
329: int p_refcnt; /* Number of references */
1.29 cgd 330: };
331:
1.122 lukem 332: LIST_HEAD(proclist, proc); /* A list of processes */
1.64 thorpej 333:
334: /*
335: * This structure associates a proclist with its lock.
336: */
337: struct proclist_desc {
1.122 lukem 338: struct proclist *pd_list; /* The list */
1.64 thorpej 339: /*
340: * XXX Add a pointer to the proclist's lock eventually.
341: */
342: };
343:
1.38 jtc 344: #ifdef _KERNEL
1.156 thorpej 345: #include <sys/mallocvar.h>
346: MALLOC_DECLARE(M_EMULDATA);
347: MALLOC_DECLARE(M_PROC);
348: MALLOC_DECLARE(M_SESSION);
349: MALLOC_DECLARE(M_SUBPROC);
350:
1.29 cgd 351: /*
1.162 dsl 352: * We use process IDs <= PID_MAX until there are > 16k processes.
353: * NO_PGID is used to represent "no process group" for a tty.
1.29 cgd 354: */
355: #define PID_MAX 30000
1.163 jdolecek 356: #define NO_PGID ((pid_t)-1)
1.29 cgd 357:
1.122 lukem 358: #define SESS_LEADER(p) ((p)->p_session->s_leader == (p))
1.29 cgd 359: #define SESSHOLD(s) ((s)->s_count++)
1.122 lukem 360: #define SESSRELE(s) \
361: do { \
1.29 cgd 362: if (--(s)->s_count == 0) \
1.162 dsl 363: sessdelete(s); \
1.126 lukem 364: } while (/* CONSTCOND */ 0)
1.29 cgd 365:
1.54 thorpej 366:
367: /*
368: * Flags passed to fork1().
369: */
1.122 lukem 370: #define FORK_PPWAIT 0x01 /* Block parent until child exit */
371: #define FORK_SHAREVM 0x02 /* Share vmspace with parent */
372: #define FORK_SHARECWD 0x04 /* Share cdir/rdir/cmask */
373: #define FORK_SHAREFILES 0x08 /* Share file descriptors */
374: #define FORK_SHARESIGS 0x10 /* Share signal actions */
1.141 pooka 375: #define FORK_NOWAIT 0x20 /* Make init the parent of the child */
1.143 pooka 376: #define FORK_CLEANFILES 0x40 /* Start with a clean descriptor set */
1.41 mycroft 377:
1.67 pk 378: /*
1.93 thorpej 379: * Allow machine-dependent code to override curproc in <machine/cpu.h> for
1.83 thorpej 380: * its own convenience. Otherwise, we declare it as appropriate.
1.67 pk 381: */
1.153 thorpej 382: #if !defined(curlwp)
1.83 thorpej 383: #if defined(MULTIPROCESSOR)
1.153 thorpej 384: #define curlwp curcpu()->ci_curlwp /* Current running LWP */
1.83 thorpej 385: #else
1.153 thorpej 386: extern struct lwp *curlwp; /* Current running LWP */
1.83 thorpej 387: #endif /* MULTIPROCESSOR */
388: #endif /* ! curproc */
389:
1.174 yamt 390: static struct proc *__curproc(void);
391:
392: static __inline struct proc *
393: __curproc()
394: {
395: struct lwp *l = curlwp;
396:
397: if (l == NULL)
398: return NULL;
399: return l->l_proc;
400: }
401: #define curproc __curproc()
1.153 thorpej 402:
1.122 lukem 403: extern struct proc proc0; /* Process slot for swapper */
404: extern int nprocs, maxproc; /* Current and max number of procs */
1.29 cgd 405:
1.122 lukem 406: /* Process list lock; see kern_proc.c for locking protocol details */
407: extern struct lock proclist_lock;
1.110 sommerfe 408:
1.122 lukem 409: extern struct proclist allproc; /* List of all processes */
410: extern struct proclist zombproc; /* List of zombie processes */
1.79 thorpej 411:
1.162 dsl 412: extern SLIST_HEAD(deadprocs, proc) deadprocs; /* List of dead processes */
1.79 thorpej 413: extern struct simplelock deadproc_slock;
1.64 thorpej 414:
1.122 lukem 415: extern struct proc *initproc; /* Process slots for init, pager */
1.61 thorpej 416:
1.64 thorpej 417: extern const struct proclist_desc proclists[];
418:
1.122 lukem 419: extern struct pool pcred_pool; /* Memory pool for pcreds */
420: extern struct pool plimit_pool; /* Memory pool for plimits */
1.153 thorpej 421: extern struct pool pstats_pool; /* memory pool for pstats */
1.122 lukem 422: extern struct pool rusage_pool; /* Memory pool for rusages */
1.153 thorpej 423: extern struct pool ptimer_pool; /* Memory pool for ptimers */
1.29 cgd 424:
1.176 dsl 425: struct proc *p_find(pid_t, uint); /* Find process by id */
426: struct pgrp *pg_find(pid_t, uint); /* Find process group by id */
427: /* Flags values for p_find() and pg_find(). */
428: #define PFIND_ZOMBIE 1 /* look for zombies as well */
429: #define PFIND_LOCKED 2 /* proclist locked on entry */
430: #define PFIND_UNLOCK_FAIL 4 /* unlock proclist on failure */
431: #define PFIND_UNLOCK_OK 8 /* unlock proclist on success */
432: #define PFIND_UNLOCK (PFIND_UNLOCK_OK | PFIND_UNLOCK_FAIL)
433: /* For source compatibility. but UNLOCK_OK gives a stale answer... */
434: #define pfind(pid) p_find((pid), PFIND_UNLOCK)
435: #define pgfind(pgid) pg_find((pgid), PFIND_UNLOCK)
1.29 cgd 436:
1.98 thorpej 437: struct simplelock;
1.167 itojun 438: int chgproccnt(uid_t, int);
439: int enterpgrp(struct proc *, pid_t, int);
440: void fixjobc(struct proc *, struct pgrp *, int);
441: int inferior(struct proc *, struct proc *);
442: int leavepgrp(struct proc *);
1.162 dsl 443: void sessdelete(struct session *);
1.152 gmcgarry 444: void yield(void);
1.153 thorpej 445: struct lwp *chooselwp(void);
1.167 itojun 446: void pgdelete(struct pgrp *);
1.122 lukem 447: void procinit(void);
1.153 thorpej 448: void resetprocpriority(struct proc *);
1.122 lukem 449: void suspendsched(void);
1.167 itojun 450: int ltsleep(const void *, int, const char *, int,
1.122 lukem 451: __volatile struct simplelock *);
1.167 itojun 452: void wakeup(const void *);
453: void wakeup_one(const void *);
1.122 lukem 454: void reaper(void *);
1.153 thorpej 455: void exit1(struct lwp *, int);
456: void exit2(struct lwp *);
1.158 dsl 457: int find_stopped_child(struct proc *, pid_t, int, struct proc **);
1.162 dsl 458: struct proc *proc_alloc(void);
459: void proc0_insert(struct proc *, struct lwp *, struct pgrp *, struct session *);
1.158 dsl 460: void proc_free(struct proc *);
1.162 dsl 461: void proc_free_mem(struct proc *);
1.153 thorpej 462: void exit_lwps(struct lwp *l);
463: int fork1(struct lwp *, int, int, void *, size_t,
1.122 lukem 464: void (*)(void *), void *, register_t *, struct proc **);
465: void rqinit(void);
1.160 dsl 466: int groupmember(gid_t, const struct ucred *);
1.161 dsl 467: int pgid_in_session(struct proc *, pid_t);
1.146 gmcgarry 468: #ifndef cpu_idle
469: void cpu_idle(void);
1.124 matt 470: #endif
1.153 thorpej 471: void cpu_exit(struct lwp *, int);
472: void cpu_lwp_fork(struct lwp *, struct lwp *, void *, size_t,
1.122 lukem 473: void (*)(void *), void *);
1.123 lukem 474:
475: /*
476: * XXX: use __P() to allow ports to have as a #define.
477: * XXX: we need a better way to solve this.
478: */
1.153 thorpej 479: void cpu_wait __P((struct lwp *));
1.122 lukem 480:
481: void child_return(void *);
482:
1.166 fvdl 483: int proc_isunder(struct proc *, struct proc *);
1.178 manu 484: void proc_stop(struct proc *, int);
1.122 lukem 485:
486: void proclist_lock_read(void);
487: void proclist_unlock_read(void);
488: int proclist_lock_write(void);
489: void proclist_unlock_write(int);
1.162 dsl 490: void p_sugid(struct proc *);
1.98 thorpej 491:
1.122 lukem 492: /* Compatibility with old, non-interlocked tsleep call */
1.98 thorpej 493: #define tsleep(chan, pri, wmesg, timo) \
494: ltsleep(chan, pri, wmesg, timo, NULL)
1.102 thorpej 495:
496: #if defined(MULTIPROCESSOR)
497: void proc_trampoline_mp(void); /* XXX */
1.139 yamt 498: #endif
499:
500: #ifdef KSTACK_CHECK_MAGIC
1.154 yamt 501: void kstack_setup_magic(const struct lwp *);
502: void kstack_check_magic(const struct lwp *);
1.139 yamt 503: #endif
504:
505: /*
506: * kernel stack paramaters
507: * XXX require sizeof(struct user)
508: */
509: /* the lowest address of kernel stack */
510: #ifndef KSTACK_LOWEST_ADDR
1.154 yamt 511: #define KSTACK_LOWEST_ADDR(l) ((caddr_t)ALIGN((l)->l_addr + 1))
1.139 yamt 512: #endif
513: /* size of kernel stack */
514: #ifndef KSTACK_SIZE
515: #define KSTACK_SIZE (USPACE - ALIGN(sizeof(struct user)))
1.102 thorpej 516: #endif
1.98 thorpej 517:
1.38 jtc 518: #endif /* _KERNEL */
1.29 cgd 519: #endif /* !_SYS_PROC_H_ */
CVSweb <webmaster@jp.NetBSD.org>