OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_UTIL_FILE_FD_IO_H_ |
| 16 #define CRASHPAD_UTIL_FILE_FD_IO_H_ |
| 17 |
| 18 #include <sys/types.h> |
| 19 |
| 20 namespace crashpad { |
| 21 |
| 22 //! \brief Wraps `read()`, retrying when interrupted or following a short read. |
| 23 //! |
| 24 //! This function reads into \a buffer, stopping only when \a size bytes have |
| 25 //! been read or when `read()` returns 0, indicating that end-of-file has been |
| 26 //! reached. |
| 27 //! |
| 28 //! \return The number of bytes read and placed into \a buffer, or `-1` on |
| 29 //! error, with `errno` set appropriately. On error, a portion of \a fd may |
| 30 //! have been read into \a buffer. |
| 31 //! |
| 32 //! \sa WriteFD |
| 33 ssize_t ReadFD(int fd, void* buffer, size_t size); |
| 34 |
| 35 //! \brief Wraps `write()`, retrying when interrupted or following a short |
| 36 //! write. |
| 37 //! |
| 38 //! This function writes to \a fd, stopping only when \a size bytes have been |
| 39 //! written. |
| 40 //! |
| 41 //! \return The number of bytes written from \a buffer, or `-1` on error, with |
| 42 //! `errno` set appropriately. On error, a portion of \a buffer may have |
| 43 //! been written to \a fd. |
| 44 //! |
| 45 //! \sa ReadFD |
| 46 ssize_t WriteFD(int fd, const void* buffer, size_t size); |
| 47 |
| 48 } // namespace crashpad |
| 49 |
| 50 #endif // CRASHPAD_UTIL_FILE_FD_IO_H_ |
OLD | NEW |