[PATCH] D55576: [libcxx] [test] [support] Use socket()+bind() to create unix sockets portably
Michał Górny via Phabricator
reviews at reviews.llvm.org
Tue Dec 11 13:27:15 PST 2018
mgorny created this revision.
mgorny added reviewers: EricWF, krytarowski.
Herald added subscribers: libcxx-commits, ldionne, emaste.
Replace the mknod() call with socket() + bind() for creating unix
sockets. The mknod() method is not portable and does not work
on NetBSD while binding the socket should work on all systems supporting
// NB: I think this should solve the issues w/ FreeBSD/Darwin too but I don't have those systems to test
@@ -1,5 +1,6 @@
# Ensure that this is being run on a specific platform
@@ -76,8 +77,13 @@
- mode = 0o600 | stat.S_IFSOCK
- os.mknod(sanitize(source), mode)
+ sock = socket.socket(socket.AF_UNIX)
+ sanitized_source = sanitize(source)
+ # AF_UNIX sockets may have very limited path length, so split it
+ # into chdir call (with technically unlimited length) followed
+ # by bind() relative to the directory
if __name__ == '__main__':
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 868 bytes
Desc: not available
More information about the libcxx-commits