Browse Source

documentation and file formatting updates

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@677 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
joq 21 years ago
parent
commit
1c01d082e1
3 changed files with 40 additions and 48 deletions
  1. +9
    -9
      doc/mainpage.dox
  2. +2
    -2
      doc/porting.dox
  3. +29
    -37
      libjack/shm.c

+ 9
- 9
doc/mainpage.dox View File

@@ -82,15 +82,15 @@ internal client "plugin" that runs within the JACK server process.


The JACK programming interfaces are described in several header files: 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 "<jack/jack.h>" defines most of the JACK interfaces.
- @ref ringbuffer.h "<jack/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 "<jack/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 "<jack/types.h>" defines most of the JACK data types.


In addition, the example-clients directory provides numerous examples In addition, the example-clients directory provides numerous examples
of simple JACK clients that nevertheless use the API to do something of simple JACK clients that nevertheless use the API to do something


+ 2
- 2
doc/porting.dox View File

@@ -52,8 +52,8 @@ Compiler Collective, <http://gcc.gnu.org>.
@section portopsys Operating System Dependencies @section portopsys Operating System Dependencies


JACK is written to conform with C99, as defined in International 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 portablility reasons. For example, variables should not be declared
in the middle of a compound statement, because many compilers still in the middle of a compound statement, because many compilers still
cannot handle that language extension. cannot handle that language extension.


+ 29
- 37
libjack/shm.c View File

@@ -100,21 +100,18 @@ jack_cleanup_shm (void)
destroy = FALSE; destroy = FALSE;


if (r->allocator == getpid()) { if (r->allocator == getpid()) {
/* allocated by this process, so unattach /* allocated by this process, so unattach
and destroy.
*/
and destroy. */
jack_release_shm (&copy); jack_release_shm (&copy);
destroy = TRUE; destroy = TRUE;
} else { } else {
if (kill (r->allocator, 0)) { if (kill (r->allocator, 0)) {
if (errno == ESRCH) { if (errno == ESRCH) {
/* allocator no longer exists, so destroy */
/* allocator no longer exists,
* so destroy */
destroy = TRUE; destroy = TRUE;
} }
} }
@@ -123,7 +120,6 @@ jack_cleanup_shm (void)
if (destroy) { if (destroy) {


jack_destroy_shm (&copy); jack_destroy_shm (&copy);
r->size = 0; r->size = 0;
r->allocator = 0; r->allocator = 0;
} }
@@ -149,36 +145,30 @@ jack_initialize_shm (void)


/* grab a chunk of memory to store shm ids in. this is /* grab a chunk of memory to store shm ids in. this is
to allow clean up of all segments whenever JACK to allow clean up of all segments whenever JACK
starts (or stops).
*/

starts (or stops). */
size = sizeof (jack_shm_registry_t) * MAX_SHM_ID; size = sizeof (jack_shm_registry_t) * MAX_SHM_ID;

jack_shm_lock_registry (); jack_shm_lock_registry ();
perm = O_RDWR; perm = O_RDWR;


/* try without O_CREAT to see if it already exists */ /* try without O_CREAT to see if it already exists */
if ((shm_fd = shm_open ("/jack-shm-registry", perm, 0666)) < 0) { if ((shm_fd = shm_open ("/jack-shm-registry", perm, 0666)) < 0) {


if (errno == ENOENT) { if (errno == ENOENT) {
perm = O_RDWR|O_CREAT;
/* it doesn't exist, so create it */ /* 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; goto out;
} }
new_registry = TRUE; new_registry = TRUE;


} else { } 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; 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)", jack_error ("cannot mmap shm registry segment (%s)",
strerror (errno)); strerror (errno));
goto out; 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 (perm & O_CREAT) {
if (ftruncate (shm_fd, size) < 0) { 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; 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, 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, jack_error ("cannot mmap shm segment %s (%s)", registry->id,
strerror (errno)); strerror (errno));
close (shm_fd); close (shm_fd);
@@ -361,18 +351,18 @@ jack_initialize_shm (void)


if ((shmid = shmget (key, size, shmflags)) < 0) { if ((shmid = shmget (key, size, shmflags)) < 0) {
if (errno == ENOENT) { 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; goto out;
} }
new_registry = TRUE; new_registry = TRUE;
} else { } 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; goto out;
} }
} }
@@ -415,7 +405,8 @@ jack_release_shm (jack_shm_info_t* si)
} }


int 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 shmflags;
int shmid; int shmid;
@@ -446,7 +437,8 @@ jack_shmalloc (const char* name_not_used, jack_shmsize_t size, jack_shm_info_t*
int int
jack_attach_shm (jack_shm_info_t* si) 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)", jack_error ("cannot attach shm segment (%s)",
strerror (errno)); strerror (errno));
jack_release_shm_info (si->index); jack_release_shm_info (si->index);


Loading…
Cancel
Save