816-5168

1026
man pages section 3: Basic Library Functions Part No: 816–5168–18 January 2013

Upload: havisha-ramu

Post on 14-Apr-2015

40 views

Category:

Documents


2 download

DESCRIPTION

.

TRANSCRIPT

man pages section 3: Basic Library Functions

Part No: 816516818 January 2013

Copyright 1993, 2013, 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 intellectual property 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 documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT END USERS. Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. 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 inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability 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. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and 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.

Ce logiciel et la documentation qui laccompagne sont protgs par les lois sur la proprit intellectuelle. Ils sont concds sous licence et soumis des restrictions dutilisation et de divulgation. Sauf disposition de votre contrat de licence ou de la loi, vous ne pouvez pas copier, reproduire, traduire, diffuser, modifier, breveter, transmettre, distribuer, exposer, excuter, publier ou afficher le logiciel, mme partiellement, sous quelque forme et par quelque procd que ce soit. Par ailleurs, il est interdit de procder toute ingnierie inverse du logiciel, de le dsassembler ou de le dcompiler, except des fins dinteroprabilit avec des logiciels tiers ou tel que prescrit par la loi. Les informations fournies dans ce document sont susceptibles de modification sans pravis. Par ailleurs, Oracle Corporation ne garantit pas quelles soient exemptes derreurs et vous invite, le cas chant, lui en faire part par crit. Si ce logiciel, ou la documentation qui laccompagne, est concd sous licence au Gouvernement des Etats-Unis, ou toute entit qui dlivre la licence de ce logiciel ou lutilise pour le compte du Gouvernement des Etats-Unis, la notice suivante sapplique: U.S. GOVERNMENT END USERS. Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. Ce logiciel ou matriel a t dvelopp pour un usage gnral dans le cadre dapplications de gestion des informations. Ce logiciel ou matriel nest pas conu ni nest destin tre utilis dans des applications risque, notamment dans des applications pouvant causer des dommages corporels. Si vous utilisez ce logiciel ou matriel dans le cadre dapplications dangereuses, il est de votre responsabilit de prendre toutes les mesures de secours, de sauvegarde, de redondance et autres mesures ncessaires son utilisation dans des conditions optimales de scurit. Oracle Corporation et ses affilis dclinent toute responsabilit quant aux dommages causs par lutilisation de ce logiciel ou matriel pour ce type dapplications. Oracle et Java sont des marques dposes dOracle Corporation et/ou de ses affilis. Tout autre nom mentionn peut correspondre des marques appartenant dautres propritaires quOracle. Intel et Intel Xeon sont des marques ou des marques dposes dIntel Corporation. Toutes les marques SPARC sont utilises sous licence et sont des marques ou des marques dposes de SPARC International, Inc. AMD, Opteron, le logo AMD et le logo AMD Opteron sont des marques ou des marques dposes dAdvanced Micro Devices. UNIX est une marque dpose dThe Open Group. Ce logiciel ou matriel et la documentation qui laccompagne peuvent fournir des informations ou des liens donnant accs des contenus, des produits et des services manant de tiers. Oracle Corporation et ses affilis dclinent toute responsabilit ou garantie expresse quant aux contenus, produits ou services manant de tiers. En aucun cas, Oracle Corporation et ses affilis ne sauraient tre tenus pour responsables des pertes subies, des cots occasionns ou des dommages causs par laccs des contenus, produits ou services tiers, ou leur utilisation.

130204@25097

Contents

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

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

Contents

cfgetispeed(3C) ................................................................................................................................ 61 cfsetispeed(3C) ................................................................................................................................ 62 clock(3C) ............................................................................................................................................. 63 closedir(3C) ....................................................................................................................................... 64 closefrom(3C) .................................................................................................................................... 65 cond_init(3C) .................................................................................................................................... 67 confstr(3C) ......................................................................................................................................... 72 crypt(3C) ............................................................................................................................................. 80 crypt_genhash_impl(3C) ................................................................................................................. 82 crypt_gensalt(3C) ............................................................................................................................ 83 crypt_gensalt_impl(3C) ................................................................................................................. 84 cset(3C) ............................................................................................................................................... 85 ctermid(3C) ......................................................................................................................................... 87 ctime(3C) ............................................................................................................................................. 88 ctype(3C) ............................................................................................................................................. 93 cuserid(3C) ......................................................................................................................................... 96 dbm(3UCB) ........................................................................................................................................... 97 decimal_to_floating(3C) ............................................................................................................... 99 difftime(3C) ..................................................................................................................................... 101 directio(3C) ..................................................................................................................................... 102 dirname(3C) ....................................................................................................................................... 104 div(3C) ............................................................................................................................................... 106 dladdr(3C) ......................................................................................................................................... 107 dlclose(3C) ....................................................................................................................................... 109 dldump(3C) ......................................................................................................................................... 111 dlerror(3C) ....................................................................................................................................... 117 dlinfo(3C) ......................................................................................................................................... 118 dlopen(3C) ......................................................................................................................................... 123 dlsym(3C) ........................................................................................................................................... 128 drand48(3C) ....................................................................................................................................... 131 dup2(3C) ............................................................................................................................................. 133 econvert(3C) ..................................................................................................................................... 134 ecvt(3C) ............................................................................................................................................. 136 enable_extended_FILE_stdio(3C) ............................................................................................... 138 encrypt(3C) ....................................................................................................................................... 142 end(3C) ............................................................................................................................................... 1434 man pages section 3: Basic Library Functions January 2013

Contents

euclen(3C) ......................................................................................................................................... 144 exit(3C) ............................................................................................................................................. 145 fattach(3C) ....................................................................................................................................... 146 __fbufsize(3C) ................................................................................................................................ 148 fclose(3C) ......................................................................................................................................... 150 fdetach(3C) ....................................................................................................................................... 152 fdopen(3C) ......................................................................................................................................... 154 ferror(3C) ......................................................................................................................................... 156 fflush(3C) ......................................................................................................................................... 157 ffs(3C) ............................................................................................................................................... 159 fgetc(3C) ........................................................................................................................................... 160 fgetpos(3C) ....................................................................................................................................... 163 fgetwc(3C) ......................................................................................................................................... 164 floating_to_decimal(3C) ............................................................................................................. 166 flock(3UCB) ..................................................................................................................................... 168 flockfile(3C) .................................................................................................................................. 170 fmtmsg(3C) ......................................................................................................................................... 172 fnmatch(3C) ....................................................................................................................................... 177 fopen(3C) ........................................................................................................................................... 179 fopen(3UCB) ..................................................................................................................................... 183 fpgetround(3C) ................................................................................................................................ 185 fputc(3C) ........................................................................................................................................... 187 fputwc(3C) ......................................................................................................................................... 190 fputws(3C) ......................................................................................................................................... 192 fread(3C) ........................................................................................................................................... 193 freopen(3C) ....................................................................................................................................... 195 fseek(3C) ........................................................................................................................................... 198 fsetpos(3C) ....................................................................................................................................... 201 fsync(3C) ........................................................................................................................................... 202 ftell(3C) ........................................................................................................................................... 204 ftime(3C) ........................................................................................................................................... 205 ftok(3C) ............................................................................................................................................. 206 ftw(3C) ............................................................................................................................................... 208 fwide(3C) ........................................................................................................................................... 213 fwprintf(3C) ..................................................................................................................................... 214 fwrite(3C) ......................................................................................................................................... 2225

Contents

fwscanf(3C) ....................................................................................................................................... 223 getcpuid(3C) ..................................................................................................................................... 231 getcwd(3C) ......................................................................................................................................... 232 getdate(3C) ....................................................................................................................................... 234 getdtablesize(3C) .......................................................................................................................... 240 getenv(3C) ......................................................................................................................................... 241 getexecname(3C) .............................................................................................................................. 242 getgrnam(3C) ..................................................................................................................................... 243 gethostid(3C) .................................................................................................................................. 247 gethostname(3C) .............................................................................................................................. 248 gethrtime(3C) .................................................................................................................................. 249 getloadavg(3C) ................................................................................................................................ 250 getlogin(3C) ..................................................................................................................................... 251 getmntent(3C) .................................................................................................................................. 253 getnetgrent(3C) .............................................................................................................................. 255 getopt(3C) ......................................................................................................................................... 258 getopt_long(3C) .............................................................................................................................. 264 getpagesize(3C) .............................................................................................................................. 272 getpagesizes(3C) ............................................................................................................................ 273 getpass(3C) ....................................................................................................................................... 274 getpeerucred(3C) ............................................................................................................................ 275 getpriority(3C) .............................................................................................................................. 277 getpw(3C) ........................................................................................................................................... 280 getpwnam(3C) ..................................................................................................................................... 281 getrusage(3C) .................................................................................................................................. 286 gets(3C) ............................................................................................................................................. 289 getspnam(3C) ..................................................................................................................................... 290 getsubopt(3C) .................................................................................................................................. 294 gettext(3C) ....................................................................................................................................... 298 gettimeofday(3C) ............................................................................................................................ 302 gettimeofday(3UCB) ...................................................................................................................... 304 gettxt(3C) ......................................................................................................................................... 305 getusershell(3C) ............................................................................................................................ 307 getutent(3C) ..................................................................................................................................... 308 getutxent(3C) .................................................................................................................................. 311 getvfsent(3C) .................................................................................................................................. 3156 man pages section 3: Basic Library Functions January 2013

Contents

getwc(3C) ........................................................................................................................................... 317 getwchar(3C) ..................................................................................................................................... 318 getwd(3C) ........................................................................................................................................... 319 getwidth(3C) ..................................................................................................................................... 320 getws(3C) ........................................................................................................................................... 321 getzoneid(3C) .................................................................................................................................. 323 glob(3C) ............................................................................................................................................. 325 grantpt(3C) ....................................................................................................................................... 329 hsearch(3C) ....................................................................................................................................... 330 iconv(3C) ........................................................................................................................................... 333 iconv_close(3C) .............................................................................................................................. 339 iconv_open(3C) ................................................................................................................................ 340 imaxabs(3C) ....................................................................................................................................... 342 imaxdiv(3C) ....................................................................................................................................... 343 index(3C) ........................................................................................................................................... 344 initgroups(3C) ................................................................................................................................ 345 insque(3C) ......................................................................................................................................... 346 isaexec(3C) ....................................................................................................................................... 347 isastream(3C) .................................................................................................................................. 349 isatty(3C) ......................................................................................................................................... 350 isnand(3C) ......................................................................................................................................... 351 is_system_labeled(3C) .................................................................................................................. 353 iswalpha(3C) ..................................................................................................................................... 354 iswctype(3C) ..................................................................................................................................... 357 killpg(3C) ......................................................................................................................................... 359 lckpwdf(3C) ....................................................................................................................................... 360 lfmt(3C) ............................................................................................................................................. 361 localeconv(3C) ................................................................................................................................ 366 lockf(3C) ........................................................................................................................................... 372 _longjmp(3C) ..................................................................................................................................... 375 lsearch(3C) ....................................................................................................................................... 376 madvise(3C) ....................................................................................................................................... 378 makecontext(3C) .............................................................................................................................. 381 makedev(3C) ....................................................................................................................................... 384 malloc(3C) ......................................................................................................................................... 385 malloc(3MALLOC) .......................................................................................................................... 3887

Contents

mapmalloc(3MALLOC) ................................................................................................................... 391 mblen(3C) ........................................................................................................................................... 393 mbrlen(3C) ......................................................................................................................................... 394 mbrtowc(3C) ....................................................................................................................................... 396 mbsinit(3C) ....................................................................................................................................... 398 mbsrtowcs(3C) .................................................................................................................................. 399 mbstowcs(3C) ..................................................................................................................................... 401 mbtowc(3C) ......................................................................................................................................... 402 mctl(3UCB) ....................................................................................................................................... 403 membar_ops(3C) ................................................................................................................................ 405 memory(3C) ......................................................................................................................................... 407 mkfifo(3C) ......................................................................................................................................... 409 mkstemp(3C) ....................................................................................................................................... 411 mktemp(3C) ......................................................................................................................................... 413 mktime(3C) ......................................................................................................................................... 414 mlock(3C) ........................................................................................................................................... 417 mlockall(3C) ..................................................................................................................................... 419 monitor(3C) ....................................................................................................................................... 421 msync(3C) ........................................................................................................................................... 423 mtmalloc(3MALLOC) ...................................................................................................................... 425 mutex_init(3C) ................................................................................................................................ 428 ndbm(3C) ............................................................................................................................................. 441 nice(3UCB) ....................................................................................................................................... 445 nlist(3UCB) ..................................................................................................................................... 446 nl_langinfo(3C) .............................................................................................................................. 447 offsetof(3C) ..................................................................................................................................... 448 opendir(3C) ....................................................................................................................................... 449 perror(3C) ......................................................................................................................................... 451 pfmt(3C) ............................................................................................................................................. 452 plock(3C) ........................................................................................................................................... 455 popen(3C) ........................................................................................................................................... 456 port_alert(3C) ................................................................................................................................ 459 port_associate(3C) ........................................................................................................................ 461 port_create(3C) .............................................................................................................................. 466 port_get(3C) ..................................................................................................................................... 468 port_send(3C) .................................................................................................................................. 4728 man pages section 3: Basic Library Functions January 2013

Contents

