diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2020-03-16 20:53:54 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2020-03-16 20:53:54 (GMT) |
commit | 0d5c5af695d5533a4463c0ed5f6776c8aef1ad74 (patch) | |
tree | 8cbbe0f63ba69d2dd8179c04a49d9cdc2ea193e1 /tksao/fitsy++/sshare.C | |
parent | b7344e9a22b4e5e1e51945c907962bf927375c65 (diff) | |
download | blt-0d5c5af695d5533a4463c0ed5f6776c8aef1ad74.zip blt-0d5c5af695d5533a4463c0ed5f6776c8aef1ad74.tar.gz blt-0d5c5af695d5533a4463c0ed5f6776c8aef1ad74.tar.bz2 |
vector lib
Diffstat (limited to 'tksao/fitsy++/sshare.C')
-rw-r--r-- | tksao/fitsy++/sshare.C | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/tksao/fitsy++/sshare.C b/tksao/fitsy++/sshare.C deleted file mode 100644 index 3975a5a..0000000 --- a/tksao/fitsy++/sshare.C +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (C) 1999-2018 -// Smithsonian Astrophysical Observatory, Cambridge, MA, USA -// For conditions of distribution and use, see copyright notice in "copyright" - -#include "sshare.h" - -#if (HAVE_SYS_SHM_H && !__WIN32) -#include <sys/types.h> -#include <sys/shm.h> -#include <sys/ipc.h> - -FitsSShareID::FitsSShareID(int hdrid, int shmid, const char* filter) -{ - // reset - valid_ =0; - - { - // find size - struct shmid_ds info; - if (shmctl(hdrid, IPC_STAT, &info)) { - internalError("Fitsy++ sshare shctl failed"); - return; - } - hmapsize_ = info.shm_segsz; - - // Attach the memory segment - if ((long)(hmapdata_ = (char*)shmat(hdrid, 0, SHM_RDONLY)) == -1) { - internalError("Fitsy++ sshare shmat failed"); - return; - } - } - - { - parse(filter); - if (!valid_) - return; - - // reset - valid_ =0; - - // find size - struct shmid_ds info; - if (shmctl(shmid, IPC_STAT, &info)) { - internalError("Fitsy++ sshare shctl failed"); - return; - } - mapsize_ = info.shm_segsz; - - // Attach the memory segment - if ((long)(mapdata_ = (char*)shmat(shmid, 0, SHM_RDONLY)) == -1) { - internalError("Fitsy++ sshare shmat failed"); - return; - } - } - - // so far so good - valid_ = 1; -} - -FitsSShareID::~FitsSShareID() -{ - shmdt(mapdata_); -} - -FitsSShareKey::FitsSShareKey(int hdr, int key, const char* filter) -{ - // reset - valid_ =0; - - { - // get shmid - int shmid; - if ((shmid = shmget(hdr, 0, 0)) < 0) { - internalError("Fitsy++ sshare shmget failed"); - return; - } - - // find size - struct shmid_ds info; - if (shmctl(shmid, IPC_STAT, &info)) { - internalError("Fitsy++ sshare shctl failed"); - return; - } - mapsize_ = info.shm_segsz; - - // Attach the memory segment - if ((long)(mapdata_ = (char*)shmat(shmid, 0, SHM_RDONLY)) == -1) { - internalError("Fitsy++ sshare shmat failed"); - return; - } - } - - { - parse(filter); - if (!valid_) - return; - - // reset - valid_ =0; - - // get shmid - int shmid; - if ((shmid = shmget(key, 0, 0)) < 0) { - internalError("Fitsy++ sshare shmget failed"); - return; - } - - // find size - struct shmid_ds info; - if (shmctl(shmid, IPC_STAT, &info)) { - internalError("Fitsy++ sshare shmctl failed"); - return; - } - mapsize_ = info.shm_segsz; - - // Attach the memory segment - if ((long)(mapdata_ = (char*)shmat(shmid, 0, SHM_RDONLY)) == -1) { - internalError("Fitsy++ sshare shmat failed"); - return; - } - } - - // so far so good - valid_ = 1; -} - -FitsSShareKey::~FitsSShareKey() -{ - shmdt(mapdata_); -} - -#else - -FitsSShareID::FitsSShareID(int hdrid, int shmid, const char* filter) -{ - valid_ = 0; -} - -FitsSShareID::~FitsSShareID() {} - -FitsSShareKey::FitsSShareKey(int hdr, int key, const char* filter) -{ - valid_ = 0; -} - -FitsSShareKey::~FitsSShareKey() {} - -#endif |