source: rtems/c/src/lib/libc/newlibif.c @ 98e4ebf5

4.104.114.84.95
Last change on this file since 98e4ebf5 was b1459dc, checked in by Joel Sherrill <joel.sherrill@…>, on 08/22/97 at 19:17:09

Moved reentrant wrappers into their own file.

  • Property mode set to 100644
File size: 1.9 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 * isatty -- returns 1 if connected to a terminal device,
58 *           returns 0 if not.
59 */
60int
61isatty(int fd)
62{
63    return __rtems_isatty(fd);
64}
65
66/*
67 * lseek -- move read/write pointer. Since a serial port
68 *          is non-seekable, we return an error.
69 */
70off_t
71lseek(int fd,
72      off_t offset,
73      int whence)
74{
75    return __rtems_lseek(fd, offset, whence);
76}
77
78/*
79 * fstat -- get status of a file. Since we have no file
80 *          system, we just return an error.
81 */
82int
83fstat(int fd,
84      struct stat *buf)
85{
86    return __rtems_fstat(fd, buf);
87}
88
89/*
90 *  getpid and kill are provided directly by rtems
91 */
92
93/*
94 * ioctl -- IO control
95 */
96
97int
98ioctl(int fd, int request, void *argp)
99{
100    return __rtems_ioctl(fd,request,argp);
101}
102
103/*
104 * tcgetattr/tcsetattr -- get/set attributes of a device.
105 *
106 * by K.Shibuya
107 */
108
109int
110tcgetattr(int fd, struct termios *tp)
111{
112    return __rtems_ioctl(fd,RTEMS_IO_GET_ATTRIBUTES,tp);
113}
114
115int
116tcsetattr(int fd, int opt, struct termios *tp)
117{
118    if(opt != TCSANOW)
119      return -1;
120    return __rtems_ioctl(fd,RTEMS_IO_SET_ATTRIBUTES,tp);
121}
122
123#endif
Note: See TracBrowser for help on using the repository browser.