Commit | Line | Data |
4633a7c4 |
1 | #include <signal.h> |
2d766320 |
2 | #include <io.h> |
3 | /* #include <sys/select.h> */ |
4633a7c4 |
4 | |
5 | /* HAS_IOCTL: |
6 | * This symbol, if defined, indicates that the ioctl() routine is |
7 | * available to set I/O characteristics |
8 | */ |
9 | #define HAS_IOCTL /**/ |
10 | |
11 | /* HAS_UTIME: |
12 | * This symbol, if defined, indicates that the routine utime() is |
13 | * available to update the access and modification times of files. |
14 | */ |
15 | #define HAS_UTIME /**/ |
16 | |
a80d47c2 |
17 | /* BIG_TIME: |
18 | * This symbol is defined if Time_t is an unsigned type on this system. |
19 | */ |
20 | #define BIG_TIME |
21 | |
4633a7c4 |
22 | #define HAS_KILL |
23 | #define HAS_WAIT |
4ea6d94f |
24 | #define HAS_DLERROR |
367f3c24 |
25 | #define HAS_WAITPID_RUNTIME (_emx_env & 0x200) |
4ea6d94f |
26 | |
f72c975a |
27 | /* HAS_PASSWD |
28 | * This symbol, if defined, indicates that the getpwnam() and |
29 | * getpwuid() routines are available to get password entries. |
30 | * The getpwent() has a separate definition, HAS_GETPWENT. |
31 | */ |
32 | #define HAS_PASSWD |
33 | |
34 | /* HAS_GROUP |
35 | * This symbol, if defined, indicates that the getgrnam() and |
36 | * getgrgid() routines are available to get group entries. |
37 | * The getgrent() has a separate definition, HAS_GETGRENT. |
38 | */ |
39 | #define HAS_GROUP |
40 | #define HAS_GETGRENT /* fake */ |
41 | #define HAS_SETGRENT /* fake */ |
42 | #define HAS_ENDGRENT /* fake */ |
43 | |
4ea6d94f |
44 | /* USEMYBINMODE |
45 | * This symbol, if defined, indicates that the program should |
16fe6d59 |
46 | * use the routine my_binmode(FILE *fp, char iotype, int mode) to insure |
4ea6d94f |
47 | * that a file is in "binary" mode -- that is, that no translation |
48 | * of bytes occurs on read or write operations. |
49 | */ |
50 | #undef USEMYBINMODE |
51 | |
460c8493 |
52 | #define SOCKET_OPEN_MODE "b" |
53 | |
61bb5906 |
54 | /* Stat_t: |
55 | * This symbol holds the type used to declare buffers for information |
56 | * returned by stat(). It's usually just struct stat. It may be necessary |
57 | * to include <sys/stat.h> and <sys/types.h> to get any typedef'ed |
58 | * information. |
59 | */ |
60 | #define Stat_t struct stat |
61 | |
4ea6d94f |
62 | /* USE_STAT_RDEV: |
63 | * This symbol is defined if this system has a stat structure declaring |
64 | * st_rdev |
65 | */ |
66 | #define USE_STAT_RDEV /**/ |
67 | |
68 | /* ACME_MESS: |
69 | * This symbol, if defined, indicates that error messages should be |
70 | * should be generated in a format that allows the use of the Acme |
71 | * GUI/editor's autofind feature. |
72 | */ |
73 | #undef ACME_MESS /**/ |
4633a7c4 |
74 | |
44a8e56a |
75 | /* ALTERNATE_SHEBANG: |
76 | * This symbol, if defined, contains a "magic" string which may be used |
77 | * as the first line of a Perl program designed to be executed directly |
78 | * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG |
79 | * begins with a character other then #, then Perl will only treat |
80 | * it as a command line if if finds the string "perl" in the first |
81 | * word; otherwise it's treated as the first line of code in the script. |
82 | * (IOW, Perl won't hand off to another interpreter via an alternate |
83 | * shebang sequence that might be legal Perl code.) |
84 | */ |
aa689395 |
85 | #define ALTERNATE_SHEBANG "extproc " |
44a8e56a |
86 | |
4633a7c4 |
87 | #ifndef SIGABRT |
88 | # define SIGABRT SIGILL |
89 | #endif |
90 | #ifndef SIGILL |
91 | # define SIGILL 6 /* blech */ |
92 | #endif |
7766f137 |
93 | #define ABORT() kill(PerlProc_getpid(),SIGABRT); |
4633a7c4 |
94 | |
760ac839 |
95 | #define BIT_BUCKET "/dev/nul" /* Will this work? */ |
c07a80fd |
96 | |
202975e6 |
97 | /* Apparently TCPIPV4 defines may be included even with only IAK present */ |
98 | |
99 | #if !defined(NO_TCPIPV4) && !defined(TCPIPV4) |
100 | # define TCPIPV4 |
101 | # define TCPIPV4_FORCED /* Just in case */ |
102 | #endif |
103 | |
4a6a15c8 |
104 | #if defined(I_SYS_UN) && !defined(TCPIPV4) |
105 | /* It is not working without TCPIPV4 defined. */ |
106 | # undef I_SYS_UN |
107 | #endif |
dd96f567 |
108 | |
5c728af0 |
109 | #ifdef USE_ITHREADS |
110 | |
111 | #define do_spawn(a) os2_do_spawn(aTHX_ (a)) |
112 | #define do_aspawn(a,b,c) os2_do_aspawn(aTHX_ (a),(b),(c)) |
113 | |
114 | #define OS2_ERROR_ALREADY_POSTED 299 /* Avoid os2.h */ |
115 | |
116 | extern int rc; |
117 | |
118 | #define MUTEX_INIT(m) \ |
119 | STMT_START { \ |
120 | int rc; \ |
121 | if ((rc = _rmutex_create(m,0))) \ |
122 | Perl_croak_nocontext("panic: MUTEX_INIT: rc=%i", rc); \ |
123 | } STMT_END |
124 | #define MUTEX_LOCK(m) \ |
125 | STMT_START { \ |
126 | int rc; \ |
127 | if ((rc = _rmutex_request(m,_FMR_IGNINT))) \ |
128 | Perl_croak_nocontext("panic: MUTEX_LOCK: rc=%i", rc); \ |
129 | } STMT_END |
130 | #define MUTEX_UNLOCK(m) \ |
131 | STMT_START { \ |
132 | int rc; \ |
133 | if ((rc = _rmutex_release(m))) \ |
134 | Perl_croak_nocontext("panic: MUTEX_UNLOCK: rc=%i", rc); \ |
135 | } STMT_END |
136 | #define MUTEX_DESTROY(m) \ |
137 | STMT_START { \ |
138 | int rc; \ |
139 | if ((rc = _rmutex_close(m))) \ |
140 | Perl_croak_nocontext("panic: MUTEX_DESTROY: rc=%i", rc); \ |
141 | } STMT_END |
142 | |
143 | #define COND_INIT(c) \ |
144 | STMT_START { \ |
145 | int rc; \ |
146 | if ((rc = DosCreateEventSem(NULL,c,0,0))) \ |
147 | Perl_croak_nocontext("panic: COND_INIT: rc=%i", rc); \ |
148 | } STMT_END |
149 | #define COND_SIGNAL(c) \ |
150 | STMT_START { \ |
151 | int rc; \ |
152 | if ((rc = DosPostEventSem(*(c))) && rc != OS2_ERROR_ALREADY_POSTED)\ |
153 | Perl_croak_nocontext("panic: COND_SIGNAL, rc=%ld", rc); \ |
154 | } STMT_END |
155 | #define COND_BROADCAST(c) \ |
156 | STMT_START { \ |
157 | int rc; \ |
158 | if ((rc = DosPostEventSem(*(c))) && rc != OS2_ERROR_ALREADY_POSTED)\ |
159 | Perl_croak_nocontext("panic: COND_BROADCAST, rc=%i", rc); \ |
160 | } STMT_END |
161 | /* #define COND_WAIT(c, m) \ |
162 | STMT_START { \ |
163 | if (WaitForSingleObject(*(c),INFINITE) == WAIT_FAILED) \ |
164 | Perl_croak_nocontext("panic: COND_WAIT"); \ |
165 | } STMT_END |
166 | */ |
167 | #define COND_WAIT(c, m) os2_cond_wait(c,m) |
168 | |
169 | #define COND_WAIT_win32(c, m) \ |
170 | STMT_START { \ |
171 | int rc; \ |
172 | if ((rc = SignalObjectAndWait(*(m),*(c),INFINITE,FALSE))) \ |
173 | Perl_croak_nocontext("panic: COND_WAIT"); \ |
174 | else \ |
175 | MUTEX_LOCK(m); \ |
176 | } STMT_END |
177 | #define COND_DESTROY(c) \ |
178 | STMT_START { \ |
179 | int rc; \ |
180 | if ((rc = DosCloseEventSem(*(c)))) \ |
181 | Perl_croak_nocontext("panic: COND_DESTROY, rc=%i", rc); \ |
182 | } STMT_END |
183 | /*#define THR ((struct thread *) TlsGetValue(PL_thr_key)) |
184 | */ |
185 | |
186 | #ifdef USE_SLOW_THREAD_SPECIFIC |
187 | # define pthread_getspecific(k) (*_threadstore()) |
188 | # define pthread_setspecific(k,v) (*_threadstore()=v,0) |
189 | # define pthread_key_create(keyp,flag) (*keyp=_gettid(),0) |
190 | #else /* USE_SLOW_THREAD_SPECIFIC */ |
191 | # define pthread_getspecific(k) (*(k)) |
192 | # define pthread_setspecific(k,v) (*(k)=(v),0) |
193 | # define pthread_key_create(keyp,flag) \ |
194 | ( DosAllocThreadLocalMemory(1,(unsigned long**)keyp) \ |
195 | ? Perl_croak_nocontext("LocalMemory"),1 \ |
196 | : 0 \ |
197 | ) |
198 | #endif /* USE_SLOW_THREAD_SPECIFIC */ |
199 | #define pthread_key_delete(keyp) |
200 | #define pthread_self() _gettid() |
201 | #define YIELD DosSleep(0) |
202 | |
203 | #ifdef PTHREADS_INCLUDED /* For ./x2p stuff. */ |
204 | int pthread_join(pthread_t tid, void **status); |
205 | int pthread_detach(pthread_t tid); |
206 | int pthread_create(pthread_t *tid, const pthread_attr_t *attr, |
207 | void *(*start_routine)(void*), void *arg); |
208 | #endif /* PTHREAD_INCLUDED */ |
209 | |
210 | #define THREADS_ELSEWHERE |
211 | |
212 | #else /* USE_ITHREADS */ |
213 | |
23da6c43 |
214 | #define do_spawn(a) os2_do_spawn(a) |
215 | #define do_aspawn(a,b,c) os2_do_aspawn((a),(b),(c)) |
4a6a15c8 |
216 | |
aa689395 |
217 | void Perl_OS2_init(char **); |
764df951 |
218 | void Perl_OS2_init3(char **envp, void **excH, int flags); |
219 | void Perl_OS2_term(void **excH, int exitstatus, int flags); |
aa689395 |
220 | |
764df951 |
221 | /* The code without INIT3 hideously puts env inside: */ |
365eb7b5 |
222 | |
764df951 |
223 | /* These ones should be in the same block as PERL_SYS_TERM() */ |
ed344e4f |
224 | #ifdef PERL_CORE |
764df951 |
225 | |
226 | # define PERL_SYS_INIT3(argcp, argvp, envp) \ |
227 | { void *xreg[2]; \ |
22f7c9c9 |
228 | MALLOC_CHECK_TAINT(*argcp, *argvp, *envp) \ |
ed344e4f |
229 | _response(argcp, argvp); \ |
230 | _wildcard(argcp, argvp); \ |
764df951 |
231 | Perl_OS2_init3(*envp, xreg, 0) |
232 | |
233 | # define PERL_SYS_INIT(argcp, argvp) { \ |
234 | { void *xreg[2]; \ |
eacfb5f1 |
235 | _response(argcp, argvp); \ |
c0c09dfd |
236 | _wildcard(argcp, argvp); \ |
764df951 |
237 | Perl_OS2_init3(NULL, xreg, 0) |
238 | |
ed344e4f |
239 | #else /* Compiling embedded Perl or Perl extension */ |
764df951 |
240 | |
241 | # define PERL_SYS_INIT3(argcp, argvp, envp) \ |
242 | { void *xreg[2]; \ |
243 | Perl_OS2_init3(*envp, xreg, 0) |
244 | # define PERL_SYS_INIT(argcp, argvp) { \ |
245 | { void *xreg[2]; \ |
246 | Perl_OS2_init3(NULL, xreg, 0) |
ed344e4f |
247 | #endif |
248 | |
764df951 |
249 | #define FORCE_EMX_DEINIT_EXIT 1 |
250 | #define FORCE_EMX_DEINIT_CRT_TERM 2 |
251 | #define FORCE_EMX_DEINIT_RUN_ATEXIT 4 |
252 | |
253 | #define PERL_SYS_TERM2(xreg,flags) \ |
254 | Perl_OS2_term(xreg, 0, flags); \ |
255 | MALLOC_TERM |
256 | |
257 | #define PERL_SYS_TERM1(xreg) \ |
258 | Perl_OS2_term(xreg, 0, FORCE_EMX_DEINIT_RUN_ATEXIT) |
259 | |
260 | /* This one should come in pair with PERL_SYS_INIT() and in the same block */ |
261 | #define PERL_SYS_TERM() \ |
262 | PERL_SYS_TERM1(xreg); \ |
263 | } |
264 | |
ed344e4f |
265 | #ifndef __EMX__ |
aab1f907 |
266 | # define PERL_CALLCONV _System |
267 | #endif |
ed344e4f |
268 | |
4ea6d94f |
269 | /* #define PERL_SYS_TERM() STMT_START { \ |
270 | if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */ |
271 | |
8cc95fdb |
272 | #define dXSUB_SYS OS2_XS_init() |
eacfb5f1 |
273 | |
4ea6d94f |
274 | #ifdef PERL_IS_AOUT |
4a6a15c8 |
275 | /* # define HAS_FORK */ |
760ac839 |
276 | /* # define HIDEMYMALLOC */ |
277 | /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */ |
278 | #else /* !PERL_IS_AOUT */ |
279 | # ifndef PERL_FOR_X2P |
4a6a15c8 |
280 | # ifdef EMX_BAD_SBRK |
281 | # define USE_PERL_SBRK |
282 | # endif |
283 | # else |
284 | # define PerlIO FILE |
760ac839 |
285 | # endif |
286 | # define SYSTEM_ALLOC(a) sys_alloc(a) |
287 | |
288 | void *sys_alloc(int size); |
289 | |
290 | #endif /* !PERL_IS_AOUT */ |
4a6a15c8 |
291 | #if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */ |
292 | # define PerlIO FILE |
293 | #endif |
4ea6d94f |
294 | |
23da6c43 |
295 | /* os2ish is used from a2p/a2p.h without pTHX/pTHX_ first being |
296 | * defined. Hack around this to get us to compile. |
297 | */ |
298 | #ifdef PTHX_UNUSED |
299 | # ifndef pTHX |
300 | # define pTHX |
301 | # endif |
302 | # ifndef pTHX_ |
303 | # define pTHX_ |
304 | # endif |
305 | #endif |
306 | |
c0c09dfd |
307 | #define TMPPATH1 "plXXXXXX" |
622913ab |
308 | extern const char *tmppath; |
23da6c43 |
309 | PerlIO *my_syspopen(pTHX_ char *cmd, char *mode); |
4a6a15c8 |
310 | /* Cannot prototype with I32 at this point. */ |
311 | int my_syspclose(PerlIO *f); |
55497cff |
312 | FILE *my_tmpfile (void); |
313 | char *my_tmpnam (char *); |
5ba48348 |
314 | int my_mkdir (__const__ char *, long); |
315 | int my_rmdir (__const__ char *); |
f72c975a |
316 | struct passwd *my_getpwent (void); |
317 | void my_setpwent (void); |
318 | void my_endpwent (void); |
a64c954a |
319 | char *gcvt_os2(double value, int digits, char *buffer); |
f72c975a |
320 | |
622913ab |
321 | #define MAX_SLEEP (((1<30) / (1000/4))-1) /* 1<32 msec */ |
322 | |
323 | static __inline__ unsigned |
324 | my_sleep(unsigned sec) |
325 | { |
326 | int remain; |
327 | while (sec > MAX_SLEEP) { |
328 | sec -= MAX_SLEEP; |
329 | remain = sleep(MAX_SLEEP); |
330 | if (remain) |
331 | return remain + sec; |
332 | } |
333 | return sleep(sec); |
334 | } |
335 | |
336 | #define sleep my_sleep |
337 | |
338 | #ifndef INCL_DOS |
339 | unsigned long DosSleep(unsigned long); |
340 | unsigned long DosAllocThreadLocalMemory (unsigned long cb, unsigned long **p); |
341 | #endif |
342 | |
f72c975a |
343 | struct group *getgrent (void); |
344 | void setgrent (void); |
345 | void endgrent (void); |
346 | |
347 | struct passwd *my_getpwuid (uid_t); |
348 | struct passwd *my_getpwnam (__const__ char *); |
55497cff |
349 | |
bddf7535 |
350 | #undef L_tmpnam |
351 | #define L_tmpnam MAXPATHLEN |
352 | |
55497cff |
353 | #define tmpfile my_tmpfile |
354 | #define tmpnam my_tmpnam |
3ed26a2c |
355 | #define isatty _isterm |
44a8e56a |
356 | #define rand random |
357 | #define srand srandom |
e75931a7 |
358 | #define strtoll _strtoll |
359 | #define strtoull _strtoull |
eacfb5f1 |
360 | |
622913ab |
361 | #define usleep(usec) ((void)_sleep2(((usec)+500)/1000)) |
362 | |
363 | |
4633a7c4 |
364 | /* |
365 | * fwrite1() should be a routine with the same calling sequence as fwrite(), |
366 | * but which outputs all of the bytes requested as a single stream (unlike |
367 | * fwrite() itself, which on some systems outputs several distinct records |
368 | * if the number_of_items parameter is >1). |
369 | */ |
370 | #define fwrite1 fwrite |
371 | |
372 | #define my_getenv(var) getenv(var) |
367f3c24 |
373 | #define flock my_flock |
5ba48348 |
374 | #define rmdir my_rmdir |
375 | #define mkdir my_mkdir |
f72c975a |
376 | #define setpwent my_setpwent |
377 | #define getpwent my_getpwent |
378 | #define endpwent my_endpwent |
379 | #define getpwuid my_getpwuid |
380 | #define getpwnam my_getpwnam |
4633a7c4 |
381 | |
df3ef7a9 |
382 | void *emx_calloc (size_t, size_t); |
383 | void emx_free (void *); |
384 | void *emx_malloc (size_t); |
385 | void *emx_realloc (void *, size_t); |
386 | |
4633a7c4 |
387 | /*****************************************************************************/ |
388 | |
389 | #include <stdlib.h> /* before the following definitions */ |
390 | #include <unistd.h> /* before the following definitions */ |
21cdd7e3 |
391 | #include <fcntl.h> |
392 | #include <sys/stat.h> |
4633a7c4 |
393 | |
394 | #define chdir _chdir2 |
395 | #define getcwd _getcwd2 |
396 | |
397 | /* This guy is needed for quick stdstd */ |
398 | |
399 | #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE) |
4633a7c4 |
400 | /* Perl uses ungetc only with successful return */ |
401 | # define ungetc(c,fp) \ |
402 | (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \ |
403 | ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp)) |
404 | #endif |
405 | |
23b84778 |
406 | #define PERLIO_IS_BINMODE_FD(fd) _PERLIO_IS_BINMODE_FD(fd) |
407 | |
9c75282f |
408 | #ifdef __GNUG__ |
409 | # define HAS_BOOL |
410 | #endif |
411 | #ifndef HAS_BOOL |
412 | # define bool char |
413 | # define HAS_BOOL 1 |
414 | #endif |
415 | |
ab8d95c9 |
416 | #include <emx/io.h> /* for _fd_flags() prototype */ |
377cf4e9 |
417 | |
23b84778 |
418 | static inline bool |
419 | _PERLIO_IS_BINMODE_FD(int fd) |
420 | { |
421 | int *pflags = _fd_flags(fd); |
422 | |
423 | return pflags && (*pflags) & O_BINARY; |
424 | } |
425 | |
46e87256 |
426 | /* ctermid is missing from emx0.9d */ |
427 | char *ctermid(char *s); |
428 | |
4633a7c4 |
429 | #define OP_BINARY O_BINARY |
430 | |
431 | #define OS2_STAT_HACK 1 |
432 | #if OS2_STAT_HACK |
433 | |
434 | #define Stat(fname,bufptr) os2_stat((fname),(bufptr)) |
5c728af0 |
435 | #define Fstat(fd,bufptr) os2_fstat((fd),(bufptr)) |
365eb7b5 |
436 | #define Fflush(fp) fflush(fp) |
8cc95fdb |
437 | #define Mkdir(path,mode) mkdir((path),(mode)) |
5c728af0 |
438 | #define chmod(path,mode) os2_chmod((path),(mode)) |
4633a7c4 |
439 | |
440 | #undef S_IFBLK |
441 | #undef S_ISBLK |
5c728af0 |
442 | #define S_IFBLK 0120000 /* Hacks to make things compile... */ |
4633a7c4 |
443 | #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) |
444 | |
5c728af0 |
445 | int os2_chmod(const char *name, int pmode); |
446 | int os2_fstat(int handle, struct stat *st); |
447 | |
4633a7c4 |
448 | #else |
449 | |
450 | #define Stat(fname,bufptr) stat((fname),(bufptr)) |
451 | #define Fstat(fd,bufptr) fstat((fd),(bufptr)) |
365eb7b5 |
452 | #define Fflush(fp) fflush(fp) |
8cc95fdb |
453 | #define Mkdir(path,mode) mkdir((path),(mode)) |
4633a7c4 |
454 | |
455 | #endif |
365eb7b5 |
456 | |
44a8e56a |
457 | /* With SD386 it is impossible to debug register variables. */ |
458 | #if !defined(PERL_IS_AOUT) && defined(DEBUGGING) && !defined(register) |
459 | # define register |
460 | #endif |
461 | |
365eb7b5 |
462 | /* Our private OS/2 specific data. */ |
463 | |
464 | typedef struct OS2_Perl_data { |
465 | unsigned long flags; |
466 | unsigned long phab; |
467 | int (*xs_init)(); |
4ea6d94f |
468 | unsigned long rc; |
469 | unsigned long severity; |
4bfbfac5 |
470 | unsigned long phmq; /* Handle to message queue */ |
471 | unsigned long phmq_refcnt; |
472 | unsigned long phmq_servers; |
473 | unsigned long initial_mode; /* VIO etc. mode we were started in */ |
622913ab |
474 | unsigned long morph_refcnt; |
365eb7b5 |
475 | } OS2_Perl_data_t; |
476 | |
477 | extern OS2_Perl_data_t OS2_Perl_data; |
478 | |
4ea6d94f |
479 | #define Perl_hab ((HAB)OS2_Perl_data.phab) |
480 | #define Perl_rc (OS2_Perl_data.rc) |
481 | #define Perl_severity (OS2_Perl_data.severity) |
482 | #define errno_isOS2 12345678 |
ed344e4f |
483 | #define errno_isOS2_set 12345679 |
4ea6d94f |
484 | #define OS2_Perl_flags (OS2_Perl_data.flags) |
365eb7b5 |
485 | #define Perl_HAB_set_f 1 |
4ea6d94f |
486 | #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f) |
487 | #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f) |
488 | #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h) |
4bfbfac5 |
489 | #define _obtain_Perl_HAB (init_PMWIN_entries(), \ |
490 | Perl_hab = (*PMWIN_entries.Initialize)(0), \ |
491 | set_Perl_HAB_f, Perl_hab) |
492 | #define perl_hab_GET() (Perl_HAB_set ? Perl_hab : _obtain_Perl_HAB) |
493 | #define Acquire_hab() perl_hab_GET() |
494 | #define Perl_hmq ((HMQ)OS2_Perl_data.phmq) |
495 | #define Perl_hmq_refcnt (OS2_Perl_data.phmq_refcnt) |
496 | #define Perl_hmq_servers (OS2_Perl_data.phmq_servers) |
497 | #define Perl_os2_initial_mode (OS2_Perl_data.initial_mode) |
622913ab |
498 | #define Perl_morph_refcnt (OS2_Perl_data.morph_refcnt) |
4bfbfac5 |
499 | |
500 | unsigned long Perl_hab_GET(); |
501 | unsigned long Perl_Register_MQ(int serve); |
502 | void Perl_Deregister_MQ(int serve); |
503 | int Perl_Serve_Messages(int force); |
504 | /* Cannot prototype with I32 at this point. */ |
505 | int Perl_Process_Messages(int force, long *cntp); |
23da6c43 |
506 | char *os2_execname(pTHX); |
4bfbfac5 |
507 | |
508 | struct _QMSG; |
509 | struct PMWIN_entries_t { |
510 | unsigned long (*Initialize)( unsigned long fsOptions ); |
511 | unsigned long (*CreateMsgQueue)(unsigned long hab, long cmsg); |
512 | int (*DestroyMsgQueue)(unsigned long hmq); |
513 | int (*PeekMsg)(unsigned long hab, struct _QMSG *pqmsg, |
514 | unsigned long hwndFilter, unsigned long msgFilterFirst, |
515 | unsigned long msgFilterLast, unsigned long fl); |
516 | int (*GetMsg)(unsigned long hab, struct _QMSG *pqmsg, |
517 | unsigned long hwndFilter, unsigned long msgFilterFirst, |
518 | unsigned long msgFilterLast); |
519 | void * (*DispatchMsg)(unsigned long hab, struct _QMSG *pqmsg); |
5ba48348 |
520 | unsigned long (*GetLastError)(unsigned long hab); |
521 | unsigned long (*CancelShutdown)(unsigned long hmq, unsigned long fCancelAlways); |
4bfbfac5 |
522 | }; |
523 | extern struct PMWIN_entries_t PMWIN_entries; |
524 | void init_PMWIN_entries(void); |
525 | |
ed344e4f |
526 | #define perl_hmq_GET(serve) Perl_Register_MQ(serve) |
527 | #define perl_hmq_UNSET(serve) Perl_Deregister_MQ(serve) |
4bfbfac5 |
528 | |
23da6c43 |
529 | #define OS2_XS_init() (*OS2_Perl_data.xs_init)(aTHX) |
ed344e4f |
530 | |
531 | #if _EMX_CRT_REV_ >= 60 |
532 | # define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2_set, \ |
533 | _setsyserrno(rc)) |
534 | #else |
535 | # define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2) |
536 | #endif |
537 | |
4ea6d94f |
538 | /* The expressions below return true on error. */ |
4a6a15c8 |
539 | /* INCL_DOSERRORS needed. rc should be declared outside. */ |
4ab57fcb |
540 | #define CheckOSError(expr) ((rc = (expr)) ? (FillOSError(rc), rc) : 0) |
4ea6d94f |
541 | /* INCL_WINERRORS needed. */ |
4ea6d94f |
542 | #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1)) |
30500b05 |
543 | |
544 | /* This form propagates the return value, setting $^E if needed */ |
545 | #define SaveWinError(expr) ((expr) ? : (FillWinError, 0)) |
546 | |
547 | /* This form propagates the return value, dieing with $^E if needed */ |
548 | #define SaveCroakWinError(expr,die,name1,name2) \ |
549 | ((expr) ? : (CroakWinError(die,name1 name2), 0)) |
550 | |
ed344e4f |
551 | #define FillOSError(rc) (os2_setsyserrno(rc), \ |
4ea6d94f |
552 | Perl_severity = SEVERITY_ERROR) |
5ba48348 |
553 | |
30500b05 |
554 | #define WinError_2_Perl_rc \ |
555 | ( init_PMWIN_entries(), \ |
556 | Perl_rc=(*PMWIN_entries.GetLastError)(perl_hab_GET()) ) |
557 | |
558 | /* Calling WinGetLastError() resets the error code of the current thread. |
559 | Since for some Win* API return value 0 is normal, one needs to call |
560 | this before calling them to distinguish normal and anomalous returns. */ |
561 | /*#define ResetWinError() WinError_2_Perl_rc */ |
562 | |
5ba48348 |
563 | /* At this moment init_PMWIN_entries() should be a nop (WinInitialize should |
564 | be called already, right?), so we do not risk stepping over our own error */ |
30500b05 |
565 | #define FillWinError ( WinError_2_Perl_rc, \ |
5ba48348 |
566 | Perl_severity = ERRORIDSEV(Perl_rc), \ |
567 | Perl_rc = ERRORIDERROR(Perl_rc), \ |
568 | os2_setsyserrno(Perl_rc)) |
4ea6d94f |
569 | |
760ac839 |
570 | #define STATIC_FILE_LENGTH 127 |
ff68c719 |
571 | |
35bc1fdc |
572 | /* This should match loadOrdinals[] array in os2.c */ |
573 | enum entries_ordinals { |
574 | ORD_DosQueryExtLibpath, |
575 | ORD_DosSetExtLibpath, |
576 | ORD_DosVerifyPidTid, |
577 | ORD_SETHOSTENT, |
578 | ORD_SETNETENT, |
579 | ORD_SETPROTOENT, |
580 | ORD_SETSERVENT, |
581 | ORD_GETHOSTENT, |
582 | ORD_GETNETENT, |
583 | ORD_GETPROTOENT, |
584 | ORD_GETSERVENT, |
585 | ORD_ENDHOSTENT, |
586 | ORD_ENDNETENT, |
587 | ORD_ENDPROTOENT, |
588 | ORD_ENDSERVENT, |
589 | ORD_WinInitialize, |
590 | ORD_WinCreateMsgQueue, |
591 | ORD_WinDestroyMsgQueue, |
592 | ORD_WinPeekMsg, |
593 | ORD_WinGetMsg, |
594 | ORD_WinDispatchMsg, |
595 | ORD_WinGetLastError, |
596 | ORD_WinCancelShutdown, |
597 | ORD_RexxStart, |
598 | ORD_RexxVariablePool, |
599 | ORD_RexxRegisterFunctionExe, |
600 | ORD_RexxDeregisterFunction, |
601 | ORD_DOSSMSETTITLE, |
602 | ORD_PRF32QUERYPROFILESIZE, |
603 | ORD_PRF32OPENPROFILE, |
604 | ORD_PRF32CLOSEPROFILE, |
605 | ORD_PRF32QUERYPROFILE, |
606 | ORD_PRF32RESET, |
607 | ORD_PRF32QUERYPROFILEDATA, |
608 | ORD_PRF32WRITEPROFILEDATA, |
609 | |
610 | ORD_WinChangeSwitchEntry, |
611 | ORD_WinQuerySwitchEntry, |
612 | ORD_WinQuerySwitchHandle, |
613 | ORD_WinQuerySwitchList, |
614 | ORD_WinSwitchToProgram, |
615 | ORD_WinBeginEnumWindows, |
616 | ORD_WinEndEnumWindows, |
617 | ORD_WinEnumDlgItem, |
618 | ORD_WinGetNextWindow, |
619 | ORD_WinIsChild, |
620 | ORD_WinQueryActiveWindow, |
621 | ORD_WinQueryClassName, |
622 | ORD_WinQueryFocus, |
623 | ORD_WinQueryWindow, |
624 | ORD_WinQueryWindowPos, |
625 | ORD_WinQueryWindowProcess, |
626 | ORD_WinQueryWindowText, |
627 | ORD_WinQueryWindowTextLength, |
628 | ORD_WinSetFocus, |
629 | ORD_WinSetWindowPos, |
630 | ORD_WinSetWindowText, |
631 | ORD_WinShowWindow, |
632 | ORD_WinIsWindow, |
633 | ORD_WinWindowFromId, |
634 | ORD_WinWindowFromPoint, |
635 | ORD_WinPostMsg, |
30500b05 |
636 | ORD_WinEnableWindow, |
637 | ORD_WinEnableWindowUpdate, |
638 | ORD_WinIsWindowEnabled, |
639 | ORD_WinIsWindowShowing, |
640 | ORD_WinIsWindowVisible, |
641 | ORD_WinQueryWindowPtr, |
642 | ORD_WinQueryWindowULong, |
643 | ORD_WinQueryWindowUShort, |
644 | ORD_WinSetWindowBits, |
645 | ORD_WinSetWindowPtr, |
646 | ORD_WinSetWindowULong, |
647 | ORD_WinSetWindowUShort, |
648 | ORD_WinQueryDesktopWindow, |
649 | ORD_WinSetActiveWindow, |
650 | ORD_DosQueryModFromEIP, |
622913ab |
651 | ORD_Dos32QueryHeaderInfo, |
652 | ORD_DosTmrQueryFreq, |
653 | ORD_DosTmrQueryTime, |
654 | ORD_WinQueryActiveDesktopPathname, |
655 | ORD_WinInvalidateRect, |
656 | ORD_WinCreateFrameControls, |
657 | ORD_WinQueryClipbrdFmtInfo, |
658 | ORD_WinQueryClipbrdOwner, |
659 | ORD_WinQueryClipbrdViewer, |
660 | ORD_WinQueryClipbrdData, |
661 | ORD_WinOpenClipbrd, |
662 | ORD_WinCloseClipbrd, |
663 | ORD_WinSetClipbrdData, |
664 | ORD_WinSetClipbrdOwner, |
665 | ORD_WinSetClipbrdViewer, |
666 | ORD_WinEnumClipbrdFmts, |
667 | ORD_WinEmptyClipbrd, |
668 | ORD_WinAddAtom, |
669 | ORD_WinFindAtom, |
670 | ORD_WinDeleteAtom, |
671 | ORD_WinQueryAtomUsage, |
672 | ORD_WinQueryAtomName, |
673 | ORD_WinQueryAtomLength, |
674 | ORD_WinQuerySystemAtomTable, |
675 | ORD_WinCreateAtomTable, |
676 | ORD_WinDestroyAtomTable, |
677 | ORD_WinOpenWindowDC, |
678 | ORD_DevOpenDC, |
679 | ORD_DevQueryCaps, |
680 | ORD_DevCloseDC, |
681 | ORD_WinMessageBox, |
682 | ORD_WinMessageBox2, |
683 | ORD_WinQuerySysValue, |
684 | ORD_WinSetSysValue, |
685 | ORD_WinAlarm, |
686 | ORD_WinFlashWindow, |
687 | ORD_WinLoadPointer, |
688 | ORD_WinQuerySysPointer, |
4ab57fcb |
689 | ORD_DosReplaceModule, |
59ad941d |
690 | ORD_DosPerfSysCall, |
691 | ORD_RexxRegisterSubcomExe, |
35bc1fdc |
692 | ORD_NENTRIES |
693 | }; |
694 | |
695 | /* RET: return type, AT: argument signature in (), ARGS: should be in () */ |
696 | #define CallORD(ret,o,at,args) (((ret (*)at) loadByOrdinal(o, 1))args) |
697 | #define DeclFuncByORD(ret,name,o,at,args) \ |
698 | ret name at { return CallORD(ret,o,at,args); } |
699 | #define DeclVoidFuncByORD(name,o,at,args) \ |
700 | void name at { CallORD(void,o,at,args); } |
701 | |
4ab57fcb |
702 | /* This function returns error code on error, and saves the error info in $^E and Perl_rc */ |
703 | #define DeclOSFuncByORD_native(ret,name,o,at,args) \ |
704 | ret name at { unsigned long rc; return CheckOSError(CallORD(ret,o,at,args)); } |
705 | |
706 | /* These functions return false on error, and save the error info in $^E and Perl_rc */ |
35bc1fdc |
707 | #define DeclOSFuncByORD(ret,name,o,at,args) \ |
708 | ret name at { unsigned long rc; return !CheckOSError(CallORD(ret,o,at,args)); } |
709 | #define DeclWinFuncByORD(ret,name,o,at,args) \ |
710 | ret name at { return SaveWinError(CallORD(ret,o,at,args)); } |
711 | |
712 | #define AssignFuncPByORD(p,o) (*(Perl_PFN*)&(p) = (loadByOrdinal(o, 1))) |
713 | |
30500b05 |
714 | /* This flavor caches the procedure pointer (named as p__Win#name) locally */ |
715 | #define DeclWinFuncByORD_CACHE(ret,name,o,at,args) \ |
716 | DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,0,1) |
717 | |
718 | /* This flavor may reset the last error before the call (if ret=0 may be OK) */ |
719 | #define DeclWinFuncByORD_CACHE_resetError(ret,name,o,at,args) \ |
720 | DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,1,1) |
721 | |
722 | /* Two flavors below do the same as above, but do not auto-croak */ |
723 | /* This flavor caches the procedure pointer (named as p__Win#name) locally */ |
724 | #define DeclWinFuncByORD_CACHE_survive(ret,name,o,at,args) \ |
725 | DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,0,0) |
726 | |
727 | /* This flavor may reset the last error before the call (if ret=0 may be OK) */ |
728 | #define DeclWinFuncByORD_CACHE_resetError_survive(ret,name,o,at,args) \ |
729 | DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,1,0) |
730 | |
731 | #define DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,r,die) \ |
732 | static ret (*CAT2(p__Win,name)) at; \ |
733 | static ret name at { \ |
734 | if (!CAT2(p__Win,name)) \ |
735 | AssignFuncPByORD(CAT2(p__Win,name), o); \ |
736 | if (r) ResetWinError(); \ |
737 | return SaveCroakWinError(CAT2(p__Win,name) args, die, "[Win]", STRINGIFY(name)); } |
738 | |
739 | /* These flavors additionally assume ORD is name with prepended ORD_Win */ |
740 | #define DeclWinFunc_CACHE(ret,name,at,args) \ |
741 | DeclWinFuncByORD_CACHE(ret,name,CAT2(ORD_Win,name),at,args) |
742 | #define DeclWinFunc_CACHE_resetError(ret,name,at,args) \ |
743 | DeclWinFuncByORD_CACHE_resetError(ret,name,CAT2(ORD_Win,name),at,args) |
744 | #define DeclWinFunc_CACHE_survive(ret,name,at,args) \ |
745 | DeclWinFuncByORD_CACHE_survive(ret,name,CAT2(ORD_Win,name),at,args) |
746 | #define DeclWinFunc_CACHE_resetError_survive(ret,name,at,args) \ |
747 | DeclWinFuncByORD_CACHE_resetError_survive(ret,name,CAT2(ORD_Win,name),at,args) |
748 | |
749 | void ResetWinError(void); |
750 | void CroakWinError(int die, char *name); |
751 | |
760ac839 |
752 | #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n)) |
753 | char *perllib_mangle(char *, unsigned int); |
4ea6d94f |
754 | |
5c728af0 |
755 | #define fork fork_with_resources |
756 | |
46c6a8ac |
757 | #ifdef EINTR /* x2p do not include perl.h!!! */ |
622913ab |
758 | static __inline__ int |
759 | my_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) |
760 | { |
761 | if (nfds == 0 && timeout && (_emx_env & 0x200)) { |
762 | if (DosSleep(1000 * timeout->tv_sec + (timeout->tv_usec + 500)/1000) == 0) |
763 | return 0; |
764 | errno = EINTR; |
765 | return -1; |
766 | } |
767 | return select(nfds, readfds, writefds, exceptfds, timeout); |
768 | } |
769 | |
770 | #define select my_select |
46c6a8ac |
771 | #endif |
622913ab |
772 | |
773 | |
35bc1fdc |
774 | typedef int (*Perl_PFN)(); |
775 | Perl_PFN loadByOrdinal(enum entries_ordinals ord, int fail); |
776 | extern const Perl_PFN * const pExtFCN; |
4ea6d94f |
777 | char *os2error(int rc); |
2d766320 |
778 | int os2_stat(const char *name, struct stat *st); |
5c728af0 |
779 | int fork_with_resources(); |
2d766320 |
780 | int setpriority(int which, int pid, int val); |
781 | int getpriority(int which /* ignored */, int pid); |
782 | |
622913ab |
783 | void croak_with_os2error(char *s) __attribute__((noreturn)); |
784 | |
2d766320 |
785 | #ifdef PERL_CORE |
786 | int os2_do_spawn(pTHX_ char *cmd); |
622913ab |
787 | int os2_do_aspawn(pTHX_ SV *really, SV **vmark, SV **vsp); |
2d766320 |
788 | #endif |
4ea6d94f |
789 | |
ee964dfe |
790 | #ifndef LOG_DAEMON |
791 | |
792 | /* Replacement for syslog.h */ |
793 | # define LOG_EMERG 0 /* system is unusable */ |
794 | # define LOG_ALERT 1 /* action must be taken immediately */ |
795 | # define LOG_CRIT 2 /* critical conditions */ |
796 | # define LOG_ERR 3 /* error conditions */ |
797 | # define LOG_WARNING 4 /* warning conditions */ |
798 | # define LOG_NOTICE 5 /* normal but significant condition */ |
799 | # define LOG_INFO 6 /* informational */ |
800 | # define LOG_DEBUG 7 /* debug-level messages */ |
801 | |
802 | # define LOG_PRIMASK 0x007 /* mask to extract priority part (internal) */ |
803 | /* extract priority */ |
804 | # define LOG_PRI(p) ((p) & LOG_PRIMASK) |
805 | # define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) |
806 | |
807 | /* facility codes */ |
808 | # define LOG_KERN (0<<3) /* kernel messages */ |
809 | # define LOG_USER (1<<3) /* random user-level messages */ |
810 | # define LOG_MAIL (2<<3) /* mail system */ |
811 | # define LOG_DAEMON (3<<3) /* system daemons */ |
812 | # define LOG_AUTH (4<<3) /* security/authorization messages */ |
813 | # define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ |
814 | # define LOG_LPR (6<<3) /* line printer subsystem */ |
815 | # define LOG_NEWS (7<<3) /* network news subsystem */ |
816 | # define LOG_UUCP (8<<3) /* UUCP subsystem */ |
817 | # define LOG_CRON (15<<3) /* clock daemon */ |
818 | /* other codes through 15 reserved for system use */ |
819 | # define LOG_LOCAL0 (16<<3) /* reserved for local use */ |
820 | # define LOG_LOCAL1 (17<<3) /* reserved for local use */ |
821 | # define LOG_LOCAL2 (18<<3) /* reserved for local use */ |
822 | # define LOG_LOCAL3 (19<<3) /* reserved for local use */ |
823 | # define LOG_LOCAL4 (20<<3) /* reserved for local use */ |
824 | # define LOG_LOCAL5 (21<<3) /* reserved for local use */ |
825 | # define LOG_LOCAL6 (22<<3) /* reserved for local use */ |
826 | # define LOG_LOCAL7 (23<<3) /* reserved for local use */ |
827 | |
828 | # define LOG_NFACILITIES 24 /* current number of facilities */ |
829 | # define LOG_FACMASK 0x03f8 /* mask to extract facility part */ |
830 | /* facility of pri */ |
831 | # define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) |
832 | |
833 | /* |
834 | * arguments to setlogmask. |
835 | */ |
836 | # define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ |
837 | # define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ |
838 | |
839 | /* |
840 | * Option flags for openlog. |
841 | * |
842 | * LOG_ODELAY no longer does anything. |
843 | * LOG_NDELAY is the inverse of what it used to be. |
844 | */ |
845 | # define LOG_PID 0x01 /* log the pid with each message */ |
846 | # define LOG_CONS 0x02 /* log on the console if errors in sending */ |
847 | # define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ |
848 | # define LOG_NDELAY 0x08 /* don't delay open */ |
849 | # define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ |
850 | # define LOG_PERROR 0x20 /* log to stderr as well */ |
851 | |
852 | #endif |
853 | |
4ea6d94f |
854 | /* ************************************************************ */ |
855 | #define Dos32QuerySysState DosQuerySysState |
856 | #define QuerySysState(flags, pid, buf, bufsz) \ |
857 | Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz) |
858 | |
859 | #define QSS_PROCESS 1 |
df3ef7a9 |
860 | #define QSS_MODULE 4 |
861 | #define QSS_SEMAPHORES 2 |
4ea6d94f |
862 | #define QSS_FILE 8 /* Buggy until fixpack18 */ |
863 | #define QSS_SHARED 16 |
864 | |
ed344e4f |
865 | #ifdef _OS2_H |
4ea6d94f |
866 | |
867 | APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid, |
868 | ULONG _res_,PVOID buf,ULONG bufsz); |
869 | typedef struct { |
870 | ULONG threadcnt; |
871 | ULONG proccnt; |
872 | ULONG modulecnt; |
873 | } QGLOBAL, *PQGLOBAL; |
874 | |
875 | typedef struct { |
876 | ULONG rectype; |
877 | USHORT threadid; |
878 | USHORT slotid; |
879 | ULONG sleepid; |
880 | ULONG priority; |
881 | ULONG systime; |
882 | ULONG usertime; |
883 | UCHAR state; |
884 | UCHAR _reserved1_; /* padding to ULONG */ |
885 | USHORT _reserved2_; /* padding to ULONG */ |
886 | } QTHREAD, *PQTHREAD; |
887 | |
888 | typedef struct { |
889 | USHORT sfn; |
890 | USHORT refcnt; |
891 | USHORT flags1; |
892 | USHORT flags2; |
893 | USHORT accmode1; |
894 | USHORT accmode2; |
895 | ULONG filesize; |
896 | USHORT volhnd; |
897 | USHORT attrib; |
898 | USHORT _reserved_; |
899 | } QFDS, *PQFDS; |
900 | |
901 | typedef struct qfile { |
902 | ULONG rectype; |
903 | struct qfile *next; |
904 | ULONG opencnt; |
905 | PQFDS filedata; |
906 | char name[1]; |
907 | } QFILE, *PQFILE; |
908 | |
909 | typedef struct { |
910 | ULONG rectype; |
911 | PQTHREAD threads; |
912 | USHORT pid; |
913 | USHORT ppid; |
914 | ULONG type; |
915 | ULONG state; |
916 | ULONG sessid; |
917 | USHORT hndmod; |
918 | USHORT threadcnt; |
919 | ULONG privsem32cnt; |
920 | ULONG _reserved2_; |
921 | USHORT sem16cnt; |
922 | USHORT dllcnt; |
923 | USHORT shrmemcnt; |
924 | USHORT fdscnt; |
925 | PUSHORT sem16s; |
926 | PUSHORT dlls; |
927 | PUSHORT shrmems; |
928 | PUSHORT fds; |
929 | } QPROCESS, *PQPROCESS; |
930 | |
931 | typedef struct sema { |
932 | struct sema *next; |
933 | USHORT refcnt; |
934 | UCHAR sysflags; |
935 | UCHAR sysproccnt; |
936 | ULONG _reserved1_; |
937 | USHORT index; |
938 | CHAR name[1]; |
939 | } QSEMA, *PQSEMA; |
940 | |
941 | typedef struct { |
942 | ULONG rectype; |
943 | ULONG _reserved1_; |
944 | USHORT _reserved2_; |
945 | USHORT syssemidx; |
946 | ULONG index; |
947 | QSEMA sema; |
948 | } QSEMSTRUC, *PQSEMSTRUC; |
949 | |
950 | typedef struct { |
951 | USHORT pid; |
952 | USHORT opencnt; |
953 | } QSEMOWNER32, *PQSEMOWNER32; |
954 | |
955 | typedef struct { |
956 | PQSEMOWNER32 own; |
957 | PCHAR name; |
958 | PVOID semrecs; /* array of associated sema's */ |
959 | USHORT flags; |
960 | USHORT semreccnt; |
961 | USHORT waitcnt; |
962 | USHORT _reserved_; /* padding to ULONG */ |
963 | } QSEMSMUX32, *PQSEMSMUX32; |
964 | |
965 | typedef struct { |
966 | PQSEMOWNER32 own; |
967 | PCHAR name; |
968 | PQSEMSMUX32 mux; |
969 | USHORT flags; |
970 | USHORT postcnt; |
971 | } QSEMEV32, *PQSEMEV32; |
972 | |
973 | typedef struct { |
974 | PQSEMOWNER32 own; |
975 | PCHAR name; |
976 | PQSEMSMUX32 mux; |
977 | USHORT flags; |
978 | USHORT refcnt; |
979 | USHORT thrdnum; |
980 | USHORT _reserved_; /* padding to ULONG */ |
981 | } QSEMMUX32, *PQSEMMUX32; |
982 | |
983 | typedef struct semstr32 { |
984 | struct semstr *next; |
985 | QSEMEV32 evsem; |
986 | QSEMMUX32 muxsem; |
987 | QSEMSMUX32 smuxsem; |
988 | } QSEMSTRUC32, *PQSEMSTRUC32; |
989 | |
990 | typedef struct shrmem { |
991 | struct shrmem *next; |
992 | USHORT hndshr; |
993 | USHORT selshr; |
994 | USHORT refcnt; |
995 | CHAR name[1]; |
996 | } QSHRMEM, *PQSHRMEM; |
997 | |
998 | typedef struct module { |
999 | struct module *next; |
1000 | USHORT hndmod; |
1001 | USHORT type; |
1002 | ULONG refcnt; |
1003 | ULONG segcnt; |
1004 | PVOID _reserved_; |
1005 | PCHAR name; |
1006 | USHORT modref[1]; |
1007 | } QMODULE, *PQMODULE; |
1008 | |
1009 | typedef struct { |
1010 | PQGLOBAL gbldata; |
1011 | PQPROCESS procdata; |
1012 | PQSEMSTRUC semadata; |
1013 | PQSEMSTRUC32 sem32data; |
1014 | PQSHRMEM shrmemdata; |
1015 | PQMODULE moddata; |
1016 | PVOID _reserved2_; |
1017 | PQFILE filedata; |
1018 | } QTOPLEVEL, *PQTOPLEVEL; |
1019 | /* ************************************************************ */ |
1020 | |
1021 | PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags); |
1022 | |
ed344e4f |
1023 | #endif /* _OS2_H */ |
5ae7bdf7 |
1024 | |