Skip to content
Snippets Groups Projects
Commit 0a547e3d authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Merge branch 'fix_Default_offset' into 'master'

Improve default read/write offset

See merge request i4/manycore/emper!78
parents 67d6bf0d ce8c29db
No related branches found
No related tags found
1 merge request!1WIP: Emper shutdown
......@@ -219,7 +219,7 @@ inline auto acceptAndWait(int socket, struct sockaddr *address, socklen_t *addre
*
* @return Future object which signals the completion of the read request
*/
inline auto readFile(int fildes, void *buf, size_t nbyte, off_t offset = 0, bool read_all = false)
inline auto readFile(int fildes, void *buf, size_t nbyte, off_t offset = -1, bool read_all = false)
-> std::unique_ptr<Future> {
auto future = std::make_unique<ReadFuture>(fildes, buf, nbyte, offset, read_all);
future->submit();
......@@ -241,7 +241,7 @@ inline auto readFile(int fildes, void *buf, size_t nbyte, off_t offset = 0, bool
*
* @return -1 on error, otherwise the number of bytes read
*/
inline auto readFileAndWait(int fildes, void *buf, size_t nbyte, off_t offset = 0,
inline auto readFileAndWait(int fildes, void *buf, size_t nbyte, off_t offset = -1,
bool read_all = false) -> ssize_t {
ReadFuture future(fildes, buf, nbyte, offset, read_all);
future.submit();
......@@ -266,7 +266,7 @@ inline auto readFileAndWait(int fildes, void *buf, size_t nbyte, off_t offset =
*
* @return Future object which signals the completion of the write request
*/
inline auto writeFile(int fildes, const void *buf, size_t nbyte, off_t offset = 0,
inline auto writeFile(int fildes, const void *buf, size_t nbyte, off_t offset = -1,
bool write_all = true) -> std::unique_ptr<Future> {
auto future = std::make_unique<WriteFuture>(fildes, buf, nbyte, offset, write_all);
future->submit();
......@@ -291,7 +291,7 @@ inline auto writeFile(int fildes, const void *buf, size_t nbyte, off_t offset =
*
* @return -1 on error, otherwise the number of bytes written
*/
inline auto writeFileAndWait(int fildes, const void *buf, size_t nbyte, off_t offset = 0,
inline auto writeFileAndWait(int fildes, const void *buf, size_t nbyte, off_t offset = -1,
bool write_all = true) -> ssize_t {
WriteFuture future(fildes, buf, nbyte, offset, write_all);
future.submit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment