Skip to content

Commit bf6efa7

Browse files
committed
* configure.in (pid_t, uid_t, gid_t): check if defined.
* intern.h, process.c, rubyio.h, ext/etc/etc.c, ext/pty/pty.c: use rb_{pid,uid,gid}_t instead of plain int. [ruby-dev:30376] * ext/etc/extconf.rb (PIDT2NUM, NUM2PIDT, UIDT2NUM, NUM2UIDT, GIDT2NUM, NUM2GIDT): moved to configure.in. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 353cd25 commit bf6efa7

File tree

5 files changed

+218
-147
lines changed

5 files changed

+218
-147
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Sun Feb 18 13:11:51 2007 Nobuyoshi Nakada <[email protected]>
2+
3+
* configure.in (pid_t, uid_t, gid_t): check if defined.
4+
5+
* intern.h, process.c, rubyio.h, ext/etc/etc.c, ext/pty/pty.c: use
6+
rb_{pid,uid,gid}_t instead of plain int. [ruby-dev:30376]
7+
8+
* ext/etc/extconf.rb (PIDT2NUM, NUM2PIDT, UIDT2NUM, NUM2UIDT, GIDT2NUM,
9+
NUM2GIDT): moved to configure.in.
10+
111
Fri Feb 16 21:34:33 2007 Koichi Sasada <[email protected]>
212

313
* object.c (rb_obj_ivar_set/get/defined): fix to check :@_v/C id.

configure.in

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,46 @@ AC_CHECK_SIZEOF(float, 4)
239239
AC_CHECK_SIZEOF(double, 8)
240240
AC_CHECK_SIZEOF(time_t, 0)
241241

242-
for id in pid_t gid_t uid_t; do
243-
AC_CHECK_TYPE($id, [typ=$id], [typ=int])
244-
AC_DEFINE_UNQUOTED(rb_$id, $typ)
245-
done
242+
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
243+
AC_CHECK_SIZEOF($1, 0, $3)
244+
u=
245+
size=$ac_cv_sizeof_[$1]
246+
if test $size -gt 0; then
247+
typ=$1
248+
AC_COMPILE_IFELSE(
249+
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT]
250+
[$3], [($typ)-1 > 0])],
251+
[u=U])
252+
else
253+
typ=$2
254+
size=$ac_cv_sizeof_[$2]
255+
fi
256+
if test $size -gt $ac_cv_sizeof_long; then
257+
f=LL
258+
elif test $size = $ac_cv_sizeof_long; then
259+
f=LONG
260+
else
261+
f=INT
262+
fi
263+
AC_DEFINE_UNQUOTED(rb_$1, $typ)
264+
AC_DEFINE_UNQUOTED(SIZEOF_RB_`echo $1 | tr a-z A-Z`,
265+
SIZEOF_`echo $typ | tr a-z A-Z`)
266+
typ=`echo $1 | tr a-z A-Z | tr -d _`
267+
AC_DEFINE_UNQUOTED(${typ}2NUM, ${u}${f}2NUM)
268+
AC_DEFINE_UNQUOTED(NUM2${typ}, NUM2${u}${f})
269+
])
270+
RUBY_REPLACE_TYPE(pid_t, int, [
271+
#include <sys/types.h>
272+
#include <unistd.h>
273+
])
274+
RUBY_REPLACE_TYPE(uid_t, int, [
275+
#include <sys/types.h>
276+
#include <pwd.h>
277+
])
278+
RUBY_REPLACE_TYPE(gid_t, int, [
279+
#include <sys/types.h>
280+
#include <grp.h>
281+
])
246282

247283
AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
248284
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],

intern.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,13 @@ int rb_proc_exec_n(int, VALUE*, const char*);
424424
int rb_proc_exec(const char*);
425425
VALUE rb_check_argv(int, VALUE*);
426426
int rb_exec(const struct rb_exec_arg*);
427-
int rb_fork(int*, int (*)(void*), void*);
427+
rb_pid_t rb_fork(int*, int (*)(void*), void*);
428428
VALUE rb_f_exec(int,VALUE*);
429-
int rb_waitpid(int,int*,int);
430-
void rb_syswait(int);
431-
int rb_spawn(int, VALUE*);
429+
rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
430+
void rb_syswait(rb_pid_t pid);
431+
rb_pid_t rb_spawn(int, VALUE*);
432432
VALUE rb_proc_times(VALUE);
433-
VALUE rb_detach_process(int);
433+
VALUE rb_detach_process(pid_t pid);
434434
/* range.c */
435435
VALUE rb_range_new(VALUE, VALUE, int);
436436
VALUE rb_range_beg_len(VALUE, long*, long*, long, int);

0 commit comments

Comments
 (0)