Hi Advan, I think the problem is that you don't have a device driver behind the node you made using mknod. That 'node' you made is the connection between your application and an underlying kernel device.
Read http://lwn.net/Kernel/LDD3/ for a 2.6 kernel or http://www.xml.com/ldd/chapter/book/ for a 2.4 kernel. Mark Phillips Automated Test Systems On Tue, 2007-07-31 at 12:05 +0800, advan wrote: > David, > you're right , get an error as below: > > open failed > :No such device > > but in fact the '/dev/igwate' is only a pseudo driver , then I also > need it , can you help me solve it? frankly I only understand less > mknod usage (major ,minor number ). thank you very much . > > advan > > > ______________________________________________________________________ > advan > 2007-07-31 > > ______________________________________________________________________ > 发件人: David McCullough > 发送时间: 2007-07-31 10:59:06 > 收件人: uClinux development list > 抄送: > 主题: (瑞星提示-此邮件可能是垃圾邮件)Re: [uClinux-dev] mknod problem > > Jivin advan lays it down ... > > hi,anybody, > > I make a character special file device under /dev/ , then I invoke 'open' > > fanction to open this special file ,but every time I can get open error(-1 > > value ): > > If you get an error you need to print errno, or strerror(errno). > It will tell you why it is failing. > > > > process : > > #mknod /dev/igwate c 127 0 > > #./test /dev/igwate > > open error ,return value[-1] > > #./test /dev/console > > open ok,return value[3] > > > > test.c file : > > > > #include <sys/types.h > > > #include <sys/stat.h > > > #include <fcntl.h > > > #include <stdlib.h > > > #include <stdio.h > > > > > int main(int argc,char* argv[]) > > { > > int fp; > > if ( argc < 2 ) > > { > > printf("please input parameter\n"); > > return 0; > > } > > if( (fp = open(argv[1],O_RDONLY)) < 0 ) > > printf("open error,return value[%d]\n"); > > perror("open failed"); > > > else > > { > > printf("open ok,return value[%d]\n"); > > printf("open ok,return value[%d]\n", fp); > > > close(fp); > > } > > return 0; > > > > } > > > > > > /dev/igwate info: crw-r--r-- root 127 0 > > > > why don't I open '/dev/igwate'? must I need to do other thing ? please > > someone tells me or give me a clue ,thank you in advance > > My guess is that you will get an ENODEV or something similar because > there is not driver listening at MAJOR 127, minor 0. > > Tell us what the "perror" prints, > > Cheers, > Davidm > > -- > David McCullough, [EMAIL PROTECTED], Ph: > +61 734352815 > Secure Computing - SnapGear http://www.uCdot.org http://www.cyberguard.com > _______________________________________________ > uClinux-dev mailing list > [email protected] > http://mailman.uclinux.org/mailman/listinfo/uclinux-dev > This message was resent by [email protected] > To unsubscribe see: > http://mailman.uclinux.org/mailman/options/uclinux-dev > _______________________________________________ > uClinux-dev mailing list > [email protected] > http://mailman.uclinux.org/mailman/listinfo/uclinux-dev > This message was resent by [email protected] > To unsubscribe see: > http://mailman.uclinux.org/mailman/options/uclinux-dev _______________________________________________ uClinux-dev mailing list [email protected] http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by [email protected] To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev
