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 /**/
56 #if defined(I_SYS_UN) && !defined(TCPIPV4)
57 /* It is not working without TCPIPV4 defined. */
63 #define PERL_SYS_INIT(argcp, argvp) STMT_START { \
64 _response(argcp, argvp); \
65 _wildcard(argcp, argvp); \
66 Perl_OS2_init(); } STMT_END
68 #define PERL_SYS_TERM()
70 /* #define PERL_SYS_TERM() STMT_START { \
71 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
73 #define dXSUB_SYS int fake = OS2_XS_init()
76 /* # define HAS_FORK */
77 /* # define HIDEMYMALLOC */
78 /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
79 #else /* !PERL_IS_AOUT */
82 # define USE_PERL_SBRK
87 # define SYSTEM_ALLOC(a) sys_alloc(a)
89 void *sys_alloc(int size);
91 #endif /* !PERL_IS_AOUT */
92 #if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */
96 #define TMPPATH tmppath
97 #define TMPPATH1 "plXXXXXX"
99 PerlIO *my_syspopen(char *cmd, char *mode);
100 /* Cannot prototype with I32 at this point. */
101 int my_syspclose(PerlIO *f);
104 * fwrite1() should be a routine with the same calling sequence as fwrite(),
105 * but which outputs all of the bytes requested as a single stream (unlike
106 * fwrite() itself, which on some systems outputs several distinct records
107 * if the number_of_items parameter is >1).
109 #define fwrite1 fwrite
111 #define my_getenv(var) getenv(var)
113 /*****************************************************************************/
115 #include <stdlib.h> /* before the following definitions */
116 #include <unistd.h> /* before the following definitions */
118 #define chdir _chdir2
119 #define getcwd _getcwd2
121 /* This guy is needed for quick stdstd */
123 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
124 # define _filbuf _fill
125 /* Perl uses ungetc only with successful return */
126 # define ungetc(c,fp) \
127 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
128 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
131 #define OP_BINARY O_BINARY
133 #define OS2_STAT_HACK 1
136 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
137 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
138 #define Fflush(fp) fflush(fp)
142 #define S_IFBLK 0120000
143 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
147 #define Stat(fname,bufptr) stat((fname),(bufptr))
148 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
149 #define Fflush(fp) fflush(fp)
153 /* Our private OS/2 specific data. */
155 typedef struct OS2_Perl_data {
160 unsigned long severity;
163 extern OS2_Perl_data_t OS2_Perl_data;
165 #define Perl_hab ((HAB)OS2_Perl_data.phab)
166 #define Perl_rc (OS2_Perl_data.rc)
167 #define Perl_severity (OS2_Perl_data.severity)
168 #define errno_isOS2 12345678
169 #define OS2_Perl_flags (OS2_Perl_data.flags)
170 #define Perl_HAB_set_f 1
171 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
172 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
173 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
174 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
175 /* The expressions below return true on error. */
176 /* INCL_DOSERRORS needed. rc should be declared outside. */
177 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
178 /* INCL_WINERRORS needed. */
179 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
180 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
181 #define FillOSError(rc) (Perl_rc = rc, \
182 errno = errno_isOS2, \
183 Perl_severity = SEVERITY_ERROR)
184 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
185 errno = errno_isOS2, \
186 Perl_severity = ERRORIDSEV(Perl_rc), \
187 Perl_rc = ERRORIDERROR(Perl_rc))
188 #define Acquire_hab() if (!Perl_HAB_set) { \
189 Perl_hab = WinInitialize(0); \
190 if (!Perl_hab) die("WinInitialize failed"); \
194 #define STATIC_FILE_LENGTH 127
195 extern char sh_path[STATIC_FILE_LENGTH+1];
197 #define SH_PATH sh_path
198 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
199 char *perllib_mangle(char *, unsigned int);
201 char *os2error(int rc);
203 /* ************************************************************ */
204 #define Dos32QuerySysState DosQuerySysState
205 #define QuerySysState(flags, pid, buf, bufsz) \
206 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
208 #define QSS_PROCESS 1
210 #define QSS_SEMAPHORES 4
211 #define QSS_FILE 8 /* Buggy until fixpack18 */
212 #define QSS_SHARED 16
216 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
217 ULONG _res_,PVOID buf,ULONG bufsz);
222 } QGLOBAL, *PQGLOBAL;
233 UCHAR _reserved1_; /* padding to ULONG */
234 USHORT _reserved2_; /* padding to ULONG */
235 } QTHREAD, *PQTHREAD;
250 typedef struct qfile {
278 } QPROCESS, *PQPROCESS;
280 typedef struct sema {
297 } QSEMSTRUC, *PQSEMSTRUC;
302 } QSEMOWNER32, *PQSEMOWNER32;
307 PVOID semrecs; /* array of associated sema's */
311 USHORT _reserved_; /* padding to ULONG */
312 } QSEMSMUX32, *PQSEMSMUX32;
320 } QSEMEV32, *PQSEMEV32;
329 USHORT _reserved_; /* padding to ULONG */
330 } QSEMMUX32, *PQSEMMUX32;
332 typedef struct semstr32 {
337 } QSEMSTRUC32, *PQSEMSTRUC32;
339 typedef struct shrmem {
345 } QSHRMEM, *PQSHRMEM;
347 typedef struct module {
356 } QMODULE, *PQMODULE;
362 PQSEMSTRUC32 sem32data;
367 } QTOPLEVEL, *PQTOPLEVEL;
368 /* ************************************************************ */
370 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
372 #endif /* _OS2EMX_H */