Mlock stil
authorStiletto <blasux@blasux.ru>
Sun, 11 Dec 2011 11:31:06 +0300
branchstil
changeset 1537 c7a2261b5414
parent 1534 ff21639cb978
child 1538 6718f0ba24fd
Mlock
dwm.c
--- a/dwm.c	Tue Jun 14 07:29:06 2011 +0400
+++ b/dwm.c	Sun Dec 11 11:31:06 2011 +0300
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <X11/cursorfont.h>
@@ -1594,6 +1595,8 @@
 		if(dpy)
 			close(ConnectionNumber(dpy));
 		setsid();
+		if (munlockall())
+		    perror("munlockall()");
 		execvp(((char **)arg->v)[0], (char **)arg->v);
 		fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
 		perror(" failed");
@@ -2077,6 +2080,8 @@
 		fputs("warning: no locale support\n", stderr);
 	if(!(dpy = XOpenDisplay(NULL)))
 		die("dwm: cannot open display\n");
+	if (mlockall(MCL_CURRENT | MCL_FUTURE))
+		perror("mlockall()");
 	checkotherwm();
 	setup();
 	scan();