forked from Imagelibrary/rtems
Compare commits
1 Commits
3.6.0
...
3.5.0-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deb08b9a12 |
56
INSTALL
56
INSTALL
@@ -1,56 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
NOTE: The string <release> should be replaced with
|
||||
the appropriate release number of RTEMS.
|
||||
|
||||
This file only discusses the installation of .tgz files.
|
||||
For more detailed information on the installation of RTEMS,
|
||||
refer to the Release Notes manual in the file
|
||||
/pub/rtems/releases/<release>/doc/c_or_ada/relnotes.tgz on
|
||||
lancelot.gcs.redstone.army.mil.
|
||||
|
||||
UNCOMPRESSING .tgz FILES
|
||||
===========================
|
||||
Many of the files found in this directory and its subdirectories
|
||||
are gzip'ed, tar archive files. These files have the ".tgz"
|
||||
extension. They were compressed with gzip version 1.2.4.
|
||||
|
||||
Use a command sequence similar to the following to uncompress each
|
||||
file:
|
||||
|
||||
gzcat FILE.tgz | tar xvof -
|
||||
|
||||
where FILE.tgz is the file to be installed. This procedure will
|
||||
extract the files in the archive into the current directory.
|
||||
All of the .tgz files associated with this release RTEMS will
|
||||
place their contents in a subdirectory rtems-<release> in the current
|
||||
directory.
|
||||
|
||||
If you are unsure of what is in an RTEMS archive file, then use
|
||||
the following command sequence to get a listing of the contents:
|
||||
|
||||
gzcat FILE.tgz | tar tvf -
|
||||
|
||||
NOTES:
|
||||
|
||||
(1) The "-o" option to tar is included on the tar command line
|
||||
so that the user extracting the tar archive will own the extracted
|
||||
files.
|
||||
|
||||
(2) gzcat is sometimes installed as zcat. Be warned that on many
|
||||
(most) UNIX machines, zcat is associated with compress (.Z files).
|
||||
|
||||
(3) If you do not have gzip 1.2.4, it is available from numerous sites
|
||||
including this one. Other sites include prep.ai.mit.edu and
|
||||
gatekeeper.dec.com.
|
||||
|
||||
(4) The GNU archive files included in this distribution are packaged
|
||||
exactly like they are on official GNU ftp sites. When extracting
|
||||
GNU archives, they will not extract under a rtems-<version>
|
||||
directory. They will extract themselves under a directory which
|
||||
is the name and version of the tool in question. For example,
|
||||
gcc-2.5.8.tgz will extract its contents into the subdirectory
|
||||
gcc-2.5.8.
|
||||
|
||||
118
LICENSE
118
LICENSE
@@ -1,118 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
LICENSE INFORMATION
|
||||
|
||||
For the purposes of this document the Real Time Executive for
|
||||
Missile Systems (RTEMS) is defined to include all source code,
|
||||
documentation, shell utilities developed by On-Line Applications
|
||||
Research Corporation (OAR) under contract of the U.S. Army
|
||||
Missile Command. OAR obtained the copyright for RTEMS and
|
||||
subsequently assigned ownership of said copyright to the
|
||||
U.S. Government. As part of this transfer, OAR waived all
|
||||
claims of ownership for RTEMS. Since OAR no longer makes claims
|
||||
of ownership of RTEMS, OAR in no event shall be held liable
|
||||
for damages including any general, special, incidental or
|
||||
consequential damages arising out of the use or inability
|
||||
to use the RTEMS software or documentation or of the support
|
||||
services provided (including but not limited to loss of data or
|
||||
data being rendered inaccurate or losses sustained by you or
|
||||
third parties or a failure of the program to operate with any
|
||||
other programs), even if advised of the possibility of such damages.
|
||||
|
||||
Simply stated any file containing the U.S. Government
|
||||
copyright notice or relocatables derived from one or more of
|
||||
these files are covered by this agreement.
|
||||
|
||||
RTEMS may be reproduced by or for the U.S. Government pursuant
|
||||
to the copyright license under the clause at DFARS 252.227-7013.
|
||||
The following notice must appear in all copies of RTEMS and its
|
||||
derivatives:
|
||||
|
||||
COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
On-Line Applications Research Corporation (OAR).
|
||||
All rights assigned to U.S. Government, 1994.
|
||||
|
||||
This material may be reproduced by or for the U.S. Government
|
||||
pursuant to the copyright license under the clause at DFARS
|
||||
252.227-7013. This notice must appear in all copies of this
|
||||
material and its derivatives.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code and documentation must retain the
|
||||
above copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
Redistributions in binary form must contain or make available the
|
||||
RTEMS source code.
|
||||
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
This product includes software developed for the U.S. Government
|
||||
by On-Line Applications Research Corp.
|
||||
|
||||
4. Neither the name of the author nor the U.S. Government may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
|
||||
RTEMS is provided "AS IS" without warranty of any kind, either
|
||||
expressed or implied, including, but not limited to, the implied
|
||||
warranties of merchantability, title and fitness for a
|
||||
particular purpose. The U.S. Government does not warrant that
|
||||
the RTEMS software or documentation will satisfy your requirements
|
||||
or that the software and documentation are without defect or error
|
||||
or that the operation of the software will be uninterrupted.
|
||||
|
||||
The U.S. Government shall in no event shall be held liable for
|
||||
damages including any general, special, incidental or consequential
|
||||
damages arising out of the use or inability to use the RTEMS software
|
||||
or documentation or of the support services provided (including
|
||||
but not limited to loss of data or data being rendered
|
||||
inaccurate or losses sustained by you or third parties or a
|
||||
failure of the program to operate with any other programs), even
|
||||
if the U.S. Government has been advised of the possibility of such damages.
|
||||
|
||||
The U.S. Government reserves the right to revise this material
|
||||
and to make changes from time to time in the content hereof without
|
||||
obligation to notify anyone or any organization of such revision
|
||||
or changes.
|
||||
|
||||
OAR remains the sole organization authorized by contract to
|
||||
distribute or provide support and training for the Real-Time
|
||||
Executive for Multiprocessor Systems (RTEMS).
|
||||
|
||||
In order to promote future research activities within the U.S.
|
||||
Government, we request that potential users of RTEMS notify us
|
||||
as to the systems that RTEMS is being utilized. This will allow
|
||||
us to publicize our Dual-Use / Reuse capabilities in support of
|
||||
the current administration's goals. This can be accomplished by
|
||||
calling the RTEMS phone numbers published in the documentation
|
||||
or by electronic mail to "rtems@redstone.army.mil". Your
|
||||
cooperation is greatly appreciated. Again, thank you for using
|
||||
RTEMS.
|
||||
|
||||
RTEMS
|
||||
U.S. ARMY Missile Command
|
||||
ATTN: AMSMI-RD-GC-S
|
||||
Redstone Arsenal, AL 35898-5254
|
||||
Voice: (205) 842-6906
|
||||
FAX: (205) 842-6917
|
||||
EMAIL: rtems@redstone.army.mil
|
||||
|
||||
|
||||
On-Line Applications Research Corporation.
|
||||
2227 Drake Avenue SW
|
||||
Suite 10-F
|
||||
Huntsville, AL 35805
|
||||
(205) 883-0131
|
||||
|
||||
|
||||
|
||||
|
||||
93
README
93
README
@@ -1,93 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Directory Overview
|
||||
==================
|
||||
|
||||
This is the top level of the RTEMS directory structure. The following
|
||||
is a description of the files and directories in this directory:
|
||||
|
||||
INSTALL
|
||||
Rudimentary installation instructions. For more detailed
|
||||
information please see the Release Notes. The Postscript
|
||||
version of this manual can be found in the file
|
||||
c_or_ada/doc/relnotes.tgz.
|
||||
|
||||
LICENSE
|
||||
Required legalese.
|
||||
|
||||
README
|
||||
This file.
|
||||
|
||||
c
|
||||
This directory contains the source code for the C
|
||||
implementation of RTEMS as well as the test suites, sample
|
||||
applications, Board Support Packages, Device Drivers, and
|
||||
support libraries.
|
||||
|
||||
doc
|
||||
This directory contains the PDL for the RTEMS executive.
|
||||
|
||||
Ada versus C
|
||||
============
|
||||
|
||||
There are two implementations of RTEMS in this source tree --
|
||||
in Ada and in C. These two implementations are functionally
|
||||
and structurally equivalent. The C implementation follows
|
||||
the packaging conventions and hiearchical nature of the Ada
|
||||
implementation. In addition, a style has been followed which
|
||||
allows one to easily find the corresponding Ada and C
|
||||
implementations.
|
||||
|
||||
File names in C and code placement was carefully designed to insure
|
||||
a close mapping to the Ada implementation. The following file name
|
||||
extensions are used:
|
||||
|
||||
.adb - Ada body
|
||||
.ads - Ada specification
|
||||
.adp - Ada body requiring preprocessing
|
||||
.inc - include file for .adp files
|
||||
|
||||
.c - C body (non-inlined routines)
|
||||
.inl - C body (inlined routines)
|
||||
.h - C specification
|
||||
|
||||
In the executive source, XYZ.c and XYZ.inl correspond directly to a
|
||||
single XYZ.adb or XYZ.adp file. A .h file corresponds directly to
|
||||
the .ads file. There are only a handful of .inc files in the
|
||||
Ada source and these are used to insure that the desired simple
|
||||
inline textual expansion is performed. This avoids scoping and
|
||||
calling convention side-effects in carefully constructed tests
|
||||
which usually test context switch behavior.
|
||||
|
||||
In addition, in Ada code and data name references are always fully
|
||||
qualified as PACKAGE.NAME. In C, this convention is followed
|
||||
by having the package name as part of the name itself and using a
|
||||
capital letter to indicate the presence of a "." level. So we have
|
||||
PACKAGE.NAME in Ada and _Package_Name in C. The leading "_" in C
|
||||
is used to avoid naming conflicts between RTEMS and user variables.
|
||||
By using these conventions, one can easily compare the C and Ada
|
||||
implementations.
|
||||
|
||||
The most noticeable difference between the C and Ada83 code is
|
||||
the inability to easily obtain a "typed pointer" in Ada83.
|
||||
Using the "&" operator in C yields a pointer with a specific type.
|
||||
The 'Address attribute is the closest feature in Ada83. This
|
||||
returns a System.Address and this must be coerced via Unchecked_Conversion
|
||||
into an access type of the desired type. It is easy to view
|
||||
System.Address as similar to a "void *" in C, but this is not the case.
|
||||
A "void *" can be assigned to any other pointer type without an
|
||||
explicit conversion.
|
||||
|
||||
The solution adopted to this problem was to provide two routines for
|
||||
each access type in the Ada implementation -- one to convert from
|
||||
System.Address to the access type and another to go the opposite
|
||||
direction. This results in code which accomplishes the same thing
|
||||
as the corresponding C but it is easier to get lost in the clutter
|
||||
of the apparent subprogram invocations than the "less bulky"
|
||||
C equivalent.
|
||||
|
||||
A related difference is the types which are only in Ada which are used
|
||||
for pointers to arrays. These types do not exist and are not needed
|
||||
in the C implementation.
|
||||
18
SUPPORT
18
SUPPORT
@@ -1,18 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
For support and training contact:
|
||||
|
||||
On-Line Applications Research
|
||||
2227 Drake Avenue SW Suite 10-F
|
||||
Huntsville AL 35805
|
||||
(205) 883-0131
|
||||
|
||||
OAR offers support and classes for RTEMS as well as custom
|
||||
development services such as ports to new processors and
|
||||
the development of custom board support packages and device
|
||||
drivers.
|
||||
|
||||
OAR developed RTEMS under contract to the U.S. Army Missile Command.
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
RTEMS was developed by On-Line Applications Research (OAR) under
|
||||
contract to the U.S. Army Missile Command. Other than the
|
||||
contributions listed in this document, all code and documentation
|
||||
was developed by OAR for the Army.
|
||||
|
||||
The RTEMS project would like to thank those who have made
|
||||
contributions to the project. Together we make RTEMS a
|
||||
much better product.
|
||||
|
||||
The following persons/organizations have made contributions:
|
||||
|
||||
+ Dr. Mikhail (Misha) Savitski (mms@eiscathq.irf.se) of the EISCAT Scientific
|
||||
Association submitted the BSP and other miscellaneous support for the
|
||||
Motorola MVME162 (M68040LC CPU) VMEbus single board computer.
|
||||
|
||||
+ Division Inc. of Chapel Hill, NC for sponsoring On-Line Applications
|
||||
Research to port RTEMS to the Hewlett-Packard PA-RISC architecture (V1.1)
|
||||
and the addition of HP-UX as a development host. Tony Bennett
|
||||
(tbennett@divnc.com) was assisted in this effort by Joel Sherrill
|
||||
(joel@OARcorp.com). Tony also deserves a big pat on the back for
|
||||
contributing significantly to the overall organization of the development
|
||||
environment and directory structure. RTEMS is much easier to build
|
||||
because of Tony.
|
||||
|
||||
+ Greg Allen of Division Inc. of Chapel Hill, NC for
|
||||
porting RTEMS to HP-UX. This port treats a UNIX computer as simply
|
||||
another RTEMS target processor. This port can be used to develop
|
||||
and test code which will ultimately run on the embedded platform.
|
||||
|
||||
+ Doug McBride (mcbride@rodin.colorado.edu) of the Colorado Space Grant
|
||||
College at the University of Colorado at Boulder submitted the BSP
|
||||
for the Motorola IDP board (M68EC040 CPU) single board computer. The
|
||||
BSP leverages heavily off of the existing RTEMS BSP framework, the
|
||||
examples in the back of the IDP user's manual, and the libgloss example
|
||||
support for the IDP board from the newlib/libgloss distribution.
|
||||
|
||||
+ David Glessner (dwg@glenqcy.glenayre.com) of Glenayre Electronics
|
||||
submitted the support for the Motorola MC68302 CPU. This included
|
||||
the "gen68302" BSP which uses the on-chip peripherals on the MC68302
|
||||
as well as the modifications to the m68k dependent executive code to
|
||||
support m68k family members based on the mc68000 core.
|
||||
|
||||
+ Bryce Cogswell (cogswell@cs.uoregon.edu) submitted the support for MS-DOS
|
||||
as a development environment as well as djgpp/go32 as a target environment.
|
||||
|
||||
+ Andy Bray (andy@i-cubed.demon.co.uk) of I-CUBED Ltd. in Cambridge U.K.
|
||||
for porting RTEMS to the PowerPC. This effort included support for the
|
||||
IBM 403 as well as the Motorola 601, 603, and 604 variants. A special
|
||||
thanks to Dom Latter (dom@i-cubed.demon.co.uk) for being an RTEMS
|
||||
evangelist and promoting the use of RTEMS both at I-CUBED Ltd. as well
|
||||
as within the Internet community as a whole.
|
||||
|
||||
+ John S. Gwynne (jsg@coulomb.eng.ohio-state.edu) of Ohio State University
|
||||
submitted the support for the Motorola MC68332 CPU as well as completing
|
||||
the support for CPUs based on the MC68000 core. This included the "efi68k"
|
||||
and "efi332" BSPs as well as completing the modifications to the m68k
|
||||
dependent executive code to support m68k family members based on the
|
||||
MC68000 core. "efi68k" and "efi332" are single board computers designed
|
||||
primarily for automotive electronic fuel injection (EFI) control, but can
|
||||
be considered general purpose controllers when used without the EFI
|
||||
companion board(s). See the README in each BSP for more information.
|
||||
|
||||
+ The European Space Agency for sponsoring On-Line Applications Research
|
||||
to port RTEMS to the SPARC V7 architecture for use with their ERC32
|
||||
radiation-hardened CPU. Jiri Gaisler (jgais@wd.estec.esa.nl) deserves
|
||||
special thanks for championing this port within the ESA was well as
|
||||
for developing and supporting the SPARC Instruction Simulator used to
|
||||
develop and test this port.
|
||||
|
||||
+ Eric Norum (eric@skatter.usask.ca) of the Saskatchewan Accelerator
|
||||
Laboratory submitted the support for the Motorola MC68360 CPU
|
||||
including the `gen68360' BSP.
|
||||
|
||||
+ Dominique le Campion (Dominique.LECAMPION@enst-bretagne.fr), for
|
||||
Telecom Bretagne and T.N.I. (Brest, France) submitted the BSP for
|
||||
the Motorola MVME147 board (68030 CPU + 68881 FPU) and the MVME147s
|
||||
variant of this board.
|
||||
|
||||
+ Craig Lebakken (lebakken@minn.net) and Derrick Ostertag
|
||||
(ostertag@transition.com) of Transition Networks of Eden Prairie, MN
|
||||
for porting RTEMS to the MIPS and AMD 29K architectures. This submission
|
||||
includes complete support for the R4650 as well as partial support
|
||||
for the R4600.
|
||||
|
||||
Finally, the RTEMS project would like to thank those who have contributed
|
||||
to the other free software efforts which RTEMS utilizes. The primary RTEMS
|
||||
development environment is from the Free Software Foundation (the GNU
|
||||
project). The "newlib" C library was put together by Cygnus and is
|
||||
a collaboration of the efforts of numerous individuals and organizations.
|
||||
|
||||
We would like to see your name here. BSPs and ports are always welcome.
|
||||
Useful libraries which support RTEMS applications are also an important
|
||||
part of providing a strong foundation for the development of real-time
|
||||
embedded applications and are welcome as submission.
|
||||
|
||||
75
c/PROBLEMS
75
c/PROBLEMS
@@ -1,75 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
This is the list of outstanding problems in this release.
|
||||
|
||||
+ The POSIX threads and real-time extensions are tested but this is
|
||||
the first release with them included. They are not enabled by
|
||||
default. The environment variable RTEMS_HAS_POSIX_API must be
|
||||
set to "yes" and the C language macro RTEMS_POSIX_API must be defined
|
||||
before this api is included in the build.
|
||||
|
||||
+ The shell scripts runtest and difftest do not work properly when
|
||||
testing "debug" executables.
|
||||
|
||||
+ AMD 29k port is based on a non-GNU toolset.
|
||||
|
||||
+ The test spfatal is out of date and as a result will NOT execute
|
||||
correctly. The addition of POSIX and consequent ongoing initialization
|
||||
reorganization makes it pointless to fix this until the POSIX support
|
||||
is completely in place.
|
||||
|
||||
+ The m68k family has become quite large and an understanding of the
|
||||
compatibility of the peripherals on the various members of the 683xx
|
||||
family would allow someone to designate some of the drivers submitted
|
||||
for the gen683xx BSPs as useful on other members.
|
||||
|
||||
+ The only supported i960 family member is the CA. No support for the
|
||||
floating point support found in other family members is present.
|
||||
This also implies that RTEMS may "think" of something as generic
|
||||
across the i960 family when in fact it is specific to the CA.
|
||||
To make matters worse, the i960 target board owned by the RTEMS Project
|
||||
is now broken and as a result even the i960CA is a "compile only" port.
|
||||
|
||||
+ Some of the BSPs still define RAM_START and RAM_END in the bsp.h file.
|
||||
It is better to define these in the linkcmds file. It is also nice
|
||||
to use the linkcmds file to place overlays for on-board hardware.
|
||||
|
||||
+ The __read(), __write(), etc. routines should be renamed __rtems_read(),
|
||||
etc. to avoid potential naming conflicts. [NOTE: This is already
|
||||
necessary under some versions of Linux with the unix port.]
|
||||
|
||||
+ The __read() system call in all of the BSPs using single
|
||||
character input/output needs to be smarter. The following
|
||||
issues need to be addressed:
|
||||
|
||||
+ echoing of characters on input
|
||||
+ CR/NL echoing
|
||||
+ backspaces
|
||||
+ tabs
|
||||
|
||||
+ UNIX port notes:
|
||||
|
||||
+ sometimes a stray SIGALRM is reported as spfatal completes.
|
||||
|
||||
+ There are conflicts between the names of native library routines
|
||||
which MUST be used and those in the POSIX support. This must
|
||||
be addressed.
|
||||
|
||||
+ Some of the tests may execute correctly and not produce the exact
|
||||
ordering of lines in the screen file. This appears to be a combination
|
||||
of a number of factors including buffering, processor speed, IO
|
||||
device overhead, and clock interrupt rate.
|
||||
|
||||
+ The compiler configuration files (c/make/gcc-XYZ.cfg) are largely
|
||||
the same when the different targets have the same CPU. It would
|
||||
be desirable to have a gcc-CPU.cfg or gcc-CPU_MODEL.cfg (e.g.
|
||||
gcc-m68k.cfg or gcc-m68020.cfg) and have the file gcc-TARGET.cfg
|
||||
include this and possibly override default settings.
|
||||
|
||||
+ The clock device drivers should really avoid doing the division
|
||||
by 1000 in the clock tick ISR to convert microseconds into
|
||||
milliseconds. This only applies to clock drivers which generate
|
||||
an ISR each millisecond and only call rtems_clock_tick every
|
||||
so many ISRs.
|
||||
45
c/README
45
c/README
@@ -1,45 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
This is the top level of the RTEMS directory structure. The following
|
||||
is a description of the files and directories in this directory:
|
||||
|
||||
LICENSE
|
||||
Required legalese.
|
||||
|
||||
Makefile
|
||||
The top-level Make command file used to build the C implementation
|
||||
of RTEMS. [RTEMS assumes the use of GNU make.]
|
||||
|
||||
Modules
|
||||
Example Modules command files used to configure the user's environment
|
||||
for RTEMS. These require the Modules system administration package
|
||||
available from numerous ftp sites.
|
||||
|
||||
README
|
||||
This file.
|
||||
|
||||
REQUIRES
|
||||
A list of the other tools which are assumed to be installed
|
||||
before RTEMS is built.
|
||||
|
||||
SUPPORT
|
||||
Information on third-party support for RTEMS.
|
||||
|
||||
build-tools
|
||||
This directory contains the source for various utilities
|
||||
needed to build RTEMS.
|
||||
|
||||
make
|
||||
Make command files "included" from those in the source distribution.
|
||||
[RTEMS assumes the use of GNU make.]
|
||||
|
||||
patches
|
||||
This directory contains patches for this release of RTEMS.
|
||||
|
||||
src
|
||||
This directory contains the source code for the C
|
||||
implementation of RTEMS as well as the test suites, sample
|
||||
applications, Board Support Packages, Device Drivers, and
|
||||
support libraries.
|
||||
72
c/README.DOS
72
c/README.DOS
@@ -1,72 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
tools
|
||||
-----
|
||||
The RTEMS build procedure was designed with the capabilitiies of a
|
||||
typical UNIX computer in mind. Making this procedure work under MS-DOS
|
||||
is not that difficult but requires that MS-DOS versions of a number
|
||||
of UNIX utilities be acquired and installed. For time being, the
|
||||
best advice which can be offered is:
|
||||
|
||||
"This is a nasty question, since when I first set up the DOS machine
|
||||
(long before I acquired RTEMS) I ftp'd a bunch of different tool
|
||||
sets (all from SimTel), and then picked individual tools from each
|
||||
set that worked best for me. The djgpp tools are probably a good
|
||||
starting point, especially to get a working sed. Next the gnu tools
|
||||
in SimTel/msdos/gnuish, and then others. Sorry I can't give you more
|
||||
specific names. The only real requirement for the tools is that
|
||||
they *must* accept redirection of command line arguments from a file
|
||||
using the '@' notation (i.e., "mkdir @/tmp/args" reads the argument
|
||||
list from file /tmp/args)."
|
||||
|
||||
There is a special version (source and executable) of GNU make 3.71 for
|
||||
MS-DOS which minimizes the amount of memory used by recursive makes
|
||||
available on lancelot.gcs.redstone.army.mil in the file:
|
||||
|
||||
/pub/msdos/gmake371.tgz
|
||||
|
||||
Many of the RTEMS specific utilities used in the build and installation
|
||||
are UNIX shell scripts. On a UNIX host, these are normally interpreted
|
||||
by the Bourne Again Shell (BASH) or the Korn Shell (ksh). Most of these
|
||||
scripts can be successfully executed with the following shell from the
|
||||
MS-DOS archives from Simtel.
|
||||
|
||||
SimTel/msdos/sysutil/ms_sh23b.zip
|
||||
|
||||
Please be sure to use the 16-bit version. The Simtel archives are
|
||||
available from ftp.cdrom.com as well as a number of mirror sites.
|
||||
|
||||
go32
|
||||
----
|
||||
go32 dumps the stack when a program seg-faults, and if this happens while
|
||||
on an alternate stack an infinite loop can ensue. Setting the environment
|
||||
variable GO32="core /tmp/core" will prevent more than 20 lines or
|
||||
so of stack information from being dumped after a crash, and the output
|
||||
will go to a file rather than the screen.
|
||||
|
||||
The go32 debuggers get confused by the relocated stacks used by tasks,
|
||||
and tend to crash when variables are inspected.
|
||||
|
||||
djgcc include files
|
||||
-------------------
|
||||
In general, we use RTEMS include files because these contain the proper
|
||||
declarations for the libc, and in particular, the stdio functions.
|
||||
When calling go32-specific functions it is necessary to include some
|
||||
djgpp include files, as well. Unfortunately, there are some disagreements
|
||||
between RTEMS and djgpp as to how certain functions and types are
|
||||
declared. In these cases, the RTEMS source have been modified to
|
||||
special-case the differences.
|
||||
|
||||
other
|
||||
-----
|
||||
* Pressing F12 will immediately abort the program.
|
||||
See lib/libbsp/i386/go32/console/inch.c.
|
||||
|
||||
* lib/libbsp/i386/go32/timer uses the on-board timer chip by default,
|
||||
which has a resolution of about 1 microsecond. However, if executing
|
||||
on a Pentium processor you can use the on-chip 64-bit cycle counter,
|
||||
which counts at whatever clock rate your processor runs at. To enable
|
||||
this, set RTEMS_CPU_MODEL=pentium in make/custom/go32.cfg.
|
||||
|
||||
13
c/REQUIRES
13
c/REQUIRES
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
1. The installation procedure assumes that "gcc" is installed
|
||||
and is in your path for the installation of local tools.
|
||||
|
||||
2. gcc 2.7.2 with crossgcc patches (ftp.cygnus.com:/pub/embedded/crossgcc)
|
||||
|
||||
3. binutils 2.6 with crossgcc patches.
|
||||
|
||||
4. newlib with RTEMS configurations.
|
||||
|
||||
51
c/TESTED
51
c/TESTED
@@ -1,51 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
This file is current as of the 3.5.17 snapshot.
|
||||
|
||||
The RTEMS project uses SparcStations running the Solaris 2.3 operating
|
||||
system internally for development. This release has been tested on the
|
||||
following Languages/CPUs/Targets using Solaris 2.3/SPARC as the host
|
||||
environment:
|
||||
|
||||
CPU CPU
|
||||
LANGUAGE FAMILY MODEL TARGET SUITES
|
||||
======== ====== ========= =================== ===============
|
||||
C m68k m68000 efi68k (note 1)
|
||||
C m68k m68020 Motorola MVME136 ALL TESTS
|
||||
C m68k m68020 Motorola MVME147 (note 1)
|
||||
C m68k m68lc040 Motorola MVME162 (note 1)
|
||||
C m68k m68ec040 Motorola IDP (note 1)
|
||||
C m68k m68020 DY-4 DMV152 (note 1)
|
||||
C m68k m68302 generic 68302 (note 1)
|
||||
C m68k m68332 efi332 (note 1)
|
||||
C m68k m68302 generic 68360 (note 1)
|
||||
C i386 i386_fp Force CPU-386 ALL TESTS
|
||||
C i386 i486 DJGPP/PC-AT ALL TESTS
|
||||
C i386 pentium DJGPP/PC-AT ALL TESTS
|
||||
C i960 i960ca Cyclone CVME961 (note 4)
|
||||
C hppa hppa7100 simhppa (note 1)
|
||||
C ppc 403 Papyrus (note 1)
|
||||
C UNIX NA Solaris 2 (SPARC) ALL TESTS (inlines)
|
||||
C UNIX NA Solaris 2 (SPARC) ALL TESTS (macros)
|
||||
C UNIX NA Linux (i386) NOT TESTED
|
||||
C UNIX NA HPUX (PA-RISC) (note 2)
|
||||
C no_cpu NA no_bsp (note 3)
|
||||
|
||||
NOTES:
|
||||
|
||||
"NOT TESTED" indicates that this was not tested in the testing cycle
|
||||
immediately preceding the snapshot.
|
||||
|
||||
(1) Target board is not owned by RTEMS Project. The target is known
|
||||
to compile and link with all appropriate tests successfully.
|
||||
If the target does not support multiprocessor configurations, then
|
||||
"ALL TESTS" does not include the multiprocessor tests.
|
||||
|
||||
(2) RTEMS Project cannot internally compile or test this target.
|
||||
|
||||
(3) Target is not intended to be executed. It is only an example.
|
||||
|
||||
(4) The board owned by the RTEMS Project is broken. The BSP is known
|
||||
to compile and link with all appropriate tests successfully.
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Between RTEMS 3.1.0 and 3.2.0, every RTEMS defined symbol made visible
|
||||
was renamed. This document describes the change and the tools provided
|
||||
to assist you in updating your RTEMS 3.1.0 application.
|
||||
|
||||
[NOTE: This change was not included in snapshots prior to 3.1.15.]
|
||||
|
||||
DESCRIPTION OF NAME CHANGES:
|
||||
============================
|
||||
|
||||
The primary change was the addition of the prefix "rtems_" or "RTEMS_" to
|
||||
EVERY user visible RTEMS provided constant and routine. The primary
|
||||
factor in the decision to make such a sweeping change was conflicts
|
||||
between the the RTEMS and POSIX API's.
|
||||
|
||||
|
||||
TO UPDATE YOUR APPLICATION:
|
||||
===========================
|
||||
|
||||
The update script requires that Perl be installed on your computer.
|
||||
It has only been tested with Perl 5.x.
|
||||
|
||||
After RTEMS has been built, in the directory "$r/<BSP>/update_tools", will
|
||||
be a set of tools to aid in making the application source changes necessary
|
||||
to address (hopefully) all of the name changes in the RTEMS API between
|
||||
releases 3.1.0 and 3.2.0.
|
||||
|
||||
The update shell script is the only executable which is invoked by the
|
||||
user directly. The word-replace Perl script is invoked by the update
|
||||
shell script.
|
||||
|
||||
WARNING: These tools modify the files IN PLACE!!! Backup your
|
||||
source before using these tools.
|
||||
|
||||
To udpate your application, change directories to the top of your application
|
||||
source tree and execute the update script. It should be something similar
|
||||
to the following:
|
||||
|
||||
cd MY_APP
|
||||
$r/<BSP>/update-tools/update
|
||||
|
||||
The update script will ask if you have backed up your source code before
|
||||
beginning the update process. While operating on files, it will print
|
||||
the name of each file and a dot for each change made to the source file.
|
||||
|
||||
NOTE: These scripts do not attempt to address changes in calling
|
||||
sequences. After the script has run, you will need to update
|
||||
calls to rtems_clock_get(), rtems_timer_fire_after(), and
|
||||
rtems_timer_fire_when() by hand.
|
||||
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
ifc is an MS-DOS executable which is equivalent to the program
|
||||
install-if-change. It was compiled using Borland C 2.00.
|
||||
|
||||
cklength is a precompiled version of the program cklength.c from
|
||||
the main source tree.
|
||||
|
||||
fixtimer is a program to restore the clock if the program does not
|
||||
exit cleanly.
|
||||
@@ -1,286 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
begin 664 cklength
|
||||
M?T5,1@$" 0 " ( ! $,% #0 "T8 T "
|
||||
M!0 H !H %P 8 T $ - "@ H 4 P
|
||||
M -0 !$ ! ! ! 7
|
||||
M2P %TL % $ $ !=, (73 &\ %? < 0
|
||||
M @ %U A=0 (@ !P O=7-R+VQI8B]L9"YS
|
||||
M;RXQ $, !6 20 #P
|
||||
M #@ $4 /0 !P !# &@
|
||||
M A 30 #\ *0 $X !" D
|
||||
M $@ W $8 )@ "
|
||||
M ! %( 4P Z *@ 00
|
||||
M $H 'P $L !5 3P L .P %0 H
|
||||
M-@ #$ P 40
|
||||
M
|
||||
M
|
||||
M G
|
||||
M '0 C ; N
|
||||
M "( -0 E #D R - !X
|
||||
M "T ,P !$ *P
|
||||
M ^ "\ 3 % !'
|
||||
M 0#4 , $ $ Z # "
|
||||
M ! U0 P P 0BT , 0 $*W #
|
||||
M % !"S P !@ 0P4 , < $32
|
||||
M # ( !$^ P "0 1/L , H $3
|
||||
M] # + !% P # A=, , T
|
||||
M (74 # . "%]@ P #P ACP , !
|
||||
M (9" # 1 P $@ ,
|
||||
M !, # 4 P %0
|
||||
M , !8 # 7 P &
|
||||
M , !D ! (8. 2 " !$_0 $0 "P !8
|
||||
M 0P4 =!( < = (8U 2 (@ "&$0 $@
|
||||
M "< 1/L !$ H U (8O 2 / "&0@ $$0
|
||||
M$0 $4 AB8 !( !. (9# 01 1 5P "',@
|
||||
M$0#_\0 %P 1+ 2!( < !B $2> $@2 ' 9P !$8@
|
||||
M "H$@ !P &\ AD8 !0"$ !$ !T (73 1 /_Q B@ "
|
||||
M&*0 $@ ) A@( !( "7 (8% 2
|
||||
MG !$T@ $@ " *( ACT !!$ ! "J (9$ 01 1
|
||||
M M "&E@ )@$0 $0 , AB !( #' (8\ 01
|
||||
M 0 S0 "%U $0#_\0 -8 0[H !0!( < #> (9&
|
||||
M 4 1 1 Y "&E@ )@$0 $0 /$ AC@ !( #W (8
|
||||
M+ 2 _P "&" $@ 04 AD, !"$ !$ $-
|
||||
M (<N 01 1 !$P "&+ $@ 1H 1 H !8!( <
|
||||
M $@ (8_ 01 0 !,P "'+P $$0 $0 3H AC( !(
|
||||
M $_ (<P 01 1 !1@ "&&@ $@ 4P AS$
|
||||
M!!$ !$ %3 (8^ 01 0 !9P "&0@ $0#_\0 6X A?8
|
||||
M !$ __$ &( (87 2 !C@ "&1 $$0 $0 9<
|
||||
M 1,( /!( < &I $3\ 1 * !M@ !%TL $0#_\0
|
||||
M ;T 10 !!$ P '* $2, $@2 ' !SP "&(P $@
|
||||
M =8 0R( !( < 'H $3^ 1 + !]0 !#10 '4
|
||||
M$@ !P ?H AD !!$ ! (& (8= 2 "#0 !$^
|
||||
M $@ "0 A, AA0 !( 9V5T;W!T %]?1%1/4E],25-47U\
|
||||
M7W-T87)T ')E860 871O:0!?7T-43U)?3$E35%]? '-T<G1O; !P<F]G;F%M
|
||||
M90!V9G!R:6YT9@!?96YV:7)O;@!?96YD %=R:71E %)E860 9V5T<&%R;0!?
|
||||
M:6]B %]'3$]"04Q?3T9&4T547U1!0DQ%7P!A8F]R= !A=&5X:70 97AI= !?
|
||||
M:6YI= !V97)B;W-E %]S>7-?;F5R<@!S>7-?97)R;&ES= !F8VQO<V4 55-!
|
||||
M1T4 7T193D%-24, <')O8V5S<P!?7VEO8@!?<WES7V5R<FQI<W0 =W)I=&4
|
||||
M<W1R<F-H<@!?97AI= !E;G9I<F]N &5R<FYO '-T<F-H<@!E<G)O<@!R97!O
|
||||
M<G1?;&EN95]L96YG=&@ ;W!T:6YD &]P96X ;W!T87)G &9G971S &]P=&5R
|
||||
M<@!R97!O<G1?;&EN95]N=6UB97)S %]E9&%T80!?4%)/0T5$55)%7TQ)3DM!
|
||||
M1T5?5$%"3$5? &9O<&5N '-Y<U]N97)R %]?9&]?9VQO8F%L7V1T;W)S %]?
|
||||
M0U1/4E]%3D1?7P!?971E>'0 7VQI8E]V97)S:6]N $]P96X 9F9L=7-H %]?
|
||||
M9&]?9VQO8F%L7V-T;W)S %]?1%1/4E]%3D1?7P!M86EN &QI;F5?;&5N9W1H
|
||||
M '-T<FQE;@!?9FEN:0!F<')I;G1F &QI8F,N<V\N,0 AD, C$P
|
||||
M AS$ !#$P AS !!$P AR\ _$P AD8 U
|
||||
M$P " AD0 !($P AI8 P$P A@( K%0 A@4
|
||||
M L%0 A@@ Y%0 A@L X%0 A@X :%0
|
||||
M AA$ >%0 AA0 !5%0 AA< !'%0 AAH !"%0
|
||||
M AAT !3%0 AB Q%0 AB, !.%0 AB8 B
|
||||
M%0 ABD J%0 ABP \%0 AB\ @%0 AC(
|
||||
M ! %0 AC4 =%0 AC@ W%0 "\$" X .@0*(#H$2<
|
||||
M(Z @@) 0* 20$ !0 !"]@$ 1 !$D!(CX$ 0O(! 0 !P $
|
||||
M "0$ 0DA $94L( *4 J $E 1 "A< (:6$N$,U"+ $ "D! 0 !"
|
||||
MYP$ ! $+H 0 ('#X @! $0 1-0"(^R HK__$H #9(2(^S0 F $
|
||||
M@*(@ * F4$" E@)@!)(0( "2 F $T ) "X"B( 2O__]E *@ 9*2@ "
|
||||
M@ ,$0 1!$ $2B$B/LH2I@ M $ !&?P@ 0 *"$/_PRO__]T 0 $1$
|
||||
M $1 $+!D!(C"(''X B!Z G>._F*@0 !BB$" L! @ - &0 ! $+!DA @
|
||||
M+Q, (: HB $H !- B80@0@ $T 9 - "80B0 B !T")A"!$ (;0 B$(
|
||||
MT"9 !$ (? (B#$(0 AB< (8E "&%0 19 0 !22$ 90 !"KI02H:"
|
||||
MHC__ H ,X"B(&PB@ 1$0 AQ2 F HB!N@*(@/P* "J HB!. H '- $
|
||||
M(/@0O__P%0 10* !. HB!V H 'M $H/00O__J%0 14 0IO0 B# E!
|
||||
M"!$ (: HJ( "+__XM0B(0 3 !%$0@ $ (N2$F&H$+__W14 $70!"#X
|
||||
M@* ")!@/_\0O__7T"0@^("@ B08#__T"0@^- $X/R H (D& __Q"__\_0
|
||||
M).#\@* ")!@/_\0O__+T"2@]!"__\FB$" !@*1@ "* L1 "'%0 AA$
|
||||
M (:0$B$X$P 19(28<A $)VU *@\$ 0F60$" !DA "- "(+R1*B "T 9
|
||||
M"("B( "@ 1(0 A] "8+R1*B "0 #] &0 B HC__(H K 0/__0!""\
|
||||
MD (@ = D(+R1*B "T 9 "("B( 2O__SDA $(''X B!Z G>.]F) 0 !@3
|
||||
M !%0 !"6I(28="JD@ $H !Z80( 1& $P 19(28=A !%E! &* 0
|
||||
M( &H![WX)0 ABT (:0$ 4DA B $ 0DV4$ 5@*(@ * #4! 0 !"
|
||||
M2Y 0 !2B C__$0 AM "(0" I$ (!( *X"DX 2@ +$0 AA, $60%*$X
|
||||
MDA)A^$ 0C64$ 8T 6@^("B( "@ B$0 AM "(/2 HB H !Q, $60
|
||||
M%*$XDA)B )00 !! $(HE@>]^- %H/B HB H $A$ (;0 B#\@*(@ *
|
||||
M D3 !%D!2A.)(28AB4$ 00 !"&Y80 !$0@ (I@3@ 1, $60%*$XDA)B
|
||||
M($ 0A24$ 0I@3@ 1"__\B@!" !0 !"&Y 0 !6P$" @<?@"('H "=X[^0
|
||||
M\B>@2/0GH$SV)Z!0^">@5/HGH%@1 "&0 !"$I 2(2@1' LBX "!$0 "
|
||||
MC@ ( H !*('H$P1 "'\@(@N. 'H$@5 "&-0 AI 6H3@3 !%DA)B*$
|
||||
M0?/4 J$(D!:A.)(0 !! $(!E! $8"F8 "@ :$0 A@2 !*0$B$X$0
|
||||
MAM "(1" ID (-H #!$ (85 "&E!*B6)<N8 *0%J$X$P 19(28C! $'=
|
||||
MU + "A" X1 "&D!(A.!, $62$F(X0 !!UI00 !D0@ '$0 AI 2(3@3
|
||||
M !%0 !!T)(28E 1 "&0 !!W) 2(3@1# @(X " * !41" @(X " *
|
||||
M R IF H !1$ $41 !%$( Y(2(EB2$B)P?___M) 0( ! $&MD!
|
||||
M&9 0( 3 !%?___KI(28GA $'+ 0 (''X B!Z G>._F* 0 !@1 !%
|
||||
MD!(BD$ 0<;23 @*(@ !* F0$ 0$0@ !, $62$F*@?___G)00 ! 0
|
||||
M@ :L! &9(0( ! $&\E! @ + 0 B I@ 9!H !("F !H$@ 1 0 ("F
|
||||
M0!H2@ ($0@ !, $62$F*XE! $'___XF6$ :,( !Q, $62$F+0E!
|
||||
M&Y80 !E___^"F! &H''X B!Z G>._F* 0 !B0$ 0DA &4 0:*4$ :
|
||||
ML! "("F/_\2@ ($1@ !, $62$F+PE! $)80 !E___]PF! &H''X B!
|
||||
MZ G>._F* 0 !B0$ 0DA &4 09.4$ :L! "("F/_\2@ ($1@ !,
|
||||
M $62$F,0E! $)80 !E___]>F! &H''X B!Z G>._F* 0 !B0$ 0DA
|
||||
M&4 0824$ :L! "("F/_\2@ ($1@ !, $62$F,PE! $)80 !E___],
|
||||
MF! &H''X B!Z G>._F!$ $32 B/X@*)@ * F@$B/XT 0 )_" "@
|
||||
M!" $T 0 ("B( 2O__[ 0 (''X B!Z G>._F)WCOZ"!Z G>._F!$
|
||||
M $34 B/L@**__Q* V2$B/LT )@!("B( "@ )E! @ )8"8 22$" D@)@
|
||||
M!- "0 N HB $K___90"H &2DH H #!$ $01 !$HA(C[*$J8 +0! 1
|
||||
MG\( $ "@A#_\,K___= $ !$1 !$0 !!$) 2(PB!Q^ (@>@ (''X B!
|
||||
MZ G>._H(''X B!Z _____P #_____ ! '5S
|
||||
M86=E.B @8VML96YG=&@@(%L@+78@72!;(&%R9R N+BX@72!F:6QE<RXN+B *
|
||||
M(" @(" @(" @(" @+6P@;&5N9W1H(" @+2T@;6%X:6UU;2!L:6YE(&QE;F=T
|
||||
M: H@(" @(" @(" @(" M;B @(" @(" @(" M+2!R97!O<G0@;&EN92!N=6UB
|
||||
M97)S(&9O<B!O9F9E;F1I;F<@;&EN97,*(" @(" @(" @(" @+4X@(" @(" @
|
||||
M(" @+2T@<F5P;W)T(&QI;F4@;G5M8F5R<R!A;F0@;&5N9W1H(&9O<B!O9F9E
|
||||
M;F1I;F<@;&EN97,*(" @(" @(" @(" @+78@(" @(" @(" @+2T@=F5R8F]S
|
||||
M90H*4')I;G0@=&AE(&YA;64@;V8@9FEL97,@=VAI8V@@:&%V92!A="!L96%S
|
||||
M=" Q(&QI;F4@=VAI8V@@97AC965D<R!T:&4*;6%X:6UU;2!L:6YE(&QE;F=T
|
||||
M:"X@(%1H92!D969A=6QT(&UA>&EM=6T@;&EN92!L96YG=&@@:7,@.# N"@
|
||||
M &PZ;DYV *"5D*2!I<R!I;&QE9V%L(&QI;F4@;&5N9W1H"@ E<P
|
||||
M '( 56YA8FQE('1O(&]P96X@9FEL92 H)7,I"@ E
|
||||
M<PH %1/3R!,3TY'.B5D.B E<PH "5D.B E9 H )60*
|
||||
M E<SH@ " H)7,I"@ ("AU;FMN;W=N(&5R<FYO/25D*0H "@
|
||||
M !F871A;"!E<G)O<BP@97AI=&EN9P !E>&ET:6YG &9A=&%L(&5R
|
||||
M<F]R+"!A8F]R=&EN9P # Q,C,T-38W.#DM G)7,G(&ES(&YO="!A
|
||||
M(&YU;6)E<@ E<R!C86X@;VYL>2!B92 E;&0 E<R!M=7-T(&)E
|
||||
M(&)E='=E96X@)6QD(&%N9" E;&0 &]P96XH)R5S)RP@,'@E>"P@,"5O*2!F
|
||||
M86EL960 <F5A9"@E9"P@,'@E>"P@)60I(&9A:6QE9 !W<FET
|
||||
M92@E9"P@,'@E>"P@)60I(&9A:6QE9 (74 $ (; # !$T@
|
||||
M - $3X 0 0#H !0 !"+0 * ")0 8 0-4 "P
|
||||
M ! 5 , A?8 @ .0 4 !P !< 0LP
|
||||
M!P !"MP ( !. D ,
|
||||
M # P,+__\P$ #
|
||||
M \,+__\ $ # !(,+__[0$ # !4,+__Z@$ # !@,+__YP$
|
||||
M # !L,+__Y $ # !X,+__X0$ # "$,+__W@$ # "0,+__
|
||||
MVP$ # "<,+__V $ # "H,+__U0$ # "T,+__T@$ # #
|
||||
M,+__SP$ # #,,+__S $ # #8,+__R0$ # #D,+__Q@$ #
|
||||
M #P,+__PP$ # #\,+__P $ # $(,+__O0$ ! $4"
|
||||
M % $
|
||||
M 0 __$ $ U # ! ! .@ P @ 0-4
|
||||
M , , $(M # $ !"MP P !0
|
||||
M 0LP , 8 $,% # ' !$T@ P "
|
||||
M 1/@ , D $3[ # * !$_0 P
|
||||
M"P 10 , P (73 # - "%U
|
||||
M P #@ A?8 , \ (8\ # 0 "&0@
|
||||
M P $0 , !( # 3
|
||||
M P % , !4 # 6
|
||||
M P %P , !@ # 9
|
||||
M #P ! #_\0 !8 0 __$ B $
|
||||
M /_Q +0 !$U @ " $, 0R( < !2 (8\
|
||||
M ! 0 8 ! #_\0 &L 0T4 < !Z
|
||||
M $ /_Q A ! #_\0 (\ 1-$ ( < "E
|
||||
M $31 ' M "&00 0 $ ,( 0 __$
|
||||
M #) (8. 2 T !$_0 $0 "P -X 0P4 =!(
|
||||
M < #E (8U 2 Z@ "&$0 $@ .\ 1/L
|
||||
M !$ H #] (8O 2 !! "&0@ $$0 $0 0T AB8
|
||||
M !( $6 (9# 01 1 !'P "',@ $0#_\0 20
|
||||
M 1+ 2!( < $J $2> $@2 ' !+P !$8@ "H$@ !P
|
||||
M 3< AD8 !0"$ !$ $\ (73 1 /_Q !4@ "&*0 $@
|
||||
M 5@ A@( !( %? (8% 2 !9 !$T@
|
||||
M$@ " 6H ACT !!$ ! %R (9$ 01 1 !? "&E@
|
||||
M )@$0 $0 8@ AB !( &/ (8\ 01 0 !E0 "
|
||||
M%U $0#_\0 9X 0[H !0!( < &F (9& 4 1 1 !
|
||||
MK "&E@ )@$0 $0 ;D AC@ !( &_ (8+ 2
|
||||
M !QP "&" $@ <T AD, !"$ !$ '5 (<N 01
|
||||
M 1 !VP "&+ $@ >( 1 H !8!( < 'H (8_
|
||||
M 01 0 !^P "'+P $$0 $0 @( AC( !( (' (<
|
||||
MP 01 1 "#@ "&&@ $@ A0 AS$ !!$ !$ (;
|
||||
M (8^ 01 0 "+P "&0@ $0#_\0 C8 A?8 !$ __$
|
||||
M )0 (87 2 "5@ "&1 $$0 $0 E\ 1,( /!(
|
||||
M < )Q $3\ 1 * "?@ !%TL $0#_\0 H4 10
|
||||
M!!$ P *2 $2, $@2 ' "EP "&(P $@ IX 0R(
|
||||
M !( < *P $3^ 1 + "O0 !#10 '4$@ !P L(
|
||||
M AD !!$ ! +. (8= 2 "U0 !$^ $@ "0
|
||||
M ML AA0 !( 9V\S,B]C:VQE;F=T: !C<G1I+G, =F%L=65S+5AA
|
||||
M+F, 8W)T<W1U9F8N8P!?7V1O7V=L;V)A;%]C=&]R<U]A=7@ 9V-C,E]C;VUP
|
||||
M:6QE9"X 9F]R8V5?=&]?9&%T80!C:VQE;F=T:"YC &=C8S)?8V]M<&EL960N
|
||||
M &QI8F=C8S(N8P!C<G1S='5F9BYC %]?9&]?9VQO8F%L7V-T;W)S7V%U> !G
|
||||
M8V,R7V-O;7!I;&5D+@!F;W)C95]T;U]D871A &-R=&XN<P!G971O<'0 7U]$
|
||||
M5$]27TQ)4U1?7P!?<W1A<G0 <F5A9 !A=&]I %]?0U1/4E],25-47U\ <W1R
|
||||
M=&]L '!R;V=N86UE '9F<')I;G1F %]E;G9I<F]N %]E;F0 5W)I=&4 4F5A
|
||||
M9 !G971P87)M %]I;V( 7T=,3T)!3%]/1D93151?5$%"3$5? &%B;W)T &%T
|
||||
M97AI= !E>&ET %]I;FET '9E<F)O<V4 7W-Y<U]N97)R '-Y<U]E<G)L:7-T
|
||||
M &9C;&]S90!54T%'10!?1%E.04U)0P!P<F]C97-S %]?:6]B %]S>7-?97)R
|
||||
M;&ES= !W<FET90!S=')R8VAR %]E>&ET &5N=FER;VX 97)R;F\ <W1R8VAR
|
||||
M &5R<F]R ')E<&]R=%]L:6YE7VQE;F=T: !O<'1I;F0 ;W!E;@!O<'1A<F<
|
||||
M9F=E=', ;W!T97)R ')E<&]R=%]L:6YE7VYU;6)E<G, 7V5D871A %]04D]#
|
||||
M14154D5?3$E.2T%'15]404),15\ 9F]P96X <WES7VYE<G( 7U]D;U]G;&]B
|
||||
M86Q?9'1O<G, 7U]#5$]27T5.1%]? %]E=&5X= !?;&EB7W9E<G-I;VX 3W!E
|
||||
M;@!F9FQU<V@ 7U]D;U]G;&]B86Q?8W1O<G, 7U]$5$]27T5.1%]? &UA:6X
|
||||
M;&EN95]L96YG=&@ <W1R;&5N %]F:6YI &9P<FEN=&8 $ %
|
||||
MFP UD "]D # %$X ((X
|
||||
M $8\ ! *",I4W5N3U,@-2XS($=E;F5R:6,@4V5P=&5M
|
||||
M8F5R(#$Y.3, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,*
|
||||
M $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@
|
||||
M4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A
|
||||
M8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N
|
||||
M,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C,
|
||||
M;&0Z("A31U4I(%-U;D]3+T5,1B H3$LM,2XS*0 0 "D 8?
|
||||
M"V0 1,( (60 1,( +3P /(
|
||||
M 7H <( EX L(
|
||||
M SH !$H !5H !=(
|
||||
M !EH !LX !SX !
|
||||
MX8 !]( "#( ".8
|
||||
M "5( "<( "D8 "G8
|
||||
M "R( #&8 $GH %+(
|
||||
M & %.8 ) %0X -< %3H #0 %
|
||||
M6H #4 %9( #8 %;X #< %>8 #@
|
||||
M %A( #D %CX #H %FH $8 %IX
|
||||
M %T( &T %]( "X &"20 !\L 1,( "YI;G1E
|
||||
M<G +FAA<V@ +F1Y;G-Y;0 N9'EN<W1R "YR96QA+F)S<P N<F5L82YP;'0
|
||||
M+G1E>'0 +FEN:70 +F9I;FD +F-T;W)S "YD=&]R<P N<F]D871A "YG;W0
|
||||
M+F1Y;F%M:6, +G!L= N9&%T80 N8G-S "YS>6UT86( +G-T<G1A8@ N<W1A
|
||||
M8BYI;F1E> N8V]M;65N= N<W1A8@ N<VAS=')T86( +G-T86(N:6YD97AS
|
||||
M='( +G-T86)S='( '9A;'5E<RU882YC "\Q,#DS+V]N,3 Y,U]W<R]U<W(O
|
||||
M<W)C+VQI8B]L:6)C+P!P;W)T+V=E;B]V86QU97,M6&$N8P %AT(#L@5CTR
|
||||
M+C +VYE="]M;W)G86YA+W5S<C$O<G1E;7,M,RXU+C P+V,O8G5I;&0M=&]O
|
||||
M;',O<W)C "]U<W(O8V-S+VQI8B]V86QU97,M6&$N;P ;&EB9V-C,BYC "]U
|
||||
M<W(T+T=.050O9V-C+3(N-BXS+P N+VQI8F=C8S(N8P!G8V,R7V-O;7!I;&5D
|
||||
M+@!I;G0Z=#$]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T-SL 8VAA<CIT,CUR
|
||||
M,CLP.S$R-SL ;&]N9R!I;G0Z=#,]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T
|
||||
M-SL =6YS:6=N960@:6YT.G0T/7(Q.S [+3$[ &QO;F<@=6YS:6=N960@:6YT
|
||||
M.G0U/7(Q.S [+3$[ &QO;F<@;&]N9R!I;G0Z=#8]<C$[,#$P,# P,# P,# P
|
||||
M,# P,# P,# P,# [,#<W-S<W-S<W-S<W-S<W-S<W-S<W-SL ;&]N9R!L;VYG
|
||||
M('5N<VEG;F5D(&EN=#IT-SUR,3LP,# P,# P,# P,# P.S Q-S<W-S<W-S<W
|
||||
M-S<W-S<W-S<W-S<W.P!S:&]R="!I;G0Z=#@]<C$[+3,R-S8X.S,R-S8W.P!S
|
||||
M:&]R="!U;G-I9VYE9"!I;G0Z=#D]<C$[,#LV-34S-3L <VEG;F5D(&-H87(Z
|
||||
M=#$P/7(Q.RTQ,C@[,3(W.P!U;G-I9VYE9"!C:&%R.G0Q,3UR,3LP.S(U-3L
|
||||
M9FQO870Z=#$R/7(Q.S0[,#L 9&]U8FQE.G0Q,SUR,3LX.S [ &QO;F<@9&]U
|
||||
M8FQE.G0Q-#UR,3LX.S [ &-O;7!L97@@:6YT.G0Q-3US.')E86PZ,2PP+#,R
|
||||
M.VEM86<Z,2PS,BPS,CL[ &-O;7!L97@@9FQO870Z=#$V/7(Q-CLT.S [ &-O
|
||||
M;7!L97@@9&]U8FQE.G0Q-SUR,3<[.#LP.P!C;VUP;&5X(&QO;F<@9&]U8FQE
|
||||
M.G0Q.#UR,3@[.#LP.P!V;VED.G0Q.3TQ.0!A<F-H7W1Y<&4Z5#(P/65!4D-(
|
||||
M7S,R0DE4.C L05)#2%\V-$))5#HQ+#L <F5G7V-L87-S.E0R,3UE3D]?4D5'
|
||||
M4SHP+$=%3D5204Q?4D5'4SHQ+$907U)%1U,Z,BQ!3$Q?4D5'4SHS+$Q)35]2
|
||||
M14=?0TQ!4U-%4SHT+#L ;6%C:&EN95]M;V1E.E0R,CUE5D])1&UO9&4Z,"Q1
|
||||
M26UO9&4Z,2Q(26UO9&4Z,BQ04TEM;V1E.C,L4TEM;V1E.C0L4$1);6]D93HU
|
||||
M+$1);6]D93HV+%1);6]D93HW+$]);6]D93HX+%%&;6]D93HY+$A&;6]D93HQ
|
||||
M,"Q4449M;V1E.C$Q+%-&;6]D93HQ,BQ$1FUO9&4Z,3,L6$9M;V1E.C$T+%1&
|
||||
M;6]D93HQ-2Q30VUO9&4Z,38L1$-M;V1E.C$W+%A#;6]D93HQ."Q40VUO9&4Z
|
||||
M,3DL0U%);6]D93HR,"Q#2$EM;V1E.C(Q+$-326UO9&4Z,C(L0T1);6]D93HR
|
||||
M,RQ#5$EM;V1E.C(T+$-/26UO9&4Z,C4L0DQ+;6]D93HR-BQ#0VUO9&4Z,C<L
|
||||
M0T-8;6]D93HR."Q#0U].3T]6;6]D93HR.2Q#0UA?3D]/5FUO9&4Z,S L0T-&
|
||||
M4&UO9&4Z,S$L0T-&4$5M;V1E.C,R+$U!6%]-04-(24Y%7TU/1$4Z,S,L.P!M
|
||||
M;V1E7V-L87-S.E0R,SUE34]$15]204Y$3TTZ,"Q-3T1%7TE.5#HQ+$U/1$5?
|
||||
M1DQ/050Z,BQ-3T1%7U!!4E1)04Q?24Y4.C,L34]$15]#0SHT+$U/1$5?0T]-
|
||||
M4$Q%6%])3E0Z-2Q-3T1%7T-/35!,15A?1DQ/050Z-BQ-05A?34]$15]#3$%3
|
||||
M4SHW+#L <'1R9&EF9E]T.G0Q '-I>F5?=#IT- !W8VAA<E]T.G0S %51271Y
|
||||
M<&4Z=#$Q %-)='EP93IT,0!54TET>7!E.G0T $1)='EP93IT-@!51$ET>7!E
|
||||
M.G0W %-&='EP93IT,3( 1$9T>7!E.G0Q,P!W;W)D7W1Y<&4Z=#$ 1$ES=')U
|
||||
M8W0Z5#(T/7,X:&EG:#HQ+# L,S([;&]W.C$L,S(L,S([.P!$275N:6]N.G0R
|
||||
M-3UU.',Z,C0L,"PV-#ML;#HV+# L-C0[.P!F=6YC7W!T<CIT,C8]*C(W/68Q
|
||||
M.0!?7V1O7V=L;V)A;%]D=&]R<SI&,3D
|
||||
M $ ! @ ! -0 #4 $0
|
||||
M 0 ) !0 ( 0#H Z FP #
|
||||
M 0 $ #P L " $#5 U0 5@ ! !H $
|
||||
M $ !< # @ !"+0 BT ")0 0
|
||||
M ? ! ( 0K< *W %0 # $0 0 , *0
|
||||
M 0 " $+, "S #D P \ $ # #, !
|
||||
M!@ !#!0 P4 '- ! Y 0 8 1-(
|
||||
M 32 )@ 0 /P $ & $3X $^
|
||||
M , $ $4 ! !@ !$^P !/L "
|
||||
M ! !, 0 8 1/T 3] @
|
||||
M 0 4P $ " $4 % -+ (
|
||||
M %L ! P "%TP !=, ! ! 0
|
||||
M !@ !@ , A=0 74 (@ $ 0 ( :0
|
||||
M $ ' (7V %]@ $8 $ # &X !
|
||||
M P "&/ !CP % ! !T " , AD(
|
||||
M 9" \ @ >0 ( &0@
|
||||
M 90 $P "D $ $ ($ # !]8 "XP
|
||||
M 0 ") 0 B/ $@
|
||||
M 0 , E0 $ (H0 $; !
|
||||
M )X ! ".@ !^ ! P
|
||||
M "D P EF ,8 $ K@
|
||||
M , )EX "; ! +T #
|
||||
= ";Y &'P 0 !
|
||||
|
||||
end
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dos.h>
|
||||
|
||||
#define IO_RTC 0x70 /* RTC */
|
||||
|
||||
#define RTC_SEC 0x00 /* seconds */
|
||||
#define RTC_MIN 0x02 /* minutes */
|
||||
#define RTC_HRS 0x04 /* hours */
|
||||
#define RTC_WDAY 0x06 /* week day */
|
||||
#define RTC_DAY 0x07 /* day of month */
|
||||
#define RTC_MONTH 0x08 /* month of year */
|
||||
#define RTC_YEAR 0x09 /* month of year */
|
||||
#define RTC_STATUSA 0x0a /* status register A */
|
||||
#define RTCSA_TUP 0x80 /* time update, don't look now */
|
||||
|
||||
#define RTC_STATUSB 0x0b /* status register B */
|
||||
|
||||
#define RTC_DIAG 0x0e /* status register E - bios diagnostic */
|
||||
#define RTCDG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time"
|
||||
|
||||
|
||||
|
||||
/* convert 2 digit BCD number */
|
||||
static int bcd( unsigned int i )
|
||||
{
|
||||
return ((i/16)*10 + (i%16));
|
||||
}
|
||||
|
||||
static unsigned int rtcin( unsigned int what )
|
||||
{
|
||||
outportb( IO_RTC, what );
|
||||
return inportb( IO_RTC+1 );
|
||||
}
|
||||
|
||||
|
||||
void fix_date( void )
|
||||
{
|
||||
int s;
|
||||
struct date date;
|
||||
struct time time;
|
||||
|
||||
/* initialize brain-dead battery powered clock */
|
||||
outportb( IO_RTC, RTC_STATUSA );
|
||||
outportb( IO_RTC+1, 0x26 );
|
||||
outportb( IO_RTC, RTC_STATUSB );
|
||||
outportb( IO_RTC+1, 2 );
|
||||
|
||||
outportb( IO_RTC, RTC_DIAG );
|
||||
s = inportb( IO_RTC+1 );
|
||||
if (s) printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
|
||||
|
||||
/* check for presence of clock */
|
||||
s = rtcin(RTC_STATUSA);
|
||||
if ( s == 0xff || s == 0 ) {
|
||||
printf( "Real-time clock not found\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* ready for a read? */
|
||||
while ((s & RTCSA_TUP) == RTCSA_TUP)
|
||||
s = rtcin(RTC_STATUSA);
|
||||
|
||||
date.da_year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */
|
||||
if ( date.da_year < 1970) date.da_year += 100;
|
||||
date.da_year -= 1980;
|
||||
date.da_mon = bcd(rtcin(RTC_MONTH)); /* month */
|
||||
date.da_day = bcd(rtcin(RTC_DAY)); /* day */
|
||||
|
||||
(void)bcd(rtcin(RTC_WDAY)); /* weekday */
|
||||
|
||||
time.ti_hour = bcd(rtcin(RTC_HRS)); /* hour */
|
||||
time.ti_min = bcd(rtcin(RTC_MIN)); /* minutes */
|
||||
time.ti_sec = bcd(rtcin(RTC_SEC)); /* seconds */
|
||||
time.ti_hund = 0;
|
||||
|
||||
setdate( & date );
|
||||
settime( & time );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fix_timer( void )
|
||||
{
|
||||
#define PIT_PORT 0x40
|
||||
#define TIMER_CNTR0 (PIT_PORT + 0) /* timer 0 counter port */
|
||||
#define TIMER_MODE (PIT_PORT + 3) /* timer mode port */
|
||||
#define TIMER_SEL0 0x00 /* select counter 0 */
|
||||
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
||||
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
||||
|
||||
/* set timer 0 to generate interrupts every period */
|
||||
outportb( TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT );
|
||||
outportb( TIMER_CNTR0, 0 ); /* counter low */
|
||||
outportb( TIMER_CNTR0, 0 ); /* counter high */
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Make timer count at correct pace */
|
||||
fix_timer();
|
||||
|
||||
/* Fix the date */
|
||||
fix_date();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
begin 664 fixtimer.exe
|
||||
M35IF 0X 0 @ T __^; 8 (@ $ ^R!R:@$
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M "Z3 $NB1;X ;0PS2&++@( BQXL ([:HY( C :0
|
||||
M (D>C ")+JP QP:6 /__Z#0!Q#Z* (O'B]BY_W\F@3TX-W49)HM5 H#Z/740
|
||||
M@.;?_P:6 (#^674$_P:6 /*NXV%#)C@%==: S8#WV8D.B@"Y 0#3XX/#"(/C
|
||||
M^(D>C@",VBOJBSY\ H'_ )S![\ HD^? *!Q^P$<B@#/GH"<B*Q!-/O1SOO
|
||||
M<AF#/GP" '0'@SYZ @!U#K\ $#OO=P>+_>L#Z2$!B]\#VHD>I ")'J@ H9
|
||||
M*]B.P+1*5\TA7]/G^H[2B^?[,\ NC@;X ;^F!+GL!"O/\ZH._Q:8!.BU NB=
|
||||
M [0 S1J)%I@ B0Z: /\6G 3_-H@ _S:& /\VA #H%P)0Z%H"+HX>^ 'H? .
|
||||
M_Q::!#/ B_"Y+P"0_ ($@-0 1N+X+3<-D'0*N1D D+HO .B+ (OLM$R*1@+-
|
||||
M(;D. )"Z2 #IAP >N US2&)'G0 C 9V +@$-<TAB1YX (P&>@"X!37-(8D>
|
||||
M? ",!GX N 8US2&)'H C :" +@ )8S*CMJZ6 '-(1_#'K@ )<46= #-(1\>
|
||||
MN 0EQ19X ,TA'QZX!27%%GP S2$?'K@&)<46@ #-(1_#QP:6 R\.T0+L"
|
||||
M ,TAP[D> )"Z5@ NCA[X >CI_[@# %#H*?\ %6+[(M&!+$$T^BZ"@#WXHM6
|
||||
M!('B#P #PNL 7<-5B^R*1@3F<.1QM #K %W#58OL@^P(5K *YG"P)N9QL OF
|
||||
M<+ "YG&P#N9PY'&T (OP"_9T#[BR 5!6N)0!4.B<"8/$!K@* %#HM?]9B_"!
|
||||
M_O\ = 0+]G4+N/P!4.A^"5GIJ0#K"K@* %#HE/]9B_"+QB6 #V '3LN D
|
||||
M4.B _UE0Z%__605L!XE&^(%^^+('?02#1OAD@6[XO >X" !0Z%W_65#H//]9
|
||||
MB$;[N < 4.A-_UE0Z"S_68A&^K@& %#H/?]94.@<_UFX! !0Z##_65#H#_]9
|
||||
MB$;]N ( 4.@@_UE0Z/_^68A&_#/ 4.@1_UE0Z/#^68A&_\9&_@"-1OA0Z'H1
|
||||
M68U&_%#HA1%97HOE7<.P-.9#L #F0+ YD##Z/#_Z.S^,\#K ,-5B^Q6BW8$
|
||||
M"_9\%(/^6'8#OE< B388 HJ$&@*8ENL-]]Z#_B-WZL<&& +__XO&HY0 N/__
|
||||
MZP!>7<(" ,-5B^SK"HL>?@+1X_^7I@2A?@+_#GX""\!UZ_\6= +_%G8"_Q9X
|
||||
M O]V!.AZ_5E=PP "Z/!JH#+HP>K /\C@:0 +Z #+D)JQ C,6'UI.+
|
||||
M-HH @\8"N0$ @#Z2 -R$8X&C "+_K%_,L#RKN-V@/%_@^P"N $ \,#P27^
|
||||
M_XO\*_AR8(OGC,".V(S0CL!12?.D,L"JCMV'\H?9B\.+T$/H&0!W!W) Z!(
|
||||
M=_D\('0(/ UT!#P)=>@RP.OD"\!T!T*J"L!U 4.&X#+ ^>,5K$DL(G0/!"(\
|
||||
M7'4'@#PB=0*L20OVP^E^_5D#RBZ.'JP#B1Z$ $,#VXOTB^PKZW+FB^6)+H8
|
||||
MXPZ)=@"#Q0(VK K X/IT\#/ B48 +O\FJ@.+#HH 4>A' 5F+^ O ="0>'@>.
|
||||
M'HP ,_;\\Z0?B_@&_S:. .@I 8/$ HO8!Z.( O =0/I$?TSP+G__XD_@\,"
|
||||
M\JXF. 5U](D'PU6+[(,^?@(@=06X 0#K%8M&!(L>?@+1XXF'I@3_!GX",\#K
|
||||
M %W#58OL5E>+?@2+10:CZ 0[QW4(QP;H! ZQ"+=02+'N@$B7<$H>@$B40&
|
||||
M7UY=PU6+[%97BWX$BT8&*06+-0/WBT8&0(D$B7P"H>8$.\=U!HDVY@3K"(O^
|
||||
M WX&B74"B\8%! #K %]>7<-5B^Q6BT8$,](E__^!X@ 4E#H] !968OP@_[_
|
||||
M=00SP.L8H>8$B40"BT8$0(D$B3;F!*'F! 4$ .L 7EW#58OL5HM&!#/2)?__
|
||||
M@>( %)0Z+< 65F+\(/^_W4$,\#K%8DVZ@2)-N8$BT8$0(D$B\8%! #K %Y=
|
||||
MPU6+[%97BWX$"_]U!#/ ZUJ+QP4+ "7X_XOX@S[J! !U!U?HH?]9ZT*+-N@$
|
||||
MB\8+P'0QBP2+UX/"*#O"<@E75N@-_UE9ZR2+!#O'<@Y6Z-'^6?\$B\8%! #K
|
||||
M$(MT!CLVZ 1USU?H(O]9ZP!?7EW#58OLBT8$B]2!Z@ !.\)S!Z.> #/ ZPO'
|
||||
M!I0 " "X___K %W#58OLBT8$BU8& P:> (/2 (O(@<$ 8/2 O2=0H[S',&
|
||||
MAP:> .L+QP:4 @ N/__ZP!=PU6+[/]V!.B?_UGK %W#58OLBT8$F5)0Z++_
|
||||
MB^7K %W#58OL@^P"5E>+7@2+-XO&B4;^BUX$]T<"0 !T!(O&ZQ^+7@2+?PKK
|
||||
M"XO?1X _"G4#_T;^B\9."\!U[HM&_NL 7UZ+Y5W" @!5B^Q6BW8$5NA3!%D+
|
||||
MP'0%N/__ZTR#?@H!=1"#/ !^"U;HE?^9*48&&58(@60"7_['! BT0(B40*
|
||||
M_W8*_W8(_W8&BD0$F%#HW *#Q B#^O]U"CW__W4%N/__ZP(SP.L 7EW#58OL
|
||||
M@^P$5HMV!%;H[ -9"\!T"+K__[C__^L_N $ 4#/ 4%"*1 284.B8 H/$"(E6
|
||||
M_HE&_(,\ 'X9BU;^BT;\4E!6Z!#_F8O8B\I86BO#&]'K!HM6_HM&_.L 7HOE
|
||||
M7<-5B^RX $2+7@3-(;@ '($T>+1T.L 7<-5B^Q65XM^"HMV!(M$#CO&=0R#
|
||||
M?@@"?P:!__]_=@:X___IJ@"#/NH# '4/N) ".\9U",<&Z@,! .L4@S[H P!U
|
||||
M#;B CO&=0;'!N@# 0"#/ !T#[@! % SP%!05NC&_H/$"/=$ @0 = ?_= CH
|
||||
M"PQ9@60"\__'1 8 (O&!04 B40(B40*@WX( G0_"_]V.\<&= +$"(-^!@!U
|
||||
M&%?H6?U9B48&"\!T!X%, @0 ZP6X___K&XM&!HE$"HE$"(E\!H-^" %U!8%,
|
||||
M @@ ,\#K %]>7<-65[\$ +Z NL0]T0" P!T!5;HG )93X/&$ O_=>Q?7L-5
|
||||
MB^R![(H 5E>+1@A /0( <P4SP.GV (M>!-'C]X? P" =!+_=@C_=@;_=@3H
|
||||
MXP"#Q ;IUP"+7@31XX&GP /__8M&!HF&?/^+1@B)AGC_C;9^_^MM_XYX_XN>
|
||||
M?/__AGS_B@>(AGO_/ IU!,8$#4:*AGO_B 1&C89^_XO6*]"!^H ?#Z-AG[_
|
||||
MB_XK^%>-AG[_4/]V!.A[ (/$!HF&=O\[QW0;@[YV_P!S!;C__^L-BT8(*X9X
|
||||
M_P.&=O\KQ^M/C;9^_X.^>/\ = /IB?^-AG[_B_XK^(O'"\!V+E>-AG[_4/]V
|
||||
M!.@M (/$!HF&=O\[QW07@[YV_P!S!;C__^L)BT8( X9V_RO'ZP6+1@CK %]>
|
||||
MB^5=PU6+[(M>!-'C]X? P (=!"X @!0,\!04/]V!.@H (OEM$"+7@2+3@B+
|
||||
M5@;-(7(/4(M>!-'C@8_ P 06.L&4.@%^>L 7<-5B^R+7@31XX&GP /__;1"
|
||||
MBD8*BUX$BTX(BU8&S2%R NL'4.C;^)GK %W#58OL@^PB5E<&BWX*'@>+7@B#
|
||||
M^R1W6(#[ G)3BT8,BTX."\E]$8!^!@!T"\8%+4?WV??8@]D C7;>XP^1*]+W
|
||||
M\Y'W\X@41N,)Z_$KTO?SB!1&"\!U]8U.WO?9 \[\3HH$+ IS! 0ZZP,"1@2J
|
||||
MXN^P *H'BT8*ZP!?7HOE7<(, %6+[(-^" IU!HM&!)GK!8M&!#/24E#_=@;_
|
||||
M=@BP 5"P85#H7/_K %W#58OL_W8&_W8$_W8(_W8*L !0L&%0Z$#_ZP!=PU6+
|
||||
M[/]V!O]V!/]V"/]V"H-^"@IU!;@! .L",\!0L&%0Z!G_ZP!=P[KL ^L#NO$#
|
||||
MN04 D+1 NP( S2&Y)P"0NO8#M$#-(>EM]E6+[%97BW8$BT0..\9T!;C__^MF
|
||||
M@SP ?"WW1 (( '4,BT0*B]:#P@4[PG46QP0 (M$"HO6@\(%.\)U!HM$"(E$
|
||||
M"C/ ZS2+? 8#/$<I/%>+1 B)1 I0BD0$F%#H$OV#Q 8[QW01]T0" )U"H%,
|
||||
M A N/__ZP0SP.L 7UY=PU6+[+AK#5"XD )0_W8$C48&4.A, NL 7<-5B^R+
|
||||
M7@;_#_]V!HI&!)A0Z 8 B^7K %W#58OL@^P"5HMV!HI&!(A&__\$?3:*1O__
|
||||
M1 J+7 J(1__W1 (( '0;@'[_"G0&@'[_#74/5N@9_UD+P'0&N/__Z>D BD;_
|
||||
MM #IX0#_#/=$ I =0?W1 (" '4+@4P"$ "X___IQ@"!3 ( 8-\!@!T)H,\
|
||||
M '015NC7_ED+P'0&N/__Z:< ZPJX__^+5 8KPHD$Z7W_Z94 @S[J P!U.;B0
|
||||
M CO&=3**1 284.@)^UD+P'4%@60"__VX )0]T0" )T!;@" .L",\!0,\!0
|
||||
M5NC]^H/$".F/_X!^_PIU'_=$ D =1BX 0!0N!X$4(I$!)A0Z.#\@\0&/0$
|
||||
M=1BX 0!0C48$4(I$!)A0Z,C\@\0&/0$ =!'W1 ( G4*@4P"$ "X___K!XI&
|
||||
M_[0 ZP!>B^5=PU6+[%:+=@2XD )05NC!_EE9ZP!>7<-5B^R#[ )65XMV!(M^
|
||||
M!D?W1 (( '0CZP+K $^+QPO =!56BUX(_T8(B@>84.B+_EE9/?__=>+I=0#W
|
||||
M1 ) '0W@WP& '0QBT0&.\=S*H,\ '0-5NBT_5D+P'0$,\#K4T]7_W8(BD0$
|
||||
MF%#H(?R#Q :)1OXK?O[K-^L"ZP!/B\<+P'0L_P1]%8M>"/]&"(H'_T0*BUP*
|
||||
MB$?_M #K#E:+7@C_1@C_-^CZ_5E9/?__=<N+Q^L 7UZ+Y5W"!@#_)IX$58OL
|
||||
MBU8$N00/NR<$_(K&TNC7JHK&(L77JHK"TNC7JHK"(L77JNL 7<(" %6+[('L
|
||||
ME@!65\=&J@ QD:M4.LX5[G__S+ \J[WT4E?PX@%1_Y.K7XB4U%2!HU&KBOX
|
||||
MC4:N4%?_=@C_5@K&1JU0 7ZJC7ZN!UI96\,&_(U^KHF^;/^+OFS_BW8&K K
|
||||
M=!$\)700B 5'_DZM?^_HN?_KZNEU!(FV>/^L/"5TYXF^;/\SR8F.=O^)CFK_
|
||||
MB(YU_\>&</___\>&<O___^L!K#+DB]"+V(#K((#[8'-'BI\W!(O#/1< =@/I
|
||||
M'02+V-'C+O^G& ]C#TL/I ]7#\D/TP\5$!\0+Q"*#V00/Q!#$$<0Z1";$3P1
|
||||
M7!'_$BP3+!,L$W8/@ _IX0. _0!W^(..:O\!ZYN _0!W[(..:O\"ZX^ _0!W
|
||||
MX("^=?\K= 2(EG7_Z7S_@Z9J_]^U!>ER_X..:O\@M07I:/^ _0!W1/>&:O\"
|
||||
M '4A@XYJ_PBU >E1_^F( XM^!(L%@T8$ H#] G,)B89P_[4#Z3?_@/T$=>&)
|
||||
MAG+__L7I*?^ _01ST[4$Z1__DBPPF(#] G<;M0*'AG#_"\!\TM'@B]#1X-'@
|
||||
M \(!AG#_Z?O^@/T$=:6'AG+_"\!\M-'@B]#1X-'@ \(!AG+_Z=W^@XYJ_Q"U
|
||||
M!>G3_H&.:O\ 8.F:O_OM07IP_Z#IFK_[X&.:O^ +4%Z;/^MPCK"K<*ZPNW
|
||||
M$+/I MK&AG7_ ,:&;_\ B)9N_XM^!(L%,]+K$;<*QH9O_P&(EF[_BWX$BP69
|
||||
M1T>)=@;WAFK_$ !T!(L51T>)?@2-OGO_"\!U,PO2=2^#OG+_ '4MB[YL_XN.
|
||||
M</_C&X/Y_W06BX9J_R4( '0$LC#K K(@BL+HMOWB^>GI_8..:O\$4E!7BL>8
|
||||
M4(J&;_]04^B0^18'BY9R_PO2?P/I% 'I(0&(EF[_B78&C;YZ_XM>!/\W0T.)
|
||||
M7@3WAFK_( !T#_\W0T.)7@06!^@7_; ZJA8'Z _]Q@4 QH9O_P"#IFK_^XV.
|
||||
M>O\K^8?/BY9R_SO1?P*+T>F^ (EV!HB6;O^+?@2+!8-&! (6!XV^>_\RY(D%
|
||||
MN0$ Z=@ B78&B)9N_XM^!/>&:O\@ '4,BSV#1@0"'@<+_^L*Q#V#1@0$C, +
|
||||
MQW4%'@>_( 3HVOP[CG+_=@2+CG+_Z9D B78&B)9N_XM^!(N.<O\+R7T#N08
|
||||
M5U&-GGO_4U*X 0 CAFK_4(N&:O^I@ !T"K@" ,=&_@0 ZQ>I %T"K@( ,=&
|
||||
M_@H ZPC'1OX( +@& %#H-_R+1OX!1@06!XV^>__WAFK_" !T$XN6</\+TGX+
|
||||
MZ%O\*]%^!(F6=O^*AG7_"L!T%": /2UT#H.N=O\!@Y9V_P!/)H@%Z#3\B_>+
|
||||
MOFS_BYYP_[@% ".&:O\]!0!U%HJF;O^ _&]U$(.^=O\ ?P;'AG;_ 0#K'Y"
|
||||
M_'AT!8#\6'44@XYJ_T!+2X.N=O\"?0;'AG;_ #CG;_]X9J_P( =0SK!K @
|
||||
MZ.'[2SO9?_;WAFK_0 !T#+ PZ,_[BH9N_^C(^XN6=O\+TGXG*\HKVB:*!#PM
|
||||
M= @\('0$/"MU!R:LZ*C[24N'RN,'L##HG?OB^8?*XQ$KV2:LB 5'_DZM?P/H
|
||||
MD/OB\0O;?@F+R[ @Z'O[XOGIKON)=@:+?@3WAFK_( !U"HL]@T8$ AX'ZP;$
|
||||
M/8-&! 2X4 J1JT#1JHFB07I??N+MGC_B[YL_[ EZ#S[K K =?B ?JU0?0/H
|
||||
M-OL'BT:JZP!?7HOE7<(( %6+[%97BW8$@S[H! !T'(L>Z 2+?P:+'N@$B7<&
|
||||
MB74$B7P&H>@$B40$ZPJ)-N@$B70$B70&7UY=PU6+[(/L E97BW8&BWX$BP0!
|
||||
M!:'F!#O&=0:)/N8$ZPV+! /&B4;^BU[^B7\"5NA-\5E?7HOE7<-6H>H$.P;F
|
||||
M!'42_S;J!.C:\EDSP*/F!*/J!.L[BQ[F!(MW O<$ 0!U(E;H&?%9.S;J!'4*
|
||||
M,\"CY@2CZ@3K!HM$ J/F!%;HH_)9ZPS_-N8$Z)GR68DVY@1>PU6+[(/L E97
|
||||
MBW8$_PR+! /&B4;^BWP"]P4! '44.S;J!'0.BP0!!8M>_HE_ HOWZP56Z +_
|
||||
M68M>_O<' 0!U"?]V_E;H*O]965]>B^5=PU6+[%:+=@0+]G4"ZQ>+Q@7\_XOP
|
||||
M.S;F!'4%Z#S_ZP56Z(__65Y=PU6+[%:T*XMV!(L,BU0"S2%>7<-5B^Q6M"V+
|
||||
M=@2+#(M4 LTA7EW# !4=7)B;RU#("T@0V]P>7)I9VAT("AC
|
||||
M*2 Q.3@X($)O<FQA;F0@26YT;"X 3G5L;"!P;VEN=&5R(&%S<VEG;FUE;G0-
|
||||
M"D1I=FED92!E<G)O<@T*06)N;W)M86P@<')O9W)A;2!T97)M:6YA=&EO;@T*
|
||||
M .P$[ 3L
|
||||
M!
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M 4E1#($))3U,@9&EA9VYO<W1I8R!E<G)O<B E
|
||||
M8@H $ AC;&]C:U]B871T97)Y!U)/35]C:W-U;09C;VYF:6=?=6YI= 5M96UO
|
||||
M<GE?<VEZ901F:7AE9%]D:7-K VEN=F%L:61?=&EM90!296%L+71I;64@8VQO
|
||||
M8VL@;F]T(&9O=6YD"@ $P("! 4&" @(%!4%$_\6!1$"____________
|
||||
M_____P4%_____________________P__(P+_#_____\3__\" @4/ O___Q/_
|
||||
M_________R/_____(_\3_P!Z WH#>@, 0 D" ( "
|
||||
M * @$ "0 @ @(" H ( $," P
|
||||
M + " !" @0 # @ #_ T ( _P
|
||||
M . " /\ #P @ #_ , _P
|
||||
M ! # /\ @ P #_ , ,
|
||||
M_P $ # /\ !0 P #_ 8 ,
|
||||
M _P ' # /\ " P #_
|
||||
MD , _P * # /\ "P P$@ B "( 2@ J#_
|
||||
M______________________________________\ <')I;G0@<V-A;F8@
|
||||
M.B!F;&]A=&EN9R!P;VEN="!F;W)M871S(&YO="!L:6YK960-"@ - "AN=6QL
|
||||
M*0 P,3(S-#4V-S@Y04)#1$5& !04 105%!04% ( % ,$% D%!04%!04%!044
|
||||
M%!04%!04%!04% \7#P@4%!0'%!84%!04%!04%!0-%!04%!04%!04%! *#P\/
|
||||
G" H4% 84$@L.%!01% P4% T4%!04%!04 -(!T@'9 50+60M9"UD+
|
||||
|
||||
end
|
||||
@@ -1,331 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <process.h>
|
||||
|
||||
#include <io.h>
|
||||
|
||||
void * xmalloc( int size )
|
||||
{
|
||||
void * p = (void *)malloc( size );
|
||||
if ( !p ) {
|
||||
fprintf( stderr, "out of memory\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
void * xrealloc( void * old, int size )
|
||||
{
|
||||
void * p = (void *)realloc( old, size );
|
||||
if ( !p ) {
|
||||
fprintf( stderr, "out of memory\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
char ** argv_fix( int * argc, char ** argv )
|
||||
{
|
||||
char ** new = NULL;
|
||||
int max = 20;
|
||||
int cnt = 0;
|
||||
int j;
|
||||
|
||||
for ( j = 1; argv[j]; ++j )
|
||||
if ( argv[j][0] == '@' && access(argv[j]+1,0)==0 )
|
||||
break;
|
||||
if ( argv[j] == NULL )
|
||||
return argv;
|
||||
|
||||
new = (char **)xmalloc( max * sizeof *new );
|
||||
new[cnt++] = *argv++;
|
||||
for ( ; *argv; ++argv ) {
|
||||
if ( cnt >= max )
|
||||
new = (char **)realloc( new, (max*=2) * sizeof *new );
|
||||
|
||||
if ( argv[0][0] != '@' || access(argv[0]+1,0) ) {
|
||||
new[cnt++] = *argv;
|
||||
} else {
|
||||
char line[ 1000 ];
|
||||
FILE * f = fopen( argv[0]+1, "r" );
|
||||
if ( !f ) {
|
||||
perror( argv[0]+1 );
|
||||
exit( 2 );
|
||||
}
|
||||
while ( fgets( line, sizeof line, f ) ) {
|
||||
int len = strlen( line );
|
||||
/* delete trailing newlines */
|
||||
while ( line[len-1] == '\n' || line[len-1] == '\r' )
|
||||
line[--len] = '\0';
|
||||
if ( cnt >= max )
|
||||
new = (char **)xrealloc( new, (max*=2) * sizeof *new );
|
||||
new[cnt] = (char *)xmalloc( len+1 );
|
||||
strcpy( new[cnt], line );
|
||||
++cnt;
|
||||
}
|
||||
fclose( f );
|
||||
}
|
||||
}
|
||||
if ( cnt >= max )
|
||||
new = (char **)xrealloc( new, (max+1) * sizeof *new );
|
||||
new[cnt] = NULL;
|
||||
*argc = cnt;
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
const char * USAGE =
|
||||
"usage: $progname [ -cNvmV ] file [ file ... ] dest-directory-or-file\n"
|
||||
" -v -- verbose\n"
|
||||
" -V suffix -- suffix to append to targets (before any . suffix)\n"
|
||||
" eg: -V _g would change 'foo' to 'foo_g' and\n"
|
||||
" 'libfoo.a' to 'libfoo_g.a'\n"
|
||||
" -m mode -- mode for new file(s)\n"
|
||||
" -c -- copy instead of move (always on)\n"
|
||||
" -N -- copy only if source is newer than target\n"
|
||||
;
|
||||
|
||||
void fatal( char * msg )
|
||||
{
|
||||
if ( msg )
|
||||
fprintf( stderr, "%s\n", msg );
|
||||
fprintf( stderr, "%s", USAGE );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
char * basename( char * f )
|
||||
{
|
||||
char * b = strrchr( f, '/' );
|
||||
if ( b ) ++b;
|
||||
else b = f;
|
||||
return b;
|
||||
}
|
||||
|
||||
#include <sys/stat.h>
|
||||
int is_dir( char * path )
|
||||
{
|
||||
struct stat buf;
|
||||
if ( stat( path, &buf ) )
|
||||
return 0;
|
||||
return buf.st_mode & S_IFDIR;
|
||||
}
|
||||
int is_file( char * path )
|
||||
{
|
||||
struct stat buf;
|
||||
if ( stat( path, &buf ) )
|
||||
return 0;
|
||||
return buf.st_mode & S_IFREG;
|
||||
}
|
||||
int newer( char * p1, char * p2 )
|
||||
{
|
||||
struct stat buf1;
|
||||
struct stat buf2;
|
||||
if ( stat( p1, &buf1 ) )
|
||||
return 0;
|
||||
if ( stat( p2, &buf2 ) )
|
||||
return 0;
|
||||
return buf1.st_mtime > buf2.st_mtime;
|
||||
}
|
||||
|
||||
int filecopy( char * d, char * s, int preserve_time )
|
||||
{
|
||||
#if 0
|
||||
int status;
|
||||
char * argv[ 5 ];
|
||||
argv[0] = "cp";
|
||||
argv[1] = "-p";
|
||||
argv[2] = s;
|
||||
argv[3] = d;
|
||||
argv[4] = NULL;
|
||||
status = spawnvp( P_WAIT, argv[0], argv );
|
||||
if ( status )
|
||||
perror( "cp" );
|
||||
return status;
|
||||
#else
|
||||
FILE * fs;
|
||||
FILE * fd;
|
||||
char buffer[ 8192 ];
|
||||
int n;
|
||||
struct ftime When;
|
||||
struct stat Stat;
|
||||
|
||||
fs = fopen( s, "rb" );
|
||||
if ( fs == NULL ) {
|
||||
perror( s );
|
||||
return 1;
|
||||
}
|
||||
fd = fopen( d, "wb" );
|
||||
if ( fd == NULL ) {
|
||||
perror( d );
|
||||
fclose( fs );
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ( preserve_time )
|
||||
if ( getftime( fileno(fs), &When ) ) {
|
||||
perror( s );
|
||||
preserve_time = 0;
|
||||
}
|
||||
|
||||
do {
|
||||
n = fread( buffer, 1, sizeof buffer, fs );
|
||||
if ( n > 0 )
|
||||
if ( fwrite( buffer, 1, n, fd ) < 0 ) {
|
||||
perror( d );
|
||||
return 3;
|
||||
}
|
||||
} while ( n > 0 );
|
||||
|
||||
fclose( fs );
|
||||
|
||||
/* Fix time stamp */
|
||||
if ( preserve_time )
|
||||
if ( setftime( fileno(fd), &When ) ) {
|
||||
perror( s );
|
||||
preserve_time = 0;
|
||||
}
|
||||
fclose( fd );
|
||||
|
||||
/* Fix access rights */
|
||||
if ( stat( s, &Stat ) )
|
||||
perror( s );
|
||||
else if ( chmod( d, Stat.st_mode ) )
|
||||
perror( d );
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
char * progname;
|
||||
int verbose = 0;
|
||||
int only_if_newer= 0;
|
||||
char * suffix = NULL;
|
||||
char * mode = NULL;
|
||||
char * dest;
|
||||
char ** pp;
|
||||
|
||||
argv = argv_fix( &argc, argv );
|
||||
|
||||
progname = basename( *argv++ );
|
||||
|
||||
/* process the options */
|
||||
while ( argv[0] && argv[0][0] == '-' ) {
|
||||
switch ( argv[0][1] ) {
|
||||
case 'N':
|
||||
++argv;
|
||||
only_if_newer = 1;
|
||||
break;
|
||||
case 'c':
|
||||
++argv;
|
||||
/* We always copy, regardless */
|
||||
break;
|
||||
case 'v':
|
||||
++argv;
|
||||
verbose = 1;
|
||||
break;
|
||||
case 'V':
|
||||
++argv;
|
||||
suffix = *argv;
|
||||
++argv;
|
||||
break;
|
||||
case 'm':
|
||||
++argv;
|
||||
mode = *argv;
|
||||
++argv;
|
||||
break;
|
||||
default:
|
||||
fatal( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
/* Separate source file(s) from dest directory or file */
|
||||
#if 0
|
||||
if ( !argv[0] || !argv[1] )
|
||||
fatal( "missing files or invalid destination" );
|
||||
#else
|
||||
/* We used to require at least one file; not any more */
|
||||
if ( !argv[0] )
|
||||
fatal( "missing files or invalid destination" );
|
||||
if ( !argv[1] )
|
||||
return 0;
|
||||
#endif
|
||||
for ( pp = argv; *pp; ++pp )
|
||||
continue;
|
||||
--pp;
|
||||
dest = *pp;
|
||||
*pp = NULL;
|
||||
|
||||
/* Process the arguments */
|
||||
for (; *argv; ++argv ) {
|
||||
char * f = *argv;
|
||||
char * leaf = basename( f );
|
||||
char target[ 128 ];
|
||||
|
||||
strcpy( target, dest );
|
||||
|
||||
if ( is_dir( target ) ) {
|
||||
strcat( target, "/" );
|
||||
/* if we were given a suffix, then add it as appropriate */
|
||||
if ( suffix ) {
|
||||
char * dot = strchr( leaf, '.' );
|
||||
if ( dot ) {
|
||||
strncat( target, leaf, dot-leaf );
|
||||
strcat( target, suffix );
|
||||
strcat( target, dot );
|
||||
if ( verbose )
|
||||
printf( "%s: %s will be installed as %s",
|
||||
progname, f, strrchr(target,'/')+1 );
|
||||
} else {
|
||||
strcat( target, leaf );
|
||||
strcat( target, suffix );
|
||||
}
|
||||
} else {
|
||||
strcat( target, leaf );
|
||||
}
|
||||
}
|
||||
|
||||
if ( access( f, 0 ) ) {
|
||||
char buf[200];
|
||||
sprintf( buf, "cannot read %s", f );
|
||||
fatal( buf );
|
||||
}
|
||||
|
||||
if ( only_if_newer && is_file( target ) && !newer( f, target ) ) {
|
||||
if ( verbose )
|
||||
printf( "'%s' not newer than '%s'\n", f, target );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
printf( "rm -f %s\n", target );
|
||||
if ( chmod( target, 0777 ) )
|
||||
if ( verbose )
|
||||
perror( target );
|
||||
if ( unlink( target ) )
|
||||
if ( verbose )
|
||||
perror( target );
|
||||
if ( verbose )
|
||||
printf( "cp -p %s %s\n", f, target );
|
||||
if ( filecopy( target, f, 1 ) )
|
||||
return 1;
|
||||
if ( mode ) {
|
||||
char buf[ 255 ];
|
||||
sprintf( buf, "chmod %s %s\n", mode, target );
|
||||
if ( verbose )
|
||||
printf( "%s\n", buf );
|
||||
system( buf );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
begin 664 ifc.exe
|
||||
M(VEN8VQU9&4@/'-T9&EO+F@^#0HC:6YC;'5D92 \<W1R:6YG+F@^#0HC:6YC
|
||||
M;'5D92 \<')O8V5S<RYH/@T*#0HC:6YC;'5D92 \:6\N:#X-"@T*=F]I9" J
|
||||
M('AM86QL;V,H(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
|
||||
M("HI;6%L;&]C*"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)9G!R:6YT
|
||||
M9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H(#$@*3L-
|
||||
M"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0IV;VED("H@>')E86QL;V,H('9O
|
||||
M:60@*B!O;&0L(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
|
||||
M("HI<F5A;&QO8R@@;VQD+"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)
|
||||
M9G!R:6YT9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H
|
||||
M(#$@*3L-"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0H-"F-H87(@*BH@87)G
|
||||
M=E]F:7@H(&EN=" J(&%R9V,L(&-H87(@*BH@87)G=B I#0I[#0H@(" @8VAA
|
||||
M<B J*B!N97<@/2!.54Q,.PT*(" @(&EN=" @(" @;6%X(#T@,C [#0H@(" @
|
||||
M:6YT"2 @("!C;G0@/2 P.PT*(" @(&EN= D@(" @:CL-"@T*(" @(&9O<B H
|
||||
M(&H@/2 Q.R!A<F=V6VI=.R K*VH@*0T*"6EF("@@87)G=EMJ75LP72 ]/2 G
|
||||
M0"<@)B8@86-C97-S*&%R9W9;:ETK,2PP*3T]," I#0H)(" @(&)R96%K.PT*
|
||||
M(" @(&EF("@@87)G=EMJ72 ]/2!.54Q,("D-"@ER971U<FX@87)G=CL-"@T*
|
||||
M(" @(&YE=R ]("AC:&%R("HJ*7AM86QL;V,H(&UA>" J('-I>F5O9B J;F5W
|
||||
M("D[#0H@(" @;F5W6V-N="LK72 ]("IA<F=V*RL[#0H@(" @9F]R("@@.R J
|
||||
M87)G=CL@*RMA<F=V("D@('L-"@EI9B H(&-N=" ^/2!M87@@*0T*"2 @("!N
|
||||
M97<@/2 H8VAA<B J*BER96%L;&]C*"!N97<L("AM87@J/3(I("H@<VEZ96]F
|
||||
M("IN97<@*3L-"@D@(" @#0H):68@*"!A<F=V6S!=6S!=("$]("= )R!\?"!A
|
||||
M8V-E<W,H87)G=ELP72LQ+# I("D@('L-"@D@(" @;F5W6V-N="LK72 ]("IA
|
||||
M<F=V.PT*"7T@96QS92R(B I.PT*"2 @("!I
|
||||
M9B H("%F("D@('L-"@D)<&5R<F]R*"!A<F=V6S!=*S$@*3L-"@D)97AI="@@
|
||||
M,B I.PT*"2 @("!]#0H)(" @('=H:6QE("@@9F=E=',H(&QI;F4L('-I>F5O
|
||||
M9B!L:6YE+"!F("D@*2 @>PT*"0EI;G0@;&5N(#T@<W1R;&5N*"!L:6YE("D[
|
||||
M#0H)"2\J(&1E;&5T92!T<F%I;&EN9R!N97=L:6YE<R J+PT*"0EW:&EL92 H
|
||||
M(&QI;F5;;&5N+3%=(#T]("=<;B<@?'P@;&EN95ML96XM,5T@/3T@)UQR)R I
|
||||
M#0H)"2 @("!L:6YE6RTM;&5N72 ]("=<,"<[#0H)"6EF("@@8VYT(#X](&UA
|
||||
M>" I#0H)"2 @("!N97<@/2 H8VAA<B J*BEX<F5A;&QO8R@@;F5W+" H;6%X
|
||||
M*CTR*2 J('-I>F5O9B J;F5W("D[#0H)"6YE=UMC;G1=(#T@*&-H87(@*BEX
|
||||
M;6%L;&]C*"!L96XK,2 I.PT*"0ES=')C<'DH(&YE=UMC;G1=+"!L:6YE("D[
|
||||
M#0H)"2LK8VYT.PT*"2 @("!]#0H)(" @(&9C;&]S92@@9B I.PT*"7T)#0H@
|
||||
M(" @?0T*(" @(&EF("@@8VYT(#X](&UA>" I#0H);F5W(#T@*&-H87(@*BHI
|
||||
M>')E86QL;V,H(&YE=RP@*&UA>"LQ*2 J('-I>F5O9B J;F5W("D[#0H@(" @
|
||||
M;F5W6V-N=%T@/2!.54Q,.PT*(" @("IA<F=C(#T@8VYT.PT*(" @(')E='5R
|
||||
M;B!N97<[#0I]#0H-"@T*8V]N<W0@8VAA<B J(%5304=%(#T@#0HB=7-A9V4Z
|
||||
M("1P<F]G;F%M92!;("UC3G9M5B!=(&9I;&4@6R!F:6QE("XN+B!=(&1E<W0M
|
||||
M9&ER96-T;W)Y+6]R+69I;&5<;B(-"B(@(" @(" @("UV(" @(" @(" @("TM
|
||||
M('9E<F)O<V5<;B(-"B(@(" @(" @("U6('-U9F9I>" @("TM('-U9F9I>"!T
|
||||
M;R!A<'!E;F0@=&\@=&%R9V5T<R H8F5F;W)E(&%N>2 N('-U9F9I>"E<;B(-
|
||||
M"B(@(" @(" @(" @(" @(" @(" @(" @("!E9SH@+58@7V<@=V]U;&0@8VAA
|
||||
M;F=E("=F;V\G('1O("=F;V]?9R<@86YD7&XB#0HB(" @(" @(" @(" @(" @
|
||||
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" G;&EB9F]O+F$G('1O
|
||||
M("=L:6)F;V]?9RYA)UQN(@T*(B @(" @(" @+6T@;6]D92 @(" @+2T@;6]D
|
||||
M92!F;W(@;F5W(&9I;&4H<RE<;B(-"B(@(" @(" @("UC(" @(" @(" @("TM
|
||||
M(&-O<'D@:6YS=&5A9"!O9B!M;W9E("AA;'=A>7,@;VXI7&XB#0HB(" @(" @
|
||||
M(" M3B @(" @(" @(" M+2!C;W!Y(&]N;'D@:68@<V]U<F-E(&ES(&YE=V5R
|
||||
M('1H86X@=&%R9V5T7&XB#0H[#0H-"G9O:60@9F%T86PH(&-H87(@*B!M<V<@
|
||||
M*0T*>PT*(" @(&EF("@@;7-G("D-"@EF<')I;G1F*"!S=&1E<G(L("(E<UQN
|
||||
M(BP@;7-G("D[#0H@(" @9G!R:6YT9B@@<W1D97)R+" B)7,B+"!54T%'12 I
|
||||
M.PT*(" @(&5X:70H(#$@*3L-"GT-"@T*8VAA<B J(&)A<V5N86UE*"!C:&%R
|
||||
M("H@9B I#0I[#0H@(" @8VAA<B J(&(@/2!S=')R8VAR*"!F+" G+R<@*3L-
|
||||
M"B @("!I9B H(&(@*0DK*V([#0H@(" @96QS90EB(#T@9CL-"B @("!R971U
|
||||
M<FX@8CL-"GT-"@T*(VEN8VQU9&4@/'-Y<R]S=&%T+F@^#0II;G0@:7-?9&ER
|
||||
M*"!C:&%R("H@<&%T:" I#0I[#0H@(" @<W1R=6-T('-T870@8G5F.PT*(" @
|
||||
M(&EF("@@<W1A="@@<&%T:"P@)F)U9B I("D-"@ER971U<FX@,#L-"B @("!R
|
||||
M971U<FX@8G5F+G-T7VUO9&4@)B!37TE&1$E2.PT*?0T*:6YT(&ES7V9I;&4H
|
||||
M(&-H87(@*B!P871H("D-"GL-"B @("!S=')U8W0@<W1A="!B=68[#0H@(" @
|
||||
M:68@*"!S=&%T*"!P871H+" F8G5F("D@*0T*"7)E='5R;B P.PT*(" @(')E
|
||||
M='5R;B!B=68N<W1?;6]D92 F(%-?249214<[#0I]#0II;G0@;F5W97(H(&-H
|
||||
M87(@*B!P,2P@8VAA<B J(' R("D-"GL-"B @("!S=')U8W0@<W1A="!B=68Q
|
||||
M.PT*(" @('-T<G5C="!S=&%T(&)U9C([#0H@(" @:68@*"!S=&%T*"!P,2P@
|
||||
M)F)U9C$@*2 I#0H)<F5T=7)N(# [#0H@(" @:68@*"!S=&%T*"!P,BP@)F)U
|
||||
M9C(@*2 I#0H)<F5T=7)N(# [#0H@(" @<F5T=7)N(&)U9C$N<W1?;71I;64@
|
||||
M/B!B=68R+G-T7VUT:6UE.PT*?0T*#0II;G0@9FEL96-O<'DH(&-H87(@*B!D
|
||||
M+"!C:&%R("H@<RP@:6YT('!R97-E<G9E7W1I;64@*0T*>PT*(VEF(# -"B @
|
||||
M("!I;G0)"7-T871U<SL-"B @("!C:&%R(" @(" @*B!A<F=V6R U(%T[#0H@
|
||||
M(" @87)G=ELP72 ](")C<"([#0H@(" @87)G=ELQ72 ]("(M<"([#0H@(" @
|
||||
M87)G=ELR72 ](',[#0H@(" @87)G=ELS72 ](&0[#0H@(" @87)G=ELT72 ]
|
||||
M($Y53$P[#0H@(" @<W1A='5S(#T@<W!A=VYV<"@@4%]704E4+"!A<F=V6S!=
|
||||
M+"!A<F=V("D[#0H@(" @:68@*"!S=&%T=7,@*0T*"7!E<G)O<B@@(F-P(B I
|
||||
M.PT*(" @(')E='5R;B!S=&%T=7,[#0HC96QS90T*(" @($9)3$4@(" @(" J
|
||||
M(&9S.PT*(" @($9)3$4@(" @(" J(&9D.PT*(" @(&-H87()8G5F9F5R6R X
|
||||
M,3DR(%T[#0H@(" @:6YT"0EN.PT*(" @('-T<G5C="!F=&EM90E7:&5N.PT*
|
||||
M(" @('-T<G5C="!S=&%T"0E3=&%T.PT*#0H@(" @9G,@/2!F;W!E;B@@<RP@
|
||||
M(G)B(B I.PT*(" @(&EF("@@9G,@/3T@3E5,3" I("![#0H)<&5R<F]R*"!S
|
||||
M("D[#0H)<F5T=7)N(#$[#0H@(" @?0T*(" @(&9D(#T@9F]P96XH(&0L(")W
|
||||
M8B(@*3L-"B @("!I9B H(&9D(#T]($Y53$P@*2 @>PT*"7!E<G)O<B@@9" I
|
||||
M.PT*"69C;&]S92@@9G,@*3L-"@ER971U<FX@,CL-"B @("!]#0H-"B @("!I
|
||||
M9B H('!R97-E<G9E7W1I;64@*0T*"6EF("@@9V5T9G1I;64H(&9I;&5N;RAF
|
||||
M<RDL("97:&5N("D@*2 @>PT*"2 @("!P97)R;W(H(',@*3L-"@D@(" @<')E
|
||||
M<V5R=F5?=&EM92 ](# [#0H)?0T*#0H@(" @9&\@>PT*"6X@/2!F<F5A9"@@
|
||||
M8G5F9F5R+" Q+"!S:7IE;V8@8G5F9F5R+"!F<R I.PT*"6EF("@@;B ^(# @
|
||||
M*0T*"2 @("!I9B H(&9W<FET92@@8G5F9F5R+" Q+"!N+"!F9" I(#P@," I
|
||||
M("![#0H)"7!E<G)O<B@@9" I.PT*"0ER971U<FX@,SL-"@D@(" @?0T*(" @
|
||||
M('T@=VAI;&4@*"!N(#X@," I.R @(" -"@T*(" @(&9C;&]S92@@9G,@*3L-
|
||||
M"@T*(" @("\J($9I>"!T:6UE('-T86UP("HO#0H@(" @:68@*"!P<F5S97)V
|
||||
M95]T:6UE("D-"@EI9B H('-E=&9T:6UE*"!F:6QE;F\H9F0I+" F5VAE;B I
|
||||
M("D@('L-"@D@(" @<&5R<F]R*"!S("D[#0H)(" @('!R97-E<G9E7W1I;64@
|
||||
M/2 P.PT*"7T-"B @("!F8VQO<V4H(&9D("D[#0H-"B @(" O*B!&:7@@86-C
|
||||
M97-S(')I9VAT<R J+PT*(" @(&EF("@@<W1A="@@<RP@)E-T870@*2 I#0H)
|
||||
M<&5R<F]R*"!S("D[#0H@(" @96QS92!I9B H(&-H;6]D*"!D+"!3=&%T+G-T
|
||||
M7VUO9&4@*2 I#0H)<&5R<F]R*"!D("D[#0H-"B @("!R971U<FX@,#L-"B-E
|
||||
M;F1I9@T*?0T*#0H-"@T*#0H-"FEN="!M86EN*"!I;G0@87)G8RP@8VAA<B J
|
||||
M(&%R9W9;72 I#0I[#0H@(" @8VAA<B J"7!R;V=N86UE.PT*(" @(&EN= D)
|
||||
M=F5R8F]S92 ](# [#0H@(" @:6YT"0EO;FQY7VEF7VYE=V5R/2 P.PT*(" @
|
||||
M(&-H87(@*@ES=69F:7@@(#T@3E5,3#L-"B @("!C:&%R("H);6]D90D]($Y5
|
||||
M3$P[#0H@(" @8VAA<B J( ED97-T.PT*(" @(&-H87(@*BH)<' [#0H-"B @
|
||||
M("!A<F=V(#T@87)G=E]F:7@H("9A<F=C+"!A<F=V("D[#0H-"B @("!P<F]G
|
||||
M;F%M92 ](&)A<V5N86UE*" J87)G=BLK("D[#0H-"B @(" O*B!P<F]C97-S
|
||||
M('1H92!O<'1I;VYS("HO#0H@(" @=VAI;&4@*"!A<F=V6S!=(" F)B @87)G
|
||||
M=ELP75LP72 ]/2 G+2<@*2 @>PT*"7-W:71C:" H(&%R9W9;,%U;,5T@*2 @
|
||||
M>PT*"2 @("!C87-E("=.)SH-"@D@(" @(" @("LK87)G=CL-"@D);VYL>5]I
|
||||
M9E]N97=E<B ](#$[#0H)"6)R96%K.PT*"2 @("!C87-E("=C)SH-"@D@(" @
|
||||
M(" @("LK87)G=CL-"@D)+RH@5V4@86QW87ES(&-O<'DL(')E9V%R9&QE<W,@
|
||||
M*B\-"@D)8G)E86L[#0H)(" @(&-A<V4@)W8G.@T*"0DK*V%R9W8[#0H)"79E
|
||||
M<F)O<V4@/2 Q.PT*"0EB<F5A:SL-"@D@(" @8V%S92 G5B<Z#0H)"2LK87)G
|
||||
M=CL-"@D)<W5F9FEX(#T@*F%R9W8[#0H)"2LK87)G=CL-"@D)8G)E86L[#0H)
|
||||
M(" @(&-A<V4@)VTG.@T*"0DK*V%R9W8[#0H)"6UO9&4@/2 J87)G=CL-"@D)
|
||||
M*RMA<F=V.PT*"0EB<F5A:SL-"@D@(" @9&5F875L=#H-"@D)9F%T86PH($Y5
|
||||
M3$P@*3L-"@E]#0H@(" @?0T*#0H@(" @+RH@4V5P87)A=&4@<V]U<F-E(&9I
|
||||
M;&4H<RD@9G)O;2!D97-T(&1I<F5C=&]R>2!O<B!F:6QE("HO#0HC:68@, T*
|
||||
M(" @(&EF("@@(6%R9W9;,%T@?'P@(6%R9W9;,5T@*0T*"69A=&%L*" B;6ES
|
||||
M<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*(V5L<V4-
|
||||
M"B @(" O*B!792!U<V5D('1O(')E<75I<F4@870@;&5A<W0@;VYE(&9I;&4[
|
||||
M(&YO="!A;GD@;6]R92 J+PT*(" @(&EF("@@(6%R9W9;,%T@*0T*"69A=&%L
|
||||
M*" B;6ES<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*
|
||||
M(" @(&EF("@@(6%R9W9;,5T@*0T*"7)E='5R;B P.PT*(V5N9&EF#0H@(" @
|
||||
M9F]R("@@<' @/2!A<F=V.R J<' [("LK<' @*0T*"6-O;G1I;G5E.PT*(" @
|
||||
M("TM<' [#0H@(" @9&5S=" ]("IP<#L-"B @(" J<' @/2!.54Q,.PT*#0H@
|
||||
M(" @+RH@4')O8V5S<R!T:&4@87)G=6UE;G1S("HO#0H@(" @9F]R("@[("IA
|
||||
M<F=V.R K*V%R9W8@*2 @>PT*"6-H87(@*B!F(#T@*F%R9W8[#0H)8VAA<B J
|
||||
M(&QE868@/2!B87-E;F%M92@@9B I.PT*"6-H87(@=&%R9V5T6R Q,C@@73L-
|
||||
M"@T*"7-T<F-P>2@@=&%R9V5T+"!D97-T("D[#0H-"@EI9B H(&ES7V1I<B@@
|
||||
M=&%R9V5T("D@*2 @>PT*"2 @("!S=')C870H('1A<F=E="P@(B\B("D[#0H)
|
||||
M(" @("\J(&EF('=E('=E<F4@9VEV96X@82!S=69F:7@L('1H96X@861D(&ET
|
||||
M(&%S(&%P<')O<')I871E("HO#0H)(" @(&EF("@@<W5F9FEX("D@('L-"@D)
|
||||
M8VAA<B J(&1O=" ]('-T<F-H<B@@;&5A9BP@)RXG("D[#0H)"6EF("@@9&]T
|
||||
M("D@('L-"@D)(" @('-T<FYC870H('1A<F=E="P@;&5A9BP@9&]T+6QE868@
|
||||
M*3L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!S=69F:7@@*3L-"@D)(" @('-T
|
||||
M<F-A="@@=&%R9V5T+"!D;W0@*3L-"@D)(" @(&EF("@@=F5R8F]S92 I#0H)
|
||||
M"0EP<FEN=&8H("(E<SH@)7,@=VEL;"!B92!I;G-T86QL960@87,@)7,B+ T*
|
||||
M"0D)(" @(" @('!R;V=N86UE+"!F+"!S=')R8VAR*'1A<F=E="PG+R<I*S$@
|
||||
M*3L-"@D)?2!E;'-E('L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!L96%F("D[
|
||||
M#0H)"2 @("!S=')C870H('1A<F=E="P@<W5F9FEX("D[#0H)"7T-"@D@(" @
|
||||
M?2!E;'-E('L-"@D)<W1R8V%T*"!T87)G970L(&QE868@*3L-"@D@(" @?0T*
|
||||
M"7T-"@T*"6EF("@@86-C97-S*"!F+" P("D@*2 @>PT*"2 @("!C:&%R(&)U
|
||||
M9ELR,#!=.PT*"2 @("!S<')I;G1F*"!B=68L(")C86YN;W0@<F5A9" E<R(L
|
||||
M(&8@*3L-"@D@(" @9F%T86PH(&)U9B I.PT*"7T-"@T*"6EF("@@;VYL>5]I
|
||||
M9E]N97=E<B F)B!I<U]F:6QE*"!T87)G970@*2 F)B A;F5W97(H(&8L('1A
|
||||
M<F=E=" I("D@('L-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<')I;G1F*" B
|
||||
M)R5S)R!N;W0@;F5W97(@=&AA;B G)7,G7&XB+"!F+"!T87)G970@*3L-"@D@
|
||||
M(" @8V]N=&EN=64[#0H)?0T*#0H):68@*"!V97)B;W-E("D-"@D@(" @<')I
|
||||
M;G1F*" B<FT@+68@)7-<;B(L('1A<F=E=" I.PT*"6EF("@@8VAM;V0H('1A
|
||||
M<F=E="P@,#<W-R I("D-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<&5R<F]R
|
||||
M*"!T87)G970@*3L-"@EI9B H('5N;&EN:R@@=&%R9V5T("D@*0T*"2 @("!I
|
||||
M9B H('9E<F)O<V4@*0T*"0EP97)R;W(H('1A<F=E=" I.PT*"6EF("@@=F5R
|
||||
M8F]S92 I#0H)(" @('!R:6YT9B@@(F-P("UP("5S("5S7&XB+"!F+"!T87)G
|
||||
M970@*3L-"@EI9B H(&9I;&5C;W!Y*"!T87)G970L(&8L(#$@*2 I#0H)(" @
|
||||
M(')E='5R;B Q.PT*"6EF("@@;6]D92 I("![#0H)(" @(&-H87(@8G5F6R R
|
||||
M-34@73L-"@D@(" @<W!R:6YT9B@@8G5F+" B8VAM;V0@)7,@)7-<;B(L(&UO
|
||||
M9&4L('1A<F=E=" I.PT*"2 @("!I9B H('9E<F)O<V4@*0T*"0EP<FEN=&8H
|
||||
M("(E<UQN(BP@8G5F("D[#0H)(" @('-Y<W1E;2@@8G5F("D[#0H)?0T*(" @
|
||||
:('T-"@T*(" @(')E='5R;B P.PT*?0T*#0IE
|
||||
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Misc. support tools for RTEMS workspaces.
|
||||
More will be added later as they are converted from Teamware
|
||||
to CVS.
|
||||
|
||||
install-if-change
|
||||
Smart install script that also can append suffixes as it
|
||||
installs (suffixes used for debug and profile variants).
|
||||
Requires bash or ksh.
|
||||
|
||||
rcs-clean
|
||||
deletes all files from the current directory that can be
|
||||
re-created from RCS. Careful to not delete locked files.
|
||||
May be used by 'gmake clobber'
|
||||
|
||||
lock-directory
|
||||
unlock-directory
|
||||
traverse a directory structure making it unwritable.
|
||||
Useful to keep people from accidentally overwriting
|
||||
"released" trees if they get confused about which
|
||||
module they have loaded.
|
||||
|
||||
rtems-glom
|
||||
glom together all the rtems libraries in order to simplify
|
||||
the link line used by applications.
|
||||
Produces rtems.rel.
|
||||
Not used by the RTEMS src tree at all.
|
||||
Strictly optional.
|
||||
|
||||
@@ -1,364 +0,0 @@
|
||||
/*
|
||||
* cklength - check the length of lines in a file
|
||||
*
|
||||
* This program check to see if the files passed to it on the command line
|
||||
* contain a line which exceeds the maximum allowable length. The default
|
||||
* maximum line length is 80.
|
||||
*
|
||||
* usage: cklength [ -v ] [ arg ... ] files...
|
||||
* -l length -- maximum line length
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "l:nNv"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-l length -- maximum line length\n\
|
||||
-n -- report line numbers for offending lines\n\
|
||||
-N -- report line numbers and length for offending lines\n\
|
||||
-v -- verbose\n\
|
||||
\n\
|
||||
Print the name of files which have at least 1 line which exceeds the\n\
|
||||
maximum line length. The default maximum line length is 80.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int report_line_numbers = FALSE; /* report line numbers of offenders */
|
||||
int report_line_length = FALSE; /* report line length of offenders */
|
||||
|
||||
int line_length = 80; /* maximum allowable line length */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
extern int errno;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int
|
||||
main(int argc, char **argv, char **env)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'l': /* line length */
|
||||
line_length = atoi( optarg );
|
||||
if ( line_length < 0 || line_length > BUFFER_SIZE )
|
||||
error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
|
||||
break;
|
||||
|
||||
case 'n': /* toggle report_line_numbers */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
break;
|
||||
|
||||
case 'N': /* toggle both reports */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
report_line_length = ! report_line_length;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int line_number;
|
||||
int length;
|
||||
int count;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
count = 0;
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( length <= line_length )
|
||||
continue;
|
||||
|
||||
if ( count == 0 ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
if ( !report_line_numbers )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
|
||||
|
||||
if ( report_line_numbers ) {
|
||||
if ( report_line_length )
|
||||
fprintf( stderr, "%d: %d\n" , line_number, length );
|
||||
else
|
||||
fprintf( stderr, "%d\n" , line_number );
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
if ((local_errno > 0) && (local_errno < sys_nerr))
|
||||
(void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
|
||||
else
|
||||
(void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,351 +0,0 @@
|
||||
/*
|
||||
* eolstrip - strip white space from end of lines
|
||||
*
|
||||
* This program strips the white space from the end of every line in the
|
||||
* specified program.
|
||||
*
|
||||
* usage: eolstrip [ -v ] [ arg ... ] files...
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "vt"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-v -- verbose\n\
|
||||
-t -- test only .. DO NOT OVERWRITE FILE!!!\n\
|
||||
\n\
|
||||
Strip the white space from the end of every line on the list of files.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define BUFFER_SIZE 2048
|
||||
#define MAX_PATH 2048
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int test_only = FALSE; /* test only */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
extern int errno;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int
|
||||
main(int argc, char **argv, char **env)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 't': /* toggle test only mode */
|
||||
test_only = ! test_only;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
FILE *out = (FILE *) 0;
|
||||
char outname[ MAX_PATH ];
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int length;
|
||||
int line_number;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
if ( !test_only ) {
|
||||
sprintf( outname, "%s.eoltmp", arg );
|
||||
|
||||
out = fopen( outname, "w" );
|
||||
if (!out)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "Processing %s\n", arg );
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( buffer[ length ] != '\n' )
|
||||
error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
|
||||
|
||||
while ( isspace( buffer[ length ] ) )
|
||||
buffer[ length-- ] = '\0';
|
||||
|
||||
if ( test_only ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf( out, "%s\n", buffer );
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
if ( !test_only ) {
|
||||
fclose( out );
|
||||
rename( outname, arg );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
if ((local_errno > 0) && (local_errno < sys_nerr))
|
||||
(void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
|
||||
else
|
||||
(void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,513 +0,0 @@
|
||||
|
||||
/***** P A C K H E X . C ************************************************
|
||||
*
|
||||
* Packhex is a hex-file compaction utility. It attempts to concatenate
|
||||
* hex records to produce more size-efficient packaging.
|
||||
*
|
||||
* Limitations: Input files must be correctly formatted. This utility
|
||||
* is not robust enough to detect hex-record formatting
|
||||
* errors.
|
||||
*
|
||||
* Published: 5/93 Embedded Systems magazine
|
||||
*
|
||||
* Compiler: Microsoft C 6.0
|
||||
* cl /F 1000 packhex.c
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/* #define SMALLER_RECORDS */
|
||||
#ifdef SMALLER_RECORDS
|
||||
#define MAX_LEN_S1_RECS 128
|
||||
#define MAX_LEN_S2_RECS 128
|
||||
#define MAX_LEN_S3_RECS 128
|
||||
#else
|
||||
#define MAX_LEN_S1_RECS 252
|
||||
#define MAX_LEN_S2_RECS 251
|
||||
#define MAX_LEN_S3_RECS 250
|
||||
#endif
|
||||
|
||||
|
||||
/*--------------------------------- includes ---------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__unix__) && !defined(EXIT_FAILURE)
|
||||
#define EXIT_FAILURE -1
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
|
||||
/*--------------------------------- defines ----------------------------------*/
|
||||
|
||||
#define YES 1
|
||||
#define MAX_LINE_SIZE 600
|
||||
#define EOS '\0'
|
||||
|
||||
|
||||
/*---------------------------------- macros ----------------------------------*/
|
||||
|
||||
/* Convert ASCII hexadecimal digit to value. */
|
||||
|
||||
#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
|
||||
|
||||
|
||||
/*--------------------------------- typedefs ---------------------------------*/
|
||||
|
||||
typedef unsigned char Boolean;
|
||||
typedef unsigned char Uchar;
|
||||
typedef unsigned int Uint;
|
||||
typedef unsigned long Ulong;
|
||||
|
||||
typedef struct /* Functions and constant returning Hex-record vital stats. */
|
||||
{
|
||||
Boolean ( *is_data_record )( char * );
|
||||
Ulong ( *get_address )( char * );
|
||||
Uint ( *get_data_count )( char * );
|
||||
const Uint max_data_count;
|
||||
char *( *get_data_start )( char * );
|
||||
void ( *put_data_record )( Uint, Ulong, char * );
|
||||
} Rec_vitals;
|
||||
|
||||
|
||||
/*--------------------------- function prototypes ----------------------------*/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char * );
|
||||
Ulong get_ndigit_hex( char *, int );
|
||||
|
||||
|
||||
/*----------------------------- Intel Hex format -----------------------------*/
|
||||
|
||||
/*
|
||||
* Intel Hex data-record layout
|
||||
*
|
||||
* :aabbbbccd...dee
|
||||
*
|
||||
* : - header character
|
||||
* aa - record data byte count, a 2-digit hex value
|
||||
* bbbb - record address, a 4-digit hex value
|
||||
* cc - record type, a 2-digit hex value:
|
||||
* "00" is a data record
|
||||
* "01" is an end-of-data record
|
||||
* "02" is an extended-address record
|
||||
* "03" is a start record
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 2's complement
|
||||
* [ (sum of bytes: aabbbbccd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
|
||||
Boolean is_intel_data_rec( char * rec_str )
|
||||
{
|
||||
return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
|
||||
}
|
||||
|
||||
Uint get_intel_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
|
||||
}
|
||||
|
||||
Ulong get_intel_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 3, 4 ) );
|
||||
}
|
||||
|
||||
char * get_intel_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 9 );
|
||||
}
|
||||
|
||||
void put_intel_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals intel_hex =
|
||||
{
|
||||
is_intel_data_rec,
|
||||
get_intel_rec_address,
|
||||
get_intel_rec_data_count,
|
||||
255, /* Maximum data bytes in a record. */
|
||||
get_intel_rec_data_start,
|
||||
put_intel_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S1-record format ------------------------*/
|
||||
|
||||
/*
|
||||
* Motorola S-record data-record layout
|
||||
*
|
||||
* Sabbc...cd...dee
|
||||
*
|
||||
* S - header character
|
||||
* a - record type, a 1-digit value:
|
||||
* "0" is a header record
|
||||
* "1" is a 2-byte-address data record
|
||||
* "2" is a 3-byte-address data record
|
||||
* "3" is a 4-byte-address data record
|
||||
* "7" is a 4-byte-address end-of-data record
|
||||
* "8" is a 3-byte-address end-of-data record
|
||||
* "9" is a 2-byte-address end-of-data record
|
||||
* bb - record length in bytes, a 2-digit hex value
|
||||
* (record length doesn't count the header/type
|
||||
* chars and checksum byte)
|
||||
* c...c - record address, a 4-, 6-, or 8-digit value,
|
||||
* depending on record type
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 1's complement
|
||||
* [ (sum of all bytes: bbc..cd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
#define S1_COUNT_OFFSET 3
|
||||
|
||||
|
||||
Boolean is_moto_s1_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s1_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s1_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 4 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s1_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 8 );
|
||||
}
|
||||
|
||||
void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S1_COUNT_OFFSET + count +
|
||||
( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S1%02X%04lX%s%02X\n",
|
||||
count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s1_rec =
|
||||
{
|
||||
is_moto_s1_data_rec,
|
||||
get_moto_s1_rec_address,
|
||||
get_moto_s1_rec_data_count,
|
||||
MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s1_rec_data_start,
|
||||
put_moto_s1_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S2-record format ------------------------*/
|
||||
|
||||
#define S2_COUNT_OFFSET 4
|
||||
|
||||
Boolean is_moto_s2_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s2_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s2_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 6 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s2_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 10 );
|
||||
}
|
||||
|
||||
void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S2%02X%06lX%s%02X\n",
|
||||
count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s2_rec =
|
||||
{
|
||||
is_moto_s2_data_rec,
|
||||
get_moto_s2_rec_address,
|
||||
get_moto_s2_rec_data_count,
|
||||
MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s2_rec_data_start,
|
||||
put_moto_s2_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S3-record format ------------------------*/
|
||||
|
||||
#define S3_COUNT_OFFSET 5
|
||||
|
||||
Boolean is_moto_s3_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s3_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s3_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 8 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s3_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 12 );
|
||||
}
|
||||
|
||||
void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
|
||||
( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S3%02X%08lX%s%02X\n",
|
||||
count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s3_rec =
|
||||
{
|
||||
is_moto_s3_data_rec,
|
||||
get_moto_s3_rec_address,
|
||||
get_moto_s3_rec_data_count,
|
||||
MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s3_rec_data_start,
|
||||
put_moto_s3_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*-------------------- Put your favorite hex format here ---------------------*/
|
||||
|
||||
/*
|
||||
* * * * The following is a template for an additional hex format: * * *
|
||||
*
|
||||
*
|
||||
* Boolean is_X_data_rec( char * rec_str ) {}
|
||||
*
|
||||
* Uint get_X_rec_data_count( char * rec_str ) {}
|
||||
*
|
||||
* Ulong get_X_rec_address( char * rec_str ) {}
|
||||
*
|
||||
* char * get_X_rec_data_start( char * rec_str ) {}
|
||||
*
|
||||
* void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
|
||||
*
|
||||
* Rec_vitals X_rec =
|
||||
* {
|
||||
* is_X_data_rec,
|
||||
* get_X_rec_address,
|
||||
* get_X_rec_data_count,
|
||||
* MAXIMUM DATA BYTES IN A RECORD,
|
||||
* get_X_rec_data_start,
|
||||
* put_X_data_rec
|
||||
* };
|
||||
*
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
* Put address of additional Rec_vitals structures
|
||||
* in this array, before the NULL entry.
|
||||
*/
|
||||
|
||||
Rec_vitals *formats[] =
|
||||
{
|
||||
&intel_hex,
|
||||
&motorola_s1_rec,
|
||||
&motorola_s2_rec,
|
||||
&motorola_s3_rec,
|
||||
( Rec_vitals * ) NULL
|
||||
};
|
||||
|
||||
|
||||
/**** main *****************************************************************
|
||||
*
|
||||
*
|
||||
* Expects: Nothing (no command-line parameters).
|
||||
*
|
||||
* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
|
||||
*
|
||||
* Reads hex records on the standard input and attempts to
|
||||
* splice adjacent data fields together. Results appear on
|
||||
* the standard output.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
void main( void )
|
||||
{
|
||||
|
||||
char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
|
||||
char *in_dptr, *out_dptr;
|
||||
int d_total, d_count, d_excess, n;
|
||||
Ulong in_rec_addr, out_rec_addr = 0;
|
||||
Rec_vitals *rptr;
|
||||
|
||||
|
||||
/* Sift through file until first hex record is identified. */
|
||||
if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL )
|
||||
{
|
||||
fputs( "No hex records found.\n", stderr );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
||||
/* Attempt data-record splicing until end-of-file is reached. */
|
||||
d_total = 0;
|
||||
do
|
||||
{
|
||||
if ( rptr->is_data_record( inbuff ) == YES )
|
||||
{ /* Input record is a data record. */
|
||||
d_count = rptr->get_data_count( inbuff );
|
||||
in_rec_addr = rptr->get_address( inbuff );
|
||||
in_dptr = rptr->get_data_start( inbuff );
|
||||
|
||||
if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
|
||||
{ /* Begin a new output record. */
|
||||
if ( d_total != 0 )
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_count;
|
||||
out_rec_addr = in_rec_addr;
|
||||
}
|
||||
else if
|
||||
( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
|
||||
{ /* Output a maximum-length record, then start a new record. */
|
||||
strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
|
||||
rptr->put_data_record(
|
||||
rptr->max_data_count, out_rec_addr, outbuff
|
||||
);
|
||||
in_dptr += 2 * ( d_count - d_excess );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_excess;
|
||||
out_rec_addr += rptr->max_data_count;
|
||||
}
|
||||
else
|
||||
{ /* Append input record's data field with accumulated data. */
|
||||
out_dptr = outbuff + ( 2 * d_total );
|
||||
d_total += n = d_count;
|
||||
}
|
||||
strncpy( out_dptr, in_dptr, 2 * n );
|
||||
out_dptr[ 2 * n ] = EOS;
|
||||
}
|
||||
else
|
||||
{ /* Not a data record;
|
||||
* flush accumulated data then echo non-data record.
|
||||
*/
|
||||
if ( d_total != 0 )
|
||||
{
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
d_total = 0;
|
||||
}
|
||||
puts( inbuff );
|
||||
}
|
||||
} while ( gets( inbuff ) != NULL );
|
||||
|
||||
|
||||
exit( EXIT_SUCCESS );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**** identify_first_data_record *******************************************
|
||||
*
|
||||
* Expects: Pointer to hex-record line buffer.
|
||||
*
|
||||
* Returns: Pointer to hex-record structure (NULL if no match found).
|
||||
*
|
||||
* Reads the standard input, line by line, searching for a valid
|
||||
* record header character. If a valid header is found, a pointer
|
||||
* to the hex-record's type structure is returned, otherwise NULL.
|
||||
*
|
||||
* The input-stream pointer is left pointing to the first valid hex record.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char * buff_ptr )
|
||||
{
|
||||
Rec_vitals ** ptr;
|
||||
|
||||
while ( gets( buff_ptr ) != NULL )
|
||||
{
|
||||
for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
|
||||
if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
|
||||
return( *ptr ); /* Successful return. */
|
||||
|
||||
puts( buff_ptr ); /* Echo non-hex-record line. */
|
||||
}
|
||||
|
||||
return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
|
||||
}
|
||||
|
||||
|
||||
/**** get_ndigit_hex *******************************************************
|
||||
*
|
||||
* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
|
||||
*
|
||||
* Returns: Value of hexadecimal string as an unsigned long.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Ulong get_ndigit_hex( char * cptr, int digits )
|
||||
{
|
||||
Ulong value;
|
||||
|
||||
for ( value = 0 ; --digits >= 0 ; cptr++ )
|
||||
value = ( value * 16L ) + HEX_DIGIT( *cptr );
|
||||
|
||||
return( value );
|
||||
}
|
||||
@@ -1,725 +0,0 @@
|
||||
/*
|
||||
* unhex
|
||||
* convert a hex file to binary equivalent. If more than one file name
|
||||
* is given, then the output will be logically concatenated together.
|
||||
* stdin and stdout are defaults. Verbose will enable checksum output.
|
||||
*
|
||||
* Supported input formats are Intel hex, Motorola S records, and TI 'B'
|
||||
* records.
|
||||
*
|
||||
* Intel hex input format is
|
||||
* Byte
|
||||
* 1 Colon :
|
||||
* 2..3 Record length, eg: "20"
|
||||
* 4..7 load address nibbles
|
||||
* 8..9 record type: "00" (data) or "02" base addr
|
||||
* 10..x data bytes in ascii-hex
|
||||
* x+1..x+2 cksum (2's compl of (len+addr+data))
|
||||
* x+3 \n -- newline
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
char *USAGE = "\
|
||||
usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
|
||||
-v -- verbose\n\
|
||||
-a base -- 1st byte of output corresponds to this address\n\
|
||||
-l -- linear, just writes data out\n\
|
||||
-o file -- output file; must not be input file\n\
|
||||
-F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
|
||||
up to \"k_bits\" * 1024 bits\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define OK 0
|
||||
#define FAILURE (-1)
|
||||
#define Failed(x) ((x) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
typedef char bool;
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* Pick out designated bytes
|
||||
*/
|
||||
|
||||
#define B0(x) ((x) & 0xff)
|
||||
#define B1(x) B0((x) >> 8)
|
||||
#define B2(x) B0((x) >> 16)
|
||||
#define B3(x) B0((x) >> 24)
|
||||
|
||||
typedef struct buffer_rec {
|
||||
u32 dl_destaddr;
|
||||
u32 dl_jumpaddr;
|
||||
int dl_count;
|
||||
u8 dl_buf[512];
|
||||
} buffer_rec;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
bool verbose = FALSE; /* be verbose */
|
||||
bool linear = FALSE; /* just write out linear data */
|
||||
char *outfilename = "-"; /* default output is stdout */
|
||||
u32 base = 0L; /* base address */
|
||||
u32 FFfill = 0L; /* how far to fill w 0xFF's */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind;
|
||||
extern int errno;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
void error(int errn, ...);
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#if (defined(sparc) && (sunos < 500))
|
||||
#define stol(p) strtol(p, (char **) NULL, 0) /* Sunos */
|
||||
#else
|
||||
#define stol(p) strtoul(p, (char **) NULL, 0) /* Solaris */
|
||||
#endif
|
||||
|
||||
int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
void write_record(buffer_rec *tb, FILE *fp);
|
||||
int getnibble(char **p);
|
||||
int getbyte(char **p);
|
||||
long getNbytes(char **p, int n);
|
||||
void badformat(char *s, char *fname, char *msg);
|
||||
|
||||
#define get1bytes(p) ((int) getbyte(p))
|
||||
#define get2bytes(p) ((int) getNbytes(p, 2))
|
||||
#define get3bytes(p) getNbytes(p, 3)
|
||||
#define get4bytes(p) getNbytes(p, 4)
|
||||
|
||||
char *BADADDR = "Invalid record address";
|
||||
char *BADLEN = "Invalid record length";
|
||||
char *BADBASE = "Bad base or starting address";
|
||||
char *BADFMT = "Unrecognized record type";
|
||||
char *BADDATA = "Invalid data byte";
|
||||
char *BADCSUM = "Invalid checksum";
|
||||
char *MISCSUM = "Checksum mismatch";
|
||||
char *BADTYPE = "Unrecognized record type";
|
||||
char *MISTYPE = "Incompatible record types";
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
register int c;
|
||||
bool showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
FILE *outfp, *infp;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
progname = argv[0];
|
||||
while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'a': /* base address */
|
||||
base = stol(optarg);
|
||||
break;
|
||||
|
||||
case 'l': /* linear output */
|
||||
linear = TRUE;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case 'o': /* output file */
|
||||
outfilename = optarg;
|
||||
break;
|
||||
|
||||
case 'F': /* 0xFF fill amount (bytes) */
|
||||
FFfill = stol(optarg) * 1024L / 8L;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (linear && (base != 0))
|
||||
{
|
||||
error(0, "-l and -a may not be specified in combination");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (STREQ(outfilename, "-"))
|
||||
{
|
||||
outfp = stdout;
|
||||
outfilename = "stdout";
|
||||
}
|
||||
else
|
||||
if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for output", outfilename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now process the input files (or stdin, if none specified)
|
||||
*/
|
||||
|
||||
if (argv[optind] == (char *) NULL) /* just stdin */
|
||||
exit(unhex(stdin, "stdin", outfp, outfilename));
|
||||
else
|
||||
for (; (optarg = argv[optind]); optind++)
|
||||
{
|
||||
if (STREQ(optarg, "-"))
|
||||
rc += unhex(stdin, "stdin", outfp, outfilename);
|
||||
else
|
||||
{
|
||||
if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for input", optarg);
|
||||
exit(1);
|
||||
}
|
||||
rc += unhex(infp, optarg, outfp, outfilename);
|
||||
}
|
||||
}
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
u16 filesum;
|
||||
|
||||
int
|
||||
unhex(FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
int c;
|
||||
|
||||
filesum = 0;
|
||||
|
||||
/*
|
||||
* Make sure holes will be filled with 0xFF's if requested. We
|
||||
* do this the easy way by just filling the file with FF's before
|
||||
* getting started. To do it more optimally would be quite a bit
|
||||
* more difficult since the user can skip around as much as he/she
|
||||
* likes in the input hex file addressing.
|
||||
*
|
||||
* We'll clean this up later (after this program has run) with
|
||||
* 'stripffs'
|
||||
*/
|
||||
|
||||
if (FFfill)
|
||||
{
|
||||
(void) fseek(ofp, 0, 0);
|
||||
for (c = FFfill; c > 0; c--)
|
||||
(void) fputc(0xFF, ofp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the first char from file and determine record types
|
||||
*/
|
||||
|
||||
if ((c = getc(ifp)) != EOF)
|
||||
{
|
||||
ungetc(c, ifp);
|
||||
switch(c)
|
||||
{
|
||||
case 'S':
|
||||
convert_S_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
convert_Intel_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case '9':
|
||||
case 'B':
|
||||
convert_TI_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char tmp[2];
|
||||
tmp[0] = c; tmp[1] = 0;
|
||||
badformat(tmp, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_Intel_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int rectype; /* record type */
|
||||
int len; /* data length of current line */
|
||||
u32 addr;
|
||||
u32 base_address = 0;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != ':')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
|
||||
if ((addr = get2bytes(&p)) == -1L) /* record addr */
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
rectype = getbyte(&p);
|
||||
|
||||
cksum = len + B0(addr) + B1(addr) + rectype;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* normal data record */
|
||||
tb.dl_destaddr = base_address + addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x01: /* execution start address */
|
||||
base_address = addr;
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
case 0x02: /* new base */
|
||||
if ((base_address = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADBASE);
|
||||
cksum += B0(base_address) + B1(base_address);
|
||||
base_address <<= 4;
|
||||
break;
|
||||
|
||||
case 0x03: /* seg/off execution start address */
|
||||
{
|
||||
u32 seg, off;
|
||||
|
||||
seg = get2bytes(&p);
|
||||
off = get2bytes(&p);
|
||||
if ((seg == -1L) || (off == -1L))
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
|
||||
|
||||
tb.dl_jumpaddr = (seg << 4) + off;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
error(0, "unknown Intel-hex record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (-cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_S_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int len; /* data length of current line */
|
||||
int rectype; /* record type */
|
||||
u32 addr;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != 'S')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((rectype = getnibble(&p)) == -1) /* record type */
|
||||
badformat(buff, inm, BADTYPE);
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
cksum = len;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* comment field, ignored */
|
||||
goto write_it;
|
||||
|
||||
case 0x01: /* data record, 16 bit addr */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 3;
|
||||
goto doit;
|
||||
|
||||
case 0x02: /* ... 24 bit addr */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 4;
|
||||
goto doit;
|
||||
|
||||
case 0x03: /* ... 32 bit addr */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 5;
|
||||
doit:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
|
||||
tb.dl_destaddr = addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x07: /* 32 bit end record */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x08: /* 24 bit end record */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x09: /* 16 bit end record */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
end_rec:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
tb.dl_jumpaddr = addr;
|
||||
break;
|
||||
|
||||
default:
|
||||
error(0, "unknown Motorola-S record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (~cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
write_it:
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_TI_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
int c;
|
||||
bool endrecord = FALSE;
|
||||
bool eol;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
p = &buff[0];
|
||||
eol = FALSE;
|
||||
while ( ! eol && ! endrecord)
|
||||
{
|
||||
switch (*p++)
|
||||
{
|
||||
case '9':
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
tb.dl_destaddr = get2bytes(&p);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
eol = TRUE;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
badformat(p, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
write_record(buffer_rec *tb,
|
||||
FILE *fp)
|
||||
{
|
||||
if ( ! linear)
|
||||
{
|
||||
if (tb->dl_destaddr < base)
|
||||
error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
|
||||
tb->dl_destaddr, base);
|
||||
(void) fseek(fp, tb->dl_destaddr - base, 0);
|
||||
}
|
||||
|
||||
(void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
|
||||
tb->dl_destaddr += tb->dl_count;
|
||||
tb->dl_count = 0;
|
||||
}
|
||||
|
||||
int
|
||||
getnibble(char **p)
|
||||
{
|
||||
register int val;
|
||||
|
||||
**p = toupper(**p);
|
||||
switch (**p)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
val = **p - '0';
|
||||
break;
|
||||
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
val = 10 + (**p - 'A');
|
||||
break;
|
||||
|
||||
default:
|
||||
return(-1);
|
||||
}
|
||||
*p += 1;
|
||||
|
||||
return(val & 0x0f);
|
||||
}
|
||||
|
||||
int
|
||||
getbyte(char **p)
|
||||
{
|
||||
int n0, n1;
|
||||
|
||||
if ((n0 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
if ((n1 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
|
||||
return(((n0 << 4) + n1) & 0xff);
|
||||
}
|
||||
|
||||
long
|
||||
getNbytes(char **p,
|
||||
int n)
|
||||
{
|
||||
int t;
|
||||
u32 val = 0;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
if ((t = getbyte(p)) == -1)
|
||||
return(-1L);
|
||||
val <<= 8;
|
||||
val += t;
|
||||
}
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
void
|
||||
badformat(char *s,
|
||||
char *fname,
|
||||
char *msg)
|
||||
{
|
||||
if (s[strlen(s)-1] == '\n') /* get rid of newline */
|
||||
s[strlen(s)-1] = '\0';
|
||||
error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_EXIT bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
if ((local_errno > 0) && (local_errno < sys_nerr))
|
||||
(void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
|
||||
else
|
||||
(void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
c/src/README
27
c/src/README
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
This is the top level directory of the C RTEMS environment. The
|
||||
following is a description of the contents of each file and
|
||||
subdirectory directly in this directory:
|
||||
|
||||
tests
|
||||
|
||||
This directory contains the RTEMS Test Suites. Currently
|
||||
this includes the following suites:
|
||||
|
||||
+ Single Processor Test Suite
|
||||
+ Multiprocessor Test Suite
|
||||
+ Timing Test Suite
|
||||
+ Sample Application Suite
|
||||
|
||||
lib
|
||||
|
||||
This directory contains src for RTEMS libraries:
|
||||
libc, board support (including drivers) and libcpu.
|
||||
|
||||
exec
|
||||
|
||||
This directory contains the source code for the RTEMS executive.
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/* aio.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_ASYNCHRONOUS_IO_h
|
||||
#define __POSIX_ASYNCHRONOUS_IO_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_ASYNCHRONOUS_IO)
|
||||
|
||||
/*
|
||||
* 6.7.1 Data Definitions for Asynchronous Input and Output,
|
||||
* P1003.1b-1993, p. 151
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/*
|
||||
* 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
|
||||
*/
|
||||
|
||||
#define AIO_CANCELED 0 /* all requested operations have been canceled */
|
||||
#define AIO_NOTCANCELED 0 /* some of the operations could not be canceled */
|
||||
/* since they are in progress */
|
||||
#define AIO_ALLDONE 0 /* none of the requested operations could be */
|
||||
/* canceled since they are already complete */
|
||||
|
||||
/* lio_listio() options */
|
||||
|
||||
#define LIO_WAIT 0 /* calling process is to suspend until the */
|
||||
/* operation is complete */
|
||||
#define LIO_NOWAIT 0 /* calling process is to continue execution while */
|
||||
/* the operation is performed and no notification */
|
||||
/* shall be given when the operation is completed */
|
||||
#define LIO_READ 0 /* request a read() */
|
||||
#define LIO_WRITE 0 /* request a write() */
|
||||
#define LIO_NOP 0 /* no transfer is requested */
|
||||
|
||||
/*
|
||||
* 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
|
||||
*/
|
||||
|
||||
struct aiocb {
|
||||
int aio_fildes; /* File descriptor */
|
||||
off_t aio_offset; /* File offset */
|
||||
volatile void *aio_buf; /* Location of buffer */
|
||||
size_t aio_nbytes; /* Length of transfer */
|
||||
int aio_reqprio; /* Request priority offset */
|
||||
struct sigevent aio_sigevent; /* Signal number and value */
|
||||
int aoi_lio_opcode; /* Operation to be performed */
|
||||
};
|
||||
|
||||
/*
|
||||
* 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
|
||||
*/
|
||||
|
||||
int aio_read(
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
|
||||
*/
|
||||
|
||||
int aio_write(
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
|
||||
*/
|
||||
|
||||
int lio_listio(
|
||||
int mode,
|
||||
struct aiocb * const list[],
|
||||
int nent,
|
||||
struct sigevent *sig
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
|
||||
*/
|
||||
|
||||
int aio_error(
|
||||
const struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
|
||||
* P1003.1b-1993, p. 162
|
||||
*/
|
||||
|
||||
int aio_return(
|
||||
const struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
|
||||
*/
|
||||
|
||||
int aio_cancel(
|
||||
int filedes,
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
|
||||
*/
|
||||
|
||||
int aio_suspend(
|
||||
struct aiocb * const list[],
|
||||
int nent,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#if defined(_POSIX_SYNCHRONIZED_IO)
|
||||
|
||||
/*
|
||||
* 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
|
||||
*/
|
||||
|
||||
int aio_fsync(
|
||||
int op,
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
#endif /* _POSIX_SYNCHRONIZED_IO */
|
||||
|
||||
#endif /* _POSIX_ASYNCHRONOUS_IO */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,30 +0,0 @@
|
||||
/* devctl.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_DEVICE_CONTROL_h
|
||||
#define __POSIX_DEVICE_CONTROL_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_DEVICE_CONTROL)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* 21.2.1 Control a Device, P1003.4b/D8, p. 65
|
||||
*/
|
||||
|
||||
int devctl(
|
||||
int filedes,
|
||||
void *dev_data_ptr,
|
||||
size_t nbyte,
|
||||
int *dev_info_ptr
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,72 +0,0 @@
|
||||
/* intr.h
|
||||
*
|
||||
* XXX: It is unclear if the type "intr_t" should be defined when
|
||||
* _POSIX_INTERRUPT_CONTROL is not.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_INTERRUPTS_h
|
||||
#define __POSIX_INTERRUPTS_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined(_POSIX_INTERRUPT_CONTROL)
|
||||
|
||||
/*
|
||||
* 22.2 Concepts, P1003.4b/D8, p. 73
|
||||
*/
|
||||
|
||||
typedef int intr_t;
|
||||
|
||||
/*
|
||||
* 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
|
||||
*/
|
||||
|
||||
/*
|
||||
* Return codes from an interrupt handler
|
||||
*/
|
||||
|
||||
#define INTR_HANDLED_NOTIFY 0 /* ISR handled this interrupt, notify */
|
||||
/* the thread that registered the */
|
||||
/* ISR that the interrupt occurred. */
|
||||
#define INTR_HANDLED_DO_NOT_NOTIFY 1 /* ISR handled this interrupt, but */
|
||||
/* do NOT perform notification. */
|
||||
#define INTR_NOT_HANDLED 2 /* ISR did not handle this interrupt, */
|
||||
/* let the next handler try. */
|
||||
|
||||
int intr_capture(
|
||||
intr_t intr,
|
||||
int (*intr_handler)( void *area ),
|
||||
volatile void *area,
|
||||
size_t areasize
|
||||
);
|
||||
|
||||
int intr_release(
|
||||
intr_t intr,
|
||||
int (*intr_handler)( void *area )
|
||||
);
|
||||
|
||||
int intr_lock(
|
||||
intr_t intr
|
||||
);
|
||||
|
||||
int intr_unlock(
|
||||
intr_t intr
|
||||
);
|
||||
|
||||
/*
|
||||
* 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
|
||||
*/
|
||||
|
||||
int intr_timed_wait(
|
||||
int flags,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,164 +0,0 @@
|
||||
/* limits.h
|
||||
*
|
||||
* This file lists the minimums for the limits set by each of
|
||||
* the POSIX features subsets.
|
||||
*
|
||||
* XXX: Careful attention needs to be paid to section 2.8 in 1003.1b-1993
|
||||
* to segregrate the variables below based on their "class" according
|
||||
* to our implementation. We also need to set the Run-Time Invariant
|
||||
* and other related values.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include_next <limits.h>
|
||||
|
||||
#ifndef __POSIX_LIMITS_h
|
||||
#define __POSIX_LIMITS_h
|
||||
|
||||
/* really only to get min stack size from <rtems/score/cpu.h> */
|
||||
#include <rtems/system.h>
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* P1003.1b-1993 defines the constants below this comment. *
|
||||
* *
|
||||
****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
#define _POSIX_AIO_LISTIO_MAX 2
|
||||
#define _POSIX_AIO_MAX 1
|
||||
#define _POSIX_ARG_MAX 4096
|
||||
#define _POSIX_CHILD_MAX 6
|
||||
#define _POSIX_DELAYTIMER_MAX 32
|
||||
#define _POSIX_LINK_MAX 8
|
||||
#define _POSIX_MAX_CANON 255
|
||||
#define _POSIX_MAX_INPUT 255
|
||||
#define _POSIX_MQ_OPEN_MAX 8
|
||||
#define _POSIX_MQ_PRIO_MAX 32
|
||||
#define _POSIX_NAME_MAX 14
|
||||
#define _POSIX_NGROUPS_MAX 0
|
||||
#define _POSIX_OPEN_MAX 16
|
||||
#define _POSIX_PATH_MAX 255
|
||||
#define _POSIX_PIPE_BUF 512
|
||||
#define _POSIX_RTSIG_MAX 8
|
||||
#define _POSIX_SEM_NSEMS_MAX 256
|
||||
#define _POSIX_SEM_VALUE_MAX 32767
|
||||
#define _POSIX_SIGQUEUE_MAX 32
|
||||
#define _POSIX_SSIZE_MAX 32767
|
||||
#define _POSIX_STREAM_MAX 8
|
||||
#define _POSIX_TIMER_MAX 32
|
||||
#define _POSIX_TZNAME_MAX 3
|
||||
|
||||
/*
|
||||
* Definitions of the following may be omitted if the value is >= stated
|
||||
* minimum but is indeterminate.
|
||||
*/
|
||||
|
||||
#define AIO_LISTIO_MAX 2
|
||||
#define AIO_MAX 1
|
||||
#define AIO_PRIO_DELTA_MAX 0
|
||||
#define ARG_MAX 4096
|
||||
#define CHILD_MAX 6
|
||||
#define DELAYTIMER_MAX 32
|
||||
#define MQ_OPEN_MAX 8
|
||||
#define MQ_PRIO_MAX 32
|
||||
#define OPEN_MAX 16
|
||||
#define PAGESIZE 1
|
||||
#define RTSIG_MAX 8
|
||||
#define SEM_NSEMS_MAX 256
|
||||
#define SEM_VALUE_MAX 32767
|
||||
#define SIGQUEUE_MAX 32
|
||||
#define STREAM_MAX 8
|
||||
#define TIMER_MAX 32
|
||||
#define TZNAME_MAX 3
|
||||
|
||||
/*
|
||||
* Pathname Variables
|
||||
*/
|
||||
|
||||
#define LINK_MAX 8
|
||||
#define MAX_CANON 255
|
||||
#define MAX_INPUT 255
|
||||
#define NAME_MAX 14
|
||||
#define PATH_MAX 255
|
||||
#define PIPE_BUF 512
|
||||
|
||||
/*
|
||||
* Invariant values
|
||||
*/
|
||||
|
||||
#define SSIZE_MAX 32767
|
||||
|
||||
/*
|
||||
* Maximum Values
|
||||
*/
|
||||
|
||||
#define _POSIX_CLOCKRES_MIN 0 /* in nanoseconds */
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* P1003.1c/D10 defines the constants below this comment. *
|
||||
*
|
||||
* XXX: doc seems to have printing problems in this table :(
|
||||
* *
|
||||
****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
#define _POSIX_LOGIN_NAME_MAX 9
|
||||
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
|
||||
#define _POSIX_THREAD_KEYS_MAX 28
|
||||
#define _POSIX_THREAD_THREADS_MAX 64
|
||||
#define _POSIX_TTY_NAME_MAX 9
|
||||
|
||||
/*
|
||||
* Definitions of the following may be omitted if the value is >= stated
|
||||
* minimum but is indeterminate.
|
||||
*/
|
||||
|
||||
#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
|
||||
#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
|
||||
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
|
||||
#define PTHREAD_STACK_MIN CPU_STACK_MINIMUM_SIZE
|
||||
|
||||
/*
|
||||
* The maximum number of keys (PTHREAD_KEYS_MAX) and threads
|
||||
* (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum.
|
||||
*
|
||||
#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
|
||||
#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* P1003.4b/D8 defines the constants below this comment. *
|
||||
* *
|
||||
****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
#define _POSIX_INTERRUPT_OVERRUN_MAX 32
|
||||
|
||||
/*
|
||||
* Definitions of the following may be omitted if the value is >= stated
|
||||
* minimum but is indeterminate.
|
||||
*/
|
||||
|
||||
#define INTERRUPT_OVERRUN_MAX 32
|
||||
|
||||
/*
|
||||
* Pathname Variables
|
||||
*/
|
||||
|
||||
#define MIN_ALLOC_SIZE
|
||||
#define REC_MIN_XFER_SIZE
|
||||
#define REC_MAX_XFER_SIZE
|
||||
#define REC_INCR_XFER_SIZE
|
||||
#define REC_XFER_ALIGN
|
||||
#define MAX_ATOMIC_SIZE
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,145 +0,0 @@
|
||||
/* mqueue.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_MESSAGE_QUEUE_h
|
||||
#define __POSIX_MESSAGE_QUEUE_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_MESSAGE_PASSING)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* 15.1.1 Data Structures, P1003.1b-1993, p. 271
|
||||
*/
|
||||
|
||||
typedef Objects_Id mqd_t;
|
||||
|
||||
struct mq_attr {
|
||||
long mq_flags; /* Message queue flags */
|
||||
long mq_maxmsg; /* Maximum number of messages */
|
||||
long mq_msgsize; /* Maximum message size */
|
||||
long mq_curmsgs; /* Number of messages currently queued */
|
||||
};
|
||||
|
||||
/*
|
||||
* 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
|
||||
*/
|
||||
|
||||
mqd_t mq_open(
|
||||
const char *name,
|
||||
int oflag,
|
||||
...
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
|
||||
*/
|
||||
|
||||
int mq_close(
|
||||
mqd_t mqdes
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
|
||||
*/
|
||||
|
||||
int mq_unlink(
|
||||
const char *name
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
|
||||
*/
|
||||
|
||||
int mq_send(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int msg_prio
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
|
||||
#include <time.h>
|
||||
|
||||
int mq_timedsend(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int msg_prio,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif /* _POSIX_TIMEOUTS */
|
||||
|
||||
/*
|
||||
* 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
|
||||
*/
|
||||
|
||||
ssize_t mq_receive(
|
||||
mqd_t mqdes,
|
||||
char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int *msg_prio
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
|
||||
int mq_timedreceive( /* XXX: should this be ssize_t */
|
||||
mqd_t mqdes,
|
||||
char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int *msg_prio,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif /* _POSIX_TIMEOUTS */
|
||||
|
||||
#if defined(_POSIX_REALTIME_SIGNALS)
|
||||
|
||||
/*
|
||||
* 15.2.6 Notify Process that a Message is Available on a Queue,
|
||||
* P1003.1b-1993, p. 280
|
||||
*/
|
||||
|
||||
int mq_notify(
|
||||
mqd_t mqdes,
|
||||
const struct sigevent *notification
|
||||
);
|
||||
|
||||
#endif /* _POSIX_REALTIME_SIGNALS */
|
||||
|
||||
/*
|
||||
* 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
|
||||
*/
|
||||
|
||||
int mq_setattr(
|
||||
mqd_t mqdes,
|
||||
const struct mq_attr *mqstat,
|
||||
struct mq_attr *omqstat
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
|
||||
*/
|
||||
|
||||
int mq_getattr(
|
||||
mqd_t mqdes,
|
||||
struct mq_attr *mqstat
|
||||
);
|
||||
|
||||
#endif /* _POSIX_MESSAGE_PASSING */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,500 +0,0 @@
|
||||
/* pthread.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PTHREAD_h
|
||||
#define __PTHREAD_h
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#if defined(_POSIX_THREADS)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <sys/sched.h>
|
||||
|
||||
/*
|
||||
* 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
|
||||
*
|
||||
* RTEMS does not support processes, so we fall under this and do not
|
||||
* provide this routine:
|
||||
*
|
||||
* "Either the implementation shall support the pthread_atfork() function
|
||||
* as described above or the pthread_atfork() funciton shall not be
|
||||
* provided."
|
||||
*/
|
||||
|
||||
/*
|
||||
* 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_init(
|
||||
pthread_mutexattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_mutexattr_destroy(
|
||||
pthread_mutexattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_mutexattr_getpshared(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *pshared
|
||||
);
|
||||
|
||||
int pthread_mutexattr_setpshared(
|
||||
pthread_mutexattr_t *attr,
|
||||
int pshared
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
|
||||
*/
|
||||
|
||||
int pthread_mutex_init(
|
||||
pthread_mutex_t *mutex,
|
||||
const pthread_mutexattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_mutex_destroy(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
/*
|
||||
* This is used to statically initialize a pthread_mutex_t. Example:
|
||||
*
|
||||
* pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
|
||||
|
||||
/*
|
||||
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
|
||||
*/
|
||||
|
||||
int pthread_mutex_lock(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
int pthread_mutex_trylock(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
int pthread_mutex_unlock(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
|
||||
int pthread_mutex_timedlock(
|
||||
pthread_mutex_t *mutex,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif /* _POSIX_TIMEOUTS */
|
||||
|
||||
/*
|
||||
* 11.4.1 Condition Variable Initialization Attributes,
|
||||
* P1003.1c/Draft 10, p. 96
|
||||
*/
|
||||
|
||||
int pthread_condattr_init(
|
||||
pthread_condattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_condattr_destroy(
|
||||
pthread_condattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_condattr_getpshared(
|
||||
const pthread_condattr_t *attr,
|
||||
int *pshared
|
||||
);
|
||||
|
||||
int pthread_condattr_setpshared(
|
||||
pthread_condattr_t *attr,
|
||||
int pshared
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.4.2 Initializing and Destroying a Condition Variable,
|
||||
* P1003.1c/Draft 10, p. 87
|
||||
*/
|
||||
|
||||
int pthread_cond_init(
|
||||
pthread_cond_t *cond,
|
||||
const pthread_condattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_cond_destroy(
|
||||
pthread_cond_t *mutex
|
||||
);
|
||||
|
||||
/*
|
||||
* This is used to statically initialize a pthread_cond_t. Example:
|
||||
*
|
||||
* pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_COND_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
|
||||
|
||||
/*
|
||||
* 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
|
||||
*/
|
||||
|
||||
int pthread_cond_signal(
|
||||
pthread_cond_t *cond
|
||||
);
|
||||
|
||||
int pthread_cond_broadcast(
|
||||
pthread_cond_t *cond
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
|
||||
*/
|
||||
|
||||
int pthread_cond_wait(
|
||||
pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
int pthread_cond_timedwait(
|
||||
pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex,
|
||||
const struct timespec *abstime
|
||||
);
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
|
||||
|
||||
/*
|
||||
* 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
|
||||
*/
|
||||
|
||||
int pthread_attr_setscope(
|
||||
pthread_attr_t *attr,
|
||||
int contentionscope
|
||||
);
|
||||
|
||||
int pthread_attr_getscope(
|
||||
const pthread_attr_t *attr,
|
||||
int *contentionscope
|
||||
);
|
||||
|
||||
int pthread_attr_setinheritsched(
|
||||
pthread_attr_t *attr,
|
||||
int inheritsched
|
||||
);
|
||||
|
||||
int pthread_attr_getinheritsched(
|
||||
const pthread_attr_t *attr,
|
||||
int *inheritsched
|
||||
);
|
||||
|
||||
int pthread_attr_setschedpolicy(
|
||||
pthread_attr_t *attr,
|
||||
int policy
|
||||
);
|
||||
|
||||
int pthread_attr_getschedpolicy(
|
||||
const pthread_attr_t *attr,
|
||||
int *policy
|
||||
);
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
|
||||
|
||||
/*
|
||||
* 13.5.2 Dynamic Thread Scheduling Parameters Access,
|
||||
* P1003.1c/Draft 10, p. 124
|
||||
*/
|
||||
|
||||
int pthread_getschedparam(
|
||||
pthread_t thread,
|
||||
int *policy,
|
||||
struct sched_param *param
|
||||
);
|
||||
|
||||
int pthread_setschedparam(
|
||||
pthread_t thread,
|
||||
int policy,
|
||||
struct sched_param *param
|
||||
);
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||
|
||||
/*
|
||||
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_setprotocol(
|
||||
pthread_mutexattr_t *attr,
|
||||
int protocol
|
||||
);
|
||||
|
||||
int pthread_mutexattr_getprotocol(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *protocol
|
||||
);
|
||||
|
||||
int pthread_mutexattr_setprioceiling(
|
||||
pthread_mutexattr_t *attr,
|
||||
int prioceiling
|
||||
);
|
||||
|
||||
int pthread_mutexattr_getprioceiling(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *prioceiling
|
||||
);
|
||||
|
||||
#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||
|
||||
/*
|
||||
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
|
||||
*/
|
||||
|
||||
int pthread_mutex_setprioceiling(
|
||||
pthread_mutex_t *mutex,
|
||||
int prioceiling,
|
||||
int *old_ceiling
|
||||
);
|
||||
|
||||
int pthread_mutex_getprioceiling(
|
||||
pthread_mutex_t *mutex,
|
||||
int *prioceiling
|
||||
);
|
||||
|
||||
#endif /* _POSIX_THREAD_PRIO_PROTECT */
|
||||
|
||||
/*
|
||||
* 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
|
||||
*/
|
||||
|
||||
int pthread_attr_init(
|
||||
pthread_attr_t *attr
|
||||
);
|
||||
|
||||
int pthread_attr_destroy(
|
||||
pthread_attr_t *attr
|
||||
);
|
||||
|
||||
int pthread_attr_getstacksize(
|
||||
const pthread_attr_t *attr,
|
||||
size_t *stacksize
|
||||
);
|
||||
|
||||
int pthread_attr_setstacksize(
|
||||
pthread_attr_t *attr,
|
||||
size_t stacksize
|
||||
);
|
||||
|
||||
int pthread_attr_getstackaddr(
|
||||
const pthread_attr_t *attr,
|
||||
void **stackaddr
|
||||
);
|
||||
|
||||
int pthread_attr_setstackaddr(
|
||||
pthread_attr_t *attr,
|
||||
void *stackaddr
|
||||
);
|
||||
|
||||
int pthread_attr_getdetachstate(
|
||||
const pthread_attr_t *attr,
|
||||
int *detachstate
|
||||
);
|
||||
|
||||
int pthread_attr_setdetachstate(
|
||||
pthread_attr_t *attr,
|
||||
int detachstate
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
|
||||
*/
|
||||
|
||||
int pthread_create(
|
||||
pthread_t *thread,
|
||||
const pthread_attr_t *attr,
|
||||
void *(*start_routine)( void * ),
|
||||
void *arg
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
|
||||
*/
|
||||
|
||||
int pthread_join(
|
||||
pthread_t thread,
|
||||
void **value_ptr
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
|
||||
*/
|
||||
|
||||
int pthread_detach(
|
||||
pthread_t thread
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.5.1 Thread Termination, p1003.1c/Draft 10, p. 150
|
||||
*/
|
||||
|
||||
void pthread_exit(
|
||||
void *value_ptr
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
|
||||
*/
|
||||
|
||||
pthread_t pthread_self( void );
|
||||
|
||||
/*
|
||||
* 16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
|
||||
*/
|
||||
|
||||
int pthread_equal(
|
||||
pthread_t t1,
|
||||
pthread_t t2
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.8 Dynamic Package Initialization
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is used to statically initialize a pthread_once_t. Example:
|
||||
*
|
||||
* pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
*
|
||||
* NOTE: This is named inconsistently -- it should be INITIALIZER.
|
||||
*/
|
||||
|
||||
#define PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
|
||||
|
||||
int pthread_once(
|
||||
pthread_once_t *once_control,
|
||||
void (*init_routine)(void)
|
||||
);
|
||||
|
||||
/*
|
||||
* 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
|
||||
*/
|
||||
|
||||
int pthread_key_create(
|
||||
pthread_key_t *key,
|
||||
void (*destructor)( void * )
|
||||
);
|
||||
|
||||
/*
|
||||
* 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
|
||||
*/
|
||||
|
||||
int pthread_setspecific(
|
||||
pthread_key_t key,
|
||||
const void *value
|
||||
);
|
||||
|
||||
void *pthread_getspecific(
|
||||
pthread_key_t key
|
||||
);
|
||||
|
||||
/*
|
||||
* 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
|
||||
*/
|
||||
|
||||
int pthread_key_delete(
|
||||
pthread_key_t key
|
||||
);
|
||||
|
||||
/*
|
||||
* 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
|
||||
*/
|
||||
|
||||
#define PTHREAD_CANCEL_ENABLE 0
|
||||
#define PTHREAD_CANCEL_DISABLE 1
|
||||
|
||||
#define PTHREAD_CANCEL_DEFERRED 0
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
|
||||
|
||||
int pthread_cancel(
|
||||
pthread_t thread
|
||||
);
|
||||
|
||||
/*
|
||||
* 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
|
||||
*/
|
||||
|
||||
int pthread_setcancelstate(
|
||||
int state,
|
||||
int *oldstate
|
||||
);
|
||||
|
||||
int pthread_setcanceltype(
|
||||
int type,
|
||||
int *oldtype
|
||||
);
|
||||
|
||||
void pthread_testcancel( void );
|
||||
|
||||
/*
|
||||
* 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
|
||||
*/
|
||||
|
||||
void pthread_cleanup_push(
|
||||
void (*routine)( void * ),
|
||||
void *arg
|
||||
);
|
||||
|
||||
void pthread_cleanup_pop(
|
||||
int execute
|
||||
);
|
||||
|
||||
#if defined(_POSIX_THREAD_CPUTIME)
|
||||
|
||||
/*
|
||||
* 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
|
||||
*/
|
||||
|
||||
int pthread_getcpuclockid(
|
||||
pthread_t thread_id,
|
||||
clockid_t *clock_id
|
||||
);
|
||||
|
||||
/*
|
||||
* 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
|
||||
*/
|
||||
|
||||
int pthread_attr_setcputime(
|
||||
pthread_attr_t *attr,
|
||||
int clock_allowed
|
||||
);
|
||||
|
||||
int pthread_attr_getcputime(
|
||||
pthread_attr_t *attr,
|
||||
int *clock_allowed
|
||||
);
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_CPUTIME) */
|
||||
|
||||
#endif /* defined(_POSIX_THREADS) */
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,88 +0,0 @@
|
||||
/* sched.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __POSIX_SCHEDULING_h
|
||||
#define __POSIX_SCHEDULING_h
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#if defined(_POSIX_PRIORITY_SCHEDULING)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <sys/sched.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
* 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
|
||||
*
|
||||
*/
|
||||
|
||||
int sched_setparam(
|
||||
pid_t pid,
|
||||
const struct sched_param *param
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
|
||||
*/
|
||||
|
||||
int sched_getparam(
|
||||
pid_t pid,
|
||||
const struct sched_param *param
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.3 Set Scheduling Policy and Scheduling Parameters,
|
||||
* P1003.1b-1993, p. 254
|
||||
*/
|
||||
|
||||
int sched_setscheduler(
|
||||
pid_t pid,
|
||||
int policy,
|
||||
const struct sched_param *param
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
|
||||
*/
|
||||
|
||||
int sched_getscheduler(
|
||||
pid_t pid
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
|
||||
*/
|
||||
|
||||
int sched_get_priority_max(
|
||||
int policy
|
||||
);
|
||||
|
||||
int sched_get_priority_min(
|
||||
int policy
|
||||
);
|
||||
|
||||
int sched_rr_get_interval(
|
||||
pid_t pid,
|
||||
struct timespec *interval
|
||||
);
|
||||
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
|
||||
|
||||
/*
|
||||
* 13.3.5 Yield Processor, P1003.1b-1993, p. 257
|
||||
*/
|
||||
|
||||
int sched_yield( void );
|
||||
|
||||
#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/* semaphore.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_SEMAPHORE_h
|
||||
#define __POSIX_SEMAPHORE_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_SEMAPHORES)
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
/*
|
||||
* 11.1 Semaphore Characteristics, P1003.1b-1993, p.219
|
||||
*/
|
||||
|
||||
typedef int sem_t;
|
||||
|
||||
/*
|
||||
* 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
|
||||
*/
|
||||
|
||||
int sem_init(
|
||||
sem_t *sem,
|
||||
int pshared,
|
||||
unsigned int value
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
|
||||
*/
|
||||
|
||||
int sem_destroy(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
|
||||
*
|
||||
* NOTE: Follows open() calling conventions.
|
||||
*/
|
||||
|
||||
sem_t *sem_open(
|
||||
const char *name,
|
||||
int oflag,
|
||||
...
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
|
||||
*/
|
||||
|
||||
int sem_close(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
|
||||
*/
|
||||
|
||||
int sem_unlink(
|
||||
const char *name
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
|
||||
*/
|
||||
|
||||
int sem_wait(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
int sem_trywait(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
int sem_timedwait(
|
||||
sem_t *sem,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
|
||||
*/
|
||||
|
||||
int sem_post(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
|
||||
*/
|
||||
|
||||
int sem_getvalue(
|
||||
sem_t *sem,
|
||||
int *sval
|
||||
);
|
||||
|
||||
#endif /* _POSIX_SEMAPHORES */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,85 +0,0 @@
|
||||
/* unistd.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_UNISTD_h
|
||||
#define __POSIX_UNISTD_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
/*
|
||||
* 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96
|
||||
*
|
||||
* NOTE: Table 4-2, Configurable System Variables, p. 96
|
||||
*/
|
||||
|
||||
#define _SC_AIO_LISTIO_MAX 0
|
||||
#define _SC_AIO_MAX 1
|
||||
#define _SC_AIO_PRIO_DELTA_MAX 2
|
||||
#define _SC_ARG_MAX 3
|
||||
#define _SC_CHILD_MAX 4
|
||||
#define _SC_CLK_TCK 5
|
||||
#define _SC_DELAYTIMER_MAX 6
|
||||
#define _SC_MQ_OPEN_MAX 7
|
||||
#define _SC_MQ_PRIO_MAX 8
|
||||
#define _SC_NGROUPS_MAX 9
|
||||
#define _SC_OPEN_MAX 10
|
||||
#define _SC_PAGESIZE 11
|
||||
#define _SC_RTSIG_MAX 12
|
||||
#define _SC_SEM_NSEMS_MAX 13
|
||||
#define _SC_SEM_VALUE_MAX 14
|
||||
#define _SC_SIGQUEUE_MAX 15
|
||||
#define _SC_STREAM_MAX 16
|
||||
#define _SC_TIMER_MAX 17
|
||||
#define _SC_TZNAME_MAX 18
|
||||
|
||||
#define _SC_ASYNCHRONOUS_IO 19
|
||||
#define _SC_FSYNC 20
|
||||
#define _SC_JOB_CONTROL 21
|
||||
#define _SC_MAPPED_FILES 22
|
||||
#define _SC_MEMLOCK 23
|
||||
#define _SC_MEMLOCK_RANGE 24
|
||||
#define _SC_MEMORY_PROTECTION 25
|
||||
#define _SC_MESSAGE_PASSING 26
|
||||
#define _SC_PRIORITIZED_IO 27
|
||||
#define _SC_REALTIME_SIGNALS 28
|
||||
#define _SC_SAVED_IDS 29
|
||||
#define _SC_SEMAPHORES 30
|
||||
#define _SC_SHARED_MEMORY_OBJECTS 31
|
||||
#define _SC_SYNCHRONIZED_IO 32
|
||||
#define _SC_TIMERS 33
|
||||
#define _SC_VERSION 34
|
||||
|
||||
/*
|
||||
* P1003.1c/D10, p. 52 adds the following.
|
||||
*/
|
||||
|
||||
#define _SC_GETGR_R_SIZE_MAX 35
|
||||
#define _SC_GETPW_R_SIZE_MAX
|
||||
#define _SC_LOGIN_NAME_MAX
|
||||
#define _SC_THREAD_DESTRUCTOR_ITERATIONS
|
||||
#define _SC_THREAD_KEYS_MAX
|
||||
#define _SC_THREAD_STACK_MIN
|
||||
#define _SC_THREAD_THREADS_MAX
|
||||
#define _SC_TTY_NAME_MAX
|
||||
|
||||
#define _SC_THREADS
|
||||
#define _SC_THREAD_ATTR_STACKADDR
|
||||
#define _SC_THREAD_ATTR_STACKSIZE
|
||||
#define _SC_THREAD_PRIORITY_SCHEDULING
|
||||
#define _SC_THREAD_PRIO_INHERIT
|
||||
#define _SC_THREAD_PRIO_CEILING
|
||||
#define _SC_THREAD_PROCESS_SHARED
|
||||
#define _SC_THREAD_SAGE_FUNCTIONS
|
||||
|
||||
/*
|
||||
* 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95
|
||||
*/
|
||||
|
||||
long sysconf(
|
||||
int name
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of include */
|
||||
@@ -1,16 +0,0 @@
|
||||
/* rtems/posix/cancel.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CANCEL_h
|
||||
#define __RTEMS_POSIX_CANCEL_h
|
||||
|
||||
typedef struct {
|
||||
Chain_Node Node;
|
||||
void (*routine)( void * );
|
||||
void *arg;
|
||||
} POSIX_Cancel_Handler_control;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,130 +0,0 @@
|
||||
/* rtems/posix/cond.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX condition variables.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_h
|
||||
#define __RTEMS_POSIX_CONDITION_VARIABLES_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/threadq.h>
|
||||
|
||||
/*
|
||||
* Constant to indicate condition variable does not currently have
|
||||
* a mutex assigned to it.
|
||||
*/
|
||||
|
||||
#define POSIX_CONDITION_VARIABLES_NO_MUTEX 0
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX condition variable
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
pthread_mutex_t Mutex;
|
||||
Thread_queue_Control Wait_queue;
|
||||
} POSIX_Condition_variables_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Condition_variables_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_Manager_initialization(
|
||||
unsigned32 maximum_condition_variables
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a condition variable control block from
|
||||
* the inactive chain of free condition variable control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *
|
||||
_POSIX_Condition_variables_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a condition variable control block to the
|
||||
* inactive chain of free condition variable control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps condition variable IDs to condition variable control
|
||||
* blocks. If ID corresponds to a local condition variable, then it returns
|
||||
* the_condition variable control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the condition variable ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_condition variable is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_condition variable is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_condition variable is NULL
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
);
|
||||
|
||||
#include <rtems/posix/cond.inl>
|
||||
#include <rtems/posix/condmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
/* condmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Condition Variable Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
|
||||
#define __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote condition variable operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_CONDITION_VARIABLES_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_CONDITION_VARIABLES_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_CONDITION_VARIABLES_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_CONDITION_VARIABLES_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_CONDITION_VARIABLES_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Condition_variables_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote condition variable operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Condition_variables_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Condition_variables_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_process_packet (
|
||||
POSIX_Condition_variables_MP_Remote_operations operation,
|
||||
Objects_Id condition_variables_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Condition_variables_MP_Send_request_packet (
|
||||
POSIX_Condition_variables_MP_Remote_operations operation,
|
||||
Objects_Id condition_variables_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_response_packet (
|
||||
POSIX_Condition_variables_MP_Remote_operations operation,
|
||||
Objects_Id condition_variables_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Condition_variables_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a condition variable mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Condition_variables_MP_Packet
|
||||
*_POSIX_Condition_variables_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,59 +0,0 @@
|
||||
/* config.h
|
||||
*
|
||||
* This include file contains the table of user defined configuration
|
||||
* parameters specific for the POSIX API.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONFIGURATION_h
|
||||
#define __RTEMS_POSIX_CONFIGURATION_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
*
|
||||
* The following records define the Configuration Table. The
|
||||
* information contained in this table is required in all
|
||||
* RTEMS systems, whether single or multiprocessor. This
|
||||
* table primarily defines the following:
|
||||
*
|
||||
* + required number of each object type
|
||||
*/
|
||||
|
||||
/*
|
||||
* For now, we are only allowing the user to specify the entry point
|
||||
* for posix initialization threads.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
void *(*entry)(void *);
|
||||
} posix_initialization_threads_table;
|
||||
|
||||
typedef struct {
|
||||
int maximum_threads;
|
||||
int maximum_mutexes;
|
||||
int maximum_condition_variables;
|
||||
int maximum_keys;
|
||||
int maximum_queued_signals;
|
||||
int number_of_initialization_threads;
|
||||
posix_initialization_threads_table *User_initialization_threads_table;
|
||||
} posix_api_configuration_table;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,154 +0,0 @@
|
||||
/* rtems/posix/intr.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX Interrupt Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_KEY_h
|
||||
#define __RTEMS_POSIX_KEY_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage each POSIX Interrupt Vector
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int number_installed;
|
||||
int lock_count;
|
||||
int deferred_count;
|
||||
Chain_Control Handlers;
|
||||
} POSIX_Interrupt_Control;
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX Interrupt Handler
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int is_active;
|
||||
intr_t vector;
|
||||
Thread_Control *server;
|
||||
int (*handler)( void *area );
|
||||
volatile void *user_data_area;
|
||||
} POSIX_Interrupt_Handler_control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Interrupt_Handlers_Information;
|
||||
|
||||
/*
|
||||
* The following is an array which is used to manage the set of
|
||||
* interrupt handlers installed on each vector.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN POSIX_Interrupt_Control
|
||||
_POSIX_Interrupt_Information[ ISR_NUMBER_OF_VECTORS ];
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Interrupt_Manager_initialization(
|
||||
unsigned32 maximum_interrupt_handlers
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a interrupt handler control block from
|
||||
* the inactive chain of free interrupt handler control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Handler_control *
|
||||
_POSIX_Interrupt_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a interrupt handler control block to the
|
||||
* inactive chain of free interrupt handler control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Interrupt_Free (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps interrupt handler IDs to interrupt handler control
|
||||
* blocks. If ID corresponds to a local interrupt handler, then it returns
|
||||
* the_intr control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the interrupt handler ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_intr is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_intr is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_intr is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Interrupt_Is_null (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Handler
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function XXX.
|
||||
*/
|
||||
|
||||
void _POSIX_Interrupt_Handler(
|
||||
ISR_Vector_number vector
|
||||
);
|
||||
|
||||
#include <rtems/posix/intr.inl>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/* rtems/posix/key.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX key.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_KEY_h
|
||||
#define __RTEMS_POSIX_KEY_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX key
|
||||
*
|
||||
* NOTE: The Values is a table indexed by the index portion of the
|
||||
* ID of the currently executing thread.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
boolean is_active;
|
||||
void (*destructor)( void * );
|
||||
void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ];
|
||||
} POSIX_Keys_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Keys_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Key_Manager_initialization(
|
||||
unsigned32 maximum_keys
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Run_destructors
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function executes all the destructors associated with the thread's
|
||||
* keys. This function will execute until all values have been set to NULL.
|
||||
*
|
||||
* NOTE: This is the routine executed when a thread exits to
|
||||
* run through all the keys and do the destructor action.
|
||||
*/
|
||||
|
||||
void _POSIX_Keys_Run_destructors(
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a keys control block from
|
||||
* the inactive chain of free keys control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a keys control block to the
|
||||
* inactive chain of free keys control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
|
||||
POSIX_Keys_Control *the_key
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps key IDs to key control blocks.
|
||||
* If ID corresponds to a local keys, then it returns
|
||||
* the_key control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the keys ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_key is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_key is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_key is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Keys_Is_null (
|
||||
POSIX_Keys_Control *the_key
|
||||
);
|
||||
|
||||
#include <rtems/posix/key.inl>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
/* rtems/posix/mqueue.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX Message Queues.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_h
|
||||
#define __RTEMS_POSIX_MESSAGE_QUEUE_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/coremsg.h>
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX message queue
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
int flags;
|
||||
boolean named;
|
||||
boolean linked;
|
||||
boolean blocking;
|
||||
unsigned32 open_count;
|
||||
CORE_message_queue_Control Message_queue;
|
||||
struct sigevent notification;
|
||||
} POSIX_Message_queue_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Message_queue_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_Manager_initialization(
|
||||
unsigned32 maximum_message_queues
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Message_queue_Create_support
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the creation of a message queue utilizing the
|
||||
* core message queue.
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Create_support(
|
||||
const char *name,
|
||||
int pshared,
|
||||
unsigned int oflag,
|
||||
struct mq_attr *attr,
|
||||
POSIX_Message_queue_Control **message_queue
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Message_queue_Send_support
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine posts a message to a specified message queue.
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Send_support(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
unsigned32 msg_len,
|
||||
Priority_Control msg_prio,
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a message queue control block from
|
||||
* the inactive chain of free message queue control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a message queue control block to the
|
||||
* inactive chain of free message queue control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps message queue IDs to message queue control blocks.
|
||||
* If ID corresponds to a local message queue, then it returns
|
||||
* the_mq control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the message queue ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_message queue is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_mq is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_message_queue is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Message_queue_Is_null (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Name_to_id
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Name_to_id(
|
||||
const char *name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Priority_to_core
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Message_queue_Priority_to_core(
|
||||
unsigned int priority
|
||||
);
|
||||
|
||||
#include <rtems/posix/mqueue.inl>
|
||||
#include <rtems/posix/mqueuemp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* mqueuemp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Message Queue Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
|
||||
#define __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote message queue operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_MESSAGE_QUEUE_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_MESSAGE_QUEUE_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_MESSAGE_QUEUE_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_MESSAGE_QUEUE_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Message_queue_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote message queue operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Message_queue_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Message_queue_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_process_packet (
|
||||
POSIX_Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id mq_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_MP_Send_request_packet (
|
||||
POSIX_Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id mq_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_response_packet (
|
||||
POSIX_Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id mq_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Message_queue_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a message queue mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Message_queue_MP_Packet *_POSIX_Message_queue_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,120 +0,0 @@
|
||||
/* rtems/posix/mutex.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX mutex's.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MUTEX_h
|
||||
#define __RTEMS_POSIX_MUTEX_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX mutex
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
CORE_mutex_Control Mutex;
|
||||
} POSIX_Mutex_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Mutex_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_Manager_initialization(
|
||||
unsigned32 maximum_mutexes
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a mutexes control block from
|
||||
* the inactive chain of free mutexes control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a mutexes control block to the
|
||||
* inactive chain of free mutexes control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps mutexes IDs to mutexes control blocks.
|
||||
* If ID corresponds to a local mutexes, then it returns
|
||||
* the_mutex control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the mutexes ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_mutex is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_mutex is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_mutex is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
);
|
||||
|
||||
#include <rtems/posix/mutex.inl>
|
||||
#include <rtems/posix/mutexmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* mutexmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Mutex Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MUTEX_MP_h
|
||||
#define __RTEMS_POSIX_MUTEX_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote mutex operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_MUTEX_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_MUTEX_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_MUTEX_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_MUTEX_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_MUTEX_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_MUTEX_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_MUTEX_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Mutex_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote mutex operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Mutex_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Mutex_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_process_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Mutex_MP_Send_request_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_response_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Mutex_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a mutex mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Mutex_MP_Packet *_POSIX_Mutex_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* POSIX API Support
|
||||
*
|
||||
* NOTE:
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_API_h
|
||||
#define __POSIX_API_h
|
||||
|
||||
#include <rtems/config.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_API_Initialize
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _POSIX_API_Initialize(
|
||||
rtems_configuration_table *configuration_table
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_h
|
||||
#define __RTEMS_POSIX_PRIORITY_h
|
||||
|
||||
#include <rtems/score/priority.h>
|
||||
|
||||
/*
|
||||
* 1003.1b-1993,2.2.2.80 definition of priority, p. 19
|
||||
*
|
||||
* "Numericallly higher values represent higher priorities."
|
||||
*
|
||||
* Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
|
||||
*/
|
||||
|
||||
#define POSIX_SCHEDULER_MAXIMUM_PRIORITY (255)
|
||||
|
||||
#define POSIX_SCHEDULER_MINIMUM_PRIORITY (1)
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
);
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
);
|
||||
|
||||
RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
);
|
||||
|
||||
#include <rtems/posix/priority.inl>
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_SIGNALS_h
|
||||
#define __POSIX_SIGNALS_h
|
||||
|
||||
void _POSIX_signals_Manager_Initialization(
|
||||
int maximum_queued_signals
|
||||
);
|
||||
|
||||
void _POSIX_signals_Post_switch_extension(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,123 +0,0 @@
|
||||
/* rtems/posix/pthread.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX threads.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREADS_h
|
||||
#define __RTEMS_POSIX_THREADS_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/posix/config.h>
|
||||
#include <rtems/posix/threadsup.h>
|
||||
|
||||
#define PTHREAD_MINIMUM_STACK_SIZE (STACK_MINIMUM_SIZE * 2)
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Threads_Information;
|
||||
|
||||
/*
|
||||
* These are used to manage the user initialization threads.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN posix_initialization_threads_table
|
||||
*_POSIX_Threads_User_initialization_threads;
|
||||
POSIX_EXTERN unsigned32 _POSIX_Threads_Number_of_initialization_threads;
|
||||
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_Manager_initialization(
|
||||
unsigned32 maximum_pthreads,
|
||||
unsigned32 number_of_initialization_threads,
|
||||
posix_initialization_threads_table *user_threads
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a pthread control block from
|
||||
* the inactive chain of free pthread control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a pthread control block to the
|
||||
* inactive chain of free pthread control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free(
|
||||
Thread_Control *the_pthread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps pthread IDs to pthread control blocks.
|
||||
* If ID corresponds to a local pthread, then it returns
|
||||
* the_pthread control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the pthread ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_pthread is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_pthread is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get(
|
||||
pthread_t id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_pthread is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Threads_Is_null(
|
||||
Thread_Control *the_pthread
|
||||
);
|
||||
|
||||
#include <rtems/posix/pthread.inl>
|
||||
#include <rtems/posix/pthreadmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* pthreadmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Threads Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREADS_MP_h
|
||||
#define __RTEMS_POSIX_THREADS_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote pthread operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_THREADS_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_THREADS_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_THREADS_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_THREADS_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_THREADS_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_THREADS_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_THREADS_MP_RELEASE_RESPONSE = 6
|
||||
} POSIX_Threads_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote pthread operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Threads_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait;
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Threads_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_process_packet (
|
||||
POSIX_Threads_MP_Remote_operations operation,
|
||||
Objects_Id pthread_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Threads_MP_Send_request_packet (
|
||||
POSIX_Threads_MP_Remote_operations operation,
|
||||
Objects_Id pthread_id,
|
||||
boolean wait,
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_response_packet (
|
||||
POSIX_Threads_MP_Remote_operations operation,
|
||||
Objects_Id pthread_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Threads_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a pthread mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Threads_MP_Packet *_POSIX_Threads_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,135 +0,0 @@
|
||||
/* rtems/posix/semaphore.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX Semaphores.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_SEMAPHORE_h
|
||||
#define __RTEMS_POSIX_SEMAPHORE_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/coresem.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX semaphore
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
boolean named;
|
||||
boolean linked;
|
||||
unsigned32 open_count;
|
||||
CORE_semaphore_Control Semaphore;
|
||||
} POSIX_Semaphore_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Semaphore_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_Manager_initialization(
|
||||
unsigned32 maximum_semaphorees
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a semaphore control block from
|
||||
* the inactive chain of free semaphore control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a semaphore control block to the
|
||||
* inactive chain of free semaphore control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps semaphore IDs to semaphore control blocks.
|
||||
* If ID corresponds to a local semaphore, then it returns
|
||||
* the_semaphore control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the semaphore ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_semaphore is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_semaphore is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Semaphore_Is_null (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Name_to_id
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
int _POSIX_Semaphore_Name_to_id(
|
||||
const char *name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
#include <rtems/posix/semaphore.inl>
|
||||
#include <rtems/posix/semaphoremp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* semaphoremp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Semaphore Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_SEMAPHORE_MP_h
|
||||
#define __RTEMS_POSIX_SEMAPHORE_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote semaphore operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_SEMAPHORE_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_SEMAPHORE_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_SEMAPHORE_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_SEMAPHORE_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Semaphore_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote semaphore operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Semaphore_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Semaphore_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_process_packet (
|
||||
POSIX_Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Semaphore_MP_Send_request_packet (
|
||||
POSIX_Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_response_packet (
|
||||
POSIX_Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Semaphore_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a semaphore mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Semaphore_MP_Packet *_POSIX_Semaphore_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_SET_ERRNO_h
|
||||
#define __POSIX_SET_ERRNO_h
|
||||
|
||||
#define set_errno_and_return_minus_one( _error ) \
|
||||
{ errno = (_error); return -1; }
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,46 +0,0 @@
|
||||
/* threadsup.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
#define __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/tqdata.h>
|
||||
|
||||
typedef struct {
|
||||
pthread_attr_t Attributes;
|
||||
int detachstate;
|
||||
Thread_queue_Control Join_List;
|
||||
int schedpolicy;
|
||||
struct sched_param schedparam;
|
||||
int ss_high_priority;
|
||||
Watchdog_Control Sporadic_timer;
|
||||
|
||||
sigset_t signals_blocked;
|
||||
sigset_t signals_pending;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* POSIX Interrupts
|
||||
*/
|
||||
unsigned32 interrupts_installed;
|
||||
CORE_semaphore_Control Interrupt_Semaphore;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* POSIX Cancelability
|
||||
*/
|
||||
int cancelability_state;
|
||||
int cancelability_type;
|
||||
int cancelation_requested;
|
||||
Chain_Control Cancellation_Handlers;
|
||||
#endif
|
||||
|
||||
} POSIX_API_Control;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_TIME_h
|
||||
#define __RTEMS_POSIX_TIME_h
|
||||
|
||||
#include <rtems/score/tod.h>
|
||||
|
||||
/*
|
||||
* Seconds from January 1, 1970 to January 1, 1988. Used to account for
|
||||
* differences between POSIX API and RTEMS core.
|
||||
*/
|
||||
|
||||
#define POSIX_TIME_SECONDS_1970_THROUGH_1988 \
|
||||
(((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \
|
||||
(4 * TOD_SECONDS_PER_DAY))
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Timespec_subtract
|
||||
*/
|
||||
|
||||
void _POSIX_Timespec_subtract(
|
||||
const struct timespec *the_start,
|
||||
const struct timespec *end,
|
||||
struct timespec *result
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Timespec_to_interval
|
||||
*/
|
||||
|
||||
Watchdog_Interval _POSIX_Timespec_to_interval(
|
||||
const struct timespec *time
|
||||
);
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interval_to_timespec
|
||||
*/
|
||||
|
||||
void _POSIX_Interval_to_timespec(
|
||||
Watchdog_Interval ticks,
|
||||
struct timespec *time
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -1,137 +0,0 @@
|
||||
/* aio.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_ASYNCHRONOUS_IO_h
|
||||
#define __POSIX_ASYNCHRONOUS_IO_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_ASYNCHRONOUS_IO)
|
||||
|
||||
/*
|
||||
* 6.7.1 Data Definitions for Asynchronous Input and Output,
|
||||
* P1003.1b-1993, p. 151
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/*
|
||||
* 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
|
||||
*/
|
||||
|
||||
#define AIO_CANCELED 0 /* all requested operations have been canceled */
|
||||
#define AIO_NOTCANCELED 0 /* some of the operations could not be canceled */
|
||||
/* since they are in progress */
|
||||
#define AIO_ALLDONE 0 /* none of the requested operations could be */
|
||||
/* canceled since they are already complete */
|
||||
|
||||
/* lio_listio() options */
|
||||
|
||||
#define LIO_WAIT 0 /* calling process is to suspend until the */
|
||||
/* operation is complete */
|
||||
#define LIO_NOWAIT 0 /* calling process is to continue execution while */
|
||||
/* the operation is performed and no notification */
|
||||
/* shall be given when the operation is completed */
|
||||
#define LIO_READ 0 /* request a read() */
|
||||
#define LIO_WRITE 0 /* request a write() */
|
||||
#define LIO_NOP 0 /* no transfer is requested */
|
||||
|
||||
/*
|
||||
* 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
|
||||
*/
|
||||
|
||||
struct aiocb {
|
||||
int aio_fildes; /* File descriptor */
|
||||
off_t aio_offset; /* File offset */
|
||||
volatile void *aio_buf; /* Location of buffer */
|
||||
size_t aio_nbytes; /* Length of transfer */
|
||||
int aio_reqprio; /* Request priority offset */
|
||||
struct sigevent aio_sigevent; /* Signal number and value */
|
||||
int aoi_lio_opcode; /* Operation to be performed */
|
||||
};
|
||||
|
||||
/*
|
||||
* 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
|
||||
*/
|
||||
|
||||
int aio_read(
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
|
||||
*/
|
||||
|
||||
int aio_write(
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
|
||||
*/
|
||||
|
||||
int lio_listio(
|
||||
int mode,
|
||||
struct aiocb * const list[],
|
||||
int nent,
|
||||
struct sigevent *sig
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
|
||||
*/
|
||||
|
||||
int aio_error(
|
||||
const struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
|
||||
* P1003.1b-1993, p. 162
|
||||
*/
|
||||
|
||||
int aio_return(
|
||||
const struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
|
||||
*/
|
||||
|
||||
int aio_cancel(
|
||||
int filedes,
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
/*
|
||||
* 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
|
||||
*/
|
||||
|
||||
int aio_suspend(
|
||||
struct aiocb * const list[],
|
||||
int nent,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#if defined(_POSIX_SYNCHRONIZED_IO)
|
||||
|
||||
/*
|
||||
* 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
|
||||
*/
|
||||
|
||||
int aio_fsync(
|
||||
int op,
|
||||
struct aiocb *aiocbp
|
||||
);
|
||||
|
||||
#endif /* _POSIX_SYNCHRONIZED_IO */
|
||||
|
||||
#endif /* _POSIX_ASYNCHRONOUS_IO */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,30 +0,0 @@
|
||||
/* devctl.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_DEVICE_CONTROL_h
|
||||
#define __POSIX_DEVICE_CONTROL_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_DEVICE_CONTROL)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* 21.2.1 Control a Device, P1003.4b/D8, p. 65
|
||||
*/
|
||||
|
||||
int devctl(
|
||||
int filedes,
|
||||
void *dev_data_ptr,
|
||||
size_t nbyte,
|
||||
int *dev_info_ptr
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,72 +0,0 @@
|
||||
/* intr.h
|
||||
*
|
||||
* XXX: It is unclear if the type "intr_t" should be defined when
|
||||
* _POSIX_INTERRUPT_CONTROL is not.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_INTERRUPTS_h
|
||||
#define __POSIX_INTERRUPTS_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined(_POSIX_INTERRUPT_CONTROL)
|
||||
|
||||
/*
|
||||
* 22.2 Concepts, P1003.4b/D8, p. 73
|
||||
*/
|
||||
|
||||
typedef int intr_t;
|
||||
|
||||
/*
|
||||
* 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
|
||||
*/
|
||||
|
||||
/*
|
||||
* Return codes from an interrupt handler
|
||||
*/
|
||||
|
||||
#define INTR_HANDLED_NOTIFY 0 /* ISR handled this interrupt, notify */
|
||||
/* the thread that registered the */
|
||||
/* ISR that the interrupt occurred. */
|
||||
#define INTR_HANDLED_DO_NOT_NOTIFY 1 /* ISR handled this interrupt, but */
|
||||
/* do NOT perform notification. */
|
||||
#define INTR_NOT_HANDLED 2 /* ISR did not handle this interrupt, */
|
||||
/* let the next handler try. */
|
||||
|
||||
int intr_capture(
|
||||
intr_t intr,
|
||||
int (*intr_handler)( void *area ),
|
||||
volatile void *area,
|
||||
size_t areasize
|
||||
);
|
||||
|
||||
int intr_release(
|
||||
intr_t intr,
|
||||
int (*intr_handler)( void *area )
|
||||
);
|
||||
|
||||
int intr_lock(
|
||||
intr_t intr
|
||||
);
|
||||
|
||||
int intr_unlock(
|
||||
intr_t intr
|
||||
);
|
||||
|
||||
/*
|
||||
* 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
|
||||
*/
|
||||
|
||||
int intr_timed_wait(
|
||||
int flags,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,145 +0,0 @@
|
||||
/* mqueue.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_MESSAGE_QUEUE_h
|
||||
#define __POSIX_MESSAGE_QUEUE_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_MESSAGE_PASSING)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* 15.1.1 Data Structures, P1003.1b-1993, p. 271
|
||||
*/
|
||||
|
||||
typedef Objects_Id mqd_t;
|
||||
|
||||
struct mq_attr {
|
||||
long mq_flags; /* Message queue flags */
|
||||
long mq_maxmsg; /* Maximum number of messages */
|
||||
long mq_msgsize; /* Maximum message size */
|
||||
long mq_curmsgs; /* Number of messages currently queued */
|
||||
};
|
||||
|
||||
/*
|
||||
* 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
|
||||
*/
|
||||
|
||||
mqd_t mq_open(
|
||||
const char *name,
|
||||
int oflag,
|
||||
...
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
|
||||
*/
|
||||
|
||||
int mq_close(
|
||||
mqd_t mqdes
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
|
||||
*/
|
||||
|
||||
int mq_unlink(
|
||||
const char *name
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
|
||||
*/
|
||||
|
||||
int mq_send(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int msg_prio
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
|
||||
#include <time.h>
|
||||
|
||||
int mq_timedsend(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int msg_prio,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif /* _POSIX_TIMEOUTS */
|
||||
|
||||
/*
|
||||
* 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
|
||||
*/
|
||||
|
||||
ssize_t mq_receive(
|
||||
mqd_t mqdes,
|
||||
char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int *msg_prio
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
|
||||
int mq_timedreceive( /* XXX: should this be ssize_t */
|
||||
mqd_t mqdes,
|
||||
char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int *msg_prio,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif /* _POSIX_TIMEOUTS */
|
||||
|
||||
#if defined(_POSIX_REALTIME_SIGNALS)
|
||||
|
||||
/*
|
||||
* 15.2.6 Notify Process that a Message is Available on a Queue,
|
||||
* P1003.1b-1993, p. 280
|
||||
*/
|
||||
|
||||
int mq_notify(
|
||||
mqd_t mqdes,
|
||||
const struct sigevent *notification
|
||||
);
|
||||
|
||||
#endif /* _POSIX_REALTIME_SIGNALS */
|
||||
|
||||
/*
|
||||
* 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
|
||||
*/
|
||||
|
||||
int mq_setattr(
|
||||
mqd_t mqdes,
|
||||
const struct mq_attr *mqstat,
|
||||
struct mq_attr *omqstat
|
||||
);
|
||||
|
||||
/*
|
||||
* 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
|
||||
*/
|
||||
|
||||
int mq_getattr(
|
||||
mqd_t mqdes,
|
||||
struct mq_attr *mqstat
|
||||
);
|
||||
|
||||
#endif /* _POSIX_MESSAGE_PASSING */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,500 +0,0 @@
|
||||
/* pthread.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PTHREAD_h
|
||||
#define __PTHREAD_h
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#if defined(_POSIX_THREADS)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <sys/sched.h>
|
||||
|
||||
/*
|
||||
* 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
|
||||
*
|
||||
* RTEMS does not support processes, so we fall under this and do not
|
||||
* provide this routine:
|
||||
*
|
||||
* "Either the implementation shall support the pthread_atfork() function
|
||||
* as described above or the pthread_atfork() funciton shall not be
|
||||
* provided."
|
||||
*/
|
||||
|
||||
/*
|
||||
* 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_init(
|
||||
pthread_mutexattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_mutexattr_destroy(
|
||||
pthread_mutexattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_mutexattr_getpshared(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *pshared
|
||||
);
|
||||
|
||||
int pthread_mutexattr_setpshared(
|
||||
pthread_mutexattr_t *attr,
|
||||
int pshared
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
|
||||
*/
|
||||
|
||||
int pthread_mutex_init(
|
||||
pthread_mutex_t *mutex,
|
||||
const pthread_mutexattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_mutex_destroy(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
/*
|
||||
* This is used to statically initialize a pthread_mutex_t. Example:
|
||||
*
|
||||
* pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
|
||||
|
||||
/*
|
||||
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
|
||||
*/
|
||||
|
||||
int pthread_mutex_lock(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
int pthread_mutex_trylock(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
int pthread_mutex_unlock(
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
|
||||
int pthread_mutex_timedlock(
|
||||
pthread_mutex_t *mutex,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
|
||||
#endif /* _POSIX_TIMEOUTS */
|
||||
|
||||
/*
|
||||
* 11.4.1 Condition Variable Initialization Attributes,
|
||||
* P1003.1c/Draft 10, p. 96
|
||||
*/
|
||||
|
||||
int pthread_condattr_init(
|
||||
pthread_condattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_condattr_destroy(
|
||||
pthread_condattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_condattr_getpshared(
|
||||
const pthread_condattr_t *attr,
|
||||
int *pshared
|
||||
);
|
||||
|
||||
int pthread_condattr_setpshared(
|
||||
pthread_condattr_t *attr,
|
||||
int pshared
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.4.2 Initializing and Destroying a Condition Variable,
|
||||
* P1003.1c/Draft 10, p. 87
|
||||
*/
|
||||
|
||||
int pthread_cond_init(
|
||||
pthread_cond_t *cond,
|
||||
const pthread_condattr_t *attr
|
||||
);
|
||||
|
||||
int pthread_cond_destroy(
|
||||
pthread_cond_t *mutex
|
||||
);
|
||||
|
||||
/*
|
||||
* This is used to statically initialize a pthread_cond_t. Example:
|
||||
*
|
||||
* pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_COND_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
|
||||
|
||||
/*
|
||||
* 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
|
||||
*/
|
||||
|
||||
int pthread_cond_signal(
|
||||
pthread_cond_t *cond
|
||||
);
|
||||
|
||||
int pthread_cond_broadcast(
|
||||
pthread_cond_t *cond
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
|
||||
*/
|
||||
|
||||
int pthread_cond_wait(
|
||||
pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex
|
||||
);
|
||||
|
||||
int pthread_cond_timedwait(
|
||||
pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex,
|
||||
const struct timespec *abstime
|
||||
);
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
|
||||
|
||||
/*
|
||||
* 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
|
||||
*/
|
||||
|
||||
int pthread_attr_setscope(
|
||||
pthread_attr_t *attr,
|
||||
int contentionscope
|
||||
);
|
||||
|
||||
int pthread_attr_getscope(
|
||||
const pthread_attr_t *attr,
|
||||
int *contentionscope
|
||||
);
|
||||
|
||||
int pthread_attr_setinheritsched(
|
||||
pthread_attr_t *attr,
|
||||
int inheritsched
|
||||
);
|
||||
|
||||
int pthread_attr_getinheritsched(
|
||||
const pthread_attr_t *attr,
|
||||
int *inheritsched
|
||||
);
|
||||
|
||||
int pthread_attr_setschedpolicy(
|
||||
pthread_attr_t *attr,
|
||||
int policy
|
||||
);
|
||||
|
||||
int pthread_attr_getschedpolicy(
|
||||
const pthread_attr_t *attr,
|
||||
int *policy
|
||||
);
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
|
||||
|
||||
/*
|
||||
* 13.5.2 Dynamic Thread Scheduling Parameters Access,
|
||||
* P1003.1c/Draft 10, p. 124
|
||||
*/
|
||||
|
||||
int pthread_getschedparam(
|
||||
pthread_t thread,
|
||||
int *policy,
|
||||
struct sched_param *param
|
||||
);
|
||||
|
||||
int pthread_setschedparam(
|
||||
pthread_t thread,
|
||||
int policy,
|
||||
struct sched_param *param
|
||||
);
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||
|
||||
/*
|
||||
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_setprotocol(
|
||||
pthread_mutexattr_t *attr,
|
||||
int protocol
|
||||
);
|
||||
|
||||
int pthread_mutexattr_getprotocol(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *protocol
|
||||
);
|
||||
|
||||
int pthread_mutexattr_setprioceiling(
|
||||
pthread_mutexattr_t *attr,
|
||||
int prioceiling
|
||||
);
|
||||
|
||||
int pthread_mutexattr_getprioceiling(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *prioceiling
|
||||
);
|
||||
|
||||
#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
|
||||
|
||||
#if defined(_POSIX_THREAD_PRIO_PROTECT)
|
||||
|
||||
/*
|
||||
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
|
||||
*/
|
||||
|
||||
int pthread_mutex_setprioceiling(
|
||||
pthread_mutex_t *mutex,
|
||||
int prioceiling,
|
||||
int *old_ceiling
|
||||
);
|
||||
|
||||
int pthread_mutex_getprioceiling(
|
||||
pthread_mutex_t *mutex,
|
||||
int *prioceiling
|
||||
);
|
||||
|
||||
#endif /* _POSIX_THREAD_PRIO_PROTECT */
|
||||
|
||||
/*
|
||||
* 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
|
||||
*/
|
||||
|
||||
int pthread_attr_init(
|
||||
pthread_attr_t *attr
|
||||
);
|
||||
|
||||
int pthread_attr_destroy(
|
||||
pthread_attr_t *attr
|
||||
);
|
||||
|
||||
int pthread_attr_getstacksize(
|
||||
const pthread_attr_t *attr,
|
||||
size_t *stacksize
|
||||
);
|
||||
|
||||
int pthread_attr_setstacksize(
|
||||
pthread_attr_t *attr,
|
||||
size_t stacksize
|
||||
);
|
||||
|
||||
int pthread_attr_getstackaddr(
|
||||
const pthread_attr_t *attr,
|
||||
void **stackaddr
|
||||
);
|
||||
|
||||
int pthread_attr_setstackaddr(
|
||||
pthread_attr_t *attr,
|
||||
void *stackaddr
|
||||
);
|
||||
|
||||
int pthread_attr_getdetachstate(
|
||||
const pthread_attr_t *attr,
|
||||
int *detachstate
|
||||
);
|
||||
|
||||
int pthread_attr_setdetachstate(
|
||||
pthread_attr_t *attr,
|
||||
int detachstate
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
|
||||
*/
|
||||
|
||||
int pthread_create(
|
||||
pthread_t *thread,
|
||||
const pthread_attr_t *attr,
|
||||
void *(*start_routine)( void * ),
|
||||
void *arg
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
|
||||
*/
|
||||
|
||||
int pthread_join(
|
||||
pthread_t thread,
|
||||
void **value_ptr
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
|
||||
*/
|
||||
|
||||
int pthread_detach(
|
||||
pthread_t thread
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.5.1 Thread Termination, p1003.1c/Draft 10, p. 150
|
||||
*/
|
||||
|
||||
void pthread_exit(
|
||||
void *value_ptr
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
|
||||
*/
|
||||
|
||||
pthread_t pthread_self( void );
|
||||
|
||||
/*
|
||||
* 16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
|
||||
*/
|
||||
|
||||
int pthread_equal(
|
||||
pthread_t t1,
|
||||
pthread_t t2
|
||||
);
|
||||
|
||||
/*
|
||||
* 16.1.8 Dynamic Package Initialization
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is used to statically initialize a pthread_once_t. Example:
|
||||
*
|
||||
* pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
*
|
||||
* NOTE: This is named inconsistently -- it should be INITIALIZER.
|
||||
*/
|
||||
|
||||
#define PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
|
||||
|
||||
int pthread_once(
|
||||
pthread_once_t *once_control,
|
||||
void (*init_routine)(void)
|
||||
);
|
||||
|
||||
/*
|
||||
* 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
|
||||
*/
|
||||
|
||||
int pthread_key_create(
|
||||
pthread_key_t *key,
|
||||
void (*destructor)( void * )
|
||||
);
|
||||
|
||||
/*
|
||||
* 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
|
||||
*/
|
||||
|
||||
int pthread_setspecific(
|
||||
pthread_key_t key,
|
||||
const void *value
|
||||
);
|
||||
|
||||
void *pthread_getspecific(
|
||||
pthread_key_t key
|
||||
);
|
||||
|
||||
/*
|
||||
* 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
|
||||
*/
|
||||
|
||||
int pthread_key_delete(
|
||||
pthread_key_t key
|
||||
);
|
||||
|
||||
/*
|
||||
* 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
|
||||
*/
|
||||
|
||||
#define PTHREAD_CANCEL_ENABLE 0
|
||||
#define PTHREAD_CANCEL_DISABLE 1
|
||||
|
||||
#define PTHREAD_CANCEL_DEFERRED 0
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
|
||||
|
||||
int pthread_cancel(
|
||||
pthread_t thread
|
||||
);
|
||||
|
||||
/*
|
||||
* 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
|
||||
*/
|
||||
|
||||
int pthread_setcancelstate(
|
||||
int state,
|
||||
int *oldstate
|
||||
);
|
||||
|
||||
int pthread_setcanceltype(
|
||||
int type,
|
||||
int *oldtype
|
||||
);
|
||||
|
||||
void pthread_testcancel( void );
|
||||
|
||||
/*
|
||||
* 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
|
||||
*/
|
||||
|
||||
void pthread_cleanup_push(
|
||||
void (*routine)( void * ),
|
||||
void *arg
|
||||
);
|
||||
|
||||
void pthread_cleanup_pop(
|
||||
int execute
|
||||
);
|
||||
|
||||
#if defined(_POSIX_THREAD_CPUTIME)
|
||||
|
||||
/*
|
||||
* 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
|
||||
*/
|
||||
|
||||
int pthread_getcpuclockid(
|
||||
pthread_t thread_id,
|
||||
clockid_t *clock_id
|
||||
);
|
||||
|
||||
/*
|
||||
* 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
|
||||
*/
|
||||
|
||||
int pthread_attr_setcputime(
|
||||
pthread_attr_t *attr,
|
||||
int clock_allowed
|
||||
);
|
||||
|
||||
int pthread_attr_getcputime(
|
||||
pthread_attr_t *attr,
|
||||
int *clock_allowed
|
||||
);
|
||||
|
||||
#endif /* defined(_POSIX_THREAD_CPUTIME) */
|
||||
|
||||
#endif /* defined(_POSIX_THREADS) */
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,88 +0,0 @@
|
||||
/* sched.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __POSIX_SCHEDULING_h
|
||||
#define __POSIX_SCHEDULING_h
|
||||
|
||||
#include <sys/features.h>
|
||||
|
||||
#if defined(_POSIX_PRIORITY_SCHEDULING)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <sys/sched.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
* 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
|
||||
*
|
||||
*/
|
||||
|
||||
int sched_setparam(
|
||||
pid_t pid,
|
||||
const struct sched_param *param
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
|
||||
*/
|
||||
|
||||
int sched_getparam(
|
||||
pid_t pid,
|
||||
const struct sched_param *param
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.3 Set Scheduling Policy and Scheduling Parameters,
|
||||
* P1003.1b-1993, p. 254
|
||||
*/
|
||||
|
||||
int sched_setscheduler(
|
||||
pid_t pid,
|
||||
int policy,
|
||||
const struct sched_param *param
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
|
||||
*/
|
||||
|
||||
int sched_getscheduler(
|
||||
pid_t pid
|
||||
);
|
||||
|
||||
/*
|
||||
* 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
|
||||
*/
|
||||
|
||||
int sched_get_priority_max(
|
||||
int policy
|
||||
);
|
||||
|
||||
int sched_get_priority_min(
|
||||
int policy
|
||||
);
|
||||
|
||||
int sched_rr_get_interval(
|
||||
pid_t pid,
|
||||
struct timespec *interval
|
||||
);
|
||||
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
|
||||
|
||||
/*
|
||||
* 13.3.5 Yield Processor, P1003.1b-1993, p. 257
|
||||
*/
|
||||
|
||||
int sched_yield( void );
|
||||
|
||||
#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/* semaphore.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_SEMAPHORE_h
|
||||
#define __POSIX_SEMAPHORE_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
#if defined(_POSIX_SEMAPHORES)
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
/*
|
||||
* 11.1 Semaphore Characteristics, P1003.1b-1993, p.219
|
||||
*/
|
||||
|
||||
typedef int sem_t;
|
||||
|
||||
/*
|
||||
* 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
|
||||
*/
|
||||
|
||||
int sem_init(
|
||||
sem_t *sem,
|
||||
int pshared,
|
||||
unsigned int value
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
|
||||
*/
|
||||
|
||||
int sem_destroy(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
|
||||
*
|
||||
* NOTE: Follows open() calling conventions.
|
||||
*/
|
||||
|
||||
sem_t *sem_open(
|
||||
const char *name,
|
||||
int oflag,
|
||||
...
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
|
||||
*/
|
||||
|
||||
int sem_close(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
|
||||
*/
|
||||
|
||||
int sem_unlink(
|
||||
const char *name
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
|
||||
*/
|
||||
|
||||
int sem_wait(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
int sem_trywait(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
#if defined(_POSIX_TIMEOUTS)
|
||||
int sem_timedwait(
|
||||
sem_t *sem,
|
||||
const struct timespec *timeout
|
||||
);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
|
||||
*/
|
||||
|
||||
int sem_post(
|
||||
sem_t *sem
|
||||
);
|
||||
|
||||
/*
|
||||
* 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
|
||||
*/
|
||||
|
||||
int sem_getvalue(
|
||||
sem_t *sem,
|
||||
int *sval
|
||||
);
|
||||
|
||||
#endif /* _POSIX_SEMAPHORES */
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,85 +0,0 @@
|
||||
/* unistd.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_UNISTD_h
|
||||
#define __POSIX_UNISTD_h
|
||||
|
||||
#include <rtems/posix/features.h>
|
||||
|
||||
/*
|
||||
* 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96
|
||||
*
|
||||
* NOTE: Table 4-2, Configurable System Variables, p. 96
|
||||
*/
|
||||
|
||||
#define _SC_AIO_LISTIO_MAX 0
|
||||
#define _SC_AIO_MAX 1
|
||||
#define _SC_AIO_PRIO_DELTA_MAX 2
|
||||
#define _SC_ARG_MAX 3
|
||||
#define _SC_CHILD_MAX 4
|
||||
#define _SC_CLK_TCK 5
|
||||
#define _SC_DELAYTIMER_MAX 6
|
||||
#define _SC_MQ_OPEN_MAX 7
|
||||
#define _SC_MQ_PRIO_MAX 8
|
||||
#define _SC_NGROUPS_MAX 9
|
||||
#define _SC_OPEN_MAX 10
|
||||
#define _SC_PAGESIZE 11
|
||||
#define _SC_RTSIG_MAX 12
|
||||
#define _SC_SEM_NSEMS_MAX 13
|
||||
#define _SC_SEM_VALUE_MAX 14
|
||||
#define _SC_SIGQUEUE_MAX 15
|
||||
#define _SC_STREAM_MAX 16
|
||||
#define _SC_TIMER_MAX 17
|
||||
#define _SC_TZNAME_MAX 18
|
||||
|
||||
#define _SC_ASYNCHRONOUS_IO 19
|
||||
#define _SC_FSYNC 20
|
||||
#define _SC_JOB_CONTROL 21
|
||||
#define _SC_MAPPED_FILES 22
|
||||
#define _SC_MEMLOCK 23
|
||||
#define _SC_MEMLOCK_RANGE 24
|
||||
#define _SC_MEMORY_PROTECTION 25
|
||||
#define _SC_MESSAGE_PASSING 26
|
||||
#define _SC_PRIORITIZED_IO 27
|
||||
#define _SC_REALTIME_SIGNALS 28
|
||||
#define _SC_SAVED_IDS 29
|
||||
#define _SC_SEMAPHORES 30
|
||||
#define _SC_SHARED_MEMORY_OBJECTS 31
|
||||
#define _SC_SYNCHRONIZED_IO 32
|
||||
#define _SC_TIMERS 33
|
||||
#define _SC_VERSION 34
|
||||
|
||||
/*
|
||||
* P1003.1c/D10, p. 52 adds the following.
|
||||
*/
|
||||
|
||||
#define _SC_GETGR_R_SIZE_MAX 35
|
||||
#define _SC_GETPW_R_SIZE_MAX
|
||||
#define _SC_LOGIN_NAME_MAX
|
||||
#define _SC_THREAD_DESTRUCTOR_ITERATIONS
|
||||
#define _SC_THREAD_KEYS_MAX
|
||||
#define _SC_THREAD_STACK_MIN
|
||||
#define _SC_THREAD_THREADS_MAX
|
||||
#define _SC_TTY_NAME_MAX
|
||||
|
||||
#define _SC_THREADS
|
||||
#define _SC_THREAD_ATTR_STACKADDR
|
||||
#define _SC_THREAD_ATTR_STACKSIZE
|
||||
#define _SC_THREAD_PRIORITY_SCHEDULING
|
||||
#define _SC_THREAD_PRIO_INHERIT
|
||||
#define _SC_THREAD_PRIO_CEILING
|
||||
#define _SC_THREAD_PROCESS_SHARED
|
||||
#define _SC_THREAD_SAGE_FUNCTIONS
|
||||
|
||||
/*
|
||||
* 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95
|
||||
*/
|
||||
|
||||
long sysconf(
|
||||
int name
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of include */
|
||||
@@ -1,76 +0,0 @@
|
||||
/* rtems/posix/cond.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX condition variables.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
|
||||
#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control
|
||||
*_POSIX_Condition_variables_Allocate( void )
|
||||
{
|
||||
return (POSIX_Condition_variables_Control *)
|
||||
_Objects_Allocate( &_POSIX_Condition_variables_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
)
|
||||
{
|
||||
_Objects_Free(
|
||||
&_POSIX_Condition_variables_Information,
|
||||
&the_condition_variable->Object
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
/* XXX really should validate pointer */
|
||||
return (POSIX_Condition_variables_Control *)
|
||||
_Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
)
|
||||
{
|
||||
return !the_condition_variable;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* rtems/posix/intr.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX Interrupt Manager
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_INTERRUPT_inl
|
||||
#define __RTEMS_POSIX_INTERRUPT_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Handler_control *
|
||||
_POSIX_Interrupt_Allocate( void )
|
||||
{
|
||||
return (POSIX_Interrupt_Handler_control *)
|
||||
_Objects_Allocate( &_POSIX_Interrupt_Handlers_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Interrupt_Free (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Interrupt_Control *)
|
||||
_Objects_Get( &_POSIX_Interrupt_Handlers_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Interrupt_Is_null (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
)
|
||||
{
|
||||
return !the_intr;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/* rtems/posix/key.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX key's.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_KEY_inl
|
||||
#define __RTEMS_POSIX_KEY_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
|
||||
{
|
||||
return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
|
||||
POSIX_Keys_Control *the_key
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Keys_Control *)
|
||||
_Objects_Get( &_POSIX_Keys_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Keys_Is_null (
|
||||
POSIX_Keys_Control *the_key
|
||||
)
|
||||
{
|
||||
return !the_key;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/* rtems/posix/mqueue.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX Message Queue.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_inl
|
||||
#define __RTEMS_POSIX_MESSAGE_QUEUE_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void )
|
||||
{
|
||||
return (POSIX_Message_queue_Control *)
|
||||
_Objects_Allocate( &_POSIX_Message_queue_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Message_queue_Control *)
|
||||
_Objects_Get( &_POSIX_Message_queue_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Message_queue_Is_null (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
)
|
||||
{
|
||||
return !the_mq;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Priority_to_core
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Message_queue_Priority_to_core(
|
||||
unsigned int priority
|
||||
)
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/* rtems/posix/mutex.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX mutex's.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MUTEX_inl
|
||||
#define __RTEMS_POSIX_MUTEX_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
|
||||
{
|
||||
return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
int status;
|
||||
|
||||
if ( !id ) {
|
||||
*location = OBJECTS_ERROR;
|
||||
return (POSIX_Mutex_Control *) 0;
|
||||
}
|
||||
|
||||
if ( *id == PTHREAD_MUTEX_INITIALIZER ) {
|
||||
/*
|
||||
* Do an "auto-create" here.
|
||||
*/
|
||||
|
||||
status = pthread_mutex_init( id, 0 );
|
||||
if ( status ) {
|
||||
*location = OBJECTS_ERROR;
|
||||
return (POSIX_Mutex_Control *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now call Objects_Get()
|
||||
*/
|
||||
|
||||
return (POSIX_Mutex_Control *)
|
||||
_Objects_Get( &_POSIX_Mutex_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
return !the_mutex;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_inl
|
||||
#define __RTEMS_POSIX_PRIORITY_inl
|
||||
|
||||
/*
|
||||
* 1003.1b-1993,2.2.2.80 definition of priority, p. 19
|
||||
*
|
||||
* "Numericallly higher values represent higher priorities."
|
||||
*
|
||||
* Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (boolean) (priority >= 1 && priority <= 255);
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (Priority_Control) (256 - priority);
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
)
|
||||
{
|
||||
return 256 - priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
/* rtems/posix/pthread.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX threads.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREADS_inl
|
||||
#define __RTEMS_POSIX_THREADS_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void )
|
||||
{
|
||||
return (Thread_Control *) _Objects_Allocate( &_POSIX_Threads_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
|
||||
Thread_Control *the_pthread
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get (
|
||||
pthread_t id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Thread_Control *)
|
||||
_Objects_Get( &_POSIX_Threads_Information, (Objects_Id)id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Threads_Is_null (
|
||||
Thread_Control *the_pthread
|
||||
)
|
||||
{
|
||||
return !the_pthread;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/* rtems/posix/cond.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX condition variables.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
|
||||
#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control
|
||||
*_POSIX_Condition_variables_Allocate( void )
|
||||
{
|
||||
return (POSIX_Condition_variables_Control *)
|
||||
_Objects_Allocate( &_POSIX_Condition_variables_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
)
|
||||
{
|
||||
_Objects_Free(
|
||||
&_POSIX_Condition_variables_Information,
|
||||
&the_condition_variable->Object
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
/* XXX really should validate pointer */
|
||||
return (POSIX_Condition_variables_Control *)
|
||||
_Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
)
|
||||
{
|
||||
return !the_condition_variable;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* rtems/posix/intr.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX Interrupt Manager
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_INTERRUPT_inl
|
||||
#define __RTEMS_POSIX_INTERRUPT_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Handler_control *
|
||||
_POSIX_Interrupt_Allocate( void )
|
||||
{
|
||||
return (POSIX_Interrupt_Handler_control *)
|
||||
_Objects_Allocate( &_POSIX_Interrupt_Handlers_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Interrupt_Free (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Interrupt_Control *)
|
||||
_Objects_Get( &_POSIX_Interrupt_Handlers_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Interrupt_Is_null (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
)
|
||||
{
|
||||
return !the_intr;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/* rtems/posix/key.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX key's.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_KEY_inl
|
||||
#define __RTEMS_POSIX_KEY_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
|
||||
{
|
||||
return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
|
||||
POSIX_Keys_Control *the_key
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Keys_Control *)
|
||||
_Objects_Get( &_POSIX_Keys_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Keys_Is_null (
|
||||
POSIX_Keys_Control *the_key
|
||||
)
|
||||
{
|
||||
return !the_key;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/* rtems/posix/mqueue.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX Message Queue.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_inl
|
||||
#define __RTEMS_POSIX_MESSAGE_QUEUE_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void )
|
||||
{
|
||||
return (POSIX_Message_queue_Control *)
|
||||
_Objects_Allocate( &_POSIX_Message_queue_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Message_queue_Control *)
|
||||
_Objects_Get( &_POSIX_Message_queue_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Message_queue_Is_null (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
)
|
||||
{
|
||||
return !the_mq;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Priority_to_core
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Message_queue_Priority_to_core(
|
||||
unsigned int priority
|
||||
)
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/* rtems/posix/mutex.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX mutex's.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MUTEX_inl
|
||||
#define __RTEMS_POSIX_MUTEX_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
|
||||
{
|
||||
return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
int status;
|
||||
|
||||
if ( !id ) {
|
||||
*location = OBJECTS_ERROR;
|
||||
return (POSIX_Mutex_Control *) 0;
|
||||
}
|
||||
|
||||
if ( *id == PTHREAD_MUTEX_INITIALIZER ) {
|
||||
/*
|
||||
* Do an "auto-create" here.
|
||||
*/
|
||||
|
||||
status = pthread_mutex_init( id, 0 );
|
||||
if ( status ) {
|
||||
*location = OBJECTS_ERROR;
|
||||
return (POSIX_Mutex_Control *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now call Objects_Get()
|
||||
*/
|
||||
|
||||
return (POSIX_Mutex_Control *)
|
||||
_Objects_Get( &_POSIX_Mutex_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
return !the_mutex;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_inl
|
||||
#define __RTEMS_POSIX_PRIORITY_inl
|
||||
|
||||
/*
|
||||
* 1003.1b-1993,2.2.2.80 definition of priority, p. 19
|
||||
*
|
||||
* "Numericallly higher values represent higher priorities."
|
||||
*
|
||||
* Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (boolean) (priority >= 1 && priority <= 255);
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (Priority_Control) (256 - priority);
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
)
|
||||
{
|
||||
return 256 - priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
/* rtems/posix/pthread.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX threads.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREADS_inl
|
||||
#define __RTEMS_POSIX_THREADS_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void )
|
||||
{
|
||||
return (Thread_Control *) _Objects_Allocate( &_POSIX_Threads_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free (
|
||||
Thread_Control *the_pthread
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get (
|
||||
pthread_t id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Thread_Control *)
|
||||
_Objects_Get( &_POSIX_Threads_Information, (Objects_Id)id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Threads_Is_null (
|
||||
Thread_Control *the_pthread
|
||||
)
|
||||
{
|
||||
return !the_pthread;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/* rtems/posix/semaphore.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX Semaphores.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_SEMAPHORE_inl
|
||||
#define __RTEMS_POSIX_SEMAPHORE_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void )
|
||||
{
|
||||
return (POSIX_Semaphore_Control *)
|
||||
_Objects_Allocate( &_POSIX_Semaphore_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Semaphore_Control *)
|
||||
_Objects_Get( &_POSIX_Semaphore_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Semaphore_Is_null (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
)
|
||||
{
|
||||
return !the_semaphore;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/* rtems/posix/semaphore.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the private
|
||||
* inlined routines for POSIX Semaphores.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_SEMAPHORE_inl
|
||||
#define __RTEMS_POSIX_SEMAPHORE_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Allocate
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void )
|
||||
{
|
||||
return (POSIX_Semaphore_Control *)
|
||||
_Objects_Allocate( &_POSIX_Semaphore_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Free
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Get
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Semaphore_Control *)
|
||||
_Objects_Get( &_POSIX_Semaphore_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Is_null
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Semaphore_Is_null (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
)
|
||||
{
|
||||
return !the_semaphore;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/posix/pthread.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ada_pthread_minimum_stack_size
|
||||
*
|
||||
* This routine returns the minimum stack size so the GNAT RTS can
|
||||
* allocate enough stack for Ada tasks.
|
||||
*/
|
||||
|
||||
size_t _ada_pthread_minimum_stack_size( void )
|
||||
{
|
||||
/*
|
||||
* Eventually this may need to include a per cpu family calculation
|
||||
* but for now, this will do.
|
||||
*/
|
||||
|
||||
return PTHREAD_MINIMUM_STACK_SIZE * 2;
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <aio.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
|
||||
*/
|
||||
|
||||
int aio_read(
|
||||
struct aiocb *aiocbp
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
|
||||
*/
|
||||
|
||||
int aio_write(
|
||||
struct aiocb *aiocbp
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
|
||||
*/
|
||||
|
||||
int lio_listio(
|
||||
int mode,
|
||||
struct aiocb * const list[],
|
||||
int nent,
|
||||
struct sigevent *sig
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
|
||||
*/
|
||||
|
||||
int aio_error(
|
||||
const struct aiocb *aiocbp
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
|
||||
* P1003.1b-1993, p. 162
|
||||
*/
|
||||
|
||||
int aio_return(
|
||||
const struct aiocb *aiocbp
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
|
||||
*/
|
||||
|
||||
int aio_cancel(
|
||||
int filedes,
|
||||
struct aiocb *aiocbp
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
|
||||
*/
|
||||
|
||||
int aio_suspend(
|
||||
struct aiocb * const list[],
|
||||
int nent,
|
||||
const struct timespec *timeout
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
|
||||
*/
|
||||
|
||||
int aio_fsync(
|
||||
int op,
|
||||
struct aiocb *aiocbp
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
#include <rtems/posix/cancel.h>
|
||||
#include <rtems/posix/pthread.h>
|
||||
#include <rtems/posix/threadsup.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* POSIX_Thread_cancel_run
|
||||
*
|
||||
*/
|
||||
|
||||
void POSIX_Thread_cancel_run(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
int old_cancel_state;
|
||||
POSIX_Cancel_Handler_control *handler;
|
||||
Chain_Control *handler_stack;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
ISR_Level level;
|
||||
|
||||
thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
handler_stack = &thread_support->Cancellation_Handlers;
|
||||
|
||||
old_cancel_state = thread_support->cancelability_state;
|
||||
|
||||
thread_support->cancelability_state = PTHREAD_CANCEL_DISABLE;
|
||||
|
||||
while ( !_Chain_Is_empty( handler_stack ) ) {
|
||||
_ISR_Disable( level );
|
||||
handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
|
||||
_Chain_Extract_unprotected( &handler->Node );
|
||||
_ISR_Enable( level );
|
||||
|
||||
(*handler->routine)( handler->arg );
|
||||
|
||||
_Workspace_Free( handler );
|
||||
}
|
||||
|
||||
thread_support->cancelation_requested = 0;
|
||||
|
||||
thread_support->cancelability_state = old_cancel_state;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
|
||||
*/
|
||||
|
||||
int pthread_cancel(
|
||||
pthread_t thread
|
||||
)
|
||||
{
|
||||
Thread_Control *the_thread;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
Objects_Locations location;
|
||||
|
||||
the_thread = _POSIX_Threads_Get( &thread, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
case OBJECTS_LOCAL:
|
||||
thread_support = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
thread_support->cancelation_requested = 1;
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
|
||||
*/
|
||||
|
||||
int pthread_setcancelstate(
|
||||
int state,
|
||||
int *oldstate
|
||||
)
|
||||
{
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
|
||||
if ( !oldstate )
|
||||
return EINVAL;
|
||||
|
||||
if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE )
|
||||
return EINVAL;
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
*oldstate = thread_support->cancelability_state;
|
||||
thread_support->cancelability_state = state;
|
||||
|
||||
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
|
||||
thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
|
||||
thread_support->cancelation_requested )
|
||||
POSIX_Thread_cancel_run( _Thread_Executing );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
|
||||
*/
|
||||
|
||||
int pthread_setcanceltype(
|
||||
int type,
|
||||
int *oldtype
|
||||
)
|
||||
{
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
|
||||
if ( !oldtype )
|
||||
return EINVAL;
|
||||
|
||||
if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
|
||||
return EINVAL;
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
*oldtype = thread_support->cancelability_type;
|
||||
thread_support->cancelability_type = type;
|
||||
|
||||
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
|
||||
thread_support->cancelability_type == PTHREAD_CANCEL_ASYNCHRONOUS &&
|
||||
thread_support->cancelation_requested )
|
||||
POSIX_Thread_cancel_run( _Thread_Executing );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
|
||||
*/
|
||||
|
||||
void pthread_testcancel( void )
|
||||
{
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
if ( thread_support->cancelability_state == PTHREAD_CANCEL_ENABLE &&
|
||||
thread_support->cancelation_requested )
|
||||
POSIX_Thread_cancel_run( _Thread_Executing );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
|
||||
*/
|
||||
|
||||
void pthread_cleanup_push(
|
||||
void (*routine)( void * ),
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
POSIX_Cancel_Handler_control *handler;
|
||||
Chain_Control *handler_stack;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
|
||||
if ( !routine )
|
||||
return; /* XXX what to do really? */
|
||||
|
||||
handler = _Workspace_Allocate( sizeof( POSIX_Cancel_Handler_control ) );
|
||||
|
||||
if ( !handler )
|
||||
return; /* XXX what to do really? */
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
handler_stack = &thread_support->Cancellation_Handlers;
|
||||
|
||||
handler->routine = routine;
|
||||
handler->arg = arg;
|
||||
|
||||
_Chain_Append( handler_stack, &handler->Node );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
|
||||
*/
|
||||
|
||||
void pthread_cleanup_pop(
|
||||
int execute
|
||||
)
|
||||
{
|
||||
POSIX_Cancel_Handler_control *handler;
|
||||
Chain_Control *handler_stack;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
ISR_Level level;
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
handler_stack = &thread_support->Cancellation_Handlers;
|
||||
|
||||
if ( _Chain_Is_empty( handler_stack ) )
|
||||
return;
|
||||
|
||||
_ISR_Disable( level );
|
||||
handler = (POSIX_Cancel_Handler_control *) _Chain_Tail( handler_stack );
|
||||
_Chain_Extract_unprotected( &handler->Node );
|
||||
_ISR_Enable( level );
|
||||
|
||||
if ( execute )
|
||||
(*handler->routine)( handler->arg );
|
||||
|
||||
_Workspace_Free( handler );
|
||||
}
|
||||
@@ -1,497 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/states.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
#include <rtems/posix/cond.h>
|
||||
#include <rtems/posix/time.h>
|
||||
#include <rtems/posix/mutex.h>
|
||||
|
||||
/*
|
||||
* TEMPORARY
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_process_packet (
|
||||
POSIX_Condition_variables_MP_Remote_operations operation,
|
||||
Objects_Id condition_variables_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
)
|
||||
{
|
||||
(void) POSIX_MP_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_extract_proxy(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
(void) POSIX_MP_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*
|
||||
* END OF TEMPORARY
|
||||
*/
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* The default condition variable attributes structure.
|
||||
*/
|
||||
|
||||
const pthread_condattr_t _POSIX_Condition_variables_Default_attributes = {
|
||||
TRUE, /* is_initialized */
|
||||
PTHREAD_PROCESS_PRIVATE /* process_shared */
|
||||
};
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Manager_initialization
|
||||
*
|
||||
* This routine initializes all condition variable manager related data
|
||||
* structures.
|
||||
*
|
||||
* Input parameters:
|
||||
* maximum_condition_variables - maximum configured condition_variables
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_Manager_initialization(
|
||||
unsigned32 maximum_condition_variables
|
||||
)
|
||||
{
|
||||
_Objects_Initialize_information(
|
||||
&_POSIX_Condition_variables_Information,
|
||||
OBJECTS_POSIX_CONDITION_VARIABLES,
|
||||
TRUE,
|
||||
maximum_condition_variables,
|
||||
sizeof( POSIX_Condition_variables_Control ),
|
||||
FALSE,
|
||||
0,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.1 Condition Variable Initialization Attributes,
|
||||
* P1003.1c/Draft 10, p. 96
|
||||
*/
|
||||
|
||||
int pthread_condattr_init(
|
||||
pthread_condattr_t *attr
|
||||
)
|
||||
{
|
||||
if ( !attr )
|
||||
return EINVAL;
|
||||
|
||||
*attr = _POSIX_Condition_variables_Default_attributes;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.1 Condition Variable Initialization Attributes,
|
||||
* P1003.1c/Draft 10, p. 96
|
||||
*/
|
||||
|
||||
int pthread_condattr_destroy(
|
||||
pthread_condattr_t *attr
|
||||
)
|
||||
{
|
||||
if ( !attr || attr->is_initialized == FALSE )
|
||||
return EINVAL;
|
||||
|
||||
attr->is_initialized = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.1 Condition Variable Initialization Attributes,
|
||||
* P1003.1c/Draft 10, p. 96
|
||||
*/
|
||||
|
||||
int pthread_condattr_getpshared(
|
||||
const pthread_condattr_t *attr,
|
||||
int *pshared
|
||||
)
|
||||
{
|
||||
if ( !attr )
|
||||
return EINVAL;
|
||||
|
||||
*pshared = attr->process_shared;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.1 Condition Variable Initialization Attributes,
|
||||
* P1003.1c/Draft 10, p. 96
|
||||
*/
|
||||
|
||||
int pthread_condattr_setpshared(
|
||||
pthread_condattr_t *attr,
|
||||
int pshared
|
||||
)
|
||||
{
|
||||
if ( !attr )
|
||||
return EINVAL;
|
||||
|
||||
switch ( pshared ) {
|
||||
case PTHREAD_PROCESS_SHARED:
|
||||
case PTHREAD_PROCESS_PRIVATE:
|
||||
attr->process_shared = pshared;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.2 Initializing and Destroying a Condition Variable,
|
||||
* P1003.1c/Draft 10, p. 87
|
||||
*/
|
||||
|
||||
int pthread_cond_init(
|
||||
pthread_cond_t *cond,
|
||||
const pthread_condattr_t *attr
|
||||
)
|
||||
{
|
||||
POSIX_Condition_variables_Control *the_cond;
|
||||
const pthread_condattr_t *the_attr;
|
||||
|
||||
if ( attr ) the_attr = attr;
|
||||
else the_attr = &_POSIX_Condition_variables_Default_attributes;
|
||||
|
||||
/*
|
||||
* XXX: Be careful about attributes when global!!!
|
||||
*/
|
||||
|
||||
if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
|
||||
if ( !the_attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_cond = _POSIX_Condition_variables_Allocate();
|
||||
|
||||
if ( !the_cond ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED &&
|
||||
!( _Objects_MP_Allocate_and_open( &_POSIX_Condition_variables_Information,
|
||||
0, the_cond->Object.id, FALSE ) ) ) {
|
||||
_POSIX_Condition_variables_Free( the_cond );
|
||||
_Thread_Enable_dispatch();
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
the_cond->process_shared = the_attr->process_shared;
|
||||
|
||||
the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
|
||||
|
||||
/* XXX some more initialization might need to go here */
|
||||
_Thread_queue_Initialize(
|
||||
&the_cond->Wait_queue,
|
||||
OBJECTS_POSIX_CONDITION_VARIABLES,
|
||||
THREAD_QUEUE_DISCIPLINE_FIFO,
|
||||
STATES_WAITING_FOR_CONDITION_VARIABLE,
|
||||
_POSIX_Condition_variables_MP_Send_extract_proxy,
|
||||
ETIMEDOUT
|
||||
);
|
||||
|
||||
_Objects_Open(
|
||||
&_POSIX_Condition_variables_Information,
|
||||
&the_cond->Object,
|
||||
0
|
||||
);
|
||||
|
||||
*cond = the_cond->Object.id;
|
||||
|
||||
if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
|
||||
_POSIX_Condition_variables_MP_Send_process_packet(
|
||||
POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE,
|
||||
the_cond->Object.id,
|
||||
0, /* Name not used */
|
||||
0 /* Not used */
|
||||
);
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.2 Initializing and Destroying a Condition Variable,
|
||||
* P1003.1c/Draft 10, p. 87
|
||||
*/
|
||||
|
||||
int pthread_cond_destroy(
|
||||
pthread_cond_t *cond
|
||||
)
|
||||
{
|
||||
register POSIX_Condition_variables_Control *the_cond;
|
||||
Objects_Locations location;
|
||||
|
||||
the_cond = _POSIX_Condition_variables_Get( cond, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
return EINVAL;
|
||||
case OBJECTS_LOCAL:
|
||||
|
||||
if ( _Thread_queue_First( &the_cond->Wait_queue ) ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
_Objects_Close(
|
||||
&_POSIX_Condition_variables_Information,
|
||||
&the_cond->Object
|
||||
);
|
||||
|
||||
_POSIX_Condition_variables_Free( the_cond );
|
||||
|
||||
if ( the_cond->process_shared == PTHREAD_PROCESS_SHARED ) {
|
||||
|
||||
_Objects_MP_Close(
|
||||
&_POSIX_Condition_variables_Information,
|
||||
the_cond->Object.id
|
||||
);
|
||||
|
||||
_POSIX_Condition_variables_MP_Send_process_packet(
|
||||
POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE,
|
||||
the_cond->Object.id,
|
||||
0, /* Not used */
|
||||
0 /* Not used */
|
||||
);
|
||||
}
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Signal_support
|
||||
*
|
||||
* A support routine which implements guts of the broadcast and single task
|
||||
* wake up version of the "signal" operation.
|
||||
*/
|
||||
|
||||
int _POSIX_Condition_variables_Signal_support(
|
||||
pthread_cond_t *cond,
|
||||
boolean is_broadcast
|
||||
)
|
||||
{
|
||||
register POSIX_Condition_variables_Control *the_cond;
|
||||
Objects_Locations location;
|
||||
Thread_Control *the_thread;
|
||||
|
||||
the_cond = _POSIX_Condition_variables_Get( cond, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
return EINVAL;
|
||||
case OBJECTS_LOCAL:
|
||||
|
||||
do {
|
||||
the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
|
||||
if ( !the_thread )
|
||||
the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
|
||||
} while ( is_broadcast && the_thread );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
|
||||
*/
|
||||
|
||||
int pthread_cond_signal(
|
||||
pthread_cond_t *cond
|
||||
)
|
||||
{
|
||||
return _POSIX_Condition_variables_Signal_support( cond, FALSE );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
|
||||
*/
|
||||
|
||||
int pthread_cond_broadcast(
|
||||
pthread_cond_t *cond
|
||||
)
|
||||
{
|
||||
return _POSIX_Condition_variables_Signal_support( cond, TRUE );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Condition_variables_Wait_support
|
||||
*
|
||||
* A support routine which implements guts of the blocking, non-blocking, and
|
||||
* timed wait version of condition variable wait routines.
|
||||
*/
|
||||
|
||||
int _POSIX_Condition_variables_Wait_support(
|
||||
pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex,
|
||||
Watchdog_Interval timeout,
|
||||
boolean already_timedout
|
||||
)
|
||||
{
|
||||
register POSIX_Condition_variables_Control *the_cond;
|
||||
Objects_Locations location;
|
||||
int status;
|
||||
int mutex_status;
|
||||
|
||||
if ( !_POSIX_Mutex_Get( mutex, &location ) ) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
_Thread_Unnest_dispatch();
|
||||
|
||||
the_cond = _POSIX_Condition_variables_Get( cond, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
return EINVAL;
|
||||
case OBJECTS_LOCAL:
|
||||
|
||||
if ( the_cond->Mutex && ( the_cond->Mutex != *mutex ) ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
(void) pthread_mutex_unlock( mutex );
|
||||
/* XXX ignore this for now since behavior is undefined
|
||||
if ( mutex_status ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EINVAL;
|
||||
}
|
||||
*/
|
||||
|
||||
if ( !already_timedout ) {
|
||||
the_cond->Mutex = *mutex;
|
||||
|
||||
_Thread_queue_Enter_critical_section( &the_cond->Wait_queue );
|
||||
_Thread_Executing->Wait.return_code = 0;
|
||||
_Thread_Executing->Wait.queue = &the_cond->Wait_queue;
|
||||
_Thread_Executing->Wait.id = *cond;
|
||||
|
||||
_Thread_queue_Enqueue( &the_cond->Wait_queue, timeout );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
/*
|
||||
* Switch ourself out because we blocked as a result of the
|
||||
* _Thread_queue_Enqueue.
|
||||
*/
|
||||
|
||||
status = _Thread_Executing->Wait.return_code;
|
||||
if ( status && status != ETIMEDOUT )
|
||||
return status;
|
||||
|
||||
}
|
||||
else
|
||||
status = ETIMEDOUT;
|
||||
|
||||
mutex_status = pthread_mutex_lock( mutex );
|
||||
if ( mutex_status )
|
||||
return EINVAL;
|
||||
|
||||
return status;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
|
||||
*/
|
||||
|
||||
int pthread_cond_wait(
|
||||
pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex
|
||||
)
|
||||
{
|
||||
return _POSIX_Condition_variables_Wait_support(
|
||||
cond,
|
||||
mutex,
|
||||
THREAD_QUEUE_WAIT_FOREVER,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
|
||||
*/
|
||||
|
||||
int pthread_cond_timedwait(
|
||||
pthread_cond_t *cond,
|
||||
pthread_mutex_t *mutex,
|
||||
const struct timespec *abstime
|
||||
)
|
||||
{
|
||||
Watchdog_Interval timeout;
|
||||
struct timespec current_time;
|
||||
struct timespec difference;
|
||||
boolean already_timedout = FALSE;
|
||||
|
||||
if ( !abstime )
|
||||
return EINVAL;
|
||||
|
||||
/*
|
||||
* The abstime is a walltime. We turn it into an interval.
|
||||
*/
|
||||
|
||||
(void) clock_gettime( CLOCK_REALTIME, ¤t_time );
|
||||
|
||||
/* XXX probably some error checking should go here */
|
||||
|
||||
_POSIX_Timespec_subtract( ¤t_time, abstime, &difference );
|
||||
|
||||
if ( ( difference.tv_sec < 0 ) || ( ( difference.tv_sec == 0 ) &&
|
||||
( difference.tv_nsec < 0 ) ) )
|
||||
already_timedout = TRUE;
|
||||
|
||||
timeout = _POSIX_Timespec_to_interval( &difference );
|
||||
|
||||
return _POSIX_Condition_variables_Wait_support(
|
||||
cond,
|
||||
mutex,
|
||||
timeout,
|
||||
already_timedout
|
||||
);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <devctl.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 21.2.1 Control a Device, P1003.4b/D8, p. 65
|
||||
*/
|
||||
|
||||
int devctl(
|
||||
int filedes,
|
||||
void *dev_data_ptr,
|
||||
size_t nbyte,
|
||||
int *dev_info_ptr
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
@@ -1,340 +0,0 @@
|
||||
/*
|
||||
* NOTE: Each task has an interrupt semaphore associated with it.
|
||||
* No matter which interrupt occurs that it has registered,
|
||||
* the same semaphore is used.
|
||||
*
|
||||
* This whole interrupt scheme may have been eliminated in a later draft.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <intr.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
#include <rtems/posix/intr.h>
|
||||
#include <rtems/posix/time.h>
|
||||
#include <rtems/posix/threadsup.h>
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Interrupt_Manager_initialization(
|
||||
unsigned32 maximum_interrupt_handlers
|
||||
)
|
||||
{
|
||||
unsigned32 index;
|
||||
POSIX_Interrupt_Control *the_vector;
|
||||
|
||||
_Objects_Initialize_information(
|
||||
&_POSIX_Interrupt_Handlers_Information,
|
||||
OBJECTS_POSIX_INTERRUPTS,
|
||||
FALSE,
|
||||
maximum_interrupt_handlers,
|
||||
sizeof( POSIX_Interrupt_Handler_control ),
|
||||
FALSE,
|
||||
0,
|
||||
FALSE
|
||||
);
|
||||
|
||||
for ( index=0 ; index < CPU_INTERRUPT_NUMBER_OF_VECTORS ; index++ ) {
|
||||
the_vector = &_POSIX_Interrupt_Information[ index ];
|
||||
|
||||
the_vector->number_installed = 0;
|
||||
the_vector->lock_count = 0;
|
||||
the_vector->deferred_count = 0;
|
||||
_Chain_Initialize_empty( &the_vector->Handlers );
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
|
||||
*/
|
||||
|
||||
int intr_capture(
|
||||
intr_t intr,
|
||||
int (*intr_handler)( void *area ),
|
||||
volatile void *area,
|
||||
size_t areasize
|
||||
)
|
||||
{
|
||||
POSIX_Interrupt_Handler_control *the_intr;
|
||||
POSIX_Interrupt_Control *the_vector;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
proc_ptr old_handler;
|
||||
|
||||
if ( !_ISR_Is_vector_number_valid( intr ) ||
|
||||
!_ISR_Is_valid_user_handler( intr_handler ) )
|
||||
return EINVAL;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_intr = _POSIX_Interrupt_Allocate();
|
||||
|
||||
if ( !the_intr ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
the_vector = &_POSIX_Interrupt_Information[ intr ];
|
||||
|
||||
the_intr->vector = intr;
|
||||
the_intr->handler = intr_handler;
|
||||
the_intr->user_data_area = area;
|
||||
the_intr->server = _Thread_Executing;
|
||||
the_intr->is_active = TRUE;
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
thread_support->interrupts_installed++;
|
||||
|
||||
/* XXX should we malloc the semaphore on the fly??? if so we probably need to
|
||||
release it when the thread has released all interrupts and keep
|
||||
a count of how many it has installed. CURRENTLY NO.. ALLOCATED w/TCB
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is sufficient to have the handlers invoked in the opposite
|
||||
* order of installation. The loop invoking them can then go from
|
||||
* the front of the list to the end.
|
||||
*/
|
||||
|
||||
_Chain_Prepend( &the_vector->Handlers, &the_intr->Object.Node );
|
||||
|
||||
if ( !the_vector->number_installed++ )
|
||||
_ISR_Install_vector(
|
||||
intr,
|
||||
(proc_ptr) _POSIX_Interrupt_Handler,
|
||||
&old_handler
|
||||
);
|
||||
|
||||
_Objects_Open( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object, 0 );
|
||||
|
||||
/*
|
||||
* Normally, an Id would be returned here.
|
||||
*/
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
|
||||
*/
|
||||
|
||||
int intr_release(
|
||||
intr_t intr,
|
||||
int (*intr_handler)( void *area )
|
||||
)
|
||||
{
|
||||
boolean found;
|
||||
POSIX_Interrupt_Handler_control *the_intr;
|
||||
POSIX_Interrupt_Control *the_vector;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
Chain_Node *the_node;
|
||||
|
||||
if ( !_ISR_Is_valid_user_handler( intr_handler ) )
|
||||
return EINVAL;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
/*
|
||||
* Since interrupt handlers do not have a user visible id, there is
|
||||
* no choice but to search the entire set of active interrupt handlers
|
||||
* to find this one.
|
||||
*/
|
||||
|
||||
found = FALSE;
|
||||
|
||||
the_vector = &_POSIX_Interrupt_Information[ intr ];
|
||||
|
||||
the_node = _Chain_Head( &the_vector->Handlers );
|
||||
|
||||
for ( ; !_Chain_Is_tail( &the_vector->Handlers, the_node ) ; ) {
|
||||
the_intr = (POSIX_Interrupt_Handler_control *) the_node;
|
||||
|
||||
if ( the_intr->handler == intr_handler ) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
the_node = the_node->next;
|
||||
}
|
||||
|
||||
if ( !found ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if ( !_Thread_Is_executing( the_intr->server ) ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EINVAL; /* XXX should be ENOISR; */
|
||||
}
|
||||
|
||||
/*
|
||||
* OK now we have found the interrupt handler and can do some work.
|
||||
*/
|
||||
|
||||
_Chain_Extract( &the_intr->Object.Node );
|
||||
|
||||
the_intr->is_active = FALSE;
|
||||
|
||||
the_vector->number_installed -= 1;
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
thread_support->interrupts_installed--;
|
||||
|
||||
/*
|
||||
* It is unnecessary to flush the semaphore since the handler can only
|
||||
* be "removed" by the thread which installed it. Thus it cannot be
|
||||
* blocked on the semaphore or it would not be executing this routine.
|
||||
*/
|
||||
|
||||
_Objects_Close( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
|
||||
|
||||
_POSIX_Interrupt_Free( the_intr );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
|
||||
*/
|
||||
|
||||
int intr_lock(
|
||||
intr_t intr
|
||||
)
|
||||
{
|
||||
POSIX_Interrupt_Control *the_vector;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_vector = &_POSIX_Interrupt_Information[ intr ];
|
||||
|
||||
the_vector->lock_count++;
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
|
||||
*/
|
||||
|
||||
int intr_unlock(
|
||||
intr_t intr
|
||||
)
|
||||
{
|
||||
POSIX_Interrupt_Control *the_vector;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_vector = &_POSIX_Interrupt_Information[ intr ];
|
||||
|
||||
if ( !--the_vector->lock_count ) {
|
||||
while ( --the_vector->deferred_count ) {
|
||||
_POSIX_Interrupt_Handler( intr );
|
||||
}
|
||||
}
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
|
||||
*/
|
||||
|
||||
int intr_timed_wait(
|
||||
int flags,
|
||||
const struct timespec *timeout
|
||||
)
|
||||
{
|
||||
Watchdog_Interval ticks;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
|
||||
ticks = _POSIX_Timespec_to_interval( timeout );
|
||||
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
_CORE_semaphore_Seize(
|
||||
&thread_support->Interrupt_Semaphore,
|
||||
0, /* XXX does id=0 hurt in this case? */
|
||||
TRUE,
|
||||
ticks
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return _Thread_Executing->Wait.return_code; /* XXX should be POSIX */
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Handler
|
||||
*
|
||||
*/
|
||||
|
||||
void _POSIX_Interrupt_Handler(
|
||||
ISR_Vector_number vector
|
||||
)
|
||||
{
|
||||
POSIX_Interrupt_Handler_control *the_intr;
|
||||
POSIX_Interrupt_Control *the_vector;
|
||||
POSIX_API_Thread_Support_Control *thread_support;
|
||||
Chain_Node *the_node;
|
||||
int status;
|
||||
|
||||
the_vector = &_POSIX_Interrupt_Information[ vector ];
|
||||
|
||||
the_node = _Chain_Head( &the_vector->Handlers );
|
||||
|
||||
for ( ; !_Chain_Is_tail( &the_vector->Handlers, the_node ) ; ) {
|
||||
the_intr = (POSIX_Interrupt_Handler_control *) the_node;
|
||||
|
||||
status = (*the_intr->handler)( (void *) the_intr->user_data_area );
|
||||
|
||||
switch ( status ) {
|
||||
case INTR_HANDLED_NOTIFY:
|
||||
thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
_CORE_semaphore_Surrender(
|
||||
&thread_support->Interrupt_Semaphore,
|
||||
0, /* XXX is id=0 a problem */
|
||||
0 /* XXX is this a problem (mp support)*/
|
||||
);
|
||||
return;
|
||||
|
||||
case INTR_HANDLED_DO_NOT_NOTIFY:
|
||||
return;
|
||||
|
||||
case INTR_NOT_HANDLED:
|
||||
default: /* this should not happen */
|
||||
break;
|
||||
}
|
||||
the_node = the_node->next;
|
||||
}
|
||||
|
||||
/* XXX
|
||||
*
|
||||
* This is an unhandled interrupt!!!
|
||||
*/
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
#include <rtems/posix/key.h>
|
||||
|
||||
/*
|
||||
* _POSIX_Key_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Key_Manager_initialization(
|
||||
unsigned32 maximum_keys
|
||||
)
|
||||
{
|
||||
_Objects_Initialize_information(
|
||||
&_POSIX_Keys_Information,
|
||||
OBJECTS_POSIX_KEYS,
|
||||
FALSE,
|
||||
maximum_keys,
|
||||
sizeof( POSIX_Keys_Control ),
|
||||
FALSE,
|
||||
0,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
|
||||
*/
|
||||
|
||||
int pthread_key_create(
|
||||
pthread_key_t *key,
|
||||
void (*destructor)( void * )
|
||||
)
|
||||
{
|
||||
POSIX_Keys_Control *the_key;
|
||||
void *table;
|
||||
unsigned32 the_class;
|
||||
unsigned32 bytes_to_allocate;
|
||||
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_key = _POSIX_Keys_Allocate();
|
||||
|
||||
if ( !the_key ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
the_key->destructor = destructor;
|
||||
|
||||
for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
|
||||
the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
|
||||
the_class++ ) {
|
||||
|
||||
bytes_to_allocate =
|
||||
(_Objects_Information_table[ the_class ]->maximum + 1) * sizeof( void * );
|
||||
|
||||
table = _Workspace_Allocate( bytes_to_allocate );
|
||||
|
||||
if ( !table ) {
|
||||
for ( --the_class;
|
||||
the_class >= OBJECTS_CLASSES_FIRST_THREAD_CLASS;
|
||||
the_class-- )
|
||||
_Workspace_Free( the_key->Values[ the_class ] );
|
||||
|
||||
_POSIX_Keys_Free( the_key );
|
||||
_Thread_Enable_dispatch();
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
the_key->Values[ the_class ] = table;
|
||||
memset( table, '\0', bytes_to_allocate );
|
||||
}
|
||||
|
||||
the_key->is_active = TRUE;
|
||||
|
||||
_Objects_Open( &_POSIX_Keys_Information, &the_key->Object, 0 );
|
||||
|
||||
*key = the_key->Object.id;
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
|
||||
*/
|
||||
|
||||
int pthread_setspecific(
|
||||
pthread_key_t key,
|
||||
const void *value
|
||||
)
|
||||
{
|
||||
register POSIX_Keys_Control *the_key;
|
||||
unsigned32 index;
|
||||
unsigned32 class;
|
||||
Objects_Locations location;
|
||||
|
||||
the_key = _POSIX_Keys_Get( key, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
case OBJECTS_REMOTE: /* should never happen */
|
||||
return EINVAL;
|
||||
case OBJECTS_LOCAL:
|
||||
index = _Objects_Get_index( _Thread_Executing->Object.id );
|
||||
class = _Objects_Get_class( _Thread_Executing->Object.id );
|
||||
the_key->Values[ class ][ index ] = (void *) value;
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
|
||||
*/
|
||||
|
||||
void *pthread_getspecific(
|
||||
pthread_key_t key
|
||||
)
|
||||
{
|
||||
register POSIX_Keys_Control *the_key;
|
||||
unsigned32 index;
|
||||
unsigned32 class;
|
||||
Objects_Locations location;
|
||||
void *key_data;
|
||||
|
||||
the_key = _POSIX_Keys_Get( key, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
case OBJECTS_REMOTE: /* should never happen */
|
||||
return NULL;
|
||||
case OBJECTS_LOCAL:
|
||||
index = _Objects_Get_index( _Thread_Executing->Object.id );
|
||||
class = _Objects_Get_class( _Thread_Executing->Object.id );
|
||||
key_data = (void *) the_key->Values[ class ][ index ];
|
||||
_Thread_Enable_dispatch();
|
||||
return key_data;
|
||||
}
|
||||
return (void *) POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
|
||||
*/
|
||||
|
||||
int pthread_key_delete(
|
||||
pthread_key_t key
|
||||
)
|
||||
{
|
||||
register POSIX_Keys_Control *the_key;
|
||||
Objects_Locations location;
|
||||
unsigned32 the_class;
|
||||
|
||||
the_key = _POSIX_Keys_Get( key, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
case OBJECTS_REMOTE: /* should never happen */
|
||||
return EINVAL;
|
||||
case OBJECTS_LOCAL:
|
||||
_Objects_Close( &_POSIX_Keys_Information, &the_key->Object );
|
||||
|
||||
the_key->is_active = FALSE;
|
||||
|
||||
for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS;
|
||||
the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS;
|
||||
the_class++ )
|
||||
_Workspace_Free( the_key->Values[ the_class ] );
|
||||
|
||||
/*
|
||||
* NOTE: The destructor is not called and it is the responsibility
|
||||
* of the application to free the memory.
|
||||
*/
|
||||
|
||||
_POSIX_Keys_Free( the_key );
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Run_destructors
|
||||
*
|
||||
* 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
|
||||
*
|
||||
* NOTE: This is the routine executed when a thread exits to
|
||||
* run through all the keys and do the destructor action.
|
||||
*/
|
||||
|
||||
void _POSIX_Keys_Run_destructors(
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
unsigned32 index;
|
||||
unsigned32 pthread_index;
|
||||
unsigned32 pthread_class;
|
||||
unsigned32 iterations;
|
||||
boolean are_all_null;
|
||||
POSIX_Keys_Control *the_key;
|
||||
void *value;
|
||||
|
||||
pthread_index = _Objects_Get_index( thread->Object.id );
|
||||
pthread_class = _Objects_Get_class( thread->Object.id );
|
||||
|
||||
iterations = 0;
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
are_all_null = TRUE;
|
||||
|
||||
for ( index=1 ; index <= _POSIX_Keys_Information.maximum ; index++ ) {
|
||||
|
||||
the_key = (POSIX_Keys_Control *)
|
||||
_POSIX_Keys_Information.local_table[ index ];
|
||||
|
||||
if ( the_key && the_key->is_active && the_key->destructor ) {
|
||||
value = the_key->Values[ pthread_class ][ pthread_index ];
|
||||
if ( value ) {
|
||||
(*the_key->destructor)( value );
|
||||
if ( the_key->Values[ pthread_class ][ pthread_index ] )
|
||||
are_all_null = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( are_all_null == TRUE )
|
||||
return;
|
||||
|
||||
iterations++;
|
||||
|
||||
/*
|
||||
* The standard allows one to not do this and thus go into an infinite
|
||||
* loop. It seems rude to unnecessarily lock up a system.
|
||||
*
|
||||
* Reference: 17.1.1.2 P1003.1c/Draft 10, p. 163, line 99.
|
||||
*/
|
||||
|
||||
if ( iterations >= PTHREAD_DESTRUCTOR_ITERATIONS )
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1,710 +0,0 @@
|
||||
/*
|
||||
* NOTE: The structure of the routines is identical to that of POSIX
|
||||
* Message_queues to leave the option of having unnamed message
|
||||
* queues at a future date. They are currently not part of the
|
||||
* POSIX standard but unnamed message_queues are. This is also
|
||||
* the reason for the apparently unnecessary tracking of
|
||||
* the process_shared attribute. [In addition to the fact that
|
||||
* it would be trivial to add pshared to the mq_attr structure
|
||||
* and have process private message queues.]
|
||||
*
|
||||
* This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
|
||||
* time.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <mqueue.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
#include <rtems/posix/seterr.h>
|
||||
#include <rtems/posix/mqueue.h>
|
||||
#include <rtems/posix/time.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Manager_initialization
|
||||
*
|
||||
* This routine initializes all message_queue manager related data structures.
|
||||
*
|
||||
* Input parameters:
|
||||
* maximum_message_queues - maximum configured message_queues
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_Manager_initialization(
|
||||
unsigned32 maximum_message_queues
|
||||
)
|
||||
{
|
||||
_Objects_Initialize_information(
|
||||
&_POSIX_Message_queue_Information,
|
||||
OBJECTS_POSIX_MESSAGE_QUEUES,
|
||||
TRUE,
|
||||
maximum_message_queues,
|
||||
sizeof( POSIX_Message_queue_Control ),
|
||||
TRUE,
|
||||
_POSIX_PATH_MAX,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Create_support
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Create_support(
|
||||
const char *name,
|
||||
int pshared,
|
||||
unsigned int oflag,
|
||||
struct mq_attr *attr,
|
||||
POSIX_Message_queue_Control **message_queue
|
||||
)
|
||||
{
|
||||
POSIX_Message_queue_Control *the_mq;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_mq = _POSIX_Message_queue_Allocate();
|
||||
|
||||
if ( !the_mq ) {
|
||||
_Thread_Enable_dispatch();
|
||||
set_errno_and_return_minus_one( ENFILE );
|
||||
}
|
||||
|
||||
if ( pshared == PTHREAD_PROCESS_SHARED &&
|
||||
!( _Objects_MP_Allocate_and_open( &_POSIX_Message_queue_Information, 0,
|
||||
the_mq->Object.id, FALSE ) ) ) {
|
||||
_POSIX_Message_queue_Free( the_mq );
|
||||
_Thread_Enable_dispatch();
|
||||
set_errno_and_return_minus_one( ENFILE );
|
||||
}
|
||||
|
||||
the_mq->process_shared = pshared;
|
||||
|
||||
if ( name ) {
|
||||
the_mq->named = TRUE;
|
||||
the_mq->open_count = 1;
|
||||
the_mq->linked = TRUE;
|
||||
}
|
||||
else
|
||||
the_mq->named = FALSE;
|
||||
|
||||
if ( oflag & O_NONBLOCK )
|
||||
the_mq->blocking = FALSE;
|
||||
else
|
||||
the_mq->blocking = TRUE;
|
||||
|
||||
/* XXX
|
||||
*
|
||||
* Note that this should be based on the current scheduling policy.
|
||||
*/
|
||||
|
||||
/* XXX
|
||||
*
|
||||
* Message and waiting disciplines are not distinguished.
|
||||
*/
|
||||
/*
|
||||
the_mq_attr->message_discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
||||
the_mq_attr->waiting_discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
||||
*/
|
||||
|
||||
the_mq->Message_queue.Attributes.discipline =
|
||||
CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
||||
|
||||
if ( ! _CORE_message_queue_Initialize(
|
||||
&the_mq->Message_queue,
|
||||
OBJECTS_POSIX_MESSAGE_QUEUES,
|
||||
&the_mq->Message_queue.Attributes,
|
||||
attr->mq_maxmsg,
|
||||
attr->mq_msgsize,
|
||||
_POSIX_Message_queue_MP_Send_extract_proxy ) ) {
|
||||
|
||||
if ( pshared == PTHREAD_PROCESS_SHARED )
|
||||
_Objects_MP_Close( &_POSIX_Message_queue_Information, the_mq->Object.id );
|
||||
|
||||
_POSIX_Message_queue_Free( the_mq );
|
||||
_Thread_Enable_dispatch();
|
||||
set_errno_and_return_minus_one( ENOSPC );
|
||||
}
|
||||
|
||||
|
||||
/* XXX - need Names to be a string!!! */
|
||||
_Objects_Open(
|
||||
&_POSIX_Message_queue_Information,
|
||||
&the_mq->Object,
|
||||
(char *) name
|
||||
);
|
||||
|
||||
*message_queue = the_mq;
|
||||
|
||||
if ( pshared == PTHREAD_PROCESS_SHARED )
|
||||
_POSIX_Message_queue_MP_Send_process_packet(
|
||||
POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
|
||||
the_mq->Object.id,
|
||||
(char *) name,
|
||||
0 /* Not used */
|
||||
);
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
|
||||
*/
|
||||
|
||||
mqd_t mq_open(
|
||||
const char *name,
|
||||
int oflag,
|
||||
...
|
||||
/* mode_t mode, */
|
||||
/* struct mq_attr attr */
|
||||
)
|
||||
{
|
||||
va_list arg;
|
||||
mode_t mode;
|
||||
struct mq_attr *attr;
|
||||
int status;
|
||||
Objects_Id the_mq_id;
|
||||
POSIX_Message_queue_Control *the_mq;
|
||||
|
||||
if ( oflag & O_CREAT ) {
|
||||
va_start(arg, oflag);
|
||||
mode = (mode_t) va_arg( arg, mode_t * );
|
||||
attr = (struct mq_attr *) va_arg( arg, struct mq_attr ** );
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
|
||||
|
||||
/*
|
||||
* If the name to id translation worked, then the message queue exists
|
||||
* and we can just return a pointer to the id. Otherwise we may
|
||||
* need to check to see if this is a "message queue does not exist"
|
||||
* or some other miscellaneous error on the name.
|
||||
*/
|
||||
|
||||
if ( status ) {
|
||||
|
||||
if ( status == EINVAL ) { /* name -> ID translation failed */
|
||||
if ( !(oflag & O_CREAT) ) { /* willing to create it? */
|
||||
seterrno( ENOENT );
|
||||
return (mqd_t) -1;
|
||||
}
|
||||
/* we are willing to create it */
|
||||
}
|
||||
seterrno( status ); /* some type of error */
|
||||
return (mqd_t) -1;
|
||||
|
||||
} else { /* name -> ID translation succeeded */
|
||||
|
||||
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
||||
seterrno( EEXIST );
|
||||
return (mqd_t) -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX In this case we need to do an ID->pointer conversion to
|
||||
* check the mode. This is probably a good place for a subroutine.
|
||||
*/
|
||||
|
||||
the_mq->open_count += 1;
|
||||
|
||||
return (mqd_t)&the_mq->Object.id;
|
||||
|
||||
}
|
||||
|
||||
/* XXX verify this comment...
|
||||
*
|
||||
* At this point, the message queue does not exist and everything has been
|
||||
* checked. We should go ahead and create a message queue.
|
||||
*/
|
||||
|
||||
status = _POSIX_Message_queue_Create_support(
|
||||
name,
|
||||
TRUE, /* shared across processes */
|
||||
oflag,
|
||||
attr,
|
||||
&the_mq
|
||||
);
|
||||
|
||||
if ( status == -1 )
|
||||
return (mqd_t) -1;
|
||||
|
||||
return (mqd_t) &the_mq->Object.id;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Delete
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_Delete(
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
)
|
||||
{
|
||||
if ( !the_mq->linked && !the_mq->open_count ) {
|
||||
_POSIX_Message_queue_Free( the_mq );
|
||||
|
||||
if ( the_mq->process_shared == PTHREAD_PROCESS_SHARED ) {
|
||||
|
||||
_Objects_MP_Close(
|
||||
&_POSIX_Message_queue_Information,
|
||||
the_mq->Object.id
|
||||
);
|
||||
|
||||
_POSIX_Message_queue_MP_Send_process_packet(
|
||||
POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
|
||||
the_mq->Object.id,
|
||||
0, /* Not used */
|
||||
0 /* Not used */
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
|
||||
*/
|
||||
|
||||
int mq_close(
|
||||
mqd_t mqdes
|
||||
)
|
||||
{
|
||||
register POSIX_Message_queue_Control *the_mq;
|
||||
Objects_Locations location;
|
||||
|
||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
the_mq->open_count -= 1;
|
||||
_POSIX_Message_queue_Delete( the_mq );
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
|
||||
*/
|
||||
|
||||
int mq_unlink(
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
int status;
|
||||
register POSIX_Message_queue_Control *the_mq;
|
||||
Objects_Id the_mq_id;
|
||||
Objects_Locations location;
|
||||
|
||||
status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
|
||||
|
||||
if ( !status )
|
||||
set_errno_and_return_minus_one( status );
|
||||
|
||||
the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
|
||||
_Objects_MP_Close(
|
||||
&_POSIX_Message_queue_Information,
|
||||
the_mq->Object.id
|
||||
);
|
||||
|
||||
the_mq->linked = FALSE;
|
||||
|
||||
_POSIX_Message_queue_Delete( the_mq );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Send_support
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Send_support(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
unsigned32 msg_len,
|
||||
Priority_Control msg_prio,
|
||||
Watchdog_Interval timeout
|
||||
)
|
||||
{
|
||||
register POSIX_Message_queue_Control *the_mq;
|
||||
Objects_Locations location;
|
||||
|
||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
/* XXX must add support for timeout and priority */
|
||||
_CORE_message_queue_Send(
|
||||
&the_mq->Message_queue,
|
||||
(void *) msg_ptr,
|
||||
msg_len,
|
||||
mqdes,
|
||||
NULL /* XXX _POSIX_Message_queue_Core_message_queue_mp_support*/
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
return _Thread_Executing->Wait.return_code;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
|
||||
*/
|
||||
|
||||
int mq_send(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int msg_prio
|
||||
)
|
||||
{
|
||||
return _POSIX_Message_queue_Send_support(
|
||||
mqdes,
|
||||
msg_ptr,
|
||||
msg_len,
|
||||
msg_prio,
|
||||
THREAD_QUEUE_WAIT_FOREVER
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
|
||||
*/
|
||||
|
||||
int mq_timedsend(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int msg_prio,
|
||||
const struct timespec *timeout
|
||||
)
|
||||
{
|
||||
return _POSIX_Message_queue_Send_support(
|
||||
mqdes,
|
||||
msg_ptr,
|
||||
msg_len,
|
||||
msg_prio,
|
||||
_POSIX_Timespec_to_interval( timeout )
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Receive_support
|
||||
*/
|
||||
|
||||
/* XXX be careful ... watch the size going through all the layers ... */
|
||||
|
||||
ssize_t _POSIX_Message_queue_Receive_support(
|
||||
mqd_t mqdes,
|
||||
char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int *msg_prio,
|
||||
Watchdog_Interval timeout
|
||||
)
|
||||
{
|
||||
register POSIX_Message_queue_Control *the_mq;
|
||||
Objects_Locations location;
|
||||
unsigned32 status = 0;
|
||||
unsigned32 length_out;
|
||||
|
||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
/* XXX need to define the options argument to this */
|
||||
length_out = msg_len;
|
||||
_CORE_message_queue_Seize(
|
||||
&the_mq->Message_queue,
|
||||
mqdes,
|
||||
msg_ptr,
|
||||
&length_out,
|
||||
/* msg_prio, XXXX */
|
||||
the_mq->blocking,
|
||||
timeout
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
if ( !status )
|
||||
return length_out;
|
||||
/* XXX --- the return codes gotta be looked at .. fix this */
|
||||
return _Thread_Executing->Wait.return_code;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
|
||||
*/
|
||||
|
||||
ssize_t mq_receive(
|
||||
mqd_t mqdes,
|
||||
char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int *msg_prio
|
||||
)
|
||||
{
|
||||
return _POSIX_Message_queue_Receive_support(
|
||||
mqdes,
|
||||
msg_ptr,
|
||||
msg_len,
|
||||
msg_prio,
|
||||
THREAD_QUEUE_WAIT_FOREVER
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
|
||||
*
|
||||
* NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
|
||||
*/
|
||||
|
||||
int mq_timedreceive( /* XXX: should this be ssize_t */
|
||||
mqd_t mqdes,
|
||||
char *msg_ptr,
|
||||
size_t msg_len,
|
||||
unsigned int *msg_prio,
|
||||
const struct timespec *timeout
|
||||
)
|
||||
{
|
||||
return _POSIX_Message_queue_Receive_support(
|
||||
mqdes,
|
||||
msg_ptr,
|
||||
msg_len,
|
||||
msg_prio,
|
||||
_POSIX_Timespec_to_interval( timeout )
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Notify_handler
|
||||
*
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_Notify_handler(
|
||||
void *user_data
|
||||
)
|
||||
{
|
||||
POSIX_Message_queue_Control *the_mq;
|
||||
|
||||
the_mq = user_data;
|
||||
|
||||
/* XXX do something with signals here!!!! */
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.6 Notify Process that a Message is Available on a Queue,
|
||||
* P1003.1b-1993, p. 280
|
||||
*/
|
||||
|
||||
int mq_notify(
|
||||
mqd_t mqdes,
|
||||
const struct sigevent *notification
|
||||
)
|
||||
{
|
||||
register POSIX_Message_queue_Control *the_mq;
|
||||
Objects_Locations location;
|
||||
|
||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EBADF );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
if ( notification ) {
|
||||
if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
|
||||
_Thread_Enable_dispatch();
|
||||
seterrno( EBUSY );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
|
||||
|
||||
the_mq->notification = *notification;
|
||||
|
||||
_CORE_message_queue_Set_notify(
|
||||
&the_mq->Message_queue,
|
||||
_POSIX_Message_queue_Notify_handler,
|
||||
the_mq
|
||||
);
|
||||
} else {
|
||||
|
||||
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
|
||||
|
||||
}
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
|
||||
*/
|
||||
|
||||
int mq_setattr(
|
||||
mqd_t mqdes,
|
||||
const struct mq_attr *mqstat,
|
||||
struct mq_attr *omqstat
|
||||
)
|
||||
{
|
||||
register POSIX_Message_queue_Control *the_mq;
|
||||
Objects_Locations location;
|
||||
CORE_message_queue_Attributes *the_mq_attr;
|
||||
|
||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
/*
|
||||
* Return the old values.
|
||||
*/
|
||||
|
||||
/* XXX this is the same stuff as is in mq_getattr... and probably */
|
||||
/* XXX should be in an inlined private routine */
|
||||
|
||||
the_mq_attr = &the_mq->Message_queue.Attributes;
|
||||
|
||||
omqstat->mq_flags = the_mq->flags;
|
||||
omqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
|
||||
omqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
|
||||
omqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
|
||||
|
||||
/*
|
||||
* Ignore everything except the O_NONBLOCK bit.
|
||||
*/
|
||||
|
||||
if ( mqstat->mq_flags & O_NONBLOCK )
|
||||
the_mq->blocking = FALSE;
|
||||
else
|
||||
the_mq->blocking = TRUE;
|
||||
|
||||
the_mq->flags = mqstat->mq_flags;
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
|
||||
*/
|
||||
|
||||
int mq_getattr(
|
||||
mqd_t mqdes,
|
||||
struct mq_attr *mqstat
|
||||
)
|
||||
{
|
||||
register POSIX_Message_queue_Control *the_mq;
|
||||
Objects_Locations location;
|
||||
CORE_message_queue_Attributes *the_mq_attr;
|
||||
|
||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
/*
|
||||
* Return the old values.
|
||||
*/
|
||||
|
||||
/* XXX this is the same stuff as is in mq_setattr... and probably */
|
||||
/* XXX should be in an inlined private routine */
|
||||
|
||||
the_mq_attr = &the_mq->Message_queue.Attributes;
|
||||
|
||||
mqstat->mq_flags = the_mq->flags;
|
||||
mqstat->mq_msgsize = the_mq->Message_queue.maximum_message_size;
|
||||
mqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
|
||||
mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
@@ -1,683 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
#include <rtems/score/mpci.h>
|
||||
#include <rtems/posix/mutex.h>
|
||||
#include <rtems/posix/priority.h>
|
||||
#include <rtems/posix/time.h>
|
||||
|
||||
/*
|
||||
* TEMPORARY
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_process_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
)
|
||||
{
|
||||
(void) POSIX_MP_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
void _POSIX_Mutex_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
)
|
||||
{
|
||||
(void) POSIX_MP_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
int _POSIX_Mutex_MP_Send_request_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
)
|
||||
{
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
void POSIX_Threads_mutex_MP_support(
|
||||
Thread_Control *the_thread,
|
||||
Objects_Id id
|
||||
)
|
||||
{
|
||||
(void) POSIX_MP_NOT_IMPLEMENTED(); /* XXX: should never get here */
|
||||
}
|
||||
|
||||
/*
|
||||
* END OF TEMPORARY
|
||||
*/
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* The default mutex attributes structure.
|
||||
*/
|
||||
|
||||
const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = {
|
||||
TRUE, /* is_initialized */
|
||||
PTHREAD_PROCESS_PRIVATE, /* process_shared */
|
||||
POSIX_SCHEDULER_MAXIMUM_PRIORITY, /* prio_ceiling */
|
||||
PTHREAD_PRIO_NONE, /* protocol */
|
||||
FALSE /* recursive */
|
||||
};
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_From_core_mutex_status
|
||||
*/
|
||||
|
||||
int _POSIX_Mutex_From_core_mutex_status(
|
||||
CORE_mutex_Status status
|
||||
)
|
||||
{
|
||||
switch ( status ) {
|
||||
case CORE_MUTEX_STATUS_SUCCESSFUL:
|
||||
return 0;
|
||||
case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
|
||||
return EBUSY;
|
||||
case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
|
||||
return EDEADLK;
|
||||
case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
|
||||
return EPERM;
|
||||
case CORE_MUTEX_WAS_DELETED:
|
||||
return EINVAL;
|
||||
case CORE_MUTEX_TIMEOUT:
|
||||
return EAGAIN;
|
||||
case CORE_MUTEX_STATUS_CEILING_VIOLATED:
|
||||
return EINVAL;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
assert( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Manager_initialization
|
||||
*
|
||||
* This routine initializes all mutex manager related data structures.
|
||||
*
|
||||
* Input parameters:
|
||||
* maximum_mutexes - maximum configured mutexes
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_Manager_initialization(
|
||||
unsigned32 maximum_mutexes
|
||||
)
|
||||
{
|
||||
_Objects_Initialize_information(
|
||||
&_POSIX_Mutex_Information,
|
||||
OBJECTS_POSIX_MUTEXES,
|
||||
TRUE,
|
||||
maximum_mutexes,
|
||||
sizeof( POSIX_Mutex_Control ),
|
||||
FALSE,
|
||||
0,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_init(
|
||||
pthread_mutexattr_t *attr
|
||||
)
|
||||
{
|
||||
if ( !attr )
|
||||
return EINVAL;
|
||||
|
||||
*attr = _POSIX_Mutex_Default_attributes;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_destroy(
|
||||
pthread_mutexattr_t *attr
|
||||
)
|
||||
{
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
attr->is_initialized = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_getpshared(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *pshared
|
||||
)
|
||||
{
|
||||
if ( !attr || !attr->is_initialized || !pshared )
|
||||
return EINVAL;
|
||||
|
||||
*pshared = attr->process_shared;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_setpshared(
|
||||
pthread_mutexattr_t *attr,
|
||||
int pshared
|
||||
)
|
||||
{
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
switch ( pshared ) {
|
||||
case PTHREAD_PROCESS_SHARED:
|
||||
case PTHREAD_PROCESS_PRIVATE:
|
||||
attr->process_shared = pshared;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
|
||||
*
|
||||
* NOTE: XXX Could be optimized so all the attribute error checking
|
||||
* is not performed when attr is NULL.
|
||||
*/
|
||||
|
||||
int pthread_mutex_init(
|
||||
pthread_mutex_t *mutex,
|
||||
const pthread_mutexattr_t *attr
|
||||
)
|
||||
{
|
||||
POSIX_Mutex_Control *the_mutex;
|
||||
CORE_mutex_Attributes *the_mutex_attr;
|
||||
const pthread_mutexattr_t *the_attr;
|
||||
CORE_mutex_Disciplines the_discipline;
|
||||
register POSIX_Mutex_Control *mutex_in_use;
|
||||
Objects_Locations location;
|
||||
|
||||
if ( attr ) the_attr = attr;
|
||||
else the_attr = &_POSIX_Mutex_Default_attributes;
|
||||
|
||||
/* Check for NULL mutex */
|
||||
|
||||
if ( !mutex )
|
||||
return EINVAL;
|
||||
|
||||
/* EBUSY if *mutex is a valid id */
|
||||
|
||||
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
break;
|
||||
case OBJECTS_REMOTE:
|
||||
case OBJECTS_LOCAL:
|
||||
_Thread_Enable_dispatch();
|
||||
return EBUSY;
|
||||
};
|
||||
|
||||
if ( !the_attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
/*
|
||||
* XXX: Be careful about attributes when global!!!
|
||||
*/
|
||||
|
||||
assert( the_attr->process_shared == PTHREAD_PROCESS_PRIVATE );
|
||||
|
||||
if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
|
||||
/*
|
||||
* Determine the discipline of the mutex
|
||||
*/
|
||||
|
||||
switch ( the_attr->protocol ) {
|
||||
case PTHREAD_PRIO_NONE:
|
||||
the_discipline = CORE_MUTEX_DISCIPLINES_FIFO;
|
||||
break;
|
||||
case PTHREAD_PRIO_INHERIT:
|
||||
the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT;
|
||||
break;
|
||||
case PTHREAD_PRIO_PROTECT:
|
||||
the_discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) )
|
||||
return EINVAL;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_mutex = _POSIX_Mutex_Allocate();
|
||||
|
||||
if ( !the_mutex ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED &&
|
||||
!( _Objects_MP_Allocate_and_open( &_POSIX_Mutex_Information, 0,
|
||||
the_mutex->Object.id, FALSE ) ) ) {
|
||||
_POSIX_Mutex_Free( the_mutex );
|
||||
_Thread_Enable_dispatch();
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
the_mutex->process_shared = the_attr->process_shared;
|
||||
|
||||
the_mutex_attr = &the_mutex->Mutex.Attributes;
|
||||
|
||||
the_mutex_attr->allow_nesting = the_attr->recursive;
|
||||
the_mutex_attr->priority_ceiling =
|
||||
_POSIX_Priority_To_core( the_attr->prio_ceiling );
|
||||
the_mutex_attr->discipline = the_discipline;
|
||||
|
||||
/*
|
||||
* Must be initialized to unlocked.
|
||||
*/
|
||||
|
||||
_CORE_mutex_Initialize(
|
||||
&the_mutex->Mutex,
|
||||
OBJECTS_POSIX_MUTEXES,
|
||||
the_mutex_attr,
|
||||
CORE_MUTEX_UNLOCKED,
|
||||
NULL /* proxy_extract_callout */
|
||||
);
|
||||
|
||||
_Objects_Open( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
|
||||
|
||||
*mutex = the_mutex->Object.id;
|
||||
|
||||
if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
|
||||
_POSIX_Mutex_MP_Send_process_packet(
|
||||
POSIX_MUTEX_MP_ANNOUNCE_CREATE,
|
||||
the_mutex->Object.id,
|
||||
0, /* Name not used */
|
||||
0 /* Not used */
|
||||
);
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
|
||||
*/
|
||||
|
||||
int pthread_mutex_destroy(
|
||||
pthread_mutex_t *mutex
|
||||
)
|
||||
{
|
||||
register POSIX_Mutex_Control *the_mutex;
|
||||
Objects_Locations location;
|
||||
|
||||
the_mutex = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
return EINVAL;
|
||||
case OBJECTS_LOCAL:
|
||||
/*
|
||||
* XXX: There is an error for the mutex being locked
|
||||
* or being in use by a condition variable.
|
||||
*/
|
||||
|
||||
if ( _CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
|
||||
_Thread_Enable_dispatch();
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
_Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
|
||||
|
||||
_CORE_mutex_Flush(
|
||||
&the_mutex->Mutex,
|
||||
_POSIX_Mutex_MP_Send_object_was_deleted,
|
||||
EINVAL
|
||||
);
|
||||
|
||||
_POSIX_Mutex_Free( the_mutex );
|
||||
|
||||
if ( the_mutex->process_shared == PTHREAD_PROCESS_SHARED ) {
|
||||
|
||||
_Objects_MP_Close( &_POSIX_Mutex_Information, the_mutex->Object.id );
|
||||
|
||||
_POSIX_Mutex_MP_Send_process_packet(
|
||||
POSIX_MUTEX_MP_ANNOUNCE_DELETE,
|
||||
the_mutex->Object.id,
|
||||
0, /* Not used */
|
||||
0 /* Not used */
|
||||
);
|
||||
}
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Lock_support
|
||||
*
|
||||
* A support routine which implements guts of the blocking, non-blocking, and
|
||||
* timed wait version of mutex lock.
|
||||
*/
|
||||
|
||||
int _POSIX_Mutex_Lock_support(
|
||||
pthread_mutex_t *mutex,
|
||||
boolean blocking,
|
||||
Watchdog_Interval timeout
|
||||
)
|
||||
{
|
||||
register POSIX_Mutex_Control *the_mutex;
|
||||
Objects_Locations location;
|
||||
|
||||
the_mutex = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
return _POSIX_Mutex_MP_Send_request_packet(
|
||||
POSIX_MUTEX_MP_OBTAIN_REQUEST,
|
||||
*mutex,
|
||||
0, /* must define the option set */
|
||||
WATCHDOG_NO_TIMEOUT
|
||||
);
|
||||
case OBJECTS_LOCAL:
|
||||
_CORE_mutex_Seize(
|
||||
&the_mutex->Mutex,
|
||||
the_mutex->Object.id,
|
||||
blocking,
|
||||
timeout
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
return _POSIX_Mutex_From_core_mutex_status(
|
||||
(CORE_mutex_Status) _Thread_Executing->Wait.return_code
|
||||
);
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
|
||||
*/
|
||||
|
||||
int pthread_mutex_lock(
|
||||
pthread_mutex_t *mutex
|
||||
)
|
||||
{
|
||||
return _POSIX_Mutex_Lock_support( mutex, TRUE, THREAD_QUEUE_WAIT_FOREVER );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
|
||||
*/
|
||||
|
||||
int pthread_mutex_trylock(
|
||||
pthread_mutex_t *mutex
|
||||
)
|
||||
{
|
||||
return _POSIX_Mutex_Lock_support( mutex, FALSE, THREAD_QUEUE_WAIT_FOREVER );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
|
||||
*/
|
||||
|
||||
int pthread_mutex_unlock(
|
||||
pthread_mutex_t *mutex
|
||||
)
|
||||
{
|
||||
register POSIX_Mutex_Control *the_mutex;
|
||||
Objects_Locations location;
|
||||
CORE_mutex_Status status;
|
||||
|
||||
the_mutex = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
return _POSIX_Mutex_MP_Send_request_packet(
|
||||
POSIX_MUTEX_MP_RELEASE_REQUEST,
|
||||
*mutex,
|
||||
0, /* Not used */
|
||||
MPCI_DEFAULT_TIMEOUT
|
||||
);
|
||||
case OBJECTS_LOCAL:
|
||||
status = _CORE_mutex_Surrender(
|
||||
&the_mutex->Mutex,
|
||||
the_mutex->Object.id,
|
||||
POSIX_Threads_mutex_MP_support
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
return _POSIX_Mutex_From_core_mutex_status( status );
|
||||
break;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
|
||||
*/
|
||||
|
||||
int pthread_mutex_timedlock(
|
||||
pthread_mutex_t *mutex,
|
||||
const struct timespec *timeout
|
||||
)
|
||||
{
|
||||
return _POSIX_Mutex_Lock_support(
|
||||
mutex,
|
||||
TRUE,
|
||||
_POSIX_Timespec_to_interval( timeout )
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_setprotocol(
|
||||
pthread_mutexattr_t *attr,
|
||||
int protocol
|
||||
)
|
||||
{
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
switch ( protocol ) {
|
||||
case PTHREAD_PRIO_NONE:
|
||||
case PTHREAD_PRIO_INHERIT:
|
||||
case PTHREAD_PRIO_PROTECT:
|
||||
attr->protocol = protocol;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_getprotocol(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *protocol
|
||||
)
|
||||
{
|
||||
if ( !attr || !attr->is_initialized || !protocol )
|
||||
return EINVAL;
|
||||
|
||||
*protocol = attr->protocol;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_setprioceiling(
|
||||
pthread_mutexattr_t *attr,
|
||||
int prioceiling
|
||||
)
|
||||
{
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
if ( !_POSIX_Priority_Is_valid( prioceiling ) )
|
||||
return EINVAL;
|
||||
|
||||
attr->prio_ceiling = prioceiling;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
|
||||
*/
|
||||
|
||||
int pthread_mutexattr_getprioceiling(
|
||||
const pthread_mutexattr_t *attr,
|
||||
int *prioceiling
|
||||
)
|
||||
{
|
||||
if ( !attr || !attr->is_initialized || !prioceiling )
|
||||
return EINVAL;
|
||||
|
||||
*prioceiling = attr->prio_ceiling;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
|
||||
*/
|
||||
|
||||
int pthread_mutex_setprioceiling(
|
||||
pthread_mutex_t *mutex,
|
||||
int prioceiling,
|
||||
int *old_ceiling
|
||||
)
|
||||
{
|
||||
register POSIX_Mutex_Control *the_mutex;
|
||||
Objects_Locations location;
|
||||
Priority_Control the_priority;
|
||||
int status;
|
||||
|
||||
if ( !old_ceiling )
|
||||
return EINVAL;
|
||||
|
||||
if ( !_POSIX_Priority_Is_valid( prioceiling ) )
|
||||
return EINVAL;
|
||||
|
||||
the_priority = _POSIX_Priority_To_core( prioceiling );
|
||||
|
||||
/*
|
||||
* Must acquire the mutex before we can change it's ceiling
|
||||
*/
|
||||
|
||||
status = pthread_mutex_lock( mutex );
|
||||
if ( status )
|
||||
return status;
|
||||
|
||||
the_mutex = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL; /* impossible to get here */
|
||||
case OBJECTS_REMOTE:
|
||||
/* XXX It feels questionable to set the ceiling on a remote mutex. */
|
||||
return EINVAL;
|
||||
case OBJECTS_LOCAL:
|
||||
*old_ceiling = _POSIX_Priority_From_core(
|
||||
the_mutex->Mutex.Attributes.priority_ceiling
|
||||
);
|
||||
the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
|
||||
_CORE_mutex_Surrender(
|
||||
&the_mutex->Mutex,
|
||||
the_mutex->Object.id,
|
||||
POSIX_Threads_mutex_MP_support
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
|
||||
*/
|
||||
|
||||
int pthread_mutex_getprioceiling(
|
||||
pthread_mutex_t *mutex,
|
||||
int *prioceiling
|
||||
)
|
||||
{
|
||||
register POSIX_Mutex_Control *the_mutex;
|
||||
Objects_Locations location;
|
||||
|
||||
if ( !prioceiling )
|
||||
return EINVAL;
|
||||
|
||||
the_mutex = _POSIX_Mutex_Get( mutex, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
return EINVAL;
|
||||
case OBJECTS_REMOTE:
|
||||
return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */
|
||||
case OBJECTS_LOCAL:
|
||||
*prioceiling = _POSIX_Priority_From_core(
|
||||
the_mutex->Mutex.Attributes.priority_ceiling
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/tod.h>
|
||||
|
||||
#include <rtems/posix/time.h>
|
||||
|
||||
/*
|
||||
* 14.2.2 Create a Per-Process Timer, P1003.1b-1993, p. 264
|
||||
*/
|
||||
|
||||
int timer_create(
|
||||
clockid_t clock_id,
|
||||
struct sigevent *evp,
|
||||
timer_t *timerid
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*
|
||||
* 14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266
|
||||
*/
|
||||
|
||||
int timer_delete(
|
||||
timer_t timerid
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*
|
||||
* 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
|
||||
*/
|
||||
|
||||
int timer_settime(
|
||||
timer_t timerid,
|
||||
int flags,
|
||||
const struct itimerspec *value,
|
||||
struct itimerspec *ovalue
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*
|
||||
* 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
|
||||
*/
|
||||
|
||||
int timer_gettime(
|
||||
timer_t timerid,
|
||||
struct itimerspec *value
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*
|
||||
* 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
|
||||
*/
|
||||
|
||||
int timer_getoverrun(
|
||||
timer_t timerid
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/tod.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/posix/seterr.h>
|
||||
#include <rtems/posix/priority.h>
|
||||
#include <rtems/posix/time.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
|
||||
*
|
||||
*/
|
||||
|
||||
int sched_setparam(
|
||||
pid_t pid,
|
||||
const struct sched_param *param
|
||||
)
|
||||
{
|
||||
set_errno_and_return_minus_one( ENOSYS );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
|
||||
*/
|
||||
|
||||
int sched_getparam(
|
||||
pid_t pid,
|
||||
const struct sched_param *param
|
||||
)
|
||||
{
|
||||
set_errno_and_return_minus_one( ENOSYS );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.3 Set Scheduling Policy and Scheduling Parameters,
|
||||
* P1003.1b-1993, p. 254
|
||||
*/
|
||||
|
||||
int sched_setscheduler(
|
||||
pid_t pid,
|
||||
int policy,
|
||||
const struct sched_param *param
|
||||
)
|
||||
{
|
||||
set_errno_and_return_minus_one( ENOSYS );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
|
||||
*/
|
||||
|
||||
int sched_getscheduler(
|
||||
pid_t pid
|
||||
)
|
||||
{
|
||||
set_errno_and_return_minus_one( ENOSYS );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
|
||||
*/
|
||||
|
||||
int sched_get_priority_max(
|
||||
int policy
|
||||
)
|
||||
{
|
||||
switch ( policy ) {
|
||||
case SCHED_OTHER:
|
||||
case SCHED_FIFO:
|
||||
case SCHED_RR:
|
||||
case SCHED_SPORADIC:
|
||||
break;
|
||||
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
}
|
||||
|
||||
return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
|
||||
*/
|
||||
|
||||
int sched_get_priority_min(
|
||||
int policy
|
||||
)
|
||||
{
|
||||
switch ( policy ) {
|
||||
case SCHED_OTHER:
|
||||
case SCHED_FIFO:
|
||||
case SCHED_RR:
|
||||
case SCHED_SPORADIC:
|
||||
break;
|
||||
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
}
|
||||
|
||||
return POSIX_SCHEDULER_MINIMUM_PRIORITY;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
|
||||
*/
|
||||
|
||||
int sched_rr_get_interval(
|
||||
pid_t pid,
|
||||
struct timespec *interval
|
||||
)
|
||||
{
|
||||
/* XXX do we need to support different time quantums per thread */
|
||||
|
||||
/*
|
||||
* Only supported for the "calling process" (i.e. this node).
|
||||
*/
|
||||
|
||||
if ( pid != getpid() )
|
||||
set_errno_and_return_minus_one( ESRCH );
|
||||
|
||||
if ( !interval )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
_POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 13.3.5 Yield Processor, P1003.1b-1993, p. 257
|
||||
*/
|
||||
|
||||
int sched_yield( void )
|
||||
{
|
||||
_Thread_Disable_dispatch();
|
||||
_Thread_Yield_processor();
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,571 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/posix/semaphore.h>
|
||||
#include <rtems/posix/time.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Manager_initialization
|
||||
*
|
||||
* This routine initializes all semaphore manager related data structures.
|
||||
*
|
||||
* Input parameters:
|
||||
* maximum_semaphores - maximum configured semaphores
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_Manager_initialization(
|
||||
unsigned32 maximum_semaphores
|
||||
)
|
||||
{
|
||||
_Objects_Initialize_information(
|
||||
&_POSIX_Semaphore_Information,
|
||||
OBJECTS_POSIX_SEMAPHORES,
|
||||
TRUE,
|
||||
maximum_semaphores,
|
||||
sizeof( POSIX_Semaphore_Control ),
|
||||
TRUE,
|
||||
_POSIX_PATH_MAX,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Create_support
|
||||
*/
|
||||
|
||||
int _POSIX_Semaphore_Create_support(
|
||||
const char *name,
|
||||
int pshared,
|
||||
unsigned int value,
|
||||
POSIX_Semaphore_Control **the_sem
|
||||
)
|
||||
{
|
||||
POSIX_Semaphore_Control *the_semaphore;
|
||||
CORE_semaphore_Attributes *the_sem_attr;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Allocate();
|
||||
|
||||
if ( !the_semaphore ) {
|
||||
_Thread_Enable_dispatch();
|
||||
set_errno_and_return_minus_one( ENOMEM );
|
||||
}
|
||||
|
||||
if ( pshared == PTHREAD_PROCESS_SHARED &&
|
||||
!( _Objects_MP_Allocate_and_open( &_POSIX_Semaphore_Information, 0,
|
||||
the_semaphore->Object.id, FALSE ) ) ) {
|
||||
_POSIX_Semaphore_Free( the_semaphore );
|
||||
_Thread_Enable_dispatch();
|
||||
set_errno_and_return_minus_one( EAGAIN );
|
||||
}
|
||||
|
||||
the_semaphore->process_shared = pshared;
|
||||
|
||||
if ( name ) {
|
||||
the_semaphore->named = TRUE;
|
||||
the_semaphore->open_count = 1;
|
||||
the_semaphore->linked = TRUE;
|
||||
}
|
||||
else
|
||||
the_semaphore->named = FALSE;
|
||||
|
||||
the_sem_attr = &the_semaphore->Semaphore.Attributes;
|
||||
|
||||
/* XXX
|
||||
*
|
||||
* Note should this be based on the current scheduling policy?
|
||||
*/
|
||||
|
||||
the_sem_attr->discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
|
||||
|
||||
_CORE_semaphore_Initialize(
|
||||
&the_semaphore->Semaphore,
|
||||
OBJECTS_POSIX_SEMAPHORES,
|
||||
the_sem_attr,
|
||||
value,
|
||||
0 /* XXX - proxy_extract_callout is unused */
|
||||
);
|
||||
|
||||
/* XXX - need Names to be a string!!! */
|
||||
_Objects_Open(
|
||||
&_POSIX_Semaphore_Information,
|
||||
&the_semaphore->Object,
|
||||
(char *) name
|
||||
);
|
||||
|
||||
*the_sem = the_semaphore;
|
||||
|
||||
if ( pshared == PTHREAD_PROCESS_SHARED )
|
||||
_POSIX_Semaphore_MP_Send_process_packet(
|
||||
POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE,
|
||||
the_semaphore->Object.id,
|
||||
(char *) name,
|
||||
0 /* proxy id - Not used */
|
||||
);
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
|
||||
*/
|
||||
|
||||
int sem_init(
|
||||
sem_t *sem,
|
||||
int pshared,
|
||||
unsigned int value
|
||||
)
|
||||
{
|
||||
int status;
|
||||
POSIX_Semaphore_Control *the_semaphore;
|
||||
|
||||
status = _POSIX_Semaphore_Create_support(
|
||||
NULL,
|
||||
pshared,
|
||||
value,
|
||||
&the_semaphore
|
||||
);
|
||||
|
||||
if ( status != -1 )
|
||||
*sem = the_semaphore->Object.id;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
|
||||
*/
|
||||
|
||||
int sem_destroy(
|
||||
sem_t *sem
|
||||
)
|
||||
{
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
/*
|
||||
* Undefined operation on a named semaphore.
|
||||
*/
|
||||
|
||||
if ( the_semaphore->named == TRUE ) {
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
_Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
|
||||
|
||||
_CORE_semaphore_Flush(
|
||||
&the_semaphore->Semaphore,
|
||||
_POSIX_Semaphore_MP_Send_object_was_deleted,
|
||||
-1 /* XXX should also seterrno -> EINVAL */
|
||||
);
|
||||
|
||||
_POSIX_Semaphore_Free( the_semaphore );
|
||||
|
||||
if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
|
||||
|
||||
_Objects_MP_Close(
|
||||
&_POSIX_Semaphore_Information,
|
||||
the_semaphore->Object.id
|
||||
);
|
||||
|
||||
_POSIX_Semaphore_MP_Send_process_packet(
|
||||
POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE,
|
||||
the_semaphore->Object.id,
|
||||
0, /* Not used */
|
||||
0 /* Not used */
|
||||
);
|
||||
}
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
|
||||
*
|
||||
* NOTE: When oflag is O_CREAT, then optional third and fourth
|
||||
* parameters must be present.
|
||||
*/
|
||||
|
||||
sem_t *sem_open(
|
||||
const char *name,
|
||||
int oflag,
|
||||
...
|
||||
/* mode_t mode, */
|
||||
/* unsigned int value */
|
||||
)
|
||||
{
|
||||
va_list arg;
|
||||
mode_t mode;
|
||||
unsigned int value;
|
||||
int status;
|
||||
Objects_Id the_semaphore_id;
|
||||
POSIX_Semaphore_Control *the_semaphore;
|
||||
|
||||
|
||||
if ( oflag & O_CREAT ) {
|
||||
va_start(arg, oflag);
|
||||
mode = (mode_t) va_arg( arg, mode_t * );
|
||||
value = (unsigned int) va_arg( arg, unsigned int * );
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
|
||||
|
||||
/*
|
||||
* If the name to id translation worked, then the semaphore exists
|
||||
* and we can just return a pointer to the id. Otherwise we may
|
||||
* need to check to see if this is a "semaphore does not exist"
|
||||
* or some other miscellaneous error on the name.
|
||||
*/
|
||||
|
||||
if ( status ) {
|
||||
|
||||
if ( status == EINVAL ) { /* name -> ID translation failed */
|
||||
if ( !(oflag & O_CREAT) ) { /* willing to create it? */
|
||||
seterrno( ENOENT );
|
||||
return (sem_t *) -1;
|
||||
}
|
||||
/* we are willing to create it */
|
||||
}
|
||||
seterrno( status ); /* some type of error */
|
||||
return (sem_t *) -1;
|
||||
|
||||
} else { /* name -> ID translation succeeded */
|
||||
|
||||
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
||||
seterrno( EEXIST );
|
||||
return (sem_t *) -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX In this case we need to do an ID->pointer conversion to
|
||||
* check the mode. This is probably a good place for a subroutine.
|
||||
*/
|
||||
|
||||
the_semaphore->open_count += 1;
|
||||
|
||||
return (sem_t *)&the_semaphore->Object.id;
|
||||
|
||||
}
|
||||
|
||||
/* XXX verify this comment...
|
||||
*
|
||||
* At this point, the semaphore does not exist and everything has been
|
||||
* checked. We should go ahead and create a semaphore.
|
||||
*/
|
||||
|
||||
status = _POSIX_Semaphore_Create_support(
|
||||
name,
|
||||
TRUE, /* shared across processes */
|
||||
value,
|
||||
&the_semaphore
|
||||
);
|
||||
|
||||
if ( status == -1 )
|
||||
return (sem_t *) -1;
|
||||
|
||||
return (sem_t *) &the_semaphore->Object.id;
|
||||
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Delete
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_Delete(
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
)
|
||||
{
|
||||
if ( !the_semaphore->linked && !the_semaphore->open_count ) {
|
||||
_POSIX_Semaphore_Free( the_semaphore );
|
||||
|
||||
if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
|
||||
|
||||
_Objects_MP_Close(
|
||||
&_POSIX_Semaphore_Information,
|
||||
the_semaphore->Object.id
|
||||
);
|
||||
|
||||
_POSIX_Semaphore_MP_Send_process_packet(
|
||||
POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE,
|
||||
the_semaphore->Object.id,
|
||||
0, /* Not used */
|
||||
0 /* Not used */
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
|
||||
*/
|
||||
|
||||
int sem_close(
|
||||
sem_t *sem
|
||||
)
|
||||
{
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
the_semaphore->open_count -= 1;
|
||||
_POSIX_Semaphore_Delete( the_semaphore );
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
|
||||
*/
|
||||
|
||||
int sem_unlink(
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
int status;
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Id the_semaphore_id;
|
||||
Objects_Locations location;
|
||||
|
||||
status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
|
||||
|
||||
if ( !status )
|
||||
set_errno_and_return_minus_one( status );
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
|
||||
if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) {
|
||||
_Objects_MP_Close(
|
||||
&_POSIX_Semaphore_Information,
|
||||
the_semaphore->Object.id
|
||||
);
|
||||
}
|
||||
|
||||
the_semaphore->linked = FALSE;
|
||||
|
||||
_POSIX_Semaphore_Delete( the_semaphore );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Semaphore_Wait_support
|
||||
*/
|
||||
|
||||
int _POSIX_Semaphore_Wait_support(
|
||||
sem_t *sem,
|
||||
boolean blocking,
|
||||
Watchdog_Interval timeout
|
||||
)
|
||||
{
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
_CORE_semaphore_Seize(
|
||||
&the_semaphore->Semaphore,
|
||||
the_semaphore->Object.id,
|
||||
blocking,
|
||||
timeout
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
return _Thread_Executing->Wait.return_code;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
|
||||
*/
|
||||
|
||||
int sem_wait(
|
||||
sem_t *sem
|
||||
)
|
||||
{
|
||||
return _POSIX_Semaphore_Wait_support( sem, TRUE, THREAD_QUEUE_WAIT_FOREVER );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
|
||||
*/
|
||||
|
||||
int sem_trywait(
|
||||
sem_t *sem
|
||||
)
|
||||
{
|
||||
return _POSIX_Semaphore_Wait_support( sem, FALSE, THREAD_QUEUE_WAIT_FOREVER );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
|
||||
*
|
||||
* NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
|
||||
*/
|
||||
|
||||
int sem_timedwait(
|
||||
sem_t *sem,
|
||||
const struct timespec *timeout
|
||||
)
|
||||
{
|
||||
return _POSIX_Semaphore_Wait_support(
|
||||
sem,
|
||||
TRUE,
|
||||
_POSIX_Timespec_to_interval( timeout )
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
|
||||
*/
|
||||
|
||||
void POSIX_Semaphore_MP_support(
|
||||
Thread_Control *the_thread,
|
||||
Objects_Id id
|
||||
)
|
||||
{
|
||||
(void) POSIX_MP_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
|
||||
int sem_post(
|
||||
sem_t *sem
|
||||
)
|
||||
{
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
_CORE_semaphore_Surrender(
|
||||
&the_semaphore->Semaphore,
|
||||
the_semaphore->Object.id,
|
||||
POSIX_Semaphore_MP_support
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
|
||||
*/
|
||||
|
||||
int sem_getvalue(
|
||||
sem_t *sem,
|
||||
int *sval
|
||||
)
|
||||
{
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
seterrno( EINVAL );
|
||||
return( -1 );
|
||||
case OBJECTS_LOCAL:
|
||||
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
@@ -1,390 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/tod.h>
|
||||
|
||||
#include <rtems/posix/seterr.h>
|
||||
#include <rtems/posix/time.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Timespec_subtract
|
||||
*/
|
||||
|
||||
void _POSIX_Timespec_subtract(
|
||||
const struct timespec *the_start,
|
||||
const struct timespec *end,
|
||||
struct timespec *result
|
||||
)
|
||||
{
|
||||
struct timespec start_struct = *the_start;
|
||||
struct timespec *start = &start_struct;
|
||||
unsigned int nsecs_per_sec = TOD_NANOSECONDS_PER_SECOND;
|
||||
|
||||
if (end->tv_nsec < start->tv_nsec) {
|
||||
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec + 1;
|
||||
start->tv_nsec -= nsecs_per_sec * seconds;
|
||||
start->tv_sec += seconds;
|
||||
}
|
||||
|
||||
if (end->tv_nsec - start->tv_nsec > nsecs_per_sec) {
|
||||
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec;
|
||||
start->tv_nsec += nsecs_per_sec * seconds;
|
||||
start->tv_sec -= seconds;
|
||||
}
|
||||
|
||||
result->tv_sec = end->tv_sec - start->tv_sec;
|
||||
result->tv_nsec = end->tv_nsec - start->tv_nsec;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Timespec_to_interval
|
||||
*/
|
||||
|
||||
Watchdog_Interval _POSIX_Timespec_to_interval(
|
||||
const struct timespec *time
|
||||
)
|
||||
{
|
||||
Watchdog_Interval ticks;
|
||||
|
||||
ticks = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /
|
||||
_TOD_Microseconds_per_tick;
|
||||
|
||||
ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
|
||||
_TOD_Microseconds_per_tick;
|
||||
|
||||
return ticks;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interval_to_timespec
|
||||
*/
|
||||
|
||||
void _POSIX_Interval_to_timespec(
|
||||
Watchdog_Interval ticks,
|
||||
struct timespec *time
|
||||
)
|
||||
{
|
||||
unsigned32 usecs;
|
||||
|
||||
usecs = ticks * _TOD_Microseconds_per_tick;
|
||||
|
||||
time->tv_sec = usecs / TOD_MICROSECONDS_PER_SECOND;
|
||||
time->tv_nsec = (usecs % TOD_MICROSECONDS_PER_SECOND) *
|
||||
TOD_NANOSECONDS_PER_MICROSECOND;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.5.1 Get System Time, P1003.1b-1993, p. 91
|
||||
*/
|
||||
|
||||
time_t time(
|
||||
time_t *tloc
|
||||
)
|
||||
{
|
||||
time_t seconds_since_epoch;
|
||||
|
||||
/*
|
||||
* No error is the time of day is not set. For RTEMS the system time
|
||||
* starts out at the rtems epoch.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Internally the RTEMS epoch is 1988. This must be taken into account.
|
||||
*/
|
||||
|
||||
seconds_since_epoch = _TOD_Seconds_since_epoch;
|
||||
|
||||
seconds_since_epoch += POSIX_TIME_SECONDS_1970_THROUGH_1988;
|
||||
|
||||
if ( tloc )
|
||||
*tloc = seconds_since_epoch;
|
||||
|
||||
return seconds_since_epoch;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 14.2.1 Clocks, P1003.1b-1993, p. 263
|
||||
*/
|
||||
|
||||
int clock_settime(
|
||||
clockid_t clock_id,
|
||||
const struct timespec *tp
|
||||
)
|
||||
{
|
||||
struct tm split_time;
|
||||
TOD_Control tod;
|
||||
Watchdog_Interval seconds;
|
||||
|
||||
assert( tp );
|
||||
|
||||
switch ( clock_id ) {
|
||||
|
||||
case CLOCK_REALTIME:
|
||||
(void) gmtime_r( &tp->tv_sec, &split_time );
|
||||
|
||||
/*
|
||||
* Convert the tm structure format to that used by the TOD Handler
|
||||
*
|
||||
* NOTE: TOD Handler does not honor leap seconds.
|
||||
*/
|
||||
|
||||
tod.year = split_time.tm_year + 1900; /* RHS is years since 1900 */
|
||||
tod.month = split_time.tm_mon + 1; /* RHS uses 0-11 */
|
||||
tod.day = split_time.tm_mday;
|
||||
tod.hour = split_time.tm_hour;
|
||||
tod.minute = split_time.tm_min;
|
||||
tod.second = split_time.tm_sec; /* RHS allows 0-61 for leap seconds */
|
||||
|
||||
tod.ticks = (tp->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
|
||||
_TOD_Microseconds_per_tick;
|
||||
|
||||
if ( !_TOD_Validate( &tod ) )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
/*
|
||||
* We can't use the tp->tv_sec field because it is based on
|
||||
* a different EPOCH.
|
||||
*/
|
||||
|
||||
seconds = _TOD_To_seconds( &tod );
|
||||
_Thread_Disable_dispatch();
|
||||
_TOD_Set( &tod, seconds );
|
||||
_Thread_Enable_dispatch();
|
||||
break;
|
||||
|
||||
#ifdef _POSIX_CPUTIME
|
||||
case CLOCK_PROCESS_CPUTIME:
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_THREAD_CPUTIME
|
||||
case CLOCK_THREAD_CPUTIME:
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 14.2.1 Clocks, P1003.1b-1993, p. 263
|
||||
*/
|
||||
|
||||
int clock_gettime(
|
||||
clockid_t clock_id,
|
||||
struct timespec *tp
|
||||
)
|
||||
{
|
||||
ISR_Level level;
|
||||
time_t seconds;
|
||||
long ticks;
|
||||
|
||||
if ( !tp )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
switch ( clock_id ) {
|
||||
|
||||
case CLOCK_REALTIME:
|
||||
|
||||
_ISR_Disable( level );
|
||||
seconds = _TOD_Seconds_since_epoch;
|
||||
ticks = _TOD_Current.ticks;
|
||||
_ISR_Enable( level );
|
||||
|
||||
tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988;
|
||||
tp->tv_nsec = ticks * _TOD_Microseconds_per_tick *
|
||||
TOD_NANOSECONDS_PER_MICROSECOND;
|
||||
break;
|
||||
|
||||
#ifdef _POSIX_CPUTIME
|
||||
case CLOCK_PROCESS_CPUTIME:
|
||||
/* don't base this on _Watchdog_Ticks_since_boot--duration is too short*/
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_THREAD_CPUTIME
|
||||
case CLOCK_THREAD_CPUTIME:
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 14.2.1 Clocks, P1003.1b-1993, p. 263
|
||||
*/
|
||||
|
||||
int clock_getres(
|
||||
clockid_t clock_id,
|
||||
struct timespec *res
|
||||
)
|
||||
{
|
||||
if ( !res )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
switch ( clock_id ) {
|
||||
|
||||
/*
|
||||
* All time in rtems is based on the same clock tick.
|
||||
*/
|
||||
|
||||
case CLOCK_REALTIME:
|
||||
case CLOCK_PROCESS_CPUTIME:
|
||||
case CLOCK_THREAD_CPUTIME:
|
||||
if ( res )
|
||||
_POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );
|
||||
break;
|
||||
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
|
||||
*/
|
||||
|
||||
int nanosleep(
|
||||
const struct timespec *rqtp,
|
||||
struct timespec *rmtp
|
||||
)
|
||||
{
|
||||
Watchdog_Interval ticks;
|
||||
struct timespec *the_rqtp;
|
||||
|
||||
if ( !rqtp )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
the_rqtp = (struct timespec *)rqtp;
|
||||
|
||||
/*
|
||||
* Return EAGAIN if the delay interval is negative.
|
||||
*
|
||||
* NOTE: This behavior is beyond the POSIX specification.
|
||||
* FSU pthreads shares this behavior.
|
||||
*/
|
||||
|
||||
if ( the_rqtp->tv_sec < 0 )
|
||||
the_rqtp->tv_sec = 0;
|
||||
|
||||
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
|
||||
set_errno_and_return_minus_one( EAGAIN );
|
||||
|
||||
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
ticks = _POSIX_Timespec_to_interval( the_rqtp );
|
||||
|
||||
/*
|
||||
* This behavior is also beyond the POSIX specification but is
|
||||
* consistent with the RTEMS api and yields desirable behavior.
|
||||
*/
|
||||
|
||||
if ( !ticks ) {
|
||||
_Thread_Yield_processor();
|
||||
_Thread_Dispatch();
|
||||
if ( rmtp ) {
|
||||
rmtp->tv_sec = 0;
|
||||
rmtp->tv_nsec = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
_Thread_Set_state(
|
||||
_Thread_Executing,
|
||||
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
|
||||
);
|
||||
_Watchdog_Initialize(
|
||||
&_Thread_Executing->Timer,
|
||||
_Thread_Delay_ended,
|
||||
_Thread_Executing->Object.id,
|
||||
NULL
|
||||
);
|
||||
_Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
/* calculate time remaining */
|
||||
|
||||
if ( rmtp ) {
|
||||
ticks -=
|
||||
_Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time;
|
||||
|
||||
_POSIX_Interval_to_timespec( ticks, rmtp );
|
||||
|
||||
/*
|
||||
* If there is time remaining, then we were interrupted by a signal.
|
||||
*/
|
||||
|
||||
if ( ticks )
|
||||
set_errno_and_return_minus_one( EINTR );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
|
||||
*/
|
||||
|
||||
int clock_getcpuclockid(
|
||||
pid_t pid,
|
||||
clockid_t *clock_id
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
|
||||
*/
|
||||
|
||||
int clock_setenable_attr(
|
||||
clockid_t clock_id,
|
||||
int attr
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
|
||||
*/
|
||||
|
||||
int clock_getenable_attr(
|
||||
clockid_t clock_id,
|
||||
int *attr
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/posix/seterr.h>
|
||||
|
||||
pid_t _POSIX_types_Ppid = 0;
|
||||
uid_t _POSIX_types_Uid = 0;
|
||||
uid_t _POSIX_types_Euid = 0;
|
||||
gid_t _POSIX_types_Gid = 0;
|
||||
gid_t _POSIX_types_Egid = 0;
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
|
||||
*/
|
||||
|
||||
pid_t getpid( void )
|
||||
{
|
||||
return _Objects_Local_node;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
|
||||
*/
|
||||
|
||||
pid_t getppid( void )
|
||||
{
|
||||
return _POSIX_types_Ppid;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
uid_t getuid( void )
|
||||
{
|
||||
return _POSIX_types_Uid;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
uid_t geteuid( void )
|
||||
{
|
||||
return _POSIX_types_Euid;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
gid_t getgid( void )
|
||||
{
|
||||
return _POSIX_types_Gid;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
gid_t getegid( void )
|
||||
{
|
||||
return _POSIX_types_Egid;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
int setuid(
|
||||
uid_t uid
|
||||
)
|
||||
{
|
||||
_POSIX_types_Uid = uid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
int setgid(
|
||||
gid_t gid
|
||||
)
|
||||
{
|
||||
_POSIX_types_Gid = gid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.3 Get Supplementary IDs, P1003.1b-1993, p. 86
|
||||
*/
|
||||
|
||||
int getgroups(
|
||||
int gidsetsize,
|
||||
gid_t grouplist[]
|
||||
)
|
||||
{
|
||||
return 0; /* no supplemental group ids */
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.4 Get User Name, P1003.1b-1993, p. 87
|
||||
*
|
||||
* NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
|
||||
*/
|
||||
|
||||
static char _POSIX_types_Getlogin_buffer[ LOGIN_NAME_MAX ];
|
||||
|
||||
char *getlogin( void )
|
||||
{
|
||||
(void) getlogin_r( _POSIX_types_Getlogin_buffer, LOGIN_NAME_MAX );
|
||||
return _POSIX_types_Getlogin_buffer;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.4 Get User Name, P1003.1b-1993, p. 87
|
||||
*
|
||||
* NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
|
||||
*/
|
||||
|
||||
int getlogin_r(
|
||||
char *name,
|
||||
size_t namesize
|
||||
)
|
||||
{
|
||||
if ( namesize < LOGIN_NAME_MAX )
|
||||
return ERANGE;
|
||||
|
||||
strcpy( name, "posixapp" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.3.1 Get Process Group IDs, P1003.1b-1993, p. 89
|
||||
*/
|
||||
|
||||
pid_t getpgrp( void )
|
||||
{
|
||||
/*
|
||||
* This always succeeds and returns the process group id. For rtems,
|
||||
* this will always be the local node;
|
||||
*/
|
||||
|
||||
return _Objects_Local_node;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.3.2 Create Session and Set Process Group ID, P1003.1b-1993, p. 88
|
||||
*/
|
||||
|
||||
pid_t setsid( void )
|
||||
{
|
||||
set_errno_and_return_minus_one( ENOSYS );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.3.3 Set Process Group ID for Job Control, P1003.1b-1993, p. 89
|
||||
*/
|
||||
|
||||
int setpgid(
|
||||
pid_t pid,
|
||||
pid_t pgid
|
||||
)
|
||||
{
|
||||
set_errno_and_return_minus_one( ENOSYS );
|
||||
}
|
||||
|
||||
/*
|
||||
* TEMPORARY
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
int POSIX_MP_NOT_IMPLEMENTED()
|
||||
{
|
||||
assert( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int POSIX_BOTTOM_REACHED()
|
||||
{
|
||||
assert( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int POSIX_NOT_IMPLEMENTED()
|
||||
{
|
||||
assert( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* END OF TEMPORARY
|
||||
*/
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
|
||||
|
||||
/*
|
||||
* 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81
|
||||
*/
|
||||
|
||||
unsigned int sleep(
|
||||
unsigned int seconds
|
||||
)
|
||||
{
|
||||
/* XXX can we get away with this implementation? */
|
||||
struct timespec tp;
|
||||
struct timespec tm;
|
||||
|
||||
tp.tv_sec = seconds;
|
||||
tp.tv_nsec = 0;
|
||||
|
||||
nanosleep( &tp, &tm );
|
||||
|
||||
return tm.tv_sec; /* seconds remaining */
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95
|
||||
*/
|
||||
|
||||
long sysconf(
|
||||
int name
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.4.1 Get System Name, P1003.1b-1993, p. 90
|
||||
*/
|
||||
|
||||
int uname(
|
||||
struct utsname *name
|
||||
)
|
||||
{
|
||||
/* XXX: Here is what Solaris returns...
|
||||
sysname = SunOS
|
||||
nodename = node_name
|
||||
release = 5.3
|
||||
version = Generic_101318-12
|
||||
machine = sun4m
|
||||
*/
|
||||
|
||||
strcpy( name->sysname, "RTEMS" );
|
||||
|
||||
sprintf( name->nodename, "Node %d\n", _Objects_Local_node );
|
||||
|
||||
/* XXX release string is in BAD format for this routine!!! */
|
||||
strcpy( name->release, "3.2.0" );
|
||||
|
||||
/* XXX does this have any meaning for RTEMS */
|
||||
|
||||
strcpy( name->release, "" );
|
||||
|
||||
sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.5.2 Get Process Times, P1003.1b-1993, p. 92
|
||||
*/
|
||||
|
||||
clock_t times(
|
||||
struct tms *buffer
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/* sys/utsname.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_SYS_UTSNAME_h
|
||||
#define __POSIX_SYS_UTSNAME_h
|
||||
|
||||
#include <sys/times.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90
|
||||
*
|
||||
* NOTE: The lengths of the strings in this structure are
|
||||
* just long enough to reliably contain the RTEMS information.
|
||||
* For example, the fields are not long enough to support
|
||||
* Internet hostnames.
|
||||
*/
|
||||
|
||||
struct utsname {
|
||||
char sysname[ 32 ]; /* Name of this implementation of the operating system */
|
||||
char nodename[ 32 ]; /* Name of this node within an implementation */
|
||||
/* specified communication network */
|
||||
char release[ 32 ]; /* Current release level of this implementation */
|
||||
char version[ 32 ]; /* Current version level of this release */
|
||||
char machine[ 32 ]; /* Name of the hardware type on which the system */
|
||||
/* is running */
|
||||
};
|
||||
|
||||
/*
|
||||
* 4.4.1 Get System Name, P1003.1b-1993, p. 90
|
||||
*/
|
||||
|
||||
int uname(
|
||||
struct utsname *name
|
||||
);
|
||||
|
||||
/*
|
||||
* 4.5.2 Get Process Times, P1003.1b-1993, p. 92
|
||||
*/
|
||||
|
||||
clock_t times(
|
||||
struct tms *buffer
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
/* asr.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Asynchronous Signal Handler. This Handler provides the low-level
|
||||
* support required by the Signal Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_ASR_h
|
||||
#define __RTEMS_ASR_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/modes.h>
|
||||
|
||||
/*
|
||||
*
|
||||
* The following type defines the control block used to manage
|
||||
* each signal set.
|
||||
*/
|
||||
|
||||
typedef unsigned32 rtems_signal_set;
|
||||
|
||||
/*
|
||||
* Return type for ASR Handler
|
||||
*/
|
||||
|
||||
typedef void rtems_asr;
|
||||
|
||||
/*
|
||||
* The following type corresponds to the applications asynchronous
|
||||
* signal processing routine.
|
||||
*/
|
||||
|
||||
typedef rtems_asr ( *rtems_asr_entry )(
|
||||
rtems_signal_set
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* The following defines the control structure used to manage
|
||||
* signals. Each thread has a copy of this record.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
boolean is_enabled; /* are ASRs enabled currently? */
|
||||
rtems_asr_entry handler; /* address of RTEMS_ASR */
|
||||
Modes_Control mode_set; /* RTEMS_ASR mode */
|
||||
rtems_signal_set signals_posted; /* signal set */
|
||||
rtems_signal_set signals_pending; /* pending signal set */
|
||||
unsigned32 nest_level; /* nest level of RTEMS_ASR */
|
||||
} ASR_Information;
|
||||
|
||||
/*
|
||||
* The following constants define the individual signals which may
|
||||
* be used to compose a signal set.
|
||||
*/
|
||||
|
||||
#define RTEMS_SIGNAL_0 0x00000001
|
||||
#define RTEMS_SIGNAL_1 0x00000002
|
||||
#define RTEMS_SIGNAL_2 0x00000004
|
||||
#define RTEMS_SIGNAL_3 0x00000008
|
||||
#define RTEMS_SIGNAL_4 0x00000010
|
||||
#define RTEMS_SIGNAL_5 0x00000020
|
||||
#define RTEMS_SIGNAL_6 0x00000040
|
||||
#define RTEMS_SIGNAL_7 0x00000080
|
||||
#define RTEMS_SIGNAL_8 0x00000100
|
||||
#define RTEMS_SIGNAL_9 0x00000200
|
||||
#define RTEMS_SIGNAL_10 0x00000400
|
||||
#define RTEMS_SIGNAL_11 0x00000800
|
||||
#define RTEMS_SIGNAL_12 0x00001000
|
||||
#define RTEMS_SIGNAL_13 0x00002000
|
||||
#define RTEMS_SIGNAL_14 0x00004000
|
||||
#define RTEMS_SIGNAL_15 0x00008000
|
||||
#define RTEMS_SIGNAL_16 0x00010000
|
||||
#define RTEMS_SIGNAL_17 0x00020000
|
||||
#define RTEMS_SIGNAL_18 0x00040000
|
||||
#define RTEMS_SIGNAL_19 0x00080000
|
||||
#define RTEMS_SIGNAL_20 0x00100000
|
||||
#define RTEMS_SIGNAL_21 0x00200000
|
||||
#define RTEMS_SIGNAL_22 0x00400000
|
||||
#define RTEMS_SIGNAL_23 0x00800000
|
||||
#define RTEMS_SIGNAL_24 0x01000000
|
||||
#define RTEMS_SIGNAL_25 0x02000000
|
||||
#define RTEMS_SIGNAL_26 0x04000000
|
||||
#define RTEMS_SIGNAL_27 0x08000000
|
||||
#define RTEMS_SIGNAL_28 0x10000000
|
||||
#define RTEMS_SIGNAL_29 0x20000000
|
||||
#define RTEMS_SIGNAL_30 0x40000000
|
||||
#define RTEMS_SIGNAL_31 0x80000000
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/asr.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,84 +0,0 @@
|
||||
/* attr.h
|
||||
*
|
||||
* This include file contains all information about the Object Attributes
|
||||
* Handler.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_ATTRIBUTES_h
|
||||
#define __RTEMS_ATTRIBUTES_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* types */
|
||||
|
||||
typedef unsigned32 rtems_attribute;
|
||||
|
||||
/* constants */
|
||||
|
||||
#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000
|
||||
|
||||
#define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */
|
||||
#define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */
|
||||
|
||||
#define RTEMS_LOCAL 0x00000000 /* local resource */
|
||||
#define RTEMS_GLOBAL 0x00000002 /* global resource */
|
||||
|
||||
#define RTEMS_FIFO 0x00000000 /* process RTEMS_FIFO */
|
||||
#define RTEMS_PRIORITY 0x00000004 /* process by priority */
|
||||
|
||||
#define RTEMS_COUNTING_SEMAPHORE 0x00000000
|
||||
#define RTEMS_BINARY_SEMAPHORE 0x00000010
|
||||
|
||||
#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
|
||||
#define RTEMS_INHERIT_PRIORITY 0x00000020
|
||||
|
||||
#define RTEMS_NO_PRIORITY_CEILING 0x00000000
|
||||
#define RTEMS_PRIORITY_CEILING 0x00000040
|
||||
|
||||
#if ( CPU_HARDWARE_FP == TRUE )
|
||||
#define ATTRIBUTES_NOT_SUPPORTED 0
|
||||
#else
|
||||
#define ATTRIBUTES_NOT_SUPPORTED RTEMS_FLOATING_POINT
|
||||
#endif
|
||||
|
||||
#if ( CPU_ALL_TASKS_ARE_FP == TRUE )
|
||||
#define ATTRIBUTES_REQUIRED RTEMS_FLOATING_POINT
|
||||
#else
|
||||
#define ATTRIBUTES_REQUIRED 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* _Attributes_Handler_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs initialization for this handler.
|
||||
*
|
||||
* NOTE: There is no initialization required in C. Conditional compilation
|
||||
* takes care of this in C.
|
||||
*/
|
||||
|
||||
#define _Attributes_Handler_initialization()
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/attr.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,103 +0,0 @@
|
||||
/* clock.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Clock Manager. This manager provides facilities to set, obtain,
|
||||
* and continually update the current date and time.
|
||||
*
|
||||
* This manager provides directives to:
|
||||
*
|
||||
* + set the current date and time
|
||||
* + obtain the current date and time
|
||||
* + announce a clock tick
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_CLOCK_h
|
||||
#define __RTEMS_CLOCK_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/tod.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
/*
|
||||
* List of things which can be returned by the rtems_clock_get directive.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
RTEMS_CLOCK_GET_TOD,
|
||||
RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH,
|
||||
RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
|
||||
RTEMS_CLOCK_GET_TICKS_PER_SECOND,
|
||||
RTEMS_CLOCK_GET_TIME_VALUE
|
||||
} rtems_clock_get_options;
|
||||
|
||||
/*
|
||||
* Standard flavor style to return TOD in for a rtems_clock_get option.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned32 seconds;
|
||||
unsigned32 microseconds;
|
||||
} rtems_clock_time_value;
|
||||
|
||||
/*
|
||||
* rtems_clock_get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_clock_get directive. It returns
|
||||
* one of the following:
|
||||
* + current time of day
|
||||
* + seconds since epoch
|
||||
* + ticks since boot
|
||||
* + ticks per second
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_clock_get(
|
||||
rtems_clock_get_options option,
|
||||
void *time_buffer
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_clock_set
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_clock_set directive. It sets
|
||||
* the current time of day to that in the time_buffer record.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_clock_set(
|
||||
rtems_time_of_day *time_buffer
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_clock_tick
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_clock_tick directive. It is invoked
|
||||
* to inform RTEMS of the occurrence of a clock tick.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_clock_tick( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,54 +0,0 @@
|
||||
/* config.h
|
||||
*
|
||||
* This include file contains the table of user defined configuration
|
||||
* parameters specific for the RTEMS API.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RTEMS_CONFIGURATION_h
|
||||
#define __RTEMS_RTEMS_CONFIGURATION_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/types.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
|
||||
/*
|
||||
* The following records define the Configuration Table. The
|
||||
* information contained in this table is required in all
|
||||
* RTEMS systems, whether single or multiprocessor. This
|
||||
* table primarily defines the following:
|
||||
*
|
||||
* + required number of each object type
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned32 maximum_tasks;
|
||||
unsigned32 maximum_timers;
|
||||
unsigned32 maximum_semaphores;
|
||||
unsigned32 maximum_message_queues;
|
||||
unsigned32 maximum_partitions;
|
||||
unsigned32 maximum_regions;
|
||||
unsigned32 maximum_ports;
|
||||
unsigned32 maximum_periods;
|
||||
unsigned32 number_of_initialization_tasks;
|
||||
rtems_initialization_tasks_table *User_initialization_tasks_table;
|
||||
} rtems_api_configuration_table;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,157 +0,0 @@
|
||||
/* dpmem.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Dual Ported Memory Manager. This manager provides a mechanism
|
||||
* for converting addresses between internal and external representations
|
||||
* for multiple dual-ported memory areas.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a port
|
||||
* + get ID of a port
|
||||
* + delete a port
|
||||
* + convert external to internal address
|
||||
* + convert internal to external address
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_DUAL_PORTED_MEMORY_h
|
||||
#define __RTEMS_DUAL_PORTED_MEMORY_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* The following structure defines the port control block. Each port
|
||||
* has a control block associated with it. This control block contains
|
||||
* all information required to support the port related operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
void *internal_base; /* base internal address */
|
||||
void *external_base; /* base external address */
|
||||
unsigned32 length; /* length of dual-ported area */
|
||||
} Dual_ported_memory_Control;
|
||||
|
||||
/*
|
||||
* The following define the internal Dual Ported Memory information.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Dual_ported_memory_Information;
|
||||
|
||||
/*
|
||||
* _Dual_ported_memory_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Dual_ported_memory_Manager_initialization(
|
||||
unsigned32 maximum_ports
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_create directive. The port
|
||||
* will have the name name. The port maps onto an area of dual ported
|
||||
* memory of length bytes which has internal_start and external_start
|
||||
* as the internal and external starting addresses, respectively.
|
||||
* It returns the id of the created port in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_create(
|
||||
rtems_name name,
|
||||
void *internal_start,
|
||||
void *external_start,
|
||||
unsigned32 length,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_ident directive. This directive
|
||||
* returns the port ID associated with name. If more than one port is
|
||||
* named name, then the port to which the ID belongs is arbitrary.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_ident(
|
||||
rtems_name name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_delete directive. It deletes
|
||||
* the port associated with ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_external_to_internal
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_external_to_internal directive.
|
||||
* It returns the internal port address which maps to the provided
|
||||
* external port address for the specified port ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_external_to_internal(
|
||||
Objects_Id id,
|
||||
void *external,
|
||||
void **internal
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_internal_to_external
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the Port_internal_to_external directive.
|
||||
* It returns the external port address which maps to the provided
|
||||
* internal port address for the specified port ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_internal_to_external(
|
||||
Objects_Id id,
|
||||
void *internal,
|
||||
void **external
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/dpmem.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user