PR1245 device lseek
Victor.Vengerov at oktetlabs.ru
Tue Aug 7 19:38:57 CDT 2007
IMHO, ideally, another set of handlers should be used for sockets and pipes.
Regarding ttys - I propose to consider wider class of sequential
devices, which didn't supports lseek by their nature. It may be
real-time clock devices with ioctl-only interface, I2C devices etc. IMHO
we have two options:
1. Allow device open handler re-define rtems_filesystem_file_handlers_r
ops for iop. During file name evaluation, imfs code assign
IMFS_device_handlers to tty device and invoke device specific open
handler (am I right?) tty device open override iop->handlers to tty
handlers ops, with lseek returning EISPIPE.
2. Add LIBIO_FLAGS_SEQ flag for iop->flags and set this flag in device
open handler. device_lseek will test flag and returns EISPIPE if it is set.
2nd is little bit simpler to implement, but new flag addition is not
What do you think?
Joel Sherrill wrote:
> Victor Vengerov wrote:
>> Hard disk etc. represented in RTEMS device driver with
>> open/close/read/write/control interface. rtems_libio_rw_args_t
>> argument is passed to device read/write primitives, which contains the
>> offset attribute. offset filled in device_write (deviceio.c) from
>> May be I've missed something, but it looks for me you just need to
>> adjust iop->offset in device_lseek in accordance to offset and whence
> Where would we return EISPIPE for tty's, sockets, and eventually pipes?
> I think this is all just a very small oversight and we just have to
> drop a few lines of code in.
>> Joel Sherrill wrote:
>>> This PR notes that device_lseek() always succeeds but
>>> does nothing. According to OpenGroup
>>> lseek() should return ESPIPE for ttys, sockets, and pipes.
>>> I may be having a brain freeze, but right now, I don't
>>> see how to implement a seek on a block device like
>>> a hard disk. I know you have to be able to do it.
>>> Any thoughts?
>>> rtems-users mailing list
>>> rtems-users at rtems.com
> rtems-users mailing list
> rtems-users at rtems.com
OKTET Labs, St.-Petersburg, Russia Web: www.oktetlabs.ru
Phone +7 812 4286709(office) +7 921 9389372(mobile) +7 812 4281653(home)
More information about the rtems-users