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.
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.
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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
40 #include <sys/errno.h>
66 #include <rpcsvc/ypclnt.h>
69 #include <semaphore.h>
76 #include <sys/ucred.h>
86 #include <sys/acctctl.h>
88 #include <sys/asynch.h>
89 #include <sys/byteorder.h>
90 #include <sys/cladm.h>
91 #include <sys/corectl.h>
93 #include <sys/exacct.h>
94 #include <sys/fcntl.h>
96 #include <sys/fs/namenode.h>
97 #include <sys/instance.h>
100 #include <sys/mkdev.h>
101 #include <sys/mman.h>
102 #include <sys/mnttab.h>
103 #include <sys/mount.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>
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>
140 #include <ucontext.h>
150 #include <schedctl.h>
154 #include <inttypes.h>
156 #include <stdio_ext.h>
158 #include <sys/sysi86.h>
161 #include <stack_unwind.h>
165 * This really comes from the crt*.s startup modules.
170 * POSIX versions of standard libc routines; these aren't extracted
171 * from the headers above since we cannot #define _POSIX_C_SOURCE.
173 int __posix_readdir_r(DIR * _RESTRICT_KYWD, struct dirent * _RESTRICT_KYWD,
174 struct dirent ** _RESTRICT_KYWD);
175 int __posix_getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
176 int __posix_getgrnam_r(const char *, struct group *, char *, size_t,
178 int __posix_getpwuid_r(uid_t, struct passwd *, char *, size_t,
180 int __posix_getpwnam_r(const char *, struct passwd *, char *, size_t,
182 int __posix_sigwait(const sigset_t * _RESTRICT_KYWD, int * _RESTRICT_KYWD);
183 char *__posix_asctime_r(const struct tm *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
184 char *__posix_ctime_r(const time_t *, char *);
185 int __posix_ttyname_r(int, char *, size_t);
186 int __posix_getlogin_r(char *, int);
189 * XPG4 versions of standard libc routines; these aren't extracted
190 * from the headers above since we cannot #define _XPG4_2.
192 int __xpg4_putmsg(int, const struct strbuf *, const struct strbuf *, int);
193 int __xpg4_putpmsg(int, const struct strbuf *, const struct strbuf *, int, int);
196 * These aren't extracted from the headers above because:
197 * - We cannot #define _STRPTIME_DONTZERO
198 * - We cannot #define _XPG5
200 char *__strptime_dontzero(const char *, const char *, struct tm *);
201 long __sysconf_xpg5(int);
202 wchar_t *__wcstok_xpg5(wchar_t *_RESTRICT_KYWD,
203 const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD);
204 size_t __wcsftime_xpg5(wchar_t *_RESTRICT_KYWD, size_t,
205 const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD);
206 wint_t __fgetwc_xpg5(__FILE *);
207 wint_t __getwc_xpg5(__FILE *);
208 wint_t __getwchar_xpg5(void);
209 wint_t __fputwc_xpg5(wint_t, __FILE *);
210 wint_t __putwc_xpg5(wint_t, __FILE *);
211 wint_t __putwchar_xpg5(wint_t);
212 wchar_t *__fgetws_xpg5(wchar_t *_RESTRICT_KYWD, int, __FILE *_RESTRICT_KYWD);
213 int __fputws_xpg5(const wchar_t *_RESTRICT_KYWD, __FILE *_RESTRICT_KYWD);
214 wint_t __ungetwc_xpg5(wint_t, __FILE *);
217 * /usr/src/lib/libc/port/gen routines
227 int _set_tab(const char *loc, int cat);
230 int _xftw(int ver, const char *path, int (*fn)(), int depth);
233 long a64l(const char *);
240 long labs(long int arg);
243 void _assert(const char *assertion, const char *filename, int line_num);
244 void __assert_c99(const char *assertion, const char *filename, int line_num,
245 const char *funcname);
248 int atexit(void(*func)());
249 void _exithandle(void);
252 double atof(const char *p);
255 int atoi(const char *p);
258 long atol(const char *p);
261 char *basename(char *s);
264 int bcmp(const void *s1, const void *s2, size_t len);
267 void bcopy(const void *s1, void *s2, size_t len);
270 void *bsearch(const void *ky, const void *bs, size_t nel,
271 size_t width, int (*compar)());
274 void bzero(void *sp, size_t len);
277 void *calloc(size_t num, size_t size);
280 int catclose(nl_catd catd);
283 char *catgets(nl_catd catd, int set_num, int msg_num, const char *s);
286 nl_catd catopen(const char *name, int mode);
289 speed_t cfgetispeed(const struct termios *termios_p);
292 speed_t cfgetospeed(const struct termios *termios_p);
295 void cfree(void *p, size_t num, size_t size);
298 int cfsetispeed(struct termios *termios_p, speed_t speed);
301 int cfsetospeed(struct termios *termios_p, speed_t speed);
304 int cftime(char *buf, char *format, const time_t *t);
305 int ascftime(char *buf, const char *format, const struct tm *tm);
311 int closedir(DIR *dirp);
314 size_t confstr(int name, char *buf, size_t length);
317 void setkey(const char *key);
318 void encrypt(char *block, int fake);
319 char *crypt(const char *key, const char *salt);
322 int csetlen(int cset);
323 int csetcol(int cset);
326 char *ctime(const time_t *t);
327 char *ctime_r(const time_t *, char *buf, int);
328 char *asctime(const struct tm *t);
329 char *asctime_r(const struct tm *, char *, int);
349 int directio(int filedes, int advice);
352 char *dirname(char *s);
355 div_t div(int numer, int denom);
356 ldiv_t ldiv(long int numer, long int denom);
359 double drand48(void);
360 double erand48(unsigned short *xsubi);
361 long krand48(unsigned short *xsubi, unsigned int m);
364 void srand48(long seedval);
365 unsigned short *seed48(unsigned short seed16v[3]);
366 void lcong48(unsigned short param[7]);
367 long nrand48(unsigned short *xsubi);
368 long jrand48(unsigned short *xsubi);
371 int dup2(int fildes, int fildes2);
374 char *ecvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
375 int *_RESTRICT_KYWDsign);
376 char *fcvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
377 int *_RESTRICT_KYWD sign);
380 void _errfp(FILE *, int, const char *, ...);
381 void _verrfp(FILE *, int, const char *, va_list);
382 void _errxfp(FILE *, int, const char *, ...);
383 void _verrxfp(FILE *, int, const char *, va_list);
384 void _warnfp(FILE *, const char *, ...);
385 void _vwarnfp(FILE *, const char *, va_list);
386 void _warnxfp(FILE *, const char *, ...);
387 void _vwarnxfp(FILE *, const char *, va_list);
392 int euccol(const unsigned char *s);
393 int euclen(const unsigned char *s);
394 int eucscol(const unsigned char *s);
398 int execlp(const char *, const char *, ...);
399 int execvp(const char *name, char *const *argv);
402 int fattach(int fildes, const char *path);
405 int fdetach(const char *path);
411 int addseverity(int value, const char *string);
412 int fmtmsg(long class, const char *label, int severity, const char *text,
413 const char *action, const char *tag);
416 int ftime(struct timeb *tp);
419 key_t ftok(const char *path, int id);
422 char *gcvt(double number, int ndigit, char *buf);
425 char *getcwd(char *str, size_t size);
428 struct tm *getdate(const char *expression);
439 int getdtablesize(void);
442 char *getenv(const char *name);
445 const char *getexecname(void);
448 struct group *getgrnam(const char *name);
449 struct group *getgrgid(gid_t gid);
450 struct group *fgetgrent_r(FILE *, struct group *, char *, int);
451 struct group *getgrent_r(struct group *, char *, int);
452 struct group *getgrgid_r(gid_t, struct group *, char *, int);
453 struct group *getgrnam_r(const char *, struct group *, char *, int);
456 long gethostid(void);
462 uint_t getisax(uint32_t *, uint_t);
465 char *getlogin(void);
466 char *getlogin_r(char *, int);
469 int getmntany(FILE *fd, struct mnttab *mgetp, struct mnttab *mrefp);
470 int getmntent(FILE *fd, struct mnttab *mp);
473 int setnetgrent(const char *grp);
474 int endnetgrent(void);
475 int getnetgrent(char **machinep, char **namep, char **domainp);
478 int getopt(int argc, char *const *argv, const char *opts);
481 int getopt_clip(int argc, char *const *argv, const char *optstring,
482 const struct option *long_options, int *long_index);
483 int getopt_long(int argc, char *const *argv, const char *optstring,
484 const struct option *long_options, int *long_index);
485 int getopt_long_only(int argc, char *const *argv, const char *optstring,
486 const struct option *long_options, int *long_index);
489 int getpagesize(void);
492 int getpw(uid_t uid, char *buf);
495 struct passwd *getpwnam(const char *name);
496 struct passwd *getpwuid(uid_t uid);
497 struct passwd *fgetpwent_r(FILE *, struct passwd *, char *, int);
498 struct passwd *getpwent_r(struct passwd *, char *, int);
499 struct passwd *getpwnam_r(const char *, struct passwd *, char *, int);
500 struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
503 int getrusage(int who, struct rusage *rusage);
506 int gettimeofday(struct timeval *_RESTRICT_KYWD tp, void *_RESTRICT_KYWD);
511 struct spwd *getspent(void);
512 struct spwd *getspent_r(struct spwd *, char *, int);
513 struct spwd *fgetspent(FILE *f);
514 struct spwd *fgetspent_r(FILE *, struct spwd *, char *, int);
515 struct spwd *getspnam(const char *name);
516 struct spwd *getspnam_r(const char *, struct spwd *, char *, int);
517 int putspent(const struct spwd *p, FILE *f);
520 int str2spwd(const char *, int, void *, char *, int);
523 int getsubopt(char **optionsp, char *const *tokens, char **valuep);
526 char *gettxt(const char *msg_id, const char *dflt_str);
529 char *getusershell(void);
530 void endusershell(void);
531 void setusershell(void);
534 struct utmp *getutent(void);
535 struct utmp *getutid(const struct utmp *entry);
536 struct utmp *getutline(const struct utmp *entry);
537 struct utmp *pututline(const struct utmp *entry);
540 int utmpname(const char *newfile);
541 void updwtmp(const char *file, struct utmp *ut);
542 void getutmp(const struct utmpx *utx, struct utmp *ut);
543 void getutmpx(const struct utmp *ut, struct utmpx *utx);
544 struct utmp *makeut(struct utmp *utmp);
547 struct utmpx *getutxent(void);
548 struct utmpx *getutxid(const struct utmpx *entry);
549 struct utmpx *getutxline(const struct utmpx *entry);
550 struct utmpx *pututxline(const struct utmpx *entry);
551 void setutxent(void);
552 void endutxent(void);
553 int utmpxname(const char *newfile);
554 void updwtmpx(const char *filex, struct utmpx *utx);
555 struct utmpx *makeutx(const struct utmpx *utmp);
556 struct utmpx *modutx(const struct utmpx *utp);
559 int getvfsspec(FILE *fd, struct vfstab *vp, char *special);
560 int getvfsfile(FILE *fd, struct vfstab *vp, char *mountp);
561 int getvfsany(FILE *fd, struct vfstab *vgetp, struct vfstab *vrefp);
562 int getvfsent(FILE *fd, struct vfstab *vp);
565 char *getwd(char *pathname);
568 void getwidth(eucwidth_t *eucstruct);
571 int hcreate(size_t size);
573 ENTRY *hsearch(ENTRY item, ACTION action);
576 size_t iconv(iconv_t cd, const char **_RESTRICT_KYWD inbuf,
577 size_t *_RESTRICT_KYWD inbytesleft, char **_RESTRICT_KYWD outbuf,
578 size_t *_RESTRICT_KYWD outbytesleft);
579 int iconv_close(iconv_t cd);
580 iconv_t iconv_open(const char *tocode, const char *fromcode);
583 intmax_t imaxabs(intmax_t j);
586 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
589 char *index(const char *sp, int c);
592 int initgroups(const char *uname, gid_t agroup);
595 int innetgr(const char *group, const char *machine, const char *name,
599 void insque(void *elem, void *pred);
600 void remque(void *elem);
603 int isaexec(const char *, char *const *, char *const *);
606 int isastream(int fd);
612 int killpg(pid_t pgrp, int sig);
622 void * lfind(const void *ky, const void *bs, size_t *nelp,
623 size_t width, int (*compar)());
626 struct lconv *localeconv(void);
629 void * lsearch(const void *ky, void *bs, size_t *nelp,
630 size_t width, int (*compar)());
633 int madvise(caddr_t addr, size_t len, int advice);
636 void *malloc(size_t size);
637 void *realloc(void *old, size_t size);
638 void free(void *old);
641 size_t mbstowcs(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s,
645 int mbtowc(wchar_t *_RESTRICT_KYWD wchar, const char *_RESTRICT_KYWD s,
647 int mblen(const char *s, size_t n);
650 void *memalign(size_t align, size_t nbytes);
653 void *memccpy(void *_RESTRICT_KYWDs, const void *_RESTRICT_KYWD s0, int c,
657 void *memchr(const void *sptr, int c1, size_t n);
660 int memcmp(const void *s1, const void *s2, size_t n);
663 void *memcpy(void *_RESTRICT_KYWD s, const void *_RESTRICT_KYWD s0, size_t n);
666 void *memmove(void *s, const void *s0, size_t n);
669 void *memset(void *sp1, int c, size_t n);
672 dev_t __makedev(const int version, const major_t majdev,
673 const minor_t mindev);
674 major_t __major(const int version, const dev_t devnum);
675 minor_t __minor(const int version, const dev_t devnum);
678 int mkfifo(const char *path, mode_t mode);
681 char *mktemp(char *as);
684 int mlock(caddr_t addr, size_t len);
687 int mlockall(int flags);
690 void monitor(int (*alowpc)(), int (*ahighpc)(), WORD *buffer,
691 size_t bufsize, size_t nfunc);
694 int msync(caddr_t addr, size_t len, int flags);
697 int munlock(caddr_t addr, size_t len);
700 int munlockall(void);
703 void dbm_setdefwrite(DBM *db);
704 int dbm_flush(DBM *db);
705 int dbm_flushpag(DBM *db);
706 DBM *dbm_open(const char *file, int flags, mode_t mode);
707 void dbm_close(DBM *db);
708 int dbm_close_status(DBM *db);
709 datum dbm_fetch(DBM *db, datum key);
710 int dbm_delete(DBM *db, datum key);
711 int dbm_store(DBM *db, datum key, datum dat, int replace);
712 datum dbm_firstkey(DBM *db);
713 datum dbm_nextkey(DBM *db);
714 datum dbm_do_nextkey(DBM *db, datum inkey);
719 int nftw(const char *path, int (*fn)(), int depth, int flags);
722 char *nl_langinfo(nl_item item);
725 DIR *opendir(const char *filename);
730 void perror(const char *s);
733 void psiginfo(siginfo_t *sip, char *s);
736 void psignal(int sig, const char *s);
739 char *ptsname(int fd);
740 int unlockpt(int fd);
744 int putenv(char *change);
745 int setenv(const char *envname, const char *envval, int overwrite);
746 int unsetenv(const char *name);
749 int putpwent(const struct passwd *p, FILE *f);
752 void qsort(void *base, size_t n, size_t size, int (*compar)());
758 void srand(unsigned x);
760 int rand_r(unsigned int *);
763 void srandom(unsigned x);
764 char *initstate(unsigned seed, char *arg_state, size_t n);
765 char *setstate(const char *arg_state);
769 int rctl_walk(int (*callback)(const char *, void *), void *walk_data);
770 hrtime_t rctlblk_get_firing_time(rctlblk_t *rblk);
771 uint_t rctlblk_get_global_action(rctlblk_t *rblk);
772 uint_t rctlblk_get_global_flags(rctlblk_t *rblk);
773 uint_t rctlblk_get_local_action(rctlblk_t *rblk, int *signalp);
774 uint_t rctlblk_get_local_flags(rctlblk_t *rblk);
775 id_t rctlblk_get_recipient_pid(rctlblk_t *rblk);
776 rctl_priv_t rctlblk_get_privilege(rctlblk_t *rblk);
777 rctl_qty_t rctlblk_get_value(rctlblk_t *rblk);
778 void rctlblk_set_local_action(rctlblk_t *rblk, uint_t action, int signal);
779 void rctlblk_set_local_flags(rctlblk_t *rblk, uint_t flags);
780 void rctlblk_set_privilege(rctlblk_t *rblk, rctl_priv_t priv);
781 void rctlblk_set_value(rctlblk_t *rblk, rctl_qty_t val);
782 size_t rctlblk_size(void);
785 struct dirent *readdir(DIR *dirp);
788 char *realpath(const char *_RESTRICT_KYWD raw, char *_RESTRICT_KYWD canon);
791 char *re_comp(const char *sp);
792 int re_exec(const char *p1);
795 char *rindex(const char *sp, int c);
798 int remove(const char *filename);
799 int rename(const char *old, const char *new);
803 void rewinddir(DIR *dirp);
806 int alphasort(const struct dirent **, const struct dirent **);
807 int scandir(const char *dirname, struct dirent *(*namelist[]),
808 int (*select)(const struct dirent *),
809 int (*dcomp)(const struct dirent **, const struct dirent **));
812 int scrwidth(wchar_t c);
815 void seekdir(DIR *dirp, long loc);
818 int pselect(int nfds,
819 fd_set *_RESTRICT_KYWD readfds,
820 fd_set *_RESTRICT_KYWD writefds,
821 fd_set *_RESTRICT_KYWD errorfds,
822 const struct timespec *_RESTRICT_KYWD timeout,
823 const sigset_t *_RESTRICT_KYWD sigmask);
825 fd_set *_RESTRICT_KYWD readfds,
826 fd_set *_RESTRICT_KYWD writefds,
827 fd_set *_RESTRICT_KYWD errorfds,
828 struct timeval *_RESTRICT_KYWD timeout);
831 char *setlocale(int cat, const char *loc);
834 int getpriority(int which, id_t who);
835 int setpriority(int which, id_t who, int prio);
838 int settimeofday(struct timeval *tp, void *);
841 int sigflag(int sig, int flag, int on);
846 int sigsend(idtype_t idtype, id_t id, int sig);
849 int sigfillset(sigset_t *set);
850 int sigemptyset(sigset_t *set);
851 int sigaddset(sigset_t *set, int sig);
852 int sigdelset(sigset_t *set, int sig);
853 int sigismember(const sigset_t *set, int sig);
856 unsigned sleep(unsigned sleep_tm);
859 int (*ssignal(int sig, int (*fn)())) ();
860 int gsignal(int sig);
865 int str2sig(const char *s, int *sigp);
866 int sig2str(int i, char *s);
869 char *strcat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
872 char *strchr(const char *sp, int c);
875 int strcmp(const char *s1, const char *s2);
878 char *strcpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2);
881 size_t strcspn(const char *string, const char *charset);
884 char *strdup(const char *s1);
887 char *strerror(int errnum);
888 int strerror_r(int errnum, char *strerrbuf, size_t buflen);
891 size_t strftime(char *_RESTRICT_KYWD s, size_t maxsize,
892 const char *_RESTRICT_KYWD format,
893 const struct tm *_RESTRICT_KYWD tm);
896 size_t strlen(const char *s);
899 char *strncat(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
902 int strncmp(const char *s1, const char *s2, size_t n);
905 char *strncpy(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2, size_t n);
908 char *strpbrk(const char *string, const char *brkset);
911 char *strrchr(const char *sp, int c);
914 char *strsep(char **stringp, const char *delim);
917 size_t strspn(const char *string, const char *charset);
920 char *strstr(const char *as1, const char *as2);
923 double strtod(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
924 float strtof(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
925 long double strtold(const char *_RESTRICT_KYWD cp, char **_RESTRICT_KYWD ptr);
928 intmax_t strtoimax(const char *_RESTRICT_KYWD nptr,
929 char **_RESTRICT_KYWD endptr, int base);
932 char *strtok(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD sepset);
933 char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
934 char **_RESTRICT_KYWD);
937 long strtol(const char *_RESTRICT_KYWD str, char **_RESTRICT_KYWD nptr,
941 unsigned long strtoul(const char *_RESTRICT_KYWD str,
942 char **_RESTRICT_KYWD nptr, int base);
945 uintmax_t strtoumax(const char *_RESTRICT_KYWD nptr,
946 char **_RESTRICT_KYWD endptr, int base);
949 size_t strxfrm(char *_RESTRICT_KYWD s1, const char *_RESTRICT_KYWD s2,
951 int strcoll(const char *s1, const char *s2);
954 void swab(const char *_RESTRICT_KYWD from, char *_RESTRICT_KYWD to, ssize_t n);
957 int swapctl(int cmd, void *arg);
960 long sysconf(int name);
964 void syslog(int pri, const char *fmt, ...);
965 void vsyslog(int pri, const char *fmt, va_list ap);
966 void openlog(const char *ident, int logstat, int logfac);
968 int setlogmask(int pmask);
971 int tcdrain(int fildes);
974 int tcflow(int fildes, int action);
977 int tcflush(int fildes, int queue_selector);
980 int tcgetattr(int fildes, struct termios *termios_p);
983 pid_t tcgetpgrp(int fd);
986 pid_t tcgetsid(int fd);
989 int tcsendbreak(int fildes, int duration);
992 int tcsetattr(int fildes, int optional_actions,
993 const struct termios *termios_p);
996 int tcsetpgrp(int fd, pid_t pgrp);
1002 long telldir(DIR *dirp);
1005 void *tfind(const void *ky, void *const *rtp, int (*compar)());
1008 struct tm *localtime(const time_t *timep);
1009 struct tm *localtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1010 struct tm *gmtime(const time_t *clock);
1011 struct tm *gmtime_r(const time_t *_RESTRICT_KYWD, struct tm *_RESTRICT_KYWD);
1012 double difftime(time_t time1, time_t time0);
1013 time_t mktime(struct tm *timeptr);
1014 void _ltzset(time_t tim);
1028 int ftruncate(int fildes, off_t len);
1029 int truncate(const char *path, off_t len);
1032 void *tsearch(const void *ky, void **rtp, int (*compar)());
1033 void *tdelete(const void *ky, void **rtp, int (*compar)());
1034 void twalk(const void *rt, void (*action)());
1037 char *ttyname(int f);
1038 char *_ttyname_dev(dev_t rdev, char *buffer, size_t buflen);
1039 char *ttyname_r(int, char *, int);
1045 unsigned ualarm(unsigned usecs, unsigned reload);
1049 long ulimit(int cmd, ...);
1052 int usleep(unsigned n);
1055 void *valloc(size_t size);
1058 pid_t wait(int *stat_loc);
1059 pid_t waitpid(pid_t pid, int *stat_loc, int options);
1060 pid_t wait3(int *status, int options, struct rusage *rp);
1061 pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
1064 size_t wcstombs(char *_RESTRICT_KYWD s, const wchar_t *_RESTRICT_KYWD pwcs,
1068 int wctomb(char *s, wchar_t wchar);
1073 int wisprint(wchar_t c);
1076 void _xgetwidth(void);
1079 * /usr/src/lib/libc/port/intl routines
1083 char *bindtextdomain(const char *domain, const char *binding);
1084 char *dcgettext(const char *domain, const char *msg_id, const int category);
1085 char *dgettext(const char *domain, const char *msg_id);
1086 char *gettext(const char *msg_id);
1087 char *textdomain(const char *domain);
1090 * /usr/src/lib/libc/port/print routines
1095 int fprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format, ...);
1099 int printf(const char *_RESTRICT_KYWD format, ...);
1103 int snprintf(char *_RESTRICT_KYWD string, size_t n,
1104 const char *_RESTRICT_KYWD format, ...);
1108 int sprintf(char *_RESTRICT_KYWD string,
1109 const char *_RESTRICT_KYWD format, ...);
1113 int vfprintf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD format,
1118 int vprintf(const char *_RESTRICT_KYWD format, va_list);
1122 int vsnprintf(char *_RESTRICT_KYWD string, size_t n,
1123 const char *_RESTRICT_KYWD format, va_list);
1127 int vsprintf(char *_RESTRICT_KYWD string, const char *_RESTRICT_KYWD format,
1131 * /usr/src/lib/libc/port/regex routines
1135 char *regex(const char *regexp, const char *stringp, ...);
1142 char *regcmp(const char *regexp, ...);
1149 * /usr/src/lib/libc/port/stdio routines
1153 int _filbuf(FILE *iop);
1156 int _flsbuf(int ch, FILE *iop);
1159 int _wrtchk(FILE *iop);
1162 void clearerr(FILE *iop);
1165 char *ctermid(char *s);
1166 char *ctermid_r(char *s);
1169 char *cuserid(char *s);
1174 int _doscan(FILE *iop, const char *fmt, va_list va_alist);
1177 FILE *fdopen(int fd, const char *type);
1180 int feof(FILE *iop);
1183 int ferror(FILE *iop);
1186 int fgetc(FILE *iop);
1189 char *fgets(char *_RESTRICT_KYWD buf, int size, FILE *_RESTRICT_KYWD iop);
1192 int _fileno(FILE *iop);
1195 void _cleanup(void);
1196 FILE *_findiop(void);
1197 typedef unsigned char Uchar;
1198 void _setbufend(FILE *iop, Uchar *end);
1199 Uchar *_realbufend(FILE *iop);
1200 void _bufsync(FILE *iop, Uchar *bufend);
1201 int _xflsbuf(FILE *iop);
1202 int fflush(FILE *iop);
1203 int fclose(FILE *iop);
1206 FILE *fopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type);
1207 FILE *freopen(const char *_RESTRICT_KYWD name, const char *_RESTRICT_KYWD type,
1208 FILE *_RESTRICT_KYWD iop);
1211 int fgetpos(FILE *_RESTRICT_KYWD stream, fpos_t *_RESTRICT_KYWD pos);
1212 int fsetpos(FILE *stream, const fpos_t *pos);
1215 int fputc(int ch, FILE *iop);
1218 int fputs(const char *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1221 size_t fread(void *_RESTRICT_KYWD ptr, size_t size, size_t count,
1222 FILE *_RESTRICT_KYWD iop);
1225 int fseek(FILE *iop, long offset, int ptrname);
1228 long ftell(FILE *iop);
1231 size_t fwrite(const void *_RESTRICT_KYWD ptr1, size_t size, size_t count,
1232 FILE *_RESTRICT_KYWD iop);
1235 int getc(FILE *iop);
1241 char *getpass(const char *prompt);
1244 char *getpassphrase(const char *prompt);
1247 char *gets(char *buf);
1250 int getw(FILE *stream);
1253 FILE *popen(const char *cmd, const char *mode);
1254 int pclose(FILE *ptr);
1257 int putc(int ch, FILE *iop);
1260 int putchar(int ch);
1263 int puts(const char *ptr);
1266 int putw(int w, FILE *stream);
1269 void rewind(FILE *iop);
1273 int scanf(const char *_RESTRICT_KYWD fmt, ...);
1276 int fscanf(FILE *_RESTRICT_KYWD iop, const char *_RESTRICT_KYWD fmt, ...);
1279 int sscanf(const char *_RESTRICT_KYWD str, const char *_RESTRICT_KYWD fmt, ...);
1282 void setbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf);
1285 int setvbuf(FILE *_RESTRICT_KYWD iop, char *_RESTRICT_KYWD abuf, int type,
1289 int system(const char *s);
1292 char *tempnam(const char *dir, const char *pfx);
1295 FILE *tmpfile(void);
1298 char *tmpnam(char *s);
1299 char *tmpnam_r(char *);
1302 int ungetc(int c, FILE *iop);
1305 * /usr/src/lib/libc/port/sys routines
1309 size_t getacct(idtype_t idtype, id_t id, void *buf, size_t bufsize);
1310 int putacct(idtype_t idtype, id_t id, void *buf, size_t bufsize, int flags);
1311 int wracct(idtype_t idtype, id_t id, int flags);
1315 int execl(const char *name, const char *, ...);
1318 int execle(const char *, const char *file, ...);
1321 int execv(const char *file, char *const *argv);
1324 int lockf(int fildes, int function, off_t size);
1327 int meminfo(const uint64_t *inaddr, int addr_count, const uint_t *info_req,
1328 int info_count, uint64_t *outdata, uint_t *validity);
1331 int msgget(key_t key, int msgflg);
1332 int msgctl(int msqid, int cmd, struct msqid_ds *buf);
1333 ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
1334 int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
1338 int exportfs(char *dir, struct export *ep);
1339 int nfs_getfh(char *path, fhandle_t *fhp);
1344 int pset_create(psetid_t *npset);
1345 int pset_destroy(psetid_t pset);
1346 int pset_assign(psetid_t pset, processorid_t cpu, psetid_t *opset);
1347 int pset_assign_forced(psetid_t pset, processorid_t cpu, psetid_t *opset);
1348 int pset_info(psetid_t pset, int *type, u_int *numcpus, processorid_t *cpulist);
1349 int pset_bind(psetid_t pset, idtype_t idtype, id_t id, psetid_t *opset);
1352 int getrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1354 int setrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
1356 /* (private functions) */
1357 int setprojrctl(const char *name, rctlblk_t *new_rblk, size_t size, int flags);
1358 int rctlctl(const char *, rctlblk_t *, int);
1359 size_t rctllist(char *, size_t);
1363 int semctl(int semid, int semnum, int cmd, ...);
1364 int semget(key_t key, int nsems, int semflg);
1365 int semop(int semid, struct sembuf *sops, size_t nsops);
1368 void *shmat(int shmid, const void *shmaddr, int shmflg);
1369 int shmctl(int shmid, int cmd, struct shmid_ds *buf);
1370 #if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)
1371 int shmdt(const void *);
1374 #endif /* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4) */
1375 int shmget(key_t key, size_t size, int shmflg);
1378 taskid_t settaskid(projid_t project, uint_t flags);
1379 taskid_t gettaskid(void);
1380 projid_t getprojid(void);
1383 * /usr/src/lib/libc/port/widec routines
1387 wchar_t *fgetws(wchar_t *_RESTRICT_KYWD ptr, int size,
1388 FILE *_RESTRICT_KYWD iop);
1391 wint_t fputwc(wint_t wc, FILE *iop);
1392 wint_t putwc(wint_t wc, FILE *iop);
1395 int fputws(const wchar_t *_RESTRICT_KYWD ptr, FILE *_RESTRICT_KYWD iop);
1398 wint_t getwchar(void);
1401 void getwidth(eucwidth_t *eucstruct);
1404 wchar_t *getws(wchar_t *ptr);
1407 int iswctype(wint_t wc, wctype_t charclass);
1408 int iswalpha(wint_t c);
1409 int iswupper(wint_t c);
1410 int iswlower(wint_t c);
1411 int iswdigit(wint_t c);
1412 int iswxdigit(wint_t c);
1413 int iswalnum(wint_t c);
1414 int iswspace(wint_t c);
1415 int iswpunct(wint_t c);
1416 int iswprint(wint_t c);
1417 int iswgraph(wint_t c);
1418 int iswcntrl(wint_t c);
1419 int isphonogram(wint_t c);
1420 int isideogram(wint_t c);
1421 int isenglish(wint_t c);
1422 int isnumber(wint_t c);
1423 int isspecial(wint_t c);
1428 wint_t putwchar(wint_t c);
1431 int putws(const wchar_t *ptr);
1436 wchar_t *strtows(wchar_t *s1, char *s2);
1437 char *wstostr(char *s1, wchar_t *s2);
1440 wint_t towupper(wint_t c);
1441 wint_t towlower(wint_t c);
1444 wint_t ungetwc(wint_t wc, FILE *iop);
1447 size_t wcsxfrm(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1449 int wcscoll(const wchar_t *s1, const wchar_t *s2);
1452 #if !defined(__amd64) /* XX64 - fix me */
1453 size_t wcsftime(wchar_t *wcs, size_t maxsize,
1454 const char *format, const struct tm *timeptr);
1455 #endif /* __amd64 */
1458 wint_t fgetwc(FILE *iop);
1459 wint_t getwc(FILE *iop);
1460 int wcwidth(wchar_t wc);
1461 int wcswidth(const wchar_t *pwcs, size_t n);
1464 wchar_t *wcswcs(const wchar_t *ws1, const wchar_t *ws2);
1466 /* wcsxfrm.c - empty file! */
1468 /* wcsxfrm.xpg4.c */
1471 int wisprint(wchar_t c);
1474 int wscasecmp(const wchar_t *s1, const wchar_t *s2);
1477 wchar_t *wcscat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1478 wchar_t *wscat(wchar_t *s1, const wchar_t *s2);
1481 wchar_t *wcschr(const wchar_t *sp, wchar_t c);
1482 wchar_t *wschr(const wchar_t *sp, wchar_t c);
1485 int wcscmp(const wchar_t *s1, const wchar_t *s2);
1486 int wscmp(const wchar_t *s1, const wchar_t *s2);
1489 int wscol(const wchar_t *s1);
1492 wchar_t *wcscpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2);
1493 wchar_t *wscpy(wchar_t *s1, const wchar_t *s2);
1496 size_t wcscspn(const wchar_t *string, const wchar_t *charset);
1497 size_t wscspn(const wchar_t *string, const wchar_t *charset);
1500 wchar_t *wsdup(const wchar_t *s1);
1503 size_t wcslen(const wchar_t *s);
1504 size_t wslen(const wchar_t *s);
1507 int wsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1510 wchar_t *wcsncat(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1512 wchar_t *wsncat(wchar_t *s1, const wchar_t *s2, size_t n);
1515 int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1516 int wsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
1519 wchar_t *wcsncpy(wchar_t *_RESTRICT_KYWD s1, const wchar_t *_RESTRICT_KYWD s2,
1521 wchar_t *wsncpy(wchar_t *s1, const wchar_t *s2, size_t n);
1524 wchar_t *wcspbrk(const wchar_t *string, const wchar_t *brkset);
1525 wchar_t *wspbrk(const wchar_t *string, const wchar_t *brkset);
1528 int wsprintf(wchar_t *wstring, const char *format, ...);
1531 wchar_t *wcsrchr(const wchar_t *sp, wchar_t c);
1532 wchar_t *wsrchr(const wchar_t *sp, wchar_t c);
1535 int wsscanf(wchar_t *s, const char *format, ...);
1540 size_t wcsspn(const wchar_t *string, const wchar_t *charset);
1541 size_t wsspn(const wchar_t *string, const wchar_t *charset);
1544 double wcstod(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1545 float wcstof(const wchar_t *_RESTRICT_KYWD cp, wchar_t **_RESTRICT_KYWD ptr);
1546 long double wcstold(const wchar_t *_RESTRICT_KYWD cp,
1547 wchar_t **_RESTRICT_KYWD ptr);
1548 double wstod(const wchar_t *cp, wchar_t **ptr);
1551 #if !defined(__amd64) /* XX64 - fix me */
1552 wchar_t *wcstok(wchar_t *string, const wchar_t *sepset);
1553 wchar_t *wstok(wchar_t *string, const wchar_t *sepset);
1554 #endif /* __amd64 */
1557 long wcstol(const wchar_t *_RESTRICT_KYWD str, wchar_t **_RESTRICT_KYWD ptr,
1559 long long wcstoll(const wchar_t *_RESTRICT_KYWD str,
1560 wchar_t **_RESTRICT_KYWD ptr, int base);
1563 unsigned long wcstoul(const wchar_t *_RESTRICT_KYWD str,
1564 wchar_t **_RESTRICT_KYWD ptr, int base);
1565 unsigned long long wcstoull(const wchar_t *_RESTRICT_KYWD str,
1566 wchar_t **_RESTRICT_KYWD ptr, int base);
1569 intmax_t wcstoimax(const wchar_t *_RESTRICT_KYWD nptr,
1570 wchar_t **_RESTRICT_KYWD endptr, int base);
1571 uintmax_t wcstoumax(const wchar_t *_RESTRICT_KYWD nptr,
1572 wchar_t **_RESTRICT_KYWD endptr, int base);
1575 long wstol(const wchar_t *str, wchar_t **ptr, int base);
1578 long long wstoll(const wchar_t *str, wchar_t **ptr, int base);
1579 long long watoll(const wchar_t *p);
1582 size_t wsxfrm(wchar_t *s1, const wchar_t *s2, size_t n);
1583 int wscoll(const wchar_t *s1, const wchar_t *s2);
1586 * /usr/src/lib/libc/port/gen/event_port.c
1588 int port_dispatch(int port, int flags, int source, int events, uintptr_t object,
1592 * /usr/src/lib/libc/$MACH/gen routines
1597 void *__builtin_alloca(size_t);
1600 * modctl(int arg, ...) and utssys(...) are not available from a header
1601 * file, but our utilities which make use of it should be able to be
1604 int modctl(int arg, ...);
1605 int utssys(void *buf, int arg, int type, void *outbp);
1608 typedef float single;
1609 typedef unsigned extended[3];
1610 typedef long double quadruple;
1611 typedef unsigned fp_exception_field_type;
1613 typedef char decimal_string[512];
1615 enum fp_class_type {
1624 enum fp_direction_type {
1632 enum fp_class_type fpclass;
1646 enum fp_direction_type rd;
1647 enum decimal_form df;
1651 enum decimal_string_form {
1657 fixed_intdotfrac_form,
1659 floating_intdot_form,
1660 floating_dotfrac_form,
1661 floating_intdotfrac_form,
1668 typedef int sigfpe_code_type;
1670 typedef void (*sigfpe_handler_type)();
1672 extern sigfpe_handler_type sigfpe(sigfpe_code_type, sigfpe_handler_type);
1674 extern void single_to_decimal(single *, decimal_mode *, decimal_record *,
1675 fp_exception_field_type *);
1677 extern void double_to_decimal(double *, decimal_mode *, decimal_record *,
1678 fp_exception_field_type *);
1679 extern void extended_to_decimal(extended *, decimal_mode *,
1680 decimal_record *, fp_exception_field_type *);
1681 extern void quadruple_to_decimal(quadruple *, decimal_mode *,
1682 decimal_record *, fp_exception_field_type *);
1683 extern void decimal_to_single(single *, decimal_mode *, decimal_record *,
1684 fp_exception_field_type *);
1685 extern void decimal_to_double(double *, decimal_mode *, decimal_record *,
1686 fp_exception_field_type *);
1687 extern void decimal_to_extended(extended *, decimal_mode *,
1688 decimal_record *, fp_exception_field_type *);
1689 extern void decimal_to_quadruple(quadruple *, decimal_mode *,
1690 decimal_record *, fp_exception_field_type *);
1691 extern void string_to_decimal(char **, int, int, decimal_record *,
1692 enum decimal_string_form *, char **);
1693 extern void func_to_decimal(char **, int, int, decimal_record *,
1694 enum decimal_string_form *, char **,
1695 int (*)(void), int *, int (*)(int));
1696 extern void file_to_decimal(char **, int, int, decimal_record *,
1697 enum decimal_string_form *, char **,
1699 extern char *seconvert(single *, int, int *, int *, char *);
1700 extern char *sfconvert(single *, int, int *, int *, char *);
1701 extern char *sgconvert(single *, int, int, char *);
1702 extern char *econvert(double, int, int *, int *, char *);
1703 extern char *fconvert(double, int, int *, int *, char *);
1704 extern char *gconvert(double, int, int, char *);
1705 extern char *qeconvert(quadruple *, int, int *, int *, char *);
1706 extern char *qfconvert(quadruple *, int, int *, int *, char *);
1707 extern char *qgconvert(quadruple *, int, int, char *);
1709 extern void __assert(const char *, const char *, int);
1711 extern int setjmp(jmp_buf);
1712 extern void longjmp(jmp_buf, int);
1713 extern int sigsetjmp(sigjmp_buf, int);
1714 extern void siglongjmp(sigjmp_buf, int);
1716 int uname(struct utsname *);
1717 int _uname(struct utsname *);
1721 { return (&errno); }
1723 extern int getloadavg(double [], int);
1725 extern long pcsample(uintptr_t [], long);
1727 int fstat(int, struct stat *);
1728 int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1729 int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
1730 int mknod(const char *, mode_t, dev_t);
1732 extern int __init_daemon_priv(int, uid_t uid, gid_t gid, ...);
1733 extern void __fini_daemon_priv(const char *, ...);
1734 extern int __init_suid_priv(int, ...);
1735 extern int __priv_bracket(priv_op_t);
1736 extern void __priv_relinquish(void);
1737 extern const char * __priv_getsetbynum(const void *, int);
1738 extern char * __priv_set_to_str(void *, const priv_set_t *, char, int);
1740 /* private interface to get the groups list for a certain user */
1741 int _getgroupsbymember(const char *, gid_t[], int, int);
1743 /* private interface for use only by java */
1744 volatile sc_shared_t *volatile *_thr_schedctl(void);
1746 /* private interface to unmount all autofs mounts */
1747 int _autofssys(enum autofssys_op, void *);
1750 extern int is_system_labeled(void);
1752 /* until TOG resolves the name, keep this private */
1753 int __accessat(int, const char *, int);
1755 extern int uconv_u16tou32(const uint16_t *, size_t *, uint32_t *, size_t *,
1757 extern int uconv_u16tou8(const uint16_t *, size_t *, uchar_t *, size_t *, int);
1758 extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *,
1760 extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int);
1761 extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
1762 extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
1763 extern int u8_validate(char *, size_t, char **, int, int *);
1764 extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
1765 extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,