OSF/1"' Operating System Programmer's Reference OSF/1 Programmer's Reference Revision 1.0 Open Software Foundation iii Prentice Hall, Englewood Cliffs, New Je<sey 07632 Cover design and cover illustration: BETH FAGAN This book was formatted with troff Published by Prentice Hall, Inc. A Simon & Schuster Company Englewood Cliffs, New Jersey 07632 The information contained within this document is subject to change without notice. OSF MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. OSF shall not be liable for errors contained herein or for any direct or indirect, incidental, special or consequential damages in connection with the furnishing, performance, or use of this material. Copyright© 1991, Open Software Foundation, Inc. This documentation and the software to which it relates are derived in part from materials supplied by the following: • ©Copyright 1987, 1988, 1989 Carnegie-Mellon University • ©Copyright 1985, 1988, 1989, 1990 Encore Computer Corporation • ©Copyright 1985, 1987, 1988, 1989 International Business Machine Corporation • ©Copyright 1988, 1989, 1990 Mentat Inc. • ©Copyright 1987, 1988, 1989, 1990 SecureW are, Inc. • This Software and documentation are based in part on the Fourth Berkeley Software Distribution under license from The Regents of the University of California. We acknowledge the· following individuals and institutions for their role in its development: Kenneth C.R.C Arnold, Gregory S. Couch, Conrad C. Huang, Ed James, Symmetric Computer Systems, Robert Elz © Copyright 1980, 1981, 1982, 1983. 1985, 1986, 1987, Regents of the University of California. All Rights Reserved Printed in the U.S.A. THIS DOCUMENT AND THE SOFTWARE DESCRIBED HEREIN ARE FURNISHED UNDER A LICENSE, AND MAY BE USED AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE. TITLE TO AND OWNERSHIP OF THE DOCUMENT AND SOFTWARE REMAIN WITH OSF OR ITS LICENSORS. FOR U.S. GOVERNMENT CUSTOMERS REGARDING THIS OOCUMENTATION ANDTHE ASSOCIATED SOFTWARE These notices shall be marked on any reproduction of this data, in whole or in part. NOTICE: Notwithstanding any other lease or license that may pertain to, or accompany the delivery of, this c.omputer software, tbe rights of the Government regarding its use, reproduction and disclosure are as set forth in Section 52.227-19 of the FARS Computer Software Restricted Rights clause. RESTRICTED RIGHTS NOTICE: Use, duplication, or disclosure by the Goverm~ent is subject to the restrictions as set fortti in subparagraph (c)(1 )(ii) of the Rights in Technical Data and Computer Software clause at DFARS 52.227-7013. RESTRICTED RIGHTS LEGEND: Use, duplication or disclosure by the Government is subject to restrictions as set forth in paragraph (b) (3)(B) of the rights in Technical Data and Computer Software clause in DAR 7-104.9(a). This computer software is submitted with "restricted rights." Use, duplication or disclosure is subject to the restrictions as set forth iri NASA FAR SUP 18-52.227-79 (April 1985) ''Commercial Colnputer Software -Restricted Rights (April 1985)." If the contract contains the Clause at 18-52.227-74 "Rights in Data General" then the "Alternate III" clause applies. US Government Users Restricted Rights -Use, duplication or disclosure restricted by GSA ADP Schedule Contract. Unpublished -All rights reserved under the Copyright Laws of the United States. This notice shall be marked on any reproduction of this data, in whole or in part. Printed in the United States of America 10 9 8 7 6 5 4 3 2 ISBN 0-13-643610-2 Prentice-Hall International (UK)Limited, London Prentice-Hall of Australia Pty. Limited, Sydney Prentice-Hall Canada Inc., Toronto Prentice-Hall Hispanoamericana, S.A., Mexico Prentice-Hall of India Private Limited, New Delhi Prentice-Hall of Japan, Inc.,. Tokyo Simon & Schuster Asia Pte. Ltd., Singapore Editora Prentice-Hall do Brasil, Ltda., Rio de Janeiro Open Software Foundation, OSF, the OSF logo, OSF/I, OSF/Motif, and Motif are trademarks of Open Software Foundation, Inc. UNIX is a registered trademark of UNIX Systems Laboratories, Inc. in the U.S. and other countries. X/Open is a trademark of the X/Open Company Ltd. in the U.K. and other countries. AT&T is a registered trademark of American Telephone & Telegraph Company in the U.S. and other countries. BSD is a trademark of University of California, Berkeley. DEC, DIGITAL. and VAX are registered trademarks of Digital Equipment Corporation X Window System is a trademark of the Massachusetts Institute of Technology MIPS is a trademark of Computer Systems, Inc. Xerox is a registered trademark of Xerox Corporation Sun Microsystems, Network File System, and NFS are trademarks of Sun Microsystems, Inc. SMP, SMP+, and CMW+ are trademarks of SecureWare, Inc. PostScript is a trademark of Adobe Systems, Inc. Apple, the Apple Logo, Macintosh, AppleTalk, ImageWriter, and LaserWriter are registered trademarks of Apple Computer, Inc. A/UX is a trademark of Apple Computer. Contents Preface xiii Audience xiii Applicability xiv Purpose xiv Document Usage xiv Related Documents xiv Typographic and Keying Conventions xv Problem Reporting xvi . Permuted Index xvii Chapter 1 Functions 1-1 1.1 Organization of the Reference Pages 1-1 1.2 Error Numbers 1-2 abort 1-16 . abs 1-17 accept 1-19 access 1-21 . acct 1-23 adjtime 1-25 alarm 1-27 asinh 1-29 assert 1-30 async_daemon 1-32 . atof 1-33 . atoi 1-35 bcopy 1-39 bessel 1-41 bind • 1-43 . brk 1-45 bsearch 1-47 catclose 1-49 OSF/1 Programmer's Reference catgets • 1-51 catopen 1-53 cfgetispeed 1-55 cfg etospeed 1-56 cfsetispeed 1-57 cfsetospeed 1-58 chdir 1-59 chmod . 1-61 chown . 1-65 chroot 1-68 clearenv 1-70 clearerr • 1-71 clock 1-72 close 1-73 connect 1-75 conv 1-78 ctermid • 1-81 ctime 1-83 ctype 1-89 curses 1-92 cuserid . 1-107 dbm .• 1-109 decode_mach_o_hdr 1-111 dn_comp 1-113 dn_expand • 1-115 dn_find • • 1-117 dn_skipname 1-119 drand48 1-121 ecvt • • 1-125 encode_mach_o_hdr • 1-128 endhostent • • 1-130 endnetent 1-131 endprotoent 1-132 endservent • 1-133 erf 1-134 exec 1-136 exec_w ith_loader 1-142 exit . • 1-145 exp . 1-148 expacct • 1-151 fclose 1-152 fcntl 1-155 feof • 1-161 ferror 1-162 fileno 1-163 flock 1-164 ftockfile 1-167 ii Contents floor 1-168 fop en 1-171 fork • 1-176 fread 1-179 frexp 1-181 fseek 1-184 fsync 1-188 ftok • • 1-190 ftw • 1-192 funlockfile 1-195 gamma •• 1-196 getaddressconf 1-198 getc • • . 1-201 getclock 1-203 getcwd • • • 1-205 getdirentries 1-207 getdiskbyname 1-209 getdtablesize 1-210 getenv • 1-211 getfh 1-212 getfsent 1-214 getfsstat 1-216 getgid 1-218 getgrent 1-219 getgroups 1-222 gethostbyaddr 1-224 gethostbyname 1-226 gethostent . 1-228 gethostid 1-230 gethostname 1-231 getitimer 1-232 getlogin 1-235 _getlong 1-237 getnetbyaddr 1-239 getnetbyname 1-241 getnetent 1-243 getopt 1-244 getpagesize 1-246 getpass . . 1-247 getpeername 1-249 getpid 1-251 getpriority • 1-252 getprotobyname 1-254 getprotobynumber 1-256 getprotoent 1-258 getpwent 1-259 getrlimit 1-262 iii OSF/1 Programmer's Reference getrusage 1-265 gets • • 1-267 getservbyname 1-269 getservbyport . 1-271 getservent • 1-273 _getshort 1-275 getsockname 1-277 getsockopt . 1-279 gettimeofday 1-283 gettimer 1-285 getuid 1-287 getusershell 1-288 getutent 1-289 getwc 1-292 getwd 1-293 getws • . . • 1-294 hsearch 1-295 htonl 1-297 htons 1-298 hypot 1-299 inet_addr 1-301 inet_lnaof • 1-302 inet_makeaddr 1-303 inet_netof • • 1-304 inet_network 1-305 inet_ntoa 1-306 initgroups • 1-307 insque • • • • 1-309 ioctl 1-310 isnan • • • • • 1-312 jctype 1-313 kill . 1-315 ldr_entry . 1-317 ldr_inq_module 1-318 ldr_inq_region 1-320 ldr_install • • • 1-322 ldr_lookup_package • 1-324 ldr_next_module • 1-326 ldr_remove 1-328 ldr_xattach 1-329 ldr_xdetach 1-331 ldr_xentry • 1-333 ldr_xload • • • 1-335 ldr_xlookup_package 1-338 ldr_xunload 1-340 libPW • • . 1-342 link • • • • • • 1-345 iv Contents listen 1-347 load . . . . . . . 1-349 localeconv 1-351 lockf • 1-355 lsearch . 1-358 ls eek 1-360 mad vise 1-362 malloc • 1-364 mblen 1-368 mbstowcs • • • • • 1-370 mbtowc 1-372 memccpy 1-374 mkdir 1-378 mkfifo • • 1-381 mknod • 1-383 mktemp 1-386 mktimer 1-388 mmap 1-390 mount 1-395 mount 1-400 mp • 1-402 mprotect 1-406 msem_init . 1-409 msem_lock 1-411 msem_remove 1-413 msem_unlock 1-415 msgctl 1-417 msgget 1-420 msgrcv 1-422 msgsnd 1-425 msync . • • • . 1-428 munmap 1-430 mvalid 1-432 ndbm 1-434 neg • 1-437 nfssvc 1-438 nice • 1-439 nl_langinfo 1-441 ns_addr 1-443 ntohl 1-445 ntohs 1-446 open 1-447 opendir 1-453 pathconf 1-458 pause 1-462 pclose 1-464 perror 1-466 v