Deleted Added
full compact
devd.cc (262914) devd.cc (263758)
1/*-
2 * Copyright (c) 2002-2010 M. Warner Losh.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 49 unchanged lines hidden (view full) ---

58 */
59
60// TODO list:
61// o devd.conf and devd man pages need a lot of help:
62// - devd needs to document the unix domain socket
63// - devd.conf needs more details on the supported statements.
64
65#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002-2010 M. Warner Losh.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 49 unchanged lines hidden (view full) ---

58 */
59
60// TODO list:
61// o devd.conf and devd man pages need a lot of help:
62// - devd needs to document the unix domain socket
63// - devd.conf needs more details on the supported statements.
64
65#include <sys/cdefs.h>
66__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 262914 2014-03-07 23:30:48Z asomers $");
66__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 263758 2014-03-26 02:25:40Z mjg $");
67
68#include <sys/param.h>
69#include <sys/socket.h>
70#include <sys/stat.h>
71#include <sys/sysctl.h>
72#include <sys/types.h>
73#include <sys/wait.h>
74#include <sys/un.h>

--- 22 unchanged lines hidden (view full) ---

97#include <list>
98#include <vector>
99
100#include "devd.h" /* C compatible definitions */
101#include "devd.hh" /* C++ class definitions */
102
103#define PIPE "/var/run/devd.pipe"
104#define CF "/etc/devd.conf"
67
68#include <sys/param.h>
69#include <sys/socket.h>
70#include <sys/stat.h>
71#include <sys/sysctl.h>
72#include <sys/types.h>
73#include <sys/wait.h>
74#include <sys/un.h>

--- 22 unchanged lines hidden (view full) ---

97#include <list>
98#include <vector>
99
100#include "devd.h" /* C compatible definitions */
101#include "devd.hh" /* C++ class definitions */
102
103#define PIPE "/var/run/devd.pipe"
104#define CF "/etc/devd.conf"
105#define SYSCTL "hw.bus.devctl_disable"
105#define SYSCTL "hw.bus.devctl_queue"
106
107/*
108 * Since the client socket is nonblocking, we must increase its send buffer to
109 * handle brief event storms. On FreeBSD, AF_UNIX sockets don't have a receive
110 * buffer, so the client can't increate the buffersize by itself.
111 *
112 * For example, when creating a ZFS pool, devd emits one 165 character
113 * resource.fs.zfs.statechange message for each vdev in the pool. A 64k

--- 1045 unchanged lines hidden (view full) ---

1159check_devd_enabled()
1160{
1161 int val = 0;
1162 size_t len;
1163
1164 len = sizeof(val);
1165 if (sysctlbyname(SYSCTL, &val, &len, NULL, 0) != 0)
1166 errx(1, "devctl sysctl missing from kernel!");
106
107/*
108 * Since the client socket is nonblocking, we must increase its send buffer to
109 * handle brief event storms. On FreeBSD, AF_UNIX sockets don't have a receive
110 * buffer, so the client can't increate the buffersize by itself.
111 *
112 * For example, when creating a ZFS pool, devd emits one 165 character
113 * resource.fs.zfs.statechange message for each vdev in the pool. A 64k

--- 1045 unchanged lines hidden (view full) ---

1159check_devd_enabled()
1160{
1161 int val = 0;
1162 size_t len;
1163
1164 len = sizeof(val);
1165 if (sysctlbyname(SYSCTL, &val, &len, NULL, 0) != 0)
1166 errx(1, "devctl sysctl missing from kernel!");
1167 if (val) {
1168 warnx("Setting " SYSCTL " to 0");
1169 val = 0;
1167 if (val == 0) {
1168 warnx("Setting " SYSCTL " to 1000");
1169 val = 1000;
1170 sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val));
1171 }
1172}
1173
1174/*
1175 * main
1176 */
1177int

--- 41 unchanged lines hidden ---
1170 sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val));
1171 }
1172}
1173
1174/*
1175 * main
1176 */
1177int

--- 41 unchanged lines hidden ---