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