Changes in / [df6cc9d:135143b]
- Files:
-
- 16 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/Makefile.am
rdf6cc9d r135143b 127 127 128 128 thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \ 129 interpose_thread.cfa \130 129 bits/signal.hfa \ 131 130 concurrency/clib/cfathread.cfa \ … … 146 145 concurrency/stats.cfa \ 147 146 concurrency/stats.hfa \ 148 concurrency/stats.hfa \ 149 concurrency/pthread.cfa 147 concurrency/stats.hfa 150 148 151 149 else -
libcfa/src/concurrency/clib/cfathread.cfa
rdf6cc9d r135143b 172 172 173 173 pthread_attr_t attr; 174 if (int ret = __cfaabi_pthread_attr_init(&attr); 0 != ret) {174 if (int ret = pthread_attr_init(&attr); 0 != ret) { 175 175 abort | "failed to create master epoll thread attr: " | ret | strerror(ret); 176 176 } 177 177 178 if (int ret = __cfaabi_pthread_create(&master_poller, &attr, master_epoll, 0p); 0 != ret) {178 if (int ret = pthread_create(&master_poller, &attr, master_epoll, 0p); 0 != ret) { 179 179 abort | "failed to create master epoll thread: " | ret | strerror(ret); 180 180 } -
libcfa/src/concurrency/io.cfa
rdf6cc9d r135143b 610 610 if( we ) { 611 611 sigval_t value = { PREEMPT_IO }; 612 __cfaabi_pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value);612 pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value); 613 613 } 614 614 -
libcfa/src/concurrency/io/setup.cfa
rdf6cc9d r135143b 344 344 // iopoll.run = false; 345 345 // sigval val = { 1 }; 346 // __cfaabi_pthread_sigqueue( iopoll.thrd, SIGUSR1, val );346 // pthread_sigqueue( iopoll.thrd, SIGUSR1, val ); 347 347 348 348 // // Make sure all this is done -
libcfa/src/concurrency/kernel/private.hfa
rdf6cc9d r135143b 20 20 #endif 21 21 22 #include <signal.h>23 24 22 #include "kernel.hfa" 25 23 #include "thread.hfa" … … 50 48 #endif 51 49 #endif 50 52 51 // #define READYQ_USE_LINEAR_AVG 53 52 #define READYQ_USE_LOGDBL_AVG … … 63 62 #error must pick a scheme for averaging 64 63 #endif 65 66 extern "C" {67 __attribute__((visibility("protected"))) int __cfaabi_pthread_create(pthread_t *_thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);68 __attribute__((visibility("protected"))) int __cfaabi_pthread_join(pthread_t _thread, void **retval);69 __attribute__((visibility("protected"))) pthread_t __cfaabi_pthread_self(void);70 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_init(pthread_attr_t *attr);71 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_destroy(pthread_attr_t *attr);72 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_setstack( pthread_attr_t *attr, void *stackaddr, size_t stacksize );73 __attribute__((visibility("protected"))) int __cfaabi_pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize );74 __attribute__((visibility("protected"))) int __cfaabi_pthread_sigqueue(pthread_t _thread, int sig, const union sigval value);75 __attribute__((visibility("protected"))) int __cfaabi_pthread_sigmask( int how, const sigset_t *set, sigset_t *oset);76 }77 64 78 65 //----------------------------------------------------------------------------- -
libcfa/src/concurrency/kernel/startup.cfa
rdf6cc9d r135143b 222 222 ( this.runner ){}; 223 223 init( this, "Main Processor", *mainCluster, 0p ); 224 kernel_thread = __cfaabi_pthread_self();224 kernel_thread = pthread_self(); 225 225 226 226 runner{ &this }; … … 283 283 } 284 284 285 extern "C"{286 void pthread_delete_kernel_threads_();287 }288 289 290 285 static void __kernel_shutdown(void) { 291 286 if(!cfa_main_returned) return; 292 293 //delete kernel threads for pthread_concurrency294 pthread_delete_kernel_threads_();295 296 287 /* paranoid */ verify( __preemption_enabled() ); 297 288 disable_interrupts(); … … 786 777 pthread_attr_t attr; 787 778 788 check( __cfaabi_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute779 check( pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute 789 780 790 781 size_t stacksize = max( PTHREAD_STACK_MIN, DEFAULT_STACK_SIZE ); … … 813 804 #endif 814 805 815 check( __cfaabi_pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" );816 check( __cfaabi_pthread_create( pthread, &attr, start, arg ), "pthread_create" );806 check( pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" ); 807 check( pthread_create( pthread, &attr, start, arg ), "pthread_create" ); 817 808 return stack; 818 809 } 819 810 820 811 void __destroy_pthread( pthread_t pthread, void * stack, void ** retval ) { 821 int err = __cfaabi_pthread_join( pthread, retval );812 int err = pthread_join( pthread, retval ); 822 813 if( err != 0 ) abort("KERNEL ERROR: joining pthread %p caused error %s\n", (void*)pthread, strerror(err)); 823 814 … … 825 816 pthread_attr_t attr; 826 817 827 check( __cfaabi_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute818 check( pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute 828 819 829 820 size_t stacksize; 830 821 // default stack size, normally defined by shell limit 831 check( __cfaabi_pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" );822 check( pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" ); 832 823 assert( stacksize >= PTHREAD_STACK_MIN ); 833 824 stacksize += __page_size; -
libcfa/src/concurrency/preemption.cfa
rdf6cc9d r135143b 352 352 sigset_t oldset; 353 353 int ret; 354 ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary354 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 355 355 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 356 356 … … 385 385 sigaddset( &mask, sig ); 386 386 387 if ( __cfaabi_pthread_sigmask( SIG_UNBLOCK, &mask, 0p ) == -1 ) {387 if ( pthread_sigmask( SIG_UNBLOCK, &mask, 0p ) == -1 ) { 388 388 abort( "internal error, pthread_sigmask" ); 389 389 } … … 396 396 sigaddset( &mask, sig ); 397 397 398 if ( __cfaabi_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {398 if ( pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) { 399 399 abort( "internal error, pthread_sigmask" ); 400 400 } … … 404 404 static void preempt( processor * this ) { 405 405 sigval_t value = { PREEMPT_NORMAL }; 406 __cfaabi_pthread_sigqueue( this->kernel_thread, SIGUSR1, value );406 pthread_sigqueue( this->kernel_thread, SIGUSR1, value ); 407 407 } 408 408 … … 415 415 sigset_t oldset; 416 416 int ret; 417 ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary417 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 418 418 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 419 419 … … 434 434 sigset_t oldset; 435 435 int ret; 436 ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary436 ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset); // workaround trac#208: cast should be unnecessary 437 437 if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); } 438 438 … … 505 505 sigval val; 506 506 val.sival_int = 0; 507 __cfaabi_pthread_sigqueue( alarm_thread, SIGALRM, val );507 pthread_sigqueue( alarm_thread, SIGALRM, val ); 508 508 509 509 // Wait for the preemption thread to finish … … 579 579 static_assert( sizeof( sigset_t ) == sizeof( cxt->uc_sigmask ), "Expected cxt->uc_sigmask to be of sigset_t" ); 580 580 #endif 581 if ( __cfaabi_pthread_sigmask( SIG_SETMASK, (sigset_t *)&(cxt->uc_sigmask), 0p ) == -1 ) {581 if ( pthread_sigmask( SIG_SETMASK, (sigset_t *)&(cxt->uc_sigmask), 0p ) == -1 ) { 582 582 abort( "internal error, sigprocmask" ); 583 583 } … … 607 607 sigset_t mask; 608 608 sigfillset(&mask); 609 if ( __cfaabi_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {609 if ( pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) { 610 610 abort( "internal error, pthread_sigmask" ); 611 611 } -
libcfa/src/interpose.cfa
rdf6cc9d r135143b 42 42 43 43 typedef void (* generic_fptr_t)(void); 44 static generic_fptr_t do_interpose_symbol( void * library, const char symbol[], const char version[] ) {45 const char * error;46 47 union { generic_fptr_t fptr; void * ptr; } originalFunc;48 49 #if defined( _GNU_SOURCE )50 if ( version ) {51 originalFunc.ptr = dlvsym( library, symbol, version );52 } else {53 originalFunc.ptr = dlsym( library, symbol );54 }55 #else56 originalFunc.ptr = dlsym( library, symbol );57 #endif // _GNU_SOURCE58 59 error = dlerror();60 if ( error ) abort( "interpose_symbol : internal error, %s\n", error );61 62 return originalFunc.fptr;63 }64 65 44 static generic_fptr_t interpose_symbol( const char symbol[], const char version[] ) { 66 45 const char * error; 67 46 68 47 static void * library; 69 static void * pthread_library;70 48 if ( ! library ) { 71 49 #if defined( RTLD_NEXT ) … … 80 58 #endif 81 59 } // if 82 if ( ! pthread_library ) { 83 #if defined( RTLD_NEXT ) 84 pthread_library = RTLD_NEXT; 85 #else 86 // missing RTLD_NEXT => must hard-code library name, assuming libstdc++ 87 pthread_library = dlopen( "libpthread.so", RTLD_LAZY ); 88 error = dlerror(); 89 if ( error ) { 90 abort( "interpose_symbol : failed to open libpthread, %s\n", error ); 91 } 92 #endif 93 } // if 94 95 return do_interpose_symbol(library, symbol, version); 60 61 union { generic_fptr_t fptr; void * ptr; } originalFunc; 62 63 #if defined( _GNU_SOURCE ) 64 if ( version ) { 65 originalFunc.ptr = dlvsym( library, symbol, version ); 66 } else { 67 originalFunc.ptr = dlsym( library, symbol ); 68 } 69 #else 70 originalFunc.ptr = dlsym( library, symbol ); 71 #endif // _GNU_SOURCE 72 73 error = dlerror(); 74 if ( error ) abort( "interpose_symbol : internal error, %s\n", error ); 75 76 return originalFunc.fptr; 96 77 } 97 78 … … 116 97 117 98 extern "C" { 118 void __cfathreadabi_interpose_startup( generic_fptr_t (*do_interpose_symbol)( void * library, const char symbol[], const char version[] ) ) __attribute__((weak));119 99 void __cfaabi_interpose_startup( void ) { 120 100 const char *version = 0p; … … 128 108 INTERPOSE_LIBC( exit , version ); 129 109 #pragma GCC diagnostic pop 130 131 if(__cfathreadabi_interpose_startup) __cfathreadabi_interpose_startup( do_interpose_symbol );132 110 133 111 // As a precaution (and necessity), errors that result in termination are delivered on a separate stack because
Note: See TracChangeset
for help on using the changeset viewer.