Back to index

glibc  2.9
Functions | Variables
has_cpuclock.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <not-cancel.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


static int has_cpuclock (void)


static int itc_usable

Function Documentation

static int has_cpuclock ( void  ) [static]

Definition at line 29 of file has_cpuclock.c.

  if (__builtin_expect (itc_usable == 0, 0))
      int newval = 1;
      int fd = open_not_cancel_2 ("/proc/sal/itc_drift", O_RDONLY);
      if (__builtin_expect (fd != -1, 1))
         char buf[16];
         /* We expect the file to contain a single digit followed by
            a newline.  If the format changes we better not rely on
            the file content.  */
         if (read_not_cancel (fd, buf, sizeof buf) != 2
             || buf[0] != '0' || buf[1] != '\n')
           newval = -1;

         close_not_cancel_no_status (fd);

      itc_usable = newval;

  return itc_usable;

Here is the caller graph for this function:

Variable Documentation

int itc_usable [static]

Definition at line 26 of file has_cpuclock.c.