search for: fd_clr

Displaying 20 results from an estimated 30 matches for "fd_clr".

2020 Feb 26
2
[PATCH] lib: command: switch from select() to poll()
.../* Read output and send it to the log. */ n = read (cmd->errorfd, buf, BUFSIZ); if (n > 0) @@ -689,20 +692,26 @@ loop (struct command *cmd) else if (n == 0) { if (close (cmd->errorfd) == -1) perrorf (cmd->g, "close: errorfd"); - FD_CLR (cmd->errorfd, &rset); + fds[0].fd = -1; cmd->errorfd = -1; nr_fds--; } else if (n == -1) { perrorf (cmd->g, "read: errorfd"); close (cmd->errorfd); - FD_CLR (cmd->errorfd, &rset); + fds[0].fd =...
2020 Feb 26
0
Re: [PATCH] lib: command: switch from select() to poll()
...log. */ > n = read (cmd->errorfd, buf, BUFSIZ); > if (n > 0) > @@ -689,20 +692,26 @@ loop (struct command *cmd) > else if (n == 0) { > if (close (cmd->errorfd) == -1) > perrorf (cmd->g, "close: errorfd"); > - FD_CLR (cmd->errorfd, &rset); > + fds[0].fd = -1; > cmd->errorfd = -1; > nr_fds--; > } > else if (n == -1) { > perrorf (cmd->g, "read: errorfd"); > close (cmd->errorfd); > - FD_CLR (cmd->er...
2007 Apr 18
1
[PATCH] Lguest launcher, child starving parent
...id wake_parent(int pipefd, stru for (;;) { fd_set rfds = devices->infds; + int ignorefd; select(devices->max_infd+1, &rfds, NULL, NULL, NULL); - if (FD_ISSET(pipefd, &rfds)) { - int ignorefd; - if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) - exit(0); - FD_CLR(ignorefd, &devices->infds); - } kill(getppid(), SIGUSR1); + /* wait for parent response */ + if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) + exit(0); + if (ignorefd >= 0) + FD_CLR(ignorefd, &devices->infds); } } @@ -594,6 +594,7 @@ static void handle_outpu...
2007 Apr 18
1
[PATCH] Lguest launcher, child starving parent
...id wake_parent(int pipefd, stru for (;;) { fd_set rfds = devices->infds; + int ignorefd; select(devices->max_infd+1, &rfds, NULL, NULL, NULL); - if (FD_ISSET(pipefd, &rfds)) { - int ignorefd; - if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) - exit(0); - FD_CLR(ignorefd, &devices->infds); - } kill(getppid(), SIGUSR1); + /* wait for parent response */ + if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) + exit(0); + if (ignorefd >= 0) + FD_CLR(ignorefd, &devices->infds); } } @@ -594,6 +594,7 @@ static void handle_outpu...
2008 Jun 06
0
[PATCH] stubdom: permit compilation without lwip
...ck_readfds, &sock_writefds, &sock_exceptfds, &timeout); dump_set(nfds, &sock_readfds, &sock_writefds, &sock_exceptfds, &timeout); DEBUG("\n"); +#endif /* Then see others as well. */ for (i = 0; i < nfds; i++) { @@ -752,6 +767,7 @@ FD_CLR(i, writefds); FD_CLR(i, exceptfds); break; +#ifdef HAVE_LWIP case FTYPE_SOCKET: if (FD_ISSET(i, readfds)) { /* Optimize no-network-packet case. */ @@ -773,6 +789,7 @@ FD_CLR(i, exceptfds); } break; +#endif } #ifdef LIBC_VERBOSE if (FD_IS...
2012 Dec 13
2
[PATCH 1/2] daemon: NFC Use symbolic names in commandrvf
...ng on stdout */ - r = read (so_fd[0], buf, sizeof buf); + if (FD_ISSET (so_fd[PIPE_READ], &rset2)) { /* something on stdout */ + r = read (so_fd[PIPE_READ], buf, sizeof buf); if (r == -1) { perror ("read"); goto quit; } - if (r == 0) { FD_CLR (so_fd[0], &rset); quit++; } + if (r == 0) { FD_CLR (so_fd[PIPE_READ], &rset); quit++; } if (r > 0 && stdoutput) { so_size += r; @@ -970,17 +975,17 @@ commandrvf (char **stdoutput, char **stderror, int flags, } } - if (FD_ISSET (se_fd[0], &...
2020 Feb 26
1
Re: [PATCH] lib: command: switch from select() to poll()
...cmd->errorfd, buf, BUFSIZ); > > if (n > 0) > > @@ -689,20 +692,26 @@ loop (struct command *cmd) > > else if (n == 0) { > > if (close (cmd->errorfd) == -1) > > perrorf (cmd->g, "close: errorfd"); > > - FD_CLR (cmd->errorfd, &rset); > > + fds[0].fd = -1; > > cmd->errorfd = -1; > > nr_fds--; > > } > > else if (n == -1) { > > perrorf (cmd->g, "read: errorfd"); > > close (cmd->errorfd...
2004 Aug 25
0
[PATCH] move highest_fd calculations to ioloop-select.c
...dition & IO_WRITE) FD_SET(fd, &ioloop->handler_data->write_fds); + + if (io->fd > ioloop->highest_fd) + ioloop->highest_fd = io->fd; } void io_loop_handle_remove(struct ioloop *ioloop, struct io *io) @@ -57,6 +79,10 @@ void io_loop_handle_remove(struct ioloop FD_CLR(fd, &ioloop->handler_data->read_fds); if (condition & IO_WRITE) FD_CLR(fd, &ioloop->handler_data->write_fds); + + /* check if we removed the highest fd */ + if (io->fd == ioloop->highest_fd) + update_highest_fd(ioloop); } #define io_check_condition(fd,...
2006 Apr 01
1
Sys.sleep() burns up CPU on Solaris 8
.../unix/sys-std.c Fri Mar 31 23:12:16 2006 @@ -294,13 +294,13 @@ else onintr(); } - tv.tv_sec = 0; - tv.tv_usec = usec; + tv.tv_sec = usec/1000000; + tv.tv_usec = usec % 1000000; maxfd = setSelectMask(R_InputHandlers, &readMask); if (ignore_stdin) FD_CLR(fileno(stdin), &readMask); if (R_SelectEx(maxfd+1, &readMask, NULL, NULL, - (usec >= 0) ? &tv : NULL, intr)) + (usec >= 0) ? &tv : NULL, intr) > 0) return(&readMask); else return(NULL);
2001 Feb 22
3
intermittent stderr
The command "ssh ls -l /doesnotexist" gives various responses: Running from a 200 MHz PentiumPro with dsa key added to ssh-agent: Mistakes worst to fast machine: To a faster 600 MHz dual processor i686 600 MHz machine: ls: /doesnotexist: No such file or directory -- correct nothing at all -- wrong ls: select: Bad file descriptor -- wrong
2001 Oct 10
7
OpenSSH solaris: bad return code after exec of remote command
Hi OpenSSH developers, I am using openSSH (now 2.9.9p2, but prob occurs in 2.9p2 also) to execute commands on a remote machine which outputs data to stdout then pipes it to another invocation of ssh which connects back to the first machine in the same way, where it starts a program to read and store the output from the command on the second machine. I am using the "command" option in
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...); + waitpid (pid, NULL, 0); + return -1; + } + + if (FD_ISSET (so_fd[PIPE_READ], &rset2)) { /* something on stdout */ + r = read (so_fd[PIPE_READ], buf, sizeof buf); + if (r == -1) { + perror ("read"); + goto quit; + } + if (r == 0) { FD_CLR (so_fd[PIPE_READ], &rset); quit++; } + + if (r > 0 && stdoutput) { + so_size += r; + p = realloc (*stdoutput, so_size); + if (p == NULL) { + perror ("realloc"); + goto quit; + } + *stdoutput = p; + memcpy (*st...
2012 Sep 25
1
[PATCH] Fix <sys/time.h> for Linux 3.5.1
...x/time.h> does not even define FD_ZERO etc. + Unfortunately, some architectures define the double-underscore ones as inlines, so we can't use a simple #ifdef test. Thus, the only safe option remaining is to #undef the top-level macros. */ @@ -23,6 +25,7 @@ #undef FD_SET #undef FD_CLR #undef FD_ISSET +#undef FD_SETSIZE __extern void *memset(void *, int, size_t); static inline void FD_ZERO(fd_set *__fdsetp) @@ -45,6 +48,8 @@ static inline int FD_ISSET(int __fd, fd_set *__fdsetp) (__fd % BITS_PER_LONG)) & 1; } +#define FD_SETSIZE __FD_SETSIZE + __extern int gettime...
2012 Oct 01
0
[klibc:master] include: [sys/time.h] fix for Linux 3.5.1
...max at stro.at> --- usr/include/sys/time.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/usr/include/sys/time.h b/usr/include/sys/time.h index 7a2f8b9..98497e7 100644 --- a/usr/include/sys/time.h +++ b/usr/include/sys/time.h @@ -23,6 +23,7 @@ #undef FD_SET #undef FD_CLR #undef FD_ISSET +#undef FD_SETSIZE __extern void *memset(void *, int, size_t); static inline void FD_ZERO(fd_set *__fdsetp) @@ -45,6 +46,8 @@ static inline int FD_ISSET(int __fd, fd_set *__fdsetp) (__fd % BITS_PER_LONG)) & 1; } +#define FD_SETSIZE __FD_SETSIZE + __extern int gettime...
2020 Aug 18
1
Re: [PATCH nbdkit 7/9] server: Add hand-written replacement for poll for Windows.
On 8/18/20 5:50 AM, Richard W.M. Jones wrote: > --- > configure.ac | 1 + > common/replacements/Makefile.am | 2 + > common/replacements/poll.h | 60 ++++++++++++++++++ > server/public.c | 2 +- > server/sockets.c | 2 +- > common/replacements/poll.c | 106 ++++++++++++++++++++++++++++++++ > 6
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 07/13] lguest64 loader
...ppid(); + nice(19); + + set_fd(pipefd, devices); + + for (;;) { + fd_set rfds = devices->infds; + + select(devices->max_infd+1, &rfds, NULL, NULL, NULL); + if (FD_ISSET(pipefd, &rfds)) { + int ignorefd; + if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) + exit(0); + FD_CLR(ignorefd, &devices->infds); + } + kill(parent, SIGUSR1); + } +} + +/* We don't want signal to kill us, just jerk us out of kernel. */ +static void wakeup(int signo) +{ +} + +static int handle_tun_input(int fd, struct device *dev) +{ + u32 irq = 0, num, *lenp; + int len; + struct iovec...
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 07/13] lguest64 loader
...ppid(); + nice(19); + + set_fd(pipefd, devices); + + for (;;) { + fd_set rfds = devices->infds; + + select(devices->max_infd+1, &rfds, NULL, NULL, NULL); + if (FD_ISSET(pipefd, &rfds)) { + int ignorefd; + if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) + exit(0); + FD_CLR(ignorefd, &devices->infds); + } + kill(parent, SIGUSR1); + } +} + +/* We don't want signal to kill us, just jerk us out of kernel. */ +static void wakeup(int signo) +{ +} + +static int handle_tun_input(int fd, struct device *dev) +{ + u32 irq = 0, num, *lenp; + int len; + struct iovec...
2012 Oct 18
10
[PATCH 0/10] Add a mini-library for running external commands.
Inspired by libvirt's virCommand* internal mini-library, this adds some internal APIs for running commands. The first patch contains the new APIs. The subsequent patches change various parts of the library over to use it. Rich.
2009 Nov 09
1
[PATCH libguestfs] indent with spaces, not TABs
...*/ int commandrvf (char **stdoutput, char **stderror, int flags, - char const* const *argv) + char const* const *argv) { int so_size = 0, se_size = 0; int so_fd[2], se_fd[2]; @@ -746,19 +746,19 @@ commandrvf (char **stdoutput, char **stderror, int flags, if (r == 0) { FD_CLR (se_fd[0], &rset); quit++; } if (r > 0) { - if (verbose) - ignore_value (write (2, buf, r)); - - if (stderror) { - se_size += r; - p = realloc (*stderror, se_size); - if (p == NULL) { - perror ("realloc"); - goto quit; - } - *stderror = p; - memcpy (*s...
2007 May 09
0
[patch 9/9] lguest: the documentation, example launcher
...ces) +{ + nice(19); + + set_fd(pipefd, devices); + + for (;;) { + fd_set rfds = devices->infds; + + select(devices->max_infd+1, &rfds, NULL, NULL, NULL); + if (FD_ISSET(pipefd, &rfds)) { + int ignorefd; + if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) + exit(0); + FD_CLR(ignorefd, &devices->infds); + } + kill(getppid(), SIGUSR1); + } +} + +/* We don't want signal to kill us, just jerk us out of kernel. */ +static void wakeup(int signo) +{ +} + +static int setup_waker(struct device_list *device_list) +{ + int pipefd[2], child; + struct sigaction act; +...