Changeset dcec5a4 in rtems
- Timestamp:
- Jan 29, 1997, 12:29:25 AM (24 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 551cb1c
- Parents:
- 634e746
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libcsupport/include/rtems/libio.h
r634e746 rdcec5a4 13 13 #ifndef _RTEMS_LIBIO_H 14 14 #define _RTEMS_LIBIO_H 15 16 #include <sys/stat.h> 15 17 16 18 typedef unsigned32 rtems_libio_offset_t; … … 89 91 void rtems_libio_init(void); 90 92 91 int __open(const char *pathname, unsigned32 flag, unsigned32 mode); 92 int __close(int fd); 93 int __read(int fd, void *buffer, unsigned32 count); 94 int __write(int fd, const void *buffer, unsigned32 count); 95 int __ioctl(int fd, unsigned32 command, void *buffer); 96 int __lseek(int fd, rtems_libio_offset_t offset, int whence); 93 int __rtems_open(const char *pathname, unsigned32 flag, unsigned32 mode); 94 int __rtems_close(int fd); 95 int __rtems_read(int fd, void *buffer, unsigned32 count); 96 int __rtems_write(int fd, const void *buffer, unsigned32 count); 97 int __rtems_ioctl(int fd, unsigned32 command, void *buffer); 98 int __rtems_lseek(int fd, rtems_libio_offset_t offset, int whence); 99 int __rtems_fstat(int _fd, struct stat* _sbuf); 100 int __rtems_isatty(int _fd); 97 101 98 102 #endif /* _RTEMS_LIBIO_H */ -
c/src/exec/libcsupport/src/libio.c
r634e746 rdcec5a4 47 47 #define rtems_libio_check_fd(fd) \ 48 48 do { \ 49 if (( fd) >= rtems_libio_number_iops) \49 if ((unsigned32) (fd) >= rtems_libio_number_iops) \ 50 50 { \ 51 51 errno = EBADF; \ … … 244 244 245 245 int 246 __ open(246 __rtems_open( 247 247 const char *pathname, 248 248 unsigned32 flag, … … 255 255 256 256 if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) { 257 /* 257 258 if ( rc == RTEMS_UNSATISFIED ) { 258 259 puts( "open -- ENOSYS case" ); 259 260 assert( 0 ); 260 261 } 262 */ 261 263 goto done; 262 264 } … … 292 294 293 295 int 294 __ close(296 __rtems_close( 295 297 int fd 296 298 ) … … 317 319 318 320 int 319 __r ead(321 __rtems_read( 320 322 int fd, 321 323 void * buffer, … … 353 355 354 356 int 355 __ write(357 __rtems_write( 356 358 int fd, 357 359 const void *buffer, … … 389 391 390 392 int 391 __ ioctl(393 __rtems_ioctl( 392 394 int fd, 393 395 unsigned32 command, … … 421 423 422 424 int 423 __ lseek(425 __rtems_lseek( 424 426 int fd, 425 427 rtems_libio_offset_t offset, -
c/src/exec/libcsupport/src/malloc.c
r634e746 rdcec5a4 38 38 39 39 #ifdef MALLOC_STATS 40 #define MSBUMP(f,n) malloc_stats.f += (n)40 #define MSBUMP(f,n) rtems_malloc_stats.f += (n) 41 41 42 42 struct { … … 49 49 unsigned64 lifetime_allocated; 50 50 unsigned64 lifetime_freed; 51 } malloc_stats;52 53 #else /* No malloc_stats */51 } rtems_malloc_stats; 52 53 #else /* No rtems_malloc_stats */ 54 54 #define MSBUMP(f,n) 55 55 #endif … … 116 116 #ifdef MALLOC_STATS 117 117 /* zero all the stats */ 118 (void) memset(& malloc_stats, 0, sizeof(malloc_stats));118 (void) memset(&rtems_malloc_stats, 0, sizeof(rtems_malloc_stats)); 119 119 #endif 120 120 … … 202 202 status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size); 203 203 MSBUMP(lifetime_allocated, actual_size); 204 current_depth = malloc_stats.lifetime_allocated -malloc_stats.lifetime_freed;205 if (current_depth > malloc_stats.max_depth)206 malloc_stats.max_depth = current_depth;204 current_depth = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; 205 if (current_depth > rtems_malloc_stats.max_depth) 206 rtems_malloc_stats.max_depth = current_depth; 207 207 } 208 208 #endif … … 315 315 void malloc_dump(void) 316 316 { 317 unsigned32 allocated = malloc_stats.lifetime_allocated -malloc_stats.lifetime_freed;317 unsigned32 allocated = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; 318 318 319 319 printf("Malloc stats\n"); 320 320 printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n", 321 (unsigned int) malloc_stats.space_available / 1024,321 (unsigned int) rtems_malloc_stats.space_available / 1024, 322 322 (unsigned int) allocated / 1024, 323 323 /* avoid float! */ 324 (allocated * 100) / malloc_stats.space_available,325 (unsigned int) malloc_stats.max_depth / 1024,326 ( malloc_stats.max_depth * 100) /malloc_stats.space_available,327 (unsigned64) malloc_stats.lifetime_allocated / 1024,328 (unsigned64) malloc_stats.lifetime_freed / 1024);324 (allocated * 100) / rtems_malloc_stats.space_available, 325 (unsigned int) rtems_malloc_stats.max_depth / 1024, 326 (rtems_malloc_stats.max_depth * 100) / rtems_malloc_stats.space_available, 327 (unsigned64) rtems_malloc_stats.lifetime_allocated / 1024, 328 (unsigned64) rtems_malloc_stats.lifetime_freed / 1024); 329 329 printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", 330 malloc_stats.malloc_calls,331 malloc_stats.free_calls,332 malloc_stats.realloc_calls,333 malloc_stats.calloc_calls);330 rtems_malloc_stats.malloc_calls, 331 rtems_malloc_stats.free_calls, 332 rtems_malloc_stats.realloc_calls, 333 rtems_malloc_stats.calloc_calls); 334 334 } 335 335 -
c/src/exec/libcsupport/src/newlibc.c
r634e746 rdcec5a4 1 #if defined(RTEMS_NEWLIB)2 1 3 2 /* … … 31 30 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 32 31 #include <rtems.h> 32 33 #if defined(RTEMS_NEWLIB) 33 34 #include <libcsupport.h> 34 35 #include <stdlib.h> /* for free() */ … … 347 348 */ 348 349 350 #include <stdio.h> 351 349 352 #if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K) 350 353 void _exit(int status) -
c/src/lib/include/rtems/libio.h
r634e746 rdcec5a4 13 13 #ifndef _RTEMS_LIBIO_H 14 14 #define _RTEMS_LIBIO_H 15 16 #include <sys/stat.h> 15 17 16 18 typedef unsigned32 rtems_libio_offset_t; … … 89 91 void rtems_libio_init(void); 90 92 91 int __open(const char *pathname, unsigned32 flag, unsigned32 mode); 92 int __close(int fd); 93 int __read(int fd, void *buffer, unsigned32 count); 94 int __write(int fd, const void *buffer, unsigned32 count); 95 int __ioctl(int fd, unsigned32 command, void *buffer); 96 int __lseek(int fd, rtems_libio_offset_t offset, int whence); 93 int __rtems_open(const char *pathname, unsigned32 flag, unsigned32 mode); 94 int __rtems_close(int fd); 95 int __rtems_read(int fd, void *buffer, unsigned32 count); 96 int __rtems_write(int fd, const void *buffer, unsigned32 count); 97 int __rtems_ioctl(int fd, unsigned32 command, void *buffer); 98 int __rtems_lseek(int fd, rtems_libio_offset_t offset, int whence); 99 int __rtems_fstat(int _fd, struct stat* _sbuf); 100 int __rtems_isatty(int _fd); 97 101 98 102 #endif /* _RTEMS_LIBIO_H */ -
c/src/lib/libc/libio.c
r634e746 rdcec5a4 47 47 #define rtems_libio_check_fd(fd) \ 48 48 do { \ 49 if (( fd) >= rtems_libio_number_iops) \49 if ((unsigned32) (fd) >= rtems_libio_number_iops) \ 50 50 { \ 51 51 errno = EBADF; \ … … 244 244 245 245 int 246 __ open(246 __rtems_open( 247 247 const char *pathname, 248 248 unsigned32 flag, … … 255 255 256 256 if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) { 257 /* 257 258 if ( rc == RTEMS_UNSATISFIED ) { 258 259 puts( "open -- ENOSYS case" ); 259 260 assert( 0 ); 260 261 } 262 */ 261 263 goto done; 262 264 } … … 292 294 293 295 int 294 __ close(296 __rtems_close( 295 297 int fd 296 298 ) … … 317 319 318 320 int 319 __r ead(321 __rtems_read( 320 322 int fd, 321 323 void * buffer, … … 353 355 354 356 int 355 __ write(357 __rtems_write( 356 358 int fd, 357 359 const void *buffer, … … 389 391 390 392 int 391 __ ioctl(393 __rtems_ioctl( 392 394 int fd, 393 395 unsigned32 command, … … 421 423 422 424 int 423 __ lseek(425 __rtems_lseek( 424 426 int fd, 425 427 rtems_libio_offset_t offset, -
c/src/lib/libc/libio.h
r634e746 rdcec5a4 13 13 #ifndef _RTEMS_LIBIO_H 14 14 #define _RTEMS_LIBIO_H 15 16 #include <sys/stat.h> 15 17 16 18 typedef unsigned32 rtems_libio_offset_t; … … 89 91 void rtems_libio_init(void); 90 92 91 int __open(const char *pathname, unsigned32 flag, unsigned32 mode); 92 int __close(int fd); 93 int __read(int fd, void *buffer, unsigned32 count); 94 int __write(int fd, const void *buffer, unsigned32 count); 95 int __ioctl(int fd, unsigned32 command, void *buffer); 96 int __lseek(int fd, rtems_libio_offset_t offset, int whence); 93 int __rtems_open(const char *pathname, unsigned32 flag, unsigned32 mode); 94 int __rtems_close(int fd); 95 int __rtems_read(int fd, void *buffer, unsigned32 count); 96 int __rtems_write(int fd, const void *buffer, unsigned32 count); 97 int __rtems_ioctl(int fd, unsigned32 command, void *buffer); 98 int __rtems_lseek(int fd, rtems_libio_offset_t offset, int whence); 99 int __rtems_fstat(int _fd, struct stat* _sbuf); 100 int __rtems_isatty(int _fd); 97 101 98 102 #endif /* _RTEMS_LIBIO_H */ -
c/src/lib/libc/malloc.c
r634e746 rdcec5a4 38 38 39 39 #ifdef MALLOC_STATS 40 #define MSBUMP(f,n) malloc_stats.f += (n)40 #define MSBUMP(f,n) rtems_malloc_stats.f += (n) 41 41 42 42 struct { … … 49 49 unsigned64 lifetime_allocated; 50 50 unsigned64 lifetime_freed; 51 } malloc_stats;52 53 #else /* No malloc_stats */51 } rtems_malloc_stats; 52 53 #else /* No rtems_malloc_stats */ 54 54 #define MSBUMP(f,n) 55 55 #endif … … 116 116 #ifdef MALLOC_STATS 117 117 /* zero all the stats */ 118 (void) memset(& malloc_stats, 0, sizeof(malloc_stats));118 (void) memset(&rtems_malloc_stats, 0, sizeof(rtems_malloc_stats)); 119 119 #endif 120 120 … … 202 202 status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size); 203 203 MSBUMP(lifetime_allocated, actual_size); 204 current_depth = malloc_stats.lifetime_allocated -malloc_stats.lifetime_freed;205 if (current_depth > malloc_stats.max_depth)206 malloc_stats.max_depth = current_depth;204 current_depth = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; 205 if (current_depth > rtems_malloc_stats.max_depth) 206 rtems_malloc_stats.max_depth = current_depth; 207 207 } 208 208 #endif … … 315 315 void malloc_dump(void) 316 316 { 317 unsigned32 allocated = malloc_stats.lifetime_allocated -malloc_stats.lifetime_freed;317 unsigned32 allocated = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; 318 318 319 319 printf("Malloc stats\n"); 320 320 printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n", 321 (unsigned int) malloc_stats.space_available / 1024,321 (unsigned int) rtems_malloc_stats.space_available / 1024, 322 322 (unsigned int) allocated / 1024, 323 323 /* avoid float! */ 324 (allocated * 100) / malloc_stats.space_available,325 (unsigned int) malloc_stats.max_depth / 1024,326 ( malloc_stats.max_depth * 100) /malloc_stats.space_available,327 (unsigned64) malloc_stats.lifetime_allocated / 1024,328 (unsigned64) malloc_stats.lifetime_freed / 1024);324 (allocated * 100) / rtems_malloc_stats.space_available, 325 (unsigned int) rtems_malloc_stats.max_depth / 1024, 326 (rtems_malloc_stats.max_depth * 100) / rtems_malloc_stats.space_available, 327 (unsigned64) rtems_malloc_stats.lifetime_allocated / 1024, 328 (unsigned64) rtems_malloc_stats.lifetime_freed / 1024); 329 329 printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", 330 malloc_stats.malloc_calls,331 malloc_stats.free_calls,332 malloc_stats.realloc_calls,333 malloc_stats.calloc_calls);330 rtems_malloc_stats.malloc_calls, 331 rtems_malloc_stats.free_calls, 332 rtems_malloc_stats.realloc_calls, 333 rtems_malloc_stats.calloc_calls); 334 334 } 335 335 -
c/src/lib/libc/newlibc.c
r634e746 rdcec5a4 1 #if defined(RTEMS_NEWLIB)2 1 3 2 /* … … 31 30 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 32 31 #include <rtems.h> 32 33 #if defined(RTEMS_NEWLIB) 33 34 #include <libcsupport.h> 34 35 #include <stdlib.h> /* for free() */ … … 347 348 */ 348 349 350 #include <stdio.h> 351 349 352 #if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K) 350 353 void _exit(int status) -
c/src/lib/libc/syscalls.c
r634e746 rdcec5a4 24 24 #include <sys/stat.h> 25 25 #include <assert.h> 26 #include <errno.h> 27 #include <string.h> 28 #include <stdio.h> /* only for puts */ 26 29 27 30 /* … … 30 33 */ 31 34 32 int __ fstat(int _fd, struct stat* _sbuf)35 int __rtems_fstat(int _fd, struct stat* _sbuf) 33 36 { 34 37 if ( _fd > 2 ) { 35 puts( "__ fstat -- only stdio supported" );38 puts( "__rtems_fstat -- only stdio supported" ); 36 39 assert( 0 ); 37 40 } … … 43 46 } 44 47 45 int __ isatty(int _fd)48 int __rtems_isatty(int _fd) 46 49 { 47 50 return 1; … … 53 56 return -1; 54 57 } 55 return __ fstat( 0, buf );58 return __rtems_fstat( 0, buf ); 56 59 } 57 60 … … 68 71 } 69 72 73 char *getcwd( char *_buf, size_t _size) { 74 /* assert( FALSE ); */ 75 errno = ENOSYS; 76 return 0; 77 } 78 int fork() { 79 puts( "fork -- not supported!!!" ); 80 assert( 0 ); 81 errno = ENOSYS; 82 return -1; 83 } 84 int execv(const char *_path, char * const _argv[] ) { 85 puts( "execv -- not supported!!!" ); 86 assert( 0 ); 87 errno = ENOSYS; 88 return -1; 89 } 90 int wait() { 91 puts( "wait -- not supported!!!" ); 92 assert( 0 ); 93 errno = ENOSYS; 94 return -1; 95 } 96 70 97 #endif -
cpukit/libcsupport/include/rtems/libio.h
r634e746 rdcec5a4 13 13 #ifndef _RTEMS_LIBIO_H 14 14 #define _RTEMS_LIBIO_H 15 16 #include <sys/stat.h> 15 17 16 18 typedef unsigned32 rtems_libio_offset_t; … … 89 91 void rtems_libio_init(void); 90 92 91 int __open(const char *pathname, unsigned32 flag, unsigned32 mode); 92 int __close(int fd); 93 int __read(int fd, void *buffer, unsigned32 count); 94 int __write(int fd, const void *buffer, unsigned32 count); 95 int __ioctl(int fd, unsigned32 command, void *buffer); 96 int __lseek(int fd, rtems_libio_offset_t offset, int whence); 93 int __rtems_open(const char *pathname, unsigned32 flag, unsigned32 mode); 94 int __rtems_close(int fd); 95 int __rtems_read(int fd, void *buffer, unsigned32 count); 96 int __rtems_write(int fd, const void *buffer, unsigned32 count); 97 int __rtems_ioctl(int fd, unsigned32 command, void *buffer); 98 int __rtems_lseek(int fd, rtems_libio_offset_t offset, int whence); 99 int __rtems_fstat(int _fd, struct stat* _sbuf); 100 int __rtems_isatty(int _fd); 97 101 98 102 #endif /* _RTEMS_LIBIO_H */ -
cpukit/libcsupport/src/libio.c
r634e746 rdcec5a4 47 47 #define rtems_libio_check_fd(fd) \ 48 48 do { \ 49 if (( fd) >= rtems_libio_number_iops) \49 if ((unsigned32) (fd) >= rtems_libio_number_iops) \ 50 50 { \ 51 51 errno = EBADF; \ … … 244 244 245 245 int 246 __ open(246 __rtems_open( 247 247 const char *pathname, 248 248 unsigned32 flag, … … 255 255 256 256 if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) { 257 /* 257 258 if ( rc == RTEMS_UNSATISFIED ) { 258 259 puts( "open -- ENOSYS case" ); 259 260 assert( 0 ); 260 261 } 262 */ 261 263 goto done; 262 264 } … … 292 294 293 295 int 294 __ close(296 __rtems_close( 295 297 int fd 296 298 ) … … 317 319 318 320 int 319 __r ead(321 __rtems_read( 320 322 int fd, 321 323 void * buffer, … … 353 355 354 356 int 355 __ write(357 __rtems_write( 356 358 int fd, 357 359 const void *buffer, … … 389 391 390 392 int 391 __ ioctl(393 __rtems_ioctl( 392 394 int fd, 393 395 unsigned32 command, … … 421 423 422 424 int 423 __ lseek(425 __rtems_lseek( 424 426 int fd, 425 427 rtems_libio_offset_t offset, -
cpukit/libcsupport/src/malloc.c
r634e746 rdcec5a4 38 38 39 39 #ifdef MALLOC_STATS 40 #define MSBUMP(f,n) malloc_stats.f += (n)40 #define MSBUMP(f,n) rtems_malloc_stats.f += (n) 41 41 42 42 struct { … … 49 49 unsigned64 lifetime_allocated; 50 50 unsigned64 lifetime_freed; 51 } malloc_stats;52 53 #else /* No malloc_stats */51 } rtems_malloc_stats; 52 53 #else /* No rtems_malloc_stats */ 54 54 #define MSBUMP(f,n) 55 55 #endif … … 116 116 #ifdef MALLOC_STATS 117 117 /* zero all the stats */ 118 (void) memset(& malloc_stats, 0, sizeof(malloc_stats));118 (void) memset(&rtems_malloc_stats, 0, sizeof(rtems_malloc_stats)); 119 119 #endif 120 120 … … 202 202 status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size); 203 203 MSBUMP(lifetime_allocated, actual_size); 204 current_depth = malloc_stats.lifetime_allocated -malloc_stats.lifetime_freed;205 if (current_depth > malloc_stats.max_depth)206 malloc_stats.max_depth = current_depth;204 current_depth = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; 205 if (current_depth > rtems_malloc_stats.max_depth) 206 rtems_malloc_stats.max_depth = current_depth; 207 207 } 208 208 #endif … … 315 315 void malloc_dump(void) 316 316 { 317 unsigned32 allocated = malloc_stats.lifetime_allocated -malloc_stats.lifetime_freed;317 unsigned32 allocated = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; 318 318 319 319 printf("Malloc stats\n"); 320 320 printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n", 321 (unsigned int) malloc_stats.space_available / 1024,321 (unsigned int) rtems_malloc_stats.space_available / 1024, 322 322 (unsigned int) allocated / 1024, 323 323 /* avoid float! */ 324 (allocated * 100) / malloc_stats.space_available,325 (unsigned int) malloc_stats.max_depth / 1024,326 ( malloc_stats.max_depth * 100) /malloc_stats.space_available,327 (unsigned64) malloc_stats.lifetime_allocated / 1024,328 (unsigned64) malloc_stats.lifetime_freed / 1024);324 (allocated * 100) / rtems_malloc_stats.space_available, 325 (unsigned int) rtems_malloc_stats.max_depth / 1024, 326 (rtems_malloc_stats.max_depth * 100) / rtems_malloc_stats.space_available, 327 (unsigned64) rtems_malloc_stats.lifetime_allocated / 1024, 328 (unsigned64) rtems_malloc_stats.lifetime_freed / 1024); 329 329 printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", 330 malloc_stats.malloc_calls,331 malloc_stats.free_calls,332 malloc_stats.realloc_calls,333 malloc_stats.calloc_calls);330 rtems_malloc_stats.malloc_calls, 331 rtems_malloc_stats.free_calls, 332 rtems_malloc_stats.realloc_calls, 333 rtems_malloc_stats.calloc_calls); 334 334 } 335 335 -
cpukit/libcsupport/src/newlibc.c
r634e746 rdcec5a4 1 #if defined(RTEMS_NEWLIB)2 1 3 2 /* … … 31 30 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 32 31 #include <rtems.h> 32 33 #if defined(RTEMS_NEWLIB) 33 34 #include <libcsupport.h> 34 35 #include <stdlib.h> /* for free() */ … … 347 348 */ 348 349 350 #include <stdio.h> 351 349 352 #if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K) 350 353 void _exit(int status)
Note: See TracChangeset
for help on using the changeset viewer.