#include <linux/types.h> in the user space program. AFAIK that should solve the problem. Bhanu. On 7/27/05, Vincenzo Mallozzi <vinjunior@xxxxxxxx> wrote: > Hi all, > I've some problems with the implementation of the ioctl in kernel module I'm > developing. > I've create three files: > > 1) the header "device.h ": > > #define MTPMC_IOC_MAGIC 254 > #define MTPMC_IOC_WRITE_USER_PID _IOW(MTPMC_IOC_MAGIC, 0, pid_t) > #define MTPMC_IOC_WRITE_THREAD_PID _IOW(MTPMC_IOC_MAGIC, 1, pid_t) > #define MTPMC_IOC_READ_INITIALIZE _IOR(MTPMC_IOC_MAGIC, 2, int) > #define MTPMC_IOC_READ_NUM_THREAD _IOR(MTPMC_IOC_MAGIC, 3, int) > #define MTPMC_IOC_RESTORE_NOT_WRITABLE _IO(MTPMC_IOC_MAGIC, 4) > #define MTPMC_IOC_RESTORE_WRITABLE _IO(MTPMC_IOC_MAGIC, 5) > #define MTPMC_IOC_TIMER_FUNCTION _IOW(MTPMC_IOC_MAGIC, 6, int) > > #define MTPMC_IOC_MAXNR 7 > > 2) the kernel-space driver "device.c" which includes the header and implements > a switch as follows: > > switch(cmd){ > case MTPMC_IOC_WRITE_USER_PID: /* nr == 1 */ > mtpmc_user = arg; > break; > > case MTPMC_IOC_WRITE_THREAD_PID: /* nr == 2 */ > mtpmc_pid = arg; > break; > > case MTPMC_IOC_READ_INITIALIZE: /* nr == 3 */ > return mtpmc_initialize(); > } > > 3) the user-space file "user.c" which includes the header and calls ioctl in > this way: > > ioctl(fd, MTPMC_IOC_WRITE_USER_PID, getpid()); / > ioctl(fd, MTPMC_IOC_WRITE_THREAD_PID, thread_pid); > r = ioctl(fd, MTPMC_IOC_READ_INITIALIZE); > > > Now! When I compile device.c things go well but when I try to compile the > user-space programm with the command > > gcc -g -o user user.c > > occurre the errors: > > user.c:51: error: parse error before "pid_t" > user.c:52: error: parse error before "pid_t" > user.c:53: error: parse error before "int" > > Where I'm wrong? > Thanks. > Vincenzo Mallozzi > > > ___________________________________ > Yahoo! Messenger: chiamate gratuite in tutto il mondo > http://it.beta.messenger.yahoo.com > > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- The difference between Theory and Practice is more so in Practice than in Theory. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/