bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: porting kerberos


From: Roland McGrath
Subject: Re: porting kerberos
Date: Thu, 7 Jun 2001 19:47:23 -0400 (EDT)

> #ifndef NCARGS
> /* Linux doesn't seem to have it.  */
> #define NCARGS 1024
> #endif
> 
> char cmdbuf[NCARGS+1]
>
> We define NCARGS to INTMAX for compatibility with BSD programs
> (in <sys/param.h>).  If this is how BSD programs use that value,
> we should probably define it to a lower value ;) or not define it at
> all (but as I can see, we try to be BSD compatible).
> I only noticed this because gcc complains about a negative error value.

NCARGS is the traditional name for what POSIX calls ARG_MAX.  Current
BSD systems #define NCARGS ARG_MAX in <sys/param.h>.  In POSIX it is
like PATH_MAX, i.e. if undefined you use sysconf(_SC_ARG_MAX) and it's
allowed to be -1 meaning "indeterminate".

My recollection is that we defined NCARGS that way because there was
code that used it as a limit for comparison but not as a buffer size
(probably it was xargs).

Modern programs have no real excuse for not following the POSIX rules,
which in practice means using dynamic allocation unless the program
wants to pick its own arbitrary buffer size.  The limit on some
systems is quite large to be using as a buffer size (very often),
e.g. 1MB or 2MB on Solaris.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]