2008-02-05 18:13:13 +00:00
|
|
|
/****************************************************************************
|
2022-12-21 15:13:14 +02:00
|
|
|
* libs/libc/stdio/lib_libgetstreams.c
|
2007-02-17 23:21:28 +00:00
|
|
|
*
|
2020-05-09 09:05:29 -06: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-02-17 23:21:28 +00:00
|
|
|
*
|
2020-05-09 09:05:29 -06:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-17 23:21:28 +00:00
|
|
|
*
|
2020-05-09 09:05:29 -06: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-02-17 23:21:28 +00:00
|
|
|
*
|
2008-02-05 18:13:13 +00:00
|
|
|
****************************************************************************/
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2008-02-05 18:13:13 +00:00
|
|
|
/****************************************************************************
|
2007-02-17 23:21:28 +00:00
|
|
|
* Included Files
|
2008-02-05 18:13:13 +00:00
|
|
|
****************************************************************************/
|
2007-02-17 23:21:28 +00:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2021-05-18 14:59:14 +08:00
|
|
|
#include <assert.h>
|
|
|
|
|
2022-12-21 15:13:14 +02:00
|
|
|
#include <nuttx/tls.h>
|
2023-05-30 12:51:09 +08:00
|
|
|
#include <nuttx/lib/lib.h>
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2020-08-13 18:17:29 +08:00
|
|
|
#ifdef CONFIG_FILE_STREAM
|
2020-05-09 09:05:29 -06:00
|
|
|
|
2008-02-05 18:13:13 +00:00
|
|
|
/****************************************************************************
|
2007-02-17 23:21:28 +00:00
|
|
|
* Public Functions
|
2008-02-05 18:13:13 +00:00
|
|
|
****************************************************************************/
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2008-02-05 18:13:13 +00:00
|
|
|
/****************************************************************************
|
2022-12-21 15:13:14 +02:00
|
|
|
* Name: lib_get_streams
|
2007-02-17 23:21:28 +00:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return a pointer to the streams list for this thread
|
|
|
|
*
|
2018-03-13 09:52:27 -06:00
|
|
|
* Input Parameters:
|
2007-02-17 23:21:28 +00:00
|
|
|
* None
|
|
|
|
*
|
2018-02-01 10:00:02 -06:00
|
|
|
* Returned Value:
|
2007-02-17 23:21:28 +00:00
|
|
|
* A pointer to the errno.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
*
|
2008-02-05 18:13:13 +00:00
|
|
|
****************************************************************************/
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2022-12-21 15:13:14 +02:00
|
|
|
FAR struct streamlist *lib_get_streams(void)
|
2007-02-17 23:21:28 +00:00
|
|
|
{
|
2022-12-21 15:13:14 +02:00
|
|
|
FAR struct task_info_s *info;
|
2013-01-26 22:25:21 +00:00
|
|
|
|
2022-12-21 15:13:14 +02:00
|
|
|
info = task_get_info();
|
|
|
|
return &info->ta_streamlist;
|
2014-04-13 14:32:20 -06:00
|
|
|
}
|
2007-02-17 23:21:28 +00:00
|
|
|
|
2023-03-02 12:53:29 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: lib_get_stream
|
|
|
|
*
|
|
|
|
* Description:
|
2023-07-13 22:55:12 +08:00
|
|
|
* Return a pointer to the file stream for this thread and given fd.
|
2023-03-02 12:53:29 +08:00
|
|
|
* Note: only reserved fd number 0/1/2 is valid.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct file_struct *lib_get_stream(int fd)
|
|
|
|
{
|
|
|
|
return &lib_get_streams()->sl_std[fd];
|
|
|
|
}
|
|
|
|
|
2020-08-13 18:17:29 +08:00
|
|
|
#endif /* CONFIG_FILE_STREAM */
|