summaryrefslogtreecommitdiff
path: root/lib/libpthread/pthread_getcpuclockid.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2016-04-23 23:12:19 +0000
committerchristos <christos@NetBSD.org>2016-04-23 23:12:19 +0000
commitefd306a06493648a5dc9e51fca0f393e09b2091e (patch)
tree060fea86b899e6c06a6b1b93054bd6409664e9ea /lib/libpthread/pthread_getcpuclockid.c
parentf728cc078dce6712f5460cc3482a40a770c1d462 (diff)
Add pthread_getcpuclockid(3)
Diffstat (limited to 'lib/libpthread/pthread_getcpuclockid.c')
-rw-r--r--lib/libpthread/pthread_getcpuclockid.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/libpthread/pthread_getcpuclockid.c b/lib/libpthread/pthread_getcpuclockid.c
new file mode 100644
index 00000000000..38d37222139
--- /dev/null
+++ b/lib/libpthread/pthread_getcpuclockid.c
@@ -0,0 +1,46 @@
+/* $NetBSD: pthread_getcpuclockid.c,v 1.1 2016/04/23 23:12:19 christos Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: pthread_getcpuclockid.c,v 1.1 2016/04/23 23:12:19 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <time.h>
+
+#include "pthread_int.h"
+
+int
+pthread_getcpuclockid(pthread_t thread, clockid_t *clock_id)
+{
+ return clock_getcpuclockid2(P_LWPID, (id_t)thread->pt_lid, clock_id);
+}