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

Unified Diff: runtime/bin/directory_linux.cc

Issue 165723007: Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/directory_linux.cc
diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc
index c37b58b1ebd42179b52212eb7198bd0f107deca8..3bffda5e9ce3f13100721dfc074de8b67ec422b5 100644
--- a/runtime/bin/directory_linux.cc
+++ b/runtime/bin/directory_linux.cc
@@ -15,6 +15,7 @@
#include <sys/stat.h> // NOLINT
#include <unistd.h> // NOLINT
+#include "platform/signal_blocker.h"
#include "bin/file.h"
#include "bin/platform.h"
@@ -105,9 +106,9 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
int status = 0;
dirent entry;
dirent* result;
- if ((status = TEMP_FAILURE_RETRY(readdir_r(reinterpret_cast<DIR*>(lister_),
- &entry,
- &result))) == 0 &&
+ if ((status = readdir_r(reinterpret_cast<DIR*>(lister_),
+ &entry,
+ &result)) == 0 &&
result != NULL) {
if (!listing->path_buffer().Add(entry.d_name)) {
done_ = true;
@@ -133,8 +134,7 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
// the file pointed to.
struct stat64 entry_info;
int stat_success;
- stat_success = TEMP_FAILURE_RETRY(
- lstat64(listing->path_buffer().AsString(), &entry_info));
+ stat_success = lstat64(listing->path_buffer().AsString(), &entry_info);
if (stat_success == -1) {
return kListError;
}
@@ -152,8 +152,7 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
}
previous = previous->next;
}
- stat_success = TEMP_FAILURE_RETRY(
- stat64(listing->path_buffer().AsString(), &entry_info));
+ stat_success = stat64(listing->path_buffer().AsString(), &entry_info);
if (stat_success == -1) {
// Report a broken link as a link, even if follow_links is true.
return kListLink;
@@ -233,7 +232,7 @@ static bool DeleteRecursively(PathBuffer* path) {
// Do not recurse into links for deletion. Instead delete the link.
// If it's a file, delete it.
struct stat64 st;
- if (TEMP_FAILURE_RETRY(lstat64(path->AsString(), &st)) == -1) {
+ if (lstat64(path->AsString(), &st) == -1) {
return false;
} else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
return (unlink(path->AsString()) == 0);
@@ -258,9 +257,7 @@ static bool DeleteRecursively(PathBuffer* path) {
bool success = true;
dirent entry;
dirent* result;
- while ((read = TEMP_FAILURE_RETRY(readdir_r(dir_pointer,
- &entry,
- &result))) == 0 &&
+ while ((read = readdir_r(dir_pointer, &entry, &result)) == 0 &&
result != NULL &&
success) {
switch (entry.d_type) {
@@ -283,8 +280,7 @@ static bool DeleteRecursively(PathBuffer* path) {
// readdir_r. For those we use lstat to determine the entry
// type.
struct stat64 entry_info;
- int lstat_success = TEMP_FAILURE_RETRY(
- lstat64(path->AsString(), &entry_info));
+ int lstat_success = lstat64(path->AsString(), &entry_info);
if (lstat_success == -1) {
success = false;
break;
@@ -317,7 +313,7 @@ static bool DeleteRecursively(PathBuffer* path) {
Directory::ExistsResult Directory::Exists(const char* dir_name) {
struct stat64 entry_info;
- int success = TEMP_FAILURE_RETRY(stat64(dir_name, &entry_info));
+ int success = stat64(dir_name, &entry_info);
if (success == 0) {
if (S_ISDIR(entry_info.st_mode)) {
return EXISTS;
@@ -361,15 +357,14 @@ char* Directory::Current() {
bool Directory::SetCurrent(const char* path) {
- int result = TEMP_FAILURE_RETRY(chdir(path));
- return result == 0;
+ return chdir(path) == 0;
}
bool Directory::Create(const char* dir_name) {
// Create the directory with the permissions specified by the
// process umask.
- int result = TEMP_FAILURE_RETRY(mkdir(dir_name, 0777));
+ int result = mkdir(dir_name, 0777);
// If the directory already exists, treat it as a success.
if (result == -1 && errno == EEXIST) {
return (Exists(dir_name) == EXISTS);
@@ -422,9 +417,9 @@ bool Directory::Delete(const char* dir_name, bool recursive) {
if (!recursive) {
if (File::GetType(dir_name, false) == File::kIsLink &&
File::GetType(dir_name, true) == File::kIsDirectory) {
- return (TEMP_FAILURE_RETRY(unlink(dir_name)) == 0);
+ return unlink(dir_name) == 0;
}
- return (TEMP_FAILURE_RETRY(rmdir(dir_name)) == 0);
+ return rmdir(dir_name) == 0;
} else {
PathBuffer path;
if (!path.Add(dir_name)) {
@@ -438,7 +433,7 @@ bool Directory::Delete(const char* dir_name, bool recursive) {
bool Directory::Rename(const char* path, const char* new_path) {
ExistsResult exists = Exists(path);
if (exists != EXISTS) return false;
- return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0);
+ return rename(path, new_path) == 0;
}
} // namespace bin

Powered by Google App Engine
This is Rietveld 408576698