Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdio.h:Remove unnecessary header file #14697

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/net/telnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <nuttx/signal.h>
#include <nuttx/mutex.h>
#include <nuttx/fs/fs.h>
#include <nuttx/lib/lib.h>
#include <nuttx/net/net.h>
#include <nuttx/net/telnet.h>

Expand Down
52 changes: 1 addition & 51 deletions include/nuttx/fs/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include <sys/uio.h>
#include <sys/types.h>

#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -424,33 +424,6 @@ struct inode

#define FSNODE_SIZE(n) (sizeof(struct inode) + (n))

/* Definitions for custom stream operations with fopencookie. The
* implementation is as defined in Standard C library (libc). The only
* difference is that we use off_t instead of off64_t. This means
* off_t is int64_t if CONFIG_FS_LARGEFILE is defined and int32_t if not.
*
* These callbacks can either lead to custom functions if fopencookie is used
* or to standard file system functions if not.
*/

typedef CODE ssize_t cookie_read_function_t(FAR void *cookie, FAR char *buf,
size_t size);
typedef CODE ssize_t cookie_write_function_t(FAR void *cookie,
FAR const char *buf,
size_t size);
typedef CODE off_t cookie_seek_function_t(FAR void *cookie,
FAR off_t *offset,
int whence);
typedef CODE int cookie_close_function_t(FAR void *cookie);

typedef struct cookie_io_functions_t
{
FAR cookie_read_function_t *read;
FAR cookie_write_function_t *write;
FAR cookie_seek_function_t *seek;
FAR cookie_close_function_t *close;
} cookie_io_functions_t;
xiaoxiang781216 marked this conversation as resolved.
Show resolved Hide resolved

/* This is the underlying representation of an open file. A file
* descriptor is an index into an array of such types. The type associates
* the file descriptor to the file state and to a set of inode operations.
Expand Down Expand Up @@ -542,29 +515,6 @@ struct filelist
*/

#ifdef CONFIG_FILE_STREAM
struct file_struct
{
sq_entry_t fs_entry; /* Entry of file stream */
rmutex_t fs_lock; /* Recursive lock */
cookie_io_functions_t fs_iofunc; /* Callbacks to user / system functions */
FAR void *fs_cookie; /* Pointer to file descriptor / cookie struct */
#ifndef CONFIG_STDIO_DISABLE_BUFFERING
FAR char *fs_bufstart; /* Pointer to start of buffer */
FAR char *fs_bufend; /* Pointer to 1 past end of buffer */
FAR char *fs_bufpos; /* Current position in buffer */
FAR char *fs_bufread; /* Pointer to 1 past last buffered read char. */
# if CONFIG_STDIO_BUFFER_SIZE > 0
char fs_buffer[CONFIG_STDIO_BUFFER_SIZE];
# endif
#endif
uint16_t fs_oflags; /* Open mode flags */
uint8_t fs_flags; /* Stream flags */
#if CONFIG_NUNGET_CHARS > 0
uint8_t fs_nungotten; /* The number of characters buffered for ungetc */
char fs_ungotten[CONFIG_NUNGET_CHARS];
#endif
};

struct streamlist
{
mutex_t sl_lock; /* For thread safety */
Expand Down
1 change: 0 additions & 1 deletion include/nuttx/lib/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ extern "C"
/* Functions contained in lib_getstreams.c **********************************/

FAR struct streamlist *lib_get_streams(void);
FAR struct file_struct *lib_get_stream(int fd);
#endif /* CONFIG_FILE_STREAM */

/* Functions defined in lib_srand.c *****************************************/
Expand Down
1 change: 1 addition & 0 deletions include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <unistd.h> /* For getpid */
#include <signal.h> /* Needed for sigset_t, includes this file */
#include <time.h> /* Needed for struct timespec */
#include <sched.h>

#ifdef CONFIG_PTHREAD_SPINLOCKS
/* The architecture specific spinlock.h header file must provide the
Expand Down
10 changes: 10 additions & 0 deletions include/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@
size_t ss_size;
} stack_t;

#ifndef __PTHREAD_T_DEFINED
typedef pid_t pthread_t;
# define __PTHREAD_T_DEFINED 1
#endif

/****************************************************************************
* Public Function Prototypes
****************************************************************************/
Expand Down Expand Up @@ -474,6 +479,11 @@
int sigaltstack(FAR const stack_t *ss, FAR stack_t *oss);
int siginterrupt(int signo, int flag);

/* Pthread signal management APIs */

extern int pthread_kill(pthread_t thread, int sig);
extern int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);

Check failure on line 485 in include/signal.h

View workflow job for this annotation

GitHub Actions / check

Long line found

#undef EXTERN
#ifdef __cplusplus
}
Expand Down
58 changes: 56 additions & 2 deletions include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include <stdarg.h>
#include <time.h>

#include <nuttx/fs/fs.h>
#include <nuttx/lib/lib.h>
#include <nuttx/mutex.h>
#include <nuttx/queue.h>

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -109,8 +109,58 @@
* Public Type Definitions
****************************************************************************/

/* Definitions for custom stream operations with fopencookie. The
* implementation is as defined in Standard C library (libc). The only
* difference is that we use off_t instead of off64_t. This means
* off_t is int64_t if CONFIG_FS_LARGEFILE is defined and int32_t if not.
*
* These callbacks can either lead to custom functions if fopencookie is used
* or to standard file system functions if not.
*/

typedef CODE ssize_t cookie_read_function_t(FAR void *cookie, FAR char *buf,
size_t size);
typedef CODE ssize_t cookie_write_function_t(FAR void *cookie,
FAR const char *buf,
size_t size);
typedef CODE off_t cookie_seek_function_t(FAR void *cookie,
FAR off_t *offset,
int whence);
typedef CODE int cookie_close_function_t(FAR void *cookie);

