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

Reply via email to