From 77bdf31fbd52ef7581fc35f6383a40df0e3a759d Mon Sep 17 00:00:00 2001 From: Thorsten Otto Date: Tue, 8 Oct 2024 11:22:51 +0200 Subject: [PATCH] Add missing source file from previous patch Huks. --- unix/ppoll.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 unix/ppoll.c diff --git a/unix/ppoll.c b/unix/ppoll.c new file mode 100644 index 0000000..f58724f --- /dev/null +++ b/unix/ppoll.c @@ -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 +#include +#include +#include + +__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)