File tree 5 files changed +58
-5
lines changed
5 files changed +58
-5
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,8 @@ extern "C" int _posix_zephyr_main(void);
151
151
#define sched_yield (...) zap_sched_yield(__VA_ARGS__)
152
152
#define sched_get_priority_min (...) zap_sched_get_priority_min(__VA_ARGS__)
153
153
#define sched_get_priority_max (...) zap_sched_get_priority_max(__VA_ARGS__)
154
+ #define sched_getparam (...) zap_sched_getparam(__VA_ARGS__)
155
+ #define sched_getscheduler (...) zap_sched_getscheduler(__VA_ARGS__)
154
156
155
157
/* Sleep */
156
158
#define sleep (...) zap_sleep(__VA_ARGS__)
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2018 Intel Corporation
2
+ * Copyright (c) 2018-2023 Intel Corporation
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
8
8
9
9
#include <zephyr/kernel.h>
10
10
11
+ #include "posix_types.h"
12
+
11
13
#ifdef __cplusplus
12
14
extern "C" {
13
15
#endif
@@ -46,6 +48,9 @@ static inline int sched_yield(void)
46
48
int sched_get_priority_min (int policy );
47
49
int sched_get_priority_max (int policy );
48
50
51
+ int sched_getparam (pid_t pid , struct sched_param * param );
52
+ int sched_getscheduler (pid_t pid );
53
+
49
54
#ifdef __cplusplus
50
55
}
51
56
#endif
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2018 Intel Corporation
2
+ * Copyright (c) 2018-2023 Intel Corporation
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
@@ -41,3 +41,32 @@ int sched_get_priority_max(int policy)
41
41
errno = EINVAL ;
42
42
return -1 ;
43
43
}
44
+
45
+ /**
46
+ * @brief Get scheduling parameters
47
+ *
48
+ * See IEEE 1003.1
49
+ */
50
+ int sched_getparam (pid_t pid , struct sched_param * param )
51
+ {
52
+ ARG_UNUSED (pid );
53
+ ARG_UNUSED (param );
54
+
55
+ errno = ENOSYS ;
56
+
57
+ return -1 ;
58
+ }
59
+
60
+ /**
61
+ * @brief Get scheduling policy
62
+ *
63
+ * See IEEE 1003.1
64
+ */
65
+ int sched_getscheduler (pid_t pid )
66
+ {
67
+ ARG_UNUSED (pid );
68
+
69
+ errno = ENOSYS ;
70
+
71
+ return -1 ;
72
+ }
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2018 Intel Corporation
2
+ * Copyright (c) 2018-2023 Intel Corporation
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
@@ -644,6 +644,23 @@ ZTEST(posix_apis, test_pthread_descriptor_leak)
644
644
}
645
645
}
646
646
647
+ ZTEST (posix_apis , test_sched_getparam )
648
+ {
649
+ struct sched_param param ;
650
+ int rc = sched_getparam (0 , & param );
651
+ int err = errno ;
652
+
653
+ zassert_true ((rc == -1 && err == ENOSYS ));
654
+ }
655
+
656
+ ZTEST (posix_apis , test_sched_getscheduler )
657
+ {
658
+ int rc = sched_getscheduler (0 );
659
+ int err = errno ;
660
+
661
+ zassert_true ((rc == -1 && err == ENOSYS ));
662
+ }
663
+
647
664
ZTEST (posix_apis , test_sched_policy )
648
665
{
649
666
/*
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ ZTEST(posix_headers, test_sched_h)
30
30
zassert_not_null (sched_get_priority_max );
31
31
zassert_not_null (sched_get_priority_min );
32
32
33
- /* zassert_not_null(sched_getparam); */ /* not implemented */
34
- /* zassert_not_null(sched_getscheduler); */ /* not implemented */
33
+ zassert_not_null (sched_getparam );
34
+ zassert_not_null (sched_getscheduler );
35
35
36
36
/* zassert_not_null(sched_rr_get_interval); */ /* not implemented */
37
37
You can’t perform that action at this time.
0 commit comments