Skip to content

Commit

Permalink
fix: Add more definitions to built .a
Browse files Browse the repository at this point in the history
  • Loading branch information
aran committed May 7, 2024
1 parent 5575fe6 commit 468d0c8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
39 changes: 39 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ genrule(
cc_library(
name = "headers",
srcs = glob([
"src/common/**/*.h",
"src/include/**/*.h",
"src/interfaces/libpq/*.h",
]) + ["src/port/pg_config_paths.h"],
includes = [
"src/common",
"src/include",
"src/interfaces/libpq",
"src/port",
Expand All @@ -42,6 +44,22 @@ cc_library(
name = "pq",
srcs = [
":pg_config",
"@postgres//:src/common/base64.c",
"@postgres//:src/common/cryptohash.c",
"@postgres//:src/common/encnames.c",
"@postgres//:src/common/hmac.c",
"@postgres//:src/common/ip.c",
"@postgres//:src/common/link-canary.c",
"@postgres//:src/common/md5.c",
"@postgres//:src/common/md5_common.c",
"@postgres//:src/common/pg_prng.c",
"@postgres//:src/common/saslprep.c",
"@postgres//:src/common/scram-common.c",
"@postgres//:src/common/sha1.c",
"@postgres//:src/common/sha2.c",
"@postgres//:src/common/string.c",
"@postgres//:src/common/unicode_norm.c",
"@postgres//:src/common/wchar.c",
"@postgres//:src/interfaces/libpq/fe-auth.c",
"@postgres//:src/interfaces/libpq/fe-auth-scram.c",
"@postgres//:src/interfaces/libpq/fe-connect.c",
Expand All @@ -56,6 +74,27 @@ cc_library(
"@postgres//:src/interfaces/libpq/legacy-pqsignal.c",
"@postgres//:src/interfaces/libpq/libpq-events.c",
"@postgres//:src/interfaces/libpq/pqexpbuffer.c",
"@postgres//:src/port/chklocale.c",
"@postgres//:src/port/explicit_bzero.c",
"@postgres//:src/port/inet_net_ntop.c",
"@postgres//:src/port/noblock.c",
"@postgres//:src/port/pg_strong_random.c",
"@postgres//:src/port/pgstrcasecmp.c",
"@postgres//:src/port/snprintf.c",
"@postgres//:src/port/strerror.c",
"@postgres//:src/port/thread.c",
] + select({
"@platforms//os:linux": [
"@libpq//:getpeereid.linux.c",
"@postgres//:src/port/strlcat.c",
"@postgres//:src/port/strlcpy.c",
],
"//conditions:default": [],
}),
defines = [
"FRONTEND",
"HAVE_STRERROR_R",
"STRERROR_R_INT",
],
linkstatic = True,
visibility = ["//visibility:public"],
Expand Down
16 changes: 16 additions & 0 deletions getpeereid.linux.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "c.h"

#include <sys/param.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>

/*
* BSD-style getpeereid() for platforms that lack it.
*/
int
getpeereid(int sock, uid_t *uid, gid_t *gid)
{ /* No implementation available on this platform */
errno = ENOSYS;
return -1;
}

0 comments on commit 468d0c8

Please # to comment.