mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
socket-util: New function xset_nonblocking().
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -75,8 +75,8 @@ fatal_signal_init(void)
|
|||||||
inited = true;
|
inited = true;
|
||||||
|
|
||||||
xpipe(signal_fds);
|
xpipe(signal_fds);
|
||||||
set_nonblocking(signal_fds[0]);
|
xset_nonblocking(signal_fds[0]);
|
||||||
set_nonblocking(signal_fds[1]);
|
xset_nonblocking(signal_fds[1]);
|
||||||
|
|
||||||
sigemptyset(&fatal_signal_set);
|
sigemptyset(&fatal_signal_set);
|
||||||
for (i = 0; i < ARRAY_SIZE(fatal_signals); i++) {
|
for (i = 0; i < ARRAY_SIZE(fatal_signals); i++) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
|
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -83,8 +83,8 @@ process_init(void)
|
|||||||
|
|
||||||
/* Create notification pipe. */
|
/* Create notification pipe. */
|
||||||
xpipe(fds);
|
xpipe(fds);
|
||||||
set_nonblocking(fds[0]);
|
xset_nonblocking(fds[0]);
|
||||||
set_nonblocking(fds[1]);
|
xset_nonblocking(fds[1]);
|
||||||
|
|
||||||
/* Set up child termination signal handler. */
|
/* Set up child termination signal handler. */
|
||||||
memset(&sa, 0, sizeof sa);
|
memset(&sa, 0, sizeof sa);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2009, 2011 Nicira, Inc.
|
* Copyright (c) 2008, 2009, 2011, 2012 Nicira, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -64,8 +64,8 @@ signal_init(void)
|
|||||||
if (!inited) {
|
if (!inited) {
|
||||||
inited = true;
|
inited = true;
|
||||||
xpipe(fds);
|
xpipe(fds);
|
||||||
set_nonblocking(fds[0]);
|
xset_nonblocking(fds[0]);
|
||||||
set_nonblocking(fds[1]);
|
xset_nonblocking(fds[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,14 @@ set_nonblocking(int fd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xset_nonblocking(int fd)
|
||||||
|
{
|
||||||
|
if (set_nonblocking(fd)) {
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
set_dscp(int fd, uint8_t dscp)
|
set_dscp(int fd, uint8_t dscp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
|
|
||||||
int set_nonblocking(int fd);
|
int set_nonblocking(int fd);
|
||||||
|
void xset_nonblocking(int fd);
|
||||||
|
|
||||||
int get_max_fds(void);
|
int get_max_fds(void);
|
||||||
|
|
||||||
int lookup_ip(const char *host_name, struct in_addr *address);
|
int lookup_ip(const char *host_name, struct in_addr *address);
|
||||||
|
|||||||
Reference in New Issue
Block a user