Linux Standard Base Specification 1 · 2015. 1. 28. · with no Invariant Sections, with no...

565
Linux Standard Base Specification 1.3

Transcript of Linux Standard Base Specification 1 · 2015. 1. 28. · with no Invariant Sections, with no...

  • Linux Standard Base Specification 1.3

  • Linux Standard Base Specification 1.3 Copyright © 2000, 2001, 2002 Free Standards Group

    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1;

    with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled

    "GNU Free Documentation License".

    Portions of the text were taken from other copyrighted documents in accordance with the respective licenses of those documents.

    Linux is a trademark of Linus Torvalds.

    UNIX a registered trademark of the Open Group in the United States and other countries.

    LSB is a trademark of the Free Standards Group in the USA and other countries.

    Intel386 and Itanium are trademarks of Intel Corporation.

    OpenGL is a registered trademark of Silicon Graphics, Inc.

    Revision History

    Revision 0.9.0 07-May-2001 Revised by: SRA Initial version for Public Comment

    Revision 0.9.1 30-May-2001 Revised by: SRA Changes derived from Public Comments. Simplified User & Group Section, Lots of additional details cleaned up. Lots of spelling fixes.

    Revision 0.9.2 07-Jun-2001 Revised by: SRA More changes derived from Public Comments. Pulled the SGML chapter due to uncertainty from the working group.

    Revision 0.9.3 18-Jun-2001 Revised by: SRA More changes derived from Public Comments.

    Revision 1.0.0 29-Jun-2001 Revised by: SRA More changes derived from Public Comments. Assigned specs to commands. Final change to copyright statement.

    Revision 1.0.1.011221 21-Dec-2001 Revised by: SRA Significant editorial cleanup for both style and consistancy. Added the following new curses interfaces: COLS, LINES Added the following new reentrant interfaces: asctime_r, gethostbyname_r, getpwuid_r, getutent_r, gmtime_r, localtime_r,

    rand_r, random_r. Added the following new RPC interfaces: authnone_create, clnt_create, clnt_pcreateerror, clnt_perrno, clnt_perror,

    clnt_spcreateerror, clnt_sperrno, clnt_sperror, key_decryptsession, svc_getreqset, svcerr_auth, svcerr_decode, svcerr_noproc, svcerr_noprog, svcerr_progvers, svcerr_systemerr, svcerr_weakauth, xdr_accepted_reply, xdr_array, xdr_bool, xdr_bytes, xdr_callhdr, xdr_callmsg, xdr_char, xdr_double, xdr_enum, xdr_float, xdr_free, xdr_int, xdr_long, xdr_opaque, xdr_opaque_auth, xdr_pointer, xdr_reference, xdr_rejected_reply, xdr_replymsg, xdr_short, xdr_string, xdr_u_char, xdr_u_long, xdr_u_short, xdr_union, xdr_vector, xdr_void, xdr_wrapstring, xdrmem_create, xdrrec_create, xdrrec_eof.

    Added the following new interfaces: timer_create, timer_delete, timer_getoverrun, timer_gettime, timer_settime. Added the following new pthreads interfaces: pthread_mutexattr_getpshared, pthread_mutexattr_setpshared. The following were replaced with threaded equivilents: errno, h_errno. Remove the following interface due to lack of specifications: XESetBeforeFlush, XESetCloseDisplay, XESetCopyGC,

    XESetCreateFont, XESetCreateGC, XESetError, XESetErrorString, XESetEventToWire, XESetFreeFont, XESetFreeGC, XESetPrintErrorValues, XESetWireToError, XESetWireToEvent, XkbApplyVirtualModChanges, XkbChangeKeycodeRange, XkbGetKeyVirtualModMap, XkbTranslateKey, XkbUpdateActionVirtualMods, XkbUpdateKeyTypeVirtualMods, XkbXlibControlsImplemented.

  • The following interfaces have been deprecated: _IO_2_1_stderr_, _IO_2_1_stdin_, _IO_2_1_stdout_, __bzero , __mbrlen, __secure_getenv , __sigpause, __wcstod_internal, __wcstof_internal, __wcstol_internal, __wcstold_internal __wcstoll_internal, __wcstoul_internal, __wcstoull_internal

    The FHS chapter was replaced by a more extensive Execution Environment chapter. In addition to the previous FHS content, /proc/cpuinfo and a few devices are defined.

    The Data Definitions are more thorough and more accurate. Removed appendix B, which was non-normative.

    Revision 1.2 28-Jun-2002 Revised by: SRA New Interfaces XESetBeforeFlush, XESetCloseDisplay XESetCopyGC XESetCreateFont XESetCreateGC XESetError

    XESetErrorString XESetEventToWire XESetFlushGC XESetFreeFont XESetFreeGC XESetPrintErrorValues XESetWireToError XESetWireToEvent Xutf8TextListToTextProperty Xutf8TextPropertyToTextList _XtCheckSubclassFlag crealf glPointParameterfvEXT setupterm __h_errno_location bind_textdomain_codeset dcngettext dgettext dngettext fgetwc_unlocked getdomainname getpwnam_r lcong48 posix_memalign readdir_r setdomainname setenv setrlimit64 unsetenv vfwscanf vsyslog __ctype_tolower pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock pthread_setconcurrency

    Removed Interfaces __bzero __mbrlen __secure_getenv __sigpause __wcstoll_internal __wcstoull_internal fdetach getmsg putmsg h_errno

    Remove libta and AIO interfaces aio_cancel aio_cancel64 aio_error aio_error64 aio_fsync aio_fsync64 aio_read aio_read64 aio_return aio_return64 aio_suspend aio_suspend64 aio_write aio_write64 clock_getcpuclockid clock_getres clock_gettime clock_nanosleep clock_settime lio_listio lio_listio64 shm_open shm_unlink timer_create timer_delete timer_getoverrun timer_gettime timer_settime

    Improved Data Definitions Numerous clarification.

    Revision 1.3 27-Oct-2002 Revised by: SRA Several interfaces were changed either to or from the LSB as the guiding specification based on issues which were raised with

    the LSB 1.2. The new reference more accurately describes these interfaces. Several interfaces were incorporated from the Li18nux 2000 Specification to better support Internationalization and localization. The descriptions of interfaces defined by the LSB have been clarified and improved overall. The data definitions are more complete now. Some duplications were eliminated and some omissions have been included.

    New Interfaces touchline touchwin __isinf __isinff __isinfl __isnan __isnanf __isnanl asprintf freeaddrinfo gai_strerror getaddrinfo getgrgid_r getgrnam_r getnameinfo inet_ntop inet_pton isinff ngettext statvfs64 tdelete pam_acct_mgmt pam_authenticate pam_chauthtok pam_close_session pam_end pam_fail_delay pam_get_item pam_getenvlist pam_open_session pam_set_item pam_setcred pam_start pam_strerror _Unwind_DeleteException _Unwind_Find_FDE _Unwind_ForcedUnwind _Unwind_GetDataRelBase _Unwind_GetGR _Unwind_GetIP _Unwind_GetLanguageSpecificData _Unwind_GetRegionStart _Unwind_GetTextRelBase _Unwind_RaiseException _Unwind_Resume _Unwind_SetGR _Unwind_SetIP, xdr_u_int and socket ioctl() commands

    Deprecated Interfaces __dcgettext alphasort alphasort64 endhostent fstatfs fstatfs64 sethostent setmntent statfs statfs64 waitid New Libraries libgcc_s, libpam New RPM File Format specification Add new ELF Section .jcr Add new ELF Section .eh_frame_hdr Add new ELF Program Header PT_GNU_EH_FRAME

  • iv

    Table of Contents I. Introduction......................................................................................................................................................... 22

    1. Introduction...................................................................................................................................................1 1.1. Introduction.....................................................................................................................................1 1.2. Purpose.............................................................................................................................................1 1.3. Related Standards...........................................................................................................................1 1.4. Relevant Libraries ..........................................................................................................................4 1.5. How to Use this Standard .............................................................................................................5 1.6. Definitions.......................................................................................................................................5 1.7. Terminology....................................................................................................................................7

    II. Object Format......................................................................................................................................................9

    2. Object Files .................................................................................................................................................10 3. Sections........................................................................................................................................................11

    3.1. Sections Types ..............................................................................................................................11 3.1.1. ELF Section Types.........................................................................................................11 3.1.2. Additional Section Types .............................................................................................13

    4. Special Sections..........................................................................................................................................15 4.1. Special Sections............................................................................................................................15

    4.1.1. ELF Special Sections.....................................................................................................15 4.1.2. Additional Special Sections .........................................................................................18

    5. Symbol Mapping........................................................................................................................................20 5.1. Symbol Mapping..........................................................................................................................20

    5.1.1. C Language.....................................................................................................................20 5.1.2. C++ Language................................................................................................................20

    6. EH Frame Header.......................................................................................................................................21 6.1. DWARF Exception Header Encoding......................................................................................22

    7. Symbol Versioning ....................................................................................................................................24 7.1. Symbol Version Table .................................................................................................................24 7.2. Version Definitions......................................................................................................................24 7.3. Version Requirements .................................................................................................................25 7.4. Startup Sequence..........................................................................................................................27 7.5. Symbol Resolution.......................................................................................................................27

    8. ABI note tag................................................................................................................................................28

    III. Dynamic Linking ............................................................................................................................................ 29

    9. Program Loading and Dynamic Linking................................................................................................30 10. Program Header .......................................................................................................................................31 11. Dynamic Entries.......................................................................................................................................32

    11.1. Dynamic Entries.........................................................................................................................32 11.1.1. ELF Dynamic Entries..................................................................................................32 11.1.2. Additional Dynamic Entries.......................................................................................34

    12. Program Interpreter .................................................................................................................................36 12.1. .......................................................................................................................................................36

  • v

    IV. Base Libraries .................................................................................................................................................. 37

    13. Libraries.....................................................................................................................................................38 13.1. Interfaces for libc .......................................................................................................................38

    13.1.1. RPC ................................................................................................................................38 13.1.2. System Calls .................................................................................................................39 13.1.3. Standard I/O..................................................................................................................40 13.1.4. Signal Handling............................................................................................................41 13.1.5. Localization Functions................................................................................................41 13.1.6. Socket Interface............................................................................................................42 13.1.7. Wide Characters ...........................................................................................................42 13.1.8. String Functions...........................................................................................................43 13.1.9. IPC Functions...............................................................................................................43 13.1.10. Regular Expressions..................................................................................................43 13.1.11. Character Type Functions........................................................................................44 13.1.12. Time Manipulation....................................................................................................44 13.1.13. Terminal Interface Functions...................................................................................44 13.1.14. System Database Interface.......................................................................................45 13.1.15. Language Support......................................................................................................45 13.1.16. Large File Support.....................................................................................................45 13.1.17. Standard Library ........................................................................................................46

    13.2. Data Definitions for libc ...........................................................................................................47 13.2.1. assert.h ...........................................................................................................................47 13.2.2. ctype.h............................................................................................................................47 13.2.3. dirent.h ...........................................................................................................................47 13.2.4. errno.h ............................................................................................................................48 13.2.5. fcntl.h .............................................................................................................................50 13.2.6. fmtmsg.h........................................................................................................................51 13.2.7. fnmatch.h .......................................................................................................................52 13.2.8. ftw.h ...............................................................................................................................52 13.2.9. getopt.h ..........................................................................................................................53 13.2.10. glob.h ...........................................................................................................................53 13.2.11. grp.h .............................................................................................................................54 13.2.12. iconv.h .........................................................................................................................55 13.2.13. inttypes.h.....................................................................................................................55 13.2.14. langinfo.h ....................................................................................................................55 13.2.15. limits.h .........................................................................................................................57 13.2.16. locale.h ........................................................................................................................58 13.2.17. net/if.h ..........................................................................................................................59 13.2.18. netdb.h .........................................................................................................................60 13.2.19. netinet/in.h ..................................................................................................................62 13.2.20. netinet/tcp.h ................................................................................................................63 13.2.21. netinet/udp.h...............................................................................................................63 13.2.22. nl_types.h....................................................................................................................63 13.2.23. pwd.h ...........................................................................................................................63 13.2.24. regex.h .........................................................................................................................64 13.2.25. rpc/auth.h.....................................................................................................................66 13.2.26. rpc/clnt.h......................................................................................................................67

  • vi

    13.2.27. rpc/rpc_msg.h.............................................................................................................68 13.2.28. rpc/svc.h ......................................................................................................................70 13.2.29. rpc/types.h...................................................................................................................71 13.2.30. rpc/xdr.h ......................................................................................................................71 13.2.31. sched.h.........................................................................................................................72 13.2.32. search.h........................................................................................................................72 13.2.33. setjmp.h .......................................................................................................................73 13.2.34. signal.h ........................................................................................................................73 13.2.35. stddef.h ........................................................................................................................77 13.2.36. stdio.h ..........................................................................................................................77 13.2.37. stdlib.h .........................................................................................................................78 13.2.38. sys/file.h ......................................................................................................................79 13.2.39. sys/ipc.h.......................................................................................................................79 13.2.40. sys/mman.h .................................................................................................................79 13.2.41. sys/msg.h.....................................................................................................................79 13.2.42. sys/param.h .................................................................................................................80 13.2.43. sys/poll.h .....................................................................................................................80 13.2.44. sys/resource.h .............................................................................................................80 13.2.45. sys/sem.h .....................................................................................................................81 13.2.46. sys/shm.h .....................................................................................................................82 13.2.47. sys/socket.h.................................................................................................................82 13.2.48. sys/stat.h......................................................................................................................84 13.2.49. sys/time.h ....................................................................................................................85 13.2.50. sys/timeb.h ..................................................................................................................86 13.2.51. sys/times.h...................................................................................................................86 13.2.52. sys/types.h...................................................................................................................86 13.2.53. sys/un.h........................................................................................................................87 13.2.54. sys/utsname.h .............................................................................................................88 13.2.55. sys/wait.h.....................................................................................................................88 13.2.56. syslog.h........................................................................................................................88 13.2.57. termios.h......................................................................................................................89 13.2.58. time.h ...........................................................................................................................91 13.2.59. ulimit.h ........................................................................................................................92 13.2.60. unistd.h ........................................................................................................................92 13.2.61. utime.h .........................................................................................................................95 13.2.62. utmp.h ..........................................................................................................................95 13.2.63. wchar.h ........................................................................................................................96 13.2.64. wctype.h ......................................................................................................................96 13.2.65. wordexp.h....................................................................................................................97

    13.3. Interfaces Definitions for libc..................................................................................................98 _IO_feof......................................................................................................................................98 _IO_getc .....................................................................................................................................98 _IO_putc.....................................................................................................................................99 _IO_puts .....................................................................................................................................99 __assert_fail .............................................................................................................................100 __ctype_b.................................................................................................................................100 __ctype_get_mb_cur_max.....................................................................................................101 __ctype_tolower......................................................................................................................101

  • vii

    __ctype_toupper......................................................................................................................102 __cxa_atexit .............................................................................................................................102 __daylight.................................................................................................................................102 __dcgettext ...............................................................................................................................103 __environ..................................................................................................................................103 __errno_location......................................................................................................................103 __fpending................................................................................................................................104 __getpagesize ...........................................................................................................................104 __getpgid ..................................................................................................................................104 __h_errno_location.................................................................................................................105 __isinf........................................................................................................................................105 __isinff ......................................................................................................................................106 __isinfl ......................................................................................................................................106 __isnan ......................................................................................................................................106 __isnanf.....................................................................................................................................107 __isnanl.....................................................................................................................................107 __libc_current_sigrtmax........................................................................................................108 __libc_current_sigrtmin .........................................................................................................108 __libc_start_main ....................................................................................................................108 __lxstat......................................................................................................................................108 __mempcpy..............................................................................................................................109 __rawmemchr ..........................................................................................................................109 __sigsetjmp ...............................................................................................................................110 __stpcpy....................................................................................................................................110 __strdup....................................................................................................................................111 __strtod_internal......................................................................................................................111 __strtof_internal ......................................................................................................................112 __strtok_r..................................................................................................................................112 __strtol_internal.......................................................................................................................113 __strtold_internal ....................................................................................................................113 __strtoll_internal .....................................................................................................................114 __strtoul_internal ....................................................................................................................114 __strtoull_internal...................................................................................................................115 __sysconf..................................................................................................................................115 __sysv_signal...........................................................................................................................116 __timezone ...............................................................................................................................116 __tzname ...................................................................................................................................116 __wcstod_internal...................................................................................................................117 __wcstof_internal....................................................................................................................117 __wcstol_internal....................................................................................................................118 __wcstold_internal..................................................................................................................118 __wcstoul_internal..................................................................................................................119 __xmknod.................................................................................................................................119 __xstat .......................................................................................................................................119 __xstat64...................................................................................................................................120 _environ....................................................................................................................................121 _nl_msg_cat_cntr....................................................................................................................121 _obstack_begin ........................................................................................................................122

  • viii

    _obstack_newchunk................................................................................................................122 _sys_errlist ...............................................................................................................................122 _sys_siglist...............................................................................................................................123 acct.............................................................................................................................................124 adjtime .......................................................................................................................................125 adjtimex....................................................................................................................................126 alphasort....................................................................................................................................128 alphasort64 ...............................................................................................................................129 asprintf ......................................................................................................................................129 bind_textdomain_codeset ......................................................................................................130 bindresvport..............................................................................................................................131 bindtextdomain ........................................................................................................................132 cfmakeraw ................................................................................................................................132 cfsetspeed.................................................................................................................................133 daemon......................................................................................................................................134 dcgettext ....................................................................................................................................134 dcngettext .................................................................................................................................135 dgettext ......................................................................................................................................137 dngettext ...................................................................................................................................138 err ...............................................................................................................................................139 error ...........................................................................................................................................139 errx.............................................................................................................................................140 fcntl............................................................................................................................................140 flock...........................................................................................................................................141 fstatfs.........................................................................................................................................142 fstatfs64.....................................................................................................................................143 getdomainname ........................................................................................................................144 gethostbyname .........................................................................................................................145 gethostbyname_r .....................................................................................................................146 getloadavg................................................................................................................................146 getopt.........................................................................................................................................146 getopt_long...............................................................................................................................149 getopt_long_only.....................................................................................................................150 getpwnam_r..............................................................................................................................150 gets .............................................................................................................................................151 getservbyname .........................................................................................................................151 getservent..................................................................................................................................152 gettext ........................................................................................................................................153 getutent......................................................................................................................................154 getutent_r..................................................................................................................................154 glob64........................................................................................................................................155 globfree64.................................................................................................................................156 initgroups..................................................................................................................................156 ioctl ............................................................................................................................................157 sockio ........................................................................................................................................158 iswctype....................................................................................................................................160 kill ..............................................................................................................................................161 mbsnrtowcs...............................................................................................................................161

  • ix

    memmem..................................................................................................................................162 memrchr....................................................................................................................................163 ngettext ......................................................................................................................................164 nice.............................................................................................................................................165 obstack_free .............................................................................................................................165 opterr .........................................................................................................................................165 optind.........................................................................................................................................166 optopt.........................................................................................................................................166 psignal.......................................................................................................................................167 random_r...................................................................................................................................167 setbuffer....................................................................................................................................168 setdomainname ........................................................................................................................168 setegid .......................................................................................................................................169 setenv.........................................................................................................................................169 seteuid .......................................................................................................................................169 setgroups...................................................................................................................................170 sethostid ....................................................................................................................................171 sethostname ..............................................................................................................................172 setmntent...................................................................................................................................172 setutent ......................................................................................................................................174 sigandset ...................................................................................................................................174 sigblock.....................................................................................................................................175 siggetmask................................................................................................................................175 sigisemptyset............................................................................................................................176 sigorset ......................................................................................................................................176 sigreturn ....................................................................................................................................177 statfs...........................................................................................................................................178 statfs64 ......................................................................................................................................180 stime ..........................................................................................................................................180 stpcpy........................................................................................................................................181 stpncpy ......................................................................................................................................182 strcasestr ...................................................................................................................................182 strerror_r...................................................................................................................................183 strfry ..........................................................................................................................................183 strndup.......................................................................................................................................184 strnlen........................................................................................................................................184 strptime .....................................................................................................................................185 strsep..........................................................................................................................................186 strsignal.....................................................................................................................................186 strtok_r......................................................................................................................................188 strtoq..........................................................................................................................................188 strtouq........................................................................................................................................189 strverscmp ................................................................................................................................190 system........................................................................................................................................191 textdomain ................................................................................................................................192 unlink.........................................................................................................................................193 unsetenv ....................................................................................................................................193 vasprintf ....................................................................................................................................194

  • x

    vdprintf......................................................................................................................................194 verrx...........................................................................................................................................195 vsyslog......................................................................................................................................195 wait3..........................................................................................................................................195 wait4..........................................................................................................................................196 waitid .........................................................................................................................................198 waitpid .......................................................................................................................................199 warn ...........................................................................................................................................199 warnx.........................................................................................................................................199 wcpcpy......................................................................................................................................200 wcpncpy....................................................................................................................................200 wcscasecmp ..............................................................................................................................201 wcsdup......................................................................................................................................201 wcsncasecmp ............................................................................................................................202 wcsnlen .....................................................................................................................................203 wcsnrtombs...............................................................................................................................204 wcstoq.......................................................................................................................................205 wcstouq .....................................................................................................................................205 xdr_u_int...................................................................................................................................206

    13.4. Interfaces for libm....................................................................................................................206 13.4.1. Math .............................................................................................................................206

    13.5. Data Definitions for libm........................................................................................................208 13.5.1. math.h ..........................................................................................................................208

    13.6. Interfaces for libpthread..........................................................................................................209 13.6.1. Posix Threads .............................................................................................................210

    13.7. Data Definitions for libpthread..............................................................................................211 13.7.1. pthread.h ......................................................................................................................211 13.7.2. semaphore.h ................................................................................................................213

    13.8. Interfaces Definitions for libpthread.....................................................................................214 sem_timedwait .........................................................................................................................214

    13.9. Interfaces for libgcc_s.............................................................................................................214 13.9.1. Unwind Library ..........................................................................................................214

    13.10. Data Definitions for libgcc_s...............................................................................................215 13.10.1. unwind.h ....................................................................................................................215

    13.11. Interfaces Definitions for libgcc_s......................................................................................216 _Unwind_DeleteException....................................................................................................216 _Unwind_Find_FDE..............................................................................................................216 _Unwind_ForcedUnwind.......................................................................................................217 _Unwind_GetDataRelBase....................................................................................................218 _Unwind_GetGR.....................................................................................................................218 _Unwind_GetIP .......................................................................................................................218 _Unwind_GetLanguageSpecificData ..................................................................................219 _Unwind_GetRegionStart......................................................................................................219 _Unwind_GetTextRelBase....................................................................................................219 _Unwind_RaiseException .....................................................................................................220 _Unwind_Resume ...................................................................................................................221 _Unwind_SetGR .....................................................................................................................221 _Unwind_SetIP........................................................................................................................221

  • xi

    13.12. Interfaces for libdl .................................................................................................................222 13.12.1. Dynamic Loader ......................................................................................................222

    13.13. Data Definitions for libdl .....................................................................................................222 13.13.1. dlfcn.h ........................................................................................................................222

    13.14. Interfaces Definitions for libdl ............................................................................................223 dladdr.........................................................................................................................................223

    13.15. Interfaces for libcrypt............................................................................................................224 13.15.1. Encryption.................................................................................................................225

    13.16. Data Definitions for libcrypt................................................................................................225 13.17. Interfaces for libpam.............................................................................................................225

    13.17.1. Pluggable Authentication API...............................................................................225 13.18. Data Definitions for libpam .................................................................................................225

    13.18.1. security/pam_appl.h ................................................................................................226 13.19. Interfaces Definitions for libpam........................................................................................228

    pam_acct_mgmt ......................................................................................................................228 pam_authenticate.....................................................................................................................229 pam_chauthtok.........................................................................................................................231 pam_close_session..................................................................................................................232 pam_end....................................................................................................................................233 pam_fail_delay ........................................................................................................................234 pam_get_item...........................................................................................................................235 pam_getenvlist.........................................................................................................................236 pam_open_session..................................................................................................................237 pam_set_item...........................................................................................................................238 pam_setcred..............................................................................................................................240 pam_start ..................................................................................................................................241 pam_strerror.............................................................................................................................242

    V. Utility Libraries...............................................................................................................................................245

    14. Libraries...................................................................................................................................................246 14.1. Interfaces for libz.....................................................................................................................246

    14.1.1. Compression Library .................................................................................................246 14.2. Data Definitions for libz.........................................................................................................246

    14.2.1. zlib.h .............................................................................................................................247 14.3. Interfaces for libncurses..........................................................................................................249

    14.3.1. Curses...........................................................................................................................249 14.4. Data Definitions for libncurses..............................................................................................251

    14.4.1. curses.h ........................................................................................................................251 14.5. Interfaces for libutil .................................................................................................................255

    14.5.1. Utility Functions........................................................................................................256 14.6. Interfaces Definitions for libutil ............................................................................................256

    forkpty.......................................................................................................................................256 login ...........................................................................................................................................257 login_tty....................................................................................................................................257 logout.........................................................................................................................................258 logwtmp ....................................................................................................................................258 openpty......................................................................................................................................259

  • xii

    VI. Graphic Libraries .........................................................................................................................................260

    15. Libraries...................................................................................................................................................261 15.1. Interfaces for libX11 ...............................................................................................................261

    15.1.1. X Windows System Interface ..................................................................................261 15.2. Data Definitions for libX11 ...................................................................................................270

    15.2.1. X11/X.h .......................................................................................................................270 15.2.2. X11/Xauth.h................................................................................................................280 15.2.3. X11/Xcms.h ................................................................................................................281 15.2.4. X11/Xlib.h...................................................................................................................283 15.2.5. X11/Xutil.h .................................................................................................................287

    15.3. Interfaces for libXext ..............................................................................................................288 15.3.1. X Shape Extension.....................................................................................................288 15.3.2. X Display Power Management Signaling Extension...........................................288 15.3.3. X Shared Memory Extensions.................................................................................289 15.3.4. MIT-MISC Extension ...............................................................................................289 15.3.5. X Synchronization Extension ..................................................................................289 15.3.6. X Security Extension.................................................................................................289 15.3.7. X Double Buffer Extension......................................................................................289

    15.4. Data Definitions for libXext ..................................................................................................290 15.4.1. X11/extensions/security.h ........................................................................................290 15.4.2. X11/extensions/sync.h ..............................................................................................290

    15.5. Interfaces for libSM .................................................................................................................291 15.5.1. Session Management Functions..............................................................................292

    15.6. Data Definitions for libSM .....................................................................................................292 15.6.1. X11/SM/SMlib.h ........................................................................................................292

    15.7. Interfaces for libICE................................................................................................................294 15.7.1. ICE Functions.............................................................................................................294

    15.8. Data Definitions for libICE....................................................................................................295 15.8.1. X11/ICE/ICElib.h ......................................................................................................295 15.8.2. X11/ICE/ICEutil.h .....................................................................................................296

    15.9. Interfaces for libXt...................................................................................................................297 15.9.1. X Toolkit .....................................................................................................................297

    15.10. Data Definitions for libXt ....................................................................................................302 15.10.1. X11/Composite.h .....................................................................................................302 15.10.2. X11/CompositeP.h ..................................................................................................302 15.10.3. X11/ConstrainP.h ....................................................................................................303 15.10.4. X11/Constraint.h......................................................................................................303 15.10.5. X11/Intrinsic.h .........................................................................................................303 15.10.6. X11/ObjectP.h ..........................................................................................................304

    15.11. Interfaces Definitions for libXt ...........................................................................................306 _XtCopyFromArg ...................................................................................................................306 _XtInherit .................................................................................................................................306 _XtInheritTranslations ...........................................................................................................306 _XtIsSubclassOf......................................................................................................................307

    15.12. Interfaces for libGL...............................................................................................................307 15.12.1. GL X interface..........................................................................................................307 15.12.2. OpenGL.....................................................................................................................308

  • xiii

    15.13. Data Definitions for libGL...................................................................................................312 15.13.1. GL/gl.h ......................................................................................................................312 15.13.2. GL/glx.h ....................................................................................................................314

    VII. Package Format and Installation............................................................................................................315

    16. Software Installation .............................................................................................................................316 16.1. Package File Format................................................................................................................316

    16.1.1. Lead Section ...............................................................................................................316 16.1.2. Header Structure ........................................................................................................317

    16.1.2.1. Header Record ..............................................................................................317 16.1.2.2. Index Record.................................................................................................318

    16.1.2.2.1. Index Type Values.........................................................................318 16.1.2.2.2. Index Tag Values ...........................................................................319

    16.1.2.3. Header Store .................................................................................................320 16.1.3. Signature Section .......................................................................................................320 16.1.4. Header Section ...........................................................................................................322

    16.1.4.1. Package Information ...................................................................................322 16.1.4.2. Installation Information ..............................................................................324 16.1.4.3. File Information ...........................................................................................325 16.1.4.4. Dependency Information ............................................................................327

    16.1.4.4.1. Package Dependency Values .......................................................329 16.1.4.4.2. Package Dependencies Attributes ...............................................330

    16.1.4.5. Other Information ........................................................................................330 16.1.5. Payload Section..........................................................................................................332

    16.2. Package Script Restrictions....................................................................................................334 16.3. Package Tools ...........................................................................................................................334 16.4. Package Naming ......................................................................................................................335 16.5. Package Dependencies............................................................................................................335 16.6. Package Architecture Considerations...................................................................................335

    VIII. Commands and Utilities ..........................................................................................................................336

    17. Commands and Utilities .......................................................................................................................337 17.1. Commands and Utilities .........................................................................................................337 17.2. Command Behavior.................................................................................................................338

    ar.................................................................................................................................................338 at.................................................................................................................................................339 awk.............................................................................................................................................340 batch ..........................................................................................................................................341 bc................................................................................................................................................342 cat...............................................................................................................................................343 chfn ............................................................................................................................................345 chgrp..........................................................................................................................................346 chmod........................................................................................................................................347 chown ........................................................................................................................................347 chsh............................................................................................................................................349 col...............................................................................................................................................349 cp................................................................................................................................................350 cpio ............................................................................................................................................351 crontab.......................................................................................................................................352

  • xiv

    csplit ..........................................................................................................................................353 cut...............................................................................................................................................354 date.............................................................................................................................................355 df ................................................................................................................................................356 diff..............................................................................................................................................358 dmesg ........................................................................................................................................360 du................................................................................................................................................361 echo............................................................................................................................................362 egrep..........................................................................................................................................362 env..............................................................................................................................................363 expand.......................................................................................................................................363 expr............................................................................................................................................364 fgrep...........................................................................................................................................364 file ..............................................................................................................................................365 find.............................................................................................................................................367 fuser...........................................................................................................................................376 gencat ........................................................................................................................................377 gettext ........................................................................................................................................378 grep............................................................................................................................................381 groupadd ...................................................................................................................................383 groupdel....................................................................................................................................384 groupmod..................................................................................................................................384 groups........................................................................................................................................385 gunzip ........................................................................................................................................385 gzip ............................................................................................................................................386 head............................................................................................................................................388 hostname ...................................................................................................................................388 iconv ..........................................................................................................................................390 install .........................................................................................................................................390 install_initd...............................................................................................................................392 ipcrm..........................................................................................................................................392 ipcs.............................................................................................................................................393 killall..........................................................................................................................................394 ln.................................................................................................................................................396 localedef....................................................................................................................................397 lpr...............................................................................................................................................398 ls .................................................................................................................................................399 lsb_release................................................................................................................................400 m4 ..............................................................................................................................................401 make ..........................................................................................................................................404 man ............................................................................................................................................405 md5sum.....................................................................................................................................406 mkdir .........................................................................................................................................406 mknod........................................................................................................................................407 mktemp .....................................................................................................................................408 more ...........................................................................................................................................408 mount.........................................................................................................................................410 msgfmt ......................................................................................................................................414

  • xv

    mv ..............................................................................................................................................420 newgrp.......................................................................................................................................421 nice.............................................................................................................................................422 nl.................................................................................................................................................422 nohup.........................................................................................................................................423 od................................................................................................................................................424 passwd.......................................................................................................................................425 paste...........................................................................................................................................426 patch ..........................................................................................................................................427 pathchk......................................................................................................................................429 pidof...........................................................................................................................................430 pr ................................................................................................................................................431 printf ..........................................................................................................................................432 pwd ............................................................................................................................................432 remove_initd ............................................................................................................................433 renice .........................................................................................................................................433 rm...............................................................................................................................................434 rmdir ..........................................................................................................................................435 rsync..........................................................................................................................................435 sed..............................................................................................................................................441 sendmail....................................................................................................................................442 shutdown...................................................................................................................................445 sleep...........................................................................................................................................446 sort .............................................................................................................................................447 split ............................................................................................................................................448 strip ............................................................................................................................................449 su................................................................................................................................................451 sum.............................................................................................................................................452 sync............................................................................................................................................452 tail ..............................................................................................................................................453 tar ...............................................................................................................................................455 tee...............................................................................................................................................459 test..............................................................................................................................................460 touch..........................................................................................................................................461 tr .................................................................................................................................................462 tty ...............................................................................................................................................463 umount ......................................................................................................................................463 uname ........................................................................................................................................465 unexpand...................................................................................................................................466 uniq ............................................................................................................................................467 useradd ......................................................................................................................................468 userdel.......................................................................................................................................471 usermod.....................................................................................................................................471 wc...............................................................................................................................................473 xargs ..........................................................................................................................................474

    IX. Standard Shell................................................................................................................................................477

    18. Standard Shell.........................................................................................................................................478

  • xvi

    18.1. Introduction...............................................................................................................................478 18.2. Standard Shell Exceptions......................................................................................................478

    18.2.1. Pathname of $0...........................................................................................................478 18.2.2. Sourcing non-executable files..................................................................................478 18.2.3. Globalized Pattern Matching ...................................................................................478

    18.3. Standard Shell Rationale ........................................................................................................478

    X. Users & Groups ...............................................................................................................................................480

    19. Users & Groups......................................................................................................................................481 19.1. User and Group Database.......................................................................................................481 19.2. User & Group Names..............................................................................................................481 19.3. UID Ranges...............................................................................................................................482 19.4. Rationale ....................................................................................................................................482

    XI. Execution Environment...............................................................................................................................483

    20. File System Hierarchy...........................................................................................................................484 20.1. /dev ...........................................................................................................................................484

    21. Addi