Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 84 lines 1.9 kB view raw
1--- xxgdb-1.12-org/calldbx.c 2012-10-26 17:17:49.810750909 -0700 2+++ xxgdb-1.12/calldbx.c 2012-10-26 17:53:59.209918816 -0700 3@@ -69,6 +69,12 @@ 4 * create_io_window(): create an io window for gdb to use 5 */ 6 7+#ifdef linux 8+#ifndef _GNU_SOURCE 9+#define _GNU_SOURCE 10+#endif 11+#endif 12+ 13 #include <stdio.h> 14 #include <stdlib.h> 15 #include <string.h> 16@@ -126,6 +132,13 @@ 17 { 18 int master; 19 20+#ifdef _POSIX_SOURCE 21+ if ((master = posix_openpt (O_RDWR|O_NOCTTY)) < 0) { 22+ perror("posix_openpt failed:"); 23+ } else { 24+ return master; 25+ } 26+#else 27 #ifdef SVR4 /* (MJH) Use STREAMS */ 28 29 if((master = open(MASTER_CLONE, O_RDWR)) < 0) 30@@ -152,6 +165,7 @@ 31 } 32 #endif 33 #endif /* SVR4 */ 34+#endif /* _POSIX_SOURCE */ 35 36 #ifdef GDB 37 fprintf(stderr, "xxgdb: all ptys in use\n"); 38@@ -167,7 +181,28 @@ 39 { 40 int slave; 41 42-#ifdef SVR4 /* (MJH) */ 43+#ifdef _POSIX_SOURCE 44+ char *slave_name = ptsname (master); 45+ if (slave_name == NULL) { 46+ perror ("Pseudo-tty slave"); 47+ exit (2); 48+ } // end if 49+ if (grantpt (master) < 0) { 50+ perror ("grantpt error"); 51+ exit (3); 52+ } 53+ if (unlockpt (master) < 0) { 54+ perror ("unlockpt error"); 55+ exit (4); 56+ } 57+ if ((slave = open (slave_name, O_RDWR)) < 0) { 58+ perror (slave_name); 59+ exit (5); 60+ } // end if 61+ return slave; 62+#else 63+#ifdef SVR4 64+ /* (MJH) */ 65 char *slave_name = "unknown"; 66 extern char *ptsname(int master); 67 void (*handler)(); 68@@ -194,6 +229,7 @@ 69 } 70 return slave; 71 #endif /* SVR4 */ 72+#endif /* _POSIX_SOURCE */ 73 } 74 75 #ifdef CREATE_IO_WINDOW 76@@ -230,7 +266,7 @@ 77 { 78 /* child */ 79 /* printf("xterm xterm -l -e xxgdbiowin\n");*/ 80- if (execlp("xterm", "xterm", "-e", "xxgdbiowin", 0)) 81+ if (execlp("xterm", "xterm", "-e", "xxgdbiowin", NULL)) 82 { 83 printf("exec of 'xterm -e xxgdbiowin' fails\n"); 84 unlink("/tmp/iowindowtty");