init commit

This commit is contained in:
2025-04-13 21:48:15 +03:00
commit 23255e9121
192 changed files with 12200 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int
main(int argc, char *argv[])
{
int fdin = open(argv[1], O_RDONLY);
int fdout = open(argv[2], O_RDWR | O_CREAT, 0666);
off_t len = lseek(fdin, 0, SEEK_END);
char *fin = mmap(NULL, len, PROT_READ, MAP_SHARED, fdin, 0);
ftruncate(fdout, len);
char *fout = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fdout, 0);
memcpy(fout, fin, len);
close(fdin);
close(fdout);
munmap(fin, len);
munmap(fout, len);
return 0;
}