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