summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-12-16 22:59:06 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-12-16 22:59:06 +0000
commit3f210fc0c8b6038639d03f67353294da459d9a33 (patch)
treeda75e00500748832f69ffe5b85874bbb8548456e /llvm/lib/Support/raw_ostream.cpp
parent66834ec6e19a7ea0f2fe7654a3395c67ff6efcd1 (diff)
downloadbcm5719-llvm-3f210fc0c8b6038639d03f67353294da459d9a33.tar.gz
bcm5719-llvm-3f210fc0c8b6038639d03f67353294da459d9a33.zip
Drop an unnecessary use of writev.
It looks like the code this patch deletes is based on a misunderstanding of what guarantees writev provides. In particular, writev with 1 iovec is not "more atomic" than a write. Testing on OS X shows that both write and writev from multiple processes can be intermixed. llvm-svn: 255837
Diffstat (limited to 'llvm/lib/Support/raw_ostream.cpp')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 49ef400c5f2..57c7ac32f55 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -517,7 +517,7 @@ raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC,
/// closes the file when the stream is destroyed.
raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered)
: raw_pwrite_stream(unbuffered), FD(fd), ShouldClose(shouldClose),
- Error(false), UseAtomicWrites(false) {
+ Error(false) {
if (FD < 0 ) {
ShouldClose = false;
return;
@@ -568,21 +568,7 @@ void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
pos += Size;
do {
- ssize_t ret;
-
- // Check whether we should attempt to use atomic writes.
- if (LLVM_LIKELY(!UseAtomicWrites)) {
- ret = ::write(FD, Ptr, Size);
- } else {
- // Use ::writev() where available.
-#if defined(HAVE_WRITEV)
- const void *Addr = static_cast<const void *>(Ptr);
- struct iovec IOV = {const_cast<void *>(Addr), Size };
- ret = ::writev(FD, &IOV, 1);
-#else
- ret = ::write(FD, Ptr, Size);
-#endif
- }
+ ssize_t ret = ::write(FD, Ptr, Size);
if (ret < 0) {
// If it's a recoverable error, swallow it and retry the write.
OpenPOWER on IntegriCloud