From owner-freebsd-hackers Fri Jul 13 8:15: 7 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from Awfulhak.org (gw.Awfulhak.org [217.204.245.18]) by hub.freebsd.org (Postfix) with ESMTP id 6469537B406; Fri, 13 Jul 2001 08:15:03 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.4/8.11.4) with ESMTP id f6DFEjs25421; Fri, 13 Jul 2001 16:14:45 +0100 (BST) (envelope-from brian@lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.4/8.11.4) with ESMTP id f6DFGXW60354; Fri, 13 Jul 2001 16:16:33 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200107131516.f6DFGXW60354@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Brian Somers Cc: Alfred Perlstein , Greg Lehey , y-carden@uniandes.edu.co, FreeBSD Hackers , brian@Awfulhak.org Subject: Re: Some questions about kernel programming In-Reply-To: Message from Brian Somers of "Fri, 13 Jul 2001 15:52:29 BST." <200107131452.f6DEqTW59861@hak.lan.Awfulhak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 13 Jul 2001 16:16:33 +0100 From: Brian Somers Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Have a look at the digi driver in -current where I did this. The > caveat is that the kernel code looks ugly. From the driver's ioctl > routine: > > case DIGIIO_IDENT: > return (copyout(sc->name, *(char **)data, > strlen(sc->name) + 1)); > > and from digiio.h: > > #define DIGIIO_IDENT _IOW('e', 'E', char *) > > and from userland (digictl.c): > > char namedata[256], *name = namedata; > .... > } else if (ioctl(fd, DIGIIO_IDENT, &name) != 0) { > Oops, we weren't talking about copyout() :*D There's a copyinstr() function available. Would that solve the problem ? > > -- > > -Alfred Perlstein [alfred@freebsd.org] > > Ok, who wrote this damn function called '??'? > > And why do my programs keep crashing in it? [.....] -- Brian http://www.freebsd-services.com/ Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message