xref: /titanic_51/usr/src/lib/libc/port/llib-lc (revision e5ba14ff435beeefdaa2e6649e175c74afe02c76)
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 <atomic.h>
35#include <ctype.h>
36#include <deflt.h>
37#include <dirent.h>
38#include <dlfcn.h>
39#include <door.h>
40#include <err.h>
41#include <sys/errno.h>
42#include <euc.h>
43#include <fcntl.h>
44#include <float.h>
45#include <fmtmsg.h>
46#include <fnmatch.h>
47#include <ftw.h>
48#include <getwidth.h>
49#include <grp.h>
50#include <iconv.h>
51#include <langinfo.h>
52#include <libgen.h>
53#include <libw.h>
54#include <locale.h>
55#include <memory.h>
56#include <mon.h>
57#include <mqueue.h>
58#include <nan.h>
59#include <ndbm.h>
60#include <limits.h>
61#include <nl_types.h>
62#include <project.h>
63#include <priv.h>
64#include <pwd.h>
65#include <rctl.h>
66#include <regex.h>
67#include <rpcsvc/ypclnt.h>
68#include <sched.h>
69#include <search.h>
70#include <semaphore.h>
71#include <setjmp.h>
72#include <shadow.h>
73#include <siginfo.h>
74#include <signal.h>
75#include <stdarg.h>
76#include <ucred.h>
77#include <sys/ucred.h>
78#include <unistd.h>
79#include <ulimit.h>
80#include <utime.h>
81#include <stddef.h>
82#include <stdio.h>
83#include <stdlib.h>
84#include <string.h>
85#include <stropts.h>
86#include <synch.h>
87#include <sys/acctctl.h>
88#include <sys/acl.h>
89#include <sys/asynch.h>
90#include <sys/byteorder.h>
91#include <sys/cladm.h>
92#include <sys/corectl.h>
93#include <sys/dl.h>
94#include <sys/exacct.h>
95#include <sys/fcntl.h>
96#include <sys/file.h>
97#include <sys/fs/namenode.h>
98#include <sys/instance.h>
99#include <sys/ipc.h>
100#include <sys/lwp.h>
101#include <sys/mkdev.h>
102#include <sys/mman.h>
103#include <sys/mnttab.h>
104#include <sys/mount.h>
105#include <sys/msg.h>
106#include <sys/param.h>
107#include <sys/poll.h>
108#include <sys/priocntl.h>
109#include <sys/procset.h>
110#include <sys/processor.h>
111#include <sys/pset.h>
112#include <sys/rctl_impl.h>
113#include <sys/sem.h>
114#include <sys/shm.h>
115#include <sys/sid.h>
116#include <sys/signal.h>
117#include <sys/stat.h>
118#include <sys/statvfs.h>
119#include <sys/strlog.h>
120#include <sys/stropts.h>
121#include <sys/syscall.h>
122#include <sys/sysconfig.h>
123#include <sys/syslog.h>
124#include <sys/systeminfo.h>
125#include <sys/task.h>
126#include <sys/termio.h>
127#include <sys/termios.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 */
800void _rewinddir(DIR *dirp);
801
802/* scandir.c */
803int alphasort(const struct dirent **, const struct dirent **);
804int scandir(const char *dirname, struct dirent *(*namelist[]),
805	int (*select)(const struct dirent *),
806	int (*dcomp)(const struct dirent **, const struct dirent **));
807
808/* scrwidth.c */
809int scrwidth(wchar_t c);
810
811/* seekdir.c */
812void seekdir(DIR *dirp, long loc);
813
814/* select.c */
815int pselect(int nfds,
816	fd_set *_RESTRICT_KYWD readfds,
817	fd_set *_RESTRICT_KYWD writefds,
818	fd_set *_RESTRICT_KYWD errorfds,
819	const struct timespec *_RESTRICT_KYWD timeout,
820	const sigset_t *_RESTRICT_KYWD sigmask);
821int select(int nfds,
822	fd_set *_RESTRICT_KYWD readfds,
823	fd_set *_RESTRICT_KYWD writefds,
824	fd_set *_RESTRICT_KYWD errorfds,
825	struct timeval *_RESTRICT_KYWD timeout);
826
827/* setlocale.c */
828char *setlocale(int cat, const char *loc);
829
830/* setpriority.c */
831int getpriority(int which, id_t who);
832int setpriority(int which, id_t who, int prio);
833
834/* settimeofday.c */
835int settimeofday(struct timeval *tp, void *);
836
837/* sigflag.c */
838int sigflag(int sig, int flag, int on);
839
840/* siglist.c */
841
842/* sigsend.c */
843int sigsend(idtype_t idtype, id_t id, int sig);
844
845/* sigsetops.c */
846int sigfillset(sigset_t *set);
847int sigemptyset(sigset_t *set);
848int sigaddset(sigset_t *set, int sig);
849int sigdelset(sigset_t *set, int sig);
850int sigismember(const sigset_t *set, int sig);
851
852/* scalls.c */
853unsigned sleep(unsigned sleep_tm);
854
855/* ssignal.c */
856int (*ssignal(int sig, int (*fn)())) ();
857int gsignal(int sig);
858
859/* str2id.c */
860
861/* str2sig.c */
862int str2sig(const char *s, int *sigp);
863int sig2str(int i, char *s);
864
865/* strcat.c */
866char *strcat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
867
868/* strchr.c */
869char *strchr(const char *sp, int c);
870
871/* strcmp.c */
872int strcmp(const char *s1, const char *s2);
873
874/* strcpy.c */
875char *strcpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
876
877/* strcspn.c */
878size_t strcspn(const char *string, const char *charset);
879
880/* strdup.c */
881char *strdup(const char *s1);
882
883/* strerror.c */
884char *strerror(int errnum);
885int strerror_r(int errnum, char *strerrbuf, size_t buflen);
886
887/* strftime.c */
888size_t strftime(char *_RESTRICT_KYWD s, size_t maxsize,
889		const char *_RESTRICT_KYWD format,
890		const struct tm *_RESTRICT_KYWD tm);
891
892/* strlen.c */
893size_t strlen(const char *s);
894
895/* strncat.c */
896char *strncat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
897
898/* strncmp.c */
899int strncmp(const char *s1, const char *s2, size_t n);
900
901/* strncpy.c */
902char *strncpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
903
904/* strpbrk.c */
905char *strpbrk(const char *string, const char *brkset);
906
907/* strrchr.c */
908char *strrchr(const char *sp, int c);
909
910/* strspn.c */
911size_t strspn(const char *string, const char *charset);
912
913/* strstr.c */
914char *strstr(const char *as1, const char *as2);
915
916/* strtod.c */
917double strtod(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
918float strtof(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
919long double strtold(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
920
921/* strtoimax.c */
922intmax_t strtoimax(const char *_RESTRICT_KYWD nptr,
923	char **_RESTRICT_KYWD endptr, int base);
924
925/* strtok.c */
926char *strtok(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD sepset);
927char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
928	char **_RESTRICT_KYWD);
929
930/* strtol.c */
931long strtol(const char *_RESTRICT_KYWD str, char **_RESTRICT_KYWD nptr,
932	int base);
933
934/* strtoul.c */
935unsigned long strtoul(const char *_RESTRICT_KYWD str,
936	char **_RESTRICT_KYWD nptr, int base);
937
938/* strtoumax.c */
939uintmax_t strtoumax(const char *_RESTRICT_KYWD nptr,
940		    char **_RESTRICT_KYWD endptr, int base);
941
942/* strxfrm.c */
943size_t strxfrm(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2,
944	size_t n);
945int strcoll(const char *s1, const char *s2);
946
947/* swab.c */
948void swab(const char *_RESTRICT_KYWD from, char *_RESTRICT_KYWD to, ssize_t n);
949
950/* swapctl.c */
951int swapctl(int cmd, void *arg);
952
953/* sysconf.c */
954long sysconf(int name);
955
956/* syslog.c */
957/* VARARGS2 */
958void syslog(int pri, const char *fmt, ...);
959void vsyslog(int pri, const char *fmt, va_list ap);
960void openlog(const char *ident, int logstat, int logfac);
961void closelog(void);
962int setlogmask(int pmask);
963
964/* tcdrain.c */
965int tcdrain(int fildes);
966
967/* tcflow.c */
968int tcflow(int fildes, int action);
969
970/* tcflush.c */
971int tcflush(int fildes, int queue_selector);
972
973/* tcgetattr.c */
974int tcgetattr(int fildes, struct termios *termios_p);
975
976/* tcgetpgrp.c */
977pid_t tcgetpgrp(int fd);
978
979/* tcgetsid.c */
980pid_t tcgetsid(int fd);
981
982/* tcsendbreak.c */
983int tcsendbreak(int fildes, int duration);
984
985/* tcsetattr.c */
986int tcsetattr(int fildes, int optional_actions,
987	const struct termios *termios_p);
988
989/* tcsetpgrp.c */
990int tcsetpgrp(int fd, pid_t pgrp);
991
992/* tell.c */
993long tell(int f);
994
995/* telldir.c */
996long telldir(DIR *dirp);
997
998/* tfind.c */
999void *tfind(const void *ky, void *const *rtp, int (*compar)());
1000
1001/* time_comm.c */
1002struct tm *localtime(const time_t *timep);
1003struct tm *localtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1004struct tm *gmtime(const time_t *clock);
1005struct tm *gmtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1006double difftime(time_t time1, time_t time0);
1007time_t mktime(struct tm *timeptr);
1008void _ltzset(time_t tim);
1009void tzset(void);
1010
1011/* time_data.c */
1012
1013/* time_gdata.c */
1014
1015/* tolower.c */
1016int tolower(int c);
1017
1018/* toupper.c */
1019int toupper(int c);
1020
1021/* truncate.c */
1022int ftruncate(int fildes, off_t len);
1023int truncate(const char *path, off_t len);
1024
1025/* tsearch.c */
1026void *tsearch(const void *ky, void **rtp, int (*compar)());
1027void *tdelete(const void *ky, void **rtp, int (*compar)());
1028void twalk(const void *rt, void (*action)());
1029
1030/* ttyname.c */
1031char *ttyname(int f);
1032char *_ttyname_dev(dev_t rdev, char *buffer, size_t buflen);
1033char *ttyname_r(int, char *, int);
1034
1035/* ttyslot.c */
1036int ttyslot(void);
1037
1038/* ualarm.c */
1039unsigned ualarm(unsigned usecs, unsigned reload);
1040
1041/* ulimit.c */
1042/* VARARGS1 */
1043long ulimit(int cmd, ...);
1044
1045/* scalls.c */
1046int usleep(unsigned n);
1047
1048/* valloc.c */
1049void *valloc(size_t size);
1050
1051/* values-Xa.c */
1052
1053/* values-Xc.c */
1054
1055/* values-Xs.c */
1056
1057/* values-Xt.c */
1058
1059/* wait3.c */
1060pid_t wait3(int *status, int options, struct rusage *rp);
1061
1062/* wait4.c */
1063pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
1064
1065/* waitpid.c */
1066pid_t waitpid(pid_t pid, int *stat_loc, int options);
1067
1068/* wcstombs.c */
1069size_t wcstombs(char *_RESTRICT_KYWD s, const wchar_t *_RESTRICT_KYWD pwcs,
1070	size_t n);
1071
1072/* wctomb.c */
1073int wctomb(char *s, wchar_t wchar);
1074
1075/* wdata.c */
1076
1077/* wisprint.c */
1078int wisprint(wchar_t c);
1079
1080/* xgetwidth.c */
1081void _xgetwidth(void);
1082
1083/*
1084 * /usr/src/lib/libc/port/intl routines
1085 */
1086
1087/* gettext.c */
1088char *bindtextdomain(const char *domain, const char *binding);
1089char *dcgettext(const char *domain, const char *msg_id, const int category);
1090char *dgettext(const char *domain, const char *msg_id);
1091char *gettext(const char *msg_id);
1092char *textdomain(const char *domain);
1093
1094/*
1095 * /usr/src/lib/libc/port/print routines
1096 */
1097
1098/* fprintf.c */
1099/* VARARGS2 */
1100int fprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format, ...);
1101
1102/* printf.c */
1103/* VARARGS1 */
1104int printf(const char *_RESTRICT_KYWD format, ...);
1105
1106/* snprintf.c */
1107/* VARARGS2 */
1108int snprintf(char *_RESTRICT_KYWD string, size_t n,
1109		const char *_RESTRICT_KYWD format, ...);
1110
1111/* sprintf.c */
1112/* VARARGS2 */
1113int sprintf(char *_RESTRICT_KYWD string,
1114		const char *_RESTRICT_KYWD format, ...);
1115
1116/* vfprintf.c */
1117/* VARARGS2 */
1118int vfprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format,
1119		va_list);
1120
1121/* vprintf.c */
1122/* VARARGS1 */
1123int vprintf(const char *_RESTRICT_KYWD format, va_list);
1124
1125/* vsnprintf.c */
1126/* VARARGS2 */
1127int vsnprintf(char *_RESTRICT_KYWD string, size_t n,
1128		const char *_RESTRICT_KYWD format, va_list);
1129
1130/* vsprintf.c */
1131/* VARARGS2 */
1132int vsprintf(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD format,
1133	va_list);
1134
1135/*
1136 * /usr/src/lib/libc/port/regex routines
1137 */
1138
1139/* regex.c */
1140char *regex(const char *regexp, const char *stringp, ...);
1141#ifdef __loc1
1142#undef __loc1
1143#endif
1144char *__loc1;
1145
1146/* regcmp.c */
1147char *regcmp(const char *regexp, ...);
1148#ifdef __i_size
1149#undef __i_size
1150#endif
1151int __i_size;
1152
1153/*
1154 * /usr/src/lib/libc/port/stdio routines
1155 */
1156
1157/* _filbuf.c */
1158int _filbuf(FILE *iop);
1159
1160/* _flsbuf.c */
1161int _flsbuf(int ch, FILE *iop);
1162
1163/* _wrtchk.c */
1164int _wrtchk(FILE *iop);
1165
1166/* clearerr.c */
1167void clearerr(FILE *iop);
1168
1169/* ctermid.c */
1170char *ctermid(char *s);
1171char *ctermid_r(char *s);
1172
1173/* cuserid.c */
1174char *cuserid(char *s);
1175
1176/* data.c */
1177
1178/* doscan.c */
1179int _doscan(FILE *iop, const char *fmt, va_list va_alist);
1180
1181/* fdopen.c */
1182FILE *fdopen(int fd, const char *type);
1183
1184/* feof.c */
1185int feof(FILE *iop);
1186
1187/* ferror.c */
1188int ferror(FILE *iop);
1189
1190/* fgetc.c */
1191int fgetc(FILE *iop);
1192
1193/* fgets.c */
1194char *fgets(char *_RESTRICT_KYWD buf, int size, FILE *_RESTRICT_KYWD iop);
1195
1196/* fileno.c */
1197int _fileno(FILE *iop);
1198
1199/* flush.c */
1200void _cleanup(void);
1201FILE *_findiop(void);
1202typedef unsigned char Uchar;
1203void _setbufend(FILE *iop, Uchar *end);
1204Uchar *_realbufend(FILE *iop);
1205void _bufsync(FILE *iop, Uchar *bufend);
1206int _xflsbuf(FILE *iop);
1207int fflush(FILE *iop);
1208int fclose(FILE *iop);
1209
1210/* fopen.c */
1211FILE *fopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type);
1212FILE *freopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type,
1213		FILE *_RESTRICT_KYWD iop);
1214
1215/* fpos.c */
1216int fgetpos(FILE *_RESTRICT_KYWD stream, fpos_t *_RESTRICT_KYWD pos);
1217int fsetpos(FILE *stream, const fpos_t *pos);
1218
1219/* fputc.c */
1220int fputc(int ch, FILE *iop);
1221
1222/* fputs.c */
1223int fputs(const char *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1224
1225/* fread.c */
1226size_t fread(void *_RESTRICT_KYWD ptr, size_t size, size_t count,
1227	FILE *_RESTRICT_KYWD iop);
1228
1229/* fseek.c */
1230int fseek(FILE *iop, long offset, int ptrname);
1231
1232/* ftell.c */
1233long ftell(FILE *iop);
1234
1235/* fwrite.c */
1236size_t fwrite(const void *_RESTRICT_KYWD ptr1, size_t size, size_t count,
1237	FILE *_RESTRICT_KYWD iop);
1238
1239/* getc.c */
1240int getc(FILE *iop);
1241
1242/* getchar.c */
1243int getchar(void);
1244
1245/* getpass.c */
1246char *getpass(const char *prompt);
1247
1248/* getpass.c */
1249char *getpassphrase(const char *prompt);
1250
1251/* gets.c */
1252char *gets(char *buf);
1253
1254/* getw.c */
1255int getw(FILE *stream);
1256
1257/* popen.c */
1258FILE *popen(const char *cmd, const char *mode);
1259int pclose(FILE *ptr);
1260
1261/* putc.c */
1262int putc(int ch, FILE *iop);
1263
1264/* putchar.c */
1265int putchar(int ch);
1266
1267/* puts.c */
1268int puts(const char *ptr);
1269
1270/* putw.c */
1271int putw(int w, FILE *stream);
1272
1273/* rewind.c */
1274void rewind(FILE *iop);
1275
1276/* scanf.c */
1277/* VARARGS1 */
1278int scanf(const char *_RESTRICT_KYWD fmt, ...);
1279
1280/* VARARGS2 */
1281int fscanf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD fmt, ...);
1282
1283/* VARARGS2 */
1284int sscanf(const char *_RESTRICT_KYWD str, const char *_RESTRICT_KYWD fmt, ...);
1285
1286/* setbuf.c */
1287void setbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf);
1288
1289/* setvbuf.c */
1290int setvbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf, int type,
1291		size_t size);
1292
1293/* system.c */
1294int system(const char *s);
1295
1296/* tempnam.c */
1297char *tempnam(const char *dir, const char *pfx);
1298
1299/* tmpfile.c */
1300FILE *tmpfile(void);
1301
1302/* tmpnam.c */
1303char *tmpnam(char *s);
1304char *tmpnam_r(char *);
1305
1306/* ungetc.c */
1307int ungetc(int c, FILE *iop);
1308
1309/*
1310 * /usr/src/lib/libc/port/sys routines
1311 */
1312
1313/* exacctsys.c */
1314size_t getacct(idtype_t idtype, id_t id, void *buf, size_t bufsize);
1315int putacct(idtype_t idtype, id_t id, void *buf, size_t bufsize, int flags);
1316int wracct(idtype_t idtype, id_t id, int flags);
1317
1318/* execl.c */
1319/* VARARGS1 */
1320int execl(const char *name, const char *, ...);
1321
1322/* execle.c */
1323int execle(const char *, const char *file, ...);
1324
1325/* execv.c */
1326int execv(const char *file, char *const *argv);
1327
1328/* lockf.c */
1329int lockf(int fildes, int function, off_t size);
1330
1331/* meminfosys.c */
1332int meminfo(const uint64_t *inaddr, int addr_count, const uint_t *info_req,
1333	int info_count, uint64_t *outdata, uint_t *validity);
1334
1335/* msgsys.c */
1336int msgget(key_t key, int msgflg);
1337int msgctl(int msqid, int cmd, struct msqid_ds *buf);
1338ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
1339int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
1340
1341/* nfssys.c */
1342/*
1343int exportfs(char *dir, struct export *ep);
1344int nfs_getfh(char *path, fhandle_t *fhp);
1345int nfssvc(int fd);
1346*/
1347
1348/* psetsys.c */
1349int pset_create(psetid_t *npset);
1350int pset_destroy(psetid_t pset);
1351int pset_assign(psetid_t pset, processorid_t cpu, psetid_t *opset);
1352int pset_assign_forced(psetid_t pset, processorid_t cpu, psetid_t *opset);
1353int pset_info(psetid_t pset, int *type, u_int *numcpus, processorid_t *cpulist);
1354int pset_bind(psetid_t pset, idtype_t idtype, id_t id, psetid_t *opset);
1355
1356/* rctlsys.c */
1357int getrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1358    int flags);
1359int setrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1360    int flags);
1361/* (private functions) */
1362int setprojrctl(const char *name, rctlblk_t *new_rblk, size_t size, int flags);
1363int rctlctl(const char *, rctlblk_t *, int);
1364size_t rctllist(char *, size_t);
1365
1366
1367/* semsys.c */
1368int semctl(int semid, int semnum, int cmd, ...);
1369int semget(key_t key, int nsems, int semflg);
1370int semop(int semid, struct sembuf *sops, size_t nsops);
1371
1372/* shmsys.c */
1373void *shmat(int shmid, const void *shmaddr, int shmflg);
1374int shmctl(int shmid, int cmd, struct shmid_ds *buf);
1375#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)
1376int shmdt(const void *);
1377#else
1378int shmdt(char *);
1379#endif /* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4) */
1380int shmget(key_t key, size_t size, int shmflg);
1381
1382/* tasksys.c */
1383taskid_t settaskid(projid_t project, uint_t flags);
1384taskid_t gettaskid(void);
1385projid_t getprojid(void);
1386
1387/*
1388 * /usr/src/lib/libc/port/widec routines
1389 */
1390
1391/* fgetws.c */
1392wchar_t *fgetws(wchar_t *_RESTRICT_KYWD ptr, int  size,
1393	FILE *_RESTRICT_KYWD iop);
1394
1395/* fputwc.c */
1396wint_t fputwc(wint_t wc, FILE *iop);
1397wint_t putwc(wint_t wc, FILE *iop);
1398
1399/* fputws.c */
1400int fputws(const wchar_t *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1401
1402/* getwchar.c */
1403wint_t getwchar(void);
1404
1405/* getwidth.c */
1406void getwidth(eucwidth_t *eucstruct);
1407
1408/* getws.c */
1409wchar_t *getws(wchar_t *ptr);
1410
1411/* iswctype.c */
1412int iswctype(wint_t wc, wctype_t charclass);
1413int iswalpha(wint_t c);
1414int iswupper(wint_t c);
1415int iswlower(wint_t c);
1416int iswdigit(wint_t c);
1417int iswxdigit(wint_t c);
1418int iswalnum(wint_t c);
1419int iswspace(wint_t c);
1420int iswpunct(wint_t c);
1421int iswprint(wint_t c);
1422int iswgraph(wint_t c);
1423int iswcntrl(wint_t c);
1424int isphonogram(wint_t c);
1425int isideogram(wint_t c);
1426int isenglish(wint_t c);
1427int isnumber(wint_t c);
1428int isspecial(wint_t c);
1429
1430/* libwcollate.c */
1431
1432/* putwchar.c */
1433wint_t putwchar(wint_t c);
1434
1435/* putws.c */
1436int putws(const wchar_t *ptr);
1437
1438/* scrwidth.c */
1439
1440/* strtows.c */
1441wchar_t *strtows(wchar_t *s1, char *s2);
1442char *wstostr(char *s1, wchar_t *s2);
1443
1444/* trwctype.c */
1445wint_t towupper(wint_t c);
1446wint_t towlower(wint_t c);
1447
1448/* ungetwc.c */
1449wint_t ungetwc(wint_t wc, FILE *iop);
1450
1451/* wcollate.c */
1452size_t wcsxfrm(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1453	size_t n);
1454int wcscoll(const wchar_t *s1, const wchar_t *s2);
1455
1456/* wcsftime.c */
1457#if !defined(__amd64) 		/* XX64 - fix me */
1458size_t wcsftime(wchar_t *wcs, size_t maxsize,
1459	const char *format, const struct tm *timeptr);
1460#endif	/* __amd64 */
1461
1462/* wcstring.c */
1463wint_t fgetwc(FILE *iop);
1464wint_t getwc(FILE *iop);
1465int wcwidth(wchar_t wc);
1466int wcswidth(const wchar_t *pwcs, size_t n);
1467
1468/* wcswcs.c */
1469wchar_t *wcswcs(const wchar_t *ws1, const wchar_t *ws2);
1470
1471/* wcsxfrm.c - empty file! */
1472
1473/* wcsxfrm.xpg4.c */
1474
1475/* wisprint.c */
1476int wisprint(wchar_t c);
1477
1478/* wscasecmp.c */
1479int wscasecmp(const wchar_t *s1, const wchar_t *s2);
1480
1481/* wscat.c */
1482wchar_t *wcscat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1483wchar_t *wscat(wchar_t *s1, const wchar_t *s2);
1484
1485/* wschr.c */
1486wchar_t *wcschr(const wchar_t *sp, wchar_t c);
1487wchar_t *wschr(const wchar_t *sp, wchar_t c);
1488
1489/* wscmp.c */
1490int wcscmp(const wchar_t *s1, const wchar_t *s2);
1491int wscmp(const wchar_t *s1, const wchar_t *s2);
1492
1493/* wscol.c */
1494int wscol(const wchar_t *s1);
1495
1496/* wscpy.c */
1497wchar_t *wcscpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1498wchar_t *wscpy(wchar_t *s1, const wchar_t *s2);
1499
1500/* wscspn.c */
1501size_t wcscspn(const wchar_t *string, const wchar_t *charset);
1502size_t wscspn(const wchar_t *string, const wchar_t *charset);
1503
1504/* wsdup.c */
1505wchar_t *wsdup(const wchar_t *s1);
1506
1507/* wslen.c */
1508size_t wcslen(const wchar_t *s);
1509size_t wslen(const wchar_t *s);
1510
1511/* wsncasecmp.c */
1512int wsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1513
1514/* wsncat.c */
1515wchar_t *wcsncat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1516	size_t n);
1517wchar_t *wsncat(wchar_t *s1, const wchar_t *s2, size_t n);
1518
1519/* wsncmp.c */
1520int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1521int wsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1522
1523/* wsncpy.c */
1524wchar_t *wcsncpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1525	size_t n);
1526wchar_t *wsncpy(wchar_t *s1, const wchar_t *s2, size_t n);
1527
1528/* wspbrk.c */
1529wchar_t *wcspbrk(const wchar_t *string, const wchar_t *brkset);
1530wchar_t *wspbrk(const wchar_t *string, const wchar_t *brkset);
1531
1532/* wsprintf.c */
1533int wsprintf(wchar_t *wstring, const char *format, ...);
1534
1535/* wsrchr.c */
1536wchar_t *wcsrchr(const wchar_t *sp, wchar_t c);
1537wchar_t *wsrchr(const wchar_t *sp, wchar_t c);
1538
1539/* wsscanf.c */
1540int wsscanf(wchar_t *s, const char *format, ...);
1541
1542/* wssize.c */
1543
1544/* wsspn.c */
1545size_t wcsspn(const wchar_t *string, const wchar_t *charset);
1546size_t wsspn(const wchar_t *string, const wchar_t *charset);
1547
1548/* wstod.c */
1549double wcstod(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1550float wcstof(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1551long double wcstold(const wchar_t *_RESTRICT_KYWD cp,
1552	wchar_t **_RESTRICT_KYWD ptr);
1553double wstod(const wchar_t *cp, wchar_t **ptr);
1554
1555/* wstok.c */
1556#if !defined(__amd64) 		/* XX64 - fix me */
1557wchar_t *wcstok(wchar_t *string, const wchar_t *sepset);
1558wchar_t *wstok(wchar_t *string, const wchar_t *sepset);
1559#endif	/* __amd64 */
1560
1561/* wcstol.c */
1562long wcstol(const wchar_t *_RESTRICT_KYWD str, wchar_t **_RESTRICT_KYWD ptr,
1563	int base);
1564long long wcstoll(const wchar_t *_RESTRICT_KYWD str,
1565	wchar_t **_RESTRICT_KYWD ptr, int base);
1566
1567/* wcstoul.c */
1568unsigned long wcstoul(const wchar_t *_RESTRICT_KYWD str,
1569	wchar_t **_RESTRICT_KYWD ptr, int base);
1570unsigned long long wcstoull(const wchar_t *_RESTRICT_KYWD str,
1571	wchar_t **_RESTRICT_KYWD ptr, int base);
1572
1573/* wcstoimax.c */
1574intmax_t wcstoimax(const wchar_t *_RESTRICT_KYWD nptr,
1575	wchar_t **_RESTRICT_KYWD endptr, int base);
1576uintmax_t wcstoumax(const wchar_t *_RESTRICT_KYWD nptr,
1577	wchar_t **_RESTRICT_KYWD endptr, int base);
1578
1579/* wstol.c */
1580long wstol(const wchar_t *str, wchar_t **ptr, int base);
1581
1582/* wstoll.c */
1583long long wstoll(const wchar_t *str, wchar_t **ptr, int base);
1584long long watoll(const wchar_t *p);
1585
1586/* wsxfrm.c */
1587size_t wsxfrm(wchar_t *s1, const wchar_t *s2, size_t n);
1588int wscoll(const wchar_t *s1, const wchar_t *s2);
1589
1590/*
1591 * /usr/src/lib/libc/port/gen/event_port.c
1592 */
1593int port_dispatch(int port, int flags, int source, int events, uintptr_t object,
1594    void *user);
1595
1596/*
1597 * /usr/src/lib/libc/$MACH/gen routines
1598 */
1599
1600/* alloca.s */
1601
1602void *__builtin_alloca(size_t);
1603
1604/*
1605 * modctl(int arg, ...) and utssys(...) are not available from a header
1606 * file, but our utilities which make use of it should be able to be
1607 * lint clean.
1608 */
1609int modctl(int arg, ...);
1610int utssys(void *buf, int arg, int type, void *outbp);
1611
1612
1613typedef float single;
1614typedef unsigned extended[3];
1615typedef long double quadruple;
1616typedef unsigned fp_exception_field_type;
1617
1618typedef char decimal_string[512];
1619
1620enum fp_class_type {
1621	fp_zero	 = 0,
1622	fp_subnormal    = 1,
1623	fp_normal	= 2,
1624	fp_infinity	= 3,
1625	fp_quiet	= 4,
1626	fp_signaling    = 5
1627};
1628
1629enum fp_direction_type {
1630	fp_nearest	= 0,
1631	fp_tozero	= 1,
1632	fp_positive	= 2,
1633	fp_negative	= 3
1634};
1635
1636typedef struct {
1637	enum fp_class_type fpclass;
1638	int sign;
1639	int exponent;
1640	decimal_string ds;
1641	int more;
1642	int ndigits;
1643} decimal_record;
1644
1645enum decimal_form {
1646	fixed_form,
1647	floating_form
1648};
1649
1650typedef struct {
1651	enum fp_direction_type rd;
1652	enum decimal_form df;
1653	int ndigits;
1654} decimal_mode;
1655
1656enum decimal_string_form {
1657	invalid_form,
1658	whitespace_form,
1659	fixed_int_form,
1660	fixed_intdot_form,
1661	fixed_dotfrac_form,
1662	fixed_intdotfrac_form,
1663	floating_int_form,
1664	floating_intdot_form,
1665	floating_dotfrac_form,
1666	floating_intdotfrac_form,
1667	inf_form,
1668	infinity_form,
1669	nan_form,
1670	nanstring_form
1671};
1672
1673typedef int sigfpe_code_type;
1674
1675typedef void (*sigfpe_handler_type)();
1676
1677extern sigfpe_handler_type sigfpe(sigfpe_code_type, sigfpe_handler_type);
1678
1679extern void single_to_decimal(single *, decimal_mode *, decimal_record *,
1680				fp_exception_field_type *);
1681
1682extern void double_to_decimal(double *, decimal_mode *, decimal_record *,
1683				fp_exception_field_type *);
1684extern void extended_to_decimal(extended *, decimal_mode *,
1685				decimal_record *, fp_exception_field_type *);
1686extern void quadruple_to_decimal(quadruple *, decimal_mode *,
1687				decimal_record *, fp_exception_field_type *);
1688extern void decimal_to_single(single *, decimal_mode *, decimal_record *,
1689				fp_exception_field_type *);
1690extern void decimal_to_double(double *, decimal_mode *, decimal_record *,
1691				fp_exception_field_type *);
1692extern void decimal_to_extended(extended *, decimal_mode *,
1693				decimal_record *, fp_exception_field_type *);
1694extern void decimal_to_quadruple(quadruple *, decimal_mode *,
1695				decimal_record *, fp_exception_field_type *);
1696extern void string_to_decimal(char **, int, int, decimal_record *,
1697				enum decimal_string_form *, char **);
1698extern void func_to_decimal(char **, int, int, decimal_record *,
1699				enum decimal_string_form *, char **,
1700				int (*)(void), int *, int (*)(int));
1701extern void file_to_decimal(char **, int, int, decimal_record *,
1702				enum decimal_string_form *, char **,
1703				FILE *, int *);
1704extern char *seconvert(single *, int, int *, int *, char *);
1705extern char *sfconvert(single *, int, int *, int *, char *);
1706extern char *sgconvert(single *, int, int, char *);
1707extern char *econvert(double, int, int *, int *, char *);
1708extern char *fconvert(double, int, int *, int *, char *);
1709extern char *gconvert(double, int, int, char *);
1710extern char *qeconvert(quadruple *, int, int *, int *, char *);
1711extern char *qfconvert(quadruple *, int, int *, int *, char *);
1712extern char *qgconvert(quadruple *, int, int, char *);
1713
1714extern void __assert(const char *, const char *, int);
1715
1716extern int setjmp(jmp_buf);
1717extern void longjmp(jmp_buf, int);
1718extern int sigsetjmp(sigjmp_buf, int);
1719extern void siglongjmp(sigjmp_buf, int);
1720
1721int uname(struct utsname *);
1722int _uname(struct utsname *);
1723
1724int errno;
1725int *___errno()
1726{ return (&errno); }
1727
1728extern int getloadavg(double [], int);
1729
1730extern long pcsample(uintptr_t [], long);
1731
1732int fstat(int, struct stat *);
1733int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1734int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1735int mknod(const char *, mode_t, dev_t);
1736
1737extern int __init_daemon_priv(int, uid_t uid, gid_t gid, ...);
1738extern void __fini_daemon_priv(const char *, ...);
1739extern int __init_suid_priv(int, ...);
1740extern int __priv_bracket(priv_op_t);
1741extern void __priv_relinquish(void);
1742extern const char * __priv_getsetbynum(const void *, int);
1743extern char * __priv_set_to_str(void *, const priv_set_t *, char, int);
1744
1745/* private interface to get the groups list for a certain user */
1746int _getgroupsbymember(const char *, gid_t[], int, int);
1747
1748/* private interface for use only by java */
1749volatile sc_shared_t *volatile *_thr_schedctl(void);
1750
1751/* private interface to unmount all autofs mounts */
1752int _autofssys(enum autofssys_op, void *);
1753
1754/* label.c */
1755extern int is_system_labeled(void);
1756
1757/* until TOG resolves the name, keep this private */
1758int __accessat(int, const char *, int);
1759