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