X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..e8c3f78193f1895ea514044358b93b1add9322f3:/libsyscall/wrappers/_libkernel_init.h diff --git a/libsyscall/wrappers/_libkernel_init.h b/libsyscall/wrappers/_libkernel_init.h index f5bef896f..b081ebc90 100644 --- a/libsyscall/wrappers/_libkernel_init.h +++ b/libsyscall/wrappers/_libkernel_init.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Apple Inc. All rights reserved. + * Copyright (c) 2010-2014 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -30,20 +30,83 @@ #define __LIBKERNEL_INIT_H #include +#include +#include +#include + +#ifndef __OS_VOUCHER_PRIVATE__ +// We cannot include the actual os/voucher_private.h definition of voucher_t +// here, as that also marks the voucher_XXX functions as exported, which causes +// a compile error when we attempt to mark them hidden in the .c file. +// +// The Libsystem init.c file does include os/voucher_private.h though, as well +// as this file, and this typedef causes an error if it is unguarded. +struct voucher_s; +typedef struct voucher_s *voucher_t; +#endif typedef const struct _libkernel_functions { - /* Structure version 1. Subsequent versions must only add pointers! */ + /* The following functions are included in version 1 of this structure */ unsigned long version; void* (*dlsym)(void*, const char*); void* (*malloc)(size_t); void (*free)(void*); void* (*realloc)(void*, size_t); void (*_pthread_exit_if_canceled)(int); + + /* The following functions are included in version 2 of this structure */ + void *reserved1; + void *reserved2; + void *reserved3; + void *reserved4; + void *reserved5; + + /* The following functions are included in version 3 of this structure */ + void (*pthread_clear_qos_tsd)(mach_port_t); + + /* Subsequent versions must only add pointers! */ } *_libkernel_functions_t; +typedef const struct _libkernel_string_functions { + /* The following functions are included in version 1 of this structure */ + unsigned long version; + void (*bzero)(void *s, size_t n); + void * (*memchr)(const void *s, int c, size_t n); + int (*memcmp)(const void *s1, const void *s2, size_t n); + void * (*memmove)(void *dst, const void *src, size_t n); + void * (*memccpy)(void *__restrict dst, const void *__restrict src, int c, size_t n); + void * (*memset)(void *b, int c, size_t len); + char * (*strchr)(const char *s, int c); + int (*strcmp)(const char *s1, const char *s2); + char * (*strcpy)(char * restrict dst, const char * restrict src); + size_t (*strlcat)(char * restrict dst, const char * restrict src, size_t maxlen); + size_t (*strlcpy)(char * restrict dst, const char * restrict src, size_t maxlen); + size_t (*strlen)(const char *str); + int (*strncmp)(const char *s1, const char *s2, size_t n); + char * (*strncpy)(char * restrict dst, const char * restrict src, size_t maxlen); + size_t (*strnlen)(const char *s, size_t maxlen); + char * (*strstr)(const char *s, const char *find); + /* Subsequent versions must only add pointers! */ +} *_libkernel_string_functions_t; + +typedef const struct _libkernel_voucher_functions { + /* The following functions are included in version 1 of this structure */ + unsigned long version; + boolean_t (*voucher_mach_msg_set)(mach_msg_header_t*); + void (*voucher_mach_msg_clear)(mach_msg_header_t*); + voucher_mach_msg_state_t (*voucher_mach_msg_adopt)(mach_msg_header_t*); + void (*voucher_mach_msg_revert)(voucher_mach_msg_state_t); + + /* Subsequent versions must only add pointers! */ +} *_libkernel_voucher_functions_t; + struct ProgramVars; /* forward reference */ void __libkernel_init(_libkernel_functions_t fns, const char *envp[], const char *apple[], const struct ProgramVars *vars); -#endif // __LIBKERNEL_INIT_H` +kern_return_t __libkernel_platform_init(_libkernel_string_functions_t fns); + +kern_return_t __libkernel_voucher_init(_libkernel_voucher_functions_t fns); + +#endif // __LIBKERNEL_INIT_H