2 * iperlsys.h - Perl's interface to the system
4 * This file defines the system level functionality that perl needs.
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
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.
18 #ifndef __Inc__IPerl___
19 #define __Inc__IPerl___
22 * PerlXXX_YYY explained - DickH and DougL @ ActiveState.com
24 * XXX := functional group
25 * YYY := stdlib/OS function name
27 * Continuing with the theme of PerlIO, all OS functionality was
28 * encapsulated into one of several interfaces.
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
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.
47 * What was changed to do this:
48 * 1. All calls to OS functions were replaced with PerlXXX_YYY
53 Interface for perl stdio functions, or whatever we are Configure-d
59 typedef Signal_t (*Sighandler_t) (int);
62 #if defined(PERL_IMPLICIT_SYS)
66 struct IPerlStdIOInfo;
67 typedef FILE* (*LPStdin)(struct IPerlStdIO*);
68 typedef FILE* (*LPStdout)(struct IPerlStdIO*);
69 typedef FILE* (*LPStderr)(struct IPerlStdIO*);
70 typedef FILE* (*LPOpen)(struct IPerlStdIO*, const char*,
72 typedef int (*LPClose)(struct IPerlStdIO*, FILE*);
73 typedef int (*LPEof)(struct IPerlStdIO*, FILE*);
74 typedef int (*LPError)(struct IPerlStdIO*, FILE*);
75 typedef void (*LPClearerr)(struct IPerlStdIO*, FILE*);
76 typedef int (*LPGetc)(struct IPerlStdIO*, FILE*);
77 typedef char* (*LPGetBase)(struct IPerlStdIO*, FILE*);
78 typedef int (*LPGetBufsiz)(struct IPerlStdIO*, FILE*);
79 typedef int (*LPGetCnt)(struct IPerlStdIO*, FILE*);
80 typedef char* (*LPGetPtr)(struct IPerlStdIO*, FILE*);
81 typedef char* (*LPGets)(struct IPerlStdIO*, FILE*, char*, int);
82 typedef int (*LPPutc)(struct IPerlStdIO*, FILE*, int);
83 typedef int (*LPPuts)(struct IPerlStdIO*, FILE*, const char*);
84 typedef int (*LPFlush)(struct IPerlStdIO*, FILE*);
85 typedef int (*LPUngetc)(struct IPerlStdIO*, int,FILE*);
86 typedef int (*LPFileno)(struct IPerlStdIO*, FILE*);
87 typedef FILE* (*LPFdopen)(struct IPerlStdIO*, int, const char*);
88 typedef FILE* (*LPReopen)(struct IPerlStdIO*, const char*,
90 typedef SSize_t (*LPRead)(struct IPerlStdIO*, void*, Size_t, Size_t, FILE *);
91 typedef SSize_t (*LPWrite)(struct IPerlStdIO*, const void*, Size_t, Size_t, FILE *);
92 typedef void (*LPSetBuf)(struct IPerlStdIO*, FILE*, char*);
93 typedef int (*LPSetVBuf)(struct IPerlStdIO*, FILE*, char*, int,
95 typedef void (*LPSetCnt)(struct IPerlStdIO*, FILE*, int);
96 typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, char*);
97 typedef void (*LPSetlinebuf)(struct IPerlStdIO*, FILE*);
98 typedef int (*LPPrintf)(struct IPerlStdIO*, FILE*, const char*,
100 typedef int (*LPVprintf)(struct IPerlStdIO*, FILE*, const char*,
102 typedef long (*LPTell)(struct IPerlStdIO*, FILE*);
103 typedef int (*LPSeek)(struct IPerlStdIO*, FILE*, Off_t, int);
104 typedef void (*LPRewind)(struct IPerlStdIO*, FILE*);
105 typedef FILE* (*LPTmpfile)(struct IPerlStdIO*);
106 typedef int (*LPGetpos)(struct IPerlStdIO*, FILE*, Fpos_t*);
107 typedef int (*LPSetpos)(struct IPerlStdIO*, FILE*,
109 typedef void (*LPInit)(struct IPerlStdIO*);
110 typedef void (*LPInitOSExtras)(struct IPerlStdIO*);
111 typedef FILE* (*LPFdupopen)(struct IPerlStdIO*, FILE*);
122 LPClearerr pClearerr;
125 LPGetBufsiz pGetBufsiz;
142 LPSetlinebuf pSetlinebuf;
152 LPInitOSExtras pInitOSExtras;
153 LPFdupopen pFdupopen;
156 struct IPerlStdIOInfo
158 unsigned long nCount; /* number of entries expected */
159 struct IPerlStdIO perlStdIOList;
162 /* These do not belong here ... NI-S, 14 Nov 2000 */
165 # define PerlSIO_has_cntptr(f) 1
166 # ifdef STDIO_PTR_LVALUE
167 # ifdef STDIO_CNT_LVALUE
168 # define PerlSIO_canset_cnt(f) 1
169 # ifdef STDIO_PTR_LVAL_NOCHANGE_CNT
170 # define PerlSIO_fast_gets(f) 1
172 # else /* STDIO_CNT_LVALUE */
173 # define PerlSIO_canset_cnt(f) 0
175 # else /* STDIO_PTR_LVALUE */
176 # ifdef STDIO_PTR_LVAL_SETS_CNT
177 # define PerlSIO_fast_gets(f) 1
180 #else /* USE_STDIO_PTR */
181 # define PerlSIO_has_cntptr(f) 0
182 # define PerlSIO_canset_cnt(f) 0
183 #endif /* USE_STDIO_PTR */
185 #ifndef PerlSIO_fast_gets
186 #define PerlSIO_fast_gets(f) 0
190 #define PerlSIO_has_base(f) 1
192 #define PerlSIO_has_base(f) 0
195 /* Now take FILE * via function table */
197 #define PerlSIO_stdin \
198 (*PL_StdIO->pStdin)(PL_StdIO)
199 #define PerlSIO_stdout \
200 (*PL_StdIO->pStdout)(PL_StdIO)
201 #define PerlSIO_stderr \
202 (*PL_StdIO->pStderr)(PL_StdIO)
203 #define PerlSIO_fopen(x,y) \
204 (*PL_StdIO->pOpen)(PL_StdIO, (x),(y))
205 #define PerlSIO_fclose(f) \
206 (*PL_StdIO->pClose)(PL_StdIO, (f))
207 #define PerlSIO_feof(f) \
208 (*PL_StdIO->pEof)(PL_StdIO, (f))
209 #define PerlSIO_ferror(f) \
210 (*PL_StdIO->pError)(PL_StdIO, (f))
211 #define PerlSIO_clearerr(f) \
212 (*PL_StdIO->pClearerr)(PL_StdIO, (f))
213 #define PerlSIO_fgetc(f) \
214 (*PL_StdIO->pGetc)(PL_StdIO, (f))
215 #define PerlSIO_get_base(f) \
216 (*PL_StdIO->pGetBase)(PL_StdIO, (f))
217 #define PerlSIO_get_bufsiz(f) \
218 (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f))
219 #define PerlSIO_get_cnt(f) \
220 (*PL_StdIO->pGetCnt)(PL_StdIO, (f))
221 #define PerlSIO_get_ptr(f) \
222 (*PL_StdIO->pGetPtr)(PL_StdIO, (f))
223 #define PerlSIO_fputc(f,c) \
224 (*PL_StdIO->pPutc)(PL_StdIO, (f),(c))
225 #define PerlSIO_fputs(f,s) \
226 (*PL_StdIO->pPuts)(PL_StdIO, (f),(s))
227 #define PerlSIO_fflush(f) \
228 (*PL_StdIO->pFlush)(PL_StdIO, (f))
229 #define PerlSIO_fgets(s, n, fp) \
230 (*PL_StdIO->pGets)(PL_StdIO, (fp), s, n)
231 #define PerlSIO_ungetc(c,f) \
232 (*PL_StdIO->pUngetc)(PL_StdIO, (c),(f))
233 #define PerlSIO_fileno(f) \
234 (*PL_StdIO->pFileno)(PL_StdIO, (f))
235 #define PerlSIO_fdopen(f, s) \
236 (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s))
237 #define PerlSIO_freopen(p, m, f) \
238 (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f))
239 #define PerlSIO_fread(buf,sz,count,f) \
240 (*PL_StdIO->pRead)(PL_StdIO, (buf), (sz), (count), (f))
241 #define PerlSIO_fwrite(buf,sz,count,f) \
242 (*PL_StdIO->pWrite)(PL_StdIO, (buf), (sz), (count), (f))
243 #define PerlSIO_setbuf(f,b) \
244 (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b))
245 #define PerlSIO_setvbuf(f,b,t,s) \
246 (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s))
247 #define PerlSIO_set_cnt(f,c) \
248 (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c))
249 #define PerlSIO_set_ptr(f,p) \
250 (*PL_StdIO->pSetPtr)(PL_StdIO, (f), (p))
251 #define PerlSIO_setlinebuf(f) \
252 (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f))
253 #define PerlSIO_printf Perl_fprintf_nocontext
254 #define PerlSIO_stdoutf Perl_printf_nocontext
255 #define PerlSIO_vprintf(f,fmt,a) \
256 (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a)
257 #define PerlSIO_ftell(f) \
258 (*PL_StdIO->pTell)(PL_StdIO, (f))
259 #define PerlSIO_fseek(f,o,w) \
260 (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w))
261 #define PerlSIO_fgetpos(f,p) \
262 (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p))
263 #define PerlSIO_fsetpos(f,p) \
264 (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p))
265 #define PerlSIO_rewind(f) \
266 (*PL_StdIO->pRewind)(PL_StdIO, (f))
267 #define PerlSIO_tmpfile() \
268 (*PL_StdIO->pTmpfile)(PL_StdIO)
269 #define PerlSIO_init() \
270 (*PL_StdIO->pInit)(PL_StdIO)
271 #undef init_os_extras
272 #define init_os_extras() \
273 (*PL_StdIO->pInitOSExtras)(PL_StdIO)
274 #define PerlSIO_fdupopen(f) \
275 (*PL_StdIO->pFdupopen)(PL_StdIO, (f))
277 #else /* PERL_IMPLICIT_SYS */
279 #define PerlSIO_stdin stdin
280 #define PerlSIO_stdout stdout
281 #define PerlSIO_stderr stderr
282 #define PerlSIO_fopen(x,y) fopen(x,y)
283 #define PerlSIO_fclose(f) fclose(f)
284 #define PerlSIO_feof(f) feof(f)
285 #define PerlSIO_ferror(f) ferror(f)
286 #define PerlSIO_clearerr(f) clearerr(f)
287 #define PerlSIO_fgetc(f) fgetc(f)
289 #define PerlSIO_get_base(f) FILE_base(f)
290 #define PerlSIO_get_bufsiz(f) FILE_bufsiz(f)
292 #define PerlSIO_get_base(f) NULL
293 #define PerlSIO_get_bufsiz(f) 0
296 #define PerlSIO_get_cnt(f) FILE_cnt(f)
297 #define PerlSIO_get_ptr(f) FILE_ptr(f)
299 #define PerlSIO_get_cnt(f) 0
300 #define PerlSIO_get_ptr(f) NULL
302 #define PerlSIO_fputc(f,c) fputc(c,f)
303 #define PerlSIO_fputs(f,s) fputs(s,f)
304 #define PerlSIO_fflush(f) Fflush(f)
305 #define PerlSIO_fgets(s, n, fp) fgets(s,n,fp)
306 #if defined(VMS) && defined(__DECC)
307 /* Unusual definition of ungetc() here to accomodate fast_sv_gets()'
308 * belief that it can mix getc/ungetc with reads from stdio buffer */
309 int decc$ungetc(int __c, FILE *__stream);
310 # define PerlSIO_ungetc(c,f) ((c) == EOF ? EOF : \
311 ((*(f) && !((*(f))->_flag & _IONBF) && \
312 ((*(f))->_ptr > (*(f))->_base)) ? \
313 ((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f)))
315 # define PerlSIO_ungetc(c,f) ungetc(c,f)
317 #define PerlSIO_fileno(f) fileno(f)
318 #define PerlSIO_fdopen(f, s) fdopen(f,s)
319 #define PerlSIO_freopen(p, m, f) freopen(p,m,f)
320 #define PerlSIO_fread(buf,sz,count,f) fread(buf,sz,count,f)
321 #define PerlSIO_fwrite(buf,sz,count,f) fwrite(buf,sz,count,f)
322 #define PerlSIO_setbuf(f,b) setbuf(f,b)
323 #define PerlSIO_setvbuf(f,b,t,s) setvbuf(f,b,t,s)
324 #if defined(USE_STDIO_PTR) && defined(STDIO_CNT_LVALUE)
325 #define PerlSIO_set_cnt(f,c) FILE_cnt(f) = (c)
327 #define PerlSIO_set_cnt(f,c) PerlIOProc_abort()
329 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE)
330 #define PerlSIO_set_ptr(f,p) FILE_ptr(f) = (p)
332 #define PerlSIO_set_ptr(f,p) PerlIOProc_abort()
334 #define PerlSIO_setlinebuf(f) setlinebuf(f)
335 #define PerlSIO_printf Perl_fprintf_nocontext
336 #define PerlSIO_stdoutf *PL_StdIO->pPrintf
337 #define PerlSIO_vprintf(f,fmt,a)
338 #define PerlSIO_ftell(f) ftell(f)
339 #define PerlSIO_fseek(f,o,w) fseek(f,o,w)
340 #define PerlSIO_fgetpos(f,p) fgetpos(f,p)
341 #define PerlSIO_fsetpos(f,p) fsetpos(f,p)
342 #define PerlSIO_rewind(f) rewind(f)
343 #define PerlSIO_tmpfile() tmpfile()
344 #define PerlSIO_fdupopen(f) (f)
346 #endif /* PERL_IMPLICIT_SYS */
349 * Interface for directory functions
352 #if defined(PERL_IMPLICIT_SYS)
357 typedef int (*LPMakedir)(struct IPerlDir*, const char*, int);
358 typedef int (*LPChdir)(struct IPerlDir*, const char*);
359 typedef int (*LPRmdir)(struct IPerlDir*, const char*);
360 typedef int (*LPDirClose)(struct IPerlDir*, DIR*);
361 typedef DIR* (*LPDirOpen)(struct IPerlDir*, char*);
362 typedef struct direct* (*LPDirRead)(struct IPerlDir*, DIR*);
363 typedef void (*LPDirRewind)(struct IPerlDir*, DIR*);
364 typedef void (*LPDirSeek)(struct IPerlDir*, DIR*, long);
365 typedef long (*LPDirTell)(struct IPerlDir*, DIR*);
367 typedef char* (*LPDirMapPathA)(struct IPerlDir*, const char*);
368 typedef WCHAR* (*LPDirMapPathW)(struct IPerlDir*, const WCHAR*);
383 LPDirMapPathA pMapPathA;
384 LPDirMapPathW pMapPathW;
390 unsigned long nCount; /* number of entries expected */
391 struct IPerlDir perlDirList;
394 #define PerlDir_mkdir(name, mode) \
395 (*PL_Dir->pMakedir)(PL_Dir, (name), (mode))
396 #define PerlDir_chdir(name) \
397 (*PL_Dir->pChdir)(PL_Dir, (name))
398 #define PerlDir_rmdir(name) \
399 (*PL_Dir->pRmdir)(PL_Dir, (name))
400 #define PerlDir_close(dir) \
401 (*PL_Dir->pClose)(PL_Dir, (dir))
402 #define PerlDir_open(name) \
403 (*PL_Dir->pOpen)(PL_Dir, (name))
404 #define PerlDir_read(dir) \
405 (*PL_Dir->pRead)(PL_Dir, (dir))
406 #define PerlDir_rewind(dir) \
407 (*PL_Dir->pRewind)(PL_Dir, (dir))
408 #define PerlDir_seek(dir, loc) \
409 (*PL_Dir->pSeek)(PL_Dir, (dir), (loc))
410 #define PerlDir_tell(dir) \
411 (*PL_Dir->pTell)(PL_Dir, (dir))
413 #define PerlDir_mapA(dir) \
414 (*PL_Dir->pMapPathA)(PL_Dir, (dir))
415 #define PerlDir_mapW(dir) \
416 (*PL_Dir->pMapPathW)(PL_Dir, (dir))
419 #else /* PERL_IMPLICIT_SYS */
421 #define PerlDir_mkdir(name, mode) Mkdir((name), (mode))
423 # define PerlDir_chdir(n) Chdir(((n) && *(n)) ? (n) : "SYS$LOGIN")
425 # define PerlDir_chdir(name) chdir((name))
427 #define PerlDir_rmdir(name) rmdir((name))
428 #define PerlDir_close(dir) closedir((dir))
429 #define PerlDir_open(name) opendir((name))
430 #define PerlDir_read(dir) readdir((dir))
431 #define PerlDir_rewind(dir) rewinddir((dir))
432 #define PerlDir_seek(dir, loc) seekdir((dir), (loc))
433 #define PerlDir_tell(dir) telldir((dir))
435 #define PerlDir_mapA(dir) dir
436 #define PerlDir_mapW(dir) dir
439 #endif /* PERL_IMPLICIT_SYS */
442 Interface for perl environment functions
445 #if defined(PERL_IMPLICIT_SYS)
450 typedef char* (*LPEnvGetenv)(struct IPerlEnv*, const char*);
451 typedef int (*LPEnvPutenv)(struct IPerlEnv*, const char*);
452 typedef char* (*LPEnvGetenv_len)(struct IPerlEnv*,
453 const char *varname, unsigned long *len);
454 typedef int (*LPEnvUname)(struct IPerlEnv*, struct utsname *name);
455 typedef void (*LPEnvClearenv)(struct IPerlEnv*);
456 typedef void* (*LPEnvGetChildenv)(struct IPerlEnv*);
457 typedef void (*LPEnvFreeChildenv)(struct IPerlEnv*, void* env);
458 typedef char* (*LPEnvGetChilddir)(struct IPerlEnv*);
459 typedef void (*LPEnvFreeChilddir)(struct IPerlEnv*, char* dir);
461 typedef char* (*LPENVGetenv)(struct IPerlEnv*, const char *varname);
462 typedef char* (*LPENVGetenv_len)(struct IPerlEnv*,
463 const char *varname, unsigned long *len);
466 typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*);
467 typedef char* (*LPEnvLibPath)(struct IPerlEnv*, const char*);
468 typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, const char*);
469 typedef char* (*LPEnvVendorLibPath)(struct IPerlEnv*, const char*);
470 typedef void (*LPEnvGetChildIO)(struct IPerlEnv*, child_IO_table*);
477 LPEnvGetenv_len pGetenv_len;
478 LPEnvUname pEnvUname;
479 LPEnvClearenv pClearenv;
480 LPEnvGetChildenv pGetChildenv;
481 LPEnvFreeChildenv pFreeChildenv;
482 LPEnvGetChilddir pGetChilddir;
483 LPEnvFreeChilddir pFreeChilddir;
485 LPENVGetenv pENVGetenv;
486 LPENVGetenv_len pENVGetenv_len;
490 LPEnvLibPath pLibPath;
491 LPEnvSiteLibPath pSiteLibPath;
492 LPEnvVendorLibPath pVendorLibPath;
493 LPEnvGetChildIO pGetChildIO;
499 unsigned long nCount; /* number of entries expected */
500 struct IPerlEnv perlEnvList;
503 #define PerlEnv_putenv(str) \
504 (*PL_Env->pPutenv)(PL_Env,(str))
505 #define PerlEnv_getenv(str) \
506 (*PL_Env->pGetenv)(PL_Env,(str))
507 #define PerlEnv_getenv_len(str,l) \
508 (*PL_Env->pGetenv_len)(PL_Env,(str), (l))
509 #define PerlEnv_clearenv() \
510 (*PL_Env->pClearenv)(PL_Env)
511 #define PerlEnv_get_childenv() \
512 (*PL_Env->pGetChildenv)(PL_Env)
513 #define PerlEnv_free_childenv(e) \
514 (*PL_Env->pFreeChildenv)(PL_Env, (e))
515 #define PerlEnv_get_childdir() \
516 (*PL_Env->pGetChilddir)(PL_Env)
517 #define PerlEnv_free_childdir(d) \
518 (*PL_Env->pFreeChilddir)(PL_Env, (d))
520 # define PerlEnv_ENVgetenv(str) \
521 (*PL_Env->pENVGetenv)(PL_Env,(str))
522 # define PerlEnv_ENVgetenv_len(str,l) \
523 (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l))
525 # define PerlEnv_ENVgetenv(str) \
526 PerlEnv_getenv((str))
527 # define PerlEnv_ENVgetenv_len(str,l) \
528 PerlEnv_getenv_len((str),(l))
530 #define PerlEnv_uname(name) \
531 (*PL_Env->pEnvUname)(PL_Env,(name))
533 #define PerlEnv_os_id() \
534 (*PL_Env->pEnvOsID)(PL_Env)
535 #define PerlEnv_lib_path(str) \
536 (*PL_Env->pLibPath)(PL_Env,(str))
537 #define PerlEnv_sitelib_path(str) \
538 (*PL_Env->pSiteLibPath)(PL_Env,(str))
539 #define PerlEnv_vendorlib_path(str) \
540 (*PL_Env->pVendorLibPath)(PL_Env,(str))
541 #define PerlEnv_get_child_IO(ptr) \
542 (*PL_Env->pGetChildIO)(PL_Env, ptr)
545 #else /* PERL_IMPLICIT_SYS */
547 #define PerlEnv_putenv(str) putenv((str))
548 #define PerlEnv_getenv(str) getenv((str))
549 #define PerlEnv_getenv_len(str,l) getenv_len((str), (l))
550 #define PerlEnv_clearenv() clearenv()
551 #define PerlEnv_get_childenv() get_childenv()
552 #define PerlEnv_free_childenv(e) free_childenv((e))
553 #define PerlEnv_get_childdir() get_childdir()
554 #define PerlEnv_free_childdir(d) free_childdir((d))
556 # define PerlEnv_ENVgetenv(str) ENVgetenv((str))
557 # define PerlEnv_ENVgetenv_len(str,l) ENVgetenv_len((str), (l))
559 # define PerlEnv_ENVgetenv(str) PerlEnv_getenv((str))
560 # define PerlEnv_ENVgetenv_len(str,l) PerlEnv_getenv_len((str), (l))
562 #define PerlEnv_uname(name) uname((name))
565 #define PerlEnv_os_id() win32_os_id()
566 #define PerlEnv_lib_path(str) win32_get_privlib(str)
567 #define PerlEnv_sitelib_path(str) win32_get_sitelib(str)
568 #define PerlEnv_vendorlib_path(str) win32_get_vendorlib(str)
569 #define PerlEnv_get_child_IO(ptr) win32_get_child_IO(ptr)
572 #endif /* PERL_IMPLICIT_SYS */
575 Interface for perl low-level IO functions
578 #if defined(PERL_IMPLICIT_SYS)
583 typedef int (*LPLIOAccess)(struct IPerlLIO*, const char*, int);
584 typedef int (*LPLIOChmod)(struct IPerlLIO*, const char*, int);
585 typedef int (*LPLIOChown)(struct IPerlLIO*, const char*, uid_t,
587 typedef int (*LPLIOChsize)(struct IPerlLIO*, int, long);
588 typedef int (*LPLIOClose)(struct IPerlLIO*, int);
589 typedef int (*LPLIODup)(struct IPerlLIO*, int);
590 typedef int (*LPLIODup2)(struct IPerlLIO*, int, int);
591 typedef int (*LPLIOFlock)(struct IPerlLIO*, int, int);
592 typedef int (*LPLIOFileStat)(struct IPerlLIO*, int, struct stat*);
593 typedef int (*LPLIOIOCtl)(struct IPerlLIO*, int, unsigned int,
595 typedef int (*LPLIOIsatty)(struct IPerlLIO*, int);
596 typedef int (*LPLIOLink)(struct IPerlLIO*, const char*,
598 typedef long (*LPLIOLseek)(struct IPerlLIO*, int, long, int);
599 typedef int (*LPLIOLstat)(struct IPerlLIO*, const char*,
601 typedef char* (*LPLIOMktemp)(struct IPerlLIO*, char*);
602 typedef int (*LPLIOOpen)(struct IPerlLIO*, const char*, int);
603 typedef int (*LPLIOOpen3)(struct IPerlLIO*, const char*, int, int);
604 typedef int (*LPLIORead)(struct IPerlLIO*, int, void*, unsigned int);
605 typedef int (*LPLIORename)(struct IPerlLIO*, const char*,
608 typedef int (*LPLIOSetmode)(struct IPerlLIO*, FILE*, int);
610 typedef int (*LPLIOSetmode)(struct IPerlLIO*, int, int);
612 typedef int (*LPLIONameStat)(struct IPerlLIO*, const char*,
614 typedef char* (*LPLIOTmpnam)(struct IPerlLIO*, char*);
615 typedef int (*LPLIOUmask)(struct IPerlLIO*, int);
616 typedef int (*LPLIOUnlink)(struct IPerlLIO*, const char*);
617 typedef int (*LPLIOUtime)(struct IPerlLIO*, char*, struct utimbuf*);
618 typedef int (*LPLIOWrite)(struct IPerlLIO*, int, const void*,
631 LPLIOFileStat pFileStat;
642 LPLIOSetmode pSetmode;
643 LPLIONameStat pNameStat;
653 unsigned long nCount; /* number of entries expected */
654 struct IPerlLIO perlLIOList;
657 #define PerlLIO_access(file, mode) \
658 (*PL_LIO->pAccess)(PL_LIO, (file), (mode))
659 #define PerlLIO_chmod(file, mode) \
660 (*PL_LIO->pChmod)(PL_LIO, (file), (mode))
661 #define PerlLIO_chown(file, owner, group) \
662 (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group))
663 #define PerlLIO_chsize(fd, size) \
664 (*PL_LIO->pChsize)(PL_LIO, (fd), (size))
665 #define PerlLIO_close(fd) \
666 (*PL_LIO->pClose)(PL_LIO, (fd))
667 #define PerlLIO_dup(fd) \
668 (*PL_LIO->pDup)(PL_LIO, (fd))
669 #define PerlLIO_dup2(fd1, fd2) \
670 (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2))
671 #define PerlLIO_flock(fd, op) \
672 (*PL_LIO->pFlock)(PL_LIO, (fd), (op))
673 #define PerlLIO_fstat(fd, buf) \
674 (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf))
675 #define PerlLIO_ioctl(fd, u, buf) \
676 (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf))
677 #define PerlLIO_isatty(fd) \
678 (*PL_LIO->pIsatty)(PL_LIO, (fd))
679 #define PerlLIO_link(oldname, newname) \
680 (*PL_LIO->pLink)(PL_LIO, (oldname), (newname))
681 #define PerlLIO_lseek(fd, offset, mode) \
682 (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode))
683 #define PerlLIO_lstat(name, buf) \
684 (*PL_LIO->pLstat)(PL_LIO, (name), (buf))
685 #define PerlLIO_mktemp(file) \
686 (*PL_LIO->pMktemp)(PL_LIO, (file))
687 #define PerlLIO_open(file, flag) \
688 (*PL_LIO->pOpen)(PL_LIO, (file), (flag))
689 #define PerlLIO_open3(file, flag, perm) \
690 (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm))
691 #define PerlLIO_read(fd, buf, count) \
692 (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count))
693 #define PerlLIO_rename(oname, newname) \
694 (*PL_LIO->pRename)(PL_LIO, (oname), (newname))
695 #define PerlLIO_setmode(fd, mode) \
696 (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode))
697 #define PerlLIO_stat(name, buf) \
698 (*PL_LIO->pNameStat)(PL_LIO, (name), (buf))
699 #define PerlLIO_tmpnam(str) \
700 (*PL_LIO->pTmpnam)(PL_LIO, (str))
701 #define PerlLIO_umask(mode) \
702 (*PL_LIO->pUmask)(PL_LIO, (mode))
703 #define PerlLIO_unlink(file) \
704 (*PL_LIO->pUnlink)(PL_LIO, (file))
705 #define PerlLIO_utime(file, time) \
706 (*PL_LIO->pUtime)(PL_LIO, (file), (time))
707 #define PerlLIO_write(fd, buf, count) \
708 (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count))
710 #else /* PERL_IMPLICIT_SYS */
712 #define PerlLIO_access(file, mode) access((file), (mode))
713 #define PerlLIO_chmod(file, mode) chmod((file), (mode))
714 #define PerlLIO_chown(file, owner, grp) chown((file), (owner), (grp))
715 #define PerlLIO_chsize(fd, size) chsize((fd), (size))
716 #define PerlLIO_close(fd) close((fd))
717 #define PerlLIO_dup(fd) dup((fd))
718 #define PerlLIO_dup2(fd1, fd2) dup2((fd1), (fd2))
719 #define PerlLIO_flock(fd, op) FLOCK((fd), (op))
720 #define PerlLIO_fstat(fd, buf) Fstat((fd), (buf))
721 #define PerlLIO_ioctl(fd, u, buf) ioctl((fd), (u), (buf))
722 #define PerlLIO_isatty(fd) isatty((fd))
723 #define PerlLIO_link(oldname, newname) link((oldname), (newname))
724 #define PerlLIO_lseek(fd, offset, mode) lseek((fd), (offset), (mode))
725 #define PerlLIO_stat(name, buf) Stat((name), (buf))
727 # define PerlLIO_lstat(name, buf) lstat((name), (buf))
729 # define PerlLIO_lstat(name, buf) PerlLIO_stat((name), (buf))
731 #define PerlLIO_mktemp(file) mktemp((file))
732 #define PerlLIO_mkstemp(file) mkstemp((file))
733 #define PerlLIO_open(file, flag) open((file), (flag))
734 #define PerlLIO_open3(file, flag, perm) open((file), (flag), (perm))
735 #define PerlLIO_read(fd, buf, count) read((fd), (buf), (count))
736 #define PerlLIO_rename(old, new) rename((old), (new))
737 #define PerlLIO_setmode(fd, mode) setmode((fd), (mode))
738 #define PerlLIO_tmpnam(str) tmpnam((str))
739 #define PerlLIO_umask(mode) umask((mode))
740 #define PerlLIO_unlink(file) unlink((file))
741 #define PerlLIO_utime(file, time) utime((file), (time))
742 #define PerlLIO_write(fd, buf, count) write((fd), (buf), (count))
744 #endif /* PERL_IMPLICIT_SYS */
747 Interface for perl memory allocation
750 #if defined(PERL_IMPLICIT_SYS)
755 typedef void* (*LPMemMalloc)(struct IPerlMem*, size_t);
756 typedef void* (*LPMemRealloc)(struct IPerlMem*, void*, size_t);
757 typedef void (*LPMemFree)(struct IPerlMem*, void*);
758 typedef void* (*LPMemCalloc)(struct IPerlMem*, size_t, size_t);
759 typedef void (*LPMemGetLock)(struct IPerlMem*);
760 typedef void (*LPMemFreeLock)(struct IPerlMem*);
761 typedef int (*LPMemIsLocked)(struct IPerlMem*);
766 LPMemRealloc pRealloc;
769 LPMemGetLock pGetLock;
770 LPMemFreeLock pFreeLock;
771 LPMemIsLocked pIsLocked;
776 unsigned long nCount; /* number of entries expected */
777 struct IPerlMem perlMemList;
780 /* Interpreter specific memory macros */
781 #define PerlMem_malloc(size) \
782 (*PL_Mem->pMalloc)(PL_Mem, (size))
783 #define PerlMem_realloc(buf, size) \
784 (*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
785 #define PerlMem_free(buf) \
786 (*PL_Mem->pFree)(PL_Mem, (buf))
787 #define PerlMem_calloc(num, size) \
788 (*PL_Mem->pCalloc)(PL_Mem, (num), (size))
789 #define PerlMem_get_lock() \
790 (*PL_Mem->pGetLock)(PL_Mem)
791 #define PerlMem_free_lock() \
792 (*PL_Mem->pFreeLock)(PL_Mem)
793 #define PerlMem_is_locked() \
794 (*PL_Mem->pIsLocked)(PL_Mem)
796 /* Shared memory macros */
797 #define PerlMemShared_malloc(size) \
798 (*PL_MemShared->pMalloc)(PL_MemShared, (size))
799 #define PerlMemShared_realloc(buf, size) \
800 (*PL_MemShared->pRealloc)(PL_MemShared, (buf), (size))
801 #define PerlMemShared_free(buf) \
802 (*PL_MemShared->pFree)(PL_MemShared, (buf))
803 #define PerlMemShared_calloc(num, size) \
804 (*PL_MemShared->pCalloc)(PL_MemShared, (num), (size))
805 #define PerlMemShared_get_lock() \
806 (*PL_MemShared->pGetLock)(PL_MemShared)
807 #define PerlMemShared_free_lock() \
808 (*PL_MemShared->pFreeLock)(PL_MemShared)
809 #define PerlMemShared_is_locked() \
810 (*PL_MemShared->pIsLocked)(PL_MemShared)
813 /* Parse tree memory macros */
814 #define PerlMemParse_malloc(size) \
815 (*PL_MemParse->pMalloc)(PL_MemParse, (size))
816 #define PerlMemParse_realloc(buf, size) \
817 (*PL_MemParse->pRealloc)(PL_MemParse, (buf), (size))
818 #define PerlMemParse_free(buf) \
819 (*PL_MemParse->pFree)(PL_MemParse, (buf))
820 #define PerlMemParse_calloc(num, size) \
821 (*PL_MemParse->pCalloc)(PL_MemParse, (num), (size))
822 #define PerlMemParse_get_lock() \
823 (*PL_MemParse->pGetLock)(PL_MemParse)
824 #define PerlMemParse_free_lock() \
825 (*PL_MemParse->pFreeLock)(PL_MemParse)
826 #define PerlMemParse_is_locked() \
827 (*PL_MemParse->pIsLocked)(PL_MemParse)
830 #else /* PERL_IMPLICIT_SYS */
832 /* Interpreter specific memory macros */
833 #define PerlMem_malloc(size) malloc((size))
834 #define PerlMem_realloc(buf, size) realloc((buf), (size))
835 #define PerlMem_free(buf) free((buf))
836 #define PerlMem_calloc(num, size) calloc((num), (size))
837 #define PerlMem_get_lock()
838 #define PerlMem_free_lock()
839 #define PerlMem_is_locked() 0
841 /* Shared memory macros */
842 #define PerlMemShared_malloc(size) malloc((size))
843 #define PerlMemShared_realloc(buf, size) realloc((buf), (size))
844 #define PerlMemShared_free(buf) free((buf))
845 #define PerlMemShared_calloc(num, size) calloc((num), (size))
846 #define PerlMemShared_get_lock()
847 #define PerlMemShared_free_lock()
848 #define PerlMemShared_is_locked() 0
850 /* Parse tree memory macros */
851 #define PerlMemParse_malloc(size) malloc((size))
852 #define PerlMemParse_realloc(buf, size) realloc((buf), (size))
853 #define PerlMemParse_free(buf) free((buf))
854 #define PerlMemParse_calloc(num, size) calloc((num), (size))
855 #define PerlMemParse_get_lock()
856 #define PerlMemParse_free_lock()
857 #define PerlMemParse_is_locked() 0
859 #endif /* PERL_IMPLICIT_SYS */
862 Interface for perl process functions
866 #if defined(PERL_IMPLICIT_SYS)
874 struct IPerlProcInfo;
875 typedef void (*LPProcAbort)(struct IPerlProc*);
876 typedef char* (*LPProcCrypt)(struct IPerlProc*, const char*,
878 typedef void (*LPProcExit)(struct IPerlProc*, int);
879 typedef void (*LPProc_Exit)(struct IPerlProc*, int);
880 typedef int (*LPProcExecl)(struct IPerlProc*, const char*,
881 const char*, const char*, const char*,
883 typedef int (*LPProcExecv)(struct IPerlProc*, const char*,
885 typedef int (*LPProcExecvp)(struct IPerlProc*, const char*,
887 typedef uid_t (*LPProcGetuid)(struct IPerlProc*);
888 typedef uid_t (*LPProcGeteuid)(struct IPerlProc*);
889 typedef gid_t (*LPProcGetgid)(struct IPerlProc*);
890 typedef gid_t (*LPProcGetegid)(struct IPerlProc*);
891 typedef char* (*LPProcGetlogin)(struct IPerlProc*);
892 typedef int (*LPProcKill)(struct IPerlProc*, int, int);
893 typedef int (*LPProcKillpg)(struct IPerlProc*, int, int);
894 typedef int (*LPProcPauseProc)(struct IPerlProc*);
895 typedef PerlIO* (*LPProcPopen)(struct IPerlProc*, const char*,
897 typedef PerlIO* (*LPProcPopenList)(struct IPerlProc*, 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 int (*LPProcFork)(struct IPerlProc*);
909 typedef int (*LPProcGetpid)(struct IPerlProc*);
911 typedef void* (*LPProcDynaLoader)(struct IPerlProc*, const char*);
912 typedef void (*LPProcGetOSError)(struct IPerlProc*,
913 SV* sv, DWORD dwErr);
914 typedef void (*LPProcFreeBuf)(struct IPerlProc*, char*);
915 typedef BOOL (*LPProcDoCmd)(struct IPerlProc*, char*);
916 typedef int (*LPProcSpawn)(struct IPerlProc*, char*);
917 typedef int (*LPProcSpawnvp)(struct IPerlProc*, int, const char*,
919 typedef int (*LPProcASpawn)(struct IPerlProc*, void*, void**, void**);
921 typedef int (*LPProcLastHost)(struct IPerlProc*);
931 LPProcExecvp pExecvp;
932 LPProcGetuid pGetuid;
933 LPProcGeteuid pGeteuid;
934 LPProcGetgid pGetgid;
935 LPProcGetegid pGetegid;
936 LPProcGetlogin pGetlogin;
938 LPProcKillpg pKillpg;
939 LPProcPauseProc pPauseProc;
941 LPProcPclose pPclose;
943 LPProcSetuid pSetuid;
944 LPProcSetgid pSetgid;
948 LPProcWaitpid pWaitpid;
949 LPProcSignal pSignal;
951 LPProcGetpid pGetpid;
953 LPProcDynaLoader pDynaLoader;
954 LPProcGetOSError pGetOSError;
957 LPProcSpawnvp pSpawnvp;
958 LPProcASpawn pASpawn;
960 LPProcLastHost pLastHost;
961 LPProcPopenList pPopenList;
966 unsigned long nCount; /* number of entries expected */
967 struct IPerlProc perlProcList;
970 #define PerlProc_abort() \
971 (*PL_Proc->pAbort)(PL_Proc)
972 #define PerlProc_crypt(c,s) \
973 (*PL_Proc->pCrypt)(PL_Proc, (c), (s))
974 #define PerlProc_exit(s) \
975 (*PL_Proc->pExit)(PL_Proc, (s))
976 #define PerlProc__exit(s) \
977 (*PL_Proc->p_Exit)(PL_Proc, (s))
978 #define PerlProc_execl(c, w, x, y, z) \
979 (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z))
980 #define PerlProc_execv(c, a) \
981 (*PL_Proc->pExecv)(PL_Proc, (c), (a))
982 #define PerlProc_execvp(c, a) \
983 (*PL_Proc->pExecvp)(PL_Proc, (c), (a))
984 #define PerlProc_getuid() \
985 (*PL_Proc->pGetuid)(PL_Proc)
986 #define PerlProc_geteuid() \
987 (*PL_Proc->pGeteuid)(PL_Proc)
988 #define PerlProc_getgid() \
989 (*PL_Proc->pGetgid)(PL_Proc)
990 #define PerlProc_getegid() \
991 (*PL_Proc->pGetegid)(PL_Proc)
992 #define PerlProc_getlogin() \
993 (*PL_Proc->pGetlogin)(PL_Proc)
994 #define PerlProc_kill(i, a) \
995 (*PL_Proc->pKill)(PL_Proc, (i), (a))
996 #define PerlProc_killpg(i, a) \
997 (*PL_Proc->pKillpg)(PL_Proc, (i), (a))
998 #define PerlProc_pause() \
999 (*PL_Proc->pPauseProc)(PL_Proc)
1000 #define PerlProc_popen(c, m) \
1001 (*PL_Proc->pPopen)(PL_Proc, (c), (m))
1002 #define PerlProc_popen_list(m, n, a) \
1003 (*PL_Proc->pPopenList)(PL_Proc, (m), (n), (a))
1004 #define PerlProc_pclose(f) \
1005 (*PL_Proc->pPclose)(PL_Proc, (f))
1006 #define PerlProc_pipe(fd) \
1007 (*PL_Proc->pPipe)(PL_Proc, (fd))
1008 #define PerlProc_setuid(u) \
1009 (*PL_Proc->pSetuid)(PL_Proc, (u))
1010 #define PerlProc_setgid(g) \
1011 (*PL_Proc->pSetgid)(PL_Proc, (g))
1012 #define PerlProc_sleep(t) \
1013 (*PL_Proc->pSleep)(PL_Proc, (t))
1014 #define PerlProc_times(t) \
1015 (*PL_Proc->pTimes)(PL_Proc, (t))
1016 #define PerlProc_wait(t) \
1017 (*PL_Proc->pWait)(PL_Proc, (t))
1018 #define PerlProc_waitpid(p,s,f) \
1019 (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f))
1020 #define PerlProc_signal(n, h) \
1021 (*PL_Proc->pSignal)(PL_Proc, (n), (h))
1022 #define PerlProc_fork() \
1023 (*PL_Proc->pFork)(PL_Proc)
1024 #define PerlProc_getpid() \
1025 (*PL_Proc->pGetpid)(PL_Proc)
1026 #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
1027 #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
1030 #define PerlProc_DynaLoad(f) \
1031 (*PL_Proc->pDynaLoader)(PL_Proc, (f))
1032 #define PerlProc_GetOSError(s,e) \
1033 (*PL_Proc->pGetOSError)(PL_Proc, (s), (e))
1034 #define PerlProc_Cmd(s) \
1035 (*PL_Proc->pDoCmd)(PL_Proc, (s))
1036 #define do_spawn(s) \
1037 (*PL_Proc->pSpawn)(PL_Proc, (s))
1038 #define do_spawnvp(m, c, a) \
1039 (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a))
1040 #define PerlProc_aspawn(m,c,a) \
1041 (*PL_Proc->pASpawn)(PL_Proc, (m), (c), (a))
1043 #define PerlProc_lasthost() \
1044 (*PL_Proc->pLastHost)(PL_Proc)
1046 #else /* PERL_IMPLICIT_SYS */
1048 #define PerlProc_abort() abort()
1049 #define PerlProc_crypt(c,s) crypt((c), (s))
1050 #define PerlProc_exit(s) exit((s))
1051 #define PerlProc__exit(s) _exit((s))
1052 #define PerlProc_execl(c,w,x,y,z) \
1053 execl((c), (w), (x), (y), (z))
1054 #define PerlProc_execv(c, a) execv((c), (a))
1055 #define PerlProc_execvp(c, a) execvp((c), (a))
1056 #define PerlProc_getuid() getuid()
1057 #define PerlProc_geteuid() geteuid()
1058 #define PerlProc_getgid() getgid()
1059 #define PerlProc_getegid() getegid()
1060 #define PerlProc_getlogin() getlogin()
1061 #define PerlProc_kill(i, a) kill((i), (a))
1062 #define PerlProc_killpg(i, a) killpg((i), (a))
1063 #define PerlProc_pause() Pause()
1064 #define PerlProc_popen(c, m) my_popen((c), (m))
1065 #define PerlProc_popen_list(m,n,a) my_popen_list((m),(n),(a))
1066 #define PerlProc_pclose(f) my_pclose((f))
1067 #define PerlProc_pipe(fd) pipe((fd))
1068 #define PerlProc_setuid(u) setuid((u))
1069 #define PerlProc_setgid(g) setgid((g))
1070 #define PerlProc_sleep(t) sleep((t))
1071 #define PerlProc_times(t) times((t))
1072 #define PerlProc_wait(t) wait((t))
1073 #define PerlProc_waitpid(p,s,f) waitpid((p), (s), (f))
1074 #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
1075 #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
1076 #define PerlProc_signal(n, h) signal((n), (h))
1077 #define PerlProc_fork() fork()
1078 #define PerlProc_getpid() getpid()
1081 #define PerlProc_DynaLoad(f) \
1083 #define PerlProc_GetOSError(s,e) \
1084 win32_str_os_error((s), (e))
1086 #endif /* PERL_IMPLICIT_SYS */
1089 Interface for perl socket functions
1092 #if defined(PERL_IMPLICIT_SYS)
1096 struct IPerlSockInfo;
1097 typedef u_long (*LPHtonl)(struct IPerlSock*, u_long);
1098 typedef u_short (*LPHtons)(struct IPerlSock*, u_short);
1099 typedef u_long (*LPNtohl)(struct IPerlSock*, u_long);
1100 typedef u_short (*LPNtohs)(struct IPerlSock*, u_short);
1101 typedef SOCKET (*LPAccept)(struct IPerlSock*, SOCKET,
1102 struct sockaddr*, int*);
1103 typedef int (*LPBind)(struct IPerlSock*, SOCKET,
1104 const struct sockaddr*, int);
1105 typedef int (*LPConnect)(struct IPerlSock*, SOCKET,
1106 const struct sockaddr*, int);
1107 typedef void (*LPEndhostent)(struct IPerlSock*);
1108 typedef void (*LPEndnetent)(struct IPerlSock*);
1109 typedef void (*LPEndprotoent)(struct IPerlSock*);
1110 typedef void (*LPEndservent)(struct IPerlSock*);
1111 typedef int (*LPGethostname)(struct IPerlSock*, char*, int);
1112 typedef int (*LPGetpeername)(struct IPerlSock*, SOCKET,
1113 struct sockaddr*, int*);
1114 typedef struct hostent* (*LPGethostbyaddr)(struct IPerlSock*, const char*,
1116 typedef struct hostent* (*LPGethostbyname)(struct IPerlSock*, const char*);
1117 typedef struct hostent* (*LPGethostent)(struct IPerlSock*);
1118 typedef struct netent* (*LPGetnetbyaddr)(struct IPerlSock*, long, int);
1119 typedef struct netent* (*LPGetnetbyname)(struct IPerlSock*, const char*);
1120 typedef struct netent* (*LPGetnetent)(struct IPerlSock*);
1121 typedef struct protoent*(*LPGetprotobyname)(struct IPerlSock*, const char*);
1122 typedef struct protoent*(*LPGetprotobynumber)(struct IPerlSock*, int);
1123 typedef struct protoent*(*LPGetprotoent)(struct IPerlSock*);
1124 typedef struct servent* (*LPGetservbyname)(struct IPerlSock*, const char*,
1126 typedef struct servent* (*LPGetservbyport)(struct IPerlSock*, int,
1128 typedef struct servent* (*LPGetservent)(struct IPerlSock*);
1129 typedef int (*LPGetsockname)(struct IPerlSock*, SOCKET,
1130 struct sockaddr*, int*);
1131 typedef int (*LPGetsockopt)(struct IPerlSock*, SOCKET, int, int,
1133 typedef unsigned long (*LPInetAddr)(struct IPerlSock*, const char*);
1134 typedef char* (*LPInetNtoa)(struct IPerlSock*, struct in_addr);
1135 typedef int (*LPListen)(struct IPerlSock*, SOCKET, int);
1136 typedef int (*LPRecv)(struct IPerlSock*, SOCKET, char*, int, int);
1137 typedef int (*LPRecvfrom)(struct IPerlSock*, SOCKET, char*, int,
1138 int, struct sockaddr*, int*);
1139 typedef int (*LPSelect)(struct IPerlSock*, int, char*, char*,
1140 char*, const struct timeval*);
1141 typedef int (*LPSend)(struct IPerlSock*, SOCKET, const char*, int,
1143 typedef int (*LPSendto)(struct IPerlSock*, SOCKET, const char*,
1144 int, int, const struct sockaddr*, int);
1145 typedef void (*LPSethostent)(struct IPerlSock*, int);
1146 typedef void (*LPSetnetent)(struct IPerlSock*, int);
1147 typedef void (*LPSetprotoent)(struct IPerlSock*, int);
1148 typedef void (*LPSetservent)(struct IPerlSock*, int);
1149 typedef int (*LPSetsockopt)(struct IPerlSock*, SOCKET, int, int,
1151 typedef int (*LPShutdown)(struct IPerlSock*, SOCKET, int);
1152 typedef SOCKET (*LPSocket)(struct IPerlSock*, int, int, int);
1153 typedef int (*LPSocketpair)(struct IPerlSock*, int, int, int,
1156 typedef int (*LPClosesocket)(struct IPerlSock*, SOCKET s);
1168 LPEndhostent pEndhostent;
1169 LPEndnetent pEndnetent;
1170 LPEndprotoent pEndprotoent;
1171 LPEndservent pEndservent;
1172 LPGethostname pGethostname;
1173 LPGetpeername pGetpeername;
1174 LPGethostbyaddr pGethostbyaddr;
1175 LPGethostbyname pGethostbyname;
1176 LPGethostent pGethostent;
1177 LPGetnetbyaddr pGetnetbyaddr;
1178 LPGetnetbyname pGetnetbyname;
1179 LPGetnetent pGetnetent;
1180 LPGetprotobyname pGetprotobyname;
1181 LPGetprotobynumber pGetprotobynumber;
1182 LPGetprotoent pGetprotoent;
1183 LPGetservbyname pGetservbyname;
1184 LPGetservbyport pGetservbyport;
1185 LPGetservent pGetservent;
1186 LPGetsockname pGetsockname;
1187 LPGetsockopt pGetsockopt;
1188 LPInetAddr pInetAddr;
1189 LPInetNtoa pInetNtoa;
1192 LPRecvfrom pRecvfrom;
1196 LPSethostent pSethostent;
1197 LPSetnetent pSetnetent;
1198 LPSetprotoent pSetprotoent;
1199 LPSetservent pSetservent;
1200 LPSetsockopt pSetsockopt;
1201 LPShutdown pShutdown;
1203 LPSocketpair pSocketpair;
1205 LPClosesocket pClosesocket;
1209 struct IPerlSockInfo
1211 unsigned long nCount; /* number of entries expected */
1212 struct IPerlSock perlSockList;
1215 #define PerlSock_htonl(x) \
1216 (*PL_Sock->pHtonl)(PL_Sock, x)
1217 #define PerlSock_htons(x) \
1218 (*PL_Sock->pHtons)(PL_Sock, x)
1219 #define PerlSock_ntohl(x) \
1220 (*PL_Sock->pNtohl)(PL_Sock, x)
1221 #define PerlSock_ntohs(x) \
1222 (*PL_Sock->pNtohs)(PL_Sock, x)
1223 #define PerlSock_accept(s, a, l) \
1224 (*PL_Sock->pAccept)(PL_Sock, s, a, l)
1225 #define PerlSock_bind(s, n, l) \
1226 (*PL_Sock->pBind)(PL_Sock, s, n, l)
1227 #define PerlSock_connect(s, n, l) \
1228 (*PL_Sock->pConnect)(PL_Sock, s, n, l)
1229 #define PerlSock_endhostent() \
1230 (*PL_Sock->pEndhostent)(PL_Sock)
1231 #define PerlSock_endnetent() \
1232 (*PL_Sock->pEndnetent)(PL_Sock)
1233 #define PerlSock_endprotoent() \
1234 (*PL_Sock->pEndprotoent)(PL_Sock)
1235 #define PerlSock_endservent() \
1236 (*PL_Sock->pEndservent)(PL_Sock)
1237 #define PerlSock_gethostbyaddr(a, l, t) \
1238 (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t)
1239 #define PerlSock_gethostbyname(n) \
1240 (*PL_Sock->pGethostbyname)(PL_Sock, n)
1241 #define PerlSock_gethostent() \
1242 (*PL_Sock->pGethostent)(PL_Sock)
1243 #define PerlSock_gethostname(n, l) \
1244 (*PL_Sock->pGethostname)(PL_Sock, n, l)
1245 #define PerlSock_getnetbyaddr(n, t) \
1246 (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t)
1247 #define PerlSock_getnetbyname(c) \
1248 (*PL_Sock->pGetnetbyname)(PL_Sock, c)
1249 #define PerlSock_getnetent() \
1250 (*PL_Sock->pGetnetent)(PL_Sock)
1251 #define PerlSock_getpeername(s, n, l) \
1252 (*PL_Sock->pGetpeername)(PL_Sock, s, n, l)
1253 #define PerlSock_getprotobyname(n) \
1254 (*PL_Sock->pGetprotobyname)(PL_Sock, n)
1255 #define PerlSock_getprotobynumber(n) \
1256 (*PL_Sock->pGetprotobynumber)(PL_Sock, n)
1257 #define PerlSock_getprotoent() \
1258 (*PL_Sock->pGetprotoent)(PL_Sock)
1259 #define PerlSock_getservbyname(n, p) \
1260 (*PL_Sock->pGetservbyname)(PL_Sock, n, p)
1261 #define PerlSock_getservbyport(port, p) \
1262 (*PL_Sock->pGetservbyport)(PL_Sock, port, p)
1263 #define PerlSock_getservent() \
1264 (*PL_Sock->pGetservent)(PL_Sock)
1265 #define PerlSock_getsockname(s, n, l) \
1266 (*PL_Sock->pGetsockname)(PL_Sock, s, n, l)
1267 #define PerlSock_getsockopt(s,l,n,v,i) \
1268 (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i)
1269 #define PerlSock_inet_addr(c) \
1270 (*PL_Sock->pInetAddr)(PL_Sock, c)
1271 #define PerlSock_inet_ntoa(i) \
1272 (*PL_Sock->pInetNtoa)(PL_Sock, i)
1273 #define PerlSock_listen(s, b) \
1274 (*PL_Sock->pListen)(PL_Sock, s, b)
1275 #define PerlSock_recv(s, b, l, f) \
1276 (*PL_Sock->pRecv)(PL_Sock, s, b, l, f)
1277 #define PerlSock_recvfrom(s,b,l,f,from,fromlen) \
1278 (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen)
1279 #define PerlSock_select(n, r, w, e, t) \
1280 (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t)
1281 #define PerlSock_send(s, b, l, f) \
1282 (*PL_Sock->pSend)(PL_Sock, s, b, l, f)
1283 #define PerlSock_sendto(s, b, l, f, t, tlen) \
1284 (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen)
1285 #define PerlSock_sethostent(f) \
1286 (*PL_Sock->pSethostent)(PL_Sock, f)
1287 #define PerlSock_setnetent(f) \
1288 (*PL_Sock->pSetnetent)(PL_Sock, f)
1289 #define PerlSock_setprotoent(f) \
1290 (*PL_Sock->pSetprotoent)(PL_Sock, f)
1291 #define PerlSock_setservent(f) \
1292 (*PL_Sock->pSetservent)(PL_Sock, f)
1293 #define PerlSock_setsockopt(s, l, n, v, len) \
1294 (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len)
1295 #define PerlSock_shutdown(s, h) \
1296 (*PL_Sock->pShutdown)(PL_Sock, s, h)
1297 #define PerlSock_socket(a, t, p) \
1298 (*PL_Sock->pSocket)(PL_Sock, a, t, p)
1299 #define PerlSock_socketpair(a, t, p, f) \
1300 (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f)
1303 #define PerlSock_closesocket(s) \
1304 (*PL_Sock->pClosesocket)(PL_Sock, s)
1307 #else /* PERL_IMPLICIT_SYS */
1309 #define PerlSock_htonl(x) htonl(x)
1310 #define PerlSock_htons(x) htons(x)
1311 #define PerlSock_ntohl(x) ntohl(x)
1312 #define PerlSock_ntohs(x) ntohs(x)
1313 #define PerlSock_accept(s, a, l) accept(s, a, l)
1314 #define PerlSock_bind(s, n, l) bind(s, n, l)
1315 #define PerlSock_connect(s, n, l) connect(s, n, l)
1317 #define PerlSock_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t)
1318 #define PerlSock_gethostbyname(n) gethostbyname(n)
1319 #define PerlSock_gethostent gethostent
1320 #define PerlSock_endhostent endhostent
1321 #define PerlSock_gethostname(n, l) gethostname(n, l)
1323 #define PerlSock_getnetbyaddr(n, t) getnetbyaddr(n, t)
1324 #define PerlSock_getnetbyname(n) getnetbyname(n)
1325 #define PerlSock_getnetent getnetent
1326 #define PerlSock_endnetent endnetent
1327 #define PerlSock_getpeername(s, n, l) getpeername(s, n, l)
1329 #define PerlSock_getprotobyname(n) getprotobyname(n)
1330 #define PerlSock_getprotobynumber(n) getprotobynumber(n)
1331 #define PerlSock_getprotoent getprotoent
1332 #define PerlSock_endprotoent endprotoent
1334 #define PerlSock_getservbyname(n, p) getservbyname(n, p)
1335 #define PerlSock_getservbyport(port, p) getservbyport(port, p)
1336 #define PerlSock_getservent getservent
1337 #define PerlSock_endservent endservent
1339 #define PerlSock_getsockname(s, n, l) getsockname(s, n, l)
1340 #define PerlSock_getsockopt(s,l,n,v,i) getsockopt(s, l, n, v, i)
1341 #define PerlSock_inet_addr(c) inet_addr(c)
1342 #define PerlSock_inet_ntoa(i) inet_ntoa(i)
1343 #define PerlSock_listen(s, b) listen(s, b)
1344 #define PerlSock_recv(s, b, l, f) recv(s, b, l, f)
1345 #define PerlSock_recvfrom(s, b, l, f, from, fromlen) \
1346 recvfrom(s, b, l, f, from, fromlen)
1347 #define PerlSock_select(n, r, w, e, t) select(n, r, w, e, t)
1348 #define PerlSock_send(s, b, l, f) send(s, b, l, f)
1349 #define PerlSock_sendto(s, b, l, f, t, tlen) \
1350 sendto(s, b, l, f, t, tlen)
1351 #define PerlSock_sethostent(f) sethostent(f)
1352 #define PerlSock_setnetent(f) setnetent(f)
1353 #define PerlSock_setprotoent(f) setprotoent(f)
1354 #define PerlSock_setservent(f) setservent(f)
1355 #define PerlSock_setsockopt(s, l, n, v, len) \
1356 setsockopt(s, l, n, v, len)
1357 #define PerlSock_shutdown(s, h) shutdown(s, h)
1358 #define PerlSock_socket(a, t, p) socket(a, t, p)
1359 #define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f)
1362 #define PerlSock_closesocket(s) closesocket(s)
1365 #endif /* PERL_IMPLICIT_SYS */
1367 #endif /* __Inc__IPerl___ */