]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46030: socket module add couple of FreeBSD constants. (GH-30018)
authorDavid CARLIER <devnexen@gmail.com>
Thu, 17 Mar 2022 20:40:00 +0000 (20:40 +0000)
committerGitHub <noreply@github.com>
Thu, 17 Mar 2022 20:40:00 +0000 (22:40 +0200)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Doc/library/socket.rst
Misc/NEWS.d/next/Library/2021-12-10-07-07-47.bpo-46030.UN349J.rst [new file with mode: 0644]
Modules/socketmodule.c

index 679631a7390928d1678a2632dddb9797f662769f..f8392ba1254b7515e79a782c6bb4071c719d8f32 100755 (executable)
@@ -556,6 +556,21 @@ Constants
 
    .. availability:: Linux >= 4.7.
 
+.. data:: SCM_CREDS2
+          LOCAL_CREDS
+          LOCAL_CREDS_PERSISTENT
+
+   LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used
+   with SOCK_DGRAM, SOCK_STREAM sockets, equivalent to
+   Linux/DragonFlyBSD SO_PASSCRED, while LOCAL_CREDS
+   sends the credentials at first read, LOCAL_CREDS_PERSISTENT
+   sends for each read, SCM_CREDS2 must be then used for
+   the latter for the message type.
+
+   .. versionadded:: 3.11
+
+   .. availability:: FreeBSD.
+
 Functions
 ^^^^^^^^^
 
diff --git a/Misc/NEWS.d/next/Library/2021-12-10-07-07-47.bpo-46030.UN349J.rst b/Misc/NEWS.d/next/Library/2021-12-10-07-07-47.bpo-46030.UN349J.rst
new file mode 100644 (file)
index 0000000..4f91b17
--- /dev/null
@@ -0,0 +1 @@
+Add ``LOCAL_CREDS``, ``LOCAL_CREDS_PERSISTENT`` and ``SCM_CREDS2`` FreeBSD constants to the socket module.
index fbdd1a164db25eab492fccb5642ba47bd62f8303..7f7af1895bd9f2d13f0a50ba51a993cc38b45a39 100644 (file)
@@ -7581,6 +7581,12 @@ PyInit__socket(void)
 #ifdef SO_PROTOCOL
     PyModule_AddIntMacro(m, SO_PROTOCOL);
 #endif
+#ifdef LOCAL_CREDS
+    PyModule_AddIntMacro(m, LOCAL_CREDS);
+#endif
+#ifdef LOCAL_CREDS_PERSISTENT
+    PyModule_AddIntMacro(m, LOCAL_CREDS_PERSISTENT);
+#endif
 
     /* Maximum number of connections for "listen" */
 #ifdef  SOMAXCONN
@@ -7599,6 +7605,9 @@ PyInit__socket(void)
 #ifdef  SCM_CREDS
     PyModule_AddIntMacro(m, SCM_CREDS);
 #endif
+#ifdef  SCM_CREDS2
+    PyModule_AddIntMacro(m, SCM_CREDS2);
+#endif
 
     /* Flags for send, recv */
 #ifdef  MSG_OOB