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 void *emx_calloc (size_t, size_t);
113 void emx_free (void *);
114 void *emx_malloc (size_t);
115 void *emx_realloc (void *, size_t);
117 /*****************************************************************************/
119 #include <stdlib.h> /* before the following definitions */
120 #include <unistd.h> /* before the following definitions */
122 #define chdir _chdir2
123 #define getcwd _getcwd2
125 /* This guy is needed for quick stdstd */
127 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
128 # define _filbuf _fill
129 /* Perl uses ungetc only with successful return */
130 # define ungetc(c,fp) \
131 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
132 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
135 #define OP_BINARY O_BINARY
137 #define OS2_STAT_HACK 1
140 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
141 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
142 #define Fflush(fp) fflush(fp)
146 #define S_IFBLK 0120000
147 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
151 #define Stat(fname,bufptr) stat((fname),(bufptr))
152 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
153 #define Fflush(fp) fflush(fp)
157 /* Our private OS/2 specific data. */
159 typedef struct OS2_Perl_data {
164 unsigned long severity;
167 extern OS2_Perl_data_t OS2_Perl_data;
169 #define Perl_hab ((HAB)OS2_Perl_data.phab)
170 #define Perl_rc (OS2_Perl_data.rc)
171 #define Perl_severity (OS2_Perl_data.severity)
172 #define errno_isOS2 12345678
173 #define OS2_Perl_flags (OS2_Perl_data.flags)
174 #define Perl_HAB_set_f 1
175 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
176 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
177 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
178 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
179 /* The expressions below return true on error. */
180 /* INCL_DOSERRORS needed. rc should be declared outside. */
181 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
182 /* INCL_WINERRORS needed. */
183 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
184 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
185 #define FillOSError(rc) (Perl_rc = rc, \
186 errno = errno_isOS2, \
187 Perl_severity = SEVERITY_ERROR)
188 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
189 errno = errno_isOS2, \
190 Perl_severity = ERRORIDSEV(Perl_rc), \
191 Perl_rc = ERRORIDERROR(Perl_rc))
192 #define Acquire_hab() if (!Perl_HAB_set) { \
193 Perl_hab = WinInitialize(0); \
194 if (!Perl_hab) die("WinInitialize failed"); \
198 #define STATIC_FILE_LENGTH 127
200 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
201 char *perllib_mangle(char *, unsigned int);
203 char *os2error(int rc);
205 /* ************************************************************ */
206 #define Dos32QuerySysState DosQuerySysState
207 #define QuerySysState(flags, pid, buf, bufsz) \
208 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
210 #define QSS_PROCESS 1
212 #define QSS_SEMAPHORES 2
213 #define QSS_FILE 8 /* Buggy until fixpack18 */
214 #define QSS_SHARED 16
218 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
219 ULONG _res_,PVOID buf,ULONG bufsz);
224 } QGLOBAL, *PQGLOBAL;
235 UCHAR _reserved1_; /* padding to ULONG */
236 USHORT _reserved2_; /* padding to ULONG */
237 } QTHREAD, *PQTHREAD;
252 typedef struct qfile {
280 } QPROCESS, *PQPROCESS;
282 typedef struct sema {
299 } QSEMSTRUC, *PQSEMSTRUC;
304 } QSEMOWNER32, *PQSEMOWNER32;
309 PVOID semrecs; /* array of associated sema's */
313 USHORT _reserved_; /* padding to ULONG */
314 } QSEMSMUX32, *PQSEMSMUX32;
322 } QSEMEV32, *PQSEMEV32;
331 USHORT _reserved_; /* padding to ULONG */
332 } QSEMMUX32, *PQSEMMUX32;
334 typedef struct semstr32 {
339 } QSEMSTRUC32, *PQSEMSTRUC32;
341 typedef struct shrmem {
347 } QSHRMEM, *PQSHRMEM;
349 typedef struct module {
358 } QMODULE, *PQMODULE;
364 PQSEMSTRUC32 sem32data;
369 } QTOPLEVEL, *PQTOPLEVEL;
370 /* ************************************************************ */
372 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
374 #endif /* _OS2EMX_H */