1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2010 Intel Corporation
18 int main(int argc, char *argv[])
32 fd = open(argv[1], O_RDWR|O_TRUNC|O_CREAT, 0666);
34 fprintf(stderr, "%s: Cannot open `%s': %s\n",
35 progname, argv[1], strerror(errno));
39 if ((ret = pwrite(fd, (const char *)cc,
45 mapped_mem = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
46 if (mapped_mem == MAP_FAILED) {
50 printf("pwrite %Ld bytes from %Ld to %Ld\n",
51 (long long) amount, (long long) from, (long long) to);
53 ret = pwrite(fd, (char *)mapped_mem + from, amount, to);