Back to index

glibc  2.9
timer_getoverr.c
Go to the documentation of this file.
00001 /* Copyright (C) 2003 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public License as
00007    published by the Free Software Foundation; either version 2.1 of the
00008    License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00017    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.  */
00019 
00020 #include <errno.h>
00021 #include <time.h>
00022 #include <sysdep.h>
00023 #include <kernel-features.h>
00024 #include "kernel-posix-timers.h"
00025 
00026 
00027 #ifdef __NR_timer_getoverrun
00028 # ifndef __ASSUME_POSIX_TIMERS
00029 static int compat_timer_getoverrun (timer_t timerid);
00030 #  define timer_getoverrun static compat_timer_getoverrun
00031 #  include <nptl/sysdeps/pthread/timer_getoverr.c>
00032 #  undef timer_getoverrun
00033 # endif
00034 
00035 # ifdef timer_getoverrun_alias
00036 #  define timer_getoverrun timer_getoverrun_alias
00037 # endif
00038 
00039 
00040 int
00041 timer_getoverrun (timerid)
00042      timer_t timerid;
00043 {
00044 # undef timer_getoverrun
00045 # ifndef __ASSUME_POSIX_TIMERS
00046   if (__no_posix_timers >= 0)
00047 # endif
00048     {
00049       struct timer *kt = (struct timer *) timerid;
00050 
00051       /* Get the information from the kernel.  */
00052       int res = INLINE_SYSCALL (timer_getoverrun, 1, kt->ktimerid);
00053 
00054 # ifndef __ASSUME_POSIX_TIMERS
00055       if (res != -1 || errno != ENOSYS)
00056        {
00057          /* We know the syscall support is available.  */
00058          __no_posix_timers = 1;
00059 # endif
00060          return res;
00061 # ifndef __ASSUME_POSIX_TIMERS
00062        }
00063 # endif
00064 
00065 # ifndef __ASSUME_POSIX_TIMERS
00066       __no_posix_timers = -1;
00067 # endif
00068     }
00069 
00070 # ifndef __ASSUME_POSIX_TIMERS
00071   return compat_timer_getoverrun (timerid);
00072 # endif
00073 }
00074 #else
00075 # ifdef timer_getoverrun_alias
00076 #  define timer_getoverrun timer_getoverrun_alias
00077 # endif
00078 /* The new system calls are not available.  Use the userlevel
00079    implementation.  */
00080 # include <nptl/sysdeps/pthread/timer_getoverr.c>
00081 #endif