Gesendet: Montag, 05. April 2021 um 22:05 Uhr Von: "Alexander Tormasov via users" users@lists.genode.org An: "Genode users mailing list" users@lists.genode.org Cc: "Alexander Tormasov" a.tormasov@innopolis.ru Betreff: Re: how to open elf file image from inside genode? libbacktrace question
or I need to modify it and add another «double» option, something like
You need this configuration. But why do you want to use a way that is dependent upon config, when you need it for a language detail. That is why make something compiled in depend on something configured. And why has it to be POSIX open ()? Alternatively you can store that capability on startup in a static var in open () where it is returned from upon encountering a special parameter combination for instance an empty string as filename.
of course, I would prefer to be able to use posix open (or even just obtain a dup() of handle for my own executable file) to use it for read()/write() operations later. This is not mine code (libbacktrace is a part of original gcc), and I just want to be able to run it maximally smoothly inside genode. In this moment it try to call posix open() for some names like /proc/self/exe or similar, and later returned handle used deeply inside code. I will be happy to find ANY smooth way to have a handle for myself…
and, I am not so sure that loaded into ram current executable is suitable for such operations like read of elf header… probably I need to open it explicitly, but to do so I need to find it inside genode file system mounted name space (/vfs?)
And "probably " is the watchword here. Genode is an improbable system. For instance all systems treat the file system as given, in genode it's optional. Therefore open () can fail in a very roundabout manner. Your excerpt of the function was too short. You didn't even complete the for loop. I would bet there is a static var in the function that caches the handle. And only if that is empty the for loop is entered. And if it is so then I would give that function a parameter of type handle (whatever is stored in the statistic) with default empty and an additional statement at the beginning of the function that in the case that this parameter is not empty stores that parameter in the statistic var for later retrieval and for skipping the for loop. And at startup you retrieve the open handle (which is another name for capability) from the parent (or, if the parent provides it voluntarily, copy it) and call that function with that handle once. If that cannot work because the function is constructed otherwise I would ask you to post the whole function.
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users