Fix a test for valid scheduling policies

This commit is contained in:
Gregory Nutt 2015-07-24 10:20:22 -06:00
parent 4490744def
commit c6c424583d
3 changed files with 10 additions and 50 deletions

@ -1 +1 @@
Subproject commit 0ac15c4ce3c71f25aa923eebb0529dd571850f4a
Subproject commit 5a5b086ac14ebab6619e53e15b8e4801142dec58

View File

@ -1,7 +1,7 @@
/****************************************************************************
* 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>
*
* Redistribution and use in source and binary forms, with or without
@ -45,26 +45,6 @@
#include <debug.h>
#include <errno.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Type Declarations
****************************************************************************/
/****************************************************************************
* Global Variables
****************************************************************************/
/****************************************************************************
* Private Variables
****************************************************************************/
/****************************************************************************
* Private 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);
if (!attr ||
(policy != SCHED_FIFO
#if CONFIG_RR_INTERVAL > 0
if (!attr || (policy != SCHED_FIFO && policy != SCHED_RR))
#else
if (!attr || policy != SCHED_FIFO )
&& policy != SCHED_RR
#endif
#ifdef CONFIG_SCHED_SPORADIC
&& policy != SCHED_SPORADIC
#endif
))
{
ret = EINVAL;
}

View File

@ -48,30 +48,6 @@
#include "sched/sched.h"
#include "clock/clock.h"
/************************************************************************
* Pre-processor Definitions
************************************************************************/
/************************************************************************
* Private Type Declarations
************************************************************************/
/************************************************************************
* Global Variables
************************************************************************/
/************************************************************************
* Private Variables
************************************************************************/
/************************************************************************
* Private Function Prototypes
************************************************************************/
/************************************************************************
* Private Functions
************************************************************************/
/************************************************************************
* Public Functions
************************************************************************/
@ -126,7 +102,7 @@ int sched_rr_get_interval(pid_t pid, struct timespec *interval)
return ERROR;
}
/* Otherwise, lookup the TCB associated with this pid */
/* Otherwise, lookup the TCB associated with this PID */
else
{