]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nscd/nscd-client.h
Use a doubly-linked list for _IO_list_all (bug 27777)
[thirdparty/glibc.git] / nscd / nscd-client.h
index ee16df60835eabe5ed2ab94b4890b9f3a9b02782..3ec350e80f8b03badd1a302c5a9a7d197289c186 100644 (file)
@@ -1,6 +1,5 @@
-/* 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
@@ -14,7 +13,7 @@
 
    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.  */
@@ -24,6 +23,8 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <string.h>
+#include <time.h>
 #include <sys/types.h>
 #include <atomic.h>
 #include <nscd-types.h>
@@ -376,7 +377,7 @@ __nscd_acquire_maplock (volatile struct locked_map_ptr *mapptr)
       if (__glibc_unlikely (++cnt > 5))
        return false;
 
-      atomic_delay ();
+      atomic_spin_nop ();
     }
 
   return true;
@@ -388,7 +389,7 @@ extern int __nscd_open_socket (const char *key, size_t keylen,
                               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,
@@ -398,10 +399,12 @@ extern struct mapped_database *__nscd_get_mapping (request_type type,
 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
@@ -418,7 +421,7 @@ __nscd_drop_map_ref (struct mapped_database *map, int *gc_cycle)
          return -1;
        }
 
-      if (atomic_decrement_val (&map->counter) == 0)
+      if (atomic_fetch_add_relaxed (&map->counter, -1) == 1)
        __nscd_unmap (map);
     }
 
@@ -431,7 +434,8 @@ extern struct datahead *__nscd_cache_search (request_type type,
                                             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.  */
@@ -441,10 +445,9 @@ extern ssize_t __readvall (int fd, const struct iovec *iov, int iovcnt)
   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 */