From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | thread-safety: getpwuid_r() |
Date: | 2024-08-24 08:42:53 |
Message-ID: | 5f293da9-ceb4-4937-8e52-82c25db8e4d3@eisentraut.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Here is a patch to replace a getpwuid() call in the backend, for
thread-safety.
This is AFAICT the only call in the getpw*() family that needs to be
dealt with.
(There is also a getgrnam() call, but that is called very early in the
postmaster, before multiprocessing, so we can leave that as is.)
The solution here is actually quite attractive: We can replace the
getpwuid() call by the existing wrapper function pg_get_user_name(),
which internally uses getpwuid_r(). This also makes the code a bit
simpler. The same function is already used in libpq for a purpose that
mirrors the backend use, so it's also nicer to use the same function for
consistency.
Attachment | Content-Type | Size |
---|---|---|
0001-thread-safety-getpwuid_r.patch | text/plain | 2.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2024-08-24 12:10:19 | Re: Optimising numeric division |
Previous Message | Joel Jacobson | 2024-08-24 07:26:02 | Re: Optimising numeric division |