diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-10 15:02:38 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-10 15:02:38 -0700 |
| commit | 795aebbee77bb74d8792df96dfe1aa79ec9548fc (patch) | |
| tree | 58c16424c16b9e71cebdceaee4507ab6608f80da /src/platform/posix/posix_pipe.c | |
| parent | de90f97167d2df6739db47b2c6aad85f06250270 (diff) | |
| download | nng-795aebbee77bb74d8792df96dfe1aa79ec9548fc.tar.gz nng-795aebbee77bb74d8792df96dfe1aa79ec9548fc.tar.bz2 nng-795aebbee77bb74d8792df96dfe1aa79ec9548fc.zip | |
Give up on uncrustify; switch to clang-format.
Diffstat (limited to 'src/platform/posix/posix_pipe.c')
| -rw-r--r-- | src/platform/posix/posix_pipe.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/platform/posix/posix_pipe.c b/src/platform/posix/posix_pipe.c index c86022ef..78415d26 100644 --- a/src/platform/posix/posix_pipe.c +++ b/src/platform/posix/posix_pipe.c @@ -21,14 +21,14 @@ // Linux eventfd. This is lighter weight than pipes, and has better semantics // to boot. This is far better than say epoll(). -#include <sys/eventfd.h> #include <fcntl.h> +#include <sys/eventfd.h> #include <unistd.h> #ifdef EFD_CLOEXEC -#define NNI_EVENTFD_FLAGS EFD_CLOEXEC +#define NNI_EVENTFD_FLAGS EFD_CLOEXEC #else -#define NNI_EVENTFD_FLAGS 0 +#define NNI_EVENTFD_FLAGS 0 #endif int @@ -46,25 +46,22 @@ nni_plat_pipe_open(int *wfd, int *rfd) return (0); } - void nni_plat_pipe_raise(int wfd) { uint64_t one = 1; - (void) write(wfd, &one, sizeof (one)); + (void) write(wfd, &one, sizeof(one)); } - void nni_plat_pipe_clear(int rfd) { uint64_t val; - (void) read(rfd, &val, sizeof (val)); + (void) read(rfd, &val, sizeof(val)); } - void nni_plat_pipe_close(int wfd, int rfd) { @@ -72,11 +69,10 @@ nni_plat_pipe_close(int wfd, int rfd) (void) close(wfd); } - #else // NNG_USE_EVENTFD -#include <unistd.h> #include <fcntl.h> +#include <unistd.h> int nni_plat_pipe_open(int *wfd, int *rfd) @@ -97,7 +93,6 @@ nni_plat_pipe_open(int *wfd, int *rfd) return (0); } - void nni_plat_pipe_raise(int wfd) { @@ -106,23 +101,21 @@ nni_plat_pipe_raise(int wfd) (void) write(wfd, &c, 1); } - void nni_plat_pipe_clear(int rfd) { char buf[32]; - int rv; + int rv; for (;;) { // Completely drain the pipe, but don't wait. This coalesces // events somewhat. - if (read(rfd, buf, sizeof (buf)) <= 0) { + if (read(rfd, buf, sizeof(buf)) <= 0) { return; } } } - void nni_plat_pipe_close(int wfd, int rfd) { @@ -130,7 +123,6 @@ nni_plat_pipe_close(int wfd, int rfd) close(rfd); } - #endif // NNG_USE_EVENTFD #else |
