aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-02-20 13:20:32 +0100
committerDJ Delorie <dj@redhat.com>2020-12-04 17:15:44 -0500
commitfa78feca47fdc226b46e7f6fea4c08c10fccd182 (patch)
tree9f6d87a83d586c1c7ea5fdb3962702792b14fac1 /sysdeps
parentfd5b9b4458ef662d1955459e22a11b15d16a5648 (diff)
downloadglibc-fa78feca47fdc226b46e7f6fea4c08c10fccd182.zip
glibc-fa78feca47fdc226b46e7f6fea4c08c10fccd182.tar.gz
glibc-fa78feca47fdc226b46e7f6fea4c08c10fccd182.tar.bz2
nss: Implement <nss_database.h>
This code manages the mappings of the available databases in NSS (i.e. passwd, hosts, netgroup, etc) with the actions that should be taken to do a query on those databases. This is the main API between query functions scattered throughout glibc and the underlying code (actions, modules, etc). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/fork.c8
-rw-r--r--sysdeps/nptl/fork.c9
2 files changed, 17 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
index 3767fd9..f296310 100644
--- a/sysdeps/mach/hurd/fork.c
+++ b/sysdeps/mach/hurd/fork.c
@@ -28,6 +28,7 @@
#include "hurdmalloc.h" /* XXX */
#include <tls.h>
#include <malloc/malloc-internal.h>
+#include <nss/nss_database.h>
#undef __fork
@@ -68,6 +69,7 @@ __fork (void)
size_t i;
error_t err;
struct hurd_sigstate *volatile ss;
+ struct nss_database_data nss_database_data;
RUN_HOOK (_hurd_atfork_prepare_hook, ());
@@ -109,6 +111,9 @@ __fork (void)
/* Run things that prepare for forking before we create the task. */
RUN_HOOK (_hurd_fork_prepare_hook, ());
+ call_function_static_weak (__nss_database_fork_prepare_parent,
+ &nss_database_data);
+
/* Lock things that want to be locked before we fork. */
{
void *const *p;
@@ -666,6 +671,9 @@ __fork (void)
_hurd_malloc_fork_child ();
call_function_static_weak (__malloc_fork_unlock_child);
+ call_function_static_weak (__nss_database_fork_subprocess,
+ &nss_database_data);
+
/* Run things that want to run in the child task to set up. */
RUN_HOOK (_hurd_fork_child_hook, ());
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index 5091a00..964eb1e 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -32,6 +32,7 @@
#include <arch-fork.h>
#include <futex-internal.h>
#include <malloc/malloc-internal.h>
+#include <nss/nss_database.h>
static void
fresetlockfiles (void)
@@ -57,6 +58,8 @@ __libc_fork (void)
__run_fork_handlers (atfork_run_prepare, multiple_threads);
+ struct nss_database_data nss_database_data;
+
/* If we are not running multiple threads, we do not have to
preserve lock state. If fork runs from a signal handler, only
async-signal-safe functions can be used in the child. These data
@@ -64,6 +67,9 @@ __libc_fork (void)
not matter if fork was called from a signal handler. */
if (multiple_threads)
{
+ call_function_static_weak (__nss_database_fork_prepare_parent,
+ &nss_database_data);
+
_IO_list_lock ();
/* Acquire malloc locks. This needs to come last because fork
@@ -118,6 +124,9 @@ __libc_fork (void)
/* Reset locks in the I/O code. */
_IO_list_resetlock ();
+
+ call_function_static_weak (__nss_database_fork_subprocess,
+ &nss_database_data);
}
/* Reset the lock the dynamic loader uses to protect its data. */