Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3b249c

Browse files
committed
Make the memory layout of Port struct independent of USE_OPENSSL
Commitd39a49c added new fields to the struct, but missed the "keepthese last" comment on the previous fields. Add placeholder variablesso that the offsets of the fields are the same whether you build withUSE_OPENSSL or not. This is a courtesy to extensions that might peekat the fields, to make the ABI the same regardless of the options usedto build PostgreSQL.In reality, I don't expect any extensions to look at the 'raw_buf'fields. Firstly, they are new in v17, so no one's written suchextensions yet. Secondly, extensions should have no business poking atthose fields anyway. Nevertheless, fix this properly on 'master'. Onv17, we mustn't change the memory layout, so just fix the comments.Author: Jacob ChampionDiscussion:https://www.postgresql.org/message-id/raw/CAOYmi%2BmKVJNzn5_TD_MK%3DhqO64r_w8Gb0FHCLk0oAkW-PJv8jQ@mail.gmail.com
1 parent9695835 commite3b249c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/include/libpq/libpq-be.h‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ typedef struct Port
189189
/*
190190
* If GSSAPI is supported and used on this connection, store GSSAPI
191191
* information. Even when GSSAPI is not compiled in, store a NULL pointer
192-
* to keep struct offsets the same (for extension ABI compatibility).
192+
* to keep struct offsets of the "SSL structures" below the same (for
193+
* extension ABI compatibility).
193194
*/
194195
pg_gssinfo*gss;
195196
#else
@@ -206,8 +207,7 @@ typedef struct Port
206207
boolalpn_used;
207208

208209
/*
209-
* OpenSSL structures. (Keep these last so that the locations of other
210-
* fields are the same whether or not you build with SSL enabled.)
210+
* OpenSSL structures.
211211
*/
212212
#ifdefUSE_OPENSSL
213213
SSL*ssl;
@@ -222,6 +222,9 @@ typedef struct Port
222222
* There's no API to "unread", the upper layer just places the data in the
223223
* Port structure in raw_buf and sets raw_buf_remaining to the amount of
224224
* bytes unread and raw_buf_consumed to 0.
225+
*
226+
* NB: the offsets of these fields depend on USE_OPENSSL. These should
227+
* not be accessed in an extension because of the ABI incompatibility.
225228
*/
226229
char*raw_buf;
227230
ssize_traw_buf_consumed,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp