Re: Reading from file in module fails
From: Erik Mouw (erik_at_harddisk-recovery.com)
Date: 05/03/04
- Previous message: Nick Piggin: "Re: Random file I/O regressions in 2.6"
- In reply to: Libor Vanek: "Reading from file in module fails"
- Next in thread: Libor Vanek: "Re: Reading from file in module fails"
- Reply: Libor Vanek: "Re: Reading from file in module fails"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 3 May 2004 13:35:00 +0200 To: Libor Vanek <libor@conet.cz>
On Mon, May 03, 2004 at 12:50:41PM +0200, Libor Vanek wrote:
> I need to copy files (yes - I know that kernel shouldn't do this but
> I REALLY need).
This is ugly, but it should do the trick:
int rv;
char *argv[4] = {"/bin/cp", "/tmp/foo", "/tmp/bar", NULL};
char *envp[3] = {"HOME=/", "PATH=/sbin:/bin:/usr/sbin:/usr/bin", NULL};
rv = call_usermodehelper(argv[0], argv, envp, 1);
if(rv < 0) {
/* error handling */
}
Called from kernel, done in userspace. And if you want to access an SQL
database from kernel tomorrow, it's just a matter of changing the
usermode helper.
(BTW, if you need to copy files from kernel, it's usually a sign of bad
design)
Erik
-- +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands - 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/
- Previous message: Nick Piggin: "Re: Random file I/O regressions in 2.6"
- In reply to: Libor Vanek: "Reading from file in module fails"
- Next in thread: Libor Vanek: "Re: Reading from file in module fails"
- Reply: Libor Vanek: "Re: Reading from file in module fails"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|