Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit fdfb667

Browse files
authored
Merge pull request #54 from kazumi007/fix-getrlimit
Fix getrlimit() to return RLIM_INFINITY
2 parents c11c9e5 + c48a0af commit fdfb667

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

include/linux/misc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ struct l___sysctl_args
8080

8181
#define LINUX_RLIM_NLIMITS 10
8282

83+
#define LINUX_RLIM_INFINITY (~0UL)
84+
8385
struct l_rlimit {
8486
l_ulong rlim_cur;
8587
l_ulong rlim_max;

src/conv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ darwin_to_linux_rlimit(int resource, struct rlimit *darwin_rlimit, struct l_rlim
620620
break;
621621
default:
622622
*linux_rlimit = (struct l_rlimit) {
623-
.rlim_cur = darwin_rlimit->rlim_cur,
624-
.rlim_max = darwin_rlimit->rlim_max
623+
.rlim_cur = darwin_rlimit->rlim_cur == RLIM_INFINITY ? LINUX_RLIM_INFINITY : darwin_rlimit->rlim_cur,
624+
.rlim_max = darwin_rlimit->rlim_max == RLIM_INFINITY ? LINUX_RLIM_INFINITY : darwin_rlimit->rlim_max
625625
};
626626
}
627627
}

0 commit comments

Comments
 (0)