Commit Graph

66 Commits

Author SHA1 Message Date
chao.an
216c33a5c7 libs/libc/stdlib: Implement mkdtemp(3) syscall
See the reference here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdtemp.html

Change-Id: I49081ecafc011a843e6067b1118b53bf65d4418b
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 04:16:14 -07:00
chao.an
4067a9f057 libs/libc/stdio: correct the prototype of mktemp(3)
From:   int       mktemp(FAR char *path_template);
To:     FAR char *mktemp(FAR char *path_template);

See the reference here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/mktemp.html

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 04:16:14 -07:00
chao.an
7816b5ec8c include/stdlib: alignment function definitions
Change-Id: Id12ed4241698c8d4426907ca72eef334894ee1f3
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-19 04:16:14 -07:00
Xiang Xiao
1bca457b28 libc: Always declare getenv, link/symlink and atexit/on_exit
since many c++ library implementation reference these symbols by using ::xxx but never
really use them, the declaration avoid the unused code is pulled into the final binary

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idd7bf9a1e09b77a6b21f900cd3ede08a1cc82d86
2020-07-08 12:07:22 +01: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
a102922e12 libc: Implement realpath
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie52dcd1c5c5faa4b033901eedd7182bbb9473f7a
2020-06-30 13:09:58 -06:00
YAMAMOTO Takashi
a607e6257f Include malloc.h instead of stdlib.h for mallinfo()
This change also removes the malloc.h inclusion in stdlib.h
to break the build if there are still users of mallinfo() with stdlib.h.
2020-06-15 07:21:19 -06:00
YAMAMOTO Takashi
f1814dfca8 Move mallinfo from stdlib.h to malloc.h
mallinfo is meant to be API compatible with Linux,
where it's provided by malloc.h.

Make stdlib.h include malloc.h for now. It can be removed
once all users are updated to include malloc.h instead of
stdlib.h.

I have some app code which uses mallinfo(). I want to share
it between platforms. This commit allows me to reduce
platform-ifdefs.

(I think the API actually originated with System V. I don't
remember how it was there though. Anyway, I guess the
compatibility with Linux is more important than System V
these days.)
2020-06-15 07:21:19 -06:00
Xiang Xiao
a7174cee30 libc: Unify the selection of inline or macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I44a26550ff856af07d2d96a6f0a6066f988d6da3
2020-06-02 09:32:25 -06:00
Xiang Xiao
de509004fd libc: Implement mblen, mbstowcs and wcstombs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I682c39fc132a1614b91284670882e331add765a9
2020-06-02 07:13:37 -06:00
Xiang Xiao
b8b61dc070 lib/stdlib: Implement aligned_alloc and posix_memalign
https://linux.die.net/man/3/aligned_alloc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I73db1c982e2c3eb73e5960e91c0d471ab967be51
2020-06-01 07:10:50 -06:00
Xiang Xiao
eac66d76b3 lib/stdlib: Change some macro to inline function
to avoid the build break for "using ::xxx"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib5d861a6c2b9e6ba585df83b3cdff8a3e1495bce
2020-06-01 07:10:50 -06:00
Gregory Nutt
72104c182c nxstyle fixes
Run all files modified by PR 766 through nxstyle and fix any resulting complaints.

NOTE:  Numerous "Mixed case identifier" errors in arch/arm/src/cxd56xx/cxd56_gnss.c were not fixed because this problem is of much larger scope than this file.
2020-04-11 21:19:47 +01:00
Gregory Nutt
67ec3d7926 Remove CONFIG_CAN_PASS_STRUCT
This commit resolves issue #620:

Remove CONFIG_CAN_PASS_STRUCTS #620

The configuration option CONFIG_CAN_PASS_STRUCTS was added many years ago to support an old version of the SDCC compiler. That compiler is currently used only with the Z80 and Z180 targets. The limitation of that old compiler was that it could not pass structures or unions as either inputs or outputs. For example:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    struct mallinfo mallinfo(void);
    #else
    int      mallinfo(FAR struct mallinfo *info);
    #endif

And even leads to violation of a few POSIX interfaces like:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    int  sigqueue(int pid, int signo, union sigval value);
    #else
    int  sigqueue(int pid, int signo, FAR void *sival_ptr);
    #endif

This breaks the 1st INVIOLABLES rule:

Strict POSIX compliance
-----------------------

  o Strict conformance to the portable standard OS interface as defined at
    OpenGroup.org.
  o A deeply embedded system requires some special support.  Special
    support must be minimized.
  o The portable interface must never be compromised only for the sake of
    expediency.
  o Expediency or even improved performance are not justifications for
   violation of the strict POSIX interface

Also, it appears that the current SDCC compilers have resolve this issue and so, perhaps, this is no longer a problem: z88dk/z88dk#1132

