POSIX 选项与选项组详细信息

POSIX 选项组

POSIX_BARRIERS

使用 CONFIG_POSIX_BARRIERS 启用此选项组。

POSIX_BARRIERS

API

支持

pthread_barrier_destroy()

是

pthread_barrier_init()

yes

pthread_barrier_wait()

yes

pthread_barrierattr_destroy()

yes

pthread_barrierattr_init()

yes

POSIX_C_LANG_JUMP

POSIX_C_LANG_JUMP 选项组包含在 ISO C 标准中。

备注

使用 Newlib、Picolibc 或其他符合 ISO C 标准的 C 库时,POSIX_C_LANG_JUMP 选项组被视为受支持。

POSIX_C_LANG_JUMP

API

Supported

setjmp()

yes

longjmp()

yes

POSIX_C_LANG_MATH

POSIX_C_LANG_MATH 选项组包含在 ISO C 标准中。

备注

使用 Newlib、Picolibc 或其他符合 ISO C 标准的 C 库时,POSIX_C_LANG_MATH 选项组被视为受支持。

有关 POSIX_C_LANG_MATH 选项组的详细信息,请参阅 Subprofiling Considerations。

POSIX_C_LANG_SUPPORT

POSIX_C_LANG_SUPPORT 选项组包含通用 ISO C 库。

备注

使用 Newlib、Picolibc 或其他符合 ISO C 标准的 C 库时,整个 POSIX_C_LANG_SUPPORT 选项组被视为受支持。

有关 POSIX_C_LANG_SUPPORT 选项组的详细信息,请参阅 Subprofiling Considerations。

有关使用 C 编程语言开发 Zephyr 应用程序的更多信息,请参阅 详细信息。

POSIX_C_LANG_SUPPORT_R

使用 CONFIG_POSIX_C_LANG_SUPPORT_R 启用此选项组。

POSIX_C_LANG_SUPPORT_R

API

Supported

asctime_r()

yes

ctime_r()

yes

gmtime_r()

yes

localtime_r()

yes

rand_r()

yes

strerror_r()

yes

strtok_r()

yes

POSIX_C_LIB_EXT

使用 CONFIG_POSIX_C_LIB_EXT 启用此选项组。

POSIX_C_LIB_EXT

API

Supported

fnmatch()

yes

getopt()

yes

getsubopt()

optarg

yes

opterr

yes

optind

yes

optopt

yes

stpcpy()

stpncpy()

strcasecmp()

strdup()

strfmon()

strncasecmp()

yes

strndup()

strnlen()

yes

POSIX_CLOCK_SELECTION

使用 CONFIG_POSIX_CLOCK_SELECTION 启用此选项组。

POSIX_CLOCK_SELECTION

API

Supported

pthread_condattr_getclock()

yes

pthread_condattr_setclock()

yes

clock_nanosleep()

yes

POSIX_DEVICE_IO

使用 CONFIG_POSIX_DEVICE_IO 启用此选项组。

备注

使用 Newlib、Picolibc 或其他符合 ISO C 标准的 C 库时,POSIX_DEVICE_IO 选项组的 C89 组件被视为受支持。

POSIX_DEVICE_IO

API

Supported

FD_CLR()

yes

FD_ISSET()

yes

FD_SET()

yes

FD_ZERO()

yes

clearerr()

yes

close()

yes

fclose()

yes

fdopen()

yes

feof()

yes

ferror()

yes

fflush()

yes

fgetc()

yes

fgets()

yes

fileno()

yes

fopen()

yes

fprintf()

yes

fputc()

yes

fputs()

yes

fread()

yes

freopen()

yes

fscanf()

yes

fwrite()

yes

getc()

yes

getchar()

yes

gets()

yes

open()

yes

perror()

yes

poll()

yes

printf()

yes

pread()

yes

pselect()

yes

putc()

yes

putchar()

yes

puts()

yes

pwrite()

yes

read()

yes

scanf()

yes

select()

yes

setbuf()

yes

setvbuf()

