The HyperNews Linux KHG Discussion Pages

driver x_open,x_release work, x_ioctl,x_write don't

Forum: The Linux Kernel Hackers' Guide
Date: Tue, 31 Mar 1998 19:41:58 GMT
From: Carl Schwartz <>

Using RedHat 5.0 and following KHG I performed the following steps in developing a driver 'x':
1) created x.o with gcc -O -DMODULE -D__KERNEL__
2) created /dev/x crw-r--r-- 126 0
3) insmod ./x.o
4) lsmod listed it but ksyms did not
5) user root: fildef = open('/dev.x',O_RDWR);  (fildef = 17)
6) user root:ioctl(fildef,_IOW(126,1,sizeof(daud)),(int)&daud) 
     returns -1 as well as does all other ioctl's and write's 
     I try from user app and do not print "printk's".

7) rmmod removes it OK.  It seems that 'open' and 'release' 
     are the only functions that work (perform as expected and 
     "printk's" work).

I copied device file_operations, ioctl and write parameter lists from KHG, basically replacing 'foo' with 'x'.

I copied 'x.o' to /lib/modules/2.0.31/char and added 'alias char-major-126 x' to conf.module. Depmod -a does not add it to modules.dep and Modprobe doesn't know that 'x' exists.


1. Question: Depmod Unresolved symbols? by Carl Schwartz newest