Alle 13:05, domenica 29 febbraio 2004, Patrick \ ha scritto:
> Hi all,
>
> Jeff Dike wrote:
> >>> What's needed is a little driver which looks like a socket inside UML,
> >>> and which talks to a socket on the host, bridging between them. This
> >>> would be useful for other things, such as making a host X socket
> >>> available inside a UML that has no network
> >>
> >> Is such a driver available/in the works?
> >
> > No, it's been talked about, but no one has done anything.
>
> Well I tried to code something like that using a kernel thread that opens a
> socket on the inside od the uml guest and connects to a socket on the
> hostside. But I encountered some problems that I could noz solve and so I
> gave up.
>
> Problem 1.) How do I shutdown a kernel thread when the uml goes down? At
> the moment my patched kernle gets stuck with 100% CPU usage when I trie to
> shut down the uml kernel.
Possibly can be done either through exitcall or uml_exitcall. Give a look at
the arch/um/kernel/sigio_*.c, especially at sigio_cleanup, which is an UML
exitcall. Note however that the thread it refers to exists only on the host;
it could be your case or not.
> Problem 2.) How can I make sure that my kernel thread I startet _after_
> the networking stuff is inited? At the moment I start the kernel thread
> with a __initcall and just do a sleep(30) in the thread.
The proper way would be to use late_initcall instead of __initcall (check in
<linux/init.h>), supposing that network does not already use late_initcall.
Or you can just hack the network initcall and make it call your function; or
your initcall can call the network init. In this case, to avoid double
initialization, add at the start of network_init (or how is it called)
something like:
if (network_already_inited)
return (Ok?);
network_already_inited = 1;
and before, in the same file:
static int network_already_inited = 0;
However rename the flag or someone could think you are a Pascal programmer
(actually, I was). Seems like the actual function is called sock_init. Also,
in 2.6 (what I am checking) initcalls are called after sock_init (in
init/main.c: do_basic_setup()). So if that is right you do not need anything
to make sure that your initcall is after network initialized.
> Problem 3.) I can only create sockets in the "anonymous" namespace. The
> normal namespace gives me some error which I don't rememeber right now but
> I could find out what th errorcode was.
Sorry, but I cannot find any "anonymous" namespace. What is it? Maybe
PF_UNSPEC?
I guess the "normal" namespace is PF_LOCAL.
> So if somebody could help me with this problem I'd be willing to put some
> more work into this. Or I could post my tried on this list or by pm
There has been a lot of request for a such feature, so I would like if you can
post it here or rather on uml-devel (especially to avoid anyone trying it
without specific knowledge), even if it is not complete. So we could better
help you. Also, state whether it is onto 2.4 or 2.6.
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
|