Add the opening of the shm interface to the startup process and die if it can't be done. Quieten some debug messages.

This commit is contained in:
Mike Brady
2022-02-27 21:23:14 +11:00
parent 322f07720a
commit 18ed1bda87
2 changed files with 8 additions and 6 deletions
+4 -4
View File
@@ -123,7 +123,7 @@ int ptp_shm_interface_open() {
int response = 0;
if ((mapped_addr == NULL) || (mapped_addr == MAP_FAILED)) {
response = -1;
debug(1, "ptp_shm_interface_open");
debug(2, "ptp_shm_interface_open");
if (strcmp(config.nqptp_shared_memory_interface_name, "") != 0) {
response = 0;
int shared_memory_file_descriptor =
@@ -145,14 +145,14 @@ int ptp_shm_interface_open() {
}
if (response == 0)
debug(1, "ptp_shm_interface_open successful");
debug(2, "ptp_shm_interface_open successful");
else
debug(1, "ptp_shm_interface_open failed");
debug(2, "ptp_shm_interface_open failed");
} else {
debug(1, "No config.nqptp_shared_memory_interface_name");
}
} else {
debug(1, "ptp_shm_interface_open -- already open!");
debug(2, "ptp_shm_interface_open -- already open!");
}
return response;
}
+4 -2
View File
@@ -2214,8 +2214,10 @@ int main(int argc, char **argv) {
ptp_shm_interface_init();
ptp_send_control_message_string("T"); // incidentally create the named SHM and remove all previous history
usleep(100000); // wait for it to get done (?)
if (ptp_shm_interface_open() != 0) {
debug(1,"unable to open the shm interface at startup!");
if (ptp_shm_interface_open() == 0) {
debug(1,"shm interface opened successfully!");
} else {
die("Unable to open the shm interface at startup!");
}
#endif