yes

stderr

yes

stdin

yes

stdout

yes

ungetc()

yes

vfprintf()

yes

vfscanf()

yes

vprintf()

yes

vscanf()

yes

write()

yes

POSIX_FD_MGMT

使用 CONFIG_POSIX_FD_MGMT 启用此选项组。

POSIX_FD_MGMT

API

Supported

dup()

dup2()

fcntl()

fgetpos()

fseek()

fseeko()

fsetpos()

ftell()

ftello()

ftruncate()

yes

lseek()

rewind()

POSIX_FILE_LOCKING

POSIX_FILE_LOCKING

API

Supported

flockfile()

ftrylockfile()

funlockfile()

getc_unlocked()

getchar_unlocked()

putc_unlocked()

putchar_unlocked()

POSIX_FILE_SYSTEM

使用 CONFIG_POSIX_FILE_SYSTEM 启用此选项组。

POSIX_FILE_SYSTEM

API

Supported

access()

chdir()

closedir()

yes

creat()

fchdir()

fpathconf()

fstat()

yes

fstatvfs()

getcwd()

link()

mkdir()

yes

mkstemp()

opendir()

yes

pathconf()

readdir()

yes

remove()

yes

rename()

yes

rewinddir()

rmdir()

yes

stat()

yes

statvfs()

tmpfile()

tmpnam()

truncate()

unlink()

yes

utime()

POSIX_FILE_SYSTEM_R

使用 CONFIG_POSIX_FILE_SYSTEM_R 启用此选项。

POSIX_FILE_SYSTEM_R

API

Supported

readdir_r()

yes

POSIX_MAPPED_FILES

使用 CONFIG_POSIX_MAPPED_FILES 启用此选项组。

POSIX_MAPPED_FILES

API

Supported

mmap()

yes

msync()

yes

munmap()

yes

POSIX_MEMORY_PROTECTION

使用 CONFIG_POSIX_MEMORY_PROTECTION 启用此选项组。

POSIX_MEMORY_PROTECTION

API

Supported

mprotect()

是 †

POSIX_MULTI_PROCESS

使用 CONFIG_POSIX_MULTI_PROCESS 启用此选项组。

POSIX_MULTI_PROCESS

API

Supported

_Exit()

yes

_exit()

yes

assert()

yes

atexit()

†

clock()

execl()

†

execle()

†

execlp()

†

execv()

†

execve()

†

execvp()

†

exit()

yes

fork()

†

getpgrp()

†

getpgid()

†

getpid()

yes †

getppid()

†

getsid()

†

setsid()

†

sleep()

yes

times()

wait()

†

waitid()

†

waitpid()

†

POSIX_NETWORKING

sockatmark() 函数尚未支持,预计会失败,并将 errno 设置为 ENOSYS †。

使用 CONFIG_POSIX_NETWORKING 启用此选项组。

POSIX_NETWORKING

API

Supported

accept()

yes

bind()

yes

connect()

yes

endhostent()

yes

endnetent()

yes

endprotoent()

yes

endservent()

yes

freeaddrinfo()

yes

gai_strerror()

yes

getaddrinfo()

yes

gethostent()

yes

gethostname()

yes

getnameinfo()

yes

getnetbyaddr()

yes

getnetbyname()

yes

getnetent()

yes

getpeername()

yes

getprotobyname()

yes

getprotobynumber()

yes

getprotoent()

yes

getservbyname()

yes

getservbyport()

yes

getservent()

yes

getsockname()

yes

getsockopt()

yes

htonl()

yes

htons()

yes

if_freenameindex()

yes

if_indextoname()

yes

if_nameindex()

yes

if_nametoindex()

yes

inet_addr()

yes

inet_ntoa()

yes

inet_ntop()

yes

inet_pton()

yes

listen()

yes

ntohl()

yes

ntohs()

yes

recv()

yes

recvfrom()

yes

recvmsg()

yes

send()

yes

sendmsg()

yes

sendto()

yes

sethostent()

yes

