[libc-commits] [PATCH] D151377: [libc][darwin] Add OSUtil for darwin arm64 target so that unit tests can be run.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 25 16:04:07 PDT 2023


lntue added inline comments.


================
Comment at: libc/src/__support/OSUtil/darwin/io.h:18
+LIBC_INLINE void write_to_stderr(cpp::string_view msg) {
+  __llvm_libc::syscall_impl(4 /*SYS_write*/, 2 /* stderr */,
+                            reinterpret_cast<long>(msg.data()), msg.size());
----------------
michaelrj wrote:
> can we use the macro name if we include `<sys/syscall.h>`?
The syscall in macOS is a bit tricky.  Technically they are not public API in macOS, since you are supposed to make syscalls via the system libc syscall wrappers.  So the system header `sys/syscall.h` is not guaranteed to be available.  On the other hand, these low numbered syscalls are matched with Unix and barely changed, so it is kind of safe to call these.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151377



More information about the libc-commits mailing list