summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-07-12 11:44:51 +0200
committerKay Sievers <kay.sievers@suse.de>2005-07-12 11:44:51 +0200
commitcbbde2ba6c19d6515f09a2ed0955eb2808c91198 (patch)
treed7108d5c96d6b9df60f089e9e8eebed167c05758
parentef520ba25f540a3c552e941351f772fbba7be5d9 (diff)
udevd: set incoming socket buffer SO_RCVBUF to maximum
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
-rw-r--r--udevd.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/udevd.c b/udevd.c
index 8782c615e3..110d8e7c4d 100644
--- a/udevd.c
+++ b/udevd.c
@@ -167,7 +167,7 @@ static void msg_queue_insert(struct uevent_msg *msg)
}
/* forks event and removes event from run queue when finished */
-static void execute_udev(struct uevent_msg *msg)
+static void udev_event_fork(struct uevent_msg *msg)
{
char *const argv[] = { "udev", msg->subsystem, NULL };
pid_t pid;
@@ -181,12 +181,10 @@ static void execute_udev(struct uevent_msg *msg)
close(uevent_netlink_sock);
close(udevd_sock);
logging_close();
-
setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY);
execve(udev_bin, argv, msg->envp);
err("exec of child failed");
_exit(1);
- break;
case -1:
err("fork of child failed");
msg_queue_delete(msg);
@@ -389,7 +387,7 @@ static void exec_queue_manager(void)
if (running_with_devpath(loop_msg, max_childs) == 0) {
/* move event to run list */
list_move_tail(&loop_msg->node, &running_list);
- execute_udev(loop_msg);
+ udev_event_fork(loop_msg);
running++;
dbg("moved seq %llu to running list", loop_msg->seqnum);
} else
@@ -722,6 +720,7 @@ static void user_sighandler(void)
static int init_udevd_socket(void)
{
struct sockaddr_un saddr;
+ const int buffersize = 1024 * 1024;
socklen_t addrlen;
const int feature_on = 1;
int retval;
@@ -738,6 +737,9 @@ static int init_udevd_socket(void)
return -1;
}
+ /* set receive buffersize */
+ setsockopt(udevd_sock, SOL_SOCKET, SO_RCVBUF, &buffersize, sizeof(buffersize));
+
/* the bind takes care of ensuring only one copy running */
retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen);
if (retval < 0) {
@@ -755,6 +757,7 @@ static int init_udevd_socket(void)
static int init_uevent_netlink_sock(void)
{
struct sockaddr_nl snl;
+ const int buffersize = 1024 * 1024;
int retval;
memset(&snl, 0x00, sizeof(struct sockaddr_nl));
@@ -768,6 +771,9 @@ static int init_uevent_netlink_sock(void)
return -1;
}
+ /* set receive buffersize */
+ setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUF, &buffersize, sizeof(buffersize));
+
retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl,
sizeof(struct sockaddr_nl));
if (retval < 0) {