diff options
Diffstat (limited to 'backend/session')
-rw-r--r-- | backend/session/direct-freebsd.c | 26 | ||||
-rw-r--r-- | backend/session/direct-ipc.c | 8 | ||||
-rw-r--r-- | backend/session/direct.c | 26 | ||||
-rw-r--r-- | backend/session/logind.c | 52 | ||||
-rw-r--r-- | backend/session/session.c | 22 |
5 files changed, 67 insertions, 67 deletions
diff --git a/backend/session/direct-freebsd.c b/backend/session/direct-freebsd.c index 6e23bf1b..63e1be01 100644 --- a/backend/session/direct-freebsd.c +++ b/backend/session/direct-freebsd.c @@ -35,7 +35,7 @@ static int direct_session_open(struct wlr_session *base, const char *path) { int fd = direct_ipc_open(session->sock, path); if (fd < 0) { - wlr_log(L_ERROR, "Failed to open %s: %s%s", path, strerror(-fd), + wlr_log(WLR_ERROR, "Failed to open %s: %s%s", path, strerror(-fd), fd == -EINVAL ? "; is another display server running?" : ""); return fd; } @@ -54,7 +54,7 @@ static void direct_session_close(struct wlr_session *base, int fd) { struct stat st; if (fstat(fd, &st) < 0) { - wlr_log_errno(L_ERROR, "Stat failed"); + wlr_log_errno(WLR_ERROR, "Stat failed"); close(fd); return; } @@ -80,7 +80,7 @@ static void direct_session_destroy(struct wlr_session *base) { ioctl(session->tty_fd, VT_SETMODE, &mode); if (errno) { - wlr_log(L_ERROR, "Failed to restore tty"); + wlr_log(WLR_ERROR, "Failed to restore tty"); } direct_ipc_finish(session->sock, session->child); @@ -110,21 +110,21 @@ static int vt_handler(int signo, void *data) { static bool setup_tty(struct direct_session *session, struct wl_display *display) { int fd = -1, tty = -1, tty0_fd = -1; if ((tty0_fd = open("/dev/ttyv0", O_RDWR | O_CLOEXEC)) < 0) { - wlr_log_errno(L_ERROR, "Could not open /dev/ttyv0 to find a free vt"); + wlr_log_errno(WLR_ERROR, "Could not open /dev/ttyv0 to find a free vt"); goto error; } if (ioctl(tty0_fd, VT_OPENQRY, &tty) != 0) { - wlr_log_errno(L_ERROR, "Could not find a free vt"); + wlr_log_errno(WLR_ERROR, "Could not find a free vt"); goto error; } close(tty0_fd); char tty_path[64]; snprintf(tty_path, sizeof(tty_path), "/dev/ttyv%d", tty - 1); - wlr_log(L_INFO, "Using tty %s", tty_path); + wlr_log(WLR_INFO, "Using tty %s", tty_path); fd = open(tty_path, O_RDWR | O_NOCTTY | O_CLOEXEC); if (fd == -1) { - wlr_log_errno(L_ERROR, "Cannot open tty"); + wlr_log_errno(WLR_ERROR, "Cannot open tty"); return false; } @@ -133,17 +133,17 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display int old_kbmode; if (ioctl(fd, KDGKBMODE, &old_kbmode)) { - wlr_log_errno(L_ERROR, "Failed to read tty %d keyboard mode", tty); + wlr_log_errno(WLR_ERROR, "Failed to read tty %d keyboard mode", tty); goto error; } if (ioctl(fd, KDSKBMODE, K_CODE)) { - wlr_log_errno(L_ERROR, "Failed to set keyboard mode K_CODE on tty %d", tty); + wlr_log_errno(WLR_ERROR, "Failed to set keyboard mode K_CODE on tty %d", tty); goto error; } if (ioctl(fd, KDSETMODE, KD_GRAPHICS)) { - wlr_log_errno(L_ERROR, "Failed to set graphics mode on tty %d", tty); + wlr_log_errno(WLR_ERROR, "Failed to set graphics mode on tty %d", tty); goto error; } @@ -155,7 +155,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display }; if (ioctl(fd, VT_SETMODE, &mode) < 0) { - wlr_log(L_ERROR, "Failed to take control of tty %d", tty); + wlr_log(WLR_ERROR, "Failed to take control of tty %d", tty); goto error; } @@ -182,7 +182,7 @@ error: static struct wlr_session *direct_session_create(struct wl_display *disp) { struct direct_session *session = calloc(1, sizeof(*session)); if (!session) { - wlr_log_errno(L_ERROR, "Allocation failed"); + wlr_log_errno(WLR_ERROR, "Allocation failed"); return NULL; } @@ -195,7 +195,7 @@ static struct wlr_session *direct_session_create(struct wl_display *disp) { goto error_ipc; } - wlr_log(L_INFO, "Successfully loaded direct session"); + wlr_log(WLR_INFO, "Successfully loaded direct session"); snprintf(session->base.seat, sizeof(session->base.seat), "seat0"); session->base.impl = &session_direct; diff --git a/backend/session/direct-ipc.c b/backend/session/direct-ipc.c index 2dd777c8..5fdb95ac 100644 --- a/backend/session/direct-ipc.c +++ b/backend/session/direct-ipc.c @@ -32,7 +32,7 @@ static bool have_permissions(void) { cap_flag_value_t val; if (!cap || cap_get_flag(cap, CAP_SYS_ADMIN, CAP_PERMITTED, &val) || val != CAP_SET) { - wlr_log(L_ERROR, "Do not have CAP_SYS_ADMIN; cannot become DRM master"); + wlr_log(WLR_ERROR, "Do not have CAP_SYS_ADMIN; cannot become DRM master"); cap_free(cap); return false; } @@ -44,7 +44,7 @@ static bool have_permissions(void) { static bool have_permissions(void) { #ifdef __linux__ if (geteuid() != 0) { - wlr_log(L_ERROR, "Do not have root privileges; cannot become DRM master"); + wlr_log(WLR_ERROR, "Do not have root privileges; cannot become DRM master"); return false; } #endif @@ -229,13 +229,13 @@ int direct_ipc_init(pid_t *pid_out) { int sock[2]; if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sock) < 0) { - wlr_log_errno(L_ERROR, "Failed to create socket pair"); + wlr_log_errno(WLR_ERROR, "Failed to create socket pair"); return -1; } pid_t pid = fork(); if (pid < 0) { - wlr_log_errno(L_ERROR, "Fork failed"); + wlr_log_errno(WLR_ERROR, "Fork failed"); close(sock[0]); close(sock[1]); return -1; diff --git a/backend/session/direct.c b/backend/session/direct.c index 7fa7d05b..ed7a0c65 100644 --- a/backend/session/direct.c +++ b/backend/session/direct.c @@ -38,7 +38,7 @@ static int direct_session_open(struct wlr_session *base, const char *path) { int fd = direct_ipc_open(session->sock, path); if (fd < 0) { - wlr_log(L_ERROR, "Failed to open %s: %s%s", path, strerror(-fd), + wlr_log(WLR_ERROR, "Failed to open %s: %s%s", path, strerror(-fd), fd == -EINVAL ? "; is another display server running?" : ""); return fd; } @@ -61,7 +61,7 @@ static void direct_session_close(struct wlr_session *base, int fd) { struct stat st; if (fstat(fd, &st) < 0) { - wlr_log_errno(L_ERROR, "Stat failed"); + wlr_log_errno(WLR_ERROR, "Stat failed"); close(fd); return; } @@ -100,7 +100,7 @@ static void direct_session_destroy(struct wlr_session *base) { ioctl(session->tty_fd, VT_SETMODE, &mode); if (errno) { - wlr_log(L_ERROR, "Failed to restore tty"); + wlr_log(WLR_ERROR, "Failed to restore tty"); } wl_event_source_remove(session->vt_source); @@ -150,13 +150,13 @@ static int vt_handler(int signo, void *data) { static bool setup_tty(struct direct_session *session, struct wl_display *display) { int fd = open("/dev/tty", O_RDWR); if (fd == -1) { - wlr_log_errno(L_ERROR, "Cannot open /dev/tty"); + wlr_log_errno(WLR_ERROR, "Cannot open /dev/tty"); return false; } struct vt_stat vt_stat; if (ioctl(fd, VT_GETSTATE, &vt_stat)) { - wlr_log_errno(L_ERROR, "Could not get current tty number"); + wlr_log_errno(WLR_ERROR, "Could not get current tty number"); goto error; } @@ -165,12 +165,12 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display ret = ioctl(fd, KDGETMODE, &kd_mode); if (ret) { - wlr_log_errno(L_ERROR, "Failed to get tty mode"); + wlr_log_errno(WLR_ERROR, "Failed to get tty mode"); goto error; } if (kd_mode != KD_TEXT) { - wlr_log(L_ERROR, + wlr_log(WLR_ERROR, "tty already in graphics mode; is another display server running?"); goto error; } @@ -179,17 +179,17 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display ioctl(fd, VT_WAITACTIVE, tty); if (ioctl(fd, KDGKBMODE, &old_kbmode)) { - wlr_log_errno(L_ERROR, "Failed to read keyboard mode"); + wlr_log_errno(WLR_ERROR, "Failed to read keyboard mode"); goto error; } if (ioctl(fd, KDSKBMODE, K_OFF)) { - wlr_log_errno(L_ERROR, "Failed to set keyboard mode"); + wlr_log_errno(WLR_ERROR, "Failed to set keyboard mode"); goto error; } if (ioctl(fd, KDSETMODE, KD_GRAPHICS)) { - wlr_log_errno(L_ERROR, "Failed to set graphics mode on tty"); + wlr_log_errno(WLR_ERROR, "Failed to set graphics mode on tty"); goto error; } @@ -200,7 +200,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display }; if (ioctl(fd, VT_SETMODE, &mode) < 0) { - wlr_log(L_ERROR, "Failed to take control of tty"); + wlr_log(WLR_ERROR, "Failed to take control of tty"); goto error; } @@ -225,7 +225,7 @@ error: static struct wlr_session *direct_session_create(struct wl_display *disp) { struct direct_session *session = calloc(1, sizeof(*session)); if (!session) { - wlr_log_errno(L_ERROR, "Allocation failed"); + wlr_log_errno(WLR_ERROR, "Allocation failed"); return NULL; } @@ -251,7 +251,7 @@ static struct wlr_session *direct_session_create(struct wl_display *disp) { snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat); session->base.impl = &session_direct; - wlr_log(L_INFO, "Successfully loaded direct session"); + wlr_log(WLR_INFO, "Successfully loaded direct session"); return &session->base; error_ipc: diff --git a/backend/session/logind.c b/backend/session/logind.c index e01047e3..2f816b95 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -47,7 +47,7 @@ static int logind_take_device(struct wlr_session *base, const char *path) { struct stat st; if (stat(path, &st) < 0) { - wlr_log(L_ERROR, "Failed to stat '%s'", path); + wlr_log(WLR_ERROR, "Failed to stat '%s'", path); return -1; } @@ -55,14 +55,14 @@ static int logind_take_device(struct wlr_session *base, const char *path) { session->path, "org.freedesktop.login1.Session", "TakeDevice", &error, &msg, "uu", major(st.st_rdev), minor(st.st_rdev)); if (ret < 0) { - wlr_log(L_ERROR, "Failed to take device '%s': %s", path, error.message); + wlr_log(WLR_ERROR, "Failed to take device '%s': %s", path, error.message); goto error; } int paused = 0; ret = sd_bus_message_read(msg, "hb", &fd, &paused); if (ret < 0) { - wlr_log(L_ERROR, "Failed to parse D-Bus response for '%s': %s", + wlr_log(WLR_ERROR, "Failed to parse D-Bus response for '%s': %s", path, strerror(-ret)); goto error; } @@ -71,7 +71,7 @@ static int logind_take_device(struct wlr_session *base, const char *path) { // so we just clone it. fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); if (fd == -1) { - wlr_log(L_ERROR, "Failed to clone file descriptor for '%s': %s", + wlr_log(WLR_ERROR, "Failed to clone file descriptor for '%s': %s", path, strerror(errno)); goto error; } @@ -91,7 +91,7 @@ static void logind_release_device(struct wlr_session *base, int fd) { struct stat st; if (fstat(fd, &st) < 0) { - wlr_log(L_ERROR, "Failed to stat device '%d'", fd); + wlr_log(WLR_ERROR, "Failed to stat device '%d'", fd); return; } @@ -99,7 +99,7 @@ static void logind_release_device(struct wlr_session *base, int fd) { session->path, "org.freedesktop.login1.Session", "ReleaseDevice", &error, &msg, "uu", major(st.st_rdev), minor(st.st_rdev)); if (ret < 0) { - wlr_log(L_ERROR, "Failed to release device '%d'", fd); + wlr_log(WLR_ERROR, "Failed to release device '%d'", fd); } sd_bus_error_free(&error); @@ -123,7 +123,7 @@ static bool logind_change_vt(struct wlr_session *base, unsigned vt) { "/org/freedesktop/login1/seat/self", "org.freedesktop.login1.Seat", "SwitchTo", &error, &msg, "u", (uint32_t)vt); if (ret < 0) { - wlr_log(L_ERROR, "Failed to change to vt '%d'", vt); + wlr_log(WLR_ERROR, "Failed to change to vt '%d'", vt); } sd_bus_error_free(&error); @@ -140,7 +140,7 @@ static bool find_session_path(struct logind_session *session) { "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "GetSession", &error, &msg, "s", session->id); if (ret < 0) { - wlr_log(L_ERROR, "Failed to get session path: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Failed to get session path: %s", strerror(-ret)); goto out; } @@ -148,7 +148,7 @@ static bool find_session_path(struct logind_session *session) { ret = sd_bus_message_read(msg, "o", &path); if (ret < 0) { - wlr_log(L_ERROR, "Could not parse session path: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Could not parse session path: %s", strerror(-ret)); goto out; } @@ -170,7 +170,7 @@ static bool session_activate(struct logind_session *session) { session->path, "org.freedesktop.login1.Session", "Activate", &error, &msg, ""); if (ret < 0) { - wlr_log(L_ERROR, "Failed to activate session"); + wlr_log(WLR_ERROR, "Failed to activate session"); } sd_bus_error_free(&error); @@ -187,7 +187,7 @@ static bool take_control(struct logind_session *session) { session->path, "org.freedesktop.login1.Session", "TakeControl", &error, &msg, "b", false); if (ret < 0) { - wlr_log(L_ERROR, "Failed to take control of session"); + wlr_log(WLR_ERROR, "Failed to take control of session"); } sd_bus_error_free(&error); @@ -204,7 +204,7 @@ static void release_control(struct logind_session *session) { session->path, "org.freedesktop.login1.Session", "ReleaseControl", &error, &msg, ""); if (ret < 0) { - wlr_log(L_ERROR, "Failed to release control of session"); + wlr_log(WLR_ERROR, "Failed to release control of session"); } sd_bus_error_free(&error); @@ -224,7 +224,7 @@ static void logind_session_destroy(struct wlr_session *base) { } static int session_removed(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error) { - wlr_log(L_INFO, "SessionRemoved signal received"); + wlr_log(WLR_INFO, "SessionRemoved signal received"); return 0; } @@ -237,7 +237,7 @@ static struct wlr_device *find_device(struct wlr_session *session, dev_t devnum) } } - wlr_log(L_ERROR, "Tried to use dev_t %lu not opened by session", + wlr_log(WLR_ERROR, "Tried to use dev_t %lu not opened by session", (unsigned long)devnum); assert(0); } @@ -250,7 +250,7 @@ static int pause_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_e const char *type; ret = sd_bus_message_read(msg, "uus", &major, &minor, &type); if (ret < 0) { - wlr_log(L_ERROR, "Failed to parse D-Bus response for PauseDevice: %s", + wlr_log(WLR_ERROR, "Failed to parse D-Bus response for PauseDevice: %s", strerror(-ret)); goto error; } @@ -265,7 +265,7 @@ static int pause_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_e session->path, "org.freedesktop.login1.Session", "PauseDeviceComplete", ret_error, &msg, "uu", major, minor); if (ret < 0) { - wlr_log(L_ERROR, "Failed to send PauseDeviceComplete signal: %s", + wlr_log(WLR_ERROR, "Failed to send PauseDeviceComplete signal: %s", strerror(-ret)); } } @@ -282,7 +282,7 @@ static int resume_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_ uint32_t major, minor; ret = sd_bus_message_read(msg, "uuh", &major, &minor, &fd); if (ret < 0) { - wlr_log(L_ERROR, "Failed to parse D-Bus response for ResumeDevice: %s", + wlr_log(WLR_ERROR, "Failed to parse D-Bus response for ResumeDevice: %s", strerror(-ret)); goto error; } @@ -314,21 +314,21 @@ static bool add_signal_matches(struct logind_session *session) { snprintf(str, sizeof(str), fmt, "Manager", "SessionRemoved", "/org/freedesktop/login1"); ret = sd_bus_add_match(session->bus, NULL, str, session_removed, session); if (ret < 0) { - wlr_log(L_ERROR, "Failed to add D-Bus match: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Failed to add D-Bus match: %s", strerror(-ret)); return false; } snprintf(str, sizeof(str), fmt, "Session", "PauseDevice", session->path); ret = sd_bus_add_match(session->bus, NULL, str, pause_device, session); if (ret < 0) { - wlr_log(L_ERROR, "Failed to add D-Bus match: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Failed to add D-Bus match: %s", strerror(-ret)); return false; } snprintf(str, sizeof(str), fmt, "Session", "ResumeDevice", session->path); ret = sd_bus_add_match(session->bus, NULL, str, resume_device, session); if (ret < 0) { - wlr_log(L_ERROR, "Failed to add D-Bus match: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Failed to add D-Bus match: %s", strerror(-ret)); return false; } @@ -347,20 +347,20 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { int ret; struct logind_session *session = calloc(1, sizeof(*session)); if (!session) { - wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno)); + wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno)); return NULL; } ret = sd_pid_get_session(getpid(), &session->id); if (ret < 0) { - wlr_log(L_ERROR, "Failed to get session id: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Failed to get session id: %s", strerror(-ret)); goto error; } char *seat; ret = sd_session_get_seat(session->id, &seat); if (ret < 0) { - wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Failed to get seat id: %s", strerror(-ret)); goto error; } snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat); @@ -368,7 +368,7 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { if (strcmp(seat, "seat0") == 0) { ret = sd_session_get_vt(session->id, &session->base.vtnr); if (ret < 0) { - wlr_log(L_ERROR, "Session not running in virtual terminal"); + wlr_log(WLR_ERROR, "Session not running in virtual terminal"); goto error; } } @@ -376,7 +376,7 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { ret = sd_bus_default_system(&session->bus); if (ret < 0) { - wlr_log(L_ERROR, "Failed to open D-Bus connection: %s", strerror(-ret)); + wlr_log(WLR_ERROR, "Failed to open D-Bus connection: %s", strerror(-ret)); goto error; } @@ -401,7 +401,7 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { goto error_bus; } - wlr_log(L_INFO, "Successfully loaded logind session"); + wlr_log(WLR_INFO, "Successfully loaded logind session"); session->base.impl = &session_logind; return &session->base; diff --git a/backend/session/session.c b/backend/session/session.c index 026040fd..8d74bafe 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -36,7 +36,7 @@ static int udev_event(int fd, uint32_t mask, void *data) { const char *action = udev_device_get_action(udev_dev); - wlr_log(L_DEBUG, "udev event for %s (%s)", + wlr_log(WLR_DEBUG, "udev event for %s (%s)", udev_device_get_sysname(udev_dev), action); if (!action || strcmp(action, "change") != 0) { @@ -73,7 +73,7 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) { } if (!session) { - wlr_log(L_ERROR, "Failed to load session backend"); + wlr_log(WLR_ERROR, "Failed to load session backend"); return NULL; } @@ -83,13 +83,13 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) { session->udev = udev_new(); if (!session->udev) { - wlr_log_errno(L_ERROR, "Failed to create udev context"); + wlr_log_errno(WLR_ERROR, "Failed to create udev context"); goto error_session; } session->mon = udev_monitor_new_from_netlink(session->udev, "udev"); if (!session->mon) { - wlr_log_errno(L_ERROR, "Failed to create udev monitor"); + wlr_log_errno(WLR_ERROR, "Failed to create udev monitor"); goto error_udev; } @@ -102,7 +102,7 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) { session->udev_event = wl_event_loop_add_fd(event_loop, fd, WL_EVENT_READABLE, udev_event, session); if (!session->udev_event) { - wlr_log_errno(L_ERROR, "Failed to create udev event source"); + wlr_log_errno(WLR_ERROR, "Failed to create udev event source"); goto error_mon; } @@ -142,13 +142,13 @@ int wlr_session_open_file(struct wlr_session *session, const char *path) { struct wlr_device *dev = malloc(sizeof(*dev)); if (!dev) { - wlr_log_errno(L_ERROR, "Allocation failed"); + wlr_log_errno(WLR_ERROR, "Allocation failed"); goto error; } struct stat st; if (fstat(fd, &st) < 0) { - wlr_log_errno(L_ERROR, "Stat failed"); + wlr_log_errno(WLR_ERROR, "Stat failed"); goto error; } @@ -173,7 +173,7 @@ static struct wlr_device *find_device(struct wlr_session *session, int fd) { } } - wlr_log(L_ERROR, "Tried to use fd %d not opened by session", fd); + wlr_log(WLR_ERROR, "Tried to use fd %d not opened by session", fd); assert(0); } @@ -240,7 +240,7 @@ static size_t explicit_find_gpus(struct wlr_session *session, size_t ret_len, int ret[static ret_len], const char *str) { char *gpus = strdup(str); if (!gpus) { - wlr_log_errno(L_ERROR, "Allocation failed"); + wlr_log_errno(WLR_ERROR, "Allocation failed"); return 0; } @@ -254,7 +254,7 @@ static size_t explicit_find_gpus(struct wlr_session *session, ret[i] = open_if_kms(session, ptr); if (ret[i] < 0) { - wlr_log(L_ERROR, "Unable to open %s as DRM device", ptr); + wlr_log(WLR_ERROR, "Unable to open %s as DRM device", ptr); } else { ++i; } @@ -281,7 +281,7 @@ size_t wlr_session_find_gpus(struct wlr_session *session, struct udev_enumerate *en = udev_enumerate_new(session->udev); if (!en) { - wlr_log(L_ERROR, "Failed to create udev enumeration"); + wlr_log(WLR_ERROR, "Failed to create udev enumeration"); return -1; } |