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/nul" /* Will this work? */
51 * Duplicate for SH_PATH. This symbol allows redefinition of SH_PATH,
52 * which may be needed to make a binary distribution.
54 #define SH_PATH_INI SH_PATH /**/
58 #define PERL_SYS_INIT(argcp, argvp) STMT_START { \
59 _response(argcp, argvp); \
60 _wildcard(argcp, argvp); \
61 Perl_OS2_init(); } STMT_END
63 #define PERL_SYS_TERM()
65 /* #define PERL_SYS_TERM() STMT_START { \
66 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
68 #define dXSUB_SYS int fake = OS2_XS_init()
72 /* # define HIDEMYMALLOC */
73 /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
74 #else /* !PERL_IS_AOUT */
76 # define USE_PERL_SBRK
78 # define SYSTEM_ALLOC(a) sys_alloc(a)
80 void *sys_alloc(int size);
82 #endif /* !PERL_IS_AOUT */
84 #define TMPPATH tmppath
85 #define TMPPATH1 "plXXXXXX"
89 * fwrite1() should be a routine with the same calling sequence as fwrite(),
90 * but which outputs all of the bytes requested as a single stream (unlike
91 * fwrite() itself, which on some systems outputs several distinct records
92 * if the number_of_items parameter is >1).
94 #define fwrite1 fwrite
96 #define my_getenv(var) getenv(var)
98 /*****************************************************************************/
100 #include <stdlib.h> /* before the following definitions */
101 #include <unistd.h> /* before the following definitions */
103 #define chdir _chdir2
104 #define getcwd _getcwd2
106 /* This guy is needed for quick stdstd */
108 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
109 # define _filbuf _fill
110 /* Perl uses ungetc only with successful return */
111 # define ungetc(c,fp) \
112 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
113 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
116 #define OP_BINARY O_BINARY
118 #define OS2_STAT_HACK 1
121 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
122 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
123 #define Fflush(fp) fflush(fp)
127 #define S_IFBLK 0120000
128 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
132 #define Stat(fname,bufptr) stat((fname),(bufptr))
133 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
134 #define Fflush(fp) fflush(fp)
138 /* Our private OS/2 specific data. */
140 typedef struct OS2_Perl_data {
145 unsigned long severity;
148 extern OS2_Perl_data_t OS2_Perl_data;
150 #define Perl_hab ((HAB)OS2_Perl_data.phab)
151 #define Perl_rc (OS2_Perl_data.rc)
152 #define Perl_severity (OS2_Perl_data.severity)
153 #define errno_isOS2 12345678
154 #define OS2_Perl_flags (OS2_Perl_data.flags)
155 #define Perl_HAB_set_f 1
156 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
157 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
158 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
159 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
160 /* The expressions below return true on error. */
161 /* INCL_DOSERRORS needed. */
162 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
163 /* INCL_WINERRORS needed. */
164 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
165 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
166 #define FillOSError(rc) (Perl_rc = rc, \
167 errno = errno_isOS2, \
168 Perl_severity = SEVERITY_ERROR)
169 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
170 errno = errno_isOS2, \
171 Perl_severity = ERRORIDSEV(Perl_rc), \
172 Perl_rc = ERRORIDERROR(Perl_rc))
173 #define Acquire_hab() if (!Perl_HAB_set) { \
174 Perl_hab = WinInitialize(0); \
175 if (!Perl_hab) die("WinInitialize failed"); \
179 #define STATIC_FILE_LENGTH 127
180 extern char sh_path[STATIC_FILE_LENGTH+1];
182 #define SH_PATH sh_path
183 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
184 char *perllib_mangle(char *, unsigned int);
186 char *os2error(int rc);
188 /* ************************************************************ */
189 #define Dos32QuerySysState DosQuerySysState
190 #define QuerySysState(flags, pid, buf, bufsz) \
191 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
193 #define QSS_PROCESS 1
195 #define QSS_SEMAPHORES 4
196 #define QSS_FILE 8 /* Buggy until fixpack18 */
197 #define QSS_SHARED 16
201 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
202 ULONG _res_,PVOID buf,ULONG bufsz);
207 } QGLOBAL, *PQGLOBAL;
218 UCHAR _reserved1_; /* padding to ULONG */
219 USHORT _reserved2_; /* padding to ULONG */
220 } QTHREAD, *PQTHREAD;
235 typedef struct qfile {
263 } QPROCESS, *PQPROCESS;
265 typedef struct sema {
282 } QSEMSTRUC, *PQSEMSTRUC;
287 } QSEMOWNER32, *PQSEMOWNER32;
292 PVOID semrecs; /* array of associated sema's */
296 USHORT _reserved_; /* padding to ULONG */
297 } QSEMSMUX32, *PQSEMSMUX32;
305 } QSEMEV32, *PQSEMEV32;
314 USHORT _reserved_; /* padding to ULONG */
315 } QSEMMUX32, *PQSEMMUX32;
317 typedef struct semstr32 {
322 } QSEMSTRUC32, *PQSEMSTRUC32;
324 typedef struct shrmem {
330 } QSHRMEM, *PQSHRMEM;
332 typedef struct module {
341 } QMODULE, *PQMODULE;
347 PQSEMSTRUC32 sem32data;
352 } QTOPLEVEL, *PQTOPLEVEL;
353 /* ************************************************************ */
355 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
357 #endif /* _OS2EMX_H */