OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 16 matching lines...) Expand all Loading... |
27 //! child process does not inherit file descriptors that it has no need for. | 27 //! child process does not inherit file descriptors that it has no need for. |
28 //! | 28 //! |
29 //! Unlike the BSD function, this function may not close file descriptors | 29 //! Unlike the BSD function, this function may not close file descriptors |
30 //! immediately, but may instead mark them as close-on-exec. The actual behavior | 30 //! immediately, but may instead mark them as close-on-exec. The actual behavior |
31 //! chosen is specific to the operating system. On Mac OS X, file descriptors | 31 //! chosen is specific to the operating system. On Mac OS X, file descriptors |
32 //! are marked close-on-exec instead of being closed outright in order to avoid | 32 //! are marked close-on-exec instead of being closed outright in order to avoid |
33 //! raising `EXC_GUARD` exceptions for guarded file descriptors that are | 33 //! raising `EXC_GUARD` exceptions for guarded file descriptors that are |
34 //! protected against `close()`. | 34 //! protected against `close()`. |
35 //! | 35 //! |
36 //! \param[in] fd The lowest file descriptor to close or set as close-on-exec. | 36 //! \param[in] fd The lowest file descriptor to close or set as close-on-exec. |
37 void CloseMultipleNowOrOnExec(int fd); | 37 //! \param[in] preserve_fd A file descriptor to preserve and not close (or set |
| 38 //! as close-on-exec), even if it is open and its value is greater than \a |
| 39 //! fd. To not preserve any file descriptor, pass `-1` for this parameter. |
| 40 void CloseMultipleNowOrOnExec(int fd, int preserve_fd); |
38 | 41 |
39 } // namespace crashpad | 42 } // namespace crashpad |
40 | 43 |
41 #endif // CRASHPAD_UTIL_TEST_POSIX_CLOSE_MULTIPLE_H_ | 44 #endif // CRASHPAD_UTIL_TEST_POSIX_CLOSE_MULTIPLE_H_ |
OLD | NEW |