Networking: Fix some compilation issues noted with network is build with CONFIG_BUILD_KERNEL
This commit is contained in:
parent
d8d4ab8c10
commit
fca919f3d2
@ -103,7 +103,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds,
|
||||
FAR fd_set *exceptfds, FAR struct timeval *timeout)
|
||||
{
|
||||
struct pollfd *pollset;
|
||||
int errcode;
|
||||
int errcode = OK;
|
||||
int fd;
|
||||
int npfds;
|
||||
int msec;
|
||||
|
@ -204,7 +204,7 @@ int arp_wait(FAR struct arp_notify_s *notify, FAR struct timespec *timeout)
|
||||
*/
|
||||
|
||||
ret = net_timedwait(¬ify->nt_sem, &abstime);
|
||||
errcode = ((ret < 0) ? errno : 0);
|
||||
errcode = ((ret < 0) ? get_errno() : 0);
|
||||
}
|
||||
while (ret < 0 && errcode == EINTR);
|
||||
|
||||
|
@ -127,7 +127,7 @@ void igmp_waitmsg(FAR struct igmp_group_s *group, uint8_t msgid)
|
||||
* the wait is awakened by a signal.
|
||||
*/
|
||||
|
||||
ASSERT(errno == EINTR);
|
||||
ASSERT(get_errno() == EINTR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ static int local_waitlisten(FAR struct local_conn_s *server)
|
||||
ret = sem_wait(&server->lc_waitsem);
|
||||
if (ret < 0)
|
||||
{
|
||||
int errval = errno;
|
||||
int errval = get_errno();
|
||||
DEBUGASSERT(errval == EINTR);
|
||||
return -errval;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ static int local_create_fifo(FAR const char *path)
|
||||
ret = mkfifo(path, 0644);
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
DEBUGASSERT(errcode > 0);
|
||||
|
||||
ndbg("ERROR: Failed to create FIFO %s: %d\n", path, errcode);
|
||||
@ -227,7 +227,7 @@ static int local_release_fifo(FAR const char *path)
|
||||
ret = unlink(path);
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
DEBUGASSERT(errcode > 0);
|
||||
|
||||
ndbg("ERROR: Failed to unlink FIFO %s: %d\n", path, errcode);
|
||||
@ -257,7 +257,7 @@ static int local_rx_open(FAR struct local_conn_s *conn, FAR const char *path,
|
||||
conn->lc_infd = open(path, oflags);
|
||||
if (conn->lc_infd < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
DEBUGASSERT(errcode > 0);
|
||||
|
||||
ndbg("ERROR: Failed on open %s for reading: %d\n",
|
||||
@ -293,7 +293,7 @@ static int local_tx_open(FAR struct local_conn_s *conn, FAR const char *path,
|
||||
conn->lc_outfd = open(path, oflags);
|
||||
if (conn->lc_outfd < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
DEBUGASSERT(errcode > 0);
|
||||
|
||||
ndbg("ERROR: Failed on open %s for writing: %d\n",
|
||||
|
@ -88,7 +88,7 @@ int local_fifo_read(int fd, FAR uint8_t *buf, size_t *len)
|
||||
nread = read(fd, buf, remaining);
|
||||
if (nread < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
DEBUGASSERT(errcode > 0);
|
||||
|
||||
if (errcode != EINTR)
|
||||
|
@ -95,7 +95,7 @@ static int local_fifo_write(int fd, FAR const uint8_t *buf, size_t len)
|
||||
nwritten = write(fd, buf, len);
|
||||
if (nwritten < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
DEBUGASSERT(errcode > 0);
|
||||
|
||||
if (errcode != EINTR)
|
||||
|
@ -989,7 +989,7 @@ int netdev_ioctl(int sockfd, int cmd, unsigned long arg)
|
||||
/* On failure, set the errno and return -1 */
|
||||
|
||||
errout:
|
||||
errno = -ret;
|
||||
set_errno(-ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ static inline int psock_tcp_connect(FAR struct socket *psock,
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -errno;
|
||||
ret = -get_errno();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -641,7 +641,7 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
|
||||
return OK;
|
||||
|
||||
errout:
|
||||
errno = err;
|
||||
set_errno(err);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ int net_dupsd(int sockfd, int minsd)
|
||||
|
||||
errout:
|
||||
sched_unlock();
|
||||
errno = err;
|
||||
set_errno(err);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ int dup2(int sockfd1, int sockfd2)
|
||||
|
||||
errout:
|
||||
sched_unlock();
|
||||
errno = err;
|
||||
set_errno(err);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvcon
|
||||
pstate->snd_foffset + pstate->snd_sent, SEEK_SET);
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
nlldbg("failed to lseek: %d\n", errcode);
|
||||
pstate->snd_sent = -errcode;
|
||||
goto end_wait;
|
||||
@ -382,7 +382,7 @@ static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvcon
|
||||
ret = file_read(pstate->snd_file, dev->d_appdata, sndlen);
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
int errcode = get_errno();
|
||||
nlldbg("failed to read from input file: %d\n", errcode);
|
||||
pstate->snd_sent = -errcode;
|
||||
goto end_wait;
|
||||
|
@ -280,9 +280,10 @@ int net_vfcntl(int sockfd, int cmd, va_list ap)
|
||||
errout:
|
||||
if (err != 0)
|
||||
{
|
||||
errno = err;
|
||||
set_errno(err);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1206,7 +1206,7 @@ static void recvfrom_init(FAR struct socket *psock, FAR void *buf,
|
||||
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_TCP)
|
||||
static ssize_t recvfrom_result(int result, struct recvfrom_s *pstate)
|
||||
{
|
||||
int save_errno = errno; /* In case something we do changes it */
|
||||
int save_errno = get_errno(); /* In case something we do changes it */
|
||||
|
||||
/* Check for a error/timeout detected by the interrupt handler. Errors are
|
||||
* signaled by negative errno values for the rcv length
|
||||
|
@ -288,7 +288,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_UDP)
|
||||
#if defined(CONFIG_NET_LOCAL) && !defined(CONFIG_NET_LOCAL_STREAM) && !defined(CONFIG_NET_LOCAL_DGRAM)
|
||||
UNUSED(ipdomain);
|
||||
#endif
|
||||
|
||||
|
@ -86,7 +86,7 @@ static void _net_takesem(void)
|
||||
* awakened by a signal.
|
||||
*/
|
||||
|
||||
ASSERT(errno == EINTR);
|
||||
ASSERT(get_errno() == EINTR);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user