Changeset 427

Show
Ignore:
Timestamp:
06/17/03 16:09:10 (7 years ago)
Author:
trutkin
Message:

Removed #ifdef (linux) 's

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jack/jackd/engine.c

    r418 r427  
    2323#include <sys/socket.h> 
    2424 
    25 #if defined(linux)  
    26     #include <sys/poll.h> 
    27 #elif defined(__APPLE__) && defined(__POWERPC__)  
     25#if defined(__APPLE__) && defined(__POWERPC__)  
    2826    #include "fakepoll.h" 
    2927    #include "ipc.h" 
     28#else 
     29    #include <sys/poll.h> 
    3030#endif 
    3131 
     
    300300        size = nports * one_buffer; 
    301301     
    302 #if defined(linux)  
    303         perm = O_RDWR|O_CREAT|O_TRUNC; 
    304 #elif defined(__APPLE__) && defined(__POWERPC__)  
     302#if defined(__APPLE__) && defined(__POWERPC__)  
    305303        /* using O_TRUNC option does not work on Darwin */ 
    306304        perm = O_RDWR|O_CREAT; 
     305#else 
     306        perm = O_RDWR|O_CREAT|O_TRUNC; 
    307307#endif 
    308308 
     
    442442} 
    443443 
    444 #if defined(linux) 
    445 static JSList *  
    446 jack_process_external(jack_engine_t *engine, JSList *node) 
    447 
    448         int status; 
    449         char c; 
    450         float delayed_usecs; 
    451         jack_client_internal_t *client; 
    452         jack_client_control_t *ctl; 
    453         jack_time_t now, then; 
    454          
    455         client = (jack_client_internal_t *) node->data; 
    456          
    457         ctl = client->control; 
    458  
    459         /* external subgraph */ 
    460  
    461         ctl->state = Triggered; // a race exists if we do this after the write(2)  
    462         ctl->signalled_at = jack_get_microseconds(); 
    463         ctl->awake_at = 0; 
    464         ctl->finished_at = 0; 
    465  
    466         engine->current_client = client; 
    467  
    468         DEBUG ("calling process() on an external subgraph, fd==%d", client->subgraph_start_fd); 
    469  
    470         if (write (client->subgraph_start_fd, &c, sizeof (c)) != sizeof (c)) { 
    471                 jack_error ("cannot initiate graph processing (%s)", strerror (errno)); 
    472                 engine->process_errors++; 
    473                 return NULL; /* will stop the loop */ 
    474         }  
    475  
    476         then = jack_get_microseconds (); 
    477  
    478         if (engine->asio_mode) { 
    479                 engine->driver->wait (engine->driver, client->subgraph_wait_fd, &status, &delayed_usecs); 
    480         } else { 
    481                 struct pollfd pfd[1]; 
    482                 int poll_timeout = (engine->control->real_time == 0 ? engine->client_timeout_msecs : engine->driver->period_usecs/1000); 
    483  
    484                 pfd[0].fd = client->subgraph_wait_fd; 
    485                 pfd[0].events = POLLERR|POLLIN|POLLHUP|POLLNVAL; 
    486  
    487                 DEBUG ("waiting on fd==%d for process() subgraph to finish", client->subgraph_wait_fd); 
    488  
    489                 if (poll (pfd, 1, poll_timeout) < 0) { 
    490                         jack_error ("poll on subgraph processing failed (%s)", strerror (errno)); 
    491                         status = -1;  
    492                 } 
    493  
    494                 if (pfd[0].revents & ~POLLIN) { 
    495                         jack_error ("subgraph starting at %s lost client", client->control->name); 
    496                         status = -2;  
    497                 } 
    498  
    499                 if (pfd[0].revents & POLLIN) { 
    500                         status = 0; 
    501                 } else { 
    502                         jack_error ("subgraph starting at %s timed out (subgraph_wait_fd=%d, status = %d, state = %s)",  
    503                                     client->control->name, client->subgraph_wait_fd, status,  
    504                                     client_state_names[client->control->state]); 
    505                         status = 1; 
    506                 } 
    507         } 
    508  
    509         now = jack_get_microseconds (); 
    510  
    511         if (status != 0) { 
    512                 if (engine->verbose) { 
    513                         fprintf (stderr, "at %Lu client waiting on %d took %Lu usecs, status = %d sig = %Lu " 
    514                                  "awa = %Lu fin = %Lu dur=%Lu\n", 
    515                                  now, 
    516                                  client->subgraph_wait_fd, 
    517                                  now - then, 
    518                                  status, 
    519                                  ctl->signalled_at, 
    520                                  ctl->awake_at, 
    521                                  ctl->finished_at, 
    522                                  ctl->finished_at ? ctl->finished_at - ctl->signalled_at : 0); 
    523                 } 
    524  
    525                 /* we can only consider the timeout a client error if it actually woke up. 
    526                    its possible that the kernel scheduler screwed us up and  
    527                    never woke up the client in time. sigh. 
    528                 */ 
    529  
    530                 if (ctl->awake_at > 0) { 
    531                         ctl->timed_out++; 
    532                 } 
    533  
    534                 engine->process_errors++; 
    535                 return NULL; /* will stop the loop */ 
    536         } else { 
    537                 DEBUG ("reading byte from subgraph_wait_fd==%d", client->subgraph_wait_fd); 
    538  
    539                 if (read (client->subgraph_wait_fd, &c, sizeof(c)) != sizeof (c)) { 
    540                         jack_error ("pp: cannot clean up byte from graph wait fd (%s)", strerror (errno)); 
    541                         client->error++; 
    542                         return NULL; /* will stop the loop */ 
    543                 } 
    544         } 
    545  
    546         /* Move to next internal client (or end of client list) */ 
    547  
    548         while (node) { 
    549                 if (jack_client_is_internal (((jack_client_internal_t *) node->data))) { 
    550                         break; 
    551                 } 
    552                 node = jack_slist_next (node); 
    553         } 
    554          
    555         return node; 
    556 
    557  
    558 #elif defined(__APPLE__) && defined(__POWERPC__)  
    559  
     444#if defined(__APPLE__) && defined(__POWERPC__)  
    560445static JSList *  
    561446jack_process_external(jack_engine_t *engine, JSList *node) 
     
    578463        return jack_slist_next (node); 
    579464} 
     465#else 
     466static JSList *  
     467jack_process_external(jack_engine_t *engine, JSList *node) 
     468{ 
     469        int status; 
     470        char c; 
     471        float delayed_usecs; 
     472        jack_client_internal_t *client; 
     473        jack_client_control_t *ctl; 
     474        jack_time_t now, then; 
     475         
     476        client = (jack_client_internal_t *) node->data; 
     477         
     478        ctl = client->control; 
     479 
     480        /* external subgraph */ 
     481 
     482        ctl->state = Triggered; // a race exists if we do this after the write(2)  
     483        ctl->signalled_at = jack_get_microseconds(); 
     484        ctl->awake_at = 0; 
     485        ctl->finished_at = 0; 
     486 
     487        engine->current_client = client; 
     488 
     489        DEBUG ("calling process() on an external subgraph, fd==%d", client->subgraph_start_fd); 
     490 
     491        if (write (client->subgraph_start_fd, &c, sizeof (c)) != sizeof (c)) { 
     492                jack_error ("cannot initiate graph processing (%s)", strerror (errno)); 
     493                engine->process_errors++; 
     494                return NULL; /* will stop the loop */ 
     495        }  
     496 
     497        then = jack_get_microseconds (); 
     498 
     499        if (engine->asio_mode) { 
     500                engine->driver->wait (engine->driver, client->subgraph_wait_fd, &status, &delayed_usecs); 
     501        } else { 
     502                struct pollfd pfd[1]; 
     503                int poll_timeout = (engine->control->real_time == 0 ? engine->client_timeout_msecs : engine->driver->period_usecs/1000); 
     504 
     505                pfd[0].fd = client->subgraph_wait_fd; 
     506                pfd[0].events = POLLERR|POLLIN|POLLHUP|POLLNVAL; 
     507 
     508                DEBUG ("waiting on fd==%d for process() subgraph to finish", client->subgraph_wait_fd); 
     509 
     510                if (poll (pfd, 1, poll_timeout) < 0) { 
     511                        jack_error ("poll on subgraph processing failed (%s)", strerror (errno)); 
     512                        status = -1;  
     513                } 
     514 
     515                if (pfd[0].revents & ~POLLIN) { 
     516                        jack_error ("subgraph starting at %s lost client", client->control->name); 
     517                        status = -2;  
     518                } 
     519 
     520                if (pfd[0].revents & POLLIN) { 
     521                        status = 0; 
     522                } else { 
     523                        jack_error ("subgraph starting at %s timed out (subgraph_wait_fd=%d, status = %d, state = %s)",  
     524                                    client->control->name, client->subgraph_wait_fd, status,  
     525                                    client_state_names[client->control->state]); 
     526                        status = 1; 
     527                } 
     528        } 
     529 
     530        now = jack_get_microseconds (); 
     531 
     532        if (status != 0) { 
     533                if (engine->verbose) { 
     534                        fprintf (stderr, "at %Lu client waiting on %d took %Lu usecs, status = %d sig = %Lu " 
     535                                 "awa = %Lu fin = %Lu dur=%Lu\n", 
     536                                 now, 
     537                                 client->subgraph_wait_fd, 
     538                                 now - then, 
     539                                 status, 
     540                                 ctl->signalled_at, 
     541                                 ctl->awake_at, 
     542                                 ctl->finished_at, 
     543                                 ctl->finished_at ? ctl->finished_at - ctl->signalled_at : 0); 
     544                } 
     545 
     546                /* we can only consider the timeout a client error if it actually woke up. 
     547                   its possible that the kernel scheduler screwed us up and  
     548                   never woke up the client in time. sigh. 
     549                */ 
     550 
     551                if (ctl->awake_at > 0) { 
     552                        ctl->timed_out++; 
     553                } 
     554 
     555                engine->process_errors++; 
     556                return NULL; /* will stop the loop */ 
     557        } else { 
     558                DEBUG ("reading byte from subgraph_wait_fd==%d", client->subgraph_wait_fd); 
     559 
     560                if (read (client->subgraph_wait_fd, &c, sizeof(c)) != sizeof (c)) { 
     561                        jack_error ("pp: cannot clean up byte from graph wait fd (%s)", strerror (errno)); 
     562                        client->error++; 
     563                        return NULL; /* will stop the loop */ 
     564                } 
     565        } 
     566 
     567        /* Move to next internal client (or end of client list) */ 
     568 
     569        while (node) { 
     570                if (jack_client_is_internal (((jack_client_internal_t *) node->data))) { 
     571                        break; 
     572                } 
     573                node = jack_slist_next (node); 
     574        } 
     575         
     576        return node; 
     577} 
     578 
    580579#endif 
    581580 
     
    17531752        } 
    17541753         
    1755 #if defined(linux)  
    1756         perm = O_RDWR|O_CREAT|O_TRUNC; 
    1757 #elif defined(__APPLE__) && defined(__POWERPC__)  
     1754#if defined(__APPLE__) && defined(__POWERPC__)  
    17581755        /* using O_TRUNC option does not work on Darwin */ 
    17591756        perm = O_RDWR|O_CREAT; 
     1757#else 
     1758        perm = O_RDWR|O_CREAT|O_TRUNC; 
    17601759#endif 
    17611760 
     
    18891888        } 
    18901889         
    1891 #if defined(linux)  
     1890#if defined(__APPLE__) && defined(__POWERPC__)  
     1891        // To be implemented 
     1892#else 
    18921893        if (mlockall (MCL_CURRENT | MCL_FUTURE) != 0) { 
    18931894            jack_error ("cannot lock down memory for RT thread (%s)", strerror (errno)); 
    18941895            return -1; 
    18951896        } 
    1896 #elif defined(__APPLE__) && defined(__POWERPC__)  
    1897         // To be implemented 
    18981897#endif 
    18991898        return 0; 
     
    21502149        } 
    21512150         
    2152 #if defined(linux) 
     2151#if defined(__APPLE__) && defined(__POWERPC__)  
     2152        return 0; 
     2153#else 
    21532154        return pthread_create (&engine->main_thread, 0, jack_main_thread, engine); 
    2154 #elif defined(__APPLE__) && defined(__POWERPC__)  
    2155         return 0; 
    21562155#endif 
    21572156 
     
    21592158 
    21602159 
    2161 #if defined(linux) 
     2160#if defined(__APPLE__) && defined(__POWERPC__)  
     2161int 
     2162jack_wait (jack_engine_t *engine) 
     2163
     2164        while(1) sleep(1); 
     2165
     2166#else 
    21622167int 
    21632168jack_wait (jack_engine_t *engine) 
     
    21832188        return (int) ((intptr_t)ret); 
    21842189} 
    2185  
    2186 #elif defined(__APPLE__) && defined(__POWERPC__)  
    2187  
    2188 int 
    2189 jack_wait (jack_engine_t *engine) 
    2190 { 
    2191         while(1) sleep(1); 
    2192 } 
    2193  
    21942190#endif 
    21952191 
     
    21992195        if (engine) { 
    22002196 
    2201     #if defined(linux) 
    2202             return pthread_cancel (engine->main_thread); 
    2203     #elif defined(__APPLE__) && defined(__POWERPC__)  
     2197    #if defined(__APPLE__) && defined(__POWERPC__)  
    22042198            /* the jack_run_cycle function is directly called from the CoreAudo audio callback */ 
    22052199            return 0; 
     2200    #else 
     2201            return pthread_cancel (engine->main_thread); 
    22062202    #endif 
    22072203        } 
     
    22262222        case ClientExternal: 
    22272223                 
    2228         #if defined(linux)  
    2229                 perm = O_RDWR|O_CREAT|O_TRUNC; 
    2230         #elif defined(__APPLE__) && defined(__POWERPC__)  
     2224        #if defined(__APPLE__) && defined(__POWERPC__)  
    22312225                /* using O_TRUNC option does not work on Darwin */ 
    22322226                perm = O_RDWR|O_CREAT; 
     2227        #else 
     2228                perm = O_RDWR|O_CREAT|O_TRUNC; 
    22332229        #endif 
    22342230                snprintf (shm_name, sizeof (shm_name), "/jack-c-%s", req->name); 
     
    32303226                if (errno == ENOENT) { 
    32313227        
    3232                 #if defined(linux)  
     3228                #if defined(__APPLE__) && defined(__POWERPC__)  
     3229                        if (mkfifo(path,0666) < 0){ 
     3230                #else 
    32333231                        if (mknod (path, 0666|S_IFIFO, 0) < 0) { 
    3234                 #elif defined(__APPLE__) && defined(__POWERPC__)  
    3235                         if (mkfifo(path,0666) < 0){ 
    32363232                #endif 
    32373233                                jack_error ("cannot create inter-client FIFO [%s] (%s)\n", path, strerror (errno)); 
  • trunk/jack/libjack/client.c

    r406 r427  
    1919*/ 
    2020 
    21 #if defined(linux)  
    22     #include <sys/poll.h> 
    23 #elif defined(__APPLE__) && defined(__POWERPC__)  
     21#if defined(__APPLE__) && defined(__POWERPC__)  
    2422    #include "pThreadUtilities.h" 
    2523    #include "ipc.h" 
    2624    #include "fakepoll.h" 
     25#else 
     26    #include <sys/poll.h> 
    2727#endif 
    2828 
     
    985985                } 
    986986                 
    987         #if defined(linux)  
     987        #if defined(__APPLE__) && defined(__POWERPC__)  
     988                // To be implemented 
     989        #else 
    988990                if (mlockall (MCL_CURRENT | MCL_FUTURE) != 0) { 
    989991                    jack_error ("cannot lock down memory for RT thread (%s)", strerror (errno)); 
    990992                    return -1; 
    991993                } 
    992         #elif defined(__APPLE__) && defined(__POWERPC__)  
    993                 // To be implemented 
    994994        #endif 
    995995         
     
    11231123         */ 
    11241124          
    1125 #if defined(linux)  
     1125#if defined(__APPLE__) && defined(__POWERPC__)  
     1126       #define BIG_ENOUGH_STACK 10000 // a bigger stack make the application crash... 
     1127#else 
    11261128       #define BIG_ENOUGH_STACK 1048576 
    1127 #elif defined(__APPLE__) && defined(__POWERPC__)  
    1128        #define BIG_ENOUGH_STACK 10000 // a bigger stack make the application crash... 
    11291129#endif 
    11301130 
     
    15981598} 
    15991599 
    1600 #if defined(linux) 
     1600#if defined(__APPLE__) && defined(__POWERPC__)  
     1601 
     1602double __jack_time_ratio; 
     1603 
     1604void jack_init_time () 
     1605
     1606        mach_timebase_info_data_t info;  
     1607        mach_timebase_info(&info); 
     1608        __jack_time_ratio = ((float)info.numer/info.denom) / 1000; 
     1609
     1610#else 
    16011611 
    16021612jack_time_t 
     
    16431653} 
    16441654 
    1645 #elif defined(__APPLE__) && defined(__POWERPC__)  
    1646  
    1647 double __jack_time_ratio; 
    1648  
    1649 void jack_init_time () 
    1650 { 
    1651         mach_timebase_info_data_t info;  
    1652         mach_timebase_info(&info); 
    1653         __jack_time_ratio = ((float)info.numer/info.denom) / 1000; 
    1654 } 
    1655  
    16561655#endif 
  • trunk/jack/libjack/shm.c

    r417 r427  
    8484        */ 
    8585         
    86 #if defined(linux)  
    87         perm = O_RDWR|O_CREAT|O_TRUNC; 
    88 #elif defined(__APPLE__) && defined(__POWERPC__) 
     86#if defined(__APPLE__) && defined(__POWERPC__) 
    8987        /* using O_TRUNC option does not work on Darwin */ 
    9088        perm = O_RDWR|O_CREAT; 
     89#else 
     90        perm = O_RDWR|O_CREAT|O_TRUNC; 
    9191#endif 
    9292