mirror of
https://github.com/KitsuneMagisk/Magisk.git
synced 2024-11-22 17:48:47 +00:00
Small native code reorganization
This commit is contained in:
parent
d6fdbfe9b7
commit
a0998009c1
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -18,3 +18,7 @@ tools/** binary
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.ttf binary
|
||||
|
||||
# Help GitHub detect languages
|
||||
native/jni/external/** linguist-vendored
|
||||
native/jni/systemproperties/** linguist-language=C++
|
||||
|
@ -45,8 +45,6 @@ LOCAL_SRC_FILES := \
|
||||
magiskhide/hide_policy.cpp \
|
||||
resetprop/persist_properties.cpp \
|
||||
resetprop/resetprop.cpp \
|
||||
resetprop/system_property_api.cpp \
|
||||
resetprop/system_property_set.cpp \
|
||||
su/su.cpp \
|
||||
su/connect.cpp \
|
||||
su/pts.cpp \
|
||||
@ -167,8 +165,6 @@ LOCAL_SRC_FILES := \
|
||||
core/applet_stub.cpp \
|
||||
resetprop/persist_properties.cpp \
|
||||
resetprop/resetprop.cpp \
|
||||
resetprop/system_property_api.cpp \
|
||||
resetprop/system_property_set.cpp
|
||||
|
||||
LOCAL_CFLAGS := -DAPPLET_STUB_MAIN=resetprop_main
|
||||
LOCAL_LDFLAGS := -static
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <magisk.hpp>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
umask(0);
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <selinux.h>
|
||||
#include <utils.h>
|
||||
#include <magisk.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
|
@ -9,12 +9,12 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <db.h>
|
||||
#include <utils.h>
|
||||
#include <daemon.h>
|
||||
#include <resetprop.h>
|
||||
#include <selinux.h>
|
||||
#include <magisk.hpp>
|
||||
#include <db.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <resetprop.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
using namespace std;
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <utils.h>
|
||||
#include <daemon.h>
|
||||
#include <selinux.h>
|
||||
#include <db.h>
|
||||
#include <resetprop.h>
|
||||
#include <magisk.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <db.hpp>
|
||||
#include <resetprop.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
int SDK_INT = -1;
|
||||
|
@ -6,10 +6,10 @@
|
||||
#include <dlfcn.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <db.h>
|
||||
#include <daemon.h>
|
||||
#include <utils.h>
|
||||
#include <magisk.hpp>
|
||||
#include <db.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
#define DB_VERSION 10
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
#include <libgen.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include <magisk.h>
|
||||
#include <daemon.h>
|
||||
#include <selinux.h>
|
||||
#include <utils.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
using namespace std::literals;
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <utils.h>
|
||||
#include <selinux.h>
|
||||
#include <magisk.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <endian.h>
|
||||
|
||||
#include <daemon.h>
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <daemon.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
|
||||
#define ABS_SOCKET_LEN(sun) (sizeof(sa_family_t) + strlen(sun->sun_path + 1) + 1)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <logging.h>
|
||||
#include <logging.hpp>
|
||||
|
||||
#define MAIN_SOCKET "d30138f2310a9fb9c54a3e0c21f58591"
|
||||
#define JAVA_PACKAGE_NAME "com.topjohnwu.magisk"
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <selinux.h>
|
||||
#include <selinux.hpp>
|
||||
|
||||
#define ALL NULL
|
||||
|
@ -5,10 +5,10 @@
|
||||
#include <fcntl.h>
|
||||
#include <vector>
|
||||
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include "init.h"
|
||||
#include "init.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include <xz.h>
|
||||
#include <magisk.h>
|
||||
#include <cpio.h>
|
||||
#include <utils.h>
|
||||
#include <magisk.hpp>
|
||||
#include <cpio.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "binaries.h"
|
||||
@ -20,7 +20,7 @@
|
||||
#include "binaries_arch.h"
|
||||
#endif
|
||||
|
||||
#include "init.h"
|
||||
#include "init.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <magisk.hpp>
|
||||
|
||||
struct cmdline {
|
||||
bool skip_initramfs;
|
@ -1,5 +1,5 @@
|
||||
#include <magisk.h>
|
||||
#include <selinux.h>
|
||||
#include <magisk.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
constexpr char magiskrc[] =
|
||||
"\n"
|
@ -3,12 +3,12 @@
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <selinux.h>
|
||||
#include <magisk.h>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <magisk.hpp>
|
||||
|
||||
#include "init.h"
|
||||
#include "init.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
#include <fcntl.h>
|
||||
#include <vector>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <magiskpolicy.h>
|
||||
#include <utils.h>
|
||||
#include <magisk.hpp>
|
||||
#include <magiskpolicy.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
#include "init.h"
|
||||
#include "magiskrc.h"
|
||||
#include "init.hpp"
|
||||
#include "magiskrc.inc"
|
||||
|
||||
#ifdef USE_64BIT
|
||||
#define LIBNAME "lib64"
|
||||
|
@ -9,12 +9,12 @@
|
||||
|
||||
#include <mincrypt/sha.h>
|
||||
#include <mincrypt/sha256.h>
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include "bootimg.h"
|
||||
#include "magiskboot.h"
|
||||
#include "compress.h"
|
||||
#include "bootimg.hpp"
|
||||
#include "magiskboot.hpp"
|
||||
#include "compress.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <utility>
|
||||
#include "format.h"
|
||||
#include "format.hpp"
|
||||
|
||||
/****************
|
||||
* Other Headers
|
@ -13,11 +13,11 @@
|
||||
#include <lz4frame.h>
|
||||
#include <lz4hc.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <utils.h>
|
||||
#include <logging.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
#include "magiskboot.h"
|
||||
#include "compress.h"
|
||||
#include "magiskboot.hpp"
|
||||
#include "compress.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <stream.h>
|
||||
#include <stream.hpp>
|
||||
|
||||
#include "format.h"
|
||||
#include "format.hpp"
|
||||
|
||||
stream_ptr get_encoder(format_t type, stream_ptr &&base);
|
||||
|
@ -7,10 +7,10 @@
|
||||
extern "C" {
|
||||
#include <libfdt.h>
|
||||
}
|
||||
#include <utils.h>
|
||||
#include <utils.hpp>
|
||||
|
||||
#include "magiskboot.h"
|
||||
#include "dtb.h"
|
||||
#include "magiskboot.hpp"
|
||||
#include "dtb.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "format.h"
|
||||
#include "format.hpp"
|
||||
|
||||
std::map<std::string_view, format_t> name2fmt;
|
||||
Fmt2Name fmt2name;
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include <utils.hpp>
|
||||
|
||||
#include "magiskboot.h"
|
||||
#include "magiskboot.hpp"
|
||||
|
||||
static void hex2byte(uint8_t *hex, uint8_t *str) {
|
||||
char high, low;
|
||||
|
@ -5,12 +5,12 @@
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <mincrypt/sha.h>
|
||||
#include <logging.h>
|
||||
#include <utils.h>
|
||||
#include <logging.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "magiskboot.h"
|
||||
#include "compress.h"
|
||||
#include "magiskboot.hpp"
|
||||
#include "compress.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include <utils.hpp>
|
||||
|
||||
#include "magiskboot.h"
|
||||
#include "magiskboot.hpp"
|
||||
|
||||
#define MATCH(p) else if (strncmp(s + skip, p, sizeof(p) - 1) == 0) skip += (sizeof(p) - 1)
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include <cpio.h>
|
||||
#include <utils.hpp>
|
||||
#include <cpio.hpp>
|
||||
|
||||
#include "magiskboot.h"
|
||||
#include "compress.h"
|
||||
#include "magiskboot.hpp"
|
||||
#include "compress.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <utils.h>
|
||||
#include <selinux.h>
|
||||
#include <resetprop.h>
|
||||
#include <magisk.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <resetprop.hpp>
|
||||
|
||||
#include "magiskhide.h"
|
||||
#include "magiskhide.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <utils.h>
|
||||
#include <db.h>
|
||||
#include <magisk.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <db.hpp>
|
||||
|
||||
#include "magiskhide.h"
|
||||
#include "magiskhide.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <daemon.h>
|
||||
#include <utils.h>
|
||||
#include <daemon.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "magiskhide.h"
|
||||
#include "magiskhide.hpp"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <daemon.h>
|
||||
#include <daemon.hpp>
|
||||
|
||||
#define SIGTERMTHRD SIGUSR1
|
||||
#define SIGZYGOTE SIGUSR2
|
@ -13,10 +13,10 @@
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
|
||||
#include <logging.h>
|
||||
#include <utils.h>
|
||||
#include <logging.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
#include "magiskhide.h"
|
||||
#include "magiskhide.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <magiskpolicy.h>
|
||||
#include <magiskpolicy.hpp>
|
||||
|
||||
#include "sepolicy.h"
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <utils.h>
|
||||
#include <logging.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <flags.h>
|
||||
#include <magiskpolicy.h>
|
||||
#include <magiskpolicy.hpp>
|
||||
|
||||
#include "sepolicy.h"
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
#include <cil/cil.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <stream.h>
|
||||
#include <magiskpolicy.h>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
#include <stream.hpp>
|
||||
#include <magiskpolicy.hpp>
|
||||
|
||||
#include "sepolicy.h"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <logging.h>
|
||||
#include <logging.hpp>
|
||||
#include <flags.h>
|
||||
#include <magiskpolicy.h>
|
||||
#include <magiskpolicy.hpp>
|
||||
|
||||
#include "sepolicy.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <sepol/policydb/expand.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include "sepolicy.h"
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <magiskpolicy.h>
|
||||
#include <logging.h>
|
||||
#include <utils.h>
|
||||
#include <magiskpolicy.hpp>
|
||||
#include <logging.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <logging.h>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include "system_properties.h"
|
||||
#include <system_properties.h>
|
||||
|
||||
struct prop_t {
|
||||
char *name;
|
@ -9,9 +9,9 @@
|
||||
#include <pb.h>
|
||||
#include <pb_decode.h>
|
||||
#include <pb_encode.h>
|
||||
#include <utils.h>
|
||||
#include <utils.hpp>
|
||||
|
||||
#include "private/resetprop.h"
|
||||
#include "_resetprop.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _BIONIC_MACROS_H_
|
||||
#define _BIONIC_MACROS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Frameworks OpenGL code currently leaks this header and allows
|
||||
// collisions with other declarations, e.g., from libnativehelper.
|
||||
// TODO: Remove once cleaned up. b/18334516
|
||||
#if !defined(DISALLOW_COPY_AND_ASSIGN)
|
||||
// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
|
||||
// It goes in the private: declarations in a class.
|
||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
TypeName(const TypeName&) = delete; \
|
||||
void operator=(const TypeName&) = delete
|
||||
#endif // !defined(DISALLOW_COPY_AND_ASSIGN)
|
||||
|
||||
// A macro to disallow all the implicit constructors, namely the
|
||||
// default constructor, copy constructor and operator= functions.
|
||||
//
|
||||
// This should be used in the private: declarations for a class
|
||||
// that wants to prevent anyone from instantiating it. This is
|
||||
// especially useful for classes containing only static methods.
|
||||
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
|
||||
TypeName() = delete; \
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
|
||||
#define BIONIC_ROUND_UP_POWER_OF_2(value) \
|
||||
((sizeof(value) == 8) \
|
||||
? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
|
||||
: (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value)))))
|
||||
|
||||
static constexpr uintptr_t align_down(uintptr_t p, size_t align) {
|
||||
return p & ~(align - 1);
|
||||
}
|
||||
|
||||
static constexpr uintptr_t align_up(uintptr_t p, size_t align) {
|
||||
return (p + align - 1) & ~(align - 1);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline T* align_down(T* p, size_t align) {
|
||||
return reinterpret_cast<T*>(align_down(reinterpret_cast<uintptr_t>(p), align));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline T* align_up(T* p, size_t align) {
|
||||
return reinterpret_cast<T*>(align_up(reinterpret_cast<uintptr_t>(p), align));
|
||||
}
|
||||
|
||||
#if defined(__arm__)
|
||||
// Do not emit anything for arm, clang does not allow emiting an arm unwind
|
||||
// directive.
|
||||
// #define BIONIC_STOP_UNWIND asm volatile(".cantunwind")
|
||||
#define BIONIC_STOP_UNWIND
|
||||
#elif defined(__aarch64__)
|
||||
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined x30")
|
||||
#elif defined(__i386__)
|
||||
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%eip")
|
||||
#elif defined(__x86_64__)
|
||||
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined \%rip")
|
||||
#elif defined (__mips__)
|
||||
#define BIONIC_STOP_UNWIND asm volatile(".cfi_undefined $ra")
|
||||
#endif
|
||||
|
||||
// The arraysize(arr) macro returns the # of elements in an array arr.
|
||||
// The expression is a compile-time constant, and therefore can be
|
||||
// used in defining new arrays, for example. If you use arraysize on
|
||||
// a pointer by mistake, you will get a compile-time error.
|
||||
//
|
||||
// One caveat is that arraysize() doesn't accept any array of an
|
||||
// anonymous type or a type defined inside a function.
|
||||
//
|
||||
// This template function declaration is used in defining arraysize.
|
||||
// Note that the function doesn't need an implementation, as we only
|
||||
// use its type.
|
||||
template <typename T, size_t N>
|
||||
char (&ArraySizeHelper(T (&array)[N]))[N]; // NOLINT(readability/casting)
|
||||
|
||||
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
|
||||
|
||||
// Used to inform clang's -Wimplicit-fallthrough that a fallthrough is intended. There's no way to
|
||||
// silence (or enable, apparently) -Wimplicit-fallthrough in C yet.
|
||||
#ifdef __cplusplus
|
||||
#define __BIONIC_FALLTHROUGH [[clang::fallthrough]]
|
||||
#else
|
||||
#define __BIONIC_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#endif // _BIONIC_MACROS_H_
|
@ -1,21 +0,0 @@
|
||||
#ifndef REDEFS_H
|
||||
#define REDEFS_H
|
||||
|
||||
#define __system_property_set _system_property_set2
|
||||
#define __system_property_find _system_property_find2
|
||||
#define __system_property_read_callback _system_property_read_callback2
|
||||
#define __system_property_foreach __system_property_foreach2
|
||||
#define __system_property_wait __system_property_wait2
|
||||
#define __system_property_read __system_property_read2
|
||||
#define __system_property_get __system_property_get2
|
||||
#define __system_property_find_nth __system_property_find_nth2
|
||||
#define __system_property_set_filename __system_property_set_filename2
|
||||
#define __system_property_area_init __system_property_area_init2
|
||||
#define __system_property_area_serial __system_property_area_serial2
|
||||
#define __system_property_add __system_property_add2
|
||||
#define __system_property_update __system_property_update2
|
||||
#define __system_property_serial __system_property_serial2
|
||||
#define __system_properties_init __system_properties_init2
|
||||
#define __system_property_wait_any __system_property_wait_any2
|
||||
|
||||
#endif //REDEFS_H
|
@ -9,15 +9,15 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <logging.h>
|
||||
#include <resetprop.h>
|
||||
#include <utils.h>
|
||||
#include <logging.hpp>
|
||||
#include <resetprop.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
#include "private/_system_properties.h"
|
||||
#include "private/system_properties.h"
|
||||
#include "private/resetprop.h"
|
||||
#include <_system_properties.h>
|
||||
|
||||
#include "_resetprop.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -5,11 +5,11 @@
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <daemon.h>
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <daemon.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include "su.h"
|
||||
#include "su.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include "pts.h"
|
||||
#include "pts.hpp"
|
||||
|
||||
/**
|
||||
* Helper functions
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* pts.h
|
||||
* pts.hpp
|
||||
*
|
||||
* Manages the pseudo-terminal driver on Linux/Android and provides some
|
||||
* helper functions to handle raw input mode and terminal window resizing
|
@ -21,12 +21,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <daemon.h>
|
||||
#include <utils.h>
|
||||
#include <daemon.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "su.h"
|
||||
#include "pts.h"
|
||||
#include "su.hpp"
|
||||
#include "pts.hpp"
|
||||
|
||||
int quit_signals[] = { SIGALRM, SIGABRT, SIGHUP, SIGPIPE, SIGQUIT, SIGTERM, SIGINT, 0 };
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <memory>
|
||||
|
||||
#include <db.h>
|
||||
#include <utils.h>
|
||||
#include <db.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
#define DEFAULT_SHELL "/system/bin/sh"
|
||||
|
@ -12,13 +12,13 @@
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <daemon.h>
|
||||
#include <utils.h>
|
||||
#include <selinux.h>
|
||||
#include <logging.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
#include "su.h"
|
||||
#include "pts.h"
|
||||
#include "su.hpp"
|
||||
#include "pts.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -10,6 +10,8 @@ LOCAL_SRC_FILES := \
|
||||
prop_area.cpp \
|
||||
prop_info.cpp \
|
||||
system_properties.cpp \
|
||||
system_property_api.cpp \
|
||||
system_property_set.cpp \
|
||||
property_info_parser.cpp
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <syscall.h>
|
||||
|
||||
#ifndef PR_SET_VMA
|
||||
#define PR_SET_VMA 0x53564d41
|
||||
#endif
|
||||
#ifndef PR_SET_VMA_ANON_NAME
|
||||
#define PR_SET_VMA_ANON_NAME 0
|
||||
#endif
|
||||
#define getline __getline
|
||||
#define fsetxattr(...) syscall(__NR_fsetxattr, __VA_ARGS__)
|
||||
ssize_t __getline(char **, size_t *, FILE *);
|
35
native/jni/systemproperties/include/private/hacks.h
Normal file
35
native/jni/systemproperties/include/private/hacks.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <syscall.h>
|
||||
|
||||
// Missing defines
|
||||
#ifndef PR_SET_VMA
|
||||
#define PR_SET_VMA 0x53564d41
|
||||
#endif
|
||||
#ifndef PR_SET_VMA_ANON_NAME
|
||||
#define PR_SET_VMA_ANON_NAME 0
|
||||
#endif
|
||||
|
||||
// Missing functions
|
||||
#define fsetxattr(...) syscall(__NR_fsetxattr, __VA_ARGS__)
|
||||
#define getline __getline
|
||||
ssize_t __getline(char **, size_t *, FILE *);
|
||||
|
||||
// Rename symbols
|
||||
#pragma redefine_extname __system_property_set _system_property_set2
|
||||
#pragma redefine_extname __system_property_find _system_property_find2
|
||||
#pragma redefine_extname __system_property_read_callback _system_property_read_callback2
|
||||
#pragma redefine_extname __system_property_foreach __system_property_foreach2
|
||||
#pragma redefine_extname __system_property_wait __system_property_wait2
|
||||
#pragma redefine_extname __system_property_read __system_property_read2
|
||||
#pragma redefine_extname __system_property_get __system_property_get2
|
||||
#pragma redefine_extname __system_property_find_nth __system_property_find_nth2
|
||||
#pragma redefine_extname __system_property_set_filename __system_property_set_filename2
|
||||
#pragma redefine_extname __system_property_area_init __system_property_area_init2
|
||||
#pragma redefine_extname __system_property_area_serial __system_property_area_serial2
|
||||
#pragma redefine_extname __system_property_add __system_property_add2
|
||||
#pragma redefine_extname __system_property_update __system_property_update2
|
||||
#pragma redefine_extname __system_property_serial __system_property_serial2
|
||||
#pragma redefine_extname __system_properties_init __system_properties_init2
|
||||
#pragma redefine_extname __system_property_wait_any __system_property_wait_any2
|
@ -33,7 +33,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "redefs.h"
|
||||
|
||||
#include "private/hacks.h"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
@ -30,10 +30,10 @@
|
||||
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/system_properties.h>
|
||||
//#include <sys/system_properties.h>
|
||||
#include "../system_properties.h"
|
||||
|
||||
#include "private/bionic_macros.h"
|
||||
#include "hacks.h"
|
||||
|
||||
// The C11 standard doesn't allow atomic loads from const fields,
|
||||
// though C++11 does. Fudge it until standards get straightened out.
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/system_properties.h>
|
||||
//#include <sys/system_properties.h>
|
||||
#include "../system_properties.h"
|
||||
|
||||
#include "contexts.h"
|
||||
#include "contexts_pre_split.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
//#include <sys/_system_properties.h>
|
||||
#include "private/_system_properties.h"
|
||||
#include <_system_properties.h>
|
||||
|
||||
#include <system_properties/prop_area.h>
|
||||
#include <system_properties/system_properties.h>
|
@ -39,7 +39,7 @@
|
||||
#include <sys/un.h>
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
//#include <sys/_system_properties.h>
|
||||
#include "private/_system_properties.h"
|
||||
#include <_system_properties.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <async_safe/log.h>
|
||||
@ -173,7 +173,7 @@ class SocketWriter {
|
||||
uint32_t uint_buf_[kUintBufSize];
|
||||
size_t uint_buf_index_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(SocketWriter);
|
||||
BIONIC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketWriter);
|
||||
};
|
||||
|
||||
struct prop_msg {
|
@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <cpio.h>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
#include <cpio.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include <utils.h>
|
||||
#include <selinux.h>
|
||||
#include <utils.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <functional>
|
||||
#include <string_view>
|
||||
|
||||
#include "xwrap.h"
|
||||
#include "xwrap.hpp"
|
||||
|
||||
#define do_align(p, a) (((p) + (a) - 1) / (a) * (a))
|
||||
#define align_off(p, a) (do_align(p, a) - (p))
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
#include <deque>
|
||||
#include <misc.h>
|
||||
#include <../misc.hpp>
|
||||
|
||||
template<typename T>
|
||||
class blocking_queue {
|
@ -6,7 +6,7 @@
|
||||
#include <map>
|
||||
#include <string_view>
|
||||
|
||||
#include <stream.h>
|
||||
#include <stream.hpp>
|
||||
|
||||
struct cpio_newc_header;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <memory>
|
||||
|
||||
#include "../files.h"
|
||||
#include "../files.hpp"
|
||||
|
||||
class stream {
|
||||
public:
|
@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../missing.h"
|
||||
#include "../xwrap.h"
|
||||
#include "../files.h"
|
||||
#include "../misc.h"
|
6
native/jni/utils/include/utils.hpp
Normal file
6
native/jni/utils/include/utils.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../missing.hpp"
|
||||
#include "../xwrap.hpp"
|
||||
#include "../files.hpp"
|
||||
#include "../misc.hpp"
|
@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <logging.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
int nop_log(const char *fmt, va_list ap) {
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include <syscall.h>
|
||||
#include <random>
|
||||
|
||||
#include <logging.h>
|
||||
#include <utils.h>
|
||||
#include <logging.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
int fork_dont_care() {
|
||||
int pid = xfork();
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <errno.h>
|
||||
#include <mntent.h>
|
||||
|
||||
#include "missing.h"
|
||||
#include "missing.hpp"
|
||||
|
||||
/* Original source: https://opensource.apple.com/source/cvs/cvs-19/cvs/lib/getline.c
|
||||
* License: GPL 2 or later
|
||||
|
@ -6,9 +6,9 @@
|
||||
#include <syscall.h>
|
||||
#include <string_view>
|
||||
|
||||
#include <magisk.h>
|
||||
#include <utils.h>
|
||||
#include <selinux.h>
|
||||
#include <magisk.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <utils.h>
|
||||
#include <logging.h>
|
||||
#include <stream.h>
|
||||
#include <utils.hpp>
|
||||
#include <logging.hpp>
|
||||
#include <stream.hpp>
|
||||
|
||||
static int strm_read(void *v, char *buf, int len) {
|
||||
auto strm = reinterpret_cast<stream *>(v);
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/sendfile.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <utils.h>
|
||||
#include <logging.hpp>
|
||||
#include <utils.hpp>
|
||||
|
||||
FILE *xfopen(const char *pathname, const char *mode) {
|
||||
FILE *fp = fopen(pathname, mode);
|
||||
|
Loading…
Reference in New Issue
Block a user