Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F3153930
unlink.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
unlink.c
View Options
/*
* Test program for event service
*/
#include <stdio.h>
#include <string.h>
#include <sys/poll.h>
#include <unistd.h>
#include <fcntl.h>
#ifndef OPENAIS_SOLARIS
#include <stdint.h>
#include <getopt.h>
#else
#include <sys/types.h>
#endif
#include <stdlib.h>
#include <sys/time.h>
#include "saAis.h"
#include "saEvt.h"
#define TRY_WAIT 2
extern int get_sa_error(SaAisErrorT, char *, int);
char result_buf[256];
int result_buf_len = sizeof(result_buf);
SaVersionT version = { 'B', 0x01, 0x01 };
SaEvtCallbacksT callbacks = {
0,
0
};
char channel[256] = "EVENT_TEST_CHANNEL";
int
do_unlink()
{
SaEvtHandleT handle;
SaNameT channel_name;
SaAisErrorT result;
do {
result = saEvtInitialize (&handle, &callbacks, &version);
} while ((result == SA_AIS_ERR_TRY_AGAIN) && !sleep(TRY_WAIT));
if (result != SA_AIS_OK) {
get_sa_error(result, result_buf, result_buf_len);
printf("Event Initialize result: %s\n", result_buf);
return(result);
}
strcpy((char *)channel_name.value, channel);
channel_name.length = strlen(channel);
do {
result = saEvtChannelUnlink(handle, &channel_name);
} while ((result == SA_AIS_ERR_TRY_AGAIN) && !sleep(TRY_WAIT));
if (result != SA_AIS_OK) {
get_sa_error(result, result_buf, result_buf_len);
printf("ERROR: channel unlink result: %s\n", result_buf);
}
do {
result = saEvtFinalize(handle);
} while ((result == SA_AIS_ERR_TRY_AGAIN) && !sleep(TRY_WAIT));
if (result != SA_AIS_OK) {
get_sa_error(result, result_buf, result_buf_len);
printf("ERROR: Event Finalize result: %s\n", result_buf);
}
return 0;
}
int main (int argc, char **argv)
{
static const char opts[] = "c:";
int option;
while (1) {
option = getopt(argc, argv, opts);
if (option == -1)
break;
switch (option) {
case 'c':
strcpy(channel, optarg);
break;
default:
printf("invalid arg: \"%s\"\n", optarg);
return 1;
}
}
do_unlink();
return 0;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Wed, Feb 26, 3:46 AM (1 d, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1465153
Default Alt Text
unlink.c (1 KB)
Attached To
Mode
rC Corosync
Attached
Detach File
Event Timeline
Log In to Comment