From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: unconstify equivalent for volatile |
Date: | 2019-02-18 20:25:11 |
Message-ID: | 20190218202511.qsfpuj5sy4dbezcw@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2019-02-18 16:39:25 +0100, Peter Eisentraut wrote:
> diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
> index 7da337d11f..fa7d72ef76 100644
> --- a/src/backend/storage/ipc/latch.c
> +++ b/src/backend/storage/ipc/latch.c
> @@ -381,7 +381,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
>
> if (wakeEvents & WL_LATCH_SET)
> AddWaitEventToSet(set, WL_LATCH_SET, PGINVALID_SOCKET,
> - (Latch *) latch, NULL);
> + unvolatize(Latch *, latch), NULL);
>
> /* Postmaster-managed callers must handle postmaster death somehow. */
> Assert(!IsUnderPostmaster ||
ISTM this one should rather be solved by removing all volatiles from
latch.[ch]. As that's a cross-process concern we can't rely on it
anyway (and have placed barriers a few years back to allay concerns /
bugs due to reordering).
> diff --git a/src/backend/storage/ipc/pmsignal.c b/src/backend/storage/ipc/pmsignal.c
> index d707993bf6..48f4311464 100644
> --- a/src/backend/storage/ipc/pmsignal.c
> +++ b/src/backend/storage/ipc/pmsignal.c
> @@ -134,7 +134,7 @@ PMSignalShmemInit(void)
>
> if (!found)
> {
> - MemSet(PMSignalState, 0, PMSignalShmemSize());
> + MemSet(unvolatize(PMSignalData *, PMSignalState), 0, PMSignalShmemSize());
> PMSignalState->num_child_flags = MaxLivePostmasterChildren();
> }
> }
Same. Did you put an type assertion into MemSet(), or how did you
discover this one as needing to be changed?
.oO(We really ought to remove MemSet()).
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-02-18 20:27:43 | crash in pg_identify_object_as_address |
Previous Message | Tom Lane | 2019-02-18 20:20:55 | Re: unconstify equivalent for volatile |