From owner-freebsd-current Sat Jul 29 1:18:53 2000 Delivered-To: freebsd-current@freebsd.org Received: from localhost (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 84FE137B680; Sat, 29 Jul 2000 01:18:48 -0700 (PDT) (envelope-from green@FreeBSD.org) Date: Sat, 29 Jul 2000 04:18:47 -0400 (EDT) From: Brian Fundakowski Feldman X-Sender: green@green.dyndns.org To: Hiroyuki Hanai Cc: current@FreeBSD.org, markm@FreeBSD.org Subject: Re: fcntl and /dev/random In-Reply-To: <8266pp602g.wl@darkmatter.imgsrc.co.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 29 Jul 2000, Hiroyuki Hanai wrote: > > Setting status flags using F_SETFL command of fcntl(2) on the file > descriptor, which is returned by open(2)ing /dev/random, seems not to > be supported. For example, when I run following code; > > [...] > > 3.4-RELEASE(and possibly 3.5 and 3.5.1) and 4.1-RELEASE/4.1-STABLE say > `Inappropriate ioctl for device' and 5-current says `Operation not > supported by device'. EOPNOTSUPP is definitely wrong. Try this: Index: randomdev.c =================================================================== RCS file: /usr2/ncvs/src/sys/dev/randomdev/randomdev.c,v retrieving revision 1.10 diff -u -u -1 -r1.10 randomdev.c --- randomdev.c 2000/07/25 21:22:17 1.10 +++ randomdev.c 2000/07/29 08:12:47 @@ -51,2 +51,3 @@ static d_write_t random_write; +static d_ioctl_t random_ioctl; @@ -61,3 +62,3 @@ /* write */ random_write, - /* ioctl */ noioctl, + /* ioctl */ random_ioctl, /* poll */ nopoll, @@ -133,2 +134,9 @@ return error; +} + +static int +random_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +{ + + return (ENOTTY); } > I've found above in BIND9's source and its `named' program complains > everytime it's invoked. > > Should I fix BIND9's code? or wait for fcntl's F_SETFL being > supported on FreeBSD? Err, this is a minor bug, but should definitely be fixed. > Actually, in BIND9, fd is already open(2)ed with `O_RDONLY | O_NONBLOCK' > and setting O_NONBLOCK status with fcntl(2) is not needed, which means > that fixing BIND9's code is very simple; just comment out the fcntl(2)ing line. I'd say send that to the maintainer :) > h.hanai -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message