10main (
int argc,
char *argv[])
14 void *in_data = (
void *) 0x10000000;
15 void *out_data = (
void *) 0x20000000;
20 printf (
"usage: cp OLD NEW\n");
25 in_fd =
open (argv[1]);
28 printf (
"%s: open failed\n", argv[1]);
34 if (!
create (argv[2], size))
36 printf (
"%s: create failed\n", argv[2]);
39 out_fd =
open (argv[2]);
42 printf (
"%s: open failed\n", argv[2]);
47 in_map =
mmap (in_fd, in_data);
50 printf (
"%s: mmap failed\n", argv[1]);
53 out_map =
mmap (out_fd, out_data);
56 printf (
"%s: mmap failed\n", argv[2]);
61 memcpy (out_data, in_data, size);
int printf(const char *format,...)
Writes formatted output to the console.
mapid_t mmap(int fd, void *addr)
Project 3 and optionally project 4.
bool create(const char *file, unsigned initial_size)
int open(const char *file)
void munmap(mapid_t mapid)
#define EXIT_SUCCESS
Typical return values from main() and arguments to exit().
#define EXIT_FAILURE
Unsuccessful execution.
int mapid_t
Map region identifier.
int main(int argc, char *argv[])
mcp.c
void * memcpy(void *dst_, const void *src_, size_t size)
Copies SIZE bytes from SRC to DST, which must not overlap.