1557
Open System Services System Calls Reference Manual Abstract This manual documents part of the HP NonStop Open System Services (OSS) application program interface. It is written for system and application programmers. Product Version N.A. Supported Release Version Updates (RVUs) This manual supports J06.03 and all subsequent J-series RVUs, H06.08 and all subsequent H-series RVUs, and G06.29 and all subsequent G-series RVUs until otherwise indicated by its replacement publication. Part Number Published 527186-023 February 2014

Open System Services SystemCalls ReferenceManualnonstoptools.com/manuals/OSS-SystemCalls.pdfThis manual documents part of the HP NonStop Open System Services (OSS) application program

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

  • Open System ServicesSystem CallsReference Manual

    Abstract

    This manual documents part of the HP NonStop Open System Services (OSS)application program interface. It is written for system and application programmers.

    Product Version

    N.A.

    Supported Release Version Updates (RVUs)

    This manual supports J06.03 and all subsequent J-series RVUs, H06.08 and allsubsequent H-series RVUs, and G06.29 and all subsequent G-series RVUs untilotherwise indicated by its replacement publication.

    Part Number Published

    527186-023 February 2014

  • Document HistoryPart Number Product Version Published

    527186-019 N/A February 2012527186-020 N/A August 2012527186-021 N/A February 2013527186-022 N/A August 2013527186-023 N/A February 2014

  • Contents_____________________________

    What Is New in This Manual . . . . . . . . . . . . . . . . . . . . ix

    Changed Functions . . . . . . . . . . . . . . . . . . . x

    About This Manual . . . . . . . . . . . . . . . . . . . . . . xi

    Audience . . . . . . . . . . . . . . . . . . . . . . xii

    Purpose . . . . . . . . . . . . . . . . . . . . . . xii

    Document Usage . . . . . . . . . . . . . . . . . . . xii

    Reference Page Format . . . . . . . . . . . . . . . . . xii

    Related Documents . . . . . . . . . . . . . . . . . . . xiii

    Reference Section Numbers . . . . . . . . . . . . . . . . xiv

    Typographic and Keying Conventions . . . . . . . . . . . . . xv

    Section 1. System Functions (a - d) . . . . . . . . . . . . . . . . . 1-1accept . . . . . . . . . . . . . . . . . . . . . . . 1-2access . . . . . . . . . . . . . . . . . . . . . . . 1-6acl . . . . . . . . . . . . . . . . . . . . . . . . 1-10bind . . . . . . . . . . . . . . . . . . . . . . . 1-14chdir . . . . . . . . . . . . . . . . . . . . . . . 1-18chmod . . . . . . . . . . . . . . . . . . . . . . 1-21chown . . . . . . . . . . . . . . . . . . . . . . 1-26chroot . . . . . . . . . . . . . . . . . . . . . . . 1-31close . . . . . . . . . . . . . . . . . . . . . . . 1-34connect . . . . . . . . . . . . . . . . . . . . . . 1-37creat . . . . . . . . . . . . . . . . . . . . . . . 1-43creat64 . . . . . . . . . . . . . . . . . . . . . . 1-51dup . . . . . . . . . . . . . . . . . . . . . . . 1-58dup2 . . . . . . . . . . . . . . . . . . . . . . . 1-60

    Section 2. System Functions (e) . . . . . . . . . . . . . . . . . . 2-1exec . . . . . . . . . . . . . . . . . . . . . . . 2-2execl . . . . . . . . . . . . . . . . . . . . . . . 2-3execle . . . . . . . . . . . . . . . . . . . . . . . 2-11execlp . . . . . . . . . . . . . . . . . . . . . . 2-19execv . . . . . . . . . . . . . . . . . . . . . . . 2-27execve . . . . . . . . . . . . . . . . . . . . . . 2-35execvp . . . . . . . . . . . . . . . . . . . . . . 2-43_exit . . . . . . . . . . . . . . . . . . . . . . . 2-51

    Section 3. System Functions (f - i) . . . . . . . . . . . . . . . . . 3-1fchmod . . . . . . . . . . . . . . . . . . . . . . 3-2fchown . . . . . . . . . . . . . . . . . . . . . . 3-7fcntl . . . . . . . . . . . . . . . . . . . . . . . 3-11fork . . . . . . . . . . . . . . . . . . . . . . . 3-19

    527186-023 Hewlett-Packard Company iii

  • OSS System Calls Reference Manual

    fstat . . . . . . . . . . . . . . . . . . . . . . . 3-24fstat64 . . . . . . . . . . . . . . . . . . . . . . 3-35fstatvfs . . . . . . . . . . . . . . . . . . . . . . 3-45fstatvfs64 . . . . . . . . . . . . . . . . . . . . . 3-53fsync . . . . . . . . . . . . . . . . . . . . . . . 3-61ftruncate . . . . . . . . . . . . . . . . . . . . . . 3-64ftruncate64 . . . . . . . . . . . . . . . . . . . . . 3-67getegid . . . . . . . . . . . . . . . . . . . . . . 3-70geteuid . . . . . . . . . . . . . . . . . . . . . . 3-71getgid . . . . . . . . . . . . . . . . . . . . . . . 3-72getgroups . . . . . . . . . . . . . . . . . . . . . 3-73gethostname . . . . . . . . . . . . . . . . . . . . . 3-74getpeername . . . . . . . . . . . . . . . . . . . . . 3-75getpgid . . . . . . . . . . . . . . . . . . . . . . 3-78getpgrp . . . . . . . . . . . . . . . . . . . . . . 3-79getpid . . . . . . . . . . . . . . . . . . . . . . . 3-80getppid . . . . . . . . . . . . . . . . . . . . . . 3-81getpriority . . . . . . . . . . . . . . . . . . . . . 3-82getsid . . . . . . . . . . . . . . . . . . . . . . . 3-84getsockname . . . . . . . . . . . . . . . . . . . . . 3-85getsockopt . . . . . . . . . . . . . . . . . . . . . 3-88gettimeofday . . . . . . . . . . . . . . . . . . . . 3-94getuid . . . . . . . . . . . . . . . . . . . . . . . 3-96ioctl . . . . . . . . . . . . . . . . . . . . . . . 3-97

    Section 4. System Functions (k - m) . . . . . . . . . . . . . . . . . 4-1kill . . . . . . . . . . . . . . . . . . . . . . . 4-2lchmod . . . . . . . . . . . . . . . . . . . . . . 4-5lchown . . . . . . . . . . . . . . . . . . . . . . 4-10link . . . . . . . . . . . . . . . . . . . . . . . 4-15listen . . . . . . . . . . . . . . . . . . . . . . . 4-19lseek . . . . . . . . . . . . . . . . . . . . . . . 4-22lseek64 . . . . . . . . . . . . . . . . . . . . . . 4-25lstat . . . . . . . . . . . . . . . . . . . . . . . 4-28lstat64 . . . . . . . . . . . . . . . . . . . . . . 4-38mkdir . . . . . . . . . . . . . . . . . . . . . . . 4-48mknod . . . . . . . . . . . . . . . . . . . . . . 4-53msgctl . . . . . . . . . . . . . . . . . . . . . . 4-59msgget . . . . . . . . . . . . . . . . . . . . . . 4-62msgrcv . . . . . . . . . . . . . . . . . . . . . . 4-65msgsnd . . . . . . . . . . . . . . . . . . . . . . 4-69

    Section 5. System Functions (n - p) . . . . . . . . . . . . . . . . . 5-1nice . . . . . . . . . . . . . . . . . . . . . . . 5-2open . . . . . . . . . . . . . . . . . . . . . . . 5-4open64 . . . . . . . . . . . . . . . . . . . . . . 5-16pipe . . . . . . . . . . . . . . . . . . . . . . . 5-27pthread_atfork . . . . . . . . . . . . . . . . . . . . 5-29pthread_attr_destroy . . . . . . . . . . . . . . . . . . 5-32pthread_attr_getdetachstate . . . . . . . . . . . . . . . . 5-34pthread_attr_getguardsize . . . . . . . . . . . . . . . . . 5-36pthread_attr_getguardsize_np . . . . . . . . . . . . . . . 5-38pthread_attr_getinheritsched . . . . . . . . . . . . . . . . 5-39pthread_attr_getschedparam . . . . . . . . . . . . . . . . 5-41pthread_attr_getschedpolicy . . . . . . . . . . . . . . . . 5-43pthread_attr_getscope . . . . . . . . . . . . . . . . . . 5-45

    iv Hewlett-Packard Company 527186-023

  • Contents

    pthread_attr_getstackaddr . . . . . . . . . . . . . . . . . 5-47pthread_attr_getstacksize . . . . . . . . . . . . . . . . . 5-49pthread_attr_init . . . . . . . . . . . . . . . . . . . 5-51pthread_attr_setdetachstate . . . . . . . . . . . . . . . . 5-54pthread_attr_setguardsize . . . . . . . . . . . . . . . . . 5-57pthread_attr_setguardsize_np . . . . . . . . . . . . . . . . 5-59pthread_attr_setinheritsched . . . . . . . . . . . . . . . . 5-61pthread_attr_setschedparam . . . . . . . . . . . . . . . . 5-64pthread_attr_setschedpolicy . . . . . . . . . . . . . . . . 5-67pthread_attr_setscope . . . . . . . . . . . . . . . . . . 5-69pthread_attr_setstacksize . . . . . . . . . . . . . . . . . 5-71pthread_cancel . . . . . . . . . . . . . . . . . . . . 5-73pthread_cleanup_pop . . . . . . . . . . . . . . . . . . 5-76pthread_cleanup_push . . . . . . . . . . . . . . . . . . 5-78pthread_condattr_destroy . . . . . . . . . . . . . . . . . 5-80pthread_condattr_init . . . . . . . . . . . . . . . . . . 5-82pthread_cond_broadcast . . . . . . . . . . . . . . . . . 5-84pthread_cond_destroy . . . . . . . . . . . . . . . . . . 5-86pthread_cond_init . . . . . . . . . . . . . . . . . . . 5-88pthread_cond_signal . . . . . . . . . . . . . . . . . . 5-91pthread_cond_signal_int_np . . . . . . . . . . . . . . . . 5-93pthread_cond_timedwait . . . . . . . . . . . . . . . . . 5-95pthread_cond_wait . . . . . . . . . . . . . . . . . . . 5-98pthread_create . . . . . . . . . . . . . . . . . . . . 5-101pthread_delay_np . . . . . . . . . . . . . . . . . . . 5-105pthread_detach . . . . . . . . . . . . . . . . . . . . 5-107pthread_equal . . . . . . . . . . . . . . . . . . . . 5-109pthread_exit . . . . . . . . . . . . . . . . . . . . . 5-111pthread_getattr_np . . . . . . . . . . . . . . . . . . . 5-113pthread_getconcurrency . . . . . . . . . . . . . . . . . 5-115pthread_get_expiration_np . . . . . . . . . . . . . . . . 5-117pthread_getschedparam . . . . . . . . . . . . . . . . . 5-119pthread_getspecific . . . . . . . . . . . . . . . . . . . 5-121pthread_get_threadstateinfo_np . . . . . . . . . . . . . . . 5-123pthread_join . . . . . . . . . . . . . . . . . . . . . 5-125pthread_key_create . . . . . . . . . . . . . . . . . . . 5-128pthread_key_delete . . . . . . . . . . . . . . . . . . . 5-131pthread_kill . . . . . . . . . . . . . . . . . . . . . 5-133pthread_kill_np . . . . . . . . . . . . . . . . . . . . 5-136pthread_lock_global_np . . . . . . . . . . . . . . . . . 5-138pthread_mutexattr_destroy . . . . . . . . . . . . . . . . 5-140pthread_mutexattr_getkind_np . . . . . . . . . . . . . . . 5-142pthread_mutexattr_gettype . . . . . . . . . . . . . . . . 5-143pthread_mutexattr_init . . . . . . . . . . . . . . . . . . 5-146pthread_mutexattr_setkind_np . . . . . . . . . . . . . . . 5-148pthread_mutexattr_settype . . . . . . . . . . . . . . . . 5-150pthread_mutex_destroy . . . . . . . . . . . . . . . . . 5-152pthread_mutex_init . . . . . . . . . . . . . . . . . . . 5-154pthread_mutex_lock . . . . . . . . . . . . . . . . . . 5-156pthread_mutex_trylock . . . . . . . . . . . . . . . . . 5-158pthread_mutex_unlock . . . . . . . . . . . . . . . . . . 5-160pthread_once . . . . . . . . . . . . . . . . . . . . 5-162pthread_self . . . . . . . . . . . . . . . . . . . . . 5-164pthread_setcancelstate . . . . . . . . . . . . . . . . . . 5-166pthread_setcanceltype . . . . . . . . . . . . . . . . . . 5-168

    527186-023 Hewlett-Packard Company v

  • OSS System Calls Reference Manual

    pthread_setconcurrency . . . . . . . . . . . . . . . . . 5-171pthread_setschedparam . . . . . . . . . . . . . . . . . 5-173pthread_setspecific . . . . . . . . . . . . . . . . . . . 5-176pthread_sigmask . . . . . . . . . . . . . . . . . . . 5-178pthread_signal_to_cancel_np . . . . . . . . . . . . . . . . 5-180pthread_testcancel . . . . . . . . . . . . . . . . . . . 5-182pthread_unlock_global_np . . . . . . . . . . . . . . . . 5-184put_awaitio . . . . . . . . . . . . . . . . . . . . . 5-186PUT_CANCEL . . . . . . . . . . . . . . . . . . . . 5-188PUT_CONTROL . . . . . . . . . . . . . . . . . . . 5-190put_fd_read_ready . . . . . . . . . . . . . . . . . . . 5-193put_fd_write_ready . . . . . . . . . . . . . . . . . . . 5-195PUT_FILE_CLOSE_ . . . . . . . . . . . . . . . . . . 5-197PUT_FILE_OPEN_ . . . . . . . . . . . . . . . . . . 5-199PUT_FILE_WRITEREAD_ . . . . . . . . . . . . . . . . 5-212put_generateTag . . . . . . . . . . . . . . . . . . . 5-215put_getTMFConcurrentTransactions . . . . . . . . . . . . . 5-216put_INITRECEIVE . . . . . . . . . . . . . . . . . . . 5-217put_INITRECEIVEL . . . . . . . . . . . . . . . . . . 5-219put_interrupt . . . . . . . . . . . . . . . . . . . . . 5-221put_interruptTag . . . . . . . . . . . . . . . . . . . 5-223PUT_LOCKFILE . . . . . . . . . . . . . . . . . . . 5-225PUT_LOCKREC . . . . . . . . . . . . . . . . . . . 5-228PUT_READLOCKX . . . . . . . . . . . . . . . . . . 5-232PUT_READUPDATELOCKX . . . . . . . . . . . . . . . 5-236PUT_READUPDATEX . . . . . . . . . . . . . . . . . 5-240PUT_READX . . . . . . . . . . . . . . . . . . . . 5-243put_RECEIVEREAD . . . . . . . . . . . . . . . . . . 5-249put_RECEIVEREADL . . . . . . . . . . . . . . . . . . 5-251put_regFile . . . . . . . . . . . . . . . . . . . . . 5-253put_regFileIOHandler . . . . . . . . . . . . . . . . . . 5-254put_regOSSFileIOHandler . . . . . . . . . . . . . . . . 5-256put_regPathsendFile . . . . . . . . . . . . . . . . . . 5-258put_regPathsendTagHandler . . . . . . . . . . . . . . . . 5-260put_regTimerHandler . . . . . . . . . . . . . . . . . . 5-262put_REPLYX . . . . . . . . . . . . . . . . . . . . 5-263put_REPLYXL . . . . . . . . . . . . . . . . . . . . 5-265put_select_single_np . . . . . . . . . . . . . . . . . . 5-267PUT_SETMODE . . . . . . . . . . . . . . . . . . . 5-269put_setOSSFileIOHandler . . . . . . . . . . . . . . . . . 5-272put_setTMFConcurrentTransactions . . . . . . . . . . . . . . 5-274PUT_TMF_GetTxHandle . . . . . . . . . . . . . . . . . 5-275PUT_TMF_Init . . . . . . . . . . . . . . . . . . . . 5-277PUT_TMF_RESUME . . . . . . . . . . . . . . . . . . 5-278PUT_TMF_SetAndValidateTxHandle . . . . . . . . . . . . . 5-280PUT_TMF_SetTxHandle . . . . . . . . . . . . . . . . . 5-282PUT_TMF_SUSPEND . . . . . . . . . . . . . . . . . . 5-284PUT_UNLOCKFILE . . . . . . . . . . . . . . . . . . 5-286PUT_UNLOCKREC . . . . . . . . . . . . . . . . . . 5-288put_unregFile . . . . . . . . . . . . . . . . . . . . 5-291put_unregOSSFileIOHandler . . . . . . . . . . . . . . . . 5-293put_unregPathsendTagHandler . . . . . . . . . . . . . . . 5-294put_wakeup . . . . . . . . . . . . . . . . . . . . . 5-295PUT_WRITEREADX . . . . . . . . . . . . . . . . . . 5-297PUT_WRITEUPDATEUNLOCKX . . . . . . . . . . . . . . 5-301

    vi Hewlett-Packard Company 527186-023

  • Contents

    PUT_WRITEUPDATEX . . . . . . . . . . . . . . . . . 5-305PUT_WRITEX . . . . . . . . . . . . . . . . . . . . 5-311

    Section 6. System Functions (r) . . . . . . . . . . . . . . . . . . 6-1read . . . . . . . . . . . . . . . . . . . . . . . 6-2read64_ . . . . . . . . . . . . . . . . . . . . . . 6-8readlink . . . . . . . . . . . . . . . . . . . . . . 6-12readv . . . . . . . . . . . . . . . . . . . . . . . 6-15recv . . . . . . . . . . . . . . . . . . . . . . . 6-21recv64_ . . . . . . . . . . . . . . . . . . . . . . 6-24recvfrom . . . . . . . . . . . . . . . . . . . . . . 6-27recvfrom64_ . . . . . . . . . . . . . . . . . . . . . 6-31recvmsg . . . . . . . . . . . . . . . . . . . . . . 6-34recvmsg64_ . . . . . . . . . . . . . . . . . . . . . 6-39rename . . . . . . . . . . . . . . . . . . . . . . 6-43rename_guardian . . . . . . . . . . . . . . . . . . . 6-44rename_oss . . . . . . . . . . . . . . . . . . . . . 6-46rmdir . . . . . . . . . . . . . . . . . . . . . . . 6-52

    Section 7. System Functions (s and S) . . . . . . . . . . . . . . . . 7-1sched_get_priority_max . . . . . . . . . . . . . . . . . 7-2sched_get_priority_min . . . . . . . . . . . . . . . . . 7-4sched_yield . . . . . . . . . . . . . . . . . . . . . 7-6select . . . . . . . . . . . . . . . . . . . . . . . 7-8semctl . . . . . . . . . . . . . . . . . . . . . . 7-15semget . . . . . . . . . . . . . . . . . . . . . . 7-20semop . . . . . . . . . . . . . . . . . . . . . . . 7-23send . . . . . . . . . . . . . . . . . . . . . . . 7-27send64_ . . . . . . . . . . . . . . . . . . . . . . 7-31sendmsg . . . . . . . . . . . . . . . . . . . . . . 7-34sendmsg64_ . . . . . . . . . . . . . . . . . . . . . 7-39sendto . . . . . . . . . . . . . . . . . . . . . . 7-44sendto64_ . . . . . . . . . . . . . . . . . . . . . 7-49setegid . . . . . . . . . . . . . . . . . . . . . . 7-53seteuid . . . . . . . . . . . . . . . . . . . . . . 7-55setfilepriv . . . . . . . . . . . . . . . . . . . . . 7-57setgid . . . . . . . . . . . . . . . . . . . . . . . 7-59setgroups . . . . . . . . . . . . . . . . . . . . . . 7-60setpgid . . . . . . . . . . . . . . . . . . . . . . 7-61setpgrp . . . . . . . . . . . . . . . . . . . . . . 7-63setregid . . . . . . . . . . . . . . . . . . . . . . 7-64setreuid . . . . . . . . . . . . . . . . . . . . . . 7-66setsid . . . . . . . . . . . . . . . . . . . . . . . 7-68setsockopt . . . . . . . . . . . . . . . . . . . . . 7-69setuid . . . . . . . . . . . . . . . . . . . . . . . 7-76shmat . . . . . . . . . . . . . . . . . . . . . . . 7-77shmctl . . . . . . . . . . . . . . . . . . . . . . 7-80shmdt . . . . . . . . . . . . . . . . . . . . . . . 7-83shmget . . . . . . . . . . . . . . . . . . . . . . 7-85shutdown . . . . . . . . . . . . . . . . . . . . . . 7-90sigaction . . . . . . . . . . . . . . . . . . . . . . 7-92sigaltstack . . . . . . . . . . . . . . . . . . . . . 7-98sigpending . . . . . . . . . . . . . . . . . . . . . 7-102sigprocmask . . . . . . . . . . . . . . . . . . . . . 7-104sigsuspend . . . . . . . . . . . . . . . . . . . . . 7-106sigwait . . . . . . . . . . . . . . . . . . . . . . 7-109

    527186-023 Hewlett-Packard Company vii

  • OSS System Calls Reference Manual

    sockatmark . . . . . . . . . . . . . . . . . . . . . 7-112socket . . . . . . . . . . . . . . . . . . . . . . . 7-114socketpair . . . . . . . . . . . . . . . . . . . . . 7-119socket_transport_name_get . . . . . . . . . . . . . . . . 7-124socket_transport_name_set . . . . . . . . . . . . . . . . 7-127spt_accept . . . . . . . . . . . . . . . . . . . . . 7-130spt_acceptx . . . . . . . . . . . . . . . . . . . . . 7-131spt_alarm . . . . . . . . . . . . . . . . . . . . . 7-134spt_awaitio . . . . . . . . . . . . . . . . . . . . . 7-136SPT_CANCEL . . . . . . . . . . . . . . . . . . . . 7-138spt_close . . . . . . . . . . . . . . . . . . . . . . 7-140spt_closex . . . . . . . . . . . . . . . . . . . . . 7-141spt_closez . . . . . . . . . . . . . . . . . . . . . 7-143spt_connect . . . . . . . . . . . . . . . . . . . . . 7-145spt_connectx . . . . . . . . . . . . . . . . . . . . 7-146SPT_CONTROL . . . . . . . . . . . . . . . . . . . 7-151spt_dup2x . . . . . . . . . . . . . . . . . . . . . 7-153spt_fclose . . . . . . . . . . . . . . . . . . . . . 7-156spt_fclosex . . . . . . . . . . . . . . . . . . . . . 7-157spt_fcntlx . . . . . . . . . . . . . . . . . . . . . 7-159spt_fcntlz . . . . . . . . . . . . . . . . . . . . . 7-166spt_fd_read_ready . . . . . . . . . . . . . . . . . . . 7-174spt_fd_write_ready . . . . . . . . . . . . . . . . . . . 7-175spt_fflush . . . . . . . . . . . . . . . . . . . . . . 7-176spt_fflushx . . . . . . . . . . . . . . . . . . . . . 7-177spt_fgetc . . . . . . . . . . . . . . . . . . . . . . 7-179spt_fgetcx . . . . . . . . . . . . . . . . . . . . . 7-180spt_fgets . . . . . . . . . . . . . . . . . . . . . . 7-182spt_fgetsx . . . . . . . . . . . . . . . . . . . . . 7-183spt_fgetwc . . . . . . . . . . . . . . . . . . . . . 7-185spt_fgetwcx . . . . . . . . . . . . . . . . . . . . . 7-186SPT_FILE_CLOSE_ . . . . . . . . . . . . . . . . . . 7-188spt_FileIOHandler_p . . . . . . . . . . . . . . . . . . 7-190SPT_FILE_OPEN_ . . . . . . . . . . . . . . . . . . . 7-191spt_fork . . . . . . . . . . . . . . . . . . . . . . 7-204spt_fprintf . . . . . . . . . . . . . . . . . . . . . 7-205spt_fprintfx . . . . . . . . . . . . . . . . . . . . . 7-206spt_fputc . . . . . . . . . . . . . . . . . . . . . . 7-213spt_fputcx . . . . . . . . . . . . . . . . . . . . . 7-214spt_fputs . . . . . . . . . . . . . . . . . . . . . . 7-217spt_fputsx . . . . . . . . . . . . . . . . . . . . . 7-218spt_fputwc . . . . . . . . . . . . . . . . . . . . . 7-220spt_fputwcx . . . . . . . . . . . . . . . . . . . . . 7-221spt_fread . . . . . . . . . . . . . . . . . . . . . . 7-223spt_freadx . . . . . . . . . . . . . . . . . . . . . 7-224spt_fstat64z . . . . . . . . . . . . . . . . . . . . . 7-226spt_fstatz . . . . . . . . . . . . . . . . . . . . . . 7-236spt_fsyncz . . . . . . . . . . . . . . . . . . . . . 7-246spt_ftruncate64z . . . . . . . . . . . . . . . . . . . 7-249spt_ftruncatez . . . . . . . . . . . . . . . . . . . . 7-252spt_fwrite . . . . . . . . . . . . . . . . . . . . . 7-255spt_fwritex . . . . . . . . . . . . . . . . . . . . . 7-256spt_generateTag . . . . . . . . . . . . . . . . . . . . 7-259spt_getc . . . . . . . . . . . . . . . . . . . . . . 7-260spt_getchar . . . . . . . . . . . . . . . . . . . . . 7-261

    viii Hewlett-Packard Company 527186-023

  • Contents

    spt_getcharx . . . . . . . . . . . . . . . . . . . . . 7-262spt_getcx . . . . . . . . . . . . . . . . . . . . . . 7-264spt_gets . . . . . . . . . . . . . . . . . . . . . . 7-266spt_getsx . . . . . . . . . . . . . . . . . . . . . . 7-267spt_getTMFConcurrentTransactions . . . . . . . . . . . . . . 7-269spt_getw . . . . . . . . . . . . . . . . . . . . . . 7-270spt_getwc . . . . . . . . . . . . . . . . . . . . . 7-271spt_getwchar . . . . . . . . . . . . . . . . . . . . 7-272spt_getwcharx . . . . . . . . . . . . . . . . . . . . 7-273spt_getwcx . . . . . . . . . . . . . . . . . . . . . 7-275spt_getwx . . . . . . . . . . . . . . . . . . . . . 7-277spt_INITRECEIVE . . . . . . . . . . . . . . . . . . . 7-279spt_INITRECEIVEL . . . . . . . . . . . . . . . . . . 7-280spt_interrupt . . . . . . . . . . . . . . . . . . . . . 7-281spt_interruptTag . . . . . . . . . . . . . . . . . . . 7-282SPT_LOCKFILE . . . . . . . . . . . . . . . . . . . 7-283SPT_LOCKREC . . . . . . . . . . . . . . . . . . . 7-286spt_lseek64z . . . . . . . . . . . . . . . . . . . . . 7-290spt_lseekz . . . . . . . . . . . . . . . . . . . . . 7-293spt_OSSFileIOHandler_p . . . . . . . . . . . . . . . . . 7-296spt_pause . . . . . . . . . . . . . . . . . . . . . 7-297spt_printf . . . . . . . . . . . . . . . . . . . . . . 7-298spt_printfx . . . . . . . . . . . . . . . . . . . . . 7-299spt_putc . . . . . . . . . . . . . . . . . . . . . . 7-306spt_putchar . . . . . . . . . . . . . . . . . . . . . 7-307spt_putcharx . . . . . . . . . . . . . . . . . . . . . 7-308spt_putcx . . . . . . . . . . . . . . . . . . . . . . 7-311spt_puts . . . . . . . . . . . . . . . . . . . . . . 7-314spt_putsx . . . . . . . . . . . . . . . . . . . . . . 7-315spt_putw . . . . . . . . . . . . . . . . . . . . . . 7-317spt_putwc . . . . . . . . . . . . . . . . . . . . . 7-318spt_putwchar . . . . . . . . . . . . . . . . . . . . 7-319spt_putwcharx . . . . . . . . . . . . . . . . . . . . 7-320spt_putwcx . . . . . . . . . . . . . . . . . . . . . 7-322spt_putwx . . . . . . . . . . . . . . . . . . . . . 7-324spt_read . . . . . . . . . . . . . . . . . . . . . . 7-327SPT_READLOCKX . . . . . . . . . . . . . . . . . . 7-328SPT_READUPDATELOCKX . . . . . . . . . . . . . . . 7-331SPT_READUPDATEX . . . . . . . . . . . . . . . . . 7-334spt_readv . . . . . . . . . . . . . . . . . . . . . . 7-337spt_readvx . . . . . . . . . . . . . . . . . . . . . 7-338spt_readvz . . . . . . . . . . . . . . . . . . . . . 7-343SPT_READX . . . . . . . . . . . . . . . . . . . . 7-348spt_readx . . . . . . . . . . . . . . . . . . . . . . 7-354spt_readz . . . . . . . . . . . . . . . . . . . . . . 7-358spt_RECEIVEREAD . . . . . . . . . . . . . . . . . . 7-363spt_RECEIVEREADL . . . . . . . . . . . . . . . . . . 7-365spt_recv . . . . . . . . . . . . . . . . . . . . . . 7-367spt_recvfrom . . . . . . . . . . . . . . . . . . . . 7-368spt_recvfromx . . . . . . . . . . . . . . . . . . . . 7-369spt_recvmsg . . . . . . . . . . . . . . . . . . . . . 7-372spt_recvmsgx . . . . . . . . . . . . . . . . . . . . 7-373spt_recvx . . . . . . . . . . . . . . . . . . . . . . 7-377spt_regFile . . . . . . . . . . . . . . . . . . . . . 7-380spt_regFileIOHandler . . . . . . . . . . . . . . . . . . 7-381

    527186-023 Hewlett-Packard Company ix

  • OSS System Calls Reference Manual

    spt_regOSSFileIOHandler . . . . . . . . . . . . . . . . 7-382spt_regPathsendFile . . . . . . . . . . . . . . . . . . 7-383spt_regPathsendTagHandler . . . . . . . . . . . . . . . . 7-384spt_regTimerHandler . . . . . . . . . . . . . . . . . . 7-386spt_REPLYX . . . . . . . . . . . . . . . . . . . . 7-387spt_REPLYXL . . . . . . . . . . . . . . . . . . . . 7-388spt_select . . . . . . . . . . . . . . . . . . . . . 7-390spt_select_single_np . . . . . . . . . . . . . . . . . . 7-392spt_send . . . . . . . . . . . . . . . . . . . . . . 7-394spt_sendmsg . . . . . . . . . . . . . . . . . . . . . 7-395spt_sendmsgx . . . . . . . . . . . . . . . . . . . . 7-396spt_sendto . . . . . . . . . . . . . . . . . . . . . 7-401spt_sendtox . . . . . . . . . . . . . . . . . . . . . 7-403spt_sendx . . . . . . . . . . . . . . . . . . . . . 7-407SPT_SETMODE . . . . . . . . . . . . . . . . . . . 7-410spt_setOSSFileIOHandler . . . . . . . . . . . . . . . . . 7-413spt_setTMFConcurrentTransactions . . . . . . . . . . . . . . 7-414spt_sigaction . . . . . . . . . . . . . . . . . . . . 7-415spt_signal . . . . . . . . . . . . . . . . . . . . . 7-417spt_sigpending . . . . . . . . . . . . . . . . . . . . 7-419spt_sigsuspend . . . . . . . . . . . . . . . . . . . . 7-420spt_sigwait . . . . . . . . . . . . . . . . . . . . . 7-422spt_sleep . . . . . . . . . . . . . . . . . . . . . . 7-424spt_system . . . . . . . . . . . . . . . . . . . . . 7-425spt_TimerHandler_p . . . . . . . . . . . . . . . . . . 7-426SPT_TMF_GetTxHandle . . . . . . . . . . . . . . . . . 7-427SPT_TMF_Init . . . . . . . . . . . . . . . . . . . . 7-428SPT_TMF_RESUME . . . . . . . . . . . . . . . . . . 7-429SPT_TMF_SetAndValidateTxHandle . . . . . . . . . . . . . 7-430SPT_TMF_SetTxHandle . . . . . . . . . . . . . . . . . 7-431SPT_TMF_SUSPEND . . . . . . . . . . . . . . . . . . 7-432SPT_UNLOCKFILE . . . . . . . . . . . . . . . . . . 7-433SPT_UNLOCKREC . . . . . . . . . . . . . . . . . . 7-435spt_unregFile . . . . . . . . . . . . . . . . . . . . 7-438spt_unregOSSFileIOHandler . . . . . . . . . . . . . . . . 7-439spt_unregPathsendTagHandler . . . . . . . . . . . . . . . 7-440spt_usleep . . . . . . . . . . . . . . . . . . . . . 7-441spt_vfprintf . . . . . . . . . . . . . . . . . . . . . 7-442spt_vfprintfx . . . . . . . . . . . . . . . . . . . . . 7-443spt_vprintf . . . . . . . . . . . . . . . . . . . . . 7-446spt_vprintfx . . . . . . . . . . . . . . . . . . . . . 7-447spt_waitpid . . . . . . . . . . . . . . . . . . . . . 7-449spt_wakeup . . . . . . . . . . . . . . . . . . . . . 7-451spt_write . . . . . . . . . . . . . . . . . . . . . . 7-452SPT_WRITEREADX . . . . . . . . . . . . . . . . . . 7-453SPT_WRITEUPDATEUNLOCKX . . . . . . . . . . . . . . 7-456SPT_WRITEUPDATEX . . . . . . . . . . . . . . . . . 7-460spt_writev . . . . . . . . . . . . . . . . . . . . . 7-465spt_writevx . . . . . . . . . . . . . . . . . . . . . 7-466spt_writevz . . . . . . . . . . . . . . . . . . . . . 7-472SPT_WRITEX . . . . . . . . . . . . . . . . . . . . 7-478spt_writex . . . . . . . . . . . . . . . . . . . . . 7-483spt_writez . . . . . . . . . . . . . . . . . . . . . 7-488stat . . . . . . . . . . . . . . . . . . . . . . . 7-494stat64 . . . . . . . . . . . . . . . . . . . . . . . 7-505

    x Hewlett-Packard Company 527186-023

  • Contents

    statvfs . . . . . . . . . . . . . . . . . . . . . . 7-515statvfs64 . . . . . . . . . . . . . . . . . . . . . . 7-524symlink . . . . . . . . . . . . . . . . . . . . . . 7-533

    Section 8. System Functions (t) . . . . . . . . . . . . . . . . . . 8-1tdm_execve . . . . . . . . . . . . . . . . . . . . . 8-2tdm_execvep . . . . . . . . . . . . . . . . . . . . 8-17tdm_fork . . . . . . . . . . . . . . . . . . . . . . 8-32tdm_spawn . . . . . . . . . . . . . . . . . . . . . 8-43tdm_spawnp . . . . . . . . . . . . . . . . . . . . . 8-60

    Section 9. System Functions (u) . . . . . . . . . . . . . . . . . . 9-1ulimit . . . . . . . . . . . . . . . . . . . . . . . 9-2umask . . . . . . . . . . . . . . . . . . . . . . . 9-4uname . . . . . . . . . . . . . . . . . . . . . . 9-5unlink . . . . . . . . . . . . . . . . . . . . . . . 9-7utime . . . . . . . . . . . . . . . . . . . . . . . 9-11

    Section 10. System Functions (w) . . . . . . . . . . . . . . . . . . 10-1wait . . . . . . . . . . . . . . . . . . . . . . . 10-2waitpid . . . . . . . . . . . . . . . . . . . . . . 10-7write . . . . . . . . . . . . . . . . . . . . . . . 10-14write64_ . . . . . . . . . . . . . . . . . . . . . . 10-20writev . . . . . . . . . . . . . . . . . . . . . . . 10-25

    Section 11. Files . . . . . . . . . . . . . . . . . . . . . . . 11-1ar . . . . . . . . . . . . . . . . . . . . . . . . 11-2core . . . . . . . . . . . . . . . . . . . . . . . 11-3cpio . . . . . . . . . . . . . . . . . . . . . . . 11-4dir . . . . . . . . . . . . . . . . . . . . . . . . 11-7float . . . . . . . . . . . . . . . . . . . . . . . 11-8limits . . . . . . . . . . . . . . . . . . . . . . . 11-10math . . . . . . . . . . . . . . . . . . . . . . . 11-18named.conf . . . . . . . . . . . . . . . . . . . . . 11-21null . . . . . . . . . . . . . . . . . . . . . . . 11-29saveabend . . . . . . . . . . . . . . . . . . . . . 11-30signal . . . . . . . . . . . . . . . . . . . . . . . 11-31spthread.h . . . . . . . . . . . . . . . . . . . . . 11-39tar . . . . . . . . . . . . . . . . . . . . . . . . 11-48termcap . . . . . . . . . . . . . . . . . . . . . . 11-51termios . . . . . . . . . . . . . . . . . . . . . . 11-64tty . . . . . . . . . . . . . . . . . . . . . . . . 11-70

    Section 12. Miscellaneous . . . . . . . . . . . . . . . . . . . . 12-1acl . . . . . . . . . . . . . . . . . . . . . . . . 12-2ascii . . . . . . . . . . . . . . . . . . . . . . . 12-16environ . . . . . . . . . . . . . . . . . . . . . . 12-18errno . . . . . . . . . . . . . . . . . . . . . . . 12-35filename . . . . . . . . . . . . . . . . . . . . . . 12-44hier . . . . . . . . . . . . . . . . . . . . . . . 12-51login.defs . . . . . . . . . . . . . . . . . . . . . 12-53pathname . . . . . . . . . . . . . . . . . . . . . . 12-54process_extension_results . . . . . . . . . . . . . . . . . 12-55resolv.conf . . . . . . . . . . . . . . . . . . . . . 12-64users . . . . . . . . . . . . . . . . . . . . . . . 12-67

    Permuted Index . . . . . . . . . . . . . . . . . . . . . . . Pindex-1

    527186-023 Hewlett-Packard Company xi

  • OSS System Calls Reference Manual

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1

    xii Hewlett-Packard Company 527186-023

  • Contents

    LIST OF TABLES

    Table 3−1. Ignored File Status Flags . . . . . . . . . . . . . . . . . 3-13

    Table 5−1. Levels of Guardian File Security . . . . . . . . . . . . . . . 5-206

    Table 5−2. Allowed Guardian File Accesses . . . . . . . . . . . . . . . 5-207

    Table 7−1. Ignored File Status Flags (spt_fcntlx Function) . . . . . . . . . . . 7-160

    Table 7−2. Ignored File Status Flags . . . . . . . . . . . . . . . . . 7-167

    Table 7−3. Levels of Guardian File Security . . . . . . . . . . . . . . . 7-198

    Table 7−4. Allowed Guardian File Accesses . . . . . . . . . . . . . . . 7-198

    Table 11−1. cpio Archive File Header Format . . . . . . . . . . . . . . . 11-4

    Table 11−2. cpio Archive File Filename Entry Format . . . . . . . . . . . . 11-5

    Table 11−3. cpio Archive File Data Format . . . . . . . . . . . . . . . . 11-5

    Table 11−4. cpio.h Header File Macros . . . . . . . . . . . . . . . . . 11-6

    Table 11−5. Values for Floating-Point Constants . . . . . . . . . . . . . . 11-9

    Table 11−6. Values for Floating-Point Constants . . . . . . . . . . . . . . 11-16

    Table 11−7. Values for Symbolic Constants . . . . . . . . . . . . . . . . 11-17

    Table 11−8. Signals . . . . . . . . . . . . . . . . . . . . . . . 11-34

    Table 11−9. tar Archive File Header Block . . . . . . . . . . . . . . . . 11-48

    Table 11−10. Terminal Name Suffixes . . . . . . . . . . . . . . . . . . 11-51

    Table 11−11. Terminal Capabilities . . . . . . . . . . . . . . . . . . 11-52

    Table 12−1. ASCII Character Set Octal Values . . . . . . . . . . . . . . . 12-16

    Table 12−2. ASCII Character Set Hexadecimal Values . . . . . . . . . . . . 12-16

    Table 12−3. ASCII Character Set Decimal Values . . . . . . . . . . . . . . 12-17

    527186-023 Hewlett-Packard Company xiii

  • What Is New in This Manual

    This section describes changes made to the Open System Services System CallsReference Manual since the last edition (527186-022).

    Unless otherwise indicated in the text, discussions of native mode behavior, processes,and so forth apply to both the TNS/R code that runs on systems running G-series RVUsand to the TNS/E code that runs on systems running J-series RVUs or H-series RVUs.Discussions of TNS or accelerated code behavior in the OSS environment apply only tosystems running G-series RVUs; systems running J-series RVUs or H-series RVUs donot support TNS or accelerated code execution in the OSS environment.

    Unless otherwise indicated in the text, all text that applies to systems running H06.14and later H-series RVUs also applies to systems running J06.03 and later J-series RVUs.

    This manual contains information about some of the following G-series developmenttools. For servers running H-series RVUs, these tools are supported only in H06.05 andsubsequent H-series RVUs:

    • TNS/R native C compiler

    • TNS/R native C++ compiler

    • TNS/R native C++ runtime library version 2

    • SQL/MP for TNS/R native C

    • SQL/MP Compilation Agent for TNS/R programs

    • NMCOBOL compiler and nmcobol frontend

    • ld

    • nld

    • noft

    • TNS/R native pTAL

    If your server is running the H06.03 or H06.04 RVU, continue to use the HP EnterpriseToolkit.NonStop Edition or servers running G-series RVUs for development tasks thatrequire these tools. If your server is running J06.03 or later J-series RVUs, these tools aresupported.

    527186-023 Hewlett-Packard Company ix

  • OSS System Calls Reference Manual

    Changed Functions

    The following reference pages were changed to correct errors:

    • gettimeofday( )

    • put_awaitio( )

    • PUT_FILE_OPEN_( )

    The following reference pages were changed to support the increase in message queuelimits:

    • msgctl( )

    • msgget( )

    • msgrcv( )

    • msgsnd( )

    x Hewlett-Packard Company 527186-023

  • About This Manual

    The HP NonStop Open System Services (OSS) application program interface (API)provides an open interface for programs to be run with the underlying HP NonStopoperating system.

    The Open System Services System Calls Reference Manual contains reference pages forOSS system functions, files, and miscellaneous topics.

    The description of the OSS API is divided into system functions (documented in thismanual) and library functions (documented in the Open System Services Library CallsReference Manual). Functions appear in one manual or the other, based on the logicalsection number assigned to the reference page for the function. For an explanation of thelogical section numbers, see Reference Section Numbers later in this section.

    This division does not imply any restrictions on the use of the functions described ineither manual. The division exists for many reasons, including:

    • Consistency with the documentation of the Guardian API. The Guardian API forprocess management and low-level file-system access is documented separately fromother portions of the API available to users of a C run-time library.

    • Consistency with the separation of functions used in some UNIX systems. In thosesystems, an important distinction exists between the API for code that is to run inkernel space and the API for code that is to run in user space. This distinction ismeaningless for users of the OSS API. The NonStop operating system doesdistinguish among code that runs in user code space, code that runs in system codespace, and code that runs in library code space, but the distinction does not separatethe functions of the OSS API.

    Unless otherwise indicated in the text, discussions of native mode behavior, processes,and so forth apply to both the TNS/R code that runs on systems running G-series RVUsand to the TNS/E code that runs on systems running J-series RVUs or H-series RVUs.Discussions of TNS or accelerated code behavior in the OSS environment apply only tosystems running G-series RVUs; systems running J-series RVUs or H-series RVUs donot support TNS or accelerated code execution in the OSS environment.

    Unless otherwise indicated in the text, all text that applies to systems running H06.14and later H-series RVUs also applies to systems running J06.03 and later J-series RVUs.

    527186-023 Hewlett-Packard Company xi

  • OSS System Calls Reference Manual

    Audience

    This manual is for system and application programmers who want to use the OSS APIprovided with the NonStop operating system. The manual assumes that the reader is aprogrammer and is familiar with the C programming language.

    Purpose

    This manual provides a complete reference to all OSS system functions and their relatedfiles and miscellaneous topics.

    Document Usage

    This manual contains a portion of the online reference (man) pages. These referencepages are divided among 12 sections, as follows:

    • Sections 1 through 10 contain reference pages for OSS system functions. Thesereference pages reside in the cat2 or cat3 directory and are sorted alphabetically.

    • Section 11 contains reference pages for some OSS header and special files. Thesereference pages reside in the cat4 and cat7 directories and are sorted alphabetically.

    • Section 12 contains reference pages for some miscellaneous OSS topics. Thesereference pages reside in the cat5 directory and are sorted alphabetically.

    Reference Page Format

    The reference pages for functions, files, and miscellaneous topics in this manual use thefollowing format. If a heading has no contents for a particular reference page, it isomitted.

    NAME Function, file, or miscellaneous topic name and purpose.

    LIBRARY Library containing the function. The library is identified in terms of therun-time environment in which the compiled application must run. Forexample, an H-series native Guardian process must use the specifiedlibrary when the c89 -Wtarget=TNS/E and -Wsystype=guardian flagsare specified or used by default.

    xii Hewlett-Packard Company 527186-023

  • About This Manual

    SYNOPSIS Appropriate syntax, including header files to be included and allparameter types. Some header files are required for POSIX.1-compliantapplications but are optional for applications conforming to otherstandards. These header files are noted as "optional except for POSIX.1."

    PARAMETERS Descriptions of the parameters listed under the SYNOPSIS heading.

    DESCRIPTION For function topics, how the function works, including the conditionsor permissions required to use it successfully, the set of values for allparameters, and the effect of the function on the state of processes orfiles. For file topic reference pages, a description of file contents. Formiscellaneous topics, a general description.

    EXAMPLES Compilable C language program excerpts using the function calldescribed in the reference page.

    NOTES Any supplementary information that is peripheral to the actual operationof the function, file, or miscellaneous topic described.

    CAUTIONS Information on possible system damage or data corruption as a result ofusing the function, file, or miscellaneous topic in a specific way.

    RETURN VALUES Indication of successful or unsuccessful completion when thefunction is invoked.

    ERRORS Error conditions under which the function might fail, and the errnovalue associated with each condition.

    FILES Files related to the function, file, or miscellaneous topic, except for anyheader files listed under the SYNOPSIS heading.

    RELATED INFORMATION Cross-references to related functions, files, commands,and miscellaneous topics described in other OSS reference pages. Thisheading does not contain titles of standards, HP manuals, or commercialtexts.

    STANDARDS CONFORMANCE Summary of features that are fully described underprevious headings and are flagged as implementation-defined or HPextensions to the cited standard.

    The POSIX standards leave some features to the implementing vendor todefine. These features are flagged as implementation-defined. Featuresthat HP has included that are not in the cited standard are flagged as HPextensions to the appropriate cited standard.

    Related Documents

    For information about OSS library functions, commands and utilities, and guidelines forgeneral usage, see these manuals:

    • C/C++ Programmer’s Guide

    • Common Run-Time Environment (CRE) Programmer’s Guide

    527186-023 Hewlett-Packard Company xiii

  • OSS System Calls Reference Manual

    • eld Manual (TNS/E systems only)

    • enoft Manual (TNS/E systems only)

    • H-Series Application Migration Guide

    • Inspect Manual

    • ld Manual

    • Native Inspect Manual (TNS/E systems only)

    • rld Manual

    • nld Manual

    • noft Manual

    • Open System Services Library Calls Reference Manual

    • Open System Services Porting Guide

    • Open System Services Programmer’s Guide

    • Open System Services Shell and Utilities Reference Manual

    • Open System Services User’s Guide

    • Software Internationalization Guide

    • TCP/IP and TCP/IPv6 Programming Manual

    • TNS/R Native Application Migration Guide

    If you are working in or with the Guardian environment, see the Guardian ProcedureCalls Reference Manual and its related manuals.

    Reference Section Numbers

    The online documentation for Open System Services is divided into logical sections.Each logical section has a reference section number.

    Some topics in the reference pages have more than one reference page file; a referencesection number identifies a specific file. For example, chown has a reference page for thechown( ) function in section 2 and a reference page for the chown command in section 1.These topics are identified as chown(2) and chown(1), respectively.

    The reference section number can be used in the man command to select the correctreference page. For more information about the section parameter, see the mancommand reference page either online or in the Open System Services Shell and UtilitiesReference Manual.

    Reference section numbers are included under the RELATED INFORMATIONheading and in the heading at the top of every reference page. The following table showsthe correspondence between reference section numbers and OSS manuals.

    xiv Hewlett-Packard Company 527186-023

  • About This Manual

    Section Content Manual___________________________________________________________________

    (1) User commands OSS Shell and Utilities Reference Manual

    (2) System functions OSS System Calls Reference Manual

    (3) Library functions OSS Library Calls Reference Manual

    (4) File formats and OSS System Calls Reference ManualOSS Library Calls Reference ManualOSS Shell and Utilities Reference Manual

    data structures

    (5) Miscellaneous topics and OSS System Calls Reference ManualOSS Library Calls Reference ManualOSS Shell and Utilities Reference Manual

    environment variables

    (6) Games Not supplied by HP

    (7) Special files OSS System Calls Reference Manual

    (8) Administrator commands OSS Shell and Utilities Reference Manual

    Typographic and Keying Conventions

    This manual uses the following typographic conventions:

    Bold Bold words or characters represent system elements that you must useliterally, such as commands, flags, and pathnames.

    Italic Italic words or characters represent variable values that you must supply.

    Constant widthExamples and information that the system displays appear in theconstant width typeface.

    [ ] Brackets enclose optional items in format and syntax descriptions.

    | A vertical bar separates items in a list of choices.

    ... A horizontal ellipsis indicates that you can repeat the preceding item oneor more times. A vertical ellipsis indicates that you can repeat thepreceding line one or more times.

    In text margins, a vertical bar indicates a line changed since the last revision of thereference page.

    527186-023 Hewlett-Packard Company xv

  • Section 1. System Functions (a - d)

    This section contains reference pages for Open System Services (OSS) system functioncalls with names that begin with a through d. These reference pages reside in the cat2directory and are sorted alphabetically by U.S. English conventions in this section.

    527186-023 Hewlett-Packard Company 1−1

  • accept(2) OSS System Calls Reference Manual

    NAMEaccept - Accepts a new connection on a socket

    LIBRARYG-series native OSS processes: system libraryH-series and J-series OSS processes: implicit libraries32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:/G/system/zdllnnn/zputdll64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:/G/system/zdllnnn/yputdll

    SYNOPSIS#define _XOPEN_SOURCE_EXTENDED 1#include

    int accept(int socket,struct sockaddr *address,socklen_t *address_len);

    PARAMETERSsocket Specifies the file descriptor for a socket that was created with the socket( ) func-

    tion, has been bound to an address with the bind( ) function, and has issued asuccessful call to the listen( ) function.

    address Specifies either a null pointer or a pointer to the sockaddr structure where theaddress of the peer socket that requested the connection should be returned. Thelength and format of the address depend on the address family of the socket.

    For AF_INET sockets, a pointer to the address structure sockaddr_in must becast as a struct sockaddr. For AF_INET6 sockets, a pointer to the addressstructure sockaddr_in6 must be cast as a struct sockaddr. For AF_UNIX sock-ets, a pointer to the address structure sockaddr_un must be cast as a structsockaddr.

    address_len Points to a socklen_t data item, which, on input, specifies the length of thesockaddr structure pointed to by the address parameter, and, on output, specifiesthe length of the address returned.

    DESCRIPTIONThe accept( ) function extracts the first connection on the queue of pending connections, createsa new socket with the same socket type, protocol, and address family as the specified socket, andallocates a new file descriptor for that socket.

    In systems running AF_UNIX Release 2 software, the new socket will use the same mode (com-patibility or portability) as the specified socket.

    For more information about AF_UNIX Release 2, compatibility mode, and portability mode, seethe Open System Services Programmer’s Guide.

    When the accept( ) function is called using a value for the address parameter that is null, suc-cessful completion of the call returns a socket file descriptor without modifying the value pointedto by the address_len parameter. When the accept( ) function is called using a value for theaddress parameter that is not null, a successful call places the address of the peer socket in thesockaddr structure pointed to by the address parameter, and places the length of the peersocket’s address in the location pointed to by the address_len parameter.

    If the length of the socket address is greater than the length of the supplied sockaddr structure,the address is truncated when stored.

    1−2 Hewlett-Packard Company 527186-023

  • System Functions (a - d) accept(2)

    If the queue of pending connections is empty of connection requests and the socket’s filedescriptor is blocking (O_NONBLOCK is not set), the accept( ) function blocks until a connec-tion is present. If the socket’s file descriptor is marked nonblocking (O_NONBLOCK is set) andthe queue of pending connections is empty, the accept( ) function call fails and sets errno to[EWOULDBLOCK].

    NOTESThis function requires that the feature-test macro _XOPEN_SOURCE_EXTENDED be specifiedwhen you compile the module.

    When a connection is available, a call to the select( ) function indicates that the file descriptor forthe original socket is ready for reading.

    The accepted socket cannot itself accept more connections. The original socket remains openand can accept more connections.

    To use the accept( ) functionality in a threaded application that uses the Standard POSIX Threadslibrary, see spt_acceptx(2).

    To use this function in a threaded application that uses the POSIX User Thread Model library onsystems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-lowing tasks to make the function thread-aware in a multi-threaded application:

    • Compile the application using the _PUT_MODEL_ feature test macro or equivalentcompiler command option.

    • Link the application to the zputdll library (/G/system/zdllnnn/zputdll).

    On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can usethis function with 32-bit or 64-bit OSS applications.

    To use this function in a 32-bit threaded application that uses the POSIX User Thread Modellibrary on systems running H06.24 or later RVUs or J06.13 or later RVUs, perform the sametasks (described above) used to enable the function on systems running H06.21/J06.10 or laterRVUs.

    To use this function in a 64-bit threaded application that uses the POSIX User Thread Modellibrary on systems running H06.24 or later RVUs or J06.13 or later RVUs, you must perform allof the following tasks:

    • Compile the application using the _PUT_MODEL_ feature test macro or equivalentcompiler command option.

    • Compile the application using the -Wlp64 compiler command option.

    • Link the application to the yputdll library (/G/system/zdllnnn/yputdll).

    For detailed information about writing multi-threaded and 64-bit applications for the Open Sys-tem Services environment, see the Open System Services Programmer’s Guide.

    RETURN VALUESUpon successful completion, the accept( ) function returns the file descriptor of the acceptedsocket. If the accept( ) function call fails, the value -1 is returned and errno is set to indicate theerror.

    ERRORSIf any of the following conditions occurs, the accept( ) function sets errno to the correspondingvalue:

    527186-023 Hewlett-Packard Company 1−3

  • accept(2) OSS System Calls Reference Manual

    [EADDRINUSE]The address is already in use. This error is returned in the OSS environmentonly.

    [EBADF] The socket parameter is not a valid file descriptor.

    This error is also returned if the accept( ) function is thread-aware and the socketbecomes invalid (is closed by another thread).

    [ECONNABORTED]The connection was aborted.

    [ECONNRESET]One of the following conditions occurred:

    • The transport-provider process for this socket is no longer available.

    • The TCP/IP subsystem for this socket is no longer available.

    • The connection was forcibly closed by the peer socket.The socket can only be closed.

    [EFAULT] A user-supplied memory buffer cannot be accessed or written.

    [EINTR] The function call was interrupted by a signal that was caught before a valid con-nection arrived.

    This error is also returned if the accept( ) function is thread-aware and a signalreceived from the pthread_kill( ) function is not blocked, ignored, or handled.

    [EINVAL] The socket is not accepting connections.

    [EMFILE] No more file descriptors are available for this process.

    [ENFILE] One of these conditions exists:

    • The maximum number of file descriptors of this file type (socket, pipe,etc.) for this processor are already open.

    • The limit for open file descriptors of this file type has not been exceeded,but the maximum number of all file descriptors for this processor arealready open.

    [ENOBUFS] There was not enough buffer space available to complete the call. A retry at alater time might succeed.

    [ENOMEM] There was insufficient memory available to complete the operation.

    [ENOTSOCK] The socket parameter does not specify a socket.

    [EOPNOTSUPP]The socket type of the specified socket does not support accepting connections.

    [EWOULDBLOCK]The socket’s file descriptor is marked nonblocking (O_NONBLOCK is set) andno connections are present to be accepted.

    1−4 Hewlett-Packard Company 527186-023

  • System Functions (a - d) accept(2)

    RELATED INFORMATIONFunctions: bind(2), connect(2), fcntl(2), listen(2), socket(2), spt_acceptx(2).

    STANDARDS CONFORMANCEThe XPG4 specification allows certain behaviors to be implementer-defined. The following arechoices of the HP implementation:

    • The HP implementation does not return the errno values [EAGAIN], [ENOSR], or[EPROTO].

    The following are HP extensions to the XPG4 specification:

    • The errno value [ECONNRESET] can be returned when the transport-provider processis unavailable.

    The use of this function with the POSIX User Thread Model library conforms to the followingindustry standards:

    • IEEE Std 1003.1-2004, POSIX System Application Program Interface

    527186-023 Hewlett-Packard Company 1−5

  • access(2) OSS System Calls Reference Manual

    NAMEaccess - Determines the accessibility of a file

    LIBRARYG-series native OSS processes: system libraryH-series and J-series OSS processes: implicit libraries

    SYNOPSIS#include

    int access(const char *path,int access_mode);

    PARAMETERSpath Points to the file pathname. When the path parameter refers to a symbolic link,

    the access( ) function returns information about the file pointed to by the sym-bolic link.

    Permission to access all components of the path parameter is determined byusing a real user ID instead of an effective user ID, and by using a real group IDinstead of an effective group ID.

    access_mode Specifies the type of access. The bit pattern contained in the access_modeparameter is constructed by a logical OR of values from the following list:

    F_OK Checks to see whether the file exists.

    R_OK Checks read permission.

    W_OK Checks write permission.

    X_OK Checks execute (search) permission.

    DESCRIPTIONThe access( ) function checks the accessibility of a file specified by a pathname.

    Only access bits are checked. A directory can be indicated as writable by access( ), but anattempt to open it for writing could fail (although files can be created there).

    A process with appropriate privilege can override the file permissions of a file. For files in unres-tricted filesets, a process with the super ID has the appropriate privilege. However, for files inrestricted-access filesets, such special access privileges are restricted even for the super ID. Forinformation about restricted-access filesets, see the Open System Services Management andOperations Guide.

    Access Control Lists (ACLs)Read, write, and execute/search permissions are checked against the ACL for the file.

    To determine the permission granted to the real user ID (RUID) and real group ID (RGID) of theaccessing process, the access( ) function checks these things in the ACL, in order:

    1. If the RUID of the process is the same as the owner of the file, grant the permissionsspecified in the user:: entry. Otherwise, continue to the next check.

    2. If the RUID matches the UID specified in one of the additional user:uid: entries, grantthe permissions specified in that entry, bitwise-ANDed with the permissions specified inthe class entry. Otherwise, continue to the next check.

    3. If the RGID or a supplementary GID of the process matches the owning GID of the fileor one of the GIDs specified in any additional group:gid: entries, grant the permissions

    1−6 Hewlett-Packard Company 527186-023

  • System Functions (a - d) access(2)

    specified in the class entry bitwise-ANDed with the result of bitwise-ORing together allof the permissions in all matching group entries. Otherwise, continue to the next check.

    4. Otherwise, grant the permissions specified in the other entry.

    Files in the Guardian File SystemIf the specified pathname resolves to the /G directory itself, the calling process has read and exe-cute access but not write access. The permissions are "r-xr-xr-x".

    If the specified pathname resolves to a Guardian process name, the calling process has executeaccess but not read or write access. The permissions are "--x--x--x".

    If the specified pathname resolves to a Guardian disk volume or subvolume, then the calling pro-cess has read, write, and execute access. The permissions are "rwxrwxrwx".

    If the specified pathname resolves to a regular Guardian disk file, then Guardian standard secu-rity and Safeguard file-level protection govern access. Refer to the stat(2) reference page formore information.

    Use From the Guardian EnvironmentThe access( ) function is one of a set of functions that have the following effects when the first ofthem is called from the Guardian environment:

    • Two Guardian file system file numbers (not necessarily the next two available) are allo-cated for the root directory and the current working directory. These file numbers cannotbe closed by calling the Guardian FILE_CLOSE_ procedure.

    • The current working directory is assigned from the VOLUME attribute of the Guardianenvironment =_DEFAULTS DEFINE.

    • The use of static memory by the process increases slightly.

    These effects occur only when the first of the set of functions is called. The effects are not cumu-lative.

    NOTESOn systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can usethis function with 32-bit or 64-bit OSS applications.

    RETURN VALUESUpon successful completion, the access( ) function returns the value 0 (zero). Otherwise, thevalue -1 is returned and errno is set to indicate the error.

    ERRORSIf any of the following conditions occurs, the access( ) function sets errno to the correspondingvalue:

    [EACCES] The permission bits of the file mode do not permit the requested access, or searchpermission is denied on a component of the pathname prefix. The owner of a filehas permissions checked with respect to the "owner" read, write, and executemode bits; members of the file’s group other than the owner have permissionschecked with respect to the "group" mode bits; and all others have permissionschecked with respect to the "other" mode bits.

    [EFAULT] The path parameter points outside the process’s allocated address space.

    [EFSBAD] The program attempted an operation involving a fileset with a corrupted filesetcatalog.

    527186-023 Hewlett-Packard Company 1−7

  • access(2) OSS System Calls Reference Manual

    [EINTR] A signal was caught during execution of the function call.

    [EINVAL] The access_mode parameter contains an invalid bit pattern.

    [EIO] An I/O error occurred during a read from or a write to the fileset.

    [ELOOP] Too many symbolic links were encountered in translating the pathname.

    [ENAMETOOLONG]One of the following is too long:

    • The pathname pointed to by the path parameter

    • A component of the pathname pointed to by the path parameter

    • The intermediate result of pathname resolution when a symbolic link ispart of the path parameter

    The pathconf( ) function can be called to obtain the applicable limits.

    [ENOENT] One of the following conditions exists:

    • The specified pathname does not exist.

    • The specified pathname is an empty string.

    • The specified pathname cannot be mapped to a valid Guardian filename.

    • The path parameter specifies a file on a remote HP NonStop node butcommunication with the remote node has been lost.

    [ENOROOT] One of the following conditions exists:

    • The root fileset of the local node (fileset 0) is not in the STARTED state.

    • The current root fileset for the specified file is unavailable. The OSSname server for the fileset might have failed.

    • The specified file is on a remote HP NonStop node and communicationwith the remote name server has been lost.

    [ENOTDIR] A component of the pathname prefix is not a directory.

    [ENOTSUP] The path parameter specifies a Guardian file on an SMF logical volume and oneof the following conditions exists:

    • The local system is running an RVU prior to J06.15 or H06.26.

    • The path parameter specifies a file in /E and the remote system is run-ning an RVU prior to J06.15 or H06.26.

    [ENXIO] The fileset containing the current working directory or the root fileset is notmounted.

    [EOSSNOTRUNNING]The program attempted an operation on an object in the OSS environment whilea required system process was not running.

    [EPERM] The program attempted an operation on a SEEP-protected fileset. Valid forJ06.15 and later J-series RVUs, and H06.26 and later H-series RVUs.

    1−8 Hewlett-Packard Company 527186-023

  • System Functions (a - d) access(2)

    [EROFS] Write access is requested for a file on a read-only fileset.

    [ETXTBSY] Write access is requested for a pure procedure (shared text) file that is being exe-cuted.

    RELATED INFORMATIONCommands: getacl(1), setacl(1).

    Functions: acl(2), chmod(2), stat(2).

    Miscellaneous topics: acl(5).

    STANDARDS CONFORMANCEThe POSIX standards leave some features to the implementing vendor to define. The followingfeatures are affected in the HP implementation:

    • A process with appropriate privilege can override the file permissions of a file. For filesin unrestricted filesets, a process with the super ID has the appropriate privilege. How-ever, for files in restricted-access filesets, such special access privileges are restrictedeven for the super ID.

    • The error [EINVAL] can be detected.

    The following are HP extensions to the XPG4 Version 2 specification:

    • The errno values [EFAULT], [EFSBAD], [EINTR], [EIO], [ENOROOT], [ENOTSUP],[ENXIO], and [EOSSNOTRUNNING] can be returned.

    527186-023 Hewlett-Packard Company 1−9

  • acl(2) OSS System Calls Reference Manual

    NAMEacl - Sets access control list (ACL) information for a file

    LIBRARYG-series native Guardian processes: system libraryG-series native OSS processes: system libraryH-series and J-series native Guardian processes: implicit librariesH-series and J-series OSS processes: implicit libraries

    SYNOPSIS#include #include int acl(

    char *pathp, int cmd, int nentries,struct acl *aclbufp);

    PARAMETERSpathp Points to the pathname of the file.

    nentries Specifies the number of ACL entries pointed to by the aclbufp parameter.

    aclbufp Points to the first element of a structure of type acl. The acl structure is definedin the acl.h header file as:

    struct acl {int a_type; /* entry type */uid_t a_id; /* user or group ID */unsigned short a_perm; /* entry permissions */

    };

    The values of the a_type field are:

    USER_OBJ Permissions for the owner of the object

    USER Permissions for additional specified users

    GROUP_OBJ Permissions for members of the owning group of the object

    GROUP Permissions for members of additional specified groups

    CLASS_OBJ Maximum permissions granted to the file group class

    OTHER_OBJ Permissions for other users

    DEF_USER_OBJDefault permissions for the object owner

    DEF_USER Default permissions for additional specified users

    DEF_GROUP_OBJDefault permissions for members of the owning group of theobject

    DEF_GROUP Default permissions for members of additional specified groups

    DEF_CLASS_OBJDefault maximum permissions for the owning group, additionalspecified users, and additional specified groups.

    DEF_OTHER_OBJDefault permissions for other users

    1−10 Hewlett-Packard Company 527186-023

  • System Functions (a - d) acl(2)

    cmd Specifies the action to be taken by the acl( ) function. The cmd parameter can beone of these values:

    ACL_SET The acl( ) function stores the entries specified by the nentriesand aclbufp parameters in the ACL for the file. The new ACLreplaces any existing ACL for the file. This value for cmd canonly be executed by a process that has an effective user ID equalto the owner of the file or the super ID, or is a member of theSafeguard SECURITY-OSS-ADMINISTRATOR group. Alldirectories in the pathname must be searchable.

    ACL_GET The buffer aclbufp is filled with the ACL entries for the file.Discretionary read access to the file is not required, but all direc-tories in the pathname must be searchable.

    ACL_CNT The number of entries in the ACL for the file is returned. Dis-cretionary read access to the file is not required, but all direc-tories in the pathname must be searchable.

    DESCRIPTIONThe acl( ) function manipulates ACLs on file system objects in filesets that support OSS ACLs.A process on a system that does not support ACLs can use the chmod( ) function to remotelymodify the permissions in the base ACL entries of a file (see the chmod(2) reference page).ACLs are supported for OSS files only. For a detailed description of ACLs, see the acl(5) refer-ence page.

    A call to acl( ) specified with the ACL_SET command succeeds only if all of these conditionsare true:

    • The ACL contains exactly one entry each of type USER_OBJ, GROUP_OBJ,CLASS_OBJ, and OTHER_OBJ.

    • If pathp points to a directory, the ACL contains at most one entry each of typeDEF_USER_OBJ, DEF_GROUP_OBJ, DEF_CLASS_OBJ, andDEF_OTHER_OBJ.

    • Entries of type USER, GROUP, DEF_USER, or DEF_GROUP do not contain dupli-cate entries. A duplicate entry is one of the same type containing the same numeric ID.

    • If the ACL contains no entries of type USER and no entries of type GROUP, the entriesof type GROUP_OBJ and CLASS_OBJ have the same permissions.

    • If the ACL contains no entries of type DEF_USER and no entries of typeDEF_GROUP, and an entry of type DEF_GROUP_OBJ is specified, an entry of typeDEF_CLASS_OBJ is also specified and the two entries have the same permissions.

    Accessing Files in Restricted-Access FilesetsWhen accessing a file in a restricted-access fileset, the super ID (255,255 in the Guardianenvironment, 65535 in the OSS environment) is restricted by the same file permissions andowner privileges as any other user ID: It has no special privileges unless the executable filestarted by the super ID has the PRIVSETID file privilege. In this case, the process started by thesuper ID can switch to another ID and then access files in restricted-access filesets as that ID.

    Processes that are started by a member of the Safeguard SECURITY-OSS-ADMINISTRATOR(SOA) group have the appropriate privilege to use this function on any file in a restricted-accessfileset. However, Network File System (NFS) clients are not granted SOA group privileges, evenif these clients are accessing the system with a user ID that is a member of the SOA securitygroup.

    527186-023 Hewlett-Packard Company 1−11

  • acl(2) OSS System Calls Reference Manual

    For more information about restricted-access filesets and file privileges, see the Open System Ser-vices Management and Operations Guide.

    NOTESOn systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can usethis function with 32-bit applications or 64-bit OSS applications.

    RETURN VALUESUpon successful completion, the acl( ) function returns one of the following values, depending onthe value of the cmd parameter:

    • For successful ACL_CNT or ACL_GET commands, the acl( ) function returns thenumber of ACL entries.

    • For successful ACL_SET commands, the acl( ) function returns a 0 (zero).If the acl( ) function fails, the value -1 is returned and errno is set to indicate the error.

    ERRORSIf any of these conditions occurs, the acl( ) function sets errno to the corresponding value:

    [EACCES] The caller does not have access to a component of the pathname.

    [EINVAL] One of these conditions occurred:

    • The value of the cmd parameter is not ACL_GET, ACL_SET, orACL_CNT.

    • The value of the cmd parameter is ACL_SET, and the value of the nen-tries parameter is less than the number of mandatory ACL entries.

    • The value of the cmd parameter is ACL_SET, and the ACL specified inthe aclbufp parameter is not valid.

    [EIO] A disk I/O error occurred while attempting to store or retrieve the ACL

    [EPERM] One of the following conditions exist:

    • The value of the cmd parameter is ACL_SET, and the effective user IDof the caller does not match the owner of the file or the super ID, and theeffective user ID or one of its group affiliations does not qualify thecaller for membership in the Safeguard SECURITY-OSS-ADMINISTRATOR group.

    • The program attempted an operation on a SEEP-protected fileset. Validfor J06.15 and later J-series RVUs, and H06.26 and later H-series RVUs.

    [ENOENT] A component of the path does not exist.

    [ENOSPC] One of these conditions occurred:

    • The value of the cmd parameter is ACL_GET, and the value of the nen-tries parameter is less than the number of entries in the ACL for the file.

    • The value of the cmd parameter is ACL_SET, and there is not enoughdisk space to store the ACL.

    • The value of the cmd parameter is ACL_SET, and nentries is greaterthan the number of NACLENTRIES specfied in the acl.h header file.

    1−12 Hewlett-Packard Company 527186-023

  • System Functions (a - d) acl(2)

    [ENOSYS] This system does not support OSS ACLs.

    [ENOTDIR] Either of these conditions is true:

    • A component of the path specified by pathp is not a directory.

    • The value of the cmd parameter is ACL_SET, and an attempt was madeto set a default ACL on a file type other than a directory.

    [ENOTSUP] The file specified by pathp either resides in a fileset that does not support OSSACLs, or is a file type that does not support OSS ACLs (such as Guardian filesaccessed from the //G directory).

    [EROFS] The value of the cmd parameter is ACL_SET, and the file specified by pathpresides in a fileset that is mounted as read-only.

    [EFAULT] The aclbufp parameter points to an invalid address.

    RELATED INFORMATIONCommands: getacl(1), setacl(1).

    Functions: aclsort(3), creat(2), creat64(2), open(2), open64(2).

    Miscellaneous: acl(5).

    STANDARDS CONFORMANCEThis function is an HP extension to the XPG4 Version 2 specification.

    527186-023 Hewlett-Packard Company 1−13

  • bind(2) OSS System Calls Reference Manual

    NAMEbind - Binds a name to a socket

    LIBRARYG-series native OSS processes: system libraryH-series and J-series OSS processes: implicit libraries

    SYNOPSIS#define _XOPEN_SOURCE_EXTENDED 1#include

    int bind(int socket,const struct sockaddr *address,socklen_t address_len);

    PARAMETERSsocket Specifies the file descriptor of the socket to be bound.

    address Points to a sockaddr structure that contains the address to be bound to thesocket. The length and format of the address depend on the address family of thesocket.

    For AF_INET sockets, a pointer to the address structure sockaddr_in must becast as a struct sockaddr. For AF_INET6 sockets, a pointer to the addressstructure sockaddr_in6 must be cast as a struct sockaddr. For AF_UNIX sock-ets, a pointer to the address structure sockaddr_un must be cast as a structsockaddr.

    address_len Specifies the length of the sockaddr structure pointed to by the address parame-ter.

    DESCRIPTIONThe bind( ) function assigns a name, which consists of an address stored in a sockaddr structure,to an unnamed socket. Sockets created with the socket( ) function are initially unnamed; they areidentified only by their address family.

    An application program can retrieve the assigned socket name with the getsockname( ) function.

    Access Control Lists (ACLs)If the parent directory has an ACL that contains default ACL entries, bind( ) creates an ACL forthe socket that inherits the default ACL entries of the parent directory as actual ACL entries forthe socket. For more information about ACL inheritance, see the acl(5) reference page.

    Accessing Files in Restricted-Access FilesetsWhen accessing a file in a restricted-access fileset, the super ID (255,255 in the Guardianenvironment, 65535 in the OSS environment) is restricted by the same file permissions andowner privileges as any other user ID: It has no special privileges unless the executable filestarted by the super ID has the PRIVSETID file privilege. In this case, the process started by thesuper ID can switch to another ID and then access files in restricted-access filesets as that ID.

    In a restricted-access fileset, applications that have the PRIVSOARFOPEN privilege and arestarted by a member of the Safeguard SECURITY-OSS-ADMINISTRATOR (SOA) group havethe appropriate privilege to use this function on any file in the fileset. However, Network FileSystem (NFS) clients are not granted SOA group privileges, even if these clients are accessingthe system with a user ID that is a member of the SOA security group.

    For more information about restricted-access filesets and file privileges, see the Open System Ser-vices Management and Operations Guide.

    1−14 Hewlett-Packard Company 527186-023

  • System Functions (a - d) bind(2)

    NOTESThis function requires that the feature-test macro _XOPEN_SOURCE_EXTENDED be specifiedwhen you compile the module.

    On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can usethis function with 32-bit or 64-bit OSS applications.

    RETURN VALUESUpon successful completion, the bind( ) function returns the value 0 (zero). Otherwise, thebind( ) function returns -1 and sets errno to indicate the error.

    ERRORSIf any of the following conditions occurs, the bind( ) function sets errno to the correspondingvalue:

    [EACCES] One of the following conditions occurred:

    • The specified address is protected and the current user does not havepermission to bind to it.

    • The socket is an AF_UNIX socket and either a component of the pathprefix denies search permission, or the requested name requires writingin a directory with a mode that denies write permission.

    [EADDRINUSE]The specified address is already in use.

    [EADDRNOTAVAIL]The specified address is not available on this HP NonStop node.

    [EAFNOSUPPORT]The specified address is not a valid address for the address family of thespecified socket.

    [EBADF] The socket parameter is not a valid file descriptor.

    [ECONNRESET]One of the following conditions occurred:

    • The transport-provider process for this socket is no longer available.

    • The TCP/IP subsystem for this socket is no longer available.

    • The connection was forcibly closed by the peer socket.The socket can only be closed.

    [EDESTADDRREQ]The address parameter for an AF_UNIX socket is a null pointer.

    [EFAULT] A user-supplied memory buffer cannot be accessed.

    [EINVAL] One of the following conditions exists:

    • The socket is already bound to an address.

    • The socket has been shut down.

    • The size specified for the address_len parameter is not valid for anaddress in the address family that is used by this connection.

    527186-023 Hewlett-Packard Company 1−15

  • bind(2) OSS System Calls Reference Manual

    [EIO] An input or output error occurred for an AF_UNIX socket.

    [ELOOP] The socket is in the AF_UNIX domain and too many symbolic links wereencountered when translating the pathname specified in the sockaddr structure.

    [ENAMETOOLONG]The socket is in the AF_UNIX domain and one of the following conditionsexists:

    • The pathname in the sockaddr structure exceeds PATH_MAX charac-ters.

    • A component of the pathname in the sockaddr structure exceedsNAME_MAX characters.

    • The intermediate result of pathname resolution when a symbolic link ispart of the pathname in the sockaddr structure exceeds PATH_MAXcharacters.

    The pathconf( ) function can be called to obtain the applicable limits.

    [ENOENT] The socket is in the AF_UNIX domain and one of the following conditionsexists:

    • A component of the pathname specified in the sockaddr structure doesnot name an existing file.

    • The sockaddr structure specifies an empty string as a pathname.

    [ENOBUFS] There was not enough buffer space available to complete the call. A retry at alater time might succeed.

    [ENOMEM] Required memory resources were not available. A retry at a later time mightsucceed.

    [ENOTDIR] The socket is in the AF_UNIX domain and a component of the pathnamespecified in the sockaddr structure is not a directory.

    [ENOTSOCK] The socket parameter does not refer to a socket.

    [EOPNOTSUPP]The socket type of the specified socket does not support binding to an address.

    [EPERM] The program attempted an operation on a SEEP-protected fileset. Valid forJ06.15 and later J-series RVUs, and H06.26 and later H-series RVUs.

    [EROFS] The socket is in the AF_UNIX domain and the specified name would reside on aread-only fileset.

    RELATED INFORMATIONCommands: getacl(1), setacl(1).

    Functions: acl(2), connect(2), getsockname(2), listen(2), socket(2).

    Miscellaneous topics: acl(5).

    1−16 Hewlett-Packard Company 527186-023

  • System Functions (a - d) bind(2)

    STANDARDS CONFORMANCEThe XPG4 specification allows certain behaviors to be implementer-defined. The following arechoices of the HP implementation:

    • The HP implementation does not return the errno values [EISCONN], [EISDIR],[ENOSR], or [EPROTO].

    The following are HP extensions to the XPG4 specification:

    • The errno value [ECONNRESET] can be returned when the transport provider processis unavailable.

    527186-023 Hewlett-Packard Company 1−17

  • chdir(2) OSS System Calls Reference Manual

    NAMEchdir - Changes the current working directory

    LIBRARYG-series native Guardian processes: system libraryG-series native OSS processes: system libraryH-series and J-series native Guardian processes: implicit librariesH-series and J-series OSS processes: implicit libraries

    SYNOPSIS#include

    int chdir(const char *path);

    PARAMETERSpath Points to the pathname of the directory.

    DESCRIPTIONThe chdir( ) function changes the current working directory to the directory indicated by the pathparameter. If the path parameter refers to a symbolic link, the chdir( ) function sets the currentdirectory to the directory pointed to by the symbolic link.

    The current working directory is the starting point for searches for pathnames that do not beginwith a / (slash). For a directory to become the current working directory, the calling process musthave search (execute) access to the directory.

    Accessing Files in Restricted-Access FilesetsWhen accessing a file in a restricted-access fileset, the super ID (255,255 in the Guardianenvironment, 65535 in the OSS environment) is restricted by the same file permissions andowner privileges as any other user ID: It has no special privileges unless the executable filestarted by the super ID has the PRIVSETID file privilege. In this case, the process started by thesuper ID can switch to another ID and then access files in restricted-access filesets as that ID.

    Processes that are started by a member of the Safeguard SECURITY-OSS-ADMINISTRATOR(SOA) group have the appropriate privilege to use this function on any file in a restricted-accessfileset. However, Network File System (NFS) clients are not granted SOA group privileges, evenif these clients are accessing the system with a user ID that is a member of the SOA securitygroup.

    For more information about restricted-access filesets and file privileges, see the Open System Ser-vices Management and Operations Guide.

    Use on Guardian ObjectsGuardian process names are directories; however, they cannot be opened using chdir( ).Attempts to do so fail and set errno to the value [EPERM].

    A call to the chdir( ) function with a path parameter that points to a subprocess in the Guardianfile system fails when the process is not of subtype 30. Such a call sets errno to the value[ENOENT].

    A call to the chdir( ) function with a path parameter that points to an empty Guardian disk subvo-lume (for example, /G/vol/subvol) succeeds.

    A call to the chdir( ) function with a path parameter that points to a Guardian subvolume with areserved name (for example, /G/vol1/zyq00001) fails. Such a call sets errno to the value[EPERM].

    1−18 Hewlett-Packard Company 527186-023

  • System Functions (a - d) chdir(2)

    Use From the Guardian EnvironmentThe chdir( ) function is one of a set of functions that have the following effects when the first ofthem is called from the Guardian environment:

    • Two Guardian file system file numbers (not necessarily the next two available) are allo-cated for the root directory and the current working directory. These file numbers cannotbe closed by calling the Guardian FILE_CLOSE_ procedure.

    • The current working directory is assigned from the VOLUME attribute of the Guardianenvironment =_DEFAULTS DEFINE.

    • The use of static memory by the process increases slightly.

    These effects occur only when the first of the set of functions is called. The effects are not cumu-lative.

    NOTESA process running with an effective user ID or group affiliation that qualifies for membership inthe Safeguard SECURITY-OSS-ADMINISTRATOR group has read and search permissions forany OSS directory.

    On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can usethis function with 32-bit or 64-bit OSS applications.

    RETURN VALUESUpon successful completion, the chdir( ) function returns the value 0 (zero). Otherwise, thevalue -1 is returned, and errno is set to indicate the error.

    ERRORSIf any of these conditions occurs, the chdir( ) function sets errno to the corresponding value:

    [EACCES] The requested current working directory is not accessible because search permis-sion is denied for a component of the pathname.

    [EFAULT] The path parameter is an invalid address.

    [EFSBAD] The fileset catalog for one of the filesets involved in the operation is corrupt.

    [EIO] A physical input or output error occurred.

    [ELOOP] Too many symbolic links were encountered in translating the pathname.

    [ENAMETOOLONG]One of these is too long:

    • The pathname pointed to by the path parameter

    • A component of the pathname pointed to by the path parameter

    • The intermediate result of pathname resolution when a symbolic link ispart of the path parameter

    The pathconf( ) function can be called to obtain the applicable limits.

    [ENOENT] One of these conditions exists:

    • The named directory does not exist.

    • The specified pathname is an empty string.

    527186-023 Hewlett-Packard Company 1−19

  • chdir(2) OSS System Calls Reference Manual

    • The specified pathname cannot be mapped to a valid Guardian filename.

    • The specified pathname points to the name of a Guardian process that isnot of subtype 30.

    • The path parameter names a symbolic link, but the directory to which itrefers does not exist.

    • The path parameter specifies a file on a remote HP NonStop node, butcommunication with the remote node has been lost.

    [ENOROOT] One of these conditions exists:

    • The root fileset of the local node (fileset 0) is not in the STARTED state.

    • The current root fileset for the specified file is unavailable. The OSSname server for the fileset might have failed.

    • The specified file is on a remote HP NonStop node, and communicationwith the remote name server has been lost.

    [ENOTDIR] A component of the pathname is not a directory.

    [ENXIO] The fileset containing the client’s current working directory or root directory isnot mounted.

    [EOSSNOTRUNNING]The program attempted an operation on an object in the OSS environment whilea required system process was not running.

    [EPERM] One of the following conditions exist:

    • The program attempted an operation on a Guardian process or attemptedto access a Guardian ZYQ subvolume.

    • The program attempted an operation on a SEEP-protected fileset. Validfor J06.15 and later J-series RVUs, and H06.26 and later H-series RVUs.

    For all other error conditions, errno is set to the appropriate Guardian file-system error number.See the Guardian Procedure Errors and Messages Manual for more information about a specificGuardian file-system error.

    RELATED INFORMATIONCommands: cd(1).

    Functions: chroot(2).

    Miscellaneous topics: acl(5).

    STANDARDS CONFORMANCEThe following are HP extensions to the XPG4 Version 2 specification:

    • The errno values [EFAULT], [EFSBAD], [EIO], [ENOROOT], [ENXIO],[EOSSNOTRUNNING], and [EPERM] can be returned.

    1−20 Hewlett-Packard Company 527186-023

  • System Functions (a - d) chmod(2)

    NAMEchmod - Changes file-access permissions

    LIBRARYG-series native Guardian processes: system libraryG-series native OSS processes: system libraryH-series and J-series native Guardian processes: implicit librariesH-series and J-series OSS processes: implicit libraries

    SYNOPSIS#include /* optional except for POSIX.1 */#include

    int chmod(const char *path,mode_t mode);

    PARAMETERSpath Specifies the full pathname of the file. If the path parameter refers to a symbolic

    link, the chmod( ) function changes access permissions on the file specified bythe symbolic link.

    mode Specifies the bit pattern that determines the access permissions.

    DESCRIPTIONThe chmod( ) function sets the access permissions of the file specified by the path parameteraccording to the bit pattern specified by the mode parameter.

    To change the file access permissions of a file or directory, the effective user ID of the processmust match the super ID or the owner of the file, or its effective user ID or one of its groupaffiliations must qualify it for membership in the Safeguard SECURITY-OSS-ADMINISTRATOR group.

    If chmod( ) is invoked by a process whose effective user ID does not equal the super ID or fileowner, the set-user-ID and set-group-ID bits of the file mode (04000 and 02000, respectively) arecleared.

    If chmod( ) is invoked to set either or both of the set-user-ID and set-group-ID bits of the filemode (04000 and 02000 respectively), then any file privileges the file might have had arecleared.

    See also "Accessing Files in Restricted-Access Filesets."

    If the S_ISVTX bit is on for a directory, only processes with an effective user ID equal to theuser ID of the file’s owner or the directory’s owner, or a process with appropriate privileges, canremove files from the directory.

    A call to the chmod( ) function has no effect on the file descriptor for a file that is open at thetime of the call. However, new openers of the file will be authorized by using the new access per-missions that were specified in the call.

    The mode parameter is constructed by logically ORing one or more of these symbols, which aredefined in the sys/stat.h header file:

    S_ISUID Sets the process’s effective user ID to the user ID of the file’s owner on execu-tion.

    527186-023 Hewlett-Packard Company 1−21

  • chmod(2) OSS System Calls Reference Manual

    S_ISGID Sets the process’s effective group ID to the group ID of the file’s group on execu-tion.

    S_ISVTX For a directory, permits modification to the directory only if the effective user IDof the process matches that of the file being accessed.

    S_IRWXU Permits the file’s owner to read, write, and execute the file (or to search the direc-tory).

    S_IRUSR Permits the file’s owner to read the file.

    S_IWUSR Permits the file’s owner to write to the file.

    S_IXUSR Permits the file’s owner to execute the file (or to search the directory).

    S_IRWXG Permits the file’s group to read, write, and execute the file (or to search the direc-tory).

    S_IRGRP Permits the file’s group to read the file.

    S_IWGRP Permits the file’s group to write to the file.

    S_IXGRP Permits the file’s group to execute the file (or to search the directory).

    S_IRWXO Permits others to read, write, and execute the file (or to search the directory).

    S_IROTH Permits others to read the file.

    S_IWOTH Permits others to write to the file.

    S_IXOTH Permits others to execute the file (or to search the directory).

    S_TRUST Establishes that the file does not contain code for an uncooperative process orcode to examine or modify I/O buffers. This flag suppresses operating systemprotection of the buffers when the memory segment containing the buffers is notshared. This flag applies only to loadfiles for a