From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10317 invoked by alias); 18 Jan 2007 13:30:20 -0000 Received: (qmail 10205 invoked by uid 48); 18 Jan 2007 13:30:07 -0000 Date: Thu, 18 Jan 2007 13:30:00 -0000 From: "bart dot vanassche at gmail dot com" To: glibc-bugs@sources.redhat.com Message-ID: <20070118133006.3886.bart.vanassche@gmail.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/3886] New: clock_nanosleep() does not return an error when its first argument is out of range X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00058.txt.bz2 According to the clock_nanosleep manpage, clock_nanosleep() should return -1 and set errno to ENOTSUP for clocks that are not supported. When specifying CLOCK_MONOTONIC_HR as the first argument to clock_nanosleep(), it returns 0 instead of -1. System details: $ uname -a Linux sabekorlnx05 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux $ rpm -q glibc glibc-2.5-25 Test program: $ cat clock_gettime.cpp #include #include #define CLOCK_MONOTONIC_HR 5 // see also int main(int /*argc*/, char** /*argv*/) { timespec now; if (clock_gettime(CLOCK_MONOTONIC_HR, &now) >= 0) { std::cout << now.tv_sec << '.' << std::setw(9) << std::setfill('0') << now.tv_nsec << std::endl; } else { perror("clock_gettime"); } { timespec delay; delay.tv_sec = 1; delay.tv_nsec = 0; if (clock_nanosleep(CLOCK_MONOTONIC_HR, 0, &delay, 0) < 0) perror("clock_nanosleep"); } return 0; } // Local variables: // compile-command: "for c in g++ ppc_440-g++; do $c -g -pg -Wall -Wextra -Werror clock_gettime.cpp -o ${c%g++}clock_gettime -lrt; done" // End: -- Summary: clock_nanosleep() does not return an error when its first argument is out of range Product: glibc Version: 2.4 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: bart dot vanassche at gmail dot com CC: glibc-bugs at sources dot redhat dot com GCC build triplet: x86_64-suse-linux-gnu GCC host triplet: x86_64-suse-linux-gnu GCC target triplet: x86_64-suse-linux-gnu http://sourceware.org/bugzilla/show_bug.cgi?id=3886 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.