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