summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/os2/os2ish.h
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-12-03 03:02:54 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-12-03 03:02:54 +0000
commitba0a2090f574df90404f8a0bbe689389ce0ebcab (patch)
tree53f8d0ad53e5fc0f05d68a0073273080ef5bd392 /gnu/usr.bin/perl/os2/os2ish.h
parent0121b80e4f69c2ad9631e8d20b5c91f3b2a40434 (diff)
Resolve conflicts for perl 5.8.2, remove old files, and add OpenBSD-specific scaffolding
Diffstat (limited to 'gnu/usr.bin/perl/os2/os2ish.h')
-rw-r--r--gnu/usr.bin/perl/os2/os2ish.h122
1 files changed, 114 insertions, 8 deletions
diff --git a/gnu/usr.bin/perl/os2/os2ish.h b/gnu/usr.bin/perl/os2/os2ish.h
index 1b38b85427b..dbd5d94c876 100644
--- a/gnu/usr.bin/perl/os2/os2ish.h
+++ b/gnu/usr.bin/perl/os2/os2ish.h
@@ -14,6 +14,11 @@
*/
#define HAS_UTIME /**/
+/* BIG_TIME:
+ * This symbol is defined if Time_t is an unsigned type on this system.
+ */
+#define BIG_TIME
+
#define HAS_KILL
#define HAS_WAIT
#define HAS_DLERROR
@@ -44,6 +49,8 @@
*/
#undef USEMYBINMODE
+#define SOCKET_OPEN_MODE "b"
+
/* Stat_t:
* This symbol holds the type used to declare buffers for information
* returned by stat(). It's usually just struct stat. It may be necessary
@@ -99,7 +106,7 @@
# undef I_SYS_UN
#endif
-#ifdef USE_5005THREADS
+#if defined(USE_5005THREADS) || defined(USE_ITHREADS)
#define do_spawn(a) os2_do_spawn(aTHX_ (a))
#define do_aspawn(a,b,c) os2_do_aspawn(aTHX_ (a),(b),(c))
@@ -184,7 +191,7 @@ extern int rc;
# define pthread_getspecific(k) (*(k))
# define pthread_setspecific(k,v) (*(k)=(v),0)
# define pthread_key_create(keyp,flag) \
- ( DosAllocThreadLocalMemory(1,(U32*)keyp) \
+ ( DosAllocThreadLocalMemory(1,(unsigned long**)keyp) \
? Perl_croak_nocontext("LocalMemory"),1 \
: 0 \
)
@@ -220,6 +227,7 @@ void Perl_OS2_term(void **excH, int exitstatus, int flags);
# define PERL_SYS_INIT3(argcp, argvp, envp) \
{ void *xreg[2]; \
+ MALLOC_CHECK_TAINT(*argcp, *argvp, *envp) \
_response(argcp, argvp); \
_wildcard(argcp, argvp); \
Perl_OS2_init3(*envp, xreg, 0)
@@ -299,7 +307,7 @@ void *sys_alloc(int size);
#endif
#define TMPPATH1 "plXXXXXX"
-extern char *tmppath;
+extern const char *tmppath;
PerlIO *my_syspopen(pTHX_ char *cmd, char *mode);
/* Cannot prototype with I32 at this point. */
int my_syspclose(PerlIO *f);
@@ -312,6 +320,28 @@ void my_setpwent (void);
void my_endpwent (void);
char *gcvt_os2(double value, int digits, char *buffer);
+#define MAX_SLEEP (((1<30) / (1000/4))-1) /* 1<32 msec */
+
+static __inline__ unsigned
+my_sleep(unsigned sec)
+{
+ int remain;
+ while (sec > MAX_SLEEP) {
+ sec -= MAX_SLEEP;
+ remain = sleep(MAX_SLEEP);
+ if (remain)
+ return remain + sec;
+ }
+ return sleep(sec);
+}
+
+#define sleep my_sleep
+
+#ifndef INCL_DOS
+unsigned long DosSleep(unsigned long);
+unsigned long DosAllocThreadLocalMemory (unsigned long cb, unsigned long **p);
+#endif
+
struct group *getgrent (void);
void setgrent (void);
void endgrent (void);
@@ -330,6 +360,9 @@ struct passwd *my_getpwnam (__const__ char *);
#define strtoll _strtoll
#define strtoull _strtoull
+#define usleep(usec) ((void)_sleep2(((usec)+500)/1000))
+
+
/*
* fwrite1() should be a routine with the same calling sequence as fwrite(),
* but which outputs all of the bytes requested as a single stream (unlike
@@ -401,15 +434,19 @@ char *ctermid(char *s);
#if OS2_STAT_HACK
#define Stat(fname,bufptr) os2_stat((fname),(bufptr))
-#define Fstat(fd,bufptr) fstat((fd),(bufptr))
+#define Fstat(fd,bufptr) os2_fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
#define Mkdir(path,mode) mkdir((path),(mode))
+#define chmod(path,mode) os2_chmod((path),(mode))
#undef S_IFBLK
#undef S_ISBLK
-#define S_IFBLK 0120000
+#define S_IFBLK 0120000 /* Hacks to make things compile... */
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
+int os2_chmod(const char *name, int pmode);
+int os2_fstat(int handle, struct stat *st);
+
#else
#define Stat(fname,bufptr) stat((fname),(bufptr))
@@ -436,6 +473,7 @@ typedef struct OS2_Perl_data {
unsigned long phmq_refcnt;
unsigned long phmq_servers;
unsigned long initial_mode; /* VIO etc. mode we were started in */
+ unsigned long morph_refcnt;
} OS2_Perl_data_t;
extern OS2_Perl_data_t OS2_Perl_data;
@@ -459,6 +497,7 @@ extern OS2_Perl_data_t OS2_Perl_data;
#define Perl_hmq_refcnt (OS2_Perl_data.phmq_refcnt)
#define Perl_hmq_servers (OS2_Perl_data.phmq_servers)
#define Perl_os2_initial_mode (OS2_Perl_data.initial_mode)
+#define Perl_morph_refcnt (OS2_Perl_data.morph_refcnt)
unsigned long Perl_hab_GET();
unsigned long Perl_Register_MQ(int serve);
@@ -500,7 +539,7 @@ void init_PMWIN_entries(void);
/* The expressions below return true on error. */
/* INCL_DOSERRORS needed. rc should be declared outside. */
-#define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
+#define CheckOSError(expr) ((rc = (expr)) ? (FillOSError(rc), rc) : 0)
/* INCL_WINERRORS needed. */
#define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
@@ -611,6 +650,47 @@ enum entries_ordinals {
ORD_WinQueryDesktopWindow,
ORD_WinSetActiveWindow,
ORD_DosQueryModFromEIP,
+ ORD_Dos32QueryHeaderInfo,
+ ORD_DosTmrQueryFreq,
+ ORD_DosTmrQueryTime,
+ ORD_WinQueryActiveDesktopPathname,
+ ORD_WinInvalidateRect,
+ ORD_WinCreateFrameControls,
+ ORD_WinQueryClipbrdFmtInfo,
+ ORD_WinQueryClipbrdOwner,
+ ORD_WinQueryClipbrdViewer,
+ ORD_WinQueryClipbrdData,
+ ORD_WinOpenClipbrd,
+ ORD_WinCloseClipbrd,
+ ORD_WinSetClipbrdData,
+ ORD_WinSetClipbrdOwner,
+ ORD_WinSetClipbrdViewer,
+ ORD_WinEnumClipbrdFmts,
+ ORD_WinEmptyClipbrd,
+ ORD_WinAddAtom,
+ ORD_WinFindAtom,
+ ORD_WinDeleteAtom,
+ ORD_WinQueryAtomUsage,
+ ORD_WinQueryAtomName,
+ ORD_WinQueryAtomLength,
+ ORD_WinQuerySystemAtomTable,
+ ORD_WinCreateAtomTable,
+ ORD_WinDestroyAtomTable,
+ ORD_WinOpenWindowDC,
+ ORD_DevOpenDC,
+ ORD_DevQueryCaps,
+ ORD_DevCloseDC,
+ ORD_WinMessageBox,
+ ORD_WinMessageBox2,
+ ORD_WinQuerySysValue,
+ ORD_WinSetSysValue,
+ ORD_WinAlarm,
+ ORD_WinFlashWindow,
+ ORD_WinLoadPointer,
+ ORD_WinQuerySysPointer,
+ ORD_DosReplaceModule,
+ ORD_DosPerfSysCall,
+ ORD_RexxRegisterSubcomExe,
ORD_NENTRIES
};
@@ -621,7 +701,11 @@ enum entries_ordinals {
#define DeclVoidFuncByORD(name,o,at,args) \
void name at { CallORD(void,o,at,args); }
-/* These functions return false on error, and save the error info in $^E */
+/* This function returns error code on error, and saves the error info in $^E and Perl_rc */
+#define DeclOSFuncByORD_native(ret,name,o,at,args) \
+ ret name at { unsigned long rc; return CheckOSError(CallORD(ret,o,at,args)); }
+
+/* These functions return false on error, and save the error info in $^E and Perl_rc */
#define DeclOSFuncByORD(ret,name,o,at,args) \
ret name at { unsigned long rc; return !CheckOSError(CallORD(ret,o,at,args)); }
#define DeclWinFuncByORD(ret,name,o,at,args) \
@@ -670,17 +754,39 @@ void CroakWinError(int die, char *name);
#define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
char *perllib_mangle(char *, unsigned int);
+#define fork fork_with_resources
+
+#ifdef EINTR /* x2p do not include perl.h!!! */
+static __inline__ int
+my_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
+{
+ if (nfds == 0 && timeout && (_emx_env & 0x200)) {
+ if (DosSleep(1000 * timeout->tv_sec + (timeout->tv_usec + 500)/1000) == 0)
+ return 0;
+ errno = EINTR;
+ return -1;
+ }
+ return select(nfds, readfds, writefds, exceptfds, timeout);
+}
+
+#define select my_select
+#endif
+
+
typedef int (*Perl_PFN)();
Perl_PFN loadByOrdinal(enum entries_ordinals ord, int fail);
extern const Perl_PFN * const pExtFCN;
char *os2error(int rc);
int os2_stat(const char *name, struct stat *st);
+int fork_with_resources();
int setpriority(int which, int pid, int val);
int getpriority(int which /* ignored */, int pid);
+void croak_with_os2error(char *s) __attribute__((noreturn));
+
#ifdef PERL_CORE
int os2_do_spawn(pTHX_ char *cmd);
-int os2_do_aspawn(pTHX_ SV *really, void **vmark, void **vsp);
+int os2_do_aspawn(pTHX_ SV *really, SV **vmark, SV **vsp);
#endif
#ifndef LOG_DAEMON