source: rtems/c/src/lib/libc/syscalls.c @ 217e398

4.104.114.84.95
Last change on this file since 217e398 was 217e398, checked in by Joel Sherrill <joel.sherrill@…>, on 01/17/96 at 20:13:01

Modified fstat and stat to be consistent with isatty in that all three
now pretend that everything is a tty. This insures that newlib makes
the console output line buffered.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#if !defined(RTEMS_UNIX)
2
3/*
4 *  RTEMS Fake System Calls
5 *
6 *  This file contains "fake" versions of the system call routines
7 *  which are reference by many libc implementations.  Once a routine
8 *  has been implemented in terms of RTEMS services, it should be
9 *  taken out of this file.
10 *
11 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
12 *  On-Line Applications Research Corporation (OAR).
13 *  All rights assigned to U.S. Government, 1994.
14 *
15 *  This material may be reproduced by or for the U.S. Government pursuant
16 *  to the copyright license under the clause at DFARS 252.227-7013.  This
17 *  notice must appear in all copies of this file and its derivatives.
18 *
19 *  $Id$
20 *
21 */
22
23#include <sys/types.h>
24#include <sys/stat.h>
25
26/*
27 *  check this newlib bug?:
28 *
29 *  newlib/libc/stdio/makebuf.c:
30 *
31 *  2nd ifdef uses 1024 instead of BUFSIZ
32 *  2nd check lets fp blksize be 0
33 *  finally look at the malloc
34 */
35
36/*
37 *  fstat, stat, and isatty must lie consistently and report that everything
38 *  is a tty or stdout will not be line buffered.
39 */
40
41int __fstat(int _fd, struct stat* _sbuf)
42{
43  _sbuf->st_mode = S_IFCHR;
44#ifdef HAVE_BLKSIZE
45  _sbuf->st_blksize = 0;
46#endif
47  return 0;
48}
49
50int __isatty(int _fd)
51{
52  return 1;
53}
54
55int stat( const char *path, struct stat *buf )
56{
57  return __fstat( 0, buf );
58}
59
60int link( const char *existing, const char *new )
61{
62  /* always fail */
63  return -1;
64}
65
66int unlink( const char *path )
67{
68  /* always fail */
69  return -1;
70}
71
72#endif
Note: See TracBrowser for help on using the repository browser.