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