2 *------------------------------------------------------------------
3 * Copyright (c) 2017 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *------------------------------------------------------------------
19 #include <sys/socket.h>
20 #include <sys/types.h>
26 #include <sys/ioctl.h>
29 #include <sys/prctl.h>
35 #include <memif_private.h>
37 /* sends msg to socket */
39 memif_msg_send_from_queue (memif_control_channel_t *cc)
41 struct msghdr mh = { 0 };
43 char ctl[CMSG_SPACE (sizeof (int))];
44 int rv, err = MEMIF_ERR_SUCCESS; /* 0 */
45 memif_msg_queue_elt_t *e;
47 /* Pick the first message */
48 e = TAILQ_FIRST (&cc->msg_queue);
50 return MEMIF_ERR_SUCCESS;
52 /* Construct the message */
53 iov[0].iov_base = (void *) &e->msg;
54 iov[0].iov_len = sizeof (memif_msg_t);
61 memset (&ctl, 0, sizeof (ctl));
63 mh.msg_controllen = sizeof (ctl);
64 cmsg = CMSG_FIRSTHDR (&mh);
65 cmsg->cmsg_len = CMSG_LEN (sizeof (int));
66 cmsg->cmsg_level = SOL_SOCKET;
67 cmsg->cmsg_type = SCM_RIGHTS;
68 memcpy (CMSG_DATA (cmsg), &e->fd, sizeof (int));
70 rv = sendmsg (cc->fd, &mh, 0);
72 err = memif_syscall_error_handler (errno);
73 DBG ("Message type %u sent", e->msg.type);
75 /* If sent successfully, remove the msg from queue */
76 if (err == MEMIF_ERR_SUCCESS)
78 TAILQ_REMOVE (&cc->msg_queue, e, next);
79 cc->sock->args.free (e);
85 static memif_msg_queue_elt_t *
86 memif_msg_enq (memif_control_channel_t *cc)
88 memif_msg_queue_elt_t *e;
90 e = cc->sock->args.alloc (sizeof (*e));
95 TAILQ_INSERT_TAIL (&cc->msg_queue, e, next);
101 memif_msg_enq_hello (memif_control_channel_t *cc)
103 memif_msg_hello_t *h;
104 memif_msg_queue_elt_t *e = memif_msg_enq (cc);
107 return MEMIF_ERR_NOMEM;
109 e->msg.type = MEMIF_MSG_TYPE_HELLO;
112 h->min_version = MEMIF_VERSION;
113 h->max_version = MEMIF_VERSION;
114 h->max_s2m_ring = MEMIF_MAX_S2M_RING;
115 h->max_m2s_ring = MEMIF_MAX_M2S_RING;
116 h->max_region = MEMIF_MAX_REGION;
117 h->max_log2_ring_size = MEMIF_MAX_LOG2_RING_SIZE;
119 strlcpy ((char *) h->name, (char *) cc->sock->args.app_name,
122 return MEMIF_ERR_SUCCESS;
125 /* response from memif master - master is ready to handle next message */
127 memif_msg_enq_ack (memif_control_channel_t *cc)
129 memif_msg_queue_elt_t *e = memif_msg_enq (cc);
132 return MEMIF_ERR_NOMEM;
134 e->msg.type = MEMIF_MSG_TYPE_ACK;
137 return MEMIF_ERR_SUCCESS; /* 0 */
140 /* send id and secret (optional) for interface identification */
142 memif_msg_enq_init (memif_control_channel_t *cc)
144 memif_msg_queue_elt_t *e = memif_msg_enq (cc);
147 return MEMIF_ERR_NOMEM;
149 memif_msg_init_t *i = &e->msg.init;
151 e->msg.type = MEMIF_MSG_TYPE_INIT;
153 i->version = MEMIF_VERSION;
154 i->id = cc->conn->args.interface_id;
155 i->mode = cc->conn->args.mode;
157 strlcpy ((char *) i->name, (char *) cc->sock->args.app_name,
159 if (strlen ((char *) cc->conn->args.secret) > 0)
160 strlcpy ((char *) i->secret, (char *) cc->conn->args.secret,
163 return MEMIF_ERR_SUCCESS; /* 0 */
166 /* send information about region specified by region_index */
168 memif_msg_enq_add_region (memif_control_channel_t *cc, uint8_t region_index)
170 memif_region_t *mr = &cc->conn->regions[region_index];
171 memif_msg_queue_elt_t *e = memif_msg_enq (cc);
174 return MEMIF_ERR_NOMEM;
176 memif_msg_add_region_t *ar = &e->msg.add_region;
178 e->msg.type = MEMIF_MSG_TYPE_ADD_REGION;
180 ar->index = region_index;
181 ar->size = mr->region_size;
183 return MEMIF_ERR_SUCCESS; /* 0 */
186 /* send information about ring specified by direction (S2M | M2S) and index */
188 memif_msg_enq_add_ring (memif_control_channel_t *cc, uint8_t index,
191 memif_msg_queue_elt_t *e = memif_msg_enq (cc);
194 return MEMIF_ERR_NOMEM;
196 memif_msg_add_ring_t *ar = &e->msg.add_ring;
198 e->msg.type = MEMIF_MSG_TYPE_ADD_RING;
200 /* TODO: support multiple rings */
202 if (dir == MEMIF_RING_M2S)
203 mq = &cc->conn->rx_queues[index];
205 mq = &cc->conn->tx_queues[index];
209 ar->offset = mq->offset;
210 ar->region = mq->region;
211 ar->log2_ring_size = mq->log2_ring_size;
212 ar->flags = (dir == MEMIF_RING_S2M) ? MEMIF_MSG_ADD_RING_FLAG_S2M : 0;
213 ar->private_hdr_size = 0;
215 return MEMIF_ERR_SUCCESS; /* 0 */
218 /* used as connection request from slave */
220 memif_msg_enq_connect (memif_control_channel_t *cc)
222 memif_msg_queue_elt_t *e = memif_msg_enq (cc);
225 return MEMIF_ERR_NOMEM;
227 memif_msg_connect_t *cm = &e->msg.connect;
229 e->msg.type = MEMIF_MSG_TYPE_CONNECT;
231 strlcpy ((char *) cm->if_name, (char *) cc->conn->args.interface_name,
232 sizeof (cm->if_name));
234 return MEMIF_ERR_SUCCESS; /* 0 */
237 /* used as confirmation of connection by master */
239 memif_msg_enq_connected (memif_control_channel_t *cc)
241 memif_msg_queue_elt_t *e = memif_msg_enq (cc);
244 return MEMIF_ERR_NOMEM;
246 memif_msg_connected_t *cm = &e->msg.connected;
248 e->msg.type = MEMIF_MSG_TYPE_CONNECTED;
250 strlcpy ((char *) cm->if_name, (char *) cc->conn->args.interface_name,
251 sizeof (cm->if_name));
253 return MEMIF_ERR_SUCCESS; /* 0 */
257 memif_msg_enq_disconnect (memif_control_channel_t *cc, uint8_t *err_string,
260 memif_msg_queue_elt_t *e;
262 e = cc->sock->args.alloc (sizeof (*e));
264 return MEMIF_ERR_NOMEM;
267 /* Insert disconenct message at the top of the msg queue */
268 TAILQ_INSERT_HEAD (&cc->msg_queue, e, next);
270 memif_msg_disconnect_t *d = &e->msg.disconnect;
272 e->msg.type = MEMIF_MSG_TYPE_DISCONNECT;
274 uint16_t l = sizeof (d->string);
277 DBG ("Disconnect string too long. Sending the first %ld characters.",
278 sizeof (d->string) - 1);
280 strlcpy ((char *) d->string, (char *) err_string, sizeof (d->string));
282 return MEMIF_ERR_SUCCESS;
286 memif_msg_parse_hello (memif_control_channel_t *cc, memif_msg_t *msg)
288 memif_msg_hello_t *h = &msg->hello;
289 memif_connection_t *c = cc->conn;
291 if (msg->hello.min_version > MEMIF_VERSION ||
292 msg->hello.max_version < MEMIF_VERSION)
294 DBG ("incompatible protocol version");
295 return MEMIF_ERR_PROTO;
298 c->run_args.num_s2m_rings = memif_min (h->max_s2m_ring + 1,
299 c->args.num_s2m_rings);
300 c->run_args.num_m2s_rings = memif_min (h->max_m2s_ring + 1,
301 c->args.num_m2s_rings);
302 c->run_args.log2_ring_size = memif_min (h->max_log2_ring_size,
303 c->args.log2_ring_size);
304 c->run_args.buffer_size = c->args.buffer_size;
305 strlcpy ((char *) c->remote_name, (char *) h->name, sizeof (c->remote_name));
307 return MEMIF_ERR_SUCCESS; /* 0 */
310 /* handle interface identification (id, secret (optional)) */
312 memif_msg_parse_init (memif_control_channel_t *cc, memif_msg_t *msg)
314 memif_msg_init_t *i = &msg->init;
315 memif_connection_t *c = NULL;
316 uint8_t err_string[96];
317 memset (err_string, 0, sizeof (char) * 96);
318 int err = MEMIF_ERR_SUCCESS; /* 0 */
320 /* Check compatible meimf version */
321 if (i->version != MEMIF_VERSION)
323 DBG ("MEMIF_VER_ERR");
324 memif_msg_enq_disconnect (cc, MEMIF_VER_ERR, 0);
325 return MEMIF_ERR_PROTO;
328 /* Find endpoint on the socket */
329 TAILQ_FOREACH (c, &cc->sock->master_interfaces, next)
331 /* Match interface id */
332 if (c->args.interface_id != i->id)
334 /* If control channel is present, interface is connected (or connecting) */
335 if (c->control_channel != NULL)
337 memif_msg_enq_disconnect (cc, "Already connected", 0);
338 return MEMIF_ERR_ALRCONN;
341 if (c->args.secret[0] != '\0')
343 if (strncmp ((char *) c->args.secret, (char *) i->secret, 24) != 0)
345 memif_msg_enq_disconnect (cc, "Incorrect secret", 0);
346 return MEMIF_ERR_SECRET;
350 /* Assign the control channel to this interface */
351 c->control_channel = cc;
354 strlcpy ((char *) c->remote_name, (char *) i->name,
355 sizeof (c->remote_name));
361 /* receive region information and add new region to connection (if possible) */
363 memif_msg_parse_add_region (memif_control_channel_t *cc, memif_msg_t *msg,
366 memif_msg_add_region_t *ar = &msg->add_region;
368 memif_connection_t *c = cc->conn;
371 return MEMIF_ERR_NO_SHMFD;
373 if (ar->index > MEMIF_MAX_REGION)
374 return MEMIF_ERR_MAXREG;
376 mr = (memif_region_t *) cc->sock->args.realloc (
377 c->regions, sizeof (memif_region_t) * (++c->regions_num));
379 return memif_syscall_error_handler (errno);
380 memset (mr + ar->index, 0, sizeof (memif_region_t));
382 c->regions[ar->index].fd = fd;
383 c->regions[ar->index].region_size = ar->size;
384 c->regions[ar->index].addr = NULL;
385 /* region 0 is never external */
386 if (cc->sock->get_external_region_addr && (ar->index != 0))
387 c->regions[ar->index].is_external = 1;
389 return MEMIF_ERR_SUCCESS; /* 0 */
392 /* receive ring information and add new ring to connection queue
393 (based on direction S2M | M2S) */
395 memif_msg_parse_add_ring (memif_control_channel_t *cc, memif_msg_t *msg,
398 memif_msg_add_ring_t *ar = &msg->add_ring;
399 memif_connection_t *c = cc->conn;
404 return MEMIF_ERR_NO_INTFD;
406 if (ar->private_hdr_size != 0)
407 return MEMIF_ERR_PRIVHDR;
409 if (ar->flags & MEMIF_MSG_ADD_RING_FLAG_S2M)
411 if (ar->index > MEMIF_MAX_S2M_RING)
412 return MEMIF_ERR_MAXRING;
413 if (ar->index >= c->args.num_s2m_rings)
414 return MEMIF_ERR_MAXRING;
416 mq = (memif_queue_t *) cc->sock->args.realloc (
417 c->rx_queues, sizeof (memif_queue_t) * (++c->rx_queues_num));
418 memset (mq + ar->index, 0, sizeof (memif_queue_t));
420 return memif_syscall_error_handler (errno);
422 c->rx_queues[ar->index].int_fd = fd;
423 c->rx_queues[ar->index].log2_ring_size = ar->log2_ring_size;
424 c->rx_queues[ar->index].region = ar->region;
425 c->rx_queues[ar->index].offset = ar->offset;
426 c->run_args.num_s2m_rings++;
430 if (ar->index > MEMIF_MAX_M2S_RING)
431 return MEMIF_ERR_MAXRING;
432 if (ar->index >= c->args.num_m2s_rings)
433 return MEMIF_ERR_MAXRING;
435 mq = (memif_queue_t *) cc->sock->args.realloc (
436 c->tx_queues, sizeof (memif_queue_t) * (++c->tx_queues_num));
437 memset (mq + ar->index, 0, sizeof (memif_queue_t));
439 return memif_syscall_error_handler (errno);
441 c->tx_queues[ar->index].int_fd = fd;
442 c->tx_queues[ar->index].log2_ring_size = ar->log2_ring_size;
443 c->tx_queues[ar->index].region = ar->region;
444 c->tx_queues[ar->index].offset = ar->offset;
445 c->run_args.num_m2s_rings++;
448 return MEMIF_ERR_SUCCESS; /* 0 */
452 memif_configure_rx_interrupt (memif_connection_t *c)
454 memif_socket_t *ms = (memif_socket_t *) c->args.socket;
455 memif_interrupt_t *idata;
456 memif_fd_event_t fde;
457 memif_fd_event_data_t *fdata;
461 if (c->on_interrupt != NULL)
463 for (i = 0; i < c->run_args.num_m2s_rings; i++)
465 /* Allocate fd event data */
466 fdata = ms->args.alloc (sizeof (*fdata));
469 memif_msg_enq_disconnect (c->control_channel, "Internal error",
471 return MEMIF_ERR_NOMEM;
473 /* Allocate interrupt data */
474 idata = ms->args.alloc (sizeof (*fdata));
477 ms->args.free (fdata);
478 memif_msg_enq_disconnect (c->control_channel, "Internal error",
480 return MEMIF_ERR_NOMEM;
483 /* configure interrupt data */
486 /* configure fd event data */
487 fdata->event_handler = memif_interrupt_handler;
488 fdata->private_ctx = idata;
489 fde.fd = c->rx_queues[i].int_fd;
490 fde.type = MEMIF_FD_EVENT_READ;
491 fde.private_ctx = fdata;
493 /* Start listening for events */
494 ctx = ms->epfd != -1 ? ms : ms->private_ctx;
495 ms->args.on_control_fd_update (fde, ctx);
499 return MEMIF_ERR_SUCCESS;
502 /* slave -> master */
504 memif_msg_parse_connect (memif_control_channel_t *cc, memif_msg_t *msg)
506 memif_msg_connect_t *cm = &msg->connect;
507 memif_connection_t *c = cc->conn;
510 err = memif_connect1 (c);
511 if (err != MEMIF_ERR_SUCCESS)
514 strlcpy ((char *) c->remote_if_name, (char *) cm->if_name,
515 sizeof (c->remote_if_name));
517 err = memif_configure_rx_interrupt (c);
518 if (err != MEMIF_ERR_SUCCESS)
521 c->on_connect ((void *) c, c->private_ctx);
526 /* master -> slave */
528 memif_msg_parse_connected (memif_control_channel_t *cc, memif_msg_t *msg)
530 memif_msg_connect_t *cm = &msg->connect;
531 memif_connection_t *c = cc->conn;
534 err = memif_connect1 (c);
535 if (err != MEMIF_ERR_SUCCESS)
538 strlcpy ((char *) c->remote_if_name, (char *) cm->if_name,
539 sizeof (c->remote_if_name));
541 err = memif_configure_rx_interrupt (c);
542 if (err != MEMIF_ERR_SUCCESS)
545 c->on_connect ((void *) c, c->private_ctx);
551 memif_msg_parse_disconnect (memif_control_channel_t *cc, memif_msg_t *msg)
553 memif_msg_disconnect_t *d = &msg->disconnect;
554 memif_connection_t *c = cc->conn;
556 memset (c->remote_disconnect_string, 0,
557 sizeof (c->remote_disconnect_string));
558 strlcpy ((char *) c->remote_disconnect_string, (char *) d->string,
559 sizeof (c->remote_disconnect_string));
561 /* on returning error, handle function will call memif_disconnect () */
562 DBG ("disconnect received: %s, mode: %d",
563 c->remote_disconnect_string, c->args.mode);
564 return MEMIF_ERR_DISCONNECT;
568 memif_msg_receive_and_parse (memif_control_channel_t *cc)
570 char ctl[CMSG_SPACE (sizeof (int)) +
571 CMSG_SPACE (sizeof (struct ucred))] = { 0 };
572 struct msghdr mh = { 0 };
574 memif_msg_t msg = { 0 };
576 int err = MEMIF_ERR_SUCCESS; /* 0 */
579 memif_socket_t *ms = NULL;
581 iov[0].iov_base = (void *) &msg;
582 iov[0].iov_len = sizeof (memif_msg_t);
585 mh.msg_control = ctl;
586 mh.msg_controllen = sizeof (ctl);
588 DBG ("recvmsg fd %d", cc->fd);
589 size = recvmsg (cc->fd, &mh, 0);
590 if (size != sizeof (memif_msg_t))
593 return MEMIF_ERR_DISCONNECTED;
595 return MEMIF_ERR_MFMSG;
598 struct cmsghdr *cmsg;
600 cmsg = CMSG_FIRSTHDR (&mh);
603 if (cmsg->cmsg_level == SOL_SOCKET)
605 if (cmsg->cmsg_type == SCM_CREDENTIALS)
609 else if (cmsg->cmsg_type == SCM_RIGHTS)
611 int *fdp = (int *) CMSG_DATA (cmsg);
615 cmsg = CMSG_NXTHDR (&mh, cmsg);
618 DBG ("Message type %u received", msg.type);
622 case MEMIF_MSG_TYPE_ACK:
625 case MEMIF_MSG_TYPE_HELLO:
626 if ((err = memif_msg_parse_hello (cc, &msg)) != MEMIF_ERR_SUCCESS)
628 if ((err = memif_init_regions_and_queues (cc->conn)) !=
631 if ((err = memif_msg_enq_init (cc)) != MEMIF_ERR_SUCCESS)
633 for (i = 0; i < cc->conn->regions_num; i++)
635 if ((err = memif_msg_enq_add_region (cc, i)) != MEMIF_ERR_SUCCESS)
638 for (i = 0; i < cc->conn->run_args.num_s2m_rings; i++)
640 if ((err = memif_msg_enq_add_ring (cc, i, MEMIF_RING_S2M)) !=
644 for (i = 0; i < cc->conn->run_args.num_m2s_rings; i++)
646 if ((err = memif_msg_enq_add_ring (cc, i, MEMIF_RING_M2S)) !=
650 if ((err = memif_msg_enq_connect (cc)) != MEMIF_ERR_SUCCESS)
654 case MEMIF_MSG_TYPE_INIT:
655 if ((err = memif_msg_parse_init (cc, &msg)) != MEMIF_ERR_SUCCESS)
657 /* c->remote_pid = cr->pid */
658 /* c->remote_uid = cr->uid */
659 /* c->remote_gid = cr->gid */
660 if ((err = memif_msg_enq_ack (cc)) != MEMIF_ERR_SUCCESS)
664 case MEMIF_MSG_TYPE_ADD_REGION:
665 if ((err = memif_msg_parse_add_region (cc, &msg, fd)) !=
668 if ((err = memif_msg_enq_ack (cc)) != MEMIF_ERR_SUCCESS)
672 case MEMIF_MSG_TYPE_ADD_RING:
673 if ((err = memif_msg_parse_add_ring (cc, &msg, fd)) != MEMIF_ERR_SUCCESS)
675 if ((err = memif_msg_enq_ack (cc)) != MEMIF_ERR_SUCCESS)
679 case MEMIF_MSG_TYPE_CONNECT:
680 if ((err = memif_msg_parse_connect (cc, &msg)) != MEMIF_ERR_SUCCESS)
682 if ((err = memif_msg_enq_connected (cc)) != MEMIF_ERR_SUCCESS)
686 case MEMIF_MSG_TYPE_CONNECTED:
687 if ((err = memif_msg_parse_connected (cc, &msg)) != MEMIF_ERR_SUCCESS)
691 case MEMIF_MSG_TYPE_DISCONNECT:
692 if ((err = memif_msg_parse_disconnect (cc, &msg)) != MEMIF_ERR_SUCCESS)
697 return MEMIF_ERR_UNKNOWN_MSG;;
701 return MEMIF_ERR_SUCCESS; /* 0 */
705 memif_delete_control_channel (memif_control_channel_t *cc)
707 memif_msg_queue_elt_t *e, *next;
708 memif_socket_t *ms = cc->sock;
709 memif_fd_event_t fde;
713 fde.type = MEMIF_FD_EVENT_DEL;
714 ctx = ms->epfd != -1 ? ms : ms->private_ctx;
715 cc->sock->args.on_control_fd_update (fde, ctx);
720 /* Clear control message queue */
721 for (e = TAILQ_FIRST (&cc->msg_queue); e != NULL; e = next)
723 next = TAILQ_NEXT (e, next);
724 TAILQ_REMOVE (&cc->msg_queue, e, next);
725 cc->sock->args.free (e);
728 /* remove reference */
729 if (cc->conn != NULL)
730 cc->conn->control_channel = NULL;
732 cc->sock->args.free (cc);
738 memif_control_channel_handler (memif_fd_event_type_t type, void *private_ctx)
740 memif_control_channel_t *cc = (memif_control_channel_t *) private_ctx;
743 /* Receive the message, parse the message and
744 * enqueue next message(s).
746 err = memif_msg_receive_and_parse (cc);
747 /* Can't assign to endpoint */
748 if (cc->conn == NULL)
750 /* A disconnect message is already in the queue */
751 memif_msg_send_from_queue (cc);
752 memif_delete_control_channel (cc);
754 return MEMIF_ERR_SUCCESS;
756 /* error in memif_msg_receive */
757 if (err != MEMIF_ERR_SUCCESS)
760 /* Continue connecting, send next message from the queue */
761 err = memif_msg_send_from_queue (cc);
762 if (err != MEMIF_ERR_SUCCESS)
765 return MEMIF_ERR_SUCCESS;
768 memif_disconnect_internal (cc->conn);
769 return MEMIF_ERR_SUCCESS;
773 memif_listener_handler (memif_fd_event_type_t type, void *private_ctx)
775 memif_socket_t *ms = (memif_socket_t *) private_ctx;
776 memif_control_channel_t *cc;
777 memif_fd_event_t fde;
778 memif_fd_event_data_t *fdata;
779 struct sockaddr_un un;
780 int err, sockfd, addr_len = sizeof (un);
784 return MEMIF_ERR_INVAL_ARG;
786 if (type & MEMIF_FD_EVENT_READ)
788 /* Accept connection to the listener socket */
789 sockfd = accept (ms->listener_fd, (struct sockaddr *) &un,
790 (socklen_t *) &addr_len);
793 return memif_syscall_error_handler (errno);
796 /* Create new control channel */
797 cc = ms->args.alloc (sizeof (*cc));
800 err = MEMIF_ERR_NOMEM;
805 /* The connection will be assigned after parsing MEMIF_MSG_TYPE_INIT msg
809 TAILQ_INIT (&cc->msg_queue);
811 /* Create memif fd event */
812 fdata = ms->args.alloc (sizeof (*fdata));
815 err = MEMIF_ERR_NOMEM;
819 fdata->event_handler = memif_control_channel_handler;
820 fdata->private_ctx = cc;
823 fde.type = MEMIF_FD_EVENT_READ;
824 fde.private_ctx = fdata;
826 /* Start listenning for events on the new control channel */
827 ctx = ms->epfd != -1 ? ms : ms->private_ctx;
828 ms->args.on_control_fd_update (fde, ctx);
830 /* enqueue HELLO msg */
831 err = memif_msg_enq_hello (cc);
832 if (err != MEMIF_ERR_SUCCESS)
836 err = memif_msg_send_from_queue (cc);
837 if (err != MEMIF_ERR_SUCCESS)
841 return MEMIF_ERR_SUCCESS;
849 ms->args.free (fdata);