2 * iperlsys.h - Perl's interface to the system
4 * This file defines the system level functionality that perl needs.
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
13 #ifndef __Inc__IPerl___
14 #define __Inc__IPerl___
17 * PerlXXX_YYY explained - DickH and DougL @ ActiveState.com
19 * XXX := functional group
20 * YYY := stdlib/OS function name
22 * Continuing with the theme of PerlIO, all OS functionality was
23 * encapsulated into one of several interfaces.
26 * PerlLIO - low level I/O
27 * PerlMem - malloc, realloc, free
28 * PerlDir - directory related
29 * PerlEnv - process environment handling
30 * PerlProc - process control
31 * PerlSock - socket functions
34 * The features of this are:
35 * 1. All OS dependant code is in the Perl Host and not the Perl Core.
36 * (At least this is the holy grail goal of this work)
37 * 2. The Perl Host (see perl.h for description) can provide a new and
38 * improved interface to OS functionality if required.
39 * 3. Developers can easily hook into the OS calls for instrumentation
40 * or diagnostic purposes.
42 * What was changed to do this:
43 * 1. All calls to OS functions were replaced with PerlXXX_YYY
48 Interface for perl stdio functions, or whatever we are Configure-d
54 # if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
55 typedef Signal_t (*Sighandler_t) (int, siginfo_t*, void*);
57 typedef Signal_t (*Sighandler_t) (int);
61 #if defined(PERL_IMPLICIT_SYS)
65 struct IPerlStdIOInfo;
66 typedef FILE* (*LPStdin)(struct IPerlStdIO*);
67 typedef FILE* (*LPStdout)(struct IPerlStdIO*);
68 typedef FILE* (*LPStderr)(struct IPerlStdIO*);
69 typedef FILE* (*LPOpen)(struct IPerlStdIO*, const char*,
71 typedef int (*LPClose)(struct IPerlStdIO*, FILE*);
72 typedef int (*LPEof)(struct IPerlStdIO*, FILE*);
73 typedef int (*LPError)(struct IPerlStdIO*, FILE*);
74 typedef void (*LPClearerr)(struct IPerlStdIO*, FILE*);
75 typedef int (*LPGetc)(struct IPerlStdIO*, FILE*);
76 typedef STDCHAR* (*LPGetBase)(struct IPerlStdIO*, FILE*);
77 typedef int (*LPGetBufsiz)(struct IPerlStdIO*, FILE*);
78 typedef int (*LPGetCnt)(struct IPerlStdIO*, FILE*);
79 typedef STDCHAR* (*LPGetPtr)(struct IPerlStdIO*, FILE*);
80 typedef char* (*LPGets)(struct IPerlStdIO*, char*, int, FILE*);
81 typedef int (*LPPutc)(struct IPerlStdIO*, int, FILE*);
82 typedef int (*LPPuts)(struct IPerlStdIO*, const char *, FILE*);
83 typedef int (*LPFlush)(struct IPerlStdIO*, FILE*);
84 typedef int (*LPUngetc)(struct IPerlStdIO*, int,FILE*);
85 typedef int (*LPFileno)(struct IPerlStdIO*, FILE*);
86 typedef FILE* (*LPFdopen)(struct IPerlStdIO*, int, const char*);
87 typedef FILE* (*LPReopen)(struct IPerlStdIO*, const char*,
89 typedef SSize_t (*LPRead)(struct IPerlStdIO*, void*, Size_t, Size_t, FILE *);
90 typedef SSize_t (*LPWrite)(struct IPerlStdIO*, const void*, Size_t, Size_t, FILE *);
91 typedef void (*LPSetBuf)(struct IPerlStdIO*, FILE*, char*);
92 typedef int (*LPSetVBuf)(struct IPerlStdIO*, FILE*, char*, int,
94 typedef void (*LPSetCnt)(struct IPerlStdIO*, FILE*, int);
97 typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, STDCHAR*);
98 #elif defined(NETWARE)
99 typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, STDCHAR*, int);
102 typedef void (*LPSetlinebuf)(struct IPerlStdIO*, FILE*);
103 typedef int (*LPPrintf)(struct IPerlStdIO*, FILE*, const char*,
105 typedef int (*LPVprintf)(struct IPerlStdIO*, FILE*, const char*,
107 typedef Off_t (*LPTell)(struct IPerlStdIO*, FILE*);
108 typedef int (*LPSeek)(struct IPerlStdIO*, FILE*, Off_t, int);
109 typedef void (*LPRewind)(struct IPerlStdIO*, FILE*);
110 typedef FILE* (*LPTmpfile)(struct IPerlStdIO*);
111 typedef int (*LPGetpos)(struct IPerlStdIO*, FILE*, Fpos_t*);
112 typedef int (*LPSetpos)(struct IPerlStdIO*, FILE*,
114 typedef void (*LPInit)(struct IPerlStdIO*);
115 typedef void (*LPInitOSExtras)(struct IPerlStdIO*);
116 typedef FILE* (*LPFdupopen)(struct IPerlStdIO*, FILE*);
127 LPClearerr pClearerr;
130 LPGetBufsiz pGetBufsiz;
147 LPSetlinebuf pSetlinebuf;
157 LPInitOSExtras pInitOSExtras;
158 LPFdupopen pFdupopen;
161 struct IPerlStdIOInfo
163 unsigned long nCount; /* number of entries expected */
164 struct IPerlStdIO perlStdIOList;
167 /* These do not belong here ... NI-S, 14 Nov 2000 */
170 # define PerlSIO_has_cntptr(f) 1
171 # ifdef STDIO_PTR_LVALUE
172 # ifdef STDIO_CNT_LVALUE
173 # define PerlSIO_canset_cnt(f) 1
174 # ifdef STDIO_PTR_LVAL_NOCHANGE_CNT
175 # define PerlSIO_fast_gets(f) 1
177 # else /* STDIO_CNT_LVALUE */
178 # define PerlSIO_canset_cnt(f) 0
180 # else /* STDIO_PTR_LVALUE */
181 # ifdef STDIO_PTR_LVAL_SETS_CNT
182 # define PerlSIO_fast_gets(f) 1
185 #else /* USE_STDIO_PTR */
186 # define PerlSIO_has_cntptr(f) 0
187 # define PerlSIO_canset_cnt(f) 0
188 #endif /* USE_STDIO_PTR */
190 #ifndef PerlSIO_fast_gets
191 #define PerlSIO_fast_gets(f) 0
195 #define PerlSIO_has_base(f) 1
197 #define PerlSIO_has_base(f) 0
200 /* Now take FILE * via function table */
202 #define PerlSIO_stdin \
203 (*PL_StdIO->pStdin)(PL_StdIO)
204 #define PerlSIO_stdout \
205 (*PL_StdIO->pStdout)(PL_StdIO)
206 #define PerlSIO_stderr \
207 (*PL_StdIO->pStderr)(PL_StdIO)
208 #define PerlSIO_fopen(x,y) \
209 (*PL_StdIO->pOpen)(PL_StdIO, (x),(y))
210 #define PerlSIO_fclose(f) \
211 (*PL_StdIO->pClose)(PL_StdIO, (f))
212 #define PerlSIO_feof(f) \
213 (*PL_StdIO->pEof)(PL_StdIO, (f))
214 #define PerlSIO_ferror(f) \
215 (*PL_StdIO->pError)(PL_StdIO, (f))
216 #define PerlSIO_clearerr(f) \
217 (*PL_StdIO->pClearerr)(PL_StdIO, (f))
218 #define PerlSIO_fgetc(f) \
219 (*PL_StdIO->pGetc)(PL_StdIO, (f))
220 #define PerlSIO_get_base(f) \
221 (*PL_StdIO->pGetBase)(PL_StdIO, (f))
222 #define PerlSIO_get_bufsiz(f) \
223 (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f))
224 #define PerlSIO_get_cnt(f) \
225 (*PL_StdIO->pGetCnt)(PL_StdIO, (f))
226 #define PerlSIO_get_ptr(f) \
227 (*PL_StdIO->pGetPtr)(PL_StdIO, (f))
228 #define PerlSIO_fputc(c,f) \
229 (*PL_StdIO->pPutc)(PL_StdIO, (c),(f))
230 #define PerlSIO_fputs(s,f) \
231 (*PL_StdIO->pPuts)(PL_StdIO, (s),(f))
232 #define PerlSIO_fflush(f) \
233 (*PL_StdIO->pFlush)(PL_StdIO, (f))
234 #define PerlSIO_fgets(s, n, f) \
235 (*PL_StdIO->pGets)(PL_StdIO, s, n, (f))
236 #define PerlSIO_ungetc(c,f) \
237 (*PL_StdIO->pUngetc)(PL_StdIO, (c),(f))
238 #define PerlSIO_fileno(f) \
239 (*PL_StdIO->pFileno)(PL_StdIO, (f))
240 #define PerlSIO_fdopen(f, s) \
241 (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s))
242 #define PerlSIO_freopen(p, m, f) \
243 (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f))
244 #define PerlSIO_fread(buf,sz,count,f) \
245 (*PL_StdIO->pRead)(PL_StdIO, (buf), (sz), (count), (f))
246 #define PerlSIO_fwrite(buf,sz,count,f) \
247 (*PL_StdIO->pWrite)(PL_StdIO, (buf), (sz), (count), (f))
248 #define PerlSIO_setbuf(f,b) \
249 (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b))
250 #define PerlSIO_setvbuf(f,b,t,s) \
251 (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s))
252 #define PerlSIO_set_cnt(f,c) \
253 (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c))
254 #define PerlSIO_set_ptr(f,p) \
255 (*PL_StdIO->pSetPtr)(PL_StdIO, (f), (p))
256 #define PerlSIO_setlinebuf(f) \
257 (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f))
258 #define PerlSIO_printf Perl_fprintf_nocontext
259 #define PerlSIO_stdoutf Perl_printf_nocontext
260 #define PerlSIO_vprintf(f,fmt,a) \
261 (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a)
262 #define PerlSIO_ftell(f) \
263 (*PL_StdIO->pTell)(PL_StdIO, (f))
264 #define PerlSIO_fseek(f,o,w) \
265 (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w))
266 #define PerlSIO_fgetpos(f,p) \
267 (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p))
268 #define PerlSIO_fsetpos(f,p) \
269 (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p))
270 #define PerlSIO_rewind(f) \
271 (*PL_StdIO->pRewind)(PL_StdIO, (f))
272 #define PerlSIO_tmpfile() \
273 (*PL_StdIO->pTmpfile)(PL_StdIO)
274 #define PerlSIO_init() \
275 (*PL_StdIO->pInit)(PL_StdIO)
276 #undef init_os_extras
277 #define init_os_extras() \
278 (*PL_StdIO->pInitOSExtras)(PL_StdIO)
279 #define PerlSIO_fdupopen(f) \
280 (*PL_StdIO->pFdupopen)(PL_StdIO, (f))
282 #else /* PERL_IMPLICIT_SYS */
284 #define PerlSIO_stdin stdin
285 #define PerlSIO_stdout stdout
286 #define PerlSIO_stderr stderr
287 #define PerlSIO_fopen(x,y) fopen(x,y)
289 /* Work around VOS bug posix-979, wrongly setting errno when at end of file. */
290 #define PerlSIO_fclose(f) (((errno==1025)?errno=0:0),fclose(f))
291 #define PerlSIO_feof(f) (((errno==1025)?errno=0:0),feof(f))
292 #define PerlSIO_ferror(f) (((errno==1025)?errno=0:0),ferror(f))
294 #define PerlSIO_fclose(f) fclose(f)
295 #define PerlSIO_feof(f) feof(f)
296 #define PerlSIO_ferror(f) ferror(f)
298 #define PerlSIO_clearerr(f) clearerr(f)
299 #define PerlSIO_fgetc(f) fgetc(f)
301 #define PerlSIO_get_base(f) FILE_base(f)
302 #define PerlSIO_get_bufsiz(f) FILE_bufsiz(f)
304 #define PerlSIO_get_base(f) NULL
305 #define PerlSIO_get_bufsiz(f) 0
308 #define PerlSIO_get_cnt(f) FILE_cnt(f)
309 #define PerlSIO_get_ptr(f) FILE_ptr(f)
311 #define PerlSIO_get_cnt(f) 0
312 #define PerlSIO_get_ptr(f) NULL
314 #define PerlSIO_fputc(c,f) fputc(c,f)
315 #define PerlSIO_fputs(s,f) fputs(s,f)
316 #define PerlSIO_fflush(f) Fflush(f)
317 #define PerlSIO_fgets(s, n, f) fgets(s,n,f)
319 /* Unusual definition of ungetc() here to accommodate fast_sv_gets()'
320 * belief that it can mix getc/ungetc with reads from stdio buffer */
322 int decc$ungetc(int __c, FILE *__stream);
324 # define PerlSIO_ungetc(c,f) ((c) == EOF ? EOF : \
325 ((*(f) && !((*(f))->_flag & _IONBF) && \
326 ((*(f))->_ptr > (*(f))->_base)) ? \
327 ((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f)))
329 # define PerlSIO_ungetc(c,f) ungetc(c,f)
331 #define PerlSIO_fileno(f) fileno(f)
332 #define PerlSIO_fdopen(f, s) fdopen(f,s)
333 #define PerlSIO_freopen(p, m, f) freopen(p,m,f)
334 #define PerlSIO_fread(buf,sz,count,f) fread(buf,sz,count,f)
335 #define PerlSIO_fwrite(buf,sz,count,f) fwrite(buf,sz,count,f)
336 #define PerlSIO_setbuf(f,b) setbuf(f,b)
337 #define PerlSIO_setvbuf(f,b,t,s) setvbuf(f,b,t,s)
338 #if defined(USE_STDIO_PTR) && defined(STDIO_CNT_LVALUE)
339 #define PerlSIO_set_cnt(f,c) FILE_cnt(f) = (c)
341 #define PerlSIO_set_cnt(f,c) PerlIOProc_abort()
343 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE)
344 #define PerlSIO_set_ptr(f,p) (FILE_ptr(f) = (p))
346 #define PerlSIO_set_ptr(f,p) PerlIOProc_abort()
348 #define PerlSIO_setlinebuf(f) setlinebuf(f)
349 #define PerlSIO_printf fprintf
350 #define PerlSIO_stdoutf printf
351 #define PerlSIO_vprintf(f,fmt,a) vfprintf(f,fmt,a)
352 #define PerlSIO_ftell(f) ftell(f)
353 #define PerlSIO_fseek(f,o,w) fseek(f,o,w)
354 #define PerlSIO_fgetpos(f,p) fgetpos(f,p)
355 #define PerlSIO_fsetpos(f,p) fsetpos(f,p)
356 #define PerlSIO_rewind(f) rewind(f)
357 #define PerlSIO_tmpfile() tmpfile()
358 #define PerlSIO_fdupopen(f) (f)
360 #endif /* PERL_IMPLICIT_SYS */
363 * Interface for directory functions
366 #if defined(PERL_IMPLICIT_SYS)
371 typedef int (*LPMakedir)(struct IPerlDir*, const char*, int);
372 typedef int (*LPChdir)(struct IPerlDir*, const char*);
373 typedef int (*LPRmdir)(struct IPerlDir*, const char*);
374 typedef int (*LPDirClose)(struct IPerlDir*, DIR*);
375 typedef DIR* (*LPDirOpen)(struct IPerlDir*, const char*);
376 typedef struct direct* (*LPDirRead)(struct IPerlDir*, DIR*);
377 typedef void (*LPDirRewind)(struct IPerlDir*, DIR*);
378 typedef void (*LPDirSeek)(struct IPerlDir*, DIR*, long);
379 typedef long (*LPDirTell)(struct IPerlDir*, DIR*);
381 typedef char* (*LPDirMapPathA)(struct IPerlDir*, const char*);
382 typedef WCHAR* (*LPDirMapPathW)(struct IPerlDir*, const WCHAR*);
397 LPDirMapPathA pMapPathA;
398 LPDirMapPathW pMapPathW;
404 unsigned long nCount; /* number of entries expected */
405 struct IPerlDir perlDirList;
408 #define PerlDir_mkdir(name, mode) \
409 (*PL_Dir->pMakedir)(PL_Dir, (name), (mode))
410 #define PerlDir_chdir(name) \
411 (*PL_Dir->pChdir)(PL_Dir, (name))
412 #define PerlDir_rmdir(name) \
413 (*PL_Dir->pRmdir)(PL_Dir, (name))
414 #define PerlDir_close(dir) \
415 (*PL_Dir->pClose)(PL_Dir, (dir))
416 #define PerlDir_open(name) \
417 (*PL_Dir->pOpen)(PL_Dir, (name))
418 #define PerlDir_read(dir) \
419 (*PL_Dir->pRead)(PL_Dir, (dir))
420 #define PerlDir_rewind(dir) \
421 (*PL_Dir->pRewind)(PL_Dir, (dir))
422 #define PerlDir_seek(dir, loc) \
423 (*PL_Dir->pSeek)(PL_Dir, (dir), (loc))
424 #define PerlDir_tell(dir) \
425 (*PL_Dir->pTell)(PL_Dir, (dir))
427 #define PerlDir_mapA(dir) \
428 (*PL_Dir->pMapPathA)(PL_Dir, (dir))
429 #define PerlDir_mapW(dir) \
430 (*PL_Dir->pMapPathW)(PL_Dir, (dir))
433 #else /* PERL_IMPLICIT_SYS */
435 #define PerlDir_mkdir(name, mode) Mkdir((name), (mode))
437 # define PerlDir_chdir(n) Chdir((n))
439 # define PerlDir_chdir(name) chdir((name))
441 #define PerlDir_rmdir(name) rmdir((name))
442 #define PerlDir_close(dir) closedir((dir))
443 #define PerlDir_open(name) opendir((name))
444 #define PerlDir_read(dir) readdir((dir))
445 #define PerlDir_rewind(dir) rewinddir((dir))
446 #define PerlDir_seek(dir, loc) seekdir((dir), (loc))
447 #define PerlDir_tell(dir) telldir((dir))
449 #define PerlDir_mapA(dir) dir
450 #define PerlDir_mapW(dir) dir
453 #endif /* PERL_IMPLICIT_SYS */
456 Interface for perl environment functions
459 #if defined(PERL_IMPLICIT_SYS)
464 typedef char* (*LPEnvGetenv)(struct IPerlEnv*, const char*);
465 typedef int (*LPEnvPutenv)(struct IPerlEnv*, const char*);
466 typedef char* (*LPEnvGetenv_len)(struct IPerlEnv*,
467 const char *varname, unsigned long *len);
468 typedef int (*LPEnvUname)(struct IPerlEnv*, struct utsname *name);
469 typedef void (*LPEnvClearenv)(struct IPerlEnv*);
470 typedef void* (*LPEnvGetChildenv)(struct IPerlEnv*);
471 typedef void (*LPEnvFreeChildenv)(struct IPerlEnv*, void* env);
472 typedef char* (*LPEnvGetChilddir)(struct IPerlEnv*);
473 typedef void (*LPEnvFreeChilddir)(struct IPerlEnv*, char* dir);
475 typedef char* (*LPENVGetenv)(struct IPerlEnv*, const char *varname);
476 typedef char* (*LPENVGetenv_len)(struct IPerlEnv*,
477 const char *varname, unsigned long *len);
480 typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*);
481 typedef char* (*LPEnvLibPath)(struct IPerlEnv*, WIN32_NO_REGISTRY_M_(const char*)
483 typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, const char*,
485 typedef char* (*LPEnvVendorLibPath)(struct IPerlEnv*, const char*,
487 typedef void (*LPEnvGetChildIO)(struct IPerlEnv*, child_IO_table*);
494 LPEnvGetenv_len pGetenv_len;
495 LPEnvUname pEnvUname;
496 LPEnvClearenv pClearenv;
497 LPEnvGetChildenv pGetChildenv;
498 LPEnvFreeChildenv pFreeChildenv;
499 LPEnvGetChilddir pGetChilddir;
500 LPEnvFreeChilddir pFreeChilddir;
502 LPENVGetenv pENVGetenv;
503 LPENVGetenv_len pENVGetenv_len;
507 LPEnvLibPath pLibPath;
508 LPEnvSiteLibPath pSiteLibPath;
509 LPEnvVendorLibPath pVendorLibPath;
510 LPEnvGetChildIO pGetChildIO;
516 unsigned long nCount; /* number of entries expected */
517 struct IPerlEnv perlEnvList;
520 #define PerlEnv_putenv(str) \
521 (*PL_Env->pPutenv)(PL_Env,(str))
522 #define PerlEnv_getenv(str) \
523 (*PL_Env->pGetenv)(PL_Env,(str))
524 #define PerlEnv_getenv_len(str,l) \
525 (*PL_Env->pGetenv_len)(PL_Env,(str), (l))
526 #define PerlEnv_clearenv() \
527 (*PL_Env->pClearenv)(PL_Env)
528 #define PerlEnv_get_childenv() \
529 (*PL_Env->pGetChildenv)(PL_Env)
530 #define PerlEnv_free_childenv(e) \
531 (*PL_Env->pFreeChildenv)(PL_Env, (e))
532 #define PerlEnv_get_childdir() \
533 (*PL_Env->pGetChilddir)(PL_Env)
534 #define PerlEnv_free_childdir(d) \
535 (*PL_Env->pFreeChilddir)(PL_Env, (d))
537 # define PerlEnv_ENVgetenv(str) \
538 (*PL_Env->pENVGetenv)(PL_Env,(str))
539 # define PerlEnv_ENVgetenv_len(str,l) \
540 (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l))
542 # define PerlEnv_ENVgetenv(str) \
543 PerlEnv_getenv((str))
544 # define PerlEnv_ENVgetenv_len(str,l) \
545 PerlEnv_getenv_len((str),(l))
547 #define PerlEnv_uname(name) \
548 (*PL_Env->pEnvUname)(PL_Env,(name))
550 #define PerlEnv_os_id() \
551 (*PL_Env->pEnvOsID)(PL_Env)
552 #define PerlEnv_lib_path(str, lenp) \
553 (*PL_Env->pLibPath)(PL_Env,WIN32_NO_REGISTRY_M_(str)(lenp))
554 #define PerlEnv_sitelib_path(str, lenp) \
555 (*PL_Env->pSiteLibPath)(PL_Env,(str),(lenp))
556 #define PerlEnv_vendorlib_path(str, lenp) \
557 (*PL_Env->pVendorLibPath)(PL_Env,(str),(lenp))
558 #define PerlEnv_get_child_IO(ptr) \
559 (*PL_Env->pGetChildIO)(PL_Env, ptr)
562 #else /* PERL_IMPLICIT_SYS */
564 #define PerlEnv_putenv(str) putenv((str))
565 #define PerlEnv_getenv(str) getenv((str))
566 #define PerlEnv_getenv_len(str,l) getenv_len((str), (l))
568 # define PerlEnv_ENVgetenv(str) ENVgetenv((str))
569 # define PerlEnv_ENVgetenv_len(str,l) ENVgetenv_len((str), (l))
571 # define PerlEnv_ENVgetenv(str) PerlEnv_getenv((str))
572 # define PerlEnv_ENVgetenv_len(str,l) PerlEnv_getenv_len((str), (l))
574 #define PerlEnv_uname(name) uname((name))
577 #define PerlEnv_os_id() win32_os_id()
578 #define PerlEnv_lib_path(str, lenp) win32_get_privlib(WIN32_NO_REGISTRY_M_(str) lenp)
579 #define PerlEnv_sitelib_path(str, lenp) win32_get_sitelib(str, lenp)
580 #define PerlEnv_vendorlib_path(str, lenp) win32_get_vendorlib(str, lenp)
581 #define PerlEnv_get_child_IO(ptr) win32_get_child_IO(ptr)
582 #define PerlEnv_clearenv() win32_clearenv()
583 #define PerlEnv_get_childenv() win32_get_childenv()
584 #define PerlEnv_free_childenv(e) win32_free_childenv((e))
585 #define PerlEnv_get_childdir() win32_get_childdir()
586 #define PerlEnv_free_childdir(d) win32_free_childdir((d))
588 #define PerlEnv_clearenv() clearenv()
589 #define PerlEnv_get_childenv() get_childenv()
590 #define PerlEnv_free_childenv(e) free_childenv((e))
591 #define PerlEnv_get_childdir() get_childdir()
592 #define PerlEnv_free_childdir(d) free_childdir((d))
595 #endif /* PERL_IMPLICIT_SYS */
598 Interface for perl low-level IO functions
601 #if defined(PERL_IMPLICIT_SYS)
603 struct utimbuf; /* prevent gcc warning about the use below */
608 typedef int (*LPLIOAccess)(struct IPerlLIO*, const char*, int);
609 typedef int (*LPLIOChmod)(struct IPerlLIO*, const char*, int);
610 typedef int (*LPLIOChown)(struct IPerlLIO*, const char*, uid_t,
612 typedef int (*LPLIOChsize)(struct IPerlLIO*, int, Off_t);
613 typedef int (*LPLIOClose)(struct IPerlLIO*, int);
614 typedef int (*LPLIODup)(struct IPerlLIO*, int);
615 typedef int (*LPLIODup2)(struct IPerlLIO*, int, int);
616 typedef int (*LPLIOFlock)(struct IPerlLIO*, int, int);
617 typedef int (*LPLIOFileStat)(struct IPerlLIO*, int, Stat_t*);
618 typedef int (*LPLIOIOCtl)(struct IPerlLIO*, int, unsigned int,
620 typedef int (*LPLIOIsatty)(struct IPerlLIO*, int);
621 typedef int (*LPLIOLink)(struct IPerlLIO*, const char*,
623 typedef Off_t (*LPLIOLseek)(struct IPerlLIO*, int, Off_t, int);
624 typedef int (*LPLIOLstat)(struct IPerlLIO*, const char*,
626 typedef char* (*LPLIOMktemp)(struct IPerlLIO*, char*);
627 typedef int (*LPLIOOpen)(struct IPerlLIO*, const char*, int);
628 typedef int (*LPLIOOpen3)(struct IPerlLIO*, const char*, int, int);
629 typedef int (*LPLIORead)(struct IPerlLIO*, int, void*, unsigned int);
630 typedef int (*LPLIORename)(struct IPerlLIO*, const char*,
633 typedef int (*LPLIOSetmode)(struct IPerlLIO*, FILE*, int);
635 typedef int (*LPLIOSetmode)(struct IPerlLIO*, int, int);
637 typedef int (*LPLIONameStat)(struct IPerlLIO*, const char*,
639 typedef char* (*LPLIOTmpnam)(struct IPerlLIO*, char*);
640 typedef int (*LPLIOUmask)(struct IPerlLIO*, int);
641 typedef int (*LPLIOUnlink)(struct IPerlLIO*, const char*);
642 typedef int (*LPLIOUtime)(struct IPerlLIO*, const char*, struct utimbuf*);
643 typedef int (*LPLIOWrite)(struct IPerlLIO*, int, const void*,
656 LPLIOFileStat pFileStat;
667 LPLIOSetmode pSetmode;
668 LPLIONameStat pNameStat;
678 unsigned long nCount; /* number of entries expected */
679 struct IPerlLIO perlLIOList;
682 #define PerlLIO_access(file, mode) \
683 (*PL_LIO->pAccess)(PL_LIO, (file), (mode))
684 #define PerlLIO_chmod(file, mode) \
685 (*PL_LIO->pChmod)(PL_LIO, (file), (mode))
686 #define PerlLIO_chown(file, owner, group) \
687 (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group))
688 #define PerlLIO_chsize(fd, size) \
689 (*PL_LIO->pChsize)(PL_LIO, (fd), (size))
690 #define PerlLIO_close(fd) \
691 (*PL_LIO->pClose)(PL_LIO, (fd))
692 #define PerlLIO_dup(fd) \
693 (*PL_LIO->pDup)(PL_LIO, (fd))
694 #define PerlLIO_dup2(fd1, fd2) \
695 (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2))
696 #define PerlLIO_flock(fd, op) \
697 (*PL_LIO->pFlock)(PL_LIO, (fd), (op))
698 #define PerlLIO_fstat(fd, buf) \
699 (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf))
700 #define PerlLIO_ioctl(fd, u, buf) \
701 (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf))
702 #define PerlLIO_isatty(fd) \
703 (*PL_LIO->pIsatty)(PL_LIO, (fd))
704 #define PerlLIO_link(oldname, newname) \
705 (*PL_LIO->pLink)(PL_LIO, (oldname), (newname))
706 #define PerlLIO_lseek(fd, offset, mode) \
707 (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode))
708 #define PerlLIO_lstat(name, buf) \
709 (*PL_LIO->pLstat)(PL_LIO, (name), (buf))
710 #define PerlLIO_mktemp(file) \
711 (*PL_LIO->pMktemp)(PL_LIO, (file))
712 #define PerlLIO_open(file, flag) \
713 (*PL_LIO->pOpen)(PL_LIO, (file), (flag))
714 #define PerlLIO_open3(file, flag, perm) \
715 (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm))
716 #define PerlLIO_read(fd, buf, count) \
717 (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count))
718 #define PerlLIO_rename(oname, newname) \
719 (*PL_LIO->pRename)(PL_LIO, (oname), (newname))
720 #define PerlLIO_setmode(fd, mode) \
721 (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode))
722 #define PerlLIO_stat(name, buf) \
723 (*PL_LIO->pNameStat)(PL_LIO, (name), (buf))
724 #define PerlLIO_tmpnam(str) \
725 (*PL_LIO->pTmpnam)(PL_LIO, (str))
726 #define PerlLIO_umask(mode) \
727 (*PL_LIO->pUmask)(PL_LIO, (mode))
728 #define PerlLIO_unlink(file) \
729 (*PL_LIO->pUnlink)(PL_LIO, (file))
730 #define PerlLIO_utime(file, time) \
731 (*PL_LIO->pUtime)(PL_LIO, (file), (time))
732 #define PerlLIO_write(fd, buf, count) \
733 (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count))
735 #else /* PERL_IMPLICIT_SYS */
737 #define PerlLIO_access(file, mode) access((file), (mode))
738 #define PerlLIO_chmod(file, mode) chmod((file), (mode))
739 #define PerlLIO_chown(file, owner, grp) chown((file), (owner), (grp))
740 #if defined(HAS_TRUNCATE)
741 # define PerlLIO_chsize(fd, size) ftruncate((fd), (size))
742 #elif defined(HAS_CHSIZE)
743 # define PerlLIO_chsize(fd, size) chsize((fd), (size))
745 # define PerlLIO_chsize(fd, size) my_chsize((fd), (size))
747 #define PerlLIO_close(fd) close((fd))
748 #define PerlLIO_dup(fd) dup((fd))
749 #define PerlLIO_dup2(fd1, fd2) dup2((fd1), (fd2))
750 #define PerlLIO_flock(fd, op) FLOCK((fd), (op))
751 #define PerlLIO_fstat(fd, buf) Fstat((fd), (buf))
752 #define PerlLIO_ioctl(fd, u, buf) ioctl((fd), (u), (buf))
753 #define PerlLIO_isatty(fd) isatty((fd))
754 #define PerlLIO_link(oldname, newname) link((oldname), (newname))
755 #define PerlLIO_lseek(fd, offset, mode) lseek((fd), (offset), (mode))
756 #define PerlLIO_stat(name, buf) Stat((name), (buf))
758 # define PerlLIO_lstat(name, buf) lstat((name), (buf))
760 # define PerlLIO_lstat(name, buf) PerlLIO_stat((name), (buf))
762 #define PerlLIO_mktemp(file) mktemp((file))
763 #define PerlLIO_open(file, flag) open((file), (flag))
764 #define PerlLIO_open3(file, flag, perm) open((file), (flag), (perm))
765 #define PerlLIO_read(fd, buf, count) read((fd), (buf), (count))
766 #define PerlLIO_rename(old, new) rename((old), (new))
767 #define PerlLIO_setmode(fd, mode) setmode((fd), (mode))
768 #define PerlLIO_tmpnam(str) tmpnam((str))
769 #define PerlLIO_umask(mode) umask((mode))
770 #define PerlLIO_unlink(file) unlink((file))
771 #define PerlLIO_utime(file, time) utime((file), (time))
772 #define PerlLIO_write(fd, buf, count) write((fd), (buf), (count))
774 #endif /* PERL_IMPLICIT_SYS */
777 Interface for perl memory allocation
780 #if defined(PERL_IMPLICIT_SYS)
785 typedef void* (*LPMemMalloc)(struct IPerlMem*, size_t);
786 typedef void* (*LPMemRealloc)(struct IPerlMem*, void*, size_t);
787 typedef void (*LPMemFree)(struct IPerlMem*, void*);
788 typedef void* (*LPMemCalloc)(struct IPerlMem*, size_t, size_t);
789 typedef void (*LPMemGetLock)(struct IPerlMem*);
790 typedef void (*LPMemFreeLock)(struct IPerlMem*);
791 typedef int (*LPMemIsLocked)(struct IPerlMem*);
796 LPMemRealloc pRealloc;
799 LPMemGetLock pGetLock;
800 LPMemFreeLock pFreeLock;
801 LPMemIsLocked pIsLocked;
806 unsigned long nCount; /* number of entries expected */
807 struct IPerlMem perlMemList;
810 /* Interpreter specific memory macros */
811 #define PerlMem_malloc(size) \
812 (*PL_Mem->pMalloc)(PL_Mem, (size))
813 #define PerlMem_realloc(buf, size) \
814 (*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
815 #define PerlMem_free(buf) \
816 (*PL_Mem->pFree)(PL_Mem, (buf))
817 #define PerlMem_calloc(num, size) \
818 (*PL_Mem->pCalloc)(PL_Mem, (num), (size))
819 #define PerlMem_get_lock() \
820 (*PL_Mem->pGetLock)(PL_Mem)
821 #define PerlMem_free_lock() \
822 (*PL_Mem->pFreeLock)(PL_Mem)
823 #define PerlMem_is_locked() \
824 (*PL_Mem->pIsLocked)(PL_Mem)
826 /* Shared memory macros */
829 #define PerlMemShared_malloc(size) \
830 (*PL_Mem->pMalloc)(PL_Mem, (size))
831 #define PerlMemShared_realloc(buf, size) \
832 (*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
833 #define PerlMemShared_free(buf) \
834 (*PL_Mem->pFree)(PL_Mem, (buf))
835 #define PerlMemShared_calloc(num, size) \
836 (*PL_Mem->pCalloc)(PL_Mem, (num), (size))
837 #define PerlMemShared_get_lock() \
838 (*PL_Mem->pGetLock)(PL_Mem)
839 #define PerlMemShared_free_lock() \
840 (*PL_Mem->pFreeLock)(PL_Mem)
841 #define PerlMemShared_is_locked() \
842 (*PL_Mem->pIsLocked)(PL_Mem)
846 #define PerlMemShared_malloc(size) \
847 (*PL_MemShared->pMalloc)(PL_MemShared, (size))
848 #define PerlMemShared_realloc(buf, size) \
849 (*PL_MemShared->pRealloc)(PL_MemShared, (buf), (size))
850 #define PerlMemShared_free(buf) \
851 (*PL_MemShared->pFree)(PL_MemShared, (buf))
852 #define PerlMemShared_calloc(num, size) \
853 (*PL_MemShared->pCalloc)(PL_MemShared, (num), (size))
854 #define PerlMemShared_get_lock() \
855 (*PL_MemShared->pGetLock)(PL_MemShared)
856 #define PerlMemShared_free_lock() \
857 (*PL_MemShared->pFreeLock)(PL_MemShared)
858 #define PerlMemShared_is_locked() \
859 (*PL_MemShared->pIsLocked)(PL_MemShared)
863 /* Parse tree memory macros */
864 #define PerlMemParse_malloc(size) \
865 (*PL_MemParse->pMalloc)(PL_MemParse, (size))
866 #define PerlMemParse_realloc(buf, size) \
867 (*PL_MemParse->pRealloc)(PL_MemParse, (buf), (size))
868 #define PerlMemParse_free(buf) \
869 (*PL_MemParse->pFree)(PL_MemParse, (buf))
870 #define PerlMemParse_calloc(num, size) \
871 (*PL_MemParse->pCalloc)(PL_MemParse, (num), (size))
872 #define PerlMemParse_get_lock() \
873 (*PL_MemParse->pGetLock)(PL_MemParse)
874 #define PerlMemParse_free_lock() \
875 (*PL_MemParse->pFreeLock)(PL_MemParse)
876 #define PerlMemParse_is_locked() \
877 (*PL_MemParse->pIsLocked)(PL_MemParse)
880 #else /* PERL_IMPLICIT_SYS */
882 /* Interpreter specific memory macros */
883 #define PerlMem_malloc(size) malloc((size))
884 #define PerlMem_realloc(buf, size) realloc((buf), (size))
885 #define PerlMem_free(buf) free((buf))
886 #define PerlMem_calloc(num, size) calloc((num), (size))
887 #define PerlMem_get_lock()
888 #define PerlMem_free_lock()
889 #define PerlMem_is_locked() 0
891 /* Shared memory macros */
892 #define PerlMemShared_malloc(size) malloc((size))
893 #define PerlMemShared_realloc(buf, size) realloc((buf), (size))
894 #define PerlMemShared_free(buf) free((buf))
895 #define PerlMemShared_calloc(num, size) calloc((num), (size))
896 #define PerlMemShared_get_lock()
897 #define PerlMemShared_free_lock()
898 #define PerlMemShared_is_locked() 0
900 /* Parse tree memory macros */
901 #define PerlMemParse_malloc(size) malloc((size))
902 #define PerlMemParse_realloc(buf, size) realloc((buf), (size))
903 #define PerlMemParse_free(buf) free((buf))
904 #define PerlMemParse_calloc(num, size) calloc((num), (size))
905 #define PerlMemParse_get_lock()
906 #define PerlMemParse_free_lock()
907 #define PerlMemParse_is_locked() 0
909 #endif /* PERL_IMPLICIT_SYS */
912 Interface for perl process functions
916 #if defined(PERL_IMPLICIT_SYS)
924 struct IPerlProcInfo;
925 typedef void (*LPProcAbort)(struct IPerlProc*);
926 typedef char* (*LPProcCrypt)(struct IPerlProc*, const char*,
928 typedef void (*LPProcExit)(struct IPerlProc*, int)
929 __attribute__noreturn__;
930 typedef void (*LPProc_Exit)(struct IPerlProc*, int)
931 __attribute__noreturn__;
932 typedef int (*LPProcExecl)(struct IPerlProc*, const char*,
933 const char*, const char*, const char*,
935 typedef int (*LPProcExecv)(struct IPerlProc*, const char*,
937 typedef int (*LPProcExecvp)(struct IPerlProc*, const char*,
939 typedef Uid_t (*LPProcGetuid)(struct IPerlProc*);
940 typedef Uid_t (*LPProcGeteuid)(struct IPerlProc*);
941 typedef Gid_t (*LPProcGetgid)(struct IPerlProc*);
942 typedef Gid_t (*LPProcGetegid)(struct IPerlProc*);
943 typedef char* (*LPProcGetlogin)(struct IPerlProc*);
944 typedef int (*LPProcKill)(struct IPerlProc*, int, int);
945 typedef int (*LPProcKillpg)(struct IPerlProc*, int, int);
946 typedef int (*LPProcPauseProc)(struct IPerlProc*);
947 typedef PerlIO* (*LPProcPopen)(struct IPerlProc*, const char*,
949 typedef PerlIO* (*LPProcPopenList)(struct IPerlProc*, const char*,
951 typedef int (*LPProcPclose)(struct IPerlProc*, PerlIO*);
952 typedef int (*LPProcPipe)(struct IPerlProc*, int*);
953 typedef int (*LPProcSetuid)(struct IPerlProc*, uid_t);
954 typedef int (*LPProcSetgid)(struct IPerlProc*, gid_t);
955 typedef int (*LPProcSleep)(struct IPerlProc*, unsigned int);
956 typedef int (*LPProcTimes)(struct IPerlProc*, struct tms*);
957 typedef int (*LPProcWait)(struct IPerlProc*, int*);
958 typedef int (*LPProcWaitpid)(struct IPerlProc*, int, int*, int);
959 typedef Sighandler_t (*LPProcSignal)(struct IPerlProc*, int, Sighandler_t);
960 typedef int (*LPProcFork)(struct IPerlProc*);
961 typedef int (*LPProcGetpid)(struct IPerlProc*);
963 typedef void* (*LPProcDynaLoader)(struct IPerlProc*, const char*);
964 typedef void (*LPProcGetOSError)(struct IPerlProc*,
965 SV* sv, DWORD dwErr);
966 typedef int (*LPProcSpawnvp)(struct IPerlProc*, int, const char*,
969 typedef int (*LPProcLastHost)(struct IPerlProc*);
970 typedef int (*LPProcGetTimeOfDay)(struct IPerlProc*,
971 struct timeval*, void*);
981 LPProcExecvp pExecvp;
982 LPProcGetuid pGetuid;
983 LPProcGeteuid pGeteuid;
984 LPProcGetgid pGetgid;
985 LPProcGetegid pGetegid;
986 LPProcGetlogin pGetlogin;
988 LPProcKillpg pKillpg;
989 LPProcPauseProc pPauseProc;
991 LPProcPclose pPclose;
993 LPProcSetuid pSetuid;
994 LPProcSetgid pSetgid;
998 LPProcWaitpid pWaitpid;
999 LPProcSignal pSignal;
1001 LPProcGetpid pGetpid;
1003 LPProcDynaLoader pDynaLoader;
1004 LPProcGetOSError pGetOSError;
1005 LPProcSpawnvp pSpawnvp;
1007 LPProcLastHost pLastHost;
1008 LPProcPopenList pPopenList;
1009 LPProcGetTimeOfDay pGetTimeOfDay;
1012 struct IPerlProcInfo
1014 unsigned long nCount; /* number of entries expected */
1015 struct IPerlProc perlProcList;
1018 #define PerlProc_abort() \
1019 (*PL_Proc->pAbort)(PL_Proc)
1020 #define PerlProc_crypt(c,s) \
1021 (*PL_Proc->pCrypt)(PL_Proc, (c), (s))
1022 #define PerlProc_exit(s) \
1023 (*PL_Proc->pExit)(PL_Proc, (s))
1024 #define PerlProc__exit(s) \
1025 (*PL_Proc->p_Exit)(PL_Proc, (s))
1026 #define PerlProc_execl(c, w, x, y, z) \
1027 (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z))
1028 #define PerlProc_execv(c, a) \
1029 (*PL_Proc->pExecv)(PL_Proc, (c), (a))
1030 #define PerlProc_execvp(c, a) \
1031 (*PL_Proc->pExecvp)(PL_Proc, (c), (a))
1032 #define PerlProc_getuid() \
1033 (*PL_Proc->pGetuid)(PL_Proc)
1034 #define PerlProc_geteuid() \
1035 (*PL_Proc->pGeteuid)(PL_Proc)
1036 #define PerlProc_getgid() \
1037 (*PL_Proc->pGetgid)(PL_Proc)
1038 #define PerlProc_getegid() \
1039 (*PL_Proc->pGetegid)(PL_Proc)
1040 #define PerlProc_getlogin() \
1041 (*PL_Proc->pGetlogin)(PL_Proc)
1042 #define PerlProc_kill(i, a) \
1043 (*PL_Proc->pKill)(PL_Proc, (i), (a))
1044 #define PerlProc_killpg(i, a) \
1045 (*PL_Proc->pKillpg)(PL_Proc, (i), (a))
1046 #define PerlProc_pause() \
1047 (*PL_Proc->pPauseProc)(PL_Proc)
1048 #define PerlProc_popen(c, m) \
1049 (*PL_Proc->pPopen)(PL_Proc, (c), (m))
1050 #define PerlProc_popen_list(m, n, a) \
1051 (*PL_Proc->pPopenList)(PL_Proc, (m), (n), (a))
1052 #define PerlProc_pclose(f) \
1053 (*PL_Proc->pPclose)(PL_Proc, (f))
1054 #define PerlProc_pipe(fd) \
1055 (*PL_Proc->pPipe)(PL_Proc, (fd))
1056 #define PerlProc_setuid(u) \
1057 (*PL_Proc->pSetuid)(PL_Proc, (u))
1058 #define PerlProc_setgid(g) \
1059 (*PL_Proc->pSetgid)(PL_Proc, (g))
1060 #define PerlProc_sleep(t) \
1061 (*PL_Proc->pSleep)(PL_Proc, (t))
1062 #define PerlProc_times(t) \
1063 (*PL_Proc->pTimes)(PL_Proc, (t))
1064 #define PerlProc_wait(t) \
1065 (*PL_Proc->pWait)(PL_Proc, (t))
1066 #define PerlProc_waitpid(p,s,f) \
1067 (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f))
1068 #define PerlProc_signal(n, h) \
1069 (*PL_Proc->pSignal)(PL_Proc, (n), (h))
1070 #define PerlProc_fork() \
1071 (*PL_Proc->pFork)(PL_Proc)
1072 #define PerlProc_getpid() \
1073 (*PL_Proc->pGetpid)(PL_Proc)
1074 #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
1075 #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
1078 #define PerlProc_DynaLoad(f) \
1079 (*PL_Proc->pDynaLoader)(PL_Proc, (f))
1080 #define PerlProc_GetOSError(s,e) \
1081 (*PL_Proc->pGetOSError)(PL_Proc, (s), (e))
1082 #define PerlProc_spawnvp(m, c, a) \
1083 (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a))
1085 #define PerlProc_lasthost() \
1086 (*PL_Proc->pLastHost)(PL_Proc)
1087 #define PerlProc_gettimeofday(t,z) \
1088 (*PL_Proc->pGetTimeOfDay)(PL_Proc,(t),(z))
1090 #else /* PERL_IMPLICIT_SYS */
1092 #define PerlProc_abort() abort()
1093 #define PerlProc_crypt(c,s) crypt((c), (s))
1094 #define PerlProc_exit(s) exit((s))
1095 #define PerlProc__exit(s) _exit((s))
1096 #define PerlProc_execl(c,w,x,y,z) \
1097 execl((c), (w), (x), (y), (z))
1098 #define PerlProc_execv(c, a) execv((c), (a))
1099 #define PerlProc_execvp(c, a) execvp((c), (a))
1100 #define PerlProc_getuid() getuid()
1101 #define PerlProc_geteuid() geteuid()
1102 #define PerlProc_getgid() getgid()
1103 #define PerlProc_getegid() getegid()
1104 #define PerlProc_getlogin() getlogin()
1105 #define PerlProc_kill(i, a) kill((i), (a))
1106 #define PerlProc_killpg(i, a) killpg((i), (a))
1107 #define PerlProc_pause() Pause()
1108 #define PerlProc_popen(c, m) my_popen((c), (m))
1109 #define PerlProc_popen_list(m,n,a) my_popen_list((m),(n),(a))
1110 #define PerlProc_pclose(f) my_pclose((f))
1111 #define PerlProc_pipe(fd) pipe((fd))
1112 #define PerlProc_setuid(u) setuid((u))
1113 #define PerlProc_setgid(g) setgid((g))
1114 #define PerlProc_sleep(t) sleep((t))
1115 #define PerlProc_times(t) times((t))
1116 #define PerlProc_wait(t) wait((t))
1117 #define PerlProc_waitpid(p,s,f) waitpid((p), (s), (f))
1118 #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
1119 #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
1120 #define PerlProc_signal(n, h) signal((n), (h))
1121 #define PerlProc_fork() my_fork()
1122 #define PerlProc_getpid() getpid()
1123 #define PerlProc_gettimeofday(t,z) gettimeofday((t),(z))
1126 #define PerlProc_DynaLoad(f) \
1128 #define PerlProc_GetOSError(s,e) \
1129 win32_str_os_error((s), (e))
1130 #define PerlProc_spawnvp(m, c, a) \
1131 win32_spawnvp((m), (c), (a))
1132 #undef PerlProc_signal
1133 #define PerlProc_signal(n, h) win32_signal((n), (h))
1135 #endif /* PERL_IMPLICIT_SYS */
1138 Interface for perl socket functions
1141 #if defined(PERL_IMPLICIT_SYS)
1145 struct IPerlSockInfo;
1146 typedef u_long (*LPHtonl)(struct IPerlSock*, u_long);
1147 typedef u_short (*LPHtons)(struct IPerlSock*, u_short);
1148 typedef u_long (*LPNtohl)(struct IPerlSock*, u_long);
1149 typedef u_short (*LPNtohs)(struct IPerlSock*, u_short);
1150 typedef SOCKET (*LPAccept)(struct IPerlSock*, SOCKET,
1151 struct sockaddr*, int*);
1152 typedef int (*LPBind)(struct IPerlSock*, SOCKET,
1153 const struct sockaddr*, int);
1154 typedef int (*LPConnect)(struct IPerlSock*, SOCKET,
1155 const struct sockaddr*, int);
1156 typedef void (*LPEndhostent)(struct IPerlSock*);
1157 typedef void (*LPEndnetent)(struct IPerlSock*);
1158 typedef void (*LPEndprotoent)(struct IPerlSock*);
1159 typedef void (*LPEndservent)(struct IPerlSock*);
1160 typedef int (*LPGethostname)(struct IPerlSock*, char*, int);
1161 typedef int (*LPGetpeername)(struct IPerlSock*, SOCKET,
1162 struct sockaddr*, int*);
1163 typedef struct hostent* (*LPGethostbyaddr)(struct IPerlSock*, const char*,
1165 typedef struct hostent* (*LPGethostbyname)(struct IPerlSock*, const char*);
1166 typedef struct hostent* (*LPGethostent)(struct IPerlSock*);
1167 typedef struct netent* (*LPGetnetbyaddr)(struct IPerlSock*, long, int);
1168 typedef struct netent* (*LPGetnetbyname)(struct IPerlSock*, const char*);
1169 typedef struct netent* (*LPGetnetent)(struct IPerlSock*);
1170 typedef struct protoent*(*LPGetprotobyname)(struct IPerlSock*, const char*);
1171 typedef struct protoent*(*LPGetprotobynumber)(struct IPerlSock*, int);
1172 typedef struct protoent*(*LPGetprotoent)(struct IPerlSock*);
1173 typedef struct servent* (*LPGetservbyname)(struct IPerlSock*, const char*,
1175 typedef struct servent* (*LPGetservbyport)(struct IPerlSock*, int,
1177 typedef struct servent* (*LPGetservent)(struct IPerlSock*);
1178 typedef int (*LPGetsockname)(struct IPerlSock*, SOCKET,
1179 struct sockaddr*, int*);
1180 typedef int (*LPGetsockopt)(struct IPerlSock*, SOCKET, int, int,
1182 typedef unsigned long (*LPInetAddr)(struct IPerlSock*, const char*);
1183 typedef char* (*LPInetNtoa)(struct IPerlSock*, struct in_addr);
1184 typedef int (*LPListen)(struct IPerlSock*, SOCKET, int);
1185 typedef int (*LPRecv)(struct IPerlSock*, SOCKET, char*, int, int);
1186 typedef int (*LPRecvfrom)(struct IPerlSock*, SOCKET, char*, int,
1187 int, struct sockaddr*, int*);
1188 typedef int (*LPSelect)(struct IPerlSock*, int, char*, char*,
1189 char*, const struct timeval*);
1190 typedef int (*LPSend)(struct IPerlSock*, SOCKET, const char*, int,
1192 typedef int (*LPSendto)(struct IPerlSock*, SOCKET, const char*,
1193 int, int, const struct sockaddr*, int);
1194 typedef void (*LPSethostent)(struct IPerlSock*, int);
1195 typedef void (*LPSetnetent)(struct IPerlSock*, int);
1196 typedef void (*LPSetprotoent)(struct IPerlSock*, int);
1197 typedef void (*LPSetservent)(struct IPerlSock*, int);
1198 typedef int (*LPSetsockopt)(struct IPerlSock*, SOCKET, int, int,
1200 typedef int (*LPShutdown)(struct IPerlSock*, SOCKET, int);
1201 typedef SOCKET (*LPSocket)(struct IPerlSock*, int, int, int);
1202 typedef int (*LPSocketpair)(struct IPerlSock*, int, int, int,
1205 typedef int (*LPClosesocket)(struct IPerlSock*, SOCKET s);
1217 LPEndhostent pEndhostent;
1218 LPEndnetent pEndnetent;
1219 LPEndprotoent pEndprotoent;
1220 LPEndservent pEndservent;
1221 LPGethostname pGethostname;
1222 LPGetpeername pGetpeername;
1223 LPGethostbyaddr pGethostbyaddr;
1224 LPGethostbyname pGethostbyname;
1225 LPGethostent pGethostent;
1226 LPGetnetbyaddr pGetnetbyaddr;
1227 LPGetnetbyname pGetnetbyname;
1228 LPGetnetent pGetnetent;
1229 LPGetprotobyname pGetprotobyname;
1230 LPGetprotobynumber pGetprotobynumber;
1231 LPGetprotoent pGetprotoent;
1232 LPGetservbyname pGetservbyname;
1233 LPGetservbyport pGetservbyport;
1234 LPGetservent pGetservent;
1235 LPGetsockname pGetsockname;
1236 LPGetsockopt pGetsockopt;
1237 LPInetAddr pInetAddr;
1238 LPInetNtoa pInetNtoa;
1241 LPRecvfrom pRecvfrom;
1245 LPSethostent pSethostent;
1246 LPSetnetent pSetnetent;
1247 LPSetprotoent pSetprotoent;
1248 LPSetservent pSetservent;
1249 LPSetsockopt pSetsockopt;
1250 LPShutdown pShutdown;
1252 LPSocketpair pSocketpair;
1254 LPClosesocket pClosesocket;
1258 struct IPerlSockInfo
1260 unsigned long nCount; /* number of entries expected */
1261 struct IPerlSock perlSockList;
1264 #define PerlSock_htonl(x) \
1265 (*PL_Sock->pHtonl)(PL_Sock, x)
1266 #define PerlSock_htons(x) \
1267 (*PL_Sock->pHtons)(PL_Sock, x)
1268 #define PerlSock_ntohl(x) \
1269 (*PL_Sock->pNtohl)(PL_Sock, x)
1270 #define PerlSock_ntohs(x) \
1271 (*PL_Sock->pNtohs)(PL_Sock, x)
1272 #define PerlSock_accept(s, a, l) \
1273 (*PL_Sock->pAccept)(PL_Sock, s, a, l)
1274 #define PerlSock_bind(s, n, l) \
1275 (*PL_Sock->pBind)(PL_Sock, s, n, l)
1276 #define PerlSock_connect(s, n, l) \
1277 (*PL_Sock->pConnect)(PL_Sock, s, n, l)
1278 #define PerlSock_endhostent() \
1279 (*PL_Sock->pEndhostent)(PL_Sock)
1280 #define PerlSock_endnetent() \
1281 (*PL_Sock->pEndnetent)(PL_Sock)
1282 #define PerlSock_endprotoent() \
1283 (*PL_Sock->pEndprotoent)(PL_Sock)
1284 #define PerlSock_endservent() \
1285 (*PL_Sock->pEndservent)(PL_Sock)
1286 #define PerlSock_gethostbyaddr(a, l, t) \
1287 (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t)
1288 #define PerlSock_gethostbyname(n) \
1289 (*PL_Sock->pGethostbyname)(PL_Sock, n)
1290 #define PerlSock_gethostent() \
1291 (*PL_Sock->pGethostent)(PL_Sock)
1292 #define PerlSock_gethostname(n, l) \
1293 (*PL_Sock->pGethostname)(PL_Sock, n, l)
1294 #define PerlSock_getnetbyaddr(n, t) \
1295 (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t)
1296 #define PerlSock_getnetbyname(c) \
1297 (*PL_Sock->pGetnetbyname)(PL_Sock, c)
1298 #define PerlSock_getnetent() \
1299 (*PL_Sock->pGetnetent)(PL_Sock)
1300 #define PerlSock_getpeername(s, n, l) \
1301 (*PL_Sock->pGetpeername)(PL_Sock, s, n, l)
1302 #define PerlSock_getprotobyname(n) \
1303 (*PL_Sock->pGetprotobyname)(PL_Sock, n)
1304 #define PerlSock_getprotobynumber(n) \
1305 (*PL_Sock->pGetprotobynumber)(PL_Sock, n)
1306 #define PerlSock_getprotoent() \
1307 (*PL_Sock->pGetprotoent)(PL_Sock)
1308 #define PerlSock_getservbyname(n, p) \
1309 (*PL_Sock->pGetservbyname)(PL_Sock, n, p)
1310 #define PerlSock_getservbyport(port, p) \
1311 (*PL_Sock->pGetservbyport)(PL_Sock, port, p)
1312 #define PerlSock_getservent() \
1313 (*PL_Sock->pGetservent)(PL_Sock)
1314 #define PerlSock_getsockname(s, n, l) \
1315 (*PL_Sock->pGetsockname)(PL_Sock, s, n, l)
1316 #define PerlSock_getsockopt(s,l,n,v,i) \
1317 (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i)
1318 #define PerlSock_inet_addr(c) \
1319 (*PL_Sock->pInetAddr)(PL_Sock, c)
1320 #define PerlSock_inet_ntoa(i) \
1321 (*PL_Sock->pInetNtoa)(PL_Sock, i)
1322 #define PerlSock_listen(s, b) \
1323 (*PL_Sock->pListen)(PL_Sock, s, b)
1324 #define PerlSock_recv(s, b, l, f) \
1325 (*PL_Sock->pRecv)(PL_Sock, s, b, l, f)
1326 #define PerlSock_recvfrom(s,b,l,f,from,fromlen) \
1327 (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen)
1328 #define PerlSock_select(n, r, w, e, t) \
1329 (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t)
1330 #define PerlSock_send(s, b, l, f) \
1331 (*PL_Sock->pSend)(PL_Sock, s, b, l, f)
1332 #define PerlSock_sendto(s, b, l, f, t, tlen) \
1333 (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen)
1334 #define PerlSock_sethostent(f) \
1335 (*PL_Sock->pSethostent)(PL_Sock, f)
1336 #define PerlSock_setnetent(f) \
1337 (*PL_Sock->pSetnetent)(PL_Sock, f)
1338 #define PerlSock_setprotoent(f) \
1339 (*PL_Sock->pSetprotoent)(PL_Sock, f)
1340 #define PerlSock_setservent(f) \
1341 (*PL_Sock->pSetservent)(PL_Sock, f)
1342 #define PerlSock_setsockopt(s, l, n, v, len) \
1343 (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len)
1344 #define PerlSock_shutdown(s, h) \
1345 (*PL_Sock->pShutdown)(PL_Sock, s, h)
1346 #define PerlSock_socket(a, t, p) \
1347 (*PL_Sock->pSocket)(PL_Sock, a, t, p)
1348 #define PerlSock_socketpair(a, t, p, f) \
1349 (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f)
1352 #define PerlSock_closesocket(s) \
1353 (*PL_Sock->pClosesocket)(PL_Sock, s)
1356 #else /* PERL_IMPLICIT_SYS */
1358 #define PerlSock_htonl(x) htonl(x)
1359 #define PerlSock_htons(x) htons(x)
1360 #define PerlSock_ntohl(x) ntohl(x)
1361 #define PerlSock_ntohs(x) ntohs(x)
1362 #define PerlSock_accept(s, a, l) accept(s, a, l)
1363 #define PerlSock_bind(s, n, l) bind(s, n, l)
1364 #define PerlSock_connect(s, n, l) connect(s, n, l)
1366 #define PerlSock_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t)
1367 #define PerlSock_gethostbyname(n) gethostbyname(n)
1368 #define PerlSock_gethostent gethostent
1369 #define PerlSock_endhostent endhostent
1370 #define PerlSock_gethostname(n, l) gethostname(n, l)
1372 #define PerlSock_getnetbyaddr(n, t) getnetbyaddr(n, t)
1373 #define PerlSock_getnetbyname(n) getnetbyname(n)
1374 #define PerlSock_getnetent getnetent
1375 #define PerlSock_endnetent endnetent
1376 #define PerlSock_getpeername(s, n, l) getpeername(s, n, l)
1378 #define PerlSock_getprotobyname(n) getprotobyname(n)
1379 #define PerlSock_getprotobynumber(n) getprotobynumber(n)
1380 #define PerlSock_getprotoent getprotoent
1381 #define PerlSock_endprotoent endprotoent
1383 #define PerlSock_getservbyname(n, p) getservbyname(n, p)
1384 #define PerlSock_getservbyport(port, p) getservbyport(port, p)
1385 #define PerlSock_getservent getservent
1386 #define PerlSock_endservent endservent
1388 #define PerlSock_getsockname(s, n, l) getsockname(s, n, l)
1389 #define PerlSock_getsockopt(s,l,n,v,i) getsockopt(s, l, n, v, i)
1390 #define PerlSock_inet_addr(c) inet_addr(c)
1391 #define PerlSock_inet_ntoa(i) inet_ntoa(i)
1392 #define PerlSock_listen(s, b) listen(s, b)
1393 #define PerlSock_recv(s, b, l, f) recv(s, b, l, f)
1394 #define PerlSock_recvfrom(s, b, l, f, from, fromlen) \
1395 recvfrom(s, b, l, f, from, fromlen)
1396 #define PerlSock_select(n, r, w, e, t) select(n, r, w, e, t)
1397 #define PerlSock_send(s, b, l, f) send(s, b, l, f)
1398 #define PerlSock_sendto(s, b, l, f, t, tlen) \
1399 sendto(s, b, l, f, t, tlen)
1400 #define PerlSock_sethostent(f) sethostent(f)
1401 #define PerlSock_setnetent(f) setnetent(f)
1402 #define PerlSock_setprotoent(f) setprotoent(f)
1403 #define PerlSock_setservent(f) setservent(f)
1404 #define PerlSock_setsockopt(s, l, n, v, len) \
1405 setsockopt(s, l, n, v, len)
1406 #define PerlSock_shutdown(s, h) shutdown(s, h)
1407 #define PerlSock_socket(a, t, p) socket(a, t, p)
1408 #define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f)
1411 #define PerlSock_closesocket(s) closesocket(s)
1414 #endif /* PERL_IMPLICIT_SYS */
1416 #endif /* __Inc__IPerl___ */
1419 * ex: set ts=8 sts=4 sw=4 et: