update gitignore
fix: localize the code for current system environment
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
rootfs/
|
||||||
|
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
|
||||||
|
container-from-scratch
|
||||||
|
|
||||||
+28
-13
@@ -22,6 +22,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
@@ -142,6 +143,31 @@ int mounts(struct child_config *config)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "done.\n");
|
fprintf(stderr, "done.\n");
|
||||||
|
|
||||||
|
fprintf(stderr, "=> mounting /proc...");
|
||||||
|
if (mount("proc", "/proc", "proc", 0, NULL)) {
|
||||||
|
fprintf(stderr, "failed: %m\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fprintf(stderr, "done.\n");
|
||||||
|
|
||||||
|
fprintf(stderr, "=> mounting /dev...");
|
||||||
|
if (mount("tmpfs", "/dev", "tmpfs", MS_NOSUID | MS_STRICTATIME, "mode=755,size=65536k")) {
|
||||||
|
fprintf(stderr, "failed: %m\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
umask(0);
|
||||||
|
if (mknod("/dev/null", S_IFCHR | 0666, makedev(1, 3))) {
|
||||||
|
fprintf(stderr, "mknod null failed: %m\n");
|
||||||
|
}
|
||||||
|
if (mknod("/dev/zero", S_IFCHR | 0666, makedev(1, 5))) {
|
||||||
|
fprintf(stderr, "mknod zero failed: %m\n");
|
||||||
|
}
|
||||||
|
if (mknod("/dev/urandom", S_IFCHR | 0666, makedev(1, 9))) {
|
||||||
|
fprintf(stderr, "mknod urandom failed: %m\n");
|
||||||
|
}
|
||||||
|
fprintf(stderr, "done.\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,17 +274,6 @@ struct cgrp_control *cgrps[] = {
|
|||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
& (struct cgrp_control) {
|
|
||||||
.control = "blkio",
|
|
||||||
.settings = (struct cgrp_setting *[]) {
|
|
||||||
& (struct cgrp_setting) {
|
|
||||||
.name = "blkio.weight",
|
|
||||||
.value = PIDS
|
|
||||||
},
|
|
||||||
&add_to_tasks,
|
|
||||||
NULL
|
|
||||||
}
|
|
||||||
},
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
int resources(struct child_config *config)
|
int resources(struct child_config *config)
|
||||||
@@ -504,8 +519,8 @@ finish_options:
|
|||||||
fprintf(stderr, "weird release format: %s\n", host.release);
|
fprintf(stderr, "weird release format: %s\n", host.release);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (major != 4 || (minor != 7 && minor != 8)) {
|
if (major < 4 || (major == 4 && minor < 7)) {
|
||||||
fprintf(stderr, "expected 4.7.x or 4.8.x: %s\n", host.release);
|
fprintf(stderr, "kernel too old: %s (need >= 4.7)\n", host.release);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (strcmp("x86_64", host.machine)) {
|
if (strcmp("x86_64", host.machine)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user