summaryrefslogtreecommitdiffstats
path: root/swaylock/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaylock/main.c')
-rw-r--r--swaylock/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 4c6b44c6..200c1b5f 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -8,6 +8,7 @@
8#include <stdio.h> 8#include <stdio.h>
9#include <stdlib.h> 9#include <stdlib.h>
10#include <string.h> 10#include <string.h>
11#include <sys/mman.h>
11#include <sys/stat.h> 12#include <sys/stat.h>
12#include <time.h> 13#include <time.h>
13#include <unistd.h> 14#include <unistd.h>
@@ -18,10 +19,15 @@
18#include "background-image.h" 19#include "background-image.h"
19#include "pool-buffer.h" 20#include "pool-buffer.h"
20#include "cairo.h" 21#include "cairo.h"
22#include "log.h"
21#include "util.h" 23#include "util.h"
22#include "wlr-input-inhibitor-unstable-v1-client-protocol.h" 24#include "wlr-input-inhibitor-unstable-v1-client-protocol.h"
23#include "wlr-layer-shell-unstable-v1-client-protocol.h" 25#include "wlr-layer-shell-unstable-v1-client-protocol.h"
24 26
27void sway_terminate(int exit_code) {
28 exit(exit_code);
29}
30
25static void daemonize() { 31static void daemonize() {
26 int fds[2]; 32 int fds[2];
27 if (pipe(fds) != 0) { 33 if (pipe(fds) != 0) {
@@ -236,6 +242,13 @@ int main(int argc, char **argv) {
236 } 242 }
237 } 243 }
238 244
245#ifdef __linux__
246 // Most non-linux platforms require root to mlock()
247 if (mlock(state.password.buffer, sizeof(state.password.buffer)) != 0) {
248 sway_abort("Unable to mlock() password memory.");
249 }
250#endif
251
239 wl_list_init(&state.surfaces); 252 wl_list_init(&state.surfaces);
240 state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); 253 state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
241 state.display = wl_display_connect(NULL); 254 state.display = wl_display_connect(NULL);