[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sys_open fails with error 14
On Thu, 6 Dec 2007 18:37:06 +0530
"Sandeep K Sinha" <sandeepksinha@xxxxxxxxx> wrote:
> It returns with ENOENT after using set_fs.
Why do you need to do a sys_open from kernel?
system calls are for user space i guess.
You are already in kernel.
how about using sysfs interface and passing info to a file
in /sys/xyz/abc file, from where a user space thread/daemon can write
that to your desired location?
Thanks
>
> On Dec 6, 2007 5:11 PM, Vivek Kutal <vivekutal@xxxxxxxxx> wrote:
> > Sandeep K Sinha wrote:
> > > Well, I am trying to write a kernel module which when inserted
> > > should created a file foo at any absolute location.
> > > This is a code snippet of the same. It returns with error No -14.
> > > This a part of the constructor code for the module. I am using
> > > 2.6.20 kernel.
> > >
> > > char x1[64]="/home/ssinha/foo";
> > > printk(KERN_INFO "Hello world \n");
> > > return1 = sys_open(x1,O_CREAT | O_WRONLY | O_TRUNC,0);
> > > printk(KERN_ALERT "Returned Value is : %d. \n",return1);
> > >
> > > Am I logically wrong somewhere ??
> > >
> > >
> > You'll have to do a set_fs(KERNEL_DS) , before calling open.
> >
> >
> >
> > --
> > Vivek Kutal
> >
> >
>
>
>
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