The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/proc.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: proc.h,v 1.232.2.1 2007/04/01 16:16:20 bouyer Exp $    */
    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.
   20  * 3. Neither the name of the University nor the names of its contributors
   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  *
   36  *      @(#)proc.h      8.15 (Berkeley) 5/19/95
   37  */
   38 
   39 #ifndef _SYS_PROC_H_
   40 #define _SYS_PROC_H_
   41 
   42 #if defined(_KERNEL_OPT)
   43 #include "opt_multiprocessor.h"
   44 #include "opt_kstack.h"
   45 #include "opt_lockdebug.h"
   46 #endif
   47 
   48 #include <machine/proc.h>               /* Machine-dependent proc substruct */
   49 #include <sys/lock.h>
   50 #include <sys/lwp.h>
   51 #include <sys/queue.h>
   52 #include <sys/callout.h>
   53 #include <sys/signalvar.h>
   54 #include <sys/siginfo.h>
   55 #include <sys/event.h>
   56 #include <sys/specificdata.h>
   57 
   58 #ifndef _KERNEL
   59 #include <sys/time.h>
   60 #include <sys/resource.h>
   61 #endif
   62 
   63 /*
   64  * One structure allocated per session.
   65  */
   66 struct session {
   67         int             s_count;        /* Ref cnt; pgrps in session */
   68         u_int           s_flags;
   69 #define S_LOGIN_SET     1               /* s_login set in this session */
   70         struct proc     *s_leader;      /* Session leader */
   71         struct vnode    *s_ttyvp;       /* Vnode of controlling terminal */
   72         struct tty      *s_ttyp;        /* Controlling terminal */
   73         char            s_login[MAXLOGNAME]; /* Setlogin() name */
   74         pid_t           s_sid;          /* Session ID (pid of leader) */
   75 };
   76 
   77 /*
   78  * One structure allocated per process group.
   79  */
   80 struct pgrp {
   81         LIST_HEAD(, proc) pg_members;   /* Pointer to pgrp members */
   82         struct session  *pg_session;    /* Pointer to session */
   83         pid_t           pg_id;          /* Pgrp id */
   84         int             pg_jobc;        /*
   85                                          * Number of processes qualifying
   86                                          * pgrp for job control
   87                                          */
   88 };
   89 
   90 /*
   91  * One structure allocated per emulation.
   92  */
   93 struct exec_package;
   94 struct ps_strings;
   95 struct ras;
   96 struct sa_emul;
   97 struct kauth_cred;
   98 
   99 struct emul {
  100         const char      *e_name;        /* Symbolic name */
  101         const char      *e_path;        /* Extra emulation path (NULL if none)*/
  102 #ifndef __HAVE_MINIMAL_EMUL
  103         int             e_flags;        /* Miscellaneous flags, see above */
  104                                         /* Syscall handling function */
  105         const int       *e_errno;       /* Errno array */
  106         int             e_nosys;        /* Offset of the nosys() syscall */
  107         int             e_nsysent;      /* Number of system call entries */
  108 #endif
  109         const struct sysent *e_sysent;  /* System call array */
  110         const char * const *e_syscallnames; /* System call name array */
  111                                         /* Signal sending function */
  112         void            (*e_sendsig)(const struct ksiginfo *,
  113                                           const sigset_t *);
  114         void            (*e_trapsignal)(struct lwp *, const struct ksiginfo *);
  115         int             (*e_tracesig)(struct proc *, int);
  116         char            *e_sigcode;     /* Start of sigcode */
  117         char            *e_esigcode;    /* End of sigcode */
  118                                         /* Set registers before execution */
  119         struct uvm_object **e_sigobject;/* shared sigcode object */
  120         void            (*e_setregs)(struct lwp *, struct exec_package *,
  121                                           u_long);
  122 
  123                                         /* Per-process hooks */
  124         void            (*e_proc_exec)(struct proc *, struct exec_package *);
  125         void            (*e_proc_fork)(struct proc *, struct proc *, int);
  126         void            (*e_proc_exit)(struct proc *);
  127         void            (*e_lwp_fork)(struct lwp *, struct lwp *);
  128         void            (*e_lwp_exit)(struct lwp *);
  129 
  130 #ifdef __HAVE_SYSCALL_INTERN
  131         void            (*e_syscall_intern)(struct proc *);
  132 #else
  133         void            (*e_syscall)(void);
  134 #endif
  135                                         /* Emulation specific sysctl data */
  136         struct sysctlnode *e_sysctlovly;
  137         int             (*e_fault)(struct proc *, vaddr_t, int);
  138 
  139         vaddr_t         (*e_vm_default_addr)(struct proc *, vaddr_t, vsize_t);
  140 
  141         /* Emulation-specific hook for userspace page faults */
  142         int             (*e_usertrap)(struct lwp *, vaddr_t, void *);
  143 
  144         /* SA-related information */
  145         const struct sa_emul *e_sa;
  146 };
  147 
  148 /*
  149  * Emulation miscelaneous flags
  150  */
  151 #define EMUL_HAS_SYS___syscall  0x001   /* Has SYS___syscall */
  152 
  153 /*
  154  * Description of a process.
  155  *
  156  * This structure contains the information needed to manage a thread of
  157  * control, known in UN*X as a process; it has references to substructures
  158  * containing descriptions of things that the process uses, but may share
  159  * with related processes.  The process structure and the substructures
  160  * are always addressible except for those marked "(PROC ONLY)" below,
  161  * which might be addressible only on a processor on which the process
  162  * is running.
  163  *
  164  * Field markings and the corresponding locks (not yet fully implemented,
  165  * more a statement of intent):
  166  *
  167  * c:   P_CRLOCK - credentials write lock
  168  * l:   proclist_lock
  169  * p:   p->p_lock
  170  * s:   sched_lock
  171  */
  172 struct proc {
  173         LIST_ENTRY(proc) p_list;        /* l: List of all processes */
  174 
  175         /* Substructures: */
  176         struct kauth_cred *p_cred;      /* p, c: Master copy of credentials */
  177         struct filedesc *p_fd;          /* Ptr to open files structure */
  178         struct cwdinfo  *p_cwdi;        /* cdir/rdir/cmask info */
  179         struct pstats   *p_stats;       /* Accounting/statistics (PROC ONLY) */
  180         struct plimit   *p_limit;       /* Process limits */
  181         struct vmspace  *p_vmspace;     /* Address space */
  182         struct sigacts  *p_sigacts;     /* Process sigactions (state is below)*/
  183 
  184 #define p_rlimit        p_limit->pl_rlimit
  185 
  186         specificdata_reference
  187                         p_specdataref;  /* subsystem proc-specific data */
  188 
  189         int             p_exitsig;      /* signal to send to parent on exit */
  190         int             p_flag;         /* P_* flags. */
  191         char            p_stat;         /* S* process status. */
  192         char            p_pad1[3];
  193 
  194         pid_t           p_pid;          /* Process identifier. */
  195         LIST_ENTRY(proc) p_pglist;      /* l: List of processes in pgrp. */
  196         struct proc     *p_pptr;        /* l: Pointer to parent process. */
  197         LIST_ENTRY(proc) p_sibling;     /* l: List of sibling processes. */
  198         LIST_HEAD(, proc) p_children;   /* l: Pointer to list of children. */
  199 
  200         struct simplelock p_lock;       /* Lock on proc state (p:) */
  201 
  202         /* XXX dsl: locking of LWP info is suspect in schedcpu and kpsignal2 */
  203         LIST_HEAD(, lwp) p_lwps;        /* p: Pointer to list of LWPs. */
  204 
  205         LIST_HEAD(, ras) p_raslist;     /* p: Pointer to RAS queue */
  206 
  207 /* The following fields are all zeroed upon creation in fork. */
  208 #define p_startzero     p_nlwps
  209 
  210         int             p_nlwps;        /* p: Number of LWPs */
  211         int             p_nrlwps;       /* s: Number of running LWPs */
  212         int             p_nzlwps;       /* p: Number of zombie LWPs */
  213         int             p_nlwpid;       /* p: Next LWP ID */
  214 
  215         u_int           p_nstopchild;   /* l: Count of stopped/dead children */
  216 
  217         struct sadata   *p_sa;          /* Scheduler activation information */
  218 
  219         /* scheduling */
  220         fixpt_t         p_estcpu;       /* Time averaged value of p_cpticks XXX belongs in p_startcopy section */
  221         fixpt_t         p_estcpu_inherited;
  222         unsigned int    p_forktime;
  223         int             p_cpticks;      /* Ticks of CPU time */
  224         fixpt_t         p_pctcpu;       /* %cpu for this process during p_swtime */
  225 
  226         struct proc     *p_opptr;       /* Save parent during ptrace. */
  227         struct ptimers  *p_timers;      /* Timers: real, virtual, profiling */
  228         struct timeval  p_rtime;        /* Real time */
  229         u_quad_t        p_uticks;       /* Statclock hits in user mode */
  230         u_quad_t        p_sticks;       /* Statclock hits in system mode */
  231         u_quad_t        p_iticks;       /* Statclock hits processing intr */
  232 
  233         int             p_traceflag;    /* Kernel trace points */
  234         void            *p_tracep;      /* Trace private data */
  235         void            *p_systrace;    /* Back pointer to systrace */
  236 
  237         struct vnode    *p_textvp;      /* Vnode of executable */
  238 
  239         const struct emul *p_emul;      /* Emulation information */
  240         void            *p_emuldata;    /* Per-process emulation data, or NULL.
  241                                          * Malloc type M_EMULDATA
  242                                          */
  243 
  244         void            (*p_userret)(struct lwp *, void *);
  245                                         /* Function to call at userret(). */
  246         void            *p_userret_arg;
  247 
  248         const struct execsw *p_execsw;  /* Exec package information */
  249         struct klist    p_klist;        /* Knotes attached to this process */
  250 
  251 /*
  252  * End area that is zeroed on creation
  253  */
  254 #define p_endzero       p_startcopy
  255 
  256 /*
  257  * The following fields are all copied upon creation in fork.
  258  */
  259 #define p_startcopy     p_sigctx.ps_startcopy
  260 
  261         struct sigctx   p_sigctx;       /* Signal state */
  262 
  263         u_char          p_nice;         /* Process "nice" value */
  264         char            p_comm[MAXCOMLEN+1];    /* basename of last exec file */
  265 
  266         struct pgrp     *p_pgrp;        /* Pointer to process group */
  267 
  268         struct ps_strings *p_psstr;     /* address of process's ps_strings */
  269         size_t          p_psargv;       /* offset of ps_argvstr in above */
  270         size_t          p_psnargv;      /* offset of ps_nargvstr in above */
  271         size_t          p_psenv;        /* offset of ps_envstr in above */
  272         size_t          p_psnenv;       /* offset of ps_nenvstr in above */
  273 
  274 /*
  275  * End area that is copied on creation
  276  */
  277 #define p_endcopy       p_xstat
  278 
  279         u_short         p_xstat;        /* Exit status for wait; also stop signal */
  280         u_short         p_acflag;       /* p: Acc. flags; see struct lwp also */
  281         struct rusage   *p_ru;          /* Exit information. XXX */
  282 
  283         struct mdproc   p_md;           /* Any machine-dependent fields */
  284 };
  285 
  286 #define p_session       p_pgrp->pg_session
  287 #define p_pgid          p_pgrp->pg_id
  288 
  289 /*
  290  * Status values.
  291  *
  292  */
  293 #define SIDL            1               /* Process being created by fork */
  294 #define SACTIVE         2               /* Process is not stopped */
  295 #define SDYING          3               /* About to die */
  296 #define SSTOP           4               /* Process debugging or suspension */
  297 #define SZOMB           5               /* Awaiting collection by parent */
  298 
  299 #define P_ZOMBIE(p)     ((p)->p_stat == SZOMB || (p)->p_stat == SDYING)
  300 
  301 /* These flags are kept in p_flag. */
  302 #define P_ADVLOCK       0x00000001 /* Process may hold a POSIX advisory lock */
  303 #define P_CONTROLT      0x00000002 /* Has a controlling terminal */
  304 #define P_INMEM      /* 0x00000004 */   L_INMEM
  305 #define P_NOCLDSTOP     0x00000008 /* No SIGCHLD when children stop */
  306 #define P_PPWAIT        0x00000010 /* Parent is waiting for child exec/exit */
  307 #define P_PROFIL        0x00000020 /* Has started profiling */
  308 #define P_SELECT     /* 0x00000040 */   L_SELECT
  309 #define P_SINTR      /* 0x00000080 */   L_SINTR
  310 #define P_SUGID         0x00000100 /* Had set id privileges since last exec */
  311 #define P_SYSTEM        0x00000200 /* System proc: no sigs, stats or swapping */
  312 #define P_SA         /* 0x00000400 */   L_SA
  313 #define P_TRACED        0x00000800 /* Debugged process being traced */
  314 #define P_WAITED        0x00001000 /* Debugging process has waited for child */
  315 #define P_WEXIT         0x00002000 /* Working on exiting */
  316 #define P_EXEC          0x00004000 /* Process called exec */
  317 #define P_OWEUPC        0x00008000 /* Owe process an addupc() at next ast */
  318 #define P_FSTRACE       0x00010000 /* Debugger process being traced by procfs */
  319 #define P_NOCLDWAIT     0x00020000 /* No zombies if child dies */
  320 #define P_32            0x00040000 /* 32-bit process (used on 64-bit kernels) */
  321 #define P_CLDSIGIGN     0x00080000 /* Process is ignoring SIGCHLD */
  322 #define P_INEXEC        0x00100000 /* Process is exec'ing and can't be traced */
  323 #define P_SYSTRACE      0x00200000 /* Process system call tracing active */
  324 #define P_CHTRACED      0x00400000 /* Child has been traced & reparented */
  325 #define P_STOPFORK      0x00800000 /* Child will be stopped on fork(2) */
  326 #define P_STOPEXEC      0x01000000 /* Will be stopped on exec(2) */
  327 #define P_STOPEXIT      0x02000000 /* Will be stopped at process exit */
  328 #define P_SYSCALL       0x04000000 /* process has PT_SYSCALL enabled */
  329 #define P_UNUSED3       0x08000000
  330 #define P_UNUSED2       0x10000000
  331 #define P_CRLOCK        0x20000000 /* p_cred write lock */
  332 #define P_UNUSED1       0x40000000
  333 #define P_MARKER        0x80000000 /* Is a dummy marker process */
  334 
  335 #define P_SHARED        (L_INMEM|L_SELECT|L_SINTR|L_SA)
  336 
  337 /*
  338  * Macro to compute the exit signal to be delivered.
  339  */
  340 #define P_EXITSIG(p)    (((p)->p_flag & (P_TRACED|P_FSTRACE)) ? SIGCHLD : \
  341                          p->p_exitsig)
  342 
  343 /*
  344  * MOVE TO ucred.h?
  345  *
  346  * Shareable process credentials (always resident).  This includes a reference
  347  * to the current user credentials as well as real and saved ids that may be
  348  * used to change ids.
  349  */
  350 struct pcred {
  351         struct ucred    *pc_ucred;      /* Current credentials */
  352         uid_t           p_ruid;         /* Real user id */
  353         uid_t           p_svuid;        /* Saved effective user id */
  354         gid_t           p_rgid;         /* Real group id */
  355         gid_t           p_svgid;        /* Saved effective group id */
  356         int             p_refcnt;       /* Number of references */
  357 };
  358 
  359 LIST_HEAD(proclist, proc);              /* A list of processes */
  360 
  361 /*
  362  * This structure associates a proclist with its lock.
  363  */
  364 struct proclist_desc {
  365         struct proclist *pd_list;       /* The list */
  366         /*
  367          * XXX Add a pointer to the proclist's lock eventually.
  368          */
  369 };
  370 
  371 #ifdef _KERNEL
  372 #include <sys/mallocvar.h>
  373 MALLOC_DECLARE(M_EMULDATA);
  374 MALLOC_DECLARE(M_PROC);
  375 MALLOC_DECLARE(M_SESSION);
  376 MALLOC_DECLARE(M_SUBPROC);      /* XXX - only used by sparc/sparc64 */
  377 
  378 /*
  379  * We use process IDs <= PID_MAX until there are > 16k processes.
  380  * NO_PGID is used to represent "no process group" for a tty.
  381  */
  382 #define PID_MAX         30000
  383 #define NO_PGID         ((pid_t)-1)
  384 
  385 #define SESS_LEADER(p)  ((p)->p_session->s_leader == (p))
  386 #define SESSHOLD(s)     ((s)->s_count++)
  387 #define SESSRELE(s)                                                     \
  388 do {                                                                    \
  389         if (--(s)->s_count == 0)                                        \
  390                 sessdelete(s);                                          \
  391 } while (/* CONSTCOND */ 0)
  392 
  393 
  394 /*
  395  * Flags passed to fork1().
  396  */
  397 #define FORK_PPWAIT     0x01            /* Block parent until child exit */
  398 #define FORK_SHAREVM    0x02            /* Share vmspace with parent */
  399 #define FORK_SHARECWD   0x04            /* Share cdir/rdir/cmask */
  400 #define FORK_SHAREFILES 0x08            /* Share file descriptors */
  401 #define FORK_SHARESIGS  0x10            /* Share signal actions */
  402 #define FORK_NOWAIT     0x20            /* Make init the parent of the child */
  403 #define FORK_CLEANFILES 0x40            /* Start with a clean descriptor set */
  404 
  405 /*
  406  * Allow machine-dependent code to override curproc in <machine/cpu.h> for
  407  * its own convenience.  Otherwise, we declare it as appropriate.
  408  */
  409 #if !defined(curlwp)
  410 #if defined(MULTIPROCESSOR)
  411 #define curlwp          curcpu()->ci_curlwp     /* Current running LWP */
  412 #else
  413 extern struct lwp       *curlwp;                /* Current running LWP */
  414 #endif /* MULTIPROCESSOR */
  415 #endif /* ! curproc */
  416 
  417 static struct proc *__curproc(void);
  418 
  419 static __inline struct proc *
  420 __curproc()
  421 {
  422         struct lwp *l = curlwp;
  423 
  424         if (l == NULL)
  425                 return NULL;
  426         return l->l_proc;
  427 }
  428 #define curproc __curproc()
  429 
  430 extern struct proc      proc0;          /* Process slot for swapper */
  431 extern int              nprocs, maxproc; /* Current and max number of procs */
  432 #define vmspace_kernel()        (proc0.p_vmspace)
  433 
  434 /* Process list lock; see kern_proc.c for locking protocol details */
  435 extern struct lock      proclist_lock;
  436 
  437 extern struct proclist  allproc;        /* List of all processes */
  438 extern struct proclist  zombproc;       /* List of zombie processes */
  439 
  440 extern SLIST_HEAD(deadprocs, proc) deadprocs;   /* List of dead processes */
  441 extern struct simplelock deadproc_slock;
  442 
  443 extern struct proc      *initproc;      /* Process slots for init, pager */
  444 
  445 extern const struct proclist_desc proclists[];
  446 
  447 extern struct pool      pcred_pool;     /* Memory pool for pcreds */
  448 extern struct pool      plimit_pool;    /* Memory pool for plimits */
  449 extern struct pool      pstats_pool;    /* memory pool for pstats */
  450 extern struct pool      rusage_pool;    /* Memory pool for rusages */
  451 extern struct pool      ptimer_pool;    /* Memory pool for ptimers */
  452 
  453 struct proc *p_find(pid_t, uint);       /* Find process by id */
  454 struct pgrp *pg_find(pid_t, uint);      /* Find process group by id */
  455 /* Flags values for p_find() and pg_find(). */
  456 #define PFIND_ZOMBIE            1       /* look for zombies as well */
  457 #define PFIND_LOCKED            2       /* proclist locked on entry */
  458 #define PFIND_UNLOCK_FAIL       4       /* unlock proclist on failure */
  459 #define PFIND_UNLOCK_OK         8       /* unlock proclist on success */
  460 #define PFIND_UNLOCK            (PFIND_UNLOCK_OK | PFIND_UNLOCK_FAIL)
  461 /* For source compatibility. but UNLOCK_OK gives a stale answer... */
  462 #define pfind(pid) p_find((pid), PFIND_UNLOCK)
  463 #define pgfind(pgid) pg_find((pgid), PFIND_UNLOCK)
  464 
  465 struct simplelock;
  466 int     enterpgrp(struct proc *, pid_t, int);
  467 void    fixjobc(struct proc *, struct pgrp *, int);
  468 int     inferior(struct proc *, struct proc *);
  469 int     leavepgrp(struct proc *);
  470 void    sessdelete(struct session *);
  471 void    yield(void);
  472 void    pgdelete(struct pgrp *);
  473 void    procinit(void);
  474 void    resetprocpriority(struct proc *);
  475 void    suspendsched(void);
  476 int     ltsleep(volatile const void *, int, const char *, int,
  477             volatile struct simplelock *);
  478 void    wakeup(volatile const void *);
  479 void    wakeup_one(volatile const void *);
  480 void    exit1(struct lwp *, int);
  481 int     find_stopped_child(struct proc *, pid_t, int, struct proc **);
  482 struct proc *proc_alloc(void);
  483 void    proc0_init(void);
  484 void    proc_free(struct proc *);
  485 void    proc_free_mem(struct proc *);
  486 void    exit_lwps(struct lwp *l);
  487 int     fork1(struct lwp *, int, int, void *, size_t,
  488             void (*)(void *), void *, register_t *, struct proc **);
  489 void    rqinit(void);
  490 int     pgid_in_session(struct proc *, pid_t);
  491 #ifndef cpu_idle
  492 void    cpu_idle(void);
  493 #endif
  494 void    cpu_exit(struct lwp *);
  495 void    cpu_lwp_fork(struct lwp *, struct lwp *, void *, size_t,
  496             void (*)(void *), void *);
  497 #ifndef cpu_lwp_free
  498 void    cpu_lwp_free(struct lwp *, int);
  499 #endif
  500 
  501 #ifdef __HAVE_SYSCALL_INTERN
  502 void    syscall_intern(struct proc *);
  503 #endif
  504 
  505 void    child_return(void *);
  506 
  507 int     proc_isunder(struct proc *, struct lwp *);
  508 void    proc_stop(struct proc *, int);
  509 
  510 void    proclist_lock_read(void);
  511 void    proclist_unlock_read(void);
  512 int     proclist_lock_write(void);
  513 void    proclist_unlock_write(int);
  514 void    p_sugid(struct proc *);
  515 
  516 int     proc_vmspace_getref(struct proc *, struct vmspace **);
  517 void    proc_crmod_leave(struct proc *, kauth_cred_t, kauth_cred_t);
  518 void    proc_crmod_enter(struct proc *);
  519 
  520 int     proc_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
  521 void    proc_specific_key_delete(specificdata_key_t);
  522 void    proc_initspecific(struct proc *);
  523 void    proc_finispecific(struct proc *);
  524 void *  proc_getspecific(struct proc *, specificdata_key_t);
  525 void    proc_setspecific(struct proc *, specificdata_key_t, void *);
  526 
  527 int     proclist_foreach_call(struct proclist *,
  528     int (*)(struct proc *, void *arg), void *);
  529 static __inline struct proc *_proclist_skipmarker(struct proc *);
  530 
  531 static __inline struct proc *
  532 _proclist_skipmarker(struct proc *p0)
  533 {
  534         struct proc *p = p0;
  535 
  536         while (p != NULL && p->p_flag & P_MARKER)
  537                 p = LIST_NEXT(p, p_list);
  538 
  539         return p;
  540 }
  541 #define PROCLIST_FOREACH(var, head)                                     \
  542         for ((var) = LIST_FIRST(head);                                  \
  543                 ((var) = _proclist_skipmarker(var)) != NULL;            \
  544                 (var) = LIST_NEXT(var, p_list))
  545 
  546 #if defined(LOCKDEBUG)
  547 void assert_sleepable(struct simplelock *, const char *);
  548 #define ASSERT_SLEEPABLE(lk, msg)       assert_sleepable((lk), (msg))
  549 #else /* defined(LOCKDEBUG) */
  550 #define ASSERT_SLEEPABLE(lk, msg)       /* nothing */
  551 #endif /* defined(LOCKDEBUG) */
  552 
  553 /* Compatibility with old, non-interlocked tsleep call */
  554 #define tsleep(chan, pri, wmesg, timo)                                  \
  555         ltsleep(chan, pri, wmesg, timo, NULL)
  556 
  557 #if defined(MULTIPROCESSOR)
  558 void    proc_trampoline_mp(void);       /* XXX */
  559 #endif
  560 
  561 #ifdef KSTACK_CHECK_MAGIC
  562 void kstack_setup_magic(const struct lwp *);
  563 void kstack_check_magic(const struct lwp *);
  564 #endif
  565 
  566 /*
  567  * kernel stack paramaters
  568  * XXX require sizeof(struct user)
  569  */
  570 /* the lowest address of kernel stack */
  571 #ifndef KSTACK_LOWEST_ADDR
  572 #define KSTACK_LOWEST_ADDR(l)   ((caddr_t)ALIGN((l)->l_addr + 1))
  573 #endif
  574 /* size of kernel stack */
  575 #ifndef KSTACK_SIZE
  576 #define KSTACK_SIZE     (USPACE - ALIGN(sizeof(struct user)))
  577 #endif
  578 
  579 #endif  /* _KERNEL */
  580 #endif  /* !_SYS_PROC_H_ */

Cache object: e21c2b746d68cba77e2429487a77771b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.