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