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