POSIXOPTIONS - Linux手册页

时间:2019-08-20 18:02:00  来源:igfitidea点击:

Linux程序员手册 第7部分
更新日期: 2018-04-30

名称

posixoptions-POSIX标准的可选部分

说明

POSIX标准(以下信息来自POSIX.1-2001)描述了兼容系统的一组行为和接口。但是,许多接口是可选的,并且具有功能测试宏以在编译时测试接口的可用性,并且函数sysconf(3),fpathconf(3),pathconf(3),confstr(3)在运行时执行此操作。在shell脚本中,可以使用getconf(1)。有关更多详细信息,请参见sysconf(3)。

我们给出POSIX缩写的名称,选项的名称,用于查询选项的sysconf(3)参数的名称以及可能的简短说明。可以在POSIX标准本身中找到更精确的详细信息,如今可以在Web上自由访问其版本。

ADV - _POSIX_ADVISORY_INFO - _SC_ADVISORY_INFO

存在以下咨询功能:

posix_fadvise()
posix_fallocate()
posix_memalign()
posix_madvise()

AIO - _POSIX_ASYNCHRONOUS_IO - _SC_ASYNCHRONOUS_IO

标头存在。存在以下功能:

aio_cancel()
aio_error()
aio_fsync()
aio_read()
aio_return()
aio_suspend()
aio_write()
lio_listio()

BAR - _POSIX_BARRIERS - _SC_BARRIERS

此选项暗含_POSIX_THREADS和_POSIX_THREAD_SAFE_FUNCTIONS选项。存在以下功能:

pthread_barrier_destroy()
pthread_barrier_init()
pthread_barrier_wait()
pthread_barrierattr_destroy()
pthread_barrierattr_init()

--- - POSIX_CHOWN_RESTRICTED

如果此选项有效(因为它始终在POSIX.1-2001下),则只有root可以更改文件的所有者,非root用户只能将文件的组设置为它所属的组之一。这会影响以下功能

chown()
fchown()

CS - _POSIX_CLOCK_SELECTION - _SC_CLOCK_SELECTION

此选项暗含_POSIX_TIMERS选项。存在以下功能:

pthread_condattr_getclock()
pthread_condattr_setclock()
clock_nanosleep()

如果通过函数clock_settime()更改了CLOCK_REALTIME,则这会影响为绝对时间设置的所有计时器。

CPT - _POSIX_CPUTIME - _SC_CPUTIME

支持CLOCK_PROCESS_CPUTIME_ID时钟ID。对于每个进程,此时钟的初始值为0。此选项暗含_POSIX_TIMERS选项。函数clock_getcpuclockid()存在。

--- - _POSIX_FILE_LOCKING - _SC_FILE_LOCKING

此选项已被删除。不在最终XPG6中。

FSC - _POSIX_FSYNC - _SC_FSYNC

函数fsync()存在。

IP6 - _POSIX_IPV6 - _SC_IPV6

支持Internet协议版本6。

--- - _POSIX_JOB_CONTROL - _SC_JOB_CONTROL

如果此选项有效(始终在POSIX.1-2001下),那么系统将实现POSIX样式的作业控制,并且具有以下功能:

setpgid()
tcdrain()
tcflush()
tcgetpgrp()
tcsendbreak()
tcsetattr()
tcsetpgrp()

MF - _POSIX_MAPPED_FILES - _SC_MAPPED_FILES

支持共享内存。包含文件存在。存在以下功能:

mmap()
msync()
munmap()

ML - _POSIX_MEMLOCK - _SC_MEMLOCK

共享内存可以锁定到核心。存在以下功能:

mlockall()
munlockall()

MR/MLR - _POSIX_MEMLOCK_RANGE - _SC_MEMLOCK_RANGE

更准确地说,范围可以锁定到核心。存在以下功能:

mlock()
munlock()

MPR - _POSIX_MEMORY_PROTECTION - _SC_MEMORY_PROTECTION

函数mprotect()存在。

MSG - _POSIX_MESSAGE_PASSING - _SC_MESSAGE_PASSING

包含文件存在。存在以下功能:

mq_close()
mq_getattr()
mq_notify()
mq_open()
mq_receive()
mq_send()
mq_setattr()
mq_unlink()

MON - _POSIX_MONOTONIC_CLOCK - _SC_MONOTONIC_CLOCK

支持CLOCK_MONOTONIC。此选项暗含_POSIX_TIMERS选项。下列功能会受到影响:

aio_suspend()
clock_getres()
clock_gettime()
clock_settime()
timer_create()

--- - _POSIX_MULTI_PROCESS - _SC_MULTI_PROCESS

此选项已被删除。不在最终XPG6中。

--- - _POSIX_NO_TRUNC

如果此选项有效(因为它始终在POSIX.1-2001下),则长度大于NAME_MAX的路径名组件不会被截断,但会出错。此属性可能取决于组件的路径前缀。

PIO - _POSIX_PRIORITIZED_IO - _SC_PRIORITIZED_IO

此选项表示可以指定异步I / O的优先级。这会影响功能

aio_read()
aio_write()

PS - _POSIX_PRIORITY_SCHEDULING - _SC_PRIORITY_SCHEDULING

包含文件存在。存在以下功能:

sched_get_priority_max()
sched_get_priority_min()
sched_getparam()
sched_getscheduler()
sched_rr_get_interval()
sched_setparam()
sched_setscheduler()
sched_yield()

如果_POSIX_SPAWN也有效,则存在以下功能:

posix_spawnattr_getschedparam()
posix_spawnattr_getschedpolicy()
posix_spawnattr_setschedparam()
posix_spawnattr_setschedpolicy()

RS - _POSIX_RAW_SOCKETS

支持原始套接字。下列功能会受到影响:

getsockopt()
setsockopt()

--- - _POSIX_READER_WRITER_LOCKS - _SC_READER_WRITER_LOCKS

此选项暗含_POSIX_THREADS选项。相反,在POSIX.1-2001下,_POSIX_THREADS选项暗含该选项。

存在以下功能:

pthread_rwlock_destroy()
pthread_rwlock_init()
pthread_rwlock_rdlock()
pthread_rwlock_tryrdlock()
pthread_rwlock_trywrlock()
pthread_rwlock_unlock()
pthread_rwlock_wrlock()
pthread_rwlockattr_destroy()
pthread_rwlockattr_init()

RTS - _POSIX_REALTIME_SIGNALS - _SC_REALTIME_SIGNALS

支持实时信号。存在以下功能:

sigqueue()
sigtimedwait()
sigwaitinfo()

--- - _POSIX_REGEXP - _SC_REGEXP

如果此选项有效(始终在POSIX.1-2001下),则支持POSIX正则表达式,并且存在以下功能:

regcomp()
regerror()
regexec()
regfree()

--- - _POSIX_SAVED_IDS - _SC_SAVED_IDS

如果此选项有效(始终在POSIX.1-2001下),则进程将具有保存的设置用户ID和保存的设置组ID。下列功能会受到影响:

exec()
kill()
seteuid()
setegid()
setgid()
setuid()

SEM - _POSIX_SEMAPHORES - _SC_SEMAPHORES

包含文件存在。存在以下功能:

sem_close()
sem_destroy()
sem_getvalue()
sem_init()
sem_open()
sem_post()
sem_trywait()
sem_unlink()
sem_wait()

SHM - _POSIX_SHARED_MEMORY_OBJECTS - _SC_SHARED_MEMORY_OBJECTS

存在以下功能:

mmap()
munmap()
shm_open()
shm_unlink()

--- - _POSIX_SHELL - _SC_SHELL

如果此选项有效(始终在POSIX.1-2001下),则存在函数system()。

SPN - _POSIX_SPAWN - _SC_SPAWN

例如,由于没有MMU,因此很难或不可能使用fork()时,此选项描述了对流程创建的支持。

如果_POSIX_SPAWN有效,那么包含文件和以下功能将存在:

posix_spawn()
posix_spawn_file_actions_addclose()
posix_spawn_file_actions_adddup2()
posix_spawn_file_actions_addopen()
posix_spawn_file_actions_destroy()
posix_spawn_file_actions_init()
posix_spawnattr_destroy()
posix_spawnattr_getsigdefault()
posix_spawnattr_getflags()
posix_spawnattr_getpgroup()
posix_spawnattr_getsigmask()
posix_spawnattr_init()
posix_spawnattr_setsigdefault()
posix_spawnattr_setflags()
posix_spawnattr_setpgroup()
posix_spawnattr_setsigmask()
posix_spawnp()

如果_POSIX_PRIORITY_SCHEDULING也有效,则存在以下功能:

posix_spawnattr_getschedparam()
posix_spawnattr_getschedpolicy()
posix_spawnattr_setschedparam()
posix_spawnattr_setschedpolicy()

SPI - _POSIX_SPIN_LOCKS - _SC_SPIN_LOCKS

此选项暗含_POSIX_THREADS和_POSIX_THREAD_SAFE_FUNCTIONS选项。存在以下功能:

pthread_spin_destroy()
pthread_spin_init()
pthread_spin_lock()
pthread_spin_trylock()
pthread_spin_unlock()

SS - _POSIX_SPORADIC_SERVER - _SC_SPORADIC_SERVER

支持调度策略SCHED_SPORADIC。此选项暗含_POSIX_PRIORITY_SCHEDULING选项。下列功能会受到影响:

sched_setparam()
sched_setscheduler()

SIO - _POSIX_SYNCHRONIZED_IO - _SC_SYNCHRONIZED_IO

下列功能会受到影响:

open()
msync()
fsync()
fdatasync()

TSA - _POSIX_THREAD_ATTR_STACKADDR - _SC_THREAD_ATTR_STACKADDR

下列功能会受到影响:

pthread_attr_getstack()
pthread_attr_getstackaddr()
pthread_attr_setstack()
pthread_attr_setstackaddr()

TSS - _POSIX_THREAD_ATTR_STACKSIZE - _SC_THREAD_ATTR_STACKSIZE

下列功能会受到影响:

pthread_attr_getstack()
pthread_attr_getstacksize()
pthread_attr_setstack()
pthread_attr_setstacksize()

TCT - _POSIX_THREAD_CPUTIME - _SC_THREAD_CPUTIME

支持ClockID CLOCK_THREAD_CPUTIME_ID。此选项暗含_POSIX_TIMERS选项。下列功能会受到影响:

pthread_getcpuclockid()
clock_getres()
clock_gettime()
clock_settime()
timer_create()

TPI - _POSIX_THREAD_PRIO_INHERIT - _SC_THREAD_PRIO_INHERIT

下列功能会受到影响:

pthread_mutexattr_getprotocol()
pthread_mutexattr_setprotocol()

TPP - _POSIX_THREAD_PRIO_PROTECT - _SC_THREAD_PRIO_PROTECT

下列功能会受到影响:

pthread_mutex_getprioceiling()
pthread_mutex_setprioceiling()
pthread_mutexattr_getprioceiling()
pthread_mutexattr_getprotocol()
pthread_mutexattr_setprioceiling()
pthread_mutexattr_setprotocol()

TPS - _POSIX_THREAD_PRIORITY_SCHEDULING - _SC_THREAD_PRIORITY_SCHEDULING

如果此选项有效,则进程内的不同线程可以以不同的优先级和/或不同的调度程序运行。下列功能会受到影响:

pthread_attr_getinheritsched()
pthread_attr_getschedpolicy()
pthread_attr_getscope()
pthread_attr_setinheritsched()
pthread_attr_setschedpolicy()
pthread_attr_setscope()
pthread_getschedparam()
pthread_setschedparam()
pthread_setschedprio()

TSH - _POSIX_THREAD_PROCESS_SHARED - _SC_THREAD_PROCESS_SHARED

下列功能会受到影响:

pthread_barrierattr_getpshared()
pthread_barrierattr_setpshared()
pthread_condattr_getpshared()
pthread_condattr_setpshared()
pthread_mutexattr_getpshared()
pthread_mutexattr_setpshared()
pthread_rwlockattr_getpshared()
pthread_rwlockattr_setpshared()

TSF - _POSIX_THREAD_SAFE_FUNCTIONS - _SC_THREAD_SAFE_FUNCTIONS

下列功能会受到影响:

readdir_r()
getgrgid_r()
getgrnam_r()
getpwnam_r()
getpwuid_r()
flockfile()
ftrylockfile()
funlockfile()
getc_unlocked()
getchar_unlocked()
putc_unlocked()
putchar_unlocked()
rand_r()
strerror_r()
strtok_r()
asctime_r()
ctime_r()
gmtime_r()
localtime_r()

TSP - _POSIX_THREAD_SPORADIC_SERVER - _SC_THREAD_SPORADIC_SERVER

此选项暗含_POSIX_THREAD_PRIORITY_SCHEDULING选项。下列功能会受到影响:

sched_getparam()
sched_setparam()
sched_setscheduler()

THR - _POSIX_THREADS - _SC_THREADS

提供了对POSIX线程的基本支持。存在以下功能:

