Commit | Line | Data |
---|---|---|
33b14136 MD |
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> | |
73ec1cf9 | 22 | #include <common/macros.h> |
33b14136 MD |
23 | |
24 | /* | |
25 | * lttng_read and lttng_write take care of EINTR and partial read/write. | |
26 | * Upon success, they return the "count" received as parameter. | |
27 | * They can return a negative value if an error occurs. | |
28 | * If a value lower than the requested "count" is returned, it means an | |
83f4233d | 29 | * error occurred. |
33b14136 MD |
30 | * The error can be checked by querying errno. |
31 | */ | |
73ec1cf9 | 32 | LTTNG_HIDDEN |
33b14136 | 33 | ssize_t lttng_read(int fd, void *buf, size_t count); |
73ec1cf9 | 34 | LTTNG_HIDDEN |
33b14136 MD |
35 | ssize_t lttng_write(int fd, const void *buf, size_t count); |
36 | ||
37 | #endif /* LTTNG_COMMON_READWRITE_H */ |