Using open system call in KLD

Anupam Deshpande anupamdeshpande at gmail.com
Sun Mar 5 07:02:01 PST 2006


Hello,
         I have used open system call in KLD to create a file. But after
inserting the module the file is not created though the file descriptor
returned is non zero. I also used close system call to close the file, using
the descriptor returned by open system call.
         I called the following function from my module:

int f_open(void)
{
   struct open_args o;
   struct close_args c;
   struct thread *td = curthread;
   int fd;
   o.path = "/home/file1.c";
   o.flags = O_CREAT | O_RDWR | O_APPEND;
   o.mode = 777;
   fd = open(td,&a);
   printf("\nFile descriptor  = %d",fd);
   c.fd = fd;
   close(td,&c);
}


         Can anyone help me in this regard?

TIA,
Anupam Deshpande


More information about the freebsd-hackers mailing list