pthread_atfork()
pthread_attr_destroy()
pthread_attr_getdetachstate()
pthread_attr_getschedparam()
pthread_attr_init()
pthread_attr_setdetachstate()
pthread_attr_setschedparam()
pthread_cancel()
pthread_cleanup_push()
pthread_cleanup_pop()
pthread_cond_broadcast()
pthread_cond_destroy()
pthread_cond_init()
pthread_cond_signal()
pthread_cond_timedwait()
pthread_cond_wait()
pthread_condattr_destroy()
pthread_condattr_init()
pthread_create()
pthread_detach()
pthread_equal()
pthread_exit()
pthread_getspecific()
pthread_join()
pthread_key_create()
pthread_key_delete()
pthread_mutex_destroy()
pthread_mutex_init()
pthread_mutex_lock()
pthread_mutex_trylock()
pthread_mutex_unlock()
pthread_mutexattr_destroy()
pthread_mutexattr_init()
pthread_once()
pthread_rwlock_destroy()
pthread_rwlock_init()
pthread_rwlock_rdlock()
pthread_rwlock_tryrdlock()
pthread_rwlock_trywrlock()
pthread_rwlock_unlock()
pthread_rwlock_wrlock()
pthread_rwlockattr_destroy()
pthread_rwlockattr_init()
pthread_self()
pthread_setcancelstate()
pthread_setcanceltype()
pthread_setspecific()
pthread_testcancel()

TMO - _POSIX_TIMEOUTS - _SC_TIMEOUTS

存在以下功能:

mq_timedreceive()
mq_timedsend()
pthread_mutex_timedlock()
pthread_rwlock_timedrdlock()
pthread_rwlock_timedwrlock()
sem_timedwait()
posix_trace_timedgetnext_event()

TMR - _POSIX_TIMERS - _SC_TIMERS

存在以下功能:

clock_getres()
clock_gettime()
clock_settime()
nanosleep()
timer_create()
timer_delete()
timer_gettime()
timer_getoverrun()
timer_settime()

TRC - _POSIX_TRACE - _SC_TRACE

POSIX跟踪可用。存在以下功能:

posix_trace_attr_destroy()
posix_trace_attr_getclockres()
posix_trace_attr_getcreatetime()
posix_trace_attr_getgenversion()
posix_trace_attr_getmaxdatasize()
posix_trace_attr_getmaxsystemeventsize()
posix_trace_attr_getmaxusereventsize()
posix_trace_attr_getname()
posix_trace_attr_getstreamfullpolicy()
posix_trace_attr_getstreamsize()
posix_trace_attr_init()
posix_trace_attr_setmaxdatasize()
posix_trace_attr_setname()
posix_trace_attr_setstreamsize()
posix_trace_attr_setstreamfullpolicy()
posix_trace_clear()
posix_trace_create()
posix_trace_event()
posix_trace_eventid_equal()
posix_trace_eventid_get_name()
posix_trace_eventid_open()
posix_trace_eventtypelist_getnext_id()
posix_trace_eventtypelist_rewind()
posix_trace_flush()
posix_trace_get_attr()
posix_trace_get_status()
posix_trace_getnext_event()
posix_trace_shutdown()
posix_trace_start()
posix_trace_stop()
posix_trace_trygetnext_event()

TEF - _POSIX_TRACE_EVENT_FILTER - _SC_TRACE_EVENT_FILTER

此选项暗含_POSIX_TRACE选项。存在以下功能:

posix_trace_eventset_add()
posix_trace_eventset_del()
posix_trace_eventset_empty()
posix_trace_eventset_fill()
posix_trace_eventset_ismember()
posix_trace_get_filter()
posix_trace_set_filter()
posix_trace_trid_eventid_open()

TRI - _POSIX_TRACE_INHERIT - _SC_TRACE_INHERIT

支持跟踪过程的子级。此选项暗含_POSIX_TRACE选项。存在以下功能:

posix_trace_attr_getinherited()
posix_trace_attr_setinherited()

TRL - _POSIX_TRACE_LOG - _SC_TRACE_LOG

此选项暗含_POSIX_TRACE选项。存在以下功能:

posix_trace_attr_getlogfullpolicy()
posix_trace_attr_getlogsize()
posix_trace_attr_setlogfullpolicy()
posix_trace_attr_setlogsize()
posix_trace_close()
posix_trace_create_withlog()
posix_trace_open()
posix_trace_rewind()

TYM - _POSIX_TYPED_MEMORY_OBJECTS - _SC_TYPED_MEMORY_OBJECT

存在以下功能:

posix_mem_offset()
posix_typed_mem_get_info()
posix_typed_mem_open()

--- - _POSIX_VDISABLE

始终存在(可能为0)。设置一个可更改的特殊控制字符以指示其被禁用的值。

X/OPEN SYSTEM INTERFACE EXTENSIONS

XSI - _XOPEN_CRYPT - _SC_XOPEN_CRYPT

