source: rtems/c/src/lib/libc/libio.h @ b1b5a7cb

4.104.114.84.95
Last change on this file since b1b5a7cb was 1f94ed6b, checked in by Joel Sherrill <joel.sherrill@…>, on 04/22/96 at 16:50:17

Updates from Tony Bennett.

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