📄 posix.sgml
字号:
<para>
The <emphasis role="strong">pshared</emphasis> argument to
<emphasis>sem_init()</emphasis> is not implemented,
its value is ignored.
</para>
</listitem>
<listitem>
<para>
Functions <emphasis>sem_open()</emphasis>,
<emphasis>sem_close()</emphasis> and
<emphasis>sem_unlink()</emphasis> are present but
always return an error (ENOSYS).
</para>
</listitem>
<listitem>
<para>
The exact priority inversion protocols supported may be
controlled with the
_POSIX_THREAD_PRIO_INHERIT and
_POSIX_THREAD_PRIO_PROTECT
configuration options.
</para>
</listitem>
<listitem>
<para>
{_POSIX_THREAD_PROCESS_SHARED} is
not defined, so the
<emphasis role="strong">process-shared</emphasis> mutex
and condition variable attributes are not supported, and
neither are the functions
<emphasis>pthread_mutexattr_getpshared()</emphasis>,
<emphasis>pthread_mutexattr_setpshared()</emphasis>,
<emphasis>pthread_condattr_getpshared()</emphasis> and
<emphasis>pthread_condattr_setpshared()</emphasis>.
</para>
</listitem>
<listitem>
<para>
Condition variables do not become bound to a particular
mutex when
<emphasis>pthread_cond_wait()</emphasis> is
called. Hence different threads may wait on a condition
variable with different mutexes. This is at variance with
the standard, which requires a condition variable to
become (dynamically) bound by the first waiter, and
unbound when the last finishes. However, this difference
is largely benign, and the cost of policing this feature
is non-trivial.
</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<!-- }}} -->
<!-- {{{ Memory Management -->
<sect1 id="posix-memory-management">
<title>Memory Management [POSIX Section 12]</title>
<!-- =================================================================== -->
<sect2>
<title>Functions Implemented</title>
<para>
<none>
</para>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Functions Omitted</title>
<screen>
int mlockall( int flags );
int munlockall( void );
int mlock( const void *addr, size_t len );
int munlock( const void *addr, size_t len );
void mmap( void *addr, size_t len, int prot, int flags,
int fd, off_t off );
int munmap( void *addr, size_t len );
int mprotect( const void *addr, size_t len, int prot );
int msync( void *addr, size_t len, int flags );
int shm_open( const char *name, int oflag, mode_t mode );
int shm_unlink( const char *name );
</screen>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Notes</title>
<para>
None of these functions are currently provided. Some may
be implemented in a restricted form in the future.
</para>
</sect2>
</sect1>
<!-- }}} -->
<!-- {{{ Execution Scheduling -->
<sect1 id="posix-execution-scheduling">
<title>Execution Scheduling [POSIX Section 13]</title>
<!-- =================================================================== -->
<sect2>
<title>Functions Implemented</title>
<screen>
int sched_yield(void);
int sched_get_priority_max(int policy);
int sched_get_priority_min(int policy);
int sched_rr_get_interval(pid_t pid, struct timespec *t);
int pthread_attr_setscope(pthread_attr_t *attr, int scope);
int pthread_attr_getscope(const pthread_attr_t *attr, int *scope);
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit);
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit);
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy);
int pthread_attr_setschedparam( pthread_attr_t *attr, const struct sched_param *param);
int pthread_attr_getschedparam( const pthread_attr_t *attr,
struct sched_param *param);
int pthread_setschedparam(pthread_t thread, int policy,
const struct sched_param *param);
int pthread_getschedparam(pthread_t thread, int *policy,
struct sched_param *param);
int pthread_mutexattr_setprotocol( pthread_mutexattr_t *attr,
int protocol);
int pthread_mutexattr_getprotocol( pthread_mutexattr_t *attr,
int *protocol);
int pthread_mutexattr_setprioceiling( pthread_mutexattr_t *attr,
int prioceiling);
int pthread_mutexattr_getprioceiling( pthread_mutexattr_t *attr,
int *prioceiling);
int pthread_mutex_setprioceiling( pthread_mutex_t *mutex,
int prioceiling,
int *old_ceiling);
int pthread_mutex_getprioceiling( pthread_mutex_t *mutex,
int *prioceiling);
</screen>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Functions Omitted</title>
<screen>
int sched_setparam(pid_t pid, const struct sched_param *param);
int sched_getparam(pid_t pid, struct sched_param *param);
int sched_setscheduler(pid_t pid, int policy,
const struct sched_param *param);
int sched_getscheduler(pid_t pid);
</screen>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Notes</title>
<itemizedlist>
<listitem>
<para>
The functions <emphasis>sched_setparam()</emphasis>,
<emphasis>sched_getparam()</emphasis>,
<emphasis>sched_setscheduler()</emphasis> and
<emphasis>sched_getscheduler()</emphasis> are present
but always return an error.
</para>
</listitem>
<listitem>
<para>
The scheduler policy <emphasis>SCHED_OTHER</emphasis> is
equivalent to <emphasis>SCHED_RR</emphasis>.
</para>
</listitem>
<listitem>
<para>
Only <emphasis>PTHREAD_SCOPE_SYSTEM</emphasis>
is supported as a
<emphasis role="strong">contentionscope</emphasis>
attribute.
</para>
</listitem>
<listitem>
<para>
The default thread scheduling attributes are:
<screen>
contentionscope PTHREAD_SCOPE_SYSTEM
inheritsched PTHREAD_INHERIT_SCHED
schedpolicy SCHED_OTHER
schedparam.sched 0
</screen>
</para>
</listitem>
<listitem>
<para>
Mutex priority inversion protection is controlled by a
number of kernel configuration options.
If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT
is defined then
{_POSIX_THREAD_PRIO_INHERIT}
will be defined and PTHREAD_PRIO_INHERIT may
be set as the protocol in a
<emphasis>pthread_mutexattr_t</emphasis>
object.
If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
is defined then
{_POSIX_THREAD_PRIO_PROTECT}
will be defined and PTHREAD_PRIO_PROTECT may
be set as the protocol in a
<emphasis>pthread_mutexattr_t</emphasis> object.
</para>
</listitem>
<listitem>
<para>
The default attribute values set by
<emphasis>pthread_mutexattr_init()</emphasis>
is to set the protocol attribute to
PTHREAD_PRIO_NONE and the prioceiling
attribute to zero.
</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<!-- }}} -->
<!-- {{{ Clocks and Timers -->
<sect1 id="posix-clocks-and-timers">
<title>Clocks and Timers [POSIX Section 14]</title>
<!-- =================================================================== -->
<sect2>
<title>Functions Implemented</title>
<screen>
int clock_settime( clockid_t clock_id,
const struct timespec *tp);
int clock_gettime( clockid_t clock_id, struct timespec *tp);
int clock_getres( clockid_t clock_id, struct timespec *tp);
int timer_create( clockid_t clock_id, struct sigevent *evp,
timer_t *timer_id);
int timer_delete( timer_t timer_id );
int timer_settime( timer_t timerid, int flags,
const struct itimerspec *value,
struct itimerspec *ovalue );
int timer_gettime( timer_t timerid, struct itimerspec *value );
int timer_getoverrun( timer_t timerid );
int nanosleep( const struct timespec *rqtp, struct timespec *rmtp);
</screen>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Functions Omitted</title>
<para>
<none>
</para>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Notes</title>
<itemizedlist>
<listitem>
<para>
Currently <emphasis>timer_getoverrun()</emphasis> only
reports timer notifications that are delayed in the timer
subsystem. If they are delayed in the signal subsystem, due to
signal masks for example, this is not counted as an overrun.
</para>
</listitem>
<listitem>
<para>
The option CYGPKG_POSIX_TIMERS allows the timer support to be
enabled or disabled, and causes _POSIX_TIMERS to be defined
appropriately. This will cause other parts of the POSIX system to
have limited functionality.
</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<!-- }}} -->
<!-- {{{ Message Passing -->
<sect1 id="posix-message-passing">
<title>Message Passing [POSIX Section 15]</title>
<!-- =================================================================== -->
<sect2>
<title>Functions Implemented</title>
<screen>
mqd_t mq_open( const char *name, int oflag, ... );
int mq_close( mqd_t mqdes );
int mq_unlink( const char *name );
int mq_send( mqd_t mqdes, const char *msg_ptr,
size_t msg_len, unsigned int msg_prio );
ssize_t mq_receive( mqd_t mqdes, char *msg_ptr,
size_t msg_len, unsigned int *msg_prio );
int mq_setattr( mqd_t mqdes, const struct mq_attr *mqstat,
struct mq_attr *omqstat );
int mq_getattr( mqd_t mqdes, struct mq_attr *mqstat );
int mq_notify( mqd_t mqdes, const struct sigevent *notification );
</screen>
<para>From POSIX 1003.1d draft: </para>
<screen>
int mq_send( mqd_t mqdes, const char *msg_ptr,
size_t msg_len, unsigned int msg_prio,
const struct timespec *abs_timeout );
ssize_t mq_receive( mqd_t mqdes, char *msg_ptr,
size_t msg_len, unsigned int *msg_prio,
const struct timespec *abs_timeout );
</screen>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Functions Omitted</title>
<para>
<none>
</para>
</sect2>
<!-- =================================================================== -->
<sect2>
<title>Notes</title>
<itemizedlist>
<listitem>
<para>
The presence of message queues is controlled by the
CYGPKG_POSIX_MQUEUES option. Setting this will
cause [_POSIX_MESSAGE_PASSING] to
be defined and the message queue API to be made available.
</para>
</listitem>
<listitem>
<para>
Message queues are not currently filesystem objects. They live in
their own name and descriptor spaces.
</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<!-- }}} -->
<!-- {{{ Thread Management -->
<sect1 id="posix-thread-management">
<title>Thread Management [POSIX Section 16]</title>
<!-- =================================================================== -->
<sect2>
<title>Functions Implemented</title>
<screen>
int pthread_attr_init(pthread_attr_t *attr);
int pthread_attr_destroy(pthread_attr_t *attr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -