summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-01-29 00:29:25 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-01-29 00:29:25 +0000
commitdcec5a4d60405c206b1fab8630534e917fdf9857 (patch)
tree53dd9f4fbaffd74fbb5e8311ec6a2efe83eb84ea /cpukit
parentAll RTEMS system call implementation renamed to be __rtems_*. (diff)
downloadrtems-dcec5a4d60405c206b1fab8630534e917fdf9857.tar.bz2
Merged newlib's libgloss support for rtems into this directory. This
should simplify the build process.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h16
-rw-r--r--cpukit/libcsupport/src/libio.c16
-rw-r--r--cpukit/libcsupport/src/malloc.c36
-rw-r--r--cpukit/libcsupport/src/newlibc.c5
4 files changed, 41 insertions, 32 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 07d72620b1..b518100484 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -13,6 +13,8 @@
#ifndef _RTEMS_LIBIO_H
#define _RTEMS_LIBIO_H
+#include <sys/stat.h>
+
typedef unsigned32 rtems_libio_offset_t;
/*
@@ -88,11 +90,13 @@ typedef struct {
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);
+int __rtems_open(const char *pathname, unsigned32 flag, unsigned32 mode);
+int __rtems_close(int fd);
+int __rtems_read(int fd, void *buffer, unsigned32 count);
+int __rtems_write(int fd, const void *buffer, unsigned32 count);
+int __rtems_ioctl(int fd, unsigned32 command, void *buffer);
+int __rtems_lseek(int fd, rtems_libio_offset_t offset, int whence);
+int __rtems_fstat(int _fd, struct stat* _sbuf);
+int __rtems_isatty(int _fd);
#endif /* _RTEMS_LIBIO_H */
diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c
index 26448d20a4..3a7325c422 100644
--- a/cpukit/libcsupport/src/libio.c
+++ b/cpukit/libcsupport/src/libio.c
@@ -46,7 +46,7 @@ rtems_libio_t *rtems_libio_last_iop;
#define rtems_libio_check_fd(fd) \
do { \
- if ((fd) >= rtems_libio_number_iops) \
+ if ((unsigned32) (fd) >= rtems_libio_number_iops) \
{ \
errno = EBADF; \
return -1; \
@@ -243,7 +243,7 @@ rtems_libio_free(rtems_libio_t *iop)
}
int
-__open(
+__rtems_open(
const char *pathname,
unsigned32 flag,
unsigned32 mode)
@@ -254,10 +254,12 @@ __open(
rtems_libio_open_close_args_t args;
if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) {
+/*
if ( rc == RTEMS_UNSATISFIED ) {
puts( "open -- ENOSYS case" );
assert( 0 );
}
+*/
goto done;
}
@@ -291,7 +293,7 @@ done:
}
int
-__close(
+__rtems_close(
int fd
)
{
@@ -316,7 +318,7 @@ __close(
}
int
-__read(
+__rtems_read(
int fd,
void * buffer,
unsigned32 count
@@ -352,7 +354,7 @@ __read(
}
int
-__write(
+__rtems_write(
int fd,
const void *buffer,
unsigned32 count
@@ -388,7 +390,7 @@ __write(
}
int
-__ioctl(
+__rtems_ioctl(
int fd,
unsigned32 command,
void * buffer)
@@ -420,7 +422,7 @@ __ioctl(
int
-__lseek(
+__rtems_lseek(
int fd,
rtems_libio_offset_t offset,
int whence
diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c
index 61969c1d24..e8288a3bd3 100644
--- a/cpukit/libcsupport/src/malloc.c
+++ b/cpukit/libcsupport/src/malloc.c
@@ -37,7 +37,7 @@ size_t RTEMS_Malloc_Sbrk_amount;
#endif
#ifdef MALLOC_STATS
-#define MSBUMP(f,n) malloc_stats.f += (n)
+#define MSBUMP(f,n) rtems_malloc_stats.f += (n)
struct {
unsigned32 space_available; /* current size of malloc area */
@@ -48,9 +48,9 @@ struct {
unsigned32 max_depth; /* most ever malloc'd at 1 time */
unsigned64 lifetime_allocated;
unsigned64 lifetime_freed;
-} malloc_stats;
+} rtems_malloc_stats;
-#else /* No malloc_stats */
+#else /* No rtems_malloc_stats */
#define MSBUMP(f,n)
#endif
@@ -115,7 +115,7 @@ void RTEMS_Malloc_Initialize(
#ifdef MALLOC_STATS
/* zero all the stats */
- (void) memset(&malloc_stats, 0, sizeof(malloc_stats));
+ (void) memset(&rtems_malloc_stats, 0, sizeof(rtems_malloc_stats));
#endif
MSBUMP(space_available, length);
@@ -201,9 +201,9 @@ void *malloc(
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;
+ current_depth = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed;
+ if (current_depth > rtems_malloc_stats.max_depth)
+ rtems_malloc_stats.max_depth = current_depth;
}
#endif
@@ -314,23 +314,23 @@ void free(
void malloc_dump(void)
{
- unsigned32 allocated = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
+ unsigned32 allocated = rtems_malloc_stats.lifetime_allocated - rtems_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) rtems_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,
- (unsigned64) malloc_stats.lifetime_allocated / 1024,
- (unsigned64) malloc_stats.lifetime_freed / 1024);
+ (allocated * 100) / rtems_malloc_stats.space_available,
+ (unsigned int) rtems_malloc_stats.max_depth / 1024,
+ (rtems_malloc_stats.max_depth * 100) / rtems_malloc_stats.space_available,
+ (unsigned64) rtems_malloc_stats.lifetime_allocated / 1024,
+ (unsigned64) rtems_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);
+ rtems_malloc_stats.malloc_calls,
+ rtems_malloc_stats.free_calls,
+ rtems_malloc_stats.realloc_calls,
+ rtems_malloc_stats.calloc_calls);
}
diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c
index 2909c0e541..bd2d7133ed 100644
--- a/cpukit/libcsupport/src/newlibc.c
+++ b/cpukit/libcsupport/src/newlibc.c
@@ -1,4 +1,3 @@
-#if defined(RTEMS_NEWLIB)
/*
* COPYRIGHT (c) 1994 by Division Incorporated
@@ -30,6 +29,8 @@
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#include <rtems.h>
+
+#if defined(RTEMS_NEWLIB)
#include <libcsupport.h>
#include <stdlib.h> /* for free() */
#include <string.h> /* for memset() */
@@ -346,6 +347,8 @@ int get_errno()
*
*/
+#include <stdio.h>
+
#if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K)
void _exit(int status)
{