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 * This symbol, if defined, contains a "magic" string which may be used
42 * as the first line of a Perl program designed to be executed directly
43 * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG
44 * begins with a character other then #, then Perl will only treat
45 * it as a command line if if finds the string "perl" in the first
46 * word; otherwise it's treated as the first line of code in the script.
47 * (IOW, Perl won't hand off to another interpreter via an alternate
48 * shebang sequence that might be legal Perl code.)
50 #define ALTERNATE_SHEBANG "extproc "
53 # define SIGABRT SIGILL
56 # define SIGILL 6 /* blech */
58 #define ABORT() kill(getpid(),SIGABRT);
60 #define BIT_BUCKET "/dev/nul" /* Will this work? */
62 #if defined(I_SYS_UN) && !defined(TCPIPV4)
63 /* It is not working without TCPIPV4 defined. */
67 void Perl_OS2_init(char **);
69 /* XXX This code hideously puts env inside: */
71 #define PERL_SYS_INIT(argcp, argvp) STMT_START { \
72 _response(argcp, argvp); \
73 _wildcard(argcp, argvp); \
74 Perl_OS2_init(env); } STMT_END
76 #define PERL_SYS_TERM()
78 /* #define PERL_SYS_TERM() STMT_START { \
79 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
81 #define dXSUB_SYS OS2_XS_init()
84 /* # define HAS_FORK */
85 /* # define HIDEMYMALLOC */
86 /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
87 #else /* !PERL_IS_AOUT */
90 # define USE_PERL_SBRK
95 # define SYSTEM_ALLOC(a) sys_alloc(a)
97 void *sys_alloc(int size);
99 #endif /* !PERL_IS_AOUT */
100 #if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */
104 #define TMPPATH tmppath
105 #define TMPPATH1 "plXXXXXX"
106 extern char *tmppath;
107 PerlIO *my_syspopen(char *cmd, char *mode);
108 /* Cannot prototype with I32 at this point. */
109 int my_syspclose(PerlIO *f);
110 FILE *my_tmpfile (void);
111 char *my_tmpnam (char *);
113 #define tmpfile my_tmpfile
114 #define tmpnam my_tmpnam
115 #define isatty _isterm
117 #define srand srandom
120 * fwrite1() should be a routine with the same calling sequence as fwrite(),
121 * but which outputs all of the bytes requested as a single stream (unlike
122 * fwrite() itself, which on some systems outputs several distinct records
123 * if the number_of_items parameter is >1).
125 #define fwrite1 fwrite
127 #define my_getenv(var) getenv(var)
129 void *emx_calloc (size_t, size_t);
130 void emx_free (void *);
131 void *emx_malloc (size_t);
132 void *emx_realloc (void *, size_t);
134 /*****************************************************************************/
136 #include <stdlib.h> /* before the following definitions */
137 #include <unistd.h> /* before the following definitions */
139 #define chdir _chdir2
140 #define getcwd _getcwd2
142 /* This guy is needed for quick stdstd */
144 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
145 /* Perl uses ungetc only with successful return */
146 # define ungetc(c,fp) \
147 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
148 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
151 #define OP_BINARY O_BINARY
153 #define OS2_STAT_HACK 1
156 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
157 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
158 #define Fflush(fp) fflush(fp)
159 #define Mkdir(path,mode) mkdir((path),(mode))
163 #define S_IFBLK 0120000
164 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
168 #define Stat(fname,bufptr) stat((fname),(bufptr))
169 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
170 #define Fflush(fp) fflush(fp)
171 #define Mkdir(path,mode) mkdir((path),(mode))
175 /* With SD386 it is impossible to debug register variables. */
176 #if !defined(PERL_IS_AOUT) && defined(DEBUGGING) && !defined(register)
180 /* Our private OS/2 specific data. */
182 typedef struct OS2_Perl_data {
187 unsigned long severity;
190 extern OS2_Perl_data_t OS2_Perl_data;
192 #define Perl_hab ((HAB)OS2_Perl_data.phab)
193 #define Perl_rc (OS2_Perl_data.rc)
194 #define Perl_severity (OS2_Perl_data.severity)
195 #define errno_isOS2 12345678
196 #define OS2_Perl_flags (OS2_Perl_data.flags)
197 #define Perl_HAB_set_f 1
198 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
199 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
200 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
201 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
202 /* The expressions below return true on error. */
203 /* INCL_DOSERRORS needed. rc should be declared outside. */
204 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
205 /* INCL_WINERRORS needed. */
206 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
207 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
208 #define FillOSError(rc) (Perl_rc = rc, \
209 errno = errno_isOS2, \
210 Perl_severity = SEVERITY_ERROR)
211 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
212 errno = errno_isOS2, \
213 Perl_severity = ERRORIDSEV(Perl_rc), \
214 Perl_rc = ERRORIDERROR(Perl_rc))
215 #define Acquire_hab() if (!Perl_HAB_set) { \
216 Perl_hab = WinInitialize(0); \
217 if (!Perl_hab) die("WinInitialize failed"); \
221 #define STATIC_FILE_LENGTH 127
223 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
224 char *perllib_mangle(char *, unsigned int);
226 char *os2error(int rc);
228 /* ************************************************************ */
229 #define Dos32QuerySysState DosQuerySysState
230 #define QuerySysState(flags, pid, buf, bufsz) \
231 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
233 #define QSS_PROCESS 1
235 #define QSS_SEMAPHORES 2
236 #define QSS_FILE 8 /* Buggy until fixpack18 */
237 #define QSS_SHARED 16
241 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
242 ULONG _res_,PVOID buf,ULONG bufsz);
247 } QGLOBAL, *PQGLOBAL;
258 UCHAR _reserved1_; /* padding to ULONG */
259 USHORT _reserved2_; /* padding to ULONG */
260 } QTHREAD, *PQTHREAD;
275 typedef struct qfile {
303 } QPROCESS, *PQPROCESS;
305 typedef struct sema {
322 } QSEMSTRUC, *PQSEMSTRUC;
327 } QSEMOWNER32, *PQSEMOWNER32;
332 PVOID semrecs; /* array of associated sema's */
336 USHORT _reserved_; /* padding to ULONG */
337 } QSEMSMUX32, *PQSEMSMUX32;
345 } QSEMEV32, *PQSEMEV32;
354 USHORT _reserved_; /* padding to ULONG */
355 } QSEMMUX32, *PQSEMMUX32;
357 typedef struct semstr32 {
362 } QSEMSTRUC32, *PQSEMSTRUC32;
364 typedef struct shrmem {
370 } QSHRMEM, *PQSHRMEM;
372 typedef struct module {
381 } QMODULE, *PQMODULE;
387 PQSEMSTRUC32 sem32data;
392 } QTOPLEVEL, *PQTOPLEVEL;
393 /* ************************************************************ */
395 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
397 #endif /* _OS2EMX_H */