Re: EINTR in ftruncate()
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Andres Freund <andres@anarazel.de>, Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-07-14T21:22:36Z
Lists: pgsql-hackers
Attachments
- 0001-Make-dsm_impl_resize-more-future-proof.patch (text/x-patch) patch 0001
On Fri, Jul 15, 2022 at 3:27 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > > ISTM it would be cleaner to patch PG_SETMASK to have a second argument > > and to return the original mask if that's not NULL. This is more > > invasive, but there aren't that many callsites of that macro. > > [ shoulda read your message before replying ] > > Given that this needs back-patched, I think changing PG_SETMASK > is a bad idea: there might be outside callers. However, we could > add another macro with the additional argument. PG_GET_AND_SET_MASK? It's funny though, the reason we had PG_SETMASK in the first place is not for Windows. Ancient commit 47937403676 added that for long gone pre-POSIX systems like NeXTSTEP which only had single-argument sigsetmask(), not sigprocmask(). In general on Windows we're emulating POSIX signal interfaces with normal names like sigemptyset() etc, it just so happens that we chose to emulate that pre-standard sigsetmask() interface (as you complained about in the commit message for a65e0864). So why would I add another wrapper like PG_SETMASK and leave it unimplemented for now on Windows, when I could just use sigprocmask() directly and leave it unimplemented for now on Windows? The only reason I can think of for a wrapper is to provide a place to check the return code and ereport (panic?). That seems to be of limited value (how can it fail ... bad "how" value, or a sandbox denying some system calls, ...?). I did make sure to preserve the errno though; even though we're assuming these calls can't fail by long standing tradition, I didn't feel like additionally assuming that successful calls don't clobber errno. I guess, coded like this, it should also be safe to do it in the postmaster, but I think maybe we should leave it conditional, rather than relying on BlockSig being initialised and sane during early postmaster initialisation.
Commits
-
Provide sigaction() for Windows.
- b28ac1d24db4 16.0 landed
-
Emulate sigprocmask(), not sigsetmask(), on Windows.
- c94ae9d827a3 16.0 landed
-
Make dsm_impl_posix_resize more future-proof.
- d3b0884c0708 10.22 landed
- 3f2344d4aee1 11.17 landed
- 1661c40b9deb 12.12 landed
- c75b6b454ea1 13.8 landed
- c412c60b91ac 14.5 landed
- 91377a4559d8 15.0 landed
- 3b8d23a3e14f 16.0 landed
-
Don't clobber postmaster sigmask in dsm_impl_resize.
- e26024bea9e9 10.22 landed
- 74a9ee034829 11.17 landed
- a05f40ef874b 12.12 landed
- 17aa39da50c5 13.8 landed
- 8383645592de 14.5 landed
- a715c20043c1 15.0 landed
- 80845b7c0b2c 16.0 landed
-
Create a distinct wait event for POSIX DSM allocation.
- 7bae3bbf62d6 16.0 landed
-
Remove redundant ftruncate() for POSIX DSM memory.
- 712704d3539e 16.0 landed
-
Block signals while allocating DSM memory.
- 4518c798b2b9 16.0 landed
- c4a617ea117e 15.0 landed
- 2019e6ecfa26 14.5 landed
- e73fe6e828d1 13.8 landed
- ff78bf796d80 12.12 landed
- 39683c69a03e 11.17 landed
- 53cfe403c9d2 10.22 landed
-
Remove dsm_resize() and dsm_remap().
- 3c60d0fa231f 12.0 cited
-
XLOG (also known as WAL -:)) Bootstrap/Startup/Shutdown.
- 47937403676d 7.1.1 cited