File:  [ELWIX - Embedded LightWeight unIX -] / libaitio / src / sock.c
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Fri Nov 22 13:49:14 2013 UTC (10 years, 7 months ago) by misho
Branches: MAIN
CVS tags: io6_1, IO6_0, HEAD
version 6.0

    1: /*************************************************************************
    2: * (C) 2013 AITNET ltd - Sofia/Bulgaria - <misho@aitnet.org>
    3: *  by Michael Pounov <misho@elwix.org>
    4: *
    5: * $Author: misho $
    6: * $Id: sock.c,v 1.5 2013/11/22 13:49:14 misho Exp $
    7: *
    8: **************************************************************************
    9: The ELWIX and AITNET software is distributed under the following
   10: terms:
   11: 
   12: All of the documentation and software included in the ELWIX and AITNET
   13: Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   14: 
   15: Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
   16: 	by Michael Pounov <misho@elwix.org>.  All rights reserved.
   17: 
   18: Redistribution and use in source and binary forms, with or without
   19: modification, are permitted provided that the following conditions
   20: are met:
   21: 1. Redistributions of source code must retain the above copyright
   22:    notice, this list of conditions and the following disclaimer.
   23: 2. Redistributions in binary form must reproduce the above copyright
   24:    notice, this list of conditions and the following disclaimer in the
   25:    documentation and/or other materials provided with the distribution.
   26: 3. All advertising materials mentioning features or use of this software
   27:    must display the following acknowledgement:
   28: This product includes software developed by Michael Pounov <misho@elwix.org>
   29: ELWIX - Embedded LightWeight unIX and its contributors.
   30: 4. Neither the name of AITNET nor the names of its contributors
   31:    may be used to endorse or promote products derived from this software
   32:    without specific prior written permission.
   33: 
   34: THIS SOFTWARE IS PROVIDED BY AITNET AND CONTRIBUTORS ``AS IS'' AND
   35: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   36: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   37: ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   38: FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   39: DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   40: OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   41: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   42: LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   43: OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   44: SUCH DAMAGE.
   45: */
   46: #include "global.h"
   47: 
   48: 
   49: static void *
   50: io_closeClient(sched_task_t *task)
   51: {
   52: 	sock_cli_t *cli = (sock_cli_t*) TASK_ARG(task);
   53: 	sock_t *s = (sock_t*) cli->cli_parent;
   54: 	int stat, sock = (int) TASK_DATLEN(task);
   55: 
   56: 	pthread_mutex_lock(&s->sock_mtx);
   57: 	TAILQ_REMOVE(&s->sock_cli, cli, cli_node);
   58: 	pthread_mutex_unlock(&s->sock_mtx);
   59: 
   60: 	schedCancelby(s->sock_root, taskMAX, CRITERIA_ARG, cli, NULL);
   61: 
   62: 	if (s->sock_type == SOCK_STREAM) {
   63: 		shutdown(sock, SHUT_RDWR);
   64: 		close(sock);
   65: 	}
   66: 	AIT_FREE_VAL(&cli->cli_buf[1]);
   67: 	AIT_FREE_VAL(&cli->cli_buf[0]);
   68: 
   69: 	if (cli->cli_pid > 0) {
   70: 		kill(cli->cli_pid, SIGTERM);
   71: 		while (waitpid(cli->cli_pid, &stat, WNOHANG) > 0) {
   72: 			usleep(1000);
   73: 			kill(cli->cli_pid, SIGTERM);
   74: 		}
   75: 	}
   76: 
   77: 	e_free(cli);
   78: 	taskExit(task, NULL);
   79: }
   80: 
   81: static void *
   82: io_acceptClient(sched_task_t *task)
   83: {
   84: 	int c, rlen;
   85: 	sockaddr_t sa;
   86: 	socklen_t salen = sizeof sa.ss;
   87: 	sock_cli_t *cli = NULL;
   88: 	sock_t *s = (sock_t*) TASK_ARG(task);
   89: 
   90: 	if (s->sock_type == SOCK_STREAM) {
   91: 		if ((c = accept(TASK_FD(task), &sa.sa, &salen)) == -1) {
   92: 			LOGERR;
   93: 			goto end;
   94: 		}
   95: 	} else {
   96: 		if ((rlen = recvfrom(TASK_FD(task), 
   97: 						AIT_GET_BUF(&s->sock_buf), AIT_LEN(&s->sock_buf), 
   98: 						MSG_PEEK, &sa.sa, &salen)) == -1) {
   99: 			LOGERR;
  100: 			goto end;
  101: 		} else
  102: 			c = TASK_FD(task);
  103: 	}
  104: 
  105: 	cli = e_malloc(sizeof(sock_cli_t));
  106: 	if (!cli) {
  107: 		io_SetErr(elwix_GetErrno(), "%s", elwix_GetError());
  108: 		if (s->sock_type == SOCK_STREAM)
  109: 			close(c);
  110: 		goto end;
  111: 	} else {
  112: 		memset(cli, 0, sizeof(sock_cli_t));
  113: 		pthread_mutex_lock(&s->sock_mtx);
  114: 		TAILQ_INSERT_TAIL(&s->sock_cli, cli, cli_node);
  115: 		pthread_mutex_unlock(&s->sock_mtx);
  116: 	}
  117: 
  118: 	cli->cli_parent = TASK_ARG(task);
  119: 	cli->cli_fd = c;
  120: 	cli->cli_func = TASK_DATA(task);
  121: 	memcpy(&cli->cli_addr, &sa, sizeof cli->cli_addr);
  122: 	AIT_SET_BUFSIZ(&cli->cli_buf[0], 0, AIT_LEN(&s->sock_buf));
  123: 	AIT_SET_BUFSIZ(&cli->cli_buf[1], 0, AIT_LEN(&s->sock_buf));
  124: 
  125: 	schedRead(TASK_ROOT(task), cli->cli_func, cli, cli->cli_fd, TASK_ARG(task), 0);
  126: 	ioUpdTimerSocket(cli, NULL);
  127: end:
  128: 	schedReadSelf(task);
  129: 	taskExit(task, NULL);
  130: }
  131: 
  132: static void *
  133: io_txNet(sched_task_t *task)
  134: {
  135: 	int wlen;
  136: 	sock_cli_t *cli = TASK_ARG(task);
  137: 	sock_t *s = (sock_t*) cli->cli_parent;
  138: 
  139: 	ioUpdTimerSocket(cli, NULL);
  140: 
  141: 	if (s->sock_type == SOCK_STREAM)
  142: 		wlen = send(TASK_FD(task), TASK_DATA(task), TASK_DATLEN(task), 0);
  143: 	else
  144: 		wlen = sendto(TASK_FD(task), TASK_DATA(task), TASK_DATLEN(task), 0, 
  145: 				&cli->cli_addr.sa, cli->cli_addr.sa.sa_len);
  146: 	if (wlen < 1)
  147: 		schedEvent(TASK_ROOT(task), io_closeClient, cli, 0, 
  148: 				(void*) cli->cli_func, cli->cli_fd);
  149: 
  150: 	taskExit(task, NULL);
  151: }
  152: 
  153: static void *
  154: io_txPty(sched_task_t *task)
  155: {
  156: 	int wlen;
  157: 	sock_cli_t *cli = TASK_ARG(task);
  158: 
  159: 	ioUpdTimerSocket(cli, NULL);
  160: 
  161: 	wlen = write(TASK_FD(task), TASK_DATA(task), TASK_DATLEN(task));
  162: 	if (wlen < 1)
  163: 		schedEvent(TASK_ROOT(task), io_closeClient, cli, 0, 
  164: 				(void*) cli->cli_func, cli->cli_fd);
  165: 
  166: 	taskExit(task, NULL);
  167: }
  168: 
  169: static void *
  170: io_rxNet(sched_task_t *task)
  171: {
  172: 	int rlen;
  173: 	sock_cli_t *cli = TASK_ARG(task);
  174: 	sock_t *s = (sock_t*) cli->cli_parent;
  175: 	sockaddr_t sa;
  176: 	socklen_t salen = sizeof sa.ss;
  177: 
  178: 	ioUpdTimerSocket(cli, NULL);
  179: 
  180: 	if (s->sock_type == SOCK_STREAM)
  181: 		rlen = recv(TASK_FD(task), AIT_GET_BUF(&cli->cli_buf[0]), 
  182: 				AIT_LEN(&cli->cli_buf[0]), 0);
  183: 	else {
  184: 		rlen = recvfrom(TASK_FD(task), AIT_GET_BUF(&cli->cli_buf[0]), 
  185: 				AIT_LEN(&cli->cli_buf[0]), 0, &sa.sa, &salen);
  186: 		if (e_addrcmp(&cli->cli_addr, &sa, 42))
  187: 			goto end;
  188: 	}
  189: 	if (rlen < 1)
  190: 		schedEvent(TASK_ROOT(task), io_closeClient, cli, 0, 
  191: 				(void*) cli->cli_func, cli->cli_fd);
  192: 	else
  193: 		schedEvent(TASK_ROOT(task), io_txPty, cli, cli->cli_pty, 
  194: 				AIT_GET_BUF(&cli->cli_buf[0]), rlen);
  195: end:
  196: 	schedReadSelf(task);
  197: 	taskExit(task, NULL);
  198: }
  199: 
  200: static void *
  201: io_rxPty(sched_task_t *task)
  202: {
  203: 	int rlen;
  204: 	sock_cli_t *cli = TASK_ARG(task);
  205: 
  206: 	ioUpdTimerSocket(cli, NULL);
  207: 
  208: 	rlen = read(TASK_FD(task), AIT_GET_BUF(&cli->cli_buf[1]), AIT_LEN(&cli->cli_buf[1]));
  209: 	if (rlen < 1)
  210: 		schedEvent(TASK_ROOT(task), io_closeClient, cli, 0, 
  211: 				(void*) cli->cli_func, cli->cli_fd);
  212: 	else
  213: 		schedEvent(TASK_ROOT(task), io_txNet, cli, cli->cli_fd, 
  214: 				AIT_GET_BUF(&cli->cli_buf[1]), rlen);
  215: 
  216: 	schedReadSelf(task);
  217: 	taskExit(task, NULL);
  218: }
  219: 
  220: static void *
  221: io_bridgeClient(sched_task_t *task)
  222: {
  223: 	int c, rlen;
  224: 	pid_t pid;
  225: 	sockaddr_t sa;
  226: 	socklen_t salen = sizeof sa.ss;
  227: 	sock_cli_t *cli = NULL;
  228: 	sock_t *s = (sock_t*) TASK_ARG(task);
  229: 	array_t *args = NULL;
  230: 	char **argv = NULL;
  231: 
  232: 	if (s->sock_type == SOCK_STREAM) {
  233: 		if ((c = accept(TASK_FD(task), &sa.sa, &salen)) == -1) {
  234: 			LOGERR;
  235: 			goto end;
  236: 		}
  237: 	} else {
  238: 		if ((rlen = recvfrom(TASK_FD(task), 
  239: 						AIT_GET_BUF(&s->sock_buf), AIT_LEN(&s->sock_buf), 
  240: 						MSG_PEEK, &sa.sa, &salen)) == -1) {
  241: 			LOGERR;
  242: 			goto end;
  243: 		} else
  244: 			c = TASK_FD(task);
  245: 	}
  246: 
  247: 	cli = e_malloc(sizeof(sock_cli_t));
  248: 	if (!cli) {
  249: 		io_SetErr(elwix_GetErrno(), "%s", elwix_GetError());
  250: 		if (s->sock_type == SOCK_STREAM)
  251: 			close(c);
  252: 		goto end;
  253: 	} else {
  254: 		memset(cli, 0, sizeof(sock_cli_t));
  255: 		pthread_mutex_lock(&s->sock_mtx);
  256: 		TAILQ_INSERT_TAIL(&s->sock_cli, cli, cli_node);
  257: 		pthread_mutex_unlock(&s->sock_mtx);
  258: 	}
  259: 
  260: 	cli->cli_parent = TASK_ARG(task);
  261: 	cli->cli_fd = c;
  262: 	strlcpy(cli->cli_cmdline, TASK_DATA(task), sizeof cli->cli_cmdline);
  263: 	memcpy(&cli->cli_addr, &sa, sizeof cli->cli_addr);
  264: 	AIT_SET_BUFSIZ(&cli->cli_buf[0], 0, AIT_LEN(&s->sock_buf));
  265: 	AIT_SET_BUFSIZ(&cli->cli_buf[1], 0, AIT_LEN(&s->sock_buf));
  266: 
  267: 	switch ((pid = ioForkPTY(&cli->cli_pty, cli->cli_name, sizeof cli->cli_name, 
  268: 				NULL, NULL, NULL))) {
  269: 		case -1:
  270: 			ELIBERR(io);
  271: 			break;
  272: 		case 0:
  273: 			array_Args(cli->cli_cmdline, 0, " \t", &args);
  274: 			argv = array_To(args);
  275: 			array_Destroy(&args);
  276: 
  277: 			printf("Console %s\n", cli->cli_name);
  278: 			execv(*argv, argv);
  279: 			break;
  280: 		default:
  281: 			cli->cli_pid = pid;
  282: 
  283: 			schedRead(TASK_ROOT(task), io_rxPty, cli, cli->cli_pty, 
  284: 					TASK_ARG(task), 0);
  285: 			schedRead(TASK_ROOT(task), io_rxNet, cli, cli->cli_fd, 
  286: 					TASK_ARG(task), 0);
  287: 			ioUpdTimerSocket(cli, NULL);
  288: 			break;
  289: 	}
  290: end:
  291: 	schedReadSelf(task);
  292: 	taskExit(task, NULL);
  293: }
  294: 
  295: 
  296: /*
  297:  * ioInitSocket() - Init socket and allocate resources
  298:  *
  299:  * @role = Socket role
  300:  * @type = Socket type
  301:  * @proto = Socket protocol
  302:  * @addr = Bind to address
  303:  * @port = Bind to port
  304:  * @buflen = Socket buffer, optional if =0 == BUFSIZ
  305:  * return: NULL error or !=NULL created socket
  306:  */
  307: sock_t *
  308: ioInitSocket(int role, int type, int proto, const char *addr, u_short port, size_t buflen)
  309: {
  310: 	sock_t *s = NULL;
  311: 	int n = 1;
  312: 
  313: 	if (!addr)
  314: 		return NULL;
  315: 
  316: 	s = e_malloc(sizeof(sock_t));
  317: 	if (!s) {
  318: 		io_SetErr(elwix_GetErrno(), "%s", elwix_GetError());
  319: 		return NULL;
  320: 	} else
  321: 		memset(s, 0, sizeof(sock_t));
  322: 
  323: 	TAILQ_INIT(&s->sock_cli);
  324: 
  325: 	s->sock_role = role;
  326: 	s->sock_type = type;
  327: 	s->sock_proto = proto;
  328: 	if (!e_gethostbyname(addr, port, &s->sock_addr)) {
  329: 		io_SetErr(elwix_GetErrno(), "%s", elwix_GetError());
  330: 		e_free(s);
  331: 		return NULL;
  332: 	} else {
  333: 		buflen = buflen ? buflen : BUFSIZ;
  334: 		buflen = E_ALIGN(buflen, 2);	/* align buflen length */
  335: 		AIT_SET_BUFSIZ(&s->sock_buf, 0, buflen);
  336: 	}
  337: 
  338: 	s->sock_fd = socket(s->sock_addr.sa.sa_family, s->sock_type, s->sock_proto);
  339: 	if (s->sock_fd == -1) {
  340: 		LOGERR;
  341: 		AIT_FREE_VAL(&s->sock_buf);
  342: 		e_free(s);
  343: 		return NULL;
  344: 	}
  345: 	if (setsockopt(s->sock_fd, SOL_SOCKET, SO_SNDBUF, &buflen, sizeof buflen) == -1) {
  346: 		LOGERR;
  347: 		AIT_FREE_VAL(&s->sock_buf);
  348: 		e_free(s);
  349: 		return NULL;
  350: 	}
  351: 	if (setsockopt(s->sock_fd, SOL_SOCKET, SO_RCVBUF, &buflen, sizeof buflen) == -1) {
  352: 		LOGERR;
  353: 		AIT_FREE_VAL(&s->sock_buf);
  354: 		e_free(s);
  355: 		return NULL;
  356: 	}
  357: 	if (setsockopt(s->sock_fd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof n) == -1) {
  358: 		LOGERR;
  359: 		AIT_FREE_VAL(&s->sock_buf);
  360: 		e_free(s);
  361: 		return NULL;
  362: 	}
  363: 	if (bind(s->sock_fd, &s->sock_addr.sa, s->sock_addr.sa.sa_len) == -1) {
  364: 		LOGERR;
  365: 		AIT_FREE_VAL(&s->sock_buf);
  366: 		e_free(s);
  367: 		return NULL;
  368: 	}
  369: 
  370: 	s->sock_root = schedBegin();
  371: 	if (!s->sock_root) {
  372: 		io_SetErr(sched_GetErrno(), "%s", sched_GetError());
  373: 		AIT_FREE_VAL(&s->sock_buf);
  374: 		e_free(s);
  375: 		return NULL;
  376: 	}
  377: 
  378: 	pthread_mutex_init(&s->sock_mtx, NULL);
  379: 	return s;
  380: }
  381: 
  382: /*
  383:  * ioCloseSocket() - Close socket and free resources
  384:  *
  385:  * @s = Socket
  386:  * return: none
  387:  */
  388: void
  389: ioCloseSocket(sock_t ** __restrict s)
  390: {
  391: 	sock_cli_t *cli;
  392: 	int stat;
  393: 
  394: 	if (s && *s) {
  395: 		pthread_mutex_lock(&(*s)->sock_mtx);
  396: 		while ((cli = TAILQ_FIRST(&(*s)->sock_cli))) {
  397: 			TAILQ_REMOVE(&(*s)->sock_cli, cli, cli_node);
  398: 
  399: 			schedCancelby((*s)->sock_root, taskMAX, CRITERIA_ARG, cli, NULL);
  400: 
  401: 			if ((*s)->sock_type == SOCK_STREAM) {
  402: 				shutdown(cli->cli_fd, SHUT_RDWR);
  403: 				close(cli->cli_fd);
  404: 			}
  405: 			AIT_FREE_VAL(&cli->cli_buf[1]);
  406: 			AIT_FREE_VAL(&cli->cli_buf[0]);
  407: 
  408: 			if (cli->cli_pid > 0) {
  409: 				kill(cli->cli_pid, SIGTERM);
  410: 				while (waitpid(cli->cli_pid, &stat, WNOHANG) > 0) {
  411: 					usleep(1000);
  412: 					kill(cli->cli_pid, SIGTERM);
  413: 				}
  414: 			}
  415: 
  416: 			e_free(cli);
  417: 		}
  418: 		pthread_mutex_unlock(&(*s)->sock_mtx);
  419: 
  420: 		shutdown((*s)->sock_fd, SHUT_RDWR);
  421: 		close((*s)->sock_fd);
  422: 
  423: 		AIT_FREE_VAL(&(*s)->sock_buf);
  424: 
  425: 		schedEnd(&(*s)->sock_root);
  426: 
  427: 		pthread_mutex_destroy(&(*s)->sock_mtx);
  428: 		e_free(*s);
  429: 		*s = NULL;
  430: 	}
  431: }
  432: 
  433: /*
  434:  * ioUpSocket() - Setup socket for use
  435:  *
  436:  * @s = Socket
  437:  * @arg = Server role = listen backlog queue and Client role = peer address
  438:  * @timeout = Socket timeout in sec (default -1 infinit)
  439:  * return: -1 error or 0 ok
  440:  */
  441: int
  442: ioUpSocket(sock_t * __restrict s, void *arg, int timeout)
  443: {
  444: 	int ret = 0;
  445: 	sockaddr_t *peer = (sockaddr_t*) arg;
  446: 	uintptr_t backlog = (uintptr_t) arg;
  447: 
  448: 	if (!s || !arg)
  449: 		return -1;
  450: 	else {
  451: 		s->sock_timeout.tv_sec = timeout;
  452: 		s->sock_timeout.tv_nsec = (timeout < 1) ? timeout : 0;
  453: 		schedPolling(s->sock_root, &s->sock_timeout, NULL);
  454: 	}
  455: 
  456: 	switch (s->sock_role) {
  457: 		case IO_SOCK_ROLE_CLIENT:
  458: 			memcpy(&s->sock_peer, peer, sizeof s->sock_peer);
  459: 
  460: 			if (connect(s->sock_fd, &s->sock_peer.sa, 
  461: 						s->sock_peer.sa.sa_len) == -1) {
  462: 				LOGERR;
  463: 				return -1;
  464: 			}
  465: 			break;
  466: 		case IO_SOCK_ROLE_SERVER:
  467: 			if (s->sock_type == SOCK_STREAM) {
  468: 				s->sock_backq = backlog;
  469: 
  470: 				if (listen(s->sock_fd, s->sock_backq) == -1) {
  471: 					LOGERR;
  472: 					return -1;
  473: 				}
  474: 			}
  475: 			break;
  476: 		default:
  477: 			io_SetErr(EINVAL, "Unsupported socket type");
  478: 			return -1;
  479: 	}
  480: 
  481: 	fcntl(s->sock_fd, F_SETFL, fcntl(s->sock_fd, F_GETFL) | O_NONBLOCK);
  482: 	return ret;
  483: }
  484: 
  485: /*
  486:  * ioUpdTimerSocket() - Update timeout of socket
  487:  *
  488:  * @c = Client socket
  489:  * @arg = Optional data argument
  490:  * return:  none
  491:  */
  492: void
  493: ioUpdTimerSocket(sock_cli_t * __restrict c, void *arg)
  494: {
  495: 	sock_t *s;
  496: 
  497: 	if (!c)
  498: 		return;
  499: 	else
  500: 		s = c->cli_parent;
  501: 
  502: 	schedCancelby(s->sock_root, taskTIMER, CRITERIA_DATLEN, (void*) c->cli_fd, NULL);
  503: 	schedTimer(s->sock_root, io_closeClient, c, s->sock_timeout, arg, c->cli_fd);
  504: }
  505: 
  506: /*
  507:  * ioCloseClient() - Close client socket
  508:  *
  509:  * @c = Client socket
  510:  * return: 0 ok or !=0 error
  511:  */
  512: int
  513: ioCloseClient(sock_cli_t * __restrict c)
  514: {
  515: 	sock_t *s;
  516: 
  517: 	if (!c)
  518: 		return -1;
  519: 	else
  520: 		s = c->cli_parent;
  521: 
  522: 	return !schedEvent(s->sock_root, io_closeClient, c, 0, NULL, c->cli_fd);
  523: }
  524: 
  525: /*
  526:  * ioLoopSocket() - Start socket scheduler
  527:  *
  528:  * @s = Socket
  529:  * @rcb = Read callback
  530:  * return: -1 error or return result from scheduler
  531:  */
  532: int
  533: ioLoopSocket(sock_t * __restrict s, sched_task_func_t rcb)
  534: {
  535: 	if (!s || !rcb || s->sock_kill)
  536: 		return -1;
  537: 
  538: 	schedRead(s->sock_root, io_acceptClient, s, s->sock_fd, rcb, 0);
  539: 	return schedRun(s->sock_root, &s->sock_kill);
  540: }
  541: 
  542: /*
  543:  * ioBridgeProg2Socket() - Start socket scheduler and bridge program to socket
  544:  *
  545:  * @s = Socket
  546:  * @prgname = Program name
  547:  * return: 0 ok or !=0 error
  548:  */
  549: int
  550: ioBridgeProg2Socket(sock_t * __restrict s, const char *prgname)
  551: {
  552: 	if (!s || !prgname || s->sock_kill)
  553: 		return -1;
  554: 
  555: 	schedRead(s->sock_root, io_bridgeClient, s, s->sock_fd, (void*) prgname, 0);
  556: 	return schedRun(s->sock_root, &s->sock_kill);
  557: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>