1*7b36c281Sguenther /* $OpenBSD: clock_getcpuclockid.c,v 1.1 2013/06/17 19:11:54 guenther Exp $ */
2*7b36c281Sguenther /*
3*7b36c281Sguenther * Copyright (c) 2013 Philip Guenther <guenther@openbsd.org>
4*7b36c281Sguenther * All Rights Reserved.
5*7b36c281Sguenther *
6*7b36c281Sguenther * Permission to use, copy, modify, and distribute this software for any
7*7b36c281Sguenther * purpose with or without fee is hereby granted, provided that the above
8*7b36c281Sguenther * copyright notice and this permission notice appear in all copies.
9*7b36c281Sguenther *
10*7b36c281Sguenther * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11*7b36c281Sguenther * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12*7b36c281Sguenther * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13*7b36c281Sguenther * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14*7b36c281Sguenther * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15*7b36c281Sguenther * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16*7b36c281Sguenther * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*7b36c281Sguenther */
18*7b36c281Sguenther
19*7b36c281Sguenther #include <time.h>
20*7b36c281Sguenther #include <unistd.h>
21*7b36c281Sguenther #include <errno.h>
22*7b36c281Sguenther
23*7b36c281Sguenther int
clock_getcpuclockid(pid_t pid,clockid_t * clock_id)24*7b36c281Sguenther clock_getcpuclockid(pid_t pid, clockid_t *clock_id)
25*7b36c281Sguenther {
26*7b36c281Sguenther if (pid != 0 && pid != getpid())
27*7b36c281Sguenther return (EPERM);
28*7b36c281Sguenther
29*7b36c281Sguenther *clock_id = CLOCK_PROCESS_CPUTIME_ID;
30*7b36c281Sguenther return (0);
31*7b36c281Sguenther }
32