Skip to content

Commit 33698e8

Browse files
devnexenasvetlov
andauthored
bpo-46030: socket module add couple of FreeBSD constants. (GH-30018)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
1 parent 424dfc7 commit 33698e8

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Doc/library/socket.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,21 @@ Constants
556556

557557
.. availability:: Linux >= 4.7.
558558

559+
.. data:: SCM_CREDS2
560+
LOCAL_CREDS
561+
LOCAL_CREDS_PERSISTENT
562+
563+
LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used
564+
with SOCK_DGRAM, SOCK_STREAM sockets, equivalent to
565+
Linux/DragonFlyBSD SO_PASSCRED, while LOCAL_CREDS
566+
sends the credentials at first read, LOCAL_CREDS_PERSISTENT
567+
sends for each read, SCM_CREDS2 must be then used for
568+
the latter for the message type.
569+
570+
.. versionadded:: 3.11
571+
572+
.. availability:: FreeBSD.
573+
559574
Functions
560575
^^^^^^^^^
561576

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ``LOCAL_CREDS``, ``LOCAL_CREDS_PERSISTENT`` and ``SCM_CREDS2`` FreeBSD constants to the socket module.

Modules/socketmodule.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7581,6 +7581,12 @@ PyInit__socket(void)
75817581
#ifdef SO_PROTOCOL
75827582
PyModule_AddIntMacro(m, SO_PROTOCOL);
75837583
#endif
7584+
#ifdef LOCAL_CREDS
7585+
PyModule_AddIntMacro(m, LOCAL_CREDS);
7586+
#endif
7587+
#ifdef LOCAL_CREDS_PERSISTENT
7588+
PyModule_AddIntMacro(m, LOCAL_CREDS_PERSISTENT);
7589+
#endif
75847590

75857591
/* Maximum number of connections for "listen" */
75867592
#ifdef SOMAXCONN
@@ -7599,6 +7605,9 @@ PyInit__socket(void)
75997605
#ifdef SCM_CREDS
76007606
PyModule_AddIntMacro(m, SCM_CREDS);
76017607
#endif
7608+
#ifdef SCM_CREDS2
7609+
PyModule_AddIntMacro(m, SCM_CREDS2);
7610+
#endif
76027611

76037612
/* Flags for send, recv */
76047613
#ifdef MSG_OOB

0 commit comments

Comments
 (0)