| Summary: | times(NULL) function returns negative value | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Christophe Boccheciampe <cb> |
| Component: | [OLD] Library | Assignee: | Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel> |
| Status: | RESOLVED INVALID | ||
| Severity: | major | CC: | vapier |
| Priority: | High | ||
| Version: | 2006.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
glibc doesnt implement times() ... it merely calls the kernel but really i dont see this as a bug if we review the specs on the function: http://www.opengroup.org/onlinepubs/009695399/functions/times.html the return value has these characteristics: - completely arbitrary - success can be any value at all except for -1 - return value may be overflowed as long as the result isnt -1 |
This simple program should return a positive value ----------------------- #include <sys/times.h> #include <iostream> main() { std::cout << times(NULL) << std::endl; } ----------------------- Instead I get something like "-2142386810" as a result. These values freeze some applications like Oracle-10.2.0. Some details : Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2, 2.6.14.3 i686) ================================================================= System uname: 2.6.14.3 i686 AMD Opteron(tm) Processor 852 Gentoo Base System version 1.6.14 - 4 CPU (AMD Opteron 852 - 2.6GHz) - 16 GB RAM - Uptime : about 50 days - all updates done - no masked packages installed I had to reboot very quickly since it is our main students server. times(NULL) now returns a positive value (until ... ?). Tell me if more details needed.