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