4 * This symbol, if defined, indicates that the ioctl() routine is
5 * available to set I/O characteristics
10 * This symbol, if defined, indicates that the routine utime() is
11 * available to update the access and modification times of files.
13 #define HAS_UTIME /**/
20 * This symbol, if defined, indicates that the program should
21 * use the routine my_binmode(FILE *fp, char iotype) to insure
22 * that a file is in "binary" mode -- that is, that no translation
23 * of bytes occurs on read or write operations.
28 * This symbol is defined if this system has a stat structure declaring
31 #define USE_STAT_RDEV /**/
34 * This symbol, if defined, indicates that error messages should be
35 * should be generated in a format that allows the use of the Acme
36 * GUI/editor's autofind feature.
41 # define SIGABRT SIGILL
44 # define SIGILL 6 /* blech */
46 #define ABORT() kill(getpid(),SIGABRT);
48 #define BIT_BUCKET "/dev/null" /* Will this work? */
52 #define PERL_SYS_INIT(argcp, argvp) STMT_START { \
53 _response(argcp, argvp); \
54 _wildcard(argcp, argvp); \
55 Perl_OS2_init(); } STMT_END
57 #define PERL_SYS_TERM()
59 /* #define PERL_SYS_TERM() STMT_START { \
60 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
62 #define dXSUB_SYS int fake = OS2_XS_init()
68 #define TMPPATH tmppath
69 #define TMPPATH1 "plXXXXXX"
73 * fwrite1() should be a routine with the same calling sequence as fwrite(),
74 * but which outputs all of the bytes requested as a single stream (unlike
75 * fwrite() itself, which on some systems outputs several distinct records
76 * if the number_of_items parameter is >1).
78 #define fwrite1 fwrite
80 #define my_getenv(var) getenv(var)
82 /*****************************************************************************/
84 #include <stdlib.h> /* before the following definitions */
85 #include <unistd.h> /* before the following definitions */
88 #define getcwd _getcwd2
90 /* This guy is needed for quick stdstd */
92 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
93 # define _filbuf _fill
94 /* Perl uses ungetc only with successful return */
95 # define ungetc(c,fp) \
96 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
97 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
100 #define OP_BINARY O_BINARY
102 #define OS2_STAT_HACK 1
105 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
106 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
107 #define Fflush(fp) fflush(fp)
111 #define S_IFBLK 0120000
112 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
116 #define Stat(fname,bufptr) stat((fname),(bufptr))
117 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
118 #define Fflush(fp) fflush(fp)
122 /* Our private OS/2 specific data. */
124 typedef struct OS2_Perl_data {
129 unsigned long severity;
132 extern OS2_Perl_data_t OS2_Perl_data;
134 #define Perl_hab ((HAB)OS2_Perl_data.phab)
135 #define Perl_rc (OS2_Perl_data.rc)
136 #define Perl_severity (OS2_Perl_data.severity)
137 #define errno_isOS2 12345678
138 #define OS2_Perl_flags (OS2_Perl_data.flags)
139 #define Perl_HAB_set_f 1
140 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
141 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
142 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
143 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
144 /* The expressions below return true on error. */
145 /* INCL_DOSERRORS needed. */
146 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
147 /* INCL_WINERRORS needed. */
148 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
149 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
150 #define FillOSError(rc) (Perl_rc = rc, \
151 errno = errno_isOS2, \
152 Perl_severity = SEVERITY_ERROR)
153 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
154 errno = errno_isOS2, \
155 Perl_severity = ERRORIDSEV(Perl_rc), \
156 Perl_rc = ERRORIDERROR(Perl_rc))
157 #define Acquire_hab() if (!Perl_HAB_set) { \
158 Perl_hab = WinInitialize(0); \
159 if (!Perl_hab) die("WinInitialize failed"); \
163 extern char sh_path[33];
164 #define SH_PATH sh_path
166 char *os2error(int rc);
168 /* ************************************************************ */
169 #define Dos32QuerySysState DosQuerySysState
170 #define QuerySysState(flags, pid, buf, bufsz) \
171 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
173 #define QSS_PROCESS 1
175 #define QSS_SEMAPHORES 4
176 #define QSS_FILE 8 /* Buggy until fixpack18 */
177 #define QSS_SHARED 16
181 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
182 ULONG _res_,PVOID buf,ULONG bufsz);
187 } QGLOBAL, *PQGLOBAL;
198 UCHAR _reserved1_; /* padding to ULONG */
199 USHORT _reserved2_; /* padding to ULONG */
200 } QTHREAD, *PQTHREAD;
215 typedef struct qfile {
243 } QPROCESS, *PQPROCESS;
245 typedef struct sema {
262 } QSEMSTRUC, *PQSEMSTRUC;
267 } QSEMOWNER32, *PQSEMOWNER32;
272 PVOID semrecs; /* array of associated sema's */
276 USHORT _reserved_; /* padding to ULONG */
277 } QSEMSMUX32, *PQSEMSMUX32;
285 } QSEMEV32, *PQSEMEV32;
294 USHORT _reserved_; /* padding to ULONG */
295 } QSEMMUX32, *PQSEMMUX32;
297 typedef struct semstr32 {
302 } QSEMSTRUC32, *PQSEMSTRUC32;
304 typedef struct shrmem {
310 } QSHRMEM, *PQSHRMEM;
312 typedef struct module {
321 } QMODULE, *PQMODULE;
327 PQSEMSTRUC32 sem32data;
332 } QTOPLEVEL, *PQTOPLEVEL;
333 /* ************************************************************ */
335 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
337 #endif /* _OS2EMX_H */