This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 28d943b2267a28dee9f6ddd767e1ee529f667a71
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Wed Jul 10 11:17:18 2024 +0800

    sys/resource: Add RLIMIT_RTPRIO and RLIMIT_RTTIME definition
    
    This commit add the definition of RLIMIT_RTPRIO and RLIMIT_RTTIME.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 include/sys/resource.h           |  5 +++++
 libs/libc/unistd/lib_getrlimit.c | 12 ++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/sys/resource.h b/include/sys/resource.h
index 494e9a1d28..ca0be2c60b 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -59,6 +59,11 @@
 #define RLIMIT_AS       7           /* Limit on address space size */
 #define RLIMIT_MEMLOCK  8           /* Limit on memory use */
 
+/* Below are not implemented yet: */
+
+#define RLIMIT_RTPRIO   14          /* Limit on RT tasks priority */
+#define RLIMIT_RTTIME   15          /* Limit on timeout for RT tasks (us) */
+
 #if defined(CONFIG_FS_LARGEFILE)
 #  define RLIM_INFINITY    UINT64_MAX /* No limit */
 #  define RLIM_SAVED_MAX   UINT64_MAX /* Unrepresentable saved hard limit */
diff --git a/libs/libc/unistd/lib_getrlimit.c b/libs/libc/unistd/lib_getrlimit.c
index 3e8655c2e5..c523852ff7 100644
--- a/libs/libc/unistd/lib_getrlimit.c
+++ b/libs/libc/unistd/lib_getrlimit.c
@@ -71,6 +71,18 @@ int getrlimit(int resource, FAR struct rlimit *rlp)
           rlp->rlim_max = RLIM_INFINITY;
         }
         break;
+      case RLIMIT_RTPRIO:
+        {
+          rlp->rlim_cur = SCHED_PRIORITY_DEFAULT;
+          rlp->rlim_max = SCHED_PRIORITY_MAX;
+        }
+        break;
+      case RLIMIT_RTTIME:
+        {
+          rlp->rlim_cur = UINT32_MAX;
+          rlp->rlim_max = UINT32_MAX;
+        }
+        break;
       default:
         break;
     }

Reply via email to