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