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