xref: /titanic_53/usr/src/lib/libc/port/llib-lc (revision bb043848da3b310a80b83f7cf3e72c3a96066ddb)
1/*
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved.
26 * Copyright (c) 2013 Gary Mills
27 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 * Copyright 2015 Circonus, Inc.  All rights reserved.
29 * Copyright 2015 Joyent, Inc.
30 */
31
32/* LINTLIBRARY */
33/* PROTOLIB1 */
34
35#define	__EXTENSIONS__
36
37#include <aio.h>
38#include <alloca.h>
39#include <attr.h>
40#include <atomic.h>
41#include <ctype.h>
42#include <deflt.h>
43#include <dirent.h>
44#include <dlfcn.h>
45#include <door.h>
46#include <err.h>
47#include <sys/errno.h>
48#include <euc.h>
49#include <fcntl.h>
50#include <float.h>
51#include <fmtmsg.h>
52#include <fnmatch.h>
53#include <ftw.h>
54#include <glob.h>
55#include <getwidth.h>
56#include <grp.h>
57#include <iconv.h>
58#include <langinfo.h>
59#include <libgen.h>
60#include <libw.h>
61#include <locale.h>
62#include <memory.h>
63#include <mon.h>
64#include <mqueue.h>
65#include <nan.h>
66#include <ndbm.h>
67#include <limits.h>
68#include <nl_types.h>
69#include <poll.h>
70#include <project.h>
71#include <priv.h>
72#include <pwd.h>
73#include <rctl.h>
74#include <regex.h>
75#include <rpcsvc/ypclnt.h>
76#include <sched.h>
77#include <search.h>
78#include <semaphore.h>
79#include <setjmp.h>
80#include <shadow.h>
81#include <siginfo.h>
82#include <signal.h>
83#include <stdarg.h>
84#include <ucred.h>
85#include <sys/ucred.h>
86#include <unistd.h>
87#include <ulimit.h>
88#include <utime.h>
89#include <stddef.h>
90#include <stdio.h>
91#include <stdlib.h>
92#include <string.h>
93#include <stropts.h>
94#include <synch.h>
95#include <sys/acctctl.h>
96#include <sys/acl.h>
97#include <sys/asynch.h>
98#include <sys/byteorder.h>
99#include <sys/cladm.h>
100#include <sys/corectl.h>
101#include <sys/dl.h>
102#include <sys/exacct.h>
103#include <sys/fcntl.h>
104#include <sys/file.h>
105#include <sys/fs/namenode.h>
106#include <sys/instance.h>
107#include <sys/ipc.h>
108#include <sys/lwp.h>
109#include <sys/mkdev.h>
110#include <sys/mman.h>
111#include <sys/mnttab.h>
112#include <sys/mount.h>
113#include <sys/msg.h>
114#include <sys/param.h>
115#include <sys/priocntl.h>
116#include <sys/procset.h>
117#include <sys/processor.h>
118#include <sys/pset.h>
119#include <sys/rctl_impl.h>
120#include <sys/sem.h>
121#include <sys/shm.h>
122#include <sys/sid.h>
123#include <sys/signal.h>
124#include <sys/stat.h>
125#include <sys/statvfs.h>
126#include <sys/strlog.h>
127#include <sys/stropts.h>
128#include <sys/syscall.h>
129#include <sys/sysconfig.h>
130#include <sys/syslog.h>
131#include <sys/systeminfo.h>
132#include <sys/task.h>
133#include <sys/termio.h>
134#include <sys/termios.h>
135#include <sys/u8_textprep.h>
136#include <sys/time.h>
137#include <sys/timeb.h>
138#include <sys/times.h>
139#include <sys/types.h>
140#include <sys/uadmin.h>
141#include <sys/utsname.h>
142#include <sys/vfstab.h>
143#include <sys/sendfile.h>
144#include <sys/zone.h>
145#include <termio.h>
146#include <time.h>
147#include <tzfile.h>
148#include <ucontext.h>
149#include <utmpx.h>
150#include <values.h>
151#include <wait.h>
152#include <wchar.h>
153#include <wctype.h>
154#include <widec.h>
155#include <wordexp.h>
156#include <thread.h>
157#include <pthread.h>
158#include <schedctl.h>
159#include <zone.h>
160#include <port.h>
161#include <spawn.h>
162#include <inttypes.h>
163#include <getopt.h>
164#include <stdio_ext.h>
165#if defined(__i386)
166#include <sys/sysi86.h>
167#endif
168#if defined(__amd64)
169#include <stack_unwind.h>
170#endif
171#include <xlocale.h>
172
173/*
174 * This really comes from the crt*.s startup modules.
175 */
176char **environ;
177
178/*
179 * This is a GNU/Linux/BSD compatibility interface,
180 * not declared in any header file.
181 */
182const char *__progname;
183
184/*
185 * POSIX versions of standard libc routines; these aren't extracted
186 * from the headers above since we cannot #define _POSIX_C_SOURCE.
187 */
188int __posix_readdir_r(DIR * _RESTRICT_KYWD, struct dirent * _RESTRICT_KYWD,
189    struct dirent ** _RESTRICT_KYWD);
190int __posix_getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
191int __posix_getgrnam_r(const char *, struct group *, char *, size_t,
192    struct group **);
193int __posix_getpwuid_r(uid_t, struct passwd *, char *, size_t,
194    struct passwd **);
195int __posix_getpwnam_r(const char *, struct passwd *, char *, size_t,
196    struct passwd **);
197int __posix_sigwait(const sigset_t * _RESTRICT_KYWD, int * _RESTRICT_KYWD);
198char *__posix_asctime_r(const struct tm *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
199char *__posix_ctime_r(const time_t *, char *);
200int __posix_ttyname_r(int, char *, size_t);
201int __posix_getlogin_r(char *, int);
202int __posix_getloginx_r(char *, int);
203
204/*
205 * XPG4 versions of standard libc routines; these aren't extracted
206 * from the headers above since we cannot #define _XPG4_2.
207 */
208int __xpg4_putmsg(int, const struct strbuf *, const struct strbuf *, int);
209int __xpg4_putpmsg(int, const struct strbuf *, const struct strbuf *, int, int);
210
211/*
212 * These aren't extracted from the headers above because:
213 * - We cannot #define _STRPTIME_DONTZERO
214 * - We cannot #define _XPG5
215 */
216char *__strptime_dontzero(const char *, const char *, struct tm *);
217long __sysconf_xpg5(int);
218wchar_t *__wcstok_xpg5(wchar_t *_RESTRICT_KYWD,
219	const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD);
220size_t __wcsftime_xpg5(wchar_t *_RESTRICT_KYWD, size_t,
221	const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD);
222wint_t __fgetwc_xpg5(__FILE *);
223wint_t __getwc_xpg5(__FILE *);
224wint_t __getwchar_xpg5(void);
225wint_t __fputwc_xpg5(wint_t, __FILE *);
226wint_t __putwc_xpg5(wint_t, __FILE *);
227wint_t __putwchar_xpg5(wint_t);
228wchar_t *__fgetws_xpg5(wchar_t *_RESTRICT_KYWD, int, __FILE *_RESTRICT_KYWD);
229int __fputws_xpg5(const wchar_t *_RESTRICT_KYWD, __FILE *_RESTRICT_KYWD);
230wint_t __ungetwc_xpg5(wint_t, __FILE *);
231
232/*
233 * /usr/src/lib/libc/port/gen routines
234 */
235
236/* _ctype.c */
237
238/* _loc_data.c */
239
240/* _locale.c */
241
242/* _set_tab.c */
243int _set_tab(const char *loc, int cat);
244
245/* _xftw.c */
246int _xftw(int ver, const char *path, int (*fn)(), int depth);
247
248/* a64l.c */
249long a64l(const char *);
250
251/* abort.c */
252void abort(void);
253
254/* abs.c */
255int abs(int arg);
256long labs(long int arg);
257
258/* assert.c */
259void _assert(const char *assertion, const char *filename, int line_num);
260void __assert_c99(const char *assertion, const char *filename, int line_num,
261    const char *funcname);
262
263/* atexit.c */
264int atexit(void(*func)());
265void _exithandle(void);
266
267/* atof.c */
268double atof(const char *p);
269
270/* atoi.c */
271int atoi(const char *p);
272
273/* atol.c */
274long atol(const char *p);
275
276/* basename.c */
277char *basename(char *s);
278
279/* bcmp.c */
280int bcmp(const void *s1, const void *s2, size_t len);
281
282/* bcopy.c */
283void bcopy(const void *s1, void *s2, size_t len);
284
285/* bsearch.c */
286void *bsearch(const void *ky, const void *bs, size_t nel,
287		size_t width, int (*compar)());
288
289/* bzero.c */
290void bzero(void *sp, size_t len);
291
292/* calloc.c */
293void *calloc(size_t num, size_t size);
294
295/* catclose.c */
296int catclose(nl_catd catd);
297
298/* catgets.c */
299char *catgets(nl_catd catd, int set_num, int msg_num, const char *s);
300
301/* catopen.c */
302nl_catd catopen(const char *name, int mode);
303
304/* cfgetispeed.c */
305speed_t cfgetispeed(const struct termios *termios_p);
306
307/* cfgetospeed.c */
308speed_t cfgetospeed(const struct termios *termios_p);
309
310/* cfree.c */
311void cfree(void *p, size_t num, size_t size);
312
313/* cfsetispeed.c */
314int cfsetispeed(struct termios *termios_p, speed_t speed);
315
316/* cfsetospeed.c */
317int cfsetospeed(struct termios *termios_p, speed_t speed);
318
319/* cftime.c */
320int cftime(char *buf, char *format, const time_t *t);
321int ascftime(char *buf, const char *format, const struct tm *tm);
322
323/* clock.c */
324clock_t clock(void);
325
326/* closedir.c */
327int closedir(DIR *dirp);
328
329/* confstr.c */
330size_t confstr(int name, char *buf, size_t length);
331
332/* crypt.c */
333void setkey(const char *key);
334void encrypt(char *block, int fake);
335char *crypt(const char *key, const char *salt);
336
337/* csetlen.c */
338int csetlen(int cset);
339int csetcol(int cset);
340
341/* ctime.c */
342char *ctime(const time_t *t);
343char *ctime_r(const time_t *, char *buf, int);
344char *asctime(const struct tm *t);
345char *asctime_r(const struct tm *, char *, int);
346
347/* ctypefcns.c */
348int isalpha(int c);
349int isupper(int c);
350int islower(int c);
351int isdigit(int c);
352int isxdigit(int c);
353int isalnum(int c);
354int isspace(int c);
355int ispunct(int c);
356int isprint(int c);
357int isgraph(int c);
358int iscntrl(int c);
359int isascii(int c);
360int _toupper(int c);
361int _tolower(int c);
362int toascii(int c);
363
364/* daemon.c */
365int daemon(int nochdir, int noclose);
366
367/* directio.c */
368int directio(int filedes, int advice);
369
370/* dirname.c */
371char *dirname(char *s);
372
373/* div.c */
374div_t div(int numer, int denom);
375ldiv_t ldiv(long int numer, long int denom);
376
377/* drand48.c */
378double drand48(void);
379double erand48(unsigned short *xsubi);
380long krand48(unsigned short *xsubi, unsigned int m);
381long lrand48(void);
382long mrand48(void);
383void srand48(long seedval);
384unsigned short *seed48(unsigned short seed16v[3]);
385void lcong48(unsigned short param[7]);
386long nrand48(unsigned short *xsubi);
387long jrand48(unsigned short *xsubi);
388
389/* dup.c */
390int dup(int fildes);
391int dup2(int fildes, int fildes2);
392int dup3(int fildes, int fildes2, int flags);
393
394/* ecvt.c */
395char *ecvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
396	int *_RESTRICT_KYWDsign);
397char *fcvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
398	int *_RESTRICT_KYWD sign);
399
400/* err.c */
401void _errfp(FILE *, int, const char *, ...);
402void _verrfp(FILE *, int, const char *, va_list);
403void _errxfp(FILE *, int, const char *, ...);
404void _verrxfp(FILE *, int, const char *, va_list);
405void _warnfp(FILE *, const char *, ...);
406void _vwarnfp(FILE *, const char *, va_list);
407void _warnxfp(FILE *, const char *, ...);
408void _vwarnxfp(FILE *, const char *, va_list);
409
410/* errlst.c */
411
412/* euclen.c */
413int euccol(const unsigned char *s);
414int euclen(const unsigned char *s);
415int eucscol(const unsigned char *s);
416
417/* execvp.c */
418/* VARARGS1 */
419int execlp(const char *, const char *, ...);
420int execvp(const char *name, char *const *argv);
421
422/* fattach.c */
423int fattach(int fildes, const char *path);
424
425/* fdetach.c */
426int fdetach(const char *path);
427
428/* ffs.c */
429int ffs(int field);
430
431/* flock.c */
432int flock(int filedes, int operation);
433
434/* fmtmsg.c */
435int addseverity(int value, const char *string);
436int fmtmsg(long class, const char *label, int severity, const char *text,
437		const char *action, const char *tag);
438
439/* freezero.c */
440void freezero(void *, size_t);
441
442/* ftime.c */
443int ftime(struct timeb *tp);
444
445/* ftok.c */
446key_t ftok(const char *path, int id);
447
448/* gcvt.c */
449char *gcvt(double number, int ndigit, char *buf);
450
451/* getcwd.c */
452char *getcwd(char *str, size_t size);
453
454/* getdate.c */
455struct tm *getdate(const char *expression);
456#ifdef getdate_err
457#undef getdate_err
458#endif
459int getdate_err;
460
461/* getdate_data.c */
462
463/* getdate_gd.c */
464
465/* getdtblsize.c */
466int getdtablesize(void);
467
468/* getenv.c */
469char *getenv(const char *name);
470
471/* getexecname.c */
472const char *getexecname(void);
473
474/* getgrnam.c */
475struct group *getgrnam(const char *name);
476struct group *getgrgid(gid_t gid);
477struct group *fgetgrent_r(FILE *, struct group *, char *, int);
478struct group *getgrent_r(struct group *, char *, int);
479struct group *getgrgid_r(gid_t, struct group *, char *, int);
480struct group *getgrnam_r(const char *, struct group *, char *, int);
481
482/* gethostid.c */
483long gethostid(void);
484
485/* gethz.c */
486int gethz(void);
487
488/* getisax.c */
489uint_t getisax(uint32_t *, uint_t);
490
491/* getlogin.c */
492char *getloginx(void);
493char *getloginx_r(char *, int);
494#ifdef	getlogin
495#undef	getlogin
496#endif	/* getlogin */
497char *getlogin(void);
498#ifdef	getlogin_r
499#undef	getlogin_r
500#endif	/* getlogin_r */
501char *getlogin_r(char *, int);
502
503/* getmntent.c */
504int getmntany(FILE *fd, struct mnttab *mgetp, struct mnttab *mrefp);
505int getmntent(FILE *fd, struct mnttab *mp);
506
507/* getnetgrent.c */
508int setnetgrent(const char *grp);
509int endnetgrent(void);
510int getnetgrent(char **machinep, char **namep, char **domainp);
511
512/* getopt.c */
513int getopt(int argc, char *const *argv, const char *opts);
514
515/* getopt_long.c */
516int getopt_clip(int argc, char *const *argv, const char *optstring,
517		const struct option *long_options, int *long_index);
518int getopt_long(int argc, char *const *argv, const char *optstring,
519		const struct option *long_options, int *long_index);
520int getopt_long_only(int argc, char *const *argv, const char *optstring,
521		const struct option *long_options, int *long_index);
522
523/* getpagesize.c */
524int getpagesize(void);
525
526/* getpw.c */
527int getpw(uid_t uid, char *buf);
528
529/* getpwnam.c */
530struct passwd *getpwnam(const char *name);
531struct passwd *getpwuid(uid_t uid);
532struct passwd *fgetpwent_r(FILE *, struct passwd *, char *, int);
533struct passwd *getpwent_r(struct passwd *, char *, int);
534struct passwd *getpwnam_r(const char *, struct passwd *, char *, int);
535struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
536
537/* getrusage.c */
538int getrusage(int who, struct rusage *rusage);
539
540/* gettimeofday.c */
541int gettimeofday(struct timeval *_RESTRICT_KYWD tp, void *_RESTRICT_KYWD);
542
543/* getspent.c */
544void setspent(void);
545void endspent(void);
546struct spwd *getspent(void);
547struct spwd *getspent_r(struct spwd *, char *, int);
548struct spwd *fgetspent(FILE *f);
549struct spwd *fgetspent_r(FILE *, struct spwd *, char *, int);
550struct spwd *getspnam(const char *name);
551struct spwd *getspnam_r(const char *, struct spwd *, char *, int);
552int putspent(const struct spwd *p, FILE *f);
553
554/* getspent_r.c */
555int str2spwd(const char *, int, void *, char *, int);
556
557/* getsubopt.c */
558int getsubopt(char **optionsp, char *const *tokens, char **valuep);
559
560/* gettxt.c */
561char *gettxt(const char *msg_id, const char *dflt_str);
562
563/* getusershell.c */
564char *getusershell(void);
565void endusershell(void);
566void setusershell(void);
567
568/* getut.c */
569struct utmp *getutent(void);
570struct utmp *getutid(const struct utmp *entry);
571struct utmp *getutline(const struct utmp *entry);
572struct utmp *pututline(const struct utmp *entry);
573void setutent(void);
574void endutent(void);
575int utmpname(const char *newfile);
576void updwtmp(const char *file, struct utmp *ut);
577void getutmp(const struct utmpx *utx, struct utmp *ut);
578void getutmpx(const struct utmp *ut, struct utmpx *utx);
579struct utmp *makeut(struct utmp *utmp);
580
581/* getutx.c */
582struct utmpx *getutxent(void);
583struct utmpx *getutxid(const struct utmpx *entry);
584struct utmpx *getutxline(const struct utmpx *entry);
585struct utmpx *pututxline(const struct utmpx *entry);
586void setutxent(void);
587void endutxent(void);
588int utmpxname(const char *newfile);
589void updwtmpx(const char *filex, struct utmpx *utx);
590struct utmpx *makeutx(const struct utmpx *utmp);
591struct utmpx *modutx(const struct utmpx *utp);
592
593/* getvfsent.c */
594int getvfsspec(FILE *fd, struct vfstab *vp, char *special);
595int getvfsfile(FILE *fd, struct vfstab *vp, char *mountp);
596int getvfsany(FILE *fd, struct vfstab *vgetp, struct vfstab *vrefp);
597int getvfsent(FILE *fd, struct vfstab *vp);
598
599/* getwd.c */
600char *getwd(char *pathname);
601
602/* getwidth.c */
603void getwidth(eucwidth_t *eucstruct);
604
605/* hsearch.c */
606int hcreate(size_t size);
607void hdestroy(void);
608ENTRY *hsearch(ENTRY item, ACTION action);
609
610/* iconv.c  */
611size_t iconv(iconv_t cd, const char **_RESTRICT_KYWD inbuf,
612    size_t *_RESTRICT_KYWD inbytesleft, char **_RESTRICT_KYWD outbuf,
613    size_t *_RESTRICT_KYWD outbytesleft);
614int iconv_close(iconv_t cd);
615iconv_t iconv_open(const char *tocode, const char *fromcode);
616
617/* imaxabs.c */
618intmax_t imaxabs(intmax_t j);
619
620/* imaxdiv.c */
621imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
622
623/* index.c */
624char *index(const char *sp, int c);
625
626/* initgroups.c */
627int initgroups(const char *uname, gid_t agroup);
628
629/* innetgr.c */
630int innetgr(const char *group, const char *machine, const char *name,
631    const char *domain);
632
633/* insque.c */
634void insque(void *elem, void *pred);
635void remque(void *elem);
636
637/* isaexec.c */
638int isaexec(const char *, char *const *, char *const *);
639
640/* isastream.c */
641int isastream(int fd);
642
643/* isatty.c */
644int isatty(int f);
645
646/* killpg.c */
647int killpg(pid_t pgrp, int sig);
648
649/* l64a.c */
650char *l64a(long lg);
651
652/* lckpwdf.c */
653int lckpwdf(void);
654int ulckpwdf(void);
655
656/* lfind.c */
657void * lfind(const void *ky, const void *bs, size_t *nelp,
658		size_t width, int (*compar)());
659
660/* localeconv.c */
661struct lconv *localeconv(void);
662
663/* lsearch.c */
664void * lsearch(const void *ky, void *bs, size_t *nelp,
665		size_t width, int (*compar)());
666
667/* madvise.c */
668int madvise(caddr_t addr, size_t len, int advice);
669
670/* malloc.c */
671void *malloc(size_t size);
672void *realloc(void *old, size_t size);
673void free(void *old);
674
675/* mbstowcs.c */
676size_t mbstowcs(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s,
677	size_t n);
678
679/* mbtowc.c */
680int mbtowc(wchar_t *_RESTRICT_KYWD wchar, const char *_RESTRICT_KYWD s,
681	size_t n);
682int mblen(const char *s, size_t n);
683
684/* memalign.c */
685void *memalign(size_t align, size_t nbytes);
686
687/* memccpy.c */
688void *memccpy(void *_RESTRICT_KYWDs, const void *_RESTRICT_KYWD s0, int c,
689	size_t n);
690
691/* memchr.c */
692void *memchr(const void *sptr, int c1, size_t n);
693
694/* memcmp.c */
695int memcmp(const void *s1, const void *s2, size_t n);
696
697/* memcpy.c */
698void *memcpy(void *_RESTRICT_KYWD s, const void *_RESTRICT_KYWD s0, size_t n);
699
700/* memmove.c */
701void *memmove(void *s, const void *s0, size_t n);
702
703/* memset.c */
704void *memset(void *sp1, int c, size_t n);
705
706/* mkdev.c */
707dev_t __makedev(const int version, const major_t majdev,
708		const minor_t mindev);
709major_t __major(const int version, const dev_t devnum);
710minor_t __minor(const int version, const dev_t devnum);
711
712/* mkfifo.c */
713int mkfifo(const char *path, mode_t mode);
714
715/* mktemp.c */
716char *mktemp(char *as);
717
718/* mlock.c */
719int mlock(caddr_t addr, size_t len);
720
721/* mlockall.c */
722int mlockall(int flags);
723
724/* mon.c */
725void monitor(int (*alowpc)(), int (*ahighpc)(), WORD *buffer,
726		size_t bufsize, size_t nfunc);
727
728/* msync.c */
729int msync(caddr_t addr, size_t len, int flags);
730
731/* munlock.c */
732int munlock(caddr_t addr, size_t len);
733
734/* munlockall.c */
735int munlockall(void);
736
737/* ndbm.c */
738void dbm_setdefwrite(DBM *db);
739int dbm_flush(DBM *db);
740int dbm_flushpag(DBM *db);
741DBM *dbm_open(const char *file, int flags, mode_t mode);
742void dbm_close(DBM *db);
743int dbm_close_status(DBM *db);
744datum dbm_fetch(DBM *db, datum key);
745int dbm_delete(DBM *db, datum key);
746int dbm_store(DBM *db, datum key, datum dat, int replace);
747datum dbm_firstkey(DBM *db);
748datum dbm_nextkey(DBM *db);
749datum dbm_do_nextkey(DBM *db, datum inkey);
750
751/* new_list.c */
752
753/* nftw.c */
754int nftw(const char *path, int (*fn)(), int depth, int flags);
755
756/* nl_langinfo.c */
757char *nl_langinfo(nl_item item);
758
759/* opendir.c */
760DIR *opendir(const char *filename);
761
762/* opt_data.c */
763
764/* perror.c */
765void perror(const char *s);
766
767/* pipe.c */
768int pipe(int *fds);
769
770/* psiginfo.c */
771void psiginfo(const siginfo_t *sip, const char *s);
772
773/* psignal.c */
774void psignal(int sig, const char *s);
775
776/* pt.c */
777char *ptsname(int fd);
778int unlockpt(int fd);
779int grantpt(int fd);
780
781/* putenv.c */
782int putenv(char *change);
783int setenv(const char *envname, const char *envval, int overwrite);
784int unsetenv(const char *name);
785
786/* putpwent.c */
787int putpwent(const struct passwd *p, FILE *f);
788
789/* qsort.c */
790void qsort(void *base, size_t n, size_t size, int (*compar)());
791
792/* raise.c */
793int raise(int sig);
794
795/* rand.c */
796void srand(unsigned x);
797int rand(void);
798int rand_r(unsigned int *);
799
800/* random.c */
801void srandom(unsigned x);
802char *initstate(unsigned seed, char *arg_state, size_t n);
803char *setstate(const char *arg_state);
804long random(void);
805
806/* rctlops.c */
807int rctl_walk(int (*callback)(const char *, void *), void *walk_data);
808hrtime_t rctlblk_get_firing_time(rctlblk_t *rblk);
809uint_t rctlblk_get_global_action(rctlblk_t *rblk);
810uint_t rctlblk_get_global_flags(rctlblk_t *rblk);
811uint_t rctlblk_get_local_action(rctlblk_t *rblk, int *signalp);
812uint_t rctlblk_get_local_flags(rctlblk_t *rblk);
813id_t rctlblk_get_recipient_pid(rctlblk_t *rblk);
814rctl_priv_t rctlblk_get_privilege(rctlblk_t *rblk);
815rctl_qty_t rctlblk_get_value(rctlblk_t *rblk);
816void rctlblk_set_local_action(rctlblk_t *rblk, uint_t action, int signal);
817void rctlblk_set_local_flags(rctlblk_t *rblk, uint_t flags);
818void rctlblk_set_privilege(rctlblk_t *rblk, rctl_priv_t priv);
819void rctlblk_set_value(rctlblk_t *rblk, rctl_qty_t val);
820size_t rctlblk_size(void);
821
822/* readdir.c */
823struct dirent *readdir(DIR *dirp);
824
825/* recallocarray.c */
826void *recallocarray(void *, size_t, size_t, size_t);
827
828/* realpath.c */
829char *realpath(const char *_RESTRICT_KYWD raw, char *_RESTRICT_KYWD canon);
830
831/* regexpr.c */
832char *re_comp(const char *sp);
833int re_exec(const char *p1);
834
835/* rindex.c */
836char *rindex(const char *sp, int c);
837
838/* rename.c */
839int remove(const char *filename);
840int rename(const char *old, const char *new);
841
842/* rewinddir.c */
843#undef rewinddir
844void rewinddir(DIR *dirp);
845
846/* scandir.c */
847int alphasort(const struct dirent **, const struct dirent **);
848int scandir(const char *dirname, struct dirent *(*namelist[]),
849	int (*select)(const struct dirent *),
850	int (*dcomp)(const struct dirent **, const struct dirent **));
851
852/* scrwidth.c */
853int scrwidth(wchar_t c);
854
855/* seekdir.c */
856void seekdir(DIR *dirp, long loc);
857
858/* select.c */
859int pselect(int nfds,
860	fd_set *_RESTRICT_KYWD readfds,
861	fd_set *_RESTRICT_KYWD writefds,
862	fd_set *_RESTRICT_KYWD errorfds,
863	const struct timespec *_RESTRICT_KYWD timeout,
864	const sigset_t *_RESTRICT_KYWD sigmask);
865int select(int nfds,
866	fd_set *_RESTRICT_KYWD readfds,
867	fd_set *_RESTRICT_KYWD writefds,
868	fd_set *_RESTRICT_KYWD errorfds,
869	struct timeval *_RESTRICT_KYWD timeout);
870
871/* setlocale.c */
872char *setlocale(int cat, const char *loc);
873
874/* setpriority.c */
875int getpriority(int which, id_t who);
876int setpriority(int which, id_t who, int prio);
877
878/* settimeofday.c */
879int settimeofday(struct timeval *tp, void *);
880
881/* sigflag.c */
882int sigflag(int sig, int flag, int on);
883
884/* siglist.c */
885
886/* sigsend.c */
887int sigsend(idtype_t idtype, id_t id, int sig);
888
889/* sigsetops.c */
890int sigfillset(sigset_t *set);
891int sigemptyset(sigset_t *set);
892int sigaddset(sigset_t *set, int sig);
893int sigdelset(sigset_t *set, int sig);
894int sigismember(const sigset_t *set, int sig);
895
896/* scalls.c */
897unsigned sleep(unsigned sleep_tm);
898
899/* ssignal.c */
900int (*ssignal(int sig, int (*fn)())) ();
901int gsignal(int sig);
902
903/* str2id.c */
904
905/* str2sig.c */
906int str2sig(const char *s, int *sigp);
907int sig2str(int i, char *s);
908
909/* strcat.c */
910char *strcat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
911
912/* strchr.c */
913char *strchr(const char *sp, int c);
914
915/* strcmp.c */
916int strcmp(const char *s1, const char *s2);
917
918/* strcpy.c */
919char *strcpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
920
921/* strcspn.c */
922size_t strcspn(const char *string, const char *charset);
923
924/* strdup.c */
925char *strdup(const char *s1);
926
927/* strerror.c */
928char *strerror(int errnum);
929int strerror_r(int errnum, char *strerrbuf, size_t buflen);
930
931/* strftime.c */
932size_t strftime(char *_RESTRICT_KYWD s, size_t maxsize,
933		const char *_RESTRICT_KYWD format,
934		const struct tm *_RESTRICT_KYWD tm);
935
936/* strlen.c */
937size_t strlen(const char *s);
938
939/* strncat.c */
940char *strncat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
941
942/* strncmp.c */
943int strncmp(const char *s1, const char *s2, size_t n);
944
945/* strncpy.c */
946char *strncpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
947
948/* strpbrk.c */
949char *strpbrk(const char *string, const char *brkset);
950
951/* strrchr.c */
952char *strrchr(const char *sp, int c);
953
954/* strsep.c */
955char *strsep(char **stringp, const char *delim);
956
957/* strspn.c */
958size_t strspn(const char *string, const char *charset);
959
960/* strstr.c */
961char *strstr(const char *as1, const char *as2);
962
963/* strtod.c */
964double strtod(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
965float strtof(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
966long double strtold(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
967
968/* strtoimax.c */
969intmax_t strtoimax(const char *_RESTRICT_KYWD nptr,
970	char **_RESTRICT_KYWD endptr, int base);
971
972/* strtok.c */
973char *strtok(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD sepset);
974char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
975	char **_RESTRICT_KYWD);
976
977/* strtol.c */
978long strtol(const char *_RESTRICT_KYWD str, char **_RESTRICT_KYWD nptr,
979	int base);
980
981/* strtoul.c */
982unsigned long strtoul(const char *_RESTRICT_KYWD str,
983	char **_RESTRICT_KYWD nptr, int base);
984
985/* strtoumax.c */
986uintmax_t strtoumax(const char *_RESTRICT_KYWD nptr,
987		    char **_RESTRICT_KYWD endptr, int base);
988
989/* strxfrm.c */
990size_t strxfrm(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2,
991	size_t n);
992int strcoll(const char *s1, const char *s2);
993
994/* swab.c */
995void swab(const char *_RESTRICT_KYWD from, char *_RESTRICT_KYWD to, ssize_t n);
996
997/* swapctl.c */
998int swapctl(int cmd, void *arg);
999
1000/* sysconf.c */
1001long sysconf(int name);
1002
1003/* syslog.c */
1004/* VARARGS2 */
1005void syslog(int pri, const char *fmt, ...);
1006void vsyslog(int pri, const char *fmt, va_list ap);
1007void openlog(const char *ident, int logstat, int logfac);
1008void closelog(void);
1009int setlogmask(int pmask);
1010
1011/* tcdrain.c */
1012int tcdrain(int fildes);
1013
1014/* tcflow.c */
1015int tcflow(int fildes, int action);
1016
1017/* tcflush.c */
1018int tcflush(int fildes, int queue_selector);
1019
1020/* tcgetattr.c */
1021int tcgetattr(int fildes, struct termios *termios_p);
1022
1023/* tcgetpgrp.c */
1024pid_t tcgetpgrp(int fd);
1025
1026/* tcgetsid.c */
1027pid_t tcgetsid(int fd);
1028
1029/* tcsendbreak.c */
1030int tcsendbreak(int fildes, int duration);
1031
1032/* tcsetattr.c */
1033int tcsetattr(int fildes, int optional_actions,
1034	const struct termios *termios_p);
1035
1036/* tcsetpgrp.c */
1037int tcsetpgrp(int fd, pid_t pgrp);
1038
1039/* tell.c */
1040long tell(int f);
1041
1042/* telldir.c */
1043long telldir(DIR *dirp);
1044
1045/* tfind.c */
1046void *tfind(const void *ky, void *const *rtp, int (*compar)());
1047
1048/* time_comm.c */
1049struct tm *localtime(const time_t *timep);
1050struct tm *localtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1051struct tm *gmtime(const time_t *clock);
1052struct tm *gmtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1053double difftime(time_t time1, time_t time0);
1054time_t mktime(struct tm *timeptr);
1055void _ltzset(time_t tim);
1056void tzset(void);
1057
1058/* time_data.c */
1059
1060/* time_gdata.c */
1061
1062/* tolower.c */
1063int tolower(int c);
1064
1065/* toupper.c */
1066int toupper(int c);
1067
1068/* truncate.c */
1069int ftruncate(int fildes, off_t len);
1070int truncate(const char *path, off_t len);
1071
1072/* tsearch.c */
1073void *tsearch(const void *ky, void **rtp, int (*compar)());
1074void *tdelete(const void *ky, void **rtp, int (*compar)());
1075void twalk(const void *rt, void (*action)());
1076
1077/* ttyname.c */
1078char *ttyname(int f);
1079char *_ttyname_dev(dev_t rdev, char *buffer, size_t buflen);
1080char *ttyname_r(int, char *, int);
1081
1082/* ttyslot.c */
1083int ttyslot(void);
1084
1085/* ualarm.c */
1086unsigned ualarm(unsigned usecs, unsigned reload);
1087
1088/* ulimit.c */
1089/* VARARGS1 */
1090long ulimit(int cmd, ...);
1091
1092/* scalls.c */
1093int usleep(unsigned n);
1094
1095/* valloc.c */
1096void *valloc(size_t size);
1097
1098/* waitpid.c */
1099pid_t wait(int *stat_loc);
1100pid_t waitpid(pid_t pid, int *stat_loc, int options);
1101pid_t wait3(int *status, int options, struct rusage *rp);
1102pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
1103
1104/* wcstombs.c */
1105size_t wcstombs(char *_RESTRICT_KYWD s, const wchar_t *_RESTRICT_KYWD pwcs,
1106	size_t n);
1107
1108/* wctomb.c */
1109int wctomb(char *s, wchar_t wchar);
1110
1111/* wdata.c */
1112
1113/* wisprint.c */
1114int wisprint(wchar_t c);
1115
1116/* xgetwidth.c */
1117void _xgetwidth(void);
1118
1119/*
1120 * /usr/src/lib/libc/port/intl routines
1121 */
1122
1123/* gettext.c */
1124char *bindtextdomain(const char *domain, const char *binding);
1125char *dcgettext(const char *domain, const char *msg_id, const int category);
1126char *dgettext(const char *domain, const char *msg_id);
1127char *gettext(const char *msg_id);
1128char *textdomain(const char *domain);
1129
1130/*
1131 * /usr/src/lib/libc/port/print routines
1132 */
1133
1134/* fprintf.c */
1135/* VARARGS2 */
1136int fprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format, ...);
1137
1138/* printf.c */
1139/* VARARGS1 */
1140int printf(const char *_RESTRICT_KYWD format, ...);
1141
1142/* snprintf.c */
1143/* VARARGS2 */
1144int snprintf(char *_RESTRICT_KYWD string, size_t n,
1145		const char *_RESTRICT_KYWD format, ...);
1146
1147/* sprintf.c */
1148/* VARARGS2 */
1149int sprintf(char *_RESTRICT_KYWD string,
1150		const char *_RESTRICT_KYWD format, ...);
1151
1152/* vfprintf.c */
1153/* VARARGS2 */
1154int vfprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format,
1155		va_list);
1156
1157/* vprintf.c */
1158/* VARARGS1 */
1159int vprintf(const char *_RESTRICT_KYWD format, va_list);
1160
1161/* vsnprintf.c */
1162/* VARARGS2 */
1163int vsnprintf(char *_RESTRICT_KYWD string, size_t n,
1164		const char *_RESTRICT_KYWD format, va_list);
1165
1166/* vsprintf.c */
1167/* VARARGS2 */
1168int vsprintf(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD format,
1169	va_list);
1170
1171/*
1172 * /usr/src/lib/libc/port/regex routines
1173 */
1174
1175/* glob.c */
1176extern int glob(const char *restrict pattern, int flags,
1177    int(*errfunc)(const char *epath, int eerrno), glob_t *restrict pglob);
1178extern void globfree(glob_t *pglob);
1179
1180/* regex.c */
1181char *regex(const char *regexp, const char *stringp, ...);
1182#ifdef __loc1
1183#undef __loc1
1184#endif
1185char *__loc1;
1186
1187/* regcmp.c */
1188char *regcmp(const char *regexp, ...);
1189#ifdef __i_size
1190#undef __i_size
1191#endif
1192int __i_size;
1193
1194/*
1195 * /usr/src/lib/libc/port/stdio routines
1196 */
1197
1198/* _filbuf.c */
1199int _filbuf(FILE *iop);
1200
1201/* _flsbuf.c */
1202int _flsbuf(int ch, FILE *iop);
1203
1204/* _wrtchk.c */
1205int _wrtchk(FILE *iop);
1206
1207/* clearerr.c */
1208void clearerr(FILE *iop);
1209
1210/* ctermid.c */
1211char *ctermid(char *s);
1212char *ctermid_r(char *s);
1213
1214/* cuserid.c */
1215char *cuserid(char *s);
1216
1217/* data.c */
1218
1219/* doscan.c */
1220int _doscan(FILE *iop, const char *fmt, va_list va_alist);
1221
1222/* fdopen.c */
1223FILE *fdopen(int fd, const char *type);
1224
1225/* feof.c */
1226int feof(FILE *iop);
1227
1228/* ferror.c */
1229int ferror(FILE *iop);
1230
1231/* fgetc.c */
1232int fgetc(FILE *iop);
1233
1234/* fgets.c */
1235char *fgets(char *_RESTRICT_KYWD buf, int size, FILE *_RESTRICT_KYWD iop);
1236
1237/* fileno.c */
1238int _fileno(FILE *iop);
1239
1240/* flush.c */
1241void _cleanup(void);
1242FILE *_findiop(void);
1243typedef unsigned char Uchar;
1244void _setbufend(FILE *iop, Uchar *end);
1245Uchar *_realbufend(FILE *iop);
1246void _bufsync(FILE *iop, Uchar *bufend);
1247int _xflsbuf(FILE *iop);
1248int fflush(FILE *iop);
1249int fclose(FILE *iop);
1250
1251/* fopen.c */
1252FILE *fopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type);
1253FILE *freopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type,
1254		FILE *_RESTRICT_KYWD iop);
1255
1256/* fpos.c */
1257int fgetpos(FILE *_RESTRICT_KYWD stream, fpos_t *_RESTRICT_KYWD pos);
1258int fsetpos(FILE *stream, const fpos_t *pos);
1259
1260/* fputc.c */
1261int fputc(int ch, FILE *iop);
1262
1263/* fputs.c */
1264int fputs(const char *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1265
1266/* fread.c */
1267size_t fread(void *_RESTRICT_KYWD ptr, size_t size, size_t count,
1268	FILE *_RESTRICT_KYWD iop);
1269
1270/* fseek.c */
1271int fseek(FILE *iop, long offset, int ptrname);
1272
1273/* ftell.c */
1274long ftell(FILE *iop);
1275
1276/* fwrite.c */
1277size_t fwrite(const void *_RESTRICT_KYWD ptr1, size_t size, size_t count,
1278	FILE *_RESTRICT_KYWD iop);
1279
1280/* getc.c */
1281int getc(FILE *iop);
1282
1283/* getchar.c */
1284int getchar(void);
1285
1286/* getpass.c */
1287char *getpass(const char *prompt);
1288
1289/* getpass.c */
1290char *getpassphrase(const char *prompt);
1291
1292/* gets.c */
1293char *gets(char *buf);
1294
1295/* getw.c */
1296int getw(FILE *stream);
1297
1298/* popen.c */
1299FILE *popen(const char *cmd, const char *mode);
1300int pclose(FILE *ptr);
1301
1302/* putc.c */
1303int putc(int ch, FILE *iop);
1304
1305/* putchar.c */
1306int putchar(int ch);
1307
1308/* puts.c */
1309int puts(const char *ptr);
1310
1311/* putw.c */
1312int putw(int w, FILE *stream);
1313
1314/* rewind.c */
1315void rewind(FILE *iop);
1316
1317/* scanf.c */
1318/* VARARGS1 */
1319int scanf(const char *_RESTRICT_KYWD fmt, ...);
1320
1321/* VARARGS2 */
1322int fscanf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD fmt, ...);
1323
1324/* VARARGS2 */
1325int sscanf(const char *_RESTRICT_KYWD str, const char *_RESTRICT_KYWD fmt, ...);
1326
1327/* setbuf.c */
1328void setbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf);
1329
1330/* setvbuf.c */
1331int setvbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf, int type,
1332		size_t size);
1333
1334/* system.c */
1335int system(const char *s);
1336
1337/* tempnam.c */
1338char *tempnam(const char *dir, const char *pfx);
1339
1340/* tmpfile.c */
1341FILE *tmpfile(void);
1342
1343/* tmpnam.c */
1344char *tmpnam(char *s);
1345char *tmpnam_r(char *);
1346
1347/* ungetc.c */
1348int ungetc(int c, FILE *iop);
1349
1350/*
1351 * /usr/src/lib/libc/port/sys routines
1352 */
1353
1354/* exacctsys.c */
1355size_t getacct(idtype_t idtype, id_t id, void *buf, size_t bufsize);
1356int putacct(idtype_t idtype, id_t id, void *buf, size_t bufsize, int flags);
1357int wracct(idtype_t idtype, id_t id, int flags);
1358
1359/* execl.c */
1360/* VARARGS1 */
1361int execl(const char *name, const char *, ...);
1362
1363/* execle.c */
1364int execle(const char *, const char *file, ...);
1365
1366/* execv.c */
1367int execv(const char *file, char *const *argv);
1368
1369/* lockf.c */
1370int lockf(int fildes, int function, off_t size);
1371
1372/* meminfosys.c */
1373int meminfo(const uint64_t *inaddr, int addr_count, const uint_t *info_req,
1374	int info_count, uint64_t *outdata, uint_t *validity);
1375
1376/* msgsys.c */
1377int msgget(key_t key, int msgflg);
1378int msgctl(int msqid, int cmd, struct msqid_ds *buf);
1379ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
1380int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
1381
1382/* nfssys.c */
1383/*
1384int exportfs(char *dir, struct export *ep);
1385int nfs_getfh(char *path, fhandle_t *fhp);
1386int nfssvc(int fd);
1387*/
1388
1389/* psetsys.c */
1390int pset_create(psetid_t *npset);
1391int pset_destroy(psetid_t pset);
1392int pset_assign(psetid_t pset, processorid_t cpu, psetid_t *opset);
1393int pset_assign_forced(psetid_t pset, processorid_t cpu, psetid_t *opset);
1394int pset_info(psetid_t pset, int *type, u_int *numcpus, processorid_t *cpulist);
1395int pset_bind(psetid_t pset, idtype_t idtype, id_t id, psetid_t *opset);
1396int pset_bind_lwp(psetid_t pset, id_t id, pid_t, psetid_t *opset);
1397
1398
1399/* rctlsys.c */
1400int getrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1401    int flags);
1402int setrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1403    int flags);
1404/* (private functions) */
1405int setprojrctl(const char *name, rctlblk_t *new_rblk, size_t size, int flags);
1406int rctlctl(const char *, rctlblk_t *, int);
1407size_t rctllist(char *, size_t);
1408
1409
1410/* semsys.c */
1411int semctl(int semid, int semnum, int cmd, ...);
1412int semget(key_t key, int nsems, int semflg);
1413int semop(int semid, struct sembuf *sops, size_t nsops);
1414
1415/* shmsys.c */
1416void *shmat(int shmid, const void *shmaddr, int shmflg);
1417int shmctl(int shmid, int cmd, struct shmid_ds *buf);
1418#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)
1419int shmdt(const void *);
1420#else
1421int shmdt(char *);
1422#endif /* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4) */
1423int shmget(key_t key, size_t size, int shmflg);
1424
1425/* tasksys.c */
1426taskid_t settaskid(projid_t project, uint_t flags);
1427taskid_t gettaskid(void);
1428projid_t getprojid(void);
1429
1430/*
1431 * /usr/src/lib/libc/port/widec routines
1432 */
1433
1434/* fgetws.c */
1435wchar_t *fgetws(wchar_t *_RESTRICT_KYWD ptr, int  size,
1436	FILE *_RESTRICT_KYWD iop);
1437
1438/* fputwc.c */
1439wint_t fputwc(wint_t wc, FILE *iop);
1440wint_t putwc(wint_t wc, FILE *iop);
1441
1442/* fputws.c */
1443int fputws(const wchar_t *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1444
1445/* getwchar.c */
1446wint_t getwchar(void);
1447
1448/* getwidth.c */
1449void getwidth(eucwidth_t *eucstruct);
1450
1451/* getws.c */
1452wchar_t *getws(wchar_t *ptr);
1453
1454/* iswctype.c */
1455int iswctype(wint_t wc, wctype_t charclass);
1456int iswalpha(wint_t c);
1457int iswupper(wint_t c);
1458int iswlower(wint_t c);
1459int iswdigit(wint_t c);
1460int iswxdigit(wint_t c);
1461int iswalnum(wint_t c);
1462int iswspace(wint_t c);
1463int iswpunct(wint_t c);
1464int iswprint(wint_t c);
1465int iswgraph(wint_t c);
1466int iswcntrl(wint_t c);
1467int isphonogram(wint_t c);
1468int isideogram(wint_t c);
1469int isenglish(wint_t c);
1470int isnumber(wint_t c);
1471int isspecial(wint_t c);
1472
1473/* libwcollate.c */
1474
1475/* putwchar.c */
1476wint_t putwchar(wint_t c);
1477
1478/* putws.c */
1479int putws(const wchar_t *ptr);
1480
1481/* scrwidth.c */
1482
1483/* strtows.c */
1484wchar_t *strtows(wchar_t *s1, char *s2);
1485char *wstostr(char *s1, wchar_t *s2);
1486
1487/* trwctype.c */
1488wint_t towupper(wint_t c);
1489wint_t towlower(wint_t c);
1490
1491/* ungetwc.c */
1492wint_t ungetwc(wint_t wc, FILE *iop);
1493
1494/* wcollate.c */
1495size_t wcsxfrm(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1496	size_t n);
1497int wcscoll(const wchar_t *s1, const wchar_t *s2);
1498
1499/* wcsftime.c */
1500#if !defined(__amd64) 		/* XX64 - fix me */
1501size_t wcsftime(wchar_t *wcs, size_t maxsize,
1502	const char *format, const struct tm *timeptr);
1503#endif	/* __amd64 */
1504
1505/* wcstring.c */
1506wint_t fgetwc(FILE *iop);
1507wint_t getwc(FILE *iop);
1508int wcwidth(wchar_t wc);
1509int wcswidth(const wchar_t *pwcs, size_t n);
1510
1511/* wcswcs.c */
1512wchar_t *wcswcs(const wchar_t *ws1, const wchar_t *ws2);
1513
1514/* wcsxfrm.c - empty file! */
1515
1516/* wcsxfrm.xpg4.c */
1517
1518/* wisprint.c */
1519int wisprint(wchar_t c);
1520
1521/* wscasecmp.c */
1522int wscasecmp(const wchar_t *s1, const wchar_t *s2);
1523
1524/* wscat.c */
1525wchar_t *wcscat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1526wchar_t *wscat(wchar_t *s1, const wchar_t *s2);
1527
1528/* wschr.c */
1529wchar_t *wcschr(const wchar_t *sp, wchar_t c);
1530wchar_t *wschr(const wchar_t *sp, wchar_t c);
1531
1532/* wscmp.c */
1533int wcscmp(const wchar_t *s1, const wchar_t *s2);
1534int wscmp(const wchar_t *s1, const wchar_t *s2);
1535
1536/* wscol.c */
1537int wscol(const wchar_t *s1);
1538
1539/* wscpy.c */
1540wchar_t *wcscpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1541wchar_t *wscpy(wchar_t *s1, const wchar_t *s2);
1542
1543/* wscspn.c */
1544size_t wcscspn(const wchar_t *string, const wchar_t *charset);
1545size_t wscspn(const wchar_t *string, const wchar_t *charset);
1546
1547/* wsdup.c */
1548wchar_t *wsdup(const wchar_t *s1);
1549
1550/* wslen.c */
1551size_t wcslen(const wchar_t *s);
1552size_t wslen(const wchar_t *s);
1553
1554/* wsncasecmp.c */
1555int wsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1556
1557/* wsncat.c */
1558wchar_t *wcsncat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1559	size_t n);
1560wchar_t *wsncat(wchar_t *s1, const wchar_t *s2, size_t n);
1561
1562/* wsncmp.c */
1563int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1564int wsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1565
1566/* wsncpy.c */
1567wchar_t *wcsncpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1568	size_t n);
1569wchar_t *wsncpy(wchar_t *s1, const wchar_t *s2, size_t n);
1570
1571/* wspbrk.c */
1572wchar_t *wcspbrk(const wchar_t *string, const wchar_t *brkset);
1573wchar_t *wspbrk(const wchar_t *string, const wchar_t *brkset);
1574
1575/* wsprintf.c */
1576int wsprintf(wchar_t *wstring, const char *format, ...);
1577
1578/* wsrchr.c */
1579wchar_t *wcsrchr(const wchar_t *sp, wchar_t c);
1580wchar_t *wsrchr(const wchar_t *sp, wchar_t c);
1581
1582/* wsscanf.c */
1583int wsscanf(wchar_t *s, const char *format, ...);
1584
1585/* wssize.c */
1586
1587/* wsspn.c */
1588size_t wcsspn(const wchar_t *string, const wchar_t *charset);
1589size_t wsspn(const wchar_t *string, const wchar_t *charset);
1590
1591/* wstod.c */
1592double wcstod(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1593float wcstof(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1594long double wcstold(const wchar_t *_RESTRICT_KYWD cp,
1595	wchar_t **_RESTRICT_KYWD ptr);
1596double wstod(const wchar_t *cp, wchar_t **ptr);
1597
1598/* wstok.c */
1599#if !defined(__amd64) 		/* XX64 - fix me */
1600wchar_t *wcstok(wchar_t *string, const wchar_t *sepset);
1601wchar_t *wstok(wchar_t *string, const wchar_t *sepset);
1602#endif	/* __amd64 */
1603
1604/* wcstol.c */
1605long wcstol(const wchar_t *_RESTRICT_KYWD str, wchar_t **_RESTRICT_KYWD ptr,
1606	int base);
1607long long wcstoll(const wchar_t *_RESTRICT_KYWD str,
1608	wchar_t **_RESTRICT_KYWD ptr, int base);
1609
1610/* wcstoul.c */
1611unsigned long wcstoul(const wchar_t *_RESTRICT_KYWD str,
1612	wchar_t **_RESTRICT_KYWD ptr, int base);
1613unsigned long long wcstoull(const wchar_t *_RESTRICT_KYWD str,
1614	wchar_t **_RESTRICT_KYWD ptr, int base);
1615
1616/* wcstoimax.c */
1617intmax_t wcstoimax(const wchar_t *_RESTRICT_KYWD nptr,
1618	wchar_t **_RESTRICT_KYWD endptr, int base);
1619uintmax_t wcstoumax(const wchar_t *_RESTRICT_KYWD nptr,
1620	wchar_t **_RESTRICT_KYWD endptr, int base);
1621
1622/* wstol.c */
1623long wstol(const wchar_t *str, wchar_t **ptr, int base);
1624
1625/* wstoll.c */
1626long long wstoll(const wchar_t *str, wchar_t **ptr, int base);
1627long long watoll(const wchar_t *p);
1628
1629/* wsxfrm.c */
1630size_t wsxfrm(wchar_t *s1, const wchar_t *s2, size_t n);
1631int wscoll(const wchar_t *s1, const wchar_t *s2);
1632
1633/*
1634 * /usr/src/lib/libc/port/gen/event_port.c
1635 */
1636int port_dispatch(int port, int flags, int source, int events, uintptr_t object,
1637    void *user);
1638
1639/*
1640 * /usr/src/lib/libc/$MACH/gen routines
1641 */
1642
1643/* alloca.s */
1644
1645void *__builtin_alloca(size_t);
1646
1647/*
1648 * modctl(int arg, ...) and utssys(...) are not available from a header
1649 * file, but our utilities which make use of it should be able to be
1650 * lint clean.
1651 */
1652int modctl(int arg, ...);
1653int utssys(void *buf, int arg, int type, void *outbp);
1654
1655
1656typedef float single;
1657typedef unsigned extended[3];
1658typedef long double quadruple;
1659typedef unsigned fp_exception_field_type;
1660
1661typedef char decimal_string[512];
1662
1663enum fp_class_type {
1664	fp_zero	 = 0,
1665	fp_subnormal    = 1,
1666	fp_normal	= 2,
1667	fp_infinity	= 3,
1668	fp_quiet	= 4,
1669	fp_signaling    = 5
1670};
1671
1672enum fp_direction_type {
1673	fp_nearest	= 0,
1674	fp_tozero	= 1,
1675	fp_positive	= 2,
1676	fp_negative	= 3
1677};
1678
1679typedef struct {
1680	enum fp_class_type fpclass;
1681	int sign;
1682	int exponent;
1683	decimal_string ds;
1684	int more;
1685	int ndigits;
1686} decimal_record;
1687
1688enum decimal_form {
1689	fixed_form,
1690	floating_form
1691};
1692
1693typedef struct {
1694	enum fp_direction_type rd;
1695	enum decimal_form df;
1696	int ndigits;
1697} decimal_mode;
1698
1699enum decimal_string_form {
1700	invalid_form,
1701	whitespace_form,
1702	fixed_int_form,
1703	fixed_intdot_form,
1704	fixed_dotfrac_form,
1705	fixed_intdotfrac_form,
1706	floating_int_form,
1707	floating_intdot_form,
1708	floating_dotfrac_form,
1709	floating_intdotfrac_form,
1710	inf_form,
1711	infinity_form,
1712	nan_form,
1713	nanstring_form
1714};
1715
1716typedef int sigfpe_code_type;
1717
1718typedef void (*sigfpe_handler_type)();
1719
1720extern sigfpe_handler_type sigfpe(sigfpe_code_type, sigfpe_handler_type);
1721
1722extern void single_to_decimal(single *, decimal_mode *, decimal_record *,
1723				fp_exception_field_type *);
1724
1725extern void double_to_decimal(double *, decimal_mode *, decimal_record *,
1726				fp_exception_field_type *);
1727extern void extended_to_decimal(extended *, decimal_mode *,
1728				decimal_record *, fp_exception_field_type *);
1729extern void quadruple_to_decimal(quadruple *, decimal_mode *,
1730				decimal_record *, fp_exception_field_type *);
1731extern void decimal_to_single(single *, decimal_mode *, decimal_record *,
1732				fp_exception_field_type *);
1733extern void decimal_to_double(double *, decimal_mode *, decimal_record *,
1734				fp_exception_field_type *);
1735extern void decimal_to_extended(extended *, decimal_mode *,
1736				decimal_record *, fp_exception_field_type *);
1737extern void decimal_to_quadruple(quadruple *, decimal_mode *,
1738				decimal_record *, fp_exception_field_type *);
1739extern void string_to_decimal(char **, int, int, decimal_record *,
1740				enum decimal_string_form *, char **);
1741extern void func_to_decimal(char **, int, int, decimal_record *,
1742				enum decimal_string_form *, char **,
1743				int (*)(void), int *, int (*)(int));
1744extern void file_to_decimal(char **, int, int, decimal_record *,
1745				enum decimal_string_form *, char **,
1746				FILE *, int *);
1747extern char *seconvert(single *, int, int *, int *, char *);
1748extern char *sfconvert(single *, int, int *, int *, char *);
1749extern char *sgconvert(single *, int, int, char *);
1750extern char *econvert(double, int, int *, int *, char *);
1751extern char *fconvert(double, int, int *, int *, char *);
1752extern char *gconvert(double, int, int, char *);
1753extern char *qeconvert(quadruple *, int, int *, int *, char *);
1754extern char *qfconvert(quadruple *, int, int *, int *, char *);
1755extern char *qgconvert(quadruple *, int, int, char *);
1756
1757extern void __assert(const char *, const char *, int);
1758
1759extern int setjmp(jmp_buf);
1760extern void longjmp(jmp_buf, int);
1761extern int sigsetjmp(sigjmp_buf, int);
1762extern void siglongjmp(sigjmp_buf, int);
1763
1764int uname(struct utsname *);
1765int _uname(struct utsname *);
1766
1767int errno;
1768int *___errno()
1769{ return (&errno); }
1770
1771extern int getloadavg(double [], int);
1772
1773extern long pcsample(uintptr_t [], long);
1774
1775int fstat(int, struct stat *);
1776int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1777int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1778int mknod(const char *, mode_t, dev_t);
1779
1780extern int __init_daemon_priv(int, uid_t uid, gid_t gid, ...);
1781extern void __fini_daemon_priv(const char *, ...);
1782extern int __init_suid_priv(int, ...);
1783extern int __priv_bracket(priv_op_t);
1784extern void __priv_relinquish(void);
1785extern const char * __priv_getsetbynum(const void *, int);
1786extern char * __priv_set_to_str(void *, const priv_set_t *, char, int);
1787
1788/* private interface to get the groups list for a certain user */
1789int _getgroupsbymember(const char *, gid_t[], int, int);
1790
1791/* private interface for use only by java */
1792volatile sc_shared_t *volatile *_thr_schedctl(void);
1793
1794/* private interface to unmount all autofs mounts */
1795int _autofssys(enum autofssys_op, void *);
1796
1797/* label.c */
1798extern int is_system_labeled(void);
1799
1800extern int uconv_u16tou32(const uint16_t *, size_t *, uint32_t *, size_t *,
1801	int);
1802extern int uconv_u16tou8(const uint16_t *, size_t *, uchar_t *, size_t *, int);
1803extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *,
1804	int);
1805extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int);
1806extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
1807extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
1808extern int u8_validate(char *, size_t, char **, int, int *);
1809extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
1810extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,
1811	int *);
1812
1813/* private locale interfaces */
1814wint_t __nextwctype(wint_t, wctype_t);
1815int __iswrune(wint_t);
1816