#include "perlio.h"
#ifndef Sighandler_t
+# if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
+typedef Signal_t (*Sighandler_t) (int, ...);
+# else
typedef Signal_t (*Sighandler_t) (int);
+# endif
#endif
#if defined(PERL_IMPLICIT_SYS)
typedef int (*LPSetVBuf)(struct IPerlStdIO*, FILE*, char*, int,
Size_t);
typedef void (*LPSetCnt)(struct IPerlStdIO*, FILE*, int);
+
+#ifndef NETWARE
typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, char*);
+#elif defined(NETWARE)
+typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, char*, int);
+#endif
+
typedef void (*LPSetlinebuf)(struct IPerlStdIO*, FILE*);
typedef int (*LPPrintf)(struct IPerlStdIO*, FILE*, const char*,
...);
#define PerlSIO_set_cnt(f,c) PerlIOProc_abort()
#endif
#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE)
-#define PerlSIO_set_ptr(f,p) FILE_ptr(f) = (p)
+#define PerlSIO_set_ptr(f,p) FILE_ptr(f) = ((STDCHAR*)(p))
#else
#define PerlSIO_set_ptr(f,p) PerlIOProc_abort()
#endif
#define PerlSIO_setlinebuf(f) setlinebuf(f)
-#define PerlSIO_printf Perl_fprintf_nocontext
-#define PerlSIO_stdoutf *PL_StdIO->pPrintf
-#define PerlSIO_vprintf(f,fmt,a)
+#define PerlSIO_printf fprintf
+#define PerlSIO_stdoutf printf
+#define PerlSIO_vprintf(f,fmt,a) vfprintf(f,fmt,a)
#define PerlSIO_ftell(f) ftell(f)
#define PerlSIO_fseek(f,o,w) fseek(f,o,w)
#define PerlSIO_fgetpos(f,p) fgetpos(f,p)
typedef int (*LPChdir)(struct IPerlDir*, const char*);
typedef int (*LPRmdir)(struct IPerlDir*, const char*);
typedef int (*LPDirClose)(struct IPerlDir*, DIR*);
-typedef DIR* (*LPDirOpen)(struct IPerlDir*, char*);
+typedef DIR* (*LPDirOpen)(struct IPerlDir*, const char*);
typedef struct direct* (*LPDirRead)(struct IPerlDir*, DIR*);
typedef void (*LPDirRewind)(struct IPerlDir*, DIR*);
typedef void (*LPDirSeek)(struct IPerlDir*, DIR*, long);
typedef int (*LPLIOChmod)(struct IPerlLIO*, const char*, int);
typedef int (*LPLIOChown)(struct IPerlLIO*, const char*, uid_t,
gid_t);
-typedef int (*LPLIOChsize)(struct IPerlLIO*, int, long);
+typedef int (*LPLIOChsize)(struct IPerlLIO*, int, Off_t);
typedef int (*LPLIOClose)(struct IPerlLIO*, int);
typedef int (*LPLIODup)(struct IPerlLIO*, int);
typedef int (*LPLIODup2)(struct IPerlLIO*, int, int);
typedef char* (*LPLIOTmpnam)(struct IPerlLIO*, char*);
typedef int (*LPLIOUmask)(struct IPerlLIO*, int);
typedef int (*LPLIOUnlink)(struct IPerlLIO*, const char*);
-typedef int (*LPLIOUtime)(struct IPerlLIO*, char*, struct utimbuf*);
+typedef int (*LPLIOUtime)(struct IPerlLIO*, const char*, struct utimbuf*);
typedef int (*LPLIOWrite)(struct IPerlLIO*, int, const void*,
unsigned int);
#define PerlLIO_access(file, mode) access((file), (mode))
#define PerlLIO_chmod(file, mode) chmod((file), (mode))
#define PerlLIO_chown(file, owner, grp) chown((file), (owner), (grp))
-#define PerlLIO_chsize(fd, size) chsize((fd), (size))
+#if defined(HAS_TRUNCATE)
+# define PerlLIO_chsize(fd, size) ftruncate((fd), (size))
+#elif defined(HAS_CHSIZE)
+# define PerlLIO_chsize(fd, size) chsize((fd), (size))
+#else
+# define PerlLIO_chsize(fd, size) my_chsize((fd), (size))
+#endif
#define PerlLIO_close(fd) close((fd))
#define PerlLIO_dup(fd) dup((fd))
#define PerlLIO_dup2(fd1, fd2) dup2((fd1), (fd2))
/* Shared memory macros */
#ifdef NETWARE
-
- #define PerlMemShared_malloc(size) \
+
+#define PerlMemShared_malloc(size) \
(*PL_Mem->pMalloc)(PL_Mem, (size))
#define PerlMemShared_realloc(buf, size) \
(*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
typedef void (*LPProcAbort)(struct IPerlProc*);
typedef char* (*LPProcCrypt)(struct IPerlProc*, const char*,
const char*);
-typedef void (*LPProcExit)(struct IPerlProc*, int);
-typedef void (*LPProc_Exit)(struct IPerlProc*, int);
+typedef void (*LPProcExit)(struct IPerlProc*, int)
+ __attribute__noreturn__;
+typedef void (*LPProc_Exit)(struct IPerlProc*, int)
+ __attribute__noreturn__;
typedef int (*LPProcExecl)(struct IPerlProc*, const char*,
const char*, const char*, const char*,
const char*);
typedef void* (*LPProcDynaLoader)(struct IPerlProc*, const char*);
typedef void (*LPProcGetOSError)(struct IPerlProc*,
SV* sv, DWORD dwErr);
-typedef void (*LPProcFreeBuf)(struct IPerlProc*, char*);
-typedef BOOL (*LPProcDoCmd)(struct IPerlProc*, char*);
-typedef int (*LPProcSpawn)(struct IPerlProc*, char*);
typedef int (*LPProcSpawnvp)(struct IPerlProc*, int, const char*,
const char*const*);
-typedef int (*LPProcASpawn)(struct IPerlProc*, void*, void**, void**);
#endif
typedef int (*LPProcLastHost)(struct IPerlProc*);
+typedef int (*LPProcGetTimeOfDay)(struct IPerlProc*,
+ struct timeval*, void*);
struct IPerlProc
{
#ifdef WIN32
LPProcDynaLoader pDynaLoader;
LPProcGetOSError pGetOSError;
- LPProcDoCmd pDoCmd;
- LPProcSpawn pSpawn;
LPProcSpawnvp pSpawnvp;
- LPProcASpawn pASpawn;
#endif
LPProcLastHost pLastHost;
LPProcPopenList pPopenList;
+ LPProcGetTimeOfDay pGetTimeOfDay;
};
struct IPerlProcInfo
(*PL_Proc->pDynaLoader)(PL_Proc, (f))
#define PerlProc_GetOSError(s,e) \
(*PL_Proc->pGetOSError)(PL_Proc, (s), (e))
-#define PerlProc_Cmd(s) \
- (*PL_Proc->pDoCmd)(PL_Proc, (s))
-#define do_spawn(s) \
- (*PL_Proc->pSpawn)(PL_Proc, (s))
-#define do_spawnvp(m, c, a) \
+#define PerlProc_spawnvp(m, c, a) \
(*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a))
-#define PerlProc_aspawn(m,c,a) \
- (*PL_Proc->pASpawn)(PL_Proc, (m), (c), (a))
#endif
#define PerlProc_lasthost() \
(*PL_Proc->pLastHost)(PL_Proc)
+#define PerlProc_gettimeofday(t,z) \
+ (*PL_Proc->pGetTimeOfDay)(PL_Proc,(t),(z))
#else /* PERL_IMPLICIT_SYS */
#define PerlProc_signal(n, h) signal((n), (h))
#define PerlProc_fork() my_fork()
#define PerlProc_getpid() getpid()
+#define PerlProc_gettimeofday(t,z) gettimeofday((t),(z))
#ifdef WIN32
#define PerlProc_DynaLoad(f) \
win32_dynaload((f))
#define PerlProc_GetOSError(s,e) \
win32_str_os_error((s), (e))
+#define PerlProc_spawnvp(m, c, a) \
+ win32_spawnvp((m), (c), (a))
#undef PerlProc_signal
#define PerlProc_signal(n, h) win32_signal((n), (h))
#endif