shell/app: Restore NOFILE limit
Restore the nofile limit when launching apps so that they do not inherit from the Shell's own limit. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
This commit is contained in:
parent
1bb05c33be
commit
9862ee9b25
@ -7,6 +7,7 @@
|
|||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
#include <meta/display.h>
|
#include <meta/display.h>
|
||||||
|
#include <meta/meta-context.h>
|
||||||
#include <meta/meta-workspace-manager.h>
|
#include <meta/meta-workspace-manager.h>
|
||||||
#include <meta/meta-x11-display.h>
|
#include <meta/meta-x11-display.h>
|
||||||
|
|
||||||
@ -1292,6 +1293,16 @@ shell_app_request_quit (ShellApp *app)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
child_context_setup (gpointer user_data)
|
||||||
|
{
|
||||||
|
ShellGlobal *shell_global = user_data;
|
||||||
|
MetaContext *meta_context;
|
||||||
|
|
||||||
|
g_object_get (shell_global, "context", &meta_context, NULL);
|
||||||
|
meta_context_restore_rlimit_nofile (meta_context, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS) && defined(HAVE_SYSTEMD)
|
#if !defined(HAVE_GIO_DESKTOP_LAUNCH_URIS_WITH_FDS) && defined(HAVE_SYSTEMD)
|
||||||
/* This sets up the launched application to log to the journal
|
/* This sets up the launched application to log to the journal
|
||||||
* using its own identifier, instead of just "gnome-session".
|
* using its own identifier, instead of just "gnome-session".
|
||||||
@ -1302,6 +1313,8 @@ app_child_setup (gpointer user_data)
|
|||||||
const char *appid = user_data;
|
const char *appid = user_data;
|
||||||
int res;
|
int res;
|
||||||
int journalfd = sd_journal_stream_fd (appid, LOG_INFO, FALSE);
|
int journalfd = sd_journal_stream_fd (appid, LOG_INFO, FALSE);
|
||||||
|
ShellGlobal *shell_global = shell_global_get ();
|
||||||
|
|
||||||
if (journalfd >= 0)
|
if (journalfd >= 0)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@ -1312,6 +1325,8 @@ app_child_setup (gpointer user_data)
|
|||||||
while (G_UNLIKELY (res == -1 && errno == EINTR));
|
while (G_UNLIKELY (res == -1 && errno == EINTR));
|
||||||
(void) close (journalfd);
|
(void) close (journalfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
child_context_setup (shell_global);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1396,6 +1411,7 @@ shell_app_launch (ShellApp *app,
|
|||||||
gboolean ret;
|
gboolean ret;
|
||||||
GSpawnFlags flags;
|
GSpawnFlags flags;
|
||||||
gboolean discrete_gpu = FALSE;
|
gboolean discrete_gpu = FALSE;
|
||||||
|
ShellGlobal *shell_global = shell_global_get ();
|
||||||
|
|
||||||
if (app->info == NULL)
|
if (app->info == NULL)
|
||||||
{
|
{
|
||||||
@ -1439,7 +1455,7 @@ shell_app_launch (ShellApp *app,
|
|||||||
ret = g_desktop_app_info_launch_uris_as_manager_with_fds (app->info, NULL,
|
ret = g_desktop_app_info_launch_uris_as_manager_with_fds (app->info, NULL,
|
||||||
context,
|
context,
|
||||||
flags,
|
flags,
|
||||||
NULL, NULL,
|
child_context_setup, shell_global,
|
||||||
wait_pid, NULL,
|
wait_pid, NULL,
|
||||||
-1,
|
-1,
|
||||||
journalfd,
|
journalfd,
|
||||||
@ -1456,7 +1472,7 @@ shell_app_launch (ShellApp *app,
|
|||||||
#ifdef HAVE_SYSTEMD
|
#ifdef HAVE_SYSTEMD
|
||||||
app_child_setup, (gpointer)shell_app_get_id (app),
|
app_child_setup, (gpointer)shell_app_get_id (app),
|
||||||
#else
|
#else
|
||||||
NULL, NULL,
|
child_context_setup, shell_global,
|
||||||
#endif
|
#endif
|
||||||
wait_pid, NULL,
|
wait_pid, NULL,
|
||||||
error);
|
error);
|
||||||
|
Loading…
Reference in New Issue
Block a user