Skip to content

Commit

Permalink
fix retro bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yigonghu committed Aug 11, 2023
1 parent 4dc5533 commit 8e9d91a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion libs/src/psandbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
static __thread int psandbox_id;

//#define DISABLE_PSANDBOX
//#define IS_RETRO
#define IS_RETRO
//#define TRACE_NUMBER
//#define NO_LIB
struct hashmap_s *psandbox_map = NULL;
Expand Down Expand Up @@ -172,6 +172,11 @@ int get_psandbox(size_t key) {
#ifdef DISABLE_PSANDBOX
return -1;
#endif

#ifdef IS_RETRO
return get_current_psandbox();
#endif

int pid = (int) syscall(SYS_GET_PSANDBOX, key);
#ifdef TRACE_NUMBER
TRACK_SYSCALL();
Expand All @@ -188,6 +193,10 @@ int unbind_psandbox(size_t key, int pid, enum enum_unbind_flag flags) {
#ifdef DISABLE_PSANDBOX
return -1;
#endif

#ifdef IS_RETRO
return 1;
#endif
if (pid == -1) {
printf("Error: Can't unbind sandbox for the thread %ld\n",syscall(SYS_gettid));
return -1;
Expand All @@ -212,6 +221,10 @@ int bind_psandbox(size_t key) {
#ifdef TRACE_NUMBER
TRACK_SYSCALL();
#endif

#ifdef IS_RETRO
return get_current_psandbox();
#endif
int bid = (int) syscall(SYS_BIND_PSANDBOX, key);

if (bid == -1) {
Expand Down Expand Up @@ -395,6 +408,7 @@ int get_psandbox_record() {
#ifdef DISABLE_PSANDBOX
return 1;
#endif

if (psandbox_id == 0)
return -1;
psandbox = (PSandbox *) hashmap_get(psandbox_map, psandbox_id, 0);
Expand Down

0 comments on commit 8e9d91a

Please sign in to comment.