Implementation status: to be implemented

Synopsis

#include <time.h>

int clock_getcpuclockid(pid_t pid, clockid_t *clock_id);

Description

The clock_getcpuclockid() function returns the clock ID of the CPU-time clock of the process specified by pid. If the process described by pid exists and the calling process has permission, the clock ID of this clock shall be returned in clock_id.

Arguments:
pid - the ID of the process of interest,
clock_id - (output value) the CPU-time clock ID of the process making the call.

If pid is zero, the function returns the clock ID of the CPU-time clock of the process making the call, in clock_id.

Return value

0 on success, error number otherwise.

Errors

[EPERM] - the requesting process does not have permission to access the CPU-time clock for the process.
[ESRCH] - no process can be found corresponding to the process specified by pid.

Implementation tasks

  • Define the conditions under which one process has permission to obtain the CPU-time clock ID of other processes.
  • Implement the function.