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