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
commit642ddf7201445c6abd8b7afa6efdaa1e8f1bea67 (patch)
tree2af4ab7e7faed8c5211ff920bf6a3a1d43b28e67
parent9bbb8406cb1ded73ebdc10d565fdd1fc0f805cb8 (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/trunk@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.c20
-rw-r--r--wince/Makefile.sub2
-rw-r--r--wince/sys/types.h7
11 files changed, 65 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index e8f32574ae..5b05bec122 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+Sat May 14 23:56:41 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.
+
Sat May 14 11:47:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* intern.h (ruby_pragma): prototype. [ruby-core:04881]
diff --git a/configure.in b/configure.in
index 21de29f29b..9202f48d49 100644
--- a/configure.in
+++ b/configure.in
@@ -226,6 +226,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,
@@ -454,7 +456,6 @@ AC_CHECK_SIZEOF(rlim_t, 0, [
])
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 abfd53cc1c..d0aa208b49 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 1894e1a5d6..82c82f1668 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 a77476cbc2..17de5db157 100644
--- a/process.c
+++ b/process.c
@@ -1847,7 +1847,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);
@@ -2642,10 +2642,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)
@@ -2681,7 +2681,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;
@@ -2691,7 +2691,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];
@@ -2749,7 +2749,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 a9a3897f63..3371a9998d 100644
--- a/ruby.h
+++ b/ruby.h
@@ -82,6 +82,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 70a584f33d..55b0c36803 100644
--- a/vms/config.h
+++ b/vms/config.h
@@ -23,6 +23,9 @@
#define HAVE_GETPGRP 1
/* #define HAVE_GETPRIORITY 1 */
/* #define HAVE_GETRLIMIT 1 */
+#define HAVE_PID_T 1
+#define HAVE_GID_T 1
+#define HAVE_UID_T 1
#define HAVE_HYPOT 1
#define HAVE_ISASCII 1
/* #define HAVE_ISINF 1 */
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 660edd3a4a..ad18e9c89a 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -229,8 +229,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 d8d5dae027..aa3e94a839 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -445,7 +445,7 @@ 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 { \
@@ -463,7 +463,7 @@ FindFirstChildSlot(void)
}
static struct ChildRecord *
-FindChildSlot(pid_t pid)
+FindChildSlot(rb_pid_t pid)
{
FOREACH_CHILD(child) {
@@ -678,7 +678,7 @@ rb_w32_join_argv(char *cmd, char *const *argv)
static int socketpair_internal(int af, int type, int protocol, SOCKET *sv);
-pid_t
+rb_pid_t
rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe)
{
struct ChildRecord* child;
@@ -987,7 +987,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 */
@@ -2577,7 +2577,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;
@@ -2595,7 +2595,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;
@@ -2603,8 +2603,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;
@@ -3435,10 +3435,10 @@ rb_w32_free_environ(char **env)
}
#undef getpid
-pid_t
+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 3649d77632..4e5007a22d 100644
--- a/wince/Makefile.sub
+++ b/wince/Makefile.sub
@@ -231,8 +231,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