From owner-freebsd-hackers Sat May 6 12:59:53 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from io.yi.org (24.67.218.186.bc.wave.home.com [24.67.218.186]) by hub.freebsd.org (Postfix) with ESMTP id 4F47437B5AF for ; Sat, 6 May 2000 12:59:42 -0700 (PDT) (envelope-from jburkhol@home.com) Received: from io.yi.org (localhost.gvcl1.bc.wave.home.com [127.0.0.1]) by io.yi.org (Postfix) with ESMTP id 31B4ABCA7; Sat, 6 May 2000 12:58:10 -0700 (PDT) X-Mailer: exmh version 2.1.1 10/15/1999 To: Alexander Langer Cc: hackers@FreeBSD.ORG Subject: Re: problem with ioctl handler in a module In-Reply-To: Message from Alexander Langer of "Sat, 06 May 2000 20:09:40 +0200." <20000506200940.A8087@cichlids.cichlids.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 06 May 2000 12:58:10 -0700 From: Jake Burkholder Message-Id: <20000506195810.31B4ABCA7@io.yi.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Hello! > > I have: > > int ziva_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct > proc* pr) > > when this function catches a ioctl from userspace, called as: > int foo = 199; > ioctl(fd, 10, &foo); > > the u_long cmd contains 10, which is correct (so the ioctl-handler is > called correctly). > > However, I can't get the value of the int. > > I tried something like: > if (*((int *) arg) == 199) > . > > But this doesn't work, is not executed. Somehow, I can't access > the memory this way. > > Anyone knows, what I'm doing wrong? The request parameter to ioctl needs to contain length information. I think you want something like: #define ZIVA_IOCTL _IOW('c', 10, int) int foo = 199; ioctl(fd, ZIVA_IOCTL, &foo); Then arg should be right. See iocomm.h. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message