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