ruby-changes:35315
From: akr <ko1@a...>
Date: Fri, 5 Sep 2014 12:43:40 +0900 (JST)
Subject: [ruby-changes:35315] akr:r47397 (trunk): * configure.in: Check sys/id.h, getuidx and getgidx for AIX.
akr 2014-09-05 12:43:28 +0900 (Fri, 05 Sep 2014) New Revision: 47397 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47397 Log: * configure.in: Check sys/id.h, getuidx and getgidx for AIX. * process.c (getresuid): Defined for AIX. (getresgid): Ditto AIX don't have getresuid/getresgid but getuidx/getgidx. Modified files: trunk/ChangeLog trunk/configure.in trunk/process.c Index: configure.in =================================================================== --- configure.in (revision 47396) +++ configure.in (revision 47397) @@ -1143,7 +1143,8 @@ AC_CHECK_HEADERS( \ https://github.com/ruby/ruby/blob/trunk/configure.in#L1143 malloc.h \ malloc_np.h \ malloc/malloc.h \ - setjmpex.h + setjmpex.h \ + sys/id.h ) AC_ARG_WITH([gmp], @@ -1991,6 +1992,7 @@ AC_CHECK_FUNCS(fsync) https://github.com/ruby/ruby/blob/trunk/configure.in#L1992 AC_CHECK_FUNCS(ftruncate) AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform AC_CHECK_FUNCS(getcwd) +AC_CHECK_FUNCS(getgidx) AC_CHECK_FUNCS(getgrnam_r) AC_CHECK_FUNCS(getgroups) AC_CHECK_FUNCS(getpgid) @@ -2002,6 +2004,7 @@ AC_CHECK_FUNCS(getresuid) https://github.com/ruby/ruby/blob/trunk/configure.in#L2004 AC_CHECK_FUNCS(getrlimit) AC_CHECK_FUNCS(getsid) AC_CHECK_FUNCS(gettimeofday) # for making ac_cv_func_gettimeofday +AC_CHECK_FUNCS(getuidx) AC_CHECK_FUNCS(gmtime_r) AC_CHECK_FUNCS(initgroups) AC_CHECK_FUNCS(ioctl) Index: ChangeLog =================================================================== --- ChangeLog (revision 47396) +++ ChangeLog (revision 47397) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Sep 5 12:40:55 2014 Tanaka Akira <akr@f...> + + * configure.in: Check sys/id.h, getuidx and getgidx for AIX. + + * process.c (getresuid): Defined for AIX. + (getresgid): Ditto + AIX don't have getresuid/getresgid but getuidx/getgidx. + Fri Sep 5 12:28:21 2014 Tanaka Akira <akr@f...> * process.c (has_privilege): Fix assignements. Index: process.c =================================================================== --- process.c (revision 47396) +++ process.c (revision 47397) @@ -84,6 +84,9 @@ https://github.com/ruby/ruby/blob/trunk/process.c#L84 #ifdef HAVE_GRP_H #include <grp.h> #endif +#ifdef HAVE_SYS_ID_H +#include <sys/id.h> +#endif #ifdef __APPLE__ # include <mach/mach_time.h> @@ -3277,6 +3280,42 @@ recv_child_error(int fd, int *errp, char https://github.com/ruby/ruby/blob/trunk/process.c#L3280 return size != 0; } +#if !defined(HAVE_GETRESUID) && defined(HAVE_GETUIDX) +/* AIX 7.1 */ +static int +getresuid(rb_uid_t *ruid, rb_uid_t *euid, rb_uid_t *suid) +{ + rb_uid_t ret; + + *ruid = getuid(); + *euid = geteuid(); + ret = getuidx(ID_SAVED); + if (ret == (rb_uid_t)-1) + return -1; + *suid = ret; + return 0; +} +#define HAVE_GETRESUID +#endif + +#if !defined(HAVE_GETRESGID) && defined(HAVE_GETGIDX) +/* AIX 7.1 */ +static int +getresgid(rb_gid_t *rgid, rb_gid_t *egid, rb_gid_t *sgid) +{ + rb_gid_t ret; + + *rgid = getgid(); + *egid = getegid(); + ret = getgidx(ID_SAVED); + if (ret == (rb_gid_t)-1) + return -1; + *sgid = ret; + return 0; +} +#define HAVE_GETRESGID +#endif + static int has_privilege(void) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/