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