diff options
author | 2014-08-31 04:02:08 +0000 | |
---|---|---|
committer | 2014-08-31 04:02:08 +0000 | |
commit | cbcba4176ab35af399f980fc4b1a0e62b454d8dc (patch) | |
tree | 2ddecd8d887051451dc64f1ae342c0baf246535e | |
parent | Add sockatmark() (diff) | |
download | wireguard-openbsd-cbcba4176ab35af399f980fc4b1a0e62b454d8dc.tar.xz wireguard-openbsd-cbcba4176ab35af399f980fc4b1a0e62b454d8dc.zip |
Declare and document getthrid()
indirectly prodded by krw@
-rw-r--r-- | include/unistd.h | 3 | ||||
-rw-r--r-- | lib/libc/sys/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/sys/getthrid.2 | 80 | ||||
-rw-r--r-- | lib/librthread/rthread.h | 3 |
4 files changed, 85 insertions, 5 deletions
diff --git a/include/unistd.h b/include/unistd.h index a86998768e0..0d7fd3abb7e 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.90 2014/08/31 01:42:36 guenther Exp $ */ +/* $OpenBSD: unistd.h,v 1.91 2014/08/31 04:02:08 guenther Exp $ */ /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ /*- @@ -504,6 +504,7 @@ int getgrouplist(const char *, gid_t, gid_t *, int *); mode_t getmode(const void *, mode_t); int getresgid(gid_t *, gid_t *, gid_t *); int getresuid(uid_t *, uid_t *, uid_t *); +pid_t getthrid(void); char *getusershell(void); int initgroups(const char *, gid_t); int iruserok(u_int32_t, int, const char *, const char *); diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 0fbb0bda402..78535b041fa 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.121 2014/08/31 01:42:36 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.122 2014/08/31 04:02:08 guenther Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -205,7 +205,7 @@ MAN+= __get_tcb.2 __thrsigdivert.2 __thrsleep.2 _exit.2 accept.2 \ getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \ getpeername.2 getpgrp.2 getpid.2 getpriority.2 getrlimit.2 \ getrtable.2 getrusage.2 getsid.2 getsockname.2 getsockopt.2 \ - gettimeofday.2 getuid.2 intro.2 ioctl.2 issetugid.2 \ + getthrid.2 gettimeofday.2 getuid.2 intro.2 ioctl.2 issetugid.2 \ kill.2 kqueue.2 ktrace.2 link.2 listen.2 lseek.2 madvise.2 \ mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 \ mlockall.2 mmap.2 mount.2 mprotect.2 mquery.2 msgctl.2 \ diff --git a/lib/libc/sys/getthrid.2 b/lib/libc/sys/getthrid.2 new file mode 100644 index 00000000000..d92180f82a8 --- /dev/null +++ b/lib/libc/sys/getthrid.2 @@ -0,0 +1,80 @@ +.\" $OpenBSD: getthrid.2,v 1.1 2014/08/31 04:02:08 guenther Exp $ +.\" $NetBSD: getpid.2,v 1.5 1995/02/27 12:33:12 cgd Exp $ +.\" +.\" Copyright (c) 1980, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" 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. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +.\" +.\" @(#)getpid.2 8.1 (Berkeley) 6/4/93 +.\" +.Dd $Mdocdate: August 31 2014 $ +.Dt GETTHRID 2 +.Os +.Sh NAME +.Nm getthrid +.Nd get thread identifier +.Sh SYNOPSIS +.Fd #include <unistd.h> +.Ft pid_t +.Fn getthrid void +.Sh DESCRIPTION +.Nm +returns the thread ID of the calling thread. +This is used in the implementation of the thread library +.Pq Fl lpthread +and can appear in the output of system utilities such as +.Xr ps +and +.Xr kdump . +.Pp +Thread IDs are not a stable interface and should not be used directly +by applications except for correlation with system utility output. +Applications should use the +.Vt pthread_t +values from +.Xr pthread_self +and +.Xr pthread_create +to identify threads within the process itself. +.Sh RETURN VALUES +This function is always successful, and no return value is +reserved to indicate an error. +.Sh SEE ALSO +.Xr getpid 2 , +.Xr __tfork 2 , +.Xr pthread_self 3 , +.Xr pthread_create 3 +.Sh STANDARDS +The +.Nm +syscall is specific to +.Ox +and should not be used in portable applications. +.Sh HISTORY +The +.Nm +syscall appeared in +.Ox 3.9 . diff --git a/lib/librthread/rthread.h b/lib/librthread/rthread.h index 782cb3a7ee2..a777ad8c607 100644 --- a/lib/librthread/rthread.h +++ b/lib/librthread/rthread.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread.h,v 1.49 2014/07/01 03:32:18 guenther Exp $ */ +/* $OpenBSD: rthread.h,v 1.50 2014/08/31 04:02:08 guenther Exp $ */ /* * Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org> * All Rights Reserved. @@ -235,7 +235,6 @@ void _leave_delayed_cancel(pthread_t, int); void _thread_dump_info(void); /* syscalls */ -int getthrid(void); void __threxit(pid_t *); int __thrsleep(const volatile void *, clockid_t, const struct timespec *, volatile void *, const int *); |