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