存在以下功能:

crypt()
encrypt()
setkey()

XSI - _XOPEN_REALTIME - _SC_XOPEN_REALTIME

此选项暗含以下选项:

_POSIX_ASYNCHRONOUS_IO==200112L
_POSIX_FSYNC
_POSIX_MAPPED_FILES
_POSIX_MEMLOCK==200112L
_POSIX_MEMLOCK_RANGE==200112L
_POSIX_MEMORY_PROTECTION
_POSIX_MESSAGE_PASSING==200112L
_POSIX_PRIORITIZED_IO
_POSIX_PRIORITY_SCHEDULING==200112L
_POSIX_REALTIME_SIGNALS==200112L
_POSIX_SEMAPHORES==200112L
_POSIX_SHARED_MEMORY_OBJECTS==200112L
_POSIX_SYNCHRONIZED_IO==200112L
_POSIX_TIMERS==200112L

ADV - --- - ---

Advanced Realtime选项组意味着以下选项都定义为200112L:

_POSIX_ADVISORY_INFO
_POSIX_CLOCK_SELECTION
(意味着_POSIX_TIMERS)
_POSIX_CPUTIME
(意味着_POSIX_TIMERS)
_POSIX_MONOTONIC_CLOCK
(意味着_POSIX_TIMERS)
_POSIX_SPAWN
_POSIX_SPORADIC_SERVER
(表示_POSIX_PRIORITY_SCHEDULING)
_POSIX_TIMEOUTS
_POSIX_TYPED_MEMORY_OBJECTS

XSI - _XOPEN_REALTIME_THREADS - _SC_XOPEN_REALTIME_THREADS

该选项意味着以下所有选项都定义为200112L:

_POSIX_THREAD_PRIO_INHERIT
_POSIX_THREAD_PRIO_PROTECT
_POSIX_THREAD_PRIORITY_SCHEDULING

ADVANCED REALTIME THREADS - --- - ---

该选项意味着以下所有选项都定义为200112L:

_POSIX_BARRIERS
(意味着_POSIX_THREADS,_POSIX_THREAD_SAFE_FUNCTIONS)
_POSIX_SPIN_LOCKS
(意味着_POSIX_THREADS,_POSIX_THREAD_SAFE_FUNCTIONS)
_POSIX_THREAD_CPUTIME
(意味着_POSIX_TIMERS)
_POSIX_THREAD_SPORADIC_SERVER
(表示_POSIX_THREAD_PRIORITY_SCHEDULING)

TRACING - --- - ---

该选项意味着以下所有选项都定义为200112L:

_POSIX_TRACE
_POSIX_TRACE_EVENT_FILTER
_POSIX_TRACE_LOG
_POSIX_TRACE_INHERIT

STREAMS - _XOPEN_STREAMS - _SC_XOPEN_STREAMS

存在以下功能:

fattach()
fdetach()
getmsg()
getpmsg()
ioctl()
isastream()
putmsg()
putpmsg()

XSI - _XOPEN_LEGACY - _SC_XOPEN_LEGACY

旧选项组中包含的功能以前是必需的,但在此版本中现在是可选的。存在以下功能:

bcmp()
bcopy()
bzero()
ecvt()
fcvt()
ftime()
gcvt()
getcwd()
index()
mktemp()
rindex()
utimes()
wcswcs()

XSI - _XOPEN_UNIX - _SC_XOPEN_UNIX

存在以下功能:

mmap()
munmap()
msync()

此选项暗含以下选项:

_POSIX_FSYNC
_POSIX_MAPPED_FILES
_POSIX_MEMORY_PROTECTION
_POSIX_THREAD_ATTR_STACKADDR
_POSIX_THREAD_ATTR_STACKSIZE
_POSIX_THREAD_PROCESS_SHARED
_POSIX_THREAD_SAFE_FUNCTIONS
_POSIX_THREADS

此选项可能意味着XSI选项组中的以下选项:

Encryption (_XOPEN_CRYPT)
Realtime (_XOPEN_REALTIME)
Advanced Realtime (ADB)
Realtime Threads (_XOPEN_REALTIME_THREADS)
Advanced Realtime Threads (ADVANCED REALTIME THREADS)
Tracing (TRACING)
XSI Streams (STREAMS)
Legacy (_XOPEN_LEGACY)

另外参见

sysconf(3),标准(7)

出版信息

这个页面是Linux手册页项目5.08版的一部分。有关项目的说明、有关报告错误的信息以及此页面的最新版本,请访问https://www.kernel.org/doc/man-pages/