posix_openpt(3C) ............................................................................................................................ 475 posix_spawn(3C) .............................................................................................................................. 477 posix_spawnattr_destroy(3C) ..................................................................................................... 482 posix_spawnattr_getflags(3C) ................................................................................................... 484 posix_spawnattr_getpgroup(3C) ................................................................................................. 486 posix_spawnattr_getschedparam(3C) ........................................................................................ 487 posix_spawnattr_getschedpolicy(3C) ...................................................................................... 488 posix_spawnattr_getsigdefault(3C) ........................................................................................ 489 posix_spawnattr_getsigmask(3C) ............................................................................................... 490 posix_spawn_file_actions_addclose(3C) ................................................................................ 491 posix_spawn_file_actions_adddup2(3C) .................................................................................. 493 posix_spawn_file_actions_destroy(3C) .................................................................................. 494 printf(3C) ......................................................................................................................................... 495 printf(3UCB) ................................................................................................................................... 506 priv_addset(3C) .............................................................................................................................. 510 priv_set(3C) ..................................................................................................................................... 513 priv_str_to_set(3C) ...................................................................................................................... 515 pset_getloadavg(3C) ...................................................................................................................... 518 psignal(3C) ....................................................................................................................................... 519 psignal(3UCB) ................................................................................................................................. 520 pthread_atfork(3C) ........................................................................................................................ 521 pthread_attr_getdetachstate(3C) ............................................................................................ 524 pthread_attr_getguardsize(3C) ................................................................................................. 525 pthread_attr_getinheritsched(3C) .......................................................................................... 527 pthread_attr_getschedparam(3C) ............................................................................................... 529 pthread_attr_getschedpolicy(3C) ............................................................................................ 530 pthread_attr_getscope(3C) ......................................................................................................... 531 pthread_attr_getstack(3C) ......................................................................................................... 532 pthread_attr_getstackaddr(3C) ................................................................................................. 534 pthread_attr_getstacksize(3C) ................................................................................................. 535 pthread_attr_init(3C) .................................................................................................................. 536 pthread_barrierattr_destroy(3C) ............................................................................................ 538 pthread_barrierattr_getpshared(3C) ...................................................................................... 539 pthread_barrier_destroy(3C) ..................................................................................................... 541 pthread_barrier_wait(3C) ........................................................................................................... 543 pthread_cancel(3C) ........................................................................................................................ 5459

Contents

pthread_cleanup_pop(3C) ............................................................................................................. 547 pthread_cleanup_push(3C) ........................................................................................................... 548 pthread_condattr_getclock(3C) ................................................................................................. 550 pthread_condattr_getpshared(3C) ............................................................................................ 552 pthread_condattr_init(3C) ......................................................................................................... 554 pthread_cond_init(3C) .................................................................................................................. 556 pthread_cond_signal(3C) ............................................................................................................. 558 pthread_cond_wait(3C) .................................................................................................................. 560 pthread_create(3C) ........................................................................................................................ 563 pthread_detach(3C) ........................................................................................................................ 567 pthread_equal(3C) .......................................................................................................................... 568 pthread_exit(3C) ............................................................................................................................ 569 pthread_getconcurrency(3C) ....................................................................................................... 571 pthread_getschedparam(3C) ......................................................................................................... 573 pthread_getspecific(3C) ............................................................................................................. 575 pthread_join(3C) ............................................................................................................................ 577 pthread_key_create(3C) ............................................................................................................... 579 pthread_key_delete(3C) ............................................................................................................... 581 pthread_kill(3C) ............................................................................................................................ 582 pthread_mutexattr_getprioceiling(3C) .................................................................................. 583 pthread_mutexattr_getprotocol(3C) ........................................................................................ 585 pthread_mutexattr_getpshared(3C) .......................................................................................... 588 pthread_mutexattr_getrobust_np(3C) ...................................................................................... 590 pthread_mutexattr_gettype(3C) ................................................................................................. 592 pthread_mutexattr_init(3C) ....................................................................................................... 594 pthread_mutex_consistent_np(3C) ............................................................................................ 595 pthread_mutex_getprioceiling(3C) .......................................................................................... 596 pthread_mutex_init(3C) ............................................................................................................... 598 pthread_mutex_lock(3C) ............................................................................................................... 600 pthread_mutex_timedlock(3C) ..................................................................................................... 603 pthread_once(3C) ............................................................................................................................ 605 pthread_rwlockattr_getpshared(3C) ........................................................................................ 606 pthread_rwlockattr_init(3C) ..................................................................................................... 608 pthread_rwlock_init(3C) ............................................................................................................. 609 pthread_rwlock_rdlock(3C) ......................................................................................................... 611 pthread_rwlock_timedrdlock(3C) ............................................................................................... 61310 man pages section 3: Basic Library Functions January 2013

