mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 04:22:55 +08:00
Support building on Solaris 11
Took care of remaining issues preventing fish from building on Solaris. Mainly caused by some assumptions that certain defines are POSIX when they are not (`NAME_MAX`). Moved `NAME_MAX` defines to common.h - for some reason, it was being defined in a cpp file (`env_universal_common.cpp`) even though it is used in multiple source files. Now compiles on Solaris 11 with GNU Make. Still some warnings because fish was written with GNU getopt in mind and the Solaris version doesn't use `const char *` but rather just `char *` for getopt values, but it builds nevertheless. Assuming this closes #3340
This commit is contained in:
parent
9fdfe44236
commit
ffebe74885
12
src/common.h
12
src/common.h
|
@ -4,6 +4,7 @@
|
|||
#include "config.h" // IWYU pragma: keep
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h> // IWYU pragma: keep
|
||||
#include <stddef.h>
|
||||
|
@ -90,6 +91,17 @@ typedef std::vector<wcstring> wcstring_list_t;
|
|||
#define INPUT_COMMON_BASE (wchar_t)0xF700
|
||||
#define INPUT_COMMON_END (INPUT_COMMON_BASE + 64)
|
||||
|
||||
// NAME_MAX is not defined on Solaris
|
||||
#if !defined(NAME_MAX)
|
||||
#include <sys/param.h>
|
||||
#if defined(MAXNAMELEN)
|
||||
// MAXNAMELEN is defined on Linux, BSD, and Solaris among others
|
||||
#define NAME_MAX MAXNAMELEN
|
||||
#else
|
||||
static_assert(false, "Neither NAME_MAX nor MAXNAMELEN is defined!");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
enum escape_string_style_t { STRING_STYLE_SCRIPT, STRING_STYLE_URL, STRING_STYLE_VAR };
|
||||
|
||||
// Flags for unescape_string functions.
|
||||
|
|
|
@ -55,13 +55,6 @@
|
|||
#include <bsd/ifaddrs.h>
|
||||
#endif // Haiku
|
||||
|
||||
// NAME_MAX is not defined on Solaris and suggests the use of pathconf()
|
||||
// There is no obvious sensible pathconf() for shared memory and _XPG_NAME_MAX
|
||||
// seems a reasonable choice.
|
||||
#if !defined(NAME_MAX) && defined(_XOPEN_NAME_MAX)
|
||||
#define NAME_MAX _XOPEN_NAME_MAX
|
||||
#endif
|
||||
|
||||
/// The set command.
|
||||
#define SET_STR L"SET"
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ bool wreaddir(DIR *dir, wcstring &out_name) {
|
|||
// long when it should be at least NAME_MAX + 1.
|
||||
union {
|
||||
struct dirent d;
|
||||
char c[offsetof(struct dirent, d_name) + NAME_MAX + 1]; /* NAME_MAX is POSIX. */
|
||||
char c[offsetof(struct dirent, d_name) + NAME_MAX + 1];
|
||||
} d_u;
|
||||
struct dirent *result = NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user