Re: A couple of cosmetic changes around shared memory code - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: A couple of cosmetic changes around shared memory code
Date
Msg-id CAB7nPqQzMxmsG_7AOXpT6EVA7C-tOPFQA9_9myakFGj2jmOnuA@mail.gmail.com
Whole thread Raw
In response to A couple of cosmetic changes around shared memory code  (Piotr Stefaniak <postgres@piotr-stefaniak.me>)
Responses Re: A couple of cosmetic changes around shared memory code  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, May 17, 2016 at 4:40 AM, Piotr Stefaniak
<postgres@piotr-stefaniak.me> wrote:
> while investigating the shm_mq code and its testing module I made some
> cosmetic improvements there. You can see them in the attached diff file.

-    toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry)
+    toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry)        + allocated_bytes;
I don't recall the exact reason, but this is intentional style
(memories from a patchwork with Tom). See for example geo_ops.c or
pl_funcs.c. Though it is true that things are not completely
consistent in the code with offset.

-    seg = dsm_create(shm_toc_estimate(&e), 0);
+    seg = dsm_create(segsize, 0);
Yep.

-    proc_exit(1);
+    proc_exit(0);
Agreed here. I don't see why this should not exit with 0 if there have
not been any errors.
-- 
Michael



pgsql-hackers by date:

Previous
From: Piotr Stefaniak
Date:
Subject: A couple of cosmetic changes around shared memory code
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Windows service is not starting so there’s message in log: FATAL: "could not create shared memory segment “Global/PostgreSQL.851401618”: Permission denied”