source: vendor/perl/5.8.8/os2/os2ish.h

Last change on this file was 3181, checked in by bird, 18 years ago

perl 5.8.8

File size: 37.5 KB
Line 
1#include <signal.h>
2#include <io.h>
3/* #include <sys/select.h> */
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
17/* BIG_TIME:
18 * This symbol is defined if Time_t is an unsigned type on this system.
19 */
20#define BIG_TIME
21
22#define HAS_KILL
23#define HAS_WAIT
24#define HAS_DLERROR
25#define HAS_WAITPID_RUNTIME (_emx_env & 0x200)
26
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
44/* USEMYBINMODE
45 * This symbol, if defined, indicates that the program should
46 * use the routine my_binmode(FILE *fp, char iotype, int mode) to insure
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
52#define SOCKET_OPEN_MODE "b"
53
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
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 /**/
74
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 */
85#define ALTERNATE_SHEBANG "extproc "
86
87#ifndef SIGABRT
88# define SIGABRT SIGILL
89#endif
90#ifndef SIGILL
91# define SIGILL 6 /* blech */
92#endif
93#define ABORT() kill(PerlProc_getpid(),SIGABRT);
94
95#define BIT_BUCKET "/dev/nul" /* Will this work? */
96
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
104#if defined(I_SYS_UN) && !defined(TCPIPV4)
105/* It is not working without TCPIPV4 defined. */
106# undef I_SYS_UN
107#endif
108
109#if defined(USE_5005THREADS) || defined(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
116extern 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. */
204int pthread_join(pthread_t tid, void **status);
205int pthread_detach(pthread_t tid);
206int 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_5005THREADS */
213
214#define do_spawn(a) os2_do_spawn(a)
215#define do_aspawn(a,b,c) os2_do_aspawn((a),(b),(c))
216
217#endif /* USE_5005THREADS */
218
219void Perl_OS2_init(char **);
220void Perl_OS2_init3(char **envp, void **excH, int flags);
221void Perl_OS2_term(void **excH, int exitstatus, int flags);
222
223/* The code without INIT3 hideously puts env inside: */
224
225/* These ones should be in the same block as PERL_SYS_TERM() */
226#ifdef PERL_CORE
227
228# define PERL_SYS_INIT3(argcp, argvp, envp) \
229 { void *xreg[2]; \
230 MALLOC_CHECK_TAINT(*argcp, *argvp, *envp) \
231 _response(argcp, argvp); \
232 _wildcard(argcp, argvp); \
233 Perl_OS2_init3(*envp, xreg, 0)
234
235# define PERL_SYS_INIT(argcp, argvp) { \
236 { void *xreg[2]; \
237 _response(argcp, argvp); \
238 _wildcard(argcp, argvp); \
239 Perl_OS2_init3(NULL, xreg, 0)
240
241#else /* Compiling embedded Perl or Perl extension */
242
243# define PERL_SYS_INIT3(argcp, argvp, envp) \
244 { void *xreg[2]; \
245 Perl_OS2_init3(*envp, xreg, 0)
246# define PERL_SYS_INIT(argcp, argvp) { \
247 { void *xreg[2]; \
248 Perl_OS2_init3(NULL, xreg, 0)
249#endif
250
251#define FORCE_EMX_DEINIT_EXIT 1
252#define FORCE_EMX_DEINIT_CRT_TERM 2
253#define FORCE_EMX_DEINIT_RUN_ATEXIT 4
254
255#define PERL_SYS_TERM2(xreg,flags) \
256 Perl_OS2_term(xreg, 0, flags); \
257 MALLOC_TERM
258
259#define PERL_SYS_TERM1(xreg) \
260 Perl_OS2_term(xreg, 0, FORCE_EMX_DEINIT_RUN_ATEXIT)
261
262/* This one should come in pair with PERL_SYS_INIT() and in the same block */
263#define PERL_SYS_TERM() \
264 PERL_SYS_TERM1(xreg); \
265 }
266
267#ifndef __EMX__
268# define PERL_CALLCONV _System
269#endif
270
271/* #define PERL_SYS_TERM() STMT_START { \
272 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
273
274#define dXSUB_SYS OS2_XS_init()
275
276#ifdef PERL_IS_AOUT
277/* # define HAS_FORK */
278/* # define HIDEMYMALLOC */
279/* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
280#else /* !PERL_IS_AOUT */
281# ifndef PERL_FOR_X2P
282# ifdef EMX_BAD_SBRK
283# define USE_PERL_SBRK
284# endif
285# else
286# define PerlIO FILE
287# endif
288# define SYSTEM_ALLOC(a) sys_alloc(a)
289
290void *sys_alloc(int size);
291
292#endif /* !PERL_IS_AOUT */
293#if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */
294# define PerlIO FILE
295#endif
296
297/* os2ish is used from a2p/a2p.h without pTHX/pTHX_ first being
298 * defined. Hack around this to get us to compile.
299*/
300#ifdef PTHX_UNUSED
301# ifndef pTHX
302# define pTHX
303# endif
304# ifndef pTHX_
305# define pTHX_
306# endif
307#endif
308
309#define TMPPATH1 "plXXXXXX"
310extern const char *tmppath;
311PerlIO *my_syspopen(pTHX_ char *cmd, char *mode);
312/* Cannot prototype with I32 at this point. */
313int my_syspclose(PerlIO *f);
314FILE *my_tmpfile (void);
315char *my_tmpnam (char *);
316int my_mkdir (__const__ char *, long);
317int my_rmdir (__const__ char *);
318struct passwd *my_getpwent (void);
319void my_setpwent (void);
320void my_endpwent (void);
321char *gcvt_os2(double value, int digits, char *buffer);
322
323extern int async_mssleep(unsigned long ms, int switch_priority);
324extern unsigned long msCounter(void);
325extern unsigned long InfoTable(int local);
326extern unsigned long find_myself(void);
327
328#define MAX_SLEEP (((1<30) / (1000/4))-1) /* 1<32 msec */
329
330static __inline__ unsigned
331my_sleep(unsigned sec)
332{
333 int remain;
334 while (sec > MAX_SLEEP) {
335 sec -= MAX_SLEEP;
336 remain = sleep(MAX_SLEEP);
337 if (remain)
338 return remain + sec;
339 }
340 return sleep(sec);
341}
342
343#define sleep my_sleep
344
345#ifndef INCL_DOS
346unsigned long DosSleep(unsigned long);
347unsigned long DosAllocThreadLocalMemory (unsigned long cb, unsigned long **p);
348#endif
349
350struct group *getgrent (void);
351void setgrent (void);
352void endgrent (void);
353
354struct passwd *my_getpwuid (uid_t);
355struct passwd *my_getpwnam (__const__ char *);
356
357#undef L_tmpnam
358#define L_tmpnam MAXPATHLEN
359
360#define tmpfile my_tmpfile
361#define tmpnam my_tmpnam
362#define isatty _isterm
363#define rand random
364#define srand srandom
365#define strtoll _strtoll
366#define strtoull _strtoull
367
368#define usleep(usec) ((void)async_mssleep(((usec)+500)/1000, 500))
369
370
371/*
372 * fwrite1() should be a routine with the same calling sequence as fwrite(),
373 * but which outputs all of the bytes requested as a single stream (unlike
374 * fwrite() itself, which on some systems outputs several distinct records
375 * if the number_of_items parameter is >1).
376 */
377#define fwrite1 fwrite
378
379#define my_getenv(var) getenv(var)
380#define flock my_flock
381#define rmdir my_rmdir
382#define mkdir my_mkdir
383#define setpwent my_setpwent
384#define getpwent my_getpwent
385#define endpwent my_endpwent
386#define getpwuid my_getpwuid
387#define getpwnam my_getpwnam
388
389void *emx_calloc (size_t, size_t);
390void emx_free (void *);
391void *emx_malloc (size_t);
392void *emx_realloc (void *, size_t);
393
394/*****************************************************************************/
395
396#include <stdlib.h> /* before the following definitions */
397#include <unistd.h> /* before the following definitions */
398#include <fcntl.h>
399#include <sys/stat.h>
400
401#define chdir _chdir2
402#define getcwd _getcwd2
403
404/* This guy is needed for quick stdstd */
405
406#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
407 /* Perl uses ungetc only with successful return */
408# define ungetc(c,fp) \
409 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
410 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
411#endif
412
413#define PERLIO_IS_BINMODE_FD(fd) _PERLIO_IS_BINMODE_FD(fd)
414
415#ifdef __GNUG__
416# define HAS_BOOL
417#endif
418#ifndef HAS_BOOL
419# define bool char
420# define HAS_BOOL 1
421#endif
422
423#include <emx/io.h> /* for _fd_flags() prototype */
424
425static inline bool
426_PERLIO_IS_BINMODE_FD(int fd)
427{
428 int *pflags = _fd_flags(fd);
429
430 return pflags && (*pflags) & O_BINARY;
431}
432
433/* ctermid is missing from emx0.9d */
434char *ctermid(char *s);
435
436#define OP_BINARY O_BINARY
437
438#define OS2_STAT_HACK 1
439#if OS2_STAT_HACK
440
441#define Stat(fname,bufptr) os2_stat((fname),(bufptr))
442#define Fstat(fd,bufptr) os2_fstat((fd),(bufptr))
443#define Fflush(fp) fflush(fp)
444#define Mkdir(path,mode) mkdir((path),(mode))
445#define chmod(path,mode) os2_chmod((path),(mode))
446
447#undef S_IFBLK
448#undef S_ISBLK
449#define S_IFBLK 0120000 /* Hacks to make things compile... */
450#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
451
452int os2_chmod(const char *name, int pmode);
453int os2_fstat(int handle, struct stat *st);
454
455#else
456
457#define Stat(fname,bufptr) stat((fname),(bufptr))
458#define Fstat(fd,bufptr) fstat((fd),(bufptr))
459#define Fflush(fp) fflush(fp)
460#define Mkdir(path,mode) mkdir((path),(mode))
461
462#endif
463
464/* With SD386 it is impossible to debug register variables. */
465#if !defined(PERL_IS_AOUT) && defined(DEBUGGING) && !defined(register)
466# define register
467#endif
468
469/* Our private OS/2 specific data. */
470
471typedef struct OS2_Perl_data {
472 unsigned long flags;
473 unsigned long phab;
474 int (*xs_init)();
475 unsigned long rc;
476 unsigned long severity;
477 unsigned long phmq; /* Handle to message queue */
478 unsigned long phmq_refcnt;
479 unsigned long phmq_servers;
480 unsigned long initial_mode; /* VIO etc. mode we were started in */
481 unsigned long morph_refcnt;
482} OS2_Perl_data_t;
483
484extern OS2_Perl_data_t OS2_Perl_data;
485
486#define Perl_hab ((HAB)OS2_Perl_data.phab)
487#define Perl_rc (OS2_Perl_data.rc)
488#define Perl_severity (OS2_Perl_data.severity)
489#define errno_isOS2 12345678
490#define errno_isOS2_set 12345679
491#define OS2_Perl_flags (OS2_Perl_data.flags)
492#define Perl_HAB_set_f 1
493#define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
494#define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
495#define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
496#define _obtain_Perl_HAB (init_PMWIN_entries(), \
497 Perl_hab = (*PMWIN_entries.Initialize)(0), \
498 set_Perl_HAB_f, Perl_hab)
499#define perl_hab_GET() (Perl_HAB_set ? Perl_hab : _obtain_Perl_HAB)
500#define Acquire_hab() perl_hab_GET()
501#define Perl_hmq ((HMQ)OS2_Perl_data.phmq)
502#define Perl_hmq_refcnt (OS2_Perl_data.phmq_refcnt)
503#define Perl_hmq_servers (OS2_Perl_data.phmq_servers)
504#define Perl_os2_initial_mode (OS2_Perl_data.initial_mode)
505#define Perl_morph_refcnt (OS2_Perl_data.morph_refcnt)
506
507unsigned long Perl_hab_GET();
508unsigned long Perl_Register_MQ(int serve);
509void Perl_Deregister_MQ(int serve);
510int Perl_Serve_Messages(int force);
511/* Cannot prototype with I32 at this point. */
512int Perl_Process_Messages(int force, long *cntp);
513char *os2_execname(pTHX);
514
515struct _QMSG;
516struct PMWIN_entries_t {
517 unsigned long (*Initialize)( unsigned long fsOptions );
518 unsigned long (*CreateMsgQueue)(unsigned long hab, long cmsg);
519 int (*DestroyMsgQueue)(unsigned long hmq);
520 int (*PeekMsg)(unsigned long hab, struct _QMSG *pqmsg,
521 unsigned long hwndFilter, unsigned long msgFilterFirst,
522 unsigned long msgFilterLast, unsigned long fl);
523 int (*GetMsg)(unsigned long hab, struct _QMSG *pqmsg,
524 unsigned long hwndFilter, unsigned long msgFilterFirst,
525 unsigned long msgFilterLast);
526 void * (*DispatchMsg)(unsigned long hab, struct _QMSG *pqmsg);
527 unsigned long (*GetLastError)(unsigned long hab);
528 unsigned long (*CancelShutdown)(unsigned long hmq, unsigned long fCancelAlways);
529};
530extern struct PMWIN_entries_t PMWIN_entries;
531void init_PMWIN_entries(void);
532
533#define perl_hmq_GET(serve) Perl_Register_MQ(serve)
534#define perl_hmq_UNSET(serve) Perl_Deregister_MQ(serve)
535
536#define OS2_XS_init() (*OS2_Perl_data.xs_init)(aTHX)
537
538#if _EMX_CRT_REV_ >= 60
539# define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2_set, \
540 _setsyserrno(rc))
541#else
542# define os2_setsyserrno(rc) (Perl_rc = rc, errno = errno_isOS2)
543#endif
544
545/* The expressions below return true on error. */
546/* INCL_DOSERRORS needed. rc should be declared outside. */
547#define CheckOSError(expr) ((rc = (expr)) ? (FillOSError(rc), rc) : 0)
548/* INCL_WINERRORS needed. */
549#define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
550
551/* This form propagates the return value, setting $^E if needed */
552#define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
553
554/* This form propagates the return value, dieing with $^E if needed */
555#define SaveCroakWinError(expr,die,name1,name2) \
556 ((expr) ? : (CroakWinError(die,name1 name2), 0))
557
558#define FillOSError(rc) (os2_setsyserrno(rc), \
559 Perl_severity = SEVERITY_ERROR)
560
561#define WinError_2_Perl_rc \
562 ( init_PMWIN_entries(), \
563 Perl_rc=(*PMWIN_entries.GetLastError)(perl_hab_GET()) )
564
565/* Calling WinGetLastError() resets the error code of the current thread.
566 Since for some Win* API return value 0 is normal, one needs to call
567 this before calling them to distinguish normal and anomalous returns. */
568/*#define ResetWinError() WinError_2_Perl_rc */
569
570/* At this moment init_PMWIN_entries() should be a nop (WinInitialize should
571 be called already, right?), so we do not risk stepping over our own error */
572#define FillWinError ( WinError_2_Perl_rc, \
573 Perl_severity = ERRORIDSEV(Perl_rc), \
574 Perl_rc = ERRORIDERROR(Perl_rc), \
575 os2_setsyserrno(Perl_rc))
576
577#define STATIC_FILE_LENGTH 127
578
579 /* This should match loadOrdinals[] array in os2.c */
580enum entries_ordinals {
581 ORD_DosQueryExtLibpath,
582 ORD_DosSetExtLibpath,
583 ORD_DosVerifyPidTid,
584 ORD_SETHOSTENT,
585 ORD_SETNETENT,
586 ORD_SETPROTOENT,
587 ORD_SETSERVENT,
588 ORD_GETHOSTENT,
589 ORD_GETNETENT,
590 ORD_GETPROTOENT,
591 ORD_GETSERVENT,
592 ORD_ENDHOSTENT,
593 ORD_ENDNETENT,
594 ORD_ENDPROTOENT,
595 ORD_ENDSERVENT,
596 ORD_WinInitialize,
597 ORD_WinCreateMsgQueue,
598 ORD_WinDestroyMsgQueue,
599 ORD_WinPeekMsg,
600 ORD_WinGetMsg,
601 ORD_WinDispatchMsg,
602 ORD_WinGetLastError,
603 ORD_WinCancelShutdown,
604 ORD_RexxStart,
605 ORD_RexxVariablePool,
606 ORD_RexxRegisterFunctionExe,
607 ORD_RexxDeregisterFunction,
608 ORD_DOSSMSETTITLE,
609 ORD_PRF32QUERYPROFILESIZE,
610 ORD_PRF32OPENPROFILE,
611 ORD_PRF32CLOSEPROFILE,
612 ORD_PRF32QUERYPROFILE,
613 ORD_PRF32RESET,
614 ORD_PRF32QUERYPROFILEDATA,
615 ORD_PRF32WRITEPROFILEDATA,
616
617 ORD_WinChangeSwitchEntry,
618 ORD_WinQuerySwitchEntry,
619 ORD_WinQuerySwitchHandle,
620 ORD_WinQuerySwitchList,
621 ORD_WinSwitchToProgram,
622 ORD_WinBeginEnumWindows,
623 ORD_WinEndEnumWindows,
624 ORD_WinEnumDlgItem,
625 ORD_WinGetNextWindow,
626 ORD_WinIsChild,
627 ORD_WinQueryActiveWindow,
628 ORD_WinQueryClassName,
629 ORD_WinQueryFocus,
630 ORD_WinQueryWindow,
631 ORD_WinQueryWindowPos,
632 ORD_WinQueryWindowProcess,
633 ORD_WinQueryWindowText,
634 ORD_WinQueryWindowTextLength,
635 ORD_WinSetFocus,
636 ORD_WinSetWindowPos,
637 ORD_WinSetWindowText,
638 ORD_WinShowWindow,
639 ORD_WinIsWindow,
640 ORD_WinWindowFromId,
641 ORD_WinWindowFromPoint,
642 ORD_WinPostMsg,
643 ORD_WinEnableWindow,
644 ORD_WinEnableWindowUpdate,
645 ORD_WinIsWindowEnabled,
646 ORD_WinIsWindowShowing,
647 ORD_WinIsWindowVisible,
648 ORD_WinQueryWindowPtr,
649 ORD_WinQueryWindowULong,
650 ORD_WinQueryWindowUShort,
651 ORD_WinSetWindowBits,
652 ORD_WinSetWindowPtr,
653 ORD_WinSetWindowULong,
654 ORD_WinSetWindowUShort,
655 ORD_WinQueryDesktopWindow,
656 ORD_WinSetActiveWindow,
657 ORD_DosQueryModFromEIP,
658 ORD_Dos32QueryHeaderInfo,
659 ORD_DosTmrQueryFreq,
660 ORD_DosTmrQueryTime,
661 ORD_WinQueryActiveDesktopPathname,
662 ORD_WinInvalidateRect,
663 ORD_WinCreateFrameControls,
664 ORD_WinQueryClipbrdFmtInfo,
665 ORD_WinQueryClipbrdOwner,
666 ORD_WinQueryClipbrdViewer,
667 ORD_WinQueryClipbrdData,
668 ORD_WinOpenClipbrd,
669 ORD_WinCloseClipbrd,
670 ORD_WinSetClipbrdData,
671 ORD_WinSetClipbrdOwner,
672 ORD_WinSetClipbrdViewer,
673 ORD_WinEnumClipbrdFmts,
674 ORD_WinEmptyClipbrd,
675 ORD_WinAddAtom,
676 ORD_WinFindAtom,
677 ORD_WinDeleteAtom,
678 ORD_WinQueryAtomUsage,
679 ORD_WinQueryAtomName,
680 ORD_WinQueryAtomLength,
681 ORD_WinQuerySystemAtomTable,
682 ORD_WinCreateAtomTable,
683 ORD_WinDestroyAtomTable,
684 ORD_WinOpenWindowDC,
685 ORD_DevOpenDC,
686 ORD_DevQueryCaps,
687 ORD_DevCloseDC,
688 ORD_WinMessageBox,
689 ORD_WinMessageBox2,
690 ORD_WinQuerySysValue,
691 ORD_WinSetSysValue,
692 ORD_WinAlarm,
693 ORD_WinFlashWindow,
694 ORD_WinLoadPointer,
695 ORD_WinQuerySysPointer,
696 ORD_DosReplaceModule,
697 ORD_DosPerfSysCall,
698 ORD_RexxRegisterSubcomExe,
699 ORD_NENTRIES
700};
701
702/* RET: return type, AT: argument signature in (), ARGS: should be in () */
703#define CallORD(ret,o,at,args) (((ret (*)at) loadByOrdinal(o, 1))args)
704#define DeclFuncByORD(ret,name,o,at,args) \
705 ret name at { return CallORD(ret,o,at,args); }
706#define DeclVoidFuncByORD(name,o,at,args) \
707 void name at { CallORD(void,o,at,args); }
708
709/* This function returns error code on error, and saves the error info in $^E and Perl_rc */
710#define DeclOSFuncByORD_native(ret,name,o,at,args) \
711 ret name at { unsigned long rc; return CheckOSError(CallORD(ret,o,at,args)); }
712
713/* These functions return false on error, and save the error info in $^E and Perl_rc */
714#define DeclOSFuncByORD(ret,name,o,at,args) \
715 ret name at { unsigned long rc; return !CheckOSError(CallORD(ret,o,at,args)); }
716#define DeclWinFuncByORD(ret,name,o,at,args) \
717 ret name at { return SaveWinError(CallORD(ret,o,at,args)); }
718
719#define AssignFuncPByORD(p,o) (*(Perl_PFN*)&(p) = (loadByOrdinal(o, 1)))
720
721/* This flavor caches the procedure pointer (named as p__Win#name) locally */
722#define DeclWinFuncByORD_CACHE(ret,name,o,at,args) \
723 DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,0,1)
724
725/* This flavor may reset the last error before the call (if ret=0 may be OK) */
726#define DeclWinFuncByORD_CACHE_resetError(ret,name,o,at,args) \
727 DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,1,1)
728
729/* Two flavors below do the same as above, but do not auto-croak */
730/* This flavor caches the procedure pointer (named as p__Win#name) locally */
731#define DeclWinFuncByORD_CACHE_survive(ret,name,o,at,args) \
732 DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,0,0)
733
734/* This flavor may reset the last error before the call (if ret=0 may be OK) */
735#define DeclWinFuncByORD_CACHE_resetError_survive(ret,name,o,at,args) \
736 DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,1,0)
737
738#define DeclWinFuncByORD_CACHE_r(ret,name,o,at,args,r,die) \
739 static ret (*CAT2(p__Win,name)) at; \
740 static ret name at { \
741 if (!CAT2(p__Win,name)) \
742 AssignFuncPByORD(CAT2(p__Win,name), o); \
743 if (r) ResetWinError(); \
744 return SaveCroakWinError(CAT2(p__Win,name) args, die, "[Win]", STRINGIFY(name)); }
745
746/* These flavors additionally assume ORD is name with prepended ORD_Win */
747#define DeclWinFunc_CACHE(ret,name,at,args) \
748 DeclWinFuncByORD_CACHE(ret,name,CAT2(ORD_Win,name),at,args)
749#define DeclWinFunc_CACHE_resetError(ret,name,at,args) \
750 DeclWinFuncByORD_CACHE_resetError(ret,name,CAT2(ORD_Win,name),at,args)
751#define DeclWinFunc_CACHE_survive(ret,name,at,args) \
752 DeclWinFuncByORD_CACHE_survive(ret,name,CAT2(ORD_Win,name),at,args)
753#define DeclWinFunc_CACHE_resetError_survive(ret,name,at,args) \
754 DeclWinFuncByORD_CACHE_resetError_survive(ret,name,CAT2(ORD_Win,name),at,args)
755
756void ResetWinError(void);
757void CroakWinError(int die, char *name);
758
759enum Perlos2_handler {
760 Perlos2_handler_mangle = 1,
761 Perlos2_handler_perl_sh,
762 Perlos2_handler_perllib_from,
763 Perlos2_handler_perllib_to,
764};
765enum dir_subst_e {
766 dir_subst_fatal = 1,
767 dir_subst_pathlike = 2
768};
769
770extern int Perl_OS2_handler_install(void *handler, enum Perlos2_handler how);
771extern char *dir_subst(char *s, unsigned int l, char *b, unsigned int bl, enum dir_subst_e flags, char *msg);
772extern unsigned long fill_extLibpath(int type, char *pre, char *post, int replace, char *msg);
773
774#define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
775char *perllib_mangle(char *, unsigned int);
776
777#define fork fork_with_resources
778
779#ifdef EINTR /* x2p do not include perl.h!!! */
780static __inline__ int
781my_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
782{
783 if (nfds == 0 && timeout && (_emx_env & 0x200)) {
784 if (async_mssleep(1000 * timeout->tv_sec + (timeout->tv_usec + 500)/1000, 500))
785 return 0;
786 errno = EINTR;
787 return -1;
788 }
789 return select(nfds, readfds, writefds, exceptfds, timeout);
790}
791
792#define select my_select
793#endif
794
795
796typedef int (*Perl_PFN)();
797Perl_PFN loadByOrdinal(enum entries_ordinals ord, int fail);
798extern const Perl_PFN * const pExtFCN;
799char *os2error(int rc);
800int os2_stat(const char *name, struct stat *st);
801int fork_with_resources();
802int setpriority(int which, int pid, int val);
803int getpriority(int which /* ignored */, int pid);
804
805void croak_with_os2error(char *s) __attribute__((noreturn));
806
807/* void return value */
808#define os2cp_croak(rc,msg) (CheckOSError(rc) && (croak_with_os2error(msg),0))
809
810/* propagates rc */
811#define os2win_croak(rc,msg) \
812 SaveCroakWinError((expr), 1 /* die */, /* no prefix */, (msg))
813
814/* propagates rc; use with functions which may return 0 on success */
815#define os2win_croak_0OK(rc,msg) \
816 SaveCroakWinError((ResetWinError, (expr)), \
817 1 /* die */, /* no prefix */, (msg))
818
819#ifdef PERL_CORE
820int os2_do_spawn(pTHX_ char *cmd);
821int os2_do_aspawn(pTHX_ SV *really, SV **vmark, SV **vsp);
822#endif
823
824#ifndef LOG_DAEMON
825
826/* Replacement for syslog.h */
827# define LOG_EMERG 0 /* system is unusable */
828# define LOG_ALERT 1 /* action must be taken immediately */
829# define LOG_CRIT 2 /* critical conditions */
830# define LOG_ERR 3 /* error conditions */
831# define LOG_WARNING 4 /* warning conditions */
832# define LOG_NOTICE 5 /* normal but significant condition */
833# define LOG_INFO 6 /* informational */
834# define LOG_DEBUG 7 /* debug-level messages */
835
836# define LOG_PRIMASK 0x007 /* mask to extract priority part (internal) */
837 /* extract priority */
838# define LOG_PRI(p) ((p) & LOG_PRIMASK)
839# define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
840
841/* facility codes */
842# define LOG_KERN (0<<3) /* kernel messages */
843# define LOG_USER (1<<3) /* random user-level messages */
844# define LOG_MAIL (2<<3) /* mail system */
845# define LOG_DAEMON (3<<3) /* system daemons */
846# define LOG_AUTH (4<<3) /* security/authorization messages */
847# define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
848# define LOG_LPR (6<<3) /* line printer subsystem */
849# define LOG_NEWS (7<<3) /* network news subsystem */
850# define LOG_UUCP (8<<3) /* UUCP subsystem */
851# define LOG_CRON (15<<3) /* clock daemon */
852 /* other codes through 15 reserved for system use */
853# define LOG_LOCAL0 (16<<3) /* reserved for local use */
854# define LOG_LOCAL1 (17<<3) /* reserved for local use */
855# define LOG_LOCAL2 (18<<3) /* reserved for local use */
856# define LOG_LOCAL3 (19<<3) /* reserved for local use */
857# define LOG_LOCAL4 (20<<3) /* reserved for local use */
858# define LOG_LOCAL5 (21<<3) /* reserved for local use */
859# define LOG_LOCAL6 (22<<3) /* reserved for local use */
860# define LOG_LOCAL7 (23<<3) /* reserved for local use */
861
862# define LOG_NFACILITIES 24 /* current number of facilities */
863# define LOG_FACMASK 0x03f8 /* mask to extract facility part */
864 /* facility of pri */
865# define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
866
867/*
868 * arguments to setlogmask.
869 */
870# define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
871# define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
872
873/*
874 * Option flags for openlog.
875 *
876 * LOG_ODELAY no longer does anything.
877 * LOG_NDELAY is the inverse of what it used to be.
878 */
879# define LOG_PID 0x01 /* log the pid with each message */
880# define LOG_CONS 0x02 /* log on the console if errors in sending */
881# define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
882# define LOG_NDELAY 0x08 /* don't delay open */
883# define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
884# define LOG_PERROR 0x20 /* log to stderr as well */
885
886#endif
887
888/* ************************************************* */
889#ifndef MAKEPLINFOSEG
890
891/* From $DDK\base32\rel\os2c\include\base\os2\16bit\infoseg.h + typedefs */
892
893/*
894 * The structure below defines the content and organization of the system
895 * information segment (InfoSeg). The actual table is statically defined in
896 * SDATA.ASM. Ring 0, read/write access is obtained by the clock device
897 * driver using the DevHlp GetDOSVar function. (GetDOSVar returns a ring 0,
898 * read-only selector to all other requestors.)
899 *
900 * In order to prevent an errant process from destroying the infoseg, two
901 * identical global infosegs are maintained. One is in the tiled shared
902 * arena and is accessible in user mode (and therefore can potentially be
903 * overwritten from ring 2), and the other is in the system arena and is
904 * accessible only in kernel mode. All kernel code (except the clock driver)
905 * is responsible for updating BOTH copies of the infoseg. The copy kept
906 * in the system arena is addressable as DOSGROUP:SISData, and the copy
907 * in the shared arena is addressable via a system arena alias. 16:16 and
908 * 0:32 pointers to the alias are stored in _Sis2.
909 */
910
911typedef struct InfoSegGDT {
912
913/* Time (offset 0x00) */
914
915unsigned long SIS_BigTime; /* Time from 1-1-1970 in seconds */
916unsigned long SIS_MsCount; /* Freerunning milliseconds counter */
917unsigned char SIS_HrsTime; /* Hours */
918unsigned char SIS_MinTime; /* Minutes */
919unsigned char SIS_SecTime; /* Seconds */
920unsigned char SIS_HunTime; /* Hundredths of seconds */
921unsigned short SIS_TimeZone; /* Timezone in min from GMT (Set to EST) */
922unsigned short SIS_ClkIntrvl; /* Timer interval (units=0.0001 secs) */
923
924/* Date (offset 0x10) */
925
926unsigned char SIS_DayDate; /* Day-of-month (1-31) */
927unsigned char SIS_MonDate; /* Month (1-12) */
928unsigned short SIS_YrsDate; /* Year (>= 1980) */
929unsigned char SIS_DOWDate; /* Day-of-week (1-1-80 = Tues = 3) */
930
931/* Version (offset 0x15) */
932
933unsigned char SIS_VerMajor; /* Major version number */
934unsigned char SIS_VerMinor; /* Minor version number */
935unsigned char SIS_RevLettr; /* Revision letter */
936
937/* System Status (offset 0x18) */
938
939unsigned char SIS_CurScrnGrp; /* Fgnd screen group # */
940unsigned char SIS_MaxScrnGrp; /* Maximum number of screen groups */
941unsigned char SIS_HugeShfCnt; /* Shift count for huge segments */
942unsigned char SIS_ProtMdOnly; /* Protect-mode-only indicator */
943unsigned short SIS_FgndPID; /* Foreground process ID */
944
945/* Scheduler Parms (offset 0x1E) */
946
947unsigned char SIS_Dynamic; /* Dynamic variation flag (1=enabled) */
948unsigned char SIS_MaxWait; /* Maxwait (seconds) */
949unsigned short SIS_MinSlice; /* Minimum timeslice (milliseconds) */
950unsigned short SIS_MaxSlice; /* Maximum timeslice (milliseconds) */
951
952/* Boot Drive (offset 0x24) */
953
954unsigned short SIS_BootDrv; /* Drive from which system was booted */
955
956/* RAS Major Event Code Table (offset 0x26) */
957
958unsigned char SIS_mec_table[32]; /* Table of RAS Major Event Codes (MECs) */
959
960/* Additional Session Data (offset 0x46) */
961
962unsigned char SIS_MaxVioWinSG; /* Max. no. of VIO windowable SG's */
963unsigned char SIS_MaxPresMgrSG; /* Max. no. of Presentation Manager SG's */
964
965/* Error logging Information (offset 0x48) */
966
967unsigned short SIS_SysLog; /* Error Logging Status */
968
969/* Additional RAS Information (offset 0x4A) */
970
971unsigned short SIS_MMIOBase; /* Memory mapped I/O selector */
972unsigned long SIS_MMIOAddr; /* Memory mapped I/O address */
973
974/* Additional 2.0 Data (offset 0x50) */
975
976unsigned char SIS_MaxVDMs; /* Max. no. of Virtual DOS machines */
977unsigned char SIS_Reserved;
978
979unsigned char SIS_perf_mec_table[32]; /* varga 6/5/97 Table of Perfomance Major Event Codes (MECS) varga*/
980} GINFOSEG, *PGINFOSEG;
981
982#define SIS_LEN sizeof(struct InfoSegGDT)
983
984/*
985 * InfoSeg LDT Data Segment Structure
986 *
987 * The structure below defines the content and organization of the system
988 * information in a special per-process segment to be accessible by the
989 * process through the LDT (read-only).
990 *
991 * As in the global infoseg, two copies of the current processes local
992 * infoseg exist, one accessible in both user and kernel mode, the other
993 * only in kernel mode. Kernel code is responsible for updating BOTH copies.
994 * Pointers to the local infoseg copy are stored in _Lis2.
995 *
996 * Note that only the currently running process has an extra copy of the
997 * local infoseg. The copy is done at context switch time.
998 */
999
1000typedef struct InfoSegLDT {
1001unsigned short LIS_CurProcID; /* Current process ID */
1002unsigned short LIS_ParProcID; /* Process ID of parent */
1003unsigned short LIS_CurThrdPri; /* Current thread priority */
1004unsigned short LIS_CurThrdID; /* Current thread ID */
1005unsigned short LIS_CurScrnGrp; /* Screengroup */
1006unsigned char LIS_ProcStatus; /* Process status bits */
1007unsigned char LIS_fillbyte1; /* filler byte */
1008unsigned short LIS_Fgnd; /* Current process is in foreground */
1009unsigned char LIS_ProcType; /* Current process type */
1010unsigned char LIS_fillbyte2; /* filler byte */
1011
1012unsigned short LIS_AX; /* @@V1 Environment selector */
1013unsigned short LIS_BX; /* @@V1 Offset of command line start */
1014unsigned short LIS_CX; /* @@V1 Length of Data Segment */
1015unsigned short LIS_DX; /* @@V1 STACKSIZE from the .EXE file */
1016unsigned short LIS_SI; /* @@V1 HEAPSIZE from the .EXE file */
1017unsigned short LIS_DI; /* @@V1 Module handle of the application */
1018unsigned short LIS_DS; /* @@V1 Data Segment Handle of application */
1019
1020unsigned short LIS_PackSel; /* First tiled selector in this EXE */
1021unsigned short LIS_PackShrSel; /* First selector above shared arena */
1022unsigned short LIS_PackPckSel; /* First selector above packed arena */
1023/* #ifdef SMP */
1024unsigned long LIS_pTIB; /* Pointer to TIB */
1025unsigned long LIS_pPIB; /* Pointer to PIB */
1026/* #endif */
1027} LINFOSEG, *PLINFOSEG;
1028
1029#define LIS_LEN sizeof(struct InfoSegLDT)
1030
1031
1032/*
1033 * Process Type codes
1034 *
1035 * These are the definitons for the codes stored
1036 * in the LIS_ProcType field in the local infoseg.
1037 */
1038
1039#define LIS_PT_FULLSCRN 0 /* Full screen app. */
1040#define LIS_PT_REALMODE 1 /* Real mode process */
1041#define LIS_PT_VIOWIN 2 /* VIO windowable app. */
1042#define LIS_PT_PRESMGR 3 /* Presentation Manager app. */
1043#define LIS_PT_DETACHED 4 /* Detached app. */
1044
1045
1046/*
1047 *
1048 * Process Status Bit Definitions
1049 *
1050 */
1051
1052#define LIS_PS_EXITLIST 0x01 /* In exitlist handler */
1053
1054
1055/*
1056 * Flags equates for the Global Info Segment
1057 * SIS_SysLog WORD in Global Info Segment
1058 *
1059 * xxxx xxxx xxxx xxx0 Error Logging Disabled
1060 * xxxx xxxx xxxx xxx1 Error Logging Enabled
1061 *
1062 * xxxx xxxx xxxx xx0x Error Logging not available
1063 * xxxx xxxx xxxx xx1x Error Logging available
1064 */
1065
1066#define LF_LOGENABLE 0x0001 /* Logging enabled */
1067#define LF_LOGAVAILABLE 0x0002 /* Logging available */
1068
1069#define MAKEPGINFOSEG(sel) ((PGINFOSEG)MAKEP(sel, 0))
1070#define MAKEPLINFOSEG(sel) ((PLINFOSEG)MAKEP(sel, 0))
1071
1072#endif /* ndef(MAKEPLINFOSEG) */
1073
1074/* ************************************************************ */
1075#define Dos32QuerySysState DosQuerySysState
1076#define QuerySysState(flags, pid, buf, bufsz) \
1077 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
1078
1079#define QSS_PROCESS 1
1080#define QSS_MODULE 4
1081#define QSS_SEMAPHORES 2
1082#define QSS_FILE 8 /* Buggy until fixpack18 */
1083#define QSS_SHARED 16
1084
1085#ifdef _OS2_H
1086
1087APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
1088 ULONG _res_,PVOID buf,ULONG bufsz);
1089typedef struct {
1090 ULONG threadcnt;
1091 ULONG proccnt;
1092 ULONG modulecnt;
1093} QGLOBAL, *PQGLOBAL;
1094
1095typedef struct {
1096 ULONG rectype;
1097 USHORT threadid;
1098 USHORT slotid;
1099 ULONG sleepid;
1100 ULONG priority;
1101 ULONG systime;
1102 ULONG usertime;
1103 UCHAR state;
1104 UCHAR _reserved1_; /* padding to ULONG */
1105 USHORT _reserved2_; /* padding to ULONG */
1106} QTHREAD, *PQTHREAD;
1107
1108typedef struct {
1109 USHORT sfn;
1110 USHORT refcnt;
1111 USHORT flags1;
1112 USHORT flags2;
1113 USHORT accmode1;
1114 USHORT accmode2;
1115 ULONG filesize;
1116 USHORT volhnd;
1117 USHORT attrib;
1118 USHORT _reserved_;
1119} QFDS, *PQFDS;
1120
1121typedef struct qfile {
1122 ULONG rectype;
1123 struct qfile *next;
1124 ULONG opencnt;
1125 PQFDS filedata;
1126 char name[1];
1127} QFILE, *PQFILE;
1128
1129typedef struct {
1130 ULONG rectype;
1131 PQTHREAD threads;
1132 USHORT pid;
1133 USHORT ppid;
1134 ULONG type;
1135 ULONG state;
1136 ULONG sessid;
1137 USHORT hndmod;
1138 USHORT threadcnt;
1139 ULONG privsem32cnt;
1140 ULONG _reserved2_;
1141 USHORT sem16cnt;
1142 USHORT dllcnt;
1143 USHORT shrmemcnt;
1144 USHORT fdscnt;
1145 PUSHORT sem16s;
1146 PUSHORT dlls;
1147 PUSHORT shrmems;
1148 PUSHORT fds;
1149} QPROCESS, *PQPROCESS;
1150
1151typedef struct sema {
1152 struct sema *next;
1153 USHORT refcnt;
1154 UCHAR sysflags;
1155 UCHAR sysproccnt;
1156 ULONG _reserved1_;
1157 USHORT index;
1158 CHAR name[1];
1159} QSEMA, *PQSEMA;
1160
1161typedef struct {
1162 ULONG rectype;
1163 ULONG _reserved1_;
1164 USHORT _reserved2_;
1165 USHORT syssemidx;
1166 ULONG index;
1167 QSEMA sema;
1168} QSEMSTRUC, *PQSEMSTRUC;
1169
1170typedef struct {
1171 USHORT pid;
1172 USHORT opencnt;
1173} QSEMOWNER32, *PQSEMOWNER32;
1174
1175typedef struct {
1176 PQSEMOWNER32 own;
1177 PCHAR name;
1178 PVOID semrecs; /* array of associated sema's */
1179 USHORT flags;
1180 USHORT semreccnt;
1181 USHORT waitcnt;
1182 USHORT _reserved_; /* padding to ULONG */
1183} QSEMSMUX32, *PQSEMSMUX32;
1184
1185typedef struct {
1186 PQSEMOWNER32 own;
1187 PCHAR name;
1188 PQSEMSMUX32 mux;
1189 USHORT flags;
1190 USHORT postcnt;
1191} QSEMEV32, *PQSEMEV32;
1192
1193typedef struct {
1194 PQSEMOWNER32 own;
1195 PCHAR name;
1196 PQSEMSMUX32 mux;
1197 USHORT flags;
1198 USHORT refcnt;
1199 USHORT thrdnum;
1200 USHORT _reserved_; /* padding to ULONG */
1201} QSEMMUX32, *PQSEMMUX32;
1202
1203typedef struct semstr32 {
1204 struct semstr *next;
1205 QSEMEV32 evsem;
1206 QSEMMUX32 muxsem;
1207 QSEMSMUX32 smuxsem;
1208} QSEMSTRUC32, *PQSEMSTRUC32;
1209
1210typedef struct shrmem {
1211 struct shrmem *next;
1212 USHORT hndshr;
1213 USHORT selshr;
1214 USHORT refcnt;
1215 CHAR name[1];
1216} QSHRMEM, *PQSHRMEM;
1217
1218typedef struct module {
1219 struct module *next;
1220 USHORT hndmod;
1221 USHORT type;
1222 ULONG refcnt;
1223 ULONG segcnt;
1224 PVOID _reserved_;
1225 PCHAR name;
1226 USHORT modref[1];
1227} QMODULE, *PQMODULE;
1228
1229typedef struct {
1230 PQGLOBAL gbldata;
1231 PQPROCESS procdata;
1232 PQSEMSTRUC semadata;
1233 PQSEMSTRUC32 sem32data;
1234 PQSHRMEM shrmemdata;
1235 PQMODULE moddata;
1236 PVOID _reserved2_;
1237 PQFILE filedata;
1238} QTOPLEVEL, *PQTOPLEVEL;
1239/* ************************************************************ */
1240
1241PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
1242
1243#endif /* _OS2_H */
1244
Note: See TracBrowser for help on using the repository browser.