setnetent()

yes

setprotoent()

yes

setservent()

yes

setsockopt()

yes

shutdown()

yes

socket()

yes

sockatmark()

yes †

socketpair()

yes

POSIX_PIPE

POSIX_PIPE

API

Supported

pipe()

POSIX_REALTIME_SIGNALS

使用 CONFIG_POSIX_REALTIME_SIGNALS 启用此选项组。

POSIX_REALTIME_SIGNALS

API

Supported

sigqueue()

sigtimedwait()

sigwaitinfo()

POSIX_RW_LOCKS

使用 CONFIG_POSIX_RW_LOCKS 启用此选项。

POSIX_RW_LOCKS

API

Supported

pthread_rwlock_destroy()

yes

pthread_rwlock_init()

yes

pthread_rwlock_rdlock()

yes

pthread_rwlock_tryrdlock()

yes

pthread_rwlock_trywrlock()

yes

pthread_rwlock_unlock()

yes

pthread_rwlock_wrlock()

yes

pthread_rwlockattr_destroy()

yes

pthread_rwlockattr_getpshared()

yes

pthread_rwlockattr_init()

yes

pthread_rwlockattr_setpshared()

yes

POSIX_SEMAPHORES

使用 CONFIG_POSIX_SEMAPHORES 启用此选项组。

POSIX_SEMAPHORES

API

Supported

sem_close()

yes

sem_destroy()

yes

sem_getvalue()

yes

sem_init()

yes

sem_open()

yes

sem_post()

yes

sem_trywait()

yes

sem_unlink()

yes

sem_wait()

yes

POSIX_SIGNAL_JUMP

POSIX_SIGNAL_JUMP

API

Supported

siglongjmp()

sigsetjmp()

POSIX_SIGNALS

使用 CONFIG_POSIX_SIGNALS 启用此选项组。

备注

由于 Zephyr 尚未支持进程,ISO C 函数 abort()、signal() 和 raise() 以及下面列出的其他 POSIX 函数可能会出现未定义行为。已实现 POSIX 函数 kill()、pause()、sigaction()、sigpending()、sigsuspend() 和 sigwait(),以确保符合规范的应用能够链接,但这些函数预计会失败,并将 errno 设置为 ENOSYS †。

POSIX_SIGNALS

API

Supported

abort()

yes †

alarm()

yes †

kill()

yes †

pause()

yes †

raise()

yes †

sigaction()

yes †

sigaddset()

yes

sigdelset()

yes

sigemptyset()

yes

sigfillset()

yes

sigismember()

yes

signal()

yes †

sigpending()

yes †

sigprocmask()

yes

sigsuspend()

yes †

sigwait()

yes †

strsignal()

yes

POSIX_SINGLE_PROCESS

POSIX_SINGLE_PROCESS 选项组包含用于单进程应用的服务。

使用 CONFIG_POSIX_SINGLE_PROCESS 启用此选项组。

POSIX_SINGLE_PROCESS

API

Supported

confstr()

yes

environ

yes

errno

yes

getenv()

yes

setenv()

yes

sysconf()

yes

uname()

yes

unsetenv()

yes

POSIX_SPIN_LOCKS

使用 CONFIG_POSIX_SPIN_LOCKS 启用此选项组。

POSIX_SPIN_LOCKS

API

Supported

pthread_spin_destroy()

yes

pthread_spin_init()

yes

pthread_spin_lock()

yes

pthread_spin_trylock()

yes

pthread_spin_unlock()

yes

POSIX_THREADS_BASE

此配置文件的基本假设是:系统由单个(隐式)进程和多个线程组成。因此,除与多进程相关的服务外,标准要求提供所有基本线程服务。

使用 CONFIG_POSIX_THREADS 启用此选项组。

POSIX_THREADS_BASE

API

Supported

pthread_atfork()

yes

pthread_attr_destroy()

yes

pthread_attr_getdetachstate()

yes

pthread_attr_getschedparam()

yes

pthread_attr_init()

yes

