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