]> git.saurik.com Git - apple/boot.git/blob - gen/libsa/libsa.h
56b5abe9cc831f08f96f63ed0dddf9bc899beef2
[apple/boot.git] / gen / libsa / libsa.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /* Exported API for standalone library */
26 #import <mach-o/loader.h>
27 #import <mach/mach.h>
28 #import <stdarg.h>
29 #import <stddef.h>
30
31 #ifndef bcopy
32 extern char *bcopy(char *src, char *dst, int n);
33 #endif
34 extern void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
35 #ifndef bzero
36 extern int bzero(char *b, int length);
37 #endif
38 extern void *memset(void *s, int c, size_t n);
39
40 /*
41 * These are defined internally by GCC
42 *
43 * extern void *memcpy(void *dst, const void *src, size_t len);
44 * extern size_t strlen(const char *s);
45 */
46
47 extern int errno;
48 extern struct segment_command *
49 getsegbynamefromheader(struct mach_header *mhp, char *segname);
50 extern int ptol(char *str);
51
52 /* setjmp/longjmp:
53 * #include <setjmp.h>
54 *
55 * extern int setjmp(jmp_buf env);
56 * extern void longjmp( jmp_buf env, int val);
57 */
58
59 extern int slvprintf(char *buffer, int len, const char *fmt, va_list arg);
60 extern int sprintf(char *s, const char *format, ...);
61
62 extern char *strcat(char *s1, const char *s2);
63 extern int strcmp(const char *s1, const char *s2);
64 extern char *strcpy(char *s1, const char *s2);
65 char *strerror(int errnum);
66 extern int strncmp(const char *s1, const char *s2, size_t n);
67 extern char *strncpy(char *s1, const char *s2, size_t n);
68 extern long strtol(
69 const char *nptr,
70 char **endptr,
71 register int base
72 );
73 extern unsigned long strtoul(
74 const char *nptr,
75 char **endptr,
76 register int base
77 );
78 extern int atoi(const char *str);
79
80 /* Mach */
81 extern port_t task_self_;
82 extern kern_return_t vm_allocate(
83 vm_task_t target_task,
84 vm_address_t *address,
85 vm_size_t size,
86 boolean_t anywhere
87 );
88 extern kern_return_t vm_deallocate(
89 vm_task_t target_task,
90 vm_address_t address,
91 vm_size_t size
92 );
93 extern kern_return_t host_info(
94 host_t host,
95 int flavor,
96 host_info_t host_info,
97 unsigned int *host_info_count
98 );
99 extern vm_size_t vm_page_size;
100 extern host_t host_self(void);
101 extern int getpagesize(void);
102 extern char *mach_error_string(int errnum);
103
104 /* Malloc */
105 extern void malloc_init(char *start, int size, int nodes);
106 extern void *malloc(size_t size);
107 extern void free(void *start);
108 extern void *realloc(void *ptr, size_t size);
109
110 extern void prf(
111 const char *fmt,
112 va_list ap,
113 void (*putfn_p)(),
114 void *putfn_arg
115 );
116 extern int strncasecmp(const char *s1, const char *s2, size_t n);