source: rtems/c/src/lib/libc/newlibif.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: 1.8 KB
Line 
1
2/*
3 *  This file contains the glue which maps newlib system calls onto their
4 *  RTEMS implementations.  This formerly was in the file
5 *  libgloss/rtems/iface.c which was installed as rtems.o.  Merging this
6 *  into the RTEMS source tree minimizes the files which must be linked
7 *  to build an rtems application.
8 *
9 *  $Id$
10 *
11 */
12
13#include <rtems.h>
14#if defined(RTEMS_NEWLIB)
15
16#include <sys/types.h>
17#include <sys/stat.h>
18#include <errno.h>
19#include <reent.h>
20
21#include <termios.h>
22
23#include "internal.h"
24#include "libio.h"
25
26int
27read(int fd,
28     char *buf,
29     int nbytes)
30{
31    return __rtems_read(fd, buf, nbytes);
32}
33
34int
35write(int fd,
36      char *buf,
37      int nbytes)
38{
39    return __rtems_write(fd, buf, nbytes);
40}
41
42int
43open(char *buf,
44     int flags,
45     int mode)
46{
47    return __rtems_open(buf, flags, mode);
48}
49
50int
51close(int fd)
52{
53    return __rtems_close(fd);
54}
55
56/*
57 * lseek -- move read/write pointer. Since a serial port
58 *          is non-seekable, we return an error.
59 */
60off_t
61lseek(int fd,
62      off_t offset,
63      int whence)
64{
65    return __rtems_lseek(fd, offset, whence);
66}
67
68/*
69 * fstat -- get status of a file. Since we have no file
70 *          system, we just return an error.
71 */
72int
73fstat(int fd,
74      struct stat *buf)
75{
76    return __rtems_fstat(fd, buf);
77}
78
79/*
80 *  getpid and kill are provided directly by rtems
81 */
82
83/*
84 * ioctl -- IO control
85 */
86
87int
88ioctl(int fd, int request, void *argp)
89{
90    return __rtems_ioctl(fd,request,argp);
91}
92
93/*
94 * tcgetattr/tcsetattr -- get/set attributes of a device.
95 *
96 * by K.Shibuya
97 */
98
99int
100tcgetattr(int fd, struct termios *tp)
101{
102    return __rtems_ioctl(fd,RTEMS_IO_GET_ATTRIBUTES,tp);
103}
104
105int
106tcsetattr(int fd, int opt, struct termios *tp)
107{
108    if(opt != TCSANOW)
109      return -1;
110    return __rtems_ioctl(fd,RTEMS_IO_SET_ATTRIBUTES,tp);
111}
112
113#endif
Note: See TracBrowser for help on using the repository browser.