Changes in / [df6cc9d:135143b]


Ignore:
Files:
16 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    rdf6cc9d r135143b  
    127127
    128128thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \
    129         interpose_thread.cfa \
    130129        bits/signal.hfa \
    131130        concurrency/clib/cfathread.cfa \
     
    146145        concurrency/stats.cfa \
    147146        concurrency/stats.hfa \
    148         concurrency/stats.hfa \
    149         concurrency/pthread.cfa
     147        concurrency/stats.hfa
    150148
    151149else
  • libcfa/src/concurrency/clib/cfathread.cfa

    rdf6cc9d r135143b  
    172172
    173173                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) {
    175175                        abort | "failed to create master epoll thread attr: " | ret | strerror(ret);
    176176                }
    177177
    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) {
    179179                        abort | "failed to create master epoll thread: " | ret | strerror(ret);
    180180                }
  • libcfa/src/concurrency/io.cfa

    rdf6cc9d r135143b  
    610610                if( we ) {
    611611                        sigval_t value = { PREEMPT_IO };
    612                         __cfaabi_pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value);
     612                        pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value);
    613613                }
    614614
  • libcfa/src/concurrency/io/setup.cfa

    rdf6cc9d r135143b  
    344344        //      iopoll.run = false;
    345345        //      sigval val = { 1 };
    346         //      __cfaabi_pthread_sigqueue( iopoll.thrd, SIGUSR1, val );
     346        //      pthread_sigqueue( iopoll.thrd, SIGUSR1, val );
    347347
    348348        //      // Make sure all this is done
  • libcfa/src/concurrency/kernel/private.hfa

    rdf6cc9d r135143b  
    2020#endif
    2121
    22 #include <signal.h>
    23 
    2422#include "kernel.hfa"
    2523#include "thread.hfa"
     
    5048        #endif
    5149#endif
     50
    5251// #define READYQ_USE_LINEAR_AVG
    5352#define READYQ_USE_LOGDBL_AVG
     
    6362#error must pick a scheme for averaging
    6463#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 }
    7764
    7865//-----------------------------------------------------------------------------
  • libcfa/src/concurrency/kernel/startup.cfa

    rdf6cc9d r135143b  
    222222                ( this.runner ){};
    223223                init( this, "Main Processor", *mainCluster, 0p );
    224                 kernel_thread = __cfaabi_pthread_self();
     224                kernel_thread = pthread_self();
    225225
    226226                runner{ &this };
     
    283283}
    284284
    285 extern "C"{
    286         void pthread_delete_kernel_threads_();
    287 }
    288 
    289 
    290285static void __kernel_shutdown(void) {
    291286        if(!cfa_main_returned) return;
    292 
    293         //delete kernel threads for pthread_concurrency
    294         pthread_delete_kernel_threads_();
    295 
    296287        /* paranoid */ verify( __preemption_enabled() );
    297288        disable_interrupts();
     
    786777        pthread_attr_t attr;
    787778
    788         check( __cfaabi_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute
     779        check( pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute
    789780
    790781        size_t stacksize = max( PTHREAD_STACK_MIN, DEFAULT_STACK_SIZE );
     
    813804        #endif
    814805
    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" );
    817808        return stack;
    818809}
    819810
    820811void __destroy_pthread( pthread_t pthread, void * stack, void ** retval ) {
    821         int err = __cfaabi_pthread_join( pthread, retval );
     812        int err = pthread_join( pthread, retval );
    822813        if( err != 0 ) abort("KERNEL ERROR: joining pthread %p caused error %s\n", (void*)pthread, strerror(err));
    823814
     
    825816                pthread_attr_t attr;
    826817
    827                 check( __cfaabi_pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute
     818                check( pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute
    828819
    829820                size_t stacksize;
    830821                // 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" );
    832823                assert( stacksize >= PTHREAD_STACK_MIN );
    833824                stacksize += __page_size;
  • libcfa/src/concurrency/preemption.cfa

    rdf6cc9d r135143b  
    352352        sigset_t oldset;
    353353        int ret;
    354         ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
     354        ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
    355355        if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
    356356
     
    385385        sigaddset( &mask, sig );
    386386
    387         if ( __cfaabi_pthread_sigmask( SIG_UNBLOCK, &mask, 0p ) == -1 ) {
     387        if ( pthread_sigmask( SIG_UNBLOCK, &mask, 0p ) == -1 ) {
    388388            abort( "internal error, pthread_sigmask" );
    389389        }
     
    396396        sigaddset( &mask, sig );
    397397
    398         if ( __cfaabi_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {
     398        if ( pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {
    399399                abort( "internal error, pthread_sigmask" );
    400400        }
     
    404404static void preempt( processor * this ) {
    405405        sigval_t value = { PREEMPT_NORMAL };
    406         __cfaabi_pthread_sigqueue( this->kernel_thread, SIGUSR1, value );
     406        pthread_sigqueue( this->kernel_thread, SIGUSR1, value );
    407407}
    408408
     
    415415        sigset_t oldset;
    416416        int ret;
    417         ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
     417        ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
    418418        if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
    419419
     
    434434        sigset_t oldset;
    435435        int ret;
    436         ret = __cfaabi_pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
     436        ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
    437437        if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
    438438
     
    505505        sigval val;
    506506        val.sival_int = 0;
    507         __cfaabi_pthread_sigqueue( alarm_thread, SIGALRM, val );
     507        pthread_sigqueue( alarm_thread, SIGALRM, val );
    508508
    509509        // Wait for the preemption thread to finish
     
    579579        static_assert( sizeof( sigset_t ) == sizeof( cxt->uc_sigmask ), "Expected cxt->uc_sigmask to be of sigset_t" );
    580580        #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 ) {
    582582                abort( "internal error, sigprocmask" );
    583583        }
     
    607607        sigset_t mask;
    608608        sigfillset(&mask);
    609         if ( __cfaabi_pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {
     609        if ( pthread_sigmask( SIG_BLOCK, &mask, 0p ) == -1 ) {
    610610            abort( "internal error, pthread_sigmask" );
    611611        }
  • libcfa/src/interpose.cfa

    rdf6cc9d r135143b  
    4242
    4343typedef 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         #else
    56                 originalFunc.ptr = dlsym( library, symbol );
    57         #endif // _GNU_SOURCE
    58 
    59         error = dlerror();
    60         if ( error ) abort( "interpose_symbol : internal error, %s\n", error );
    61 
    62         return originalFunc.fptr;
    63 }
    64 
    6544static generic_fptr_t interpose_symbol( const char symbol[], const char version[] ) {
    6645        const char * error;
    6746
    6847        static void * library;
    69         static void * pthread_library;
    7048        if ( ! library ) {
    7149                #if defined( RTLD_NEXT )
     
    8058                #endif
    8159        } // 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;
    9677}
    9778
     
    11697
    11798extern "C" {
    118         void __cfathreadabi_interpose_startup( generic_fptr_t (*do_interpose_symbol)( void * library, const char symbol[], const char version[] ) ) __attribute__((weak));
    11999        void __cfaabi_interpose_startup( void ) {
    120100                const char *version = 0p;
     
    128108                INTERPOSE_LIBC( exit , version );
    129109#pragma GCC diagnostic pop
    130 
    131                 if(__cfathreadabi_interpose_startup) __cfathreadabi_interpose_startup( do_interpose_symbol );
    132110
    133111                // 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.