mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-18 15:47:54 -08:00
@@ -10,8 +10,8 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
/* Original source: https://github.com/freebsd/freebsd/blob/master/contrib/file/src/getline.c
|
||||
* License: BSD, full copyright notice please check original source */
|
||||
// Original source: https://github.com/freebsd/freebsd/blob/master/contrib/file/src/getline.c
|
||||
// License: BSD, full copyright notice please check original source
|
||||
|
||||
ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) {
|
||||
char *ptr, *eptr;
|
||||
@@ -53,8 +53,8 @@ ssize_t getline(char **buf, size_t *bufsiz, FILE *fp) {
|
||||
return getdelim(buf, bufsiz, '\n', fp);
|
||||
}
|
||||
|
||||
/* Original source: https://android.googlesource.com/platform/bionic/+/master/libc/bionic/mntent.cpp
|
||||
* License: AOSP, full copyright notice please check original source */
|
||||
// Original source: https://android.googlesource.com/platform/bionic/+/master/libc/bionic/mntent.cpp
|
||||
// License: AOSP, full copyright notice please check original source
|
||||
|
||||
struct mntent *getmntent_r(FILE *fp, struct mntent *e, char *buf, int buf_len) {
|
||||
memset(e, 0, sizeof(*e));
|
||||
@@ -143,7 +143,28 @@ int ftruncate64(int fd, off64_t length) {
|
||||
#endif
|
||||
|
||||
#if !defined(__LP64__)
|
||||
void android_set_abort_message(const char *msg) {}
|
||||
void android_set_abort_message(const char *) {}
|
||||
|
||||
// Original source: <android/legacy_signal_inlines.h>
|
||||
int sigaddset(sigset_t *set, int signum) {
|
||||
/* Signal numbers start at 1, but bit positions start at 0. */
|
||||
int bit = signum - 1;
|
||||
auto *local_set = (unsigned long *)set;
|
||||
if (set == nullptr || bit < 0 || bit >= (int)(8 * sizeof(sigset_t))) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
local_set[bit / LONG_BIT] |= 1UL << (bit % LONG_BIT);
|
||||
return 0;
|
||||
}
|
||||
int sigemptyset(sigset_t *set) {
|
||||
if (set == nullptr) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
memset(set, 0, sizeof(sigset_t));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user