Merge remote-tracking branch 'origin/master' into ieee802154
This commit is contained in:
commit
6903e5895c
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* net/socket/getsockname.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -148,11 +148,23 @@ int ipv4_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
/* The socket/connection does not know its IP address unless
|
||||
* CONFIG_NETDEV_MULTINIC is selected. Otherwise the design supports only
|
||||
* a single network device and only the network device knows the IP address.
|
||||
*/
|
||||
|
||||
if (lipaddr == 0)
|
||||
{
|
||||
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_UDP)
|
||||
outaddr->sin_family = AF_INET;
|
||||
outaddr->sin_addr.s_addr = 0;
|
||||
*addrlen = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
net_lock();
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
@ -160,7 +172,7 @@ int ipv4_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
* NOTE: listening sockets have no ripaddr. Work around is to use the
|
||||
* lipaddr when ripaddr is not available.
|
||||
*/
|
||||
`
|
||||
|
||||
if (ripaddr == 0)
|
||||
{
|
||||
ripaddr = lipaddr;
|
||||
@ -279,11 +291,23 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
/* The socket/connection does not know its IP address unless
|
||||
* CONFIG_NETDEV_MULTINIC is selected. Otherwise the design supports only
|
||||
* a single network device and only the network device knows the IP address.
|
||||
*/
|
||||
|
||||
if (net_ipv6addr_cmp(lipaddr, g_ipv6_allzeroaddr))
|
||||
{
|
||||
#if defined(NET_TCP_HAVE_STACK) || defined(NET_UDP_HAVE_STACK)
|
||||
outaddr->sin6_family = AF_INET6;
|
||||
memcpy(outaddr->sin6_addr.in6_u.u6_addr8, g_ipv6_allzeroaddr, 16);
|
||||
*addrlen = sizeof(struct sockaddr_in6);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
net_lock();
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
|
@ -53,7 +53,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pthread_mutex_unlock
|
||||
* Name: pthread_mutex_islocked
|
||||
*
|
||||
* Description:
|
||||
* Return true is the mutex is locked.
|
||||
@ -114,13 +114,13 @@ static inline bool pthread_mutex_islocked(FAR struct pthread_mutex_s *mutex)
|
||||
|
||||
int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
|
||||
{
|
||||
int ret = OK;
|
||||
int ret = EPERM;
|
||||
|
||||
sinfo("mutex=0x%p\n", mutex);
|
||||
DEBUGASSERT(mutex != NULL);
|
||||
if (mutex == NULL)
|
||||
{
|
||||
return -EINVAL;
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* Make sure the semaphore is stable while we make the following checks.
|
||||
@ -130,8 +130,10 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
|
||||
sched_lock();
|
||||
|
||||
/* The unlock operation is only performed if the mutex is actually locked.
|
||||
* If the mutex is not locked, then SUCCESS will be returned (there is
|
||||
* no error return value specified for this case).
|
||||
* EPERM *must* be returned if the mutex type is PTHREAD_MUTEX_ERRORCHECK
|
||||
* or PTHREAD_MUTEX_RECURSIVE, or the mutex is a robust mutex, and the
|
||||
* current thread does not own the mutex. Behavior is undefined for the
|
||||
* remaining case.
|
||||
*/
|
||||
|
||||
if (pthread_mutex_islocked(mutex))
|
||||
|
Loading…
Reference in New Issue
Block a user