Date: Sun, 13 Jun 1999 21:22:00 -0400 From: "David E. Cross" <crossd@cs.rpi.edu> To: The Hermit Hacker <scrappy@hub.org> Cc: Matthew Dillon <dillon@apollo.backplane.com>, "David E. Cross" <crossd@cs.rpi.edu>, freebsd-current@FreeBSD.ORG, freebsd-stable@FreeBSD.ORG, crossd@cs.rpi.edu Subject: Re: MMAP() in STABLE/CURRENT ... Message-ID: <199906140122.VAA02659@cs.rpi.edu> In-Reply-To: Message from The Hermit Hacker <scrappy@hub.org> of "Sun, 13 Jun 1999 22:02:13 -0300." <Pine.BSF.4.05.9906132201400.49155-100000@thelab.hub.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Here's the code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/mman.h>
#define DBSIZE 733055625
int main(void)
{
int fd;
unsigned char *dbp;
fd=open(argv[1], O_CREAT | O_RDWR | O_TRUNC, 0600);
lseek(fd, DBSIZE -1, SEEK_SET);
write(fd, &fd, 1);
dbp=mmap(NULL, DBSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
close (fd);
memset(dbp, 0, DBSIZE);
munmap(dbp, DBSIZE);
return 0;
}
}
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906140122.VAA02659>
