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

4.104.114.84.95
Last change on this file since b82c957 was b82c957, checked in by Joel Sherrill <joel.sherrill@…>, on 04/03/98 at 18:45:42

Removed isatty() since we are now using newlib's implementation as
a result of enabling the newlib POSIX directory.

  • Property mode set to 100644
File size: 2.5 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/*
33 *  fstat, stat, and isatty must lie consistently and report that everything
34 *  is a tty or stdout will not be line buffered.
35 */
36
37int __rtems_fstat(int _fd, struct stat* _sbuf)
38{
39#ifdef HAVE_BLKSIZE
40  _sbuf->st_blksize = 0;
41#endif
42
43  /*
44   * For now assume stdin/stdout/stderr are always a TTY line
45   *
46   *  From Eric Norum:
47   *
48   *  The `fix' is not complete.  It still doesn't properly handle
49   *  file descriptors for any files/devices other  than the console
50   *  serial lines.....
51   */
52  if (_fd <= 2) {
53    _sbuf->st_mode = S_IFCHR;
54  } else {
55    switch (rtems_file_descriptor_type (_fd)) {
56    case RTEMS_FILE_DESCRIPTOR_TYPE_FILE:
57      _sbuf->st_mode = S_IFREG;
58      break;
59
60    case RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET:
61#if !defined(__GO32__)
62      _sbuf->st_mode = S_IFSOCK;
63      break;
64#endif
65
66    default:
67      puts( "__rtems_fstat -- unknown file descriptor type" );
68      assert( 0 );
69    }
70  }
71  return 0;
72}
73
74#if !defined(RTEMS_UNIX)
75int stat( const char *path, struct stat *buf )
76{
77  if ( strncmp( "/dev/", path, 5 ) ) {
78    return -1;
79  }
80  return __rtems_fstat( 0, buf );
81}
82
83int link( const char *existing, const char *new )
84{
85  /* always fail */
86  return -1;
87}
88
89int unlink( const char *path )
90{
91  /* always fail */
92  return -1;
93}
94
95char *getcwd( char *_buf, size_t _size)
96{
97/*  assert( FALSE ); */
98  errno = ENOSYS;
99  return 0;
100}
101
102int fork() {
103  puts( "fork -- not supported!!!" );
104  assert( 0 );
105  errno = ENOSYS;
106  return -1;
107}
108int execv(const char *_path, char * const _argv[] ) {
109  puts( "execv -- not supported!!!" );
110  assert( 0 );
111  errno = ENOSYS;
112  return -1;
113}
114int wait() {
115  puts( "wait -- not supported!!!" );
116  assert( 0 );
117  errno = ENOSYS;
118  return -1;
119}
120#endif
121
122#endif
Note: See TracBrowser for help on using the repository browser.