Contents

pthread_rwlock_timedwrlock(3C) ............................................................................................... 615 pthread_rwlock_unlock(3C) ......................................................................................................... 617 pthread_rwlock_wrlock(3C) ......................................................................................................... 618 pthread_self(3C) ............................................................................................................................ 620 pthread_setcancelstate(3C) ....................................................................................................... 621 pthread_setcanceltype(3C) ......................................................................................................... 622 pthread_setschedprio(3C) ........................................................................................................... 624 pthread_sigmask(3C) ...................................................................................................................... 625 pthread_spin_destroy(3C) ........................................................................................................... 630 pthread_spin_lock(3C) .................................................................................................................. 632 pthread_spin_unlock(3C) ............................................................................................................. 633 pthread_testcancel(3C) ............................................................................................................... 634 ptrace(3C) ......................................................................................................................................... 635 ptsname(3C) ....................................................................................................................................... 638 putenv(3C) ......................................................................................................................................... 639 putpwent(3C) ..................................................................................................................................... 640 puts(3C) ............................................................................................................................................. 641 putspent(3C) ..................................................................................................................................... 642 putws(3C) ........................................................................................................................................... 643 qsort(3C) ........................................................................................................................................... 644 raise(3C) ........................................................................................................................................... 646 rand(3C) ............................................................................................................................................. 647 rand(3UCB) ....................................................................................................................................... 648 random(3C) ......................................................................................................................................... 649 rctlblk_set_value(3C) .................................................................................................................. 652 rctl_walk(3C) .................................................................................................................................. 657 readdir(3C) ....................................................................................................................................... 659 readdir(3UCB) ................................................................................................................................. 663 realpath(3C) ..................................................................................................................................... 665 reboot(3C) ......................................................................................................................................... 667 re_comp(3C) ....................................................................................................................................... 668 regcmp(3C) ......................................................................................................................................... 669 regcomp(3C) ....................................................................................................................................... 671 remove(3C) ......................................................................................................................................... 677 rewind(3C) ......................................................................................................................................... 678 rewinddir(3C) .................................................................................................................................. 67911

Contents

rwlock(3C) ......................................................................................................................................... 680 scandir(3C) ....................................................................................................................................... 683 scandir(3UCB) ................................................................................................................................. 685 scanf(3C) ........................................................................................................................................... 686 schedctl_init(3C) .......................................................................................................................... 694 seekdir(3C) ....................................................................................................................................... 696 select(3C) ......................................................................................................................................... 697 semaphore(3C) .................................................................................................................................. 702 setbuf(3C) ......................................................................................................................................... 706 setbuffer(3C) .................................................................................................................................. 708 setcat(3C) ......................................................................................................................................... 709 setenv(3C) ......................................................................................................................................... 710 setjmp(3C) ......................................................................................................................................... 711 setjmp(3UCB) ................................................................................................................................... 714 setkey(3C) ......................................................................................................................................... 717 setlabel(3C) ..................................................................................................................................... 718 setlocale(3C) .................................................................................................................................. 719 sigblock(3UCB) ............................................................................................................................... 722 sigfpe(3C) ......................................................................................................................................... 723 siginterrupt(3C) ............................................................................................................................ 726 siginterrupt(3UCB) ...................................................................................................................... 727 signal(3C) ......................................................................................................................................... 728 signal(3UCB) ................................................................................................................................... 730 sigsetops(3C) .................................................................................................................................. 732 sigstack(3C) ..................................................................................................................................... 734 sigstack(3UCB) ............................................................................................................................... 736 sigvec(3UCB) ................................................................................................................................... 737 sleep(3C) ........................................................................................................................................... 742 sleep(3UCB) ..................................................................................................................................... 743 smt_pause(3C) .................................................................................................................................. 744 ssignal(3C) ....................................................................................................................................... 745 stack_getbounds(3C) ...................................................................................................................... 746 _stack_grow(3C) .............................................................................................................................. 747 stack_inbounds(3C) ........................................................................................................................ 748 stack_setbounds(3C) ...................................................................................................................... 749 stack_violation(3C) ...................................................................................................................... 75012 man pages section 3: Basic Library Functions January 2013

Contents

