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 /**/
18 #define HAS_WAITPID_RUNTIME (_emx_env & 0x200)
21 * This symbol, if defined, indicates that the program should
22 * use the routine my_binmode(FILE *fp, char iotype) to insure
23 * that a file is in "binary" mode -- that is, that no translation
24 * of bytes occurs on read or write operations.
29 * This symbol is defined if this system has a stat structure declaring
32 #define USE_STAT_RDEV /**/
35 * This symbol, if defined, indicates that error messages should be
36 * should be generated in a format that allows the use of the Acme
37 * GUI/editor's autofind feature.
42 * This symbol, if defined, contains a "magic" string which may be used
43 * as the first line of a Perl program designed to be executed directly
44 * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG
45 * begins with a character other then #, then Perl will only treat
46 * it as a command line if if finds the string "perl" in the first
47 * word; otherwise it's treated as the first line of code in the script.
48 * (IOW, Perl won't hand off to another interpreter via an alternate
49 * shebang sequence that might be legal Perl code.)
51 #define ALTERNATE_SHEBANG "extproc "
54 # define SIGABRT SIGILL
57 # define SIGILL 6 /* blech */
59 #define ABORT() kill(getpid(),SIGABRT);
61 #define BIT_BUCKET "/dev/nul" /* Will this work? */
63 #if defined(I_SYS_UN) && !defined(TCPIPV4)
64 /* It is not working without TCPIPV4 defined. */
68 void Perl_OS2_init(char **);
70 /* XXX This code hideously puts env inside: */
72 #define PERL_SYS_INIT(argcp, argvp) STMT_START { \
73 _response(argcp, argvp); \
74 _wildcard(argcp, argvp); \
75 Perl_OS2_init(env); } STMT_END
77 #define PERL_SYS_TERM()
79 /* #define PERL_SYS_TERM() STMT_START { \
80 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
82 #define dXSUB_SYS OS2_XS_init()
85 /* # define HAS_FORK */
86 /* # define HIDEMYMALLOC */
87 /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
88 #else /* !PERL_IS_AOUT */
91 # define USE_PERL_SBRK
96 # define SYSTEM_ALLOC(a) sys_alloc(a)
98 void *sys_alloc(int size);
100 #endif /* !PERL_IS_AOUT */
101 #if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */
105 #define TMPPATH tmppath
106 #define TMPPATH1 "plXXXXXX"
107 extern char *tmppath;
108 PerlIO *my_syspopen(char *cmd, char *mode);
109 /* Cannot prototype with I32 at this point. */
110 int my_syspclose(PerlIO *f);
111 FILE *my_tmpfile (void);
112 char *my_tmpnam (char *);
114 #define tmpfile my_tmpfile
115 #define tmpnam my_tmpnam
116 #define isatty _isterm
118 #define srand srandom
121 * fwrite1() should be a routine with the same calling sequence as fwrite(),
122 * but which outputs all of the bytes requested as a single stream (unlike
123 * fwrite() itself, which on some systems outputs several distinct records
124 * if the number_of_items parameter is >1).
126 #define fwrite1 fwrite
128 #define my_getenv(var) getenv(var)
129 #define flock my_flock
131 void *emx_calloc (size_t, size_t);
132 void emx_free (void *);
133 void *emx_malloc (size_t);
134 void *emx_realloc (void *, size_t);
136 /*****************************************************************************/
138 #include <stdlib.h> /* before the following definitions */
139 #include <unistd.h> /* before the following definitions */
141 #define chdir _chdir2
142 #define getcwd _getcwd2
144 /* This guy is needed for quick stdstd */
146 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
147 /* Perl uses ungetc only with successful return */
148 # define ungetc(c,fp) \
149 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
150 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
153 #define OP_BINARY O_BINARY
155 #define OS2_STAT_HACK 1
158 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
159 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
160 #define Fflush(fp) fflush(fp)
161 #define Mkdir(path,mode) mkdir((path),(mode))
165 #define S_IFBLK 0120000
166 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
170 #define Stat(fname,bufptr) stat((fname),(bufptr))
171 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
172 #define Fflush(fp) fflush(fp)
173 #define Mkdir(path,mode) mkdir((path),(mode))
177 /* With SD386 it is impossible to debug register variables. */
178 #if !defined(PERL_IS_AOUT) && defined(DEBUGGING) && !defined(register)
182 /* Our private OS/2 specific data. */
184 typedef struct OS2_Perl_data {
189 unsigned long severity;
192 extern OS2_Perl_data_t OS2_Perl_data;
194 #define Perl_hab ((HAB)OS2_Perl_data.phab)
195 #define Perl_rc (OS2_Perl_data.rc)
196 #define Perl_severity (OS2_Perl_data.severity)
197 #define errno_isOS2 12345678
198 #define OS2_Perl_flags (OS2_Perl_data.flags)
199 #define Perl_HAB_set_f 1
200 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
201 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
202 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
203 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
204 /* The expressions below return true on error. */
205 /* INCL_DOSERRORS needed. rc should be declared outside. */
206 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
207 /* INCL_WINERRORS needed. */
208 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
209 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
210 #define FillOSError(rc) (Perl_rc = rc, \
211 errno = errno_isOS2, \
212 Perl_severity = SEVERITY_ERROR)
213 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
214 errno = errno_isOS2, \
215 Perl_severity = ERRORIDSEV(Perl_rc), \
216 Perl_rc = ERRORIDERROR(Perl_rc))
217 #define Acquire_hab() if (!Perl_HAB_set) { \
218 Perl_hab = WinInitialize(0); \
219 if (!Perl_hab) die("WinInitialize failed"); \
223 #define STATIC_FILE_LENGTH 127
225 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
226 char *perllib_mangle(char *, unsigned int);
228 char *os2error(int rc);
230 /* ************************************************************ */
231 #define Dos32QuerySysState DosQuerySysState
232 #define QuerySysState(flags, pid, buf, bufsz) \
233 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
235 #define QSS_PROCESS 1
237 #define QSS_SEMAPHORES 2
238 #define QSS_FILE 8 /* Buggy until fixpack18 */
239 #define QSS_SHARED 16
243 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
244 ULONG _res_,PVOID buf,ULONG bufsz);
249 } QGLOBAL, *PQGLOBAL;
260 UCHAR _reserved1_; /* padding to ULONG */
261 USHORT _reserved2_; /* padding to ULONG */
262 } QTHREAD, *PQTHREAD;
277 typedef struct qfile {
305 } QPROCESS, *PQPROCESS;
307 typedef struct sema {
324 } QSEMSTRUC, *PQSEMSTRUC;
329 } QSEMOWNER32, *PQSEMOWNER32;
334 PVOID semrecs; /* array of associated sema's */
338 USHORT _reserved_; /* padding to ULONG */
339 } QSEMSMUX32, *PQSEMSMUX32;
347 } QSEMEV32, *PQSEMEV32;
356 USHORT _reserved_; /* padding to ULONG */
357 } QSEMMUX32, *PQSEMMUX32;
359 typedef struct semstr32 {
364 } QSEMSTRUC32, *PQSEMSTRUC32;
366 typedef struct shrmem {
372 } QSHRMEM, *PQSHRMEM;
374 typedef struct module {
383 } QMODULE, *PQMODULE;
389 PQSEMSTRUC32 sem32data;
394 } QTOPLEVEL, *PQTOPLEVEL;
395 /* ************************************************************ */
397 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
399 #endif /* _OS2EMX_H */