Perry E. Metzger
d1d85b5a0e
FIO: Fix Big Endian sim_fwrite() error
...
This problem was discovered by Codex initiated by Perry Metzger.
sim_fwrite() in sim_fio.c has a bug in the big-endian/swapped write
path. When a write spans more than one internal flip buffer, the
function advances its source pointer by size * count on every chunk
instead of by size * c, where c is the number of elements actually
written in that chunk.
This causes later chunks to read from the wrong part of the caller's
buffer, which corrupts the file contents.
Why this is wrong
sim_fwrite() may break the caller's write into multiple pieces:
nelem is the number of elements that fit in the flip buffer
nbuf is the number of chunks to write
c is the number of elements in the current chunk
After writing one chunk, the source pointer must advance by the
size of that chunk:
sptr = sptr + size * c;
But the original code advanced by the size of the entire original request
every time:
sptr = sptr + size * count;
That is only correct if there is exactly one chunk.
2026-04-16 16:02:54 -10:00
Mark Pizzolato
6fce72d9bc
FIO: Add current SunOS __illumos__ to SourceCheck platform defines
2025-12-14 13:40:43 -10:00
Mark Pizzolato
d6a53f1c06
SCP: Cleanup allocated memory assignments for C++ compatibility
2025-10-24 08:19:42 -10:00
Mark Pizzolato
f8c367d75d
FIO: Add Source check options to allow exceptions for Binary and Tabs
2025-10-22 11:24:11 -10:00
Mark Pizzolato
b915b3aede
FIO: Add Line numbers to tab and non-ascii character reports
2025-10-21 11:34:31 -10:00
Mark Pizzolato
5c59cced96
FIO: Add sim_trim_spc API to trim spaces from the front and back of a string
2025-10-01 10:51:03 -10:00
Peter Schorn
c7df248f09
SIMH: Fix spelling errors in comments and strings
2024-07-16 12:04:53 -10:00
Mark Pizzolato
acafbac518
FIO: Add Files/Lines/Size totals in CheckSourceCode output
2024-01-09 05:55:04 -10:00
Mark Pizzolato
a8ff8110e4
FIO: Fix sim_get_filelist potential problem when directory contents change
...
- Avoid inconsistencies in the internal cache when directory contents change
- Cleanup FIO testing and add tests for new filename comparison routine
2023-12-17 10:27:53 -10:00
Mark Pizzolato
8ec41d4503
FIO: Fix clang warnings in _sim_expand_honedir
2023-07-16 09:56:15 -10:00
Mark Pizzolato
fbbfe931ae
FIO: Don't try to interpret \ escape characters when unquoting file names
...
The \ character is the directory path separator for native Windows file
specifications.
2023-07-09 11:25:36 -10:00
Mark Pizzolato
6fa6b5292c
FIO: Add a global variable that indicates the normal host path separator
...
This avoids the potential need for platform specific #ifdef blocks in
simulator code which might be needed on some platforms.
2023-06-27 11:18:24 -10:00
Mark Pizzolato
9e6e0f0355
FIO: Enhance Source Code Checking
...
- Optionally export problem details
- Optionally allow specific problem exceptions
- Precisely match platform defines
2023-06-27 10:38:22 -10:00
Mark Pizzolato
cfe25e5366
SCP: Add source code checking for SCP only APIs
2023-05-19 16:59:01 -10:00
Mark Pizzolato
057c0354f5
SCP: Add simulator platform specific checks to CheckSourceCode logic
2023-05-11 10:05:20 -10:00
Mark Pizzolato
676ca3a836
SCP: Add CheckSourceCode support for Windows builds
2023-04-28 09:43:27 -10:00
Mark Pizzolato
c7d01273df
SCP: Add CheckSourceCode facility to validate simh project standards
2023-03-04 17:51:49 -10:00
Mark Pizzolato
194b313179
SCP: Fold up include files used by all simulators
...
- Add common system includes used in may places which are allowed
and thus added directly in sim_defs.h.
- Separate completely private system data structures and system APIs
for use only by SCP library routines into sim_scp_private.h.
2023-03-04 17:51:49 -10:00
Mark Pizzolato
2e50ada71f
FIO: Fix corner case found in sim_relative_path
2023-02-03 09:32:27 -10:00
Mark Pizzolato
a1172690a0
FIO: Avoid potential buffer overrun while formatting file modify time
...
Silence over aggressive compiler warning.
2023-01-16 16:56:26 -10:00
Mark Pizzolato
4377d93049
SCP: Avoid compile errors when compiled with UNICODE defined
...
On windows all platform specific APIs deliberately use ANSI APIs.
Fix these few inconsistencies.
2022-11-14 17:18:55 -10:00
Mark Pizzolato
ee69bf3e6f
FIO: Extend library test for sim_get_filelist and group order results
2022-09-09 21:07:36 -07:00
Mark Pizzolato
07a03009e5
FIO: Extend sim_get_filelist to return the recursive list of matching files
2022-09-05 02:10:02 -07:00
Mark Pizzolato
7ada0d6edb
FIO: Fix relative path name logic for edge cases
2022-07-21 02:48:37 -10:00
Mark Pizzolato
33ef5b9ef2
FIO: Add relative path support to translate raw filenames to relative paths
...
Default to ./ when no directory separator is mentioned in the path provided.
2022-06-15 15:51:18 -07:00
Mark Pizzolato
8016c6a0ad
FIO: Add generic pack/unpack buffer copy support
2022-05-12 13:15:00 -07:00
Mark Pizzolato
cb4d6cfc29
FIO: Properly bound byte swap activity when reading on big endian hosts
2022-03-18 12:09:17 -07:00
Mark Pizzolato
06c696385f
SCP: Coverity inspired changes
2022-03-06 02:11:57 -08:00
Mark Pizzolato
153776accb
FIO: Add support to expand filename/path to a list of filenames
2022-02-06 11:04:39 -08:00
Mark Pizzolato
079e4780d2
FIO: Add support to set file access and modify times
2021-10-31 04:20:39 -07:00
Mark Pizzolato
d0c7276dd7
FIO: Emit reasonable error message when shm_open() API isn't available locally
2021-10-24 14:25:28 -07:00
Mark Pizzolato
06a8447d26
FIO: Add NetBSD and OpenBSD to platforms that could use mmap and shm APIs
...
As reported in #1083
2021-10-12 18:53:56 -07:00
Mark Pizzolato
4e729165ee
FIO: Add sim_byte_swap_data routine to byte swap
...
This is an unconditional swap which may not be dependent on the
particular endian orientation of the simulated or host system.
2021-08-17 15:20:07 -07:00
Mark Pizzolato
f95b20e1f3
SCP: Cleanup potential compiler warnings
2021-08-13 09:09:53 -07:00
Mark Pizzolato
7dda50344c
FIO: Allow access to all file names with or without quotes
2021-06-08 13:06:47 -07:00
Mark Pizzolato
c004fcc2ba
SCP: Fix Coverity identified issues
2021-04-11 15:48:01 -07:00
Mark Pizzolato
ee7ab95c9c
SCP: Allow file names to be quoted in sim_fopen
2021-04-06 01:28:13 -07:00
Mark Pizzolato
076c1ef094
SCP: Add support for ~/ references to user home directory when opening files
2021-03-06 14:04:54 -08:00
Mark Pizzolato
749dd7d333
SCP: Move utility functions to sim_fio
2021-01-12 07:58:56 -08:00
Mark Pizzolato
4f215963f8
FIO: Fix name matching when glob isn't available and using fnmatch
2021-01-06 07:15:22 -08:00
Mark Pizzolato
746f806bb3
SCP: Merge minor changes from Supnik-Current branch
2020-12-18 10:02:18 -08:00
Mark Pizzolato
852c0bc1bc
SCP: Avoid seeking on attached sequential devices on non seekable files
...
As reported on #982
2020-12-14 18:48:14 -08:00
Mark Pizzolato
31606161ce
SCP: Avoid potential compiler warnings
...
Essentially all are non-functional problems but silencing them is a good idea
2020-10-09 05:09:41 -07:00
Mark Pizzolato
a73ab48c0e
SHMEM: Fix all Linux code paths to only use shm_ APIs when available
2020-07-09 08:27:57 -07:00
Mark Pizzolato
6c08fae048
SHMEM: Fix Linux code to properly use built-in's and cleanup on shutdown
...
As reported in #909
2020-07-08 12:38:10 -07:00
Mark Pizzolato
7e58080fb5
SCP: Fix file name parser to tolerate a name without any slashes in the path
2020-02-17 21:03:20 -08:00
Mark Pizzolato
d131f66c40
FIO: Fix non Win32 behaviors of sim_dir_scan
...
Allow for a file not found case to be determined and explicit file and
full directory scan when GLOB and FNMATCH aren't available.
2019-12-30 13:12:41 -08:00
Mark Pizzolato
5a59fe81fc
FIO: Fix directory scanning logic to avoid errors handling files in /
2019-11-18 16:57:20 -08:00
Mark Pizzolato
23856afcac
FIO: Avoid compiler warning on never executed code path (Tony Nicholson)
...
As suggested in #766
2019-11-14 03:08:57 -08:00
Mark Pizzolato
9fe781cb7e
SCP: Add environment variable file expansion options for file size, date/time
2019-10-28 17:40:59 -07:00