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 |
368 // Test that |path| can only be changed by a given user and members of | 379 // Test that |path| can only be changed by a given user and members of |
369 // a given set of groups. | 380 // a given set of groups. |
370 // Specifically, test that all parts of |path| under (and including) |base|: | 381 // Specifically, test that all parts of |path| under (and including) |base|: |
371 // * Exist. | 382 // * Exist. |
372 // * Are owned by a specific user. | 383 // * Are owned by a specific user. |
373 // * Are not writable by all users. | 384 // * Are not writable by all users. |
374 // * Are owned by a member of a given set of groups, or are not writable by | 385 // * Are owned by a member of a given set of groups, or are not writable by |
375 // their group. | 386 // their group. |
376 // * Are not symbolic links. | 387 // * Are not symbolic links. |
377 // This is useful for checking that a config file is administrator-controlled. | 388 // 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... |
441 // This function simulates Move(), but unlike Move() it works across volumes. | 452 // This function simulates Move(), but unlike Move() it works across volumes. |
442 // This function is not transactional. | 453 // This function is not transactional. |
443 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 454 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
444 const FilePath& to_path); | 455 const FilePath& to_path); |
445 #endif // defined(OS_WIN) | 456 #endif // defined(OS_WIN) |
446 | 457 |
447 } // namespace internal | 458 } // namespace internal |
448 } // namespace base | 459 } // namespace base |
449 | 460 |
450 #endif // BASE_FILES_FILE_UTIL_H_ | 461 #endif // BASE_FILES_FILE_UTIL_H_ |
OLD | NEW |