Skip to contentSkip to conversation

tools/sched_ext: Clean up unused getopt flags

PATCH In review Cheng-Yang Chou 2 participants 4 messages Feb 22 – Feb 23 Scheduler - sched_ext

lore
Share & tools
lore
#0 lore raw

cover tools/sched_ext: Clean up unused getopt flags

This series removes unused option characters from the getopt() strings in scx_central and scx_sdt.

These flags ('-p' and '-f' respectively) were defined in the optstring but not implemented in the switch logic or documented in the help text. Removing them ensures consistency and prevents user confusion when providing these invalid arguments.

Thanks,
cheng-yang

---

Cheng-Yang Chou (2):
tools/sched_ext: scx_central: Remove unused '-p' option tools/sched_ext: scx_sdt: Remove unused '-f' option

 tools/sched_ext/scx_central.c | 2 +-
 tools/sched_ext/scx_sdt.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/2 tools/sched_ext: scx_central: Remove unused '-p' option

The '-p' option is defined in getopt() but not handled in the switch statement or documented in the help text. Providing '-p' currently triggers the default error path.

Remove it to sync the optstring with the actual implementation.

---
 tools/sched_ext/scx_central.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/sched_ext/scx_central.c +1 -1
index 2a805f1d6c8f..710fa03376e2 100644
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
 	assert(skel->rodata->nr_cpu_ids > 0);
 	assert(skel->rodata->nr_cpu_ids <= INT32_MAX);
 
-	while ((opt = getopt(argc, argv, "s:c:pvh")) != -1) {
+	while ((opt = getopt(argc, argv, "s:c:vh")) != -1) {
 		switch (opt) {
 		case 's':
 			skel->rodata->slice_ns = strtoull(optarg, NULL, 0) * 1000;
Signature · 1 line
2.48.1
#2 lore raw

PATCH 2/2 tools/sched_ext: scx_sdt: Remove unused '-f' option

In reply to Cheng-Yang Chou

The '-f' option is defined in getopt() but not handled in the switch statement or documented in the help text. Providing '-f' currently triggers the default error path.

Remove it to sync the optstring with the actual implementation.

---
 tools/sched_ext/scx_sdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/sched_ext/scx_sdt.c +1 -1
index d8ca9aa316a5..a36405d8df30 100644
@@ -54,7 +54,7 @@ int main(int argc, char **argv)
 	optind = 1;
 	skel = SCX_OPS_OPEN(sdt_ops, scx_sdt);
 
-	while ((opt = getopt(argc, argv, "fvh")) != -1) {
+	while ((opt = getopt(argc, argv, "vh")) != -1) {
 		switch (opt) {
 		case 'v':
 			verbose = true;
Signature · 1 line
2.48.1
reviewer
#3 lore raw
In reply to Cheng-Yang Chou
Quoted 3 lines

Cheng-Yang Chou (2):
tools/sched_ext: scx_central: Remove unused '-p' option tools/sched_ext: scx_sdt: Remove unused '-f' option

Applied 1-2 to sched_ext/for-7.0-fixes.

Thanks.

--
tejun