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