📄 posix-standard-support.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. -->
<!-- This material may be distributed only subject to the terms -->
<!-- and conditions set forth in the Open Publication License, v1.0 -->
<!-- or later (the latest version is presently available at -->
<!-- http://www.opencontent.org/openpub/). -->
<!-- Distribution of the work or derivative of the work in any -->
<!-- standard (paper) book form is prohibited unless prior -->
<!-- permission is obtained from the copyright holder. -->
<HTML
><HEAD
><TITLE
>POSIX Standard Support</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
REL="UP"
TITLE="eCos POSIX compatibility layer"
HREF="posix-compatibility.html"><LINK
REL="PREVIOUS"
TITLE="eCos POSIX compatibility layer"
HREF="posix-compatibility.html"><LINK
REL="NEXT"
TITLE="Process Environment [POSIX Section 4]"
HREF="posix-process-environment.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>eCos Reference Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="posix-compatibility.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="posix-process-environment.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="POSIX-STANDARD-SUPPORT">Chapter 31. POSIX Standard Support</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="posix-standard-support.html#POSIX-PROCESS-PRIMITIVES"
>Process Primitives [POSIX Section 3]</A
></DT
><DT
><A
HREF="posix-process-environment.html"
>Process Environment [POSIX Section 4]</A
></DT
><DT
><A
HREF="posix-files-and-directories.html"
>Files and Directories [POSIX Section 5]</A
></DT
><DT
><A
HREF="posix-input-and-output.html"
>Input and Output [POSIX Section 6]</A
></DT
><DT
><A
HREF="posix-device-and-class-specific-functions.html"
>Device and Class Specific Functions [POSIX Section 7]</A
></DT
><DT
><A
HREF="posix-c-language-services.html"
>C Language Services [POSIX Section 8]</A
></DT
><DT
><A
HREF="posix-system-databases.html"
>System Databases [POSIX Section 9]</A
></DT
><DT
><A
HREF="posix-data-interchange-format.html"
>Data Interchange Format [POSIX Section 10]</A
></DT
><DT
><A
HREF="posix-synchronization.html"
>Synchronization [POSIX Section 11]</A
></DT
><DT
><A
HREF="posix-memory-management.html"
>Memory Management [POSIX Section 12]</A
></DT
><DT
><A
HREF="posix-execution-scheduling.html"
>Execution Scheduling [POSIX Section 13]</A
></DT
><DT
><A
HREF="posix-clocks-and-timers.html"
>Clocks and Timers [POSIX Section 14]</A
></DT
><DT
><A
HREF="posix-message-passing.html"
>Message Passing [POSIX Section 15]</A
></DT
><DT
><A
HREF="posix-thread-management.html"
>Thread Management [POSIX Section 16]</A
></DT
><DT
><A
HREF="posix-thread-specific-data.html"
>Thread-Specific Data [POSIX Section 17]</A
></DT
><DT
><A
HREF="posix-thread-cancellation.html"
>Thread Cancellation [POSIX Section 18]</A
></DT
><DT
><A
HREF="posix-non-posix-functions.html"
>Non-POSIX Functions</A
></DT
></DL
></DIV
><P
> eCos contains support for the POSIX Specification (ISO/IEC
9945-1)[POSIX].
</P
><P
> POSIX support is divided between the POSIX and the FILEIO
packages. The POSIX package provides support for threads,
signals, synchronization, timers and message queues. The FILEIO
package provides support for file and device I/O. The two
packages may be used together or separately, depending on
configuration.
</P
><P
> This document takes a functional approach to the POSIX
library. Support for a function implies that the data types and
definitions necessary to support that function, and the objects
it manipulates, are also defined. Any exceptions to this are
noted, and unless otherwise noted, implemented functions behave
as specified in the POSIX standard.
</P
><P
> This document only covers the differences between the eCos
implementation and the standard; it does not provide complete
documentation. For full information, see the POSIX standard
[POSIX]. Online, the Open Group Single Unix
Specification [SUS2] provides complete documentation
of a superset of POSIX. If you have access to a Unix system with
POSIX compatibility, then the manual pages for this will be of
use. There are also a number of books available.
[Lewine] covers the process, signal, file and I/O
functions, while [Lewis1], [Lewis2],
[Nichols] and [Norton] cover Pthreads and
related topics (see Bibliography, xref). However, many of these
books are oriented toward using POSIX in non-embedded systems,
so care should be taken in applying them to programming under
eCos.
</P
><P
> The remainder of this chapter broadly follows the structure
of the POSIX Specification. References to the appropriate
section of the Standard are included.
</P
><P
> Omitted functions marked with “// TBA”
are potential candidates for later implementation.
</P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="POSIX-PROCESS-PRIMITIVES">Process Primitives [POSIX Section 3]</H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN12979">Functions Implemented</H2
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="SCREEN"
>int kill(pid_t pid, int sig);
int pthread_kill(pthread_t thread, int sig);
int sigaction(int sig, const struct sigaction *act,
struct sigaction *oact);
int sigqueue(pid_t pid, int sig, const union sigval value);
int sigprocmask(int how, const sigset_t *set,
sigset_t *oset);
int pthread_sigmask(int how, const sigset_t *set,
sigset_t *oset);
int sigpending(sigset_t *set);
int sigsuspend(const sigset_t *set);
int sigwait(const sigset_t *set, int *sig);
int sigwaitinfo(const sigset_t *set, siginfo_t *info);
int sigtimedwait(const sigset_t *set, siginfo_t *info,
const struct timespec *timeout);
int sigemptyset(sigset_t *set);
int sigfillset(sigset_t *set);
int sigaddset(sigset_t *set, int signo);
int sigdelset(sigset_t *set, int signo);
int sigismember(const sigset_t *set, int signo);
unsigned int alarm( unsigned int seconds );
int pause( void );
unsigned int sleep( unsigned int seconds );</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN12982">Functions Omitted</H2
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="SCREEN"
>pid_t fork(void);
int execl( const char *path, const char *arg, ... );
int execv( const char *path, char *const argv[] );
int execle( const char *path, const char *arg, ... );
int execve( const char *path, char *const argv[],
char *const envp[] );
int execlp( const char *path, const char *arg, ... );
int execvp( const char *path, char *const argv[] );
int pthread_atfork( void(*prepare)(void),
void (*parent)(void),
void (*child)() );
pid_t wait( int *stat_loc );
pid_t waitpid( pid_t pid, int *stat_loc,
int options );
void _exit( int status );</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN12985">Notes</H2
><P
></P
><UL
><LI
><P
> Signal handling may be enabled or disabled with the
CYGPKG_POSIX_SIGNALS option. Since signals are used
by other POSIX components, such as timers, disabling signals will
disable those components too.
</P
></LI
><LI
><P
> <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>kill()</I
></SPAN
> and
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>sigqueue()</I
></SPAN
> may only take a
<SPAN
CLASS="strong"
><B
CLASS="EMPHASIS"
>pid</B
></SPAN
> argument of zero,
which maps to the current process.
</P
></LI
><LI
><P
> The <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>SIGEV_THREAD</I
></SPAN
> notification type is
not currently implemented.
</P
></LI
><LI
><P
> Job Control and Memory Protection signals are
not supported.
</P
></LI
><LI
><P
> An extra implementation defined
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>si_code</I
></SPAN
> value,
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>SI_EXCEPT</I
></SPAN
>, is defined to
distinguish hardware generated exceptions from
others.
</P
></LI
><LI
><P
> Extra signals are defined:
_SIGTRAP_,_SIGIOT_,
_SIGEMT_, and _SIGSYS_. These are
largely to maintain compatibility with the signal numbers used by
GDB.
</P
></LI
><LI
><P
> Signal delivery may currently occur at unexpected places in some
API functions. Using <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>longjmp()</I
></SPAN
> to transfer
control out of a signal handler may result in the interrupted
function not being able to complete properly. This may result in
later function calls failing or deadlocking.
</P
></LI
></UL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="posix-compatibility.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ecos-ref.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="posix-process-environment.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>eCos POSIX compatibility layer</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="posix-compatibility.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Process Environment [POSIX Section 4]</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -