Browse Source

Removed #ifdef (linux) 's

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@427 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
trutkin 22 years ago
parent
commit
03061a6686
3 changed files with 76 additions and 81 deletions
  1. +53
    -57
      jackd/engine.c
  2. +20
    -21
      libjack/client.c
  3. +3
    -3
      libjack/shm.c

+ 53
- 57
jackd/engine.c View File

@@ -22,11 +22,11 @@
#include <unistd.h>
#include <sys/socket.h>

#if defined(linux)
#include <sys/poll.h>
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
#include "fakepoll.h"
#include "ipc.h"
#else
#include <sys/poll.h>
#endif

#include <sys/un.h>
@@ -299,11 +299,11 @@ jack_resize_port_segment (jack_engine_t *engine, jack_port_type_info_t *port_typ

size = nports * one_buffer;
#if defined(linux)
perm = O_RDWR|O_CREAT|O_TRUNC;
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
/* using O_TRUNC option does not work on Darwin */
perm = O_RDWR|O_CREAT;
#else
perm = O_RDWR|O_CREAT|O_TRUNC;
#endif

if (port_type->shm_info.size == 0) {
@@ -441,7 +441,28 @@ jack_process_internal(jack_engine_t *engine, JSList *node, jack_nframes_t nframe
return jack_slist_next (node);
}

#if defined(linux)
#if defined(__APPLE__) && defined(__POWERPC__)
static JSList *
jack_process_external(jack_engine_t *engine, JSList *node)
{
jack_client_internal_t * client = (jack_client_internal_t *) node->data;
jack_client_control_t *ctl;
client = (jack_client_internal_t *) node->data;
ctl = client->control;
engine->current_client = client;
ctl->state = Triggered; // a race exists if we do this after the write(2)
ctl->signalled_at = jack_get_microseconds();
ctl->awake_at = 0;
ctl->finished_at = 0;
jack_client_resume(client);
return jack_slist_next (node);
}
#else
static JSList *
jack_process_external(jack_engine_t *engine, JSList *node)
{
@@ -555,28 +576,6 @@ jack_process_external(jack_engine_t *engine, JSList *node)
return node;
}

#elif defined(__APPLE__) && defined(__POWERPC__)

static JSList *
jack_process_external(jack_engine_t *engine, JSList *node)
{
jack_client_internal_t * client = (jack_client_internal_t *) node->data;
jack_client_control_t *ctl;
client = (jack_client_internal_t *) node->data;
ctl = client->control;
engine->current_client = client;
ctl->state = Triggered; // a race exists if we do this after the write(2)
ctl->signalled_at = jack_get_microseconds();
ctl->awake_at = 0;
ctl->finished_at = 0;
jack_client_resume(client);
return jack_slist_next (node);
}
#endif


@@ -1752,11 +1751,11 @@ jack_engine_new (int realtime, int rtpriority, int verbose, int client_timeout)
return 0;
}
#if defined(linux)
perm = O_RDWR|O_CREAT|O_TRUNC;
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
/* using O_TRUNC option does not work on Darwin */
perm = O_RDWR|O_CREAT;
#else
perm = O_RDWR|O_CREAT|O_TRUNC;
#endif

if ((addr = jack_get_shm (engine->control_shm_name, engine->control_size,
@@ -1888,13 +1887,13 @@ jack_become_real_time (pthread_t thread, int priority)
return -1;
}
#if defined(linux)
#if defined(__APPLE__) && defined(__POWERPC__)
// To be implemented
#else
if (mlockall (MCL_CURRENT | MCL_FUTURE) != 0) {
jack_error ("cannot lock down memory for RT thread (%s)", strerror (errno));
return -1;
}
#elif defined(__APPLE__) && defined(__POWERPC__)
// To be implemented
#endif
return 0;
}
@@ -2149,16 +2148,22 @@ jack_run (jack_engine_t *engine)
return -1;
}
#if defined(linux)
return pthread_create (&engine->main_thread, 0, jack_main_thread, engine);
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
return 0;
#else
return pthread_create (&engine->main_thread, 0, jack_main_thread, engine);
#endif

}


#if defined(linux)
#if defined(__APPLE__) && defined(__POWERPC__)
int
jack_wait (jack_engine_t *engine)
{
while(1) sleep(1);
}
#else
int
jack_wait (jack_engine_t *engine)
{
@@ -2182,15 +2187,6 @@ jack_wait (jack_engine_t *engine)
}
return (int) ((intptr_t)ret);
}