pthread_attr_setdetachstate()

yes

pthread_attr_setschedparam()

yes

pthread_barrier_destroy()

yes

pthread_barrier_init()

yes

pthread_barrier_wait()

yes

pthread_barrierattr_destroy()

yes

pthread_barrierattr_getpshared()

yes

pthread_barrierattr_init()

yes

pthread_barrierattr_setpshared()

yes

pthread_cancel()

yes

pthread_cleanup_pop()

yes

pthread_cleanup_push()

yes

pthread_cond_broadcast()

yes

pthread_cond_destroy()

yes

pthread_cond_init()

yes

pthread_cond_signal()

yes

pthread_cond_timedwait()

yes

pthread_cond_wait()

yes

pthread_condattr_destroy()

yes

pthread_condattr_init()

yes

pthread_create()

yes

pthread_detach()

yes

pthread_equal()

yes

pthread_exit()

yes

pthread_getspecific()

yes

pthread_join()

yes

pthread_key_create()

yes

pthread_key_delete()

yes

pthread_kill()

pthread_mutex_destroy()

yes

pthread_mutex_init()

yes

pthread_mutex_lock()

yes

pthread_mutex_trylock()

yes

pthread_mutex_unlock()

yes

pthread_mutexattr_destroy()

yes

pthread_mutexattr_init()

yes

pthread_once()

yes

pthread_self()

yes

pthread_setcancelstate()

yes

pthread_setcanceltype()

yes

pthread_setspecific()

yes

pthread_sigmask()

yes

pthread_testcancel()

yes

sched_yield()

yes

POSIX_THREADS_EXT

使用 CONFIG_POSIX_THREADS_EXT 启用此选项组。

POSIX_THREADS_EXT

API

Supported

pthread_attr_getguardsize()

yes

pthread_attr_setguardsize()

yes

pthread_mutexattr_gettype()

yes

pthread_mutexattr_settype()

yes

POSIX_TIMERS

使用 CONFIG_POSIX_TIMERS 启用此选项组。

POSIX_TIMERS

API

Supported

clock_getres()

yes

clock_gettime()

yes

clock_settime()

yes

nanosleep()

yes

timer_create()

yes

timer_delete()

yes

timer_gettime()

yes

timer_getoverrun()

yes

timer_settime()

yes

XSI_REALTIME

XSI_REALTIME 选项组表示已启用 _POSIX_FSYNC、_POSIX_MEMLOCK、_POSIX_MEMLOCK_RANGE、_POSIX_MESSAGE_PASSING、_POSIX_PRIORITY_SCHEDULING、_POSIX_SHARED_MEMORY_OBJECTS 以及 _POSIX_SYNCHRONIZED_IO 选项。

使用 CONFIG_XSI_REALTIME 启用此选项组。

启用此选项组后,_XOPEN_REALTIME 特性测试宏将被定义为 -1 以外的值。

XSI_SINGLE_PROCESS

使用 CONFIG_XSI_SINGLE_PROCESS 启用此选项组。

XSI_SINGLE_PROCESS

API

Supported

gethostid()

yes

gettimeofday()

yes

putenv()

yes

XSI_SYSTEM_LOGGING

使用 CONFIG_XSI_SYSTEM_LOGGING 启用此选项组。

XSI_SYSTEM_LOGGING

API

Supported

closelog()

yes

openlog()

yes

setlogmask()

yes

syslog()

yes

XSI_THREADS_EXT

XSI_THREADS_EXT 选项组是必需的,因为它提供了控制线程栈的函数。这对任何实时应用都很有用。

使用 CONFIG_XSI_THREADS_EXT 启用此选项组。

XSI_THREADS_EXT

API

Supported

pthread_attr_getstack()

yes

pthread_attr_setstack()

yes

pthread_getconcurrency()

yes

pthread_setconcurrency()

yes

POSIX 选项

_POSIX_ASYNCHRONOUS_IO

