The majority of grp routines are entry points for nss functionality.
This commit removes the 'grp' subdirectory and moves all nss-relevant
functionality and all tests to 'nss', and the 'setgroups' stub into
'posix' (alongside the 'getgroups' stub). References to grp/ are
accordingly changed. In addition, compat-initgroups.c, a fallback
implementation of initgroups is renamed to initgroups-fallback.c so that
the build system does not confuse it for nss_compat/compat-initgroups.c.
Build time improves very slightly; e.g. down from an average of 45.5s to
44.5s on an 8-thread mobile x86_64 CPU.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
# dependencies and generate sorted-subdirs dynamically.
all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
stdlib stdio-common libio malloc string wcsmbs time dirent \
- grp pwd posix io termios resource misc socket sysvipc gmon \
+ pwd posix io termios resource misc socket sysvipc gmon \
gnulib iconv iconvdata wctype manual shadow gshadow po argp \
localedata timezone rt conform debug mathvec support \
dlfcn elf
+++ /dev/null
-# Copyright (C) 1991-2023 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-
-# The GNU C Library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, see
-# <https://www.gnu.org/licenses/>.
-
-#
-# Sub-makefile for grp portion of the library.
-#
-subdir := grp
-
-include ../Makeconfig
-
-headers := grp.h
-
-routines := fgetgrent initgroups setgroups \
- getgrent getgrgid getgrnam putgrent \
- getgrent_r getgrgid_r getgrnam_r fgetgrent_r \
- grp-merge
-
-tests := testgrp tst-putgrent
-
-tests-container = \
- tst-initgroups1 \
- tst-initgroups2
-
-ifeq (yes,$(build-shared))
-test-srcs := tst_fgetgrent
-ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)tst_fgetgrent.out
-endif
-endif
-
-
-include ../Rules
-
-ifeq ($(have-thread-library),yes)
-
-CFLAGS-getgrgid_r.c += -fexceptions
-CFLAGS-getgrnam_r.c += -fexceptions
-CFLAGS-getgrent_r.c += -fexceptions
-CFLAGS-getgrent.c += -fexceptions
-CFLAGS-fgetgrent.c += -fexceptions
-CFLAGS-fgetgrent_r.c += -fexceptions $(libio-mtsafe)
-CFLAGS-putgrent.c += -fexceptions $(libio-mtsafe)
-CFLAGS-initgroups.c += -fexceptions
-CFLAGS-getgrgid.c += -fexceptions
-
-endif
-
-ifeq ($(run-built-tests),yes)
-# tst_fgetgrent currently only works with shared libraries
-ifeq (yes,$(build-shared))
-$(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
- $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
- $(evaluate-test)
-
-endif
-endif
+++ /dev/null
-libc {
- GLIBC_2.0 {
- # e*
- endgrent;
-
- # f*
- fgetgrent; fgetgrent_r;
-
- # g*
- getgrent; getgrent_r; getgrgid; getgrgid_r; getgrnam; getgrnam_r;
- getgroups;
-
- # i*
- initgroups;
-
- # s*
- setgrent; setgroups;
- }
- GLIBC_2.1 {
- # p*
- putgrent;
- }
- GLIBC_2.1.2 {
- # g*
- getgrent_r; getgrgid_r; getgrnam_r;
- }
- GLIBC_2.2.4 {
- # g*
- getgrouplist;
- }
- GLIBC_PRIVATE {
- __merge_grp; __copy_grp;
- }
-}
#ifndef _GRP_MERGE_H
-#include <grp/grp-merge.h>
+#include <nss/grp-merge.h>
libc_hidden_proto (__copy_grp)
libc_hidden_proto (__merge_grp)
#ifndef _GRP_H
-#include <grp/grp.h>
+#include <nss/grp.h>
#ifndef _ISOMAC
libc_hidden_proto (setgroups)
};
-#include "../grp/compat-initgroups.c"
+#include "../nss/initgroups-fallback.c"
static time_t
include ../Makeconfig
headers := \
+ grp.h \
nss.h \
# headers
valid_list_field \
# routines
+# grp routines:
+routines += \
+ fgetgrent \
+ fgetgrent_r \
+ getgrent \
+ getgrent_r \
+ getgrgid \
+ getgrgid_r \
+ getgrnam \
+ getgrnam_r \
+ grp-merge \
+ initgroups \
+ putgrent \
+ # routines
+
+ifeq ($(have-thread-library),yes)
+CFLAGS-fgetgrent.c += -fexceptions
+CFLAGS-fgetgrent_r.c += -fexceptions $(libio-mtsafe)
+CFLAGS-getgrent.c += -fexceptions
+CFLAGS-getgrent_r.c += -fexceptions
+CFLAGS-getgrgid.c += -fexceptions
+CFLAGS-getgrgid_r.c += -fexceptions
+CFLAGS-getgrnam.c += -fexceptions
+CFLAGS-getgrnam_r.c += -fexceptions
+CFLAGS-initgroups.c += -fexceptions
+CFLAGS-putgrent.c += -fexceptions $(libio-mtsafe)
+endif
+
# These are the databases that go through nss dispatch.
# Caution: if you add a database here, you must add its real name
# in databases.def, too.
bug17079 \
test-digits-dots \
test-netdb \
+ testgrp \
tst-nss-getpwent \
tst-nss-hash \
tst-nss-test1 \
tst-nss-test4 \
tst-nss-test5 \
tst-nss-test_errno \
+ tst-putgrent \
# tests
xtests = bug-erange
tests-container := \
+ tst-initgroups1 \
+ tst-initgroups2 \
tst-nss-compat1 \
tst-nss-db-endgrent \
tst-nss-db-endpwent \
tst-reload2 \
# tests-container
-# Tests which need libdl
ifeq (yes,$(build-shared))
+# Tests which need libdl
tests += tst-nss-files-hosts-erange
tests += tst-nss-files-hosts-multi
tests += tst-nss-files-hosts-getent
tests += tst-nss-files-alias-leak
tests += tst-nss-files-alias-truncated
+# tst_fgetgrent currently only works with shared libraries
+test-srcs := tst_fgetgrent
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)tst_fgetgrent.out
+$(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
+ $(evaluate-test)
+endif
endif
# If we have a thread library then we can test cancellation against
# Functions exported as no-op compat symbols.
__nss_passwd_lookup; __nss_group_lookup; __nss_hosts_lookup; __nss_next;
__nss_database_lookup;
+
+ # e*
+ endgrent;
+
+ # f*
+ fgetgrent; fgetgrent_r;
+
+ # g*
+ getgrent; getgrent_r; getgrgid; getgrgid_r; getgrnam; getgrnam_r;
+ getgroups;
+
+ # i*
+ initgroups;
+
+ # s*
+ setgrent;
+ }
+ GLIBC_2.1 {
+ # p*
+ putgrent;
+ }
+ GLIBC_2.1.2 {
+ # g*
+ getgrent_r; getgrgid_r; getgrnam_r;
}
GLIBC_2.2.2 {
__nss_hostname_digits_dots;
}
+ GLIBC_2.2.4 {
+ # g*
+ getgrouplist;
+ }
GLIBC_2.27 {
}
GLIBC_PRIVATE {
_nss_files_initgroups_dyn;
_nss_files_init;
+
+ __merge_grp; __copy_grp;
}
}
static bool use_initgroups_entry;
-#include "compat-initgroups.c"
+#include "initgroups-fallback.c"
static int
common_objpfx=$1; shift
test_program_prefix=$1; shift
-testout=${common_objpfx}/grp/tst_fgetgrent.out
+testout=${common_objpfx}/nss/tst_fgetgrent.out
result=0
${test_program_prefix} \
-${common_objpfx}grp/tst_fgetgrent 0 > ${testout} || result=1
+${common_objpfx}nss/tst_fgetgrent 0 > ${testout} || result=1
${test_program_prefix} \
-${common_objpfx}grp/tst_fgetgrent 1 >> ${testout} || result=1
+${common_objpfx}nss/tst_fgetgrent 1 >> ${testout} || result=1
${test_program_prefix} \
-${common_objpfx}grp/tst_fgetgrent 2 >> ${testout} || result=1
+${common_objpfx}nss/tst_fgetgrent 2 >> ${testout} || result=1
${test_program_prefix} \
-${common_objpfx}grp/tst_fgetgrent 3 >> ${testout} || result=1
+${common_objpfx}nss/tst_fgetgrent 3 >> ${testout} || result=1
exit $result
sched_sets \
sched_yield \
setgid \
+ setgroups \
setpgid \
setpgrp \
setresgid \
sched_get_priority_max; sched_get_priority_min; sched_getparam;
sched_getscheduler; sched_rr_get_interval; sched_setparam;
sched_setscheduler; sched_yield; setegid; seteuid; setgid;
- setpgid; setpgrp; setsid; setuid; sleep; sysconf;
+ setgroups; setpgid; setpgrp; setsid; setuid; sleep; sysconf;
# t*
times;
"$update_script" "$f"
fi
;;
- grp/initgroups.c | misc/bits/stab.def | posix/regex.h \
+ nss/initgroups.c | misc/bits/stab.def | posix/regex.h \
| sysdeps/wordsize-32/divdi3.c)
# Pre-1991 gaps in copyright years, so cannot use a single range.
UPDATE_COPYRIGHT_USE_INTERVALS=1 "$update_script" "$f"