diff --git a/doc/mainpage.dox b/doc/mainpage.dox index e0a0a80..8fa5917 100644 --- a/doc/mainpage.dox +++ b/doc/mainpage.dox @@ -82,15 +82,15 @@ internal client "plugin" that runs within the JACK server process. The JACK programming interfaces are described in several header files: - - jack.h defines most of the interfaces used by JACK clients. - - transport.h provides a simple transport control mechanism for - starting, stopping and repositioning clients. This is described in - the @ref transport-design document. - - types.h defines most of the data types for JACK. - - ringbuffer.h defines a simple API for using lock-free ringbuffers, - a very valuable and common data structure in real time streaming - media software. It is critical for use in applications that do disk - I/O such as audio file players and recording software. + - @ref jack.h "" defines most of the JACK interfaces. + - @ref ringbuffer.h "" defines a simple API for + using lock-free ringbuffers. These are a good way to pass data + between threads, when streaming realtime data to slower media, like + audio file playback or recording. + - @ref transport.h "" defines a simple transport + control mechanism for starting, stopping and repositioning clients. + This is described in the @ref transport-design document. + - @ref types.h "" defines most of the JACK data types. In addition, the example-clients directory provides numerous examples of simple JACK clients that nevertheless use the API to do something diff --git a/doc/porting.dox b/doc/porting.dox index 69a77b1..8dfc8c8 100644 --- a/doc/porting.dox +++ b/doc/porting.dox @@ -52,8 +52,8 @@ Compiler Collective, . @section portopsys Operating System Dependencies JACK is written to conform with C99, as defined in International -Standard ISO/IEC 9899. Because many existing compilers do not fully -support this standard, some new features should be avoided for +Standard ISO/IEC 9899:1999. Because many existing compilers do not +fully support this standard, some new features should be avoided for portablility reasons. For example, variables should not be declared in the middle of a compound statement, because many compilers still cannot handle that language extension. diff --git a/libjack/shm.c b/libjack/shm.c index a6ea99e..75c04dc 100644 --- a/libjack/shm.c +++ b/libjack/shm.c @@ -100,21 +100,18 @@ jack_cleanup_shm (void) destroy = FALSE; if (r->allocator == getpid()) { - + /* allocated by this process, so unattach - and destroy. - */ - + and destroy. */ jack_release_shm (©); destroy = TRUE; - + } else { - + if (kill (r->allocator, 0)) { if (errno == ESRCH) { - - /* allocator no longer exists, so destroy */ - + /* allocator no longer exists, + * so destroy */ destroy = TRUE; } } @@ -123,7 +120,6 @@ jack_cleanup_shm (void) if (destroy) { jack_destroy_shm (©); - r->size = 0; r->allocator = 0; } @@ -149,36 +145,30 @@ jack_initialize_shm (void) /* grab a chunk of memory to store shm ids in. this is to allow clean up of all segments whenever JACK - starts (or stops). - */ - + starts (or stops). */ size = sizeof (jack_shm_registry_t) * MAX_SHM_ID; - jack_shm_lock_registry (); - perm = O_RDWR; /* try without O_CREAT to see if it already exists */ - if ((shm_fd = shm_open ("/jack-shm-registry", perm, 0666)) < 0) { if (errno == ENOENT) { - - perm = O_RDWR|O_CREAT; /* it doesn't exist, so create it */ - - if ((shm_fd = shm_open ("/jack-shm-registry", perm, 0666)) < 0) { - jack_error ("cannot create shm registry segment (%s)", - strerror (errno)); + perm = O_RDWR|O_CREAT; + if ((shm_fd = + shm_open ("/jack-shm-registry", perm, 0666)) < 0) { + jack_error ("cannot create shm registry segment" + " (%s)", strerror (errno)); goto out; } new_registry = TRUE; } else { - jack_error ("cannot open existing shm registry segment (%s)", - strerror (errno)); + jack_error ("cannot open existing shm registry segment" + " (%s)", strerror (errno)); goto out; } } @@ -191,7 +181,8 @@ jack_initialize_shm (void) } } - if ((jack_shm_registry = mmap (0, size, PROT_READ|PROT_WRITE, MAP_SHARED, shm_fd, 0)) == MAP_FAILED) { + if ((jack_shm_registry = mmap (0, size, PROT_READ|PROT_WRITE, + MAP_SHARED, shm_fd, 0)) == MAP_FAILED) { jack_error ("cannot mmap shm registry segment (%s)", strerror (errno)); goto out; @@ -249,8 +240,8 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si) if (perm & O_CREAT) { if (ftruncate (shm_fd, size) < 0) { - jack_error ("cannot set size of engine shm registry 0" - "(%s)", strerror (errno)); + jack_error ("cannot set size of engine shm " + "registry 0 (%s)", strerror (errno)); return -1; } } @@ -315,8 +306,7 @@ jack_resize_shm (jack_shm_info_t* si, jack_shmsize_t size) } if ((si->attached_at = mmap (0, size, PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0)) - == MAP_FAILED) { + MAP_SHARED, shm_fd, 0)) == MAP_FAILED) { jack_error ("cannot mmap shm segment %s (%s)", registry->id, strerror (errno)); close (shm_fd); @@ -361,18 +351,18 @@ jack_initialize_shm (void) if ((shmid = shmget (key, size, shmflags)) < 0) { if (errno == ENOENT) { - if ((shmid = shmget (key, size, shmflags|IPC_CREAT)) < 0) { - jack_error ("cannot create shm registry segment (%s)", - strerror (errno)); + if ((shmid = shmget (key, size, + shmflags|IPC_CREAT)) < 0) { + jack_error ("cannot create shm registry segment" + " (%s)", strerror (errno)); goto out; } - new_registry = TRUE; } else { - jack_error ("cannot use existing shm registry segment (%s)", - strerror (errno)); + jack_error ("cannot use existing shm registry segment" + " (%s)", strerror (errno)); goto out; } } @@ -415,7 +405,8 @@ jack_release_shm (jack_shm_info_t* si) } int -jack_shmalloc (const char* name_not_used, jack_shmsize_t size, jack_shm_info_t* si) +jack_shmalloc (const char* name_not_used, jack_shmsize_t size, + jack_shm_info_t* si) { int shmflags; int shmid; @@ -446,7 +437,8 @@ jack_shmalloc (const char* name_not_used, jack_shmsize_t size, jack_shm_info_t* int jack_attach_shm (jack_shm_info_t* si) { - if ((si->attached_at = shmat (jack_shm_registry[si->index].id, 0, 0)) < 0) { + if ((si->attached_at = shmat (jack_shm_registry[si->index].id, + 0, 0)) < 0) { jack_error ("cannot attach shm segment (%s)", strerror (errno)); jack_release_shm_info (si->index);