File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* ppoll.c -- MiNTLib.
2
+ Copyright (C) 2024 Thorsten Otto
3
+
4
+ This file is part of the MiNTLib project, and may only be used
5
+ modified and distributed under the terms of the MiNTLib project
6
+ license, COPYMINT. By continuing to use, modify, or distribute
7
+ this file you indicate that you have read the license and
8
+ understand and accept it fully.
9
+ */
10
+
11
+ #include <signal.h>
12
+ #include <sys/select.h>
13
+ #include <sys/poll.h>
14
+ #include <sys/time.h>
15
+
16
+ __typeof__ (ppoll ) __ppoll ;
17
+
18
+ int
19
+ __ppoll (struct pollfd * fds , nfds_t nfds , const struct timespec * tmo , const sigset_t * sigmask )
20
+ {
21
+ sigset_t savemask ;
22
+ int retval ;
23
+ __int32_t timeout = tmo == NULL ? -1 : tmo -> tv_sec * 1000 + (tmo -> tv_nsec + 999999 ) / 1000000 ;
24
+
25
+ /* The setting and restoring of the signal mask and the select call
26
+ should be an atomic operation. This can't be done without kernel
27
+ help. */
28
+ if (sigmask != NULL )
29
+ __sigprocmask (SIG_SETMASK , sigmask , & savemask );
30
+ retval = poll (fds , nfds , timeout );
31
+ if (sigmask != NULL )
32
+ __sigprocmask (SIG_SETMASK , & savemask , NULL );
33
+ return retval ;
34
+ }
35
+ weak_alias (__ppoll , ppoll )
You can’t perform that action at this time.
0 commit comments