Skip to content

Commit

Permalink
improve: Zygiskd build.gradle.kts
Browse files Browse the repository at this point in the history
This commit improves Zygisk's build gradle file by avoiding the repetition of compiler flags.
  • Loading branch information
ThePedroo committed Oct 5, 2024
1 parent a90d32f commit 1488ce7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions zygiskd/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ val verName: String by rootProject.extra
val commitHash: String by rootProject.extra

val CStandardFlags = arrayOf(
"-D_GNU_SOURCE", "-std=c99", "-Wpedantic", "-Wall", "-Wextra", "-Werror",
"-Wformat", "-Wuninitialized", "-Wshadow", "-Wno-zero-length-array",
"-Wno-fixed-enum-extension", "-Iroot_impl", "-llog",
"-DMIN_APATCH_VERSION=$minAPatchVersion",
"-DMIN_KSU_VERSION=$minKsuVersion",
"-DMAX_KSU_VERSION=$maxKsuVersion",
Expand All @@ -35,16 +38,10 @@ val CStandardFlags = arrayOf(
)

val CFlagsRelease = arrayOf(
"-D_GNU_SOURCE", "-std=c99", "-Wpedantic", "-Wall", "-Wextra", "-Werror",
"-Wformat", "-Wuninitialized", "-Wshadow", "-Wno-zero-length-array",
"-Wno-fixed-enum-extension", "-Iroot_impl", "-llog",
"-Wl,--strip-all", "-flto=thin", "-Ofast"
)

val CFlagsDebug = arrayOf(
"-D_GNU_SOURCE", "-std=c99", "-Wpedantic", "-Wall", "-Wextra", "-Werror",
"-Wformat", "-Wuninitialized", "-Wshadow", "-Wno-zero-length-array",
"-Wno-fixed-enum-extension", "-Iroot_impl", "-llog",
"-g", "-O0"
)

Expand Down
4 changes: 2 additions & 2 deletions zygiskd/src/root_impl/kernelsu.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
so we need to cast it to signed int to
avoid any potential UB.
*/
#define KERNEL_SU_OPTION (signed int)0xdeadbeef
#define KERNEL_SU_OPTION 0xdeadbeef

#define CMD_GET_VERSION 2
#define CMD_UID_GRANTED_ROOT 12
#define CMD_UID_SHOULD_UMOUNT 13

enum RootImplState ksu_get_existence(void) {
int version = 0;
prctl(KERNEL_SU_OPTION, CMD_GET_VERSION, &version, 0, 0);
prctl((signed int)KERNEL_SU_OPTION, CMD_GET_VERSION, &version, 0, 0);

if (version == 0) return Inexistent;
if (version >= MIN_KSU_VERSION && version <= MAX_KSU_VERSION) return Supported;
Expand Down

0 comments on commit 1488ce7

Please sign in to comment.