stdio(3C) ........................................................................................................................................... 752 str2sig(3C) ....................................................................................................................................... 756 strcoll(3C) ....................................................................................................................................... 757 strerror(3C) ..................................................................................................................................... 758 strfmon(3C) ....................................................................................................................................... 759 strftime(3C) ..................................................................................................................................... 764 string(3C) ......................................................................................................................................... 769 string_to_decimal(3C) .................................................................................................................. 776 strptime(3C) ..................................................................................................................................... 780 strsignal(3C) .................................................................................................................................. 785 strtod(3C) ......................................................................................................................................... 786 strtoimax(3C) .................................................................................................................................. 791 strtol(3C) ......................................................................................................................................... 792 strtoul(3C) ....................................................................................................................................... 795 strtows(3C) ....................................................................................................................................... 797 strxfrm(3C) ....................................................................................................................................... 798 swab(3C) ............................................................................................................................................. 800 sync_instruction_memory(3C) ..................................................................................................... 801 syscall(3UCB) ................................................................................................................................. 802 sysconf(3C) ....................................................................................................................................... 803 syslog(3C) ......................................................................................................................................... 812 system(3C) ......................................................................................................................................... 816 tcdrain(3C) ....................................................................................................................................... 817 tcflow(3C) ......................................................................................................................................... 818 tcflush(3C) ....................................................................................................................................... 820 tcgetattr(3C) .................................................................................................................................. 821 tcgetpgrp(3C) .................................................................................................................................. 822 tcgetsid(3C) ..................................................................................................................................... 823 tcsendbreak(3C) .............................................................................................................................. 824 tcsetattr(3C) .................................................................................................................................. 825 tcsetpgrp(3C) .................................................................................................................................. 827 td_init(3C_DB) ............................................................................................................................... 828 td_log(3C_DB) ................................................................................................................................. 829 td_sync_get_info(3C_DB) ............................................................................................................ 830 td_ta_enable_stats(3C_DB) ....................................................................................................... 833 td_ta_event_addr(3C_DB) ............................................................................................................ 83513

Contents

td_ta_get_nthreads(3C_DB) ....................................................................................................... 839 td_ta_map_addr2sync(3C_DB) ..................................................................................................... 840 td_ta_map_id2thr(3C_DB) ............................................................................................................ 841 td_ta_new(3C_DB) .......................................................................................................................... 842 td_ta_setconcurrency(3C_DB) ................................................................................................... 844 td_ta_sync_iter(3C_DB) .............................................................................................................. 845 td_thr_dbsuspend(3C_DB) ............................................................................................................ 847 td_thr_getgregs(3C_DB) .............................................................................................................. 848 td_thr_get_info(3C_DB) .............................................................................................................. 850 td_thr_lockowner(3C_DB) ............................................................................................................ 853 td_thr_setprio(3C_DB) ................................................................................................................ 854 td_thr_setsigpending(3C_DB) ................................................................................................... 855 td_thr_sleepinfo(3C_DB) ............................................................................................................ 856 td_thr_tlsbase(3C_DB) ................................................................................................................ 857 td_thr_tsd(3C_DB) ........................................................................................................................ 858 td_thr_validate(3C_DB) .............................................................................................................. 859 tell(3C) ............................................................................................................................................. 860 telldir(3C) ....................................................................................................................................... 861 termios(3C) ....................................................................................................................................... 862 thr_create(3C) ................................................................................................................................ 863 thr_exit(3C) ..................................................................................................................................... 869 thr_getconcurrency(3C) ............................................................................................................... 871 thr_getprio(3C) .............................................................................................................................. 872 thr_join(3C) ..................................................................................................................................... 873 thr_keycreate(3C) .......................................................................................................................... 875 thr_kill(3C) ..................................................................................................................................... 879 thr_main(3C) ..................................................................................................................................... 880 thr_min_stack(3C) .......................................................................................................................... 881 thr_self(3C) ..................................................................................................................................... 883 thr_sigsetmask(3C) ........................................................................................................................ 884 thr_stksegment(3C) ........................................................................................................................ 889 thr_suspend(3C) .............................................................................................................................. 890 thr_yield(3C) .................................................................................................................................. 891 times(3UCB) ..................................................................................................................................... 892 tmpfile(3C) ....................................................................................................................................... 893 tmpnam(3C) ......................................................................................................................................... 89414 man pages section 3: Basic Library Functions January 2013

Contents

