Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1497 lines
49 KiB

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