diff --git a/common/shm.c b/common/shm.c index ce05bb41..e74a2134 100644 --- a/common/shm.c +++ b/common/shm.c @@ -145,11 +145,11 @@ static int semid = -1; #ifdef WIN32 -static void -semaphore_init () {} +static int +semaphore_init () {return 0;} -static void -semaphore_add (int value) {} +static int +semaphore_add (int value) {return 0;} #else /* all semaphore errors are fatal -- issue message, but do not return */ @@ -194,7 +194,7 @@ semaphore_init () return -1; } } - + return 0; } @@ -206,12 +206,12 @@ semaphore_add (int value) sbuf.sem_num = 0; sbuf.sem_op = value; sbuf.sem_flg = SEM_UNDO; - + if (semop(semid, &sbuf, 1) == -1) { semaphore_error ("semop"); return -1; } - + return 0; } @@ -228,7 +228,7 @@ jack_shm_lock_registry (void) return semaphore_add (-1); } -static void +static void jack_shm_unlock_registry (void) { semaphore_add (1); @@ -370,7 +370,7 @@ jack_initialize_shm (const char *server_name) jack_error ("jack_shm_lock_registry fails..."); return -1; } - + if ((rc = jack_access_registry (®istry_info)) == 0) { if ((rc = jack_shm_validate_registry ()) != 0) { jack_error ("Incompatible shm registry, " @@ -441,7 +441,7 @@ jack_release_shm_info (jack_shm_registry_index_t index) jack_release_shm_entry (index); jack_shm_unlock_registry (); } - + return 0; } @@ -518,7 +518,7 @@ jack_register_server (const char *server_name, int new_registry) } /* release server_name registration */ -void +int jack_unregister_server (const char *server_name /* unused */) { int i; @@ -534,7 +534,8 @@ jack_unregister_server (const char *server_name /* unused */) } } - jack_shm_unlock_registry (); + jack_shm_unlock_registry (); + return 0; } /* called for server startup and termination */ diff --git a/common/shm.h b/common/shm.h index bff6a857..ed5a953f 100644 --- a/common/shm.h +++ b/common/shm.h @@ -115,33 +115,33 @@ extern "C" * indicating where the shared memory has been * attached to the address space. */ - + typedef struct _jack_shm_info { jack_shm_registry_index_t index; /* offset into the registry */ uint32_t size; union { void *attached_at; /* address where attached */ - char ptr_size[8]; - } ptr; /* a "pointer" that has the same 8 bytes size when compling in 32 or 64 bits */ + char ptr_size[8]; + } ptr; /* a "pointer" that has the same 8 bytes size when compling in 32 or 64 bits */ } POST_PACKED_STRUCTURE jack_shm_info_t; /* utility functions used only within JACK */ - + void jack_shm_copy_from_registry (jack_shm_info_t*, jack_shm_registry_index_t); void jack_shm_copy_to_registry (jack_shm_info_t*, jack_shm_registry_index_t*); int jack_release_shm_info (jack_shm_registry_index_t); - char* jack_shm_addr (jack_shm_info_t* si); + char* jack_shm_addr (jack_shm_info_t* si); - // here begin the API + // here begin the API int jack_register_server (const char *server_name, int new_registry); - void jack_unregister_server (const char *server_name); + int jack_unregister_server (const char *server_name); int jack_initialize_shm (const char *server_name); - int jack_initialize_shm_server (void); - int jack_initialize_shm_client (void); + int jack_initialize_shm_server (void); + int jack_initialize_shm_client (void); int jack_cleanup_shm (void); int jack_shmalloc (const char *shm_name, jack_shmsize_t size, @@ -149,7 +149,7 @@ extern "C" void jack_release_shm (jack_shm_info_t*); void jack_destroy_shm (jack_shm_info_t*); int jack_attach_shm (jack_shm_info_t*); - int jack_attach_shm_read (jack_shm_info_t*); + int jack_attach_shm_read (jack_shm_info_t*); int jack_resize_shm (jack_shm_info_t*, jack_shmsize_t size); #ifdef __cplusplus