You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by sh...@apache.org on 2022/05/30 11:03:44 UTC
[bookkeeper] branch master updated: [build] support circe-checksum and cpu-affinity build on Windows (#2549)
This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new f1ff8b4a30 [build] support circe-checksum and cpu-affinity build on Windows (#2549)
f1ff8b4a30 is described below
commit f1ff8b4a307e09594fc663625c50318dde5fd7e4
Author: magiccao <ue...@163.com>
AuthorDate: Mon May 30 19:03:38 2022 +0800
[build] support circe-checksum and cpu-affinity build on Windows (#2549)
Co-authored-by: dongcao <do...@trip.com>
---
circe-checksum/pom.xml | 37 +++++++++++++++++++++++
cpu-affinity/pom.xml | 37 +++++++++++++++++++++++
cpu-affinity/src/main/affinity/cpp/affinity_jni.c | 6 ++++
3 files changed, 80 insertions(+)
diff --git a/circe-checksum/pom.xml b/circe-checksum/pom.xml
index dd76177f52..f53fe9d92e 100644
--- a/circe-checksum/pom.xml
+++ b/circe-checksum/pom.xml
@@ -237,6 +237,43 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>Windows</id>
+ <activation>
+ <os>
+ <family>Windows</family>
+ </os>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.github.maven-nar</groupId>
+ <artifactId>nar-maven-plugin</artifactId>
+ <version>${nar-maven-plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <runtime>${nar.runtime}</runtime>
+ <output>circe-checksum</output>
+ <libraries>
+ <library>
+ <type>jni</type>
+ <narSystemPackage>com.scurrilous.circe.checksum</narSystemPackage>
+ </library>
+ </libraries>
+ <cpp>
+ <optionSet>${nar.cpp.optionSet}</optionSet>
+ <exceptions>false</exceptions>
+ <rtti>false</rtti>
+ <optimize>full</optimize>
+ </cpp>
+ <linker>
+ <name>g++</name>
+ </linker>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/cpu-affinity/pom.xml b/cpu-affinity/pom.xml
index 5da61c9489..f218b8cf4c 100644
--- a/cpu-affinity/pom.xml
+++ b/cpu-affinity/pom.xml
@@ -221,6 +221,43 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>Windows</id>
+ <activation>
+ <os>
+ <family>Windows</family>
+ </os>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.github.maven-nar</groupId>
+ <artifactId>nar-maven-plugin</artifactId>
+ <version>${nar-maven-plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <runtime>${nar.runtime}</runtime>
+ <output>cpu-affinity</output>
+ <libraries>
+ <library>
+ <type>jni</type>
+ <narSystemPackage>org.apache.bookkeeper.utils.affinity</narSystemPackage>
+ </library>
+ </libraries>
+ <cpp>
+ <optionSet>${nar.cpp.optionSet}</optionSet>
+ <exceptions>false</exceptions>
+ <rtti>false</rtti>
+ <optimize>full</optimize>
+ </cpp>
+ <linker>
+ <name>g++</name>
+ </linker>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/cpu-affinity/src/main/affinity/cpp/affinity_jni.c b/cpu-affinity/src/main/affinity/cpp/affinity_jni.c
index a0aedf6466..ebd8b7b9d4 100644
--- a/cpu-affinity/src/main/affinity/cpp/affinity_jni.c
+++ b/cpu-affinity/src/main/affinity/cpp/affinity_jni.c
@@ -44,6 +44,8 @@ static int set_affinity(int cpuid) { return NOT_IMPLEMENTED; }
static const int IS_AVAILABLE = 0;
+#define strerror_r(errno,buf,len) strerror_s(buf,len,errno)
+
#endif
#include <unistd.h>
@@ -60,7 +62,11 @@ static const int IS_AVAILABLE = 0;
*/
JNIEXPORT jboolean JNICALL
Java_org_apache_bookkeeper_common_util_affinity_impl_CpuAffinityJni_isRoot(JNIEnv *env, jclass cls) {
+#ifdef __linux__
return getuid() == 0;
+#else
+ return 0;
+#endif
}
/*