Commit Graph

71 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
b90809d5f0 stdio.h: Sprinkle scanflike 2020-11-19 18:03:04 -08:00
YAMAMOTO Takashi
7e702817c1 stdio.h: Sprinkle printflike attribute 2020-11-19 18:03:04 -08:00
Xiang Xiao
84b90e00f0 libc/stdio: Preallocate the stdin, stdout and stderr
to handle the uninitialized stdin/stdout/stderr gracefully
report here:
https://github.com/apache/incubator-nuttx/issues/2203

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-11 09:56:10 -08:00
ligd
b69c587dc9 stdio: remove depends on setbuf setvbuf
N/A

Cause the function realize will handle this

Change-Id: I154c21c7a40667afae423bb0ebb67de8f5fc42fd
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-10-26 22:12:02 -07:00
ligd
57dfb98713 include: add dependence to setvbuf & isatty, undefine symbols when !CONFIG_SERIAL_TERMIOS
Change-Id: I053504fcfc90d926e6f529bfd7badedc71596313
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-15 10:28:21 -03:00
Xiang Xiao
b0797263ca libc/stdio: Allocate file_struct dynamically
1.Reduce the default size of task_group_s(~512B each task)
2.Scale better between simple and complex application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia872137504fddcf64d89c48d6f0593d76d582710
2020-09-11 17:58:17 +08:00
Xiang Xiao
60fe0a0f96 libc: Refine the inline handling
1.Remove CONFIG_HAVE_INLINE macro
2.Change the ANSI C function to normal function
3.Other simple non ANSI function to macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-04 11:10:29 +09:00
Xiang Xiao
676a2b77f8 stdio.h: Implement fseeko and ftello function
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-29 14:26:19 +09:00
YAMAMOTO Takashi
ef5d204fd2 rewind: clear the error indicator
Make rewind() clear the error indicator of the stream
as it's specified by the standards.
2020-06-24 16:56:44 +08:00
Xiang Xiao
43d7c1e807 libc: Add IPTR for puts/fputs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2a83afb4d934a44ad1b56ec6dd72e654f4e112a3
2020-06-10 00:03:53 -07:00
Xiang Xiao
a55f8d24a2 libc: Implement vscanf() function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2421e57b2c848c43afb749b8ebfa79ec457cde26
2020-06-03 07:35:08 -06:00
Xiang Xiao
9ff32427bf libc: Implement tmpfile() function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I00bdb42006b40bf1b9bc0bb6865b9b88b4acbb7b
2020-06-02 09:32:25 -06:00
Gregory Nutt
a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Xiang Xiao
a2d924eea4 syscall: Fix typo error in cvs and header file
and reoder the entry in cvs file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-07 10:31:05 -06:00
Xiang Xiao
f8a809eb5b Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Xiang Xiao
eca7059785 Refine __KERNEL__ and CONFIG_BUILD_xxx usage in the code base
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Xiang Xiao
5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Gregory Nutt
0820af5f8d libs/libc/stdio/lib_getdelim.c: Add implementations of the POSIX functions getdelim() and getline(). 2019-11-12 18:58:50 -06:00
Gregory Nutt
a9fd817eeb More ZNeo compile fixes: include/stdio.h: Another place where misuse of FAR makes a difference. include/nuttx/sched.h: Be consistent in use of WDOG_ID type. ZDS-II doesn't like auto-conversions of struct wdog_s * to WDOG_I (which is type struct wdog_s *). 2019-06-03 13:28:39 -06:00
Gregory Nutt
928108036c libs/libc/stdio: In the recent changes we lost the implementation of vsscanf(). This commit restores vsscanf(). sscanf() is not just a front end for vsscanf(). 2019-02-15 17:31:58 -06:00
Johannes
350295d009 Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>

    TODO:  Remove 'Missing fscanf()' bug
    Clean up remaining complaints for tools/nxstyle
    Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.

Author: Johannes <nivus.entwicklung@gmail.com>

    - Move vscanf logic to lib_sscanf.c  Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
    - Added scanf and fscanf
    - Added hh, h, and ll modifiers
    - Fixes for standard compliance in scanf
    - Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 07:03:02 -06:00
Gregory Nutt
0e5b02552a inclued/stdio.h: popen()/pclose() are not available in KERNEL mode because they depend on task_spawn() which is not available in KERNEL mode. 2018-08-17 16:06:01 -06:00
Gregory Nutt
4dac881e24 include/stdio.h: Add prototypes for popen() and pclose(). Actual implementation is in apps/system/popen() 2018-08-17 10:40:59 -06:00
Gregory Nutt
c19aa094e1 C Library: Add setbuf() which is a trivial wrapper around setvbuf(). 2017-02-09 15:04:53 -06:00
Gregory Nutt
1d290c2b37 setvbuf: Add support for disabling I/O buffering. Initially cut; untested. 2017-02-09 09:24:44 -06:00
Gregory Nutt
51a14c9b2f C Library: Add a very limited, first step implementation of setvbuf(). This is a collaborative effort. Alan Carvalho de Assis did the initial prototype. 2017-02-08 10:33:18 -06:00
Sebastien Lorquet
aed8a602b8 stdio: Add support for remove() 2016-08-25 08:40:34 -06:00
Dimitry Kloper
06d83c6261 Introduce support for Atmel toolchain in-flash strings
Atmel toolchain AVR compiler provides a transparent in-flash object support using __flash and __memx symbols. The former indicates to compiler that this is a flash-based object.  The later used with pointer indicates that the referenced object may reside either in flash or in RAM. The compiler automatically makes 32-bit pointer with flag indicating whether referenced object is in flash or RAM and generates code to access either in run-time. Thus, any function that accepts __memx object can transparently work with RAM and flash objects.

