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