Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

Commit

Permalink
chore: patches: move some patch lines to the correct file
Browse files Browse the repository at this point in the history
Signed-off-by: Ookiineko <[email protected]>
  • Loading branch information
Ookiineko committed Apr 12, 2024
1 parent 59607af commit e159716
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 53 deletions.
53 changes: 0 additions & 53 deletions patches/Magisk/0001-native-fix-header-includes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,6 @@ index 0d8d11c..c4bb952 100644
#include "misc.hpp"

template <typename T>
@@ -110,7 +110,11 @@ std::vector<mount_info> parse_mount_info(const char *pid);
std::string resolve_preinit_dir(const char *base_dir);

using sFILE = std::unique_ptr<FILE, decltype(&fclose)>;
+#ifdef _WIN32
+using sDIR = std::unique_ptr<DIR, int (*)(DIR*)>;
+#else
using sDIR = std::unique_ptr<DIR, decltype(&closedir)>;
+#endif
sDIR make_dir(DIR *dp);
sFILE make_file(FILE *fp);

diff --git a/native/src/base/misc.cpp b/native/src/base/misc.cpp
index 313d136..f0188b5 100644
--- a/native/src/base/misc.cpp
Expand Down Expand Up @@ -173,31 +161,6 @@ index 313d136..f0188b5 100644

#include <base.hpp>

@@ -175,7 +175,9 @@ void init_argv0(int argc, char **argv) {
void set_nice_name(const char *name) {
memset(argv0, 0, name_len);
strscpy(argv0, name, name_len);
+#if 0
prctl(PR_SET_NAME, name);
+#endif
}

/*
diff --git a/native/src/base/include/stream.hpp b/native/src/base/include/stream.hpp
index 4742085..b461534 100644
--- a/native/src/base/include/stream.hpp
+++ b/native/src/base/include/stream.hpp
@@ -1,6 +1,10 @@
#pragma once

+#ifdef _WIN32
+# include <winsup/uio_compat.h>
+#else
#include <sys/uio.h>
+#endif
#include <cstdio>
#include <memory>

diff --git a/native/src/base/xwrap.hpp b/native/src/base/xwrap.hpp
index ce7a6dd..b4ba2c0 100644
--- a/native/src/base/xwrap.hpp
Expand Down Expand Up @@ -226,22 +189,6 @@ index ce7a6dd..b4ba2c0 100644

extern "C" {

diff --git a/native/src/boot/bootimg.cpp b/native/src/boot/bootimg.cpp
index a80a746..857eff2 100644
--- a/native/src/boot/bootimg.cpp
+++ b/native/src/boot/bootimg.cpp
@@ -1,6 +1,11 @@
#include <functional>
#include <memory>

+#ifdef _WIN32
+# define O_CLOEXEC O_NOINHERIT
+
+# include <winsup/str_compat.h>
+#endif
#include <base.hpp>

#include "boot-rs.hpp"
--
2.41.0

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@
return -1;
outfd = pipefd[1];
} else if (exec.fd >= 0) {
@@ -175,7 +175,9 @@ void init_argv0(int argc, char **argv) {
void set_nice_name(const char *name) {
memset(argv0, 0, name_len);
strscpy(argv0, name, name_len);
+#if 0
prctl(PR_SET_NAME, name);
+#endif
}

/*
--- a/native/src/base/include/base.hpp
+++ b/native/src/base/include/base.hpp
@@ -9,5 +9,7 @@
Expand Down
49 changes: 49 additions & 0 deletions patches/Magisk/0008-fix-build-err-on-MinGW.patch
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,39 @@ index dab86d8..c0aca63 100644
use byteorder::{BigEndian, ReadBytesExt};
use quick_protobuf::{BytesReader, MessageRead};


diff --git a/native/src/base/files.hpp b/native/src/base/files.hpp
index 0d8d11c..c4bb952 100644
--- a/native/src/base/files.hpp
+++ b/native/src/base/files.hpp

@@ -110,7 +110,11 @@ std::vector<mount_info> parse_mount_info(const char *pid);
std::string resolve_preinit_dir(const char *base_dir);

using sFILE = std::unique_ptr<FILE, decltype(&fclose)>;
+#ifdef _WIN32
+using sDIR = std::unique_ptr<DIR, int (*)(DIR*)>;
+#else
using sDIR = std::unique_ptr<DIR, decltype(&closedir)>;
+#endif
sDIR make_dir(DIR *dp);
sFILE make_file(FILE *fp);

diff --git a/native/src/base/include/stream.hpp b/native/src/base/include/stream.hpp
index 4742085..b461534 100644
--- a/native/src/base/include/stream.hpp
+++ b/native/src/base/include/stream.hpp
@@ -1,6 +1,10 @@
#pragma once

+#ifdef _WIN32
+# include <winsup/uio_compat.h>
+#else
#include <sys/uio.h>
+#endif
#include <cstdio>
#include <memory>

diff --git a/native/src/base/stream.cpp b/native/src/base/stream.cpp
index b7a775c..9a77dde 100644
--- a/native/src/base/stream.cpp
Expand Down Expand Up @@ -295,5 +328,21 @@ index 79dac8f..e0634ba 100644
/* Compression formats */
GZIP,
ZOPFLI,
diff --git a/native/src/boot/bootimg.cpp b/native/src/boot/bootimg.cpp
index a80a746..857eff2 100644
--- a/native/src/boot/bootimg.cpp
+++ b/native/src/boot/bootimg.cpp
@@ -1,6 +1,11 @@
#include <functional>
#include <memory>

+#ifdef _WIN32
+# define O_CLOEXEC O_NOINHERIT
+
+# include <winsup/str_compat.h>
+#endif
#include <base.hpp>

#include "boot-rs.hpp"
--
2.41.0.windows.3

0 comments on commit e159716

Please sign in to comment.