[BACK]Return to proc.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / sys

Annotation of src/sys/sys/proc.h, Revision 1.175

1.175   ! dsl         1: /*     $NetBSD: proc.h,v 1.174 2003/10/09 14:00:34 yamt 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.170     christos  108: #else
1.173     simonb    109:        void            (*e_sendsig) __P((int, const sigset_t *, u_long));
1.153     thorpej   110:        void            (*e_trapsignal) __P((struct lwp *, int, u_long));
1.170     christos  111: #endif
1.122     lukem     112:        char            *e_sigcode;     /* Start of sigcode */
                    113:        char            *e_esigcode;    /* End of sigcode */
1.134     jdolecek  114:                                        /* Set registers before execution */
1.169     chs       115:        struct uvm_object **e_sigobject;/* shared sigcode object */
1.153     thorpej   116:        void            (*e_setregs) __P((struct lwp *, struct exec_package *,
1.172     christos  117:                                          u_long));
1.106     jdolecek  118:
1.112     jdolecek  119:                                        /* Per-process hooks */
1.122     lukem     120:        void            (*e_proc_exec) __P((struct proc *,
                    121:                                            struct exec_package *));
1.167     itojun    122:        void            (*e_proc_fork) __P((struct proc *, struct proc *));
1.122     lukem     123:        void            (*e_proc_exit) __P((struct proc *));
1.112     jdolecek  124:
1.116     mycroft   125: #ifdef __HAVE_SYSCALL_INTERN
1.122     lukem     126:        void            (*e_syscall_intern) __P((struct proc *));
1.116     mycroft   127: #else
1.122     lukem     128:        void            (*e_syscall) __P((void));
1.116     mycroft   129: #endif
1.137     jdolecek  130:                                        /* Emulation specific sysctl */
                    131:        int             (*e_sysctl) __P((int *, u_int , void *, size_t *,
1.172     christos  132:                                         void *, size_t, struct proc *));
1.151     manu      133:                                        /* Specific VM fault handling */
1.145     manu      134:        int             (*e_fault) __P((struct proc *, vaddr_t, int, int));
1.40      christos  135: };
                    136:
1.127     manu      137: /*
                    138:  * Emulation miscelaneous flags
                    139:  */
