proc.h (171611) | proc.h (172207) |
---|---|
1/*- 2 * Copyright (c) 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)proc.h 8.15 (Berkeley) 5/19/95 | 1/*- 2 * Copyright (c) 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)proc.h 8.15 (Berkeley) 5/19/95 |
35 * $FreeBSD: head/sys/sys/proc.h 171611 2007-07-27 09:21:18Z attilio $ | 35 * $FreeBSD: head/sys/sys/proc.h 172207 2007-09-17 05:31:39Z jeff $ |
36 */ 37 38#ifndef _SYS_PROC_H_ 39#define _SYS_PROC_H_ 40 41#include <sys/callout.h> /* For struct callout. */ 42#include <sys/event.h> /* For struct klist. */ 43#ifndef _KERNEL --- 267 unchanged lines hidden (view full) --- 311} while (0) 312 313/* 314 * Flags kept in td_flags: 315 * To change these you MUST have the scheduler lock. 316 */ 317#define TDF_BORROWING 0x00000001 /* Thread is borrowing pri from another. */ 318#define TDF_INPANIC 0x00000002 /* Caused a panic, let it drive crashdump. */ | 36 */ 37 38#ifndef _SYS_PROC_H_ 39#define _SYS_PROC_H_ 40 41#include <sys/callout.h> /* For struct callout. */ 42#include <sys/event.h> /* For struct klist. */ 43#ifndef _KERNEL --- 267 unchanged lines hidden (view full) --- 311} while (0) 312 313/* 314 * Flags kept in td_flags: 315 * To change these you MUST have the scheduler lock. 316 */ 317#define TDF_BORROWING 0x00000001 /* Thread is borrowing pri from another. */ 318#define TDF_INPANIC 0x00000002 /* Caused a panic, let it drive crashdump. */ |
319#define TDF_INMEM 0x00000004 /* Thread's stack is in memory. */ |
|
319#define TDF_SINTR 0x00000008 /* Sleep is interruptible. */ 320#define TDF_TIMEOUT 0x00000010 /* Timing out during sleep. */ 321#define TDF_IDLETD 0x00000020 /* This is a per-CPU idle thread. */ 322#define TDF_SELECT 0x00000040 /* Selecting; wakeup/waiting danger. */ 323#define TDF_SLEEPABORT 0x00000080 /* sleepq_abort was called. */ 324#define TDF_UNUSEDx100 0x00000100 /* --available-- */ 325#define TDF_UBORROWING 0x00000200 /* Thread is borrowing user pri. */ 326#define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */ 327#define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */ 328#define TDF_TIMOFAIL 0x00001000 /* Timeout from sleep after we were awake. */ 329#define TDF_INTERRUPT 0x00002000 /* Thread is marked as interrupted. */ 330#define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */ 331#define TDF_UNUSED15 0x00008000 /* --available-- */ 332#define TDF_NEEDRESCHED 0x00010000 /* Thread needs to yield. */ 333#define TDF_NEEDSIGCHK 0x00020000 /* Thread may need signal delivery. */ 334#define TDF_XSIG 0x00040000 /* Thread is exchanging signal under trace */ 335#define TDF_UNUSED19 0x00080000 /* Thread is sleeping on a umtx. */ 336#define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */ 337#define TDF_DBSUSPEND 0x00200000 /* Thread is suspended by debugger */ | 320#define TDF_SINTR 0x00000008 /* Sleep is interruptible. */ 321#define TDF_TIMEOUT 0x00000010 /* Timing out during sleep. */ 322#define TDF_IDLETD 0x00000020 /* This is a per-CPU idle thread. */ 323#define TDF_SELECT 0x00000040 /* Selecting; wakeup/waiting danger. */ 324#define TDF_SLEEPABORT 0x00000080 /* sleepq_abort was called. */ 325#define TDF_UNUSEDx100 0x00000100 /* --available-- */ 326#define TDF_UBORROWING 0x00000200 /* Thread is borrowing user pri. */ 327#define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */ 328#define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */ 329#define TDF_TIMOFAIL 0x00001000 /* Timeout from sleep after we were awake. */ 330#define TDF_INTERRUPT 0x00002000 /* Thread is marked as interrupted. */ 331#define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */ 332#define TDF_UNUSED15 0x00008000 /* --available-- */ 333#define TDF_NEEDRESCHED 0x00010000 /* Thread needs to yield. */ 334#define TDF_NEEDSIGCHK 0x00020000 /* Thread may need signal delivery. */ 335#define TDF_XSIG 0x00040000 /* Thread is exchanging signal under trace */ 336#define TDF_UNUSED19 0x00080000 /* Thread is sleeping on a umtx. */ 337#define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */ 338#define TDF_DBSUSPEND 0x00200000 /* Thread is suspended by debugger */ |
338#define TDF_UNUSED22 0x00400000 /* --available-- */ | 339#define TDF_SWAPINREQ 0x00400000 /* Swapin request due to wakeup. */ |
339#define TDF_UNUSED23 0x00800000 /* --available-- */ 340#define TDF_SCHED0 0x01000000 /* Reserved for scheduler private use */ 341#define TDF_SCHED1 0x02000000 /* Reserved for scheduler private use */ 342#define TDF_SCHED2 0x04000000 /* Reserved for scheduler private use */ 343#define TDF_SCHED3 0x08000000 /* Reserved for scheduler private use */ | 340#define TDF_UNUSED23 0x00800000 /* --available-- */ 341#define TDF_SCHED0 0x01000000 /* Reserved for scheduler private use */ 342#define TDF_SCHED1 0x02000000 /* Reserved for scheduler private use */ 343#define TDF_SCHED2 0x04000000 /* Reserved for scheduler private use */ 344#define TDF_SCHED3 0x08000000 /* Reserved for scheduler private use */ |
345#define TDF_ALRMPEND 0x10000000 /* Pending SIGVTALRM needs to be posted. */ 346#define TDF_PROFPEND 0x20000000 /* Pending SIGPROF needs to be posted. */ 347#define TDF_MACPEND 0x40000000 /* AST-based MAC event pending. */ |
|
344 345/* 346 * "Private" flags kept in td_pflags: 347 * These are only accessed by curthread and thus need no locking. 348 */ 349#define TDP_OLDMASK 0x00000001 /* Need to restore mask after suspend. */ 350#define TDP_INKTR 0x00000002 /* Thread is currently in KTR code. */ 351#define TDP_INKTRACE 0x00000004 /* Thread is currently in KTRACE code. */ --- 139 unchanged lines hidden (view full) --- 491 struct callout p_limco; /* (c) Limit callout handle */ 492 struct sigacts *p_sigacts; /* (x) Signal actions, state (CPU). */ 493 494 /* 495 * The following don't make too much sense. 496 * See the td_ or ke_ versions of the same flags. 497 */ 498 int p_flag; /* (c) P_* flags. */ | 348 349/* 350 * "Private" flags kept in td_pflags: 351 * These are only accessed by curthread and thus need no locking. 352 */ 353#define TDP_OLDMASK 0x00000001 /* Need to restore mask after suspend. */ 354#define TDP_INKTR 0x00000002 /* Thread is currently in KTR code. */ 355#define TDP_INKTRACE 0x00000004 /* Thread is currently in KTRACE code. */ --- 139 unchanged lines hidden (view full) --- 495 struct callout p_limco; /* (c) Limit callout handle */ 496 struct sigacts *p_sigacts; /* (x) Signal actions, state (CPU). */ 497 498 /* 499 * The following don't make too much sense. 500 * See the td_ or ke_ versions of the same flags. 501 */ 502 int p_flag; /* (c) P_* flags. */ |
499 int p_sflag; /* (j) PS_* flags. */ | |
500 enum { 501 PRS_NEW = 0, /* In creation */ 502 PRS_NORMAL, /* threads can be run. */ 503 PRS_ZOMBIE 504 } p_state; /* (j/c) S* process status. */ 505 pid_t p_pid; /* (b) Process identifier. */ 506 LIST_ENTRY(proc) p_hash; /* (d) Hash chain. */ 507 LIST_ENTRY(proc) p_pglist; /* (g + e) List of processes in pgrp. */ --- 105 unchanged lines hidden (view full) --- 613#define P_PROTECTED 0x100000 /* Do not kill on memory overcommit. */ 614#define P_SIGEVENT 0x200000 /* Process pending signals changed. */ 615#define P_SINGLE_BOUNDARY 0x400000 /* Threads should suspend at user boundary. */ 616#define P_HWPMC 0x800000 /* Process is using HWPMCs */ 617 618#define P_JAILED 0x1000000 /* Process is in jail. */ 619#define P_INEXEC 0x4000000 /* Process is in execve(). */ 620#define P_STATCHILD 0x8000000 /* Child process stopped or exited. */ | 503 enum { 504 PRS_NEW = 0, /* In creation */ 505 PRS_NORMAL, /* threads can be run. */ 506 PRS_ZOMBIE 507 } p_state; /* (j/c) S* process status. */ 508 pid_t p_pid; /* (b) Process identifier. */ 509 LIST_ENTRY(proc) p_hash; /* (d) Hash chain. */ 510 LIST_ENTRY(proc) p_pglist; /* (g + e) List of processes in pgrp. */ --- 105 unchanged lines hidden (view full) --- 616#define P_PROTECTED 0x100000 /* Do not kill on memory overcommit. */ 617#define P_SIGEVENT 0x200000 /* Process pending signals changed. */ 618#define P_SINGLE_BOUNDARY 0x400000 /* Threads should suspend at user boundary. */ 619#define P_HWPMC 0x800000 /* Process is using HWPMCs */ 620 621#define P_JAILED 0x1000000 /* Process is in jail. */ 622#define P_INEXEC 0x4000000 /* Process is in execve(). */ 623#define P_STATCHILD 0x8000000 /* Child process stopped or exited. */ |
624#define P_INMEM 0x10000000 /* Loaded into memory. */ 625#define P_SWAPPINGOUT 0x20000000 /* Process is being swapped out. */ 626#define P_SWAPPINGIN 0x40000000 /* Process is being swapped in. */ |
|
621 622#define P_STOPPED (P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE) 623#define P_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED) 624 | 627 628#define P_STOPPED (P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE) 629#define P_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED) 630 |
625/* These flags are kept in p_sflag and are protected with proc slock. */ 626#define PS_INMEM 0x00001 /* Loaded into memory. */ 627#define PS_ALRMPEND 0x00020 /* Pending SIGVTALRM needs to be posted. */ 628#define PS_PROFPEND 0x00040 /* Pending SIGPROF needs to be posted. */ 629#define PS_SWAPINREQ 0x00100 /* Swapin request due to wakeup. */ 630#define PS_SWAPPINGOUT 0x00200 /* Process is being swapped out. */ 631#define PS_SWAPPINGIN 0x04000 /* Process is being swapped in. */ 632#define PS_MACPEND 0x08000 /* AST-based MAC event pending. */ 633 | |
634/* 635 * These were process status values (p_stat), now they are only used in 636 * legacy conversion code. 637 */ 638#define SIDL 1 /* Process being created by fork. */ 639#define SRUN 2 /* Currently runnable. */ 640#define SSLEEP 3 /* Sleeping on an address. */ 641#define SSTOP 4 /* Process debugging or suspension. */ --- 96 unchanged lines hidden (view full) --- 738 _PHOLD(p); \ 739 PROC_UNLOCK(p); \ 740} while (0) 741#define _PHOLD(p) do { \ 742 PROC_LOCK_ASSERT((p), MA_OWNED); \ 743 KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc, \ 744 ("PHOLD of exiting process")); \ 745 (p)->p_lock++; \ | 631/* 632 * These were process status values (p_stat), now they are only used in 633 * legacy conversion code. 634 */ 635#define SIDL 1 /* Process being created by fork. */ 636#define SRUN 2 /* Currently runnable. */ 637#define SSLEEP 3 /* Sleeping on an address. */ 638#define SSTOP 4 /* Process debugging or suspension. */ --- 96 unchanged lines hidden (view full) --- 735 _PHOLD(p); \ 736 PROC_UNLOCK(p); \ 737} while (0) 738#define _PHOLD(p) do { \ 739 PROC_LOCK_ASSERT((p), MA_OWNED); \ 740 KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc, \ 741 ("PHOLD of exiting process")); \ 742 (p)->p_lock++; \ |
746 if (((p)->p_sflag & PS_INMEM) == 0) \ | 743 if (((p)->p_flag & P_INMEM) == 0) \ |
747 faultin((p)); \ 748} while (0) 749#define PROC_ASSERT_HELD(p) do { \ 750 KASSERT((p)->p_lock > 0, ("process not held")); \ 751} while (0) 752 753#define PRELE(p) do { \ 754 PROC_LOCK((p)); \ --- 164 unchanged lines hidden --- | 744 faultin((p)); \ 745} while (0) 746#define PROC_ASSERT_HELD(p) do { \ 747 KASSERT((p)->p_lock > 0, ("process not held")); \ 748} while (0) 749 750#define PRELE(p) do { \ 751 PROC_LOCK((p)); \ --- 164 unchanged lines hidden --- |