Fix build issue with cgroups workaround patch
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
parent
14c7631f2d
commit
ecbec5e0c4
@ -1,24 +1,28 @@
|
|||||||
diff -up mdadm-3.2.6/util.c.cgroup mdadm-3.2.6/util.c
|
diff -up mdadm-3.2.6/util.c.cgroup mdadm-3.2.6/util.c
|
||||||
--- mdadm-3.2.6/util.c.cgroup 2012-11-15 16:48:03.327035349 -0500
|
--- mdadm-3.2.6/util.c.cgroup 2012-11-15 16:48:03.327035349 -0500
|
||||||
+++ mdadm-3.2.6/util.c 2012-11-15 17:07:16.628751041 -0500
|
+++ mdadm-3.2.6/util.c 2012-11-15 17:07:16.628751041 -0500
|
||||||
@@ -1611,6 +1611,21 @@ int mdmon_running(int devnum)
|
@@ -1611,6 +1611,25 @@ int mdmon_running(int devnum)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
+void set_cgroup(char *group)
|
+int set_cgroup(char *group)
|
||||||
+{
|
+{
|
||||||
+ char pid[8];
|
+ char pid[8];
|
||||||
+ char pathbuf[PATH_MAX];
|
+ char pathbuf[PATH_MAX];
|
||||||
+ int tasks_fd;
|
+ int tasks_fd, n;
|
||||||
+
|
+
|
||||||
+ snprintf(pathbuf, PATH_MAX, "/sys/fs/cgroup/%s/tasks", group);
|
+ snprintf(pathbuf, PATH_MAX, "/sys/fs/cgroup/%s/tasks", group);
|
||||||
+ tasks_fd = open(pathbuf, O_WRONLY);
|
+ tasks_fd = open(pathbuf, O_WRONLY);
|
||||||
+ if (tasks_fd >= 0) {
|
+ if (tasks_fd >= 0) {
|
||||||
+ snprintf(pid, sizeof(pid), "%d", getpid());
|
+ snprintf(pid, sizeof(pid), "%d", getpid());
|
||||||
+ write(tasks_fd, pid, strlen(pid));
|
+ n = write(tasks_fd, pid, strlen(pid));
|
||||||
+ close(tasks_fd);
|
+ close(tasks_fd);
|
||||||
|
+ if (n != (int)strlen(pid)) {
|
||||||
|
+ return -1;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
+
|
+
|
||||||
int start_mdmon(int devnum)
|
int start_mdmon(int devnum)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user