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? */
50 #if defined(I_SYS_UN) && !defined(TCPIPV4)
51 /* It is not working without TCPIPV4 defined. */
57 #define PERL_SYS_INIT(argcp, argvp) STMT_START { \
58 _response(argcp, argvp); \
59 _wildcard(argcp, argvp); \
60 Perl_OS2_init(); } STMT_END
62 #define PERL_SYS_TERM()
64 /* #define PERL_SYS_TERM() STMT_START { \
65 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
67 #define dXSUB_SYS int fake = OS2_XS_init()
70 /* # define HAS_FORK */
71 /* # define HIDEMYMALLOC */
72 /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
73 #else /* !PERL_IS_AOUT */
76 # define USE_PERL_SBRK
81 # define SYSTEM_ALLOC(a) sys_alloc(a)
83 void *sys_alloc(int size);
85 #endif /* !PERL_IS_AOUT */
86 #if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */
90 #define TMPPATH tmppath
91 #define TMPPATH1 "plXXXXXX"
93 PerlIO *my_syspopen(char *cmd, char *mode);
94 /* Cannot prototype with I32 at this point. */
95 int my_syspclose(PerlIO *f);
96 FILE *my_tmpfile (void);
97 char *my_tmpnam (char *);
99 #define tmpfile my_tmpfile
100 #define tmpnam my_tmpnam
103 * fwrite1() should be a routine with the same calling sequence as fwrite(),
104 * but which outputs all of the bytes requested as a single stream (unlike
105 * fwrite() itself, which on some systems outputs several distinct records
106 * if the number_of_items parameter is >1).
108 #define fwrite1 fwrite
110 #define my_getenv(var) getenv(var)
112 /*****************************************************************************/
114 #include <stdlib.h> /* before the following definitions */
115 #include <unistd.h> /* before the following definitions */
117 #define chdir _chdir2
118 #define getcwd _getcwd2
120 /* This guy is needed for quick stdstd */
122 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
123 # define _filbuf _fill
124 /* Perl uses ungetc only with successful return */
125 # define ungetc(c,fp) \
126 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
127 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
130 #define OP_BINARY O_BINARY
132 #define OS2_STAT_HACK 1
135 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
136 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
137 #define Fflush(fp) fflush(fp)
141 #define S_IFBLK 0120000
142 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
146 #define Stat(fname,bufptr) stat((fname),(bufptr))
147 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
148 #define Fflush(fp) fflush(fp)
152 /* Our private OS/2 specific data. */
154 typedef struct OS2_Perl_data {
159 unsigned long severity;
162 extern OS2_Perl_data_t OS2_Perl_data;
164 #define Perl_hab ((HAB)OS2_Perl_data.phab)
165 #define Perl_rc (OS2_Perl_data.rc)
166 #define Perl_severity (OS2_Perl_data.severity)
167 #define errno_isOS2 12345678
168 #define OS2_Perl_flags (OS2_Perl_data.flags)
169 #define Perl_HAB_set_f 1
170 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
171 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
172 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
173 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
174 /* The expressions below return true on error. */
175 /* INCL_DOSERRORS needed. rc should be declared outside. */
176 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
177 /* INCL_WINERRORS needed. */
178 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
179 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
180 #define FillOSError(rc) (Perl_rc = rc, \
181 errno = errno_isOS2, \
182 Perl_severity = SEVERITY_ERROR)
183 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
184 errno = errno_isOS2, \
185 Perl_severity = ERRORIDSEV(Perl_rc), \
186 Perl_rc = ERRORIDERROR(Perl_rc))
187 #define Acquire_hab() if (!Perl_HAB_set) { \
188 Perl_hab = WinInitialize(0); \
189 if (!Perl_hab) die("WinInitialize failed"); \
193 #define STATIC_FILE_LENGTH 127
195 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
196 char *perllib_mangle(char *, unsigned int);
198 char *os2error(int rc);
200 /* ************************************************************ */
201 #define Dos32QuerySysState DosQuerySysState
202 #define QuerySysState(flags, pid, buf, bufsz) \
203 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
205 #define QSS_PROCESS 1
207 #define QSS_SEMAPHORES 4
208 #define QSS_FILE 8 /* Buggy until fixpack18 */
209 #define QSS_SHARED 16
213 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
214 ULONG _res_,PVOID buf,ULONG bufsz);
219 } QGLOBAL, *PQGLOBAL;
230 UCHAR _reserved1_; /* padding to ULONG */
231 USHORT _reserved2_; /* padding to ULONG */
232 } QTHREAD, *PQTHREAD;
247 typedef struct qfile {
275 } QPROCESS, *PQPROCESS;
277 typedef struct sema {
294 } QSEMSTRUC, *PQSEMSTRUC;
299 } QSEMOWNER32, *PQSEMOWNER32;
304 PVOID semrecs; /* array of associated sema's */
308 USHORT _reserved_; /* padding to ULONG */
309 } QSEMSMUX32, *PQSEMSMUX32;
317 } QSEMEV32, *PQSEMEV32;
326 USHORT _reserved_; /* padding to ULONG */
327 } QSEMMUX32, *PQSEMMUX32;
329 typedef struct semstr32 {
334 } QSEMSTRUC32, *PQSEMSTRUC32;
336 typedef struct shrmem {
342 } QSHRMEM, *PQSHRMEM;
344 typedef struct module {
353 } QMODULE, *PQMODULE;
359 PQSEMSTRUC32 sem32data;
364 } QTOPLEVEL, *PQTOPLEVEL;
365 /* ************************************************************ */
367 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
369 #endif /* _OS2EMX_H */