Date: Thu, 28 Mar 2002 19:56:13 +0100 (CET) From: Matthias Buelow <mkb@wi4d22.informatik.uni-wuerzburg.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/36425: bump up SYS_NMLN in sys/utsname.h Message-ID: <20020328185613.BA3F8AC42@reiher.informatik.uni-wuerzburg.de>
next in thread | raw e-mail | index | archive | help
>Number: 36425 >Category: kern >Synopsis: bump up SYS_NMLN in sys/utsname.h >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Mar 28 11:00:02 PST 2002 >Closed-Date: >Last-Modified: >Originator: Matthias Buelow >Release: FreeBSD 4.5-STABLE i386 >Organization: >Environment: System: FreeBSD reiher.informatik.uni-wuerzburg.de 4.5-STABLE FreeBSD 4.5-STABLE #0: Fri Mar 22 18:00:52 CET 2002 root@reiher.informatik.uni-wuerzburg.de:/usr/src/sys/compile/REIHER i386 >Description: The current definition of the SYS_NMLN constant, which defines the length of the entries of the utsname structure for use with uname(3) is defined in 4.5-STABLE sys/utsname.h as following: #define SYS_NMLN 32 This is probably a leftover from early days and was forgotten to update when Internet hostnames became fashionable (up to 256 characters.) As a result, one cannot reliably obtain the hostname via uname(3), other entries like the "version" field are also truncated. This has caused a problem for me lately because the nmh mailer suite was using uname(3) for obtaining the hostname and got a truncated one, resulting in some effort for identifying and working around the problem. >How-To-Repeat: >Fix: Update SYS_NMLN to at least 256. On Solaris 8, it is 257 and defined as following: #define _SYS_NMLN 257 /* 4.0 size of utsname elements */ /* Must be at least 257 to */ /* support Internet hostnames. */ On NetBSD (1.5.1) it is: #define _SYS_NMLN 256 It might also be beneficial to not make SYS_NMLN visible in certain cases but define it like the above mentioned systems with a prepended underscore, and only defining the SYS_NMLN constant when certain conditions hold, on NetBSD and Solaris, this is: #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) #define SYS_NMLN _SYS_NMLN #endif although this is just makeup, imho (don't know what the standard has to say here but there seems to be a reason if both do it the same way.) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020328185613.BA3F8AC42>