mirror of
https://github.com/nasa/trick.git
synced 2025-02-21 09:31:49 +00:00
Changed all header file once include variables to follow the same naming convention and not start with any underscores. Also deleted old incorrect copyright notices. Also removed $Id: tags from all files. Fixes #14. Fixes #22.
34 lines
802 B
C
34 lines
802 B
C
|
|
/*
|
|
* Disconnect (detach) a shared memory segment
|
|
*/
|
|
#include "../include/tsm.h"
|
|
#include "../include/tsm_proto.h"
|
|
|
|
|
|
int tsm_disconnect(TSMDevice * shm_device)
|
|
{
|
|
int ret;
|
|
|
|
ret = TSM_SUCCESS;
|
|
|
|
// if we had a read/write lock, destroy it first
|
|
if (shm_device->rwlock_addr != NULL) {
|
|
ret = pthread_rwlockattr_destroy(&shm_device->rwlattr);
|
|
if (ret == -1) {
|
|
perror("tsm_disconnect SHARED MEMORY DESTROY LOCK ATTRIBUTES FAILED");
|
|
}
|
|
ret = pthread_rwlock_destroy(shm_device->rwlock_addr);
|
|
if (ret == -1) {
|
|
perror("tsm_disconnect SHARED MEMORY DESTROY LOCK FAILED");
|
|
}
|
|
}
|
|
|
|
ret = shmdt(shm_device->addr);
|
|
if (ret == -1) {
|
|
perror("tsm_disconnect SHARED MEMORY DETACH FAILED");
|
|
}
|
|
|
|
return (ret);
|
|
}
|