1.122     lukem     140: #define        EMUL_HAS_SYS___syscall  0x001   /* Has SYS___syscall */
1.114     mycroft   141:
1.40      christos  142: /*
1.29      cgd       143:  * Description of a process.
                    144:  *
                    145:  * This structure contains the information needed to manage a thread of
                    146:  * control, known in UN*X as a process; it has references to substructures
                    147:  * containing descriptions of things that the process uses, but may share
                    148:  * with related processes.  The process structure and the substructures
                    149:  * are always addressible except for those marked "(PROC ONLY)" below,
                    150:  * which might be addressible only on a processor on which the process
                    151:  * is running.
1.175   ! dsl       152:  *
        !           153:  * Fields marked 'p:' are protected by the process's own p_lock.
1.29      cgd       154:  */
1.122     lukem     155: struct proc {
                    156:        LIST_ENTRY(proc) p_list;        /* List of all processes */
                    157:
                    158:        /* Substructures: */
                    159:        struct pcred    *p_cred;        /* Process owner's identity */
                    160:        struct filedesc *p_fd;          /* Ptr to open files structure */
                    161:        struct cwdinfo  *p_cwdi;        /* cdir/rdir/cmask info */
                    162:        struct pstats   *p_stats;       /* Accounting/statistics (PROC ONLY) */
                    163:        struct plimit   *p_limit;       /* Process limits */
                    164:        struct vmspace  *p_vmspace;     /* Address space */
                    165:        struct sigacts  *p_sigacts;     /* Process sigactions (state is below)*/
1.155     thorpej   166:
                    167:        void            *p_ksems;       /* p1003.1b semaphores */
1.29      cgd       168:
                    169: #define        p_ucred         p_cred->pc_ucred
                    170: #define        p_rlimit        p_limit->pl_rlimit
                    171:
1.153     thorpej   172:        int             p_exitsig;      /* signal to sent to parent on exit */
                    173:        int             p_flag;         /* P_* flags. */
                    174:        char            p_stat;         /* S* process status. */
1.122     lukem     175:        char            p_pad1[3];
                    176:
1.153     thorpej   177:        pid_t           p_pid;          /* Process identifier. */
1.162     dsl       178:        SLIST_ENTRY(proc) p_dead;       /* Processes waiting for reaper */
1.153     thorpej   179:        LIST_ENTRY(proc) p_pglist;      /* List of processes in pgrp. */
                    180:        struct proc     *p_pptr;        /* Pointer to parent process. */
                    181:        LIST_ENTRY(proc) p_sibling;     /* List of sibling processes. */
                    182:        LIST_HEAD(, proc) p_children;   /* Pointer to list of children. */
                    183:
1.175   ! dsl       184:        struct simplelock p_lock;       /* Lock on proc state (p:) */
1.153     thorpej   185:
1.175   ! dsl       186:        LIST_HEAD(, lwp) p_lwps;        /* p: Pointer to list of LWPs. */
1.144     gmcgarry  187:
1.175   ! dsl       188:        LIST_HEAD(, ras) p_raslist;     /* p: Pointer to RAS queue */
        !           189:        u_int           p_nu;           /* unused: was number of RASs */
        !           190:        struct simplelock p_nu2;        /* unused: was Lock for RAS queue */
1.29      cgd       191:
1.153     thorpej   192: /* The following fields are all zeroed upon creation in fork. */
                    193: #define        p_startzero     p_nlwps
                    194:
1.175   ! dsl       195:        int             p_nlwps;        /* p: Number of LWPs */
        !           196:        int             p_nrlwps;       /* p: Number of running LWPs */
        !           197:        int             p_nzlwps;       /* p: Number of zombie LWPs */
        !           198:        int             p_nlwpid;       /* p: Next LWP ID */
1.29      cgd       199:
1.153     thorpej   200:        struct sadata   *p_sa;          /* Scheduler activation information */
1.29      cgd       201:
1.153     thorpej   202:        /* scheduling */
                    203:        u_int           p_estcpu;       /* Time averaged value of p_cpticks XXX belongs in p_startcopy section */
1.122     lukem     204:        int             p_cpticks;      /* Ticks of cpu time */
1.153     thorpej   205:        fixpt_t         p_pctcpu;       /* %cpu for this process during p_swtime */
                    206:
                    207:        struct proc     *p_opptr;       /* Save parent during ptrace. */
                    208:        struct ptimers  *p_timers;      /* Timers: real, virtual, profiling */
                    209:        struct timeval  p_rtime;        /* Real time */
                    210:        u_quad_t        p_uticks;       /* Statclock hits in user mode */
                    211:        u_quad_t        p_sticks;       /* Statclock hits in system mode */
                    212:        u_quad_t        p_iticks;       /* Statclock hits processing intr */
1.29      cgd       213:
1.122     lukem     214:        int             p_traceflag;    /* Kernel trace points */
                    215:        struct file     *p_tracep;      /* Trace to file */
1.138     christos  216:        void            *p_systrace;    /* Back pointer to systrace */
1.29      cgd       217:
1.153     thorpej   218:        struct vnode    *p_textvp;      /* Vnode of executable */
1.50      fvdl      219:
1.111     jdolecek  220:        const struct emul *p_emul;      /* Emulation information */
1.153     thorpej   221:        void            *p_emuldata;    /* Per-process emulation data, or NULL.
                    222:                                         * Malloc type M_EMULDATA
1.122     lukem     223:                                         */
1.153     thorpej   224:
1.167     itojun    225:        void            (*p_userret)(struct lwp *, void *);
1.153     thorpej   226:                                        /* Function to call at userret(). */
                    227:        void            *p_userret_arg;
                    228:
1.135     thorpej   229:        const struct execsw *p_execsw;  /* Exec package information */
1.147     jdolecek  230:        struct klist    p_klist;        /* Knotes attached to this process */
1.29      cgd       231:
1.122     lukem     232: /*
                    233:  * End area that is zeroed on creation
                    234:  */
1.29      cgd       235: #define        p_endzero       p_startcopy
                    236:
1.122     lukem     237: /*
                    238:  * The following fields are all copied upon creation in fork.
                    239:  */
1.118     jdolecek  240: #define        p_startcopy     p_sigctx.ps_startcopy
1.29      cgd       241:
1.153     thorpej   242:        struct sigctx   p_sigctx;       /* Signal state */
1.122     lukem     243:
                    244:        u_char          p_nice;         /* Process "nice" value */
1.125     simonb    245:        char            p_comm[MAXCOMLEN+1];    /* basename of last exec file */
1.122     lukem     246:
1.153     thorpej   247:        struct pgrp     *p_pgrp;        /* Pointer to process group */
1.29      cgd       248:
1.153     thorpej   249:        struct ps_strings *p_psstr;     /* address of process's ps_strings */
                    250:        size_t          p_psargv;       /* offset of ps_argvstr in above */
                    251:        size_t          p_psnargv;      /* offset of ps_nargvstr in above */
                    252:        size_t          p_psenv;        /* offset of ps_envstr in above */
                    253:        size_t          p_psnenv;       /* offset of ps_nenvstr in above */
1.29      cgd       254:
1.153     thorpej   255: /*
1.122     lukem     256:  * End area that is copied on creation
                    257:  */
1.153     thorpej   258: #define        p_endcopy       p_xstat
1.122     lukem     259:
                    260:        u_short         p_xstat;        /* Exit status for wait; also stop signal */
                    261:        u_short         p_acflag;       /* Accounting flags */
1.153     thorpej   262:        struct rusage   *p_ru;          /* Exit information. XXX */
                    263:
                    264:        struct mdproc   p_md;           /* Any machine-dependent fields */
1.29      cgd       265: };
                    266:
                    267: #define        p_session       p_pgrp->pg_session
                    268: #define        p_pgid          p_pgrp->pg_id
                    269:
