source: rtems/c/src/lib/include/rtems/libio.h @ b06e68ef

4.104.114.84.95
Last change on this file since b06e68ef was b06e68ef, checked in by Joel Sherrill <joel.sherrill@…>, on 08/17/95 at 19:51:51

Numerous miscellaneous features incorporated from Tony Bennett
(tbennett@…) including the following major additions:

+ variable length messages
+ named devices
+ debug monitor
+ association tables/variables

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *      @(#)libio.h     1.1 - 95/06/02
3 *     
4 *
5 * General purpose communication channel for RTEMS to allow UNIX/POSIX
6 *    system call behavior on top of RTEMS IO devices.
7 *
8 * TODO
9 *      stat(2)
10 *      unlink(2)
11 *      rename(2)
12 *
13 *  $Id$
14 */
15
16#ifndef _RTEMS_LIBIO_H
17#define _RTEMS_LIBIO_H
18
19typedef unsigned32 rtems_libio_offset_t;
20
21/*
22 * An open file data structure, indexed by 'fd'
23 * TODO:
24 *    should really have a separate per/file data structure that this
25 *    points to (eg: size, offset, driver, pathname should be in that)
26 */
27
28typedef struct {
29    rtems_driver_name_t *driver;
30    rtems_libio_offset_t size;          /* size of file */
31    rtems_libio_offset_t offset;        /* current offset into the file */
32    unsigned32           flags;
33    char                *pathname;      /* opened pathname */
34    Objects_Id           sem;
35    unsigned32           data0;         /* private to "driver" */
36    unsigned32           data1;         /* ... */
37} rtems_libio_t;
38
39
40/*
41 * param block for read/write
42 * Note: it must include 'offset' instead of using iop's offset since
43 *       we can have multiple outstanding i/o's on a device.
44 */
45
46typedef struct {
47    rtems_libio_t          *iop;
48    rtems_libio_offset_t    offset;
49    unsigned8              *buffer;
50    unsigned32              count;
51    unsigned32              flags;
52    unsigned32              bytes_moved;
53} rtems_libio_rw_args_t;
54
55/*
56 * param block for open/close
57 */
58
59typedef struct {
60    rtems_libio_t          *iop;
61    unsigned32              flags;
62    unsigned32              mode;
63} rtems_libio_open_close_args_t;
64
65/*
66 * param block for ioctl
67 */
68
69typedef struct {
70    rtems_libio_t          *iop;
71    unsigned32              command;
72    void                   *buffer;
73    unsigned32              ioctl_return;
74} rtems_libio_ioctl_args_t;
75
76
77/*
78 * Values for 'flag'
79 */
80
81#define LIBIO_FLAGS_NO_DELAY      0x0001  /* return immediately if no data */
82#define LIBIO_FLAGS_READ          0x0002  /* reading */
83#define LIBIO_FLAGS_WRITE         0x0004  /* writing */
84#define LIBIO_FLAGS_LINE_BUFFERED 0x0008  /* line buffered io (^h, ^u, etc) */
85#define LIBIO_FLAGS_OPEN          0x0100  /* device is open */
86#define LIBIO_FLAGS_APPEND        0x0200  /* all writes append */
87#define LIBIO_FLAGS_CREATE        0x0400  /* create file */
88
89#define LIBIO_FLAGS_READ_WRITE    (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
90
91void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds);
92void rtems_libio_init(void);
93
94int __open(const char  *pathname, unsigned32 flag, unsigned32 mode);
95int __close(int  fd);
96int __read(int fd, void *buffer, unsigned32 count);
97int __write(int fd, const void *buffer, unsigned32 count);
98int __ioctl(int fd, unsigned32  command, void *buffer);
99int __lseek(int fd, rtems_libio_offset_t offset, int whence);
100
101#endif /* _RTEMS_LIBIO_H */
Note: See TracBrowser for help on using the repository browser.