Re: [PATCH v2] Cygwin: Fix error return for madvise()
Christian Franke <[email protected]> Wed, 8 Jul 2026 16:58:02 +0200
| Newsgroups | gmane.os.cygwin.patches |
|---|---|
| Message-ID | <[email protected]> |
Mark Geisert wrote:
> Currently madvise() and posix_madvise() are wired together as one
> function: the latter. But their error returns should be different.
> Make madvise a first-class export in cygwin.din.
>
> v2: Create madvise_worker() and have madvise() and posix_madvise()
> call it, then handling their error returns compliant to POSIX.
> Add a release note for 3.7.0.
LGTM, thanks!
> ...
> -extern "C" int
> -posix_madvise (void *addr, size_t len, int advice)
> +static int
> +madvise_worker (void *addr, size_t len, int advice)
> {
> int ret = 0;
> /* Check parameters. */
> @@ -1514,6 +1514,26 @@ posix_madvise (void *addr, size_t len, int advice)
> break;
> }
> out:
> + return ret;
> +}
PS: The 'goto out' could now be replaced by 'return ref'.
--
Regards,
Christan