1.91      thorpej   270: /*
                    271:  * Status values.
                    272:  *
                    273:  */
1.122     lukem     274: #define        SIDL            1               /* Process being created by fork */
1.153     thorpej   275: #define        SACTIVE         2               /* Process is not stopped */
1.122     lukem     276: #define        SSTOP           4               /* Process debugging or suspension */
                    277: #define        SZOMB           5               /* Awaiting collection by parent */
                    278: #define        SDEAD           6               /* Process is almost a zombie */
1.79      thorpej   279:
                    280: #define        P_ZOMBIE(p)     ((p)->p_stat == SZOMB || (p)->p_stat == SDEAD)
1.29      cgd       281:
1.41      mycroft   282: /* These flags are kept in p_flag. */
1.164     christos  283: #define        P_ADVLOCK       0x00000001 /* Process may hold a POSIX advisory lock */
                    284: #define        P_CONTROLT      0x00000002 /* Has a controlling terminal */
                    285: #define        P_NOCLDSTOP     0x00000008 /* No SIGCHLD when children stop */
                    286: #define        P_PPWAIT        0x00000010 /* Parent is waiting for child exec/exit */
                    287: #define        P_PROFIL        0x00000020 /* Has started profiling */
                    288: #define        P_SUGID         0x00000100 /* Had set id privileges since last exec */
                    289: #define        P_SYSTEM        0x00000200 /* System proc: no sigs, stats or swapping */
                    290: #define        P_SA            0x00000400 /* Using scheduler activations */
                    291: #define        P_TRACED        0x00000800 /* Debugged process being traced */
                    292: #define        P_WAITED        0x00001000 /* Debugging process has waited for child */
                    293: #define        P_WEXIT         0x00002000 /* Working on exiting */
                    294: #define        P_EXEC          0x00004000 /* Process called exec */
                    295: #define        P_OWEUPC        0x00008000 /* Owe process an addupc() at next ast */
                    296: #define        P_FSTRACE       0x00010000 /* Debugger process being traced by procfs */
                    297: #define        P_NOCLDWAIT     0x00020000 /* No zombies if child dies */
                    298: #define        P_32            0x00040000 /* 32-bit process (used on 64-bit kernels) */
                    299: #define        P_INEXEC        0x00100000 /* Process is exec'ing and can't be traced */
                    300: #define        P_SYSTRACE      0x00200000 /* Process system call tracing active */
                    301: #define        P_CHTRACED      0x00400000 /* Child has been traced & reparented */
                    302: #define        P_STOPFORK      0x00800000 /* Child will be stopped on fork(2) */
                    303: #define        P_STOPEXEC      0x01000000 /* Will be stopped on exec(2) */
