Hi!
> -static void _gather_cpus(char *cpus, long nd)
> +static void _gather_node_cpus(char *cpus, long nd)
I know that the function name starting with underscore was there
allready but can we please get rid of them (idealy in separate patch
either before or after this patch).
> {
> int ncpus = 0;
> - int i;
> + int fd, i;
> + long online;
> char buf[BUFSIZ];
> + char path[BUFSIZ], path1[BUFSIZ];
>
> while (path_exist(PATH_SYS_SYSTEM "/cpu/cpu%d", ncpus))
> ncpus++;
>
> - for (i = 0; i < ncpus; i++)
> - if (path_exist(PATH_SYS_SYSTEM "/node/node%ld/cpu%d", nd, i)) {
> + for (i = 0; i < ncpus; i++) {
> + snprintf(path, BUFSIZ,
> + PATH_SYS_SYSTEM "/node/node%ld/cpu%d", nd, i);
> + if (path_exist(path, nd, i)) {
> + snprintf(path1, BUFSIZ, "%s/online", path);
> + /*
> + * No cpu0/online knob, as it can't support to
> + * on/offline cpu0, so if the 'nd' node contains
> + * cpu0, it should skip to check cpu0/online's value.
> + */
> + if (i == 0)
> + goto next;
There are two spaces before the next.
> + fd = open(path1, O_RDONLY);
> + if (fd == -1)
> + tst_brkm(TBROK|TERRNO, cleanup,
> + "open %s", path1);
> + read_file(path1, buf);
> + online = SAFE_STRTOL(cleanup, buf, 0, 1);
> + if (online == 0)
> + continue;
This part can be done with SAFE_FILE_SCANF() see include/safe_file_ops.h
> +next:
> sprintf(buf, "%d,", i);
> strcat(cpus, buf);
> }
> + }
> /* Remove the trailing comma. */
> cpus[strlen(cpus) - 1] = '\0';
> }
> @@ -563,7 +585,7 @@ void write_cpusets(long nd)
> snprintf(buf, BUFSIZ, "%ld", nd);
> write_cpuset_files(CPATH_NEW, "mems", buf);
>
> - _gather_cpus(cpus, nd);
> + _gather_node_cpus(cpus, nd);
> write_cpuset_files(CPATH_NEW, "cpus", cpus);
>
> snprintf(buf, BUFSIZ, "%d", getpid());
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list