Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 2000 13:36:21 -0800 (PST)
From:      jonathan@graehl.org
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/23304: POSIX clock_gettime, clock_getres return errno invalid argument for CLOCK_PROF and CLOCK_VIRTUAL
Message-ID:  <200012052136.eB5LaL936493@freefall.freebsd.org>
Resent-Message-ID: <200012052140.eB5Le5236971@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         23304
>Category:       kern
>Synopsis:       POSIX clock_gettime, clock_getres return errno invalid argument for CLOCK_PROF and CLOCK_VIRTUAL
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 05 13:40:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Graehl
>Release:        4.2-STABLE
>Organization:
>Environment:
FreeBSD 3jane 4.2-STABLE FreeBSD 4.2-STABLE #0: Sat Dec  2 14:46:10 PST 2000     root@3jane:/ext/obj/usr/src/sys/NEWJANE  i386
>Description:
While there is no problem with CLOCK_REALTIME, POSIX clock_gettime, clock_getres return errno invalid argument for CLOCK_PROF and CLOCK_VIRTUAL, which are documented in the man pages (section 2) as being user+system and user time, respectively.
>How-To-Repeat:
/* demonstrates that the clock_get... calls succed for CLOCK_REALTIME but fail for CLOCK_PROF and CLOCK_VIRTUAL */
#include <sys/time.h>
#include <stdio.h>

int main() {
  struct timespec t;

  puts("CLOCK_PROF");
  if (clock_gettime(CLOCK_PROF, &t))
    perror(NULL);
  if (clock_getres(CLOCK_PROF, &t))
    perror(NULL);

  puts("\nCLOCK_VIRTUAL");
  if (clock_gettime(CLOCK_VIRTUAL, &t))
    perror(NULL);
  if (clock_getres(CLOCK_VIRTUAL, &t))
    perror(NULL);

  puts("\nCLOCK_REALTIME");
  if (clock_gettime(CLOCK_REALTIME, &t))
    perror(NULL);
  if (clock_getres(CLOCK_REALTIME, &t))
    perror(NULL);
}
>Fix:
Immediate fix: remove mention of CLOCK_VIRTUAL AND CLOCK_PROF from sys/time.h and man 2 clock_gettime

Real fix: implement the documented POSIX functionality

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012052136.eB5LaL936493>