mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
Compare commits
193 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f745c6fcbc | ||
|
|
729c8f2e9d | ||
|
|
df8d1440d1 | ||
|
|
e399e18241 | ||
|
|
b7acc57fef | ||
|
|
8d7a1d76e2 | ||
|
|
c486e917b3 | ||
|
|
7d74395fe9 | ||
|
|
f88310da6c | ||
|
|
108ef35570 | ||
|
|
7f13a93288 | ||
|
|
9e28da4165 | ||
|
|
36197e539e | ||
|
|
4334949d02 | ||
|
|
eb0551f312 | ||
|
|
3a075f5d18 | ||
|
|
c53cfd0f2d | ||
|
|
25a882a611 | ||
|
|
022923e468 | ||
|
|
728b5a7bb4 | ||
|
|
ce0f7d95d6 | ||
|
|
1b17790ccd | ||
|
|
e89f8cacbf | ||
|
|
b85649c47b | ||
|
|
7fc3029a59 | ||
|
|
1094754fd9 | ||
|
|
da4b6e88ed | ||
|
|
2e0ebd11ad | ||
|
|
281ad526b6 | ||
|
|
4a1bc34b8f | ||
|
|
2291b71654 | ||
|
|
937808f500 | ||
|
|
ea1a5bef17 | ||
|
|
20d099eabd | ||
|
|
699fe08a25 | ||
|
|
c8f5ab5d2e | ||
|
|
fb39f191da | ||
|
|
12aeff91fe | ||
|
|
98ed15e30f | ||
|
|
d0baf81b2f | ||
|
|
494740cb7f | ||
|
|
1ba858d7ea | ||
|
|
1e608b0f5a | ||
|
|
893103c3c2 | ||
|
|
0f63c8627e | ||
|
|
fdec30ba62 | ||
|
|
d03f192a21 | ||
|
|
81daab3e6b | ||
|
|
05ce4e097a | ||
|
|
fa03f083a3 | ||
|
|
895efd9edc | ||
|
|
fce2e9dab3 | ||
|
|
0a359a7af5 | ||
|
|
782bdfd125 | ||
|
|
09b1f1ad2c | ||
|
|
e754dd1df9 | ||
|
|
5d9cb7e00f | ||
|
|
0207c55825 | ||
|
|
65a5c1b192 | ||
|
|
ebd40c0638 | ||
|
|
2f200c7e64 | ||
|
|
624133c6f4 | ||
|
|
ed10d76219 | ||
|
|
7aa4671d91 | ||
|
|
71698522fe | ||
|
|
23305a25c3 | ||
|
|
98162c35fb | ||
|
|
9b4e549729 | ||
|
|
7189a40297 | ||
|
|
09c1e31dc3 | ||
|
|
2c207d1f84 | ||
|
|
65911c32fb | ||
|
|
56bd4a361b | ||
|
|
230a0dcbb5 | ||
|
|
3ff4688cdd | ||
|
|
6b067c4eda | ||
|
|
95645a45e2 | ||
|
|
24adc5bc3d | ||
|
|
c48e0ee2b8 | ||
|
|
12c77ab080 | ||
|
|
15974b65ea | ||
|
|
8f85799226 | ||
|
|
552a345d97 | ||
|
|
742b399c66 | ||
|
|
f39b01e676 | ||
|
|
e811d68705 | ||
|
|
4427a6492e | ||
|
|
fa4fdd7dfd | ||
|
|
e984c64589 | ||
|
|
685f4d65d4 | ||
|
|
e88b5894f3 | ||
|
|
a26ee01ca4 | ||
|
|
5b748a177d | ||
|
|
19962562df | ||
|
|
5ff991e8a5 | ||
|
|
a38283590c | ||
|
|
f6e6ed8464 | ||
|
|
52a06419cc | ||
|
|
5e7b6272fc | ||
|
|
c238a2189d | ||
|
|
f31da72ce4 | ||
|
|
c832429dcd | ||
|
|
1e665a5716 | ||
|
|
e72d995a80 | ||
|
|
b927fba1c4 | ||
|
|
285af80408 | ||
|
|
9594cdbd4e | ||
|
|
7c55e065f9 | ||
|
|
5600661d6a | ||
|
|
b169590e9a | ||
|
|
53fd6e2979 | ||
|
|
a96a713c57 | ||
|
|
be1c11edab | ||
|
|
dd32d883d7 | ||
|
|
7f72217e97 | ||
|
|
2a98af841e | ||
|
|
5240c71c52 | ||
|
|
2197a2e15f | ||
|
|
cfcfdf0585 | ||
|
|
5e0efa2b3a | ||
|
|
d835a35cbd | ||
|
|
ece8c9abd3 | ||
|
|
9c877c0df6 | ||
|
|
98849f4487 | ||
|
|
613cff6f58 | ||
|
|
e941ea131d | ||
|
|
d9a0689e35 | ||
|
|
0252200299 | ||
|
|
99f9dffaf4 | ||
|
|
019bce7917 | ||
|
|
974ff40e57 | ||
|
|
c627b2a3a1 | ||
|
|
c6fa38c006 | ||
|
|
7640525da4 | ||
|
|
5a18e047ac | ||
|
|
2b4683a156 | ||
|
|
bc69a8591f | ||
|
|
962c9b65f2 | ||
|
|
47d6b1400f | ||
|
|
da33d26358 | ||
|
|
d4b4487779 | ||
|
|
8165b48f51 | ||
|
|
52d9e4d1ac | ||
|
|
2eba45de91 | ||
|
|
4b06db7558 | ||
|
|
cb9637246a | ||
|
|
e6d4b1d086 | ||
|
|
3320e526ff | ||
|
|
87a2a7418b | ||
|
|
28fa54d9b9 | ||
|
|
356efa36d6 | ||
|
|
5ebc91e1b5 | ||
|
|
94bac46465 | ||
|
|
6d12f59dd4 | ||
|
|
86fc81e9f3 | ||
|
|
568ebf32f4 | ||
|
|
abd604ae1c | ||
|
|
6481405e5c | ||
|
|
8442b4c7d2 | ||
|
|
13fcfde55e | ||
|
|
8a318cdf93 | ||
|
|
3a9fc7dd40 | ||
|
|
73c5da6a41 | ||
|
|
7303eea9fc | ||
|
|
1b297b4af2 | ||
|
|
d1d7e80784 | ||
|
|
a1c86cbead | ||
|
|
3d135eeaa9 | ||
|
|
d3fed0a30f | ||
|
|
02bfc5682e | ||
|
|
318ac69029 | ||
|
|
7af3a82886 | ||
|
|
f2cb4ac089 | ||
|
|
57fc51c2fe | ||
|
|
41e7a1d8f6 | ||
|
|
9854e33605 | ||
|
|
8b2ecf8546 | ||
|
|
64b976a960 | ||
|
|
a6aded4f0d | ||
|
|
0553a3a1d8 | ||
|
|
a5f56a4398 | ||
|
|
859f17ce22 | ||
|
|
d196e48590 | ||
|
|
2328475ccd | ||
|
|
ef006c1e3b | ||
|
|
f4719d5aaf | ||
|
|
05195890d7 | ||
|
|
ad50f41b43 | ||
|
|
cbaa556350 | ||
|
|
4e684a317e | ||
|
|
92262ab412 | ||
|
|
3e7b167af1 | ||
|
|
1c964ffab2 |
@@ -21,10 +21,10 @@ The following persons/organizations have made contributions:
|
||||
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
|
||||
(jsherril@redstone.army.mil). 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.
|
||||
(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
|
||||
@@ -75,6 +75,10 @@ The following persons/organizations have made contributions:
|
||||
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).
|
||||
|
||||
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
|
||||
|
||||
18
c/PROBLEMS
18
c/PROBLEMS
@@ -4,23 +4,21 @@
|
||||
|
||||
This is the list of outstanding problems in this release.
|
||||
|
||||
+ The POSIX threads and real time extensions code in this tree does
|
||||
not work yet and is intentionally not in the normal build path.
|
||||
+ The POSIX threads and real time extensions code in this tree are
|
||||
not completely tested yet. Some of the POSIX tests do run but none
|
||||
of the POSIX code is in the normal build path.
|
||||
|
||||
+ 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 m68000 support is nearly complete now. The missing piece
|
||||
inside the executive proper is support for the software interrupt
|
||||
stack. Also, 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 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 i960 family member tested is the CA. No support for the
|
||||
+ 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.
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
1. The installation procedure assumes that "gcc" is installed
|
||||
and is in your path for the installation of local tools.
|
||||
|
||||
2. gcc 2.6.3 with crossgcc patches (ftp.cygnus.com:/pub/embedded)
|
||||
2. gcc 2.7.2 with crossgcc patches (ftp.cygnus.com:/pub/embedded/crossgcc)
|
||||
|
||||
3. binutils 2.5.2
|
||||
3. binutils 2.6 with crossgcc patches.
|
||||
|
||||
4. newlib with RTEMS configurations.
|
||||
|
||||
|
||||
71
c/TESTED
71
c/TESTED
@@ -2,45 +2,41 @@
|
||||
# $Id$
|
||||
#
|
||||
|
||||
The RTEMS Project does not have all of the development computers or
|
||||
target boards included in the RTEMS distribution. Many of the BSPs
|
||||
are user supplied and we try to insure that they compile before each
|
||||
full release. This file describes the range of configurations the
|
||||
RTEMS project can internally test.
|
||||
This file is current as of the 3.5.17 snapshot.
|
||||
|
||||
Host Development Systems
|
||||
========================
|
||||
|
||||
All RTEMS development is done on a Sun SPARCStation running Solaris 2.3 and
|
||||
all other host systems are not tested internally.
|
||||
|
||||
Target Systems
|
||||
==============
|
||||
|
||||
The following table describes the testability of each BSP by the RTEMS project:
|
||||
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
|
||||
FAMILY MODEL TARGET STATUS
|
||||
====== ========= =================== =================
|
||||
m68k m68000 efi68k (note 1)
|
||||
m68k m68020 Motorola MVME136 TESTED INTERNALLY
|
||||
m68k m68lc040 Motorola MVME162 (note 1)
|
||||
m68k m68ec040 Motorola IDP (note 1)
|
||||
m68k m68020 DY-4 DMV152 (note 1)
|
||||
m68k m68302 generic 68302 (note 1)
|
||||
m68k m68332 efi332 (note 1)
|
||||
i386 i386_fp Force CPU-386 TESTED INTERNALLY
|
||||
i386 i486 DJGPP/PC-AT TESTED INTERNALLY
|
||||
i386 pentium DJGPP/PC-AT TESTED INTERNALLY
|
||||
i960 i960ca Cyclone CVME961 (note 4)
|
||||
hppa hppa7100 simhppa (note 2)
|
||||
ppc 403 Papyrus (note 2)
|
||||
UNIX NA Solaris 2 (SPARC) TESTED INTERNALLY (inlines)
|
||||
UNIX NA Solaris 2 (SPARC) TESTED INTERNALLY (macros)
|
||||
UNIX NA Linux (i386) (note 5)
|
||||
UNIX NA HPUX (PA-RISC) (note 2)
|
||||
no_cpu NA no_bsp (note 3)
|
||||
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.
|
||||
@@ -51,6 +47,5 @@ The following table describes the testability of each BSP by the RTEMS project:
|
||||
|
||||
(3) Target is not intended to be executed. It is only an example.
|
||||
|
||||
(4) The RTEMS Project owns this board but it is broken at the moment.
|
||||
|
||||
(5) The RTEMS Project owns a Linux host but does not regularly test this BSP.
|
||||
(4) The board owned by the RTEMS Project is broken. The BSP is known
|
||||
to compile and link with all appropriate tests successfully.
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -88,7 +88,11 @@ void error(int errn, ...);
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtoul(p, (char **) NULL, 0)
|
||||
#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);
|
||||
|
||||
@@ -1,721 +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 */
|
||||
|
||||
#define stol(p) strtoul(p, (char **) NULL, 0)
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* clock.h
|
||||
*
|
||||
* This file describes the Clock Driver for all boards.
|
||||
*
|
||||
* 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 __CLOCK_DRIVER_h
|
||||
#define __CLOCK_DRIVER_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* variables */
|
||||
|
||||
extern volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
extern rtems_device_major_number rtems_clock_major;
|
||||
extern rtems_device_minor_number rtems_clock_minor;
|
||||
|
||||
/* default clock driver entry */
|
||||
|
||||
#define CLOCK_DRIVER_TABLE_ENTRY \
|
||||
{ Clock_initialize, NULL, NULL, NULL, NULL, Clock_control }
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver Clock_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,69 +0,0 @@
|
||||
/* console.h
|
||||
*
|
||||
* This file describes the Console Device Driver for all boards.
|
||||
* This driver provides support for the standard C Library.
|
||||
*
|
||||
* 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 _CONSOLE_DRIVER_h
|
||||
#define _CONSOLE_DRIVER_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CONSOLE_DRIVER_TABLE_ENTRY \
|
||||
{ console_initialize, console_open, console_close, \
|
||||
console_read, console_write, console_control }
|
||||
|
||||
rtems_device_driver console_initialize(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver console_open(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver console_close(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver console_read(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver console_write(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver console_control(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,44 +0,0 @@
|
||||
/* iosupp.h
|
||||
*
|
||||
* 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 __IOSUPP_h
|
||||
#define __IOSUPP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* character constants */
|
||||
|
||||
#define BS 0x08 /* backspace */
|
||||
#define LF 0x0a /* line feed */
|
||||
#define CR 0x0d /* carriage return */
|
||||
#define XON 0x11 /* control-Q */
|
||||
#define XOFF 0x13 /* control-S */
|
||||
|
||||
/* structures */
|
||||
|
||||
#ifdef IOSUPP_INIT
|
||||
#define IOSUPP_EXTERN
|
||||
#else
|
||||
#undef IOSUPP_EXTERN
|
||||
#define IOSUPP_EXTERN extern
|
||||
#endif
|
||||
|
||||
/* functions */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* ringbuf.h
|
||||
*
|
||||
* This file provides simple ring buffer functionality.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RINGBUF_H__
|
||||
#define __RINGBUF_H__
|
||||
|
||||
#ifndef RINGBUF_QUEUE_LENGTH
|
||||
#define RINGBUF_QUEUE_LENGTH 128
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char buffer[RINGBUF_QUEUE_LENGTH];
|
||||
volatile int head;
|
||||
volatile int tail;
|
||||
} Ring_buffer_t;
|
||||
|
||||
#define Ring_buffer_Initialize( _buffer ) \
|
||||
do { \
|
||||
(_buffer)->head = (_buffer)->tail = 0; \
|
||||
} while ( 0 )
|
||||
|
||||
#define Ring_buffer_Is_empty( _buffer ) \
|
||||
( (_buffer)->head == (_buffer)->tail )
|
||||
|
||||
#define Ring_buffer_Is_full( _buffer ) \
|
||||
( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH )
|
||||
|
||||
#define Ring_buffer_Add_character( _buffer, _ch ) \
|
||||
do { \
|
||||
rtems_unsigned32 isrlevel; \
|
||||
\
|
||||
rtems_interrupt_disable( isrlevel ); \
|
||||
(_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \
|
||||
(_buffer)->buffer[ (_buffer)->tail ] = (_ch); \
|
||||
rtems_interrupt_enable( isrlevel ); \
|
||||
} while ( 0 )
|
||||
|
||||
#define Ring_buffer_Remove_character( _buffer, _ch ) \
|
||||
do { \
|
||||
rtems_unsigned32 isrlevel; \
|
||||
\
|
||||
rtems_interrupt_disable( isrlevel ); \
|
||||
(_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \
|
||||
(_ch) = (_buffer)->buffer[ (_buffer)->head ]; \
|
||||
rtems_interrupt_enable( isrlevel ); \
|
||||
} while ( 0 )
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Rtems associativity routines. Mainly used to convert a value from
|
||||
* one space to another (eg: our errno's to host errno's and v.v)
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_ASSOC_H
|
||||
#define _INCLUDE_ASSOC_H
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
unsigned32 local_value;
|
||||
unsigned32 remote_value;
|
||||
} rtems_assoc_t;
|
||||
|
||||
/*
|
||||
* Flag/marker for optional default value in each table
|
||||
*/
|
||||
|
||||
#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
|
||||
|
||||
const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *);
|
||||
const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32);
|
||||
const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32);
|
||||
|
||||
unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32);
|
||||
unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32);
|
||||
unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *);
|
||||
unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *);
|
||||
const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32);
|
||||
const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32);
|
||||
|
||||
unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32);
|
||||
char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *);
|
||||
char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *);
|
||||
unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32);
|
||||
|
||||
|
||||
#endif /* ! _INCLUDE_ASSOC_H */
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Defines and externs for rtems error reporting
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_ERROR_h
|
||||
#define __RTEMS_ERROR_h
|
||||
|
||||
/*
|
||||
* rtems_error() and rtems_panic() support
|
||||
*/
|
||||
|
||||
#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
|
||||
#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
|
||||
|
||||
#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
|
||||
RTEMS_ERROR_PANIC) /* all */
|
||||
|
||||
const char *rtems_status_text(rtems_status_code);
|
||||
int rtems_error(int error_code, const char *printf_format, ...);
|
||||
#ifdef __GNUC__
|
||||
void rtems_panic(const char *printf_format, ...)
|
||||
__attribute__ ((__noreturn__));
|
||||
#else
|
||||
void rtems_panic(const char *printf_format, ...);
|
||||
#endif
|
||||
|
||||
extern int rtems_panic_in_progress;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,42 +0,0 @@
|
||||
/* libcsupport.h
|
||||
*
|
||||
* This include file contains the information regarding the
|
||||
* RTEMS specific support for the standard C library.
|
||||
*
|
||||
* 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 __LIBC_SUPPORT_h
|
||||
#define __LIBC_SUPPORT_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
void RTEMS_Malloc_Initialize(
|
||||
void *start,
|
||||
size_t length,
|
||||
size_t sbrk_amount
|
||||
);
|
||||
|
||||
extern void malloc_dump(void);
|
||||
extern void libc_init(int reentrant);
|
||||
extern int host_errno(void);
|
||||
extern void fix_syscall_errno(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* General purpose communication channel for RTEMS to allow UNIX/POSIX
|
||||
* system call behavior on top of RTEMS IO devices.
|
||||
*
|
||||
* TODO
|
||||
* stat(2)
|
||||
* unlink(2)
|
||||
* rename(2)
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_LIBIO_H
|
||||
#define _RTEMS_LIBIO_H
|
||||
|
||||
typedef unsigned32 rtems_libio_offset_t;
|
||||
|
||||
/*
|
||||
* An open file data structure, indexed by 'fd'
|
||||
* TODO:
|
||||
* should really have a separate per/file data structure that this
|
||||
* points to (eg: size, offset, driver, pathname should be in that)
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_driver_name_t *driver;
|
||||
rtems_libio_offset_t size; /* size of file */
|
||||
rtems_libio_offset_t offset; /* current offset into the file */
|
||||
unsigned32 flags;
|
||||
char *pathname; /* opened pathname */
|
||||
Objects_Id sem;
|
||||
unsigned32 data0; /* private to "driver" */
|
||||
unsigned32 data1; /* ... */
|
||||
} rtems_libio_t;
|
||||
|
||||
|
||||
/*
|
||||
* param block for read/write
|
||||
* Note: it must include 'offset' instead of using iop's offset since
|
||||
* we can have multiple outstanding i/o's on a device.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_libio_t *iop;
|
||||
rtems_libio_offset_t offset;
|
||||
unsigned8 *buffer;
|
||||
unsigned32 count;
|
||||
unsigned32 flags;
|
||||
unsigned32 bytes_moved;
|
||||
} rtems_libio_rw_args_t;
|
||||
|
||||
/*
|
||||
* param block for open/close
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_libio_t *iop;
|
||||
unsigned32 flags;
|
||||
unsigned32 mode;
|
||||
} rtems_libio_open_close_args_t;
|
||||
|
||||
/*
|
||||
* param block for ioctl
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_libio_t *iop;
|
||||
unsigned32 command;
|
||||
void *buffer;
|
||||
unsigned32 ioctl_return;
|
||||
} rtems_libio_ioctl_args_t;
|
||||
|
||||
|
||||
/*
|
||||
* Values for 'flag'
|
||||
*/
|
||||
|
||||
#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */
|
||||
#define LIBIO_FLAGS_READ 0x0002 /* reading */
|
||||
#define LIBIO_FLAGS_WRITE 0x0004 /* writing */
|
||||
#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */
|
||||
#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */
|
||||
#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */
|
||||
#define LIBIO_FLAGS_CREATE 0x0400 /* create file */
|
||||
|
||||
#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
|
||||
|
||||
void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds);
|
||||
void rtems_libio_init(void);
|
||||
|
||||
int __open(const char *pathname, unsigned32 flag, unsigned32 mode);
|
||||
int __close(int fd);
|
||||
int __read(int fd, void *buffer, unsigned32 count);
|
||||
int __write(int fd, const void *buffer, unsigned32 count);
|
||||
int __ioctl(int fd, unsigned32 command, void *buffer);
|
||||
int __lseek(int fd, rtems_libio_offset_t offset, int whence);
|
||||
|
||||
#endif /* _RTEMS_LIBIO_H */
|
||||
@@ -1,38 +0,0 @@
|
||||
/* spurious.h
|
||||
*
|
||||
* This file describes the Spurious Interrupt Driver for all boards.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* 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 __SPURIOUS_h
|
||||
#define __SPURIOUS_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SPURIOUS_DRIVER_TABLE_ENTRY \
|
||||
{ Spurious_Initialize, NULL, NULL, NULL, NULL, NULL }
|
||||
|
||||
rtems_device_driver Spurious_Initialize(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *,
|
||||
rtems_id,
|
||||
rtems_unsigned32 *
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -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,40 +0,0 @@
|
||||
/* timerdrv.h
|
||||
*
|
||||
* This file describes the Timer Driver for all boards.
|
||||
*
|
||||
* 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 __TIMER_DRIVER_h
|
||||
#define __TIMER_DRIVER_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* functions */
|
||||
|
||||
void Timer_initialize( void );
|
||||
|
||||
rtems_unsigned32 Read_timer( void );
|
||||
|
||||
rtems_status_code Empty_function( void );
|
||||
|
||||
void Set_find_average_overhead(
|
||||
rtems_boolean find_flag
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* vmeintr.h
|
||||
*
|
||||
* This file is the specification for the VMEbus interface library
|
||||
* which should be provided by all BSPs for VMEbus Single Board
|
||||
* Computers but currently only a few do so.
|
||||
*
|
||||
* 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 __VME_INTERRUPT_h
|
||||
#define __VME_INTERRUPT_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This defines the mask which is used to determine which
|
||||
* interrupt levels are affected by a call to this package.
|
||||
* The LSB corresponds to VME interrupt 0 and the MSB
|
||||
* to VME interrupt 7.
|
||||
*
|
||||
*/
|
||||
|
||||
typedef rtems_unsigned8 VME_interrupt_Mask;
|
||||
|
||||
/*
|
||||
* VME_interrupt_Disable
|
||||
*
|
||||
*/
|
||||
|
||||
void VME_interrupt_Disable (
|
||||
VME_interrupt_Mask mask /* IN */
|
||||
);
|
||||
|
||||
/*
|
||||
* VME_interrupt_Disable
|
||||
*
|
||||
*/
|
||||
|
||||
void VME_interrupt_Enable (
|
||||
VME_interrupt_Mask mask /* IN */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of include file */
|
||||
@@ -1,37 +0,0 @@
|
||||
--
|
||||
-- $Id$
|
||||
--
|
||||
|
||||
Overview of newlib support (newlib is from CYGNUS)
|
||||
Each task can have its own libc state including:
|
||||
open stdio files
|
||||
strtok
|
||||
multi precision arithmetic state
|
||||
etc.
|
||||
|
||||
This is implemented by a reentrancy data structure for each task.
|
||||
|
||||
When a task is "started" (in RTEMS sense) the reentrancy structure
|
||||
is allocated. Its address is stored in notepad[NOTEPAD_LAST].
|
||||
|
||||
When task is switched to, the value of global variable _impure_ptr
|
||||
is changed to the value of the new tasks reentrancy structure.
|
||||
|
||||
When a task is deleted
|
||||
atexit() processing (for that task) happens
|
||||
task's stdio buffers are flushed
|
||||
|
||||
When exit(3) is called
|
||||
calling task's atexit processing done
|
||||
global libc state atexit processing done
|
||||
(this will include any atexit routines installed by drivers)
|
||||
executive is shutdown
|
||||
causes a context switch back to bsp land
|
||||
|
||||
|
||||
NOTE:
|
||||
libc extension are installed by bsp_libc_init()
|
||||
iff we are using clock interrupts.
|
||||
This hack is necessary to allow the tmtests to avoid
|
||||
timing the extensions.
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#if !defined(RTEMS_UNIX)
|
||||
|
||||
/*
|
||||
* RTEMS "Broken" __brk/__sbrk Implementation
|
||||
*
|
||||
* NOTE: sbrk is BSP provided.
|
||||
*
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef RTEMS_NEWLIB
|
||||
#include <reent.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
/* we use RTEMS for memory management. We don't need sbrk */
|
||||
|
||||
void * __sbrk(int incr)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return (void *)0;
|
||||
}
|
||||
|
||||
int __brk( const void *endds )
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,103 +0,0 @@
|
||||
#if !defined(RTEMS_UNIX)
|
||||
/*
|
||||
* RTEMS gettimeofday Implementation
|
||||
*
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#ifdef RTEMS_NEWLIB
|
||||
#include <sys/reent.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
* NOTE: The solaris gettimeofday does not have a second parameter.
|
||||
*/
|
||||
|
||||
int gettimeofday(
|
||||
struct timeval *tp,
|
||||
struct timezone *tzp
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
rtems_clock_time_value time;
|
||||
|
||||
if ( !tp ) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* "POSIX" does not seem to allow for not having a TOD */
|
||||
status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time );
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
assert( 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
tp->tv_sec = time.seconds;
|
||||
tp->tv_usec = time.microseconds;
|
||||
|
||||
/*
|
||||
* newlib does not have timezone and daylight savings time
|
||||
* yet. When it does this needs to be fixed.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
if ( tzp ) {
|
||||
tzp->tz_minuteswest = 0; /* at UTC */
|
||||
tzp->tz_dsttime = 0; /* no daylight savings */
|
||||
tzp->minuteswest = timezone / 60; /* from seconds to minutes */
|
||||
tzp->dsttime = daylight;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* "Reentrant" version
|
||||
*/
|
||||
|
||||
int _gettimeofday_r(
|
||||
struct _reent *ignored_reentrancy_stuff,
|
||||
struct timeval *tp,
|
||||
struct timezone *tzp
|
||||
)
|
||||
{
|
||||
return gettimeofday( tp, tzp );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "System call" version
|
||||
*/
|
||||
|
||||
int _gettimeofday(
|
||||
struct timeval *tp,
|
||||
struct timezone *tzp
|
||||
)
|
||||
{
|
||||
return gettimeofday( tp, tzp );
|
||||
}
|
||||
|
||||
#endif /* defined(RTEMS_NEWLIB) */
|
||||
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* RTEMS _times Implementation
|
||||
*
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#include <sys/times.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
clock_t _times(
|
||||
struct tms *ptms
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
rtems_interval ticks_since_boot;
|
||||
|
||||
if ( !ptms ) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* "POSIX" does not seem to allow for not having a TOD */
|
||||
status = rtems_clock_get(
|
||||
RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
|
||||
&ticks_since_boot
|
||||
);
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
assert( 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* RTEMS has no notion of system versus user time and does
|
||||
* not (as of 3.2.0) keep track of CPU usage on a per task basis.
|
||||
*/
|
||||
|
||||
ptms->tms_utime = ticks_since_boot;
|
||||
ptms->tms_stime = 0;
|
||||
ptms->tms_cutime = 0;
|
||||
ptms->tms_cstime = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
clock_t times(
|
||||
struct tms *ptms
|
||||
)
|
||||
{
|
||||
return _times( ptms );
|
||||
}
|
||||
|
||||
@@ -1,260 +0,0 @@
|
||||
/*
|
||||
* assoc.c
|
||||
* rtems assoc routines
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include "assoc.h"
|
||||
|
||||
#include <stdio.h> /* sprintf */
|
||||
#include <string.h> /* strcat, strcmp */
|
||||
|
||||
#define STREQ(a,b) (strcmp((a), (b)) == 0)
|
||||
#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME))
|
||||
|
||||
const rtems_assoc_t *
|
||||
rtems_assoc_ptr_by_name(
|
||||
const rtems_assoc_t *ap,
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *default_ap = 0;
|
||||
|
||||
if (rtems_assoc_is_default(ap))
|
||||
default_ap = ap++;
|
||||
|
||||
for ( ; ap->name; ap++)
|
||||
if (strcmp(ap->name, name) == 0)
|
||||
return ap;
|
||||
|
||||
return default_ap;
|
||||
}
|
||||
|
||||
const rtems_assoc_t *
|
||||
rtems_assoc_ptr_by_local(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *default_ap = 0;
|
||||
|
||||
if (rtems_assoc_is_default(ap))
|
||||
default_ap = ap++;
|
||||
|
||||
for ( ; ap->name; ap++)
|
||||
if (ap->local_value == local_value)
|
||||
return ap;
|
||||
|
||||
return default_ap;
|
||||
}
|
||||
|
||||
|
||||
const rtems_assoc_t *
|
||||
rtems_assoc_ptr_by_remote(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *default_ap = 0;
|
||||
|
||||
if (rtems_assoc_is_default(ap))
|
||||
default_ap = ap++;
|
||||
|
||||
for ( ; ap->name; ap++)
|
||||
if (ap->remote_value == remote_value)
|
||||
return ap;
|
||||
|
||||
return default_ap;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get values
|
||||
*/
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_remote_by_local(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_local(ap, local_value);
|
||||
if (nap)
|
||||
return nap->remote_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_local_by_remote(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_remote(ap, remote_value);
|
||||
if (nap)
|
||||
return nap->local_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_remote_by_name(
|
||||
const rtems_assoc_t *ap,
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_name(ap, name);
|
||||
if (nap)
|
||||
return nap->remote_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_local_by_name(
|
||||
const rtems_assoc_t *ap,
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_name(ap, name);
|
||||
if (nap)
|
||||
return nap->local_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* what to return if a value is not found
|
||||
* this is not reentrant, but it really shouldn't be invoked anyway
|
||||
*/
|
||||
|
||||
const char *
|
||||
rtems_assoc_name_bad(
|
||||
unsigned32 bad_value
|
||||
)
|
||||
{
|
||||
#ifdef RTEMS_DEBUG
|
||||
static char bad_buffer[32];
|
||||
|
||||
sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value);
|
||||
#else
|
||||
static char bad_buffer[32] = "<assoc.c: BAD NAME>";
|
||||
#endif
|
||||
return bad_buffer;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
rtems_assoc_name_by_local(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_local(ap, local_value);
|
||||
if (nap)
|
||||
return nap->name;
|
||||
|
||||
return rtems_assoc_name_bad(local_value);
|
||||
}
|
||||
|
||||
const char *
|
||||
rtems_assoc_name_by_remote(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_remote(ap, remote_value);
|
||||
if (nap)
|
||||
return nap->name;
|
||||
|
||||
return rtems_assoc_name_bad(remote_value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitfield functions assume just 1 bit set in each of remote and local
|
||||
* entries; they do not check for this.
|
||||
*/
|
||||
|
||||
unsigned32 rtems_assoc_remote_by_local_bitfield(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
unsigned32 b;
|
||||
unsigned32 remote_value = 0;
|
||||
|
||||
for (b = 1; b; b <<= 1)
|
||||
if (b & local_value)
|
||||
remote_value |= rtems_assoc_remote_by_local(ap, b);
|
||||
|
||||
return remote_value;
|
||||
}
|
||||
|
||||
|
||||
unsigned32 rtems_assoc_local_by_remote_bitfield(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
unsigned32 b;
|
||||
unsigned32 local_value = 0;
|
||||
|
||||
for (b = 1; b; b <<= 1)
|
||||
if (b & remote_value)
|
||||
local_value |= rtems_assoc_local_by_remote(ap, b);
|
||||
|
||||
return local_value;
|
||||
}
|
||||
|
||||
char *
|
||||
rtems_assoc_name_by_remote_bitfield(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 value,
|
||||
char *buffer
|
||||
)
|
||||
{
|
||||
unsigned32 b;
|
||||
|
||||
*buffer = 0;
|
||||
|
||||
for (b = 1; b; b <<= 1)
|
||||
if (b & value)
|
||||
{
|
||||
if (*buffer)
|
||||
strcat(buffer, " ");
|
||||
strcat(buffer, rtems_assoc_name_by_remote(ap, b));
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char *
|
||||
rtems_assoc_name_by_local_bitfield(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 value,
|
||||
char *buffer
|
||||
)
|
||||
{
|
||||
unsigned32 b;
|
||||
|
||||
*buffer = 0;
|
||||
|
||||
for (b = 1; b; b <<= 1)
|
||||
if (b & value)
|
||||
{
|
||||
if (*buffer)
|
||||
strcat(buffer, " ");
|
||||
strcat(buffer, rtems_assoc_name_by_local(ap, b));
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
/*
|
||||
* report errors and panics to RTEMS' stderr.
|
||||
* Currently just used by RTEMS monitor.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* These routines provide general purpose error reporting.
|
||||
* rtems_error reports an error to stderr and allows use of
|
||||
* printf style formatting. A newline is appended to all messages.
|
||||
*
|
||||
* error_flag can be specified as any of the following:
|
||||
*
|
||||
* RTEMS_ERROR_ERRNO -- include errno text in output
|
||||
* RTEMS_ERROR_PANIC -- halts local system after output
|
||||
* RTEMS_ERROR_ABORT -- abort after output
|
||||
*
|
||||
* It can also include a rtems_status value which can be OR'd
|
||||
* with the above flags. *
|
||||
*
|
||||
* EXAMPLE
|
||||
* #include <rtems.h>
|
||||
* #include <rtems/error.h>
|
||||
* rtems_error(0, "stray interrupt %d", intr);
|
||||
*
|
||||
* EXAMPLE
|
||||
* if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
|
||||
* {
|
||||
* rtems_error(status | RTEMS_ERROR_ABORT,
|
||||
* "could not create task");
|
||||
* }
|
||||
*
|
||||
* EXAMPLE
|
||||
* if ((fd = open(pathname, O_RDNLY)) < 0)
|
||||
* {
|
||||
* rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
|
||||
* goto failed;
|
||||
* }
|
||||
*/
|
||||
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
|
||||
#include <rtems.h>
|
||||
|
||||
#include "error.h"
|
||||
#include <rtems/assoc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> /* _exit() */
|
||||
|
||||
/* bug in hpux <errno.h>: no prototypes unless you are C++ */
|
||||
#ifdef hpux9
|
||||
char *strerror(int);
|
||||
#endif
|
||||
|
||||
extern char *rtems_progname;
|
||||
int rtems_panic_in_progress;
|
||||
|
||||
rtems_assoc_t rtems_status_assoc[] = {
|
||||
{ "successful completion", RTEMS_SUCCESSFUL, },
|
||||
{ "returned from a thread", RTEMS_TASK_EXITTED, },
|
||||
{ "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, },
|
||||
{ "invalid object name", RTEMS_INVALID_NAME, },
|
||||
{ "invalid object id", RTEMS_INVALID_ID, },
|
||||
{ "too many", RTEMS_TOO_MANY, },
|
||||
{ "timed out waiting", RTEMS_TIMEOUT, },
|
||||
{ "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, },
|
||||
{ "specified size was invalid", RTEMS_INVALID_SIZE, },
|
||||
{ "address specified is invalid", RTEMS_INVALID_ADDRESS, },
|
||||
{ "number was invalid", RTEMS_INVALID_NUMBER, },
|
||||
{ "item has not been initialized", RTEMS_NOT_DEFINED, },
|
||||
{ "resources still outstanding", RTEMS_RESOURCE_IN_USE, },
|
||||
{ "request not satisfied", RTEMS_UNSATISFIED, },
|
||||
{ "thread is in wrong state", RTEMS_INCORRECT_STATE, },
|
||||
{ "thread already in state", RTEMS_ALREADY_SUSPENDED, },
|
||||
{ "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, },
|
||||
{ "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, },
|
||||
{ "called from wrong environment", RTEMS_CALLED_FROM_ISR, },
|
||||
{ "invalid thread priority", RTEMS_INVALID_PRIORITY, },
|
||||
{ "invalid date/time", RTEMS_INVALID_CLOCK, },
|
||||
{ "invalid node id", RTEMS_INVALID_NODE, },
|
||||
{ "directive not configured", RTEMS_NOT_CONFIGURED, },
|
||||
{ "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , },
|
||||
{ "directive not implemented", RTEMS_NOT_IMPLEMENTED, },
|
||||
{ "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, },
|
||||
{ "could not get enough memory", RTEMS_NO_MEMORY, },
|
||||
{ "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
|
||||
const char *
|
||||
rtems_status_text(
|
||||
rtems_status_code status
|
||||
)
|
||||
{
|
||||
return rtems_assoc_name_by_local(rtems_status_assoc, status);
|
||||
}
|
||||
|
||||
|
||||
static int rtems_verror(
|
||||
unsigned32 error_flag,
|
||||
const char *printf_format,
|
||||
va_list arglist
|
||||
)
|
||||
{
|
||||
int local_errno = 0;
|
||||
int chars_written = 0;
|
||||
rtems_status_code status;
|
||||
|
||||
if (error_flag & RTEMS_ERROR_PANIC)
|
||||
{
|
||||
rtems_panic_in_progress++;
|
||||
|
||||
/* disable task switches */
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
/* don't aggravate things */
|
||||
if (rtems_panic_in_progress > 2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
status = error_flag & ~RTEMS_ERROR_MASK;
|
||||
if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */
|
||||
local_errno = errno;
|
||||
|
||||
if (_System_state_Is_multiprocessing)
|
||||
fprintf(stderr, "[%d] ", _Configuration_MP_table->node);
|
||||
|
||||
if (rtems_progname && *rtems_progname)
|
||||
chars_written += fprintf(stderr, "%s: ", rtems_progname);
|
||||
chars_written += vfprintf(stderr, printf_format, arglist);
|
||||
|
||||
if (status)
|
||||
chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status));
|
||||
|
||||
if (local_errno)
|
||||
if ((local_errno > 0) && *strerror(local_errno))
|
||||
chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno));
|
||||
else
|
||||
chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno);
|
||||
|
||||
chars_written += fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT))
|
||||
{
|
||||
if (error_flag & RTEMS_ERROR_PANIC)
|
||||
{
|
||||
rtems_error(0, "fatal error, exiting");
|
||||
_exit(local_errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtems_error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
return chars_written;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Report an error.
|
||||
* error_flag is as above; printf_format is a normal
|
||||
* printf(3) format string, with its concommitant arguments.
|
||||
*
|
||||
* Returns the number of characters written.
|
||||
*/
|
||||
|
||||
int rtems_error(
|
||||
int error_flag,
|
||||
const char *printf_format,
|
||||
...
|
||||
)
|
||||
{
|
||||
va_list arglist;
|
||||
int chars_written;
|
||||
|
||||
va_start(arglist, printf_format);
|
||||
chars_written = rtems_verror(error_flag, printf_format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
return chars_written;
|
||||
}
|
||||
|
||||
/*
|
||||
* rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...)
|
||||
*/
|
||||
|
||||
void rtems_panic(
|
||||
const char *printf_format,
|
||||
...
|
||||
)
|
||||
{
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, printf_format);
|
||||
(void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist);
|
||||
va_end(arglist);
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Routines to access a host errno
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <errno.h>
|
||||
|
||||
int host_errno(void);
|
||||
|
||||
/*
|
||||
* copy host errno, if any to thread aware errno, if any
|
||||
*/
|
||||
|
||||
void fix_syscall_errno(void)
|
||||
{
|
||||
errno = host_errno();
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the host system errno, if any
|
||||
* When using newlib (or possibly other libc's) on top of UNIX
|
||||
* the errno returned by system calls may be unavailable due
|
||||
* to trickery of making errno thread aware.
|
||||
* This provides a kludge of getting at it.
|
||||
*/
|
||||
|
||||
#undef errno
|
||||
extern int errno;
|
||||
int host_errno(void)
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
@@ -1,442 +0,0 @@
|
||||
/*
|
||||
* Provide UNIX/POSIX-like io system calls for RTEMS using the
|
||||
* RTEMS IO manager
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/assoc.h> /* assoc.h not included by rtems.h */
|
||||
|
||||
#include <stdio.h> /* O_RDONLY, et.al. */
|
||||
#include <fcntl.h> /* O_RDONLY, et.al. */
|
||||
|
||||
#if defined(solaris2)
|
||||
#define O_NDELAY O_NONBLOCK
|
||||
#elif defined(RTEMS_NEWLIB)
|
||||
#define O_NDELAY _FNBIO
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h> /* strcmp */
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h> /* calloc() */
|
||||
|
||||
#include "libio.h" /* libio.h not pulled in by rtems */
|
||||
|
||||
/*
|
||||
* Semaphore to protect the io table
|
||||
*/
|
||||
|
||||
Objects_Id rtems_libio_semaphore;
|
||||
|
||||
#define RTEMS_LIBIO_SEM rtems_build_name('L', 'B', 'I', 'O')
|
||||
#define RTEMS_LIBIO_IOP_SEM(n) rtems_build_name('L', 'B', 'I', n)
|
||||
|
||||
unsigned32 rtems_libio_number_iops;
|
||||
rtems_libio_t *rtems_libio_iops;
|
||||
rtems_libio_t *rtems_libio_last_iop;
|
||||
|
||||
#define rtems_libio_iop(fd) ((((unsigned32)(fd)) < rtems_libio_number_iops) ? \
|
||||
&rtems_libio_iops[fd] : 0)
|
||||
|
||||
#define rtems_libio_check_fd(fd) \
|
||||
do { \
|
||||
if ((fd) >= rtems_libio_number_iops) \
|
||||
{ \
|
||||
errno = EBADF; \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define rtems_libio_check_buffer(buffer) \
|
||||
do { \
|
||||
if ((buffer) == 0) \
|
||||
{ \
|
||||
errno = EINVAL; \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define rtems_libio_check_count(count) \
|
||||
do { \
|
||||
if ((count) == 0) \
|
||||
{ \
|
||||
return 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define rtems_libio_check_permissions(iop, flag) \
|
||||
do { \
|
||||
if (((iop)->flags & (flag)) == 0) \
|
||||
{ \
|
||||
errno = EINVAL; \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
void
|
||||
rtems_libio_config(
|
||||
rtems_configuration_table *config,
|
||||
unsigned32 max_fds
|
||||
)
|
||||
{
|
||||
rtems_libio_number_iops = max_fds;
|
||||
|
||||
/*
|
||||
* tweak config to reflect # of semaphores we will need
|
||||
*/
|
||||
|
||||
config->maximum_semaphores += 1; /* one for iop table */
|
||||
config->maximum_semaphores += max_fds;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called by bsp startup code to init the libio area.
|
||||
*/
|
||||
|
||||
void
|
||||
rtems_libio_init(void)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
|
||||
if (rtems_libio_number_iops > 0)
|
||||
{
|
||||
rtems_libio_iops = (rtems_libio_t *) calloc(rtems_libio_number_iops,
|
||||
sizeof(rtems_libio_t));
|
||||
if (rtems_libio_iops == NULL)
|
||||
rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
|
||||
|
||||
rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
|
||||
}
|
||||
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_SEM,
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&rtems_libio_semaphore
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert RTEMS status to a UNIX errno
|
||||
*/
|
||||
|
||||
rtems_assoc_t errno_assoc[] = {
|
||||
{ "OK", RTEMS_SUCCESSFUL, 0 },
|
||||
{ "TIMEOUT", RTEMS_TIMEOUT, ETIME },
|
||||
{ "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
static unsigned32
|
||||
rtems_libio_errno(rtems_status_code code)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if ((rc = rtems_assoc_remote_by_local(errno_assoc, (unsigned32) code)))
|
||||
{
|
||||
errno = rc;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand
|
||||
*/
|
||||
|
||||
rtems_assoc_t access_modes_assoc[] = {
|
||||
{ "READ", LIBIO_FLAGS_READ, O_RDONLY },
|
||||
{ "WRITE", LIBIO_FLAGS_WRITE, O_WRONLY },
|
||||
{ "READ/WRITE", LIBIO_FLAGS_READ_WRITE, O_RDWR },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
rtems_assoc_t status_flags_assoc[] = {
|
||||
{ "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY },
|
||||
{ "APPEND", LIBIO_FLAGS_APPEND, O_APPEND },
|
||||
{ "CREATE", LIBIO_FLAGS_CREATE, O_CREAT },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
static unsigned32
|
||||
rtems_libio_fcntl_flags(unsigned32 fcntl_flags)
|
||||
{
|
||||
unsigned32 flags = 0;
|
||||
unsigned32 access_modes;
|
||||
|
||||
/*
|
||||
* Access mode is a small integer
|
||||
*/
|
||||
|
||||
access_modes = fcntl_flags & O_ACCMODE;
|
||||
fcntl_flags &= ~O_ACCMODE;
|
||||
flags = rtems_assoc_local_by_remote(access_modes_assoc, access_modes);
|
||||
|
||||
/*
|
||||
* Everything else is single bits
|
||||
*/
|
||||
|
||||
flags |= rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
static rtems_libio_t *
|
||||
rtems_libio_allocate(void)
|
||||
{
|
||||
rtems_libio_t *iop;
|
||||
rtems_status_code rc;
|
||||
|
||||
rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
||||
|
||||
for (iop = rtems_libio_iops; iop <= rtems_libio_last_iop; iop++)
|
||||
if ((iop->flags & LIBIO_FLAGS_OPEN) == 0)
|
||||
{
|
||||
/*
|
||||
* Got one; create a semaphore for it
|
||||
*/
|
||||
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&iop->sem
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
goto failed;
|
||||
|
||||
iop->flags = LIBIO_FLAGS_OPEN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
failed:
|
||||
iop = 0;
|
||||
|
||||
done:
|
||||
rtems_semaphore_release(rtems_libio_semaphore);
|
||||
return iop;
|
||||
}
|
||||
|
||||
static void
|
||||
rtems_libio_free(rtems_libio_t *iop)
|
||||
{
|
||||
rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
|
||||
|
||||
if (iop->sem)
|
||||
rtems_semaphore_delete(iop->sem);
|
||||
(void) memset(iop, 0, sizeof(*iop));
|
||||
|
||||
rtems_semaphore_release(rtems_libio_semaphore);
|
||||
}
|
||||
|
||||
int
|
||||
__open(
|
||||
const char *pathname,
|
||||
unsigned32 flag,
|
||||
unsigned32 mode)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_libio_t *iop = 0;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_open_close_args_t args;
|
||||
|
||||
if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL)
|
||||
goto done;
|
||||
|
||||
iop = rtems_libio_allocate();
|
||||
if (iop == 0)
|
||||
{
|
||||
rc = RTEMS_TOO_MANY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
iop->driver = np;
|
||||
iop->pathname = (char *) pathname;
|
||||
iop->flags |= rtems_libio_fcntl_flags(flag);
|
||||
|
||||
args.iop = iop;
|
||||
args.flags = iop->flags;
|
||||
args.mode = mode;
|
||||
|
||||
rc = rtems_io_open(np->major, np->minor, (void *) &args);
|
||||
|
||||
done:
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
{
|
||||
if (iop)
|
||||
rtems_libio_free(iop);
|
||||
return rtems_libio_errno(rc);
|
||||
}
|
||||
|
||||
return iop - rtems_libio_iops;
|
||||
}
|
||||
|
||||
int
|
||||
__close(
|
||||
int fd
|
||||
)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_open_close_args_t args;
|
||||
|
||||
rtems_libio_check_fd(fd);
|
||||
|
||||
np = iop->driver;
|
||||
|
||||
args.iop = iop;
|
||||
args.flags = 0;
|
||||
args.mode = 0;
|
||||
|
||||
rc = rtems_io_close(np->major, np->minor, (void *) &args);
|
||||
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
return rtems_libio_errno(rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
__read(
|
||||
int fd,
|
||||
void * buffer,
|
||||
unsigned32 count
|
||||
)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_rw_args_t args;
|
||||
|
||||
rtems_libio_check_fd(fd);
|
||||
rtems_libio_check_buffer(buffer);
|
||||
rtems_libio_check_count(count);
|
||||
rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
|
||||
|
||||
np = iop->driver;
|
||||
|
||||
args.iop = iop;
|
||||
args.offset = iop->offset;
|
||||
args.buffer = buffer;
|
||||
args.count = count;
|
||||
args.flags = iop->flags;
|
||||
args.bytes_moved = 0;
|
||||
|
||||
rc = rtems_io_read(np->major, np->minor, (void *) &args);
|
||||
|
||||
iop->offset += args.bytes_moved;
|
||||
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
return rtems_libio_errno(rc);
|
||||
|
||||
return args.bytes_moved;
|
||||
}
|
||||
|
||||
int
|
||||
__write(
|
||||
int fd,
|
||||
const void *buffer,
|
||||
unsigned32 count
|
||||
)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_rw_args_t args;
|
||||
|
||||
rtems_libio_check_fd(fd);
|
||||
rtems_libio_check_buffer(buffer);
|
||||
rtems_libio_check_count(count);
|
||||
rtems_libio_check_permissions(iop, LIBIO_FLAGS_WRITE);
|
||||
|
||||
np = iop->driver;
|
||||
|
||||
args.iop = iop;
|
||||
args.offset = iop->offset;
|
||||
args.buffer = (void *) buffer;
|
||||
args.count = count;
|
||||
args.flags = iop->flags;
|
||||
args.bytes_moved = 0;
|
||||
|
||||
rc = rtems_io_write(np->major, np->minor, (void *) &args);
|
||||
|
||||
iop->offset += args.bytes_moved;
|
||||
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
return rtems_libio_errno(rc);
|
||||
|
||||
return args.bytes_moved;
|
||||
}
|
||||
|
||||
int
|
||||
__ioctl(
|
||||
int fd,
|
||||
unsigned32 command,
|
||||
void * buffer)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_ioctl_args_t args;
|
||||
|
||||
rtems_libio_check_fd(fd);
|
||||
|
||||
np = iop->driver;
|
||||
|
||||
args.iop = iop;
|
||||
args.command = command;
|
||||
args.buffer = buffer;
|
||||
|
||||
rc = rtems_io_control(np->major, np->minor, (void *) &args);
|
||||
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
return rtems_libio_errno(rc);
|
||||
|
||||
return args.ioctl_return;
|
||||
}
|
||||
|
||||
/*
|
||||
* internal only??
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
__lseek(
|
||||
int fd,
|
||||
rtems_libio_offset_t offset,
|
||||
int whence
|
||||
)
|
||||
{
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
|
||||
rtems_libio_check_fd(fd);
|
||||
|
||||
switch (whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
iop->offset = offset;
|
||||
break;
|
||||
|
||||
case SEEK_CUR:
|
||||
iop->offset += offset;
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
iop->offset = iop->size - offset;
|
||||
break;
|
||||
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,366 +0,0 @@
|
||||
/*
|
||||
* RTEMS Malloc Family Implementation
|
||||
*
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include "libcsupport.h"
|
||||
#ifdef RTEMS_NEWLIB
|
||||
#include <sys/reent.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> /* sbrk(2) */
|
||||
|
||||
rtems_id RTEMS_Malloc_Heap;
|
||||
size_t RTEMS_Malloc_Sbrk_amount;
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
#define MALLOC_STATS
|
||||
#define MALLOC_DIRTY
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
#define MSBUMP(f,n) malloc_stats.f += (n)
|
||||
|
||||
struct {
|
||||
unsigned32 space_available; /* current size of malloc area */
|
||||
unsigned32 malloc_calls; /* # calls to malloc */
|
||||
unsigned32 free_calls;
|
||||
unsigned32 realloc_calls;
|
||||
unsigned32 calloc_calls;
|
||||
unsigned32 max_depth; /* most ever malloc'd at 1 time */
|
||||
unsigned64 lifetime_allocated;
|
||||
unsigned64 lifetime_freed;
|
||||
} malloc_stats;
|
||||
|
||||
#else /* No malloc_stats */
|
||||
#define MSBUMP(f,n)
|
||||
#endif
|
||||
|
||||
void RTEMS_Malloc_Initialize(
|
||||
void *start,
|
||||
size_t length,
|
||||
size_t sbrk_amount
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
void *starting_address;
|
||||
rtems_unsigned32 old_address;
|
||||
rtems_unsigned32 u32_address;
|
||||
|
||||
/*
|
||||
* If the starting address is 0 then we are to attempt to
|
||||
* get length worth of memory using sbrk. Make sure we
|
||||
* align the address that we get back.
|
||||
*/
|
||||
|
||||
starting_address = start;
|
||||
RTEMS_Malloc_Sbrk_amount = sbrk_amount;
|
||||
|
||||
if (!starting_address) {
|
||||
u32_address = (unsigned int)sbrk(length);
|
||||
|
||||
if (u32_address == -1) {
|
||||
rtems_fatal_error_occurred( RTEMS_NO_MEMORY );
|
||||
/* DOES NOT RETURN!!! */
|
||||
}
|
||||
|
||||
if (u32_address & (CPU_ALIGNMENT-1)) {
|
||||
old_address = u32_address;
|
||||
u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
|
||||
/*
|
||||
* adjust the length by whatever we aligned by
|
||||
*/
|
||||
|
||||
length -= u32_address - old_address;
|
||||
}
|
||||
|
||||
starting_address = (void *)u32_address;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unfortunately we cannot use assert if this fails because if this
|
||||
* has failed we do not have a heap and if we do not have a heap
|
||||
* STDIO cannot work because there will be no buffers.
|
||||
*/
|
||||
|
||||
status = rtems_region_create(
|
||||
rtems_build_name( 'H', 'E', 'A', 'P' ),
|
||||
starting_address,
|
||||
length,
|
||||
CPU_ALIGNMENT,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&RTEMS_Malloc_Heap
|
||||
);
|
||||
if ( status != RTEMS_SUCCESSFUL )
|
||||
rtems_fatal_error_occurred( status );
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
/* zero all the stats */
|
||||
(void) memset(&malloc_stats, 0, sizeof(malloc_stats));
|
||||
#endif
|
||||
|
||||
MSBUMP(space_available, length);
|
||||
}
|
||||
|
||||
void *malloc(
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
void *return_this;
|
||||
void *starting_address;
|
||||
rtems_unsigned32 the_size;
|
||||
rtems_unsigned32 sbrk_amount;
|
||||
rtems_status_code status;
|
||||
|
||||
MSBUMP(malloc_calls, 1);
|
||||
|
||||
if ( !size )
|
||||
return (void *) 0;
|
||||
|
||||
/*
|
||||
* Try to give a segment in the current region if there is not
|
||||
* enough space then try to grow the region using rtems_region_extend().
|
||||
* If this fails then return a NULL pointer.
|
||||
*/
|
||||
|
||||
status = rtems_region_get_segment(
|
||||
RTEMS_Malloc_Heap,
|
||||
size,
|
||||
RTEMS_NO_WAIT,
|
||||
RTEMS_NO_TIMEOUT,
|
||||
&return_this
|
||||
);
|
||||
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
/*
|
||||
* Round to the "requested sbrk amount" so hopefully we won't have
|
||||
* to grow again for a while. This effectively does sbrk() calls
|
||||
* in "page" amounts.
|
||||
*/
|
||||
|
||||
sbrk_amount = RTEMS_Malloc_Sbrk_amount;
|
||||
|
||||
if ( sbrk_amount == 0 )
|
||||
return (void *) 0;
|
||||
|
||||
the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount);
|
||||
|
||||
if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)
|
||||
return (void *) 0;
|
||||
|
||||
status = rtems_region_extend(
|
||||
RTEMS_Malloc_Heap,
|
||||
starting_address,
|
||||
the_size
|
||||
);
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
sbrk(-the_size);
|
||||
errno = ENOMEM;
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
MSBUMP(space_available, the_size);
|
||||
|
||||
status = rtems_region_get_segment(
|
||||
RTEMS_Malloc_Heap,
|
||||
size,
|
||||
RTEMS_NO_WAIT,
|
||||
RTEMS_NO_TIMEOUT,
|
||||
&return_this
|
||||
);
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
errno = ENOMEM;
|
||||
return (void *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
if (return_this)
|
||||
{
|
||||
unsigned32 actual_size;
|
||||
unsigned32 current_depth;
|
||||
status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size);
|
||||
MSBUMP(lifetime_allocated, actual_size);
|
||||
current_depth = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
|
||||
if (current_depth > malloc_stats.max_depth)
|
||||
malloc_stats.max_depth = current_depth;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_DIRTY
|
||||
(void) memset(return_this, 0xCF, size);
|
||||
#endif
|
||||
|
||||
return return_this;
|
||||
}
|
||||
|
||||
void *calloc(
|
||||
size_t nelem,
|
||||
size_t elsize
|
||||
)
|
||||
{
|
||||
register char *cptr;
|
||||
int length;
|
||||
|
||||
MSBUMP(calloc_calls, 1);
|
||||
|
||||
length = nelem * elsize;
|
||||
cptr = malloc( length );
|
||||
if ( cptr )
|
||||
memset( cptr, '\0', length );
|
||||
|
||||
MSBUMP(malloc_calls, -1); /* subtract off the malloc */
|
||||
|
||||
return cptr;
|
||||
}
|
||||
|
||||
void *realloc(
|
||||
void *ptr,
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
rtems_unsigned32 old_size;
|
||||
rtems_status_code status;
|
||||
char *new_area;
|
||||
|
||||
MSBUMP(realloc_calls, 1);
|
||||
|
||||
if ( !ptr )
|
||||
return malloc( size );
|
||||
|
||||
if ( !size ) {
|
||||
free( ptr );
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
new_area = malloc( size );
|
||||
if ( !new_area ) {
|
||||
free( ptr );
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &old_size );
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
errno = EINVAL;
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
memcpy( new_area, ptr, (size < old_size) ? size : old_size );
|
||||
free( ptr );
|
||||
|
||||
return new_area;
|
||||
|
||||
}
|
||||
|
||||
void free(
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
MSBUMP(free_calls, 1);
|
||||
|
||||
if ( !ptr )
|
||||
return;
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
{
|
||||
unsigned32 size;
|
||||
status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &size );
|
||||
if ( status == RTEMS_SUCCESSFUL ) {
|
||||
MSBUMP(lifetime_freed, size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr );
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
errno = EINVAL;
|
||||
assert( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
/*
|
||||
* Dump the malloc statistics
|
||||
* May be called via atexit() (installable by our bsp) or
|
||||
* at any time by user
|
||||
*/
|
||||
|
||||
void malloc_dump(void)
|
||||
{
|
||||
unsigned32 allocated = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
|
||||
|
||||
printf("Malloc stats\n");
|
||||
printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n",
|
||||
(unsigned int) malloc_stats.space_available / 1024,
|
||||
(unsigned int) allocated / 1024,
|
||||
/* avoid float! */
|
||||
(allocated * 100) / malloc_stats.space_available,
|
||||
(unsigned int) malloc_stats.max_depth / 1024,
|
||||
(malloc_stats.max_depth * 100) / malloc_stats.space_available,
|
||||
(unsigned long long) malloc_stats.lifetime_allocated / 1024,
|
||||
(unsigned long long) malloc_stats.lifetime_freed / 1024);
|
||||
printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n",
|
||||
malloc_stats.malloc_calls,
|
||||
malloc_stats.free_calls,
|
||||
malloc_stats.realloc_calls,
|
||||
malloc_stats.calloc_calls);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "Reentrant" versions of the above routines implemented above.
|
||||
*/
|
||||
|
||||
#ifdef RTEMS_NEWLIB
|
||||
void *malloc_r(
|
||||
struct _reent *ignored,
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
return malloc( size );
|
||||
}
|
||||
|
||||
void *calloc_r(
|
||||
size_t nelem,
|
||||
size_t elsize
|
||||
)
|
||||
{
|
||||
return calloc( nelem, elsize );
|
||||
}
|
||||
|
||||
void *realloc_r(
|
||||
void *ptr,
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
return realloc_r( ptr, size );
|
||||
}
|
||||
|
||||
void free_r(
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
free( ptr );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1994 by Division Incorporated
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
* without any express or implied warranty:
|
||||
* permission to use, copy, modify, and distribute this file
|
||||
* for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice and this notice appears in all
|
||||
* copies, and that the name of Division Incorporated not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission.
|
||||
* Division Incorporated makes no representations about the
|
||||
* suitability of this software for any purpose.
|
||||
*
|
||||
* Description:
|
||||
* Implementation of hooks for the CYGNUS newlib libc
|
||||
* These hooks set things up so that:
|
||||
* '_REENT' is switched at task switch time.
|
||||
*
|
||||
*
|
||||
* TODO:
|
||||
*
|
||||
* NOTE:
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
|
||||
#include <rtems.h>
|
||||
#include <libcsupport.h>
|
||||
#include <stdlib.h> /* for free() */
|
||||
#include <string.h> /* for memset() */
|
||||
|
||||
#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
|
||||
|
||||
/*
|
||||
* NOTE: When using RTEMS fake stat, fstat, and isatty, all output
|
||||
* is line buffered so this setvbuf is not necessary. This
|
||||
* setvbuf insures that we can redirect the output of a test
|
||||
* on the UNIX simulator and it is in the same order as for a
|
||||
* real target.
|
||||
* NOTE:
|
||||
* There is some problem with doing this on the hpux version
|
||||
* of the UNIX simulator (symptom is printf core dumps), so
|
||||
* we just don't for now.
|
||||
* Not sure if this is a problem with hpux, newlib, or something else.
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_UNIX) && !defined(hpux)
|
||||
#define NEED_SETVBUF
|
||||
#endif
|
||||
|
||||
#ifdef NEED_SETVBUF
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define LIBC_NOTEPAD RTEMS_NOTEPAD_LAST
|
||||
|
||||
|
||||
int libc_reentrant; /* do we think we are reentrant? */
|
||||
struct _reent libc_global_reent = _REENT_INIT(libc_global_reent);;
|
||||
|
||||
/*
|
||||
* CYGNUS newlib routine that does atexit() processing and flushes
|
||||
* stdio streams
|
||||
* undocumented
|
||||
*/
|
||||
|
||||
extern void _wrapup_reent(struct _reent *);
|
||||
extern void _reclaim_reent(struct _reent *);
|
||||
|
||||
void
|
||||
libc_wrapup(void)
|
||||
{
|
||||
_wrapup_reent(0);
|
||||
if (_REENT != &libc_global_reent)
|
||||
{
|
||||
_wrapup_reent(&libc_global_reent);
|
||||
#if 0
|
||||
/* don't reclaim this one, just in case we do printfs */
|
||||
/* on our way out to ROM */
|
||||
_reclaim_reent(&libc_global_reent);
|
||||
#endif
|
||||
_REENT = &libc_global_reent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rtems_boolean
|
||||
libc_create_hook(rtems_tcb *current_task,
|
||||
rtems_tcb *creating_task)
|
||||
{
|
||||
MY_task_set_note(creating_task, LIBC_NOTEPAD, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
|
||||
*/
|
||||
|
||||
rtems_extension
|
||||
libc_start_hook(rtems_tcb *current_task,
|
||||
rtems_tcb *starting_task)
|
||||
{
|
||||
struct _reent *ptr;
|
||||
|
||||
/* NOTE: our malloc is reentrant without a reent ptr since
|
||||
* it is based on region manager
|
||||
*/
|
||||
|
||||
ptr = (struct _reent *) malloc(sizeof(struct _reent));
|
||||
|
||||
/* GCC extension: structure constants */
|
||||
*ptr = (struct _reent) _REENT_INIT((*ptr));
|
||||
|
||||
MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called for all user TASKS (system tasks are MPCI Receive Server and IDLE)
|
||||
*
|
||||
* NOTE: When using RTEMS fake stat, fstat, and isatty, all output
|
||||
* is line buffered so this setvbuf is not necessary. This
|
||||
* setvbuf insures that we can redirect the output of a test
|
||||
* on the UNIX simulator and it is in the same order as for a
|
||||
* real target.
|
||||
*/
|
||||
|
||||
#ifdef RTEMS_UNIX
|
||||
rtems_extension
|
||||
libc_begin_hook(rtems_tcb *current_task)
|
||||
{
|
||||
setvbuf( stdout, NULL, _IOLBF, BUFSIZ );
|
||||
}
|
||||
#endif
|
||||
|
||||
rtems_extension
|
||||
libc_switch_hook(rtems_tcb *current_task,
|
||||
rtems_tcb *heir_task)
|
||||
{
|
||||
rtems_unsigned32 impure_value;
|
||||
|
||||
/* XXX We can't use rtems_task_set_note() here since SYSI task has a
|
||||
* tid of 0, which is treated specially (optimized, actually)
|
||||
* by rtems_task_set_note
|
||||
*
|
||||
* NOTE: The above comment is no longer true and we need to use
|
||||
* the extension data areas added about the same time.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Don't touch the outgoing task if it has been deleted.
|
||||
*/
|
||||
|
||||
if ( !_States_Is_transient( current_task->current_state ) ) {
|
||||
impure_value = (rtems_unsigned32) _REENT;
|
||||
MY_task_set_note(current_task, LIBC_NOTEPAD, impure_value);
|
||||
}
|
||||
|
||||
_REENT = (struct _reent *) MY_task_get_note(heir_task, LIBC_NOTEPAD);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: libc_delete_hook
|
||||
* Created: 94/12/10
|
||||
*
|
||||
* Description:
|
||||
* Called when a task is deleted.
|
||||
* Must restore the new lib reentrancy state for the new current
|
||||
* task.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*
|
||||
* Side Effects:
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*
|
||||
* Deficiencies/ToDo:
|
||||
*
|
||||
*
|
||||
*/
|
||||
rtems_extension
|
||||
libc_delete_hook(rtems_tcb *current_task,
|
||||
rtems_tcb *deleted_task)
|
||||
{
|
||||
struct _reent *ptr;
|
||||
|
||||
/*
|
||||
* The reentrancy structure was allocated by newlib using malloc()
|
||||
*/
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
ptr = _REENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD);
|
||||
}
|
||||
|
||||
/* if (ptr) */
|
||||
if (ptr && ptr != &libc_global_reent)
|
||||
{
|
||||
_wrapup_reent(ptr);
|
||||
_reclaim_reent(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0);
|
||||
|
||||
/*
|
||||
* Require the switch back to another task to install its own
|
||||
*/
|
||||
|
||||
if (current_task == deleted_task)
|
||||
{
|
||||
_REENT = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: libc_init
|
||||
* Created: 94/12/10
|
||||
*
|
||||
* Description:
|
||||
* Init libc for CYGNUS newlib
|
||||
* Set up _REENT to use our global libc_global_reent.
|
||||
* (newlib provides a global of its own, but we prefer our
|
||||
* own name for it)
|
||||
*
|
||||
* If reentrancy is desired (which it should be), then
|
||||
* we install the task extension hooks to maintain the
|
||||
* newlib reentrancy global variable _REENT on task
|
||||
* create, delete, switch, exit, etc.
|
||||
*
|
||||
* Parameters:
|
||||
* reentrant non-zero if reentrant library desired.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* Side Effects:
|
||||
* installs libc extensions if reentrant.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*
|
||||
* Deficiencies/ToDo:
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
libc_init(int reentrant)
|
||||
{
|
||||
rtems_extensions_table libc_extension;
|
||||
rtems_id extension_id;
|
||||
rtems_status_code rc;
|
||||
|
||||
_REENT = &libc_global_reent;
|
||||
|
||||
if (reentrant)
|
||||
{
|
||||
memset(&libc_extension, 0, sizeof(libc_extension));
|
||||
|
||||
libc_extension.thread_create = libc_create_hook;
|
||||
libc_extension.thread_start = libc_start_hook;
|
||||
#ifdef RTEMS_UNIX
|
||||
libc_extension.thread_begin = libc_begin_hook;
|
||||
#endif
|
||||
libc_extension.thread_switch = libc_switch_hook;
|
||||
libc_extension.thread_delete = libc_delete_hook;
|
||||
|
||||
rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'),
|
||||
&libc_extension, &extension_id);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(rc);
|
||||
|
||||
libc_reentrant = reentrant;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
exit(int status)
|
||||
{
|
||||
libc_wrapup();
|
||||
rtems_shutdown_executive(status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: _exit
|
||||
* Created: 94/12/10
|
||||
*
|
||||
* Description:
|
||||
* Called from exit() after it does atexit() processing and stdio fflush's
|
||||
*
|
||||
* called from bottom of exit() to really delete the task.
|
||||
* If we are using reentrant libc, then let the delete extension
|
||||
* do all the work, otherwise if a shutdown is in progress,
|
||||
* then just do it.
|
||||
*
|
||||
* Parameters:
|
||||
* exit status
|
||||
*
|
||||
* Returns:
|
||||
* does not return
|
||||
*
|
||||
* Side Effects:
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*
|
||||
* Deficiencies/ToDo:
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(RTEMS_UNIX) && !defined(__GO32__)
|
||||
void _exit(int status)
|
||||
{
|
||||
rtems_shutdown_executive(status);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,45 +0,0 @@
|
||||
#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX)
|
||||
|
||||
/* no_libc.h
|
||||
*
|
||||
* This file contains stubs for the reentrancy hooks when
|
||||
* an unknown C library is used.
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#include "libcsupport.h"
|
||||
#include "internal.h"
|
||||
|
||||
#include <stdlib.h> /* for free() */
|
||||
|
||||
void
|
||||
libc_init(int reentrant)
|
||||
{
|
||||
}
|
||||
|
||||
void libc_suspend_main(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void libc_global_exit(rtems_unsigned32 code)
|
||||
{
|
||||
}
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_UNIXLIB)
|
||||
|
||||
void libc_init(int reentrant)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,61 +0,0 @@
|
||||
/* utsname.c
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/utsname.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;
|
||||
}
|
||||
|
||||
#ifdef NOT_IMPLEMENTED_YET
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.5.2 Get Process Times, P1003.1b-1993, p. 92
|
||||
*/
|
||||
|
||||
clock_t times(
|
||||
struct tms *buffer
|
||||
)
|
||||
{
|
||||
return POSIX_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
#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,154 +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$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_LIMITS_h
|
||||
#define __POSIX_LIMITS_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 9
|
||||
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
|
||||
/*
|
||||
* The maximum number of keys (PTHREAD_KEYS_MAX) and threads
|
||||
* (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum.
|
||||
*/
|
||||
|
||||
#define TTY_NAME_MAX 9
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* 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,502 +0,0 @@
|
||||
/* pthread.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PTHREAD_h
|
||||
#define __PTHREAD_h
|
||||
|
||||
#include <rtems/posix/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
|
||||
*/
|
||||
|
||||
int pthread_atfork(
|
||||
void (*prepare)(void),
|
||||
void (*parent)(void),
|
||||
void (*child)(void)
|
||||
);
|
||||
|
||||
/*
|
||||
* 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
|
||||
);
|
||||
|
||||
#define PTHREAD_INHERIT_SCHED 0 /* scheduling policy and associated */
|
||||
/* attributes are inherited from */
|
||||
/* the calling thread. */
|
||||
#define PTHREAD_EXPLICIT_SCHED 0 /* set from provided attribute object */
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Values for protocol.
|
||||
*/
|
||||
|
||||
#define PTHREAD_PRIO_NONE 0
|
||||
#define PTHREAD_PRIO_INHERIT 1
|
||||
#define PTHREAD_PRIO_PROTECT 2
|
||||
|
||||
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.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_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_ONCE_INITIALIZER { TRUE, FALSE }
|
||||
|
||||
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 pid,
|
||||
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 <rtems/posix/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,123 +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>
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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,153 +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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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,117 +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
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_h
|
||||
#define __RTEMS_POSIX_PRIORITY_h
|
||||
|
||||
#include <rtems/score/priority.h>
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
STATIC INLINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
);
|
||||
|
||||
STATIC INLINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
);
|
||||
|
||||
STATIC INLINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
);
|
||||
|
||||
#include <rtems/posix/priority.inl>
|
||||
|
||||
#endif
|
||||
@@ -1,113 +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
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX thread
|
||||
*/
|
||||
|
||||
typedef Thread_Control POSIX_Threads_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
EXTERN Objects_Information _POSIX_Threads_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_Manager_initialization(
|
||||
unsigned32 maximum_pthreads
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a pthread control block from
|
||||
* the inactive chain of free pthread control blocks.
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_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.
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Threads_Free (
|
||||
POSIX_Threads_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.
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_pthread is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Threads_Is_null (
|
||||
POSIX_Threads_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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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,30 +0,0 @@
|
||||
/* threadsup.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
#define __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
|
||||
#include <rtems/score/coresem.h>
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
* POSIX Interrupts
|
||||
*/
|
||||
unsigned32 interrupts_installed;
|
||||
CORE_semaphore_Control Interrupt_Semaphore;
|
||||
|
||||
/*
|
||||
* POSIX Cancelability
|
||||
*/
|
||||
int cancelability_state;
|
||||
int cancelability_type;
|
||||
int cancelation_requested;
|
||||
Chain_Control Cancellation_Handlers;
|
||||
|
||||
} POSIX_API_Thread_Support_Control;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_TIME_h
|
||||
#define __RTEMS_POSIX_TIME_h
|
||||
|
||||
Watchdog_Interval _POSIX_Time_Spec_to_interval(
|
||||
const 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,154 +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$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_LIMITS_h
|
||||
#define __POSIX_LIMITS_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 9
|
||||
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
|
||||
/*
|
||||
* The maximum number of keys (PTHREAD_KEYS_MAX) and threads
|
||||
* (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum.
|
||||
*/
|
||||
|
||||
#define TTY_NAME_MAX 9
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* 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,502 +0,0 @@
|
||||
/* pthread.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PTHREAD_h
|
||||
#define __PTHREAD_h
|
||||
|
||||
#include <rtems/posix/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
|
||||
*/
|
||||
|
||||
int pthread_atfork(
|
||||
void (*prepare)(void),
|
||||
void (*parent)(void),
|
||||
void (*child)(void)
|
||||
);
|
||||
|
||||
/*
|
||||
* 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
|
||||
);
|
||||
|
||||
#define PTHREAD_INHERIT_SCHED 0 /* scheduling policy and associated */
|
||||
/* attributes are inherited from */
|
||||
/* the calling thread. */
|
||||
#define PTHREAD_EXPLICIT_SCHED 0 /* set from provided attribute object */
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Values for protocol.
|
||||
*/
|
||||
|
||||
#define PTHREAD_PRIO_NONE 0
|
||||
#define PTHREAD_PRIO_INHERIT 1
|
||||
#define PTHREAD_PRIO_PROTECT 2
|
||||
|
||||
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.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_INITIALIZER;
|
||||
*/
|
||||
|
||||
#define PTHREAD_ONCE_INITIALIZER { TRUE, FALSE }
|
||||
|
||||
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 pid,
|
||||
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,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,123 +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>
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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,153 +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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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,117 +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
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_h
|
||||
#define __RTEMS_POSIX_PRIORITY_h
|
||||
|
||||
#include <rtems/score/priority.h>
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
STATIC INLINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
);
|
||||
|
||||
STATIC INLINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
);
|
||||
|
||||
STATIC INLINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
);
|
||||
|
||||
#include <rtems/posix/priority.inl>
|
||||
|
||||
#endif
|
||||
@@ -1,113 +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
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX thread
|
||||
*/
|
||||
|
||||
typedef Thread_Control POSIX_Threads_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
EXTERN Objects_Information _POSIX_Threads_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_Manager_initialization(
|
||||
unsigned32 maximum_pthreads
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a pthread control block from
|
||||
* the inactive chain of free pthread control blocks.
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_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.
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Threads_Free (
|
||||
POSIX_Threads_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.
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_pthread is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Threads_Is_null (
|
||||
POSIX_Threads_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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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.
|
||||
*/
|
||||
|
||||
STATIC INLINE 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,30 +0,0 @@
|
||||
/* threadsup.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
#define __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
|
||||
#include <rtems/score/coresem.h>
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
* POSIX Interrupts
|
||||
*/
|
||||
unsigned32 interrupts_installed;
|
||||
CORE_semaphore_Control Interrupt_Semaphore;
|
||||
|
||||
/*
|
||||
* POSIX Cancelability
|
||||
*/
|
||||
int cancelability_state;
|
||||
int cancelability_type;
|
||||
int cancelation_requested;
|
||||
Chain_Control Cancellation_Handlers;
|
||||
|
||||
} POSIX_API_Thread_Support_Control;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_TIME_h
|
||||
#define __RTEMS_POSIX_TIME_h
|
||||
|
||||
Watchdog_Interval _POSIX_Time_Spec_to_interval(
|
||||
const struct timespec *time
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -1,88 +0,0 @@
|
||||
/* sched.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __POSIX_SCHEDULING_h
|
||||
#define __POSIX_SCHEDULING_h
|
||||
|
||||
#include <rtems/posix/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,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,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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Interrupt_Handler_control *
|
||||
_POSIX_Interrupt_Allocate( void )
|
||||
{
|
||||
return (POSIX_Interrupt_Handler_control *)
|
||||
_Objects_Allocate( &_POSIX_Interrupt_Handlers_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Interrupt_Free (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
|
||||
{
|
||||
return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Keys_Free (
|
||||
POSIX_Keys_Control *the_key
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Message_queue_Is_null (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
)
|
||||
{
|
||||
return !the_mq;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Priority_to_core
|
||||
*/
|
||||
|
||||
STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
|
||||
unsigned int priority
|
||||
)
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,88 +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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
|
||||
{
|
||||
return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Mutex_Free (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
int status;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Mutex_Is_null (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
return !the_mutex;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_inl
|
||||
#define __RTEMS_POSIX_PRIORITY_inl
|
||||
|
||||
STATIC INLINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (boolean) priority >= 1 && priority <= 255;
|
||||
}
|
||||
|
||||
STATIC INLINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (Priority_Control) 256 - priority;
|
||||
}
|
||||
|
||||
STATIC INLINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
)
|
||||
{
|
||||
return 256 - priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,71 +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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void )
|
||||
{
|
||||
return (POSIX_Threads_Control *)
|
||||
_Objects_Allocate( &_POSIX_Threads_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Threads_Free (
|
||||
POSIX_Threads_Control *the_pthread
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Threads_Control *)
|
||||
_Objects_Get( &_POSIX_Threads_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Is_null
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Threads_Is_null (
|
||||
POSIX_Threads_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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Interrupt_Handler_control *
|
||||
_POSIX_Interrupt_Allocate( void )
|
||||
{
|
||||
return (POSIX_Interrupt_Handler_control *)
|
||||
_Objects_Allocate( &_POSIX_Interrupt_Handlers_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Interrupt_Free (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Interrupt_Handlers_Information, &the_intr->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interrupt_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void )
|
||||
{
|
||||
return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Keys_Free (
|
||||
POSIX_Keys_Control *the_key
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Keys_Information, &the_key->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Keys_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE 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
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Message_queue_Is_null (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
)
|
||||
{
|
||||
return !the_mq;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Message_queue_Priority_to_core
|
||||
*/
|
||||
|
||||
STATIC INLINE Priority_Control _POSIX_Message_queue_Priority_to_core(
|
||||
unsigned int priority
|
||||
)
|
||||
{
|
||||
return priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,88 +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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
|
||||
{
|
||||
return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Mutex_Free (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Mutex_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
int status;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Mutex_Is_null (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
)
|
||||
{
|
||||
return !the_mutex;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_inl
|
||||
#define __RTEMS_POSIX_PRIORITY_inl
|
||||
|
||||
STATIC INLINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (boolean) priority >= 1 && priority <= 255;
|
||||
}
|
||||
|
||||
STATIC INLINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
)
|
||||
{
|
||||
return (Priority_Control) 256 - priority;
|
||||
}
|
||||
|
||||
STATIC INLINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
)
|
||||
{
|
||||
return 256 - priority;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,71 +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
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Allocate( void )
|
||||
{
|
||||
return (POSIX_Threads_Control *)
|
||||
_Objects_Allocate( &_POSIX_Threads_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Free
|
||||
*/
|
||||
|
||||
STATIC INLINE void _POSIX_Threads_Free (
|
||||
POSIX_Threads_Control *the_pthread
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Get
|
||||
*/
|
||||
|
||||
STATIC INLINE POSIX_Threads_Control *_POSIX_Threads_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (POSIX_Threads_Control *)
|
||||
_Objects_Get( &_POSIX_Threads_Information, *id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Threads_Is_null
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _POSIX_Threads_Is_null (
|
||||
POSIX_Threads_Control *the_pthread
|
||||
)
|
||||
{
|
||||
return !the_pthread;
|
||||
}
|
||||
|
||||
#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