mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* 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
This commit is contained in:
parent
afdbd6fc52
commit
7862a89c56
11 changed files with 66 additions and 30 deletions
25
ChangeLog
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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -176,7 +176,6 @@ void xfree _((void*));
|
|||
#ifndef X_OK
|
||||
#define X_OK 1
|
||||
#endif
|
||||
typedef int pid_t;
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* NeXT */
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ echild_status(self)
|
|||
|
||||
struct pty_info {
|
||||
int fd;
|
||||
pid_t child_pid;
|
||||
rb_pid_t child_pid;
|
||||
VALUE thread;
|
||||
};
|
||||
|
||||
|
|
12
process.c
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);
|
||||
|
|
18
ruby.h
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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue