Re: [PATCH v2] Cygwin: Fix error return for madvise()
Takashi Yano <[email protected]> Fri, 10 Jul 2026 22:27:33 +0900
| Newsgroups | gmane.os.cygwin.patches |
|---|---|
| Message-ID | <[email protected]> |
Hi Christian,
On Fri, 10 Jul 2026 13:13:43 +0200
Christian Franke wrote:
> Hi Mark,
>
> Mark Geisert wrote:
> > Hi Christian,
> >
> > On 7/8/2026 7:58 AM, Christian Franke wrote:
> >> 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'.
> >
> > I prefer to keep both 'goto out' so there's just one exit from the
> > function to aid future debugging. Perhaps that's an old-school habit.
>
> :-)
>
> Don't take me wrong, the patch is GTG, IMO.
I agree. Would you push the patch?
--
Takashi Yano <[email protected]>