#elif defined(__APPLE__) && defined(__POWERPC__)

int
jack_wait (jack_engine_t *engine)
{
while(1) sleep(1);
}

#endif

int
@@ -2198,11 +2194,11 @@ jack_engine_delete (jack_engine_t *engine)
{
if (engine) {

#if defined(linux)
return pthread_cancel (engine->main_thread);
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
/* the jack_run_cycle function is directly called from the CoreAudo audio callback */
return 0;
#else
return pthread_cancel (engine->main_thread);
#endif
}

@@ -2225,11 +2221,11 @@ jack_client_internal_new (jack_engine_t *engine, int fd, jack_client_connect_req

case ClientExternal:
#if defined(linux)
perm = O_RDWR|O_CREAT|O_TRUNC;
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
/* using O_TRUNC option does not work on Darwin */
perm = O_RDWR|O_CREAT;
#else
perm = O_RDWR|O_CREAT|O_TRUNC;
#endif
snprintf (shm_name, sizeof (shm_name), "/jack-c-%s", req->name);
@@ -3229,10 +3225,10 @@ jack_get_fifo_fd (jack_engine_t *engine, unsigned int which_fifo)
if (stat (path, &statbuf)) {
if (errno == ENOENT) {
#if defined(linux)
if (mknod (path, 0666|S_IFIFO, 0) < 0) {
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
if (mkfifo(path,0666) < 0){
#else
if (mknod (path, 0666|S_IFIFO, 0) < 0) {
#endif
jack_error ("cannot create inter-client FIFO [%s] (%s)\n", path, strerror (errno));
return -1;


+ 20
- 21
libjack/client.c View File

@@ -18,12 +18,12 @@
$Id$
*/

#if defined(linux)
#include <sys/poll.h>
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
#include "pThreadUtilities.h"
#include "ipc.h"
#include "fakepoll.h"
#else
#include <sys/poll.h>
#endif

#include <sys/socket.h>
@@ -984,13 +984,13 @@ jack_start_thread (jack_client_t *client)
return -1;
}
#if defined(linux)
#if defined(__APPLE__) && defined(__POWERPC__)
// To be implemented
#else
if (mlockall (MCL_CURRENT | MCL_FUTURE) != 0) {
jack_error ("cannot lock down memory for RT thread (%s)", strerror (errno));
return -1;
}
#elif defined(__APPLE__) && defined(__POWERPC__)
// To be implemented
#endif
}
@@ -1122,10 +1122,10 @@ jack_activate (jack_client_t *client)
* jack_start_thread())
*/
#if defined(linux)
#define BIG_ENOUGH_STACK 1048576
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
#define BIG_ENOUGH_STACK 10000 // a bigger stack make the application crash...
#else
#define BIG_ENOUGH_STACK 1048576
#endif

char buf[BIG_ENOUGH_STACK];
@@ -1597,7 +1597,17 @@ jack_client_thread_id (jack_client_t *client)
return client->thread_id;
}

#if defined(linux)
#if defined(__APPLE__) && defined(__POWERPC__)

double __jack_time_ratio;

void jack_init_time ()
{
mach_timebase_info_data_t info;
mach_timebase_info(&info);
__jack_time_ratio = ((float)info.numer/info.denom) / 1000;
}
#else

jack_time_t
jack_get_mhz (void)
@@ -1642,15 +1652,4 @@ void jack_init_time ()
__jack_cpu_mhz = jack_get_mhz ();
}

#elif defined(__APPLE__) && defined(__POWERPC__)

double __jack_time_ratio;

void jack_init_time ()
{
mach_timebase_info_data_t info;
mach_timebase_info(&info);
__jack_time_ratio = ((float)info.numer/info.denom) / 1000;
}

#endif

+ 3
- 3
libjack/shm.c View File

@@ -83,11 +83,11 @@ jack_initialize_shm ()
or debugger driven exits.
*/
#if defined(linux)
perm = O_RDWR|O_CREAT|O_TRUNC;
#elif defined(__APPLE__) && defined(__POWERPC__)
#if defined(__APPLE__) && defined(__POWERPC__)
/* using O_TRUNC option does not work on Darwin */
perm = O_RDWR|O_CREAT;
#else
perm = O_RDWR|O_CREAT|O_TRUNC;
#endif
if ((addr = jack_get_shm ("/jack-shm-registry", sizeof (jack_shm_registry_entry_t) * MAX_SHM_ID,


Loading…
Cancel
Save