Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/echonet_app_config.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/echonet_app_config.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/echonet_app_config.h	(revision 364)
@@ -40,4 +40,8 @@
 
 #define ECHONET_TASK_STACK_SIZE	1024	/* ECNL UDPタスク用スタック領域のサイズ */
+
+#define ECHONET_API_DATAQUEUE_COUNT 5		/* ECHONET Lite API用データキュー */
+#define ECHONET_SVC_DATAQUEUE_COUNT 5		/* ECHONET Lite サービス処理タスク用データキュー */
+#define ECHONET_UDP_DATAQUEUE_COUNT 5		/* ECHONET Lite UDP通信処理用データキュー */
 
 /*
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/fdtable.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/fdtable.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/fdtable.c	(revision 364)
@@ -45,5 +45,8 @@
 #include "target_syssvc.h"
 #ifndef NTSHELL_NO_SOCKET
+#include <tinet_defs.h>
 #include <tinet_config.h>
+#include <net/net.h>
+#include <net/net_endian.h>
 #include <netinet/in.h>
 #include <netinet/in_itron.h>
@@ -55,7 +58,9 @@
 #include <net/net.h>
 #include <net/if_var.h>
+#include <netinet/udp.h>
 #include <netinet/udp_var.h>
 #include <netinet/tcp.h>
 #include <netinet/tcp_var.h>
+#include <net/net_buf.h>
 #endif
 #include "ff.h"
@@ -69,5 +74,5 @@
 #define IO_TYPE_DIR		3
 #define IO_TYPE_TCP		4
-#define IO_TYPE_UDP		5
+#define IO_TYPE_UDP	5
 
 static struct _IO_FILE fd_table[8 * sizeof(FLGPTN)] = {
@@ -85,4 +90,5 @@
 			continue;
 
+		memset(fp, 0, sizeof(struct _IO_FILE));
 		fp->fd = fd;
 		fp->type = type;
@@ -280,4 +286,15 @@
 #endif
 
+void memor(void *dst, void *src, size_t len)
+{
+	uint8_t *d = (uint8_t *)dst;
+	uint8_t *s = (uint8_t *)src;
+	uint8_t *e = &s[len];
+
+	while (s < e) {
+		*d++ |= *s++;
+	}
+}
+
 struct fd_events {
 	int count;
@@ -304,20 +321,35 @@
 	}
 
-	memcpy(&evts.readfds, rfds, sizeof(fd_set));
-	memcpy(&evts.writefds, wfds, sizeof(fd_set));
-	memcpy(&evts.errorfds, efds, sizeof(fd_set));
+	if (rfds != NULL)
+		memcpy(&evts.readfds, rfds, sizeof(fd_set));
+	else
+		memset(&evts.readfds, 0, sizeof(fd_set));
+	if (wfds != NULL)
+		memcpy(&evts.writefds, wfds, sizeof(fd_set));
+	else
+		memset(&evts.writefds, 0, sizeof(fd_set));
+	if (efds != NULL)
+		memcpy(&evts.errorfds, efds, sizeof(fd_set));
+	else
+		memset(&evts.errorfds, 0, sizeof(fd_set));
 	evts.count = 0;
 
 	ret = shell_get_evts(&evts, tmout);
+	if (rfds != NULL)
+		memset(rfds, 0, sizeof(fd_set));
+	if (wfds != NULL)
+		memset(wfds, 0, sizeof(fd_set));
+	if (efds != NULL)
+		memset(efds, 0, sizeof(fd_set));
 	if (ret == E_OK) {
-		memcpy(rfds, &evts.readfds, sizeof(fd_set));
-		memcpy(wfds, &evts.writefds, sizeof(fd_set));
-		memcpy(efds, &evts.errorfds, sizeof(fd_set));
+		if (rfds != NULL)
+			memor(rfds, &evts.readfds, sizeof(fd_set));
+		if (wfds != NULL)
+			memor(wfds, &evts.writefds, sizeof(fd_set));
+		if (efds != NULL)
+			memor(efds, &evts.errorfds, sizeof(fd_set));
 		return evts.count;
 	}
 	if (ret == E_TMOUT) {
-		memset(rfds, 0, sizeof(fd_set));
-		memset(wfds, 0, sizeof(fd_set));
-		memset(efds, 0, sizeof(fd_set));
 		return 0;
 	}
@@ -441,4 +473,6 @@
 	struct _IO_FILE *fp = tcpid_to_fd(cepid);
 	FLGPTN flgptn = 0;
+	ER ret;
+	int len;
 
 	if (fp == NULL)
@@ -449,5 +483,39 @@
 
 	switch (fncd) {
+	case TFN_TCP_RCV_BUF:
+		len = *(int *)p_parblk;
+		if (len <= 0)
+			return E_OK;
+
+		ret = wai_sem(SEM_FILEDESC);
+		if (ret < 0) {
+			syslog(LOG_ERROR, "wai_sem => %d", ret);
+		}
+		fp->psock->len += len;
+		ret = sig_sem(SEM_FILEDESC);
+		if (ret < 0) {
+			syslog(LOG_ERROR, "sig_sem => %d", ret);
+		}
+
+		if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;
+
+		set_flg(FLG_SELECT_WAIT, flgptn);
+		return E_OK;
+
 	case TFN_TCP_RCV_DAT:
+		len = *(int *)p_parblk;
+		if (len <= 0)
+			return E_OK;
+
+		ret = wai_sem(SEM_FILEDESC);
+		if (ret < 0) {
+			syslog(LOG_ERROR, "wai_sem => %d", ret);
+		}
+		fp->psock->len += len;
+		ret = sig_sem(SEM_FILEDESC);
+		if (ret < 0) {
+			syslog(LOG_ERROR, "sig_sem => %d", ret);
+		}
+
 		if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;
 
@@ -484,4 +552,5 @@
 	struct _IO_FILE *fp = udpid_to_fd(cepid);
 	FLGPTN flgptn = 0;
+	int len;
 
 	if (fp == NULL)
@@ -492,6 +561,47 @@
 
 	switch (fncd) {
+	case TEV_UDP_RCV_DAT:
+	{
+		T_UDP_RCV_DAT_PARA *udppara = (T_UDP_RCV_DAT_PARA *)p_parblk;
+		len = udppara->len;
+		if (len <= 0)
+			return E_OK;
+
+		ER ret = wai_sem(SEM_FILEDESC);
+		if (ret < 0) {
+			syslog(LOG_ERROR, "wai_sem => %d", ret);
+		}
+		fp->psock->len = len;
+		if (fp->psock->input != NULL) {
+			ret = rel_net_buf(fp->psock->input);
+			if (ret < 0) {
+				syslog(LOG_ERROR, "rel_net_buf => %d", ret);
+			}
+		}
+		fp->psock->input = udppara->input;
+		fp->psock->buf = GET_UDP_SDU(udppara->input, udppara->off);
+		memset(&fp->psock->raddr4, 0, sizeof(fp->psock->raddr4));
+		fp->psock->raddr4.sin_family = AF_INET;
+		fp->psock->raddr4.sin_port = htons(udppara->rep4.portno);
+		fp->psock->raddr4.sin_addr.s_addr = htonl(udppara->rep4.ipaddr);
+		udppara->input->flags |= NB_FLG_NOREL_IFOUT;
+		ret = sig_sem(SEM_FILEDESC);
+		if (ret < 0) {
+			syslog(LOG_ERROR, "sig_sem => %d", ret);
+		}
+
+		if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;
+
+		set_flg(FLG_SELECT_WAIT, flgptn);
+		return E_OK;
+	}
 	case TFN_UDP_CRE_CEP:
+		return E_OK;
+
 	case TFN_UDP_RCV_DAT:
+		len = *(int *)p_parblk;
+		if (len <= 0)
+			return E_OK;
+
 		if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;
 
@@ -524,101 +634,149 @@
 ER shell_get_evts(struct fd_events *evts, TMO tmout)
 {
-	ER ret;
-	FLGPTN waitptn, flgptn = 0, readfds = 0, writefds = 0;
-	struct _IO_FILE *fp = NULL;
 	int count = 0;
-
-	stdio_update_evts();
+	SYSTIM prev, now;
+
+	get_tim(&prev);
+
+	for (;;) {
+		ER ret;
+		FLGPTN waitptn, flgptn, readfds = 0, writefds = 0;
+		struct _IO_FILE *fp = NULL;
+
+		stdio_update_evts();
 
 #ifndef NTSHELL_NO_SOCKET
-	waitptn = *((FLGPTN *)&evts->errorfds);
+		waitptn = *((FLGPTN *)&evts->errorfds);
 #else
-	waitptn = *((FLGPTN *)&evts->readfds) | *((FLGPTN *)&evts->errorfds);
+		waitptn = *((FLGPTN *)&evts->readfds) | *((FLGPTN *)&evts->errorfds);
 #endif
-	for (int fd = 0; fd < fd_table_count; fd++) {
-		fp = &fd_table[fd];
+		for (int fd = 0; fd < fd_table_count; fd++) {
+			fp = &fd_table[fd];
 
 #ifndef NTSHELL_NO_SOCKET
-		if (FD_ISSET(fd, &evts->readfds)) {
-			if ((fp->type == IO_TYPE_TCP)
-				&& (GET_TCP_CEP(fp->psock->cepid)->rwbuf_count > 0)) {
-				FD_SET(fd, (fd_set *)&readfds);
-				count++;
-				if (fp->readevt_w == fp->readevt_r) fp->readevt_r--;
+			if (FD_ISSET(fd, &evts->readfds)) {
+				if ((fp->type == IO_TYPE_TCP) && (fp->psock->cepid != 0)) {
+					if (fp->psock->len == 0) {
+						ret = tcp_rcv_buf(fp->psock->cepid, &fp->psock->input, TMO_NBLK);
+						if ((ret != E_WBLK) && (ret != E_OBJ) && (ret < 0)) {
+							syslog(LOG_ERROR, "tcp_rcv_buf => %d", ret);
+							//return ret;
+						}
+						if (ret > 0) {
+							ret = wai_sem(SEM_FILEDESC);
+							if (ret < 0) {
+								syslog(LOG_ERROR, "wai_sem => %d", ret);
+							}
+							fp->psock->len += ret;
+							ret = sig_sem(SEM_FILEDESC);
+							if (ret < 0) {
+								syslog(LOG_ERROR, "sig_sem => %d", ret);
+							}
+						}
+					}
+					else ret = 1;
+					if (ret > 0) {
+						FD_SET(fd, (fd_set *)&readfds);
+						count++;
+						if (fp->readevt_w == fp->readevt_r) fp->readevt_r--;
+					}
+				}
+				else if ((fp->type == IO_TYPE_UDP) && (fp->psock->cepid != 0)) {
+					if (fp->psock->input != NULL) {
+						FD_SET(fd, (fd_set *)&readfds);
+						count++;
+						if (fp->readevt_w == fp->readevt_r) fp->readevt_r--;
+					}
+				}
+				else {
+					FD_SET(fd, (fd_set *)&waitptn);
+				}
 			}
-			else {
-				FD_SET(fd, (fd_set *)&waitptn);
+#endif
+			if (FD_ISSET(fd, &evts->writefds)) {
+				if (fp->writeevt_w == fp->writeevt_r) {
+					FD_SET(fd, (fd_set *)&writefds);
+					count++;
+					if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_r--;
+				}
+				else {
+					FD_SET(fd, (fd_set *)&waitptn);
+				}
 			}
 		}
-#endif
-		if (FD_ISSET(fd, &evts->writefds)) {
-			if (fp->writable) {
-				FD_SET(fd, (fd_set *)&writefds);
+		memset(evts, 0, sizeof(*evts));
+
+		if (waitptn == 0) {
+			memcpy(&evts->readfds, &readfds, sizeof(evts->readfds));
+			memcpy(&evts->writefds, &writefds, sizeof(evts->writefds));
+			evts->count = count;
+			return E_OK;
+		}
+		else if ((readfds | writefds) != 0) {
+			set_flg(FLG_SELECT_WAIT, (readfds | writefds));
+		}
+
+		/* イベント待ち */
+		flgptn = 0;
+		ret = twai_flg(FLG_SELECT_WAIT, waitptn, TWF_ORW, &flgptn, tmout);
+		if (ret != E_OK) {
+			if (ret != E_TMOUT) {
+				syslog(LOG_ERROR, "twai_flg => %d", ret);
+				return ret;
+			}
+
+			stdio_flgptn(&flgptn);
+
+			if (flgptn == 0)
+				return E_TMOUT;
+		}
+		flgptn &= waitptn;
+
+		/* 受け取ったフラグのみクリア */
+		ret = clr_flg(FLG_SELECT_WAIT, ~flgptn);
+		if (ret != E_OK) {
+			syslog(LOG_ERROR, "clr_flg => %d", ret);
+		}
+
+		count = 0;
+		for (int fd = 0; fd < fd_table_count; fd++) {
+			if (!FD_ISSET(fd, (fd_set *)&waitptn))
+				continue;
+
+			fp = &fd_table[fd];
+
+			if (fp->readevt_w != fp->readevt_r) {
+				fp->readevt_r++;
+				FD_SET(fd, &evts->readfds);
 				count++;
 			}
-			else {
-				FD_SET(fd, (fd_set *)&waitptn);
+			if (fp->writeevt_w != fp->writeevt_r) {
+				fp->writeevt_r++;
+				fp->writable = 1;
 			}
-		}
-	}
-	memset(evts, 0, sizeof(*evts));
-
-	if (waitptn == 0) {
-		memcpy(&evts->readfds, &readfds, sizeof(evts->readfds));
-		memcpy(&evts->writefds, &writefds, sizeof(evts->writefds));
-		evts->count = count;
-		return E_OK;
-	}
-	else if ((readfds | writefds) != 0){
-		set_flg(FLG_SELECT_WAIT, (readfds | writefds));
-	}
-
-	/* イベント待ち */
-	ret = twai_flg(FLG_SELECT_WAIT, waitptn, TWF_ORW, &flgptn, tmout);
-	if (ret != E_OK) {
-		if (ret != E_TMOUT) {
-			syslog(LOG_ERROR, "twai_flg => %d", ret);
-			return ret;
-		}
-
-		stdio_flgptn(&flgptn);
-
-		if (flgptn == 0)
+			if (fp->writable) {
+				FD_SET(fd, &evts->writefds);
+				count++;
+			}
+			if (fp->errorevt_w != fp->errorevt_r) {
+				fp->errorevt_r++;
+				FD_SET(fd, &evts->errorfds);
+				count++;
+			}
+		}
+
+		if (count > 0)
+			break;
+
+		get_tim(&now);
+
+		SYSTIM elapse = now - prev;
+		if (elapse > tmout)
 			return E_TMOUT;
