Re: What's wrong with this really simple function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mohamed El Dawy wrote:
Hi,
 I have created this 5-liner system call, which basically opens a
file, write "Hello World" to it, and then returns. That's all.

Now, when I actually call it, it creates the file successfully but
writes nothing to it. The file is created and is only zero bytes. So,
either write didn't write, or close didn't close. Any help would be
greatly appreciated.
Well, the main thing wrong is that you are writing to a file from inside 
the kernel, that is just wrong.. However likely the reason why the write 
didn't work is that it expects an address inside userspace memory and 
you've given it a character literal which is inside the kernel address 
space.
--
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux