net: Disable priority inheritance on all semaphores used for signaling
This commit is contained in:
parent
4fcbe8e410
commit
2d057c28c8
18 changed files with 160 additions and 20 deletions
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/arp/arp_notify.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,8 +47,9 @@
|
|||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
#include "arp/arp.h"
|
||||
|
||||
|
@ -88,7 +89,13 @@ void arp_wait_setup(in_addr_t ipaddr, FAR struct arp_notify_s *notify)
|
|||
|
||||
notify->nt_ipaddr = ipaddr;
|
||||
notify->nt_result = -ETIMEDOUT;
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(¬ify->nt_sem, 0, 0);
|
||||
sem_setprotocol(¬ify->nt_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Add the wait structure to the list with interrupts disabled */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/arp/arp_send.c
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
|
@ -294,7 +295,13 @@ int arp_send(in_addr_t ipaddr)
|
|||
* disabled
|
||||
*/
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
||||
sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.snd_retries = 0; /* No retries yet */
|
||||
state.snd_ipaddr = ipaddr; /* IP address to query */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/icmp/icmp_ping.c
|
||||
*
|
||||
* Copyright (C) 2008-2012, 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2012, 2014-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include <net/if.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semahore.h>
|
||||
#include <nuttx/net/netconfig.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
@ -364,7 +365,13 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen,
|
|||
|
||||
/* Initialize the state structure */
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&state.png_sem, 0, 0);
|
||||
sem_setprotocol(&state.png_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.png_ticks = DSEC2TICK(dsecs); /* System ticks to wait */
|
||||
state.png_result = -ENOMEM; /* Assume allocation failure */
|
||||
state.png_addr = addr; /* Address of the peer to be ping'ed */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/icmpv6/icmpv6_autoconfig.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,6 +47,7 @@
|
|||
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
||||
|
@ -208,7 +209,12 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise)
|
|||
* disabled
|
||||
*/
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
||||
sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE);
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
/* Remember the routing device name */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/icmpv6/icmpv6_neighbor.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
|
@ -307,8 +308,14 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
|
|||
* disabled
|
||||
*/
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
||||
state.snd_retries = 0; /* No retries yet */
|
||||
sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.snd_retries = 0; /* No retries yet */
|
||||
net_ipv6addr_copy(state.snd_ipaddr, lookup); /* IP address to query */
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/icmpv6/icmpv6_notify.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,8 +47,9 @@
|
|||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
#include "icmpv6/icmpv6.h"
|
||||
|
||||
|
@ -101,7 +102,13 @@ void icmpv6_wait_setup(const net_ipv6addr_t ipaddr,
|
|||
|
||||
net_ipv6addr_copy(notify->nt_ipaddr, ipaddr);
|
||||
notify->nt_result = -ETIMEDOUT;
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(¬ify->nt_sem, 0, 0);
|
||||
sem_setprotocol(¬ify->nt_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Add the wait structure to the list with interrupts disabled */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/icmpv6/icmpv6_ping.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -50,6 +50,7 @@
|
|||
#include <net/if.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/netconfig.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
@ -437,7 +438,13 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno,
|
|||
|
||||
/* Initialize the state structure */
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&state.png_sem, 0, 0);
|
||||
sem_setprotocol(&state.png_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.png_ticks = DSEC2TICK(dsecs); /* System ticks to wait */
|
||||
state.png_result = -ENOMEM; /* Assume allocation failure */
|
||||
state.png_id = id; /* The ID to use in the ECHO request */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/icmpv6/icmpv6_rnotify.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,9 +47,10 @@
|
|||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "netdev/netdev.h"
|
||||
#include "utils/utils.h"
|
||||
|
@ -166,7 +167,13 @@ void icmpv6_rwait_setup(FAR struct net_driver_s *dev,
|
|||
|
||||
memcpy(notify->rn_ifname, dev->d_ifname, IFNAMSIZ);
|
||||
notify->rn_result = -ETIMEDOUT;
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(¬ify->rn_sem, 0, 0);
|
||||
sem_setprotocol(¬ify->rn_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Add the wait structure to the list with interrupts disabled */
|
||||
|
||||
|
@ -183,7 +190,13 @@ void icmpv6_rwait_setup(FAR struct net_driver_s *dev,
|
|||
/* Initialize and remember wait structure */
|
||||
|
||||
notify->rn_result = -ETIMEDOUT;
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(¬ify->rn_sem, 0, 0);
|
||||
sem_setprotocol(¬ify->rn_sem, SEM_PRIO_NONE);
|
||||
|
||||
DEBUGASSERT(g_icmpv6_rwaiters == NULL);
|
||||
g_icmpv6_rwaiters = notify;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* net/igmp/igmp_group.c
|
||||
* IGMP group data structure management logic
|
||||
*
|
||||
* Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 2013-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* The NuttX implementation of IGMP was inspired by the IGMP add-on for the
|
||||
|
@ -55,6 +55,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
#include <nuttx/net/igmp.h>
|
||||
|
@ -240,7 +241,13 @@ FAR struct igmp_group_s *igmp_grpalloc(FAR struct net_driver_s *dev,
|
|||
/* Initialize the non-zero elements of the group structure */
|
||||
|
||||
net_ipv4addr_copy(group->grpaddr, *addr);
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&group->sem, 0, 0);
|
||||
sem_setprotocol(&group->sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Initialize the group timer (but don't start it yet) */
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/local/local_conn.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
|
||||
#include "local/local.h"
|
||||
|
||||
|
@ -92,8 +93,15 @@ FAR struct local_conn_s *local_alloc(void)
|
|||
|
||||
conn->lc_infd = -1;
|
||||
conn->lc_outfd = -1;
|
||||
|
||||
#ifdef CONFIG_NET_LOCAL_STREAM
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&conn->lc_waitsem, 0, 0);
|
||||
sem_setprotocol(&conn->lc_waitsem, SEM_PRIO_NONE);
|
||||
|
||||
#ifdef HAVE_LOCAL_POLL
|
||||
memset(conn->lc_accept_fds, 0, sizeof(conn->lc_accept_fds));
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/****************************************************************************
|
||||
* net/pkt/pkt_send.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -52,6 +53,7 @@
|
|||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
|
@ -245,7 +247,14 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf,
|
|||
|
||||
save = net_lock();
|
||||
memset(&state, 0, sizeof(struct send_s));
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
||||
(void)sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.snd_sock = psock; /* Socket descriptor to use */
|
||||
state.snd_buflen = len; /* Number of bytes to send */
|
||||
state.snd_buffer = buf; /* Buffer to send from */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/socket/connect.c
|
||||
*
|
||||
* Copyright (C) 2007-2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2012, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -49,6 +49,8 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/udp.h>
|
||||
|
@ -107,7 +109,13 @@ static inline int psock_setup_callbacks(FAR struct socket *psock,
|
|||
|
||||
/* Initialize the TCP state structure */
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(&pstate->tc_sem, 0, 0); /* Doesn't really fail */
|
||||
(void)sem_setprotocol(&pstate->tc_sem, SEM_PRIO_NONE);
|
||||
|
||||
pstate->tc_conn = conn;
|
||||
pstate->tc_psock = psock;
|
||||
pstate->tc_result = -EAGAIN;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/socket/net_close.c
|
||||
*
|
||||
* Copyright (C) 2007-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -49,6 +49,8 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/tcp.h>
|
||||
|
@ -388,7 +390,13 @@ static inline int netclose_disconnect(FAR struct socket *psock)
|
|||
|
||||
state.cl_psock = psock;
|
||||
state.cl_result = -EBUSY;
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&state.cl_sem, 0, 0);
|
||||
sem_setprotocol(&state.cl_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Record the time that we started the wait (in ticks) */
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
@ -673,9 +674,15 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset,
|
|||
*/
|
||||
|
||||
save = net_lock();
|
||||
|
||||
memset(&state, 0, sizeof(struct sendfile_s));
|
||||
sem_init(&state. snd_sem, 0, 0); /* Doesn't really fail */
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
||||
sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.snd_sock = psock; /* Socket descriptor to use */
|
||||
state.snd_foffset = offset ? *offset : 0; /* Input file offset */
|
||||
state.snd_flen = count; /* Number of bytes to send */
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/iob.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
@ -1217,7 +1218,14 @@ static void recvfrom_init(FAR struct socket *psock, FAR void *buf,
|
|||
/* Initialize the state structure. */
|
||||
|
||||
memset(pstate, 0, sizeof(struct recvfrom_s));
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(&pstate->rf_sem, 0, 0); /* Doesn't really fail */
|
||||
(void)sem_setprotocol(&pstate->rf_sem, SEM_PRIO_NONE);
|
||||
|
||||
pstate->rf_buflen = len;
|
||||
pstate->rf_buffer = buf;
|
||||
pstate->rf_from = infrom;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* net/tcp/tcp_accept.c
|
||||
*
|
||||
* Copyright (C) 2007-2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2012, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -49,6 +49,7 @@
|
|||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
#include "socket/socket.h"
|
||||
|
@ -279,7 +280,13 @@ int psock_tcp_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
state.acpt_addrlen = addrlen;
|
||||
state.acpt_newconn = NULL;
|
||||
state.acpt_result = OK;
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&state.acpt_sem, 0, 0);
|
||||
sem_setprotocol(&state.acpt_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Set up the callback in the connection */
|
||||
|
||||
|
|
|
@ -52,7 +52,9 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/arp.h>
|
||||
|
@ -792,7 +794,14 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
|
|||
|
||||
save = net_lock();
|
||||
memset(&state, 0, sizeof(struct send_s));
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
(void)sem_init(&state.snd_sem, 0, 0); /* Doesn't really fail */
|
||||
(void)sem_setprotocol(&state.snd_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.snd_sock = psock; /* Socket descriptor to use */
|
||||
state.snd_buflen = len; /* Number of bytes to send */
|
||||
state.snd_buffer = buf; /* Buffer to send from */
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <debug.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/udp.h>
|
||||
|
@ -391,7 +392,14 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||
|
||||
save = net_lock();
|
||||
memset(&state, 0, sizeof(struct sendto_s));
|
||||
|
||||
/* This semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_init(&state.st_sem, 0, 0);
|
||||
sem_setprotocol(&state.st_sem, SEM_PRIO_NONE);
|
||||
|
||||
state.st_buflen = len;
|
||||
state.st_buffer = buf;
|
||||
|
||||
|
|
Loading…
Reference in a new issue