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