Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 092a5c6b6a80f2d3eb3bce7e3bcb9c7b19737127 1 parent ab39890
@nobu nobu authored
View
25 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.
View
3  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
View
1  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 */
View
2  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;
};
View
12 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);
View
18 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
View
3  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 */
View
2  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
View
21 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();
View
2  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
View
7 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
Please sign in to comment.
Something went wrong with that request. Please try again.