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
54 Interface for perl stdio functions
58 /* Clean up (or at least document) the various possible #defines.
59 This section attempts to match the 5.003_03 Configure variables
60 onto the 5.003_02 header file values.
61 I can't figure out where USE_STDIO was supposed to be set.
65 # define PERLIO_IS_STDIO
68 /* Below is the 5.003_02 stuff. */
70 # ifndef PERLIO_IS_STDIO
71 # define PERLIO_IS_STDIO
74 extern void PerlIO_init (void);
77 #if defined(PERL_IMPLICIT_SYS)
80 typedef struct _PerlIO PerlIO;
85 typedef PerlIO* (*LPStdin)(struct IPerlStdIO*);
86 typedef PerlIO* (*LPStdout)(struct IPerlStdIO*);
87 typedef PerlIO* (*LPStderr)(struct IPerlStdIO*);
88 typedef PerlIO* (*LPOpen)(struct IPerlStdIO*, const char*,
90 typedef int (*LPClose)(struct IPerlStdIO*, PerlIO*);
91 typedef int (*LPEof)(struct IPerlStdIO*, PerlIO*);
92 typedef int (*LPError)(struct IPerlStdIO*, PerlIO*);
93 typedef void (*LPClearerr)(struct IPerlStdIO*, PerlIO*);
94 typedef int (*LPGetc)(struct IPerlStdIO*, PerlIO*);
95 typedef char* (*LPGetBase)(struct IPerlStdIO*, PerlIO*);
96 typedef int (*LPGetBufsiz)(struct IPerlStdIO*, PerlIO*);
97 typedef int (*LPGetCnt)(struct IPerlStdIO*, PerlIO*);
98 typedef char* (*LPGetPtr)(struct IPerlStdIO*, PerlIO*);
99 typedef char* (*LPGets)(struct IPerlStdIO*, PerlIO*, char*, int);
100 typedef int (*LPPutc)(struct IPerlStdIO*, PerlIO*, int);
101 typedef int (*LPPuts)(struct IPerlStdIO*, PerlIO*, const char*);
102 typedef int (*LPFlush)(struct IPerlStdIO*, PerlIO*);
103 typedef int (*LPUngetc)(struct IPerlStdIO*, PerlIO*,int);
104 typedef int (*LPFileno)(struct IPerlStdIO*, PerlIO*);
105 typedef PerlIO* (*LPFdopen)(struct IPerlStdIO*, int, const char*);
106 typedef PerlIO* (*LPReopen)(struct IPerlStdIO*, const char*,
107 const char*, PerlIO*);
108 typedef SSize_t (*LPRead)(struct IPerlStdIO*, PerlIO*, void*, Size_t);
109 typedef SSize_t (*LPWrite)(struct IPerlStdIO*, PerlIO*, const void*,
111 typedef void (*LPSetBuf)(struct IPerlStdIO*, PerlIO*, char*);
112 typedef int (*LPSetVBuf)(struct IPerlStdIO*, PerlIO*, char*, int,
114 typedef void (*LPSetCnt)(struct IPerlStdIO*, PerlIO*, int);
115 typedef void (*LPSetPtrCnt)(struct IPerlStdIO*, PerlIO*, char*,
117 typedef void (*LPSetlinebuf)(struct IPerlStdIO*, PerlIO*);
118 typedef int (*LPPrintf)(struct IPerlStdIO*, PerlIO*, const char*,
120 typedef int (*LPVprintf)(struct IPerlStdIO*, PerlIO*, const char*,
122 typedef long (*LPTell)(struct IPerlStdIO*, PerlIO*);
123 typedef int (*LPSeek)(struct IPerlStdIO*, PerlIO*, Off_t, int);
124 typedef void (*LPRewind)(struct IPerlStdIO*, PerlIO*);
125 typedef PerlIO* (*LPTmpfile)(struct IPerlStdIO*);
126 typedef int (*LPGetpos)(struct IPerlStdIO*, PerlIO*, Fpos_t*);
127 typedef int (*LPSetpos)(struct IPerlStdIO*, PerlIO*,
129 typedef void (*LPInit)(struct IPerlStdIO*);
130 typedef void (*LPInitOSExtras)(struct IPerlStdIO*);
141 LPClearerr pClearerr;
144 LPGetBufsiz pGetBufsiz;
160 LPSetPtrCnt pSetPtrCnt;
161 LPSetlinebuf pSetlinebuf;
171 LPInitOSExtras pInitOSExtras;
174 struct IPerlStdIOInfo
176 unsigned long nCount; /* number of entries expected */
177 struct IPerlStdIO perlStdIOList;
181 # define PerlIO_has_cntptr(f) 1
182 # ifdef STDIO_CNT_LVALUE
183 # define PerlIO_canset_cnt(f) 1
184 # ifdef STDIO_PTR_LVALUE
185 # define PerlIO_fast_gets(f) 1
188 # define PerlIO_canset_cnt(f) 0
190 #else /* USE_STDIO_PTR */
191 # define PerlIO_has_cntptr(f) 0
192 # define PerlIO_canset_cnt(f) 0
193 #endif /* USE_STDIO_PTR */
195 #ifndef PerlIO_fast_gets
196 #define PerlIO_fast_gets(f) 0
200 #define PerlIO_has_base(f) 1
202 #define PerlIO_has_base(f) 0
205 #define PerlIO_stdin() \
206 (*PL_StdIO->pStdin)(PL_StdIO)
207 #define PerlIO_stdout() \
208 (*PL_StdIO->pStdout)(PL_StdIO)
209 #define PerlIO_stderr() \
210 (*PL_StdIO->pStderr)(PL_StdIO)
211 #define PerlIO_open(x,y) \
212 (*PL_StdIO->pOpen)(PL_StdIO, (x),(y))
213 #define PerlIO_close(f) \
214 (*PL_StdIO->pClose)(PL_StdIO, (f))
215 #define PerlIO_eof(f) \
216 (*PL_StdIO->pEof)(PL_StdIO, (f))
217 #define PerlIO_error(f) \
218 (*PL_StdIO->pError)(PL_StdIO, (f))
219 #define PerlIO_clearerr(f) \
220 (*PL_StdIO->pClearerr)(PL_StdIO, (f))
221 #define PerlIO_getc(f) \
222 (*PL_StdIO->pGetc)(PL_StdIO, (f))
223 #define PerlIO_get_base(f) \
224 (*PL_StdIO->pGetBase)(PL_StdIO, (f))
225 #define PerlIO_get_bufsiz(f) \
226 (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f))
227 #define PerlIO_get_cnt(f) \
228 (*PL_StdIO->pGetCnt)(PL_StdIO, (f))
229 #define PerlIO_get_ptr(f) \
230 (*PL_StdIO->pGetPtr)(PL_StdIO, (f))
231 #define PerlIO_putc(f,c) \
232 (*PL_StdIO->pPutc)(PL_StdIO, (f),(c))
233 #define PerlIO_puts(f,s) \
234 (*PL_StdIO->pPuts)(PL_StdIO, (f),(s))
235 #define PerlIO_flush(f) \
236 (*PL_StdIO->pFlush)(PL_StdIO, (f))
237 #define PerlIO_gets(s, n, fp) \
238 (*PL_StdIO->pGets)(PL_StdIO, (fp), s, n)
239 #define PerlIO_ungetc(f,c) \
240 (*PL_StdIO->pUngetc)(PL_StdIO, (f),(c))
241 #define PerlIO_fileno(f) \
242 (*PL_StdIO->pFileno)(PL_StdIO, (f))
243 #define PerlIO_fdopen(f, s) \
244 (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s))
245 #define PerlIO_reopen(p, m, f) \
246 (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f))
247 #define PerlIO_read(f,buf,count) \
248 (SSize_t)(*PL_StdIO->pRead)(PL_StdIO, (f), (buf), (count))
249 #define PerlIO_write(f,buf,count) \
250 (*PL_StdIO->pWrite)(PL_StdIO, (f), (buf), (count))
251 #define PerlIO_setbuf(f,b) \
252 (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b))
253 #define PerlIO_setvbuf(f,b,t,s) \
254 (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s))
255 #define PerlIO_set_cnt(f,c) \
256 (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c))
257 #define PerlIO_set_ptrcnt(f,p,c) \
258 (*PL_StdIO->pSetPtrCnt)(PL_StdIO, (f), (p), (c))
259 #define PerlIO_setlinebuf(f) \
260 (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f))
261 #define PerlIO_printf Perl_fprintf_nocontext
262 #define PerlIO_stdoutf *PL_StdIO->pPrintf
263 #define PerlIO_vprintf(f,fmt,a) \
264 (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a)
265 #define PerlIO_tell(f) \
266 (*PL_StdIO->pTell)(PL_StdIO, (f))
267 #define PerlIO_seek(f,o,w) \
268 (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w))
269 #define PerlIO_getpos(f,p) \
270 (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p))
271 #define PerlIO_setpos(f,p) \
272 (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p))
273 #define PerlIO_rewind(f) \
274 (*PL_StdIO->pRewind)(PL_StdIO, (f))
275 #define PerlIO_tmpfile() \
276 (*PL_StdIO->pTmpfile)(PL_StdIO)
277 #define PerlIO_init() \
278 (*PL_StdIO->pInit)(PL_StdIO)
279 #undef init_os_extras
280 #define init_os_extras() \
281 (*PL_StdIO->pInitOSExtras)(PL_StdIO)
283 #else /* PERL_IMPLICIT_SYS */
285 #include "perlsdio.h"
287 #endif /* PERL_IMPLICIT_SYS */
289 #ifndef PERLIO_IS_STDIO
291 #include "perlsfio.h"
292 #endif /* USE_SFIO */
293 #endif /* PERLIO_IS_STDIO */
299 /* This is to catch case with no stdio */
318 #define PerlIO struct _PerlIO
319 #endif /* No PerlIO */
325 #ifndef NEXT30_NO_ATTRIBUTE
326 #ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */
327 #ifdef __attribute__ /* Avoid possible redefinition errors */
330 #define __attribute__(attr)
334 #ifndef PerlIO_stdoutf
335 extern int PerlIO_stdoutf (const char *,...)
336 __attribute__((format (printf, 1, 2)));
339 extern int PerlIO_puts (PerlIO *,const char *);
342 extern PerlIO * PerlIO_open (const char *,const char *);
345 extern int PerlIO_close (PerlIO *);
348 extern int PerlIO_eof (PerlIO *);
351 extern int PerlIO_error (PerlIO *);
353 #ifndef PerlIO_clearerr
354 extern void PerlIO_clearerr (PerlIO *);
357 extern int PerlIO_getc (PerlIO *);
360 extern int PerlIO_putc (PerlIO *,int);
363 extern int PerlIO_flush (PerlIO *);
365 #ifndef PerlIO_ungetc
366 extern int PerlIO_ungetc (PerlIO *,int);
368 #ifndef PerlIO_fileno
369 extern int PerlIO_fileno (PerlIO *);
371 #ifndef PerlIO_fdopen
372 extern PerlIO * PerlIO_fdopen (int, const char *);
374 #ifndef PerlIO_importFILE
375 extern PerlIO * PerlIO_importFILE (FILE *,int);
377 #ifndef PerlIO_exportFILE
378 extern FILE * PerlIO_exportFILE (PerlIO *,int);
380 #ifndef PerlIO_findFILE
381 extern FILE * PerlIO_findFILE (PerlIO *);
383 #ifndef PerlIO_releaseFILE
384 extern void PerlIO_releaseFILE (PerlIO *,FILE *);
387 extern SSize_t PerlIO_read (PerlIO *,void *,Size_t);
390 extern SSize_t PerlIO_write (PerlIO *,const void *,Size_t);
392 #ifndef PerlIO_setlinebuf
393 extern void PerlIO_setlinebuf (PerlIO *);
395 #ifndef PerlIO_printf
396 extern int PerlIO_printf (PerlIO *, const char *,...)
397 __attribute__((format (printf, 2, 3)));
399 #ifndef PerlIO_sprintf
400 extern int PerlIO_sprintf (char *, int, const char *,...)
401 __attribute__((format (printf, 3, 4)));
403 #ifndef PerlIO_vprintf
404 extern int PerlIO_vprintf (PerlIO *, const char *, va_list);
407 extern Off_t PerlIO_tell (PerlIO *);
410 extern int PerlIO_seek (PerlIO *, Off_t, int);
412 #ifndef PerlIO_rewind
413 extern void PerlIO_rewind (PerlIO *);
415 #ifndef PerlIO_has_base
416 extern int PerlIO_has_base (PerlIO *);
418 #ifndef PerlIO_has_cntptr
419 extern int PerlIO_has_cntptr (PerlIO *);
421 #ifndef PerlIO_fast_gets
422 extern int PerlIO_fast_gets (PerlIO *);
424 #ifndef PerlIO_canset_cnt
425 extern int PerlIO_canset_cnt (PerlIO *);
427 #ifndef PerlIO_get_ptr
428 extern STDCHAR * PerlIO_get_ptr (PerlIO *);
430 #ifndef PerlIO_get_cnt
431 extern int PerlIO_get_cnt (PerlIO *);
433 #ifndef PerlIO_set_cnt
434 extern void PerlIO_set_cnt (PerlIO *,int);
436 #ifndef PerlIO_set_ptrcnt
437 extern void PerlIO_set_ptrcnt (PerlIO *,STDCHAR *,int);
439 #ifndef PerlIO_get_base
440 extern STDCHAR * PerlIO_get_base (PerlIO *);
442 #ifndef PerlIO_get_bufsiz
443 extern int PerlIO_get_bufsiz (PerlIO *);
445 #ifndef PerlIO_tmpfile
446 extern PerlIO * PerlIO_tmpfile (void);
449 extern PerlIO * PerlIO_stdin (void);
451 #ifndef PerlIO_stdout
452 extern PerlIO * PerlIO_stdout (void);
454 #ifndef PerlIO_stderr
455 extern PerlIO * PerlIO_stderr (void);
457 #ifndef PerlIO_getpos
458 extern int PerlIO_getpos (PerlIO *,Fpos_t *);
460 #ifndef PerlIO_setpos
461 extern int PerlIO_setpos (PerlIO *,const Fpos_t *);
466 * Interface for directory functions
469 #if defined(PERL_IMPLICIT_SYS)
473 typedef int (*LPMakedir)(struct IPerlDir*, const char*, int);
474 typedef int (*LPChdir)(struct IPerlDir*, const char*);
475 typedef int (*LPRmdir)(struct IPerlDir*, const char*);
476 typedef int (*LPDirClose)(struct IPerlDir*, DIR*);
477 typedef DIR* (*LPDirOpen)(struct IPerlDir*, char*);
478 typedef struct direct* (*LPDirRead)(struct IPerlDir*, DIR*);
479 typedef void (*LPDirRewind)(struct IPerlDir*, DIR*);
480 typedef void (*LPDirSeek)(struct IPerlDir*, DIR*, long);
481 typedef long (*LPDirTell)(struct IPerlDir*, DIR*);
498 unsigned long nCount; /* number of entries expected */
499 struct IPerlDir perlDirList;
502 #define PerlDir_mkdir(name, mode) \
503 (*PL_Dir->pMakedir)(PL_Dir, (name), (mode))
504 #define PerlDir_chdir(name) \
505 (*PL_Dir->pChdir)(PL_Dir, (name))
506 #define PerlDir_rmdir(name) \
507 (*PL_Dir->pRmdir)(PL_Dir, (name))
508 #define PerlDir_close(dir) \
509 (*PL_Dir->pClose)(PL_Dir, (dir))
510 #define PerlDir_open(name) \
511 (*PL_Dir->pOpen)(PL_Dir, (name))
512 #define PerlDir_read(dir) \
513 (*PL_Dir->pRead)(PL_Dir, (dir))
514 #define PerlDir_rewind(dir) \
515 (*PL_Dir->pRewind)(PL_Dir, (dir))
516 #define PerlDir_seek(dir, loc) \
517 (*PL_Dir->pSeek)(PL_Dir, (dir), (loc))
518 #define PerlDir_tell(dir) \
519 (*PL_Dir->pTell)(PL_Dir, (dir))
521 #else /* PERL_IMPLICIT_SYS */
523 #define PerlDir_mkdir(name, mode) Mkdir((name), (mode))
525 # define PerlDir_chdir(n) chdir(((n) && *(n)) ? (n) : "SYS$LOGIN")
527 # define PerlDir_chdir(name) chdir((name))
529 #define PerlDir_rmdir(name) rmdir((name))
530 #define PerlDir_close(dir) closedir((dir))
531 #define PerlDir_open(name) opendir((name))
532 #define PerlDir_read(dir) readdir((dir))
533 #define PerlDir_rewind(dir) rewinddir((dir))
534 #define PerlDir_seek(dir, loc) seekdir((dir), (loc))
535 #define PerlDir_tell(dir) telldir((dir))
537 #endif /* PERL_IMPLICIT_SYS */
540 Interface for perl environment functions
543 #if defined(PERL_IMPLICIT_SYS)
547 typedef char* (*LPEnvGetenv)(struct IPerlEnv*, const char*);
548 typedef int (*LPEnvPutenv)(struct IPerlEnv*, const char*);
549 typedef char* (*LPEnvGetenv_len)(struct IPerlEnv*,
550 const char *varname, unsigned long *len);
551 typedef int (*LPEnvUname)(struct IPerlEnv*, struct utsname *name);
552 typedef void (*LPEnvClearenv)(struct IPerlEnv*);
553 typedef void* (*LPEnvGetChildenv)(struct IPerlEnv*);
554 typedef void (*LPEnvFreeChildenv)(struct IPerlEnv*, void* env);
555 typedef char* (*LPEnvGetChilddir)(struct IPerlEnv*);
556 typedef void (*LPEnvFreeChilddir)(struct IPerlEnv*, char* dir);
558 typedef char* (*LPENVGetenv)(struct IPerlEnv*, const char *varname);
559 typedef char* (*LPENVGetenv_len)(struct IPerlEnv*,
560 const char *varname, unsigned long *len);
563 typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*);
564 typedef char* (*LPEnvLibPath)(struct IPerlEnv*, char*);
565 typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, char*);
572 LPEnvGetenv_len pGetenv_len;
573 LPEnvUname pEnvUname;
574 LPEnvClearenv pClearenv;
575 LPEnvGetChildenv pGetChildenv;
576 LPEnvFreeChildenv pFreeChildenv;
577 LPEnvGetChilddir pGetChilddir;
578 LPEnvFreeChilddir pFreeChilddir;
580 LPENVGetenv pENVGetenv;
581 LPENVGetenv_len pENVGetenv_len;
585 LPEnvLibPath pLibPath;
586 LPEnvSiteLibPath pSiteLibPath;
592 unsigned long nCount; /* number of entries expected */
593 struct IPerlEnv perlEnvList;
596 #define PerlEnv_putenv(str) \
597 (*PL_Env->pPutenv)(PL_Env,(str))
598 #define PerlEnv_getenv(str) \
599 (*PL_Env->pGetenv)(PL_Env,(str))
600 #define PerlEnv_getenv_len(str,l) \
601 (*PL_Env->pGetenv_len)(PL_Env,(str), (l))
602 #define PerlEnv_clearenv() \
603 (*PL_Env->pClearenv)(PL_Env)
604 #define PerlEnv_get_childenv() \
605 (*PL_Env->pGetChildenv)(PL_Env)
606 #define PerlEnv_free_childenv(e) \
607 (*PL_Env->pFreeChildenv)(PL_Env, (e))
608 #define PerlEnv_get_childdir() \
609 (*PL_Env->pGetChilddir)(PL_Env)
610 #define PerlEnv_free_childdir(d) \
611 (*PL_Env->pFreeChilddir)(PL_Env, (d))
613 # define PerlEnv_ENVgetenv(str) \
614 (*PL_Env->pENVGetenv)(PL_Env,(str))
615 # define PerlEnv_ENVgetenv_len(str,l) \
616 (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l))
618 # define PerlEnv_ENVgetenv(str) \
619 PerlEnv_getenv((str))
620 # define PerlEnv_ENVgetenv_len(str,l) \
621 PerlEnv_getenv_len((str),(l))
623 #define PerlEnv_uname(name) \
624 (*PL_Env->pEnvUname)(PL_Env,(name))
626 #define PerlEnv_os_id() \
627 (*PL_Env->pEnvOsID)(PL_Env)
628 #define PerlEnv_lib_path(str) \
629 (*PL_Env->pLibPath)(PL_Env,(str))
630 #define PerlEnv_sitelib_path(str) \
631 (*PL_Env->pSiteLibPath)(PL_Env,(str))
634 #else /* PERL_IMPLICIT_SYS */
636 #define PerlEnv_putenv(str) putenv((str))
637 #define PerlEnv_getenv(str) getenv((str))
638 #define PerlEnv_getenv_len(str,l) getenv_len((str), (l))
639 #define PerlEnv_clear() clearenv()
640 #define PerlEnv_get_childenv() get_childenv()
641 #define PerlEnv_free_childenv(e) free_childenv((e))
642 #define PerlEnv_get_childdir() get_childdir()
643 #define PerlEnv_free_childdir(d) free_childdir((d))
645 # define PerlEnv_ENVgetenv(str) ENVgetenv((str))
646 # define PerlEnv_ENVgetenv_len(str,l) ENVgetenv_len((str), (l))
648 # define PerlEnv_ENVgetenv(str) PerlEnv_getenv((str))
649 # define PerlEnv_ENVgetenv_len(str,l) PerlEnv_getenv_len((str), (l))
651 #define PerlEnv_uname(name) uname((name))
654 #define PerlEnv_os_id() win32_os_id()
657 #endif /* PERL_IMPLICIT_SYS */
660 Interface for perl low-level IO functions
663 #if defined(PERL_IMPLICIT_SYS)
667 typedef int (*LPLIOAccess)(struct IPerlLIO*, const char*, int);
668 typedef int (*LPLIOChmod)(struct IPerlLIO*, const char*, int);
669 typedef int (*LPLIOChown)(struct IPerlLIO*, const char*, uid_t,
671 typedef int (*LPLIOChsize)(struct IPerlLIO*, int, long);
672 typedef int (*LPLIOClose)(struct IPerlLIO*, int);
673 typedef int (*LPLIODup)(struct IPerlLIO*, int);
674 typedef int (*LPLIODup2)(struct IPerlLIO*, int, int);
675 typedef int (*LPLIOFlock)(struct IPerlLIO*, int, int);
676 typedef int (*LPLIOFileStat)(struct IPerlLIO*, int, struct stat*);
677 typedef int (*LPLIOIOCtl)(struct IPerlLIO*, int, unsigned int,
679 typedef int (*LPLIOIsatty)(struct IPerlLIO*, int);
680 typedef long (*LPLIOLseek)(struct IPerlLIO*, int, long, int);
681 typedef int (*LPLIOLstat)(struct IPerlLIO*, const char*,
683 typedef char* (*LPLIOMktemp)(struct IPerlLIO*, char*);
684 typedef int (*LPLIOOpen)(struct IPerlLIO*, const char*, int);
685 typedef int (*LPLIOOpen3)(struct IPerlLIO*, const char*, int, int);
686 typedef int (*LPLIORead)(struct IPerlLIO*, int, void*, unsigned int);
687 typedef int (*LPLIORename)(struct IPerlLIO*, const char*,
689 typedef int (*LPLIOSetmode)(struct IPerlLIO*, int, int);
690 typedef int (*LPLIONameStat)(struct IPerlLIO*, const char*,
692 typedef char* (*LPLIOTmpnam)(struct IPerlLIO*, char*);
693 typedef int (*LPLIOUmask)(struct IPerlLIO*, int);
694 typedef int (*LPLIOUnlink)(struct IPerlLIO*, const char*);
695 typedef int (*LPLIOUtime)(struct IPerlLIO*, char*, struct utimbuf*);
696 typedef int (*LPLIOWrite)(struct IPerlLIO*, int, const void*,
709 LPLIOFileStat pFileStat;
719 LPLIOSetmode pSetmode;
720 LPLIONameStat pNameStat;
730 unsigned long nCount; /* number of entries expected */
731 struct IPerlLIO perlLIOList;
734 #define PerlLIO_access(file, mode) \
735 (*PL_LIO->pAccess)(PL_LIO, (file), (mode))
736 #define PerlLIO_chmod(file, mode) \
737 (*PL_LIO->pChmod)(PL_LIO, (file), (mode))
738 #define PerlLIO_chown(file, owner, group) \
739 (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group))
740 #define PerlLIO_chsize(fd, size) \
741 (*PL_LIO->pChsize)(PL_LIO, (fd), (size))
742 #define PerlLIO_close(fd) \
743 (*PL_LIO->pClose)(PL_LIO, (fd))
744 #define PerlLIO_dup(fd) \
745 (*PL_LIO->pDup)(PL_LIO, (fd))
746 #define PerlLIO_dup2(fd1, fd2) \
747 (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2))
748 #define PerlLIO_flock(fd, op) \
749 (*PL_LIO->pFlock)(PL_LIO, (fd), (op))
750 #define PerlLIO_fstat(fd, buf) \
751 (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf))
752 #define PerlLIO_ioctl(fd, u, buf) \
753 (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf))
754 #define PerlLIO_isatty(fd) \
755 (*PL_LIO->pIsatty)(PL_LIO, (fd))
756 #define PerlLIO_lseek(fd, offset, mode) \
757 (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode))
758 #define PerlLIO_lstat(name, buf) \
759 (*PL_LIO->pLstat)(PL_LIO, (name), (buf))
760 #define PerlLIO_mktemp(file) \
761 (*PL_LIO->pMktemp)(PL_LIO, (file))
762 #define PerlLIO_open(file, flag) \
763 (*PL_LIO->pOpen)(PL_LIO, (file), (flag))
764 #define PerlLIO_open3(file, flag, perm) \
765 (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm))
766 #define PerlLIO_read(fd, buf, count) \
767 (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count))
768 #define PerlLIO_rename(oname, newname) \
769 (*PL_LIO->pRename)(PL_LIO, (oname), (newname))
770 #define PerlLIO_setmode(fd, mode) \
771 (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode))
772 #define PerlLIO_stat(name, buf) \
773 (*PL_LIO->pNameStat)(PL_LIO, (name), (buf))
774 #define PerlLIO_tmpnam(str) \
775 (*PL_LIO->pTmpnam)(PL_LIO, (str))
776 #define PerlLIO_umask(mode) \
777 (*PL_LIO->pUmask)(PL_LIO, (mode))
778 #define PerlLIO_unlink(file) \
779 (*PL_LIO->pUnlink)(PL_LIO, (file))
780 #define PerlLIO_utime(file, time) \
781 (*PL_LIO->pUtime)(PL_LIO, (file), (time))
782 #define PerlLIO_write(fd, buf, count) \
783 (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count))
785 #else /* PERL_IMPLICIT_SYS */
787 #define PerlLIO_access(file, mode) access((file), (mode))
788 #define PerlLIO_chmod(file, mode) chmod((file), (mode))
789 #define PerlLIO_chown(file, owner, grp) chown((file), (owner), (grp))
790 #define PerlLIO_chsize(fd, size) chsize((fd), (size))
791 #define PerlLIO_close(fd) close((fd))
792 #define PerlLIO_dup(fd) dup((fd))
793 #define PerlLIO_dup2(fd1, fd2) dup2((fd1), (fd2))
794 #define PerlLIO_flock(fd, op) FLOCK((fd), (op))
795 #define PerlLIO_fstat(fd, buf) Fstat((fd), (buf))
796 #define PerlLIO_ioctl(fd, u, buf) ioctl((fd), (u), (buf))
797 #define PerlLIO_isatty(fd) isatty((fd))
798 #define PerlLIO_lseek(fd, offset, mode) lseek((fd), (offset), (mode))
799 #define PerlLIO_stat(name, buf) Stat((name), (buf))
801 # define PerlLIO_lstat(name, buf) lstat((name), (buf))
803 # define PerlLIO_lstat(name, buf) PerlLIO_stat((name), (buf))
805 #define PerlLIO_mktemp(file) mktemp((file))
806 #define PerlLIO_mkstemp(file) mkstemp((file))
807 #define PerlLIO_open(file, flag) open((file), (flag))
808 #define PerlLIO_open3(file, flag, perm) open((file), (flag), (perm))
809 #define PerlLIO_read(fd, buf, count) read((fd), (buf), (count))
810 #define PerlLIO_rename(old, new) rename((old), (new))
811 #define PerlLIO_setmode(fd, mode) setmode((fd), (mode))
812 #define PerlLIO_tmpnam(str) tmpnam((str))
813 #define PerlLIO_umask(mode) umask((mode))
814 #define PerlLIO_unlink(file) unlink((file))
815 #define PerlLIO_utime(file, time) utime((file), (time))
816 #define PerlLIO_write(fd, buf, count) write((fd), (buf), (count))
818 #endif /* PERL_IMPLICIT_SYS */
821 Interface for perl memory allocation
824 #if defined(PERL_IMPLICIT_SYS)
828 typedef void* (*LPMemMalloc)(struct IPerlMem*, size_t);
829 typedef void* (*LPMemRealloc)(struct IPerlMem*, void*, size_t);
830 typedef void (*LPMemFree)(struct IPerlMem*, void*);
835 LPMemRealloc pRealloc;
841 unsigned long nCount; /* number of entries expected */
842 struct IPerlMem perlMemList;
845 #define PerlMem_malloc(size) \
846 (*PL_Mem->pMalloc)(PL_Mem, (size))
847 #define PerlMem_realloc(buf, size) \
848 (*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
849 #define PerlMem_free(buf) \
850 (*PL_Mem->pFree)(PL_Mem, (buf))
852 #else /* PERL_IMPLICIT_SYS */
854 #define PerlMem_malloc(size) malloc((size))
855 #define PerlMem_realloc(buf, size) realloc((buf), (size))
856 #define PerlMem_free(buf) free((buf))
858 #endif /* PERL_IMPLICIT_SYS */
861 Interface for perl process functions
865 #if defined(PERL_IMPLICIT_SYS)
868 typedef Signal_t (*Sighandler_t) (int);
876 typedef void (*LPProcAbort)(struct IPerlProc*);
877 typedef char* (*LPProcCrypt)(struct IPerlProc*, const char*,
879 typedef void (*LPProcExit)(struct IPerlProc*, int);
880 typedef void (*LPProc_Exit)(struct IPerlProc*, int);
881 typedef int (*LPProcExecl)(struct IPerlProc*, const char*,
882 const char*, const char*, const char*,
884 typedef int (*LPProcExecv)(struct IPerlProc*, const char*,
886 typedef int (*LPProcExecvp)(struct IPerlProc*, const char*,
888 typedef uid_t (*LPProcGetuid)(struct IPerlProc*);
889 typedef uid_t (*LPProcGeteuid)(struct IPerlProc*);
890 typedef gid_t (*LPProcGetgid)(struct IPerlProc*);
891 typedef gid_t (*LPProcGetegid)(struct IPerlProc*);
892 typedef char* (*LPProcGetlogin)(struct IPerlProc*);
893 typedef int (*LPProcKill)(struct IPerlProc*, int, int);
894 typedef int (*LPProcKillpg)(struct IPerlProc*, int, int);
895 typedef int (*LPProcPauseProc)(struct IPerlProc*);
896 typedef PerlIO* (*LPProcPopen)(struct IPerlProc*, const char*,
898 typedef int (*LPProcPclose)(struct IPerlProc*, PerlIO*);
899 typedef int (*LPProcPipe)(struct IPerlProc*, int*);
900 typedef int (*LPProcSetuid)(struct IPerlProc*, uid_t);
901 typedef int (*LPProcSetgid)(struct IPerlProc*, gid_t);
902 typedef int (*LPProcSleep)(struct IPerlProc*, unsigned int);
903 typedef int (*LPProcTimes)(struct IPerlProc*, struct tms*);
904 typedef int (*LPProcWait)(struct IPerlProc*, int*);
905 typedef int (*LPProcWaitpid)(struct IPerlProc*, int, int*, int);
906 typedef Sighandler_t (*LPProcSignal)(struct IPerlProc*, int, Sighandler_t);
907 typedef void* (*LPProcDynaLoader)(struct IPerlProc*, const char*);
909 typedef void (*LPProcGetOSError)(struct IPerlProc*,
910 SV* sv, DWORD dwErr);
911 typedef void (*LPProcFreeBuf)(struct IPerlProc*, char*);
912 typedef BOOL (*LPProcDoCmd)(struct IPerlProc*, char*);
913 typedef int (*LPProcSpawn)(struct IPerlProc*, char*);
914 typedef int (*LPProcSpawnvp)(struct IPerlProc*, int, const char*,
916 typedef int (*LPProcASpawn)(struct IPerlProc*, void*, void**, void**);
927 LPProcExecvp pExecvp;
928 LPProcGetuid pGetuid;
929 LPProcGeteuid pGeteuid;
930 LPProcGetgid pGetgid;
931 LPProcGetegid pGetegid;
932 LPProcGetlogin pGetlogin;
934 LPProcKillpg pKillpg;
935 LPProcPauseProc pPauseProc;
937 LPProcPclose pPclose;
939 LPProcSetuid pSetuid;
940 LPProcSetgid pSetgid;
944 LPProcWaitpid pWaitpid;
945 LPProcSignal pSignal;
947 LPProcDynaLoader pDynaLoader;
948 LPProcGetOSError pGetOSError;
951 LPProcSpawnvp pSpawnvp;
952 LPProcASpawn pASpawn;
958 unsigned long nCount; /* number of entries expected */
959 struct IPerlProc perlProcList;
962 #define PerlProc_abort() \
963 (*PL_Proc->pAbort)(PL_Proc)
964 #define PerlProc_crypt(c,s) \
965 (*PL_Proc->pCrypt)(PL_Proc, (c), (s))
966 #define PerlProc_exit(s) \
967 (*PL_Proc->pExit)(PL_Proc, (s))
968 #define PerlProc__exit(s) \
969 (*PL_Proc->p_Exit)(PL_Proc, (s))
970 #define PerlProc_execl(c, w, x, y, z) \
971 (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z))
972 #define PerlProc_execv(c, a) \
973 (*PL_Proc->pExecv)(PL_Proc, (c), (a))
974 #define PerlProc_execvp(c, a) \
975 (*PL_Proc->pExecvp)(PL_Proc, (c), (a))
976 #define PerlProc_getuid() \
977 (*PL_Proc->pGetuid)(PL_Proc)
978 #define PerlProc_geteuid() \
979 (*PL_Proc->pGeteuid)(PL_Proc)
980 #define PerlProc_getgid() \
981 (*PL_Proc->pGetgid)(PL_Proc)
982 #define PerlProc_getegid() \
983 (*PL_Proc->pGetegid)(PL_Proc)
984 #define PerlProc_getlogin() \
985 (*PL_Proc->pGetlogin)(PL_Proc)
986 #define PerlProc_kill(i, a) \
987 (*PL_Proc->pKill)(PL_Proc, (i), (a))
988 #define PerlProc_killpg(i, a) \
989 (*PL_Proc->pKillpg)(PL_Proc, (i), (a))
990 #define PerlProc_pause() \
991 (*PL_Proc->pPauseProc)(PL_Proc)
992 #define PerlProc_popen(c, m) \
993 (*PL_Proc->pPopen)(PL_Proc, (c), (m))
994 #define PerlProc_pclose(f) \
995 (*PL_Proc->pPclose)(PL_Proc, (f))
996 #define PerlProc_pipe(fd) \
997 (*PL_Proc->pPipe)(PL_Proc, (fd))
998 #define PerlProc_setuid(u) \
999 (*PL_Proc->pSetuid)(PL_Proc, (u))
1000 #define PerlProc_setgid(g) \
1001 (*PL_Proc->pSetgid)(PL_Proc, (g))
1002 #define PerlProc_sleep(t) \
1003 (*PL_Proc->pSleep)(PL_Proc, (t))
1004 #define PerlProc_times(t) \
1005 (*PL_Proc->pTimes)(PL_Proc, (t))
1006 #define PerlProc_wait(t) \
1007 (*PL_Proc->pWait)(PL_Proc, (t))
1008 #define PerlProc_waitpid(p,s,f) \
1009 (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f))
1010 #define PerlProc_signal(n, h) \
1011 (*PL_Proc->pSignal)(PL_Proc, (n), (h))
1012 #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
1013 #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
1016 #define PerlProc_DynaLoad(f) \
1017 (*PL_Proc->pDynaLoader)(PL_Proc, (f))
1018 #define PerlProc_GetOSError(s,e) \
1019 (*PL_Proc->pGetOSError)(PL_Proc, (s), (e))
1020 #define PerlProc_Cmd(s) \
1021 (*PL_Proc->pDoCmd)(PL_Proc, (s))
1022 #define do_spawn(s) \
1023 (*PL_Proc->pSpawn)(PL_Proc, (s))
1024 #define do_spawnvp(m, c, a) \
1025 (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a))
1026 #define PerlProc_aspawn(m,c,a) \
1027 (*PL_Proc->pASpawn)(PL_Proc, (m), (c), (a))
1030 #else /* PERL_IMPLICIT_SYS */
1032 #define PerlProc_abort() abort()
1033 #define PerlProc_crypt(c,s) crypt((c), (s))
1034 #define PerlProc_exit(s) exit((s))
1035 #define PerlProc__exit(s) _exit((s))
1036 #define PerlProc_execl(c,w,x,y,z) \
1037 execl((c), (w), (x), (y), (z))
1038 #define PerlProc_execv(c, a) execv((c), (a))
1039 #define PerlProc_execvp(c, a) execvp((c), (a))
1040 #define PerlProc_getuid() getuid()
1041 #define PerlProc_geteuid() geteuid()
1042 #define PerlProc_getgid() getgid()
1043 #define PerlProc_getegid() getegid()
1044 #define PerlProc_getlogin() getlogin()
1045 #define PerlProc_kill(i, a) kill((i), (a))
1046 #define PerlProc_killpg(i, a) killpg((i), (a))
1047 #define PerlProc_pause() Pause()
1048 #define PerlProc_popen(c, m) my_popen((c), (m))
1049 #define PerlProc_pclose(f) my_pclose((f))
1050 #define PerlProc_pipe(fd) pipe((fd))
1051 #define PerlProc_setuid(u) setuid((u))
1052 #define PerlProc_setgid(g) setgid((g))
1053 #define PerlProc_sleep(t) sleep((t))
1054 #define PerlProc_times(t) times((t))
1055 #define PerlProc_wait(t) wait((t))
1056 #define PerlProc_waitpid(p,s,f) waitpid((p), (s), (f))
1057 #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
1058 #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
1059 #define PerlProc_signal(n, h) signal((n), (h))
1062 #define PerlProc_DynaLoad(f) \
1064 #define PerlProc_GetOSError(s,e) \
1065 win32_str_os_error((s), (e))
1067 #endif /* PERL_IMPLICIT_SYS */
1070 Interface for perl socket functions
1073 #if defined(PERL_IMPLICIT_SYS)
1077 typedef u_long (*LPHtonl)(struct IPerlSock*, u_long);
1078 typedef u_short (*LPHtons)(struct IPerlSock*, u_short);
1079 typedef u_long (*LPNtohl)(struct IPerlSock*, u_long);
1080 typedef u_short (*LPNtohs)(struct IPerlSock*, u_short);
1081 typedef SOCKET (*LPAccept)(struct IPerlSock*, SOCKET,
1082 struct sockaddr*, int*);
1083 typedef int (*LPBind)(struct IPerlSock*, SOCKET,
1084 const struct sockaddr*, int);
1085 typedef int (*LPConnect)(struct IPerlSock*, SOCKET,
1086 const struct sockaddr*, int);
1087 typedef void (*LPEndhostent)(struct IPerlSock*);
1088 typedef void (*LPEndnetent)(struct IPerlSock*);
1089 typedef void (*LPEndprotoent)(struct IPerlSock*);
1090 typedef void (*LPEndservent)(struct IPerlSock*);
1091 typedef int (*LPGethostname)(struct IPerlSock*, char*, int);
1092 typedef int (*LPGetpeername)(struct IPerlSock*, SOCKET,
1093 struct sockaddr*, int*);
1094 typedef struct hostent* (*LPGethostbyaddr)(struct IPerlSock*, const char*,
1096 typedef struct hostent* (*LPGethostbyname)(struct IPerlSock*, const char*);
1097 typedef struct hostent* (*LPGethostent)(struct IPerlSock*);
1098 typedef struct netent* (*LPGetnetbyaddr)(struct IPerlSock*, long, int);
1099 typedef struct netent* (*LPGetnetbyname)(struct IPerlSock*, const char*);
1100 typedef struct netent* (*LPGetnetent)(struct IPerlSock*);
1101 typedef struct protoent*(*LPGetprotobyname)(struct IPerlSock*, const char*);
1102 typedef struct protoent*(*LPGetprotobynumber)(struct IPerlSock*, int);
1103 typedef struct protoent*(*LPGetprotoent)(struct IPerlSock*);
1104 typedef struct servent* (*LPGetservbyname)(struct IPerlSock*, const char*,
1106 typedef struct servent* (*LPGetservbyport)(struct IPerlSock*, int,
1108 typedef struct servent* (*LPGetservent)(struct IPerlSock*);
1109 typedef int (*LPGetsockname)(struct IPerlSock*, SOCKET,
1110 struct sockaddr*, int*);
1111 typedef int (*LPGetsockopt)(struct IPerlSock*, SOCKET, int, int,
1113 typedef unsigned long (*LPInetAddr)(struct IPerlSock*, const char*);
1114 typedef char* (*LPInetNtoa)(struct IPerlSock*, struct in_addr);
1115 typedef int (*LPListen)(struct IPerlSock*, SOCKET, int);
1116 typedef int (*LPRecv)(struct IPerlSock*, SOCKET, char*, int, int);
1117 typedef int (*LPRecvfrom)(struct IPerlSock*, SOCKET, char*, int,
1118 int, struct sockaddr*, int*);
1119 typedef int (*LPSelect)(struct IPerlSock*, int, char*, char*,
1120 char*, const struct timeval*);
1121 typedef int (*LPSend)(struct IPerlSock*, SOCKET, const char*, int,
1123 typedef int (*LPSendto)(struct IPerlSock*, SOCKET, const char*,
1124 int, int, const struct sockaddr*, int);
1125 typedef void (*LPSethostent)(struct IPerlSock*, int);
1126 typedef void (*LPSetnetent)(struct IPerlSock*, int);
1127 typedef void (*LPSetprotoent)(struct IPerlSock*, int);
1128 typedef void (*LPSetservent)(struct IPerlSock*, int);
1129 typedef int (*LPSetsockopt)(struct IPerlSock*, SOCKET, int, int,
1131 typedef int (*LPShutdown)(struct IPerlSock*, SOCKET, int);
1132 typedef SOCKET (*LPSocket)(struct IPerlSock*, int, int, int);
1133 typedef int (*LPSocketpair)(struct IPerlSock*, int, int, int,
1136 typedef int (*LPClosesocket)(struct IPerlSock*, SOCKET s);
1148 LPEndhostent pEndhostent;
1149 LPEndnetent pEndnetent;
1150 LPEndprotoent pEndprotoent;
1151 LPEndservent pEndservent;
1152 LPGethostname pGethostname;
1153 LPGetpeername pGetpeername;
1154 LPGethostbyaddr pGethostbyaddr;
1155 LPGethostbyname pGethostbyname;
1156 LPGethostent pGethostent;
1157 LPGetnetbyaddr pGetnetbyaddr;
1158 LPGetnetbyname pGetnetbyname;
1159 LPGetnetent pGetnetent;
1160 LPGetprotobyname pGetprotobyname;
1161 LPGetprotobynumber pGetprotobynumber;
1162 LPGetprotoent pGetprotoent;
1163 LPGetservbyname pGetservbyname;
1164 LPGetservbyport pGetservbyport;
1165 LPGetservent pGetservent;
1166 LPGetsockname pGetsockname;
1167 LPGetsockopt pGetsockopt;
1168 LPInetAddr pInetAddr;
1169 LPInetNtoa pInetNtoa;
1172 LPRecvfrom pRecvfrom;
1176 LPSethostent pSethostent;
1177 LPSetnetent pSetnetent;
1178 LPSetprotoent pSetprotoent;
1179 LPSetservent pSetservent;
1180 LPSetsockopt pSetsockopt;
1181 LPShutdown pShutdown;
1183 LPSocketpair pSocketpair;
1185 LPClosesocket pClosesocket;
1189 struct IPerlSockInfo
1191 unsigned long nCount; /* number of entries expected */
1192 struct IPerlSock perlSockList;
1195 #define PerlSock_htonl(x) \
1196 (*PL_Sock->pHtonl)(PL_Sock, x)
1197 #define PerlSock_htons(x) \
1198 (*PL_Sock->pHtons)(PL_Sock, x)
1199 #define PerlSock_ntohl(x) \
1200 (*PL_Sock->pNtohl)(PL_Sock, x)
1201 #define PerlSock_ntohs(x) \
1202 (*PL_Sock->pNtohs)(PL_Sock, x)
1203 #define PerlSock_accept(s, a, l) \
1204 (*PL_Sock->pAccept)(PL_Sock, s, a, l)
1205 #define PerlSock_bind(s, n, l) \
1206 (*PL_Sock->pBind)(PL_Sock, s, n, l)
1207 #define PerlSock_connect(s, n, l) \
1208 (*PL_Sock->pConnect)(PL_Sock, s, n, l)
1209 #define PerlSock_endhostent() \
1210 (*PL_Sock->pEndhostent)(PL_Sock)
1211 #define PerlSock_endnetent() \
1212 (*PL_Sock->pEndnetent)(PL_Sock)
1213 #define PerlSock_endprotoent() \
1214 (*PL_Sock->pEndprotoent)(PL_Sock)
1215 #define PerlSock_endservent() \
1216 (*PL_Sock->pEndservent)(PL_Sock)
1217 #define PerlSock_gethostbyaddr(a, l, t) \
1218 (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t)
1219 #define PerlSock_gethostbyname(n) \
1220 (*PL_Sock->pGethostbyname)(PL_Sock, n)
1221 #define PerlSock_gethostent() \
1222 (*PL_Sock->pGethostent)(PL_Sock)
1223 #define PerlSock_gethostname(n, l) \
1224 (*PL_Sock->pGethostname)(PL_Sock, n, l)
1225 #define PerlSock_getnetbyaddr(n, t) \
1226 (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t)
1227 #define PerlSock_getnetbyname(c) \
1228 (*PL_Sock->pGetnetbyname)(PL_Sock, c)
1229 #define PerlSock_getnetent() \
1230 (*PL_Sock->pGetnetent)(PL_Sock)
1231 #define PerlSock_getpeername(s, n, l) \
1232 (*PL_Sock->pGetpeername)(PL_Sock, s, n, l)
1233 #define PerlSock_getprotobyname(n) \
1234 (*PL_Sock->pGetprotobyname)(PL_Sock, n)
1235 #define PerlSock_getprotobynumber(n) \
1236 (*PL_Sock->pGetprotobynumber)(PL_Sock, n)
1237 #define PerlSock_getprotoent() \
1238 (*PL_Sock->pGetprotoent)(PL_Sock)
1239 #define PerlSock_getservbyname(n, p) \
1240 (*PL_Sock->pGetservbyname)(PL_Sock, n, p)
1241 #define PerlSock_getservbyport(port, p) \
1242 (*PL_Sock->pGetservbyport)(PL_Sock, port, p)
1243 #define PerlSock_getservent() \
1244 (*PL_Sock->pGetservent)(PL_Sock)
1245 #define PerlSock_getsockname(s, n, l) \
1246 (*PL_Sock->pGetsockname)(PL_Sock, s, n, l)
1247 #define PerlSock_getsockopt(s,l,n,v,i) \
1248 (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i)
1249 #define PerlSock_inet_addr(c) \
1250 (*PL_Sock->pInetAddr)(PL_Sock, c)
1251 #define PerlSock_inet_ntoa(i) \
1252 (*PL_Sock->pInetNtoa)(PL_Sock, i)
1253 #define PerlSock_listen(s, b) \
1254 (*PL_Sock->pListen)(PL_Sock, s, b)
1255 #define PerlSock_recv(s, b, l, f) \
1256 (*PL_Sock->pRecv)(PL_Sock, s, b, l, f)
1257 #define PerlSock_recvfrom(s,b,l,f,from,fromlen) \
1258 (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen)
1259 #define PerlSock_select(n, r, w, e, t) \
1260 (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t)
1261 #define PerlSock_send(s, b, l, f) \
1262 (*PL_Sock->pSend)(PL_Sock, s, b, l, f)
1263 #define PerlSock_sendto(s, b, l, f, t, tlen) \
1264 (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen)
1265 #define PerlSock_sethostent(f) \
1266 (*PL_Sock->pSethostent)(PL_Sock, f)
1267 #define PerlSock_setnetent(f) \
1268 (*PL_Sock->pSetnetent)(PL_Sock, f)
1269 #define PerlSock_setprotoent(f) \
1270 (*PL_Sock->pSetprotoent)(PL_Sock, f)
1271 #define PerlSock_setservent(f) \
1272 (*PL_Sock->pSetservent)(PL_Sock, f)
1273 #define PerlSock_setsockopt(s, l, n, v, len) \
1274 (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len)
1275 #define PerlSock_shutdown(s, h) \
1276 (*PL_Sock->pShutdown)(PL_Sock, s, h)
1277 #define PerlSock_socket(a, t, p) \
1278 (*PL_Sock->pSocket)(PL_Sock, a, t, p)
1279 #define PerlSock_socketpair(a, t, p, f) \
1280 (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f)
1283 #define PerlSock_closesocket(s) \
1284 (*PL_Sock->pClosesocket)(PL_Sock, s)
1287 #else /* PERL_IMPLICIT_SYS */
1289 #define PerlSock_htonl(x) htonl(x)
1290 #define PerlSock_htons(x) htons(x)
1291 #define PerlSock_ntohl(x) ntohl(x)
1292 #define PerlSock_ntohs(x) ntohs(x)
1293 #define PerlSock_accept(s, a, l) accept(s, a, l)
1294 #define PerlSock_bind(s, n, l) bind(s, n, l)
1295 #define PerlSock_connect(s, n, l) connect(s, n, l)
1297 #define PerlSock_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t)
1298 #define PerlSock_gethostbyname(n) gethostbyname(n)
1299 #define PerlSock_gethostent gethostent
1300 #define PerlSock_endhostent endhostent
1301 #define PerlSock_gethostname(n, l) gethostname(n, l)
1303 #define PerlSock_getnetbyaddr(n, t) getnetbyaddr(n, t)
1304 #define PerlSock_getnetbyname(n) getnetbyname(n)
1305 #define PerlSock_getnetent getnetent
1306 #define PerlSock_endnetent endnetent
1307 #define PerlSock_getpeername(s, n, l) getpeername(s, n, l)
1309 #define PerlSock_getprotobyname(n) getprotobyname(n)
1310 #define PerlSock_getprotobynumber(n) getprotobynumber(n)
1311 #define PerlSock_getprotoent getprotoent
1312 #define PerlSock_endprotoent endprotoent
1314 #define PerlSock_getservbyname(n, p) getservbyname(n, p)
1315 #define PerlSock_getservbyport(port, p) getservbyport(port, p)
1316 #define PerlSock_getservent getservent
1317 #define PerlSock_endservent endservent
1319 #define PerlSock_getsockname(s, n, l) getsockname(s, n, l)
1320 #define PerlSock_getsockopt(s,l,n,v,i) getsockopt(s, l, n, v, i)
1321 #define PerlSock_inet_addr(c) inet_addr(c)
1322 #define PerlSock_inet_ntoa(i) inet_ntoa(i)
1323 #define PerlSock_listen(s, b) listen(s, b)
1324 #define PerlSock_recv(s, b, l, f) recv(s, b, l, f)
1325 #define PerlSock_recvfrom(s, b, l, f, from, fromlen) \
1326 recvfrom(s, b, l, f, from, fromlen)
1327 #define PerlSock_select(n, r, w, e, t) select(n, r, w, e, t)
1328 #define PerlSock_send(s, b, l, f) send(s, b, l, f)
1329 #define PerlSock_sendto(s, b, l, f, t, tlen) \
1330 sendto(s, b, l, f, t, tlen)
1331 #define PerlSock_sethostent(f) sethostent(f)
1332 #define PerlSock_setnetent(f) setnetent(f)
1333 #define PerlSock_setprotoent(f) setprotoent(f)
1334 #define PerlSock_setservent(f) setservent(f)
1335 #define PerlSock_setsockopt(s, l, n, v, len) \
1336 setsockopt(s, l, n, v, len)
1337 #define PerlSock_shutdown(s, h) shutdown(s, h)
1338 #define PerlSock_socket(a, t, p) socket(a, t, p)
1339 #define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f)
1342 #define PerlSock_closesocket(s) closesocket(s)
1345 #endif /* PERL_IMPLICIT_SYS */
1356 here so that Configure picks them up. Perl core does not
1357 use them but somebody might want to extend Socket:: or IO::
1360 Jarkko Hietaniemi November 1998
1364 #endif /* __Inc__IPerl___ */