aboutsummaryrefslogtreecommitdiff
path: root/www/chromium/files/patch-base_files_file__util__posix.cc
diff options
context:
space:
mode:
Diffstat (limited to 'www/chromium/files/patch-base_files_file__util__posix.cc')
-rw-r--r--www/chromium/files/patch-base_files_file__util__posix.cc72
1 files changed, 63 insertions, 9 deletions
diff --git a/www/chromium/files/patch-base_files_file__util__posix.cc b/www/chromium/files/patch-base_files_file__util__posix.cc
index ca0e4d4a8e28..c92ce21bda62 100644
--- a/www/chromium/files/patch-base_files_file__util__posix.cc
+++ b/www/chromium/files/patch-base_files_file__util__posix.cc
@@ -1,6 +1,17 @@
---- base/files/file_util_posix.cc.orig 2021-05-12 22:05:40 UTC
+--- base/files/file_util_posix.cc.orig 2021-07-19 18:45:05 UTC
+++ base/files/file_util_posix.cc
-@@ -384,7 +384,7 @@ bool CreatePipe(ScopedFD* read_fd, ScopedFD* write_fd,
+@@ -23,6 +23,10 @@
+ #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
+ #include <sys/sendfile.h>
+ #endif
++#if defined(OS_BSD)
++#include <sys/socket.h>
++#include <sys/uio.h>
++#endif
+
+ #include "base/base_switches.h"
+ #include "base/bits.h"
+@@ -383,7 +387,7 @@ bool CreatePipe(ScopedFD* read_fd, ScopedFD* write_fd,
}
bool CreateLocalNonBlockingPipe(int fds[2]) {
@@ -9,7 +20,7 @@
return pipe2(fds, O_CLOEXEC | O_NONBLOCK) == 0;
#else
int raw_fds[2];
-@@ -932,8 +932,12 @@ bool AllocateFileRegion(File* file, int64_t offset, si
+@@ -936,8 +940,12 @@ bool AllocateFileRegion(File* file, int64_t offset, si
// space. It can fail because the filesystem doesn't support it. In that case,
// use the manual method below.
@@ -23,7 +34,7 @@
return true;
DPLOG(ERROR) << "fallocate";
#elif defined(OS_APPLE)
-@@ -1103,7 +1107,7 @@ int GetMaximumPathComponentLength(const FilePath& path
+@@ -1111,7 +1119,7 @@ int GetMaximumPathComponentLength(const FilePath& path
#if !defined(OS_ANDROID)
// This is implemented in file_util_android.cc for that platform.
bool GetShmemTempDir(bool executable, FilePath* path) {
@@ -32,7 +43,7 @@
bool disable_dev_shm = false;
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS)
disable_dev_shm = CommandLine::ForCurrentProcess()->HasSwitch(
-@@ -1119,7 +1123,7 @@ bool GetShmemTempDir(bool executable, FilePath* path)
+@@ -1127,7 +1135,7 @@ bool GetShmemTempDir(bool executable, FilePath* path)
*path = FilePath("/dev/shm");
return true;
}
@@ -41,7 +52,7 @@
return GetTempDir(path);
}
#endif // !defined(OS_ANDROID)
-@@ -1157,7 +1161,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
+@@ -1165,7 +1173,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
// posix_fadvise() is only available in the Android NDK in API 21+. Older
// versions may have the required kernel support, but don't have enough usage
// to justify backporting.
@@ -50,7 +61,7 @@
(defined(OS_ANDROID) && __ANDROID_API__ >= 21)
File file(file_path, File::FLAG_OPEN | File::FLAG_READ);
if (!file.IsValid())
-@@ -1193,7 +1197,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
+@@ -1201,7 +1209,7 @@ PrefetchResult PreReadFile(const FilePath& file_path,
return internal::PreReadFileSlow(file_path, max_bytes)
? PrefetchResult{PrefetchResultCode::kSlowSuccess}
: PrefetchResult{PrefetchResultCode::kSlowFailed};
@@ -59,7 +70,50 @@
// __ANDROID_API__ >= 21)
}
-@@ -1263,7 +1267,7 @@ bool CopyFileContentsWithSendfile(File& infile,
+@@ -1232,7 +1240,7 @@ bool MoveUnsafe(const FilePath& from_path, const FileP
+ return true;
+ }
+
+-#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
++#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
+ bool CopyFileContentsWithSendfile(File& infile,
+ File& outfile,
+ bool& retry_slow) {
+@@ -1246,12 +1254,26 @@ bool CopyFileContentsWithSendfile(File& infile,
+ while (file_size - copied > 0) {
+ // Don't specify an offset and the kernel will begin reading/writing to the
+ // current file offsets.
++#if defined(OS_BSD)
++ int retv = HANDLE_EINTR(sendfile(infile.GetPlatformFile(),
++ outfile.GetPlatformFile(),
++ copied,
++ file_size - copied,
++ /*hdtr=*/nullptr,
++ &res,
++ 0));
++ if (retv != 0) {
++ res = -1;
++ break;
++ }
++#else
+ res = HANDLE_EINTR(sendfile(outfile.GetPlatformFile(),
+ infile.GetPlatformFile(), /*offset=*/nullptr,
+ /*length=*/file_size - copied));
+ if (res <= 0) {
+ break;
+ }
++#endif
+
+ copied += res;
+ }
+@@ -1265,13 +1287,13 @@ bool CopyFileContentsWithSendfile(File& infile,
+
+ return res >= 0;
+ }
+-#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
++#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_BSD)
+
+ } // namespace internal
#endif // !defined(OS_NACL_NONSFI)
@@ -68,7 +122,7 @@
BASE_EXPORT bool IsPathExecutable(const FilePath& path) {
bool result = false;
FilePath tmp_file_path;
-@@ -1284,6 +1288,6 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path
+@@ -1292,6 +1314,6 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path
}
return result;
}