libc

my libc
git clone git://git.evenfri.pw/libc.git
Log | Files | Refs | README

getdents.c (344B)


      1 /*
      2  * getdents.c - get directory entries
      3  * Copyright (C) 2026. All rights reserved.
      4  */
      5 
      6 #include "libc.h"
      7 
      8 ssize_t getdents64(int fd, struct linux_dirent64 *dirp, size_t count) {
      9   long ret = syscall(SYS_getdents64, (long)fd, (long)dirp, (long)count, 0, 0, 0);
     10 
     11   if (ret < 0) {
     12     errno = -ret;
     13     return -1;
     14   }
     15 
     16   return (ssize_t)ret;
     17 }