source: rtems/c/src/lib/libc/syscalls.c @ d37ea462

4.104.114.84.95
Last change on this file since d37ea462 was d37ea462, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/98 at 17:39:38

execv*() now comes from newlib.

  • Property mode set to 100644
File size: 2.3 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 *
[60b791ad]9 *  COPYRIGHT (c) 1989-1998.
[ac7d5ef0]10 *  On-Line Applications Research Corporation (OAR).
[03f2154e]11 *  Copyright assigned to U.S. Government, 1994.
[ac7d5ef0]12 *
[98e4ebf5]13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
[03f2154e]15 *  http://www.OARcorp.com/rtems/license.html.
[ac7d5ef0]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>
[4dc0fd6]29#include <rtems/libio.h>
[41c58154]30
31#ifdef RTEMS_NEWLIB
[217e398]32
[dcec5a4]33int __rtems_fstat(int _fd, struct stat* _sbuf)
[ac7d5ef0]34{
[217e398]35#ifdef HAVE_BLKSIZE
36  _sbuf->st_blksize = 0;
37#endif
[4dc0fd6]38
39  /*
40   * For now assume stdin/stdout/stderr are always a TTY line
[866c465f]41   *
42   *  From Eric Norum:
43   *
44   *  The `fix' is not complete.  It still doesn't properly handle
45   *  file descriptors for any files/devices other  than the console
46   *  serial lines.....
[4dc0fd6]47   */
48  if (_fd <= 2) {
49    _sbuf->st_mode = S_IFCHR;
50  } else {
51    switch (rtems_file_descriptor_type (_fd)) {
[9646d5be]52    case RTEMS_FILE_DESCRIPTOR_TYPE_FILE:
53      _sbuf->st_mode = S_IFREG;
54      break;
55
[4dc0fd6]56    case RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET:
[ece79bb1]57#if !defined(__GO32__)
[4dc0fd6]58      _sbuf->st_mode = S_IFSOCK;
59      break;
[ece79bb1]60#endif
[4dc0fd6]61
62    default:
[9646d5be]63      puts( "__rtems_fstat -- unknown file descriptor type" );
[4dc0fd6]64      assert( 0 );
65    }
66  }
[217e398]67  return 0;
[ac7d5ef0]68}
69
[41c58154]70#if !defined(RTEMS_UNIX)
[ac7d5ef0]71int stat( const char *path, struct stat *buf )
72{
[331d9e3b]73  if ( strncmp( "/dev/", path, 5 ) ) {
[c6126e57]74    return -1;
[331d9e3b]75  }
[dcec5a4]76  return __rtems_fstat( 0, buf );
[ac7d5ef0]77}
78
79int link( const char *existing, const char *new )
80{
81  /* always fail */
82  return -1;
83}
84
85int unlink( const char *path )
86{
87  /* always fail */
88  return -1;
89}
90
[334b01f1]91char *getcwd( char *_buf, size_t _size)
92{
[dcec5a4]93/*  assert( FALSE ); */
94  errno = ENOSYS;
95  return 0;
96}
[725f310]97
[dcec5a4]98int fork() {
99  puts( "fork -- not supported!!!" );
100  assert( 0 );
101  errno = ENOSYS;
102  return -1;
103}
[d37ea462]104#if 0
[dcec5a4]105int execv(const char *_path, char * const _argv[] ) {
106  puts( "execv -- not supported!!!" );
107  assert( 0 );
108  errno = ENOSYS;
109  return -1;
110}
[d37ea462]111#endif
[dcec5a4]112int wait() {
113  puts( "wait -- not supported!!!" );
114  assert( 0 );
115  errno = ENOSYS;
116  return -1;
117}
[41c58154]118#endif
[dcec5a4]119
[ac7d5ef0]120#endif
Note: See TracBrowser for help on using the repository browser.