search for: max_fd

Displaying 20 results from an estimated 59 matches for "max_fd".

2014 Jul 25
3
[PATCH] launch: Close file descriptors after fork (RHBZ#1123007).
...@ -161,4 +161,18 @@ extern GUESTFS_DLL_PUBLIC int guestfs___add_libvirt_dom (guestfs_h *g, virDomain # define program_name "libguestfs" #endif +/* Close all file descriptors matching the condition. */ +#define close_file_descriptors(cond) do { \ + int max_fd = sysconf (_SC_OPEN_MAX); \ + int fd; \ + if (max_fd == -1) \ + max_fd = 1024; \ + if (max_fd...
2023 Jul 11
1
[libguestfs PATCH] lib: remove guestfs_int_cmd_clear_close_files()
...18 +549,16 @@ run_child (struct command *cmd, char **env) for (i = 1; i < NSIG; ++i) sigaction (i, &sa, NULL); - if (cmd->close_files) { - /* Close all other file descriptors. This ensures that we don't - * hold open (eg) pipes from the parent process. - */ - max_fd = sysconf (_SC_OPEN_MAX); - if (max_fd == -1) - max_fd = 1024; - if (max_fd > 65536) - max_fd = 65536; /* bound the amount of work we do here */ - for (fd = 3; fd < max_fd; ++fd) - close (fd); - } + /* Close all other file descriptors. This ensures that we do...
2014 Jul 30
2
[PATCH v2] launch: Close file descriptors after fork (RHBZ#1123007).
https://bugzilla.redhat.com/show_bug.cgi?id=1123007 This is version 2 of the patch which avoids incorrectly closing stderr, so we can still see debug and error messages. Rich.
2014 Jul 28
1
Re: [PATCH] launch: Close file descriptors after fork (RHBZ#1123007).
...@@ -161,4 +161,18 @@ extern GUESTFS_DLL_PUBLIC int guestfs___add_libvirt_dom (guestfs_h *g, virDomain # define program_name "libguestfs" #endif +/* Close all file descriptors matching the condition. */ +#define close_file_descriptors(cond) do { \ + int max_fd = sysconf (_SC_OPEN_MAX); \ + int fd; \ + if (max_fd == -1) \ + max_fd = 1024; \ + if (max_fd...
2001 Oct 31
2
suggested fix for the sigchld race
...client_alive_check(); + + notify_done(*readsetp); } /* @@ -467,6 +510,8 @@ connection_in = packet_get_connection_in(); connection_out = packet_get_connection_out(); + notify_setup(); + previous_stdout_buffer_bytes = 0; /* Set approximate I/O buffer size. */ @@ -572,6 +617,7 @@ max_fd = MAX(max_fd, fdin); max_fd = MAX(max_fd, fdout); max_fd = MAX(max_fd, fderr); + max_fd = MAX(max_fd, notify_pipe[0]); /* Sleep in select() until we can do something. */ wait_until_can_do_something(&readset, &writeset, &max_fd, @@ -696,7 +742,11 @@ connection_in = packe...
2001 Jun 15
2
openssh 2.9p1: data loss when stdout sent to a pipe
...output from + being reliably sent to a pipe. - PHS 2001/06/15 if (!isatty(fileno(stdin))) set_nonblock(fileno(stdin)); if (!isatty(fileno(stdout))) set_nonblock(fileno(stdout)); if (!isatty(fileno(stderr))) set_nonblock(fileno(stderr)); + */ max_fd = MAX(max_fd, fileno(stdin)); max_fd = MAX(max_fd, fileno(stdout)); max_fd = MAX(max_fd, fileno(stderr)); Now, presumably those lines were added to the source code to address some other problem (perhaps one of the hanging problems I see mentioned on the list?) So simply removing them as per...
2013 Jan 03
20
[PATCH] Switch to poll in xenconsoled's io loop.
...lt;fcntl.h> #include <unistd.h> #include <termios.h> @@ -930,7 +930,6 @@ static void handle_log_reload(void) void handle_io(void) { - fd_set readfds, writefds; int ret; if (log_hv) { @@ -959,21 +958,33 @@ void handle_io(void) for (;;) { struct domain *d, *n; - int max_fd = -1; - struct timeval timeout; + int poll_timeout; /* timeout in milliseconds */ struct timespec ts; long long now, next_timeout = 0; - FD_ZERO(&readfds); - FD_ZERO(&writefds); - - FD_SET(xs_fileno(xs), &readfds); - max_fd = MAX(xs_fileno(xs), max_fd); - - if (log_hv) {...
2013 Feb 19
13
[PATCH] mini-os: implement poll(2)
...*readfds, fd_set *writefds, fd_set *exceptfds) { @@ -983,6 +1007,71 @@ out: return ret; } +/* Wrap around select */ +int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout) +{ + int ret; + int i, fd; + struct timeval _timeo, *timeo = NULL; + fd_set rfds, wfds, efds; + int max_fd = -1; + + DEBUG("poll("); + dump_pollfds(_pfd, _nfds, _timeout); + DEBUG(")\n"); + + if (_timeout != -1) { + /* Timeout in poll is in millisecond. */ + _timeo.tv_sec = _timeout / 1000; + _timeo.tv_usec = (_timeout - _timeo.tv_sec * 1000) * 1000;...
2006 Sep 07
12
Multiple (multiplexed) simultaneous ssh connections - Cygwin bug?
Hello, ? I need to make many (>50) ssh connections from linux to cygwin at the same time. Using Windows 2000 Server (OpenSSH_4.3p2, OpenSSL 0.9.8b and updated cygwin) and Linux RHEL4 (OpenSSH_3.9p1, OpenSSL 0.9.7a). ? It's been difficult to optimize many simultaneous connections. Here were some issues: 1.?????? On Windows XP/Professional, Microsoft intentionally cripples the TCP/IP stack.
2012 Mar 09
1
[PATCH 1/2] Close all file descriptors in the recovery process.
...+++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/launch.c b/src/launch.c index 1dc23f4..a9af445 100644 --- a/src/launch.c +++ b/src/launch.c @@ -844,9 +844,21 @@ launch_appliance (guestfs_h *g) if (g->recovery_proc) { r = fork (); if (r == 0) { + int fd, max_fd; pid_t qemu_pid = g->pid; pid_t parent_pid = getppid (); + /* Close all other file descriptors. This ensures that we don't + * hold open (eg) pipes from the parent process. + */ + max_fd = sysconf (_SC_OPEN_MAX); + if (max_fd == -1) + max_fd...
2013 Mar 07
4
[PATCH 0/4] Small refactorings of the protocol layer.
As the start of work to add remote support, I'm taking a close look at the protocol layer in the library. These are some small cleanups. Rich.
2007 Dec 21
2
[Virtio-for-kvm] [PATCH 7/7] userspace virtio
...ev.status & VIRTIO_CONFIG_S_DRIVER_OK) && n->can_receive; } -static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) +void virtio_net_poll(void) { - VirtIONet *n = opaque; + VirtIONet *vnet; + int len; + fd_set rfds; + struct timeval tv; + int max_fd = -1; VirtQueueElement elem; struct virtio_net_hdr *hdr; - int offset, i; - - /* FIXME: the drivers really need to set their status better */ - if (n->rx_vq->vring.avail == NULL) { - n->can_receive = 0; - return; - } - - if (virtqueue_pop(n->rx_vq, &el...
2007 Dec 21
2
[Virtio-for-kvm] [PATCH 7/7] userspace virtio
...ev.status & VIRTIO_CONFIG_S_DRIVER_OK) && n->can_receive; } -static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) +void virtio_net_poll(void) { - VirtIONet *n = opaque; + VirtIONet *vnet; + int len; + fd_set rfds; + struct timeval tv; + int max_fd = -1; VirtQueueElement elem; struct virtio_net_hdr *hdr; - int offset, i; - - /* FIXME: the drivers really need to set their status better */ - if (n->rx_vq->vring.avail == NULL) { - n->can_receive = 0; - return; - } - - if (virtqueue_pop(n->rx_vq, &el...
2007 Feb 23
1
ssh-agent does not immediately clean timeouted keys from memory
during my seminar of advanced exploitation techniques (SEAT, [1]) i developed some methods to crack into system via DMA (e.g. via firewire). as part of this i developed a program that steals loaded ssh private keys from ssh-agents. i was astonished to find that the keys are not immediately removed from the agent when a timeout occurs, but only the next time the agent is queried via its socket. i
2002 Aug 22
1
Applying the "Connection reset by peer"
Hi all, we're suffering heavily from the "connection reset by peer" problem when running Rsync on WinNT. Great was our relief when seeing Randy's message in http://www.mail-archive.com/rsync@lists.samba.org/msg01918.html I immediately installed the full Cygwin to recompile Rsync, but since I'm far from a C guru, I'm a bit puzzled with the last 2 lines in Randy's
2000 Mar 03
7
[PATCH] Add a Maximum Idle Time (1.2.2)
...396,8 +396,10 @@ */ void -client_wait_until_can_do_something(fd_set * readset, fd_set * writeset) +client_wait_until_can_do_something(fd_set * readset, fd_set * writeset, int trans_inter) { + int select_return; + /* Initialize select masks. */ FD_ZERO(readset); @@ -436,15 +438,32 @@ max_fd = channel_max_fd(); /* - * Wait for something to happen. This will suspend the process until - * some selected descriptor can be read, written, or has some other - * event pending. Note: if you want to implement SSH_MSG_IGNORE - * messages to fool traffic analysis, this might be the place...
2017 Oct 06
0
[PATCH v2 1/2] lib: command: If command fails, exit with 126 or 127 as defined by POSIX.
...lib/command.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/command.c b/lib/command.c index 3d8bc7dbf..36f953dcf 100644 --- a/lib/command.c +++ b/lib/command.c @@ -539,7 +539,7 @@ static void run_child (struct command *cmd) { struct sigaction sa; - int i, fd, max_fd, r; + int i, err, fd, max_fd, r; char status_string[80]; #ifdef HAVE_SETRLIMIT struct child_rlimits *child_rlimit; @@ -614,8 +614,12 @@ run_child (struct command *cmd) switch (cmd->style) { case COMMAND_STYLE_EXECV: execvp (cmd->argv.argv[0], cmd->argv.argv); + err =...
2013 Aug 09
4
[PATCH v2 0/4] Experimental User-Mode Linux backend.
v1 was here: https://www.redhat.com/archives/libguestfs/2013-August/msg00005.html This now works, to some extent. The main problem now is that devices are named /dev/ubd[a-] which of course confuses everything. I'm thinking it may be easier to add a udev rule to rename them. Rich.
2013 Aug 09
5
[PATCH 0/4] Not quite working User-Mode Linux backend.
This is a User-Mode Linux backend for libguestfs. You can select it by doing: export LIBGUESTFS_BACKEND=uml export LIBGUESTFS_QEMU=/path/to/vmlinux Note we're reusing the 'qemu' variable in the handle for convenience. QEmu is not involved when using the UML backend. This almost works. UML itself crashes when the daemon tries to connect to the serial port. I suspect it's
2001 Oct 16
1
Defeating Timing Attacks Patch for OpenSSH 2.9.9p2 and 2.9p2
...0) + { + steno_timer.tv_usec = 50000; + return 1; + } + else + return 0; + /* End SD Mod */ + } - static void client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) { @@ -773,6 +843,15 @@ int max_fd = 0, max_fd2 = 0, len, rekeying = 0, nalloc = 0; char buf[100]; + /* + * Begin SD Mod: + * Add counter for number of fake packets that have been sent. + * Add time_out flag for marking when timeout has occured. + */ + int bogus_send_count = 0; +...