diff options
| author | Alexander Langer <alex@FreeBSD.org> | 1997-01-16 21:58:40 +0000 |
|---|---|---|
| committer | Alexander Langer <alex@FreeBSD.org> | 1997-01-16 21:58:40 +0000 |
| commit | 8abdc2eb40c03b97153f2a01bdb53927f3a336c1 (patch) | |
| tree | d61898dd79824c10ca33127214d8569c804559c2 /usr.bin | |
| parent | 839cc09e5384e6f8c0ebb9203052015b532cfce7 (diff) | |
Notes
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/cmp/regular.c | 4 | ||||
| -rw-r--r-- | usr.bin/locate/locate/locate.c | 2 | ||||
| -rw-r--r-- | usr.bin/look/look.c | 2 | ||||
| -rw-r--r-- | usr.bin/strip/strip.c | 2 | ||||
| -rw-r--r-- | usr.bin/tail/forward.c | 2 | ||||
| -rw-r--r-- | usr.bin/tail/reverse.c | 2 | ||||
| -rw-r--r-- | usr.bin/xinstall/xinstall.c | 10 | ||||
| -rw-r--r-- | usr.bin/xlint/lint1/mem1.c | 2 | ||||
| -rw-r--r-- | usr.bin/xlint/lint2/mem2.c | 2 |
9 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index 5d301fad6bb92..f540ab4aebe8a 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -80,12 +80,12 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2) return (c_special(fd1, file1, skip1, fd2, file2, skip2)); if ((p1 = (u_char *)mmap(NULL, - (size_t)length, PROT_READ, 0, fd1, off1)) == (u_char *)-1) + (size_t)length, PROT_READ, MAP_SHARED, fd1, off1)) == (u_char *)MAP_FAILED) err(ERR_EXIT, "%s", file1); madvise(p1, length, MADV_SEQUENTIAL); if ((p2 = (u_char *)mmap(NULL, - (size_t)length, PROT_READ, 0, fd2, off2)) == (u_char *)-1) + (size_t)length, PROT_READ, MAP_SHARED, fd2, off2)) == (u_char *)MAP_FAILED) err(ERR_EXIT, "%s", file2); madvise(p2, length, MADV_SEQUENTIAL); diff --git a/usr.bin/locate/locate/locate.c b/usr.bin/locate/locate/locate.c index 427d49d2ed573..791c3eba6b701 100644 --- a/usr.bin/locate/locate/locate.c +++ b/usr.bin/locate/locate/locate.c @@ -301,7 +301,7 @@ search_mmap(db, s) if ((p = mmap((caddr_t)0, (size_t)len, PROT_READ, MAP_SHARED, - fd, (off_t)0)) == (caddr_t)-1) + fd, (off_t)0)) == MAP_FAILED) err(1, "mmap ``%s''", path_fcodes); /* foreach search string ... */ diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c index e2bd95285e4e9..daef12fd4361a 100644 --- a/usr.bin/look/look.c +++ b/usr.bin/look/look.c @@ -143,7 +143,7 @@ main(argc, argv) if (sb.st_size > SIZE_T_MAX) err("%s: %s", file, strerror(EFBIG)); if ((front = mmap(NULL, - (size_t)sb.st_size, PROT_READ, 0, fd, (off_t)0)) == NULL) + (size_t)sb.st_size, PROT_READ, MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) err("%s: %s", file, strerror(errno)); back = front + sb.st_size; exit(look(string, front, back)); diff --git a/usr.bin/strip/strip.c b/usr.bin/strip/strip.c index 8fe4c49a2f4d2..36f14c26d6c4c 100644 --- a/usr.bin/strip/strip.c +++ b/usr.bin/strip/strip.c @@ -173,7 +173,7 @@ s_stab(fn, fd, ep) /* Map the file. */ if ((ep = (EXEC *)mmap(NULL, (size_t)sb.st_size, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)0)) == (EXEC *)-1) { + PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)0)) == (EXEC *)MAP_FAILED) { err(0, "%s: %s", fn, strerror(errno)); return; } diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index 4b22eefddf089..b9457afbb0cff 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -210,7 +210,7 @@ rlines(fp, off, sbp) } if ((start = mmap(NULL, (size_t)size, - PROT_READ, 0, fileno(fp), (off_t)0)) == (caddr_t)-1) { + PROT_READ, MAP_SHARED, fileno(fp), (off_t)0)) == MAP_FAILED) { ierr(); return; } diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index 2653add72cd3d..0a07f4f1bdcb0 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -125,7 +125,7 @@ r_reg(fp, style, off, sbp) } if ((start = mmap(NULL, (size_t)size, - PROT_READ, 0, fileno(fp), (off_t)0)) == (caddr_t)-1) { + PROT_READ, MAP_SHARED, fileno(fp), (off_t)0)) == MAP_FAILED) { ierr(); return; } diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 9a2a9918b66ec..0148958f7e7ec 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -513,11 +513,11 @@ compare(int from_fd, const char *from_name, int to_fd, const char *to_name, if (tsize <= 8 * 1024 * 1024) { done_compare = 0; if (trymmap(from_fd) && trymmap(to_fd)) { - p = mmap(NULL, tsize, PROT_READ, 0, from_fd, (off_t)0); - if ((long)p == -1) + p = mmap(NULL, tsize, PROT_READ, MAP_SHARED, from_fd, (off_t)0); + if (p == (char *)MAP_FAILED) goto out; - q = mmap(NULL, tsize, PROT_READ, 0, to_fd, (off_t)0); - if ((long)q == -1) { + q = mmap(NULL, tsize, PROT_READ, MAP_SHARED, to_fd, (off_t)0); + if (q == (char *)MAP_FAILED) { munmap(p, tsize); goto out; } @@ -581,7 +581,7 @@ copy(from_fd, from_name, to_fd, to_name, size) done_copy = 0; if (size <= 8 * 1048576 && trymmap(from_fd)) { if ((p = mmap(NULL, (size_t)size, PROT_READ, - 0, from_fd, (off_t)0)) == (char *)-1) + MAP_SHARED, from_fd, (off_t)0)) == (char *)MAP_FAILED) goto out; if ((nw = write(to_fd, p, size)) != size) { serrno = errno; diff --git a/usr.bin/xlint/lint1/mem1.c b/usr.bin/xlint/lint1/mem1.c index df880b1337381..f3bf3c6a9a6bb 100644 --- a/usr.bin/xlint/lint1/mem1.c +++ b/usr.bin/xlint/lint1/mem1.c @@ -180,7 +180,7 @@ xnewblk() prot = PROT_READ | PROT_WRITE; flags = MAP_ANON | MAP_PRIVATE; mb->blk = mmap(NULL, mblklen, prot, flags, -1, (off_t)0); - if (mb->blk == (void *)-1) + if (mb->blk == (void *)MAP_FAILED) err(1, "can't map memory"); if (ALIGN((u_long)mb->blk) != (u_long)mb->blk) errx(1, "mapped address is not aligned"); diff --git a/usr.bin/xlint/lint2/mem2.c b/usr.bin/xlint/lint2/mem2.c index 06d749153ed8f..ed97c6fc20f4b 100644 --- a/usr.bin/xlint/lint2/mem2.c +++ b/usr.bin/xlint/lint2/mem2.c @@ -82,7 +82,7 @@ xalloc(sz) prot = PROT_READ | PROT_WRITE; flags = MAP_ANON | MAP_PRIVATE; mbuf = mmap(NULL, mblklen, prot, flags, -1, (off_t)0); - if (mbuf == (void *)-1) + if (mbuf == (void *)MAP_FAILED) err(1, "can't map memory"); if (ALIGN((u_long)mbuf) != (u_long)mbuf) errx(1, "mapped address is not aligned"); |
