bpo-42960: Add resource.RLIMIT_KQUEUES constant from FreeBSD (GH-24251)

diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst
index e4eac43..00ff3b5 100644
--- a/Doc/library/resource.rst
+++ b/Doc/library/resource.rst
@@ -255,6 +255,14 @@
 
    .. versionadded:: 3.4
 
+.. data:: RLIMIT_KQUEUES
+
+   The maximum number of kqueues this user id is allowed to create.
+
+   .. availability:: FreeBSD 11 or later.
+
+   .. versionadded:: 3.10
+
 Resource Usage
 --------------
 
diff --git a/Misc/NEWS.d/next/Library/2021-01-18-21-07-20.bpo-42960.a7Dote.rst b/Misc/NEWS.d/next/Library/2021-01-18-21-07-20.bpo-42960.a7Dote.rst
new file mode 100644
index 0000000..58c1bcc
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-01-18-21-07-20.bpo-42960.a7Dote.rst
@@ -0,0 +1 @@
+Adds :data:`resource.RLIMIT_KQUEUES` constant from FreeBSD to the :mod:`resource` module.
diff --git a/Modules/resource.c b/Modules/resource.c
index f10a80f..0d69c29 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -480,6 +480,10 @@ resource_exec(PyObject *module)
     ADD_INT(module, RLIMIT_NPTS);
 #endif
 
+#ifdef RLIMIT_KQUEUES
+    ADD_INT(module, RLIMIT_KQUEUES);
+#endif
+
     PyObject *v;
     if (sizeof(RLIM_INFINITY) > sizeof(long)) {
         v = PyLong_FromLongLong((long long) RLIM_INFINITY);