+
+ if (rmr_port) {
+#ifdef RMR_ENABLED
+ /* initialize RMR library */
+ if( (mrc = rmr_init( rmr_port, 1400, RMRFL_NONE )) == NULL ) {
+ fprintf(stderr, "%s::error:unable to initialise RMR\n", me);
+ exit( 1 );
+ }
+
+ rcv_fd = rmr_get_rcvfd( mrc ); // set up epoll things, start by getting the FD from MRr
+ if( rcv_fd < 0 ) {
+ fprintf(stderr, "%s::error:unable to set up polling fd\n", me);
+ exit( 1 );
+ }
+ if( (ep_fd = epoll_create1( 0 )) < 0 ) {
+ fprintf(stderr, "%s::error:unable to create epoll fd: %d\n", me, errno);
+ exit( 1 );
+ }
+ epe.events = EPOLLIN;
+ epe.data.fd = rcv_fd;
+
+ if( epoll_ctl( ep_fd, EPOLL_CTL_ADD, rcv_fd, &epe ) != 0 ) {
+ fprintf(stderr, "%s::error:epoll_ctl status not 0 : %s\n", me, strerror(errno));
+ exit( 1 );
+ }
+
+ rmr_sbuf = rmr_alloc_msg( mrc, MAXLINE ); // alloc first send buffer; subsequent buffers allcoated on send
+ rmr_rbuf = NULL; // don't need to alloc receive buffer
+
+ while( ! rmr_ready( mrc ) ) { // must have a route table before we can send; wait til RMr say it has one
+ sleep( 10 );
+ }
+ fprintf( stderr, "%s: RMR is ready\n", argv[0]);
+#else
+ fprintf(stderr,"Runtime libraries built without RMR support. Rebuild with RMR_ENABLED defined in gsoptions.h\n");
+ exit(0);
+#endif
+ }
+