summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* cpukit/libmisc/fsmount: Change license to BSD-2.Joel Sherrill2022-03-221-3/+22
| | | | Updates #3053.
* cpukit/libmisc/dumpbuf: Change license to BSD-2Joel Sherrill2022-03-221-0/+2
| | | | Updates #3053.
* cpukit/libmisc/dummy: Change license to BSD-2.Joel Sherrill2022-03-221-3/+22
| | | | Updates #3053.
* cpukit/libmisc/devnull/devzero.c: Change license to BSD-2Joel Sherrill2022-03-221-3/+22
| | | | Updates #3053.
* cpukit/libmisc/cpuuse: Change license to BSD-2Joel Sherrill2022-03-226-18/+132
| | | | Updates #3053.
* cpukit/libmisc/capture: Manually change license to BSD-2Joel Sherrill2022-03-227-112/+212
| | | | | | | These files did not follow the standard format and needed to be changed manually. Updates #3053.
* cpukit/capture: Change license to BSD-2Joel Sherrill2022-03-222-6/+44
| | | | Updates #3053.
* cpukit/libmisc/bspcmdline: Change license to BSD-2Joel Sherrill2022-03-224-12/+88
| | | | Updates #3053.
* shell: Avoid potential stack corruptionSebastian Huber2022-03-161-7/+1
| | | | | | | | | | | The rtems_shell_init() passed the address of a stack variable (exit_code) to rtems_shell_run(). If wait == false, then the stack variable goes out of scope but may be accessed by the created shell thread. The rtems_shell_script() was affected by the same problem. Close #4629.
* cpukit: Automated IMD header file clean upChristian Mauderer2022-03-104-4/+4
| | | | | | Use the same form of IMD in all copyright lines Update #4625.
* bsps and cpukit: Manual file header clean upChristian Mauderer2022-03-102-26/+23
| | | | Updates #4625.
* cpukit/: Scripted embedded brains header file clean upJoel Sherrill2022-03-1015-88/+1
| | | | Updates #4625.
* libmisc/serdbg: Manual header clean upJoel Sherrill2022-03-102-45/+29
| | | | Updates #4625.
* cpukit: Prevent error with disabled stack checkerKinsey Moore2022-01-271-0/+5
| | | | | | | | | | | When the stack checker is not enabled, the stack checker reporting function can still be called. This prevents that call from performing a null memory access in trying to find the high water mark if the stack checker was never initialized. This also introduces a test to ensure this call does not cause a crash. Closes #4588
* libmisc/rtems-fdt: close() file 'bf'Ryan Long2021-12-171-0/+1
| | | | | | | | close() file 'bf' to avoid leaking descriptor. CID 1437645: Resource leak in rtems_fdt_load(). Closes #4297
* untar: Make behavior similar to GNU or BSD tarChristian Mauderer2021-12-091-20/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RTEMS untar implementation had problems with overwriting or integrating archives into existing directory structures. This patch adapts the behavior to mimic that of a GNU tar or BSD tar and extends the tar01 test to check for the behavior. That is: * If a directory structure exists, the files from the archive will be integrated. Existing files are overwritten. * If a file exists and the archive contains a directory with the same name, the file is removed and a directory is created. In the above example: if l1/l2 is a file it will be overwritten with a new directory. * If a directory exists and the archive contains a file with the same name, the directory will be replaced if it is empty. If it contains files, the result is an error. * An archive also can contain only a file without the parent directories. If in that case one of the parent directories exists as a file extracting the archive results in an error. In the example: if l1/l2 is a file and the archive doesn't contain the directories but only the file l1/l2/x.txt that would be an error. * In case of an error, it is possible that the archive has been partially extracted. Closes #4568
* rtems: Move scheduler directives to own headerSebastian Huber2021-12-021-0/+1
| | | | | | Move all rtems_scheduler_* directives to the new header file <rtems/rtems/scheduler.h>. Add a Scheduler Manager API and implementation group.
* rtems: Fix rate monotonic statisticsSebastian Huber2021-10-253-3/+4
| | | | | | | | | | | | | | | The rate monotonic period statistics were affected by rtems_cpu_usage_reset(). The logic to detect and work around a CPU usage reset was broken. The Thread_Contol::cpu_time_used is changed to contain the processor time used throughout the entire lifetime of the thread. The new member Thread_Contol::cpu_time_used_at_last_reset is added to contain the processor time used at the time of the last reset through rtems_cpu_usage_reset(). This decouples the resets of the CPU usage and the rate monotonic period statistics. Update #4528.
* libmisc/shell: Check the shell command pointers when adding a commandChris Johns2021-08-211-0/+5
|
* libmisc/fdt: fix node initialise error with RTEMS_DEBUGChris Johns2021-08-211-0/+2
|
* rtems: Fix rtems_partition_return_buffer()Sebastian Huber2021-08-121-2/+3
| | | | | | | | The rtems_partition_return_buffer() wrongly accepted which were exactly at the buffer area end. Use the buffer area limit address for the range checking. Close #4490.
* main_edit.c: get rid of malloc warningRyan Long2021-06-091-8/+8
| | | | | | A warning was present when building RTEMS that stated that the argument for malloc() exceeded the maximum object size. To get rid of this, I changed many places where 'int' was being used to 'size_t'.
* cpukit/libmisc/monitor: Fix src/dest overlap of strcpy in mon-editor.cHarrison Edward Gerber2021-05-281-1/+11
| | | | | | See also CID 1399727 Closes #4444
* main_help.c: Do not care what char is returned by getchar()Ryan Long2021-05-281-1/+1
| | | | | | CID 1437650: Unchecked return value from library in rtems_shell_help(). Closes #4291
* main_cp.c: Ignore return value from stat()Ryan Long2021-05-281-0/+6
| | | | | | CID 26051: Unchecked return value from library in main_cp(). Closes #4365
* gen_uuid.c: Ignore return values from fcntl()Ryan Long2021-05-281-0/+6
| | | | | | | CID 1049146: Unchecked return value from library in get_clock(). CID 1049147: Unchecked return value from library in get_random_fd(). Closes #4280
* stackchk: Fixed 32bit pointersStephen Clark2021-05-051-1/+2
| | | | | | Using 32bit types like uint32_t for pointers creates issues on 64 bit architectures like AArch64. Replaced occurrences of these with uintptr_t, which will work for both 32 and 64 bit architectures.
* rtems-fdt: Fixed 32bit pointersStephen Clark2021-05-051-2/+2
| | | | | | Using 32bit types like uint32_t for pointers creates issues on 64 bit architectures like AArch64. Replaced occurrences of these with uintptr_t, which will work for both 32 and 64 bit architectures.
* main_rtrace.c: Add error return when malloc failsRyan Long2021-04-291-0/+1
| | | | | | | CID 1399709: Dereference after null check in rtems_trace_buffering_shell_save(). Closes #4329
* print-ls.c: Unused value (CID #1255346)Ryan Long2021-04-081-0/+9
| | | | | | CID 1255346: Unused value in rtems_shell_ls_printacol(). Closes #4340
* main_cp.c: Unused value (CID #1255344)Ryan Long2021-04-081-0/+32
| | | | | | CID 1255344: Unused value in copy(). Closes #4339
* cpukit: Remove libnetworkingVijay Kumar Banerjee2021-04-076-2929/+0
| | | | Update #3850
* gen_uuid.c: Revert previous patch (597e4f476568a225d14dfaff02074cf269ad62ac)Joel Sherrill2021-03-241-8/+3
| | | | | | | | | | The patch was: gen_uuid.c: Fix two Unchecked return value from library errors CID 1049146: Unchecked return value from library in get_clock(). CID 1049147: Unchecked return value from library in get_random_fd(). Reopen #4280
* rtems-fdt/rtems-fdt.c: Fix bug in loop terminationG S Niteesh Babu2021-03-211-1/+1
| | | | | The while loop, loops infinitely in case of raw FDT data. The loop condition (size) is not modified during iterations.
* main_help.c: Unchecked return value from library (CID #1437650)Ryan Long2021-03-081-1/+2
| | | | | | CID 1437650: Unchecked return value from library in rtems_shell_help(). Closes #4291
* main_chmod.c: Fix Unchecked return value from library (CID #1063856)Ryan Long2021-03-081-2/+5
| | | | | | | CID 1063856: Unchecked return value from library in rtems_shell_main_chmod(). Closes #4281
* gen_uuid.c: Fix two Unchecked return value from library errorsRyan Long2021-03-081-3/+8
| | | | | | | CID 1049146: Unchecked return value from library in get_clock(). CID 1049147: Unchecked return value from library in get_random_fd(). Closes #4280
* main_edit.c: Fix Unchecked return value (CID #1255318)Ryan Long2021-03-081-1/+1
| | | | | | CID 1255318: Unchecked return value in display_line(). Updates #4257
* cpuusagetop.c: Fix three Missing break in switch Coverity errorsRyan Long2021-03-051-0/+3
| | | | | | | | CID 1399726: Missing break in switch in task_usage(). CID 1399728: Missing break in switch in task_usage(). CID 1399742: Missing break in switch in task_usage(). Closes #4278
* shell.c: Fix Dereference before null check (CID #1467420)Ryan Long2021-02-181-1/+4
| | | | | | CID 1467420: Dereference before null check in rtems_shell_line_editor(). Closes #4254
* shell: Add i2c and spi commandsChristian Mauderer2020-12-144-0/+533
| | | | | | | | This adds some commands that are usefull for debugging simple serial interfaces. Even if they are a complete re-implementation, the i2c* commands use a simmilar call like the Linux i2c tools.
* shell: Rename "IO" typedef for better DoxygenSebastian Huber2020-12-023-6/+6
| | | | | An automatic link from every place in the documentation which mentions "IO" to this dd command internal "IO" typedef is not really nice.
* rtems-fdt / shell - Fix string truncation warningFrank Kühndel2020-10-201-21/+19
| | | | | | | | | | | | | | The compiler warning was: ../../../cpukit/libmisc/rtems-fdt/rtems-fdt.c:267:5: warning: 'strncpy' specified bound depends on the length of the source argument 267 | strncpy(path, name, namelen); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out that the `strncpy()` nor the buffer `path` is needed when one uses `strncmp()` instead of `strcmp()`. This needs some change to the algorithm but has the advantage that `name` is never truncated to the size of the buffer `path`.
* Revert "rtems-fdt / shell - Fix string truncation warning"Sebastian Huber2020-10-161-19/+21
| | | | This reverts commit 355bc37ad35a7d67a7209130171febe805c67f62.
* rtems-fdt / shell - Fix string truncation warningFrank Kühndel2020-10-151-21/+19
| | | | | | | | | | | | | | | | | | | | | The compiler warning was: ../../../cpukit/libmisc/rtems-fdt/rtems-fdt.c:267:5: warning: 'strncpy' specified bound depends on the length of the source argument 267 | strncpy(path, name, namelen); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ It turns out that the `strncpy()` nor the buffer `path` is needed when one uses `strncmp()` instead of `strcmp()`. This needs some change to the algorithm but has the advantage that `name` is never truncated to the size of the buffer `path`. Note: rtems-fdt.c, rtems-fdt-shell.c and cpukit/include/rtems/rtems-fdt.h seem to be dead code. They implement a shell command `fdt` but that command is not part of the shell nor of any macro in cpukit/include/rtems/shellconfig.h.
* shell/main_edit.c: Fix string truncation warningFrank Kühndel2020-10-151-5/+7
| | | | | | | | | | | | Using strlcpy() instead of strncpy(): 1) Prevents the compiler warnings 2) Ensures, the string is NUL terminated. 3) Avoids that strncpy() unnecessary fills the unused part of the buffer with 0 bytes. (Note that realpath() also returns NULL if the file does not exist - that happens always if someone creates a new file with the editor of the shell.)
* shell/main_edit.c: Fix use of wrong constantFrank Kühndel2020-10-151-1/+2
| | | | | realpath() requires a buffer of size PATH_MAX and not of size FILENAME_MAX according to 'man realpath (3)'.
* shell/shell.c: Fix illegal string copyFrank Kühndel2020-10-151-4/+14
| | | | | | | | | | | | | This is an illegal use of strcpy() because one is not allowed to use this function with overlapping source and destination buffers; whereas memmove() is explicitly designed to handle such cases. The copiler warning was: ../../../cpukit/libmisc/shell/shell.c:626:13: warning: 'strcpy' accessing between 1 and 2147483645 bytes at offsets 0 and [1, 2147483647] may overlap up to 2147483644 bytes at offset [1, 2147483644] [-Wrestrict]
* shell/shell.c: Fix an implicit type castFrank Kühndel2020-10-151-1/+3
| | | | | With some compiler warnings enabled, the implicit cast may trigger a compiler warning. The explicit cast avoids this.
* shell: Remove not functioning fdisk mount/unmountFrank Kühndel2020-10-121-31/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The shell has an 'fdisk' command which has sub-commands 'mount' and 'unmount'. These two sub-commands have a bug which causes them to be not able to mount anything. This proposed patch removes the buggy file cpukit/libblock/src/bdpart-mount.c and the mount/unmount commands from 'fdisk' as bug fix. The 'fdisk' command itself is not removed. The reasons for removing the sub-commands (instead of fixing the issue) are: 1) The bug has been introduced on 2010-May-31 with commit 29e92b090c8bc35745aa5c89231ce806bcb11e57. Since ten years no one can use this feature, nor has anybody complained about it. 2) Besides of the 'fdisk' 'mount' sub-command, the shell has the usual 'mount' and 'unmount' commands which can serve as substitutes. 3) There are additional minor issues (see further down) which needed to be addressed when the file will be kept. What follows below is the precise bug description. The bug is in function rtems_bdpart_mount() which is only be used by the 'fdisk' shell command to mount all partitions of a disk with a single command: > fdisk DISK_NAME mount > mounts the file system of each partition of the disk > > fdisk DISK_NAME unmount > unmounts the file system of each partition of the disk The whole command does not work because in file cpukit/libblock/src/bdpart-mount.c line 103 specifies the file system type of each partition to be "msdos". Yet, "msdos" does not exist. The name must be "dosfs". Beside of this fundamental problem, there are more issues with the code in bdpart-mount.c: 1) The function returns RTEMS_SUCCESSFUL despite the mount always fails. 2) The reason for errors is not written to the terminal. 3) The directory '/mnt' is created but not deleted later on (failure or not). 3) There is no documentation about this special 'fdisk' feature in the RTEMS Shell Guide ('fdisk' is mentioned but its documentation is a bit short): https://docs.rtems.org/branches/master/shell/ file_and_directory.html#fdisk-format-disk 4) Only "msdos" formatted partitions can be mounted and all partitions are mounted read-only. This is hard coded and cannot be changed by options. Moreover, there is no information about this to the user of the shell (i.e. using 'fdisk' mount requires insider knowledge). How to reproduce: 1) For testing, I use the 'testsuites/samples/fileio.exe' sample with qemu: > cd rtems > env QEMU_AUDIO_DRV="none" qemu-system-arm -net none -nographic \ > -M realview-pbx-a9 -m 256M -kernel \ > build/arm/realview_pbx_a9_qemu/testsuites/samples/fileio.exe 2) Type any key to stop the timer and enter the sample tool. Type 's' to enter the shell, login as 'root' with the password shown in the terminal. 3) Type the following shell commands (they create a RAM disk, partition it, register it, format it and try to mount it): > mkrd > fdisk /dev/rda fat32 16 write mbr > fdisk /dev/rda register > mkdos /dev/rda1 > fdisk /dev/rda mount 4) The last line above is the command which fails - without an error message. There exists a '/mnt' directory but no '/mnt/rda1' directory as it should be: > ls -la /mnt 5) If you change line 103 of 'cpukit/libblock/src/bdpart-mount.c' from "msdos" to "dosfs", compile and build the executable and re-run the above test, '/mnt/rda1' exists (but the file system is mounted read-only). Close #4131