Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/null/null.c
Show All 24 Lines | |||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* | * | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_compat.h" | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/uio.h> | #include <sys/uio.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/disk.h> | #include <sys/disk.h> | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
null_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data __unused, | null_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data __unused, | ||||
int flags __unused, struct thread *td) | int flags __unused, struct thread *td) | ||||
{ | { | ||||
int error; | int error; | ||||
error = 0; | error = 0; | ||||
switch (cmd) { | switch (cmd) { | ||||
#ifdef COMPAT_FREEBSD10 | |||||
case DIOCSKERNELDUMP_FREEBSD10: | |||||
delphij: Why do we need this? (Looks like they are doing the same thing of the new DIOCSKERNELDUMP?)… | |||||
#endif | |||||
case DIOCSKERNELDUMP: | case DIOCSKERNELDUMP: | ||||
error = set_dumper(NULL, NULL, td); | error = set_dumper(NULL, NULL, td, 0, NULL, 0, NULL); | ||||
Done Inline ActionsOr perhaps here we need to pass something in? (Looks like we don't). delphij: Or perhaps here we need to pass something in? (Looks like we don't). | |||||
Done Inline ActionsThis is here so that dumps can be disabled by "setting" them on /dev/null. (That is, there isn't a separate ioctl request to disable dumps, instead /dev/null is (ab)used as a cookie to disable them.) I think a FALLTHROUGH as you suggested is fine, but you can also do it even simpler as: #ifdef COMPAT_FREEBSD10 case DIOCSKERNELDUMPOLD: #endif case DIOCSKERNELDUMP: jhb: This is here so that dumps can be disabled by "setting" them on /dev/null. (That is, there… | |||||
Done Inline ActionsI like this one the most. pjd: I like this one the most. | |||||
break; | break; | ||||
case FIONBIO: | case FIONBIO: | ||||
break; | break; | ||||
case FIOASYNC: | case FIOASYNC: | ||||
if (*(int *)data != 0) | if (*(int *)data != 0) | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
default: | default: | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |
Why do we need this? (Looks like they are doing the same thing of the new DIOCSKERNELDUMP?) Can the two lines below be replaced with a comment like, /* FALLTHROUGH */?