xref: /titanic_51/usr/src/lib/libc/port/llib-lc (revision 40a5c998e5462ed47916e2edfcc5016073cf8851)
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/* ftime.c */
440int ftime(struct timeb *tp);
441
442/* ftok.c */
443key_t ftok(const char *path, int id);
444
445/* gcvt.c */
446char *gcvt(double number, int ndigit, char *buf);
447
448/* getcwd.c */
449char *getcwd(char *str, size_t size);
450
451/* getdate.c */
452struct tm *getdate(const char *expression);
453#ifdef getdate_err
454#undef getdate_err
455#endif
456int getdate_err;
457
458/* getdate_data.c */
459
460/* getdate_gd.c */
461
462/* getdtblsize.c */
463int getdtablesize(void);
464
465/* getenv.c */
466char *getenv(const char *name);
467
468/* getexecname.c */
469const char *getexecname(void);
470
471/* getgrnam.c */
472struct group *getgrnam(const char *name);
473struct group *getgrgid(gid_t gid);
474struct group *fgetgrent_r(FILE *, struct group *, char *, int);
475struct group *getgrent_r(struct group *, char *, int);
476struct group *getgrgid_r(gid_t, struct group *, char *, int);
477struct group *getgrnam_r(const char *, struct group *, char *, int);
478
479/* gethostid.c */
480long gethostid(void);
481
482/* gethz.c */
483int gethz(void);
484
485/* getisax.c */
486uint_t getisax(uint32_t *, uint_t);
487
488/* getlogin.c */
489char *getloginx(void);
490char *getloginx_r(char *, int);
491#ifdef	getlogin
492#undef	getlogin
493#endif	/* getlogin */
494char *getlogin(void);
495#ifdef	getlogin_r
496#undef	getlogin_r
497#endif	/* getlogin_r */
498char *getlogin_r(char *, int);
499
500/* getmntent.c */
501int getmntany(FILE *fd, struct mnttab *mgetp, struct mnttab *mrefp);
502int getmntent(FILE *fd, struct mnttab *mp);
503
504/* getnetgrent.c */
505int setnetgrent(const char *grp);
506int endnetgrent(void);
507int getnetgrent(char **machinep, char **namep, char **domainp);
508
509/* getopt.c */
510int getopt(int argc, char *const *argv, const char *opts);
511
512/* getopt_long.c */
513int getopt_clip(int argc, char *const *argv, const char *optstring,
514		const struct option *long_options, int *long_index);
515int getopt_long(int argc, char *const *argv, const char *optstring,
516		const struct option *long_options, int *long_index);
517int getopt_long_only(int argc, char *const *argv, const char *optstring,
518		const struct option *long_options, int *long_index);
519
520/* getpagesize.c */
521int getpagesize(void);
522
523/* getpw.c */
524int getpw(uid_t uid, char *buf);
525
526/* getpwnam.c */
527struct passwd *getpwnam(const char *name);
528struct passwd *getpwuid(uid_t uid);
529struct passwd *fgetpwent_r(FILE *, struct passwd *, char *, int);
530struct passwd *getpwent_r(struct passwd *, char *, int);
531struct passwd *getpwnam_r(const char *, struct passwd *, char *, int);
532struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
533
534/* getrusage.c */
535int getrusage(int who, struct rusage *rusage);
536
537/* gettimeofday.c */
538int gettimeofday(struct timeval *_RESTRICT_KYWD tp, void *_RESTRICT_KYWD);
539
540/* getspent.c */
541void setspent(void);
542void endspent(void);
543struct spwd *getspent(void);
544struct spwd *getspent_r(struct spwd *, char *, int);
545struct spwd *fgetspent(FILE *f);
546struct spwd *fgetspent_r(FILE *, struct spwd *, char *, int);
547struct spwd *getspnam(const char *name);
548struct spwd *getspnam_r(const char *, struct spwd *, char *, int);
549int putspent(const struct spwd *p, FILE *f);
550
551/* getspent_r.c */
552int str2spwd(const char *, int, void *, char *, int);
553
554/* getsubopt.c */
555int getsubopt(char **optionsp, char *const *tokens, char **valuep);
556
557/* gettxt.c */
558char *gettxt(const char *msg_id, const char *dflt_str);
559
560/* getusershell.c */
561char *getusershell(void);
562void endusershell(void);
563void setusershell(void);
564
565/* getut.c */
566struct utmp *getutent(void);
567struct utmp *getutid(const struct utmp *entry);
568struct utmp *getutline(const struct utmp *entry);
569struct utmp *pututline(const struct utmp *entry);
570void setutent(void);
571void endutent(void);
572int utmpname(const char *newfile);
573void updwtmp(const char *file, struct utmp *ut);
574void getutmp(const struct utmpx *utx, struct utmp *ut);
575void getutmpx(const struct utmp *ut, struct utmpx *utx);
576struct utmp *makeut(struct utmp *utmp);
577
578/* getutx.c */
579struct utmpx *getutxent(void);
580struct utmpx *getutxid(const struct utmpx *entry);
581struct utmpx *getutxline(const struct utmpx *entry);
582struct utmpx *pututxline(const struct utmpx *entry);
583void setutxent(void);
584void endutxent(void);
585int utmpxname(const char *newfile);
586void updwtmpx(const char *filex, struct utmpx *utx);
587struct utmpx *makeutx(const struct utmpx *utmp);
588struct utmpx *modutx(const struct utmpx *utp);
589
590/* getvfsent.c */
591int getvfsspec(FILE *fd, struct vfstab *vp, char *special);
592int getvfsfile(FILE *fd, struct vfstab *vp, char *mountp);
593int getvfsany(FILE *fd, struct vfstab *vgetp, struct vfstab *vrefp);
594int getvfsent(FILE *fd, struct vfstab *vp);
595
596/* getwd.c */
597char *getwd(char *pathname);
598
599/* getwidth.c */
600void getwidth(eucwidth_t *eucstruct);
601
602/* hsearch.c */
603int hcreate(size_t size);
604void hdestroy(void);
605ENTRY *hsearch(ENTRY item, ACTION action);
606
607/* iconv.c  */
608size_t iconv(iconv_t cd, const char **_RESTRICT_KYWD inbuf,
609    size_t *_RESTRICT_KYWD inbytesleft, char **_RESTRICT_KYWD outbuf,
610    size_t *_RESTRICT_KYWD outbytesleft);
611int iconv_close(iconv_t cd);
612iconv_t iconv_open(const char *tocode, const char *fromcode);
613
614/* imaxabs.c */
615intmax_t imaxabs(intmax_t j);
616
617/* imaxdiv.c */
618imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
619
620/* index.c */
621char *index(const char *sp, int c);
622
623/* initgroups.c */
624int initgroups(const char *uname, gid_t agroup);
625
626/* innetgr.c */
627int innetgr(const char *group, const char *machine, const char *name,
628    const char *domain);
629
630/* insque.c */
631void insque(void *elem, void *pred);
632void remque(void *elem);
633
634/* isaexec.c */
635int isaexec(const char *, char *const *, char *const *);
636
637/* isastream.c */
638int isastream(int fd);
639
640/* isatty.c */
641int isatty(int f);
642
643/* killpg.c */
644int killpg(pid_t pgrp, int sig);
645
646/* l64a.c */
647char *l64a(long lg);
648
649/* lckpwdf.c */
650int lckpwdf(void);
651int ulckpwdf(void);
652
653/* lfind.c */
654void * lfind(const void *ky, const void *bs, size_t *nelp,
655		size_t width, int (*compar)());
656
657/* localeconv.c */
658struct lconv *localeconv(void);
659
660/* lsearch.c */
661void * lsearch(const void *ky, void *bs, size_t *nelp,
662		size_t width, int (*compar)());
663
664/* madvise.c */
665int madvise(caddr_t addr, size_t len, int advice);
666
667/* malloc.c */
668void *malloc(size_t size);
669void *realloc(void *old, size_t size);
670void free(void *old);
671
672/* mbstowcs.c */
673size_t mbstowcs(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s,
674	size_t n);
675
676/* mbtowc.c */
677int mbtowc(wchar_t *_RESTRICT_KYWD wchar, const char *_RESTRICT_KYWD s,
678	size_t n);
679int mblen(const char *s, size_t n);
680
681/* memalign.c */
682void *memalign(size_t align, size_t nbytes);
683
684/* memccpy.c */
685void *memccpy(void *_RESTRICT_KYWDs, const void *_RESTRICT_KYWD s0, int c,
686	size_t n);
687
688/* memchr.c */
689void *memchr(const void *sptr, int c1, size_t n);
690
691/* memcmp.c */
692int memcmp(const void *s1, const void *s2, size_t n);
693
694/* memcpy.c */
695void *memcpy(void *_RESTRICT_KYWD s, const void *_RESTRICT_KYWD s0, size_t n);
696
697/* memmove.c */
698void *memmove(void *s, const void *s0, size_t n);
699
700/* memset.c */
701void *memset(void *sp1, int c, size_t n);
702
703/* mkdev.c */
704dev_t __makedev(const int version, const major_t majdev,
705		const minor_t mindev);
706major_t __major(const int version, const dev_t devnum);
707minor_t __minor(const int version, const dev_t devnum);
708
709/* mkfifo.c */
710int mkfifo(const char *path, mode_t mode);
711
712/* mktemp.c */
713char *mktemp(char *as);
714
715/* mlock.c */
716int mlock(caddr_t addr, size_t len);
717
718/* mlockall.c */
719int mlockall(int flags);
720
721/* mon.c */
722void monitor(int (*alowpc)(), int (*ahighpc)(), WORD *buffer,
723		size_t bufsize, size_t nfunc);
724
725/* msync.c */
726int msync(caddr_t addr, size_t len, int flags);
727
728/* munlock.c */
729int munlock(caddr_t addr, size_t len);
730
731/* munlockall.c */
732int munlockall(void);
733
734/* ndbm.c */
735void dbm_setdefwrite(DBM *db);
736int dbm_flush(DBM *db);
737int dbm_flushpag(DBM *db);
738DBM *dbm_open(const char *file, int flags, mode_t mode);
739void dbm_close(DBM *db);
740int dbm_close_status(DBM *db);
741datum dbm_fetch(DBM *db, datum key);
742int dbm_delete(DBM *db, datum key);
743int dbm_store(DBM *db, datum key, datum dat, int replace);
744datum dbm_firstkey(DBM *db);
745datum dbm_nextkey(DBM *db);
746datum dbm_do_nextkey(DBM *db, datum inkey);
747
748/* new_list.c */
749
750/* nftw.c */
751int nftw(const char *path, int (*fn)(), int depth, int flags);
752
753/* nl_langinfo.c */
754char *nl_langinfo(nl_item item);
755
756/* opendir.c */
757DIR *opendir(const char *filename);
758
759/* opt_data.c */
760
761/* perror.c */
762void perror(const char *s);
763
764/* pipe.c */
765int pipe(int *fds);
766
767/* psiginfo.c */
768void psiginfo(const siginfo_t *sip, const char *s);
769
770/* psignal.c */
771void psignal(int sig, const char *s);
772
773/* pt.c */
774char *ptsname(int fd);
775int unlockpt(int fd);
776int grantpt(int fd);
777
778/* putenv.c */
779int putenv(char *change);
780int setenv(const char *envname, const char *envval, int overwrite);
781int unsetenv(const char *name);
782
783/* putpwent.c */
784int putpwent(const struct passwd *p, FILE *f);
785
786/* qsort.c */
787void qsort(void *base, size_t n, size_t size, int (*compar)());
788
789/* raise.c */
790int raise(int sig);
791
792/* rand.c */
793void srand(unsigned x);
794int rand(void);
795int rand_r(unsigned int *);
796
797/* random.c */
798void srandom(unsigned x);
799char *initstate(unsigned seed, char *arg_state, size_t n);
800char *setstate(const char *arg_state);
801long random(void);
802
803/* rctlops.c */
804int rctl_walk(int (*callback)(const char *, void *), void *walk_data);
805hrtime_t rctlblk_get_firing_time(rctlblk_t *rblk);
806uint_t rctlblk_get_global_action(rctlblk_t *rblk);
807uint_t rctlblk_get_global_flags(rctlblk_t *rblk);
808uint_t rctlblk_get_local_action(rctlblk_t *rblk, int *signalp);
809uint_t rctlblk_get_local_flags(rctlblk_t *rblk);
810id_t rctlblk_get_recipient_pid(rctlblk_t *rblk);
811rctl_priv_t rctlblk_get_privilege(rctlblk_t *rblk);
812rctl_qty_t rctlblk_get_value(rctlblk_t *rblk);
813void rctlblk_set_local_action(rctlblk_t *rblk, uint_t action, int signal);
814void rctlblk_set_local_flags(rctlblk_t *rblk, uint_t flags);
815void rctlblk_set_privilege(rctlblk_t *rblk, rctl_priv_t priv);
816void rctlblk_set_value(rctlblk_t *rblk, rctl_qty_t val);
817size_t rctlblk_size(void);
818
819/* readdir.c */
820struct dirent *readdir(DIR *dirp);
821
822/* realpath.c */
823char *realpath(const char *_RESTRICT_KYWD raw, char *_RESTRICT_KYWD canon);
824
825/* regexpr.c */
826char *re_comp(const char *sp);
827int re_exec(const char *p1);
828
829/* rindex.c */
830char *rindex(const char *sp, int c);
831
832/* rename.c */
833int remove(const char *filename);
834int rename(const char *old, const char *new);
835
836/* rewinddir.c */
837#undef rewinddir
838void rewinddir(DIR *dirp);
839
840/* scandir.c */
841int alphasort(const struct dirent **, const struct dirent **);
842int scandir(const char *dirname, struct dirent *(*namelist[]),
843	int (*select)(const struct dirent *),
844	int (*dcomp)(const struct dirent **, const struct dirent **));
845
846/* scrwidth.c */
847int scrwidth(wchar_t c);
848
849/* seekdir.c */
850void seekdir(DIR *dirp, long loc);
851
852/* select.c */
853int pselect(int nfds,
854	fd_set *_RESTRICT_KYWD readfds,
855	fd_set *_RESTRICT_KYWD writefds,
856	fd_set *_RESTRICT_KYWD errorfds,
857	const struct timespec *_RESTRICT_KYWD timeout,
858	const sigset_t *_RESTRICT_KYWD sigmask);
859int select(int nfds,
860	fd_set *_RESTRICT_KYWD readfds,
861	fd_set *_RESTRICT_KYWD writefds,
862	fd_set *_RESTRICT_KYWD errorfds,
863	struct timeval *_RESTRICT_KYWD timeout);
864
865/* setlocale.c */
866char *setlocale(int cat, const char *loc);
867
868/* setpriority.c */
869int getpriority(int which, id_t who);
870int setpriority(int which, id_t who, int prio);
871
872/* settimeofday.c */
873int settimeofday(struct timeval *tp, void *);
874
875/* sigflag.c */
876int sigflag(int sig, int flag, int on);
877
878/* siglist.c */
879
880/* sigsend.c */
881int sigsend(idtype_t idtype, id_t id, int sig);
882
883/* sigsetops.c */
884int sigfillset(sigset_t *set);
885int sigemptyset(sigset_t *set);
886int sigaddset(sigset_t *set, int sig);
887int sigdelset(sigset_t *set, int sig);
888int sigismember(const sigset_t *set, int sig);
889
890/* scalls.c */
891unsigned sleep(unsigned sleep_tm);
892
893/* ssignal.c */
894int (*ssignal(int sig, int (*fn)())) ();
895int gsignal(int sig);
896
897/* str2id.c */
898
899/* str2sig.c */
900int str2sig(const char *s, int *sigp);
901int sig2str(int i, char *s);
902
903/* strcat.c */
904char *strcat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
905
906/* strchr.c */
907char *strchr(const char *sp, int c);
908
909/* strcmp.c */
910int strcmp(const char *s1, const char *s2);
911
912/* strcpy.c */
913char *strcpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
914
915/* strcspn.c */
916size_t strcspn(const char *string, const char *charset);
917
918/* strdup.c */
919char *strdup(const char *s1);
920
921/* strerror.c */
922char *strerror(int errnum);
923int strerror_r(int errnum, char *strerrbuf, size_t buflen);
924
925/* strftime.c */
926size_t strftime(char *_RESTRICT_KYWD s, size_t maxsize,
927		const char *_RESTRICT_KYWD format,
928		const struct tm *_RESTRICT_KYWD tm);
929
930/* strlen.c */
931size_t strlen(const char *s);
932
933/* strncat.c */
934char *strncat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
935
936/* strncmp.c */
937int strncmp(const char *s1, const char *s2, size_t n);
938
939/* strncpy.c */
940char *strncpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
941
942/* strpbrk.c */
943char *strpbrk(const char *string, const char *brkset);
944
945/* strrchr.c */
946char *strrchr(const char *sp, int c);
947
948/* strsep.c */
949char *strsep(char **stringp, const char *delim);
950
951/* strspn.c */
952size_t strspn(const char *string, const char *charset);
953
954/* strstr.c */
955char *strstr(const char *as1, const char *as2);
956
957/* strtod.c */
958double strtod(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
959float strtof(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
960long double strtold(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
961
962/* strtoimax.c */
963intmax_t strtoimax(const char *_RESTRICT_KYWD nptr,
964	char **_RESTRICT_KYWD endptr, int base);
965
966/* strtok.c */
967char *strtok(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD sepset);
968char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
969	char **_RESTRICT_KYWD);
970
971/* strtol.c */
972long strtol(const char *_RESTRICT_KYWD str, char **_RESTRICT_KYWD nptr,
973	int base);
974
975/* strtoul.c */
976unsigned long strtoul(const char *_RESTRICT_KYWD str,
977	char **_RESTRICT_KYWD nptr, int base);
978
979/* strtoumax.c */
980uintmax_t strtoumax(const char *_RESTRICT_KYWD nptr,
981		    char **_RESTRICT_KYWD endptr, int base);
982
983/* strxfrm.c */
984size_t strxfrm(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2,
985	size_t n);
986int strcoll(const char *s1, const char *s2);
987
988/* swab.c */
989void swab(const char *_RESTRICT_KYWD from, char *_RESTRICT_KYWD to, ssize_t n);
990
991/* swapctl.c */
992int swapctl(int cmd, void *arg);
993
994/* sysconf.c */
995long sysconf(int name);
996
997/* syslog.c */
998/* VARARGS2 */
999void syslog(int pri, const char *fmt, ...);
1000void vsyslog(int pri, const char *fmt, va_list ap);
1001void openlog(const char *ident, int logstat, int logfac);
1002void closelog(void);
1003int setlogmask(int pmask);
1004
1005/* tcdrain.c */
1006int tcdrain(int fildes);
1007
1008/* tcflow.c */
1009int tcflow(int fildes, int action);
1010
1011/* tcflush.c */
1012int tcflush(int fildes, int queue_selector);
1013
1014/* tcgetattr.c */
1015int tcgetattr(int fildes, struct termios *termios_p);
1016
1017/* tcgetpgrp.c */
1018pid_t tcgetpgrp(int fd);
1019
1020/* tcgetsid.c */
1021pid_t tcgetsid(int fd);
1022
1023/* tcsendbreak.c */
1024int tcsendbreak(int fildes, int duration);
1025
1026/* tcsetattr.c */
1027int tcsetattr(int fildes, int optional_actions,
1028	const struct termios *termios_p);
1029
1030/* tcsetpgrp.c */
1031int tcsetpgrp(int fd, pid_t pgrp);
1032
1033/* tell.c */
1034long tell(int f);
1035
1036/* telldir.c */
1037long telldir(DIR *dirp);
1038
1039/* tfind.c */
1040void *tfind(const void *ky, void *const *rtp, int (*compar)());
1041
1042/* time_comm.c */
1043struct tm *localtime(const time_t *timep);
1044struct tm *localtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1045struct tm *gmtime(const time_t *clock);
1046struct tm *gmtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1047double difftime(time_t time1, time_t time0);
1048time_t mktime(struct tm *timeptr);
1049void _ltzset(time_t tim);
1050void tzset(void);
1051
1052/* time_data.c */
1053
1054/* time_gdata.c */
1055
1056/* tolower.c */
1057int tolower(int c);
1058
1059/* toupper.c */
1060int toupper(int c);
1061
1062/* truncate.c */
1063int ftruncate(int fildes, off_t len);
1064int truncate(const char *path, off_t len);
1065
1066/* tsearch.c */
1067void *tsearch(const void *ky, void **rtp, int (*compar)());
1068void *tdelete(const void *ky, void **rtp, int (*compar)());
1069void twalk(const void *rt, void (*action)());
1070
1071/* ttyname.c */
1072char *ttyname(int f);
1073char *_ttyname_dev(dev_t rdev, char *buffer, size_t buflen);
1074char *ttyname_r(int, char *, int);
1075
1076/* ttyslot.c */
1077int ttyslot(void);
1078
1079/* ualarm.c */
1080unsigned ualarm(unsigned usecs, unsigned reload);
1081
1082/* ulimit.c */
1083/* VARARGS1 */
1084long ulimit(int cmd, ...);
1085
1086/* scalls.c */
1087int usleep(unsigned n);
1088
1089/* valloc.c */
1090void *valloc(size_t size);
1091
1092/* waitpid.c */
1093pid_t wait(int *stat_loc);
1094pid_t waitpid(pid_t pid, int *stat_loc, int options);
1095pid_t wait3(int *status, int options, struct rusage *rp);
1096pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
1097
1098/* wcstombs.c */
1099size_t wcstombs(char *_RESTRICT_KYWD s, const wchar_t *_RESTRICT_KYWD pwcs,
1100	size_t n);
1101
1102/* wctomb.c */
1103int wctomb(char *s, wchar_t wchar);
1104
1105/* wdata.c */
1106
1107/* wisprint.c */
1108int wisprint(wchar_t c);
1109
1110/* xgetwidth.c */
1111void _xgetwidth(void);
1112
1113/*
1114 * /usr/src/lib/libc/port/intl routines
1115 */
1116
1117/* gettext.c */
1118char *bindtextdomain(const char *domain, const char *binding);
1119char *dcgettext(const char *domain, const char *msg_id, const int category);
1120char *dgettext(const char *domain, const char *msg_id);
1121char *gettext(const char *msg_id);
1122char *textdomain(const char *domain);
1123
1124/*
1125 * /usr/src/lib/libc/port/print routines
1126 */
1127
1128/* fprintf.c */
1129/* VARARGS2 */
1130int fprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format, ...);
1131
1132/* printf.c */
1133/* VARARGS1 */
1134int printf(const char *_RESTRICT_KYWD format, ...);
1135
1136/* snprintf.c */
1137/* VARARGS2 */
1138int snprintf(char *_RESTRICT_KYWD string, size_t n,
1139		const char *_RESTRICT_KYWD format, ...);
1140
1141/* sprintf.c */
1142/* VARARGS2 */
1143int sprintf(char *_RESTRICT_KYWD string,
1144		const char *_RESTRICT_KYWD format, ...);
1145
1146/* vfprintf.c */
1147/* VARARGS2 */
1148int vfprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format,
1149		va_list);
1150
1151/* vprintf.c */
1152/* VARARGS1 */
1153int vprintf(const char *_RESTRICT_KYWD format, va_list);
1154
1155/* vsnprintf.c */
1156/* VARARGS2 */
1157int vsnprintf(char *_RESTRICT_KYWD string, size_t n,
1158		const char *_RESTRICT_KYWD format, va_list);
1159
1160/* vsprintf.c */
1161/* VARARGS2 */
1162int vsprintf(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD format,
1163	va_list);
1164
1165/*
1166 * /usr/src/lib/libc/port/regex routines
1167 */
1168
1169/* glob.c */
1170extern int glob(const char *restrict pattern, int flags,
1171    int(*errfunc)(const char *epath, int eerrno), glob_t *restrict pglob);
1172extern void globfree(glob_t *pglob);
1173
1174/* regex.c */
1175char *regex(const char *regexp, const char *stringp, ...);
1176#ifdef __loc1
1177#undef __loc1
1178#endif
1179char *__loc1;
1180
1181/* regcmp.c */
1182char *regcmp(const char *regexp, ...);
1183#ifdef __i_size
1184#undef __i_size
1185#endif
1186int __i_size;
1187
1188/*
1189 * /usr/src/lib/libc/port/stdio routines
1190 */
1191
1192/* _filbuf.c */
1193int _filbuf(FILE *iop);
1194
1195/* _flsbuf.c */
1196int _flsbuf(int ch, FILE *iop);
1197
1198/* _wrtchk.c */
1199int _wrtchk(FILE *iop);
1200
1201/* clearerr.c */
1202void clearerr(FILE *iop);
1203
1204/* ctermid.c */
1205char *ctermid(char *s);
1206char *ctermid_r(char *s);
1207
1208/* cuserid.c */
1209char *cuserid(char *s);
1210
1211/* data.c */
1212
1213/* doscan.c */
1214int _doscan(FILE *iop, const char *fmt, va_list va_alist);
1215
1216/* fdopen.c */
1217FILE *fdopen(int fd, const char *type);
1218
1219/* feof.c */
1220int feof(FILE *iop);
1221
1222/* ferror.c */
1223int ferror(FILE *iop);
1224
1225/* fgetc.c */
1226int fgetc(FILE *iop);
1227
1228/* fgets.c */
1229char *fgets(char *_RESTRICT_KYWD buf, int size, FILE *_RESTRICT_KYWD iop);
1230
1231/* fileno.c */
1232int _fileno(FILE *iop);
1233
1234/* flush.c */
1235void _cleanup(void);
1236FILE *_findiop(void);
1237typedef unsigned char Uchar;
1238void _setbufend(FILE *iop, Uchar *end);
1239Uchar *_realbufend(FILE *iop);
1240void _bufsync(FILE *iop, Uchar *bufend);
1241int _xflsbuf(FILE *iop);
1242int fflush(FILE *iop);
1243int fclose(FILE *iop);
1244
1245/* fopen.c */
1246FILE *fopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type);
1247FILE *freopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type,
1248		FILE *_RESTRICT_KYWD iop);
1249
1250/* fpos.c */
1251int fgetpos(FILE *_RESTRICT_KYWD stream, fpos_t *_RESTRICT_KYWD pos);
1252int fsetpos(FILE *stream, const fpos_t *pos);
1253
1254/* fputc.c */
1255int fputc(int ch, FILE *iop);
1256
1257/* fputs.c */
1258int fputs(const char *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1259
1260/* fread.c */
1261size_t fread(void *_RESTRICT_KYWD ptr, size_t size, size_t count,
1262	FILE *_RESTRICT_KYWD iop);
1263
1264/* fseek.c */
1265int fseek(FILE *iop, long offset, int ptrname);
1266
1267/* ftell.c */
1268long ftell(FILE *iop);
1269
1270/* fwrite.c */
1271size_t fwrite(const void *_RESTRICT_KYWD ptr1, size_t size, size_t count,
1272	FILE *_RESTRICT_KYWD iop);
1273
1274/* getc.c */
1275int getc(FILE *iop);
1276
1277/* getchar.c */
1278int getchar(void);
1279
1280/* getpass.c */
1281char *getpass(const char *prompt);
1282
1283/* getpass.c */
1284char *getpassphrase(const char *prompt);
1285
1286/* gets.c */
1287char *gets(char *buf);
1288
1289/* getw.c */
1290int getw(FILE *stream);
1291
1292/* popen.c */
1293FILE *popen(const char *cmd, const char *mode);
1294int pclose(FILE *ptr);
1295
1296/* putc.c */
1297int putc(int ch, FILE *iop);
1298
1299/* putchar.c */
1300int putchar(int ch);
1301
1302/* puts.c */
1303int puts(const char *ptr);
1304
1305/* putw.c */
1306int putw(int w, FILE *stream);
1307
1308/* rewind.c */
1309void rewind(FILE *iop);
1310
1311/* scanf.c */
1312/* VARARGS1 */
1313int scanf(const char *_RESTRICT_KYWD fmt, ...);
1314
1315/* VARARGS2 */
1316int fscanf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD fmt, ...);
1317
1318/* VARARGS2 */
1319int sscanf(const char *_RESTRICT_KYWD str, const char *_RESTRICT_KYWD fmt, ...);
1320
1321/* setbuf.c */
1322void setbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf);
1323
1324/* setvbuf.c */
1325int setvbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf, int type,
1326		size_t size);
1327
1328/* system.c */
1329int system(const char *s);
1330
1331/* tempnam.c */
1332char *tempnam(const char *dir, const char *pfx);
1333
1334/* tmpfile.c */
1335FILE *tmpfile(void);
1336
1337/* tmpnam.c */
1338char *tmpnam(char *s);
1339char *tmpnam_r(char *);
1340
1341/* ungetc.c */
1342int ungetc(int c, FILE *iop);
1343
1344/*
1345 * /usr/src/lib/libc/port/sys routines
1346 */
1347
1348/* exacctsys.c */
1349size_t getacct(idtype_t idtype, id_t id, void *buf, size_t bufsize);
1350int putacct(idtype_t idtype, id_t id, void *buf, size_t bufsize, int flags);
1351int wracct(idtype_t idtype, id_t id, int flags);
1352
1353/* execl.c */
1354/* VARARGS1 */
1355int execl(const char *name, const char *, ...);
1356
1357/* execle.c */
1358int execle(const char *, const char *file, ...);
1359
1360/* execv.c */
1361int execv(const char *file, char *const *argv);
1362
1363/* lockf.c */
1364int lockf(int fildes, int function, off_t size);
1365
1366/* meminfosys.c */
1367int meminfo(const uint64_t *inaddr, int addr_count, const uint_t *info_req,
1368	int info_count, uint64_t *outdata, uint_t *validity);
1369
1370/* msgsys.c */
1371int msgget(key_t key, int msgflg);
1372int msgctl(int msqid, int cmd, struct msqid_ds *buf);
1373ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
1374int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
1375
1376/* nfssys.c */
1377/*
1378int exportfs(char *dir, struct export *ep);
1379int nfs_getfh(char *path, fhandle_t *fhp);
1380int nfssvc(int fd);
1381*/
1382
1383/* psetsys.c */
1384int pset_create(psetid_t *npset);
1385int pset_destroy(psetid_t pset);
1386int pset_assign(psetid_t pset, processorid_t cpu, psetid_t *opset);
1387int pset_assign_forced(psetid_t pset, processorid_t cpu, psetid_t *opset);
1388int pset_info(psetid_t pset, int *type, u_int *numcpus, processorid_t *cpulist);
1389int pset_bind(psetid_t pset, idtype_t idtype, id_t id, psetid_t *opset);
1390int pset_bind_lwp(psetid_t pset, id_t id, pid_t, psetid_t *opset);
1391
1392
1393/* rctlsys.c */
1394int getrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1395    int flags);
1396int setrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1397    int flags);
1398/* (private functions) */
1399int setprojrctl(const char *name, rctlblk_t *new_rblk, size_t size, int flags);
1400int rctlctl(const char *, rctlblk_t *, int);
1401size_t rctllist(char *, size_t);
1402
1403
1404/* semsys.c */
1405int semctl(int semid, int semnum, int cmd, ...);
1406int semget(key_t key, int nsems, int semflg);
1407int semop(int semid, struct sembuf *sops, size_t nsops);
1408
1409/* shmsys.c */
1410void *shmat(int shmid, const void *shmaddr, int shmflg);
1411int shmctl(int shmid, int cmd, struct shmid_ds *buf);
1412#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)
1413int shmdt(const void *);
1414#else
1415int shmdt(char *);
1416#endif /* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4) */
1417int shmget(key_t key, size_t size, int shmflg);
1418
1419/* tasksys.c */
1420taskid_t settaskid(projid_t project, uint_t flags);
1421taskid_t gettaskid(void);
1422projid_t getprojid(void);
1423
1424/*
1425 * /usr/src/lib/libc/port/widec routines
1426 */
1427
1428/* fgetws.c */
1429wchar_t *fgetws(wchar_t *_RESTRICT_KYWD ptr, int  size,
1430	FILE *_RESTRICT_KYWD iop);
1431
1432/* fputwc.c */
1433wint_t fputwc(wint_t wc, FILE *iop);
1434wint_t putwc(wint_t wc, FILE *iop);
1435
1436/* fputws.c */
1437int fputws(const wchar_t *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1438
1439/* getwchar.c */
1440wint_t getwchar(void);
1441
1442/* getwidth.c */
1443void getwidth(eucwidth_t *eucstruct);
1444
1445/* getws.c */
1446wchar_t *getws(wchar_t *ptr);
1447
1448/* iswctype.c */
1449int iswctype(wint_t wc, wctype_t charclass);
1450int iswalpha(wint_t c);
1451int iswupper(wint_t c);
1452int iswlower(wint_t c);
1453int iswdigit(wint_t c);
1454int iswxdigit(wint_t c);
1455int iswalnum(wint_t c);
1456int iswspace(wint_t c);
1457int iswpunct(wint_t c);
1458int iswprint(wint_t c);
1459int iswgraph(wint_t c);
1460int iswcntrl(wint_t c);
1461int isphonogram(wint_t c);
1462int isideogram(wint_t c);
1463int isenglish(wint_t c);
1464int isnumber(wint_t c);
1465int isspecial(wint_t c);
1466
1467/* libwcollate.c */
1468
1469/* putwchar.c */
1470wint_t putwchar(wint_t c);
1471
1472/* putws.c */
1473int putws(const wchar_t *ptr);
1474
1475/* scrwidth.c */
1476
1477/* strtows.c */
1478wchar_t *strtows(wchar_t *s1, char *s2);
1479char *wstostr(char *s1, wchar_t *s2);
1480
1481/* trwctype.c */
1482wint_t towupper(wint_t c);
1483wint_t towlower(wint_t c);
1484
1485/* ungetwc.c */
1486wint_t ungetwc(wint_t wc, FILE *iop);
1487
1488/* wcollate.c */
1489size_t wcsxfrm(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1490	size_t n);
1491int wcscoll(const wchar_t *s1, const wchar_t *s2);
1492
1493/* wcsftime.c */
1494#if !defined(__amd64) 		/* XX64 - fix me */
1495size_t wcsftime(wchar_t *wcs, size_t maxsize,
1496	const char *format, const struct tm *timeptr);
1497#endif	/* __amd64 */
1498
1499/* wcstring.c */
1500wint_t fgetwc(FILE *iop);
1501wint_t getwc(FILE *iop);
1502int wcwidth(wchar_t wc);
1503int wcswidth(const wchar_t *pwcs, size_t n);
1504
1505/* wcswcs.c */
1506wchar_t *wcswcs(const wchar_t *ws1, const wchar_t *ws2);
1507
1508/* wcsxfrm.c - empty file! */
1509
1510/* wcsxfrm.xpg4.c */
1511
1512/* wisprint.c */
1513int wisprint(wchar_t c);
1514
1515/* wscasecmp.c */
1516int wscasecmp(const wchar_t *s1, const wchar_t *s2);
1517
1518/* wscat.c */
1519wchar_t *wcscat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1520wchar_t *wscat(wchar_t *s1, const wchar_t *s2);
1521
1522/* wschr.c */
1523wchar_t *wcschr(const wchar_t *sp, wchar_t c);
1524wchar_t *wschr(const wchar_t *sp, wchar_t c);
1525
1526/* wscmp.c */
1527int wcscmp(const wchar_t *s1, const wchar_t *s2);
1528int wscmp(const wchar_t *s1, const wchar_t *s2);
1529
1530/* wscol.c */
1531int wscol(const wchar_t *s1);
1532
1533/* wscpy.c */
1534wchar_t *wcscpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1535wchar_t *wscpy(wchar_t *s1, const wchar_t *s2);
1536
1537/* wscspn.c */
1538size_t wcscspn(const wchar_t *string, const wchar_t *charset);
1539size_t wscspn(const wchar_t *string, const wchar_t *charset);
1540
1541/* wsdup.c */
1542wchar_t *wsdup(const wchar_t *s1);
1543
1544/* wslen.c */
1545size_t wcslen(const wchar_t *s);
1546size_t wslen(const wchar_t *s);
1547
1548/* wsncasecmp.c */
1549int wsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1550
1551/* wsncat.c */
1552wchar_t *wcsncat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1553	size_t n);
1554wchar_t *wsncat(wchar_t *s1, const wchar_t *s2, size_t n);
1555
1556/* wsncmp.c */
1557int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1558int wsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1559
1560/* wsncpy.c */
1561wchar_t *wcsncpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1562	size_t n);
1563wchar_t *wsncpy(wchar_t *s1, const wchar_t *s2, size_t n);
1564
1565/* wspbrk.c */
1566wchar_t *wcspbrk(const wchar_t *string, const wchar_t *brkset);
1567wchar_t *wspbrk(const wchar_t *string, const wchar_t *brkset);
1568
1569/* wsprintf.c */
1570int wsprintf(wchar_t *wstring, const char *format, ...);
1571
1572/* wsrchr.c */
1573wchar_t *wcsrchr(const wchar_t *sp, wchar_t c);
1574wchar_t *wsrchr(const wchar_t *sp, wchar_t c);
1575
1576/* wsscanf.c */
1577int wsscanf(wchar_t *s, const char *format, ...);
1578
1579/* wssize.c */
1580
1581/* wsspn.c */
1582size_t wcsspn(const wchar_t *string, const wchar_t *charset);
1583size_t wsspn(const wchar_t *string, const wchar_t *charset);
1584
1585/* wstod.c */
1586double wcstod(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1587float wcstof(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1588long double wcstold(const wchar_t *_RESTRICT_KYWD cp,
1589	wchar_t **_RESTRICT_KYWD ptr);
1590double wstod(const wchar_t *cp, wchar_t **ptr);
1591
1592/* wstok.c */
1593#if !defined(__amd64) 		/* XX64 - fix me */
1594wchar_t *wcstok(wchar_t *string, const wchar_t *sepset);
1595wchar_t *wstok(wchar_t *string, const wchar_t *sepset);
1596#endif	/* __amd64 */
1597
1598/* wcstol.c */
1599long wcstol(const wchar_t *_RESTRICT_KYWD str, wchar_t **_RESTRICT_KYWD ptr,
1600	int base);
1601long long wcstoll(const wchar_t *_RESTRICT_KYWD str,
1602	wchar_t **_RESTRICT_KYWD ptr, int base);
1603
1604/* wcstoul.c */
1605unsigned long wcstoul(const wchar_t *_RESTRICT_KYWD str,
1606	wchar_t **_RESTRICT_KYWD ptr, int base);
1607unsigned long long wcstoull(const wchar_t *_RESTRICT_KYWD str,
1608	wchar_t **_RESTRICT_KYWD ptr, int base);
1609
1610/* wcstoimax.c */
1611intmax_t wcstoimax(const wchar_t *_RESTRICT_KYWD nptr,
1612	wchar_t **_RESTRICT_KYWD endptr, int base);
1613uintmax_t wcstoumax(const wchar_t *_RESTRICT_KYWD nptr,
1614	wchar_t **_RESTRICT_KYWD endptr, int base);
1615
1616/* wstol.c */
1617long wstol(const wchar_t *str, wchar_t **ptr, int base);
1618
1619/* wstoll.c */
1620long long wstoll(const wchar_t *str, wchar_t **ptr, int base);
1621long long watoll(const wchar_t *p);
1622
1623/* wsxfrm.c */
1624size_t wsxfrm(wchar_t *s1, const wchar_t *s2, size_t n);
1625int wscoll(const wchar_t *s1, const wchar_t *s2);
1626
1627/*
1628 * /usr/src/lib/libc/port/gen/event_port.c
1629 */
1630int port_dispatch(int port, int flags, int source, int events, uintptr_t object,
1631    void *user);
1632
1633/*
1634 * /usr/src/lib/libc/$MACH/gen routines
1635 */
1636
1637/* alloca.s */
1638
1639void *__builtin_alloca(size_t);
1640
1641/*
1642 * modctl(int arg, ...) and utssys(...) are not available from a header
1643 * file, but our utilities which make use of it should be able to be
1644 * lint clean.
1645 */
1646int modctl(int arg, ...);
1647int utssys(void *buf, int arg, int type, void *outbp);
1648
1649
1650typedef float single;
1651typedef unsigned extended[3];
1652typedef long double quadruple;
1653typedef unsigned fp_exception_field_type;
1654
1655typedef char decimal_string[512];
1656
1657enum fp_class_type {
1658	fp_zero	 = 0,
1659	fp_subnormal    = 1,
1660	fp_normal	= 2,
1661	fp_infinity	= 3,
1662	fp_quiet	= 4,
1663	fp_signaling    = 5
1664};
1665
1666enum fp_direction_type {
1667	fp_nearest	= 0,
1668	fp_tozero	= 1,
1669	fp_positive	= 2,
1670	fp_negative	= 3
1671};
1672
1673typedef struct {
1674	enum fp_class_type fpclass;
1675	int sign;
1676	int exponent;
1677	decimal_string ds;
1678	int more;
1679	int ndigits;
1680} decimal_record;
1681
1682enum decimal_form {
1683	fixed_form,
1684	floating_form
1685};
1686
1687typedef struct {
1688	enum fp_direction_type rd;
1689	enum decimal_form df;
1690	int ndigits;
1691} decimal_mode;
1692
1693enum decimal_string_form {
1694	invalid_form,
1695	whitespace_form,
1696	fixed_int_form,
1697	fixed_intdot_form,
1698	fixed_dotfrac_form,
1699	fixed_intdotfrac_form,
1700	floating_int_form,
1701	floating_intdot_form,
1702	floating_dotfrac_form,
1703	floating_intdotfrac_form,
1704	inf_form,
1705	infinity_form,
1706	nan_form,
1707	nanstring_form
1708};
1709
1710typedef int sigfpe_code_type;
1711
1712typedef void (*sigfpe_handler_type)();
1713
1714extern sigfpe_handler_type sigfpe(sigfpe_code_type, sigfpe_handler_type);
1715
1716extern void single_to_decimal(single *, decimal_mode *, decimal_record *,
1717				fp_exception_field_type *);
1718
1719extern void double_to_decimal(double *, decimal_mode *, decimal_record *,
1720				fp_exception_field_type *);
1721extern void extended_to_decimal(extended *, decimal_mode *,
1722				decimal_record *, fp_exception_field_type *);
1723extern void quadruple_to_decimal(quadruple *, decimal_mode *,
1724				decimal_record *, fp_exception_field_type *);
1725extern void decimal_to_single(single *, decimal_mode *, decimal_record *,
1726				fp_exception_field_type *);
1727extern void decimal_to_double(double *, decimal_mode *, decimal_record *,
1728				fp_exception_field_type *);
1729extern void decimal_to_extended(extended *, decimal_mode *,
1730				decimal_record *, fp_exception_field_type *);
1731extern void decimal_to_quadruple(quadruple *, decimal_mode *,
1732				decimal_record *, fp_exception_field_type *);
1733extern void string_to_decimal(char **, int, int, decimal_record *,
1734				enum decimal_string_form *, char **);
1735extern void func_to_decimal(char **, int, int, decimal_record *,
1736				enum decimal_string_form *, char **,
1737				int (*)(void), int *, int (*)(int));
1738extern void file_to_decimal(char **, int, int, decimal_record *,
1739				enum decimal_string_form *, char **,
1740				FILE *, int *);
1741extern char *seconvert(single *, int, int *, int *, char *);
1742extern char *sfconvert(single *, int, int *, int *, char *);
1743extern char *sgconvert(single *, int, int, char *);
1744extern char *econvert(double, int, int *, int *, char *);
1745extern char *fconvert(double, int, int *, int *, char *);
1746extern char *gconvert(double, int, int, char *);
1747extern char *qeconvert(quadruple *, int, int *, int *, char *);
1748extern char *qfconvert(quadruple *, int, int *, int *, char *);
1749extern char *qgconvert(quadruple *, int, int, char *);
1750
1751extern void __assert(const char *, const char *, int);
1752
1753extern int setjmp(jmp_buf);
1754extern void longjmp(jmp_buf, int);
1755extern int sigsetjmp(sigjmp_buf, int);
1756extern void siglongjmp(sigjmp_buf, int);
1757
1758int uname(struct utsname *);
1759int _uname(struct utsname *);
1760
1761int errno;
1762int *___errno()
1763{ return (&errno); }
1764
1765extern int getloadavg(double [], int);
1766
1767extern long pcsample(uintptr_t [], long);
1768
1769int fstat(int, struct stat *);
1770int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1771int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1772int mknod(const char *, mode_t, dev_t);
1773
1774extern int __init_daemon_priv(int, uid_t uid, gid_t gid, ...);
1775extern void __fini_daemon_priv(const char *, ...);
1776extern int __init_suid_priv(int, ...);
1777extern int __priv_bracket(priv_op_t);
1778extern void __priv_relinquish(void);
1779extern const char * __priv_getsetbynum(const void *, int);
1780extern char * __priv_set_to_str(void *, const priv_set_t *, char, int);
1781
1782/* private interface to get the groups list for a certain user */
1783int _getgroupsbymember(const char *, gid_t[], int, int);
1784
1785/* private interface for use only by java */
1786volatile sc_shared_t *volatile *_thr_schedctl(void);
1787
1788/* private interface to unmount all autofs mounts */
1789int _autofssys(enum autofssys_op, void *);
1790
1791/* label.c */
1792extern int is_system_labeled(void);
1793
1794extern int uconv_u16tou32(const uint16_t *, size_t *, uint32_t *, size_t *,
1795	int);
1796extern int uconv_u16tou8(const uint16_t *, size_t *, uchar_t *, size_t *, int);
1797extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *,
1798	int);
1799extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int);
1800extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
1801extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
1802extern int u8_validate(char *, size_t, char **, int, int *);
1803extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
1804extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,
1805	int *);
1806
1807/* private locale interfaces */
1808wint_t __nextwctype(wint_t, wctype_t);
1809int __iswrune(wint_t);
1810