toascii(3C) ....................................................................................................................................... 896 _tolower(3C) ..................................................................................................................................... 897 tolower(3C) ....................................................................................................................................... 898 _toupper(3C) ..................................................................................................................................... 899 toupper(3C) ....................................................................................................................................... 900 towctrans(3C) .................................................................................................................................. 901 towlower(3C) ..................................................................................................................................... 902 towupper(3C) ..................................................................................................................................... 903 truncate(3C) ..................................................................................................................................... 904 tsearch(3C) ....................................................................................................................................... 907 ttyname(3C) ....................................................................................................................................... 911 ttyslot(3C) ....................................................................................................................................... 913 u8_strcmp(3C) .................................................................................................................................. 914 u8_textprep_str(3C) ...................................................................................................................... 918 u8_validate(3C) .............................................................................................................................. 922 ualarm(3C) ......................................................................................................................................... 926 uconv_u16tou32(3C) ........................................................................................................................ 927 ucred_get(3C) .................................................................................................................................. 933 umem_alloc(3MALLOC) ................................................................................................................. 936 umem_cache_create(3MALLOC) ................................................................................................... 942 umem_debug(3MALLOC) ................................................................................................................. 951 ungetc(3C) ......................................................................................................................................... 954 ungetwc(3C) ....................................................................................................................................... 955 unlockpt(3C) ..................................................................................................................................... 956 unsetenv(3C) ..................................................................................................................................... 957 usleep(3C) ......................................................................................................................................... 958 vfwprintf(3C) .................................................................................................................................. 959 vlfmt(3C) ........................................................................................................................................... 960 vpfmt(3C) ........................................................................................................................................... 962 vprintf(3C) ....................................................................................................................................... 964 vsyslog(3C) ....................................................................................................................................... 966 wait3(3C) ........................................................................................................................................... 968 wait(3C) ............................................................................................................................................. 971 wait(3UCB) ....................................................................................................................................... 973 waitpid(3C) ....................................................................................................................................... 977 walkcontext(3C) .............................................................................................................................. 97915

Contents

watchmalloc(3MALLOC) ............................................................................................................... 981 wcrtomb(3C) ....................................................................................................................................... 984 wcscoll(3C) ....................................................................................................................................... 986 wcsftime(3C) ..................................................................................................................................... 987 wcsrtombs(3C) .................................................................................................................................. 988 wcsstr(3C) ......................................................................................................................................... 990 wcstod(3C) ......................................................................................................................................... 991 wcstoimax(3C) .................................................................................................................................. 994 wcstol(3C) ......................................................................................................................................... 995 wcstombs(3C) ..................................................................................................................................... 998 wcstoul(3C) ....................................................................................................................................... 999 wcstring(3C) ................................................................................................................................... 1002 wcswidth(3C) ................................................................................................................................... 1007 wcsxfrm(3C) ..................................................................................................................................... 1008 wctob(3C) ......................................................................................................................................... 1010 wctomb(3C) ....................................................................................................................................... 1011 wctrans(3C) ..................................................................................................................................... 1012 wctype(3C) ....................................................................................................................................... 1013 wcwidth(3C) ..................................................................................................................................... 1014 wmemchr(3C) ..................................................................................................................................... 1015 wmemcmp(3C) ..................................................................................................................................... 1016 wmemcpy(3C) ..................................................................................................................................... 1017 wmemmove(3C) ................................................................................................................................... 1018 wmemset(3C) ..................................................................................................................................... 1019 wordexp(3C) ..................................................................................................................................... 1020 wsprintf(3C) ................................................................................................................................... 1024 wsscanf(3C) ..................................................................................................................................... 1025 wstring(3C) ..................................................................................................................................... 1026

16

man pages section 3: Basic Library Functions January 2013

Preface

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

OverviewThe following contains a brief description of each man page section and the information it references:

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 calls are also described. Section 9 provides reference information needed to write device drivers in the kernel environment. It describes two device driver interface specifications: the Device Driver Interface (DDI) and the Driver/Kernel Interface (DKI). Section 9E describes the DDI/DKI, DDI-only, and DKI-only entry-point routines a developer 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

Preface

Below is a generic format for man pages. The man pages of each manual section generally follow 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 each section, and man(1) for more information about man pages in general. NAME This section gives the names of the commands or functions documented, followed by a brief description of what they do. This section shows the syntax of commands or functions. When a command or file does not exist in the standard path, its full path name is shown. Options and arguments are alphabetized, with single letter arguments first, and options with arguments next, unless a different argument order is required. The following special characters are used in this section: [ ] Brackets. The option or argument enclosed in these brackets is optional. If the brackets are omitted, the argument must be specified. Ellipses. Several values can be provided for the previous argument, or the previous argument can be specified multiple times, for example, "filename . . ." . Separator. Only one of the arguments separated by this character can be specified at a time. Braces. The options and/or arguments enclosed within braces are interdependent, such that everything enclosed must be treated as a unit.

