svn commit: r282072 - head/tools/regression/p1003_1b

Garrett Cooper ngie at FreeBSD.org
Mon Apr 27 08:34:48 UTC 2015


Author: ngie
Date: Mon Apr 27 08:34:46 2015
New Revision: 282072
URL: https://svnweb.freebsd.org/changeset/base/282072

Log:
  - Fix compilation (MAP_INHERIT's dead)
  - Fix warnings
  - Use mkstemp instead of tmpnam
  
  MFC after: 1 week

Modified:
  head/tools/regression/p1003_1b/Makefile
  head/tools/regression/p1003_1b/fifo.c
  head/tools/regression/p1003_1b/sched.c
  head/tools/regression/p1003_1b/yield.c
Directory Properties:
  head/   (props changed)

Modified: head/tools/regression/p1003_1b/Makefile
==============================================================================
--- head/tools/regression/p1003_1b/Makefile	Mon Apr 27 08:31:43 2015	(r282071)
+++ head/tools/regression/p1003_1b/Makefile	Mon Apr 27 08:34:46 2015	(r282072)
@@ -14,4 +14,5 @@ SRCS=\
 MAN=
 
 CFLAGS+=-DNO_MEMLOCK
+
 .include <bsd.prog.mk>

Modified: head/tools/regression/p1003_1b/fifo.c
==============================================================================
--- head/tools/regression/p1003_1b/fifo.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ head/tools/regression/p1003_1b/fifo.c	Mon Apr 27 08:34:46 2015	(r282072)
@@ -31,17 +31,17 @@
  *
  * $FreeBSD$
  */
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <err.h>
-#include <fcntl.h>
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/time.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
 #include <sched.h>
 #include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
 
 volatile int ticked;
 #define CAN_USE_ALARMS
@@ -109,7 +109,7 @@ int fifo(int argc, char *argv[])
 	fifo_param.sched_priority = 1;
 
 	p = (long *)mmap(0, sizeof(*p),
-	PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED|MAP_INHERIT, -1, 0);
+	PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
 
 	if (p == (long *)-1)
 		err(errno, "mmap");

Modified: head/tools/regression/p1003_1b/sched.c
==============================================================================
--- head/tools/regression/p1003_1b/sched.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ head/tools/regression/p1003_1b/sched.c	Mon Apr 27 08:34:46 2015	(r282072)
@@ -41,16 +41,17 @@
 #define _POSIX_SOURCE
 #define _POSIX_C_SOURCE 199309L
 
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-#include <string.h>
+#include <sys/mman.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <sys/mman.h>
-
+#include <limits.h>
 #include <sched.h>
+#include <stdio.h>
+#define	__XSI_VISIBLE 1
+#include <stdlib.h>
+#undef __XSI_VISIBLE
+#include <string.h>
+#include <unistd.h>
 
 #include "prutil.h"
 
@@ -209,17 +210,14 @@ int sched(int ac, char *av[])
 
 
 	{
-#define NAM "P1003_1b_schedXXXX"
-		char nam[L_tmpnam];
+		char nam[] = "P1003_1b_schedXXXXXX";
 		int fd;
 		pid_t p;
 		pid_t *lastrun;
 
-		strcpy(nam, NAM);
-		if (tmpnam(nam) != nam)
-			q(__LINE__, errno, "tmpnam " NAM);
-		q(__LINE__, (fd = open(nam, O_RDWR|O_CREAT, 0666)),
-			"open " NAM);
+		fd = mkstemp(nam);
+		if (fd == -1)
+			q(__LINE__, errno, "mkstemp failed");
 
 		(void)unlink(nam);
 

Modified: head/tools/regression/p1003_1b/yield.c
==============================================================================
--- head/tools/regression/p1003_1b/yield.c	Mon Apr 27 08:31:43 2015	(r282071)
+++ head/tools/regression/p1003_1b/yield.c	Mon Apr 27 08:34:46 2015	(r282072)
@@ -89,7 +89,7 @@ int yield(int argc, char *argv[])
 		n = nslaves = atoi(argv[1]);
 
 	p = (int *)mmap(0, sizeof(int),
-	PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED|MAP_INHERIT, -1, 0);
+	PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
 
 	if (p == (int *)-1)
 		err(errno, "mmap");


More information about the svn-src-all mailing list