For platforms with a Harvard architecture and a very small RAM like AVR this allows to move all constant strings used in trace messages to flash in the instruction address space, releasing resources for other things.

This change introduces IOBJ and IPTR type qualifiers.  The 'I' indicates that the object may like in instruction space on a Harvard architecture machine.

For platforms that do not have __flash and __memx or similar symbols IOBJ and IPTR are empty, making the types equivalent to, for example, 'const char' and 'const char*'.  For Atmel compiler these will become 'const __flash char' and 'const __memx char*'.  All printf() functions and syslog() functions are changed so that the qualifier is used with the format parameter.

From: Dimitry Kloper <dikloper@cisco.com>
2016-01-05 10:29:29 -06:00
Gregory Nutt
006528b144 Add support for freopen() 2015-11-22 08:39:17 -06:00
Paul A. Patience
c0a1d8e960 stdio: Define BUFSIZ 2015-11-18 15:09:43 -05:00
Gregory Nutt
cb9e27c3b0 Standardize naming used for public data and function groupings 2015-10-02 16:30:35 -06:00
Sebastien Lorquet
77e4e7b231 Change all references from avsprintf to vasprintf. From Sebastien Lorquet 2015-09-07 13:22:13 -06:00
Gregory Nutt
ca29c652c3 Remove duplicate prototype of statfs from stdio.h. Belongs in sys/statfs.h only. Note by Michael Hope 2015-05-12 07:00:11 -06:00
Gregory Nutt
787cd466d2 Add tmpnam() and tempnam() 2014-11-05 10:43:17 -06:00
Gregory Nutt
7025465109 Adds support for localtime. From Max Neklyudov 2014-08-12 06:18:22 -06:00
Gregory Nutt
c5f9b8768e Add type rsize_t and function gets_s() 2014-01-07 16:27:45 -06:00
Gregory Nutt
545cef3223 scanf() fixes from kfrolov: 1) sscanf() function hangs in the following example: sscanf(2, %u,%u,%u,%u, ...), 2) sscanf() returns incorrect number of parsed numbers if some arguments can't be parsed: sscanf(=2, %u,%u,%u,%u,...)==1 instead of 0, and 3) using of char* instead of const char* in vsscanf function leads to warnings from GCC. 2013-10-21 10:41:15 -06:00
Gregory Nutt
44450511d4 Add dprintf() and vdprintf() 2013-06-02 15:49:52 -06:00
patacongo
1c52dce216 More changes for a kernel-mode allocator (more to be done)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5724 42af7a65-404d-4744-a932-0658087f49c3
2013-03-09 21:12:20 +00:00
patacongo
55265bfb4d Add support for ferror(), feof(), and clearerr()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5290 42af7a65-404d-4744-a932-0658087f49c3
2012-11-01 15:00:26 +00:00
patacongo
94a048002b Add perror()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5061 42af7a65-404d-4744-a932-0658087f49c3
2012-08-28 19:01:14 +00:00
patacongo
8e5733ae3f Header file clean-up
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4948 42af7a65-404d-4744-a932-0658087f49c3
2012-07-17 03:58:11 +00:00
patacongo
2fe4ad52f8 Move file-system header files to include/nuttx/fs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4499 42af7a65-404d-4744-a932-0658087f49c3
2012-03-21 18:01:07 +00:00
patacongo
b075ac5236 Add avsprintf()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4365 42af7a65-404d-4744-a932-0658087f49c3
2012-02-03 17:31:08 +00:00
patacongo
29a70ad011 Add asprintf()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3652 42af7a65-404d-4744-a932-0658087f49c3
2011-05-31 17:26:24 +00:00
patacongo
21ae727f6f Add syscall directory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3438 42af7a65-404d-4744-a932-0658087f49c3
2011-03-30 02:59:01 +00:00
patacongo
eeec4073a9 Switching to C99 stdint.h types
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2340 42af7a65-404d-4744-a932-0658087f49c3
2009-12-14 23:32:23 +00:00
patacongo
485c3066e1 Add fileno()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1985 42af7a65-404d-4744-a932-0658087f49c3
2009-07-13 01:35:15 +00:00
patacongo
3975fc5bdf Add tdate_parse.c
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1982 42af7a65-404d-4744-a932-0658087f49c3
2009-07-12 20:48:44 +00:00
patacongo
cd37d9323a cosmetic updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1709 42af7a65-404d-4744-a932-0658087f49c3
2009-04-19 15:21:22 +00:00