]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
samples/get_procs.c: fix checkpatch.pl warnings
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 16 Mar 2022 16:00:10 +0000 (21:30 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 16 Mar 2022 21:38:20 +0000 (15:38 -0600)
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG.  It also introduces reverse xmas tree local
variable declarations and header file reordering.

In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 0 warnings, 36 lines checked

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
samples/c/get_procs.c

index 23a4d5849ceab0613acc993b304155130c980b4e..30f7b0ae0e1be77fe1e954270d87172e84ab3041 100644 (file)
@@ -1,32 +1,32 @@
 // SPDX-License-Identifier: LGPL-2.1-only
-#include <stdio.h>
 #include <libcgroup.h>
+
 #include <stdlib.h>
+#include <stdio.h>
 
 /*
  * Assumes the cgroup is already mounted at /cgroup/memory/a
- *
  * Assumes some processes are already in the cgroup
- *
- * Assumes it is the memory controller is mounted in at that
- * point
+ * Assumes it is the memory controller is mounted in at that point
  */
-int main()
+int main(void)
 {
-       int size;
        pid_t *pids;
+       int size;
        int ret;
        int i;
 
        ret = cgroup_init();
        if (ret) {
-               printf("FAIL: cgroup_init failed with %s\n", cgroup_strerror(ret));
+               printf("FAIL: cgroup_init failed with %s\n",
+                      cgroup_strerror(ret));
                exit(3);
        }
 
        ret = cgroup_get_procs("a", "memory", &pids, &size);
        if (ret) {
-               printf("FAIL: cgroup_get_procs failed with %s\n", cgroup_strerror(ret));
+               printf("FAIL: cgroup_get_procs failed with %s\n",
+                      cgroup_strerror(ret));
                exit(3);
        }