1.29      cgd       304:
                    305: /*
1.78      thorpej   306:  * Macro to compute the exit signal to be delivered.
1.76      thorpej   307:  */
1.78      thorpej   308: #define        P_EXITSIG(p)    (((p)->p_flag & (P_TRACED|P_FSTRACE)) ? SIGCHLD : \
                    309:                         p->p_exitsig)
1.76      thorpej   310:
                    311: /*
1.29      cgd       312:  * MOVE TO ucred.h?
                    313:  *
                    314:  * Shareable process credentials (always resident).  This includes a reference
                    315:  * to the current user credentials as well as real and saved ids that may be
                    316:  * used to change ids.
                    317:  */
1.122     lukem     318: struct pcred {
                    319:        struct ucred    *pc_ucred;      /* Current credentials */
                    320:        uid_t           p_ruid;         /* Real user id */
                    321:        uid_t           p_svuid;        /* Saved effective user id */
                    322:        gid_t           p_rgid;         /* Real group id */
                    323:        gid_t           p_svgid;        /* Saved effective group id */
                    324:        int             p_refcnt;       /* Number of references */
1.29      cgd       325: };
                    326:
1.122     lukem     327: LIST_HEAD(proclist, proc);             /* A list of processes */
1.64      thorpej   328:
                    329: /*
                    330:  * This structure associates a proclist with its lock.
                    331:  */
                    332: struct proclist_desc {
1.122     lukem     333:        struct proclist *pd_list;       /* The list */
1.64      thorpej   334:        /*
                    335:         * XXX Add a pointer to the proclist's lock eventually.
                    336:         */
                    337: };
                    338:
1.38      jtc       339: #ifdef _KERNEL
1.156     thorpej   340: #include <sys/mallocvar.h>
                    341: MALLOC_DECLARE(M_EMULDATA);
                    342: MALLOC_DECLARE(M_PROC);
                    343: MALLOC_DECLARE(M_SESSION);
                    344: MALLOC_DECLARE(M_SUBPROC);
                    345:
1.29      cgd       346: /*
1.162     dsl       347:  * We use process IDs <= PID_MAX until there are > 16k processes.
                    348:  * NO_PGID is used to represent "no process group" for a tty.
1.29      cgd       349:  */
                    350: #define        PID_MAX         30000
1.163     jdolecek  351: #define        NO_PGID         ((pid_t)-1)
1.29      cgd       352:
1.122     lukem     353: #define        SESS_LEADER(p)  ((p)->p_session->s_leader == (p))
1.29      cgd       354: #define        SESSHOLD(s)     ((s)->s_count++)
1.122     lukem     355: #define        SESSRELE(s)                                                     \
                    356: do {                                                                   \
1.29      cgd       357:        if (--(s)->s_count == 0)                                        \
1.162     dsl       358:                sessdelete(s);                                          \
1.126     lukem     359: } while (/* CONSTCOND */ 0)
1.29      cgd       360:
1.54      thorpej   361:
                    362: /*
                    363:  * Flags passed to fork1().
                    364:  */
