X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/bc34fd00d2e81fbc890bb2060ed6693454a230bf..db7fc030e9e04c881f5f12a0e23baa8db4e20ee1:/lunaix-os/kernel/demos/dir_read.c diff --git a/lunaix-os/kernel/demos/dir_read.c b/lunaix-os/kernel/demos/dir_read.c deleted file mode 100644 index caa88cc..0000000 --- a/lunaix-os/kernel/demos/dir_read.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include -#include - -LOG_MODULE("RDDIR") - -void -_readdir_main() -{ - int fd = open("/dev/./../dev/.", 0); - if (fd == -1) { - kprintf(KERROR "fail to open (%d)\n", geterrno()); - return; - } - - char path[129]; - int len = realpathat(fd, path, 128); - if (len < 0) { - kprintf(KERROR "fail to read (%d)\n", geterrno()); - } else { - path[len] = 0; - kprintf("%s\n", path); - } - - struct dirent ent = { .d_offset = 0 }; - - while (!readdir(fd, &ent)) { - kprintf(KINFO "%s\n", ent.d_name); - } - - close(fd); - - return; -} \ No newline at end of file