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