属于 _POSIX_ASYNCHRONOUS_IO 选项的函数在 Zephyr 中未实现,但提供这些函数是为了让符合规范的应用仍可链接。这些函数将会失败,并将 errno 设置为 ENOSYS †。

使用 CONFIG_POSIX_ASYNCHRONOUS_IO 启用此选项。

_POSIX_ASYNCHRONOUS_IO

API

Supported

aio_cancel()

yes †

aio_error()

yes †

aio_fsync()

yes †

aio_read()

yes †

aio_return()

yes †

aio_suspend()

yes †

aio_write()

yes †

lio_listio()

yes †

_POSIX_CPUTIME

使用 CONFIG_POSIX_CPUTIME 启用此选项。

_POSIX_CPUTIME

API

Supported

CLOCK_PROCESS_CPUTIME_ID

yes

_POSIX_FSYNC

使用 CONFIG_POSIX_FSYNC 启用此选项。

_POSIX_FSYNC

API

Supported

fsync()

yes

_POSIX_IPV6

支持互联网协议第 6 版。

更多信息请参阅 网络。

使用 CONFIG_POSIX_IPV6 启用此选项。

_POSIX_MEMLOCK

Zephyr 的 按需分页 API 尚不支持固定或取消固定所有虚拟内存区域。下面的函数预计会失败,并将 errno 设置为 ENOSYS †。

使用 CONFIG_POSIX_MEMLOCK 启用此选项。

_POSIX_MEMLOCK

API

Supported

mlockall()

yes

munlockall()

yes

_POSIX_MEMLOCK_RANGE

使用 CONFIG_POSIX_MEMLOCK_RANGE 启用此选项。

_POSIX_MEMLOCK_RANGE

API

Supported

mlock()

yes

munlock()

yes

_POSIX_MESSAGE_PASSING

使用 CONFIG_POSIX_MESSAGE_PASSING 启用此选项。

_POSIX_MESSAGE_PASSING

API

Supported

mq_close()

yes

mq_getattr()

yes

mq_notify()

yes

mq_open()

yes

mq_receive()

yes

mq_send()

yes

mq_setattr()

yes

mq_unlink()

yes

_POSIX_MONOTONIC_CLOCK

使用 CONFIG_POSIX_MONOTONIC_CLOCK 启用此选项。

_POSIX_MONOTONIC_CLOCK

API

Supported

CLOCK_MONOTONIC

yes

_POSIX_PRIORITY_SCHEDULING

由于 Zephyr 尚未支持进程,sched_rr_get_interval()、sched_setparam() 和 sched_setscheduler() 函数预计会失败,并将 errno 设置为 ENOSYS †。

使用 CONFIG_POSIX_PRIORITY_SCHEDULING 启用此选项。

_POSIX_PRIORITY_SCHEDULING

API

Supported

sched_get_priority_max()

yes

sched_get_priority_min()

yes

sched_getparam()

yes

sched_getscheduler()

yes

sched_rr_get_interval()

yes †

sched_setparam()

yes †

sched_setscheduler()

yes †

_POSIX_RAW_SOCKETS

支持原始套接字。

更多信息请参阅 CONFIG_NET_SOCKETS_PACKET。

使用 CONFIG_POSIX_RAW_SOCKETS 启用此选项。

_POSIX_SHARED_MEMORY_OBJECTS

使用 CONFIG_POSIX_SHARED_MEMORY_OBJECTS 启用此选项。

_POSIX_SHARED_MEMORY_OBJECTS

API

Supported

mmap()

yes

munmap()

yes

shm_open()

yes

shm_unlink()

yes

_POSIX_SYNCHRONIZED_IO

使用 CONFIG_POSIX_SYNCHRONIZED_IO 启用此选项。

_POSIX_SYNCHRONIZED_IO

API

Supported

fdatasync()

yes

fsync()

yes

msync()

yes

_POSIX_THREAD_ATTR_STACKADDR

使用 CONFIG_POSIX_THREAD_ATTR_STACKADDR 启用此选项。

_POSIX_THREAD_ATTR_STACKADDR

API

