From: Cheng-Yang Chou <yphbchou0911@gmail.com>
To: williams@redhat.com, jkacur@redhat.com
Cc: linux-rt-users@vger.kernel.org, jserv@ccns.ncku.edu.tw,
yphbchou0911@gmail.com
Subject: [PATCH 5/8] cyclicdeadline.c: Suppress warning
Date: Sat, 12 Jul 2025 21:42:10 +0800 [thread overview]
Message-ID: <20250712134213.58582-6-yphbchou0911@gmail.com> (raw)
In-Reply-To: <20250712134213.58582-1-yphbchou0911@gmail.com>
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
src/sched_deadline/cyclicdeadline.c | 32 ++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 04e61ed..f1a0ba0 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -206,6 +206,7 @@ static void ftrace_write(char *buf, const char *fmt, ...)
{
va_list ap;
int n;
+ int ret;
if (mark_fd < 0)
return;
@@ -214,7 +215,9 @@ static void ftrace_write(char *buf, const char *fmt, ...)
n = my_vsprintf(buf, BUFSIZ, fmt, ap);
va_end(ap);
- write(mark_fd, buf, n);
+ ret = write(mark_fd, buf, n);
+ if (ret < 0)
+ perror("ftrace write failed");
}
static void setup_ftrace_marker(void)
@@ -448,6 +451,10 @@ static int mount_cpuset(void)
if (fd < 0)
return fd;
ret = write(fd, "0", 2);
+ if (ret < 0) {
+ close(fd);
+ return ret;
+ }
close(fd);
return 0;
@@ -634,7 +641,14 @@ static void destroy_cpuset(const char *name, int print)
sprintf(buf, "%d", pid);
if (print)
printf("Moving %d out of %s\n", pid, name);
- write(fd, buf, strlen(buf));
+ ret = write(fd, buf, strlen(buf));
+ if (ret < 0 && errno == ENOSPC) {
+ fclose(fp);
+ close(fd);
+ fatal("Cannot move tasks out of cpuset %s\n", name);
+ }
+
+
}
fclose(fp);
close(fd);
@@ -656,19 +670,24 @@ static void destroy_cpuset(const char *name, int print)
static void teardown(void)
{
int fd;
+ int ret;
if (all_cpus)
return;
fd = open_cpuset(CPUSET_PATH, "cpuset.cpu_exclusive");
if (fd >= 0) {
- write(fd, "0", 2);
+ ret = write(fd, "0", 2);
+ if (ret < 0)
+ perror("cpuset.cpu_exclusive");
close(fd);
}
fd = open_cpuset(CPUSET_PATH, "cpuset.sched_load_balance");
if (fd >= 0) {
- write(fd, "1", 2);
+ ret = write(fd, "1", 2);
+ if (ret < 0)
+ perror("cpuset.sched_load_balance");
close(fd);
}
@@ -1164,6 +1183,7 @@ int main(int argc, char **argv)
int nr_cpus;
int i;
int c;
+ int ret;
rt_init(argc, argv);
@@ -1387,7 +1407,9 @@ int main(int argc, char **argv)
CPUSET_FL_CLONE_CHILDREN |
CPUSET_FL_TASKS, pids);
- system("cat /sys/fs/cgroup/cpuset/my_cpuset/tasks");
+ ret = system("cat /sys/fs/cgroup/cpuset/my_cpuset/tasks");
+ if (ret < 0)
+ perror("system call failed");
}
debug(debug_enable, "main thread %d\n", gettid());
--
2.48.1
next prev parent reply other threads:[~2025-07-12 13:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-12 13:42 [PATCH 0/8] Fix -Wunused-result warnings by checking return values Cheng-Yang Chou
2025-07-12 13:42 ` [PATCH 1/8] rt-utils.c: Suppress warning Cheng-Yang Chou
2025-07-25 18:04 ` John Kacur
2025-07-12 13:42 ` [PATCH 2/8] pmqtest.c: " Cheng-Yang Chou
2025-07-25 18:07 ` John Kacur
2025-07-12 13:42 ` [PATCH 3/8] ptsematest.c: " Cheng-Yang Chou
2025-07-25 18:09 ` John Kacur
2025-07-12 13:42 ` [PATCH 4/8] rt-migrate-test.c: " Cheng-Yang Chou
2025-07-25 18:10 ` John Kacur
2025-07-12 13:42 ` Cheng-Yang Chou [this message]
2025-07-12 13:42 ` [PATCH 6/8] deadline_test.c: " Cheng-Yang Chou
2025-07-12 13:42 ` [PATCH 7/8] sigwaittest.c: " Cheng-Yang Chou
2025-07-12 13:42 ` [PATCH 8/8] svsematest.c: " Cheng-Yang Chou
2025-07-25 18:16 ` [PATCH 0/8] Fix -Wunused-result warnings by checking return values John Kacur
2025-07-25 18:20 ` Cheng-Yang Chou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250712134213.58582-6-yphbchou0911@gmail.com \
--to=yphbchou0911@gmail.com \
--cc=jkacur@redhat.com \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox