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 03/10/97 at 19:38:06

made some of this conditional on unix lib

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[ac7d5ef0]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>
[331d9e3b]23#include <assert.h>
[dcec5a4]24#include <errno.h>
25#include <string.h>
26#include <stdio.h>  /* only for puts */
[ac7d5ef0]27
[41c58154]28#include <rtems.h>
29
30#ifdef RTEMS_NEWLIB
[217e398]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
[dcec5a4]36int __rtems_fstat(int _fd, struct stat* _sbuf)
[ac7d5ef0]37{
[331d9e3b]38  if ( _fd > 2 ) {
[dcec5a4]39    puts( "__rtems_fstat -- only stdio supported" );
[331d9e3b]40    assert( 0 );
41  }
[217e398]42  _sbuf->st_mode = S_IFCHR;
43#ifdef HAVE_BLKSIZE
44  _sbuf->st_blksize = 0;
45#endif
46  return 0;
[ac7d5ef0]47}
48
[dcec5a4]49int __rtems_isatty(int _fd)
[ac7d5ef0]50{
51  return 1;
52}
53
[41c58154]54#if !defined(RTEMS_UNIX)
[ac7d5ef0]55int stat( const char *path, struct stat *buf )
56{
[331d9e3b]57  if ( strncmp( "/dev/", path, 5 ) ) {
[c6126e57]58    return -1;
[331d9e3b]59  }
[dcec5a4]60  return __rtems_fstat( 0, buf );
[ac7d5ef0]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
[dcec5a4]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}
[41c58154]98#endif
[dcec5a4]99
[ac7d5ef0]100#endif
Note: See TracBrowser for help on using the repository browser.