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