source: rtems/c/src/lib/libc/newlibif.c @ 1f581ec

4.104.114.84.95
Last change on this file since 1f581ec was 1f581ec, checked in by Joel Sherrill <joel.sherrill@…>, on 08/01/97 at 20:57:21

Added include of termios.h which was accidentally left out.

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[dcec5a4]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
[1f581ec]20#include <termios.h>
21
[dcec5a4]22#include "internal.h"
23#include "libio.h"
24
25int
26read(int fd,
27     char *buf,
28     int nbytes)
29{
30    return __rtems_read(fd, buf, nbytes);
31}
32
33int
34write(int fd,
35      char *buf,
36      int nbytes)
37{
38    return __rtems_write(fd, buf, nbytes);
39}
40
41int
42open(char *buf,
43     int flags,
44     int mode)
45{
46    return __rtems_open(buf, flags, mode);
47}
48
49int
50close(int fd)
51{
52    return __rtems_close(fd);
53}
54
55/*
56 * isatty -- returns 1 if connected to a terminal device,
57 *           returns 0 if not.
58 */
59int
60isatty(int fd)
61{
62    return __rtems_isatty(fd);
63}
64
65/*
66 * lseek -- move read/write pointer. Since a serial port
67 *          is non-seekable, we return an error.
68 */
69off_t
70lseek(int fd,
71      off_t offset,
72      int whence)
73{
74    return __rtems_lseek(fd, offset, whence);
75}
76
77/*
78 * fstat -- get status of a file. Since we have no file
79 *          system, we just return an error.
80 */
81int
82fstat(int fd,
83      struct stat *buf)
84{
85    return __rtems_fstat(fd, buf);
86}
87
88/*
89 *  getpid and kill are provided directly by rtems
90 */
91
[9deb5b8b]92/*
93 * ioctl -- IO control
94 */
95
96int
97ioctl(int fd, int request, void *argp)
98{
99    return __rtems_ioctl(fd,request,argp);
100}
101
102/*
103 * tcgetattr/tcsetattr -- get/set attributes of a device.
104 *
105 * by K.Shibuya
106 */
107
108int
109tcgetattr(int fd, struct termios *tp)
110{
111    return __rtems_ioctl(fd,RTEMS_IO_GET_ATTRIBUTES,tp);
112}
113
114int
115tcsetattr(int fd, int opt, struct termios *tp)
116{
117    if(opt != TCSANOW)
118      return -1;
119    return __rtems_ioctl(fd,RTEMS_IO_SET_ATTRIBUTES,tp);
120}
121
[dcec5a4]122#endif
Note: See TracBrowser for help on using the repository browser.