| 1 | #ifndef LTTNG_COMMON_READWRITE_H |
| 2 | #define LTTNG_COMMON_READWRITE_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (C) 2013 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU Lesser General Public License, version 2.1 only, |
| 9 | * as published by the Free Software Foundation. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
| 14 | * for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public License |
| 17 | * along with this library; if not, write to the Free Software Foundation, |
| 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include <unistd.h> |
| 22 | |
| 23 | /* |
| 24 | * lttng_read and lttng_write take care of EINTR and partial read/write. |
| 25 | * Upon success, they return the "count" received as parameter. |
| 26 | * They can return a negative value if an error occurs. |
| 27 | * If a value lower than the requested "count" is returned, it means an |
| 28 | * error occured. |
| 29 | * The error can be checked by querying errno. |
| 30 | */ |
| 31 | ssize_t lttng_read(int fd, void *buf, size_t count); |
| 32 | ssize_t lttng_write(int fd, const void *buf, size_t count); |
| 33 | |
| 34 | #endif /* LTTNG_COMMON_READWRITE_H */ |