test version

This commit is contained in:
eddyem 2015-11-02 08:50:34 +03:00
parent 6b3ca8a34b
commit dd6821cecb
4 changed files with 19 additions and 14 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.hg*
*.tgz
*~
.dropbox.attr

View File

@ -684,7 +684,7 @@ int main(int argc, char **argv){
if(showinfo != NO_INFO) bta_print(showinfo, GP->infoargs);
else if(GP->listinfo) bta_print(NO_INFO, NULL); // show arguments available
#define RUN(arg) do{if(!arg) retcode = 1;}while(0)
#define RUNBLK(arg) do{if(!arg) return 1;}while(0)
#define RUNBLK(arg) do{if(!arg){retcode = 1; goto restoring;}}while(0)
if(GP->telstop) RUN(stop_telescope());
if(GP->eqcrds) RUNBLK(setCoords(GP->eqcrds, TRUE));
else if(GP->horcrds) RUNBLK(setCoords(GP->horcrds, FALSE));
@ -700,6 +700,7 @@ int main(int argc, char **argv){
else if(GP->corrRAD) RUN(run_correction(GP->corrRAD, FALSE));
#undef RUN
#undef RUNBLK
restoring:
unlink(PIDFILE);
restore_console();
return retcode;

View File

@ -13,10 +13,10 @@ static char msg[80];
#define PERR(...) do{sprintf(msg, __VA_ARGS__); perror(msg);} while(0)
#ifndef BTA_MODULE
struct BTA_Data *sdt;
struct BTA_Local *sdtl;
volatile struct BTA_Data *sdt;
volatile struct BTA_Local *sdtl;
struct SHM_Block sdat = {
volatile struct SHM_Block sdat = {
{"Sdat"},
sizeof(struct BTA_Data),
2048,0444,
@ -97,7 +97,7 @@ void bta_data_close() {
/**
* Allocate shared memory segment
*/
int get_shm_block( struct SHM_Block *sb, int server) {
int get_shm_block(volatile struct SHM_Block *sb, int server) {
int getsize = (server)? sb->maxsize : sb->size;
// first try to find existing one
sb->id = shmget(sb->key.code, getsize, sb->mode);
@ -135,7 +135,7 @@ int get_shm_block( struct SHM_Block *sb, int server) {
return 1;
}
int close_shm_block(struct SHM_Block *sb){
int close_shm_block(volatile struct SHM_Block *sb){
int ret;
if(sb->close != NULL)
sb->close();
@ -179,7 +179,7 @@ void get_cmd_queue(struct CMD_Queue *cq, int server){
#endif // BTA_MODULE
int check_shm_block( struct SHM_Block *sb) {
int check_shm_block(volatile struct SHM_Block *sb) {
if(sb->check)
return(sb->check());
else return(0);

View File

@ -33,7 +33,7 @@ struct SHM_Block {
uint8_t *addr; // connection address
};
extern struct SHM_Block sdat;
extern volatile struct SHM_Block sdat;
/*
* Command queue descriptor
@ -788,7 +788,7 @@ struct BTA_Data {
uint32_t pep_code_di, pep_code_do; // dome PEP codes
};
extern struct BTA_Data *sdt;
extern volatile struct BTA_Data *sdt;
/*******************************************************************************
* Local data structure *
@ -819,7 +819,7 @@ struct my_msgbuf {
char mtext[100]; // message itself
};
extern struct BTA_Local *sdtl;
extern volatile struct BTA_Local *sdtl;
extern int snd_id;
extern int cmd_src_pid;
extern uint32_t cmd_src_ip;
@ -831,12 +831,12 @@ extern uint32_t cmd_src_ip;
void bta_data_init();
int bta_data_check();
void bta_data_close();
int get_shm_block( struct SHM_Block *sb, int server);
int close_shm_block(struct SHM_Block *sb);
int get_shm_block(volatile struct SHM_Block *sb, int server);
int close_shm_block(volatile struct SHM_Block *sb);
void get_cmd_queue(struct CMD_Queue *cq, int server);
#endif
int check_shm_block( struct SHM_Block *sb);
int check_shm_block(volatile struct SHM_Block *sb);
void encode_lev_passwd(char *passwd, int nlev, uint32_t *keylev, uint32_t *codlev);
int find_lev_passwd(char *passwd, uint32_t *keylev, uint32_t *codlev);