shyamjith wrote:
When u register a device with the kernel for example, a character device
U attach the device structure into the device table . which is filled with
pointers to our read and write functions .while registering a proc entry also we can fill such functional pointers .
up up and away
shyam
ok , so u mean the file_operat ions table.
See i think we are talking about kernel programming . What i mean to say is that there is only two ways to communiacte to user space . One through a registerd read or write functions & other one through proc file system .
Well, what about the code below ? i know it's not an accepted way of doing it , but it sure beats your *only* 2 ways of doing it :-) !
< kfs.c > int kopen(const char *filename,int flags) { oldmm = get_fs(); set_fs(get_ds()); kfd = sys_open(filename,flags | O_CREAT,S_IRWXU); if(kfd > 0) { printk("<1>kfd = %d \n",kfd); set_fs(oldmm); return kfd; } return kfd; }
int kwrite(int fd,char *buffer,int size) { int red; oldmm = get_fs(); set_fs(get_ds()); red = sys_write(fd,write_buffer,size); if(red > 0) { printk("<1>write buffer = %s \n",write_buffer); set_fs(oldmm); return red; } }
i had written this code sometime ago and it did work !
cheers, Amith
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/