Add more compat defs for code compiled for !NetBSD targets.

At least GNU Hurd lacks MAXHOSTNAMELEN/MAXPATHLEN/PATH_MAX, so make sure
those have some arbitrary semi-sane values.

from Robert Millan in PR misc/50166, with some modifications from myself
This commit is contained in:
pooka 2015-09-21 21:50:16 +00:00
parent eabbabd2c3
commit bc0dc0b26e
3 changed files with 34 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser_port.h,v 1.45 2015/08/16 11:37:39 pooka Exp $ */
/* $NetBSD: rumpuser_port.h,v 1.46 2015/09/21 21:50:16 pooka Exp $ */
#ifndef _LIB_LIBRUMPUSER_RUMPUSER_PORT_H_
#define _LIB_LIBRUMPUSER_RUMPUSER_PORT_H_
@ -314,4 +314,16 @@ do { \
#define setprogname(a)
#endif
/* at least GNU Hurd does not specify various common hardcoded constants */
#include <limits.h>
#ifndef MAXPATHLEN
#define MAXPATHLEN 4096
#endif
#ifndef PATH_MAX
#define PATH_MAX MAXPATHLEN
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
#endif /* _LIB_LIBRUMPUSER_RUMPUSER_PORT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_defs.h,v 1.102 2015/07/26 14:01:53 kamil Exp $ */
/* $NetBSD: compat_defs.h,v 1.103 2015/09/21 21:50:16 pooka Exp $ */
#ifndef __NETBSD_COMPAT_DEFS_H__
#define __NETBSD_COMPAT_DEFS_H__
@ -910,6 +910,13 @@ void *setmode(const char *);
#define LLONG_MIN ((long long)(~LLONG_MAX))
#endif
#ifndef MAXPATHLEN
#define MAXPATHLEN 4096
#endif
#ifndef PATH_MAX
#define PATH_MAX MAXPATHLEN
#endif
/* <paths.h> */
/* The host's _PATH_BSHELL might be broken, so override it. */
@ -1149,6 +1156,9 @@ __GEN_ENDIAN_DEC(64, le)
#ifndef MAXPHYS
#define MAXPHYS (64 * 1024)
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
/* XXX needed by makefs; this should be done in a better way */
#undef btodb

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.95 2014/09/07 20:55:34 joerg Exp $ */
/* $NetBSD: make.h,v 1.96 2015/09/21 21:50:16 pooka Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -503,4 +503,13 @@ int str2Lst_Append(Lst, char *, const char *);
#define MAX(a, b) ((a > b) ? a : b)
#endif
/* At least GNU/Hurd systems lack hardcoded MAXPATHLEN/PATH_MAX */
#include <limits.h>
#ifndef MAXPATHLEN
#define MAXPATHLEN 4096
#endif
#ifndef PATH_MAX
#define PATH_MAX MAXPATHLEN
#endif
#endif /* _MAKE_H_ */