forked from Imagelibrary/rtems
updates from Tony Bennett for PA and UNIX ports
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @(#)assoc.c 1.4 - 95/08/02
|
||||
*
|
||||
* @(#)assoc.c 1.6 - 95/10/25
|
||||
*
|
||||
*
|
||||
* assoc.c
|
||||
* rtems assoc routines
|
||||
@@ -8,7 +8,6 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems.h>
|
||||
#include "assoc.h"
|
||||
|
||||
@@ -18,13 +17,13 @@
|
||||
#define STREQ(a,b) (strcmp((a), (b)) == 0)
|
||||
#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME))
|
||||
|
||||
rtems_assoc_t *
|
||||
const rtems_assoc_t *
|
||||
rtems_assoc_ptr_by_name(
|
||||
rtems_assoc_t *ap,
|
||||
char *name
|
||||
const rtems_assoc_t *ap,
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *default_ap = 0;
|
||||
const rtems_assoc_t *default_ap = 0;
|
||||
|
||||
if (rtems_assoc_is_default(ap))
|
||||
default_ap = ap++;
|
||||
@@ -36,13 +35,13 @@ rtems_assoc_ptr_by_name(
|
||||
return default_ap;
|
||||
}
|
||||
|
||||
rtems_assoc_t *
|
||||
const rtems_assoc_t *
|
||||
rtems_assoc_ptr_by_local(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *default_ap = 0;
|
||||
const rtems_assoc_t *default_ap = 0;
|
||||
|
||||
if (rtems_assoc_is_default(ap))
|
||||
default_ap = ap++;
|
||||
@@ -55,13 +54,13 @@ rtems_assoc_ptr_by_local(
|
||||
}
|
||||
|
||||
|
||||
rtems_assoc_t *
|
||||
const rtems_assoc_t *
|
||||
rtems_assoc_ptr_by_remote(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *default_ap = 0;
|
||||
const rtems_assoc_t *default_ap = 0;
|
||||
|
||||
if (rtems_assoc_is_default(ap))
|
||||
default_ap = ap++;
|
||||
@@ -80,11 +79,11 @@ rtems_assoc_ptr_by_remote(
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_remote_by_local(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *nap;
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_local(ap, local_value);
|
||||
if (nap)
|
||||
return nap->remote_value;
|
||||
@@ -94,11 +93,11 @@ rtems_assoc_remote_by_local(
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_local_by_remote(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *nap;
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_remote(ap, remote_value);
|
||||
if (nap)
|
||||
return nap->local_value;
|
||||
@@ -108,11 +107,11 @@ rtems_assoc_local_by_remote(
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_remote_by_name(
|
||||
rtems_assoc_t *ap,
|
||||
char *name
|
||||
const rtems_assoc_t *ap,
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *nap;
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_name(ap, name);
|
||||
if (nap)
|
||||
return nap->remote_value;
|
||||
@@ -122,11 +121,11 @@ rtems_assoc_remote_by_name(
|
||||
|
||||
unsigned32
|
||||
rtems_assoc_local_by_name(
|
||||
rtems_assoc_t *ap,
|
||||
char *name
|
||||
const rtems_assoc_t *ap,
|
||||
const char *name
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *nap;
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_name(ap, name);
|
||||
if (nap)
|
||||
return nap->local_value;
|
||||
@@ -139,25 +138,29 @@ rtems_assoc_local_by_name(
|
||||
* this is not reentrant, but it really shouldn't be invoked anyway
|
||||
*/
|
||||
|
||||
char *
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
const char *
|
||||
rtems_assoc_name_by_local(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *nap;
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_local(ap, local_value);
|
||||
if (nap)
|
||||
return nap->name;
|
||||
@@ -165,13 +168,13 @@ rtems_assoc_name_by_local(
|
||||
return rtems_assoc_name_bad(local_value);
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
rtems_assoc_name_by_remote(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
rtems_assoc_t *nap;
|
||||
const rtems_assoc_t *nap;
|
||||
nap = rtems_assoc_ptr_by_remote(ap, remote_value);
|
||||
if (nap)
|
||||
return nap->name;
|
||||
@@ -185,7 +188,7 @@ rtems_assoc_name_by_remote(
|
||||
*/
|
||||
|
||||
unsigned32 rtems_assoc_remote_by_local_bitfield(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 local_value
|
||||
)
|
||||
{
|
||||
@@ -201,7 +204,7 @@ unsigned32 rtems_assoc_remote_by_local_bitfield(
|
||||
|
||||
|
||||
unsigned32 rtems_assoc_local_by_remote_bitfield(
|
||||
rtems_assoc_t *ap,
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 remote_value
|
||||
)
|
||||
{
|
||||
@@ -215,8 +218,9 @@ unsigned32 rtems_assoc_local_by_remote_bitfield(
|
||||
return local_value;
|
||||
}
|
||||
|
||||
char *rtems_assoc_name_by_remote_bitfield(
|
||||
rtems_assoc_t *ap,
|
||||
char *
|
||||
rtems_assoc_name_by_remote_bitfield(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 value,
|
||||
char *buffer
|
||||
)
|
||||
@@ -236,8 +240,9 @@ char *rtems_assoc_name_by_remote_bitfield(
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char *rtems_assoc_name_by_local_bitfield(
|
||||
rtems_assoc_t *ap,
|
||||
char *
|
||||
rtems_assoc_name_by_local_bitfield(
|
||||
const rtems_assoc_t *ap,
|
||||
unsigned32 value,
|
||||
char *buffer
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* @(#)assoc.h 1.2 - 95/06/28
|
||||
* @(#)assoc.h 1.4 - 95/10/25
|
||||
*
|
||||
*
|
||||
* Rtems associativity routines. Mainly used to convert a value from
|
||||
@@ -13,7 +13,7 @@
|
||||
#define _INCLUDE_ASSOC_H
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
unsigned32 local_value;
|
||||
unsigned32 remote_value;
|
||||
} rtems_assoc_t;
|
||||
@@ -24,21 +24,21 @@ typedef struct {
|
||||
|
||||
#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
|
||||
|
||||
rtems_assoc_t *rtems_assoc_ptr_by_name(rtems_assoc_t *, char *);
|
||||
rtems_assoc_t *rtems_assoc_ptr_by_value(rtems_assoc_t *, unsigned32);
|
||||
rtems_assoc_t *rtems_assoc_ptr_by_remote(rtems_assoc_t *, unsigned32);
|
||||
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(rtems_assoc_t *, unsigned32);
|
||||
unsigned32 rtems_assoc_local_by_remote(rtems_assoc_t *, unsigned32);
|
||||
unsigned32 rtems_assoc_remote_by_name(rtems_assoc_t *, char *);
|
||||
unsigned32 rtems_assoc_local_by_name(rtems_assoc_t *, char *);
|
||||
char *rtems_assoc_name_by_local(rtems_assoc_t *, unsigned32);
|
||||
char *rtems_assoc_name_by_remote(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(rtems_assoc_t *, unsigned32);
|
||||
char *rtems_assoc_name_by_local_bitfield(rtems_assoc_t *, unsigned32, char *);
|
||||
char *rtems_assoc_name_by_remote_bitfield(rtems_assoc_t *, unsigned32, char *);
|
||||
unsigned32 rtems_assoc_local_by_remote_bitfield(rtems_assoc_t *ap, 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,10 +1,9 @@
|
||||
/*
|
||||
* @(#)error.c 1.2 - 95/08/02
|
||||
* @(#)error.c 1.6 - 95/12/12
|
||||
*
|
||||
*
|
||||
* report errors and panics to RTEMS' stderr.
|
||||
* Currently just used by RTEMS monitor.
|
||||
*
|
||||
* report errors and panics to RTEMS' stderr.
|
||||
* Currently just used by RTEMS monitor.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
@@ -97,7 +96,7 @@ rtems_assoc_t rtems_status_assoc[] = {
|
||||
};
|
||||
|
||||
|
||||
char *
|
||||
const char *
|
||||
rtems_status_text(
|
||||
rtems_status_code status
|
||||
)
|
||||
@@ -108,7 +107,7 @@ rtems_status_text(
|
||||
|
||||
static int rtems_verror(
|
||||
unsigned32 error_flag,
|
||||
char *printf_format,
|
||||
const char *printf_format,
|
||||
va_list arglist
|
||||
)
|
||||
{
|
||||
@@ -181,7 +180,7 @@ static int rtems_verror(
|
||||
|
||||
int rtems_error(
|
||||
int error_flag,
|
||||
char *printf_format,
|
||||
const char *printf_format,
|
||||
...
|
||||
)
|
||||
{
|
||||
@@ -200,7 +199,7 @@ int rtems_error(
|
||||
*/
|
||||
|
||||
void rtems_panic(
|
||||
char *printf_format,
|
||||
const char *printf_format,
|
||||
...
|
||||
)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
/*
|
||||
* @(#)error.h 1.1 - 95/08/02
|
||||
* @(#)error.h 1.3 - 95/10/25
|
||||
*
|
||||
*
|
||||
* Defines and externs for rtems error reporting
|
||||
@@ -7,6 +8,9 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_ERROR_h
|
||||
#define __RTEMS_ERROR_h
|
||||
|
||||
/*
|
||||
* rtems_error() and rtems_panic() support
|
||||
*/
|
||||
@@ -18,9 +22,11 @@
|
||||
#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \
|
||||
RTEMS_ERROR_PANIC) /* all */
|
||||
|
||||
char *rtems_status_text(rtems_status_code);
|
||||
int rtems_error(int error_code, char *printf_format, ...);
|
||||
void rtems_panic(char *printf_format, ...);
|
||||
const char *rtems_status_text(rtems_status_code);
|
||||
int rtems_error(int error_code, const char *printf_format, ...);
|
||||
void rtems_panic(const char *printf_format, ...);
|
||||
|
||||
extern int rtems_panic_in_progress;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -29,14 +29,14 @@ void RTEMS_Malloc_Initialize(
|
||||
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
|
||||
|
||||
extern int host_errno(void);
|
||||
extern void fix_syscall_errno(void);
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
|
||||
#include <stdio.h> /* O_RDONLY, et.al. */
|
||||
#include <fcntl.h> /* O_RDONLY, et.al. */
|
||||
#include <sys/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>
|
||||
@@ -208,7 +209,7 @@ rtems_libio_allocate(void)
|
||||
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1,
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&iop->sem
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !defined(RTEMS_LIBC) && !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX)
|
||||
#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX)
|
||||
|
||||
/* no_libc.h
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user