[clang] [clang][MBD] set up module build daemon infrastructure (PR #67562)

Connor Sughrue via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 20:33:37 PDT 2023


================
@@ -0,0 +1,18 @@
+// Check that clang invocation can spawn and handshake with module build daemon
+
+// REQUIRES: !system-windows
+
+//  RUN: if pgrep -f "cc1modbuildd mbd-handshake"; then pkill -f "cc1modbuildd mbd-handshake"; fi
+//  RUN: rm -rf mbd-handshake %t
----------------
cpsughrue wrote:

Looks like the header file `un.h`, provided by glibc-headers-2.34-60.el9.x86_64, sets the max unix socket address length to 108 characters.

```cpp
// /usr/include/sys/un.h
/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket.  */
struct sockaddr_un
  {
    __SOCKADDR_COMMON (sun_);
    char sun_path[108];		/* Path name.  */
  };
```

`%t` results in a socket address of `/home/cpsughrue/repos/llvm-project-fork/build/tools/clang/test/ModuleBuildDaemon/Output/handshake.c.tmp/mbd.sock` which is 112 characters. So, in this case, the clang invocation looks to communicate over `mbd.sock` under `/home/cpsughrue/repos/llvm-project-fork/build/tools/clang/test/ModuleBuildDaemon/Output/handshake.c.tmp` but the daemon chops off `.sock` and creates the address `mbd`. 

I can shorten the file name to `hand.c` or use `-fmodule-build-daemon=handshake-mbd` which places the socket file at `llvm-project/build/tools/clang/test/ModuleBuildDaemon/handshake-mbd/mbd.sock`. Any preference?

https://github.com/llvm/llvm-project/pull/67562


More information about the cfe-commits mailing list