4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * This is where all the interfaces that are internal to libc
29 * which do not have a better home live
44 #include <sys/ieeefp.h>
45 #include <sys/mount.h>
46 #include <floatingpoint.h>
52 #include <libnvpair.h>
58 extern void __set_panicstr(const char *);
59 extern void _rewind_unlocked(FILE *);
60 extern long _sysconfig(int);
61 extern int kill(pid_t pid
, int sig
);
63 extern int primary_link_map
;
64 extern int thr_main(void);
65 extern int thr_kill(thread_t tid
, int sig
);
66 extern thread_t
thr_self(void);
67 extern int mutex_lock(mutex_t
*mp
);
68 extern int mutex_unlock(mutex_t
*mp
);
69 extern void callout_lock_enter(void);
70 extern void callout_lock_exit(void);
71 extern void *lmalloc(size_t);
72 extern void lfree(void *, size_t);
73 extern void libc_nvlist_free(nvlist_t
*);
74 extern int libc_nvlist_lookup_uint64(nvlist_t
*, const char *, uint64_t *);
75 extern void *libc_malloc(size_t);
76 extern void *libc_realloc(void *, size_t);
77 extern void libc_free(void *);
78 extern char *libc_strdup(const char *);
79 extern int _pollsys(struct pollfd
*, nfds_t
, const timespec_t
*,
83 * The private_DIR structure is the same as the DIR structure,
84 * with the addition of a mutex lock for libc's internal use.
93 * getdents64 transitional interface is intentionally internal to libc
95 extern int getdents64(int, struct dirent64
*, size_t);
98 extern int _scrwidth(wchar_t);
100 extern int64_t __div64(int64_t, int64_t);
101 extern int64_t __rem64(int64_t, int64_t);
102 extern uint64_t __udiv64(uint64_t, uint64_t);
103 extern uint64_t __urem64(uint64_t, uint64_t);
104 extern int64_t __mul64(int64_t, int64_t);
105 extern uint64_t __umul64(uint64_t, uint64_t);
109 * Rounding direction functions
111 #if defined(__i386) || defined(__amd64)
112 extern enum fp_direction_type
__xgetRD(void);
113 #elif defined(__sparc)
114 extern enum fp_direction_type
_QgetRD(void);
116 #error Unknown architecture!
122 extern int __open(const char *, int, mode_t
);
123 extern int __open64(const char *, int, mode_t
);
124 extern int __openat(int, const char *, int, mode_t
);
125 extern int __openat64(int, const char *, int, mode_t
);
128 * defined in hex_bin.c
130 extern void __hex_to_single(decimal_record
*, enum fp_direction_type
,
131 single
*, fp_exception_field_type
*);
132 extern void __hex_to_double(decimal_record
*, enum fp_direction_type
,
133 double *, fp_exception_field_type
*);
135 extern void __hex_to_quadruple(decimal_record
*, enum fp_direction_type
,
136 quadruple
*, fp_exception_field_type
*);
137 #elif defined(__i386) || defined(__amd64)
138 extern void __hex_to_extended(decimal_record
*, enum fp_direction_type
,
139 extended
*, fp_exception_field_type
*);
141 #error Unknown architecture
147 extern char *__posix_asctime_r(const struct tm
*, char *);
150 * Internal routine from fsync.c
152 extern int __fdsync(int, int); /* 2nd arg may be wrong in 64bit mode */
155 * Internal routine from _xregs_clrptr.c
157 extern void _xregs_clrptr(ucontext_t
*);
160 * Internal routine from nfssys.c
162 extern int _nfssys(int, void *); /* int in 64bit mode ???, void * ??? */
165 * Internal routine from psetsys.c
167 extern int _pset(int, ...); /* int in 64bit mode ??? */
170 * defined in sigpending.s
172 extern int __sigfillset(sigset_t
*);
175 * defined in sparc/fp/_Q_set_except.c and i386/fp/exception.c
177 extern int _Q_set_exception(unsigned int);
180 * defined in nsparse.c
182 extern struct __nsw_switchconfig
*_nsw_getoneconfig(const char *name
,
183 char *linep
, enum __nsw_parse_err
*);
184 extern struct __nsw_switchconfig_v1
*_nsw_getoneconfig_v1(const char *name
,
185 char *linep
, enum __nsw_parse_err
*);
188 * Internal routine from getusershell.c
190 extern char *getusershell(void);
193 * defined in _sigaction.s
195 extern int __sigaction(int, const struct sigaction
*, struct sigaction
*);
198 * defined in _getsp.s
200 extern greg_t
_getsp(void);
203 * defined in _so_setsockopt.s
205 extern int _so_setsockopt(int, int, int, const char *, int);
208 * defined in _so_getsockopt.s
210 extern int _so_getsockopt(int, int, int, char *, int *);
215 extern int lsign(dl_t
);
218 * defined in ucontext.s
220 extern int __getcontext(ucontext_t
*);
225 extern int __door_info(int, door_info_t
*);
226 extern int __door_call(int, door_arg_t
*);
229 * defined in _portfs.s
231 extern int64_t _portfs(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
237 extern int __xpg4
; /* global */
238 extern int libc__xpg4
; /* copy of __xpg4, private to libc */
243 extern uint_t __xpg6
; /* global */
244 extern uint_t libc__xpg6
; /* copy of __xpg6, private to libc */
247 * defined in port/stdio/doscan.c
249 extern int _doscan(FILE *, const char *, va_list);
250 extern int __doscan_u(FILE *, const char *, va_list, int);
251 extern int __wdoscan_u(FILE *, const wchar_t *, va_list, int);
254 /* Flag for _ndoprnt() and _doscan_u() */
255 #define _F_INTMAX32 0x1 /* if set read 4 bytes for u/intmax %j */
256 extern int _fprintf_c89(FILE *, const char *, ...);
257 extern int _printf_c89(const char *, ...);
258 extern int _snprintf_c89(char *, size_t, const char *, ...);
259 extern int _sprintf_c89(char *, const char *, ...);
260 extern int _wprintf_c89(const wchar_t *, ...);
261 extern int _fwprintf_c89(FILE *, const wchar_t *, ...);
262 extern int _swprintf_c89(wchar_t *, size_t, const wchar_t *, ...);
263 extern int _vfprintf_c89(FILE *, const char *, va_list);
264 extern int _vprintf_c89(const char *, va_list);
265 extern int _vsnprintf_c89(char *, size_t, const char *, va_list);
266 extern int _vsprintf_c89(char *, const char *, va_list);
267 extern int _vwprintf_c89(const wchar_t *, va_list);
268 extern int _vfwprintf_c89(FILE *, const wchar_t *, va_list);
269 extern int _vswprintf_c89(wchar_t *, size_t, const wchar_t *, va_list);
270 extern int _scanf_c89(const char *, ...);
271 extern int _fscanf_c89(FILE *, const char *, ...);
272 extern int _sscanf_c89(const char *, const char *, ...);
273 extern int _vscanf_c89(const char *, va_list);
274 extern int _vfscanf_c89(FILE *, const char *, va_list);
275 extern int _vsscanf_c89(const char *, const char *, va_list);
276 extern int _vwscanf_c89(const wchar_t *, va_list);
277 extern int _vfwscanf_c89(FILE *, const wchar_t *, va_list);
278 extern int _vswscanf_c89(const wchar_t *, const wchar_t *, va_list);
279 extern int _wscanf_c89(const wchar_t *, ...);
280 extern int _fwscanf_c89(FILE *, const wchar_t *, ...);
281 extern int _swscanf_c89(const wchar_t *, const wchar_t *, ...);
285 * defined in port/stdio/popen.c
287 extern int _insert(pid_t pid
, int fd
);
288 extern pid_t
_delete(int fd
);
291 * defined in port/print/doprnt.c
293 extern ssize_t
_wdoprnt(const wchar_t *, va_list, FILE *);
296 * defined in fgetwc.c
298 extern wint_t _fgetwc_unlocked(FILE *);
299 extern wint_t __getwc_xpg5(FILE *);
300 extern wint_t __fgetwc_xpg5(FILE *);
301 extern wint_t _getwc(FILE *);
304 * defined in fputwc.c
306 extern wint_t __putwc_xpg5(wint_t, FILE *);
307 extern wint_t _putwc(wint_t, FILE *);
310 * defined in ungetwc.c
312 extern wint_t __ungetwc_xpg5(wint_t, FILE *);
315 * Defined in setlocale.c.
317 extern char *current_locale(locale_t
, int);