Commit | Line | Data |
---|---|---|
0f4eea8f DL |
1 | /* |
2 | * iperlsys.h - Perl's interface to the system | |
3 | * | |
4 | * This file defines the system level functionality that perl needs. | |
5 | * | |
6 | * When using C, this definition is in the form of a set of macros | |
7 | * that can be #defined to the system-level function (or a wrapper | |
8 | * provided elsewhere). | |
9 | * | |
10 | * When using C++ with -DPERL_OBJECT, this definition is in the | |
11 | * form of a set of virtual base classes which must be subclassed to | |
12 | * provide a real implementation. The Perl Object will use instances | |
13 | * of this implementation to use the system-level functionality. | |
14 | * | |
15 | * GSAR 21-JUN-98 | |
16 | */ | |
17 | ||
18 | #ifndef __Inc__IPerl___ | |
19 | #define __Inc__IPerl___ | |
20 | ||
21 | /* | |
22 | * PerlXXX_YYY explained - DickH and DougL @ ActiveState.com | |
23 | * | |
24 | * XXX := functional group | |
25 | * YYY := stdlib/OS function name | |
26 | * | |
27 | * Continuing with the theme of PerlIO, all OS functionality was | |
28 | * encapsulated into one of several interfaces. | |
29 | * | |
30 | * PerlIO - stdio | |
31 | * PerlLIO - low level I/O | |
32 | * PerlMem - malloc, realloc, free | |
33 | * PerlDir - directory related | |
34 | * PerlEnv - process environment handling | |
35 | * PerlProc - process control | |
36 | * PerlSock - socket functions | |
37 | * | |
38 | * | |
39 | * The features of this are: | |
40 | * 1. All OS dependant code is in the Perl Host and not the Perl Core. | |
41 | * (At least this is the holy grail goal of this work) | |
42 | * 2. The Perl Host (see perl.h for description) can provide a new and | |
43 | * improved interface to OS functionality if required. | |
44 | * 3. Developers can easily hook into the OS calls for instrumentation | |
45 | * or diagnostic purposes. | |
46 | * | |
47 | * What was changed to do this: | |
48 | * 1. All calls to OS functions were replaced with PerlXXX_YYY | |
49 | * | |
50 | */ | |
51 | ||
52 | ||
53 | /* | |
54 | Interface for perl stdio functions | |
55 | */ | |
56 | ||
57 | ||
58 | /* Clean up (or at least document) the various possible #defines. | |
59 | This section attempts to match the 5.003_03 Configure variables | |
60 | onto the 5.003_02 header file values. | |
61 | I can't figure out where USE_STDIO was supposed to be set. | |
62 | --AD | |
63 | */ | |
64 | #ifndef USE_PERLIO | |
65 | # define PERLIO_IS_STDIO | |
66 | #endif | |
67 | ||
68 | /* Below is the 5.003_02 stuff. */ | |
69 | #ifdef USE_STDIO | |
70 | # ifndef PERLIO_IS_STDIO | |
71 | # define PERLIO_IS_STDIO | |
72 | # endif | |
73 | #else | |
20ce7b12 | 74 | extern void PerlIO_init (void); |
0f4eea8f DL |
75 | #endif |
76 | ||
c5be433b | 77 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f DL |
78 | |
79 | #ifndef PerlIO | |
80 | typedef struct _PerlIO PerlIO; | |
81 | #endif | |
82 | ||
0cb96387 GS |
83 | /* IPerlStdIO */ |
84 | struct IPerlStdIO; | |
85 | typedef PerlIO* (*LPStdin)(struct IPerlStdIO*); | |
86 | typedef PerlIO* (*LPStdout)(struct IPerlStdIO*); | |
87 | typedef PerlIO* (*LPStderr)(struct IPerlStdIO*); | |
88 | typedef PerlIO* (*LPOpen)(struct IPerlStdIO*, const char*, | |
89 | const char*); | |
90 | typedef int (*LPClose)(struct IPerlStdIO*, PerlIO*); | |
91 | typedef int (*LPEof)(struct IPerlStdIO*, PerlIO*); | |
92 | typedef int (*LPError)(struct IPerlStdIO*, PerlIO*); | |
93 | typedef void (*LPClearerr)(struct IPerlStdIO*, PerlIO*); | |
94 | typedef int (*LPGetc)(struct IPerlStdIO*, PerlIO*); | |
95 | typedef char* (*LPGetBase)(struct IPerlStdIO*, PerlIO*); | |
96 | typedef int (*LPGetBufsiz)(struct IPerlStdIO*, PerlIO*); | |
97 | typedef int (*LPGetCnt)(struct IPerlStdIO*, PerlIO*); | |
98 | typedef char* (*LPGetPtr)(struct IPerlStdIO*, PerlIO*); | |
99 | typedef char* (*LPGets)(struct IPerlStdIO*, PerlIO*, char*, int); | |
100 | typedef int (*LPPutc)(struct IPerlStdIO*, PerlIO*, int); | |
101 | typedef int (*LPPuts)(struct IPerlStdIO*, PerlIO*, const char*); | |
102 | typedef int (*LPFlush)(struct IPerlStdIO*, PerlIO*); | |
103 | typedef int (*LPUngetc)(struct IPerlStdIO*, PerlIO*,int); | |
104 | typedef int (*LPFileno)(struct IPerlStdIO*, PerlIO*); | |
105 | typedef PerlIO* (*LPFdopen)(struct IPerlStdIO*, int, const char*); | |
106 | typedef PerlIO* (*LPReopen)(struct IPerlStdIO*, const char*, | |
107 | const char*, PerlIO*); | |
108 | typedef SSize_t (*LPRead)(struct IPerlStdIO*, PerlIO*, void*, Size_t); | |
109 | typedef SSize_t (*LPWrite)(struct IPerlStdIO*, PerlIO*, const void*, | |
110 | Size_t); | |
111 | typedef void (*LPSetBuf)(struct IPerlStdIO*, PerlIO*, char*); | |
112 | typedef int (*LPSetVBuf)(struct IPerlStdIO*, PerlIO*, char*, int, | |
113 | Size_t); | |
114 | typedef void (*LPSetCnt)(struct IPerlStdIO*, PerlIO*, int); | |
115 | typedef void (*LPSetPtrCnt)(struct IPerlStdIO*, PerlIO*, char*, | |
116 | int); | |
117 | typedef void (*LPSetlinebuf)(struct IPerlStdIO*, PerlIO*); | |
118 | typedef int (*LPPrintf)(struct IPerlStdIO*, PerlIO*, const char*, | |
119 | ...); | |
120 | typedef int (*LPVprintf)(struct IPerlStdIO*, PerlIO*, const char*, | |
121 | va_list); | |
122 | typedef long (*LPTell)(struct IPerlStdIO*, PerlIO*); | |
123 | typedef int (*LPSeek)(struct IPerlStdIO*, PerlIO*, Off_t, int); | |
124 | typedef void (*LPRewind)(struct IPerlStdIO*, PerlIO*); | |
125 | typedef PerlIO* (*LPTmpfile)(struct IPerlStdIO*); | |
126 | typedef int (*LPGetpos)(struct IPerlStdIO*, PerlIO*, Fpos_t*); | |
127 | typedef int (*LPSetpos)(struct IPerlStdIO*, PerlIO*, | |
128 | const Fpos_t*); | |
129 | typedef void (*LPInit)(struct IPerlStdIO*); | |
130 | typedef void (*LPInitOSExtras)(struct IPerlStdIO*); | |
131 | ||
132 | struct IPerlStdIO | |
0f4eea8f | 133 | { |
0cb96387 GS |
134 | LPStdin pStdin; |
135 | LPStdout pStdout; | |
136 | LPStderr pStderr; | |
137 | LPOpen pOpen; | |
138 | LPClose pClose; | |
139 | LPEof pEof; | |
140 | LPError pError; | |
141 | LPClearerr pClearerr; | |
142 | LPGetc pGetc; | |
143 | LPGetBase pGetBase; | |
144 | LPGetBufsiz pGetBufsiz; | |
145 | LPGetCnt pGetCnt; | |
146 | LPGetPtr pGetPtr; | |
147 | LPGets pGets; | |
148 | LPPutc pPutc; | |
149 | LPPuts pPuts; | |
150 | LPFlush pFlush; | |
151 | LPUngetc pUngetc; | |
152 | LPFileno pFileno; | |
153 | LPFdopen pFdopen; | |
154 | LPReopen pReopen; | |
155 | LPRead pRead; | |
156 | LPWrite pWrite; | |
157 | LPSetBuf pSetBuf; | |
158 | LPSetVBuf pSetVBuf; | |
159 | LPSetCnt pSetCnt; | |
160 | LPSetPtrCnt pSetPtrCnt; | |
161 | LPSetlinebuf pSetlinebuf; | |
162 | LPPrintf pPrintf; | |
163 | LPVprintf pVprintf; | |
164 | LPTell pTell; | |
165 | LPSeek pSeek; | |
166 | LPRewind pRewind; | |
167 | LPTmpfile pTmpfile; | |
168 | LPGetpos pGetpos; | |
169 | LPSetpos pSetpos; | |
170 | LPInit pInit; | |
171 | LPInitOSExtras pInitOSExtras; | |
0f4eea8f DL |
172 | }; |
173 | ||
0cb96387 GS |
174 | struct IPerlStdIOInfo |
175 | { | |
176 | unsigned long nCount; /* number of entries expected */ | |
177 | struct IPerlStdIO perlStdIOList; | |
178 | }; | |
2bd2b9e0 GS |
179 | |
180 | #ifdef USE_STDIO_PTR | |
181 | # define PerlIO_has_cntptr(f) 1 | |
182 | # ifdef STDIO_CNT_LVALUE | |
183 | # define PerlIO_canset_cnt(f) 1 | |
184 | # ifdef STDIO_PTR_LVALUE | |
185 | # define PerlIO_fast_gets(f) 1 | |
186 | # endif | |
187 | # else | |
188 | # define PerlIO_canset_cnt(f) 0 | |
189 | # endif | |
190 | #else /* USE_STDIO_PTR */ | |
191 | # define PerlIO_has_cntptr(f) 0 | |
192 | # define PerlIO_canset_cnt(f) 0 | |
193 | #endif /* USE_STDIO_PTR */ | |
194 | ||
195 | #ifndef PerlIO_fast_gets | |
196 | #define PerlIO_fast_gets(f) 0 | |
197 | #endif | |
198 | ||
199 | #ifdef FILE_base | |
200 | #define PerlIO_has_base(f) 1 | |
201 | #else | |
202 | #define PerlIO_has_base(f) 0 | |
203 | #endif | |
0f4eea8f | 204 | |
0cb96387 | 205 | #define PerlIO_stdin() \ |
51371543 | 206 | (*PL_StdIO->pStdin)(PL_StdIO) |
0cb96387 | 207 | #define PerlIO_stdout() \ |
51371543 | 208 | (*PL_StdIO->pStdout)(PL_StdIO) |
0cb96387 | 209 | #define PerlIO_stderr() \ |
51371543 | 210 | (*PL_StdIO->pStderr)(PL_StdIO) |
0cb96387 | 211 | #define PerlIO_open(x,y) \ |
51371543 | 212 | (*PL_StdIO->pOpen)(PL_StdIO, (x),(y)) |
0cb96387 | 213 | #define PerlIO_close(f) \ |
51371543 | 214 | (*PL_StdIO->pClose)(PL_StdIO, (f)) |
0cb96387 | 215 | #define PerlIO_eof(f) \ |
51371543 | 216 | (*PL_StdIO->pEof)(PL_StdIO, (f)) |
0cb96387 | 217 | #define PerlIO_error(f) \ |
51371543 | 218 | (*PL_StdIO->pError)(PL_StdIO, (f)) |
0cb96387 | 219 | #define PerlIO_clearerr(f) \ |
51371543 | 220 | (*PL_StdIO->pClearerr)(PL_StdIO, (f)) |
0cb96387 | 221 | #define PerlIO_getc(f) \ |
51371543 | 222 | (*PL_StdIO->pGetc)(PL_StdIO, (f)) |
a20bf0c3 | 223 | #define PerlIO_get_base(f) \ |
51371543 | 224 | (*PL_StdIO->pGetBase)(PL_StdIO, (f)) |
a20bf0c3 | 225 | #define PerlIO_get_bufsiz(f) \ |
51371543 | 226 | (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f)) |
a20bf0c3 | 227 | #define PerlIO_get_cnt(f) \ |
51371543 | 228 | (*PL_StdIO->pGetCnt)(PL_StdIO, (f)) |
a20bf0c3 | 229 | #define PerlIO_get_ptr(f) \ |
51371543 | 230 | (*PL_StdIO->pGetPtr)(PL_StdIO, (f)) |
0cb96387 | 231 | #define PerlIO_putc(f,c) \ |
51371543 | 232 | (*PL_StdIO->pPutc)(PL_StdIO, (f),(c)) |
0cb96387 | 233 | #define PerlIO_puts(f,s) \ |
51371543 | 234 | (*PL_StdIO->pPuts)(PL_StdIO, (f),(s)) |
0cb96387 | 235 | #define PerlIO_flush(f) \ |
51371543 | 236 | (*PL_StdIO->pFlush)(PL_StdIO, (f)) |
0cb96387 | 237 | #define PerlIO_gets(s, n, fp) \ |
51371543 | 238 | (*PL_StdIO->pGets)(PL_StdIO, (fp), s, n) |
0cb96387 | 239 | #define PerlIO_ungetc(f,c) \ |
51371543 | 240 | (*PL_StdIO->pUngetc)(PL_StdIO, (f),(c)) |
0cb96387 | 241 | #define PerlIO_fileno(f) \ |
51371543 | 242 | (*PL_StdIO->pFileno)(PL_StdIO, (f)) |
0cb96387 | 243 | #define PerlIO_fdopen(f, s) \ |
51371543 | 244 | (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s)) |
0cb96387 | 245 | #define PerlIO_reopen(p, m, f) \ |
51371543 | 246 | (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f)) |
0f4eea8f | 247 | #define PerlIO_read(f,buf,count) \ |
51371543 | 248 | (SSize_t)(*PL_StdIO->pRead)(PL_StdIO, (f), (buf), (count)) |
0f4eea8f | 249 | #define PerlIO_write(f,buf,count) \ |
51371543 | 250 | (*PL_StdIO->pWrite)(PL_StdIO, (f), (buf), (count)) |
0cb96387 | 251 | #define PerlIO_setbuf(f,b) \ |
51371543 | 252 | (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b)) |
0cb96387 | 253 | #define PerlIO_setvbuf(f,b,t,s) \ |
51371543 | 254 | (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s)) |
a20bf0c3 | 255 | #define PerlIO_set_cnt(f,c) \ |
51371543 | 256 | (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c)) |
a20bf0c3 | 257 | #define PerlIO_set_ptrcnt(f,p,c) \ |
51371543 | 258 | (*PL_StdIO->pSetPtrCnt)(PL_StdIO, (f), (p), (c)) |
0cb96387 | 259 | #define PerlIO_setlinebuf(f) \ |
51371543 | 260 | (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f)) |
c5be433b | 261 | #define PerlIO_printf Perl_fprintf_nocontext |
51371543 | 262 | #define PerlIO_stdoutf *PL_StdIO->pPrintf |
0cb96387 | 263 | #define PerlIO_vprintf(f,fmt,a) \ |
51371543 | 264 | (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a) |
0cb96387 | 265 | #define PerlIO_tell(f) \ |
51371543 | 266 | (*PL_StdIO->pTell)(PL_StdIO, (f)) |
0cb96387 | 267 | #define PerlIO_seek(f,o,w) \ |
51371543 | 268 | (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w)) |
0cb96387 | 269 | #define PerlIO_getpos(f,p) \ |
51371543 | 270 | (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p)) |
0cb96387 | 271 | #define PerlIO_setpos(f,p) \ |
51371543 | 272 | (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p)) |
0cb96387 | 273 | #define PerlIO_rewind(f) \ |
51371543 | 274 | (*PL_StdIO->pRewind)(PL_StdIO, (f)) |
0cb96387 | 275 | #define PerlIO_tmpfile() \ |
51371543 | 276 | (*PL_StdIO->pTmpfile)(PL_StdIO) |
0cb96387 | 277 | #define PerlIO_init() \ |
51371543 | 278 | (*PL_StdIO->pInit)(PL_StdIO) |
0f4eea8f | 279 | #undef init_os_extras |
c5be433b | 280 | #define init_os_extras() \ |
51371543 | 281 | (*PL_StdIO->pInitOSExtras)(PL_StdIO) |
0f4eea8f | 282 | |
c5be433b | 283 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
284 | |
285 | #include "perlsdio.h" | |
d9b3e12d | 286 | #include "perl.h" |
0f4eea8f | 287 | |
c5be433b | 288 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
289 | |
290 | #ifndef PERLIO_IS_STDIO | |
291 | #ifdef USE_SFIO | |
292 | #include "perlsfio.h" | |
293 | #endif /* USE_SFIO */ | |
294 | #endif /* PERLIO_IS_STDIO */ | |
295 | ||
296 | #ifndef EOF | |
297 | #define EOF (-1) | |
298 | #endif | |
299 | ||
300 | /* This is to catch case with no stdio */ | |
301 | #ifndef BUFSIZ | |
302 | #define BUFSIZ 1024 | |
303 | #endif | |
304 | ||
305 | #ifndef SEEK_SET | |
306 | #define SEEK_SET 0 | |
307 | #endif | |
308 | ||
309 | #ifndef SEEK_CUR | |
310 | #define SEEK_CUR 1 | |
311 | #endif | |
312 | ||
313 | #ifndef SEEK_END | |
314 | #define SEEK_END 2 | |
315 | #endif | |
316 | ||
317 | #ifndef PerlIO | |
318 | struct _PerlIO; | |
319 | #define PerlIO struct _PerlIO | |
320 | #endif /* No PerlIO */ | |
321 | ||
322 | #ifndef Fpos_t | |
323 | #define Fpos_t long | |
324 | #endif | |
325 | ||
326 | #ifndef NEXT30_NO_ATTRIBUTE | |
327 | #ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */ | |
328 | #ifdef __attribute__ /* Avoid possible redefinition errors */ | |
329 | #undef __attribute__ | |
330 | #endif | |
331 | #define __attribute__(attr) | |
332 | #endif | |
333 | #endif | |
334 | ||
335 | #ifndef PerlIO_stdoutf | |
20ce7b12 | 336 | extern int PerlIO_stdoutf (const char *,...) |
0f4eea8f DL |
337 | __attribute__((format (printf, 1, 2))); |
338 | #endif | |
339 | #ifndef PerlIO_puts | |
20ce7b12 | 340 | extern int PerlIO_puts (PerlIO *,const char *); |
0f4eea8f DL |
341 | #endif |
342 | #ifndef PerlIO_open | |
20ce7b12 | 343 | extern PerlIO * PerlIO_open (const char *,const char *); |
0f4eea8f DL |
344 | #endif |
345 | #ifndef PerlIO_close | |
20ce7b12 | 346 | extern int PerlIO_close (PerlIO *); |
0f4eea8f DL |
347 | #endif |
348 | #ifndef PerlIO_eof | |
20ce7b12 | 349 | extern int PerlIO_eof (PerlIO *); |
0f4eea8f DL |
350 | #endif |
351 | #ifndef PerlIO_error | |
20ce7b12 | 352 | extern int PerlIO_error (PerlIO *); |
0f4eea8f DL |
353 | #endif |
354 | #ifndef PerlIO_clearerr | |
20ce7b12 | 355 | extern void PerlIO_clearerr (PerlIO *); |
0f4eea8f DL |
356 | #endif |
357 | #ifndef PerlIO_getc | |
20ce7b12 | 358 | extern int PerlIO_getc (PerlIO *); |
0f4eea8f DL |
359 | #endif |
360 | #ifndef PerlIO_putc | |
20ce7b12 | 361 | extern int PerlIO_putc (PerlIO *,int); |
0f4eea8f DL |
362 | #endif |
363 | #ifndef PerlIO_flush | |
20ce7b12 | 364 | extern int PerlIO_flush (PerlIO *); |
0f4eea8f DL |
365 | #endif |
366 | #ifndef PerlIO_ungetc | |
20ce7b12 | 367 | extern int PerlIO_ungetc (PerlIO *,int); |
0f4eea8f DL |
368 | #endif |
369 | #ifndef PerlIO_fileno | |
20ce7b12 | 370 | extern int PerlIO_fileno (PerlIO *); |
0f4eea8f DL |
371 | #endif |
372 | #ifndef PerlIO_fdopen | |
20ce7b12 | 373 | extern PerlIO * PerlIO_fdopen (int, const char *); |
0f4eea8f DL |
374 | #endif |
375 | #ifndef PerlIO_importFILE | |
20ce7b12 | 376 | extern PerlIO * PerlIO_importFILE (FILE *,int); |
0f4eea8f DL |
377 | #endif |
378 | #ifndef PerlIO_exportFILE | |
20ce7b12 | 379 | extern FILE * PerlIO_exportFILE (PerlIO *,int); |
0f4eea8f DL |
380 | #endif |
381 | #ifndef PerlIO_findFILE | |
20ce7b12 | 382 | extern FILE * PerlIO_findFILE (PerlIO *); |
0f4eea8f DL |
383 | #endif |
384 | #ifndef PerlIO_releaseFILE | |
20ce7b12 | 385 | extern void PerlIO_releaseFILE (PerlIO *,FILE *); |
0f4eea8f DL |
386 | #endif |
387 | #ifndef PerlIO_read | |
20ce7b12 | 388 | extern SSize_t PerlIO_read (PerlIO *,void *,Size_t); |
0f4eea8f DL |
389 | #endif |
390 | #ifndef PerlIO_write | |
20ce7b12 | 391 | extern SSize_t PerlIO_write (PerlIO *,const void *,Size_t); |
0f4eea8f DL |
392 | #endif |
393 | #ifndef PerlIO_setlinebuf | |
20ce7b12 | 394 | extern void PerlIO_setlinebuf (PerlIO *); |
0f4eea8f DL |
395 | #endif |
396 | #ifndef PerlIO_printf | |
20ce7b12 | 397 | extern int PerlIO_printf (PerlIO *, const char *,...) |
0f4eea8f DL |
398 | __attribute__((format (printf, 2, 3))); |
399 | #endif | |
400 | #ifndef PerlIO_sprintf | |
20ce7b12 | 401 | extern int PerlIO_sprintf (char *, int, const char *,...) |
0f4eea8f DL |
402 | __attribute__((format (printf, 3, 4))); |
403 | #endif | |
404 | #ifndef PerlIO_vprintf | |
20ce7b12 | 405 | extern int PerlIO_vprintf (PerlIO *, const char *, va_list); |
0f4eea8f DL |
406 | #endif |
407 | #ifndef PerlIO_tell | |
20ce7b12 | 408 | extern Off_t PerlIO_tell (PerlIO *); |
0f4eea8f DL |
409 | #endif |
410 | #ifndef PerlIO_seek | |
20ce7b12 | 411 | extern int PerlIO_seek (PerlIO *, Off_t, int); |
0f4eea8f DL |
412 | #endif |
413 | #ifndef PerlIO_rewind | |
20ce7b12 | 414 | extern void PerlIO_rewind (PerlIO *); |
0f4eea8f DL |
415 | #endif |
416 | #ifndef PerlIO_has_base | |
20ce7b12 | 417 | extern int PerlIO_has_base (PerlIO *); |
0f4eea8f DL |
418 | #endif |
419 | #ifndef PerlIO_has_cntptr | |
20ce7b12 | 420 | extern int PerlIO_has_cntptr (PerlIO *); |
0f4eea8f DL |
421 | #endif |
422 | #ifndef PerlIO_fast_gets | |
20ce7b12 | 423 | extern int PerlIO_fast_gets (PerlIO *); |
0f4eea8f DL |
424 | #endif |
425 | #ifndef PerlIO_canset_cnt | |
20ce7b12 | 426 | extern int PerlIO_canset_cnt (PerlIO *); |
0f4eea8f DL |
427 | #endif |
428 | #ifndef PerlIO_get_ptr | |
a20bf0c3 | 429 | extern STDCHAR * PerlIO_get_ptr (PerlIO *); |
0f4eea8f DL |
430 | #endif |
431 | #ifndef PerlIO_get_cnt | |
a20bf0c3 | 432 | extern int PerlIO_get_cnt (PerlIO *); |
0f4eea8f DL |
433 | #endif |
434 | #ifndef PerlIO_set_cnt | |
a20bf0c3 | 435 | extern void PerlIO_set_cnt (PerlIO *,int); |
0f4eea8f DL |
436 | #endif |
437 | #ifndef PerlIO_set_ptrcnt | |
a20bf0c3 | 438 | extern void PerlIO_set_ptrcnt (PerlIO *,STDCHAR *,int); |
0f4eea8f DL |
439 | #endif |
440 | #ifndef PerlIO_get_base | |
a20bf0c3 | 441 | extern STDCHAR * PerlIO_get_base (PerlIO *); |
0f4eea8f DL |
442 | #endif |
443 | #ifndef PerlIO_get_bufsiz | |
a20bf0c3 | 444 | extern int PerlIO_get_bufsiz (PerlIO *); |
0f4eea8f DL |
445 | #endif |
446 | #ifndef PerlIO_tmpfile | |
20ce7b12 | 447 | extern PerlIO * PerlIO_tmpfile (void); |
0f4eea8f DL |
448 | #endif |
449 | #ifndef PerlIO_stdin | |
20ce7b12 | 450 | extern PerlIO * PerlIO_stdin (void); |
0f4eea8f DL |
451 | #endif |
452 | #ifndef PerlIO_stdout | |
20ce7b12 | 453 | extern PerlIO * PerlIO_stdout (void); |
0f4eea8f DL |
454 | #endif |
455 | #ifndef PerlIO_stderr | |
20ce7b12 | 456 | extern PerlIO * PerlIO_stderr (void); |
0f4eea8f DL |
457 | #endif |
458 | #ifndef PerlIO_getpos | |
20ce7b12 | 459 | extern int PerlIO_getpos (PerlIO *,Fpos_t *); |
0f4eea8f DL |
460 | #endif |
461 | #ifndef PerlIO_setpos | |
20ce7b12 | 462 | extern int PerlIO_setpos (PerlIO *,const Fpos_t *); |
0f4eea8f DL |
463 | #endif |
464 | ||
465 | ||
466 | /* | |
467 | * Interface for directory functions | |
468 | */ | |
469 | ||
c5be433b | 470 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f | 471 | |
0cb96387 GS |
472 | /* IPerlDir */ |
473 | struct IPerlDir; | |
474 | typedef int (*LPMakedir)(struct IPerlDir*, const char*, int); | |
475 | typedef int (*LPChdir)(struct IPerlDir*, const char*); | |
476 | typedef int (*LPRmdir)(struct IPerlDir*, const char*); | |
477 | typedef int (*LPDirClose)(struct IPerlDir*, DIR*); | |
478 | typedef DIR* (*LPDirOpen)(struct IPerlDir*, char*); | |
479 | typedef struct direct* (*LPDirRead)(struct IPerlDir*, DIR*); | |
480 | typedef void (*LPDirRewind)(struct IPerlDir*, DIR*); | |
481 | typedef void (*LPDirSeek)(struct IPerlDir*, DIR*, long); | |
482 | typedef long (*LPDirTell)(struct IPerlDir*, DIR*); | |
483 | ||
484 | struct IPerlDir | |
0f4eea8f | 485 | { |
0cb96387 GS |
486 | LPMakedir pMakedir; |
487 | LPChdir pChdir; | |
488 | LPRmdir pRmdir; | |
489 | LPDirClose pClose; | |
490 | LPDirOpen pOpen; | |
491 | LPDirRead pRead; | |
492 | LPDirRewind pRewind; | |
493 | LPDirSeek pSeek; | |
494 | LPDirTell pTell; | |
495 | }; | |
496 | ||
497 | struct IPerlDirInfo | |
498 | { | |
499 | unsigned long nCount; /* number of entries expected */ | |
500 | struct IPerlDir perlDirList; | |
0f4eea8f DL |
501 | }; |
502 | ||
503 | #define PerlDir_mkdir(name, mode) \ | |
51371543 | 504 | (*PL_Dir->pMakedir)(PL_Dir, (name), (mode)) |
0f4eea8f | 505 | #define PerlDir_chdir(name) \ |
51371543 | 506 | (*PL_Dir->pChdir)(PL_Dir, (name)) |
0f4eea8f | 507 | #define PerlDir_rmdir(name) \ |
51371543 | 508 | (*PL_Dir->pRmdir)(PL_Dir, (name)) |
0f4eea8f | 509 | #define PerlDir_close(dir) \ |
51371543 | 510 | (*PL_Dir->pClose)(PL_Dir, (dir)) |
0f4eea8f | 511 | #define PerlDir_open(name) \ |
51371543 | 512 | (*PL_Dir->pOpen)(PL_Dir, (name)) |
0f4eea8f | 513 | #define PerlDir_read(dir) \ |
51371543 | 514 | (*PL_Dir->pRead)(PL_Dir, (dir)) |
0f4eea8f | 515 | #define PerlDir_rewind(dir) \ |
51371543 | 516 | (*PL_Dir->pRewind)(PL_Dir, (dir)) |
0f4eea8f | 517 | #define PerlDir_seek(dir, loc) \ |
51371543 | 518 | (*PL_Dir->pSeek)(PL_Dir, (dir), (loc)) |
0f4eea8f | 519 | #define PerlDir_tell(dir) \ |
51371543 | 520 | (*PL_Dir->pTell)(PL_Dir, (dir)) |
0f4eea8f | 521 | |
c5be433b | 522 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
523 | |
524 | #define PerlDir_mkdir(name, mode) Mkdir((name), (mode)) | |
525 | #ifdef VMS | |
526 | # define PerlDir_chdir(n) chdir(((n) && *(n)) ? (n) : "SYS$LOGIN") | |
527 | #else | |
528 | # define PerlDir_chdir(name) chdir((name)) | |
529 | #endif | |
530 | #define PerlDir_rmdir(name) rmdir((name)) | |
531 | #define PerlDir_close(dir) closedir((dir)) | |
532 | #define PerlDir_open(name) opendir((name)) | |
533 | #define PerlDir_read(dir) readdir((dir)) | |
534 | #define PerlDir_rewind(dir) rewinddir((dir)) | |
535 | #define PerlDir_seek(dir, loc) seekdir((dir), (loc)) | |
536 | #define PerlDir_tell(dir) telldir((dir)) | |
537 | ||
c5be433b | 538 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
539 | |
540 | /* | |
541 | Interface for perl environment functions | |
542 | */ | |
543 | ||
c5be433b | 544 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f | 545 | |
0cb96387 GS |
546 | /* IPerlEnv */ |
547 | struct IPerlEnv; | |
548 | typedef char* (*LPEnvGetenv)(struct IPerlEnv*, const char*); | |
549 | typedef int (*LPEnvPutenv)(struct IPerlEnv*, const char*); | |
3075ddba | 550 | typedef char* (*LPEnvGetenv_len)(struct IPerlEnv*, |
0cb96387 GS |
551 | const char *varname, unsigned long *len); |
552 | typedef int (*LPEnvUname)(struct IPerlEnv*, struct utsname *name); | |
553 | typedef void (*LPEnvClearenv)(struct IPerlEnv*); | |
3075ddba GS |
554 | typedef void* (*LPEnvGetChildenv)(struct IPerlEnv*); |
555 | typedef void (*LPEnvFreeChildenv)(struct IPerlEnv*, void* env); | |
556 | typedef char* (*LPEnvGetChilddir)(struct IPerlEnv*); | |
557 | typedef void (*LPEnvFreeChilddir)(struct IPerlEnv*, char* dir); | |
0cb96387 | 558 | #ifdef HAS_ENVGETENV |
3075ddba GS |
559 | typedef char* (*LPENVGetenv)(struct IPerlEnv*, const char *varname); |
560 | typedef char* (*LPENVGetenv_len)(struct IPerlEnv*, | |
0cb96387 GS |
561 | const char *varname, unsigned long *len); |
562 | #endif | |
563 | #ifdef WIN32 | |
3075ddba | 564 | typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*); |
0cb96387 GS |
565 | typedef char* (*LPEnvLibPath)(struct IPerlEnv*, char*); |
566 | typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, char*); | |
567 | #endif | |
568 | ||
569 | struct IPerlEnv | |
0f4eea8f | 570 | { |
0cb96387 GS |
571 | LPEnvGetenv pGetenv; |
572 | LPEnvPutenv pPutenv; | |
573 | LPEnvGetenv_len pGetenv_len; | |
574 | LPEnvUname pEnvUname; | |
575 | LPEnvClearenv pClearenv; | |
3075ddba GS |
576 | LPEnvGetChildenv pGetChildenv; |
577 | LPEnvFreeChildenv pFreeChildenv; | |
578 | LPEnvGetChilddir pGetChilddir; | |
579 | LPEnvFreeChilddir pFreeChilddir; | |
a6c40364 | 580 | #ifdef HAS_ENVGETENV |
0cb96387 GS |
581 | LPENVGetenv pENVGetenv; |
582 | LPENVGetenv_len pENVGetenv_len; | |
583 | #endif | |
584 | #ifdef WIN32 | |
585 | LPEnvOsID pEnvOsID; | |
586 | LPEnvLibPath pLibPath; | |
587 | LPEnvSiteLibPath pSiteLibPath; | |
a6c40364 | 588 | #endif |
0f4eea8f DL |
589 | }; |
590 | ||
0cb96387 GS |
591 | struct IPerlEnvInfo |
592 | { | |
593 | unsigned long nCount; /* number of entries expected */ | |
594 | struct IPerlEnv perlEnvList; | |
595 | }; | |
596 | ||
597 | #define PerlEnv_putenv(str) \ | |
51371543 | 598 | (*PL_Env->pPutenv)(PL_Env,(str)) |
0cb96387 | 599 | #define PerlEnv_getenv(str) \ |
51371543 | 600 | (*PL_Env->pGetenv)(PL_Env,(str)) |
0cb96387 | 601 | #define PerlEnv_getenv_len(str,l) \ |
51371543 | 602 | (*PL_Env->pGetenv_len)(PL_Env,(str), (l)) |
3075ddba | 603 | #define PerlEnv_clearenv() \ |
51371543 | 604 | (*PL_Env->pClearenv)(PL_Env) |
3075ddba GS |
605 | #define PerlEnv_get_childenv() \ |
606 | (*PL_Env->pGetChildenv)(PL_Env) | |
607 | #define PerlEnv_free_childenv(e) \ | |
608 | (*PL_Env->pFreeChildenv)(PL_Env, (e)) | |
609 | #define PerlEnv_get_childdir() \ | |
610 | (*PL_Env->pGetChilddir)(PL_Env) | |
611 | #define PerlEnv_free_childdir(d) \ | |
612 | (*PL_Env->pFreeChilddir)(PL_Env, (d)) | |
f675dbe5 | 613 | #ifdef HAS_ENVGETENV |
0cb96387 | 614 | # define PerlEnv_ENVgetenv(str) \ |
51371543 | 615 | (*PL_Env->pENVGetenv)(PL_Env,(str)) |
0cb96387 | 616 | # define PerlEnv_ENVgetenv_len(str,l) \ |
51371543 | 617 | (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l)) |
f675dbe5 | 618 | #else |
0cb96387 GS |
619 | # define PerlEnv_ENVgetenv(str) \ |
620 | PerlEnv_getenv((str)) | |
621 | # define PerlEnv_ENVgetenv_len(str,l) \ | |
622 | PerlEnv_getenv_len((str),(l)) | |
f675dbe5 | 623 | #endif |
0cb96387 | 624 | #define PerlEnv_uname(name) \ |
51371543 | 625 | (*PL_Env->pEnvUname)(PL_Env,(name)) |
0f4eea8f | 626 | #ifdef WIN32 |
0cb96387 | 627 | #define PerlEnv_os_id() \ |
51371543 | 628 | (*PL_Env->pEnvOsID)(PL_Env) |
0cb96387 | 629 | #define PerlEnv_lib_path(str) \ |
51371543 | 630 | (*PL_Env->pLibPath)(PL_Env,(str)) |
0cb96387 | 631 | #define PerlEnv_sitelib_path(str) \ |
51371543 | 632 | (*PL_Env->pSiteLibPath)(PL_Env,(str)) |
0f4eea8f DL |
633 | #endif |
634 | ||
c5be433b | 635 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
636 | |
637 | #define PerlEnv_putenv(str) putenv((str)) | |
638 | #define PerlEnv_getenv(str) getenv((str)) | |
a6c40364 | 639 | #define PerlEnv_getenv_len(str,l) getenv_len((str), (l)) |
3075ddba GS |
640 | #define PerlEnv_clear() clearenv() |
641 | #define PerlEnv_get_childenv() get_childenv() | |
642 | #define PerlEnv_free_childenv(e) free_childenv((e)) | |
643 | #define PerlEnv_get_childdir() get_childdir() | |
644 | #define PerlEnv_free_childdir(d) free_childdir((d)) | |
f675dbe5 CB |
645 | #ifdef HAS_ENVGETENV |
646 | # define PerlEnv_ENVgetenv(str) ENVgetenv((str)) | |
a6c40364 | 647 | # define PerlEnv_ENVgetenv_len(str,l) ENVgetenv_len((str), (l)) |
f675dbe5 CB |
648 | #else |
649 | # define PerlEnv_ENVgetenv(str) PerlEnv_getenv((str)) | |
a6c40364 | 650 | # define PerlEnv_ENVgetenv_len(str,l) PerlEnv_getenv_len((str), (l)) |
f675dbe5 | 651 | #endif |
b2af26b1 | 652 | #define PerlEnv_uname(name) uname((name)) |
0f4eea8f | 653 | |
0cb96387 GS |
654 | #ifdef WIN32 |
655 | #define PerlEnv_os_id() win32_os_id() | |
656 | #endif | |
657 | ||
c5be433b | 658 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
659 | |
660 | /* | |
661 | Interface for perl low-level IO functions | |
662 | */ | |
663 | ||
c5be433b | 664 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f | 665 | |
0cb96387 GS |
666 | /* IPerlLIO */ |
667 | struct IPerlLIO; | |
668 | typedef int (*LPLIOAccess)(struct IPerlLIO*, const char*, int); | |
669 | typedef int (*LPLIOChmod)(struct IPerlLIO*, const char*, int); | |
670 | typedef int (*LPLIOChown)(struct IPerlLIO*, const char*, uid_t, | |
671 | gid_t); | |
672 | typedef int (*LPLIOChsize)(struct IPerlLIO*, int, long); | |
673 | typedef int (*LPLIOClose)(struct IPerlLIO*, int); | |
674 | typedef int (*LPLIODup)(struct IPerlLIO*, int); | |
675 | typedef int (*LPLIODup2)(struct IPerlLIO*, int, int); | |
676 | typedef int (*LPLIOFlock)(struct IPerlLIO*, int, int); | |
677 | typedef int (*LPLIOFileStat)(struct IPerlLIO*, int, struct stat*); | |
678 | typedef int (*LPLIOIOCtl)(struct IPerlLIO*, int, unsigned int, | |
679 | char*); | |
680 | typedef int (*LPLIOIsatty)(struct IPerlLIO*, int); | |
681 | typedef long (*LPLIOLseek)(struct IPerlLIO*, int, long, int); | |
682 | typedef int (*LPLIOLstat)(struct IPerlLIO*, const char*, | |
683 | struct stat*); | |
684 | typedef char* (*LPLIOMktemp)(struct IPerlLIO*, char*); | |
685 | typedef int (*LPLIOOpen)(struct IPerlLIO*, const char*, int); | |
686 | typedef int (*LPLIOOpen3)(struct IPerlLIO*, const char*, int, int); | |
687 | typedef int (*LPLIORead)(struct IPerlLIO*, int, void*, unsigned int); | |
688 | typedef int (*LPLIORename)(struct IPerlLIO*, const char*, | |
689 | const char*); | |
690 | typedef int (*LPLIOSetmode)(struct IPerlLIO*, int, int); | |
691 | typedef int (*LPLIONameStat)(struct IPerlLIO*, const char*, | |
692 | struct stat*); | |
693 | typedef char* (*LPLIOTmpnam)(struct IPerlLIO*, char*); | |
694 | typedef int (*LPLIOUmask)(struct IPerlLIO*, int); | |
695 | typedef int (*LPLIOUnlink)(struct IPerlLIO*, const char*); | |
696 | typedef int (*LPLIOUtime)(struct IPerlLIO*, char*, struct utimbuf*); | |
697 | typedef int (*LPLIOWrite)(struct IPerlLIO*, int, const void*, | |
698 | unsigned int); | |
699 | ||
700 | struct IPerlLIO | |
701 | { | |
702 | LPLIOAccess pAccess; | |
703 | LPLIOChmod pChmod; | |
704 | LPLIOChown pChown; | |
705 | LPLIOChsize pChsize; | |
706 | LPLIOClose pClose; | |
707 | LPLIODup pDup; | |
708 | LPLIODup2 pDup2; | |
709 | LPLIOFlock pFlock; | |
710 | LPLIOFileStat pFileStat; | |
711 | LPLIOIOCtl pIOCtl; | |
712 | LPLIOIsatty pIsatty; | |
713 | LPLIOLseek pLseek; | |
714 | LPLIOLstat pLstat; | |
715 | LPLIOMktemp pMktemp; | |
716 | LPLIOOpen pOpen; | |
717 | LPLIOOpen3 pOpen3; | |
718 | LPLIORead pRead; | |
719 | LPLIORename pRename; | |
720 | LPLIOSetmode pSetmode; | |
721 | LPLIONameStat pNameStat; | |
722 | LPLIOTmpnam pTmpnam; | |
723 | LPLIOUmask pUmask; | |
724 | LPLIOUnlink pUnlink; | |
725 | LPLIOUtime pUtime; | |
726 | LPLIOWrite pWrite; | |
727 | }; | |
728 | ||
729 | struct IPerlLIOInfo | |
0f4eea8f | 730 | { |
0cb96387 GS |
731 | unsigned long nCount; /* number of entries expected */ |
732 | struct IPerlLIO perlLIOList; | |
0f4eea8f DL |
733 | }; |
734 | ||
735 | #define PerlLIO_access(file, mode) \ | |
51371543 | 736 | (*PL_LIO->pAccess)(PL_LIO, (file), (mode)) |
0f4eea8f | 737 | #define PerlLIO_chmod(file, mode) \ |
51371543 | 738 | (*PL_LIO->pChmod)(PL_LIO, (file), (mode)) |
0f4eea8f | 739 | #define PerlLIO_chown(file, owner, group) \ |
51371543 | 740 | (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group)) |
0f4eea8f | 741 | #define PerlLIO_chsize(fd, size) \ |
51371543 | 742 | (*PL_LIO->pChsize)(PL_LIO, (fd), (size)) |
0f4eea8f | 743 | #define PerlLIO_close(fd) \ |
51371543 | 744 | (*PL_LIO->pClose)(PL_LIO, (fd)) |
0f4eea8f | 745 | #define PerlLIO_dup(fd) \ |
51371543 | 746 | (*PL_LIO->pDup)(PL_LIO, (fd)) |
0f4eea8f | 747 | #define PerlLIO_dup2(fd1, fd2) \ |
51371543 | 748 | (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2)) |
0f4eea8f | 749 | #define PerlLIO_flock(fd, op) \ |
51371543 | 750 | (*PL_LIO->pFlock)(PL_LIO, (fd), (op)) |
0f4eea8f | 751 | #define PerlLIO_fstat(fd, buf) \ |
51371543 | 752 | (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf)) |
0f4eea8f | 753 | #define PerlLIO_ioctl(fd, u, buf) \ |
51371543 | 754 | (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf)) |
0f4eea8f | 755 | #define PerlLIO_isatty(fd) \ |
51371543 | 756 | (*PL_LIO->pIsatty)(PL_LIO, (fd)) |
0f4eea8f | 757 | #define PerlLIO_lseek(fd, offset, mode) \ |
51371543 | 758 | (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode)) |
0f4eea8f | 759 | #define PerlLIO_lstat(name, buf) \ |
51371543 | 760 | (*PL_LIO->pLstat)(PL_LIO, (name), (buf)) |
0f4eea8f | 761 | #define PerlLIO_mktemp(file) \ |
51371543 | 762 | (*PL_LIO->pMktemp)(PL_LIO, (file)) |
0f4eea8f | 763 | #define PerlLIO_open(file, flag) \ |
51371543 | 764 | (*PL_LIO->pOpen)(PL_LIO, (file), (flag)) |
0f4eea8f | 765 | #define PerlLIO_open3(file, flag, perm) \ |
51371543 | 766 | (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm)) |
0f4eea8f | 767 | #define PerlLIO_read(fd, buf, count) \ |
51371543 | 768 | (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count)) |
8d9b2e3c | 769 | #define PerlLIO_rename(oname, newname) \ |
51371543 | 770 | (*PL_LIO->pRename)(PL_LIO, (oname), (newname)) |
0f4eea8f | 771 | #define PerlLIO_setmode(fd, mode) \ |
51371543 | 772 | (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode)) |
0f4eea8f | 773 | #define PerlLIO_stat(name, buf) \ |
51371543 | 774 | (*PL_LIO->pNameStat)(PL_LIO, (name), (buf)) |
0f4eea8f | 775 | #define PerlLIO_tmpnam(str) \ |
51371543 | 776 | (*PL_LIO->pTmpnam)(PL_LIO, (str)) |
0f4eea8f | 777 | #define PerlLIO_umask(mode) \ |
51371543 | 778 | (*PL_LIO->pUmask)(PL_LIO, (mode)) |
0f4eea8f | 779 | #define PerlLIO_unlink(file) \ |
51371543 | 780 | (*PL_LIO->pUnlink)(PL_LIO, (file)) |
0f4eea8f | 781 | #define PerlLIO_utime(file, time) \ |
51371543 | 782 | (*PL_LIO->pUtime)(PL_LIO, (file), (time)) |
0f4eea8f | 783 | #define PerlLIO_write(fd, buf, count) \ |
51371543 | 784 | (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count)) |
0f4eea8f | 785 | |
c5be433b | 786 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
787 | |
788 | #define PerlLIO_access(file, mode) access((file), (mode)) | |
789 | #define PerlLIO_chmod(file, mode) chmod((file), (mode)) | |
790 | #define PerlLIO_chown(file, owner, grp) chown((file), (owner), (grp)) | |
791 | #define PerlLIO_chsize(fd, size) chsize((fd), (size)) | |
792 | #define PerlLIO_close(fd) close((fd)) | |
793 | #define PerlLIO_dup(fd) dup((fd)) | |
794 | #define PerlLIO_dup2(fd1, fd2) dup2((fd1), (fd2)) | |
795 | #define PerlLIO_flock(fd, op) FLOCK((fd), (op)) | |
796 | #define PerlLIO_fstat(fd, buf) Fstat((fd), (buf)) | |
797 | #define PerlLIO_ioctl(fd, u, buf) ioctl((fd), (u), (buf)) | |
798 | #define PerlLIO_isatty(fd) isatty((fd)) | |
799 | #define PerlLIO_lseek(fd, offset, mode) lseek((fd), (offset), (mode)) | |
1f47e8e2 | 800 | #define PerlLIO_stat(name, buf) Stat((name), (buf)) |
9423c6fc | 801 | #ifdef HAS_LSTAT |
1f47e8e2 | 802 | # define PerlLIO_lstat(name, buf) lstat((name), (buf)) |
9423c6fc | 803 | #else |
1f47e8e2 | 804 | # define PerlLIO_lstat(name, buf) PerlLIO_stat((name), (buf)) |
9423c6fc | 805 | #endif |
0f4eea8f DL |
806 | #define PerlLIO_mktemp(file) mktemp((file)) |
807 | #define PerlLIO_mkstemp(file) mkstemp((file)) | |
808 | #define PerlLIO_open(file, flag) open((file), (flag)) | |
809 | #define PerlLIO_open3(file, flag, perm) open((file), (flag), (perm)) | |
810 | #define PerlLIO_read(fd, buf, count) read((fd), (buf), (count)) | |
811 | #define PerlLIO_rename(old, new) rename((old), (new)) | |
812 | #define PerlLIO_setmode(fd, mode) setmode((fd), (mode)) | |
0f4eea8f DL |
813 | #define PerlLIO_tmpnam(str) tmpnam((str)) |
814 | #define PerlLIO_umask(mode) umask((mode)) | |
815 | #define PerlLIO_unlink(file) unlink((file)) | |
816 | #define PerlLIO_utime(file, time) utime((file), (time)) | |
817 | #define PerlLIO_write(fd, buf, count) write((fd), (buf), (count)) | |
818 | ||
c5be433b | 819 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
820 | |
821 | /* | |
822 | Interface for perl memory allocation | |
823 | */ | |
824 | ||
c5be433b | 825 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f | 826 | |
0cb96387 GS |
827 | /* IPerlMem */ |
828 | struct IPerlMem; | |
829 | typedef void* (*LPMemMalloc)(struct IPerlMem*, size_t); | |
830 | typedef void* (*LPMemRealloc)(struct IPerlMem*, void*, size_t); | |
831 | typedef void (*LPMemFree)(struct IPerlMem*, void*); | |
832 | ||
833 | struct IPerlMem | |
0f4eea8f | 834 | { |
0cb96387 GS |
835 | LPMemMalloc pMalloc; |
836 | LPMemRealloc pRealloc; | |
837 | LPMemFree pFree; | |
0f4eea8f DL |
838 | }; |
839 | ||
0cb96387 GS |
840 | struct IPerlMemInfo |
841 | { | |
842 | unsigned long nCount; /* number of entries expected */ | |
843 | struct IPerlMem perlMemList; | |
844 | }; | |
845 | ||
846 | #define PerlMem_malloc(size) \ | |
51371543 | 847 | (*PL_Mem->pMalloc)(PL_Mem, (size)) |
0cb96387 | 848 | #define PerlMem_realloc(buf, size) \ |
51371543 | 849 | (*PL_Mem->pRealloc)(PL_Mem, (buf), (size)) |
0cb96387 | 850 | #define PerlMem_free(buf) \ |
51371543 | 851 | (*PL_Mem->pFree)(PL_Mem, (buf)) |
0f4eea8f | 852 | |
c5be433b | 853 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
854 | |
855 | #define PerlMem_malloc(size) malloc((size)) | |
856 | #define PerlMem_realloc(buf, size) realloc((buf), (size)) | |
857 | #define PerlMem_free(buf) free((buf)) | |
858 | ||
c5be433b | 859 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
860 | |
861 | /* | |
862 | Interface for perl process functions | |
863 | */ | |
864 | ||
865 | ||
c5be433b | 866 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f DL |
867 | |
868 | #ifndef Sighandler_t | |
20ce7b12 | 869 | typedef Signal_t (*Sighandler_t) (int); |
0f4eea8f DL |
870 | #endif |
871 | #ifndef jmp_buf | |
872 | #include <setjmp.h> | |
873 | #endif | |
874 | ||
0cb96387 GS |
875 | /* IPerlProc */ |
876 | struct IPerlProc; | |
877 | typedef void (*LPProcAbort)(struct IPerlProc*); | |
878 | typedef char* (*LPProcCrypt)(struct IPerlProc*, const char*, | |
879 | const char*); | |
880 | typedef void (*LPProcExit)(struct IPerlProc*, int); | |
881 | typedef void (*LPProc_Exit)(struct IPerlProc*, int); | |
882 | typedef int (*LPProcExecl)(struct IPerlProc*, const char*, | |
883 | const char*, const char*, const char*, | |
884 | const char*); | |
885 | typedef int (*LPProcExecv)(struct IPerlProc*, const char*, | |
886 | const char*const*); | |
887 | typedef int (*LPProcExecvp)(struct IPerlProc*, const char*, | |
888 | const char*const*); | |
889 | typedef uid_t (*LPProcGetuid)(struct IPerlProc*); | |
890 | typedef uid_t (*LPProcGeteuid)(struct IPerlProc*); | |
891 | typedef gid_t (*LPProcGetgid)(struct IPerlProc*); | |
892 | typedef gid_t (*LPProcGetegid)(struct IPerlProc*); | |
893 | typedef char* (*LPProcGetlogin)(struct IPerlProc*); | |
894 | typedef int (*LPProcKill)(struct IPerlProc*, int, int); | |
895 | typedef int (*LPProcKillpg)(struct IPerlProc*, int, int); | |
896 | typedef int (*LPProcPauseProc)(struct IPerlProc*); | |
897 | typedef PerlIO* (*LPProcPopen)(struct IPerlProc*, const char*, | |
898 | const char*); | |
899 | typedef int (*LPProcPclose)(struct IPerlProc*, PerlIO*); | |
900 | typedef int (*LPProcPipe)(struct IPerlProc*, int*); | |
901 | typedef int (*LPProcSetuid)(struct IPerlProc*, uid_t); | |
902 | typedef int (*LPProcSetgid)(struct IPerlProc*, gid_t); | |
903 | typedef int (*LPProcSleep)(struct IPerlProc*, unsigned int); | |
904 | typedef int (*LPProcTimes)(struct IPerlProc*, struct tms*); | |
905 | typedef int (*LPProcWait)(struct IPerlProc*, int*); | |
906 | typedef int (*LPProcWaitpid)(struct IPerlProc*, int, int*, int); | |
907 | typedef Sighandler_t (*LPProcSignal)(struct IPerlProc*, int, Sighandler_t); | |
908 | typedef void* (*LPProcDynaLoader)(struct IPerlProc*, const char*); | |
909 | #ifdef WIN32 | |
910 | typedef void (*LPProcGetOSError)(struct IPerlProc*, | |
911 | SV* sv, DWORD dwErr); | |
912 | typedef void (*LPProcFreeBuf)(struct IPerlProc*, char*); | |
913 | typedef BOOL (*LPProcDoCmd)(struct IPerlProc*, char*); | |
914 | typedef int (*LPProcSpawn)(struct IPerlProc*, char*); | |
915 | typedef int (*LPProcSpawnvp)(struct IPerlProc*, int, const char*, | |
916 | const char*const*); | |
917 | typedef int (*LPProcASpawn)(struct IPerlProc*, void*, void**, void**); | |
918 | #endif | |
919 | ||
920 | struct IPerlProc | |
0f4eea8f | 921 | { |
0cb96387 GS |
922 | LPProcAbort pAbort; |
923 | LPProcCrypt pCrypt; | |
924 | LPProcExit pExit; | |
925 | LPProc_Exit p_Exit; | |
926 | LPProcExecl pExecl; | |
927 | LPProcExecv pExecv; | |
928 | LPProcExecvp pExecvp; | |
929 | LPProcGetuid pGetuid; | |
930 | LPProcGeteuid pGeteuid; | |
931 | LPProcGetgid pGetgid; | |
932 | LPProcGetegid pGetegid; | |
933 | LPProcGetlogin pGetlogin; | |
934 | LPProcKill pKill; | |
935 | LPProcKillpg pKillpg; | |
936 | LPProcPauseProc pPauseProc; | |
937 | LPProcPopen pPopen; | |
938 | LPProcPclose pPclose; | |
939 | LPProcPipe pPipe; | |
940 | LPProcSetuid pSetuid; | |
941 | LPProcSetgid pSetgid; | |
942 | LPProcSleep pSleep; | |
943 | LPProcTimes pTimes; | |
944 | LPProcWait pWait; | |
945 | LPProcWaitpid pWaitpid; | |
946 | LPProcSignal pSignal; | |
0f4eea8f | 947 | #ifdef WIN32 |
0cb96387 GS |
948 | LPProcDynaLoader pDynaLoader; |
949 | LPProcGetOSError pGetOSError; | |
950 | LPProcDoCmd pDoCmd; | |
951 | LPProcSpawn pSpawn; | |
952 | LPProcSpawnvp pSpawnvp; | |
953 | LPProcASpawn pASpawn; | |
0f4eea8f DL |
954 | #endif |
955 | }; | |
956 | ||
0cb96387 GS |
957 | struct IPerlProcInfo |
958 | { | |
959 | unsigned long nCount; /* number of entries expected */ | |
960 | struct IPerlProc perlProcList; | |
961 | }; | |
962 | ||
963 | #define PerlProc_abort() \ | |
51371543 | 964 | (*PL_Proc->pAbort)(PL_Proc) |
0cb96387 | 965 | #define PerlProc_crypt(c,s) \ |
51371543 | 966 | (*PL_Proc->pCrypt)(PL_Proc, (c), (s)) |
0cb96387 | 967 | #define PerlProc_exit(s) \ |
51371543 | 968 | (*PL_Proc->pExit)(PL_Proc, (s)) |
0cb96387 | 969 | #define PerlProc__exit(s) \ |
51371543 | 970 | (*PL_Proc->p_Exit)(PL_Proc, (s)) |
0f4eea8f | 971 | #define PerlProc_execl(c, w, x, y, z) \ |
51371543 | 972 | (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z)) |
0cb96387 | 973 | #define PerlProc_execv(c, a) \ |
51371543 | 974 | (*PL_Proc->pExecv)(PL_Proc, (c), (a)) |
0cb96387 | 975 | #define PerlProc_execvp(c, a) \ |
51371543 | 976 | (*PL_Proc->pExecvp)(PL_Proc, (c), (a)) |
0cb96387 | 977 | #define PerlProc_getuid() \ |
51371543 | 978 | (*PL_Proc->pGetuid)(PL_Proc) |
0cb96387 | 979 | #define PerlProc_geteuid() \ |
51371543 | 980 | (*PL_Proc->pGeteuid)(PL_Proc) |
0cb96387 | 981 | #define PerlProc_getgid() \ |
51371543 | 982 | (*PL_Proc->pGetgid)(PL_Proc) |
0cb96387 | 983 | #define PerlProc_getegid() \ |
51371543 | 984 | (*PL_Proc->pGetegid)(PL_Proc) |
0cb96387 | 985 | #define PerlProc_getlogin() \ |
51371543 | 986 | (*PL_Proc->pGetlogin)(PL_Proc) |
0cb96387 | 987 | #define PerlProc_kill(i, a) \ |
51371543 | 988 | (*PL_Proc->pKill)(PL_Proc, (i), (a)) |
0cb96387 | 989 | #define PerlProc_killpg(i, a) \ |
51371543 | 990 | (*PL_Proc->pKillpg)(PL_Proc, (i), (a)) |
0cb96387 | 991 | #define PerlProc_pause() \ |
51371543 | 992 | (*PL_Proc->pPauseProc)(PL_Proc) |
0cb96387 | 993 | #define PerlProc_popen(c, m) \ |
51371543 | 994 | (*PL_Proc->pPopen)(PL_Proc, (c), (m)) |
0cb96387 | 995 | #define PerlProc_pclose(f) \ |
51371543 | 996 | (*PL_Proc->pPclose)(PL_Proc, (f)) |
0cb96387 | 997 | #define PerlProc_pipe(fd) \ |
51371543 | 998 | (*PL_Proc->pPipe)(PL_Proc, (fd)) |
0cb96387 | 999 | #define PerlProc_setuid(u) \ |
51371543 | 1000 | (*PL_Proc->pSetuid)(PL_Proc, (u)) |
0cb96387 | 1001 | #define PerlProc_setgid(g) \ |
51371543 | 1002 | (*PL_Proc->pSetgid)(PL_Proc, (g)) |
0cb96387 | 1003 | #define PerlProc_sleep(t) \ |
51371543 | 1004 | (*PL_Proc->pSleep)(PL_Proc, (t)) |
0cb96387 | 1005 | #define PerlProc_times(t) \ |
51371543 | 1006 | (*PL_Proc->pTimes)(PL_Proc, (t)) |
0cb96387 | 1007 | #define PerlProc_wait(t) \ |
51371543 | 1008 | (*PL_Proc->pWait)(PL_Proc, (t)) |
0cb96387 | 1009 | #define PerlProc_waitpid(p,s,f) \ |
51371543 | 1010 | (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f)) |
0cb96387 | 1011 | #define PerlProc_signal(n, h) \ |
51371543 | 1012 | (*PL_Proc->pSignal)(PL_Proc, (n), (h)) |
0cb96387 GS |
1013 | #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n)) |
1014 | #define PerlProc_longjmp(b, n) Siglongjmp((b), (n)) | |
0f4eea8f DL |
1015 | |
1016 | #ifdef WIN32 | |
0cb96387 | 1017 | #define PerlProc_DynaLoad(f) \ |
51371543 | 1018 | (*PL_Proc->pDynaLoader)(PL_Proc, (f)) |
0cb96387 | 1019 | #define PerlProc_GetOSError(s,e) \ |
51371543 | 1020 | (*PL_Proc->pGetOSError)(PL_Proc, (s), (e)) |
0cb96387 | 1021 | #define PerlProc_Cmd(s) \ |
51371543 | 1022 | (*PL_Proc->pDoCmd)(PL_Proc, (s)) |
0cb96387 | 1023 | #define do_spawn(s) \ |
51371543 | 1024 | (*PL_Proc->pSpawn)(PL_Proc, (s)) |
0cb96387 | 1025 | #define do_spawnvp(m, c, a) \ |
51371543 | 1026 | (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a)) |
0cb96387 | 1027 | #define PerlProc_aspawn(m,c,a) \ |
51371543 | 1028 | (*PL_Proc->pASpawn)(PL_Proc, (m), (c), (a)) |
0f4eea8f DL |
1029 | #endif |
1030 | ||
c5be433b | 1031 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
1032 | |
1033 | #define PerlProc_abort() abort() | |
ff95b63e | 1034 | #define PerlProc_crypt(c,s) crypt((c), (s)) |
0f4eea8f DL |
1035 | #define PerlProc_exit(s) exit((s)) |
1036 | #define PerlProc__exit(s) _exit((s)) | |
1037 | #define PerlProc_execl(c,w,x,y,z) \ | |
1038 | execl((c), (w), (x), (y), (z)) | |
1039 | #define PerlProc_execv(c, a) execv((c), (a)) | |
1040 | #define PerlProc_execvp(c, a) execvp((c), (a)) | |
1041 | #define PerlProc_getuid() getuid() | |
1042 | #define PerlProc_geteuid() geteuid() | |
1043 | #define PerlProc_getgid() getgid() | |
1044 | #define PerlProc_getegid() getegid() | |
1045 | #define PerlProc_getlogin() getlogin() | |
1046 | #define PerlProc_kill(i, a) kill((i), (a)) | |
1047 | #define PerlProc_killpg(i, a) killpg((i), (a)) | |
1048 | #define PerlProc_pause() Pause() | |
1049 | #define PerlProc_popen(c, m) my_popen((c), (m)) | |
1050 | #define PerlProc_pclose(f) my_pclose((f)) | |
1051 | #define PerlProc_pipe(fd) pipe((fd)) | |
1052 | #define PerlProc_setuid(u) setuid((u)) | |
1053 | #define PerlProc_setgid(g) setgid((g)) | |
1054 | #define PerlProc_sleep(t) sleep((t)) | |
1055 | #define PerlProc_times(t) times((t)) | |
1056 | #define PerlProc_wait(t) wait((t)) | |
1057 | #define PerlProc_waitpid(p,s,f) waitpid((p), (s), (f)) | |
1058 | #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n)) | |
1059 | #define PerlProc_longjmp(b, n) Siglongjmp((b), (n)) | |
1060 | #define PerlProc_signal(n, h) signal((n), (h)) | |
1061 | ||
0cb96387 GS |
1062 | #ifdef WIN32 |
1063 | #define PerlProc_DynaLoad(f) \ | |
c5be433b | 1064 | win32_dynaload((f)) |
0cb96387 | 1065 | #define PerlProc_GetOSError(s,e) \ |
c5be433b | 1066 | win32_str_os_error((s), (e)) |
0cb96387 | 1067 | #endif |
c5be433b | 1068 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
1069 | |
1070 | /* | |
1071 | Interface for perl socket functions | |
1072 | */ | |
1073 | ||
c5be433b | 1074 | #if defined(PERL_IMPLICIT_SYS) |
0f4eea8f | 1075 | |
0cb96387 GS |
1076 | /* PerlSock */ |
1077 | struct IPerlSock; | |
1078 | typedef u_long (*LPHtonl)(struct IPerlSock*, u_long); | |
1079 | typedef u_short (*LPHtons)(struct IPerlSock*, u_short); | |
1080 | typedef u_long (*LPNtohl)(struct IPerlSock*, u_long); | |
1081 | typedef u_short (*LPNtohs)(struct IPerlSock*, u_short); | |
1082 | typedef SOCKET (*LPAccept)(struct IPerlSock*, SOCKET, | |
1083 | struct sockaddr*, int*); | |
1084 | typedef int (*LPBind)(struct IPerlSock*, SOCKET, | |
1085 | const struct sockaddr*, int); | |
1086 | typedef int (*LPConnect)(struct IPerlSock*, SOCKET, | |
1087 | const struct sockaddr*, int); | |
1088 | typedef void (*LPEndhostent)(struct IPerlSock*); | |
1089 | typedef void (*LPEndnetent)(struct IPerlSock*); | |
1090 | typedef void (*LPEndprotoent)(struct IPerlSock*); | |
1091 | typedef void (*LPEndservent)(struct IPerlSock*); | |
1092 | typedef int (*LPGethostname)(struct IPerlSock*, char*, int); | |
1093 | typedef int (*LPGetpeername)(struct IPerlSock*, SOCKET, | |
1094 | struct sockaddr*, int*); | |
1095 | typedef struct hostent* (*LPGethostbyaddr)(struct IPerlSock*, const char*, | |
1096 | int, int); | |
1097 | typedef struct hostent* (*LPGethostbyname)(struct IPerlSock*, const char*); | |
1098 | typedef struct hostent* (*LPGethostent)(struct IPerlSock*); | |
1099 | typedef struct netent* (*LPGetnetbyaddr)(struct IPerlSock*, long, int); | |
1100 | typedef struct netent* (*LPGetnetbyname)(struct IPerlSock*, const char*); | |
1101 | typedef struct netent* (*LPGetnetent)(struct IPerlSock*); | |
1102 | typedef struct protoent*(*LPGetprotobyname)(struct IPerlSock*, const char*); | |
1103 | typedef struct protoent*(*LPGetprotobynumber)(struct IPerlSock*, int); | |
1104 | typedef struct protoent*(*LPGetprotoent)(struct IPerlSock*); | |
1105 | typedef struct servent* (*LPGetservbyname)(struct IPerlSock*, const char*, | |
1106 | const char*); | |
1107 | typedef struct servent* (*LPGetservbyport)(struct IPerlSock*, int, | |
1108 | const char*); | |
1109 | typedef struct servent* (*LPGetservent)(struct IPerlSock*); | |
1110 | typedef int (*LPGetsockname)(struct IPerlSock*, SOCKET, | |
1111 | struct sockaddr*, int*); | |
1112 | typedef int (*LPGetsockopt)(struct IPerlSock*, SOCKET, int, int, | |
1113 | char*, int*); | |
1114 | typedef unsigned long (*LPInetAddr)(struct IPerlSock*, const char*); | |
1115 | typedef char* (*LPInetNtoa)(struct IPerlSock*, struct in_addr); | |
1116 | typedef int (*LPListen)(struct IPerlSock*, SOCKET, int); | |
1117 | typedef int (*LPRecv)(struct IPerlSock*, SOCKET, char*, int, int); | |
1118 | typedef int (*LPRecvfrom)(struct IPerlSock*, SOCKET, char*, int, | |
1119 | int, struct sockaddr*, int*); | |
1120 | typedef int (*LPSelect)(struct IPerlSock*, int, char*, char*, | |
1121 | char*, const struct timeval*); | |
1122 | typedef int (*LPSend)(struct IPerlSock*, SOCKET, const char*, int, | |
1123 | int); | |
1124 | typedef int (*LPSendto)(struct IPerlSock*, SOCKET, const char*, | |
1125 | int, int, const struct sockaddr*, int); | |
1126 | typedef void (*LPSethostent)(struct IPerlSock*, int); | |
1127 | typedef void (*LPSetnetent)(struct IPerlSock*, int); | |
1128 | typedef void (*LPSetprotoent)(struct IPerlSock*, int); | |
1129 | typedef void (*LPSetservent)(struct IPerlSock*, int); | |
1130 | typedef int (*LPSetsockopt)(struct IPerlSock*, SOCKET, int, int, | |
1131 | const char*, int); | |
1132 | typedef int (*LPShutdown)(struct IPerlSock*, SOCKET, int); | |
1133 | typedef SOCKET (*LPSocket)(struct IPerlSock*, int, int, int); | |
1134 | typedef int (*LPSocketpair)(struct IPerlSock*, int, int, int, | |
1135 | int*); | |
1136 | #ifdef WIN32 | |
1137 | typedef int (*LPClosesocket)(struct IPerlSock*, SOCKET s); | |
1138 | #endif | |
1139 | ||
1140 | struct IPerlSock | |
0f4eea8f | 1141 | { |
0cb96387 GS |
1142 | LPHtonl pHtonl; |
1143 | LPHtons pHtons; | |
1144 | LPNtohl pNtohl; | |
1145 | LPNtohs pNtohs; | |
1146 | LPAccept pAccept; | |
1147 | LPBind pBind; | |
1148 | LPConnect pConnect; | |
1149 | LPEndhostent pEndhostent; | |
1150 | LPEndnetent pEndnetent; | |
1151 | LPEndprotoent pEndprotoent; | |
1152 | LPEndservent pEndservent; | |
1153 | LPGethostname pGethostname; | |
1154 | LPGetpeername pGetpeername; | |
1155 | LPGethostbyaddr pGethostbyaddr; | |
1156 | LPGethostbyname pGethostbyname; | |
1157 | LPGethostent pGethostent; | |
1158 | LPGetnetbyaddr pGetnetbyaddr; | |
1159 | LPGetnetbyname pGetnetbyname; | |
1160 | LPGetnetent pGetnetent; | |
1161 | LPGetprotobyname pGetprotobyname; | |
1162 | LPGetprotobynumber pGetprotobynumber; | |
1163 | LPGetprotoent pGetprotoent; | |
1164 | LPGetservbyname pGetservbyname; | |
1165 | LPGetservbyport pGetservbyport; | |
1166 | LPGetservent pGetservent; | |
1167 | LPGetsockname pGetsockname; | |
1168 | LPGetsockopt pGetsockopt; | |
1169 | LPInetAddr pInetAddr; | |
1170 | LPInetNtoa pInetNtoa; | |
1171 | LPListen pListen; | |
1172 | LPRecv pRecv; | |
1173 | LPRecvfrom pRecvfrom; | |
1174 | LPSelect pSelect; | |
1175 | LPSend pSend; | |
1176 | LPSendto pSendto; | |
1177 | LPSethostent pSethostent; | |
1178 | LPSetnetent pSetnetent; | |
1179 | LPSetprotoent pSetprotoent; | |
1180 | LPSetservent pSetservent; | |
1181 | LPSetsockopt pSetsockopt; | |
1182 | LPShutdown pShutdown; | |
1183 | LPSocket pSocket; | |
1184 | LPSocketpair pSocketpair; | |
0f4eea8f | 1185 | #ifdef WIN32 |
0cb96387 | 1186 | LPClosesocket pClosesocket; |
0f4eea8f DL |
1187 | #endif |
1188 | }; | |
1189 | ||
0cb96387 GS |
1190 | struct IPerlSockInfo |
1191 | { | |
1192 | unsigned long nCount; /* number of entries expected */ | |
1193 | struct IPerlSock perlSockList; | |
1194 | }; | |
1195 | ||
1196 | #define PerlSock_htonl(x) \ | |
51371543 | 1197 | (*PL_Sock->pHtonl)(PL_Sock, x) |
0cb96387 | 1198 | #define PerlSock_htons(x) \ |
51371543 | 1199 | (*PL_Sock->pHtons)(PL_Sock, x) |
0cb96387 | 1200 | #define PerlSock_ntohl(x) \ |
51371543 | 1201 | (*PL_Sock->pNtohl)(PL_Sock, x) |
0cb96387 | 1202 | #define PerlSock_ntohs(x) \ |
51371543 | 1203 | (*PL_Sock->pNtohs)(PL_Sock, x) |
0cb96387 | 1204 | #define PerlSock_accept(s, a, l) \ |
51371543 | 1205 | (*PL_Sock->pAccept)(PL_Sock, s, a, l) |
0cb96387 | 1206 | #define PerlSock_bind(s, n, l) \ |
51371543 | 1207 | (*PL_Sock->pBind)(PL_Sock, s, n, l) |
0cb96387 | 1208 | #define PerlSock_connect(s, n, l) \ |
51371543 | 1209 | (*PL_Sock->pConnect)(PL_Sock, s, n, l) |
0cb96387 | 1210 | #define PerlSock_endhostent() \ |
51371543 | 1211 | (*PL_Sock->pEndhostent)(PL_Sock) |
0cb96387 | 1212 | #define PerlSock_endnetent() \ |
51371543 | 1213 | (*PL_Sock->pEndnetent)(PL_Sock) |
0cb96387 | 1214 | #define PerlSock_endprotoent() \ |
51371543 | 1215 | (*PL_Sock->pEndprotoent)(PL_Sock) |
0cb96387 | 1216 | #define PerlSock_endservent() \ |
51371543 | 1217 | (*PL_Sock->pEndservent)(PL_Sock) |
0cb96387 | 1218 | #define PerlSock_gethostbyaddr(a, l, t) \ |
51371543 | 1219 | (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t) |
0cb96387 | 1220 | #define PerlSock_gethostbyname(n) \ |
51371543 | 1221 | (*PL_Sock->pGethostbyname)(PL_Sock, n) |
0cb96387 | 1222 | #define PerlSock_gethostent() \ |
51371543 | 1223 | (*PL_Sock->pGethostent)(PL_Sock) |
0cb96387 | 1224 | #define PerlSock_gethostname(n, l) \ |
51371543 | 1225 | (*PL_Sock->pGethostname)(PL_Sock, n, l) |
0cb96387 | 1226 | #define PerlSock_getnetbyaddr(n, t) \ |
51371543 | 1227 | (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t) |
0cb96387 | 1228 | #define PerlSock_getnetbyname(c) \ |
51371543 | 1229 | (*PL_Sock->pGetnetbyname)(PL_Sock, c) |
0cb96387 | 1230 | #define PerlSock_getnetent() \ |
51371543 | 1231 | (*PL_Sock->pGetnetent)(PL_Sock) |
0cb96387 | 1232 | #define PerlSock_getpeername(s, n, l) \ |
51371543 | 1233 | (*PL_Sock->pGetpeername)(PL_Sock, s, n, l) |
0cb96387 | 1234 | #define PerlSock_getprotobyname(n) \ |
51371543 | 1235 | (*PL_Sock->pGetprotobyname)(PL_Sock, n) |
0cb96387 | 1236 | #define PerlSock_getprotobynumber(n) \ |
51371543 | 1237 | (*PL_Sock->pGetprotobynumber)(PL_Sock, n) |
0cb96387 | 1238 | #define PerlSock_getprotoent() \ |
51371543 | 1239 | (*PL_Sock->pGetprotoent)(PL_Sock) |
0cb96387 | 1240 | #define PerlSock_getservbyname(n, p) \ |
51371543 | 1241 | (*PL_Sock->pGetservbyname)(PL_Sock, n, p) |
0cb96387 | 1242 | #define PerlSock_getservbyport(port, p) \ |
51371543 | 1243 | (*PL_Sock->pGetservbyport)(PL_Sock, port, p) |
0cb96387 | 1244 | #define PerlSock_getservent() \ |
51371543 | 1245 | (*PL_Sock->pGetservent)(PL_Sock) |
0cb96387 | 1246 | #define PerlSock_getsockname(s, n, l) \ |
51371543 | 1247 | (*PL_Sock->pGetsockname)(PL_Sock, s, n, l) |
0cb96387 | 1248 | #define PerlSock_getsockopt(s,l,n,v,i) \ |
51371543 | 1249 | (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i) |
0cb96387 | 1250 | #define PerlSock_inet_addr(c) \ |
51371543 | 1251 | (*PL_Sock->pInetAddr)(PL_Sock, c) |
0cb96387 | 1252 | #define PerlSock_inet_ntoa(i) \ |
51371543 | 1253 | (*PL_Sock->pInetNtoa)(PL_Sock, i) |
0cb96387 | 1254 | #define PerlSock_listen(s, b) \ |
51371543 | 1255 | (*PL_Sock->pListen)(PL_Sock, s, b) |
0cb96387 | 1256 | #define PerlSock_recv(s, b, l, f) \ |
51371543 | 1257 | (*PL_Sock->pRecv)(PL_Sock, s, b, l, f) |
0f4eea8f | 1258 | #define PerlSock_recvfrom(s,b,l,f,from,fromlen) \ |
51371543 | 1259 | (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen) |
0f4eea8f | 1260 | #define PerlSock_select(n, r, w, e, t) \ |
51371543 | 1261 | (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t) |
0cb96387 | 1262 | #define PerlSock_send(s, b, l, f) \ |
51371543 | 1263 | (*PL_Sock->pSend)(PL_Sock, s, b, l, f) |
0f4eea8f | 1264 | #define PerlSock_sendto(s, b, l, f, t, tlen) \ |
51371543 | 1265 | (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen) |
0cb96387 | 1266 | #define PerlSock_sethostent(f) \ |
51371543 | 1267 | (*PL_Sock->pSethostent)(PL_Sock, f) |
0cb96387 | 1268 | #define PerlSock_setnetent(f) \ |
51371543 | 1269 | (*PL_Sock->pSetnetent)(PL_Sock, f) |
0cb96387 | 1270 | #define PerlSock_setprotoent(f) \ |
51371543 | 1271 | (*PL_Sock->pSetprotoent)(PL_Sock, f) |
0cb96387 | 1272 | #define PerlSock_setservent(f) \ |
51371543 | 1273 | (*PL_Sock->pSetservent)(PL_Sock, f) |
0f4eea8f | 1274 | #define PerlSock_setsockopt(s, l, n, v, len) \ |
51371543 | 1275 | (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len) |
0cb96387 | 1276 | #define PerlSock_shutdown(s, h) \ |
51371543 | 1277 | (*PL_Sock->pShutdown)(PL_Sock, s, h) |
0cb96387 | 1278 | #define PerlSock_socket(a, t, p) \ |
51371543 | 1279 | (*PL_Sock->pSocket)(PL_Sock, a, t, p) |
0cb96387 | 1280 | #define PerlSock_socketpair(a, t, p, f) \ |
51371543 | 1281 | (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f) |
0cb96387 GS |
1282 | |
1283 | #ifdef WIN32 | |
1284 | #define PerlSock_closesocket(s) \ | |
51371543 | 1285 | (*PL_Sock->pClosesocket)(PL_Sock, s) |
0cb96387 | 1286 | #endif |
0f4eea8f | 1287 | |
c5be433b | 1288 | #else /* PERL_IMPLICIT_SYS */ |
0f4eea8f DL |
1289 | |
1290 | #define PerlSock_htonl(x) htonl(x) | |
1291 | #define PerlSock_htons(x) htons(x) | |
1292 | #define PerlSock_ntohl(x) ntohl(x) | |
1293 | #define PerlSock_ntohs(x) ntohs(x) | |
1294 | #define PerlSock_accept(s, a, l) accept(s, a, l) | |
1295 | #define PerlSock_bind(s, n, l) bind(s, n, l) | |
1296 | #define PerlSock_connect(s, n, l) connect(s, n, l) | |
1297 | ||
1298 | #define PerlSock_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t) | |
1299 | #define PerlSock_gethostbyname(n) gethostbyname(n) | |
1300 | #define PerlSock_gethostent gethostent | |
1301 | #define PerlSock_endhostent endhostent | |
1302 | #define PerlSock_gethostname(n, l) gethostname(n, l) | |
1303 | ||
1304 | #define PerlSock_getnetbyaddr(n, t) getnetbyaddr(n, t) | |
1305 | #define PerlSock_getnetbyname(n) getnetbyname(n) | |
1306 | #define PerlSock_getnetent getnetent | |
1307 | #define PerlSock_endnetent endnetent | |
1308 | #define PerlSock_getpeername(s, n, l) getpeername(s, n, l) | |
1309 | ||
1310 | #define PerlSock_getprotobyname(n) getprotobyname(n) | |
1311 | #define PerlSock_getprotobynumber(n) getprotobynumber(n) | |
1312 | #define PerlSock_getprotoent getprotoent | |
1313 | #define PerlSock_endprotoent endprotoent | |
1314 | ||
1315 | #define PerlSock_getservbyname(n, p) getservbyname(n, p) | |
1316 | #define PerlSock_getservbyport(port, p) getservbyport(port, p) | |
1317 | #define PerlSock_getservent getservent | |
1318 | #define PerlSock_endservent endservent | |
1319 | ||
1320 | #define PerlSock_getsockname(s, n, l) getsockname(s, n, l) | |
1321 | #define PerlSock_getsockopt(s,l,n,v,i) getsockopt(s, l, n, v, i) | |
1322 | #define PerlSock_inet_addr(c) inet_addr(c) | |
1323 | #define PerlSock_inet_ntoa(i) inet_ntoa(i) | |
1324 | #define PerlSock_listen(s, b) listen(s, b) | |
c6af7a1a | 1325 | #define PerlSock_recv(s, b, l, f) recv(s, b, l, f) |
0f4eea8f DL |
1326 | #define PerlSock_recvfrom(s, b, l, f, from, fromlen) \ |
1327 | recvfrom(s, b, l, f, from, fromlen) | |
1328 | #define PerlSock_select(n, r, w, e, t) select(n, r, w, e, t) | |
1329 | #define PerlSock_send(s, b, l, f) send(s, b, l, f) | |
1330 | #define PerlSock_sendto(s, b, l, f, t, tlen) \ | |
1331 | sendto(s, b, l, f, t, tlen) | |
1332 | #define PerlSock_sethostent(f) sethostent(f) | |
1333 | #define PerlSock_setnetent(f) setnetent(f) | |
1334 | #define PerlSock_setprotoent(f) setprotoent(f) | |
1335 | #define PerlSock_setservent(f) setservent(f) | |
1336 | #define PerlSock_setsockopt(s, l, n, v, len) \ | |
1337 | setsockopt(s, l, n, v, len) | |
1338 | #define PerlSock_shutdown(s, h) shutdown(s, h) | |
1339 | #define PerlSock_socket(a, t, p) socket(a, t, p) | |
1340 | #define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f) | |
1341 | ||
0cb96387 GS |
1342 | #ifdef WIN32 |
1343 | #define PerlSock_closesocket(s) closesocket(s) | |
1344 | #endif | |
0f4eea8f | 1345 | |
c5be433b | 1346 | #endif /* PERL_IMPLICIT_SYS */ |
0f4eea8f | 1347 | |
de4597cb JH |
1348 | /* Mention |
1349 | ||
1350 | HAS_READV | |
1351 | HAS_RECVMSG | |
1352 | HAS_SENDMSG | |
1353 | HAS_WRITEV | |
1354 | HAS_STRUCT_MSGHDR | |
1355 | HAS_STRUCT_CMSGHDR | |
de4597cb JH |
1356 | |
1357 | here so that Configure picks them up. Perl core does not | |
6b1016b5 JH |
1358 | use them but somebody might want to extend Socket:: or IO:: |
1359 | someday. | |
de4597cb JH |
1360 | |
1361 | Jarkko Hietaniemi November 1998 | |
1362 | ||
1363 | */ | |
1364 | ||
0f4eea8f DL |
1365 | #endif /* __Inc__IPerl___ */ |
1366 |