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? */
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()
66 /* # define HIDEMYMALLOC */
67 /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
68 #else /* !PERL_IS_AOUT */
70 # define USE_PERL_SBRK
72 # define SYSTEM_ALLOC(a) sys_alloc(a)
74 void *sys_alloc(int size);
76 #endif /* !PERL_IS_AOUT */
78 #define TMPPATH tmppath
79 #define TMPPATH1 "plXXXXXX"
83 * fwrite1() should be a routine with the same calling sequence as fwrite(),
84 * but which outputs all of the bytes requested as a single stream (unlike
85 * fwrite() itself, which on some systems outputs several distinct records
86 * if the number_of_items parameter is >1).
88 #define fwrite1 fwrite
90 #define my_getenv(var) getenv(var)
92 /*****************************************************************************/
94 #include <stdlib.h> /* before the following definitions */
95 #include <unistd.h> /* before the following definitions */
98 #define getcwd _getcwd2
100 /* This guy is needed for quick stdstd */
102 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
103 # define _filbuf _fill
104 /* Perl uses ungetc only with successful return */
105 # define ungetc(c,fp) \
106 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
107 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
110 #define OP_BINARY O_BINARY
112 #define OS2_STAT_HACK 1
115 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
116 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
117 #define Fflush(fp) fflush(fp)
121 #define S_IFBLK 0120000
122 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
126 #define Stat(fname,bufptr) stat((fname),(bufptr))
127 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
128 #define Fflush(fp) fflush(fp)
132 /* Our private OS/2 specific data. */
134 typedef struct OS2_Perl_data {
139 unsigned long severity;
142 extern OS2_Perl_data_t OS2_Perl_data;
144 #define Perl_hab ((HAB)OS2_Perl_data.phab)
145 #define Perl_rc (OS2_Perl_data.rc)
146 #define Perl_severity (OS2_Perl_data.severity)
147 #define errno_isOS2 12345678
148 #define OS2_Perl_flags (OS2_Perl_data.flags)
149 #define Perl_HAB_set_f 1
150 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
151 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
152 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
153 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
154 /* The expressions below return true on error. */
155 /* INCL_DOSERRORS needed. */
156 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
157 /* INCL_WINERRORS needed. */
158 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
159 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
160 #define FillOSError(rc) (Perl_rc = rc, \
161 errno = errno_isOS2, \
162 Perl_severity = SEVERITY_ERROR)
163 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
164 errno = errno_isOS2, \
165 Perl_severity = ERRORIDSEV(Perl_rc), \
166 Perl_rc = ERRORIDERROR(Perl_rc))
167 #define Acquire_hab() if (!Perl_HAB_set) { \
168 Perl_hab = WinInitialize(0); \
169 if (!Perl_hab) die("WinInitialize failed"); \
173 #define STATIC_FILE_LENGTH 127
174 extern char sh_path[STATIC_FILE_LENGTH+1];
175 #define SH_PATH sh_path
176 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
177 char *perllib_mangle(char *, unsigned int);
179 char *os2error(int rc);
181 /* ************************************************************ */
182 #define Dos32QuerySysState DosQuerySysState
183 #define QuerySysState(flags, pid, buf, bufsz) \
184 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
186 #define QSS_PROCESS 1
188 #define QSS_SEMAPHORES 4
189 #define QSS_FILE 8 /* Buggy until fixpack18 */
190 #define QSS_SHARED 16
194 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
195 ULONG _res_,PVOID buf,ULONG bufsz);
200 } QGLOBAL, *PQGLOBAL;
211 UCHAR _reserved1_; /* padding to ULONG */
212 USHORT _reserved2_; /* padding to ULONG */
213 } QTHREAD, *PQTHREAD;
228 typedef struct qfile {
256 } QPROCESS, *PQPROCESS;
258 typedef struct sema {
275 } QSEMSTRUC, *PQSEMSTRUC;
280 } QSEMOWNER32, *PQSEMOWNER32;
285 PVOID semrecs; /* array of associated sema's */
289 USHORT _reserved_; /* padding to ULONG */
290 } QSEMSMUX32, *PQSEMSMUX32;
298 } QSEMEV32, *PQSEMEV32;
307 USHORT _reserved_; /* padding to ULONG */
308 } QSEMMUX32, *PQSEMMUX32;
310 typedef struct semstr32 {
315 } QSEMSTRUC32, *PQSEMSTRUC32;
317 typedef struct shrmem {
323 } QSHRMEM, *PQSHRMEM;
325 typedef struct module {
334 } QMODULE, *PQMODULE;
340 PQSEMSTRUC32 sem32data;
345 } QTOPLEVEL, *PQTOPLEVEL;
346 /* ************************************************************ */
348 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
350 #endif /* _OS2EMX_H */