15e53a4f9SPedro F. Giffuni /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
35e53a4f9SPedro F. Giffuni *
49939a136SDavid Xu * Copyright (c) 2008 David Xu <davidxu@freebsd.org>
59939a136SDavid Xu * All rights reserved.
69939a136SDavid Xu *
79939a136SDavid Xu * Redistribution and use in source and binary forms, with or without
89939a136SDavid Xu * modification, are permitted provided that the following conditions
99939a136SDavid Xu * are met:
109939a136SDavid Xu * 1. Redistributions of source code must retain the above copyright
119939a136SDavid Xu * notice, this list of conditions and the following disclaimer.
129939a136SDavid Xu * 2. Redistributions in binary form must reproduce the above copyright
139939a136SDavid Xu * notice, this list of conditions and the following disclaimer in the
149939a136SDavid Xu * documentation and/or other materials provided with the distribution.
159939a136SDavid Xu *
169939a136SDavid Xu * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
179939a136SDavid Xu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189939a136SDavid Xu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199939a136SDavid Xu * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
209939a136SDavid Xu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219939a136SDavid Xu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229939a136SDavid Xu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239939a136SDavid Xu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249939a136SDavid Xu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259939a136SDavid Xu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269939a136SDavid Xu * SUCH DAMAGE.
279939a136SDavid Xu */
289939a136SDavid Xu
299939a136SDavid Xu #include "namespace.h"
309939a136SDavid Xu #include <errno.h>
319939a136SDavid Xu #include <pthread.h>
329939a136SDavid Xu #include <sys/time.h>
339939a136SDavid Xu #include "un-namespace.h"
349939a136SDavid Xu
359939a136SDavid Xu #include "thr_private.h"
369939a136SDavid Xu
379939a136SDavid Xu __weak_reference(_pthread_getcpuclockid, pthread_getcpuclockid);
389939a136SDavid Xu
399939a136SDavid Xu int
_pthread_getcpuclockid(pthread_t pthread,clockid_t * clock_id)409939a136SDavid Xu _pthread_getcpuclockid(pthread_t pthread, clockid_t *clock_id)
419939a136SDavid Xu {
42d65f1abcSDavid Xu
439939a136SDavid Xu if (pthread == NULL)
449939a136SDavid Xu return (EINVAL);
459939a136SDavid Xu
46d65f1abcSDavid Xu if (clock_getcpuclockid2(TID(pthread), CPUCLOCK_WHICH_TID, clock_id))
47d65f1abcSDavid Xu return (errno);
489939a136SDavid Xu return (0);
499939a136SDavid Xu }
50