mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
Fix a test for valid scheduling policies
This commit is contained in:
+1
-1
Submodule Documentation updated: 0ac15c4ce3...5a5b086ac1
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrsetschedpolicy.c
|
* libc/pthread/pthread_attrsetschedpolicy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011, 2015 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
|
||||||
@@ -45,26 +45,6 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Type Declarations
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Global Variables
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Variables
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -92,11 +72,15 @@ int pthread_attr_setschedpolicy(FAR pthread_attr_t *attr, int policy)
|
|||||||
|
|
||||||
sdbg("attr=0x%p policy=%d\n", attr, policy);
|
sdbg("attr=0x%p policy=%d\n", attr, policy);
|
||||||
|
|
||||||
|
if (!attr ||
|
||||||
|
(policy != SCHED_FIFO
|
||||||
#if CONFIG_RR_INTERVAL > 0
|
#if CONFIG_RR_INTERVAL > 0
|
||||||
if (!attr || (policy != SCHED_FIFO && policy != SCHED_RR))
|
&& policy != SCHED_RR
|
||||||
#else
|
|
||||||
if (!attr || policy != SCHED_FIFO )
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_SPORADIC
|
||||||
|
&& policy != SCHED_SPORADIC
|
||||||
|
#endif
|
||||||
|
))
|
||||||
{
|
{
|
||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,30 +48,6 @@
|
|||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "clock/clock.h"
|
#include "clock/clock.h"
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Private Type Declarations
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Global Variables
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Private Variables
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
@@ -126,7 +102,7 @@ int sched_rr_get_interval(pid_t pid, struct timespec *interval)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, lookup the TCB associated with this pid */
|
/* Otherwise, lookup the TCB associated with this PID */
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user