man pages section 3 basic library functionsgetwc(3c).....316 getwchar(3c).....317

1022
man pages section 3: Basic Library Functions Part No: 816–5168–16 September 2010

Upload: others

Post on 30-Jan-2021

11 views

Category:

Documents


0 download

TRANSCRIPT

  • man pages section 3: Basic LibraryFunctions

    Part No: 816–5168–16September 2010

  • Copyright © 2010, Oracle and/or its affiliates. All rights reserved.

    This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectualproperty laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software,unless required by law for interoperability, is prohibited.

    The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

    If this is software or related software documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the followingnotice is applicable:

    U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are“commercial computer software” or “commercial technical data” pursuant to the applicable Federal Acquisition Regulation and agency-specific supplementalregulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicableGovernment contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, CommercialComputer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.

    This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherentlydangerous applications, including applications which may create a risk of personal injury. If you use this software or hardware in dangerous applications, then youshall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim anyliability for any damages caused by use of this software or hardware in dangerous applications.

    Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

    AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. Intel and Intel Xeon aretrademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARCInternational, Inc. UNIX is a registered trademark licensed through X/Open Company, Ltd.

    This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation andits affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporationand its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.

    110417@25097

  • Contents

    Preface ...................................................................................................................................................17

    Basic Library Functions .......................................................................................................................21a64l(3C) ............................................................................................................................................... 22abort(3C) ............................................................................................................................................. 24abs(3C) ................................................................................................................................................. 25addsev(3C) ........................................................................................................................................... 26addseverity(3C) ................................................................................................................................ 27assert(3C) ........................................................................................................................................... 29atexit(3C) ........................................................................................................................................... 30atomic_add(3C) .................................................................................................................................. 31atomic_and(3C) .................................................................................................................................. 33atomic_bits(3C) ................................................................................................................................ 35atomic_cas(3C) .................................................................................................................................. 36atomic_dec(3C) .................................................................................................................................. 38atomic_inc(3C) .................................................................................................................................. 40atomic_ops(3C) .................................................................................................................................. 42atomic_or(3C) .................................................................................................................................... 43atomic_swap(3C) ................................................................................................................................ 45attropen(3C) ....................................................................................................................................... 46basename(3C) ....................................................................................................................................... 47bsdmalloc(3MALLOC) ..................................................................................................................... 48bsd_signal(3C) .................................................................................................................................. 50bsearch(3C) ......................................................................................................................................... 52bstring(3C) ......................................................................................................................................... 55btowc(3C) ............................................................................................................................................. 56catgets(3C) ......................................................................................................................................... 57catopen(3C) ......................................................................................................................................... 58

    3

  • cfgetispeed(3C) ................................................................................................................................ 61cfsetispeed(3C) ................................................................................................................................ 62clock(3C) ............................................................................................................................................. 63closedir(3C) ....................................................................................................................................... 64closefrom(3C) .................................................................................................................................... 65cond_init(3C) .................................................................................................................................... 67confstr(3C) ......................................................................................................................................... 72crypt(3C) ............................................................................................................................................. 80crypt_genhash_impl(3C) ................................................................................................................. 82crypt_gensalt(3C) ............................................................................................................................ 83crypt_gensalt_impl(3C) ................................................................................................................. 84cset(3C) ............................................................................................................................................... 85ctermid(3C) ......................................................................................................................................... 87ctime(3C) ............................................................................................................................................. 88ctype(3C) ............................................................................................................................................. 93cuserid(3C) ......................................................................................................................................... 96dbm(3UCB) ........................................................................................................................................... 97decimal_to_floating(3C) ............................................................................................................... 99difftime(3C) ..................................................................................................................................... 101directio(3C) ..................................................................................................................................... 102dirname(3C) ....................................................................................................................................... 104div(3C) ............................................................................................................................................... 106dladdr(3C) ......................................................................................................................................... 107dlclose(3C) ....................................................................................................................................... 109dldump(3C) ......................................................................................................................................... 111dlerror(3C) ....................................................................................................................................... 117dlinfo(3C) ......................................................................................................................................... 118dlopen(3C) ......................................................................................................................................... 122dlsym(3C) ........................................................................................................................................... 127drand48(3C) ....................................................................................................................................... 130dup2(3C) ............................................................................................................................................. 132econvert(3C) ..................................................................................................................................... 133ecvt(3C) ............................................................................................................................................. 135enable_extended_FILE_stdio(3C) ............................................................................................... 137encrypt(3C) ....................................................................................................................................... 141end(3C) ............................................................................................................................................... 142

    Contents

    man pages section 3: Basic Library Functions • September 20104

  • euclen(3C) ......................................................................................................................................... 143exit(3C) ............................................................................................................................................. 144fattach(3C) ....................................................................................................................................... 145__fbufsize(3C) ................................................................................................................................ 147fclose(3C) ......................................................................................................................................... 149fdetach(3C) ....................................................................................................................................... 151fdopen(3C) ......................................................................................................................................... 153ferror(3C) ......................................................................................................................................... 155fflush(3C) ......................................................................................................................................... 156ffs(3C) ............................................................................................................................................... 158fgetc(3C) ........................................................................................................................................... 159fgetpos(3C) ....................................................................................................................................... 162fgetwc(3C) ......................................................................................................................................... 163floating_to_decimal(3C) ............................................................................................................. 165flock(3UCB) ..................................................................................................................................... 167flockfile(3C) .................................................................................................................................. 169fmtmsg(3C) ......................................................................................................................................... 171fnmatch(3C) ....................................................................................................................................... 176fopen(3C) ........................................................................................................................................... 178fopen(3UCB) ..................................................................................................................................... 182fpgetround(3C) ................................................................................................................................ 184fputc(3C) ........................................................................................................................................... 186fputwc(3C) ......................................................................................................................................... 189fputws(3C) ......................................................................................................................................... 191fread(3C) ........................................................................................................................................... 192freopen(3C) ....................................................................................................................................... 194fseek(3C) ........................................................................................................................................... 197fsetpos(3C) ....................................................................................................................................... 200fsync(3C) ........................................................................................................................................... 201ftell(3C) ........................................................................................................................................... 203ftime(3C) ........................................................................................................................................... 204ftok(3C) ............................................................................................................................................. 205ftw(3C) ............................................................................................................................................... 207fwide(3C) ........................................................................................................................................... 212fwprintf(3C) ..................................................................................................................................... 213fwrite(3C) ......................................................................................................................................... 221

    Contents

    5

  • fwscanf(3C) ....................................................................................................................................... 222getcpuid(3C) ..................................................................................................................................... 230getcwd(3C) ......................................................................................................................................... 231getdate(3C) ....................................................................................................................................... 233getdtablesize(3C) .......................................................................................................................... 239getenv(3C) ......................................................................................................................................... 240getexecname(3C) .............................................................................................................................. 241getgrnam(3C) ..................................................................................................................................... 242gethostid(3C) .................................................................................................................................. 246gethostname(3C) .............................................................................................................................. 247gethrtime(3C) .................................................................................................................................. 248getloadavg(3C) ................................................................................................................................ 249getlogin(3C) ..................................................................................................................................... 250getmntent(3C) .................................................................................................................................. 252getnetgrent(3C) .............................................................................................................................. 254getopt(3C) ......................................................................................................................................... 257getopt_long(3C) .............................................................................................................................. 263getpagesize(3C) .............................................................................................................................. 271getpagesizes(3C) ............................................................................................................................ 272getpass(3C) ....................................................................................................................................... 273getpeerucred(3C) ............................................................................................................................ 274getpriority(3C) .............................................................................................................................. 276getpw(3C) ........................................................................................................................................... 279getpwnam(3C) ..................................................................................................................................... 280getrusage(3C) .................................................................................................................................. 285gets(3C) ............................................................................................................................................. 288getspnam(3C) ..................................................................................................................................... 289getsubopt(3C) .................................................................................................................................. 293gettext(3C) ....................................................................................................................................... 297gettimeofday(3C) ............................................................................................................................ 301gettimeofday(3UCB) ...................................................................................................................... 303gettxt(3C) ......................................................................................................................................... 304getusershell(3C) ............................................................................................................................ 306getutent(3C) ..................................................................................................................................... 307getutxent(3C) .................................................................................................................................. 310getvfsent(3C) .................................................................................................................................. 314

    Contents

    man pages section 3: Basic Library Functions • September 20106

  • getwc(3C) ........................................................................................................................................... 316getwchar(3C) ..................................................................................................................................... 317getwd(3C) ........................................................................................................................................... 318getwidth(3C) ..................................................................................................................................... 319getws(3C) ........................................................................................................................................... 320getzoneid(3C) .................................................................................................................................. 322glob(3C) ............................................................................................................................................. 324grantpt(3C) ....................................................................................................................................... 328hsearch(3C) ....................................................................................................................................... 329iconv(3C) ........................................................................................................................................... 332iconv_close(3C) .............................................................................................................................. 338iconv_open(3C) ................................................................................................................................ 339imaxabs(3C) ....................................................................................................................................... 341imaxdiv(3C) ....................................................................................................................................... 342index(3C) ........................................................................................................................................... 343initgroups(3C) ................................................................................................................................ 344insque(3C) ......................................................................................................................................... 345isaexec(3C) ....................................................................................................................................... 346isastream(3C) .................................................................................................................................. 348isatty(3C) ......................................................................................................................................... 349isnand(3C) ......................................................................................................................................... 350is_system_labeled(3C) .................................................................................................................. 352iswalpha(3C) ..................................................................................................................................... 353iswctype(3C) ..................................................................................................................................... 356killpg(3C) ......................................................................................................................................... 358lckpwdf(3C) ....................................................................................................................................... 359lfmt(3C) ............................................................................................................................................. 360localeconv(3C) ................................................................................................................................ 365lockf(3C) ........................................................................................................................................... 371_longjmp(3C) ..................................................................................................................................... 374lsearch(3C) ....................................................................................................................................... 375madvise(3C) ....................................................................................................................................... 377makecontext(3C) .............................................................................................................................. 380makedev(3C) ....................................................................................................................................... 383malloc(3C) ......................................................................................................................................... 384malloc(3MALLOC) .......................................................................................................................... 387

    Contents

    7

  • mapmalloc(3MALLOC) ................................................................................................................... 390mblen(3C) ........................................................................................................................................... 392mbrlen(3C) ......................................................................................................................................... 393mbrtowc(3C) ....................................................................................................................................... 395mbsinit(3C) ....................................................................................................................................... 397mbsrtowcs(3C) .................................................................................................................................. 398mbstowcs(3C) ..................................................................................................................................... 400mbtowc(3C) ......................................................................................................................................... 401mctl(3UCB) ....................................................................................................................................... 402membar_ops(3C) ................................................................................................................................ 404memory(3C) ......................................................................................................................................... 406mkfifo(3C) ......................................................................................................................................... 408mkstemp(3C) ....................................................................................................................................... 410mktemp(3C) ......................................................................................................................................... 411mktime(3C) ......................................................................................................................................... 412mlock(3C) ........................................................................................................................................... 415mlockall(3C) ..................................................................................................................................... 417monitor(3C) ....................................................................................................................................... 419msync(3C) ........................................................................................................................................... 421mtmalloc(3MALLOC) ...................................................................................................................... 423mutex_init(3C) ................................................................................................................................ 426ndbm(3C) ............................................................................................................................................. 439nice(3UCB) ....................................................................................................................................... 443nlist(3UCB) ..................................................................................................................................... 444nl_langinfo(3C) .............................................................................................................................. 445offsetof(3C) ..................................................................................................................................... 446opendir(3C) ....................................................................................................................................... 447perror(3C) ......................................................................................................................................... 449pfmt(3C) ............................................................................................................................................. 450plock(3C) ........................................................................................................................................... 453popen(3C) ........................................................................................................................................... 454port_alert(3C) ................................................................................................................................ 457port_associate(3C) ........................................................................................................................ 459port_create(3C) .............................................................................................................................. 464port_get(3C) ..................................................................................................................................... 466port_send(3C) .................................................................................................................................. 470

    Contents

    man pages section 3: Basic Library Functions • September 20108

  • posix_openpt(3C) ............................................................................................................................ 473posix_spawn(3C) .............................................................................................................................. 475posix_spawnattr_destroy(3C) ..................................................................................................... 480posix_spawnattr_getflags(3C) ................................................................................................... 482posix_spawnattr_getpgroup(3C) ................................................................................................. 484posix_spawnattr_getschedparam(3C) ........................................................................................ 485posix_spawnattr_getschedpolicy(3C) ...................................................................................... 486posix_spawnattr_getsigdefault(3C) ........................................................................................ 487posix_spawnattr_getsigmask(3C) ............................................................................................... 488posix_spawn_file_actions_addclose(3C) ................................................................................ 489posix_spawn_file_actions_adddup2(3C) .................................................................................. 491posix_spawn_file_actions_destroy(3C) .................................................................................. 492printf(3C) ......................................................................................................................................... 493printf(3UCB) ................................................................................................................................... 504priv_addset(3C) .............................................................................................................................. 508priv_set(3C) ..................................................................................................................................... 511priv_str_to_set(3C) ...................................................................................................................... 513pset_getloadavg(3C) ...................................................................................................................... 516psignal(3C) ....................................................................................................................................... 517psignal(3UCB) ................................................................................................................................. 518pthread_atfork(3C) ........................................................................................................................ 519pthread_attr_getdetachstate(3C) ............................................................................................ 521pthread_attr_getguardsize(3C) ................................................................................................. 522pthread_attr_getinheritsched(3C) .......................................................................................... 524pthread_attr_getschedparam(3C) ............................................................................................... 526pthread_attr_getschedpolicy(3C) ............................................................................................ 527pthread_attr_getscope(3C) ......................................................................................................... 528pthread_attr_getstack(3C) ......................................................................................................... 529pthread_attr_getstackaddr(3C) ................................................................................................. 531pthread_attr_getstacksize(3C) ................................................................................................. 532pthread_attr_init(3C) .................................................................................................................. 533pthread_barrierattr_destroy(3C) ............................................................................................ 535pthread_barrierattr_getpshared(3C) ...................................................................................... 536pthread_barrier_destroy(3C) ..................................................................................................... 538pthread_barrier_wait(3C) ........................................................................................................... 540pthread_cancel(3C) ........................................................................................................................ 542

    Contents

    9

  • pthread_cleanup_pop(3C) ............................................................................................................. 544pthread_cleanup_push(3C) ........................................................................................................... 545pthread_condattr_getclock(3C) ................................................................................................. 547pthread_condattr_getpshared(3C) ............................................................................................ 549pthread_condattr_init(3C) ......................................................................................................... 551pthread_cond_init(3C) .................................................................................................................. 553pthread_cond_signal(3C) ............................................................................................................. 555pthread_cond_wait(3C) .................................................................................................................. 557pthread_create(3C) ........................................................................................................................ 560pthread_detach(3C) ........................................................................................................................ 564pthread_equal(3C) .......................................................................................................................... 565pthread_exit(3C) ............................................................................................................................ 566pthread_getconcurrency(3C) ....................................................................................................... 568pthread_getschedparam(3C) ......................................................................................................... 570pthread_getspecific(3C) ............................................................................................................. 572pthread_join(3C) ............................................................................................................................ 574pthread_key_create(3C) ............................................................................................................... 576pthread_key_delete(3C) ............................................................................................................... 578pthread_kill(3C) ............................................................................................................................ 579pthread_mutexattr_getprioceiling(3C) .................................................................................. 580pthread_mutexattr_getprotocol(3C) ........................................................................................ 582pthread_mutexattr_getpshared(3C) .......................................................................................... 585pthread_mutexattr_getrobust_np(3C) ...................................................................................... 587pthread_mutexattr_gettype(3C) ................................................................................................. 589pthread_mutexattr_init(3C) ....................................................................................................... 591pthread_mutex_consistent_np(3C) ............................................................................................ 592pthread_mutex_getprioceiling(3C) .......................................................................................... 593pthread_mutex_init(3C) ............................................................................................................... 595pthread_mutex_lock(3C) ............................................................................................................... 597pthread_mutex_timedlock(3C) ..................................................................................................... 600pthread_once(3C) ............................................................................................................................ 602pthread_rwlockattr_getpshared(3C) ........................................................................................ 603pthread_rwlockattr_init(3C) ..................................................................................................... 605pthread_rwlock_init(3C) ............................................................................................................. 606pthread_rwlock_rdlock(3C) ......................................................................................................... 608pthread_rwlock_timedrdlock(3C) ............................................................................................... 610

    Contents

    man pages section 3: Basic Library Functions • September 201010

  • pthread_rwlock_timedwrlock(3C) ............................................................................................... 612pthread_rwlock_unlock(3C) ......................................................................................................... 614pthread_rwlock_wrlock(3C) ......................................................................................................... 615pthread_self(3C) ............................................................................................................................ 617pthread_setcancelstate(3C) ....................................................................................................... 618pthread_setcanceltype(3C) ......................................................................................................... 619pthread_setschedprio(3C) ........................................................................................................... 621pthread_sigmask(3C) ...................................................................................................................... 622pthread_spin_destroy(3C) ........................................................................................................... 627pthread_spin_lock(3C) .................................................................................................................. 629pthread_spin_unlock(3C) ............................................................................................................. 630pthread_testcancel(3C) ............................................................................................................... 631ptrace(3C) ......................................................................................................................................... 632ptsname(3C) ....................................................................................................................................... 635putenv(3C) ......................................................................................................................................... 636putpwent(3C) ..................................................................................................................................... 637puts(3C) ............................................................................................................................................. 638putspent(3C) ..................................................................................................................................... 639putws(3C) ........................................................................................................................................... 640qsort(3C) ........................................................................................................................................... 641raise(3C) ........................................................................................................................................... 643rand(3C) ............................................................................................................................................. 644rand(3UCB) ....................................................................................................................................... 645random(3C) ......................................................................................................................................... 646rctlblk_set_value(3C) .................................................................................................................. 649rctl_walk(3C) .................................................................................................................................. 654readdir(3C) ....................................................................................................................................... 656readdir(3UCB) ................................................................................................................................. 660realpath(3C) ..................................................................................................................................... 662reboot(3C) ......................................................................................................................................... 664re_comp(3C) ....................................................................................................................................... 665regcmp(3C) ......................................................................................................................................... 666regcomp(3C) ....................................................................................................................................... 668remove(3C) ......................................................................................................................................... 674rewind(3C) ......................................................................................................................................... 675rewinddir(3C) .................................................................................................................................. 676

    Contents

    11

  • rwlock(3C) ......................................................................................................................................... 677scandir(3C) ....................................................................................................................................... 680scandir(3UCB) ................................................................................................................................. 682scanf(3C) ........................................................................................................................................... 683schedctl_init(3C) .......................................................................................................................... 691seekdir(3C) ....................................................................................................................................... 693select(3C) ......................................................................................................................................... 694semaphore(3C) .................................................................................................................................. 699setbuf(3C) ......................................................................................................................................... 703setbuffer(3C) .................................................................................................................................. 705setcat(3C) ......................................................................................................................................... 706setenv(3C) ......................................................................................................................................... 707setjmp(3C) ......................................................................................................................................... 708setjmp(3UCB) ................................................................................................................................... 711setkey(3C) ......................................................................................................................................... 714setlabel(3C) ..................................................................................................................................... 715setlocale(3C) .................................................................................................................................. 716sigblock(3UCB) ............................................................................................................................... 719sigfpe(3C) ......................................................................................................................................... 720siginterrupt(3C) ............................................................................................................................ 723siginterrupt(3UCB) ...................................................................................................................... 724signal(3C) ......................................................................................................................................... 725signal(3UCB) ................................................................................................................................... 727sigsetops(3C) .................................................................................................................................. 729sigstack(3C) ..................................................................................................................................... 731sigstack(3UCB) ............................................................................................................................... 733sigvec(3UCB) ................................................................................................................................... 734sleep(3C) ........................................................................................................................................... 739sleep(3UCB) ..................................................................................................................................... 740ssignal(3C) ....................................................................................................................................... 741stack_getbounds(3C) ...................................................................................................................... 742_stack_grow(3C) .............................................................................................................................. 743stack_inbounds(3C) ........................................................................................................................ 744stack_setbounds(3C) ...................................................................................................................... 745stack_violation(3C) ...................................................................................................................... 746stdio(3C) ........................................................................................................................................... 748

    Contents

    man pages section 3: Basic Library Functions • September 201012

  • str2sig(3C) ....................................................................................................................................... 752strcoll(3C) ....................................................................................................................................... 753strerror(3C) ..................................................................................................................................... 754strfmon(3C) ....................................................................................................................................... 755strftime(3C) ..................................................................................................................................... 760string(3C) ......................................................................................................................................... 765string_to_decimal(3C) .................................................................................................................. 772strptime(3C) ..................................................................................................................................... 776strsignal(3C) .................................................................................................................................. 781strtod(3C) ......................................................................................................................................... 782strtoimax(3C) .................................................................................................................................. 787strtol(3C) ......................................................................................................................................... 788strtoul(3C) ....................................................................................................................................... 791strtows(3C) ....................................................................................................................................... 793strxfrm(3C) ....................................................................................................................................... 794swab(3C) ............................................................................................................................................. 796sync_instruction_memory(3C) ..................................................................................................... 797syscall(3UCB) ................................................................................................................................. 798sysconf(3C) ....................................................................................................................................... 799syslog(3C) ......................................................................................................................................... 808system(3C) ......................................................................................................................................... 812tcdrain(3C) ....................................................................................................................................... 813tcflow(3C) ......................................................................................................................................... 814tcflush(3C) ....................................................................................................................................... 816tcgetattr(3C) .................................................................................................................................. 817tcgetpgrp(3C) .................................................................................................................................. 818tcgetsid(3C) ..................................................................................................................................... 819tcsendbreak(3C) .............................................................................................................................. 820tcsetattr(3C) .................................................................................................................................. 821tcsetpgrp(3C) .................................................................................................................................. 823td_init(3C_DB) ............................................................................................................................... 824td_log(3C_DB) ................................................................................................................................. 825td_sync_get_info(3C_DB) ............................................................................................................ 826td_ta_enable_stats(3C_DB) ....................................................................................................... 829td_ta_event_addr(3C_DB) ............................................................................................................ 831td_ta_get_nthreads(3C_DB) ....................................................................................................... 835

    Contents

    13

  • td_ta_map_addr2sync(3C_DB) ..................................................................................................... 836td_ta_map_id2thr(3C_DB) ............................................................................................................ 837td_ta_new(3C_DB) .......................................................................................................................... 838td_ta_setconcurrency(3C_DB) ................................................................................................... 840td_ta_sync_iter(3C_DB) .............................................................................................................. 841td_thr_dbsuspend(3C_DB) ............................................................................................................ 843td_thr_getgregs(3C_DB) .............................................................................................................. 844td_thr_get_info(3C_DB) .............................................................................................................. 846td_thr_lockowner(3C_DB) ............................................................................................................ 849td_thr_setprio(3C_DB) ................................................................................................................ 850td_thr_setsigpending(3C_DB) ................................................................................................... 851td_thr_sleepinfo(3C_DB) ............................................................................................................ 852td_thr_tsd(3C_DB) ........................................................................................................................ 853td_thr_validate(3C_DB) .............................................................................................................. 854tell(3C) ............................................................................................................................................. 855telldir(3C) ....................................................................................................................................... 856termios(3C) ....................................................................................................................................... 857thr_create(3C) ................................................................................................................................ 858thr_exit(3C) ..................................................................................................................................... 864thr_getconcurrency(3C) ............................................................................................................... 866thr_getprio(3C) .............................................................................................................................. 867thr_join(3C) ..................................................................................................................................... 868thr_keycreate(3C) .......................................................................................................................... 870thr_kill(3C) ..................................................................................................................................... 874thr_main(3C) ..................................................................................................................................... 875thr_min_stack(3C) .......................................................................................................................... 876thr_self(3C) ..................................................................................................................................... 878thr_sigsetmask(3C) ........................................................................................................................ 879thr_stksegment(3C) ........................................................................................................................ 884thr_suspend(3C) .............................................................................................................................. 885thr_yield(3C) .................................................................................................................................. 886times(3UCB) ..................................................................................................................................... 887tmpfile(3C) ....................................................................................................................................... 888tmpnam(3C) ......................................................................................................................................... 889toascii(3C) ....................................................................................................................................... 891_tolower(3C) ..................................................................................................................................... 892

    Contents

    man pages section 3: Basic Library Functions • September 201014

  • tolower(3C) ....................................................................................................................................... 893_toupper(3C) ..................................................................................................................................... 894toupper(3C) ....................................................................................................................................... 895towctrans(3C) .................................................................................................................................. 896towlower(3C) ..................................................................................................................................... 897towupper(3C) ..................................................................................................................................... 898truncate(3C) ..................................................................................................................................... 899tsearch(3C) ....................................................................................................................................... 902ttyname(3C) ....................................................................................................................................... 906ttyslot(3C) ....................................................................................................................................... 908u8_strcmp(3C) .................................................................................................................................. 909u8_textprep_str(3C) ...................................................................................................................... 913u8_validate(3C) .............................................................................................................................. 917ualarm(3C) ......................................................................................................................................... 921uconv_u16tou32(3C) ........................................................................................................................ 922ucred_get(3C) .................................................................................................................................. 928umem_alloc(3MALLOC) ................................................................................................................. 931umem_cache_create(3MALLOC) ................................................................................................... 937umem_debug(3MALLOC) ................................................................................................................. 946ungetc(3C) ......................................................................................................................................... 949ungetwc(3C) ....................................................................................................................................... 950unlockpt(3C) ..................................................................................................................................... 951unsetenv(3C) ..................................................................................................................................... 952usleep(3C) ......................................................................................................................................... 953vfwprintf(3C) .................................................................................................................................. 954vlfmt(3C) ........................................................................................................................................... 955vpfmt(3C) ........................................................................................................................................... 957vprintf(3C) ....................................................................................................................................... 959vsyslog(3C) ....................................................................................................................................... 961wait3(3C) ........................................................................................................................................... 963wait(3C) ............................................................................................................................................. 966wait(3UCB) ....................................................................................................................................... 968waitpid(3C) ....................................................................................................................................... 972walkcontext(3C) .............................................................................................................................. 974watchmalloc(3MALLOC) ............................................................................................................... 976wcrtomb(3C) ....................................................................................................................................... 979

    Contents

    15

  • wcscoll(3C) ....................................................................................................................................... 981wcsftime(3C) ..................................................................................................................................... 982wcsrtombs(3C) .................................................................................................................................. 983wcsstr(3C) ......................................................................................................................................... 985wcstod(3C) ......................................................................................................................................... 986wcstoimax(3C) .................................................................................................................................. 989wcstol(3C) ......................................................................................................................................... 990wcstombs(3C) ..................................................................................................................................... 993wcstoul(3C) ....................................................................................................................................... 994wcstring(3C) ..................................................................................................................................... 997wcswidth(3C) ................................................................................................................................... 1002wcsxfrm(3C) ..................................................................................................................................... 1003wctob(3C) ......................................................................................................................................... 1005wctomb(3C) ....................................................................................................................................... 1006wctrans(3C) ..................................................................................................................................... 1007wctype(3C) ....................................................................................................................................... 1008wcwidth(3C) ..................................................................................................................................... 1009wmemchr(3C) ..................................................................................................................................... 1010wmemcmp(3C) ..................................................................................................................................... 1011wmemcpy(3C) ..................................................................................................................................... 1012wmemmove(3C) ................................................................................................................................... 1013wmemset(3C) ..................................................................................................................................... 1014wordexp(3C) ..................................................................................................................................... 1015wsprintf(3C) ................................................................................................................................... 1019wsscanf(3C) ..................................................................................................................................... 1020wstring(3C) ..................................................................................................................................... 1021

    Contents

    man pages section 3: Basic Library Functions • September 201016

  • Preface

    Both novice users and those familar with the SunOS operating system can use online man pagesto obtain information about the system and its features. A man page is intended to answerconcisely the question “What does it do?” The man pages in general comprise a referencemanual. They are not intended to be a tutorial.

    OverviewThe following contains a brief description of each man page section and the information itreferences:■ Section 1 describes, in alphabetical order, commands available with the operating system.■ Section 1M describes, in alphabetical order, commands that are used chiefly for system

    maintenance and administration purposes.■ Section 2 describes all of the system calls. Most of these calls have one or more error returns.

    An error condition is indicated by an otherwise impossible returned value.■ Section 3 describes functions found in various libraries, other than those functions that

    directly invoke UNIX system primitives, which are described in Section 2.■ Section 4 outlines the formats of various files. The C structure declarations for the file

    formats are given where applicable.■ Section 5 contains miscellaneous documentation such as character-set tables.■ Section 6 contains available games and demos.■ Section 7 describes various special files that refer to specific hardware peripherals and device

    drivers. STREAMS software drivers, modules and the STREAMS-generic set of system callsare also described.

    ■ Section 9 provides reference information needed to write device drivers in the kernelenvironment. It describes two device driver interface specifications: the Device DriverInterface (DDI) and the Driver/Kernel Interface (DKI).

    ■ Section 9E describes the DDI/DKI, DDI-only, and DKI-only entry-point routines adeveloper can include in a device driver.

    ■ Section 9F describes the kernel functions available for use by device drivers.■ Section 9S describes the data structures used by drivers to share information between the

    driver and the kernel.

    17

  • Below is a generic format for man pages. The man pages of each manual section generallyfollow this order, but include only needed headings. For example, if there are no bugs to report,there is no BUGS section. See the intro pages for more information and detail about eachsection, and man(1) for more information about man pages in general.

    NAME This section gives the names of the commands or functionsdocumented, followed by a brief description of what theydo.

    SYNOPSIS This section shows the syntax of commands or functions.When a command or file does not exist in the standardpath, its full path name is shown. Options and argumentsare alphabetized, with single letter arguments first, andoptions with arguments next, unless a different argumentorder is required.

    The following special characters are used in this section:

    [ ] Brackets. The option or argument enclosed inthese brackets is optional. If the brackets areomitted, the argument must be specified.

    . . . Ellipses. Several values can be provided for theprevious argument, or the previous argumentcan be specified multiple times, for example,"filename . . ." .

    | Separator. Only one of the argumentsseparated by this character can be specified at atime.

    { } Braces. The options and/or argumentsenclosed within braces are interdependent,such that everything enclosed must be treatedas a unit.

    PROTOCOL This section occurs only in subsection 3R to indicate theprotocol description file.

    DESCRIPTION This section defines the functionality and behavior of theservice. Thus it describes concisely what the commanddoes. It does not discuss OPTIONS or cite EXAMPLES.Interactive commands, subcommands, requests, macros,and functions are described under USAGE.

    IOCTL This section appears on pages in Section 7 only. Only thedevice class that supplies appropriate parameters to theioctl(2) system call is called ioctl and generates its own

    Preface

    man pages section 3: Basic Library Functions • September 201018

    http://www.oracle.com/pls/topic/lookup?ctx=816-5165&id=man-1http://www.oracle.com/pls/topic/lookup?ctx=816-5167&id=ioctl-2

  • heading. ioctl calls for a specific device are listedalphabetically (on the man page for that specific device).ioctl calls are used for a particular class of devices all ofwhich have an io ending, such as mtio(7I).

    OPTIONS This secton lists the command options with a concisesummary of what each option does. The options are listedliterally and in the order they appear in the SYNOPSISsection. Possible arguments to options are discussed underthe option, and where appropriate, default values aresupplied.

    OPERANDS This section lists the command operands and describeshow they affect the actions of the command.

    OUTPUT This section describes the output – standard output,standard error, or output files – generated by thecommand.

    RETURN VALUES If the man page documents functions that return values,this section lists these values and describes the conditionsunder which they are returned. If a function can returnonly constant values, such as 0 or –1, these values are listedin tagged paragraphs. Otherwise, a single paragraphdescribes the return values of each function. Functionsdeclared void do not return values, so they are notdiscussed in RETURN VALUES.

    ERRORS On failure, most functions place an error code in the globalvariable errno indicating why they failed. This section listsalphabetically all error codes a function can generate anddescribes the conditions that cause each error. When morethan one condition can cause the same error, eachcondition is described in a separate paragraph under theerror code.

    USAGE This section lists special rules, features, and commandsthat require in-depth explanations. The subsections listedhere are used to explain built-in functionality:

    CommandsModifiersVariablesExpressionsInput Grammar

    Preface

    19

    http://www.oracle.com/pls/topic/lookup?ctx=816-5177&id=mtio-7i

  • EXAMPLES This section provides examples of usage or of how to use acommand or function. Wherever possible a completeexample including command-line entry and machineresponse is shown. Whenever an example is given, theprompt is shown as example%, or if the user must besuperuser, example#. Examples are followed byexplanations, variable substitution rules, or returnedvalues. Most examples illustrate concepts from theSYNOPSIS, DESCRIPTION, OPTIONS, and USAGEsections.

    ENVIRONMENT VARIABLES This section lists any environment variables that thecommand or function affects, followed by a briefdescription of the effect.

    EXIT STATUS This section lists the values the command returns to thecalling program or shell and the conditions that cause thesevalues to be returned. Usually, zero is returned forsuccessful completion, and values other than zero forvarious error conditions.

    FILES This section lists all file names referred to by the man page,files of interest, and files created or required by commands.Each is followed by a descriptive summary or explanation.

    ATTRIBUTES This section lists characteristics of commands, utilities,and device drivers by defining the attribute type and itscorresponding value. See attributes(5) for moreinformation.

    SEE ALSO This section lists references to other man pages, in-housedocumentation, and outside publications.

    DIAGNOSTICS This section lists diagnostic messages with a briefexplanation of the condition causing the error.

    WARNINGS This section lists warnings about special conditions whichcould seriously affect your working conditions. This is nota list of diagnostics.

    NOTES This section lists additional information that does notbelong anywhere else on the page. It takes the form of anaside to the user, covering points of special interest.Critical information is never covered here.

    BUGS This section describes known bugs and, wherever possible,suggests workarounds.

    Preface

    man pages section 3: Basic Library Functions • September 201020

    http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=attributes-5

  • Basic Library Functions

    R E F E R E N C E

    21

  • a64l, l64a – convert between long integer and base-64 ASCII string

    #include

    long a64l(const char *s);

    char *l64a(long l);

    These functions maintain numbers stored in base-64 ASCII characters that define a notationby which long integers can be represented by up to six characters. Each character represents a“digit” in a radix-64 notation.

    The characters used to represent “digits” are as follows:

    Character Digit

    . 0

    / 1

    0-9 2-11

    A-Z 12-37

    a-z 38-63

    The a64l() function takes a pointer to a null-terminated base-64 representation and returns acorresponding long value. If the string pointed to by s contains more than six characters,a64l() uses the first six.

    The a64l() function scans the character string from left to right with the least significant digiton the left, decoding each character as a 6-bit radix-64 number.

    The l64a() function takes a long argument and returns a pointer to the correspondingbase-64 representation. If the argument is 0, l64a() returns a pointer to a null string.

    The value returned by l64a() is a pointer into a static buffer, the contents of which areoverwritten by each call. In the case of multithreaded applications, the return value is a pointerto thread specific data.

    See attributes(5) for descriptions of the following attributes:

    ATTRIBUTE TYPE ATTRIBUTE VALUE

    Interface Stability Standard

    MT-Level MT-Safe

    Name

    Synopsis

    Description

    Attributes

    a64l(3C)

    man pages section 3: Basic Library Functions • Last Revised 24 Jul 200222

    http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=attributes-5

  • attributes(5), standards(5)See Also

    a64l(3C)

    Basic Library Functions 23

    http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=attributes-5http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=standards-5

  • abort – terminate the process abnormally

    #include

    void abort(void);

    The abort() function causes abnormal process termination to occur, unless the signalSIGABRT is being caught and the signal handler does not return. The abnormal terminationprocessing includes at least the effect of fclose(3C) on all open streams and messagecatalogue descriptors, and the default actions defined for SIGABRT. The SIGABRT signal is sentto the calling process as if by means of the raise(3C) function with the argument SIGABRT.

    The status made available to wait(3C) or waitpid(3C) by abort will be that of a processterminated by the SIGABRT signal. abort will override blocking or ignoring the SIGABRT signal.

    The abort() function does not return.

    No errors are defined.

    Catching the signal is intended to provide the application writer with a portable means toabort processing, free from possible interference from any implementation-provided libraryfunctions. If SIGABRT is neither caught nor ignored, and the current directory is writable, acore dump may be produced.

    See attributes(5) for descriptions of the following attributes:

    ATTRIBUTE TYPE ATTRIBUTE VALUE

    Interface Stability Standard

    MT-Level Safe

    exit(2), getrlimit(2), kill(2), fclose(3C), raise(3C), signal(3C), wait(3C),waitpid(3C), attributes(5), standards(5)

    Name

    Synopsis

    Description

    Return Values

    Errors

    Usage

    Attributes

    See Also

    abort(3C)

    man pages section 3: Basic Library Functions • Last Revised 24 Jul 200224

    http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=attributes-5http://www.oracle.com/pls/topic/lookup?ctx=816-5167&id=exit-2http://www.oracle.com/pls/topic/lookup?ctx=816-5167&id=getrlimit-2http://www.oracle.com/pls/topic/lookup?ctx=816-5167&id=kill-2http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=attributes-5http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=standards-5

  • abs, labs, llabs – return absolute value of integer

    #include

    int abs(int val);

    long labs(long lval);

    long long llabs(long long llval);

    The abs() function returns the absolute value of its int operand.

    The labs() function returns the absolute value of its long operand.

    The llabs() function returns the absolute value of its long long operand.

    In 2's-complement representation, the absolute value of the largest magnitude negativeintegral value is undefined.

    See attributes(5) for descriptions of the following attributes:

    ATTRIBUTE TYPE ATTRIBUTE VALUE

    Interface Stability Standard

    MT-Level MT-Safe

    attributes(5), standards(5)

    Name

    Synopsis

    Description

    Usage

    Attributes

    See Also

    abs(3C)

    Basic Library Functions 25

    http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=attributes-5http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=attributes-5http://www.oracle.com/pls/topic/lookup?ctx=816-5175&id=standards-5

  • addsev – define additional severities

    #include

    int addsev(int int_val, const char *string);

    The addsev() function defines additional severities for use in subsequent calls to pfmt(3C) orlfmt(3C). It associates an integer value int_val in the range [5-255] with a character string,overwriting any previous string association between int_val and string.

    If int_val is OR-ed with the flags argument passed to subsequent calls to pfmt() or lfmt(),string will be used as severity. Passing a null string removes the severity.

    Upon successful completion, addsev() returns 0. Otherwise it returns−1.

    Only the standard severities are automatically displayed for the locale in effe