R: [PATCH] replace RFC2181 magic numbers with POSIX definitions

From: Guido Serassio <guido.serassio_at_acmeconsulting.it>
Date: Sat, 21 Nov 2009 10:10:07 +0100

Hi Amos,

If I remember right, MAXHOSTNAMELEN and MAXPATHLEN are not definend on
Windows and some _POSIX defines are available only building in POSIX
mode (Squid is build in native mode because win32 API are not exposed in
POSIX mode).

From limits.h:

#ifdef _POSIX_

#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_TZNAME_MAX 3

#define ARG_MAX 14500 /* 16k heap, minus overhead */
#define LINK_MAX 1024
#define MAX_CANON _POSIX_MAX_CANON
#define MAX_INPUT _POSIX_MAX_INPUT
#define NAME_MAX 255
#define NGROUPS_MAX 16
#define OPEN_MAX 32
#define PATH_MAX 512
#define PIPE_BUF _POSIX_PIPE_BUF
#define SSIZE_MAX _POSIX_SSIZE_MAX
#define STREAM_MAX 20
#define TZNAME_MAX 10

#endif /* POSIX */

Regards

Guido

Guido Serassio
Acme Consulting S.r.l.
Microsoft Gold Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: guido.serassio_at_acmeconsulting.it
WWW: http://www.acmeconsulting.it

> -----Messaggio originale-----
> Da: Amos Jeffries [mailto:squid3_at_treenet.co.nz]
> Inviato: sabato 21 novembre 2009 6.55
> A: Squid Developers
> Oggetto: [PATCH] replace RFC2181 magic numbers with POSIX definitions
>
> The maximum length of host names is provided by POSIX-compliant
> compilers. MAXHOSTNAMELEN is a standard definition relative to those
> values so we do not need the magic numbers. The actual RC2181 texts
> describe the same limits defined by POSIX IEEE Std 1003.1.
>
> There are some slightly-broken systems which use an older POSIX
standard
> with much smaller values. But I feel we should obey those system
limits
> and not pass their kernels larger chunks of data.
>
> This makes use of the standard values instead of our magic numbers.
>
> Votes?
>
> Amos
Received on Sat Nov 21 2009 - 09:10:15 MST

This archive was generated by hypermail 2.2.0 : Sat Nov 21 2009 - 12:00:05 MST