From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 24 16:17:39 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D132106566C for ; Fri, 24 Dec 2010 16:17:39 +0000 (UTC) (envelope-from hedayati.mo@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id E440F8FC13 for ; Fri, 24 Dec 2010 16:17:38 +0000 (UTC) Received: by wwf26 with SMTP id 26so6868440wwf.31 for ; Fri, 24 Dec 2010 08:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=t/D3E5kQPn93J7QqdfXDbPcEwCst154lOljUt61NFyY=; b=KBSb+n6yjzVLz0zHnqDO4T/au+wutokkV9GxDkrxu8tGXDu1CokD81K55jbR1FPJq8 syrOgAxDsgqK/z4O/T1P8ppN/RTduigt4yxi9VKMymTTCegCEZnbXXLNookZZ8KCSEPe GoraikrU146sQnEIyeOGQJb5pTvTt2SFEYVG0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=tsJ8hU66xui5pZ20h0ohX5LfykHZQ1puy8n04M8DPHPHCv7VewnG/DUCtLf6W8rq9q xjiUb2xcUwhao89sT09ZP9RSWa461neGgo+mmUFxiiPhR/rQr/LgXcCaRPUin3hHgHZa W5MUeJ9egWRIJht7XOf+EO9O0Vclp/ROhkQKw= Received: by 10.227.176.134 with SMTP id be6mr5806639wbb.147.1293207457867; Fri, 24 Dec 2010 08:17:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.143.202 with HTTP; Fri, 24 Dec 2010 08:16:56 -0800 (PST) In-Reply-To: References: <20101224170144.1d734e3c@ernst.jennejohn.org> From: Mohammad Hedayati Date: Fri, 24 Dec 2010 19:46:56 +0330 Message-ID: To: freebsd-hackers@freebsd.org X-Mailman-Approved-At: Fri, 24 Dec 2010 18:48:23 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Inappropriate ioctl for device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Dec 2010 16:17:39 -0000 On Fri, Dec 24, 2010 at 7:37 PM, Mohammad Hedayati wrote: > > > On Fri, Dec 24, 2010 at 7:31 PM, Gary Jennejohn > wrote: > >> On Fri, 24 Dec 2010 18:17:18 +0330 >> Mohammad Hedayati wrote: >> >> > I'm writing a simple char device. So far everything went so good >> > (read/write), but here I'm going to add support for ioctl. >> > >> > int >> > ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct >> thread *td) >> > { >> > int error = 0; >> > uprintf("Here...\n"); >> > return(error); >> > } >> > and I'm calling it here: >> > >> > len = ioctl(cd, 0); >> > perror("ioctl"); >> > >> > but when runnig it says: >> > >> > ioctl: Inappropriate ioctl for device >> >> Carefully read ioctl(2) and consider that you're passing in 0 as the cmd. >> If you still don't understand your error, post again. >> >> Hint: look at /sys/kern/sys_generic.c:^ioctl >> >> -- >> Gary Jennejohn >> > > It was a misspelling, I'm doing as bellow, if you mean the u_long. > > unsinged long cmd = 0; > len = ioctl(cd, cmd); > > Thanks, Problem is solved!