Back to index

glibc  2.9
Defines | Functions
dl-osinfo.h File Reference
#include <kernel-features.h>
#include <dl-sysdep.h>
#include <fcntl.h>
#include <stdint.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MIN(a, b)   (((a)<(b))?(a):(b))
#define DL_SYSDEP_OSCHECK(FATAL)

Functions

static uintptr_t __attribute__ ((always_inline)) _dl_setup_stack_chk_guard(void)

Define Documentation

#define DL_SYSDEP_OSCHECK (   FATAL)
Value:
do {                                                                 \
    /* Test whether the kernel is new enough.  This test is only performed    \
       if the library is not compiled to run on all kernels.  */            \
                                                                     \
    int version = _dl_discover_osversion ();                                \
    if (__builtin_expect (version >= 0, 1))                                 \
      {                                                                     \
       if (__builtin_expect (GLRO(dl_osversion) == 0, 1)                    \
           || GLRO(dl_osversion) > version)                                 \
         GLRO(dl_osversion) = version;                                      \
                                                                     \
       /* Now we can test with the required version.  */                    \
       if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION)   \
         /* Not sufficent.  */                                              \
         FATAL ("FATAL: kernel too old\n");                                 \
      }                                                                     \
    else if (__LINUX_KERNEL_VERSION > 0)                             \
      FATAL ("FATAL: cannot determine kernel version\n");                   \
  } while (0)

Definition at line 41 of file dl-osinfo.h.

#define MIN (   a,
  b 
)    (((a)<(b))?(a):(b))

Definition at line 26 of file dl-osinfo.h.


Function Documentation

static uintptr_t __attribute__ ( (always_inline)  ) [inline, static]

Definition at line 61 of file dl-osinfo.h.

{
  uintptr_t ret;
#ifdef ENABLE_STACKGUARD_RANDOMIZE
  int fd = __open ("/dev/urandom", O_RDONLY);
  if (fd >= 0)
    {
      ssize_t reslen = __read (fd, &ret, sizeof (ret));
      __close (fd);
      if (reslen == (ssize_t) sizeof (ret))
       return ret;
    }
#endif
  ret = 0;
  unsigned char *p = (unsigned char *) &ret;
  p[sizeof (ret) - 1] = 255;
  p[sizeof (ret) - 2] = '\n';
  return ret;

Here is the call graph for this function: