Project

General

Profile

Actions

Bug #14504

closed

madvise() not declared if _XOPEN_SOURCE defined

Added by Nikita Popov 6 months ago. Updated 6 months ago.

Status:
Duplicate
Priority:
Normal
Category:
headers
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The declaration of madvise() in sys/mman.h is conditional, and will not be declared in a default environment. This forces projects to explicitly declare this function, with the addutuibak complication that you need to pick the signature in a way that is compatible with solaris, as the two operating systems are indistinguishable based on preprocessor defines.

https://reviews.llvm.org/D119695#inline-1144987 suggests that Solaris 11.4 fixed this by using something like this:

```
#if !defined(XOPEN_OR_POSIX) || defined(__EXTENSIONS)
#if !defined(USE_LEGACY_PROTOTYPES)
[...]
extern int madvise(void *, size_t, int);
#else
[...]
extern int madvise(caddr_t, size_t, int);
#endif
```

The suggestion there is that Illumos adopt something similar.

The expected outcome is that if you include <sys/mman.h> without any additional defines, an madvise() declaration becomes available.


Related issues

Is duplicate of illumos gate - Bug #14418: mman.h symbol visibility is a messClosedRobert Mustacchi

Actions
Actions #1

Updated by Robert Mustacchi 6 months ago

  • Category set to headers
  • Status changed from New to Duplicate
  • Assignee set to Robert Mustacchi

We're working on this in #14418. Right now that will eliminate the older prototype and will fix some of the visibility issues. We're sorting out some issues with symbol visibility fallout and expectations through pkgsrc bulk builds, but I'm going to close this a duplicate of that.

Actions #2

Updated by Robert Mustacchi 6 months ago

  • Is duplicate of Bug #14418: mman.h symbol visibility is a mess added
Actions

Also available in: Atom PDF