sys/resource: Add RLIMIT_RTPRIO and RLIMIT_RTTIME definition

This commit add the definition of RLIMIT_RTPRIO and RLIMIT_RTTIME.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
ouyangxiangzhen 2024-07-10 11:17:18 +08:00 committed by Xiang Xiao
parent d36197266a
commit 28d943b226
2 changed files with 17 additions and 0 deletions

View File

@ -59,6 +59,11 @@
#define RLIMIT_AS 7 /* Limit on address space size */ #define RLIMIT_AS 7 /* Limit on address space size */
#define RLIMIT_MEMLOCK 8 /* Limit on memory use */ #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) #if defined(CONFIG_FS_LARGEFILE)
# define RLIM_INFINITY UINT64_MAX /* No limit */ # define RLIM_INFINITY UINT64_MAX /* No limit */
# define RLIM_SAVED_MAX UINT64_MAX /* Unrepresentable saved hard limit */ # define RLIM_SAVED_MAX UINT64_MAX /* Unrepresentable saved hard limit */

View File

@ -71,6 +71,18 @@ int getrlimit(int resource, FAR struct rlimit *rlp)
rlp->rlim_max = RLIM_INFINITY; rlp->rlim_max = RLIM_INFINITY;
} }
break; 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: default:
break; break;
} }