xref: /freebsd/lib/libc/include/libc_private.h (revision 2c444fdb0c75fbc73a0ac78d0ecbaef4e1e8baf8)
18a16b7a1SPedro F. Giffuni /*-
28a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
38a16b7a1SPedro F. Giffuni  *
401c70c00SJohn Birrell  * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
501c70c00SJohn Birrell  * All rights reserved.
601c70c00SJohn Birrell  *
701c70c00SJohn Birrell  * Redistribution and use in source and binary forms, with or without
801c70c00SJohn Birrell  * modification, are permitted provided that the following conditions
901c70c00SJohn Birrell  * are met:
1001c70c00SJohn Birrell  * 1. Redistributions of source code must retain the above copyright
1101c70c00SJohn Birrell  *    notice, this list of conditions and the following disclaimer.
1201c70c00SJohn Birrell  * 2. Redistributions in binary form must reproduce the above copyright
1301c70c00SJohn Birrell  *    notice, this list of conditions and the following disclaimer in the
1401c70c00SJohn Birrell  *    documentation and/or other materials provided with the distribution.
157dcf45c0SWarner Losh  * 3. Neither the name of the author nor the names of any co-contributors
1601c70c00SJohn Birrell  *    may be used to endorse or promote products derived from this software
1701c70c00SJohn Birrell  *    without specific prior written permission.
1801c70c00SJohn Birrell  *
1901c70c00SJohn Birrell  * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
2001c70c00SJohn Birrell  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2101c70c00SJohn Birrell  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2201c70c00SJohn Birrell  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2301c70c00SJohn Birrell  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2401c70c00SJohn Birrell  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2501c70c00SJohn Birrell  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2601c70c00SJohn Birrell  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2701c70c00SJohn Birrell  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2801c70c00SJohn Birrell  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2901c70c00SJohn Birrell  * SUCH DAMAGE.
3001c70c00SJohn Birrell  *
3101c70c00SJohn Birrell  * Private definitions for libc, libc_r and libpthread.
3201c70c00SJohn Birrell  *
3301c70c00SJohn Birrell  */
3401c70c00SJohn Birrell 
3501c70c00SJohn Birrell #ifndef _LIBC_PRIVATE_H_
3601c70c00SJohn Birrell #define _LIBC_PRIVATE_H_
37869fd80fSKonstantin Belousov #include <sys/_types.h>
385bcfe82eSJohn Baldwin #include <sys/_pthreadtypes.h>
3901c70c00SJohn Birrell 
40792081a7SBrooks Davis #include <libsys.h>
41792081a7SBrooks Davis 
420c6f0c0dSKonstantin Belousov extern char **environ;
430c6f0c0dSKonstantin Belousov 
4401c70c00SJohn Birrell /*
45cbc32e4cSDmitry Chagin  * The kernel doesn't expose PID_MAX to the user space. Save it here
46cbc32e4cSDmitry Chagin  * to allow to run a newer world on a pre-1400079 kernel.
47cbc32e4cSDmitry Chagin  */
48cbc32e4cSDmitry Chagin #define	_PID_MAX	99999
49cbc32e4cSDmitry Chagin 
50cbc32e4cSDmitry Chagin /*
5101c70c00SJohn Birrell  * This global flag is non-zero when a process has created one
5201c70c00SJohn Birrell  * or more threads. It is used to avoid calling locking functions
5301c70c00SJohn Birrell  * when they are not required.
5401c70c00SJohn Birrell  */
555a6d7b72SEric van Gyzen #ifndef __LIBC_ISTHREADED_DECLARED
565a6d7b72SEric van Gyzen #define __LIBC_ISTHREADED_DECLARED
5701c70c00SJohn Birrell extern int	__isthreaded;
585a6d7b72SEric van Gyzen #endif
5901c70c00SJohn Birrell 
6001c70c00SJohn Birrell /*
61a7d61fc1SKonstantin Belousov  * Elf_Auxinfo *__elf_aux_vector, the pointer to the ELF aux vector
62a7d61fc1SKonstantin Belousov  * provided by kernel. Either set for us by rtld, or found at runtime
63a7d61fc1SKonstantin Belousov  * on stack for static binaries.
64a7d61fc1SKonstantin Belousov  *
65a7d61fc1SKonstantin Belousov  * Type is void to avoid polluting whole libc with ELF types.
66a7d61fc1SKonstantin Belousov  */
67a7d61fc1SKonstantin Belousov extern void	*__elf_aux_vector;
68a7d61fc1SKonstantin Belousov 
69a7d61fc1SKonstantin Belousov /*
703e65b9c6SColin Percival  * libc should use libc_dlopen internally, which respects a global
713e65b9c6SColin Percival  * flag where loading of new shared objects can be restricted.
723e65b9c6SColin Percival  */
733e65b9c6SColin Percival void *libc_dlopen(const char *, int);
743e65b9c6SColin Percival 
753e65b9c6SColin Percival /*
763e65b9c6SColin Percival  * For dynamic linker.
773e65b9c6SColin Percival  */
783e65b9c6SColin Percival void _rtld_error(const char *fmt, ...);
793e65b9c6SColin Percival 
803e65b9c6SColin Percival /*
8101c70c00SJohn Birrell  * File lock contention is difficult to diagnose without knowing
8201c70c00SJohn Birrell  * where locks were set. Allow a debug library to be built which
8301c70c00SJohn Birrell  * records the source file and line number of each lock call.
8401c70c00SJohn Birrell  */
8501c70c00SJohn Birrell #ifdef	_FLOCK_DEBUG
8601c70c00SJohn Birrell #define _FLOCKFILE(x)	_flockfile_debug(x, __FILE__, __LINE__)
8701c70c00SJohn Birrell #else
88d201fe46SDaniel Eischen #define _FLOCKFILE(x)	_flockfile(x)
8901c70c00SJohn Birrell #endif
9001c70c00SJohn Birrell 
9101c70c00SJohn Birrell /*
9201c70c00SJohn Birrell  * Macros for locking and unlocking FILEs. These test if the
9301c70c00SJohn Birrell  * process is threaded to avoid locking when not required.
9401c70c00SJohn Birrell  */
9501c70c00SJohn Birrell #define	FLOCKFILE(fp)		if (__isthreaded) _FLOCKFILE(fp)
96d201fe46SDaniel Eischen #define	FUNLOCKFILE(fp)		if (__isthreaded) _funlockfile(fp)
9701c70c00SJohn Birrell 
9846ffdf3bSKonstantin Belousov struct _spinlock;
99442542b8SJilles Tjoelker extern struct _spinlock __stdio_thread_lock __hidden;
10046ffdf3bSKonstantin Belousov #define STDIO_THREAD_LOCK()				\
10146ffdf3bSKonstantin Belousov do {							\
10246ffdf3bSKonstantin Belousov 	if (__isthreaded)				\
10346ffdf3bSKonstantin Belousov 		_SPINLOCK(&__stdio_thread_lock);	\
10446ffdf3bSKonstantin Belousov } while (0)
10546ffdf3bSKonstantin Belousov #define STDIO_THREAD_UNLOCK()				\
10646ffdf3bSKonstantin Belousov do {							\
10746ffdf3bSKonstantin Belousov 	if (__isthreaded)				\
10846ffdf3bSKonstantin Belousov 		_SPINUNLOCK(&__stdio_thread_lock);	\
10946ffdf3bSKonstantin Belousov } while (0)
11046ffdf3bSKonstantin Belousov 
11145468c53SKonstantin Belousov void		__libc_spinlock_stub(struct _spinlock *);
11245468c53SKonstantin Belousov void		__libc_spinunlock_stub(struct _spinlock *);
11345468c53SKonstantin Belousov 
1144cd01193SMark Murray /*
115fb22a377SDaniel Eischen  * Indexes into the pthread jump table.
116fb22a377SDaniel Eischen  *
117fb22a377SDaniel Eischen  * Warning! If you change this type, you must also change the threads
118fb22a377SDaniel Eischen  * libraries that reference it (libc_r, libpthread).
119fb22a377SDaniel Eischen  */
120fb22a377SDaniel Eischen typedef enum {
121f4cd2a5bSDaniel Eischen 	PJT_ATFORK,
122f4cd2a5bSDaniel Eischen 	PJT_ATTR_DESTROY,
123f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETDETACHSTATE,
124f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETGUARDSIZE,
125f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETINHERITSCHED,
126f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETSCHEDPARAM,
127f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETSCHEDPOLICY,
128f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETSCOPE,
129f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETSTACKADDR,
130f4cd2a5bSDaniel Eischen 	PJT_ATTR_GETSTACKSIZE,
131f4cd2a5bSDaniel Eischen 	PJT_ATTR_INIT,
132f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETDETACHSTATE,
133f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETGUARDSIZE,
134f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETINHERITSCHED,
135f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETSCHEDPARAM,
136f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETSCHEDPOLICY,
137f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETSCOPE,
138f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETSTACKADDR,
139f4cd2a5bSDaniel Eischen 	PJT_ATTR_SETSTACKSIZE,
140f4cd2a5bSDaniel Eischen 	PJT_CANCEL,
141f4cd2a5bSDaniel Eischen 	PJT_CLEANUP_POP,
142f4cd2a5bSDaniel Eischen 	PJT_CLEANUP_PUSH,
143fb22a377SDaniel Eischen 	PJT_COND_BROADCAST,
144fb22a377SDaniel Eischen 	PJT_COND_DESTROY,
145fb22a377SDaniel Eischen 	PJT_COND_INIT,
146fb22a377SDaniel Eischen 	PJT_COND_SIGNAL,
147f4cd2a5bSDaniel Eischen 	PJT_COND_TIMEDWAIT,
148fb22a377SDaniel Eischen 	PJT_COND_WAIT,
149f4cd2a5bSDaniel Eischen 	PJT_DETACH,
150f4cd2a5bSDaniel Eischen 	PJT_EQUAL,
151f4cd2a5bSDaniel Eischen 	PJT_EXIT,
152fb22a377SDaniel Eischen 	PJT_GETSPECIFIC,
153f4cd2a5bSDaniel Eischen 	PJT_JOIN,
154fb22a377SDaniel Eischen 	PJT_KEY_CREATE,
155fb22a377SDaniel Eischen 	PJT_KEY_DELETE,
156f4cd2a5bSDaniel Eischen 	PJT_KILL,
157fb22a377SDaniel Eischen 	PJT_MAIN_NP,
158f4cd2a5bSDaniel Eischen 	PJT_MUTEXATTR_DESTROY,
159f4cd2a5bSDaniel Eischen 	PJT_MUTEXATTR_INIT,
160f4cd2a5bSDaniel Eischen 	PJT_MUTEXATTR_SETTYPE,
161fb22a377SDaniel Eischen 	PJT_MUTEX_DESTROY,
162fb22a377SDaniel Eischen 	PJT_MUTEX_INIT,
163fb22a377SDaniel Eischen 	PJT_MUTEX_LOCK,
164fb22a377SDaniel Eischen 	PJT_MUTEX_TRYLOCK,
165fb22a377SDaniel Eischen 	PJT_MUTEX_UNLOCK,
166fb22a377SDaniel Eischen 	PJT_ONCE,
167fb22a377SDaniel Eischen 	PJT_RWLOCK_DESTROY,
168fb22a377SDaniel Eischen 	PJT_RWLOCK_INIT,
169fb22a377SDaniel Eischen 	PJT_RWLOCK_RDLOCK,
170fb22a377SDaniel Eischen 	PJT_RWLOCK_TRYRDLOCK,
171fb22a377SDaniel Eischen 	PJT_RWLOCK_TRYWRLOCK,
172fb22a377SDaniel Eischen 	PJT_RWLOCK_UNLOCK,
173fb22a377SDaniel Eischen 	PJT_RWLOCK_WRLOCK,
174fb22a377SDaniel Eischen 	PJT_SELF,
175f4cd2a5bSDaniel Eischen 	PJT_SETCANCELSTATE,
176f4cd2a5bSDaniel Eischen 	PJT_SETCANCELTYPE,
177fb22a377SDaniel Eischen 	PJT_SETSPECIFIC,
178fb22a377SDaniel Eischen 	PJT_SIGMASK,
179f4cd2a5bSDaniel Eischen 	PJT_TESTCANCEL,
1809b0f1823SDavid Xu 	PJT_CLEANUP_POP_IMP,
1819b0f1823SDavid Xu 	PJT_CLEANUP_PUSH_IMP,
182f4213b90SDavid Xu 	PJT_CANCEL_ENTER,
183f4213b90SDavid Xu 	PJT_CANCEL_LEAVE,
1842a339d9eSKonstantin Belousov 	PJT_MUTEX_CONSISTENT,
1852a339d9eSKonstantin Belousov 	PJT_MUTEXATTR_GETROBUST,
1862a339d9eSKonstantin Belousov 	PJT_MUTEXATTR_SETROBUST,
1872d8c3eebSKonstantin Belousov 	PJT_GETTHREADID_NP,
188412ef5daSKonstantin Belousov 	PJT_ATTR_GET_NP,
1890dc52b72SMinsoo Choo 	PJT_GETNAME_NP,
19083aafcdcSKyle Evans 	PJT_SUSPEND_ALL_NP,
19183aafcdcSKyle Evans 	PJT_RESUME_ALL_NP,
192fb22a377SDaniel Eischen 	PJT_MAX
193fb22a377SDaniel Eischen } pjt_index_t;
194fb22a377SDaniel Eischen 
19507d35978SRyan Libby typedef void (*pthread_func_t)(void);
196fcfc20c8SDaniel Eischen typedef pthread_func_t pthread_func_entry_t[2];
197fb22a377SDaniel Eischen 
198fcfc20c8SDaniel Eischen extern pthread_func_entry_t __thr_jtable[];
199fb22a377SDaniel Eischen 
2001a744fefSKonstantin Belousov void	__set_error_selector(int *(*arg)(void));
2018495e8b1SKonstantin Belousov int	_pthread_mutex_init_calloc_cb_stub(pthread_mutex_t *mutex,
2028495e8b1SKonstantin Belousov 	    void *(calloc_cb)(__size_t, __size_t));
2038495e8b1SKonstantin Belousov 
20407d35978SRyan Libby typedef void (*interpos_func_t)(void);
2058495e8b1SKonstantin Belousov interpos_func_t *__libc_interposing_slot(int interposno);
2061a744fefSKonstantin Belousov extern interpos_func_t __libc_interposing[] __hidden;
2079cbd9658SBrooks Davis interpos_func_t *__libsys_interposing_slot(int interposno);
2088495e8b1SKonstantin Belousov 
2098495e8b1SKonstantin Belousov enum {
2108495e8b1SKonstantin Belousov 	INTERPOS_accept,
2118495e8b1SKonstantin Belousov 	INTERPOS_accept4,
2128495e8b1SKonstantin Belousov 	INTERPOS_aio_suspend,
2138495e8b1SKonstantin Belousov 	INTERPOS_close,
2148495e8b1SKonstantin Belousov 	INTERPOS_connect,
2158495e8b1SKonstantin Belousov 	INTERPOS_fcntl,
2168495e8b1SKonstantin Belousov 	INTERPOS_fsync,
2178495e8b1SKonstantin Belousov 	INTERPOS_fork,
2188495e8b1SKonstantin Belousov 	INTERPOS_msync,
2198495e8b1SKonstantin Belousov 	INTERPOS_nanosleep,
2208495e8b1SKonstantin Belousov 	INTERPOS_openat,
2218495e8b1SKonstantin Belousov 	INTERPOS_poll,
2228495e8b1SKonstantin Belousov 	INTERPOS_pselect,
2238495e8b1SKonstantin Belousov 	INTERPOS_recvfrom,
2248495e8b1SKonstantin Belousov 	INTERPOS_recvmsg,
2258495e8b1SKonstantin Belousov 	INTERPOS_select,
2268495e8b1SKonstantin Belousov 	INTERPOS_sendmsg,
2278495e8b1SKonstantin Belousov 	INTERPOS_sendto,
2288495e8b1SKonstantin Belousov 	INTERPOS_setcontext,
2298495e8b1SKonstantin Belousov 	INTERPOS_sigaction,
2308495e8b1SKonstantin Belousov 	INTERPOS_sigprocmask,
2318495e8b1SKonstantin Belousov 	INTERPOS_sigsuspend,
2328495e8b1SKonstantin Belousov 	INTERPOS_sigwait,
2338495e8b1SKonstantin Belousov 	INTERPOS_sigtimedwait,
2348495e8b1SKonstantin Belousov 	INTERPOS_sigwaitinfo,
2358495e8b1SKonstantin Belousov 	INTERPOS_swapcontext,
2368495e8b1SKonstantin Belousov 	INTERPOS_system,
2378495e8b1SKonstantin Belousov 	INTERPOS_tcdrain,
2388495e8b1SKonstantin Belousov 	INTERPOS_read,
2398495e8b1SKonstantin Belousov 	INTERPOS_readv,
2408495e8b1SKonstantin Belousov 	INTERPOS_wait4,
2418495e8b1SKonstantin Belousov 	INTERPOS_write,
2428495e8b1SKonstantin Belousov 	INTERPOS_writev,
2438495e8b1SKonstantin Belousov 	INTERPOS__pthread_mutex_init_calloc_cb,
24445468c53SKonstantin Belousov 	INTERPOS_spinlock,
24545468c53SKonstantin Belousov 	INTERPOS_spinunlock,
246b072e86dSKonstantin Belousov 	INTERPOS_kevent,
2473d0045bbSKonstantin Belousov 	INTERPOS_wait6,
2483d0045bbSKonstantin Belousov 	INTERPOS_ppoll,
249bd43f069SKonstantin Belousov 	INTERPOS_map_stacks_exec,
2501c1cc895SKonstantin Belousov 	INTERPOS_fdatasync,
2513f8455b0SEric van Gyzen 	INTERPOS_clock_nanosleep,
252*2c444fdbSJessica Clarke 	INTERPOS__reserved0, /* was distribute_static_tls */
25321f749daSKonstantin Belousov 	INTERPOS_pdfork,
254a56fe703SKonstantin Belousov 	INTERPOS_uexterr_gettext,
2558495e8b1SKonstantin Belousov 	INTERPOS_MAX
2568495e8b1SKonstantin Belousov };
2578495e8b1SKonstantin Belousov 
2587dd9070eSBrooks Davis #define	_INTERPOS_SYS(type, idx, ...)				\
2597dd9070eSBrooks Davis     ((type *)*(__libc_interposing_slot(idx)))(__VA_ARGS__)
2607dd9070eSBrooks Davis #define	INTERPOS_SYS(syscall, ...)				\
2617dd9070eSBrooks Davis     _INTERPOS_SYS(__sys_## syscall ##_t, INTERPOS_## syscall	\
2627dd9070eSBrooks Davis     __VA_OPT__(,) __VA_ARGS__)
2637dd9070eSBrooks Davis 
264fb22a377SDaniel Eischen /*
2652bbd7cf8SJacques Vidrine  * yplib internal interfaces
2662bbd7cf8SJacques Vidrine  */
2672bbd7cf8SJacques Vidrine #ifdef YP
2682bbd7cf8SJacques Vidrine int _yp_check(char **);
2692bbd7cf8SJacques Vidrine #endif
2702bbd7cf8SJacques Vidrine 
27151015e6dSKonstantin Belousov void __libc_start1(int, char *[], char *[],
27251015e6dSKonstantin Belousov     void (*)(void), int (*)(int, char *[], char *[])) __dead2;
27351015e6dSKonstantin Belousov void __libc_start1_gcrt(int, char *[], char *[],
27451015e6dSKonstantin Belousov     void (*)(void), int (*)(int, char *[], char *[]),
27551015e6dSKonstantin Belousov     int *, int *) __dead2;
27651015e6dSKonstantin Belousov 
277ccd13c49SDoug Rabson /*
278ccd13c49SDoug Rabson  * Initialise TLS for static programs
279ccd13c49SDoug Rabson  */
280ccd13c49SDoug Rabson void _init_tls(void);
281ccd13c49SDoug Rabson 
282ccd13c49SDoug Rabson /*
2835bcfe82eSJohn Baldwin  * Provides pthread_once()-like functionality for both single-threaded
2845bcfe82eSJohn Baldwin  * and multi-threaded applications.
2855bcfe82eSJohn Baldwin  */
2865bcfe82eSJohn Baldwin int _once(pthread_once_t *, void (*)(void));
2875bcfe82eSJohn Baldwin 
2885bcfe82eSJohn Baldwin /*
2894cd01193SMark Murray  * This is a pointer in the C run-time startup code. It is used
2904cd01193SMark Murray  * by getprogname() and setprogname().
2914cd01193SMark Murray  */
2924cd01193SMark Murray extern const char *__progname;
2934cd01193SMark Murray 
29435870236SDaniel Eischen /*
295d6742bfbSJason Evans  * This function is used by the threading libraries to notify malloc that a
296d6742bfbSJason Evans  * thread is exiting.
297d6742bfbSJason Evans  */
298d6742bfbSJason Evans void _malloc_thread_cleanup(void);
299d6742bfbSJason Evans 
300d6742bfbSJason Evans /*
301b585cd3eSKonstantin Belousov  * This function is used by the threading libraries to notify libc that a
302b585cd3eSKonstantin Belousov  * thread is exiting, so its thread-local dtors should be called.
303b585cd3eSKonstantin Belousov  */
304b585cd3eSKonstantin Belousov void __cxa_thread_call_dtors(void);
305b7c7684aSKonstantin Belousov int __cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj,
306b7c7684aSKonstantin Belousov     void *dso_symbol) __hidden;
307b585cd3eSKonstantin Belousov 
308b585cd3eSKonstantin Belousov /*
30952828c0eSJason Evans  * These functions are used by the threading libraries in order to protect
31052828c0eSJason Evans  * malloc across fork().
31135870236SDaniel Eischen  */
31252828c0eSJason Evans void _malloc_prefork(void);
31352828c0eSJason Evans void _malloc_postfork(void);
31435870236SDaniel Eischen 
3158495e8b1SKonstantin Belousov void _malloc_first_thread(void);
3168495e8b1SKonstantin Belousov 
3172ba64027SStefan Farfeleder /*
3182ba64027SStefan Farfeleder  * Function to clean up streams, called from abort() and exit().
3192ba64027SStefan Farfeleder  */
3205aed3effSKonstantin Belousov extern void (*__cleanup)(void) __hidden;
3212ba64027SStefan Farfeleder 
3224dd719bdSPeter Wemm /*
3234dd719bdSPeter Wemm  * Get kern.osreldate to detect ABI revisions.  Explicitly
3240538aafcSKonstantin Belousov  * ignores value of $OSVERSION and caches result.
3254dd719bdSPeter Wemm  */
3268495e8b1SKonstantin Belousov int __getosreldate(void);
3274dd719bdSPeter Wemm #include <sys/_types.h>
3288495e8b1SKonstantin Belousov #include <sys/_sigset.h>
3294dd719bdSPeter Wemm 
3308495e8b1SKonstantin Belousov struct aiocb;
3318495e8b1SKonstantin Belousov struct fd_set;
3328495e8b1SKonstantin Belousov struct iovec;
333b072e86dSKonstantin Belousov struct kevent;
3348495e8b1SKonstantin Belousov struct msghdr;
3358495e8b1SKonstantin Belousov struct pollfd;
3368495e8b1SKonstantin Belousov struct rusage;
3378495e8b1SKonstantin Belousov struct sigaction;
3388495e8b1SKonstantin Belousov struct sockaddr;
33969921123SKonstantin Belousov struct stat;
3405ab191c4SWarner Losh struct statfs;
341869fd80fSKonstantin Belousov struct timespec;
342869fd80fSKonstantin Belousov struct timeval;
343869fd80fSKonstantin Belousov struct timezone;
3448495e8b1SKonstantin Belousov struct __siginfo;
3458495e8b1SKonstantin Belousov struct __ucontext;
3463d0045bbSKonstantin Belousov struct __wrusage;
3473d0045bbSKonstantin Belousov enum idtype;
3488495e8b1SKonstantin Belousov 
349d8e841a9SSHENGYI HONG int		__libc_execvpe(const char *, char * const *, char * const *);
350bd6060a1SKonstantin Belousov int		__libc_sigaction(int, const struct sigaction *,
351bd6060a1SKonstantin Belousov 		    struct sigaction *) __hidden;
352bd6060a1SKonstantin Belousov int		__libc_sigprocmask(int, const __sigset_t *, __sigset_t *)
353bd6060a1SKonstantin Belousov 		    __hidden;
354bd6060a1SKonstantin Belousov int		__libc_sigsuspend(const __sigset_t *) __hidden;
355f7dbbbd1SBrooks Davis int		__libsys_sigwait(const __sigset_t *, int *) __hidden;
3568495e8b1SKonstantin Belousov int		__libc_system(const char *);
3578495e8b1SKonstantin Belousov int		__libc_tcdrain(int);
358869fd80fSKonstantin Belousov 
3592793b018SKonstantin Belousov int _elf_aux_info(int aux, void *buf, int buflen);
360ea246b63SKonstantin Belousov struct dl_phdr_info;
361ea246b63SKonstantin Belousov int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
362a7d61fc1SKonstantin Belousov void __init_elf_aux_vector(void);
363c5dd49afSMark Johnston void __libc_map_stacks_exec(void);
3642793b018SKonstantin Belousov 
365f4213b90SDavid Xu void	_pthread_cancel_enter(int);
366f4213b90SDavid Xu void	_pthread_cancel_leave(int);
367f4213b90SDavid Xu 
368b73ac668SKonstantin Belousov struct _pthread_cleanup_info;
369b73ac668SKonstantin Belousov void	___pthread_cleanup_push_imp(void (*)(void *), void *,
370b73ac668SKonstantin Belousov 	    struct _pthread_cleanup_info *);
371b73ac668SKonstantin Belousov void	___pthread_cleanup_pop_imp(int);
372b73ac668SKonstantin Belousov 
3739851b340SKonstantin Belousov void __throw_constraint_handler_s(const char * restrict msg, int error);
3749851b340SKonstantin Belousov 
375675079b1SKonstantin Belousov struct __nl_cat_d;
376675079b1SKonstantin Belousov struct _xlocale;
377675079b1SKonstantin Belousov struct __nl_cat_d *__catopen_l(const char *name, int type,
378675079b1SKonstantin Belousov 	    struct _xlocale *locale);
37992771bc0SKonstantin Belousov int __strerror_rl(int errnum, char *strerrbuf, size_t buflen,
38092771bc0SKonstantin Belousov 	    struct _xlocale *locale);
381675079b1SKonstantin Belousov 
382a56fe703SKonstantin Belousov struct uexterror;
383a56fe703SKonstantin Belousov int __uexterr_format(const struct uexterror *ue, char *buf, size_t bufsz);
384a56fe703SKonstantin Belousov int __libc_uexterr_gettext(char *buf, size_t bufsz);
385a56fe703SKonstantin Belousov 
38601c70c00SJohn Birrell #endif /* _LIBC_PRIVATE_H_ */
387