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
|
|
|
*
|
2021-02-08 16:33:58 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-06-30 19:05:44 +02:00
|
|
|
*
|
2021-02-08 16:33:58 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-06-30 19:05:44 +02:00
|
|
|
*
|
2021-02-08 16:33:58 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-06-30 19:05:44 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
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
|
2022-04-04 12:11:06 +02:00
|
|
|
# define env_dup(group, envp) (0)
|
|
|
|
# define env_release(group) (0)
|
2013-01-26 00:21:27 +01:00
|
|
|
#else
|
2007-06-30 19:05:44 +02:00
|
|
|
|
2024-03-27 03:41:15 +01:00
|
|
|
# define SCHED_ENVIRON_RESERVED (4)
|
|
|
|
|
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
|
2021-02-08 18:46:31 +01:00
|
|
|
* that is performed when a new task is created:
|
|
|
|
* The new task has a private, exact duplicate of the parent task's
|
|
|
|
* environment.
|
2018-08-10 18:16:39 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* group - The child task group to receive the newly allocated copy of the
|
|
|
|
* parent task groups environment structure.
|
2022-04-04 12:11:06 +02:00
|
|
|
* envp - Pointer to the environment strings.
|
2018-08-10 18:16:39 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* zero on success
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Not called from an interrupt handler.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2007-06-30 21:39:17 +02:00
|
|
|
|
2022-04-04 12:11:06 +02:00
|
|
|
int env_dup(FAR struct task_group_s *group, FAR char * const *envp);
|
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:
|
2022-04-16 13:38:17 +02:00
|
|
|
* A index to the name=value string in the environment
|
2018-08-10 18:16:39 +02:00
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* - Not called from an interrupt handler
|
|
|
|
* - Pre-emption is disabled by caller
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2013-01-26 00:21:27 +01:00
|
|
|
|
2023-02-09 07:59:03 +01:00
|
|
|
ssize_t 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
|
2022-04-16 13:38:17 +02:00
|
|
|
* index - A index to the name=value pair in the restroom
|
2018-08-10 18:16:39 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2022-04-16 13:38:17 +02:00
|
|
|
* None
|
2018-08-10 18:16:39 +02:00
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* - Not called from an interrupt handler
|
|
|
|
* - Caller has pre-emption disabled
|
|
|
|
* - Caller will reallocate the environment structure to the correct size
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2023-02-09 07:59:03 +01:00
|
|
|
void env_removevar(FAR struct task_group_s *group, ssize_t index);
|
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 */
|