Rename port/thread.c to port/user.c.

Historically this module dealt with thread-safety of system interfaces,
but now all that's left is wrapper code for user name and home directory
lookup.  Arguably the Windows variants of this logic could be moved in
here too, to justify its presence under port.  For now, just tidy up
some obsolete references to multi-threading, and give the file a
meaningful name.

Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com
This commit is contained in:
Thomas Munro 2023-07-09 18:12:28 +12:00
parent c23e7ea4d6
commit 89333db963
8 changed files with 8 additions and 21 deletions

1
configure vendored
View File

@ -10728,7 +10728,6 @@ fi
#
# For each platform, we need to know about any special compile and link
# libraries, and whether the normal C function names are thread-safe.
# See the comment at the top of src/port/thread.c for more information.
# WIN32 doesn't need the pthread tests; it always uses threads
#
# These tests are run before the library-tests, because linking with the

View File

@ -1232,7 +1232,6 @@ fi
#
# For each platform, we need to know about any special compile and link
# libraries, and whether the normal C function names are thread-safe.
# See the comment at the top of src/port/thread.c for more information.
# WIN32 doesn't need the pthread tests; it always uses threads
#
# These tests are run before the library-tests, because linking with the

View File

@ -23,7 +23,7 @@ GETTEXT_FILES = $(FRONTEND_COMMON_GETTEXT_FILES) \
../../common/fe_memutils.c \
../../common/username.c \
../../common/wait_error.c \
../../port/thread.c
../../port/user.c
GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) \
HELP0 HELPN N_ simple_prompt simple_prompt_extended
GETTEXT_FLAGS = $(FRONTEND_COMMON_GETTEXT_FLAGS) \

View File

@ -432,7 +432,7 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz);
extern size_t strnlen(const char *str, size_t maxlen);
#endif
/* thread.c */
/* port/user.c */
#ifndef WIN32
extern bool pg_get_user_name(uid_t user_id, char *buffer, size_t buflen);
extern bool pg_get_user_home_dir(uid_t user_id, char *buffer, size_t buflen);

View File

@ -13,7 +13,7 @@ GETTEXT_FILES = fe-auth.c \
fe-secure-gssapi.c \
fe-secure-openssl.c \
win32.c \
../../port/thread.c
../../port/user.c
GETTEXT_TRIGGERS = libpq_append_conn_error:2 \
libpq_append_error:2 \
libpq_gettext \

View File

@ -59,7 +59,7 @@ OBJS = \
snprintf.o \
strerror.o \
tar.o \
thread.o
user.o
# libpgport.a, libpgport_shlib.a, and libpgport_srv.a contain the same files
# foo.o, foo_shlib.o, and foo_srv.o are all built from foo.c
@ -84,10 +84,6 @@ libpgport.a: $(OBJS)
rm -f $@
$(AR) $(AROPT) $@ $^
# thread.o and thread_shlib.o need PTHREAD_CFLAGS (but thread_srv.o does not)
thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
thread_shlib.o: CFLAGS+=$(PTHREAD_CFLAGS)
# all versions of pg_crc32c_sse42.o need CFLAGS_CRC
pg_crc32c_sse42.o: CFLAGS+=$(CFLAGS_CRC)
pg_crc32c_sse42_shlib.o: CFLAGS+=$(CFLAGS_CRC)

View File

@ -20,7 +20,7 @@ pgport_sources = [
'snprintf.c',
'strerror.c',
'tar.c',
'thread.c',
'user.c',
]
if host_system == 'windows'

View File

@ -1,13 +1,12 @@
/*-------------------------------------------------------------------------
*
* thread.c
* user.c
*
* Prototypes and macros around system calls, used to help make
* threaded libraries reentrant and safe to use from threaded applications.
* Wrapper functions for user and home directory lookup.
*
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
*
* src/port/thread.c
* src/port/user.c
*
*-------------------------------------------------------------------------
*/
@ -16,12 +15,6 @@
#include <pwd.h>
/*
* Historically, the code in this module had to deal with operating systems
* that lacked getpwuid_r().
*/
#ifndef WIN32
/*