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