Skip to content

Commit

Permalink
Merge pull request #1343 from microsoft/bugfix-shim-initialization
Browse files Browse the repository at this point in the history
[shim] Missing Initialization on Many Calls
  • Loading branch information
ppenna authored Jul 25, 2024
2 parents 8184596 + fe5307c commit efd03c5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions shim/src/interpose.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
\
bool reentrant = is_reentrant_demi_call(); \
\
if ((!initialized) || (reentrant)) \
if ((in_init) || (reentrant)) \
return (fn_libc(__VA_ARGS__)); \
\
INTERPOSE_CALL2(type, fn_libc, fn_demi, __VA_ARGS__); \
Expand Down Expand Up @@ -498,8 +498,7 @@ int socket(int domain, int type, int protocol)

int epoll_create(int size)
{
if (!initialized_libc)
init_libc();
init_libc();

bool reentrant = is_reentrant_demi_call();

Expand All @@ -510,9 +509,8 @@ int epoll_create(int size)

init();

// Create epoll on kernel side.
int ret = libc_epoll_create(size);

// First, create epoll on kernel side.
if (ret == -1)
{
ERROR("epoll_create() failed - %s", strerror(errno));
Expand All @@ -523,7 +521,9 @@ int epoll_create(int size)

int last_errno = errno;
errno = 0;
if ((ret = __epoll_create(size)) == -1 && errno == EBADF)

// Create epoll on demikernel side.
if ((ret = __epoll_create(size) == -1) && (errno == EBADF))
{
errno = last_errno;
return linux_epfd;
Expand Down

0 comments on commit efd03c5

Please sign in to comment.