-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simpify component startup by removing component_entry_point
lib
#2199
Comments
As an intermediate step, it would be good to remove the category of "legacy Genode components that still have a main function" by replacing |
To bridge the gap between the libc component approach and POSIX programs, we should implement a libposix.lib.so that implements |
This patch removes the component_entry_point library, which used to proved a hook for the libc to intercept the call of the 'Component::construct' function. The mechansim has several shortcomings (see the discussion in the associated issue) and was complex. So we eventually discarded the approach in favor of the explicit handling of the startup. A regular Genode component provides a 'Component::construct' function, which is determined by the dynamic linker via a symbol lookup. For the time being, the dynamic linker falls back to looking up a 'main' function if no 'Component::construct' function could be found. The libc provides an implementation of 'Component::construct', which sets up the libc's task handling and finally call the function 'Libc::Component::construct' from the context of the appllication task. This function is expected to be provided by the libc-using application. Consequently, Genode components that use the libc have to implement the 'Libc::Component::construct' function. The new 'posix' library provides an implementation of 'Libc::Component::construct' that calls a main function. Hence, POSIX programs that merely use the POSIX API merely have to add 'posix' to the 'LIBS' declaration in their 'target.mk' file. Their execution starts at 'main'. Issue genodelabs#2199
This patch removes the component_entry_point library, which used to proved a hook for the libc to intercept the call of the 'Component::construct' function. The mechansim has several shortcomings (see the discussion in the associated issue) and was complex. So we eventually discarded the approach in favor of the explicit handling of the startup. A regular Genode component provides a 'Component::construct' function, which is determined by the dynamic linker via a symbol lookup. For the time being, the dynamic linker falls back to looking up a 'main' function if no 'Component::construct' function could be found. The libc provides an implementation of 'Component::construct', which sets up the libc's task handling and finally call the function 'Libc::Component::construct' from the context of the appllication task. This function is expected to be provided by the libc-using application. Consequently, Genode components that use the libc have to implement the 'Libc::Component::construct' function. The new 'posix' library provides an implementation of 'Libc::Component::construct' that calls a main function. Hence, POSIX programs that merely use the POSIX API merely have to add 'posix' to the 'LIBS' declaration in their 'target.mk' file. Their execution starts at 'main'. Issue #2199
This patch adapts the world components according to the following issue: genodelabs/genode#2199
This patch adapts the world components according to the following issue: genodelabs/genode#2199 Fixes genodelabs#57
This patch removes the component_entry_point library, which used to proved a hook for the libc to intercept the call of the 'Component::construct' function. The mechansim has several shortcomings (see the discussion in the associated issue) and was complex. So we eventually discarded the approach in favor of the explicit handling of the startup. A regular Genode component provides a 'Component::construct' function, which is determined by the dynamic linker via a symbol lookup. For the time being, the dynamic linker falls back to looking up a 'main' function if no 'Component::construct' function could be found. The libc provides an implementation of 'Component::construct', which sets up the libc's task handling and finally call the function 'Libc::Component::construct' from the context of the appllication task. This function is expected to be provided by the libc-using application. Consequently, Genode components that use the libc have to implement the 'Libc::Component::construct' function. The new 'posix' library provides an implementation of 'Libc::Component::construct' that calls a main function. Hence, POSIX programs that merely use the POSIX API merely have to add 'posix' to the 'LIBS' declaration in their 'target.mk' file. Their execution starts at 'main'. Issue #2199
This patch adapts the world components according to the following issue: genodelabs/genode#2199 Fixes genodelabs#57
This patch adapts the world components according to the following issue: genodelabs/genode#2199 Fixes #57
Fixed in Genode 17.02 |
Besides the removal of the legacy 'main' support, this patch simplifies the lib/startup/_main.cc. Issue #2199
Besides the removal of the legacy 'main' support, this patch simplifies the lib/startup/_main.cc. Issue #2199
Right now, our component-startup procedure provides several hooks to cover a large diversity of components:
main
function,main
function,The hooks make the startup arguably more complex than it should be. One particular case is the hook that we provide for the libc to customize the runtime environment of a libc-using program. Such programs tend to use blocking I/O (read, select), which does not fit well with the asynchronous nature of the component API. Under the hood, the libc bridges this semantic gap by the means of user-level scheduling. To implement this, it needs to intercept the startup of the application code.
Long story short, when linking against the libc,
Component::construct
is transparently intercepted by the libc. With this issue, I suggest to drop the "transparently" part and make the interception explicit. In order to use both Genode's component API and libc I/O functions, a component should implement aLibc::Component::construct
function. The libc would provide the implementation of the regularComponent::construct
function by setting up the context of the application code and finally calling the application-providedLibc::Component::construct
.The text was updated successfully, but these errors were encountered: