From owner-freebsd-current Tue Nov 14 08:16:09 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id IAA17447 for current-outgoing; Tue, 14 Nov 1995 08:16:09 -0800 Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id IAA17438 for ; Tue, 14 Nov 1995 08:16:06 -0800 Received: by halloran-eldar.lcs.mit.edu; (5.65/1.1.8.2/19Aug95-0530PM) id AA23508; Tue, 14 Nov 1995 11:16:03 -0500 Date: Tue, 14 Nov 1995 11:16:03 -0500 From: "Garrett A. Wollman" Message-Id: <9511141616.AA23508@halloran-eldar.lcs.mit.edu> To: Poul-Henning Kamp Cc: current@freebsd.org Subject: Re: cvs commit: src/sys/kern kern_sysctl.c In-Reply-To: <570.816343308@critter.tfs.com> References: <570.816343308@critter.tfs.com> Sender: owner-current@freebsd.org Precedence: bulk < said: >> If you dont do the above change, gethostname(buf, 64) will fail with >> ENOMEM, and cause gated, amd and mountd to fail. > Well, what if the hostname actually WAS 255 bytes long then ? Then you return an error. > I would rather it fail all the time and we can get the code fixed, > than having a mismatch between expectations like this... I would prefer for it to obey the standard. Digital UNIX 3.2: The gethostname() function retrieves the standard host name of the local host. If sufficient space is provided, the returned address parameter is null-terminated. System hostnames are limited to MAXHOSTNAMELEN as defined in the /usr/include/sys/param.h file. Ultrix 4.2: The gethostname system call returns the standard host name for the current processor, as previously set by sethostname. The namelen param- eter specifies the size of the name array. The returned name is null- terminated unless insufficient space is provided. SunOS 4.1.1: gethostname() returns the standard host name for the current processor, as previously set by sethostname(). The parame- ter namelen specifies the size of the array pointed to by name. The returned name is null-terminated unless insuffi- cient space is provided. FreeBSD 2.2: Gethostname() returns the standard host name for the current processor, as previously set by sethostname(). The parameter namelen specifies the size of the name array. The returned name is null-terminated unless in- sufficient space is provided. > get some variable > old buffer too small, > new buffer correct. > it should return ENOMEM because it cannot copyout, but should the > new value be installed ? No. > I'm seriously considering allowing only a "get" or a "set" per syscall, > not both. > But then again, that is too draconian isn't it ? Yes. It defeats the whole purpose of having `new' and `old' parameters in one call, which presently allow you to atomically get-and-set the value of a variable. -GAWollman -- Garrett A. Wollman | Shashish is simple, it's discreet, it's brief. ... wollman@lcs.mit.edu | Shashish is the bonding of hearts in spite of distance. Opinions not those of| It is a bond more powerful than absence. We like people MIT, LCS, ANA, or NSA| who like Shashish. - Claude McKenzie + Florent Vollant