1 | #include <signal.h> |
---|
2 | |
---|
3 | /* HAS_IOCTL: |
---|
4 | * This symbol, if defined, indicates that the ioctl() routine is |
---|
5 | * available to set I/O characteristics |
---|
6 | */ |
---|
7 | #define HAS_IOCTL /**/ |
---|
8 | |
---|
9 | /* HAS_UTIME: |
---|
10 | * This symbol, if defined, indicates that the routine utime() is |
---|
11 | * available to update the access and modification times of files. |
---|
12 | */ |
---|
13 | #define HAS_UTIME /**/ |
---|
14 | |
---|
15 | #define HAS_KILL |
---|
16 | #define HAS_WAIT |
---|
17 | #define HAS_DLERROR |
---|
18 | #define HAS_WAITPID_RUNTIME (_emx_env & 0x200) |
---|
19 | |
---|
20 | /* USEMYBINMODE |
---|
21 | * This symbol, if defined, indicates that the program should |
---|
22 | * use the routine my_binmode(FILE *fp, char iotype, int mode) to insure |
---|
23 | * that a file is in "binary" mode -- that is, that no translation |
---|
24 | * of bytes occurs on read or write operations. |
---|
25 | */ |
---|
26 | #undef USEMYBINMODE |
---|
27 | |
---|
28 | /* Stat_t: |
---|
29 | * This symbol holds the type used to declare buffers for information |
---|
30 | * returned by stat(). It's usually just struct stat. It may be necessary |
---|
31 | * to include <sys/stat.h> and <sys/types.h> to get any typedef'ed |
---|
32 | * information. |
---|
33 | */ |
---|
34 | #define Stat_t struct stat |
---|
35 | |
---|
36 | /* USE_STAT_RDEV: |
---|
37 | * This symbol is defined if this system has a stat structure declaring |
---|
38 | * st_rdev |
---|
39 | */ |
---|
40 | #define USE_STAT_RDEV /**/ |
---|
41 | |
---|
42 | /* ACME_MESS: |
---|
43 | * This symbol, if defined, indicates that error messages should be |
---|
44 | * should be generated in a format that allows the use of the Acme |
---|
45 | * GUI/editor's autofind feature. |
---|
46 | */ |
---|
47 | #undef ACME_MESS /**/ |
---|
48 | |
---|
49 | /* ALTERNATE_SHEBANG: |
---|
50 | * This symbol, if defined, contains a "magic" string which may be used |
---|
51 | * as the first line of a Perl program designed to be executed directly |
---|
52 | * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG |
---|
53 | * begins with a character other then #, then Perl will only treat |
---|
54 | * it as a command line if if finds the string "perl" in the first |
---|
55 | * word; otherwise it's treated as the first line of code in the script. |
---|
56 | * (IOW, Perl won't hand off to another interpreter via an alternate |
---|
57 | * shebang sequence that might be legal Perl code.) |
---|
58 | */ |
---|
59 | #define ALTERNATE_SHEBANG "extproc " |
---|
60 | |
---|
61 | #ifndef SIGABRT |
---|
62 | # define SIGABRT SIGILL |
---|
63 | #endif |
---|
64 | #ifndef SIGILL |
---|
65 | # define SIGILL 6 /* blech */ |
---|
66 | #endif |
---|
67 | #define ABORT() kill(PerlProc_getpid(),SIGABRT); |
---|
68 | |
---|
69 | #define BIT_BUCKET "/dev/nul" /* Will this work? */ |
---|
70 | |
---|
71 | /* Apparently TCPIPV4 defines may be included even with only IAK present */ |
---|
72 | |
---|
73 | #if !defined(NO_TCPIPV4) && !defined(TCPIPV4) |
---|
74 | # define TCPIPV4 |
---|
75 | # define TCPIPV4_FORCED /* Just in case */ |
---|
76 | #endif |
---|
77 | |
---|
78 | #if defined(I_SYS_UN) && !defined(TCPIPV4) |
---|
79 | /* It is not working without TCPIPV4 defined. */ |
---|
80 | # undef I_SYS_UN |
---|
81 | #endif |
---|
82 | |
---|
83 | #ifdef USE_THREADS |
---|
84 | |
---|
85 | #define OS2_ERROR_ALREADY_POSTED 299 /* Avoid os2.h */ |
---|
86 | |
---|
87 | extern int rc; |
---|
88 | |
---|
89 | #define MUTEX_INIT(m) \ |
---|
90 | STMT_START { \ |
---|
91 | int rc; \ |
---|
92 | if ((rc = _rmutex_create(m,0))) \ |
---|
93 | croak("panic: MUTEX_INIT: rc=%i", rc); \ |
---|
94 | } STMT_END |
---|
95 | #define MUTEX_LOCK(m) \ |
---|
96 | STMT_START { \ |
---|
97 | int rc; \ |
---|
98 | if ((rc = _rmutex_request(m,_FMR_IGNINT))) \ |
---|
99 | croak("panic: MUTEX_LOCK: rc=%i", rc); \ |
---|
100 | } STMT_END |
---|
101 | #define MUTEX_UNLOCK(m) \ |
---|
102 | STMT_START { \ |
---|
103 | int rc; \ |
---|
104 | if ((rc = _rmutex_release(m))) \ |
---|
105 | croak("panic: MUTEX_UNLOCK: rc=%i", rc); \ |
---|
106 | } STMT_END |
---|
107 | #define MUTEX_DESTROY(m) \ |
---|
108 | STMT_START { \ |
---|
109 | int rc; \ |
---|
110 | if ((rc = _rmutex_close(m))) \ |
---|
111 | croak("panic: MUTEX_DESTROY: rc=%i", rc); \ |
---|
112 | } STMT_END |
---|
113 | |
---|
114 | #define COND_INIT(c) \ |
---|
115 | STMT_START { \ |
---|
116 | int rc; \ |
---|
117 | if ((rc = DosCreateEventSem(NULL,c,0,0))) \ |
---|
118 | croak("panic: COND_INIT: rc=%i", rc); \ |
---|
119 | } STMT_END |
---|
120 | #define COND_SIGNAL(c) \ |
---|
121 | STMT_START { \ |
---|
122 | int rc; \ |
---|
123 | if ((rc = DosPostEventSem(*(c))) && rc != OS2_ERROR_ALREADY_POSTED) \ |
---|
124 | croak("panic: COND_SIGNAL, rc=%ld", rc); \ |
---|
125 | } STMT_END |
---|
126 | #define COND_BROADCAST(c) \ |
---|
127 | STMT_START { \ |
---|
128 | int rc; \ |
---|
129 | if ((rc = DosPostEventSem(*(c))) && rc != OS2_ERROR_ALREADY_POSTED)\ |
---|
130 | croak("panic: COND_BROADCAST, rc=%i", rc); \ |
---|
131 | } STMT_END |
---|
132 | /* #define COND_WAIT(c, m) \ |
---|
133 | STMT_START { \ |
---|
134 | if (WaitForSingleObject(*(c),INFINITE) == WAIT_FAILED) \ |
---|
135 | croak("panic: COND_WAIT"); \ |
---|
136 | } STMT_END |
---|
137 | */ |
---|
138 | #define COND_WAIT(c, m) os2_cond_wait(c,m) |
---|
139 | |
---|
140 | #define COND_WAIT_win32(c, m) \ |
---|
141 | STMT_START { \ |
---|
142 | int rc; \ |
---|
143 | if ((rc = SignalObjectAndWait(*(m),*(c),INFINITE,FALSE)))\ |
---|
144 | croak("panic: COND_WAIT"); \ |
---|
145 | else \ |
---|
146 | MUTEX_LOCK(m); \ |
---|
147 | } STMT_END |
---|
148 | #define COND_DESTROY(c) \ |
---|
149 | STMT_START { \ |
---|
150 | int rc; \ |
---|
151 | if ((rc = DosCloseEventSem(*(c)))) \ |
---|
152 | croak("panic: COND_DESTROY, rc=%i", rc); \ |
---|
153 | } STMT_END |
---|
154 | /*#define THR ((struct thread *) TlsGetValue(PL_thr_key)) |
---|
155 | #define dTHR struct thread *thr = THR |
---|
156 | */ |
---|
157 | |
---|
158 | #ifdef USE_SLOW_THREAD_SPECIFIC |
---|
159 | # define pthread_getspecific(k) (*_threadstore()) |
---|
160 | # define pthread_setspecific(k,v) (*_threadstore()=v,0) |
---|
161 | # define pthread_key_create(keyp,flag) (*keyp=_gettid(),0) |
---|
162 | #else |
---|
163 | # define pthread_getspecific(k) (*(k)) |
---|
164 | # define pthread_setspecific(k,v) (*(k)=(v),0) |
---|
165 | # define pthread_key_create(keyp,flag) (DosAllocThreadLocalMemory(1,(U32*)keyp) ? croak("LocalMemory"),1 : 0) |
---|
166 | #endif |
---|
167 | #define pthread_key_delete(keyp) |
---|
168 | #define pthread_self() _gettid() |
---|
169 | #define YIELD DosSleep(0) |
---|
170 | |
---|
171 | #ifdef PTHREADS_INCLUDED /* For ./x2p stuff. */ |
---|
172 | int pthread_join(pthread_t tid, void **status); |
---|
173 | int pthread_detach(pthread_t tid); |
---|
174 | int pthread_create(pthread_t *tid, const pthread_attr_t *attr, |
---|
175 | void *(*start_routine)(void*), void *arg); |
---|
176 | #endif |
---|
177 | |
---|
178 | #define THREADS_ELSEWHERE |
---|
179 | |
---|
180 | #endif |
---|
181 | |
---|
182 | void Perl_OS2_init(char **); |
---|
183 | |
---|
184 | /* XXX This code hideously puts env inside: */ |
---|
185 | |
---|
186 | #ifdef PERL_CORE |
---|
187 | # define PERL_SYS_INIT3(argcp, argvp, envp) STMT_START { \ |
---|
188 | _response(argcp, argvp); \ |
---|
189 | _wildcard(argcp, argvp); \ |
---|
190 | Perl_OS2_init(*envp); } STMT_END |
---|
191 | # define PERL_SYS_INIT(argcp, argvp) STMT_START { \ |
---|
192 | _response(argcp, argvp); \ |
---|
193 | _wildcard(argcp, argvp); \ |
---|
194 | Perl_OS2_init(NULL); } STMT_END |
---|
195 | #else /* Compiling embedded Perl or Perl extension */ |
---|
196 | # define PERL_SYS_INIT3(argcp, argvp, envp) STMT_START { \ |
---|
197 | Perl_OS2_init(*envp); } STMT_END |
---|
198 | # define PERL_SYS_INIT(argcp, argvp) STMT_START { \ |
---|
199 | Perl_OS2_init(NULL); } STMT_END |
---|
200 | #endif |
---|
201 | |
---|
202 | #ifndef __EMX__ |
---|
203 | # define PERL_CALLCONV _System |
---|
204 | #endif |
---|
205 | |
---|
206 | #define PERL_SYS_TERM() MALLOC_TERM |
---|
207 | |
---|
208 | /* #define PERL_SYS_TERM() STMT_START { \ |
---|
209 | if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */ |
---|
210 | |
---|
211 | #define dXSUB_SYS OS2_XS_init() |
---|
212 | |
---|
213 | #ifdef PERL_IS_AOUT |
---|
214 | /* # define HAS_FORK */ |
---|
215 | /* # define HIDEMYMALLOC */ |
---|
216 | /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */ |
---|
217 | #else /* !PERL_IS_AOUT */ |
---|
218 | # ifndef PERL_FOR_X2P |
---|
219 | # ifdef EMX_BAD_SBRK |
---|
220 | # define USE_PERL_SBRK |
---|
221 | # endif |
---|
222 | # else |
---|
223 | # define PerlIO FILE |
---|
224 | # endif |
---|
225 | # define SYSTEM_ALLOC(a) sys_alloc(a) |
---|
226 | |
---|
227 | void *sys_alloc(int size); |
---|
228 | |
---|
229 | #endif /* !PERL_IS_AOUT */ |
---|
230 | #if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */ |
---|
231 | # define PerlIO FILE |
---|
232 | #endif |
---|
233 | |
---|
234 | #define TMPPATH1 "plXXXXXX" |
---|
235 | extern char *tmppath; |
---|
236 | PerlIO *my_syspopen(char *cmd, char *mode); |
---|
237 | /* Cannot prototype with I32 at this point. */ |
---|
238 | int my_syspclose(PerlIO *f); |
---|
239 | FILE *my_tmpfile (void); |
---|
240 | char *my_tmpnam (char *); |
---|
241 | |
---|
242 | #undef L_tmpnam |
---|
243 | #define L_tmpnam MAXPATHLEN |
---|
244 | |
---|
245 | #define tmpfile my_tmpfile |
---|
246 | #define tmpnam my_tmpnam |
---|
247 | #define isatty _isterm |
---|
248 | #define rand random |
---|
249 | #define srand srandom |
---|
250 | |
---|
251 | /* |
---|
252 | * fwrite1() should be a routine with the same calling sequence as fwrite(), |
---|
253 | * but which outputs all of the bytes requested as a single stream (unlike |
---|
254 | * fwrite() itself, which on some systems outputs several distinct records |
---|
255 | * if the number_of_items parameter is >1). |
---|
256 | */ |
---|
257 | #define fwrite1 fwrite |
---|
258 | |
---|
259 | #define my_getenv(var) getenv(var) |
---|
260 | #define flock my_flock |
---|
261 | |
---|
262 | void *emx_calloc (size_t, size_t); |
---|
263 | void emx_free (void *); |
---|
264 | void *emx_malloc (size_t); |
---|
265 | void *emx_realloc (void *, size_t); |
---|
266 | |
---|
267 | /*****************************************************************************/ |
---|
268 | |
---|
269 | #include <stdlib.h> /* before the following definitions */ |
---|
270 | #include <unistd.h> /* before the following definitions */ |
---|
271 | |
---|
272 | #define chdir _chdir2 |
---|
273 | #define getcwd _getcwd2 |
---|
274 | |
---|
275 | /* This guy is needed for quick stdstd */ |
---|
276 | |
---|
277 | #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE) |
---|
278 | /* Perl uses ungetc only with successful return */ |
---|
279 | # define ungetc(c,fp) \ |
---|
280 | (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \ |
---|
281 | ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp)) |
---|
282 | #endif |
---|
283 | |
---|
284 | #define OP_BINARY O_BINARY |
---|
285 | |
---|
286 | #define OS2_STAT_HACK 1 |
---|
287 | #if OS2_STAT_HACK |
---|
288 | |
---|
289 | #define Stat(fname,bufptr) os2_stat((fname),(bufptr)) |
---|
290 | #define Fstat(fd,bufptr) fstat((fd),(bufptr)) |
---|
291 | #define Fflush(fp) fflush(fp) |
---|
292 | #define Mkdir(path,mode) mkdir((path),(mode)) |
---|
293 | |
---|
294 | #undef S_IFBLK |
---|
295 | #undef S_ISBLK |
---|
296 | #define S_IFBLK 0120000 |
---|
297 | #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) |
---|
298 | |
---|
299 | #else |
---|
300 | |
---|
301 | #define Stat(fname,bufptr) stat((fname),(bufptr)) |
---|
302 | #define Fstat(fd,bufptr) fstat((fd),(bufptr)) |
---|
303 | #define Fflush(fp) fflush(fp) |
---|
304 | #define Mkdir(path,mode) mkdir((path),(mode)) |
---|
305 | |
---|
306 | #endif |
---|
307 | |
---|
308 | /* With SD386 it is impossible to debug register variables. */ |
---|
309 | #if !defined(PERL_IS_AOUT) && defined(DEBUGGING) && !defined(register) |
---|
310 | # define register |
---|
311 | #endif |
---|
312 | |
---|
313 | /* Our private OS/2 specific data. */ |
---|
314 | |
---|
315 | typedef struct OS2_Perl_data { |
---|
316 | unsigned long flags; |
---|
317 | unsigned long phab; |
---|
318 | int (*xs_init)(); |
---|
319 | unsigned long rc; |
---|
320 | unsigned long severity; |
---|
321 | unsigned long phmq; /* Handle to message queue */ |
---|
322 | unsigned long phmq_refcnt; |
---|
323 | unsigned long phmq_servers; |
---|
324 | unsigned long initial_mode; /* VIO etc. mode we were started in */ |
---|
325 | } OS2_Perl_data_t; |
---|
326 | |
---|
327 | extern OS2_Perl_data_t OS2_Perl_data; |
---|
328 | |
---|
329 | #define Perl_hab ((HAB)OS2_Perl_data.phab) |
---|
330 | #define Perl_rc (OS2_Perl_data.rc) |
---|
331 | #define Perl_severity (OS2_Perl_data.severity) |
---|
332 | #define errno_isOS2 12345678 |
---|
333 | #define errno_isOS2_set 12345679 |
---|
334 | #define OS2_Perl_flags (OS2_Perl_data.flags) |
---|
335 | #define Perl_HAB_set_f 1 |
---|
336 | #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f) |
---|
337 | #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f) |
---|
338 | #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h) |
---|
339 | #define _obtain_Perl_HAB (init_PMWIN_entries(), \ |
---|
340 | Perl_hab = (*PMWIN_entries.Initialize)(0), \ |
---|
341 | set_Perl_HAB_f, Perl_hab) |
---|
342 | #define perl_hab_GET() (Perl_HAB_set ? Perl_hab : _obtain_Perl_HAB) |
---|
343 | #define Acquire_hab() perl_hab_GET() |
---|
344 | #define Perl_hmq ((HMQ)OS2_Perl_data.phmq) |
---|
345 | #define Perl_hmq_refcnt (OS2_Perl_data.phmq_refcnt) |
---|
346 | #define Perl_hmq_servers (OS2_Perl_data.phmq_servers) |
---|
347 | #define Perl_os2_initial_mode (OS2_Perl_data.initial_mode) |
---|
348 | |
---|
349 | unsigned long Perl_hab_GET(); |
---|
350 | unsigned long Perl_Register_MQ(int serve); |
---|
351 | void Perl_Deregister_MQ(int serve); |
---|
352 | int Perl_Serve_Messages(int force); |
---|
353 | /* Cannot prototype with I32 at this point. */ |
---|
354 | int Perl_Process_Messages(int force, long *cntp); |
---|
355 | char *os2_execname(void); |
---|
356 | |
---|
357 | struct _QMSG; |
---|
358 | struct PMWIN_entries_t { |
---|
359 | unsigned long (*Initialize)( unsigned long fsOptions ); |
---|
360 | unsigned long (*CreateMsgQueue)(unsigned long hab, long cmsg); |
---|
361 | int (*DestroyMsgQueue)(unsigned long hmq); |
---|
362 | int (*PeekMsg)(unsigned long hab, struct _QMSG *pqmsg, |
---|
363 | unsigned long hwndFilter, unsigned long msgFilterFirst, |
---|
364 | unsigned long msgFilterLast, unsigned long fl); |
---|
365 | int (*GetMsg)(unsigned long hab, struct _QMSG *pqmsg, |
---|
366 | unsigned long hwndFilter, unsigned long msgFilterFirst, |
---|
367 | unsigned long msgFilterLast); |
---|
368 | void * (*DispatchMsg)(unsigned long hab, struct _QMSG *pqmsg); |
---|
369 | }; |
---|
370 | extern struct PMWIN_entries_t PMWIN_entries; |
---|
371 | void init_PMWIN_entries(void); |
---|
372 | |
---|
373 | #define perl_hmq_GET(serve) Perl_Register_MQ(serve) |
---|
374 | #define perl_hmq_UNSET(serve) Perl_Deregister_MQ(serve) |
---|
375 | |
---|
376 | #define OS2_XS_init() (*OS2_Perl_data.xs_init)() |
---|
377 | |
---|
378 | #if _EMX_CRT_REV_ >= 60 |
---|
379 | # define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2_set, \ |
---|
380 | _setsyserrno(rc)) |
---|
381 | #else |
---|
382 | # define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2) |
---|
383 | #endif |
---|
384 | |
---|
385 | /* The expressions below return true on error. */ |
---|
386 | /* INCL_DOSERRORS needed. rc should be declared outside. */ |
---|
387 | #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1)) |
---|
388 | /* INCL_WINERRORS needed. */ |
---|
389 | #define SaveWinError(expr) ((expr) ? : (FillWinError, 0)) |
---|
390 | #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1)) |
---|
391 | #define FillOSError(rc) (os2_setsyserrno(rc), \ |
---|
392 | Perl_severity = SEVERITY_ERROR) |
---|
393 | #define FillWinError (Perl_severity = ERRORIDSEV(Perl_rc), \ |
---|
394 | Perl_rc = ERRORIDERROR(Perl_rc)), \ |
---|
395 | os2_setsyserrno(Perl_rc) |
---|
396 | |
---|
397 | #define STATIC_FILE_LENGTH 127 |
---|
398 | |
---|
399 | #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n)) |
---|
400 | char *perllib_mangle(char *, unsigned int); |
---|
401 | |
---|
402 | char *os2error(int rc); |
---|
403 | |
---|
404 | /* ************************************************************ */ |
---|
405 | #define Dos32QuerySysState DosQuerySysState |
---|
406 | #define QuerySysState(flags, pid, buf, bufsz) \ |
---|
407 | Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz) |
---|
408 | |
---|
409 | #define QSS_PROCESS 1 |
---|
410 | #define QSS_MODULE 4 |
---|
411 | #define QSS_SEMAPHORES 2 |
---|
412 | #define QSS_FILE 8 /* Buggy until fixpack18 */ |
---|
413 | #define QSS_SHARED 16 |
---|
414 | |
---|
415 | #ifdef _OS2_H |
---|
416 | |
---|
417 | APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid, |
---|
418 | ULONG _res_,PVOID buf,ULONG bufsz); |
---|
419 | typedef struct { |
---|
420 | ULONG threadcnt; |
---|
421 | ULONG proccnt; |
---|
422 | ULONG modulecnt; |
---|
423 | } QGLOBAL, *PQGLOBAL; |
---|
424 | |
---|
425 | typedef struct { |
---|
426 | ULONG rectype; |
---|
427 | USHORT threadid; |
---|
428 | USHORT slotid; |
---|
429 | ULONG sleepid; |
---|
430 | ULONG priority; |
---|
431 | ULONG systime; |
---|
432 | ULONG usertime; |
---|
433 | UCHAR state; |
---|
434 | UCHAR _reserved1_; /* padding to ULONG */ |
---|
435 | USHORT _reserved2_; /* padding to ULONG */ |
---|
436 | } QTHREAD, *PQTHREAD; |
---|
437 | |
---|
438 | typedef struct { |
---|
439 | USHORT sfn; |
---|
440 | USHORT refcnt; |
---|
441 | USHORT flags1; |
---|
442 | USHORT flags2; |
---|
443 | USHORT accmode1; |
---|
444 | USHORT accmode2; |
---|
445 | ULONG filesize; |
---|
446 | USHORT volhnd; |
---|
447 | USHORT attrib; |
---|
448 | USHORT _reserved_; |
---|
449 | } QFDS, *PQFDS; |
---|
450 | |
---|
451 | typedef struct qfile { |
---|
452 | ULONG rectype; |
---|
453 | struct qfile *next; |
---|
454 | ULONG opencnt; |
---|
455 | PQFDS filedata; |
---|
456 | char name[1]; |
---|
457 | } QFILE, *PQFILE; |
---|
458 | |
---|
459 | typedef struct { |
---|
460 | ULONG rectype; |
---|
461 | PQTHREAD threads; |
---|
462 | USHORT pid; |
---|
463 | USHORT ppid; |
---|
464 | ULONG type; |
---|
465 | ULONG state; |
---|
466 | ULONG sessid; |
---|
467 | USHORT hndmod; |
---|
468 | USHORT threadcnt; |
---|
469 | ULONG privsem32cnt; |
---|
470 | ULONG _reserved2_; |
---|
471 | USHORT sem16cnt; |
---|
472 | USHORT dllcnt; |
---|
473 | USHORT shrmemcnt; |
---|
474 | USHORT fdscnt; |
---|
475 | PUSHORT sem16s; |
---|
476 | PUSHORT dlls; |
---|
477 | PUSHORT shrmems; |
---|
478 | PUSHORT fds; |
---|
479 | } QPROCESS, *PQPROCESS; |
---|
480 | |
---|
481 | typedef struct sema { |
---|
482 | struct sema *next; |
---|
483 | USHORT refcnt; |
---|
484 | UCHAR sysflags; |
---|
485 | UCHAR sysproccnt; |
---|
486 | ULONG _reserved1_; |
---|
487 | USHORT index; |
---|
488 | CHAR name[1]; |
---|
489 | } QSEMA, *PQSEMA; |
---|
490 | |
---|
491 | typedef struct { |
---|
492 | ULONG rectype; |
---|
493 | ULONG _reserved1_; |
---|
494 | USHORT _reserved2_; |
---|
495 | USHORT syssemidx; |
---|
496 | ULONG index; |
---|
497 | QSEMA sema; |
---|
498 | } QSEMSTRUC, *PQSEMSTRUC; |
---|
499 | |
---|
500 | typedef struct { |
---|
501 | USHORT pid; |
---|
502 | USHORT opencnt; |
---|
503 | } QSEMOWNER32, *PQSEMOWNER32; |
---|
504 | |
---|
505 | typedef struct { |
---|
506 | PQSEMOWNER32 own; |
---|
507 | PCHAR name; |
---|
508 | PVOID semrecs; /* array of associated sema's */ |
---|
509 | USHORT flags; |
---|
510 | USHORT semreccnt; |
---|
511 | USHORT waitcnt; |
---|
512 | USHORT _reserved_; /* padding to ULONG */ |
---|
513 | } QSEMSMUX32, *PQSEMSMUX32; |
---|
514 | |
---|
515 | typedef struct { |
---|
516 | PQSEMOWNER32 own; |
---|
517 | PCHAR name; |
---|
518 | PQSEMSMUX32 mux; |
---|
519 | USHORT flags; |
---|
520 | USHORT postcnt; |
---|
521 | } QSEMEV32, *PQSEMEV32; |
---|
522 | |
---|
523 | typedef struct { |
---|
524 | PQSEMOWNER32 own; |
---|
525 | PCHAR name; |
---|
526 | PQSEMSMUX32 mux; |
---|
527 | USHORT flags; |
---|
528 | USHORT refcnt; |
---|
529 | USHORT thrdnum; |
---|
530 | USHORT _reserved_; /* padding to ULONG */ |
---|
531 | } QSEMMUX32, *PQSEMMUX32; |
---|
532 | |
---|
533 | typedef struct semstr32 { |
---|
534 | struct semstr *next; |
---|
535 | QSEMEV32 evsem; |
---|
536 | QSEMMUX32 muxsem; |
---|
537 | QSEMSMUX32 smuxsem; |
---|
538 | } QSEMSTRUC32, *PQSEMSTRUC32; |
---|
539 | |
---|
540 | typedef struct shrmem { |
---|
541 | struct shrmem *next; |
---|
542 | USHORT hndshr; |
---|
543 | USHORT selshr; |
---|
544 | USHORT refcnt; |
---|
545 | CHAR name[1]; |
---|
546 | } QSHRMEM, *PQSHRMEM; |
---|
547 | |
---|
548 | typedef struct module { |
---|
549 | struct module *next; |
---|
550 | USHORT hndmod; |
---|
551 | USHORT type; |
---|
552 | ULONG refcnt; |
---|
553 | ULONG segcnt; |
---|
554 | PVOID _reserved_; |
---|
555 | PCHAR name; |
---|
556 | USHORT modref[1]; |
---|
557 | } QMODULE, *PQMODULE; |
---|
558 | |
---|
559 | typedef struct { |
---|
560 | PQGLOBAL gbldata; |
---|
561 | PQPROCESS procdata; |
---|
562 | PQSEMSTRUC semadata; |
---|
563 | PQSEMSTRUC32 sem32data; |
---|
564 | PQSHRMEM shrmemdata; |
---|
565 | PQMODULE moddata; |
---|
566 | PVOID _reserved2_; |
---|
567 | PQFILE filedata; |
---|
568 | } QTOPLEVEL, *PQTOPLEVEL; |
---|
569 | /* ************************************************************ */ |
---|
570 | |
---|
571 | PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags); |
---|
572 | |
---|
573 | #endif /* _OS2_H */ |
---|
574 | |
---|