Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mayaqua/Unix.c')
-rw-r--r--src/Mayaqua/Unix.c67
1 files changed, 60 insertions, 7 deletions
diff --git a/src/Mayaqua/Unix.c b/src/Mayaqua/Unix.c
index c9c239ab..2e013832 100644
--- a/src/Mayaqua/Unix.c
+++ b/src/Mayaqua/Unix.c
@@ -3,9 +3,9 @@
//
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
//
-// Copyright (c) 2012-2016 Daiyuu Nobori.
-// Copyright (c) 2012-2016 SoftEther VPN Project, University of Tsukuba, Japan.
-// Copyright (c) 2012-2016 SoftEther Corporation.
+// Copyright (c) Daiyuu Nobori, Ph.D..
+// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
+// Copyright (c) SoftEther Corporation.
//
// All Rights Reserved.
//
@@ -1010,6 +1010,63 @@ void UnixRestorePriority()
}
}
+UINT UnixGetNumberOfCpuInner()
+{
+ BUF *b;
+ UINT ret = 0;
+
+ b = ReadDump("/proc/cpuinfo");
+ if (b != NULL)
+ {
+ while (true)
+ {
+ char *line = CfgReadNextLine(b);
+
+ if (line == NULL)
+ {
+ break;
+ }
+
+ if (IsEmptyStr(line) == false)
+ {
+ TOKEN_LIST *t = ParseToken(line, ":");
+ if (t != NULL)
+ {
+ if (t->NumTokens >= 2)
+ {
+ char *key = t->Token[0];
+ char *value = t->Token[1];
+
+ Trim(key);
+ Trim(value);
+
+ if (StrCmpi(key, "processor") == 0)
+ {
+ if (IsNum(value))
+ {
+ UINT i = ToInt(value) + 1;
+
+ if (i >= 1 && i <= 128)
+ {
+ ret = MAX(ret, i);
+ }
+ }
+ }
+ }
+
+ FreeToken(t);
+ }
+ }
+
+ Free(line);
+ }
+
+ FreeBuf(b);
+ }
+
+ return ret;
+}
+
// Get the product ID
char *UnixGetProductId()
{
@@ -2859,7 +2916,3 @@ void UnixServiceMain(int argc, char *argv[], char *name, SERVICE_FUNCTION *start
}
#endif // UNIX
-
-// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
-// Department of Computer Science has dozens of overly-enthusiastic geeks.
-// Join us: http://www.tsukuba.ac.jp/english/admission/