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