-	}
-	flgptn &= waitptn;
-
-	/* 受け取ったフラグのみクリア */
-	ret = clr_flg(FLG_SELECT_WAIT, ~flgptn);
-	if (ret != E_OK) {
-		syslog(LOG_ERROR, "clr_flg => %d", ret);
-	}
-
-	count = 0;
-	for (int fd = 0; fd < fd_table_count; fd++) {
-		if (!FD_ISSET(fd, (fd_set *)&waitptn))
-			continue;
-
-		fp = &fd_table[fd];
-
-		if (fp->readevt_w != fp->readevt_r) {
-			fp->readevt_r++;
-			FD_SET(fd, &evts->readfds);
-			count++;
-		}
-		if (fp->writeevt_w != fp->writeevt_r) {
-			fp->writeevt_r++;
-			fp->writable = 1;
-		}
-		if (fp->writable) {
-			FD_SET(fd, &evts->writefds);
-			count++;
-		}
-		if (fp->errorevt_w != fp->errorevt_r) {
-			fp->errorevt_r++;
-			FD_SET(fd, &evts->errorfds);
-			count++;
-		}
-	}
+
+		prev = now;
+		tmout -= elapse;
+	}
+
 	evts->count = count;
 
@@ -676,9 +834,4 @@
 }
 
-ssize_t shell_send(int fd, const void *buf, size_t len, int flags)
-{
-	return -ENOMEM;
-}
-
 ssize_t shell_sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
 {
@@ -691,10 +844,5 @@
 }
 
-ssize_t shell_recv(int fd, void *buf, size_t len, int flags)
-{
-	return -ENOMEM;
-}
-
-ssize_t shell_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *__restrict addr, socklen_t *__restrict alen)
+ssize_t shell_recvfrom(int fd, void *__restrict buf, size_t len, int flags, struct sockaddr *__restrict addr, socklen_t *__restrict alen)
 {
 	return -ENOMEM;
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/net_misc.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/net_misc.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/net_misc.h	(revision 364)
@@ -41,5 +41,5 @@
 /* スタックサイズ */
 
-#define NET_MISC_STACK_SIZE	1024		/* NTP クライアントタスク（IPv4）のスタックサイズ	*/
+#define NET_MISC_STACK_SIZE	2048		/* NTP クライアントタスク（IPv4）のスタックサイズ	*/
 
 /* 優先度 */
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/netcmd.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/netcmd.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/netcmd.c	(revision 364)
@@ -239,6 +239,6 @@
 int usrcmd_ping(int argc, char **argv)
 {
-	int	tmo, size;
-	char	apip = DEFAULT_API_PROTO;
+	int tmo = 3, size = 64;
+	char apip = DEFAULT_API_PROTO;
 	char *line = argv[1];
 #if defined(SUPPORT_INET6)
@@ -262,4 +262,7 @@
 
 #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4)
+	if (argc <= 2)
+		return 0;
+
 	if ('0' <= *line && *line <= '9') {
 		if (*line == '6')
@@ -269,4 +272,9 @@
 		line++;
 	}
+
+	line = argv[2];
+#else
+	if (argc <= 1)
+		return 0;
 #endif	/* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */
 
@@ -276,15 +284,15 @@
 	}
 
-	line = argv[2];
-	if ('0' <= *line && *line <= '9')
-		line = get_int(&tmo, line);
-	else
-		tmo = 3;
-
-	line = argv[3];
-	if ('0' <= *line && *line <= '9')
-		line = get_int(&size, line);
-	else
-		size = 64;
+	if (argc > 2) {
+		line = argv[2];
+		if ('0' <= *line && *line <= '9')
+			line = get_int(&tmo, line);
+
+		if (argc > 3) {
+			line = argv[3];
+			if ('0' <= *line && *line <= '9')
+				line = get_int(&size, line);
+		}
+	}
 
 #if defined(SUPPORT_INET6)
@@ -337,4 +345,8 @@
 {
 	ER ret;
+
+	if (argc < 2)
+		return 0;
+
 	if (ntlibc_strcmp(argv[1], "rel") == 0) {
 		ret = dhcp4c_rel_info();
@@ -348,4 +360,5 @@
 		dhcp4c_info();
 	}
+
 	return 0;
 }
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/ntp_cli.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/ntp_cli.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/ntp_cli.c	(revision 364)
@@ -265,5 +265,5 @@
 
 	nc->buf[0] = '\0';
-#ifndef _MSC_VER
+#ifdef __NEED_struct_timespec
 	if (ctime_r(&tp.tv_sec, nc->buf) != NULL)
 #else
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.c	(revision 364)
@@ -69,9 +69,9 @@
 const struct utsname host_name = {
 	"TOPPERS/ASP3",
-    TARGET_NAME,
-    "3.2.0",
-    "3.2.0",
-    TARGET_NAME,
-    "toppers.jp"
+	TARGET_NAME,
+	"3.2.0",
+	"3.2.0",
+	TARGET_NAME,
+	"toppers.jp"
 };
 
@@ -88,7 +88,29 @@
 jmp_buf process_exit;
 void sys_init(void);
-
-void ntshell_task_init()
-{
+NTSHELL_SERIAL_READ ntshell_serial_read = 0;
+NTSHELL_SERIAL_WRITE ntshell_serial_write = 0;
+void *ntshell_serial_extobj;
+
+unsigned char ntstdio_xi(struct ntstdio_t *handle)
+{
+	unsigned char buf[1];
+	ntshell_serial_read((char *)buf, 1, ntshell_serial_extobj);
+	return buf[0];
+}
+
+void ntstdio_xo(struct ntstdio_t *handle, unsigned char c)
+{
+	char buf[1];
+	buf[0] = c;
+	ntshell_serial_write(buf, 1, ntshell_serial_extobj);
+}
+
+void ntshell_task_init(NTSHELL_SERIAL_READ func_read,
+	NTSHELL_SERIAL_WRITE func_write, void *extobj)
+{
+	ntshell_serial_read = func_read;
+	ntshell_serial_write = func_write;
+	ntshell_serial_extobj = extobj;
+
 	sys_init();
 
@@ -126,4 +148,7 @@
 	int result = 0;
 	int found = 0;
+
+	if (*args == 0)
+		return result;
 
 	if (strcmp((const char *)args[1], "help") == 0) {
@@ -295,5 +320,5 @@
 int shell_clock_getres(clockid_t clk_id, struct timespec *res)
 {
-	if (clk_id != CLOCK_REALTIME)
+	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
 		return -EINVAL;
 
@@ -308,5 +333,5 @@
 	SYSTIM now = 0;
 
-	if (clk_id != CLOCK_REALTIME)
+	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
 		return -EINVAL;
 
@@ -320,8 +345,16 @@
 int shell_clock_settime(clockid_t clk_id, const struct timespec *tp)
 {
-	if (clk_id != CLOCK_REALTIME)
+	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
 		return -EINVAL;
 
-	rtc_write(tp->tv_sec);
+	SYSTIM time;
+	ER ret;
+
+	time = (tp->tv_sec * 1000000ll) + (tp->tv_nsec / 1000ll);
+
+	ret = set_tim(time);
+	if (ret != E_OK) {
+		return -EPERM;
+	}
 
 	return 0;
@@ -356,5 +389,5 @@
 }
 
-struct sigaction sigtable[6];
+struct sigaction sigtable[7];
 
 int shell_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
@@ -381,4 +414,7 @@
 		sat = &sigtable[5];
 		break;
+	case SIGPIPE:
+		sat = &sigtable[6];
+		break;
 	default:
 		return -EINVAL;
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.cfg
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.cfg	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.cfg	(revision 364)
@@ -43,3 +43,4 @@
 CRE_TSK(NTSHELL_TASK, { TA_NULL, 0, ntshell_task, NTSHELL_PRIORITY, NTSHELL_STACK_SIZE, NULL });
 CRE_FLG(FLG_SELECT_WAIT, { TA_WMUL, 0x00 });
+CRE_SEM(SEM_FILEDESC, { TA_TPRI, 1, 1 });
 CRE_SEM(SEM_MALLOC, { TA_TPRI, 1, 1 });
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/ntshell_main.h	(revision 364)
@@ -49,4 +49,5 @@
 
 #include "usrcmd.h"
+#include "core/ntshell.h"
 
 /*
@@ -54,5 +55,5 @@
  */
 
-#define NTSHELL_PRIORITY	4		/* ntshellタスクの優先度 */
+#define NTSHELL_PRIORITY	8		/* ntshellタスクの優先度 */
 
 #define NTSHELL_STACK_SIZE	8192	/* ntshellタスクのスタック領域のサイズ */
@@ -75,10 +76,7 @@
 extern PRI main_task_priority;
 
-struct ntstdio_t;
-unsigned char ntstdio_xi(struct ntstdio_t *handle);
-void ntstdio_xo(struct ntstdio_t *handle, unsigned char c);
-
 /* ntshellタスク初期化 */
-void ntshell_task_init();
+void ntshell_task_init(NTSHELL_SERIAL_READ func_read,
+	NTSHELL_SERIAL_WRITE func_write, void *extobj);
 
 /* ntshellタスク */
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/shellif.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/shellif.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/shellif.h	(revision 364)
@@ -39,11 +39,4 @@
 
 #ifdef _MSC_VER
-#define _CRT_NO_TIME_T
-#define tm msc_tm
-#include <time.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#undef tm
 #undef NULL
 #endif
@@ -133,4 +126,8 @@
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 // time.h
 #define CLOCK_REALTIME 0
@@ -179,10 +176,9 @@
 int shell_access(const char *path, int mode);
 // signal.h
-int shell_sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict old);
-int shell_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old);
+int shell_sigprocmask(int how, const sigset_t *__restrict set, sigset_t *__restrict old);
+int shell_sigaction(int sig, const struct sigaction *__restrict sa, struct sigaction *__restrict old);
 // socket.h
 int shell_socket(int, int, int);
 int shell_connect(int, const struct sockaddr *, socklen_t);
-ssize_t shell_send(int, const void *, size_t, int);
 ssize_t shell_sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
 ssize_t shell_sendmsg(int, const struct msghdr *, int);
@@ -190,5 +186,4 @@
 int shell_listen(int, int);
 int shell_accept(int, struct sockaddr *__restrict, socklen_t *__restrict);
-ssize_t shell_recv(int, void *, size_t, int);
 ssize_t shell_recvfrom(int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
 ssize_t shell_recvmsg(int, struct msghdr *, int);
@@ -263,6 +258,6 @@
 int shell_pipe2(int [2], int);
 int shell_ppoll(struct pollfd *, nfds_t, const struct timespec *,const sigset_t *);
-int shell_pselect6(int, fd_set *restrict, fd_set *restrict,
-	fd_set *restrict, const struct timespec *restrict, const sigset_t *restrict);
+int shell_pselect6(int, fd_set *__restrict, fd_set *__restrict,
+	fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
 int shell_setpgid(pid_t, pid_t);
 int shell_setsid();
@@ -314,3 +309,7 @@
 void free(void *ptr);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SHELLIF_H */
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/socket_stub.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/socket_stub.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/socket_stub.c	(revision 364)
@@ -42,5 +42,8 @@
 #include <sil.h>
 #include "syssvc/syslog.h"
+#include <tinet_defs.h>
 #include <tinet_config.h>
+#include <net/net.h>
+#include <net/net_endian.h>
 #include <netinet/in.h>
 #include <netinet/in_itron.h>
@@ -53,4 +56,5 @@
 #include <net/if_var.h>
 #include <netinet/udp_var.h>
+#include <net/net_buf.h>
 //#include <netinet/tcp_var.h>
 #include <netapp/resolver.h>
@@ -58,4 +62,5 @@
 #include "ff.h"
 #include "socket_stub.h"
+#include "kernel_cfg.h"
 
 #define SOCKET_TIMEOUT 2000000
@@ -181,4 +186,7 @@
 			fp->psock->buf_size = 512 + 512;
 			fp->psock->buf = malloc(fp->psock->buf_size);
+#ifdef _DEBUG
+			memset(fp->psock->buf, 0, fp->psock->buf_size);
+#endif
 			T_TCP_CCEP ccep = { 0, fp->psock->buf, 512, &fp->psock->buf[512], 512, (FP)socket_tcp_callback };
 			ret = tcp_cre_cep(cepid, &ccep);
@@ -279,4 +287,7 @@
 			fp->psock->buf_size = 512 + 512;
 			fp->psock->buf = malloc(fp->psock->buf_size);
+#ifdef _DEBUG
+			memset(fp->psock->buf, 0, fp->psock->buf_size);
+#endif
 			T_TCP_CCEP ccep = { 0, fp->psock->buf, 512, &fp->psock->buf[512], 512, (FP)socket_tcp_callback };
 			ret = tcp_cre_cep(cepid, &ccep);
@@ -298,5 +309,4 @@
 			return -EHOSTUNREACH;
 		}
-		fp->writable = 1;
 		break;
 	}
@@ -322,5 +332,5 @@
 	}
 
-	memcpy(&fp->psock, &lfp->psock, sizeof(fp->psock));
+	memcpy(fp->psock, lfp->psock, offsetof(socket_t, buf_size));
 
 	ER ret;
@@ -335,4 +345,7 @@
 			fp->psock->buf_size = 512 + 512;
 			fp->psock->buf = malloc(fp->psock->buf_size);
+#ifdef _DEBUG
+			memset(fp->psock->buf, 0, fp->psock->buf_size);
+#endif
 			T_TCP_CCEP ccep = { 0, fp->psock->buf, 512, &fp->psock->buf[512], 512, (FP)socket_tcp_callback };
 			ret = tcp_cre_cep(cepid, &ccep);
@@ -346,4 +359,5 @@
 		else {
 			cepid = lfp->psock->cepid;
+			fp->handle = cepid;
 			lfp->handle = tmax_tcp_cepid + lfp->psock->repid;
 			lfp->psock->cepid = 0;
@@ -356,5 +370,4 @@
 			return -ENOMEM;
 		}
-		fp->writable = 1;
 		struct sockaddr_in *raddr = &fp->psock->raddr4;
 		memset(raddr, 0, sizeof(*raddr));
@@ -384,5 +397,5 @@
 }
 
-ssize_t shell_send(int fd, const void *buf, size_t len, int flags)
+ssize_t shell_sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
 {
 	SOCKET *fp = fd_to_fp(fd);
@@ -396,5 +409,8 @@
 		switch (fp->psock->type) {
 		case SOCK_STREAM: {
-			fp->writable = 0;
+			if ((addr != NULL) || (alen != 0)) {
+				return -EISCONN;
+			}
+
 			if (flags & MSG_OOB) {
 				ret = tcp_snd_oob(fp->psock->cepid, (void *)buf, len, SOCKET_TIMEOUT);
@@ -404,53 +420,16 @@
 			}
 			else {
-				ret = tcp_snd_dat(fp->psock->cepid, (void *)buf, len, SOCKET_TIMEOUT);
-				if (ret < 0) {
-					return -ECOMM;
-				}
-			}
-			break;
-		}
-		case SOCK_DGRAM: {
-			return -EINVAL;
-		}
-		}
-		break;
-	}
-	case AF_INET6: {
-		return -EAFNOSUPPORT;
-	}
-	}
-
-	return ret;
-}
-
-ssize_t shell_sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
-{
-	SOCKET *fp = fd_to_fp(fd);
-	if (fp == NULL) {
-		return -EBADF;
-	}
-
-	int ret = 0;
-	switch (fp->psock->family) {
-	case AF_INET: {
-		switch (fp->psock->type) {
-		case SOCK_STREAM: {
-			if ((addr != NULL) && (alen != 0)) {
-				return -EINVAL;
-			}
-
-			fp->writable = 0;
-			if (flags & MSG_OOB) {
-				ret = tcp_snd_oob(fp->psock->cepid, (void *)buf, len, SOCKET_TIMEOUT);
-				if (ret < 0) {
-					return -ECOMM;
-				}
-			}
-			else {
-				ret = tcp_snd_dat(fp->psock->cepid, (void *)buf, len, SOCKET_TIMEOUT);
-				if (ret < 0) {
-					return -ECOMM;
-				}
+				for (;;) {
+					ret = tcp_snd_dat(fp->psock->cepid, (void *)buf, len, SOCKET_TIMEOUT);
+					if (ret < 0) {
+						if (ret == E_TMOUT)
+							return -ETIME;
+						return -ECOMM;
+					}
+					len -= ret;
+					if (len <= 0)
+						break;
+					buf = (const void *)&((uint8_t *)buf)[ret];
+				} 
 			}
 			break;
@@ -458,5 +437,5 @@
 		case SOCK_DGRAM: {
 			int sz = alen;
-			if (sz < 8) {
+			if ((addr == NULL) || (sz < 8)) {
 				return -EINVAL;
 			}
@@ -465,9 +444,8 @@
 			memcpy(raddr, addr, sz);
 			T_IPV4EP rep = { ntohl(raddr->sin_addr.s_addr), ntohs(raddr->sin_port) };
-			fp->writable = 0;
 			ret = udp_snd_dat(fp->psock->cepid, &rep, (void *)buf, len,
-				(fp->psock->flags & O_NONBLOCK) ? 0 : SOCKET_TIMEOUT);
+				(fp->psock->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT);
 			if (ret < 0) {
-				return -ECOMM;
+				return (ret == E_TMOUT) ? -ETIME : -ECOMM;
 			}
 			break;
@@ -490,5 +468,5 @@
 }
 
-ssize_t shell_recv(int fd, void *buf, size_t len, int flags)
+ssize_t shell_recvfrom(int fd, void *__restrict buf, size_t len, int flags, struct sockaddr *__restrict addr, socklen_t *__restrict alen)
 {
 	SOCKET *fp = fd_to_fp(fd);
@@ -505,74 +483,127 @@
 				ret = tcp_rcv_oob(fp->psock->cepid, buf, len);
 				if (ret < 0) {
+					syslog(LOG_ERROR, "tcp_rcv_oob => %d", ret);
 					return -ECOMM;
 				}
 			}
 			else {
-				ret = tcp_rcv_dat(fp->psock->cepid, buf, len, TMO_FEVR);
+				int rsz, tmp;
+				if (fp->psock->input == NULL) {
+					ret = wai_sem(SEM_FILEDESC);
+					if (ret < 0) {
+						syslog(LOG_ERROR, "wai_sem => %d", ret);
+					}
+					fp->psock->len = 0;
+					ret = sig_sem(SEM_FILEDESC);
+					if (ret < 0) {
+						syslog(LOG_ERROR, "sig_sem => %d", ret);
+					}
+					ret = tcp_rcv_buf(fp->psock->cepid, &fp->psock->input, TMO_FEVR);
+					if (ret < 0) {
+						syslog(LOG_ERROR, "tcp_rcv_buf => %d", ret);
+						return -ECOMM;
+					}
+					rsz = ret;
+				}
+				else
+					rsz = fp->psock->len;
+				tmp = rsz;
+				if (rsz > len)
+					rsz = len;
+				if (rsz >= 0) {
+					memcpy(buf, fp->psock->input, rsz);
+					ret = wai_sem(SEM_FILEDESC);
+					if (ret < 0) {
+						syslog(LOG_ERROR, "wai_sem => %d", ret);
+					}
+					fp->psock->len = tmp - rsz;
+					ret = sig_sem(SEM_FILEDESC);
+					if (ret < 0) {
+						syslog(LOG_ERROR, "sig_sem => %d", ret);
+					}
+					if (tmp - rsz == 0) {
+						fp->psock->input = NULL;
+					}
+					else
+						fp->psock->input = (void *)&((uint8_t *)fp->psock->input)[rsz];
+					ret = tcp_rel_buf(fp->psock->cepid, rsz);
+					if ((ret != E_OBJ) && (ret < 0)) {
+						syslog(LOG_ERROR, "tcp_rel_buf => %d", ret);
+						//return -ECOMM;
+					}
+				}
+				ret = rsz;
+			}
+			break;
+		}
+		case SOCK_DGRAM: {
+			struct sockaddr_in *raddr = &fp->psock->raddr4;
+			int rsz;
+			ret = wai_sem(SEM_FILEDESC);
+			if (ret < 0) {
+				syslog(LOG_ERROR, "wai_sem => %d", ret);
+			}
+			T_NET_BUF *input = fp->psock->input;
+			if (input == NULL) {
+				ret = sig_sem(SEM_FILEDESC);
 				if (ret < 0) {
-					return -ECOMM;
-				}
-			}
-			break;
-		}
-		case SOCK_DGRAM: {
-			T_IPV4EP rep = { 0, 0 };
-			ret = udp_rcv_dat(fp->psock->cepid, &rep, buf, len, (fp->psock->flags & O_NONBLOCK) ? 0 : TMO_FEVR);
-			if (ret < 0) {
-				return -ECOMM;
-			}
-		}
-		}
-		break;
-	}
-	case AF_INET6: {
-		return -EAFNOSUPPORT;
-	}
-	}
-
-	return ret;
-}
-
-ssize_t shell_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *__restrict addr, socklen_t *__restrict alen)
-{
-	SOCKET *fp = fd_to_fp(fd);
-	if (fp == NULL) {
-		return -EBADF;
-	}
-
-	int ret = 0;
-	switch (fp->psock->family) {
-	case AF_INET: {
-		switch (fp->psock->type) {
-		case SOCK_STREAM: {
-			if (flags & MSG_OOB) {
-				ret = tcp_rcv_oob(fp->psock->cepid, buf, len);
+					syslog(LOG_ERROR, "sig_sem => %d", ret);
+				}
+
+				T_IPV4EP rep = { 0, 0 };
+				ret = udp_rcv_dat(fp->psock->cepid, &rep, buf, len,
+					(fp->psock->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT);
 				if (ret < 0) {
-					return -ECOMM;
+					syslog(LOG_ERROR, "udp_rcv_buf => %d", ret);
+					return (ret == E_TMOUT) ? -ETIME : -ECOMM;
+				}
+				rsz = ret;
+				if ((addr != NULL) && (alen != NULL)) {
+					ret = wai_sem(SEM_FILEDESC);
+					if (ret < 0) {
+						syslog(LOG_ERROR, "wai_sem => %d", ret);
+					}
+					int sz = *alen;
+					memset(raddr, 0, sizeof(fp->psock->raddr4));
+					raddr->sin_family = AF_INET;
+					raddr->sin_port = htons(rep.portno);
+					raddr->sin_addr.s_addr = htonl(rep.ipaddr);
+					if (sz > sizeof(fp->psock->raddr4))
+						sz = sizeof(fp->psock->raddr4);
+					memcpy(addr, raddr, sz);
+					*alen = sz;
+					ret = sig_sem(SEM_FILEDESC);
+					if (ret < 0) {
+						syslog(LOG_ERROR, "sig_sem => %d", ret);
+					}
 				}
 			}
 			else {
-				ret = tcp_rcv_dat(fp->psock->cepid, buf, len, TMO_FEVR);
+				rsz = fp->psock->len;
+				void *pbuf = fp->psock->buf;
+				fp->psock->input = NULL;
+				fp->psock->len = 0;
+				fp->psock->buf = NULL;
+				if ((addr != NULL) && (alen != NULL)) {
+					int sz = *alen;
+					if (sz > sizeof(fp->psock->raddr4))
+						sz = sizeof(fp->psock->raddr4);
+					memcpy(addr, raddr, sz);
+					*alen = sz;
+				}
+				ret = sig_sem(SEM_FILEDESC);
 				if (ret < 0) {
-					return -ECOMM;
-				}
-			}
-			break;
-		}
-		case SOCK_DGRAM: {
-			T_IPV4EP rep = { 0, 0 };
-			ret = udp_rcv_dat(fp->psock->cepid, &rep, buf, len, TMO_FEVR);
-			if (ret < 0) {
-				return -ECOMM;
-			}
-			int sz = *alen;
-			struct sockaddr_in raddr;
-			memset(&raddr, 0, sizeof(raddr));
-			raddr.sin_family = AF_INET;
-			raddr.sin_port = htons(rep.portno);
-			raddr.sin_addr.s_addr = htonl(rep.ipaddr);
-			if (sz > sizeof(raddr))
-				sz = sizeof(raddr);
-			memcpy(addr, &raddr, sz);
+					syslog(LOG_ERROR, "sig_sem => %d", ret);
+				}
+				if (rsz > len)
+					rsz = len;
+				memcpy(buf, pbuf, rsz);
+				ret = rel_net_buf(input);
+				if (ret < 0) {
+					syslog(LOG_ERROR, "rel_net_buf => %d", ret);
+					//return -ECOMM;
+				}
+			}
+			ret = rsz;
 		}
 		}
@@ -830,8 +861,5 @@
 int tcp_fd_close(struct _IO_FILE *fp)
 {
-	ER ret;
-
-	free(fp->psock->buf);
-	fp->psock->buf = NULL;
+	ER ret, ret2;
 
 	switch (fp->psock->family) {
@@ -844,12 +872,11 @@
 			}
 			ret = tcp_cls_cep(cepid, (fp->psock->repid != 0) ? 0 : SOCKET_TIMEOUT);
-			if (ret < 0) {
-				//return -1;
-			}
-			ret = tcp_del_cep(cepid);
+			ret2 = tcp_del_cep(cepid);
+			free(fp->psock->buf);
+			fp->psock->buf = NULL;
 			delete_tcp_fd(cepid);
 			delete_id(tcp_cepid_table, tcp_cepid_table_count, cepid);
-			if (ret < 0) {
-				return -EINVAL;
+			if ((ret < 0) || (ret2 < 0)) {
+				return (ret == E_TMOUT) ? -ETIME : -EINVAL;
 			}
 		}
@@ -857,4 +884,6 @@
 			ID repid = fp->psock->repid;
 			ret = tcp_del_rep(repid);
+			free(fp->psock->buf);
+			fp->psock->buf = NULL;
 			delete_tcp_fd(tmax_tcp_cepid + repid);
 			delete_id(tcp_repid_table, tcp_repid_table_count, repid);
@@ -864,4 +893,6 @@
 		}
 		else {
+			free(fp->psock->buf);
+			fp->psock->buf = NULL;
 			return -EINVAL;
 		}
@@ -878,10 +909,10 @@
 size_t tcp_fd_read(struct _IO_FILE *fp, unsigned char *dst, size_t dstsz)
 {
-	return shell_recv(fp->fd, dst, dstsz, 0);
+	return shell_recvfrom(fp->fd, dst, dstsz, 0, NULL, NULL);
 }
 
 size_t tcp_fd_write(struct _IO_FILE *fp, const unsigned char *src, size_t srcsz)
 {
-	return shell_send(fp->fd, src, srcsz, 0);
+	return shell_sendto(fp->fd, src, srcsz, 0, NULL, 0);
 }
 
@@ -901,11 +932,10 @@
 	ID cepid;
 
-	free(fp->psock->buf);
-	fp->psock->buf = NULL;
-
 	switch (fp->psock->family) {
 	case AF_INET: {
 		cepid = fp->psock->cepid;
 		ret = udp_del_cep(cepid);
+		//free(fp->psock->buf);
+		//fp->psock->buf = NULL;
 		delete_udp_fd(cepid);
 		delete_id(udp_cepid_table, udp_cepid_table_count, cepid);
@@ -925,10 +955,10 @@
 size_t udp_fd_read(struct _IO_FILE *fp, unsigned char *dst, size_t dstsz)
 {
-	return shell_recv(fp->fd, dst, dstsz, 0);
+	return shell_recvfrom(fp->fd, dst, dstsz, 0, NULL, NULL);
 }
 
 size_t udp_fd_write(struct _IO_FILE *fp, const unsigned char *src, size_t srcsz)
 {
-	return shell_send(fp->fd, src, srcsz, 0);
+	return shell_sendto(fp->fd, src, srcsz, 0, NULL, 0);
 }
 
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/socket_stub.h
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/socket_stub.h	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/socket_stub.h	(revision 364)
@@ -99,4 +99,6 @@
 	int buf_size;
 	unsigned char *buf;
+	void *input;
+	int len;
 } socket_t;
 
Index: asp3_tinet_ecnl_arm/trunk/ntshell/src/syscall.c
===================================================================
--- asp3_tinet_ecnl_arm/trunk/ntshell/src/syscall.c	(revision 359)
+++ asp3_tinet_ecnl_arm/trunk/ntshell/src/syscall.c	(revision 364)
@@ -201,4 +201,5 @@
 
 long SYS_futex() {
+	int futex(int *uaddr, int op, int val, const struct timespec *timeout, int *uaddr2, int val3);
 	return no_implement("futex\n");
 }
@@ -309,12 +310,9 @@
 
 long SYS_recv(long a, long b, long c, long d) {
-	return shell_recv((int)a, (void *)b, (size_t)c, (int)d);
+	return shell_recvfrom((int)a, (void *)b, (size_t)c, (int)d, NULL, NULL);
 }
 
 long SYS_recvfrom(long a, long b, long c, long d, long e, long f) {
-	if (a == 0)
-		return shell_recv(a, (void *)b, (size_t)c, (int)d);
-	else
-		return shell_recvfrom(a, (void *)b, (size_t)c, (int)d, (struct sockaddr *)e, (socklen_t *)f);
+	return shell_recvfrom(a, (void *)b, (size_t)c, (int)d, (struct sockaddr *)e, (socklen_t *)f);
 }
 
@@ -344,5 +342,5 @@
 
 long SYS_send(long a, long b, long c, long d) {
-	return shell_send((int)a, (const void *)b, (size_t)c, (int)d);
+	return shell_sendto((int)a, (const void *)b, (size_t)c, (int)d, NULL, 0);
 }
 
@@ -352,8 +350,5 @@
 
 long SYS_sendto(long a, long b, long c, long d, long e, long f) {
-	if (a == 0)
-		return shell_send(a, (const void *)b, (size_t)c, (int)d);
-	else
-		return shell_sendto(a, (const void *)b, (size_t)c, (int)d, (const struct sockaddr *)e, (socklen_t)f);
+	return shell_sendto(a, (const void *)b, (size_t)c, (int)d, (const struct sockaddr *)e, (socklen_t)f);
 }
 
@@ -422,4 +417,59 @@
 }
 
+long SYS_dup()
+{
+	return no_implement("dup\n");
+}
+
+long SYS_dup2()
+{
+	return no_implement("dup2\n");
+}
+
+long SYS_pipe()
+{
+	return no_implement("pipe\n");
+}
+
+long SYS_readlink()
+{
+	return no_implement("readlink\n");
+}
+
+long SYS_symlink()
+{
+	return no_implement("symlink\n");
+}
+
+long SYS_umask()
+{
+	return no_implement("umask\n");
+}
+
+long SYS_execve()
+{
+	return no_implement("execve\n");
+}
+
+long SYS_fork()
+{
+	return no_implement("fork\n");
+}
+
+long SYS_wait4()
+{
+	return no_implement("wait4\n");
+}
+
+long SYS_socketpair()
+{
+	return no_implement("socketpair\n");
+}
+
+long SYS_flock()
+{
+	return no_implement("flock\n");
+}
+
 long ARM_SYS_cacheflush() {
 	flash_access_cache_control();
