Index: util/file/fd_io.h |
diff --git a/util/file/fd_io.h b/util/file/fd_io.h |
index 07f39b6d7587d5323112e5240ecb9352ff988b26..14481c93752c6fcec8e25566f37c5ea484017341 100644 |
--- a/util/file/fd_io.h |
+++ b/util/file/fd_io.h |
@@ -30,6 +30,8 @@ namespace crashpad { |
//! have been read into \a buffer. |
//! |
//! \sa WriteFD |
+//! \sa CheckedReadFD |
+//! \sa CheckedReadFDAtEOF |
ssize_t ReadFD(int fd, void* buffer, size_t size); |
//! \brief Wraps `write()`, retrying when interrupted or following a short |
@@ -43,8 +45,40 @@ ssize_t ReadFD(int fd, void* buffer, size_t size); |
//! been written to \a fd. |
//! |
//! \sa ReadFD |
+//! \sa CheckedWriteFD |
ssize_t WriteFD(int fd, const void* buffer, size_t size); |
+//! \brief Wraps ReadFD(), ensuring that exactly \a size bytes are read. |
+//! |
+//! If \a size is out of the range of possible `read()` return values, if the |
+//! underlying ReadFD() fails, or if other than \a size bytes were read, this |
+//! function causes execution to terminate without returning. |
+//! |
+//! \sa CheckedWriteFD |
+//! \sa ReadFD |
+//! \sa CheckedReadFDAtEOF |
+void CheckedReadFD(int fd, void* buffer, size_t size); |
+ |
+//! \brief Wraps WriteFD(), ensuring that exactly \a size bytes are written. |
+//! |
+//! If \a size is out of the range of possible `write()` return values, if the |
+//! underlying WriteFD() fails, or if other than \a size bytes were written, |
+//! this function causes execution to terminate without returning. |
+//! |
+//! \sa CheckedReadFD |
+//! \sa WriteFD |
+void CheckedWriteFD(int fd, const void* buffer, size_t size); |
+ |
+//! \brief Wraps ReadFD(), ensuring that it indicates end-of-file. |
+//! |
+//! Attempts to read a single byte from \a fd, expecting no data to be read. If |
+//! the underlying ReadFD() fails, or if a byte actually is read, this function |
+//! causes execution to terminate without returning. |
+//! |
+//! \sa CheckedReadFD |
+//! \sa ReadFD |
+void CheckedReadFDAtEOF(int fd); |
+ |
} // namespace crashpad |
#endif // CRASHPAD_UTIL_FILE_FD_IO_H_ |