|
|
1.1 ! root 1: /* device server routines for oskit stream devices. ! 2: ! 3: This is a very simple version really not fit for general use at all. It ! 4: blocks the thread making sending the device RPC *request* until the read ! 5: or write completes. This is only fit for kernel debugging when the ! 6: "real" minimal console code is not available. (I ain't written it yet!) ! 7: */ ! 8: ! 9: #include "ds_oskit.h" ! 10: ! 11: ! 12: /* In keeping with Mach's old chario behavior, we just ignore RECNUM. */ ! 13: ! 14: io_return_t ! 15: ds_stream_write_inband (device_t dev, ipc_port_t reply_port, ! 16: mach_msg_type_name_t reply_port_type, dev_mode_t mode, ! 17: recnum_t recnum, io_buf_ptr_t data, unsigned int count, ! 18: int *bytes_written) ! 19: { ! 20: oskit_error_t rc; ! 21: ! 22: *bytes_written = count; /* oskit console is buggy */ ! 23: rc = oskit_stream_write (dev->com.stream.io, data, count, bytes_written); ! 24: ! 25: return oskit_to_mach_error (rc); ! 26: } ! 27: ! 28: io_return_t ! 29: ds_stream_read_inband (device_t dev, ipc_port_t reply_port, ! 30: mach_msg_type_name_t reply_port_type, dev_mode_t mode, ! 31: recnum_t recnum, int count, char *data, ! 32: unsigned *bytes_read) ! 33: { ! 34: oskit_error_t rc; ! 35: ! 36: if (count == 0) ! 37: { ! 38: *bytes_read = 0; ! 39: return D_SUCCESS; ! 40: } ! 41: ! 42: /* XXX bad blocking behavior: user thread doing read_request_inband blocks ! 43: */ ! 44: ! 45: rc = oskit_stream_read (dev->com.stream.io, data, count, bytes_read); ! 46: return oskit_to_mach_error (rc); ! 47: } ! 48: ! 49: const struct device_ops stream_device_ops = ! 50: { ! 51: write_inband: ds_stream_write_inband, read_inband: ds_stream_read_inband ! 52: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.