2007-06-30 19:05:44 +02:00
|
|
|
/****************************************************************************
|
2014-08-08 21:53:29 +02:00
|
|
|
* sched/environ/environ.h
|
2007-06-30 19:05:44 +02:00
|
|
|
*
|
2018-08-10 18:16:39 +02:00
|
|
|
* Copyright (C) 2007, 2009, 2013-2014, 2018 Gregory Nutt. All rights
|
|
|
|
* reserved.
|
2012-07-14 21:30:31 +02:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2007-06-30 19:05:44 +02:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
2009-12-14 20:30:18 +01:00
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
2007-06-30 19:05:44 +02:00
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-08-08 21:53:29 +02:00
|
|
|
#ifndef __SCHED_ENVIRON_ENVIRON_H
|
|
|
|
#define __SCHED_ENVIRON_ENVIRON_H
|
2007-06-30 19:05:44 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/sched.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
2014-10-07 15:42:36 +02:00
|
|
|
* Pre-processor Definitions
|
2007-06-30 19:05:44 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_DISABLE_ENVIRON
|
2018-08-10 18:16:39 +02:00
|
|
|
# define env_dup(group) (0)
|
|
|
|
# define env_release(group) (0)
|
2013-01-26 00:21:27 +01:00
|
|
|
#else
|
2007-06-30 19:05:44 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-10-03 00:30:35 +02:00
|
|
|
* Public Data
|
2007-06-30 19:05:44 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2013-01-26 00:21:27 +01:00
|
|
|
extern "C"
|
|
|
|
{
|
2007-06-30 19:05:44 +02:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2013-01-26 00:21:27 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
2007-06-30 21:39:17 +02:00
|
|
|
|
2018-08-10 18:16:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: env_dup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Copy the internal environment structure of a task. This is the action
|
|
|
|
* that is performed when a new task is created: The new task has a private,
|
|
|
|
* exact duplicate of the parent task's environment.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* group - The child task group to receive the newly allocated copy of the
|
|
|
|
* parent task groups environment structure.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* zero on success
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Not called from an interrupt handler.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2007-06-30 21:39:17 +02:00
|
|
|
|
2013-01-27 00:49:02 +01:00
|
|
|
int env_dup(FAR struct task_group_s *group);
|
2018-08-10 18:16:39 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: env_release
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* env_release() is called only from group_leave() when the last member of
|
|
|
|
* a task group exits. The env_release() function clears the environment
|
|
|
|
* of all name-value pairs and sets the value of the external variable
|
|
|
|
* environ to NULL.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* group - Identifies the task group containing the environment structure
|
|
|
|
* to be released.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Not called from an interrupt handler
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-27 00:49:02 +01:00
|
|
|
void env_release(FAR struct task_group_s *group);
|
2007-06-30 21:39:17 +02:00
|
|
|
|
2018-08-10 18:16:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: env_findvar
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Search the provided environment structure for the variable of the
|
|
|
|
* specified name.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* group - The task group containing environment array to be searched.
|
|
|
|
* pname - The variable name to find
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* A pointer to the name=value string in the environment
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* - Not called from an interrupt handler
|
|
|
|
* - Pre-emption is disabled by caller
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2013-01-26 00:21:27 +01:00
|
|
|
|
|
|
|
FAR char *env_findvar(FAR struct task_group_s *group, FAR const char *pname);
|
2018-08-10 18:16:39 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: env_removevar
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Remove the referenced name=value pair from the environment
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* group - The task group with the environment containing the name=value
|
|
|
|
* pair
|
|
|
|
* pvar - A pointer to the name=value pair in the restroom
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero on success
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* - Not called from an interrupt handler
|
|
|
|
* - Caller has pre-emption disabled
|
|
|
|
* - Caller will reallocate the environment structure to the correct size
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-26 00:21:27 +01:00
|
|
|
int env_removevar(FAR struct task_group_s *group, FAR char *pvar);
|
2007-06-30 19:05:44 +02:00
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-01-26 00:21:27 +01:00
|
|
|
#endif /* !CONFIG_DISABLE_ENVIRON */
|
2014-08-08 21:53:29 +02:00
|
|
|
#endif /* __SCHED_ENVIRON_ENVIRON_H */
|