1.122     lukem     365: #define        FORK_PPWAIT     0x01            /* Block parent until child exit */
                    366: #define        FORK_SHAREVM    0x02            /* Share vmspace with parent */
                    367: #define        FORK_SHARECWD   0x04            /* Share cdir/rdir/cmask */
                    368: #define        FORK_SHAREFILES 0x08            /* Share file descriptors */
                    369: #define        FORK_SHARESIGS  0x10            /* Share signal actions */
1.141     pooka     370: #define        FORK_NOWAIT     0x20            /* Make init the parent of the child */
1.143     pooka     371: #define        FORK_CLEANFILES 0x40            /* Start with a clean descriptor set */
1.41      mycroft   372:
1.67      pk        373: /*
1.93      thorpej   374:  * Allow machine-dependent code to override curproc in <machine/cpu.h> for
1.83      thorpej   375:  * its own convenience.  Otherwise, we declare it as appropriate.
1.67      pk        376:  */
1.153     thorpej   377: #if !defined(curlwp)
1.83      thorpej   378: #if defined(MULTIPROCESSOR)
1.153     thorpej   379: #define        curlwp          curcpu()->ci_curlwp     /* Current running LWP */
1.83      thorpej   380: #else
1.153     thorpej   381: extern struct lwp      *curlwp;                /* Current running LWP */
1.83      thorpej   382: #endif /* MULTIPROCESSOR */
                    383: #endif /* ! curproc */
                    384:
1.174     yamt      385: static struct proc *__curproc(void);
                    386:
                    387: static __inline struct proc *
                    388: __curproc()
                    389: {
                    390:        struct lwp *l = curlwp;
                    391:
                    392:        if (l == NULL)
                    393:                return NULL;
                    394:        return l->l_proc;
                    395: }
                    396: #define        curproc __curproc()
1.153     thorpej   397:
1.122     lukem     398: extern struct proc     proc0;          /* Process slot for swapper */
                    399: extern int             nprocs, maxproc; /* Current and max number of procs */
1.29      cgd       400:
1.122     lukem     401: /* Process list lock; see kern_proc.c for locking protocol details */
                    402: extern struct lock     proclist_lock;
1.110     sommerfe  403:
1.122     lukem     404: extern struct proclist allproc;        /* List of all processes */
                    405: extern struct proclist zombproc;       /* List of zombie processes */
1.79      thorpej   406:
1.162     dsl       407: extern SLIST_HEAD(deadprocs, proc) deadprocs;  /* List of dead processes */
1.79      thorpej   408: extern struct simplelock deadproc_slock;
1.64      thorpej   409:
1.122     lukem     410: extern struct proc     *initproc;      /* Process slots for init, pager */
1.61      thorpej   411:
1.64      thorpej   412: extern const struct proclist_desc proclists[];
                    413:
1.122     lukem     414: extern struct pool     pcred_pool;     /* Memory pool for pcreds */
                    415: extern struct pool     plimit_pool;    /* Memory pool for plimits */
1.153     thorpej   416: extern struct pool     pstats_pool;    /* memory pool for pstats */
1.122     lukem     417: extern struct pool     rusage_pool;    /* Memory pool for rusages */
1.153     thorpej   418: extern struct pool     ptimer_pool;    /* Memory pool for ptimers */
1.29      cgd       419:
1.122     lukem     420: struct proc *pfind(pid_t);             /* Find process by id */
                    421: struct pgrp *pgfind(pid_t);            /* Find process group by id */
1.29      cgd       422:
1.98      thorpej   423: struct simplelock;
1.167     itojun    424: int    chgproccnt(uid_t, int);
                    425: int    enterpgrp(struct proc *, pid_t, int);
                    426: void   fixjobc(struct proc *, struct pgrp *, int);
                    427: int    inferior(struct proc *, struct proc *);
                    428: int    leavepgrp(struct proc *);