SYNOPSIS

. . .

|

{ }

PROTOCOL DESCRIPTION

This section occurs only in subsection 3R to indicate the protocol description file. This section defines the functionality and behavior of the service. Thus it describes concisely what the command does. It does not discuss OPTIONS or cite EXAMPLES. Interactive commands, subcommands, requests, macros, and functions are described under USAGE. This section appears on pages in Section 7 only. Only the device class that supplies appropriate parameters to the ioctl(2) system call is called ioctl and generates its own

IOCTL

18

man pages section 3: Basic Library Functions January 2013

Preface

heading. ioctl calls for a specific device are listed alphabetically (on the man page for that specific device). ioctl calls are used for a particular class of devices all of which have an io ending, such as mtio(7I). OPTIONS This secton lists the command options with a concise summary of what each option does. The options are listed literally and in the order they appear in the SYNOPSIS section. Possible arguments to options are discussed under the option, and where appropriate, default values are supplied. This section lists the command operands and describes how they affect the actions of the command. This section describes the output standard output, standard error, or output files generated by the command. If the man page documents functions that return values, this section lists these values and describes the conditions under which they are returned. If a function can return only constant values, such as 0 or 1, these values are listed in tagged paragraphs. Otherwise, a single paragraph describes the return values of each function. Functions declared void do not return values, so they are not discussed in RETURN VALUES. On failure, most functions place an error code in the global variable errno indicating why they failed. This section lists alphabetically all error codes a function can generate and describes the conditions that cause each error. When more than one condition can cause the same error, each condition is described in a separate paragraph under the error code. This section lists special rules, features, and commands that require in-depth explanations. The subsections listed here are used to explain built-in functionality: Commands Modifiers Variables Expressions Input Grammar

OPERANDS OUTPUT

RETURN VALUES

ERRORS

USAGE

19

Preface

EXAMPLES

This section provides examples of usage or of how to use a command or function. Wherever possible a complete example including command-line entry and machine response is shown. Whenever an example is given, the prompt is shown as example%, or if the user must be superuser, example#. Examples are followed by explanations, variable substitution rules, or returned values. Most examples illustrate concepts from the SYNOPSIS, DESCRIPTION, OPTIONS, and USAGE sections. This section lists any environment variables that the command or function affects, followed by a brief description of the effect. This section lists the values the command returns to the calling program or shell and the conditions that cause these values to be returned. Usually, zero is returned for successful completion, and values other than zero for various error conditions. 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. This section lists characteristics of commands, utilities, and device drivers by defining the attribute type and its corresponding value. See attributes(5) for more information. This section lists references to other man pages, in-house documentation, and outside publications. This section lists diagnostic messages with a brief explanation of the condition causing the error. This section lists warnings about special conditions which could seriously affect your working conditions. This is not a list of diagnostics. This section lists additional information that does not belong anywhere else on the page. It takes the form of an aside to the user, covering points of special interest. Critical information is never covered here. This section describes known bugs and, wherever possible, suggests workarounds.

ENVIRONMENT VARIABLES

EXIT STATUS

FILES

ATTRIBUTES

SEE ALSO DIAGNOSTICS WARNINGS

NOTES

BUGS

20

man pages section 3: Basic Library Functions January 2013

R E F E R E N C E

Basic Library Functions

21

a64l(3C)

Name a64l, l64a convert between long integer and base-64 ASCII string Synopsis #include long a64l(const char *s); char *l64a(long l);

Description These functions maintain numbers stored in base-64 ASCII characters that define a notation by 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 . / 0-9 A-Z a-z Digit 0 1 2-11 12-37 38-63

The a64l() function takes a pointer to a null-terminated base-64 representation and returns a corresponding 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 digit on 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 corresponding base-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 are overwritten by each call. In the case of multithreaded applications, the return value is a pointer to thread specific data. Attributes See attributes(5) for descriptions of the following attributes:ATTRIBUTE TYPE ATTRIBUTE VALUE

Interface Stability MT-Level

Standard MT-Safe

22

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

a64l(3C)

See Also attributes(5), standards(5)

Basic Library Functions

23

abort(3C)

Name abort terminate the process abnormally Synopsis #include void abort(void);

Description The abort() function causes abnormal process termination to occur, unless the signal SIGABRT is being caught and the signal handler does not return. The abnormal termination processing includes at least the effect of fclose(3C) on all open streams and message catalogue descriptors, and the default actions defined for SIGABRT. The SIGABRT signal is sent to 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 process terminated by the SIGABRT signal. abort will override blocking or ignoring the SIGAB