Web lists-archives.com

Re: Can't launch apps, fork() returns ENOMEM




Spotted another complication here.

On Mon, Apr 2, 2018 at 1:15 PM, Daniel Drake <drake@xxxxxxxxxxxx> wrote:
> Then I considered making glib just call posix_spawn() directly when
> appropriate. There are a number of things in that API which let
> relevant actions be done in the child process before it does the exec
> - managing file descriptors, signal handlers, etc. The big issue there
> is that glib lets you pass an arbitrary GSpawnChildSetupFunc to be run
> in the child before the exec(), this is used by gnome-shell, and there
> is no equivalent hook in posix_spawn().
>
> In gnome-shell app_child_setup() this function is used to send stdout
> and stderr to journald. Also in glib gdesktopappinfo.c child_setup()
> the same mechanism is used to set GIO_LAUNCHED_DESKTOP_FILE_PID in the
> child process to it's own process PID (can't find the background
> here).
>
> I think there are 2 viable paths forward:
>
>  1. Eliminate the child_setup calls from these codepaths to allow
> posix_spawn() to be used. The gspawn code already allows for file
> descriptor redirection but this would have to be exposed via
> additional parameters to g_desktop_app_info_launch_uris_as_manager() -
> an API change.

I was wrong in thinking that gspawn lets you say "run this binary, and
here's the fd that you should use for stdout".

The parameters that exist in the current interfaces either let you
inherit stdin/out/err from the parent, or create an entirely new pipe
in each case.

So, in order to avoid needing gnome-shell's app_child_setup(), we
would either need to extend the gspawn API to allow specific file
descriptors to be passed in, or perhaps another option to consider is
to have gdesktopappinfo call posix_spawn directly (instead of gspawn).

Daniel
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list