[PATCH 5.6.1] OS2 getpw*, getgr*
[p5sagit/p5-mst-13.2.git] / os2 / os2ish.h
index dccd932..e6e8b5f 100644 (file)
 #define HAS_DLERROR
 #define HAS_WAITPID_RUNTIME (_emx_env & 0x200)
 
+/* HAS_PASSWD
+ *     This symbol, if defined, indicates that the getpwnam() and
+ *     getpwuid() routines are available to get password entries.
+ *     The getpwent() has a separate definition, HAS_GETPWENT.
+ */
+#define HAS_PASSWD
+
+/* HAS_GROUP
+ *     This symbol, if defined, indicates that the getgrnam() and
+ *     getgrgid() routines are available to get group entries.
+ *     The getgrent() has a separate definition, HAS_GETGRENT.
+ */
+#define HAS_GROUP
+#define HAS_GETGRENT                   /* fake */
+#define HAS_SETGRENT                   /* fake */
+#define HAS_ENDGRENT                   /* fake */
+
 /* USEMYBINMODE
  *     This symbol, if defined, indicates that the program should
  *     use the routine my_binmode(FILE *fp, char iotype, int mode) to insure
@@ -261,6 +278,18 @@ PerlIO *my_syspopen(pTHX_ char *cmd, char *mode);
 int my_syspclose(PerlIO *f);
 FILE *my_tmpfile (void);
 char *my_tmpnam (char *);
+int my_mkdir (__const__ char *, long);
+int my_rmdir (__const__ char *);
+struct passwd *my_getpwent (void);
+void my_setpwent (void);
+void my_endpwent (void);
+
+struct group *getgrent (void);
+void setgrent (void);
+void endgrent (void);
+
+struct passwd *my_getpwuid (uid_t);
+struct passwd *my_getpwnam (__const__ char *);
 
 #undef L_tmpnam
 #define L_tmpnam MAXPATHLEN
@@ -283,6 +312,13 @@ char *my_tmpnam (char *);
 
 #define my_getenv(var) getenv(var)
 #define flock  my_flock
+#define rmdir  my_rmdir
+#define mkdir  my_mkdir
+#define setpwent       my_setpwent
+#define getpwent       my_getpwent
+#define endpwent       my_endpwent
+#define getpwuid       my_getpwuid
+#define getpwnam       my_getpwnam
 
 void *emx_calloc (size_t, size_t);
 void emx_free (void *);
@@ -394,6 +430,8 @@ struct PMWIN_entries_t {
                  unsigned long hwndFilter, unsigned long msgFilterFirst,
                  unsigned long msgFilterLast);
     void * (*DispatchMsg)(unsigned long hab, struct _QMSG *pqmsg);
+    unsigned long (*GetLastError)(unsigned long hab);
+    unsigned long (*CancelShutdown)(unsigned long hmq, unsigned long fCancelAlways);
 };
 extern struct PMWIN_entries_t PMWIN_entries;
 void init_PMWIN_entries(void);
@@ -418,9 +456,14 @@ void init_PMWIN_entries(void);
 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
 #define FillOSError(rc) (os2_setsyserrno(rc),                          \
                        Perl_severity = SEVERITY_ERROR) 
-#define FillWinError (Perl_severity = ERRORIDSEV(Perl_rc),             \
-                       Perl_rc = ERRORIDERROR(Perl_rc)),               \
-                       os2_setsyserrno(Perl_rc)
+
+/* At this moment init_PMWIN_entries() should be a nop (WinInitialize should
+   be called already, right?), so we do not risk stepping over our own error */
+#define FillWinError ( init_PMWIN_entries(),                           \
+                       Perl_rc=(*PMWIN_entries.GetLastError)(perl_hab_GET()),\
+                       Perl_severity = ERRORIDSEV(Perl_rc),            \
+                       Perl_rc = ERRORIDERROR(Perl_rc),                \
+                       os2_setsyserrno(Perl_rc))
 
 #define STATIC_FILE_LENGTH 127