diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-11-08 23:05:36 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-11-08 23:05:36 +0000 |
commit | 142962742c844869c961927cb9f4434532c345eb (patch) | |
tree | b1bebea7d81138f6699923c856e396e5f24c8e83 /buffer-poll.c | |
parent | 2df08827223872cd6b3ac1df527e55c2275a08cc (diff) | |
download | rtmux-142962742c844869c961927cb9f4434532c345eb.tar.gz rtmux-142962742c844869c961927cb9f4434532c345eb.tar.bz2 rtmux-142962742c844869c961927cb9f4434532c345eb.zip |
Sync OpenBSD patchset 499:
Bye-bye buffer*.c.
Diffstat (limited to 'buffer-poll.c')
-rw-r--r-- | buffer-poll.c | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/buffer-poll.c b/buffer-poll.c deleted file mode 100644 index 20ce7b78..00000000 --- a/buffer-poll.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $Id: buffer-poll.c,v 1.19 2009-11-08 22:40:36 tcunha Exp $ */ - -/* - * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> - -#include <errno.h> -#include <event.h> -#include <unistd.h> - -#include "tmux.h" - -/* Fill buffers from socket based on poll results. */ -int -buffer_poll(int fd, int events, struct buffer *in, struct buffer *out) -{ - ssize_t n; - - if (in != NULL && events & EV_READ) { - buffer_ensure(in, BUFSIZ); - n = read(fd, BUFFER_IN(in), BUFFER_FREE(in)); - if (n == 0) - return (-1); - if (n == -1) { - if (errno != EINTR && errno != EAGAIN) - return (-1); - } else - buffer_add(in, n); - } - if (out != NULL && BUFFER_USED(out) > 0 && events & EV_WRITE) { - n = write(fd, BUFFER_OUT(out), BUFFER_USED(out)); - if (n == -1) { - if (errno != EINTR && errno != EAGAIN) - return (-1); - } else - buffer_remove(out, n); - } - return (0); -} |