Back to index

glibc  2.9
nscd_setup_thread.c File Reference
#include <string.h>
#include <unistd.h>
#include <nscd.h>
#include <sysdep.h>

Go to the source code of this file.


int setup_thread (struct database_dyn *db)

Function Documentation

int setup_thread ( struct database_dyn db)

Definition at line 27 of file nscd_setup_thread.c.

#ifdef __NR_set_tid_address
  /* Only supported when NPTL is used.  */
  char buf[100];
  if (confstr (_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof (buf)) >= sizeof (buf)
      || strncmp (buf, "NPTL", 4) != 0)
    return 0;

  /* Do not try this at home, kids.  We play with the SETTID address
     even thought the process is multi-threaded.  This can only work
     since none of the threads ever terminates.  */
  int r = INTERNAL_SYSCALL (set_tid_address, err, 1,
    /* We know the kernel can reset this field when nscd terminates.
       So, set the field to a nonzero value which indicates that nscd
       is certainly running and clients can skip the test.  */
    return db->head->nscd_certainly_running = 1;

  return 0;

Here is the call graph for this function:

Here is the caller graph for this function: