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