You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2021/02/21 12:33:11 UTC
[incubator-nuttx] branch master updated (092d23b -> 35ec84f)
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 092d23b pthread: Change the default name from <pthread> to <0xyyyyyyyy>
new f3043d1 netdb: Don't call _NX_RECV and _NX_SEND
new 35ec84f Remove the duplicated _NX_ and _MQ_ macro
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
include/nuttx/mqueue.h | 6 ------
include/nuttx/net/net.h | 4 ----
libs/libc/netdb/lib_dnsquery.c | 8 ++++----
libs/libnx/nxmu/nx_eventhandler.c | 4 ++--
libs/libnx/nxmu/nxmu_sendserver.c | 4 +++-
5 files changed, 9 insertions(+), 17 deletions(-)
[incubator-nuttx] 02/02: Remove the duplicated _NX_ and _MQ_ macro
Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 35ec84ffca83ccdb00cc3e868808e75a174b62cc
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Feb 15 22:29:45 2021 +0800
Remove the duplicated _NX_ and _MQ_ macro
reuse the definition come from include/nuttx/fs/fs.h
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
include/nuttx/mqueue.h | 6 ------
include/nuttx/net/net.h | 4 ----
libs/libnx/nxmu/nx_eventhandler.c | 4 ++--
libs/libnx/nxmu/nxmu_sendserver.c | 4 +++-
4 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h
index ac6d961..6a880b2 100644
--- a/include/nuttx/mqueue.h
+++ b/include/nuttx/mqueue.h
@@ -67,9 +67,6 @@
# define _MQ_TIMEDSEND(d,m,l,p,t) nxmq_timedsend(d,m,l,p,t)
# define _MQ_RECEIVE(d,m,l,p) nxmq_receive(d,m,l,p)
# define _MQ_TIMEDRECEIVE(d,m,l,p,t) nxmq_timedreceive(d,m,l,p,t)
-# define _MQ_GETERRNO(r) (-(r))
-# define _MQ_SETERRNO(r) set_errno(-(r))
-# define _MQ_GETERRVAL(r) (r)
#else
# define _MQ_OPEN mq_open
# define _MQ_CLOSE(d) mq_close(d)
@@ -78,9 +75,6 @@
# define _MQ_TIMEDSEND(d,m,l,p,t) mq_timedsend(d,m,l,p,t)
# define _MQ_RECEIVE(d,m,l,p) mq_receive(d,m,l,p)
# define _MQ_TIMEDRECEIVE(d,m,l,p,t) mq_timedreceive(d,m,l,p,t)
-# define _MQ_GETERRNO(r) errno
-# define _MQ_SETERRNO(r)
-# define _MQ_GETERRVAL(r) (-errno)
#endif
/****************************************************************************
diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h
index fca8a07..a609291 100644
--- a/include/nuttx/net/net.h
+++ b/include/nuttx/net/net.h
@@ -71,14 +71,10 @@
# define _NX_SEND(s,b,l,f) nx_send(s,b,l,f)
# define _NX_RECV(s,b,l,f) nx_recv(s,b,l,f)
# define _NX_RECVFROM(s,b,l,f,a,n) nx_recvfrom(s,b,l,f,a,n)
-# define _NX_GETERRNO(r) (-(r))
-# define _NX_GETERRVAL(r) (r)
#else
# define _NX_SEND(s,b,l,f) send(s,b,l,f)
# define _NX_RECV(s,b,l,f) recv(s,b,l,f)
# define _NX_RECVFROM(s,b,l,f,a,n) recvfrom(s,b,l,f,a,n)
-# define _NX_GETERRNO(r) errno
-# define _NX_GETERRVAL(r) (-errno)
#endif
/* Socket descriptors are the index into the TCB sockets list, offset by the
diff --git a/libs/libnx/nxmu/nx_eventhandler.c b/libs/libnx/nxmu/nx_eventhandler.c
index 77160ac..e6bcbb2 100644
--- a/libs/libnx/nxmu/nx_eventhandler.c
+++ b/libs/libnx/nxmu/nx_eventhandler.c
@@ -134,7 +134,7 @@ int nx_eventhandler(NXHANDLE handle)
nbytes = _MQ_RECEIVE(conn->crdmq, buffer, NX_MXCLIMSGLEN, 0);
if (nbytes < 0)
{
- int errcode = _MQ_GETERRNO(nbytes);
+ int errcode = _NX_GETERRNO(nbytes);
/* EINTR is not an error. The wait was interrupted by a signal and
* we just need to try reading again.
@@ -154,7 +154,7 @@ int nx_eventhandler(NXHANDLE handle)
else
{
gerr("ERROR: _MQ_RECEIVE failed: %d\n", errcode);
- _MQ_SETERRNO(nbytes);
+ _NX_SETERRNO(nbytes);
return ERROR;
}
}
diff --git a/libs/libnx/nxmu/nxmu_sendserver.c b/libs/libnx/nxmu/nxmu_sendserver.c
index c31de97..9216657 100644
--- a/libs/libnx/nxmu/nxmu_sendserver.c
+++ b/libs/libnx/nxmu/nxmu_sendserver.c
@@ -86,7 +86,9 @@ int nxmu_sendserver(FAR struct nxmu_conn_s *conn, FAR const void *msg,
ret = _MQ_SEND(conn->cwrmq, msg, msglen, NX_SVRMSG_PRIO);
if (ret < 0)
{
- gerr("ERROR: _MQ_SEND failed: %d\n", _MQ_GETERRNO(ret));
+ _NX_SETERRNO(ret);
+ gerr("ERROR: _MQ_SEND failed: %d\n", _NX_GETERRNO(ret));
+ ret = ERROR;
}
return ret;
[incubator-nuttx] 01/02: netdb: Don't call _NX_RECV and _NX_SEND
Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit f3043d133eb892a64c93b4029acf2198d362ae5a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Feb 16 00:12:01 2021 +0800
netdb: Don't call _NX_RECV and _NX_SEND
since netdb should only be called from userspace
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
libs/libc/netdb/lib_dnsquery.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libs/libc/netdb/lib_dnsquery.c b/libs/libc/netdb/lib_dnsquery.c
index bcf777d..a42bcb8 100644
--- a/libs/libc/netdb/lib_dnsquery.c
+++ b/libs/libc/netdb/lib_dnsquery.c
@@ -301,10 +301,10 @@ static int dns_send_query(int sd, FAR const char *name,
return ret;
}
- ret = _NX_SEND(sd, buffer, dest - buffer, 0);
+ ret = send(sd, buffer, dest - buffer, 0);
if (ret < 0)
{
- ret = -_NX_GETERRNO(ret);
+ ret = -errno;
nerr("ERROR: sendto failed: %d\n", ret);
return ret;
}
@@ -346,10 +346,10 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int naddr,
/* Receive the response */
- ret = _NX_RECV(sd, buffer, RECV_BUFFER_SIZE, 0);
+ ret = recv(sd, buffer, RECV_BUFFER_SIZE, 0);
if (ret < 0)
{
- ret = -_NX_GETERRNO(ret);
+ ret = -errno;
nerr("ERROR: recv failed: %d\n", ret);
return ret;
}