NOTE:  This commit cannot pass the PR checks because it depends on matching changes to the apps/ directory.
2020-04-11 21:19:47 +01:00
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao
e2ccce1f2e apps/system/system/system.c: Add 'const' to make function prototype compatible with OpenGroup.org requirement 2018-08-23 06:40:59 -06:00
Gregory Nutt
58bbb66481 libs/libc/stdlib and include/stdlib.h: Add implementation of random() and srandom(). 2018-07-19 11:21:49 -06:00
Gregory Nutt
de1b68dc4e libc/Kconfig: Break big Kconfig up into separate Kconfig files in each libc subdirectory. 2017-02-10 09:32:55 -06:00
Gregory Nutt
41137b82fa Add strtold() 2016-10-22 13:02:55 -06:00
Gregory Nutt
30ab01b1d8 strtof: Add strtof() as simply a compy of strtod with types and limits changed 2016-10-20 12:07:12 -06:00
Gregory Nutt
2dbcdd781c Correct STM32 Butterfly2 URL. Correct some comments. 2016-10-20 07:18:23 -06:00
Alan Carvalho de Assis
1cb05d007d Add some less-than-perfect macros to provide some implementation of strtof() and strtold() 2016-10-19 14:26:48 -06:00
Gregory Nutt
54fd0f0a04 Fix a few more compile issues with the new wide character support 2016-10-19 08:18:46 -06:00
Gregory Nutt
890a9eb45d Fix a few wide character build issues 2016-10-18 19:11:09 -06:00
Gregory Nutt
440d535360 include/cxx: Update some C++ header files due to recent changes to C hader files 2016-08-25 15:06:46 -06:00
Gregory Nutt
55a325bcd4 system() is not available from within the OS 2016-08-25 12:36:38 -06:00
Gregory Nutt
e07a02bf29 Add system() to stdlib.h 2016-08-25 11:28:09 -06:00
Gregory Nutt
95555a0199 PTY: Add ioctls to support locking and unlocking of the slave. LIBC: Add implementation of unlockpt() 2016-07-15 09:39:33 -06:00
Gregory Nutt
6139860c0b PTY: Added PTY IOCTL command definitions. Add support for TIOCGPTN. LIB: Implement ptsname() and ptsname_r() 2016-07-15 08:33:47 -06:00
Gregory Nutt
f699072507 Merged in paulpatience/nuttx/stdlib (pull request #36)
stdlib: Fix forgotten FARs
2015-11-18 14:01:17 -06:00
Paul A. Patience
bfc95c641f stdlib: Fix forgotten FARs 2015-11-18 14:22:43 -05:00
Paul A. Patience
706218d18f atoi(): Cast return value to int 2015-11-18 14:12:29 -05:00
Gregory Nutt
38e6142ae8 Make coding style more conformant, take description from OpenGroup.org, rename formal parameters to match names used on OpenGroup.org 2015-10-02 12:58:40 -06:00
Gregory Nutt
2ba224eca2 Add support for bsearch() in C library 2015-10-02 12:33:58 -06:00
Gregory Nutt
8f7453b5ec Addings to stdlib.h must be added to cstdlib too 2015-08-14 12:04:57 -06:00
Gregory Nutt
6df94096ca Add ldiv() and lldiv() too 2015-08-14 08:45:59 -06:00
Stavros Polymenis
301f215638 Add support for div() to the C library. From OrbitalFox 2015-08-14 08:35:01 -06:00
Gregory Nutt
9cbac41e78 Clean-up/standardize a few header files 2015-08-03 11:01:41 -06:00
Gregory Nutt
b1f5c2a0b2 Fix a few errors/warnings in THTTPD when indexing is enabled. Still depends on non-existent lstat and ctime 2015-06-12 09:57:12 -06:00
Gregory Nutt
4adda9d428 Fix numerous typos in configuration variable names. Tracked down by Alan Carvalho de Assis 2015-05-23 17:08:35 -06:00
Gregory Nutt
34d1d2907d MAX_RAND should be RAND_MAX 2015-04-16 09:35:29 -06:00
Gregory Nutt
ee22104762 Can't use formal parameter name 'template' in stdlib.h. Causes C++ compilation errors. Noted by Lorenz Meier 2014-11-06 07:00:23 -06:00
Gregory Nutt
d13731711f Add mktemp() and mkstemp() 2014-11-05 09:39:18 -06:00
Gregory Nutt
a41c1de32c Add basic data structures that will allow us to move named semaphore support out of the OS and into the VFS (not complete). 2014-09-28 10:15:33 -06:00
Gregory Nutt
3a1324741a More trailing whilespace removal 2014-04-13 14:32:20 -06:00
Gregory Nutt
7be1a9622a _Exit() is the stdlib.h equivalent of unistd.h's _exit() 2013-04-18 16:13:38 -06:00
patacongo
d960ca3b8d itoa() from Ryan Sundberg
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5741 42af7a65-404d-4744-a932-0658087f49c3
2013-03-14 18:30:06 +00:00
patacongo
017e07d35d Add support for multiple heaps
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5720 42af7a65-404d-4744-a932-0658087f49c3
2013-03-08 20:36:18 +00:00
patacongo
9473d2192f Add on_exit(); Re-order some logic in the task shutdown sequence. Sometimes some complex logic needs to execute when closing file descriptors and this needs to happen early while the task is still healthy
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4354 42af7a65-404d-4744-a932-0658087f49c3
2012-01-31 23:39:12 +00:00
patacongo
f158e56fca STM32 fixes for F4 32-bit timers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4300 42af7a65-404d-4744-a932-0658087f49c3
2012-01-13 02:49:10 +00:00