]> git.saurik.com Git - apple/libpthread.git/blob - src/imports_internal.h
libpthread-454.100.8.tar.gz
[apple/libpthread.git] / src / imports_internal.h
1 /*
2 * Copyright (c) 2019 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef __LIBPTHREAD_IMPORTS_INTERNAL_H__
25 #define __LIBPTHREAD_IMPORTS_INTERNAL_H__
26
27 /*!
28 * @file imports_internal.h
29 *
30 * @brief
31 * This file lists prototypes that do not have a header on the system,
32 * like syscalls, that we need to import in pthread.
33 */
34
35 #include <os/base.h>
36 #include <mach/mach.h>
37 #include <sys/time.h>
38 #include <stack_logging.h>
39
40 extern boolean_t swtch_pri(int);
41
42 // Defined in libsyscall; initialized in libmalloc
43 extern malloc_logger_t *__syscall_logger;
44
45 // syscalls
46
47 extern uint32_t __psynch_mutexwait(pthread_mutex_t *mutex, uint32_t mgen, uint32_t ugen, uint64_t tid, uint32_t flags);
48 extern uint32_t __psynch_mutexdrop(pthread_mutex_t *mutex, uint32_t mgen, uint32_t ugen, uint64_t tid, uint32_t flags);
49
50 extern uint32_t __psynch_cvbroad(pthread_cond_t *cv, uint64_t cvlsgen, uint64_t cvudgen, uint32_t flags, pthread_mutex_t *mutex, uint64_t mugen, uint64_t tid);
51 extern uint32_t __psynch_cvsignal(pthread_cond_t *cv, uint64_t cvlsgen, uint32_t cvugen, int thread_port, pthread_mutex_t *mutex, uint64_t mugen, uint64_t tid, uint32_t flags);
52 extern uint32_t __psynch_cvwait(pthread_cond_t *cv, uint64_t cvlsgen, uint32_t cvugen, pthread_mutex_t *mutex, uint64_t mugen, uint32_t flags, int64_t sec, uint32_t nsec);
53 extern uint32_t __psynch_cvclrprepost(void *cv, uint32_t cvgen, uint32_t cvugen, uint32_t cvsgen, uint32_t prepocnt, uint32_t preposeq, uint32_t flags);
54
55 extern uint32_t __psynch_rw_longrdlock(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
56 extern uint32_t __psynch_rw_yieldwrlock(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
57 extern int __psynch_rw_downgrade(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
58 extern uint32_t __psynch_rw_upgrade(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
59 extern uint32_t __psynch_rw_rdlock(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
60 extern uint32_t __psynch_rw_wrlock(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
61 extern uint32_t __psynch_rw_unlock(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
62 extern uint32_t __psynch_rw_unlock2(pthread_rwlock_t *rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags);
63
64 extern uint32_t __bsdthread_ctl(uintptr_t cmd, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3);
65 extern pthread_t __bsdthread_create(void *(*func)(void *), void *func_arg, void *stack, pthread_t thread, unsigned int flags);
66 extern int __bsdthread_register(void (*)(pthread_t, mach_port_t, void *(*)(void *), void *, size_t, unsigned int), void (*)(pthread_t, mach_port_t, void *, void *, int), int,void (*)(pthread_t, mach_port_t, void *(*)(void *), void *, size_t, unsigned int), int32_t *,__uint64_t);
67 extern int __bsdthread_terminate(void *freeaddr, size_t freesize, mach_port_t kport, mach_port_t joinsem);
68
69 extern uint64_t __thread_selfid(void);
70 extern int __disable_threadsignal(int);
71
72 extern int __pthread_canceled(int);
73 extern int __pthread_chdir(const char *path);
74 extern int __pthread_fchdir(int fd);
75 extern int __pthread_kill(mach_port_t, int);
76 extern int __pthread_markcancel(mach_port_t);
77 extern int __pthread_sigmask(int, const sigset_t *, sigset_t *);
78
79 extern int __gettimeofday(struct timeval *, struct timezone *);
80 extern void __exit(int) __attribute__((noreturn));
81 extern int __proc_info(int callnum, int pid, int flavor, uint64_t arg, void *buffer, int buffersize);
82 extern int __semwait_signal_nocancel(int, int, int, int, __int64_t, __int32_t);
83 extern int __sigwait(const sigset_t *set, int *sig);
84 extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
85
86
87 #endif // __LIBPTHREAD_IMPORTS_INTERNAL_H__