typedef struct cookie_io_functions_t
{
FAR cookie_read_function_t *read;
FAR cookie_write_function_t *write;
FAR cookie_seek_function_t *seek;
FAR cookie_close_function_t *close;
} cookie_io_functions_t;

/* Streams */

struct file_struct
{
sq_entry_t fs_entry; /* Entry of file stream */
rmutex_t fs_lock; /* Recursive lock */
cookie_io_functions_t fs_iofunc; /* Callbacks to user / system functions */
FAR void *fs_cookie; /* Pointer to file descriptor / cookie struct */
#ifndef CONFIG_STDIO_DISABLE_BUFFERING
FAR char *fs_bufstart; /* Pointer to start of buffer */
FAR char *fs_bufend; /* Pointer to 1 past end of buffer */
FAR char *fs_bufpos; /* Current position in buffer */
FAR char *fs_bufread; /* Pointer to 1 past last buffered read char. */
# if CONFIG_STDIO_BUFFER_SIZE > 0
char fs_buffer[CONFIG_STDIO_BUFFER_SIZE];
# endif
#endif
uint16_t fs_oflags; /* Open mode flags */
uint8_t fs_flags; /* Stream flags */
#if CONFIG_NUNGET_CHARS > 0
uint8_t fs_nungotten; /* The number of characters buffered for ungetc */
char fs_ungotten[CONFIG_NUNGET_CHARS];
#endif
};

typedef struct file_struct FILE;

/****************************************************************************
Expand Down Expand Up @@ -263,6 +313,10 @@ int remove(FAR const char *path);
* apps/system/popen for implementation.
*/

#ifdef CONFIG_FILE_STREAM
FAR struct file_struct *lib_get_stream(int fd);
#endif

#ifndef __KERNEL__
int pclose(FILE *stream);
FILE *popen(FAR const char *command, FAR const char *mode) popen_like;
Expand Down
2 changes: 2 additions & 0 deletions libs/libc/locale/lib_iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <stdint.h>
#include <locale.h>

#include <nuttx/lib/lib.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand Down Expand Up @@ -109,7 +111,7 @@
"euckr\0ksc5601\0ksx1001\0cp949\0\0\350"
#endif
#ifdef CONFIG_LIBC_LOCALE_CODEPAGES
# include "codepages.h"

Check warning on line 114 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
#endif
};

Expand All @@ -120,42 +122,42 @@

static const unsigned short g_legacy_chars[] =
{
#include "legacychars.h"

Check warning on line 125 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
};

#ifdef CONFIG_LIBC_LOCALE_JAPANESE
static const unsigned short g_jis0208[84][94] =
{
#include "jis0208.h"

Check warning on line 131 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
};

static const unsigned short g_rev_jis[] =
{
#include "revjis.h"

Check warning on line 136 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
};
#endif

#ifdef CONFIG_LIBC_LOCALE_CHINESE
static const unsigned short g_gb18030[126][190] =
{
#include "gb18030.h"

Check warning on line 143 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
};

static const unsigned short g_big5[89][157] =
{
#include "big5.h"

Check warning on line 148 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
};

static const unsigned short g_hkscs[] =
{
#include "hkscs.h"

Check warning on line 153 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
};
#endif

#ifdef CONFIG_LIBC_LOCALE_KOREAN
static const unsigned short g_ksc[93][94] =
{
#include "ksc.h"

Check warning on line 160 in libs/libc/locale/lib_iconv.c

View workflow job for this annotation

GitHub Actions / check

#include outside of 'Included Files' section
};
#endif

Expand Down
2 changes: 2 additions & 0 deletions libs/libc/misc/lib_ftok.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <string.h>
#include <stdio.h>

#include <nuttx/lib/lib.h>

/****************************************************************************
* Public Functions
****************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions libs/libc/netdb/lib_netdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <netdb.h>
#include <stdio.h>
#include <stdbool.h>

#ifdef CONFIG_LIBC_NETDB

Expand Down
1 change: 1 addition & 0 deletions libs/libc/sched/sched_dumpstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <sys/types.h>

#include <stdio.h>
#include <sched.h>
#include <debug.h>

/****************************************************************************
Expand Down
2 changes: 2 additions & 0 deletions libs/libc/signal/sig_psignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <errno.h>
#include <unistd.h>

#include <nuttx/sched.h>

/* Uses streams... not available to kernel code */

#ifndef __KERNEL__
Expand Down
2 changes: 2 additions & 0 deletions libs/libc/stdio/lib_fgetwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <errno.h>
#include <string.h>

#include <nuttx/lib/lib.h>

#ifdef CONFIG_FILE_STREAM

/****************************************************************************
Expand Down
2 changes: 2 additions & 0 deletions libs/libc/stdio/lib_remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <unistd.h>
#include <stdio.h>

#include <nuttx/lib/lib.h>

/****************************************************************************
* Public Functions
****************************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions libs/libc/stdio/lib_ungetwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <fcntl.h>
#include <string.h>

#include <nuttx/lib/lib.h>

#ifdef CONFIG_FILE_STREAM

/****************************************************************************
Expand Down
1 change: 1 addition & 0 deletions libs/libc/stdio/lib_vasprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
****************************************************************************/

#include <nuttx/streams.h>
#include <nuttx/lib/lib.h>

/****************************************************************************
* Pre-processor Definitions
Expand Down
1 change: 1 addition & 0 deletions libs/libc/unistd/lib_getpass.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
****************************************************************************/

#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
Expand Down
Loading