2007-06-30 19:05:44 +02:00
|
|
|
/****************************************************************************
|
2016-08-07 16:25:30 +02:00
|
|
|
* sched/environ/env_getenvironptr.c
|
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
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#ifndef CONFIG_DISABLE_ENVIRON
|
|
|
|
|
|
|
|
#include <sched.h>
|
|
|
|
#include <stdlib.h>
|
2014-08-09 01:53:55 +02:00
|
|
|
#include "sched/sched.h"
|
2007-06-30 19:05:44 +02:00
|
|
|
|
|
|
|
#undef get_environ_ptr
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2012-07-14 21:30:31 +02:00
|
|
|
* Name: get_environ_ptr
|
2007-06-30 19:05:44 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return a pointer to the thread specific environ variable.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2007-06-30 19:05:44 +02:00
|
|
|
* None
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2007-06-30 19:05:44 +02:00
|
|
|
* A pointer to the per-thread environ variable.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-10-08 03:59:14 +02:00
|
|
|
FAR char **get_environ_ptr(void)
|
2007-06-30 19:05:44 +02:00
|
|
|
{
|
2008-01-28 15:59:21 +01:00
|
|
|
#if 1
|
|
|
|
|
2012-07-14 21:30:31 +02:00
|
|
|
/* Type of internal representation of environment is incompatible with
|
|
|
|
* char ** return value.
|
|
|
|
*/
|
2008-01-28 15:59:21 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2013-02-04 23:38:59 +01:00
|
|
|
/* Return a reference to the thread-private environ in the TCB. */
|
2007-06-30 19:05:44 +02:00
|
|
|
|
2016-02-07 00:44:41 +01:00
|
|
|
FAR struct tcb_s *ptcb = this_task();
|
2007-06-30 19:05:44 +02:00
|
|
|
if (ptcb->envp)
|
|
|
|
{
|
|
|
|
return &ptcb->envp->ev_env;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-01-28 15:59:21 +01:00
|
|
|
|
|
|
|
#endif
|
2007-06-30 19:05:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_DISABLE_ENVIRON */
|