Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Side by Side Diff: runtime/bin/file_macos.cc

Issue 1883293005: Allow opening a named pipe on MacOS and Linux. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <copyfile.h> // NOLINT 10 #include <copyfile.h> // NOLINT
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) { 151 File* File::FileOpenW(const wchar_t* system_name, FileOpenMode mode) {
152 UNREACHABLE(); 152 UNREACHABLE();
153 return NULL; 153 return NULL;
154 } 154 }
155 155
156 156
157 File* File::ScopedOpen(const char* name, FileOpenMode mode) { 157 File* File::ScopedOpen(const char* name, FileOpenMode mode) {
158 // Report errors for non-regular files. 158 // Report errors for non-regular files.
159 struct stat st; 159 struct stat st;
160 if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { 160 if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
161 // Only accept regular files and character devices. 161 // Only accept regular files and character devices.
rmacnak 2016/04/15 17:17:30 "
zra 2016/04/15 18:19:14 Done.
162 if (!S_ISREG(st.st_mode) && !S_ISCHR(st.st_mode)) { 162 if (!S_ISREG(st.st_mode) && !S_ISCHR(st.st_mode) && !S_ISFIFO(st.st_mode)) {
163 errno = (S_ISDIR(st.st_mode)) ? EISDIR : ENOENT; 163 errno = (S_ISDIR(st.st_mode)) ? EISDIR : ENOENT;
164 return NULL; 164 return NULL;
165 } 165 }
166 } 166 }
167 int flags = O_RDONLY; 167 int flags = O_RDONLY;
168 if ((mode & kWrite) != 0) { 168 if ((mode & kWrite) != 0) {
169 ASSERT((mode & kWriteOnly) == 0); 169 ASSERT((mode & kWriteOnly) == 0);
170 flags = (O_RDWR | O_CREAT); 170 flags = (O_RDWR | O_CREAT);
171 } 171 }
172 if ((mode & kWriteOnly) != 0) { 172 if ((mode & kWriteOnly) != 0) {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return ((file_1_info.st_ino == file_2_info.st_ino) && 462 return ((file_1_info.st_ino == file_2_info.st_ino) &&
463 (file_1_info.st_dev == file_2_info.st_dev)) ? 463 (file_1_info.st_dev == file_2_info.st_dev)) ?
464 File::kIdentical : 464 File::kIdentical :
465 File::kDifferent; 465 File::kDifferent;
466 } 466 }
467 467
468 } // namespace bin 468 } // namespace bin
469 } // namespace dart 469 } // namespace dart
470 470
471 #endif // defined(TARGET_OS_MACOS) 471 #endif // defined(TARGET_OS_MACOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698