libdeflate icon indicating copy to clipboard operation
libdeflate copied to clipboard

Openindiana (solaris): error in gzip.c

Open vtorri opened this issue 1 year ago • 2 comments

with git of today, 2 errors and 1 warning in gzip.c

line 357, the 2 errors with incompatible types when initializing line 359 : futimens is not declared

illumos made some errors in time*.h header files, and they are not available (yet, as there is an issue opened for this problem). __EXTENSIONS__ macro should be defined to fix those errors and the warning. (that's what illumos devs told me to do). For example, at the top of gzip.c:

#ifdef __sun
#  define __EXTENSIONS__
#endif

vtorri avatar Sep 11 '22 07:09 vtorri

Do you have a citation for this being the "correct" way to make futimens() available on OpenIndiana? Why doesn't #define POSIX_C_SOURCE 200809L work?

ebiggers avatar Sep 17 '22 00:09 ebiggers

read the IRC log here: https://log.omnios.org/illumos/2022-08-26 which also applies to futimens()

The answer is that the function is not guarded by POSIX_C_SOURCE. Relevant part of sys/stat.h:

#if defined(__EXTENSIONS__) || defined(_ATFILE_SOURCE) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
/* || defined(_XPG7) */
extern int mkdirat(int, const char *, mode_t);
extern int mkfifoat(int, const char *, mode_t);
extern int mknodat(int, const char *, mode_t, dev_t);
extern int fchmodat(int, const char *, mode_t, int);
extern int futimens(int, const struct timespec[2]);
extern int utimensat(int, const char *, const struct timespec[2], int);
#endif /* defined(__EXTENSIONS__) ... */

vtorri avatar Sep 17 '22 05:09 vtorri