From 39f34cf425d48400fda43dad1c66fc3edbb053ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 8 Jun 2004 05:53:35 +0000 Subject: [PATCH] Fixed the broken ioctl() function. Unlike BeOS, it also passes the eventually specified length parameter. The IOCPARM_LEN() macro should be used by the device/file system implementation only if applicable. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7828 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/unistd/ioctl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/kernel/libroot/posix/unistd/ioctl.c b/src/kernel/libroot/posix/unistd/ioctl.c index 625de008a8..3f2493933c 100644 --- a/src/kernel/libroot/posix/unistd/ioctl.c +++ b/src/kernel/libroot/posix/unistd/ioctl.c @@ -1,12 +1,11 @@ /* -** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ #include #include -#include #include #include @@ -23,12 +22,17 @@ int ioctl(int fd, ulong cmd, ...) { va_list args; - int err; + void *argument; + size_t size; + int status; va_start(args, cmd); - err = sys_ioctl(fd, cmd, args, IOCPARM_LEN(cmd)); + argument = va_arg(args, void *); + size = va_arg(args, size_t); va_end(args); - RETURN_AND_SET_ERRNO(err) + status = sys_ioctl(fd, cmd, argument, size); + + RETURN_AND_SET_ERRNO(status) }