Re: making use of syscalls from kernelspace

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 18 Mar 2004 22:35:32 +0100
<threadhead@web.de> wrote:


>maybe you have an idea of how i could create a file from kernel space?

This is not a good idea but if you really need it try doing this.

	filp = filp_open("foo", O_CREAT | O_WRONLY | O_APPEND,
                            S_IRUSR | S_IWUSR);

        if (!filp || !filp->f_op) {
                printk(KERN_INFO "file error\n");
                goto out;
        }

- From this point on you could do anything by simply dereferencing
file methods. Just an example if you want to write into it.

	if (filp->f_op->write)
                filp->f_op->write(filp, buf, strlen(buf), &filp->f_pos);


Regards.

- --

Angelo Dell'Aera 'buffer' 
Antifork Research, Inc.	  	http://buffer.antifork.org

PGP information in e-mail header


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAWyBSpONIzxnBXKIRAmioAJwMEgViBwiPDnaWqpM78s8/L5PAygCfTi0v
tTSX2IjyyPhx8WjlaJLLffk=
=EE5B
-----END PGP SIGNATURE-----

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux