Sorry for the mistake of the previous patch.

If -1 is passed to the argument pid of clock_getcpuclockid(),
the macro MAKE_PROCESS_CPUCLOCK(pid,CPUCLOCK_SCHED) uses it
to make the pidclock to 2, and than passes the number 0x2
to the system call clock_getres().

The posix says that if _POSIX_CPUTIME is defined, implementations
shall support clock ID values obtained by invoking clock_getcpuclockid(),
which represent the CPU-time clock of a given process, implementations
shall also support the special clockid_t value CLOCK_PROCESS_CPUTIME_ID,
which represents the CPU-time clock of the calling process when invoking
one of the clock_*() or timer_*() functions.

So passing -1 as the argument pid represents the special 
CLOCK_PROCESS_CPUTIME_ID.

This patch change -1 to -2 as the argument. Make the test to a normal one, but
not a special used value.

And acctually, the Linux kernel has already supported this special one.

Signed-off-by: Wanlong Gao <[email protected]>
---
 .../interfaces/clock_getcpuclockid/6-1.c           |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/6-1.c
 
b/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/6-1.c
index 380e2a4..0371c41 100644
--- 
a/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/6-1.c
+++ 
b/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/6-1.c
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
 #else
        clockid_t clockid_1;
 
-       if (clock_getcpuclockid(-1, &clockid_1) == 0) {
+       if (clock_getcpuclockid(-2, &clockid_1) == 0) {
                printf("clock_getcpuclockid(-1, ..) failed\n");
                return PTS_UNRESOLVED;
        }
@@ -32,4 +32,4 @@ int main(int argc, char *argv[])
        return PTS_PASS;
 
 #endif
-}
\ No newline at end of file
+}
-- 
1.7.6


------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to