dwm.c
branchstil
changeset 1537 c7a2261b5414
parent 1534 ff21639cb978
child 1538 6718f0ba24fd
equal deleted inserted replaced
1534:ff21639cb978 1537:c7a2261b5414
    26 #include <signal.h>
    26 #include <signal.h>
    27 #include <stdio.h>
    27 #include <stdio.h>
    28 #include <stdlib.h>
    28 #include <stdlib.h>
    29 #include <string.h>
    29 #include <string.h>
    30 #include <unistd.h>
    30 #include <unistd.h>
       
    31 #include <sys/mman.h>
    31 #include <sys/types.h>
    32 #include <sys/types.h>
    32 #include <sys/wait.h>
    33 #include <sys/wait.h>
    33 #include <X11/cursorfont.h>
    34 #include <X11/cursorfont.h>
    34 #include <X11/keysym.h>
    35 #include <X11/keysym.h>
    35 #include <X11/Xatom.h>
    36 #include <X11/Xatom.h>
  1592 spawn(const Arg *arg) {
  1593 spawn(const Arg *arg) {
  1593 	if(fork() == 0) {
  1594 	if(fork() == 0) {
  1594 		if(dpy)
  1595 		if(dpy)
  1595 			close(ConnectionNumber(dpy));
  1596 			close(ConnectionNumber(dpy));
  1596 		setsid();
  1597 		setsid();
       
  1598 		if (munlockall())
       
  1599 		    perror("munlockall()");
  1597 		execvp(((char **)arg->v)[0], (char **)arg->v);
  1600 		execvp(((char **)arg->v)[0], (char **)arg->v);
  1598 		fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
  1601 		fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
  1599 		perror(" failed");
  1602 		perror(" failed");
  1600 		exit(0);
  1603 		exit(0);
  1601 	}
  1604 	}
  2075 		die("usage: dwm [-v]\n");
  2078 		die("usage: dwm [-v]\n");
  2076 	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
  2079 	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
  2077 		fputs("warning: no locale support\n", stderr);
  2080 		fputs("warning: no locale support\n", stderr);
  2078 	if(!(dpy = XOpenDisplay(NULL)))
  2081 	if(!(dpy = XOpenDisplay(NULL)))
  2079 		die("dwm: cannot open display\n");
  2082 		die("dwm: cannot open display\n");
       
  2083 	if (mlockall(MCL_CURRENT | MCL_FUTURE))
       
  2084 		perror("mlockall()");
  2080 	checkotherwm();
  2085 	checkotherwm();
  2081 	setup();
  2086 	setup();
  2082 	scan();
  2087 	scan();
  2083 	run();
  2088 	run();
  2084 	cleanup();
  2089 	cleanup();