cdev.c (48212) | cdev.c (48275) |
---|---|
1/* 08 Nov 1998*/ 2/* 3 * cdev.c 4 * 5 * 08 Nov 1998 Rajesh Vaidheeswarran 6 * 7 * Copyright (c) 1998 Rajesh Vaidheeswarran 8 * All rights reserved. --- 54 unchanged lines hidden (view full) --- 63 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 64 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 65 * SUCH DAMAGE. 66 * 67 */ 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/ioccom.h> | 1/* 08 Nov 1998*/ 2/* 3 * cdev.c 4 * 5 * 08 Nov 1998 Rajesh Vaidheeswarran 6 * 7 * Copyright (c) 1998 Rajesh Vaidheeswarran 8 * All rights reserved. --- 54 unchanged lines hidden (view full) --- 63 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 64 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 65 * SUCH DAMAGE. 66 * 67 */ 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/ioccom.h> |
71#include <sys/systm.h> 72#include <sys/conf.h> 73 |
|
71#include "cdev.h" 72 73/* 74 * This is the actual code for the system call... it can't be static because 75 * it is exported to another part of the module... the only place it needs 76 * to be referenced is the sysent we are interested in. 77 * 78 * To write your own system call using this as a template, you could strip --- 25 unchanged lines hidden (view full) --- 104} 105 106int 107mydev_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc *procp) 108{ 109 int error = 0; 110 111 printf("mydev_ioctl: dev_t=%d, cmd=%lx, arg=%p, mode=%x procp=%p\n", | 74#include "cdev.h" 75 76/* 77 * This is the actual code for the system call... it can't be static because 78 * it is exported to another part of the module... the only place it needs 79 * to be referenced is the sysent we are interested in. 80 * 81 * To write your own system call using this as a template, you could strip --- 25 unchanged lines hidden (view full) --- 107} 108 109int 110mydev_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc *procp) 111{ 112 int error = 0; 113 114 printf("mydev_ioctl: dev_t=%d, cmd=%lx, arg=%p, mode=%x procp=%p\n", |
112 dev, cmd, arg, mode, procp); | 115 dev2udev(dev), cmd, arg, mode, procp); |
113 114 switch(cmd) { 115 case CDEV_IOCTL1: 116 printf("you called mydev_ioctl CDEV_IOCTL1\n"); 117 break; 118 default: 119 printf("No such ioctl for me!\n"); 120 error = EINVAL; 121 break; 122 } 123 return error; 124} | 116 117 switch(cmd) { 118 case CDEV_IOCTL1: 119 printf("you called mydev_ioctl CDEV_IOCTL1\n"); 120 break; 121 default: 122 printf("No such ioctl for me!\n"); 123 error = EINVAL; 124 break; 125 } 126 return error; 127} |