launcher: move weston_environment_get_fd
weston_environment_get_fd was declared in weston-launch and implemented in compositor.c. Since the function is not used elsewhere in the code, it is replaced by a static function in launcher-weston-launch.c Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
60b6572b35
commit
b4bd12b738
@@ -6929,26 +6929,6 @@ compositor_bind(struct wl_client *client,
|
|||||||
compositor, NULL);
|
compositor, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT int
|
|
||||||
weston_environment_get_fd(const char *env)
|
|
||||||
{
|
|
||||||
char *e;
|
|
||||||
int fd, flags;
|
|
||||||
|
|
||||||
e = getenv(env);
|
|
||||||
if (!e || !safe_strtoint(e, &fd))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
flags = fcntl(fd, F_GETFD);
|
|
||||||
if (flags == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
|
|
||||||
unsetenv(env);
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
output_repaint_status_text(struct weston_output *output)
|
output_repaint_status_text(struct weston_output *output)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include "weston-launch.h"
|
#include "weston-launch.h"
|
||||||
#include "launcher-impl.h"
|
#include "launcher-impl.h"
|
||||||
|
#include "shared/string-helpers.h"
|
||||||
|
|
||||||
#define DRM_MAJOR 226
|
#define DRM_MAJOR 226
|
||||||
|
|
||||||
@@ -231,6 +232,27 @@ launcher_weston_launch_activate_vt(struct weston_launcher *launcher_base, int vt
|
|||||||
return ioctl(launcher->tty, VT_ACTIVATE, vt);
|
return ioctl(launcher->tty, VT_ACTIVATE, vt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
launcher_weston_environment_get_fd(const char *env)
|
||||||
|
{
|
||||||
|
char *e;
|
||||||
|
int fd, flags;
|
||||||
|
|
||||||
|
e = getenv(env);
|
||||||
|
if (!e || !safe_strtoint(e, &fd))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
flags = fcntl(fd, F_GETFD);
|
||||||
|
if (flags == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
|
||||||
|
unsetenv(env);
|
||||||
|
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
launcher_weston_launch_connect(struct weston_launcher **out, struct weston_compositor *compositor,
|
launcher_weston_launch_connect(struct weston_launcher **out, struct weston_compositor *compositor,
|
||||||
int tty, const char *seat_id, bool sync_drm)
|
int tty, const char *seat_id, bool sync_drm)
|
||||||
@@ -246,9 +268,9 @@ launcher_weston_launch_connect(struct weston_launcher **out, struct weston_compo
|
|||||||
* (struct launcher_weston_launch **) out = launcher;
|
* (struct launcher_weston_launch **) out = launcher;
|
||||||
launcher->compositor = compositor;
|
launcher->compositor = compositor;
|
||||||
launcher->drm_fd = -1;
|
launcher->drm_fd = -1;
|
||||||
launcher->fd = weston_environment_get_fd("WESTON_LAUNCHER_SOCK");
|
launcher->fd = launcher_weston_environment_get_fd("WESTON_LAUNCHER_SOCK");
|
||||||
if (launcher->fd != -1) {
|
if (launcher->fd != -1) {
|
||||||
launcher->tty = weston_environment_get_fd("WESTON_TTY_FD");
|
launcher->tty = launcher_weston_environment_get_fd("WESTON_TTY_FD");
|
||||||
/* We don't get a chance to read out the original kb
|
/* We don't get a chance to read out the original kb
|
||||||
* mode for the tty, so just hard code K_UNICODE here
|
* mode for the tty, so just hard code K_UNICODE here
|
||||||
* in case we have to clean if weston-launch dies. */
|
* in case we have to clean if weston-launch dies. */
|
||||||
|
|||||||
@@ -46,7 +46,4 @@ struct weston_launcher_open {
|
|||||||
char path[0];
|
char path[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
|
||||||
weston_environment_get_fd(const char *env);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user