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