[libc-commits] [PATCH] D78184: [libc] Add write(2) implementation for Linux and FDReader test utility

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 16 12:14:52 PDT 2020


sivachandra added a comment.

I have not read the `FDReader` implementation, but the rest of the change LG. I have couple comments though. I will do a final review once they are addressed.



================
Comment at: libc/config/linux/api.td:308
+
+def UniStdAPI : PublicAPI<"unistd.h"> {
+  let Functions = [
----------------
I think `write` is part of the POSIX standard. So, we should prefer to put this in the wider standard.


================
Comment at: libc/spec/posix.td:185
+          "write",
+          RetValSpec<SizeTType>, // TODO: this should be ssize_t from sys/types.h
+          [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
----------------
The POSIX standard says that `unistd.h` should define the `ssize_t` type. I think you should add the definition in this patch and use it. Since the standard expects multiple header files to define this type, you should put it in: https://github.com/llvm/llvm-project/blob/master/libc/include/__posix-types.h and "expose" the definition via `unistd.h`.


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

https://reviews.llvm.org/D78184





More information about the libc-commits mailing list