* what's the purpose of MAXHOSTNAMELEN?
@ 2009-12-29 19:19 Robert P. J. Day
2009-12-29 19:28 ` Samuel Thibault
2009-12-29 19:40 ` Jeff Garzik
0 siblings, 2 replies; 8+ messages in thread
From: Robert P. J. Day @ 2009-12-29 19:19 UTC (permalink / raw)
To: Linux Kernel Mailing List
in prepping for coalescing a lot of param.h files, i'm curious about
the purpose of this macro:
$ grep -rw MAXHOSTNAMELEN *
arch/s390/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/sparc/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/alpha/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/mn10300/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/arm/include/asm/param.h:#define MAXHOSTNAMELEN 64
arch/m32r/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/mips/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/m68k/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/xtensa/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/ia64/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/h8300/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/avr32/include/asm/param.h:#define MAXHOSTNAMELEN 64
arch/cris/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/um/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/powerpc/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/parisc/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
arch/frv/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
include/asm-generic/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
include/net/sctp/structs.h:#include <asm/param.h> /* We get MAXHOSTNAMELEN. */
$
so lots of people define it but no one uses it. it *is* exported to
user space in /usr/include/asm/param.h, but i still have no idea what
it's for in user space. obsolete?
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: what's the purpose of MAXHOSTNAMELEN?
2009-12-29 19:19 what's the purpose of MAXHOSTNAMELEN? Robert P. J. Day
@ 2009-12-29 19:28 ` Samuel Thibault
2009-12-29 19:40 ` Jeff Garzik
1 sibling, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2009-12-29 19:28 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: Linux Kernel Mailing List
Robert P. J. Day, le Tue 29 Dec 2009 14:19:30 -0500, a écrit :
> so lots of people define it but no one uses it. it *is* exported to
> user space in /usr/include/asm/param.h, but i still have no idea what
> it's for in user space. obsolete?
It's like all these *MAX* #defines: they are a bad way to express the
system limitations. They are bad because they end up compiled-in, but
also because people understand them as "a typical allocation length" and
get lazy. The typical example is PATH_MAX, which is #defined to 4096.
A _lot_ of applications thus keep allocating 4KB for all paths.
See
http://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL
If you could drop it (would be completely POSIX-compliant), that'd be a
great service to GNU/Hurd porters, but I bet you'll also get a lot of
angry people.
Samuel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: what's the purpose of MAXHOSTNAMELEN?
2009-12-29 19:19 what's the purpose of MAXHOSTNAMELEN? Robert P. J. Day
2009-12-29 19:28 ` Samuel Thibault
@ 2009-12-29 19:40 ` Jeff Garzik
2009-12-29 19:56 ` Samuel Thibault
2009-12-29 20:13 ` Robert P. J. Day
1 sibling, 2 replies; 8+ messages in thread
From: Jeff Garzik @ 2009-12-29 19:40 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: Linux Kernel Mailing List
On 12/29/2009 02:19 PM, Robert P. J. Day wrote:
>
> in prepping for coalescing a lot of param.h files, i'm curious about
> the purpose of this macro:
>
> $ grep -rw MAXHOSTNAMELEN *
> arch/s390/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/sparc/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/alpha/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/mn10300/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/arm/include/asm/param.h:#define MAXHOSTNAMELEN 64
> arch/m32r/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/mips/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/m68k/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/xtensa/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/ia64/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/h8300/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/avr32/include/asm/param.h:#define MAXHOSTNAMELEN 64
> arch/cris/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/um/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/powerpc/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/parisc/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> arch/frv/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> include/asm-generic/param.h:#define MAXHOSTNAMELEN 64 /* max length of hostname */
> include/net/sctp/structs.h:#include<asm/param.h> /* We get MAXHOSTNAMELEN. */
> $
>
> so lots of people define it but no one uses it. it *is* exported to
> user space in /usr/include/asm/param.h, but i still have no idea what
> it's for in user space. obsolete?
According to RFC 1034, "Each node has a label, which is zero to 63
octets in length"
What is it used for in userspace, and why is it export from the kernel?
Good question...
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: what's the purpose of MAXHOSTNAMELEN?
2009-12-29 19:40 ` Jeff Garzik
@ 2009-12-29 19:56 ` Samuel Thibault
2009-12-29 20:20 ` Jeff Garzik
2009-12-29 20:13 ` Robert P. J. Day
1 sibling, 1 reply; 8+ messages in thread
From: Samuel Thibault @ 2009-12-29 19:56 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Robert P. J. Day, Linux Kernel Mailing List
Jeff Garzik, le Tue 29 Dec 2009 14:40:05 -0500, a écrit :
> On 12/29/2009 02:19 PM, Robert P. J. Day wrote:
> >arch/s390/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max
> >length of hostname */
> >
> > so lots of people define it but no one uses it. it *is* exported to
> >user space in /usr/include/asm/param.h, but i still have no idea what
> >it's for in user space. obsolete?
>
> According to RFC 1034, "Each node has a label, which is zero to 63
> octets in length"
That's for Internet networks. Other kinds of networks could implement
more. It could make sense to restrict ourself to Internet standards,
but we don't :)
> What is it used for in userspace, and why is it export from the kernel?
Gethostname, typically, but also all kinds of functions that provide a
hostname. It's also quite often completely badly used, for instance for
getnameinfo()...
You have Debian's list on
http://unstable.buildd.net/buildd/hurd-i386_Failed.html
Samuel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: what's the purpose of MAXHOSTNAMELEN?
2009-12-29 19:40 ` Jeff Garzik
2009-12-29 19:56 ` Samuel Thibault
@ 2009-12-29 20:13 ` Robert P. J. Day
1 sibling, 0 replies; 8+ messages in thread
From: Robert P. J. Day @ 2009-12-29 20:13 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Linux Kernel Mailing List
On Tue, 29 Dec 2009, Jeff Garzik wrote:
... snip ..
> > so lots of people define it but no one uses it. it *is*
> > exported to user space in /usr/include/asm/param.h, but i still
> > have no idea what it's for in user space. obsolete?
>
> According to RFC 1034, "Each node has a label, which is zero to 63
> octets in length"
>
> What is it used for in userspace, and why is it export from the
> kernel? Good question...
it's not clear what value that macro has in user space since (as
i've always understood it) the point of exporting a macro like that to
user space is so that user space apps can *agree* with kernel code
that employs the same macro.
but if absolutely *nothing* in the kernel uses that macro, then
there's nothing for user space to "agree" with. in other words, that
macro cannot *possibly* have any meaningful value in user space. does
that make sense?
my reaction at this point is to simply remove that macro definition
from include/asm-generic/param.h. anything in user space that's using
that macro is simply using a macro with a completely arbitrary value.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: what's the purpose of MAXHOSTNAMELEN?
2009-12-29 19:56 ` Samuel Thibault
@ 2009-12-29 20:20 ` Jeff Garzik
2009-12-29 20:26 ` Samuel Thibault
2009-12-29 21:00 ` Vikram Dhillon
0 siblings, 2 replies; 8+ messages in thread
From: Jeff Garzik @ 2009-12-29 20:20 UTC (permalink / raw)
To: Samuel Thibault, Robert P. J. Day, Linux Kernel Mailing List
On 12/29/2009 02:56 PM, Samuel Thibault wrote:
> Jeff Garzik, le Tue 29 Dec 2009 14:40:05 -0500, a écrit :
>> On 12/29/2009 02:19 PM, Robert P. J. Day wrote:
>>> arch/s390/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max
>>> length of hostname */
>>>
>>> so lots of people define it but no one uses it. it *is* exported to
>>> user space in /usr/include/asm/param.h, but i still have no idea what
>>> it's for in user space. obsolete?
>>
>> According to RFC 1034, "Each node has a label, which is zero to 63
>> octets in length"
>
> That's for Internet networks. Other kinds of networks could implement
> more. It could make sense to restrict ourself to Internet standards,
> but we don't :)
Er huh? That was a description of the origin of the limit.
And as a point of fact, we do restrict ourself to that:
#define __NEW_UTS_LEN 64
struct new_utsname {
char sysname[__NEW_UTS_LEN + 1];
char nodename[__NEW_UTS_LEN + 1];
>> What is it used for in userspace, and why is it export from the kernel?
>
> Gethostname, typically, but also all kinds of functions that provide a
> hostname. It's also quite often completely badly used, for instance for
> getnameinfo()...
>
> You have Debian's list on
> http://unstable.buildd.net/buildd/hurd-i386_Failed.html
No one cares about Hurd.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: what's the purpose of MAXHOSTNAMELEN?
2009-12-29 20:20 ` Jeff Garzik
@ 2009-12-29 20:26 ` Samuel Thibault
2009-12-29 21:00 ` Vikram Dhillon
1 sibling, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2009-12-29 20:26 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Robert P. J. Day, Linux Kernel Mailing List
Jeff Garzik, le Tue 29 Dec 2009 15:20:56 -0500, a écrit :
> >>What is it used for in userspace, and why is it export from the kernel?
> >
> >Gethostname, typically, but also all kinds of functions that provide a
> >hostname. It's also quite often completely badly used, for instance for
> >getnameinfo()...
> >
> >You have Debian's list on
> >http://unstable.buildd.net/buildd/hurd-i386_Failed.html
>
> No one cares about Hurd.
That wasn't at all the point of my inclusion of the URL, see above. If
you drop it, you'll get all kinds of build failures. I just happened to
use the Debian Hurd build failures as a quick way to get a list.
Samuel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: what's the purpose of MAXHOSTNAMELEN?
2009-12-29 20:20 ` Jeff Garzik
2009-12-29 20:26 ` Samuel Thibault
@ 2009-12-29 21:00 ` Vikram Dhillon
1 sibling, 0 replies; 8+ messages in thread
From: Vikram Dhillon @ 2009-12-29 21:00 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Samuel Thibault, Robert P. J. Day, Linux Kernel Mailing List
I care about Hurd :D, but yah as it is mentioned before, would it
sometime in future be possible to remove this from the kernel ?
Regards,
Vikram Dhillon
~~~
There are lots of Linux users who don't care how the kernel works, but
only want to use it. That is a tribute to how good Linux is.
-- Linus Torvalds
On Tue, Dec 29, 2009 at 3:20 PM, Jeff Garzik <jeff@garzik.org> wrote:
> On 12/29/2009 02:56 PM, Samuel Thibault wrote:
>>
>> Jeff Garzik, le Tue 29 Dec 2009 14:40:05 -0500, a écrit :
>>>
>>> On 12/29/2009 02:19 PM, Robert P. J. Day wrote:
>>>>
>>>> arch/s390/include/asm/param.h:#define MAXHOSTNAMELEN 64 /* max
>>>> length of hostname */
>>>>
>>>> so lots of people define it but no one uses it. it *is* exported to
>>>> user space in /usr/include/asm/param.h, but i still have no idea what
>>>> it's for in user space. obsolete?
>>>
>>> According to RFC 1034, "Each node has a label, which is zero to 63
>>> octets in length"
>>
>> That's for Internet networks. Other kinds of networks could implement
>> more. It could make sense to restrict ourself to Internet standards,
>> but we don't :)
>
> Er huh? That was a description of the origin of the limit.
>
> And as a point of fact, we do restrict ourself to that:
>
> #define __NEW_UTS_LEN 64
>
> struct new_utsname {
> char sysname[__NEW_UTS_LEN + 1];
> char nodename[__NEW_UTS_LEN + 1];
>
>
>
>>> What is it used for in userspace, and why is it export from the kernel?
>>
>> Gethostname, typically, but also all kinds of functions that provide a
>> hostname. It's also quite often completely badly used, for instance for
>> getnameinfo()...
>>
>> You have Debian's list on
>> http://unstable.buildd.net/buildd/hurd-i386_Failed.html
>
> No one cares about Hurd.
>
> Jeff
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-12-29 21:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-29 19:19 what's the purpose of MAXHOSTNAMELEN? Robert P. J. Day
2009-12-29 19:28 ` Samuel Thibault
2009-12-29 19:40 ` Jeff Garzik
2009-12-29 19:56 ` Samuel Thibault
2009-12-29 20:20 ` Jeff Garzik
2009-12-29 20:26 ` Samuel Thibault
2009-12-29 21:00 ` Vikram Dhillon
2009-12-29 20:13 ` Robert P. J. Day
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox