Line data Source code
1 : #define _GNU_SOURCE 2 : #include "fd_util.h" 3 : 4 : void 5 : fd_boot( int * pargc, 6 2644 : char *** pargv ) { 7 : /* At this point, we are immediately after the program start, there is 8 : only one thread of execution and fd has not yet been booted. */ 9 2644 : fd_version_private_boot( pargc, pargv ); 10 2644 : fd_log_private_boot ( pargc, pargv ); 11 2644 : fd_shmem_private_boot ( pargc, pargv ); 12 2644 : fd_tile_private_boot ( pargc, pargv ); /* The caller is now tile 0 */ 13 2644 : } 14 : 15 : void 16 1504 : fd_halt( void ) { 17 : /* At this point, we are immediately before normal program 18 : termination, and fd has already been booted. */ 19 1504 : fd_tile_private_halt (); 20 1504 : fd_shmem_private_halt(); 21 1504 : fd_log_private_halt (); 22 1504 : } 23 : 24 : long 25 276542 : _fd_tickcount( void const * _ ) { 26 276542 : (void)_; 27 276542 : return fd_tickcount(); 28 276542 : } 29 : 30 : #if FD_HAS_HOSTED 31 : 32 : #include <poll.h> 33 : #include <sched.h> 34 : #include <time.h> 35 : 36 3225520 : void fd_yield( void ) { sched_yield(); } 37 : 38 : int 39 : fd_syscall_poll( struct pollfd * fds, 40 : uint nfds, 41 30 : int timeout ) { 42 30 : #if defined(__linux__) 43 30 : if( timeout<0 ) { 44 0 : return ppoll( fds, nfds, NULL, NULL ); 45 30 : } else { 46 30 : struct timespec ts = { 47 30 : .tv_sec = (long)( timeout/1000 ), 48 30 : .tv_nsec = (long)((timeout%1000)*1000000), 49 30 : }; 50 30 : return ppoll( fds, nfds, &ts, NULL ); 51 30 : } 52 : #else 53 : return poll( fds, nfds, timeout ); 54 : #endif 55 30 : } 56 : 57 : #endif