Commit Graph

15 Commits

Author SHA1 Message Date
hujun5 b96a753747 libs/libc: There is no need to use sched_[un]lock
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-12 13:28:23 +08:00
Alin Jerpelea 6b5dddd5d7 libs/libc: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
guoshichao af53d7a178 libs/libc/aio/lio_listio: fix the heap use-after-free bug
1. the lio_sigsetup() method use a universal sighand instance across all
aiocb instances, but inside the lio_sighandler() method, if one aiocb is
handle finished, then this method will free the sighand instance that
come along with current aiocb instance. thus when handle next aiocb
instance, use-after-free crash will happen. in order to solve this
problem, we make each aiocb instance have their own sighand instance
2. make the lio_listio implementation can pass the
ltp/open_posix_testsuite/lio_listio testcases
3. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/lio_listio.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-03 13:37:34 +08:00
chao an 4c8d244fae sched/getpid: replace syscall getpid/tid/ppid() to kernel version
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
Xiang Xiao 5f7cc04627 fs/aio: Fix compile warning
aio/lio_listio.c:227:7: warning: implicit declaration of function ‘ferr’ [-Wimplicit-function-declaration]
  227 |       ferr("ERROR: lib_zalloc failed\n");
      |       ^~~~
aio/lio_listio.c:275:3: warning: implicit declaration of function ‘finfo’ [-Wimplicit-function-declaration]
  275 |   finfo("Registering signal handler\n");

aio/aio_read.c: In function ‘aio_read_worker’:
aio/aio_read.c:90:11: warning: implicit declaration of function ‘file_pread’; did you mean ‘aio_read’? [-Wimplicit-function-declaration]
   90 |   nread = file_pread(aioc->aioc_filep, (FAR void *)aiocbp->aio_buf,
      |           ^~~~~~~~~~
      |           aio_read

aio/aio_write.c: In function ‘aio_write_worker’:
aio/aio_write.c:85:12: warning: implicit declaration of function ‘file_fcntl’ [-Wimplicit-function-declaration]
   85 |   oflags = file_fcntl(aioc->aioc_filep, F_GETFL);
      |            ^~~~~~~~~~
CC:  mmap/fs_mmap.c
CC:  pthread/pthread_condclockwait.c
aio/aio_write.c:107:18: warning: implicit declaration of function ‘file_write’; did you mean ‘aio_write’? [-Wimplicit-function-declaration]
  107 |       nwritten = file_write(aioc->aioc_filep,
      |                  ^~~~~~~~~~
      |                  aio_write
aio/aio_write.c:113:18: warning: implicit declaration of function ‘file_pwrite’; did you mean ‘aio_write’? [-Wimplicit-function-declaration]
  113 |       nwritten = file_pwrite(aioc->aioc_filep,
      |                  ^~~~~~~~~~~
      |                  aio_write
In file included from aio/aio_write.c:34:
aio/aio_write.c:121:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  121 |       ferr("ERROR: write/pwrite/send failed: %d\n", nwritten);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~
      |                                                     |
      |                                                     ssize_t {aka long int}
aio/aio_write.c:121:47: note: format string is defined here
  121 |       ferr("ERROR: write/pwrite/send failed: %d\n", nwritten);
      |                                              ~^
      |                                               |
      |                                               int
      |                                              %ld

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-10-31 06:30:57 -03:00
zhanghu 7b0347c66c nuttx net warning:add initialization of pointer *aiocbp in lio_listio
Change-Id: I0ac7571ca27191b69acdc31f5bc07943c4d87e58
2021-07-12 11:27:50 -03:00
Alin Jerpelea b5d4a01821 libs: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-03 18:52:53 -08: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 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Xiang Xiao 964f0ab304 aio_cancel need signal caller after the succeed and fix minor issue in the error handler 2019-01-27 09:39:33 -06:00
Xiang Xiao fb63c0a293 sched/signal and related changes to other OS subsystems. 2019-01-27 09:28:59 -06:00
Xiang Xiao 18f971aa35 libs/libc/aio/lio_listio.c: Fix a typograpical error. 2018-11-08 19:09:47 -06:00
Xiang Xiao a9ff43d93c fs/aio, libs/libc/aio, sched/mqueue, sched/timer, and sched/signal: Remove the code duplication for SIGEV_THREAD. 2018-11-08 08:19:17 -06:00
Gregory Nutt fc127fd297 sched/signal: Add a generic signal notification facility. Modify the custom IOB available notifier so that it is now just a wrapper around this generic signal notification. This generic signal notification faility will, eventually, be used to support network polling.
Squashed commit of the following:

    mm/iob:  The IOB available notifier is now just a wrapper around the common signal notifier.

    sched/signal:  Add a generic signal notification facility.

    sched/signal/sig_evthread.c:  More trivial naming changes.

    sched/signal:  Rename nxsig_notification() to nxsig_evthread() to make forthcoming naming additions more consistent.
2018-09-09 08:32:37 -06:00
Gregory Nutt cf99fb40c9 This commit moves all of the libraries under a common directory called libs/. This most certainly break libcxx and uClibc++ for now.
Squashed commit of the following:

    libs/libxx:  Fix some confusing in naming.  If the directory is called libxx, then the library must be libxx.a (unless perhaps LIBCXX is selected).
    libs/:  Fix paths in moved library directories.
    libs:  Brute force move of libc, libnx, and libxx to libs.  Cannot yet build it in that configuration.
2018-05-29 13:21:26 -06:00