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

4.104.114.84.95
Last change on this file since d2018142 was d2018142, checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/98 at 17:23:28

Removed fork(), execv(), and wait() since they are now stubbed in the
POSIX API.

  • 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-1998.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright assigned to U.S. Government, 1994.
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.OARcorp.com/rtems/license.html.
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#include <rtems/libio.h>
30
31#ifdef RTEMS_NEWLIB
32
33int __rtems_fstat(int _fd, struct stat* _sbuf)
34{
35#ifdef HAVE_BLKSIZE
36  _sbuf->st_blksize = 0;
37#endif
38
39  /*
40   * For now assume stdin/stdout/stderr are always a TTY line
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.....
47   */
48  if (_fd <= 2) {
49    _sbuf->st_mode = S_IFCHR;
50  } else {
51    switch (rtems_file_descriptor_type (_fd)) {
52    case RTEMS_FILE_DESCRIPTOR_TYPE_FILE:
53      _sbuf->st_mode = S_IFREG;
54      break;
55
56    case RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET:
57#if !defined(__GO32__)
58      _sbuf->st_mode = S_IFSOCK;
59      break;
60#endif
61
62    default:
63      puts( "__rtems_fstat -- unknown file descriptor type" );
64      assert( 0 );
65    }
66  }
67  return 0;
68}
69
70#if !defined(RTEMS_UNIX)
71int stat( const char *path, struct stat *buf )
72{
73  if ( strncmp( "/dev/", path, 5 ) ) {
74    return -1;
75  }
76  return __rtems_fstat( 0, buf );
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
91char *getcwd( char *_buf, size_t _size)
92{
93/*  assert( FALSE ); */
94  errno = ENOSYS;
95  return 0;
96}
97#endif
98
99#endif
Note: See TracBrowser for help on using the repository browser.