On Tue, Jul 5, 2011 at 9:33 PM, Greg Freemyer <greg.freemyer@xxxxxxxxx> wrote: > On Tue, Jul 5, 2011 at 9:43 AM, Mandeep Sandhu > <mandeepsandhu.chd@xxxxxxxxx> wrote: >>> Let me simplify the question. >> >> I'll attempt to answer your questions...for my own edification! :) >> >>> >>> 1) What are the FIVE classic system calls for interfacing with a >>> character device. (ie. If it did not exist in 1970, don't list it). >> >> open/close/read/write/seek?...and the infamous ioctl. > > You listed 6. Historically character devices don't seek. So drop > that one to get to 5. > > (And yes, you can find char devices that implement seek, but ioctl is > far more common. And when I learned UNIX 30 years ago, it was just > the basic 5 I'm pretty sure that actually have matching driver code..) > > That is, drivers don't implement seek. seek() just sets a offset > variable tracked in the kernel. The driver is not even woken up when > the happens. > > That is if userspace did: > > open() > seek(1) > seek(2) > seek(3) > write() > > The driver would get invoked for open, and again for write. The thing which he wanted to go in depth was why and how will the drivers open() ,write() get invoked. I tried my attempt that depending upon vendor and device id register_chrdev will have registered etc. My guess is he probably wanted to know the system call routine that will get executed with these open and close in kernel space. i.e. for example __NR_open() ,__NR_read() and the system call numbers that would get involved in this process. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies