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