source: branches/libc-0.6/src/emx/include/InnoTekLIBC/FastInfoBlocks.h

Last change on this file was 1984, checked in by bird, 20 years ago

Ported the BSD SysV Semaphore module.

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 8.8 KB
Line 
1/* $Id: FastInfoBlocks.h 1984 2005-05-08 12:11:22Z bird $ */
2/** @file
3 *
4 * Fast InfoBlock Access.
5 *
6 * Copyright (c) 2003-2004 knut st. osmundsen <bird@innotek.de>
7 *
8 *
9 * This file is part of InnoTek LIBC.
10 *
11 * InnoTek LIBC is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * InnoTek LIBC is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with InnoTek LIBC; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#ifndef __InnoTekLIBC_FastInfoBlocks_h__
28#define __InnoTekLIBC_FastInfoBlocks_h__
29
30#include <sys/cdefs.h>
31
32__BEGIN_DECLS
33
34
35/**
36 * Gets the current Process ID.
37 */
38#if 0
39#define fibGetPid() (__libc_GpFIBPIB->pib_ulpid)
40#else
41#define fibGetPid() (__libc_GpFIBLIS->pidCurrent)
42#endif
43
44/**
45 * Gets the Parent Process ID.
46 */
47#if 0
48#define fibGetPPid() (__libc_GpFIBPIB->pib_ulppid)
49#else
50#define fibGetPPid() (__libc_GpFIBLIS->pidParent)
51#endif
52
53/**
54 * Gets the current Thread ID.
55 */
56#define fibGetTid() (__libc_GpFIBLIS->tidCurrent)
57
58/**
59 * Gets the current Thread ID plus the current PID.
60 * Very suitable for identifying global owernships.
61 */
62#define fibGetTidPid() ((unsigned)__libc_GpFIBLIS->tidCurrent | ((unsigned)__libc_GpFIBLIS->pidCurrent << 16))
63
64/**
65 * Gets the handle of the executable of this process.
66 */
67#if 1
68#define fibGetExeHandle() (__libc_GpFIBPIB->pib_hmte)
69#else
70#define fibGetExeHandle() (__libc_GpFIBLIS->hmod)
71#endif
72
73/**
74 * Gets the Environment Selector.
75 */
76#define fibGetEnvSel() (__libc_GpFIBLIS->selEnv)
77
78/**
79 * Gets the Environment Selector.
80 */
81#define fibGetCmdLineOff() (__libc_GpFIBLIS->offCmdLine)
82
83/**
84 * Gets the Environment Pointer (32bit FLAT pointer).
85 */
86#if 1
87#define fibGetEnv() (__libc_GpFIBPIB->pib_pchenv)
88#else
89#define fibGetEnv() ( ((fibGetEnvSel() & ~7) << 13) )
90#endif
91
92/**
93 * Gets the Commandline Pointer (32bit FLAT pointer).
94 */
95#if 1
96#define fibGetCmdLine() (__libc_GpFIBPIB->pib_pchcmd)
97#else
98#define fibGetCmdLine() ( ((fibGetEnvSel() & ~7) << 13) | fibGetCmdLineOff() )
99#endif
100
101
102/**
103 * Gets the Process Status.
104 */
105#define fibGetProcessStatus() ((volatile unsigned char)__libc_GpFIBLIS->rfProcStatus)
106/** Is this process in an exit list? */
107#define fibIsInExitList() (fibGetProcessStatus() & 1)
108/** Is the process exitting. */
109#define fibIsInExit() (fibGetProcessStatus() & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/* ExitList */))
110
111
112/**
113 * Gets the Process Type.
114 */
115#define fibGetProcessType() (__libc_GpFIBLIS->typeProcess)
116
117/** Is this a Detached (daemon) process? */
118#define fibIsDetachedProcess() (fibGetProcessType() == 4)
119/** Is this a PM process? */
120#define fibIsPMProcess() (fibGetProcessType() == 3)
121/** Is this a VIO (windowed console) process? */
122#define fibIsVIOProcess() (fibGetProcessType() == 2)
123/** Is this a VDM (Virtual Dos Mode) process? */
124#define fibIsVDMProcess() (fibGetProcessType() == 1)
125/** Is this a full screen process? */
126#define fibIsFullScreeProcess() (fibGetProcessType() == 0)
127
128
129/**
130 * System stuff
131 */
132/** Get the current millisecond counter value. */
133#define fibGetMsCount() (__libc_GpFIBGIS->SIS_MsCount)
134/** Get the Unix timestamp (seconds). */
135#define fibGetUnixSeconds() (__libc_GpFIBGIS->SIS_BigTime)
136
137
138
139/*******************************************************************************
140* Global Variables *
141*******************************************************************************/
142#pragma pack(1)
143
144/**
145 * Local Info Segment (per process).
146 */
147extern struct __libc_GpFIBLIS_s
148{
149 unsigned short pidCurrent; /* Current process ID */
150 unsigned short pidParent; /* Process ID of parent */
151 unsigned short prtyCurrent; /* Current thread priority */
152 unsigned short tidCurrent; /* Current thread ID */
153 unsigned short sgCurrent; /* Screengroup */
154 unsigned char rfProcStatus; /* Process status bits */
155 unsigned char LIS_fillbyte1; /* filler byte */
156 unsigned short fFoureground; /* Current process is in foreground */
157 unsigned char typeProcess; /* Current process type */
158 unsigned char LIS_fillbyte2; /* filler byte */
159
160 unsigned short selEnv; /* @@V1 Environment selector */
161 unsigned short offCmdLine; /* @@V1 Offset of command line start */
162 unsigned short cbDataSegment; /* @@V1 Length of Data Segment */
163 unsigned short cbStack; /* @@V1 STACKSIZE from the .EXE file */
164 unsigned short cbHeap; /* @@V1 HEAPSIZE from the .EXE file */
165 unsigned short hmod; /* @@V1 Module handle of the application */
166 unsigned short selDS; /* @@V1 Data Segment Handle of application */
167
168 unsigned short LIS_PackSel; /* First tiled selector in this EXE */
169 unsigned short LIS_PackShrSel; /* First selector above shared arena */
170 unsigned short LIS_PackPckSel; /* First selector above packed arena */
171} * __libc_GpFIBLIS;
172
173/**
174 * Global Info Segment (system)
175 */
176extern struct __libc_GpFIBGIS_s
177{
178 /* Time (offset 0x00) */
179 unsigned long SIS_BigTime; /* Time from 1-1-1970 in seconds */
180 unsigned long SIS_MsCount; /* Freerunning milliseconds counter */
181 unsigned char SIS_HrsTime; /* Hours */
182 unsigned char SIS_MinTime; /* Minutes */
183 unsigned char SIS_SecTime; /* Seconds */
184 unsigned char SIS_HunTime; /* Hundredths of seconds */
185 unsigned short SIS_TimeZone; /* Timezone in min from GMT (Set to EST) */
186 unsigned short SIS_ClkIntrvl; /* Timer interval (units=0.0001 secs) */
187
188 /* Date (offset 0x10) */
189 unsigned char SIS_DayDate; /* Day-of-month (1-31) */
190 unsigned char SIS_MonDate; /* Month (1-12) */
191 unsigned short SIS_YrsDate; /* Year (>= 1980) */
192 unsigned char SIS_DOWDate; /* Day-of-week (1-1-80 = Tues = 3) */
193
194 /* Version (offset 0x15) */
195 unsigned char SIS_VerMajor; /* Major version number */
196 unsigned char SIS_VerMinor; /* Minor version number */
197 unsigned char SIS_RevLettr; /* Revision letter */
198
199 /* System Status (offset 0x18) */
200 unsigned char SIS_CurScrnGrp; /* Fgnd screen group # */
201 unsigned char SIS_MaxScrnGrp; /* Maximum number of screen groups */
202 unsigned char SIS_HugeShfCnt; /* Shift count for huge segments */
203 unsigned char SIS_ProtMdOnly; /* Protect-mode-only indicator */
204 unsigned short SIS_FgndPID; /* Foreground process ID */
205
206 /* Scheduler Parms (offset 0x1E) */
207 unsigned char SIS_Dynamic; /* Dynamic variation flag (1=enabled) */
208 unsigned char SIS_MaxWait; /* Maxwait (seconds) */
209 unsigned short SIS_MinSlice; /* Minimum timeslice (milliseconds) */
210 unsigned short SIS_MaxSlice; /* Maximum timeslice (milliseconds) */
211
212 /* Boot Drive (offset 0x24) */
213 unsigned short SIS_BootDrv; /* Drive from which system was booted */
214
215 /* RAS Major Event Code Table (offset 0x26) */
216 unsigned char SIS_mec_table[32]; /* Table of RAS Major Event Codes (MECs) */
217
218 /* Additional Session Data (offset 0x46) */
219 unsigned char SIS_MaxVioWinSG; /* Max. no. of VIO windowable SG's */
220 unsigned char SIS_MaxPresMgrSG; /* Max. no. of Presentation Manager SG's */
221
222 /* Error logging Information (offset 0x48) */
223 unsigned short SIS_SysLog; /* Error Logging Status */
224
225 /* Additional RAS Information (offset 0x4A) */
226 unsigned short SIS_MMIOBase; /* Memory mapped I/O selector */
227 unsigned long SIS_MMIOAddr; /* Memory mapped I/O address */
228
229 /* Additional 2.0 Data (offset 0x50) */
230 unsigned char SIS_MaxVDMs; /* Max. no. of Virtual DOS machines */
231 unsigned char SIS_Reserved;
232} * __libc_GpFIBGIS;
233
234
235/**
236 * Process Info Block.
237 */
238extern struct __libc_GpFIBPIB_s
239{
240 unsigned long pib_ulpid; /* Process I.D. */
241 unsigned long pib_ulppid; /* Parent process I.D. */
242 unsigned long pib_hmte; /* Program (.EXE) module handle */
243 char * pib_pchcmd; /* Command line pointer */
244 char * pib_pchenv; /* Environment pointer */
245 unsigned long pib_flstatus; /* Process' status bits */
246 unsigned long pib_ultype; /* Process' type code */
247} * __libc_GpFIBPIB;
248
249#pragma pack()
250
251
252int __libc_back_fibInit(int fForced);
253void __libc_Back_fibDumpAll(void);
254
255
256__END_DECLS
257
258#endif
259
Note: See TracBrowser for help on using the repository browser.