forked from ish-app/ish
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
93 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef FS_ISHSTAT_H | ||
#define FS_ISHSTAT_H | ||
|
||
#include "misc.h" | ||
|
||
// The values in this structure are stored in an extended attribute on a file, | ||
// because on iOS I can't change the uid or gid of a file. | ||
// TODO the xattr api is a little different on darwin | ||
struct xattr_stat { | ||
dword_t mode; | ||
dword_t uid; | ||
dword_t gid; | ||
dword_t dev; | ||
dword_t rdev; | ||
}; | ||
#if defined(__linux__) | ||
#define STAT_XATTR "user.ish.stat" | ||
#elif defined(__APPLE__) | ||
#define STAT_XATTR "com.tbodt.ish.stat" | ||
#endif | ||
|
||
#if __linux__ | ||
static inline int set_ishstat(const char *path, struct xattr_stat *stat) { | ||
return setxattr(path, "user.ish.stat", stat, sizeof(*stat), 0); | ||
} | ||
static inline int fget_ishstat(int fd, struct xattr_stat *stat) { | ||
return fgetxattr(fd, "user.ish.stat", stat, sizeof(*stat)); | ||
} | ||
static inline int lget_ishstat(const char *path, struct xattr_stat *stat) { | ||
return lgetxattr(path, "user.ish.stat", stat, sizeof(*stat)); | ||
} | ||
#elif __APPLE__ | ||
static inline int set_ishstat(const char *path, struct xattr_stat *stat) { | ||
return setxattr(path, "com.tbodt.ish.stat", stat, sizeof(*stat), 0, 0); | ||
} | ||
static inline int fget_ishstat(int fd, struct xattr_stat *stat) { | ||
return fgetxattr(fd, "com.tbodt.ish.stat", stat, sizeof(*stat), 0, 0); | ||
} | ||
static inline int lget_ishstat(const char *path, struct xattr_stat *stat) { | ||
return getxattr(path, "com.tbodt.ish.stat", stat, sizeof(*stat), 0, XATTR_NOFOLLOW); | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include <string.h> | ||
#include <sys/socket.h> | ||
#include <sys/un.h> | ||
#include <netinet/in.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
transplant_src = [ | ||
'vdso-transplant.c', | ||
'ptutil.c', | ||
cified_vdso, | ||
] | ||
executable('ptraceomatic', ['ptraceomatic.c', 'undefined-flags.c', transplant_src], dependencies: [ish, softfloat, threads]) | ||
configure_file(input: 'ptraceomatic-gdb.gdb', output: '@PLAINNAME@', configuration: configuration_data()) | ||
# these tools are linux-specific | ||
if build_machine.system() == 'linux' | ||
transplant_src = [ | ||
'vdso-transplant.c', | ||
'ptutil.c', | ||
cified_vdso, | ||
] | ||
executable('ptraceomatic', ['ptraceomatic.c', 'undefined-flags.c', transplant_src], dependencies: [ish, softfloat, threads]) | ||
configure_file(input: 'ptraceomatic-gdb.gdb', output: '@PLAINNAME@', configuration: configuration_data()) | ||
|
||
executable('xattrify_fs', ['xattrify_fs.c']) | ||
# tools for messing with vdsos | ||
executable('vdso-dump', ['vdso-dump.c'], c_args: ['-m32'], link_args: ['-m32']) | ||
executable('vdso-transplant', ['vdso-transplant-main.c', transplant_src], | ||
include_directories: includes) | ||
endif | ||
|
||
# tools for messing with vdsos | ||
executable('vdso-dump', ['vdso-dump.c'], c_args: ['-m32'], link_args: ['-m32']) | ||
executable('vdso-transplant', ['vdso-transplant-main.c', transplant_src], | ||
include_directories: includes) | ||
executable('xattrify_fs', ['xattrify_fs.c'], include_directories: includes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters