| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
| 6 // filesystem. | 6 // filesystem. |
| 7 | 7 |
| 8 #ifndef BASE_FILES_FILE_UTIL_H_ | 8 #ifndef BASE_FILES_FILE_UTIL_H_ |
| 9 #define BASE_FILES_FILE_UTIL_H_ | 9 #define BASE_FILES_FILE_UTIL_H_ |
| 10 | 10 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 // existence of it with the given suffix. | 358 // existence of it with the given suffix. |
| 359 BASE_EXPORT int GetUniquePathNumber(const FilePath& path, | 359 BASE_EXPORT int GetUniquePathNumber(const FilePath& path, |
| 360 const FilePath::StringType& suffix); | 360 const FilePath::StringType& suffix); |
| 361 | 361 |
| 362 // Sets the given |fd| to non-blocking mode. | 362 // Sets the given |fd| to non-blocking mode. |
| 363 // Returns true if it was able to set it in the non-blocking mode, otherwise | 363 // Returns true if it was able to set it in the non-blocking mode, otherwise |
| 364 // false. | 364 // false. |
| 365 BASE_EXPORT bool SetNonBlocking(int fd); | 365 BASE_EXPORT bool SetNonBlocking(int fd); |
| 366 | 366 |
| 367 #if defined(OS_POSIX) | 367 #if defined(OS_POSIX) |
| 368 // Creates a non-blocking, close-on-exec pipe. | |
| 369 // This creates a non-blocking pipe that is not intended to be shared with any | |
| 370 // child process. This will be done atomically if the operating system supports | |
| 371 // it. Returns true if it was able to create the pipe, otherwise false. | |
| 372 BASE_EXPORT bool CreateLocalNonBlockingPipe(int fds[2]); | |
| 373 | |
| 374 // Sets the given |fd| to close-on-exec mode. | |
| 375 // Returns true if it was able to set it in the close-on-exec mode, otherwise | |
| 376 // false. | |
| 377 BASE_EXPORT bool SetCloseOnExec(int fd); | |
| 378 | |
| 379 // Test that |path| can only be changed by a given user and members of | 368 // Test that |path| can only be changed by a given user and members of |
| 380 // a given set of groups. | 369 // a given set of groups. |
| 381 // Specifically, test that all parts of |path| under (and including) |base|: | 370 // Specifically, test that all parts of |path| under (and including) |base|: |
| 382 // * Exist. | 371 // * Exist. |
| 383 // * Are owned by a specific user. | 372 // * Are owned by a specific user. |
| 384 // * Are not writable by all users. | 373 // * Are not writable by all users. |
| 385 // * Are owned by a member of a given set of groups, or are not writable by | 374 // * Are owned by a member of a given set of groups, or are not writable by |
| 386 // their group. | 375 // their group. |
| 387 // * Are not symbolic links. | 376 // * Are not symbolic links. |
| 388 // This is useful for checking that a config file is administrator-controlled. | 377 // This is useful for checking that a config file is administrator-controlled. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // This function simulates Move(), but unlike Move() it works across volumes. | 441 // This function simulates Move(), but unlike Move() it works across volumes. |
| 453 // This function is not transactional. | 442 // This function is not transactional. |
| 454 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 443 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 455 const FilePath& to_path); | 444 const FilePath& to_path); |
| 456 #endif // defined(OS_WIN) | 445 #endif // defined(OS_WIN) |
| 457 | 446 |
| 458 } // namespace internal | 447 } // namespace internal |
| 459 } // namespace base | 448 } // namespace base |
| 460 | 449 |
| 461 #endif // BASE_FILES_FILE_UTIL_H_ | 450 #endif // BASE_FILES_FILE_UTIL_H_ |
| OLD | NEW |