source: rtems/c/src/lib/libc/syscalls.c @ 41c58154

4.104.114.84.95
Last change on this file since 41c58154 was 41c58154, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 10, 1997 at 7:38:06 PM

made some of this conditional on unix lib

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  RTEMS Fake System Calls
3 *
4 *  This file contains "fake" versions of the system call routines
5 *  which are reference by many libc implementations.  Once a routine
6 *  has been implemented in terms of RTEMS services, it should be
7 *  taken out of this file.
8 *
9 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
10 *  On-Line Applications Research Corporation (OAR).
11 *  All rights assigned to U.S. Government, 1994.
12 *
13 *  This material may be reproduced by or for the U.S. Government pursuant
14 *  to the copyright license under the clause at DFARS 252.227-7013.  This
15 *  notice must appear in all copies of this file and its derivatives.
16 *
17 *  $Id$
18 *
19 */
20
21#include <sys/types.h>
22#include <sys/stat.h>
23#include <assert.h>
24#include <errno.h>
25#include <string.h>
26#include <stdio.h>  /* only for puts */
27
28#include <rtems.h>
29
30#ifdef RTEMS_NEWLIB
31/*
32 *  fstat, stat, and isatty must lie consistently and report that everything
33 *  is a tty or stdout will not be line buffered.
34 */
35
36int __rtems_fstat(int _fd, struct stat* _sbuf)
37{
38  if ( _fd > 2 ) {
39    puts( "__rtems_fstat -- only stdio supported" );
40    assert( 0 );
41  }
42  _sbuf->st_mode = S_IFCHR;
43#ifdef HAVE_BLKSIZE
44  _sbuf->st_blksize = 0;
45#endif
46  return 0;
47}
48
49int __rtems_isatty(int _fd)
50{
51  return 1;
52}
53
54#if !defined(RTEMS_UNIX)
55int stat( const char *path, struct stat *buf )
56{
57  if ( strncmp( "/dev/", path, 5 ) ) {
58    return -1;
59  }
60  return __rtems_fstat( 0, buf );
61}
62
63int link( const char *existing, const char *new )
64{
65  /* always fail */
66  return -1;
67}
68
69int unlink( const char *path )
70{
71  /* always fail */
72  return -1;
73}
74
75char *getcwd( char *_buf, size_t _size) {
76/*  assert( FALSE ); */
77  errno = ENOSYS;
78  return 0;
79}
80int fork() {
81  puts( "fork -- not supported!!!" );
82  assert( 0 );
83  errno = ENOSYS;
84  return -1;
85}
86int execv(const char *_path, char * const _argv[] ) {
87  puts( "execv -- not supported!!!" ); 
88  assert( 0 );
89  errno = ENOSYS;
90  return -1;
91}
92int wait() {
93  puts( "wait -- not supported!!!" );
94  assert( 0 );
95  errno = ENOSYS;
96  return -1;
97}
98#endif
99
100#endif
Note: See TracBrowser for help on using the repository browser.