Supported

pthread_attr_getstackaddr()

yes

pthread_attr_setstackaddr()

yes

_POSIX_THREAD_ATTR_STACKSIZE

使用 CONFIG_POSIX_THREAD_ATTR_STACKSIZE 启用此选项。

_POSIX_THREAD_ATTR_STACKSIZE

API

Supported

pthread_attr_getstacksize()

yes

pthread_attr_setstacksize()

yes

_POSIX_THREAD_CPUTIME

使用 CONFIG_POSIX_THREAD_CPUTIME 启用此选项。

_POSIX_THREAD_CPUTIME

API

Supported

CLOCK_THREAD_CPUTIME_ID

yes

pthread_getcpuclockid()

yes

_POSIX_THREAD_PRIO_INHERIT

使用 CONFIG_POSIX_THREAD_PRIO_INHERIT 启用此选项。

_POSIX_THREAD_PRIO_INHERIT

API

Supported

pthread_mutexattr_getprotocol()

yes

pthread_mutexattr_setprotocol()

yes

_POSIX_THREAD_PRIO_PROTECT

使用 CONFIG_POSIX_THREAD_PRIO_PROTECT 启用此选项。

_POSIX_THREAD_PRIO_PROTECT

API

Supported

pthread_mutex_getprioceiling()

yes

pthread_mutex_setprioceiling()

yes

pthread_mutexattr_getprioceiling()

yes

pthread_mutexattr_getprotocol()

yes

pthread_mutexattr_setprioceiling()

yes

pthread_mutexattr_setprotocol()

yes

_POSIX_THREAD_PRIORITY_SCHEDULING

使用 CONFIG_POSIX_THREAD_PRIORITY_SCHEDULING 启用此选项。

_POSIX_THREAD_PRIORITY_SCHEDULING

API

Supported

pthread_attr_getinheritsched()

yes

pthread_attr_getschedpolicy()

yes

pthread_attr_getscope()

yes

pthread_attr_setinheritsched()

yes

pthread_attr_setschedpolicy()

yes

pthread_attr_setscope()

yes

pthread_getschedparam()

yes

pthread_setschedparam()

yes

pthread_setschedprio()

yes

_POSIX_THREAD_SAFE_FUNCTIONS

使用 CONFIG_POSIX_THREAD_SAFE_FUNCTIONS 启用此选项。

_POSIX_THREAD_SAFE_FUNCTIONS

API

Supported

asctime_r()

yes

ctime_r()

是(仅 UTC 时区)

flockfile()

ftrylockfile()

funlockfile()

getc_unlocked()

getchar_unlocked()

getgrgid_r()

yes †

getgrnam_r()

yes †

getpwnam_r()

yes †

getpwuid_r()

yes †

gmtime_r()

yes

localtime_r()

yes (UTC timezone only)

putc_unlocked()

putchar_unlocked()

rand_r()

yes

readdir_r()

yes

strerror_r()

yes

strtok_r()

yes

_POSIX_TIMEOUTS

使用 CONFIG_POSIX_TIMEOUTS 启用此选项。

_POSIX_TIMEOUTS

API

Supported

mq_timedreceive()

yes

mq_timedsend()

yes

pthread_mutex_timedlock()

yes

pthread_rwlock_timedrdlock()

yes

pthread_rwlock_timedwrlock()

yes

sem_timedwait()

yes

posix_trace_timedgetnext_event()

_XOPEN_STREAMS

除 ioctl() 外,_XOPEN_STREAMS 选项组中的函数在 Zephyr 中未实现,但提供这些函数是为了让符合规范的应用仍可链接。此选项组中未实现的函数将会失败,并将 errno 设置为 ENOSYS †。

使用 CONFIG_XSI_STREAMS 启用此选项。

_XOPEN_STREAMS

API

Supported

fattach()

yes †

fdetach()

yes †

getmsg()

yes †

getpmsg()

yes †

ioctl()

yes

isastream()

yes †

putmsg()

yes †

putpmsg()

yes †