[RFC v7 02/21] um: add os init and exit calls

Hajime Tazaki thehajime at gmail.com
Thu Oct 8 09:18:10 EDT 2020


On Thu, 08 Oct 2020 00:13:02 +0900,
Johannes Berg wrote:
> 
> On Tue, 2020-10-06 at 18:44 +0900, Hajime Tazaki wrote:
> > 
> > -#define __define_initcall(level,fn) \
> > -	static initcall_t __initcall_##fn __used \
> > -	__attribute__((__section__(".initcall" level ".init"))) = fn
> > -
> > -/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll
> > - * make them run first.
> > - */
> > -#define __initcall(fn) __define_initcall("1", fn)
> > +#undef __uml_exit_call
> > +#define __uml_exit_call		__used __section(os_exitcalls)
> 
> Doesn't that break calling of sigio_cleanup and remove_umid_dir?

Without the patch 04/21 um: host: implement os_initcalls and
os_exitcalls, yes you're right.

> After all,
> 
> > +void __weak os_exitcalls(void)
> > +{
> > +}
> 
> This does nothing so far.
> 
> Also, why the __weak?

The intention is to define os_exitcalls() under tools/um so that the
actual exitcalls is located in different ELF sections (we defined
multiple __uml_exit_call for __UM_HOST__ and ! __UM_HOST__).  Thus
uml_cleanup() must see the symbol but give the place where actual
function is defined at tools/um.  Thus, this is __weak symbol-ed.

-- Hajime



More information about the linux-um mailing list