diff options
author | Markus Duft <mduft@gentoo.org> | 2011-09-08 13:09:27 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-10-01 19:17:26 +0200 |
commit | 07498748d2808e47e4a513f190d74b86c14aa54c (patch) | |
tree | 225b21a135e9dc3fa56b0c86943254031836bee5 /src | |
parent | 7289f125886db5e900eed52a62e89de8f802863a (diff) | |
download | coreutils-07498748d2808e47e4a513f190d74b86c14aa54c.tar.xz |
build: use getgr*_nomembers functions on Interix
Interix provides faster replacements for getgr{gid,nam,ent} where
group member information is not fetched from domain controllers.
This makes 'id' usable on domain controlled interix boxes.
* m4/jm-macros.m4: Check for _nomembers functions.
* src/system.h: Redefine function to _nomembers when available.
Diffstat (limited to 'src')
-rw-r--r-- | src/system.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/system.h b/src/system.h index ec64cd0d8..18ac0cc9f 100644 --- a/src/system.h +++ b/src/system.h @@ -213,6 +213,24 @@ struct passwd *getpwuid (); struct group *getgrgid (); #endif +/* Interix has replacements for getgr{gid,nam,ent}, that don't + query the domain controller for group members when not required. + This speeds up the calls tremendously (<1 ms vs. >3 s). */ +/* To protect any system that could provide _nomembers functions + other than interix, check for HAVE_SETGROUPS, as interix is + one of the very few (the only?) platform that lacks it */ +#if ! HAVE_SETGROUPS +# if HAVE_GETGRGID_NOMEMBERS +# define getgrgid(gid) getgrgid_nomembers(gid) +# endif +# if HAVE_GETGRNAM_NOMEMBERS +# define getgrnam(nam) getgrnam_nomembers(nam) +# endif +# if HAVE_GETGRENT_NOMEMBERS +# define getgrent() getgrent_nomembers() +# endif +#endif + #if !HAVE_DECL_GETUID uid_t getuid (); #endif |