Add Configure probes for nl_langinfo() and <langinfo.h>.
[p5sagit/p5-mst-13.2.git] / NetWare / nwperlsys.h
CommitLineData
2986a63f 1/*
2 * Copyright © 2001 Novell, Inc. All Rights Reserved.
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Artistic License, as specified in the README file.
6 *
7 */
8
9/*
8dbfbba0 10 * FILENAME : nwperlsys.h
11 * DESCRIPTION : Derives from iperlsys.h and define the
12 * platform specific function
13 * Author : SGP
14 * Date Created : June 12th 2001.
15 * Date Modified: June 26th 2001.
2986a63f 16 */
17
18#ifndef ___NWPerlSys_H___
19#define ___NWPerlSys_H___
20
21
22#include "iperlsys.h"
23
8dbfbba0 24#include "nw5iop.h"
25#include <fcntl.h>
26
2986a63f 27//Socket related calls
28#include "nw5sck.h"
29
30//Store the Watcom hash list
31#include "nwtinfo.h"
32
33//Watcom hash list
34#include <wchash.h>
35
8dbfbba0 36#include "win32ish.h"
37
38START_EXTERN_C
39extern int do_spawn2(char *cmd, int exectype);
40extern int do_aspawn(void *vreally, void **vmark, void **vsp);
41extern void Perl_init_os_extras(void);
42BOOL fnGetHashListAddrs(void *addrs, BOOL *dontTouchHashList);
43END_EXTERN_C
44
45/* IPerlMem - Memory management functions - Begin ========================================*/
2986a63f 46
8dbfbba0 47void*
48PerlMemMalloc(struct IPerlMem* piPerl, size_t size)
49{
50 void *ptr = NULL;
51 ptr = malloc(size);
52 if (ptr) {
53 void **listptr;
54 BOOL m_dontTouchHashLists;
55 if(fnGetHashListAddrs(&listptr,&m_dontTouchHashLists)) {
56 if (listptr) {
57 WCValHashTable<void*>* m_allocList= (WCValHashTable<void*>*)listptr;
58 (WCValHashTable<void*>*)m_allocList->insert(ptr);
59 }
60 }
61 }
62 return(ptr);
63}
64
65void*
66PerlMemRealloc(struct IPerlMem* piPerl, void* ptr, size_t size)
67{
68 void *newptr = NULL;
69 WCValHashTable<void*>* m_allocList;
70
71 newptr = realloc(ptr, size);
72
73 if (ptr)
74 {
75 void **listptr;
76 BOOL m_dontTouchHashLists;
77 if(fnGetHashListAddrs(&listptr,&m_dontTouchHashLists)) {
78 m_allocList= (WCValHashTable<void*>*)listptr;
79 (WCValHashTable<void*>*)m_allocList->remove(ptr);
80 }
81 }
82 if (newptr)
83 {
84 if (m_allocList)
85 (WCValHashTable<void*>*)m_allocList->insert(newptr);
86 }
87
88 return(newptr);
89}
90
91void
92PerlMemFree(struct IPerlMem* piPerl, void* ptr)
93{
94 BOOL m_dontTouchHashLists;
95 WCValHashTable<void*>* m_allocList;
96
97 void **listptr;
98 if(fnGetHashListAddrs(&listptr,&m_dontTouchHashLists)) {
99 m_allocList= (WCValHashTable<void*>*)listptr;
100 // Final clean up, free all the nodes from the hash list
101 if (m_dontTouchHashLists)
102 {
103 if(ptr)
104 {
105 free(ptr);
106 ptr = NULL;
107 }
108 }
109 else
110 {
111 if(ptr && m_allocList)
112 {
113 if ((WCValHashTable<void*>*)m_allocList->remove(ptr))
114 {
115 free(ptr);
116 ptr = NULL;
117 }
118 else
119 {
120 // If it comes here, that means that the memory pointer is not contained in the hash list.
121 // But no need to free now, since if is deleted here, it will result in an abend!!
122 // If the memory is still there, it will be cleaned during final cleanup anyway.
123 }
124 }
125 }
126 }
127 return;
128}
129
130void*
131PerlMemCalloc(struct IPerlMem* piPerl, size_t num, size_t size)
132{
133 void *ptr = NULL;
134
135 ptr = calloc(num, size);
136 if (ptr) {
137 void **listptr;
138 BOOL m_dontTouchHashLists;
139 if(fnGetHashListAddrs(&listptr,&m_dontTouchHashLists)) {
140 if (listptr) {
141 WCValHashTable<void*>* m_allocList= (WCValHashTable<void*>*)listptr;
142 (WCValHashTable<void*>*)m_allocList->insert(ptr);
143 }
144 }
145 }
146 return(ptr);
147}
2986a63f 148
149struct IPerlMem perlMem =
150{
151 PerlMemMalloc,
152 PerlMemRealloc,
153 PerlMemFree,
154 PerlMemCalloc,
155};
156
8dbfbba0 157/* IPerlMem - Memory management functions - End ========================================*/
158
159/* IPerlDir - Directory Manipulation functions - Begin ===================================*/
2986a63f 160
8dbfbba0 161int
162PerlDirMakedir(struct IPerlDir* piPerl, const char *dirname, int mode)
163{
164 return mkdir(dirname);
165}
2986a63f 166
8dbfbba0 167int
168PerlDirChdir(struct IPerlDir* piPerl, const char *dirname)
169{
170 return nw_chdir(dirname);
171}
172
173int
174PerlDirRmdir(struct IPerlDir* piPerl, const char *dirname)
175{
176 return nw_rmdir(dirname);
177}
178
179int
180PerlDirClose(struct IPerlDir* piPerl, DIR *dirp)
181{
182 return nw_closedir(dirp);
183}
184
185DIR*
186PerlDirOpen(struct IPerlDir* piPerl, char *filename)
187{
188 return nw_opendir(filename);
189}
190
191struct direct *
192PerlDirRead(struct IPerlDir* piPerl, DIR *dirp)
193{
194 return nw_readdir(dirp);
195}
196
197void
198PerlDirRewind(struct IPerlDir* piPerl, DIR *dirp)
199{
200 nw_rewinddir(dirp);
201}
202
203void
204PerlDirSeek(struct IPerlDir* piPerl, DIR *dirp, long loc)
205{
206 nw_seekdir(dirp, loc);
207}
208
209long
210PerlDirTell(struct IPerlDir* piPerl, DIR *dirp)
211{
212 return nw_telldir(dirp);
213}
2986a63f 214
215struct IPerlDir perlDir =
216{
217 PerlDirMakedir,
218 PerlDirChdir,
219 PerlDirRmdir,
220 PerlDirClose,
221 PerlDirOpen,
222 PerlDirRead,
223 PerlDirRewind,
224 PerlDirSeek,
225 PerlDirTell,
226};
227
8dbfbba0 228/* IPerlDir - Directory Manipulation functions - End ===================================*/
2986a63f 229
230/* IPerlEnv - Environment related functions - Begin ======================================*/
231
8dbfbba0 232char*
233PerlEnvGetenv(struct IPerlEnv* piPerl, const char *varname)
234{
235 return(getenv(varname));
236};
237
238int
239PerlEnvPutenv(struct IPerlEnv* piPerl, const char *envstring)
240{
241 return(putenv(envstring));
242};
243
244char*
245PerlEnvGetenv_len(struct IPerlEnv* piPerl, const char* varname, unsigned long* len)
246{
247 *len = 0;
248 char *e = getenv(varname);
249 if (e)
250 *len = strlen(e);
251 return e;
252}
2986a63f 253
8dbfbba0 254int
255PerlEnvUname(struct IPerlEnv* piPerl, struct utsname *name)
256{
257 return nw_uname(name);
258}
2986a63f 259
8dbfbba0 260void
261PerlEnvClearenv(struct IPerlEnv* piPerl)
262{
263
264}
2986a63f 265
266struct IPerlEnv perlEnv =
267{
268 PerlEnvGetenv,
269 PerlEnvPutenv,
270 PerlEnvGetenv_len,
271 PerlEnvUname,
272 PerlEnvClearenv,
273/* PerlEnvGetChildenv,
274 PerlEnvFreeChildenv,
275 PerlEnvGetChilddir,
276 PerlEnvFreeChilddir,*/
277};
278
8dbfbba0 279/* IPerlEnv - Environment related functions - End ======================================*/
2986a63f 280
281/* IPerlStdio - Stdio functions - Begin ================================================*/
282
8dbfbba0 283FILE*
284PerlStdIOStdin(struct IPerlStdIO* piPerl)
285{
286 return nw_stdin();
287}
288
289FILE*
290PerlStdIOStdout(struct IPerlStdIO* piPerl)
291{
292 return nw_stdout();
293}
294
295FILE*
296PerlStdIOStderr(struct IPerlStdIO* piPerl)
297{
298 return nw_stderr();
299}
300
301FILE*
302PerlStdIOOpen(struct IPerlStdIO* piPerl, const char *path, const char *mode)
303{
304 return nw_fopen(path, mode);
305}
306
307int
308PerlStdIOClose(struct IPerlStdIO* piPerl, FILE* pf)
309{
310 return nw_fclose(pf);
311}
312
313int
314PerlStdIOEof(struct IPerlStdIO* piPerl, FILE* pf)
315{
316 return nw_feof(pf);
317}
318
319int
320PerlStdIOError(struct IPerlStdIO* piPerl, FILE* pf)
321{
322 return nw_ferror(pf);
323}
324
325void
326PerlStdIOClearerr(struct IPerlStdIO* piPerl, FILE* pf)
327{
328 nw_clearerr(pf);
329}
330
331int
332PerlStdIOGetc(struct IPerlStdIO* piPerl, FILE* pf)
333{
334 return nw_getc(pf);
335}
336
337char*
338PerlStdIOGetBase(struct IPerlStdIO* piPerl, FILE* pf)
339{
340#ifdef FILE_base
341 FILE *f = pf;
342 return FILE_base(f);
343#else
344 return Nullch;
345#endif
346}
347
348int
349PerlStdIOGetBufsiz(struct IPerlStdIO* piPerl, FILE* pf)
350{
351#ifdef FILE_bufsiz
352 FILE *f = pf;
353 return FILE_bufsiz(f);
354#else
355 return (-1);
356#endif
357}
358
359int
360PerlStdIOGetCnt(struct IPerlStdIO* piPerl, FILE* pf)
361{
362#ifdef USE_STDIO_PTR
363 FILE *f = pf;
364 return FILE_cnt(f);
365#else
366 return (-1);
367#endif
368}
369
370char*
371PerlStdIOGetPtr(struct IPerlStdIO* piPerl, FILE* pf)
372{
373#ifdef USE_STDIO_PTR
374 FILE *f = pf;
375 return FILE_ptr(f);
376#else
377 return Nullch;
378#endif
379}
380
381char*
382PerlStdIOGets(struct IPerlStdIO* piPerl, FILE* pf, char* s, int n)
383{
384 return nw_fgets(s, n, pf);
385}
386
387int
388PerlStdIOPutc(struct IPerlStdIO* piPerl, FILE* pf, int c)
389{
390 return nw_fputc(c, pf);
391}
392
393int
394PerlStdIOPuts(struct IPerlStdIO* piPerl, FILE* pf, const char *s)
395{
396 return nw_fputs(s, pf);
397}
398
399int
400PerlStdIOFlush(struct IPerlStdIO* piPerl, FILE* pf)
401{
402 return nw_fflush(pf);
403}
404
405int
406PerlStdIOUngetc(struct IPerlStdIO* piPerl, int c, FILE* pf)
407{
408 return nw_ungetc(c, pf);
409}
410
411int
412PerlStdIOFileno(struct IPerlStdIO* piPerl, FILE* pf)
413{
414 return nw_fileno(pf);
415}
416
417FILE*
418PerlStdIOFdopen(struct IPerlStdIO* piPerl, int fd, const char *mode)
419{
420 return nw_fdopen(fd, mode);
421}
422
423FILE*
424PerlStdIOReopen(struct IPerlStdIO* piPerl, const char*path, const char*mode, FILE* pf)
425{
426 return nw_freopen(path, mode, pf);
427}
428
429SSize_t
430PerlStdIORead(struct IPerlStdIO* piPerl, void *buffer, Size_t size, Size_t count, FILE* pf)
431{
432 return nw_fread(buffer, size, count, pf);
433}
434
435SSize_t
436PerlStdIOWrite(struct IPerlStdIO* piPerl, const void *buffer, Size_t size, Size_t count, FILE* pf)
437{
438 return nw_fwrite(buffer, size, count, pf);
439}
440
441void
442PerlStdIOSetBuf(struct IPerlStdIO* piPerl, FILE* pf, char* buffer)
443{
444 nw_setbuf(pf, buffer);
445}
446
447int
448PerlStdIOSetVBuf(struct IPerlStdIO* piPerl, FILE* pf, char* buffer, int type, Size_t size)
449{
450 return nw_setvbuf(pf, buffer, type, size);
451}
452
453void
454PerlStdIOSetCnt(struct IPerlStdIO* piPerl, FILE* pf, int n)
455{
456#ifdef STDIO_CNT_LVALUE
457 FILE *f = pf;
458 FILE_cnt(f) = n;
459#endif
460}
461
462void
463PerlStdIOSetPtr(struct IPerlStdIO* piPerl, FILE* pf, char * ptr)
464{
465#ifdef STDIO_PTR_LVALUE
466 FILE *f = pf;
467 FILE_ptr(f) = ptr;
468#endif
469}
470
471void
472PerlStdIOSetlinebuf(struct IPerlStdIO* piPerl, FILE* pf)
473{
474 nw_setvbuf(pf, NULL, _IOLBF, 0);
475}
476
477int
478PerlStdIOPrintf(struct IPerlStdIO* piPerl, FILE* pf, const char *format,...)
479{
480 va_list(arglist);
481 va_start(arglist, format);
482 return nw_vfprintf(pf, format, arglist);
483}
484
485int
486PerlStdIOVprintf(struct IPerlStdIO* piPerl, FILE* pf, const char *format, va_list arglist)
487{
488 return nw_vfprintf(pf, format, arglist);
489}
490
491long
492PerlStdIOTell(struct IPerlStdIO* piPerl, FILE* pf)
493{
494 return nw_ftell(pf);
495}
496
497int
498PerlStdIOSeek(struct IPerlStdIO* piPerl, FILE* pf, off_t offset, int origin)
499{
500 return nw_fseek(pf, offset, origin);
501}
502
503void
504PerlStdIORewind(struct IPerlStdIO* piPerl, FILE* pf)
505{
506 nw_rewind(pf);
507}
508
509FILE*
510PerlStdIOTmpfile(struct IPerlStdIO* piPerl)
511{
512 return nw_tmpfile();
513}
514
515int
516PerlStdIOGetpos(struct IPerlStdIO* piPerl, FILE* pf, Fpos_t *p)
517{
518 return nw_fgetpos(pf, p);
519}
520
521int
522PerlStdIOSetpos(struct IPerlStdIO* piPerl, FILE* pf, const Fpos_t *p)
523{
524 return nw_fsetpos(pf, p);
525}
526
527void
528PerlStdIOInit(struct IPerlStdIO* piPerl)
529{
530}
531
532void
533PerlStdIOInitOSExtras(struct IPerlStdIO* piPerl)
534{
535 Perl_init_os_extras();
536}
537
538
539int
540PerlStdIOOpenOSfhandle(struct IPerlStdIO* piPerl, long osfhandle, int flags)
541{
542 return nw_open_osfhandle(osfhandle, flags);
543}
544
545int
546PerlStdIOGetOSfhandle(struct IPerlStdIO* piPerl, int filenum)
547{
548 return nw_get_osfhandle(filenum);
549}
550
551FILE*
552PerlStdIOFdupopen(struct IPerlStdIO* piPerl, FILE* pf)
553{
554 FILE* pfdup=NULL;
555 fpos_t pos=0;
556 char mode[3]={'\0'};
557 int fileno = nw_dup(nw_fileno(pf));
558
559 /* open the file in the same mode */
560 if(((FILE*)pf)->_flag & _IOREAD) {
561 mode[0] = 'r';
562 mode[1] = 0;
563 }
564 else if(((FILE*)pf)->_flag & _IOWRT) {
565 mode[0] = 'a';
566 mode[1] = 0;
567 }
568 else if(((FILE*)pf)->_flag & _IORW) {
569 mode[0] = 'r';
570 mode[1] = '+';
571 mode[2] = 0;
572 }
573
574 /* it appears that the binmode is attached to the
575 * file descriptor so binmode files will be handled
576 * correctly
577 */
578 pfdup = nw_fdopen(fileno, mode);
579
580 /* move the file pointer to the same position */
581 if (!fgetpos(pf, &pos)) {
582 fsetpos(pfdup, &pos);
583 }
584 return pfdup;
585}
2986a63f 586
587struct IPerlStdIO perlStdIO =
588{
589 PerlStdIOStdin,
590 PerlStdIOStdout,
591 PerlStdIOStderr,
592 PerlStdIOOpen,
593 PerlStdIOClose,
594 PerlStdIOEof,
595 PerlStdIOError,
596 PerlStdIOClearerr,
597 PerlStdIOGetc,
598 PerlStdIOGetBase,
599 PerlStdIOGetBufsiz,
600 PerlStdIOGetCnt,
601 PerlStdIOGetPtr,
602 PerlStdIOGets,
603 PerlStdIOPutc,
604 PerlStdIOPuts,
605 PerlStdIOFlush,
606 PerlStdIOUngetc,
607 PerlStdIOFileno,
608 PerlStdIOFdopen,
609 PerlStdIOReopen,
610 PerlStdIORead,
611 PerlStdIOWrite,
612 PerlStdIOSetBuf,
613 PerlStdIOSetVBuf,
614 PerlStdIOSetCnt,
615 PerlStdIOSetPtr,
616 PerlStdIOSetlinebuf,
617 PerlStdIOPrintf,
618 PerlStdIOVprintf,
619 PerlStdIOTell,
620 PerlStdIOSeek,
621 PerlStdIORewind,
622 PerlStdIOTmpfile,
623 PerlStdIOGetpos,
624 PerlStdIOSetpos,
625 PerlStdIOInit,
626 PerlStdIOInitOSExtras,
627 PerlStdIOFdupopen,
628};
629
630/* IPerlStdio - Stdio functions - End ================================================*/
631
632/* IPerlLIO - Low-level IO functions - Begin =============================================*/
633
8dbfbba0 634int
635PerlLIOAccess(struct IPerlLIO* piPerl, const char *path, int mode)
636{
637 return nw_access(path, mode);
638}
639
640int
641PerlLIOChmod(struct IPerlLIO* piPerl, const char *filename, int pmode)
642{
643 return nw_chmod(filename, pmode);
644}
645
646int
647PerlLIOChown(struct IPerlLIO* piPerl, const char *filename, uid_t owner, gid_t group)
648{
649 dTHXo;
650 Perl_croak(aTHX_ "chown not implemented!\n");
651 return 0;
652}
653
654int
655PerlLIOChsize(struct IPerlLIO* piPerl, int handle, long size)
656{
657 return (nw_chsize(handle,size));
658}
659
660int
661PerlLIOClose(struct IPerlLIO* piPerl, int handle)
662{
663 return nw_close(handle);
664}
665
666int
667PerlLIODup(struct IPerlLIO* piPerl, int handle)
668{
669 return nw_dup(handle);
670}
671
672int
673PerlLIODup2(struct IPerlLIO* piPerl, int handle1, int handle2)
674{
675 return nw_dup2(handle1, handle2);
676}
677
678int
679PerlLIOFlock(struct IPerlLIO* piPerl, int fd, int oper)
680{
681 //On NetWare simulate flock by locking a range on the file
682 return nw_flock(fd, oper);
683}
684
685int
686PerlLIOFileStat(struct IPerlLIO* piPerl, int handle, struct stat *buffer)
687{
688 return fstat(handle, buffer);
689}
690
691int
692PerlLIOIOCtl(struct IPerlLIO* piPerl, int i, unsigned int u, char *data)
693{
694 return 0;
695}
696
697int
698PerlLIOIsatty(struct IPerlLIO* piPerl, int fd)
699{
700 return nw_isatty(fd);
701}
702
703int
704PerlLIOLink(struct IPerlLIO* piPerl, const char*oldname, const char *newname)
705{
706 return nw_link(oldname, newname);
707}
708
709long
710PerlLIOLseek(struct IPerlLIO* piPerl, int handle, long offset, int origin)
711{
712 return nw_lseek(handle, offset, origin);
713}
714
715int
716PerlLIOLstat(struct IPerlLIO* piPerl, const char *path, struct stat *buffer)
717{
718 return nw_stat(path, buffer);
719}
720
721char*
722PerlLIOMktemp(struct IPerlLIO* piPerl, char *Template)
723{
724 return(nw_mktemp(Template));
725}
726
727int
728PerlLIOOpen(struct IPerlLIO* piPerl, const char *filename, int oflag)
729{
730 return nw_open(filename, oflag);
731}
732
733int
734PerlLIOOpen3(struct IPerlLIO* piPerl, const char *filename, int oflag, int pmode)
735{
736 return nw_open(filename, oflag, pmode);
737}
738
739int
740PerlLIORead(struct IPerlLIO* piPerl, int handle, void *buffer, unsigned int count)
741{
742 return nw_read(handle, buffer, count);
743}
744
745int
746PerlLIORename(struct IPerlLIO* piPerl, const char *OldFileName, const char *newname)
747{
748 return nw_rename(OldFileName, newname);
749}
750
751int
752PerlLIOSetmode(struct IPerlLIO* piPerl, FILE *fp, int mode)
753{
754 return nw_setmode(fp, mode);
755}
756
757int
758PerlLIONameStat(struct IPerlLIO* piPerl, const char *path, struct stat *buffer)
759{
760 return nw_stat(path, buffer);
761}
762
763char*
764PerlLIOTmpnam(struct IPerlLIO* piPerl, char *string)
765{
766 return tmpnam(string);
767}
768
769int
770PerlLIOUmask(struct IPerlLIO* piPerl, int pmode)
771{
772 return umask(pmode);
773}
774
775int
776PerlLIOUnlink(struct IPerlLIO* piPerl, const char *filename)
777{
778 return nw_unlink(filename);
779}
780
781int
782PerlLIOUtime(struct IPerlLIO* piPerl, char *filename, struct utimbuf *times)
783{
784 return nw_utime(filename, times);
785}
786
787int
788PerlLIOWrite(struct IPerlLIO* piPerl, int handle, const void *buffer, unsigned int count)
789{
790 return nw_write(handle, buffer, count);
791}
2986a63f 792
793struct IPerlLIO perlLIO =
794{
795 PerlLIOAccess,
796 PerlLIOChmod,
797 PerlLIOChown,
798 PerlLIOChsize,
799 PerlLIOClose,
800 PerlLIODup,
801 PerlLIODup2,
802 PerlLIOFlock,
803 PerlLIOFileStat,
804 PerlLIOIOCtl,
805 PerlLIOIsatty,
806 PerlLIOLink,
807 PerlLIOLseek,
808 PerlLIOLstat,
809 PerlLIOMktemp,
810 PerlLIOOpen,
811 PerlLIOOpen3,
812 PerlLIORead,
813 PerlLIORename,
814 PerlLIOSetmode,
815 PerlLIONameStat,
816 PerlLIOTmpnam,
817 PerlLIOUmask,
818 PerlLIOUnlink,
819 PerlLIOUtime,
820 PerlLIOWrite,
821};
822
8dbfbba0 823/* IPerlLIO - Low-level IO functions - End =============================================*/
2986a63f 824
825/* IPerlProc - Process control functions - Begin =========================================*/
826
8dbfbba0 827#define EXECF_EXEC 1
828#define EXECF_SPAWN 2
829
830void
831PerlProcAbort(struct IPerlProc* piPerl)
832{
833 nw_abort();
834}
835
836char *
837PerlProcCrypt(struct IPerlProc* piPerl, const char* clear, const char* salt)
838{
839 return nw_crypt(clear, salt);
840}
841
842void
843PerlProcExit(struct IPerlProc* piPerl, int status)
844{
845// exit(status);
846 dTHX;
847 dJMPENV;
848 JMPENV_JUMP(2);
849}
850
851void
852PerlProc_Exit(struct IPerlProc* piPerl, int status)
853{
854// _exit(status);
855 dTHX;
856 dJMPENV;
857 JMPENV_JUMP(2);
858}
859
860int
861PerlProcExecl(struct IPerlProc* piPerl, const char *cmdname, const char *arg0, const char *arg1, const char *arg2, const char *arg3)
862{
863 dTHXo;
864 Perl_croak(aTHX_ "execl not implemented!\n");
865 return 0;
866}
867
868int
869PerlProcExecv(struct IPerlProc* piPerl, const char *cmdname, const char *const *argv)
870{
871 return nw_execvp((char *)cmdname, (char **)argv);
872}
873
874int
875PerlProcExecvp(struct IPerlProc* piPerl, const char *cmdname, const char *const *argv)
876{
877 return nw_execvp((char *)cmdname, (char **)argv);
878}
879
880uid_t
881PerlProcGetuid(struct IPerlProc* piPerl)
882{
883 return 0;
884}
885
886uid_t
887PerlProcGeteuid(struct IPerlProc* piPerl)
888{
889 return 0;
890}
891
892gid_t
893PerlProcGetgid(struct IPerlProc* piPerl)
894{
895 return 0;
896}
897
898gid_t
899PerlProcGetegid(struct IPerlProc* piPerl)
900{
901 return 0;
902}
903
904char *
905PerlProcGetlogin(struct IPerlProc* piPerl)
906{
907 return NULL;
908}
909
910int
911PerlProcKill(struct IPerlProc* piPerl, int pid, int sig)
912{
913 return nw_kill(pid, sig);
914}
915
916int
917PerlProcKillpg(struct IPerlProc* piPerl, int pid, int sig)
918{
919 dTHXo;
920 Perl_croak(aTHX_ "killpg not implemented!\n");
921 return 0;
922}
923
924int
925PerlProcPauseProc(struct IPerlProc* piPerl)
926{
927 return nw_sleep((32767L << 16) + 32767);
928}
929
930PerlIO*
931PerlProcPopen(struct IPerlProc* piPerl, const char *command, const char *mode)
932{
933 dTHXo;
934 PERL_FLUSHALL_FOR_CHILD;
935
936 return (PerlIO*)nw_Popen((char *)command, (char *)mode, (int *)errno);
937}
938
939int
940PerlProcPclose(struct IPerlProc* piPerl, PerlIO *stream)
941{
942 return nw_Pclose((FILE*)stream, (int *)errno);
943}
944
945int
946PerlProcPipe(struct IPerlProc* piPerl, int *phandles)
947{
948 return nw_Pipe((int *)phandles, (int *)errno);
949}
950
951int
952PerlProcSetuid(struct IPerlProc* piPerl, uid_t u)
953{
954 return 0;
955}
956
957int
958PerlProcSetgid(struct IPerlProc* piPerl, gid_t g)
959{
960 return 0;
961}
962
963int
964PerlProcSleep(struct IPerlProc* piPerl, unsigned int s)
965{
966 return nw_sleep(s);
967}
968
969int
970PerlProcTimes(struct IPerlProc* piPerl, struct tms *timebuf)
971{
972 return nw_times(timebuf);
973}
974
975int
976PerlProcWait(struct IPerlProc* piPerl, int *status)
977{
978 return nw_wait(status);
979}
980
981int
982PerlProcWaitpid(struct IPerlProc* piPerl, int pid, int *status, int flags)
983{
984 return nw_waitpid(pid, status, flags);
985}
986
987Sighandler_t
988PerlProcSignal(struct IPerlProc* piPerl, int sig, Sighandler_t subcode)
989{
990 return 0;
991}
992
993int
994PerlProcFork(struct IPerlProc* piPerl)
995{
996 return 0;
997}
998
999int
1000PerlProcGetpid(struct IPerlProc* piPerl)
1001{
1002 return nw_getpid();
1003}
1004
1005/*BOOL
1006PerlProcDoCmd(struct IPerlProc* piPerl, char *cmd)
1007{
1008 do_spawn2(cmd, EXECF_EXEC);
1009 return FALSE;
1010}*/
1011
1012int
1013PerlProcSpawn(struct IPerlProc* piPerl, char* cmds)
1014{
1015 return do_spawn2(cmds, EXECF_SPAWN);
1016}
1017
1018int
1019PerlProcSpawnvp(struct IPerlProc* piPerl, int mode, const char *cmdname, const char *const *argv)
1020{
1021 return nw_spawnvp(mode, (char *)cmdname, (char **)argv);
1022}
1023
1024int
1025PerlProcASpawn(struct IPerlProc* piPerl, void *vreally, void **vmark, void **vsp)
1026{
1027 return do_aspawn(vreally, vmark, vsp);
1028}
2986a63f 1029
1030struct IPerlProc perlProc =
1031{
1032 PerlProcAbort,
1033 PerlProcCrypt,
1034 PerlProcExit,
1035 PerlProc_Exit,
1036 PerlProcExecl,
1037 PerlProcExecv,
1038 PerlProcExecvp,
1039 PerlProcGetuid,
1040 PerlProcGeteuid,
1041 PerlProcGetgid,
1042 PerlProcGetegid,
1043 PerlProcGetlogin,
1044 PerlProcKill,
1045 PerlProcKillpg,
1046 PerlProcPauseProc,
1047 PerlProcPopen,
1048 PerlProcPclose,
1049 PerlProcPipe,
1050 PerlProcSetuid,
1051 PerlProcSetgid,
1052 PerlProcSleep,
1053 PerlProcTimes,
1054 PerlProcWait,
1055 PerlProcWaitpid,
1056 PerlProcSignal,
1057 PerlProcFork,
1058 PerlProcGetpid,
1059 //PerlProcLastHost;
1060 //PerlProcPopenList;
1061};
1062
1063/* IPerlProc - Process control functions - End =========================================*/
1064
1065/* IPerlSock - Socket functions - Begin ==================================================*/
1066
8dbfbba0 1067u_long
1068PerlSockHtonl(struct IPerlSock* piPerl, u_long hostlong)
1069{
1070 return(nw_htonl(hostlong));
1071}
1072
1073u_short
1074PerlSockHtons(struct IPerlSock* piPerl, u_short hostshort)
1075{
1076 return(nw_htons(hostshort));
1077}
1078
1079u_long
1080PerlSockNtohl(struct IPerlSock* piPerl, u_long netlong)
1081{
1082 return nw_ntohl(netlong);
1083}
1084
1085u_short
1086PerlSockNtohs(struct IPerlSock* piPerl, u_short netshort)
1087{
1088 return nw_ntohs(netshort);
1089}
1090
1091SOCKET PerlSockAccept(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* addr, int* addrlen)
1092{
1093 return nw_accept(s, addr, addrlen);
1094}
1095
1096int
1097PerlSockBind(struct IPerlSock* piPerl, SOCKET s, const struct sockaddr* name, int namelen)
1098{
1099 return nw_bind(s, name, namelen);
1100}
1101
1102int
1103PerlSockConnect(struct IPerlSock* piPerl, SOCKET s, const struct sockaddr* name, int namelen)
1104{
1105 return nw_connect(s, name, namelen);
1106}
1107
1108void
1109PerlSockEndhostent(struct IPerlSock* piPerl)
1110{
1111 nw_endhostent();
1112}
1113
1114void
1115PerlSockEndnetent(struct IPerlSock* piPerl)
1116{
1117 nw_endnetent();
1118}
1119
1120void
1121PerlSockEndprotoent(struct IPerlSock* piPerl)
1122{
1123 nw_endprotoent();
1124}
1125
1126void
1127PerlSockEndservent(struct IPerlSock* piPerl)
1128{
1129 nw_endservent();
1130}
1131
1132struct hostent*
1133PerlSockGethostbyaddr(struct IPerlSock* piPerl, const char* addr, int len, int type)
1134{
1135 return(nw_gethostbyaddr(addr,len,type));
1136}
1137
1138struct hostent*
1139PerlSockGethostbyname(struct IPerlSock* piPerl, const char* name)
1140{
1141 return nw_gethostbyname(name);
1142}
1143
1144struct hostent*
1145PerlSockGethostent(struct IPerlSock* piPerl)
1146{
1147 return(nw_gethostent());
1148}
1149
1150int
1151PerlSockGethostname(struct IPerlSock* piPerl, char* name, int namelen)
1152{
1153 return nw_gethostname(name,namelen);
1154}
1155
1156struct netent *
1157PerlSockGetnetbyaddr(struct IPerlSock* piPerl, long net, int type)
1158{
1159 return nw_getnetbyaddr(net, type);
1160}
1161
1162struct netent *
1163PerlSockGetnetbyname(struct IPerlSock* piPerl, const char *name)
1164{
1165 return nw_getnetbyname((char*)name);
1166}
1167
1168struct netent *
1169PerlSockGetnetent(struct IPerlSock* piPerl)
1170{
1171 return nw_getnetent();
1172}
1173
1174int PerlSockGetpeername(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* name, int* namelen)
1175{
1176 return nw_getpeername(s, name, namelen);
1177}
1178
1179struct protoent*
1180PerlSockGetprotobyname(struct IPerlSock* piPerl, const char* name)
1181{
1182 return nw_getprotobyname(name);
1183}
1184
1185struct protoent*
1186PerlSockGetprotobynumber(struct IPerlSock* piPerl, int number)
1187{
1188 return nw_getprotobynumber(number);
1189}
1190
1191struct protoent*
1192PerlSockGetprotoent(struct IPerlSock* piPerl)
1193{
1194 return nw_getprotoent();
1195}
1196
1197struct servent*
1198PerlSockGetservbyname(struct IPerlSock* piPerl, const char* name, const char* proto)
1199{
1200 return nw_getservbyname((char*)name, (char*)proto);
1201}
1202
1203struct servent*
1204PerlSockGetservbyport(struct IPerlSock* piPerl, int port, const char* proto)
1205{
1206 return nw_getservbyport(port, proto);
1207}
1208
1209struct servent*
1210PerlSockGetservent(struct IPerlSock* piPerl)
1211{
1212 return nw_getservent();
1213}
1214
1215int
1216PerlSockGetsockname(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* name, int* namelen)
1217{
1218 return nw_getsockname(s, name, namelen);
1219}
1220
1221int
1222PerlSockGetsockopt(struct IPerlSock* piPerl, SOCKET s, int level, int optname, char* optval, int* optlen)
1223{
1224 return nw_getsockopt(s, level, optname, optval, optlen);
1225}
1226
1227unsigned long
1228PerlSockInetAddr(struct IPerlSock* piPerl, const char* cp)
1229{
1230 return(nw_inet_addr(cp));
1231}
1232
1233char*
1234PerlSockInetNtoa(struct IPerlSock* piPerl, struct in_addr in)
1235{
1236 return NULL;
1237}
1238
1239int
1240PerlSockListen(struct IPerlSock* piPerl, SOCKET s, int backlog)
1241{
1242 return (nw_listen(s, backlog));
1243}
1244
1245int
1246PerlSockRecv(struct IPerlSock* piPerl, SOCKET s, char* buffer, int len, int flags)
1247{
1248 return (nw_recv(s, buffer, len, flags));
1249}
1250
1251int
1252PerlSockRecvfrom(struct IPerlSock* piPerl, SOCKET s, char* buffer, int len, int flags, struct sockaddr* from, int* fromlen)
1253{
1254 return nw_recvfrom(s, buffer, len, flags, from, fromlen);
1255}
1256
1257int
1258PerlSockSelect(struct IPerlSock* piPerl, int nfds, char* readfds, char* writefds, char* exceptfds, const struct timeval* timeout)
1259{
1260 return nw_select(nfds, (fd_set*) readfds, (fd_set*) writefds, (fd_set*) exceptfds, timeout);
1261}
1262
1263int
1264PerlSockSend(struct IPerlSock* piPerl, SOCKET s, const char* buffer, int len, int flags)
1265{
1266 return (nw_send(s, buffer, len, flags));
1267}
1268
1269int
1270PerlSockSendto(struct IPerlSock* piPerl, SOCKET s, const char* buffer, int len, int flags, const struct sockaddr* to, int tolen)
1271{
1272 return(nw_sendto(s, buffer, len, flags, to, tolen));
1273}
1274
1275void
1276PerlSockSethostent(struct IPerlSock* piPerl, int stayopen)
1277{
1278 nw_sethostent(stayopen);
1279}
1280
1281void
1282PerlSockSetnetent(struct IPerlSock* piPerl, int stayopen)
1283{
1284 nw_setnetent(stayopen);
1285}
1286
1287void
1288PerlSockSetprotoent(struct IPerlSock* piPerl, int stayopen)
1289{
1290 nw_setprotoent(stayopen);
1291}
1292
1293void
1294PerlSockSetservent(struct IPerlSock* piPerl, int stayopen)
1295{
1296 nw_setservent(stayopen);
1297}
1298
1299int
1300PerlSockSetsockopt(struct IPerlSock* piPerl, SOCKET s, int level, int optname, const char* optval, int optlen)
1301{
1302 dTHXo;
1303 Perl_croak(aTHX_ "setsockopt not implemented!\n");
1304 return 0;
1305}
1306
1307int
1308PerlSockShutdown(struct IPerlSock* piPerl, SOCKET s, int how)
1309{
1310 return nw_shutdown(s, how);
1311}
1312
1313SOCKET
1314PerlSockSocket(struct IPerlSock* piPerl, int af, int type, int protocol)
1315{
1316 return nw_socket(af, type, protocol);
1317}
1318
1319int
1320PerlSockSocketpair(struct IPerlSock* piPerl, int domain, int type, int protocol, int* fds)
1321{
1322 dTHXo;
1323 Perl_croak(aTHX_ "socketpair not implemented!\n");
1324 return 0;
1325}
1326
1327int
1328PerlSockIoctlsocket(struct IPerlSock* piPerl, SOCKET s, long cmd, u_long *argp)
1329{
1330 dTHXo;
1331 Perl_croak(aTHX_ "ioctlsocket not implemented!\n");
1332 return 0;
1333}
2986a63f 1334
1335struct IPerlSock perlSock =
1336{
1337 PerlSockHtonl,
1338 PerlSockHtons,
1339 PerlSockNtohl,
1340 PerlSockNtohs,
1341 PerlSockAccept,
1342 PerlSockBind,
1343 PerlSockConnect,
1344 PerlSockEndhostent,
1345 PerlSockEndnetent,
1346 PerlSockEndprotoent,
1347 PerlSockEndservent,
1348 PerlSockGethostname,
1349 PerlSockGetpeername,
1350 PerlSockGethostbyaddr,
1351 PerlSockGethostbyname,
1352 PerlSockGethostent,
1353 PerlSockGetnetbyaddr,
1354 PerlSockGetnetbyname,
1355 PerlSockGetnetent,
1356 PerlSockGetprotobyname,
1357 PerlSockGetprotobynumber,
1358 PerlSockGetprotoent,
1359 PerlSockGetservbyname,
1360 PerlSockGetservbyport,
1361 PerlSockGetservent,
1362 PerlSockGetsockname,
1363 PerlSockGetsockopt,
1364 PerlSockInetAddr,
1365 PerlSockInetNtoa,
1366 PerlSockListen,
1367 PerlSockRecv,
1368 PerlSockRecvfrom,
1369 PerlSockSelect,
1370 PerlSockSend,
1371 PerlSockSendto,
1372 PerlSockSethostent,
1373 PerlSockSetnetent,
1374 PerlSockSetprotoent,
1375 PerlSockSetservent,
1376 PerlSockSetsockopt,
1377 PerlSockShutdown,
1378 PerlSockSocket,
1379 PerlSockSocketpair,
1380};
1381
8dbfbba0 1382/* IPerlSock - Socket functions - End ==================================================*/
2986a63f 1383
1384#endif /* ___NWPerlSys_H___ */