diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index fc51da59208..44445e8ce0d 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

NuttX Operating System

User's Manual

by

Gregory Nutt

-

Last Updated: October 4, 2014

+

Last Updated: November 5, 2014

@@ -7629,11 +7629,12 @@ interface of the same name.
  • 2.10.3 Directory Operations
  • 2.10.4 UNIX Standard Operations
  • 2.10.5 Standard I/O
  • -
  • 2.10.6 Asynchronous I/O
  • -
  • 2.10.7 Standard String Operations
  • -
  • 2.10.8 Pipes and FIFOs
  • -
  • 2.10.9 FAT File System Support
  • -
  • 2.10.10 mmap() and eXecute In Place (XIP)
  • +
  • 2.10.6 Standard Library
  • +
  • 2.10.7 Asynchronous I/O
  • +
  • 2.10.8 Standard String Operations
  • +
  • 2.10.9 Pipes and FIFOs
  • +
  • 2.10.10 FAT File System Support
  • +
  • 2.10.11 mmap() and eXecute In Place (XIP)
  • 2.10.1 NuttX File System Overview

    @@ -7953,6 +7954,8 @@ int dprintf(int fd, FAR const char *fmt, ...); int vdprintf(int fd, FAR const char *fmt, va_list ap); int statfs(FAR const char *path, FAR struct statfs *buf); +FAR char *tmpnam(FAR char *s); +FAR char *tempnam(FAR const char *dir, FAR const char *pfx); #include <sys/stat.h> @@ -7967,7 +7970,19 @@ int statfs(const char *path, struct statfs *buf); int fstatfs(int fd, struct statfs *buf); -

    2.10.6 Asynchronous I/O

    +

    2.10.6 Standard Library

    +

    + stdlib.h generally addresses other operating system interfaces. + However, the following may also be considered as file system interfaces: +

    + + +

    2.10.7 Asynchronous I/O

    -

    2.10.7 Standard String Operations

    +

    2.10.8 Standard String Operations

    -

    2.10.8 Pipes and FIFOs

    +

    2.10.9 Pipes and FIFOs

    -

    2.10.8.1 pipe

    +

    2.10.9.1 pipe

    Function Prototype:

    @@ -8053,7 +8068,7 @@ int pipe(int fd[2]);

    -

    2.10.8.2 mkfifo

    +

    2.10.9.2 mkfifo

    Function Prototype:

    @@ -8100,8 +8115,8 @@ int mkfifo(FAR const char *pathname, mode_t mode);

    -

    2.10.9 FAT File System Support

    -

    2.10.9.1 mkfatfs

    +

    2.10.10 FAT File System Support

    +

    2.10.10.1 mkfatfs

    Function Prototype:

    @@ -8178,7 +8193,7 @@ struct fat_format_s

    -

    2.10.10 mmap() and eXecute In Place (XIP)

    +

    2.10.11 mmap() and eXecute In Place (XIP)

    NuttX operates in a flat open address space and is focused on MCUs that do support Memory Management Units (MMUs). Therefore, NuttX generally does not @@ -8307,7 +8322,7 @@ struct fat_format_s -

    2.10.10.1 mmap

    +

    2.10.11.1 mmap

    Function Prototype:

    diff --git a/fs/Kconfig b/fs/Kconfig index 92828d9acbf..8de3f51b096 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -61,16 +61,6 @@ source fs/smartfs/Kconfig source fs/binfs/Kconfig source fs/procfs/Kconfig -config LIBC_TMPDIR - string "Temporary file directory" - default "/tmp" - depends on FS_WRITABLE - ---help--- - If a write-able file system is selected, this string will be - provided to specify the full path to a directory where temporary - files can be created. This would be a good application of RAM disk: - To provide temporary storage for application data. - comment "System Logging" config SYSLOG diff --git a/include/stdio.h b/include/stdio.h index bc0164aa482..cb1636679ed 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -78,6 +78,26 @@ #define getchar() fgetc(stdin) #define rewind(s) ((void)fseek((s),0,SEEK_SET)) +/* Path to the directory where temporary files can be created */ + +#ifndef CONFIG_LIBC_TMPDIR +# define CONFIG_LIBC_TMPDIR "/tmp" +#endif + +#define P_tmpdir CONFIG_LIBC_TMPDIR + +/* Maximum size of character array to hold tmpnam() output. */ + +#ifndef CONFIG_LIBC_MAX_TMPFILE +# define CONFIG_LIBC_MAX_TMPFILE 32 +#endif + +#define L_tmpnam CONFIG_LIBC_MAX_TMPFILE + +/* the maximum number of unique temporary file names that can be generated */ + +#define TMP_MAX 56800235584ull + /**************************************************************************** * Public Type Definitions ****************************************************************************/ @@ -161,6 +181,8 @@ int vdprintf(int fd, FAR const char *fmt, va_list ap); /* Operations on paths */ int statfs(FAR const char *path, FAR struct statfs *buf); +FAR char *tmpnam(FAR char *s); +FAR char *tempnam(FAR const char *dir, FAR const char *pfx); #undef EXTERN #if defined(__cplusplus) diff --git a/libc/Kconfig b/libc/Kconfig index 8f9569bde0a..138793aadc9 100644 --- a/libc/Kconfig +++ b/libc/Kconfig @@ -192,6 +192,27 @@ config LIBC_PERROR_STDOUT be defined, however, to provide perror() output that is serialized with other stdout messages. +config LIBC_TMPDIR + string "Temporary file directory" + default "/tmp" + depends on FS_WRITABLE + ---help--- + If a write-able file system is selected, this string will be + provided to specify the full path to a directory where temporary + files can be created. This would be a good application of RAM disk: + To provide temporary storage for application data. + +config LIBC_MAX_TMPFILE + int "Maximum size of a temporary file path" + default 32 + depends on FS_WRITABLE + ---help--- + If a write-able file system is selected, then temporary file may be + supported at the path provided by LIBC_TMPDIR. The tmpnam() interface + keeps a static copy of this last filename produced; this value is the + maximum size of that last filename. This size is the size of the full + file path. + config ARCH_LOWPUTC bool "Low-level console output" default "y" diff --git a/libc/stdio/Make.defs b/libc/stdio/Make.defs index 284c725c4b6..66914b30f20 100644 --- a/libc/stdio/Make.defs +++ b/libc/stdio/Make.defs @@ -65,6 +65,10 @@ CSRCS += lib_vprintf.c lib_fprintf.c lib_vfprintf.c lib_stdinstream.c CSRCS += lib_stdoutstream.c lib_stdsistream.c lib_stdsostream.c lib_perror.c CSRCS += lib_feof.c lib_ferror.c lib_clearerr.c +endif + +ifeq ($(CONFIG_FS_WRITABLE),y) +CSRCS += lib_tempnam.c lib_tmpnam.c endif endif