From a39b8b86f7608fd32f1890fd08fd7080d82a5db8 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Mon, 27 Apr 2015 08:34:46 +0000 Subject: - Fix compilation (MAP_INHERIT's dead) - Fix warnings - Use mkstemp instead of tmpnam MFC after: 1 week --- tools/regression/p1003_1b/Makefile | 1 + tools/regression/p1003_1b/fifo.c | 14 +++++++------- tools/regression/p1003_1b/sched.c | 26 ++++++++++++-------------- tools/regression/p1003_1b/yield.c | 2 +- 4 files changed, 21 insertions(+), 22 deletions(-) (limited to 'tools/regression') diff --git a/tools/regression/p1003_1b/Makefile b/tools/regression/p1003_1b/Makefile index 8cf7d5a6d783..902666c2ec39 100644 --- a/tools/regression/p1003_1b/Makefile +++ b/tools/regression/p1003_1b/Makefile @@ -14,4 +14,5 @@ SRCS=\ MAN= CFLAGS+=-DNO_MEMLOCK + .include diff --git a/tools/regression/p1003_1b/fifo.c b/tools/regression/p1003_1b/fifo.c index 455f7f9adc5f..925e7c21368e 100644 --- a/tools/regression/p1003_1b/fifo.c +++ b/tools/regression/p1003_1b/fifo.c @@ -31,17 +31,17 @@ * * $FreeBSD$ */ -#include -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include #include #include +#include +#include +#include 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"); diff --git a/tools/regression/p1003_1b/sched.c b/tools/regression/p1003_1b/sched.c index bd978f8d4942..1814c79194e4 100644 --- a/tools/regression/p1003_1b/sched.c +++ b/tools/regression/p1003_1b/sched.c @@ -41,16 +41,17 @@ #define _POSIX_SOURCE #define _POSIX_C_SOURCE 199309L -#include -#include - -#include -#include +#include #include #include -#include - +#include #include +#include +#define __XSI_VISIBLE 1 +#include +#undef __XSI_VISIBLE +#include +#include #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); diff --git a/tools/regression/p1003_1b/yield.c b/tools/regression/p1003_1b/yield.c index ac31a99f250a..a9b7badb3452 100644 --- a/tools/regression/p1003_1b/yield.c +++ b/tools/regression/p1003_1b/yield.c @@ -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"); -- cgit v1.2.3