-/* Copyright (c) 1998-2014 Free Software Foundation, Inc.
+/* Copyright (c) 1998-2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/* This file defines everything that client code should need to
know to talk to the nscd daemon. */
#include <stdbool.h>
#include <stdint.h>
+#include <string.h>
+#include <time.h>
#include <sys/types.h>
#include <atomic.h>
#include <nscd-types.h>
if (__glibc_unlikely (++cnt > 5))
return false;
- atomic_delay ();
+ atomic_spin_nop ();
}
return true;
request_type type, void *response,
size_t responselen) attribute_hidden;
-/* Try to get a file descriptor for the shared meory segment
+/* Try to get a file descriptor for the shared memory segment
containing the database. */
extern struct mapped_database *__nscd_get_mapping (request_type type,
const char *key,
extern struct mapped_database *__nscd_get_map_ref (request_type type,
const char *name,
volatile struct locked_map_ptr *mapptr,
- int *gc_cyclep);
+ int *gc_cyclep)
+ attribute_hidden;
/* Unmap database. */
-extern void __nscd_unmap (struct mapped_database *mapped);
+extern void __nscd_unmap (struct mapped_database *mapped)
+ attribute_hidden;
/* Drop reference of mapping. */
static int
return -1;
}
- if (atomic_decrement_val (&map->counter) == 0)
+ if (atomic_fetch_add_relaxed (&map->counter, -1) == 1)
__nscd_unmap (map);
}
const char *key,
size_t keylen,
const struct mapped_database *mapped,
- size_t datalen);
+ size_t datalen)
+ attribute_hidden;
/* Wrappers around read, readv and write that only read/write less than LEN
bytes on error or EOF. */
attribute_hidden;
extern ssize_t writeall (int fd, const void *buf, size_t len)
attribute_hidden;
-extern ssize_t sendfileall (int tofd, int fromfd, off_t off, size_t len)
- attribute_hidden;
/* Get netlink timestamp counter from mapped area or zero. */
-extern uint32_t __nscd_get_nl_timestamp (void);
+extern uint32_t __nscd_get_nl_timestamp (void)
+ attribute_hidden;
#endif /* nscd.h */