|
|
1.1 root 1: #ifndef __KERNEL_DDI_PROC_H__
2: #define __KERNEL_DDI_PROC_H__
3:
4: /*
5: * This internal header file defines structures and an access procedure for
6: * DDI/DKI per-process state that may be accessed outside the process context.
7: * This corresponds to data stored in the process table in traditional Unix
8: * systems, and we expect that this would probably be implemented that way.
9: * However, the DDI/DKI system data is kept separate from the host data to
10: * ease porting by reducing coupling with the host system to a single accessor
11: * function. We anticipate that space reserved in the process structure by the
12: * host for this system will be opaque to the rest of the kernel.
13: */
14:
15: /*
16: *-IMPORTS:
17: * <common/ccompat.h>
18: * __EXTERN_C_BEGIN__
19: * __EXTERN_C_END__
20: * __PROTO ()
21: * <kernel/x86lock.h>
22: * atomic_ptr_t
23: */
24:
25: #include <common/feature.h>
26: #include <common/ccompat.h>
27: #include <kernel/x86lock.h>
28:
29: #if ! _DDI_DKI
30: # error You must be compiling in the DDI/DKI environment to use this header
31: #endif
32:
33: #if __COHERENT__
34:
35: /*
36: * In <sys/proc.h>, cprocp is guarded by #ifdef KERNEL.
37: */
38:
39: #if ! __KERNEL__
40: #define __KERNEL__ 2
41: #endif
42:
43: #include <sys/proc.h>
44:
45: #if __KERNEL__ == 2
46: #undef __KERNEL__
47: #endif
48:
49: #define CURRENT_PROCESS() cprocp
50:
51: #elif defined (__MSDOS__)
52:
53: #include <sys/dosproc.h>
54:
55: #endif
56:
57:
58: /*
59: * The following structure defines the "process-table" data that a DDI/DKI
60: * scheduling functions need to be able to access. Note that the "pn_plist"
61: * member normally is used to point at the process list that this node is
62: * threaded on. For reasons discussed elsewhere, this member is the only
63: * member intended to be accessed without having a prior lock on the list
64: * header (since it is used to *find* the list header), and so must be
65: * accessed atomically.
66: */
67:
68: typedef struct proc_node pnode_t;
69:
70: struct proc_node {
71: pnode_t * pn_next; /* for queueing waiting processes */
72: pnode_t * pn_prev;
73:
74: short pn_priority; /* abstract process priority */
75: short pn_flag; /* true if sleep is interruptible */
76:
77: atomic_ptr_t pn_plistp; /* where we are queued */
78: };
79:
80:
81: /*
82: * DDI/DKI per-process data that may be needed outside the process context.
83: */
84:
85: struct ddi_proc_data {
86: pnode_t dp_pnode;
87: unsigned short dp_refcount;
88: };
89:
90: typedef struct ddi_proc_data dpdata_t;
91:
92:
93: __EXTERN_C_BEGIN__
94:
95: dpdata_t * ddi_proc_data __PROTO ((void));
96:
97: __EXTERN_C_END__
98:
99: #define ddi_proc_data() ((dpdata_t *) & CURRENT_PROCESS ()->p_ddi_space)
100:
101: #endif /* ! defined (__KERNEL_DDI_PROC_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.