1d65f1abcSDavid Xu /* 2d65f1abcSDavid Xu * Copyright (c) 2012 David Xu <davidxu@FreeBSD.org>. 3d65f1abcSDavid Xu * All rights reserved. 4d65f1abcSDavid Xu * 5d65f1abcSDavid Xu * Redistribution and use in source and binary forms, with or without 6d65f1abcSDavid Xu * modification, are permitted provided that the following conditions 7d65f1abcSDavid Xu * are met: 8d65f1abcSDavid Xu * 1. Redistributions of source code must retain the above copyright 9d65f1abcSDavid Xu * notice, this list of conditions and the following disclaimer. 10d65f1abcSDavid Xu * 2. Redistributions in binary form must reproduce the above copyright 11d65f1abcSDavid Xu * notice, this list of conditions and the following disclaimer in the 12d65f1abcSDavid Xu * documentation and/or other materials provided with the distribution. 13d65f1abcSDavid Xu * 14d65f1abcSDavid Xu * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' 15d65f1abcSDavid Xu * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16d65f1abcSDavid Xu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17d65f1abcSDavid Xu * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18d65f1abcSDavid Xu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19d65f1abcSDavid Xu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20d65f1abcSDavid Xu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21d65f1abcSDavid Xu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22d65f1abcSDavid Xu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23d65f1abcSDavid Xu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24d65f1abcSDavid Xu * SUCH DAMAGE. 25d65f1abcSDavid Xu */ 26d65f1abcSDavid Xu 27d65f1abcSDavid Xu #include <sys/cdefs.h> 28d65f1abcSDavid Xu __FBSDID("$FreeBSD$"); 29d65f1abcSDavid Xu 30d65f1abcSDavid Xu #include <errno.h> 31d65f1abcSDavid Xu #include <time.h> 32d65f1abcSDavid Xu #include <unistd.h> 33d65f1abcSDavid Xu #include <sys/time.h> 34d65f1abcSDavid Xu 35*cdfe9026SDavid Xu int 36d65f1abcSDavid Xu clock_getcpuclockid(pid_t pid, clockid_t *clock_id) 37d65f1abcSDavid Xu { 38*cdfe9026SDavid Xu if (clock_getcpuclockid2(pid, CPUCLOCK_WHICH_PID, clock_id)) 39*cdfe9026SDavid Xu return (errno); 40*cdfe9026SDavid Xu return (0); 41d65f1abcSDavid Xu } 42