summaryrefslogtreecommitdiffstats
path: root/share/examples/meteor
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>1997-01-16 21:58:40 +0000
committeralex <alex@FreeBSD.org>1997-01-16 21:58:40 +0000
commita3118e8c6826349b3fc54da3850d6dea994a3a35 (patch)
treed61898dd79824c10ca33127214d8569c804559c2 /share/examples/meteor
parent752ba4d26f2e94cc31940f50407a6b18b86ee0e8 (diff)
downloadFreeBSD-src-a3118e8c6826349b3fc54da3850d6dea994a3a35.zip
FreeBSD-src-a3118e8c6826349b3fc54da3850d6dea994a3a35.tar.gz
Sweep through the tree fixing mmap() usage:
- Use MAP_FAILED instead of the constant -1 to indicate failure (required by POSIX). - Removed flag arguments of '0' (required by POSIX). - Fixed code which expected an error return of 0. - Fixed code which thought any address with the high bit set was an error. - Check for failure where no checks were present. Discussed with: bde
Diffstat (limited to 'share/examples/meteor')
-rw-r--r--share/examples/meteor/rgb16.c4
-rw-r--r--share/examples/meteor/test-n.c4
-rw-r--r--share/examples/meteor/yuvpk.c4
-rw-r--r--share/examples/meteor/yuvpl.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/share/examples/meteor/rgb16.c b/share/examples/meteor/rgb16.c
index 17b1592..4c7ee07 100644
--- a/share/examples/meteor/rgb16.c
+++ b/share/examples/meteor/rgb16.c
@@ -77,9 +77,9 @@ main()
exit(1);
}
- rgb16 = (short *)mmap((caddr_t)0,SIZE,PROT_READ,0, i, (off_t)0);
+ rgb16 = (short *)mmap((caddr_t)0,SIZE,PROT_READ,MAP_SHARED, i, (off_t)0);
- if (rgb16 == (short *) -1) return (0);
+ if (rgb16 == (short *) MAP_FAILED) return (0);
c = METEOR_CAP_SINGLE ;
ioctl(i, METEORCAPTUR, &c);
diff --git a/share/examples/meteor/test-n.c b/share/examples/meteor/test-n.c
index f899033..4651654 100644
--- a/share/examples/meteor/test-n.c
+++ b/share/examples/meteor/test-n.c
@@ -127,9 +127,9 @@ main()
printf("mmap %d %d\n", errno, i);
size = ((width*height*depth*frames+4095)/4096)*4096;
- y=(uint8 *) mmap((caddr_t)0, size + 4096, PROT_READ |PROT_WRITE,0, i, (off_t)0);
+ y=(uint8 *) mmap((caddr_t)0, size + 4096, PROT_READ |PROT_WRITE,MAP_SHARED, i, (off_t)0);
- if (y == (uint8 *) -1) return (0);
+ if (y == (uint8 *) MAP_FAILED) return (0);
common_mem = (struct meteor_mem *) (y + size);
diff --git a/share/examples/meteor/yuvpk.c b/share/examples/meteor/yuvpk.c
index b2941e0..6ebd2e4 100644
--- a/share/examples/meteor/yuvpk.c
+++ b/share/examples/meteor/yuvpk.c
@@ -81,9 +81,9 @@ main()
exit(1);
}
- yuv_data = (uint8 *)mmap((caddr_t)0,SIZE,PROT_READ,0, i, (off_t)0);
+ yuv_data = (uint8 *)mmap((caddr_t)0,SIZE,PROT_READ,MAP_SHARED, i, (off_t)0);
- if (yuv_data == (int8 *) -1) return (0);
+ if (yuv_data == (int8 *) MAP_FAILED) return (0);
c = METEOR_CAP_SINGLE ;
ioctl(i, METEORCAPTUR, &c);
diff --git a/share/examples/meteor/yuvpl.c b/share/examples/meteor/yuvpl.c
index 243644d..704dfce 100644
--- a/share/examples/meteor/yuvpl.c
+++ b/share/examples/meteor/yuvpl.c
@@ -84,9 +84,9 @@ main()
exit(1);
}
- yuv_data = (uint8 *)mmap((caddr_t)0,SIZE,PROT_READ,0, i, (off_t)0);
+ yuv_data = (uint8 *)mmap((caddr_t)0,SIZE,PROT_READ,MAP_SHARED, i, (off_t)0);
- if (yuv_data == (uint8 *) -1) return (0);
+ if (yuv_data == (uint8 *) MAP_FAILED) return (0);
temp = ROWS * COLS;
ue = yuv_data + temp;
OpenPOWER on IntegriCloud