Skip to content

Commit

Permalink
Add missing source file from previous patch
Browse files Browse the repository at this point in the history
Huks.
  • Loading branch information
th-otto committed Oct 8, 2024
1 parent 2f725bb commit 77bdf31
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions unix/ppoll.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* ppoll.c -- MiNTLib.
Copyright (C) 2024 Thorsten Otto
This file is part of the MiNTLib project, and may only be used
modified and distributed under the terms of the MiNTLib project
license, COPYMINT. By continuing to use, modify, or distribute
this file you indicate that you have read the license and
understand and accept it fully.
*/

#include <signal.h>
#include <sys/select.h>
#include <sys/poll.h>
#include <sys/time.h>

__typeof__(ppoll) __ppoll;

int
__ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *tmo, const sigset_t *sigmask)
{
sigset_t savemask;
int retval;
__int32_t timeout = tmo == NULL ? -1 : tmo->tv_sec * 1000 + (tmo->tv_nsec + 999999) / 1000000;

/* The setting and restoring of the signal mask and the select call
should be an atomic operation. This can't be done without kernel
help. */
if (sigmask != NULL)
__sigprocmask(SIG_SETMASK, sigmask, &savemask);
retval = poll(fds, nfds, timeout);
if (sigmask != NULL)
__sigprocmask(SIG_SETMASK, &savemask, NULL);
return retval;
}
weak_alias (__ppoll, ppoll)

0 comments on commit 77bdf31

Please sign in to comment.