forked from nuttx/nuttx-update
nuttx/mm and libc: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
parent
f45db0313d
commit
046e39e2c6
4 changed files with 17 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* lib/syslog/lib_setlogmask.c
|
* lib/syslog/lib_setlogmask.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
#include <arch/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
#include "syslog/syslog.h"
|
#include "syslog/syslog.h"
|
||||||
|
|
||||||
|
@ -97,11 +97,11 @@ int setlogmask(int mask)
|
||||||
* as interrupts.
|
* as interrupts.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
|
|
||||||
oldmask = g_syslog_mask;
|
oldmask = g_syslog_mask;
|
||||||
g_syslog_mask = (uint8_t)mask;
|
g_syslog_mask = (uint8_t)mask;
|
||||||
|
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
return oldmask;
|
return oldmask;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* libc/unistd/lib_gethostname.c
|
* libc/unistd/lib_gethostname.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Stavros Polymenis. All rights reserved.
|
* Copyright (C) 2015 Stavros Polymenis. All rights reserved.
|
||||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Stavros Polymenis <sp@orbitalfox.com>
|
* Author: Stavros Polymenis <sp@orbitalfox.com>
|
||||||
* Gregory Nutt <gnutt@nuttx.org>
|
* Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <arch/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
/* This file is only compiled if network support is enabled */
|
/* This file is only compiled if network support is enabled */
|
||||||
|
|
||||||
|
@ -119,9 +119,9 @@ int gethostname(FAR char *name, size_t namelen)
|
||||||
* that it could change while we are copying it.
|
* that it could change while we are copying it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
strncpy(name, g_hostname, namelen);
|
strncpy(name, g_hostname, namelen);
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
* libc/unistd/lib_gethostname.c
|
* libc/unistd/lib_gethostname.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Stavros Polymenis. All rights reserved.
|
* Copyright (C) 2015 Stavros Polymenis. All rights reserved.
|
||||||
|
* Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Stavros Polymenis <sp@orbitalfox.com>
|
* Author: Stavros Polymenis <sp@orbitalfox.com>
|
||||||
|
* Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@ -42,7 +44,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <arch/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
/* This file is only compiled if network support is enabled */
|
/* This file is only compiled if network support is enabled */
|
||||||
|
|
||||||
|
@ -118,10 +120,10 @@ int sethostname(FAR const char *name, size_t size)
|
||||||
* are setting it.
|
* are setting it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
strncpy(g_hostname, name, MIN(HOST_NAME_MAX, size));
|
strncpy(g_hostname, name, MIN(HOST_NAME_MAX, size));
|
||||||
g_hostname[HOST_NAME_MAX] = '\0';
|
g_hostname[HOST_NAME_MAX] = '\0';
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* mm/mm_gran/mm_grancritical.c
|
* mm/mm_gran/mm_grancritical.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <arch/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/mm/gran.h>
|
#include <nuttx/mm/gran.h>
|
||||||
|
|
||||||
#include "mm_gran/mm_gran.h"
|
#include "mm_gran/mm_gran.h"
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
void gran_enter_critical(FAR struct gran_s *priv)
|
void gran_enter_critical(FAR struct gran_s *priv)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_GRAN_INTR
|
#ifdef CONFIG_GRAN_INTR
|
||||||
priv->irqstate = irqsave();
|
priv->irqstate = enter_critical_section();
|
||||||
#else
|
#else
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ void gran_enter_critical(FAR struct gran_s *priv)
|
||||||
void gran_leave_critical(FAR struct gran_s *priv)
|
void gran_leave_critical(FAR struct gran_s *priv)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_GRAN_INTR
|
#ifdef CONFIG_GRAN_INTR
|
||||||
irqrestore(priv->irqstate);
|
leave_critical_section(priv->irqstate);
|
||||||
#else
|
#else
|
||||||
sem_post(&priv->exclsem);
|
sem_post(&priv->exclsem);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue