Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 89333db

Browse files
committed
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
1 parent c23e7ea commit 89333db

File tree

8 files changed

+8
-21
lines changed

8 files changed

+8
-21
lines changed

configure

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

configure.ac

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

src/bin/psql/nls.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ GETTEXT_FILES = $(FRONTEND_COMMON_GETTEXT_FILES) \
2323
../../common/fe_memutils.c \
2424
../../common/username.c \
2525
../../common/wait_error.c \
26-
../../port/thread.c
26+
../../port/user.c
2727
GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) \
2828
HELP0 HELPN N_ simple_prompt simple_prompt_extended
2929
GETTEXT_FLAGS = $(FRONTEND_COMMON_GETTEXT_FLAGS) \

src/include/port.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz);
432432
extern size_t strnlen(const char *str, size_t maxlen);
433433
#endif
434434

435-
/* thread.c */
435+
/* port/user.c */
436436
#ifndef WIN32
437437
extern bool pg_get_user_name(uid_t user_id, char *buffer, size_t buflen);
438438
extern bool pg_get_user_home_dir(uid_t user_id, char *buffer, size_t buflen);

src/interfaces/libpq/nls.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ GETTEXT_FILES = fe-auth.c \
1313
fe-secure-gssapi.c \
1414
fe-secure-openssl.c \
1515
win32.c \
16-
../../port/thread.c
16+
../../port/user.c
1717
GETTEXT_TRIGGERS = libpq_append_conn_error:2 \
1818
libpq_append_error:2 \
1919
libpq_gettext \

src/port/Makefile

+1-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ OBJS = \
5959
snprintf.o \
6060
strerror.o \
6161
tar.o \
62-
thread.o
62+
user.o
6363

6464
# libpgport.a, libpgport_shlib.a, and libpgport_srv.a contain the same files
6565
# foo.o, foo_shlib.o, and foo_srv.o are all built from foo.c
@@ -84,10 +84,6 @@ libpgport.a: $(OBJS)
8484
rm -f $@
8585
$(AR) $(AROPT) $@ $^
8686

87-
# thread.o and thread_shlib.o need PTHREAD_CFLAGS (but thread_srv.o does not)
88-
thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
89-
thread_shlib.o: CFLAGS+=$(PTHREAD_CFLAGS)
90-
9187
# all versions of pg_crc32c_sse42.o need CFLAGS_CRC
9288
pg_crc32c_sse42.o: CFLAGS+=$(CFLAGS_CRC)
9389
pg_crc32c_sse42_shlib.o: CFLAGS+=$(CFLAGS_CRC)

src/port/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pgport_sources = [
2020
'snprintf.c',
2121
'strerror.c',
2222
'tar.c',
23-
'thread.c',
23+
'user.c',
2424
]
2525

2626
if host_system == 'windows'

src/port/thread.c renamed to src/port/user.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/*-------------------------------------------------------------------------
22
*
3-
* thread.c
3+
* user.c
44
*
5-
* Prototypes and macros around system calls, used to help make
6-
* threaded libraries reentrant and safe to use from threaded applications.
5+
* Wrapper functions for user and home directory lookup.
76
*
87
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
98
*
10-
* src/port/thread.c
9+
* src/port/user.c
1110
*
1211
*-------------------------------------------------------------------------
1312
*/
@@ -16,12 +15,6 @@
1615

1716
#include <pwd.h>
1817

19-
20-
/*
21-
* Historically, the code in this module had to deal with operating systems
22-
* that lacked getpwuid_r().
23-
*/
24-
2518
#ifndef WIN32
2619

2720
/*

0 commit comments

Comments
 (0)