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