summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-14 14:57:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-14 14:57:53 +0000
commit7862a89c564005b4f2c0eed1308ebd193dcbcd14 (patch)
tree78b0af99dcf7b739c0afaa59f53c338fdec6cdd9
parentafdbd6fc5264ad548370ade033daa8fa318ca8ab (diff)
* configure.in: Check for the availability of pid_t, gid_t and uid_t and
remove AC_TYPE_UID_T. fixed: [ruby-core:04745] * defines.h: Remove pid_t typedef. * ruby.h: Define rb_pid_t, rb_gid_t and rb_uid_t in accordance with the available system types. * process.c: Change instances of pid_t and gid_t to their rb_* counterparts. * ext/pty/pty.c: Change pid_t to rb_pid_t. * vms/config.h: Define HAVE_{P,G,U}ID_T to 1. * win32/Makefile.sub: Remove #define for {g,u}id_t. * win32/win32.c: Change pid_t to rb_pid_t. * wince/Makefile.sub: Remove #define for {g,u}id_t. * wince/sys/types.h: Remove definitions of {p,g,u}id_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog25
-rw-r--r--configure.in3
-rw-r--r--defines.h1
-rw-r--r--ext/pty/pty.c2
-rw-r--r--process.c12
-rw-r--r--ruby.h18
-rw-r--r--vms/config.h3
-rw-r--r--win32/Makefile.sub2
-rw-r--r--win32/win32.c21
-rw-r--r--wince/Makefile.sub2
-rw-r--r--wince/sys/types.h7
11 files changed, 66 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 174a8beb21..ee3d6c7e93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+Sat May 14 23:57:26 2005 Erik Huelsmann <ehuels@gmail.com>
+
+ * configure.in: Check for the availability of pid_t, gid_t and uid_t and
+ remove AC_TYPE_UID_T. fixed: [ruby-core:04745]
+
+ * defines.h: Remove pid_t typedef.
+
+ * ruby.h: Define rb_pid_t, rb_gid_t and rb_uid_t in accordance with
+ the available system types.
+
+ * process.c: Change instances of pid_t and gid_t to their rb_*
+ counterparts.
+
+ * ext/pty/pty.c: Change pid_t to rb_pid_t.
+
+ * vms/config.h: Define HAVE_{P,G,U}ID_T to 1.
+
+ * win32/Makefile.sub: Remove #define for {g,u}id_t.
+
+ * win32/win32.c: Change pid_t to rb_pid_t.
+
+ * wince/Makefile.sub: Remove #define for {g,u}id_t.
+
+ * wince/sys/types.h: Remove definitions of {p,g,u}id_t.
+
Fri May 13 23:44:22 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb: keep srcdir unexpanded.
diff --git a/configure.in b/configure.in
index e4980c9a5d..10e783e1ac 100644
--- a/configure.in
+++ b/configure.in
@@ -230,6 +230,8 @@ AC_CHECK_SIZEOF(float, 4)
AC_CHECK_SIZEOF(double, 8)
AC_CHECK_SIZEOF(time_t, 0)
+AC_CHECK_TYPES([pid_t, gid_t, uid_t])
+
AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
rb_cv_have_prototypes=yes,
@@ -406,7 +408,6 @@ AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\
ucontext.h intrinsics.h)
dnl Checks for typedefs, structures, and compiler characteristics.
-AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
diff --git a/defines.h b/defines.h
index a059a29b47..b5d0ed6e1c 100644
--- a/defines.h
+++ b/defines.h
@@ -176,7 +176,6 @@ void xfree _((void*));
#ifndef X_OK
#define X_OK 1
#endif
-typedef int pid_t;
#endif /* __APPLE__ */
#endif /* NeXT */
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 2a03eff6ca..f2cd871cbd 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -128,7 +128,7 @@ echild_status(self)
struct pty_info {
int fd;
- pid_t child_pid;
+ rb_pid_t child_pid;
VALUE thread;
};
diff --git a/process.c b/process.c
index 530665ba1e..800c302c1c 100644
--- a/process.c
+++ b/process.c
@@ -1715,7 +1715,7 @@ proc_setsid()
if (pid < 0) rb_sys_fail(0);
return INT2FIX(pid);
#elif defined(HAVE_SETPGRP) && defined(TIOCNOTTY)
- pid_t pid;
+ rb_pid_t pid;
int ret;
rb_secure(2);
@@ -2413,10 +2413,10 @@ proc_getgroups(VALUE obj)
#ifdef HAVE_GETGROUPS
VALUE ary;
size_t ngroups;
- gid_t *groups;
+ rb_gid_t *groups;
int i;
- groups = ALLOCA_N(gid_t, maxgroups);
+ groups = ALLOCA_N(rb_gid_t, maxgroups);
ngroups = getgroups(maxgroups, groups);
if (ngroups == -1)
@@ -2452,7 +2452,7 @@ proc_setgroups(VALUE obj, VALUE ary)
{
#ifdef HAVE_SETGROUPS
size_t ngroups;
- gid_t *groups;
+ rb_gid_t *groups;
int i;
struct group *gr;
@@ -2462,7 +2462,7 @@ proc_setgroups(VALUE obj, VALUE ary)
if (ngroups > maxgroups)
rb_raise(rb_eArgError, "too many groups, %d max", maxgroups);
- groups = ALLOCA_N(gid_t, ngroups);
+ groups = ALLOCA_N(rb_gid_t, ngroups);
for (i = 0; i < ngroups && i < RARRAY(ary)->len; i++) {
VALUE g = RARRAY(ary)->ptr[i];
@@ -2520,7 +2520,7 @@ proc_initgroups(obj, uname, base_grp)
VALUE obj, uname, base_grp;
{
#ifdef HAVE_INITGROUPS
- if (initgroups(StringValuePtr(uname), (gid_t)NUM2INT(base_grp)) != 0) {
+ if (initgroups(StringValuePtr(uname), (rb_gid_t)NUM2INT(base_grp)) != 0) {
rb_sys_fail(0);
}
return proc_getgroups(obj);
diff --git a/ruby.h b/ruby.h
index db3280b905..c5dcbff219 100644
--- a/ruby.h
+++ b/ruby.h
@@ -76,6 +76,24 @@ extern "C" {
typedef unsigned long VALUE;
typedef unsigned long ID;
+#ifndef HAVE_PID_T
+ typedef int rb_pid_t;
+#else
+ typedef pid_t rb_pid_t;
+#endif
+
+#ifndef HAVE_GID_T
+ typedef int rb_gid_t;
+#else
+ typedef gid_t rb_gid_t;
+#endif
+
+#ifndef HAVE_UID_T
+ typedef int rb_uid_t;
+#else
+ typedef uid_t rb_uid_t;
+#endif
+
#ifdef __STDC__
# include <limits.h>
#else
diff --git a/vms/config.h b/vms/config.h
index bc99ec1144..82d499ae2d 100644
--- a/vms/config.h
+++ b/vms/config.h
@@ -23,6 +23,9 @@
#define HAVE_STRING_H 1
#define HAVE_UTIME_H 1
#define HAVE_MEMORY_H 1
+#define HAVE_PID_T 1
+#define HAVE_GID_T 1
+#define HAVE_UID_T 1
/* #define HAVE_ST_BLKSIZE 1 */
#define HAVE_ST_RDEV 1
/* #define GETGROUPS_T gid_t */
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 9509f9cc6b..6d3e069788 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -221,8 +221,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub
#define HAVE_FCNTL_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_FLOAT_H 1
-#define uid_t int
-#define gid_t int
#define HAVE_STRUCT_STAT_ST_RDEV 1
#define HAVE_ST_RDEV 1
#define GETGROUPS_T int
diff --git a/win32/win32.c b/win32/win32.c
index a72ee909bf..ce194bb40d 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -398,7 +398,7 @@ char *getlogin()
static struct ChildRecord {
HANDLE hProcess; /* process handle */
- pid_t pid; /* process id */
+ rb_pid_t pid; /* process id */
} ChildRecord[MAXCHILDNUM];
#define FOREACH_CHILD(v) do { \
@@ -416,7 +416,7 @@ FindFirstChildSlot(void)
}
static struct ChildRecord *
-FindChildSlot(pid_t pid)
+FindChildSlot(rb_pid_t pid)
{
FOREACH_CHILD(child) {
@@ -578,7 +578,7 @@ rb_w32_get_osfhandle(int fh)
return _get_osfhandle(fh);
}
-pid_t
+rb_pid_t
pipe_exec(char *cmd, int mode, FILE **fpr, FILE **fpw)
{
struct ChildRecord* child;
@@ -993,7 +993,7 @@ CreateChild(const char *cmd, const char *prog, SECURITY_ATTRIBUTES *psa,
CloseHandle(aProcessInformation.hThread);
child->hProcess = aProcessInformation.hProcess;
- child->pid = (pid_t)aProcessInformation.dwProcessId;
+ child->pid = (rb_pid_t)aProcessInformation.dwProcessId;
if (!IsWinNT()) {
/* On Win9x, make pid positive similarly to cygwin and perl */
@@ -2437,7 +2437,7 @@ fcntl(int fd, int cmd, ...)
#define WNOHANG -1
#endif
-static pid_t
+static rb_pid_t
poll_child_status(struct ChildRecord *child, int *stat_loc)
{
DWORD exitcode;
@@ -2455,7 +2455,7 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
}
if (exitcode != STILL_ACTIVE) {
/* If already died, return immediatly. */
- pid_t pid = child->pid;
+ rb_pid_t pid = child->pid;
CloseChildHandle(child);
if (stat_loc) *stat_loc = exitcode << 8;
return pid;
@@ -2463,8 +2463,8 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
return 0;
}
-pid_t
-waitpid (pid_t pid, int *stat_loc, int options)
+rb_pid_t
+waitpid (rb_pid_t pid, int *stat_loc, int options)
{
DWORD timeout;
@@ -3246,9 +3246,10 @@ void rb_w32_free_environ(char **env)
}
#undef getpid
-pid_t rb_w32_getpid(void)
+rb_pid_t
+rb_w32_getpid(void)
{
- pid_t pid;
+ rb_pid_t pid;
pid = getpid();
diff --git a/wince/Makefile.sub b/wince/Makefile.sub
index 829ce48c58..1930d23be8 100644
--- a/wince/Makefile.sub
+++ b/wince/Makefile.sub
@@ -223,8 +223,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/wince/Makefile.sub
#define HAVE_FCNTL_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_FLOAT_H 1
-#define uid_t int
-#define gid_t int
#define HAVE_STRUCT_STAT_ST_RDEV 1
#define HAVE_ST_RDEV 1
#define GETGROUPS_T int
diff --git a/wince/sys/types.h b/wince/sys/types.h
index 214bd4a9b9..541d5e8361 100644
--- a/wince/sys/types.h
+++ b/wince/sys/types.h
@@ -19,8 +19,6 @@ typedef unsigned long ino_t;
#define _MODE_T_DEFINED_
#endif
-//typedef unsigned short gid_t;
-//typedef unsigned short uid_t;
typedef long clock_t;
#ifndef _PTRDIFF_T_DEFINED
@@ -59,9 +57,4 @@ typedef unsigned int size_t;
//#define _TIME_T_DEFINED_
//#endif
-#ifndef _PID_T_DEFINED_
-typedef unsigned long pid_t;
-#define _PID_T_DEFINED_
-#endif
-
#endif