[libc-commits] [PATCH] D147738: [libc] Enable linux directory entries syscalls in riscv64

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Apr 26 09:50:03 PDT 2023


sivachandra added inline comments.


================
Comment at: libc/src/__support/File/dir.cpp:45
 
+#ifdef SYS_getdents64
   struct ::dirent *d = reinterpret_cast<struct ::dirent *>(buffer + readptr);
----------------
mikhail.ramalho wrote:
> sivachandra wrote:
> > This file is supposed to contain the platform independent implementation. Can we improve the platform abstraction to push variance within Linux into the Linux implementation?
> do you mean creating a linux/ dir with the `Dir::read()` implementation?
This file is a platform independent abstraction for the dirent API. So, all references to Linux pieces and variances should move to `linux_dir.cpp`. Which means that we should not have the `#ifdef` for Linux syscalls here. I have not looked in to it in detail, but what I was trying to say that, if are unable to fit these variances in the current platform abstraction, we should enhance the abstraction instead of leaking platform specific details in to this file.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147738/new/

https://reviews.llvm.org/D147738



More information about the libc-commits mailing list