1 /* Copyright (c) 2010 Intel Corporation
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation; version 2 of the License
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * You should have received a copy of the GNU General Public License along
13 * with this program; if not, write to the Free Software Foundation, Inc., 59
14 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include <sys/signal.h>
30 int main(int argc, char *argv[])
44 fd = open(argv[1], O_RDWR|O_TRUNC|O_CREAT, 0666);
46 fprintf(stderr, "%s: Cannot open `%s': %s\n",
47 progname, argv[1], strerror(errno));
51 if ((ret = pwrite(fd, (const char *)cc,
57 mapped_mem = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
58 if (mapped_mem == MAP_FAILED) {
62 printf("pwrite %Ld bytes from %Ld to %Ld\n",
63 (long long) amount, (long long) from, (long long) to);
65 ret = pwrite(fd, (char *)mapped_mem + from, amount, to);