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