aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2009-06-10 18:05:55 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-10 18:08:35 -0500
commitf8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc (patch)
treec67bf81b0bfa6b897f4fb7a236962a85819e15f7 /vl.c
parentb319820d4099ec6b98c9c260e06d519fc41d544c (diff)
parent4ffb17f5c3244e405198ae285ffbb20a62e0d4b3 (diff)
downloadqemu-f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc.zip
qemu-f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc.tar.gz
qemu-f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc.tar.bz2
Merge branch 'net-queue'
* net-queue: (28 commits) virtio-net: Increase filter and control limits virtio-net: Add new RX filter controls virtio-net: MAC filter optimization virtio-net: Fix MAC filter overflow handling virtio-net: reorganize receive_filter() virtio-net: Use a byte to store RX mode flags virtio-net: Add version_id 7 placeholder for vnet header support virtio-net: implement rx packet queueing net: make use of async packet sending API in tap client net: add qemu_send_packet_async() net: split out packet queueing and flushing into separate functions net: return status from qemu_deliver_packet() net: add return value to packet receive handler net: pass VLANClientState* as first arg to receive handlers net: re-name vc->fd_read() to vc->receive() net: add fd_readv() handler to qemu_new_vlan_client() args net: only read from tapfd when we can send net: vlan clients with no fd_can_read() can always receive net: move the tap buffer into TAPState net: factor tap_read_packet() out of tap_send() ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/vl.c b/vl.c
index 69a9f91..bdd78cf 100644
--- a/vl.c
+++ b/vl.c
@@ -1836,45 +1836,34 @@ int get_param_value(char *buf, int buf_size,
return 0;
}
-int check_params(const char * const *params, const char *str)
+int check_params(char *buf, int buf_size,
+ const char * const *params, const char *str)
{
- int name_buf_size = 1;
const char *p;
- char *name_buf;
- int i, len;
- int ret = 0;
-
- for (i = 0; params[i] != NULL; i++) {
- len = strlen(params[i]) + 1;
- if (len > name_buf_size) {
- name_buf_size = len;
- }
- }
- name_buf = qemu_malloc(name_buf_size);
+ int i;
p = str;
while (*p != '\0') {
- p = get_opt_name(name_buf, name_buf_size, p, '=');
+ p = get_opt_name(buf, buf_size, p, '=');
if (*p != '=') {
- ret = -1;
- break;
+ return -1;
}
p++;
- for(i = 0; params[i] != NULL; i++)
- if (!strcmp(params[i], name_buf))
+ for (i = 0; params[i] != NULL; i++) {
+ if (!strcmp(params[i], buf)) {
break;
+ }
+ }
if (params[i] == NULL) {
- ret = -1;
- break;
+ return -1;
}
p = get_opt_value(NULL, 0, p);
- if (*p != ',')
+ if (*p != ',') {
break;
+ }
p++;
}
-
- qemu_free(name_buf);
- return ret;
+ return 0;
}
/***********************************************************/
@@ -2227,8 +2216,9 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque)
"cache", "format", "serial", "werror",
NULL };
- if (check_params(params, str) < 0) {
- fprintf(stderr, "qemu: unknown parameter in '%s'\n", str);
+ if (check_params(buf, sizeof(buf), params, str) < 0) {
+ fprintf(stderr, "qemu: unknown parameter '%s' in '%s'\n",
+ buf, str);
return -1;
}
@@ -2709,7 +2699,7 @@ static int usb_device_add(const char *devname, int is_hotplug)
} else if (strstart(devname, "net:", &p)) {
int nic = nb_nics;
- if (net_client_init("nic", p) < 0)
+ if (net_client_init(NULL, "nic", p) < 0)
return -1;
nd_table[nic].model = "usb";
dev = usb_net_init(&nd_table[nic]);
@@ -4783,7 +4773,12 @@ static void termsig_handler(int signal)
qemu_system_shutdown_request();
}
-static void termsig_setup(void)
+static void sigchld_handler(int signal)
+{
+ waitpid(-1, NULL, WNOHANG);
+}
+
+static void sighandler_setup(void)
{
struct sigaction act;
@@ -4792,6 +4787,10 @@ static void termsig_setup(void)
sigaction(SIGINT, &act, NULL);
sigaction(SIGHUP, &act, NULL);
sigaction(SIGTERM, &act, NULL);
+
+ act.sa_handler = sigchld_handler;
+ act.sa_flags = SA_NOCLDSTOP;
+ sigaction(SIGCHLD, &act, NULL);
}
#endif
@@ -5920,7 +5919,7 @@ int main(int argc, char **argv, char **envp)
#ifndef _WIN32
/* must be after terminal init, SDL library changes signal handlers */
- termsig_setup();
+ sighandler_setup();
#endif
/* Maintain compatibility with multiple stdio monitors */