well there are several examples of this in the arch/um/drivers area.
<blah>_user.c and <blah>_kern.c break out the userspace and
kernel space parts of UML's dual personality.

Olivier Crameri wrote:
> Well, yes, I could use this.
>
> But what I'm actually trying to understand is how to properly execute
> regular C within the UML kernel to access the host OS.
>
> Thks,
>
> Olivier
>
> On 5 avr. 06, at 19:18, D. Bahi wrote:
>
>> what about this?
>>
>> http://user-mode-linux.sourceforge.net/iomem.html
>>
>> Olivier Crameri wrote:
>>> Hi,
>>>
>>> I'm currently working on a project in which we are using UML to access
>>> the host os and perform some operations.
>>> More precisely, we would like to have a system call in UML that parses
>>> a file in the host os.
>>>
>>> Since the UML kernel is a host process, I naively thought that I could
>>> use regular C directly. Indeed, I was able to create my system call,
>>> and then have some other C files compiled using host os headers such
>>> as <stdio.h> and <stdlib.h> by putting them in the USER_OBJS list of
>>> the Makefile.
>>>
>>> Unfortunately, I'm having some weird issues that I can't really
>>> understand. I can read the file using fread, but only in a buffer that
>>> I allocated using um_kmalloc. If I use a buffer allocated by malloc,
>>> the fread fails. Then, even if I replace all  my mallocs by
>>> um_kmallocs, some libc functions (such as sscanf) don't seem to work
>>> properly. I guess I'm missing something, but I can't figure out what.
>>>
>>> If anyone of you can help me, I'd really appreciate,
>>>
>>> With best regards,
>>>
>>> Olivier
>>>
>>> P.S.: I'm using 2.6.15.6 with the latest 2.6.15 patch and the guest
>>> kernel runs in skas3 mode.
>>>
>>>
>>> -------------------------------------------------------
>>> This SF.Net email is sponsored by xPML, a groundbreaking scripting
>>> language
>>> that extends applications into web and mobile media. Attend the live
>>> webcast
>>> and join the prime developer group breaking into this new coding
>>> territory!
>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>>>
>>> _______________________________________________
>>> User-mode-linux-devel mailing list
>>> User-mode-linux-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
>>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> User-mode-linux-devel mailing list
> User-mode-linux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to