-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing source file from previous patch
Huks.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 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
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) |