123 Star 1 Fork 9

src-openEuler/procinfo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
procinfo-18-mharris-use-sysconf.patch 811 Bytes
一键复制 编辑 原始数据 按行查看 历史
Grooooot 提交于 2020-02-19 10:01 . init the package
--- procinfo-18/procinfo.c.mharris-use-sysconf 2004-01-16 15:40:37.000000000 -0500
+++ procinfo-18/procinfo.c 2004-01-17 02:01:16.000000000 -0500
@@ -837,19 +837,7 @@
}
/* Count number of CPUs */
- cpuinfofp = myfopen (PROC_DIR "cpuinfo");
- if (cpuinfofp) {
- while (fgets (line, sizeof (line), cpuinfofp))
- if (!strncmp ("processor", line, 9)) /* intel */
- nr_cpus++;
- else if (!strncmp ("ncpus ", line, 6)) /* sparc */
- nr_cpus = atoi(line+19);
- else if (!strncmp ("cpus detected", line, 13)) /* alpha */
- nr_cpus = atoi(line+27);
- fclose (cpuinfofp);
- }
- if (nr_cpus == 0)
- nr_cpus = 1;
+ nr_cpus = sysconf (_SC_NPROCESSORS_ONLN);
/* Gets called from winsz(), but in case stdout is redirected: */
version = make_version (versionfp);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/procinfo.git
git@gitee.com:src-openeuler/procinfo.git
src-openeuler
procinfo
procinfo
master

搜索帮助