|
@@ -53,6 +53,7 @@
|
|
|
|
|
|
|
|
#include "saAis.h"
|
|
#include "saAis.h"
|
|
|
#include "saCkpt.h"
|
|
#include "saCkpt.h"
|
|
|
|
|
+#include "sa_error.h"
|
|
|
|
|
|
|
|
#ifdef OPENAIS_SOLARIS
|
|
#ifdef OPENAIS_SOLARIS
|
|
|
#define timersub(a, b, result) \
|
|
#define timersub(a, b, result) \
|
|
@@ -68,6 +69,13 @@
|
|
|
|
|
|
|
|
int alarm_notice;
|
|
int alarm_notice;
|
|
|
|
|
|
|
|
|
|
+void fail_on_error(SaAisErrorT error, char* opName) {
|
|
|
|
|
+ if (error != SA_AIS_OK) {
|
|
|
|
|
+ printf ("%s: result %s\n", opName, get_sa_error_b(error));
|
|
|
|
|
+ exit (1);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void printSaNameT (SaNameT *name)
|
|
void printSaNameT (SaNameT *name)
|
|
|
{
|
|
{
|
|
|
int i;
|
|
int i;
|
|
@@ -92,7 +100,7 @@ SaCkptCheckpointCreationAttributesT checkpointCreationAttributes = {
|
|
|
.retentionDuration = 0,
|
|
.retentionDuration = 0,
|
|
|
.maxSections = 5,
|
|
.maxSections = 5,
|
|
|
.maxSectionSize = 250000,
|
|
.maxSectionSize = 250000,
|
|
|
- .maxSectionIdSize = 10
|
|
|
|
|
|
|
+ .maxSectionIdSize = 15
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
SaCkptSectionIdT sectionId1 = {
|
|
SaCkptSectionIdT sectionId1 = {
|
|
@@ -195,10 +203,7 @@ retry:
|
|
|
if (error == SA_AIS_ERR_TRY_AGAIN) {
|
|
if (error == SA_AIS_ERR_TRY_AGAIN) {
|
|
|
goto retry;
|
|
goto retry;
|
|
|
}
|
|
}
|
|
|
- if (error != SA_AIS_OK) {
|
|
|
|
|
- printf ("saCkptCheckpointWrite result %d (should be 1)\n", error);
|
|
|
|
|
- exit (1);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ fail_on_error(error, "saCkptCheckpointWrite");
|
|
|
write_count += 1;
|
|
write_count += 1;
|
|
|
} while (alarm_notice == 0);
|
|
} while (alarm_notice == 0);
|
|
|
gettimeofday (&tv2, NULL);
|
|
gettimeofday (&tv2, NULL);
|
|
@@ -229,21 +234,25 @@ int main (void) {
|
|
|
signal (SIGALRM, sigalrm_handler);
|
|
signal (SIGALRM, sigalrm_handler);
|
|
|
|
|
|
|
|
error = saCkptInitialize (&ckptHandle, &callbacks, &version);
|
|
error = saCkptInitialize (&ckptHandle, &callbacks, &version);
|
|
|
-
|
|
|
|
|
|
|
+ fail_on_error(error, "saCkptInitialize");
|
|
|
|
|
+
|
|
|
error = saCkptCheckpointOpen (ckptHandle,
|
|
error = saCkptCheckpointOpen (ckptHandle,
|
|
|
&checkpointName,
|
|
&checkpointName,
|
|
|
&checkpointCreationAttributes,
|
|
&checkpointCreationAttributes,
|
|
|
SA_CKPT_CHECKPOINT_CREATE|SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
|
|
SA_CKPT_CHECKPOINT_CREATE|SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE,
|
|
|
0,
|
|
0,
|
|
|
&checkpointHandle);
|
|
&checkpointHandle);
|
|
|
|
|
+ fail_on_error(error, "saCkptCheckpointOpen");
|
|
|
error = saCkptSectionCreate (checkpointHandle,
|
|
error = saCkptSectionCreate (checkpointHandle,
|
|
|
§ionCreationAttributes1,
|
|
§ionCreationAttributes1,
|
|
|
"Initial Data #0",
|
|
"Initial Data #0",
|
|
|
strlen ("Initial Data #0") + 1);
|
|
strlen ("Initial Data #0") + 1);
|
|
|
|
|
+ fail_on_error(error, "saCkptCheckpointSectionCreate");
|
|
|
error = saCkptSectionCreate (checkpointHandle,
|
|
error = saCkptSectionCreate (checkpointHandle,
|
|
|
§ionCreationAttributes2,
|
|
§ionCreationAttributes2,
|
|
|
"Initial Data #0",
|
|
"Initial Data #0",
|
|
|
strlen ("Initial Data #0") + 1);
|
|
strlen ("Initial Data #0") + 1);
|
|
|
|
|
+ fail_on_error(error, "saCkptCheckpointSectionCreate");
|
|
|
|
|
|
|
|
size = 1;
|
|
size = 1;
|
|
|
|
|
|