xref: /freebsd/lib/libc/gen/clock_getcpuclockid.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
19653e55fSDavid Xu.\" Copyright (c) 2012 David Xu <davidxu@FreeBSD.org>
29653e55fSDavid Xu.\" All rights reserved.
39653e55fSDavid Xu.\"
49653e55fSDavid Xu.\" Redistribution and use in source and binary forms, with or without
59653e55fSDavid Xu.\" modification, are permitted provided that the following conditions
69653e55fSDavid Xu.\" are met:
79653e55fSDavid Xu.\" 1. Redistributions of source code must retain the above copyright
89653e55fSDavid Xu.\"    notice, this list of conditions and the following disclaimer.
99653e55fSDavid Xu.\" 2. Redistributions in binary form must reproduce the above copyright
109653e55fSDavid Xu.\"    notice, this list of conditions and the following disclaimer in the
119653e55fSDavid Xu.\"    documentation and/or other materials provided with the distribution.
129653e55fSDavid Xu.\"
139653e55fSDavid Xu.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
149653e55fSDavid Xu.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
159653e55fSDavid Xu.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
169653e55fSDavid Xu.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
179653e55fSDavid Xu.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
189653e55fSDavid Xu.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199653e55fSDavid Xu.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
209653e55fSDavid Xu.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
219653e55fSDavid Xu.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
229653e55fSDavid Xu.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
239653e55fSDavid Xu.\" SUCH DAMAGE.
249653e55fSDavid Xu.\"
259653e55fSDavid Xu.\" Portions of this text are reprinted and reproduced in electronic form
269653e55fSDavid Xu.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
279653e55fSDavid Xu.\" Portable Operating System Interface (POSIX), The Open Group Base
289653e55fSDavid Xu.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
299653e55fSDavid Xu.\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
309653e55fSDavid Xu.\" event of any discrepancy between this version and the original IEEE and
319653e55fSDavid Xu.\" The Open Group Standard, the original IEEE and The Open Group Standard is
329653e55fSDavid Xu.\" the referee document.  The original Standard can be obtained online at
339653e55fSDavid Xu.\"	http://www.opengroup.org/unix/online.html.
349653e55fSDavid Xu.\"
359653e55fSDavid Xu.Dd August 21, 2012
369653e55fSDavid Xu.Dt CLOCK_GETCPUCLOCKID 3
379653e55fSDavid Xu.Os
389653e55fSDavid Xu.Sh NAME
399653e55fSDavid Xu.Nm clock_getcpuclockid
409653e55fSDavid Xu.Nd access a process CPU-time clock
419653e55fSDavid Xu.Sh LIBRARY
429653e55fSDavid Xu.Lb libc
439653e55fSDavid Xu.Sh SYNOPSIS
449653e55fSDavid Xu.In time.h
459653e55fSDavid Xu.Ft int
469653e55fSDavid Xu.Fn clock_getcpuclockid "pid_t pid" "clockid_t *clock_id"
479653e55fSDavid Xu.Sh DESCRIPTION
489653e55fSDavid XuThe
499653e55fSDavid Xu.Fn clock_getcpuclockid
509653e55fSDavid Xureturns the clock ID of the CPU-time clock of the process specified by
519653e55fSDavid Xu.Fa pid .
529653e55fSDavid XuIf the process described by
539653e55fSDavid Xu.Fa pid
549653e55fSDavid Xuexists and the calling process has permission, the clock ID of this
559653e55fSDavid Xuclock will be returned in
569653e55fSDavid Xu.Fa clock_id .
579653e55fSDavid Xu.Pp
589653e55fSDavid XuIf
599653e55fSDavid Xu.Fa pid
609653e55fSDavid Xuis zero, the
619653e55fSDavid Xu.Fn clock_getcpuclockid
629653e55fSDavid Xufunction returns the clock ID of the CPU-time clock of the process
639653e55fSDavid Xumaking the call, in
649653e55fSDavid Xu.Fa clock_id .
659653e55fSDavid Xu.Sh RETURN VALUES
669653e55fSDavid XuUpon successful completion,
679653e55fSDavid Xu.Fn clock_getcpuclockid
689653e55fSDavid Xureturns zero; otherwise, an error number is returned to indicate the
699653e55fSDavid Xuerror.
709653e55fSDavid Xu.Sh ERRORS
71eb6a4342SSergey KandaurovThe
72eb6a4342SSergey Kandaurov.Fn clock_getcpuclockid
73eb6a4342SSergey Kandaurovfunction will fail if:
749653e55fSDavid Xu.Bl -tag -width Er
759653e55fSDavid Xu.It Bq Er EPERM
769653e55fSDavid XuThe requesting process does not have permission to access the CPU-time
779653e55fSDavid Xuclock for the process.
789653e55fSDavid Xu.It Bq Er ESRCH
799653e55fSDavid XuNo process can be found corresponding to the process specified by
809653e55fSDavid Xu.Fa pid .
819653e55fSDavid Xu.El
829653e55fSDavid Xu.Sh SEE ALSO
839653e55fSDavid Xu.Xr clock_gettime 2
849653e55fSDavid Xu.Sh STANDARDS
859653e55fSDavid XuThe
869653e55fSDavid Xu.Fn clock_getcpuclockid
87*18ac59f4SSergey Kandaurovfunction conforms to
889653e55fSDavid Xu.St -p1003.1-2001 .
899653e55fSDavid Xu.Sh HISTORY
909653e55fSDavid XuThe
919653e55fSDavid Xu.Fn clock_getcpuclockid
929653e55fSDavid Xufunction first appeared in
939653e55fSDavid Xu.Fx 10.0 .
949653e55fSDavid Xu.Sh AUTHORS
958fbf3d50SBaptiste Daroussin.An David Xu Aq Mt davidxu@FreeBSD.org
96