mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05: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/trunk@8455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9bbb8406cb
commit
642ddf7201
11 changed files with 65 additions and 30 deletions
25
ChangeLog
25
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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
@ -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);
|
||||
|
|
18
ruby.h
18
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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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…
Reference in a new issue