1.162     dsl       429: void   sessdelete(struct session *);
1.152     gmcgarry  430: void   yield(void);
1.153     thorpej   431: struct lwp *chooselwp(void);
1.167     itojun    432: void   pgdelete(struct pgrp *);
1.122     lukem     433: void   procinit(void);
1.153     thorpej   434: void   resetprocpriority(struct proc *);
1.122     lukem     435: void   suspendsched(void);
1.167     itojun    436: int    ltsleep(const void *, int, const char *, int,
1.122     lukem     437:            __volatile struct simplelock *);
1.167     itojun    438: void   wakeup(const void *);
                    439: void   wakeup_one(const void *);
1.122     lukem     440: void   reaper(void *);
1.153     thorpej   441: void   exit1(struct lwp *, int);
                    442: void   exit2(struct lwp *);
1.158     dsl       443: int    find_stopped_child(struct proc *, pid_t, int, struct proc **);
1.162     dsl       444: struct proc *proc_alloc(void);
                    445: void   proc0_insert(struct proc *, struct lwp *, struct pgrp *, struct session *);
1.158     dsl       446: void   proc_free(struct proc *);
1.162     dsl       447: void   proc_free_mem(struct proc *);
1.153     thorpej   448: void   exit_lwps(struct lwp *l);
                    449: int    fork1(struct lwp *, int, int, void *, size_t,
1.122     lukem     450:            void (*)(void *), void *, register_t *, struct proc **);
                    451: void   rqinit(void);
1.160     dsl       452: int    groupmember(gid_t, const struct ucred *);
1.161     dsl       453: int    pgid_in_session(struct proc *, pid_t);
1.146     gmcgarry  454: #ifndef cpu_idle
                    455: void   cpu_idle(void);
1.124     matt      456: #endif
1.153     thorpej   457: void   cpu_exit(struct lwp *, int);
                    458: void   cpu_lwp_fork(struct lwp *, struct lwp *, void *, size_t,
1.122     lukem     459:            void (*)(void *), void *);
1.123     lukem     460:
                    461:                /*
                    462:                 * XXX: use __P() to allow ports to have as a #define.
                    463:                 * XXX: we need a better way to solve this.
                    464:                 */
1.153     thorpej   465: void   cpu_wait __P((struct lwp *));
1.122     lukem     466:
                    467: void   child_return(void *);
                    468:
1.166     fvdl      469: int    proc_isunder(struct proc *, struct proc *);
1.122     lukem     470:
                    471: void   proclist_lock_read(void);
                    472: void   proclist_unlock_read(void);
                    473: int    proclist_lock_write(void);
                    474: void   proclist_unlock_write(int);
1.162     dsl       475: void   p_sugid(struct proc *);
1.98      thorpej   476:
1.122     lukem     477: /* Compatibility with old, non-interlocked tsleep call */
1.98      thorpej   478: #define        tsleep(chan, pri, wmesg, timo)                                  \
                    479:        ltsleep(chan, pri, wmesg, timo, NULL)
1.102     thorpej   480:
                    481: #if defined(MULTIPROCESSOR)
                    482: void   proc_trampoline_mp(void);       /* XXX */
1.139     yamt      483: #endif
                    484:
                    485: #ifdef KSTACK_CHECK_MAGIC
1.154     yamt      486: void kstack_setup_magic(const struct lwp *);
                    487: void kstack_check_magic(const struct lwp *);
1.139     yamt      488: #endif
                    489:
                    490: /*
                    491:  * kernel stack paramaters
                    492:  * XXX require sizeof(struct user)
                    493:  */
                    494: /* the lowest address of kernel stack */
                    495: #ifndef KSTACK_LOWEST_ADDR
1.154     yamt      496: #define        KSTACK_LOWEST_ADDR(l)   ((caddr_t)ALIGN((l)->l_addr + 1))
1.139     yamt      497: #endif
                    498: /* size of kernel stack */
                    499: #ifndef KSTACK_SIZE
                    500: #define        KSTACK_SIZE     (USPACE - ALIGN(sizeof(struct user)))
1.102     thorpej   501: #endif
1.98      thorpej   502:
1.38      jtc       503: #endif /* _KERNEL */
1.29      cgd       504: #endif /* !_SYS_PROC_H_ */

CVSweb <webmaster@jp.NetBSD.org>