/proc/self

This commit is contained in:
Kevin Lange 2017-01-22 19:23:19 +09:00
parent 71713a3506
commit ae19b8479e

View File

@ -415,7 +415,15 @@ static struct dirent * readdir_procfs_root(fs_node_t *node, uint32_t index) {
return out;
}
index -= 2;
if (index == 3) {
struct dirent * out = malloc(sizeof(struct dirent));
memset(out, 0x00, sizeof(struct dirent));
out->ino = 0;
strcpy(out->name, "self");
return out;
}
index -= 3;
if (index < PROCFS_STANDARD_ENTRIES) {
struct dirent * out = malloc(sizeof(struct dirent));
@ -466,6 +474,10 @@ static fs_node_t * finddir_procfs_root(fs_node_t * node, char * name) {
return out;
}
if (!strcmp(name,"self")) {
return procfs_procdir_create(current_process->id);
}
for (unsigned int i = 0; i < PROCFS_STANDARD_ENTRIES; ++i) {
if (!strcmp(name, std_entries[i].name)) {
fs_node_t * out = procfs_generic_create(std_entries[i].name, std_entries[i].func);