Commit Graph
188 Commits
Author SHA1 Message Date
andrey 3a39b64d21 fix(PISPI): close fd on ioctl error paths
Three ioctl calls after successful open() returned false without
closing the file descriptor, leaking one fd per failed open attempt.
2026-08-06 10:19:18 +03:00
andrey cd90f92deb fix(PIDir): initialize list pointer and check scandir return
dirent** list was uninitialized, so scandir failure (returning -1)
left it with indeterminate value. The unconditional free(list) at
the end was then UB — typically heap corruption or crash.
2026-08-06 10:18:57 +03:00
andrey 40b5d2812c fix(PISharedMemory): reset data and unlink on mmap failure
When mmap() returned MAP_FAILED, data stayed as (void*)-1, causing
subsequent read/write/close to pass the null guard and crash.
Now resets data=nullptr, and calls shm_unlink when owner=true to
avoid orphaned shared memory objects.
2026-08-06 10:18:40 +03:00
andrey 049a46e515 fix: interfaceAddress buffer overflow on long interface names 2026-08-05 23:26:01 +03:00
andrey 079323130c fix: SIOCGIFMTU passes int* instead of ifreq* (Android) 2026-08-05 23:26:00 +03:00
andrey 580ee2eb11 fix: SIOCGIFNETMASK reads ifr_addr instead of ifr_netmask 2026-08-05 23:25:59 +03:00
andrey 367c2e6447 fix: PICAN openDevice buffer overflow in ifr_name 2026-08-05 23:25:58 +03:00
andrey 46c5b1975e small fixes 2026-08-05 23:25:57 +03:00
andrey 1ddec15b87 threadsafe fixes 2026-08-05 19:48:01 +03:00
andrey 13a9a75f79 fix(PISerial): break infinite loop when readDevice returns <= 0
In the blocking read path (timeout_ms <= 0), the while loop had no
exit condition for readDevice() returning 0 (EOF) or -1 (error).
This caused an infinite busy-loop at 100% CPU. Added 'else break'
to exit the loop on read failure, matching the timeout branch
which already handles this case.
2026-08-05 17:39:37 +03:00
andrey b2e637ee2b fix(PIIOByteArray): advance pos by actual bytes read, not requested size
readDevice() did pos += size instead of pos += ret. The clamping
on the next line (pos = min(pos, data_->size_s())) masked the
issue in practice, but the semantics were wrong. Aligns with
writeDevice() which correctly uses pos += rs.size_s().
2026-08-05 17:39:37 +03:00
andrey 9cd56ab66c fix(PIEthernet): check open() return value with >= 0 instead of != 0
open() returns -1 on error. The check fd != 0 treated -1 as a
valid fd (since -1 != 0 is true), causing devctl(-1, ...) and
close(-1) on QNX. Fixed to fd >= 0.
2026-08-05 17:39:36 +03:00
andrey e89ae88f3a fix(PICAN): align socket handling with PIEthernet patterns
- Sentinel: sock = 0 → sock = -1 (0 is stdin, valid fd)
- openDevice(): close socket on ioctl/bind failure (resource leak)
- openDevice(): set O_NONBLOCK via fcntl after socket()
- openDevice(): check setsockopt() return value
- closeDevice(): call shutdown() before close(), reset sock to -1
- readDevice() / writeDevice(): guard against sock == -1
- Add missing #include <fcntl.h>
2026-08-05 17:39:35 +03:00
andrey 427130e2ca fix 2 2026-08-05 12:48:40 +03:00
andrey 42dd5945dd review fixes 2026-08-05 12:46:43 +03:00
andrey dc69ebe5ae fix memleak in PIEthernet::interfaces for android 2026-08-05 12:06:03 +03:00
andrey 11d6f7b0db piethernet replace inet_ntoa by threadsafe inet_ntop 2026-08-05 12:05:09 +03:00
andrey c53f1d39aa fix piethernet blocking write return value 2026-08-05 12:03:56 +03:00
andrey 96c22e1184 move std function 2026-03-20 16:31:30 +03:00
andrey c02b627d47 some fixes
PIEthernet::listen
PIClientServer::Server::~Server
PISystemTime const sleep
ClientServer tests fast and stable
2026-03-17 20:14:22 +03:00
peri4 ed13838237 merged AI doc, some new pages 2026-03-12 14:46:57 +03:00
peri4 db954ffdaa version 5.5.0
add PIIODevice::threadedReadTimeout
2025-09-29 18:48:20 +03:00
peri4 daab41e41e add options for fftw3 precisions
configureFromFullPathDevice for all devices now trim() components
2025-09-23 21:16:54 +03:00
peri4 c05b8b4095 fix all PIFile::readAll calls 2025-09-05 21:50:35 +03:00
peri4 a299ada873 PIFile::readAll release
patch deploy_tool: ignore libc.so and take last dpkg dependency instead of first
2025-09-05 21:46:44 +03:00
peri4 91144ad338 new PIFile::readAll test 2025-09-04 17:52:31 +03:00
peri4 27f37c9cc1 fix PIFile::readAll(force = true) 2025-08-15 18:32:21 +03:00
peri4 b6c5d65a8d version 5.0.0_beta
integrate PIRegularExpression into PIString and PIDir
add piliterals_regularexpression.h for ""_regex and ""_glob literals
2025-08-13 18:48:01 +03:00
andrey 64e142b8c6 fix warning tmpnam 2025-08-13 11:17:31 +03:00
peri4 ed3d4c4217 PIJSON::new* now accept optional initial fields 2025-07-09 12:41:23 +03:00
andrey 7b52f6d70d fix get mtu (#186)
Reviewed-on: #186
2025-06-26 10:52:36 +03:00
peri4 8e18ec15c9 add PIBinaryLog::threadedReadRecord event (with full info) 2025-03-04 20:20:09 +03:00
peri4 8e96750046 version 4.7.0
add PIEthernet socket options setReadBufferSize() and setWriteBufferSize()
add PIByteArray::dataAs
2025-02-06 11:13:43 +03:00
peri4 d01baffb0b PITimeMeasurer remove some API, add elapsedAndReset()
got rid off some warnings
2025-01-17 11:49:24 +03:00
peri4 15548de79c version 4.5.0
PIThread::stopAndWait now returns bool
PIKbdListener on Linux now use piwaitevent_p and can immediately stop
new base method piZeroMemory, also migrate all "memset 0" to piZeroMemory
2024-12-29 11:48:24 +03:00
peri4 caa7880cc4 get rid of piForeach
apply some code analyzer recommendations
ICU flag now check if libicu exists
prepare for more accurate growth of containers (limited PoT, then constantly increase size)
2024-11-20 20:01:47 +03:00
peri4 57f8c1313e first release of translation facility
* runtime - loading and translating
 * design-time - works with *.ts file (pip_tr utility)
 * compile-time - CMake macro for compile *.ts
2024-11-05 13:49:00 +03:00
peri4 cd7e053fc5 version 4.2.0
move toStdFunction() to pibase.h
refactor PIParseHelper, now it much more abstract and useful
fix PIIODevice::createFromFullPath() when whitespaces at start or end are presence
PIStreamPacker add events for start and end packet receive
PIClientServer::ClientBase add virtual methods for start and end packet receive. also one can enable diagnostics with enableDiagnostics() method
PICout now call flush() on each end of output
add PIString::entries(const PIString & str)
2024-10-15 12:02:18 +03:00
peri4 aa963a4bda PIEthernet on error close disconnect 2024-09-17 16:50:22 +03:00
peri4 bdd18b614f PIEthernet more accuracy construct
PIThread windows fix
2024-09-17 16:11:18 +03:00
peri4 e186e0adff shorter thread names 2024-09-17 15:58:06 +03:00
peri4 f105f616f6 PIThread more accurate end, PIEthernet tcpserver client no reinit 2024-09-17 13:22:20 +03:00
peri4 224412e20a PIDir::temporary fix 2024-09-16 16:24:11 +03:00
peri4 000ce2a54d PICout improvement:
* renamed private members for more clear code
 * registerExternalBufferID() method to obtain unique ID for withExternalBuffer()
 * PICoutManipulators::PICoutStdStream enum for select stream (stdout or stderr)
 * Constructors now accept optional stream
 * piCerr and piCerrObj macros

PIDir::temporary() moved to "mkdtemp"

PILog:
 * now 4 levels
 * you can set max level
 * Error writes to piCerr
2024-09-16 16:06:07 +03:00
peri4 996b7ea403 important:
* PIThread::~PIThread() now unregister itself from introspection, if terminates than show warning
 * PISystemMonitor now correctly stops
 * PIPeer now can correctly stopAndWait
 * PIPeer::destroy(), protected method for close all eths and threads
 * new PIINTROSPECTION_STOP macro
 * Introspection now can be correctly stopped by macro, more safety

ClientServer:
 * ClientBase::close() stop and disconnect channel
 * Server clients clean-up now event-based
 * No warnings on client destructor
2024-09-12 17:07:48 +03:00
peri4 da4b09be9e PIEthernet fix tcp-server close (properly delete all clients)
PIEthernet::stopThreadedListen() method
decompose client to 2 implementations - server-side and client-side
2024-09-11 21:41:55 +03:00
peri4 0d94699206 first try, works 2024-09-11 10:18:45 +03:00
peri4 7d02f710ea add PIPackedTCP 2024-08-02 14:43:42 +03:00
peri4 1c7fc39b6c version 4.0.0_alpha
in almost all methods removed timeouts in milliseconds, replaced to PISystemTime
PITimer rewrite, remove internal impl, now only thread implementation, API similar to PIThread
PITimer API no longer pass void*
PIPeer, PIConnection improved stability on reinit and exit
PISystemTime new methods
pisd now exit without hanging
2024-07-30 14:18:02 +03:00
peri4 f041d1435e PIIODevice::waitThreadedReadFinished now periodically (100 ms) call interrupt() 2024-07-10 18:36:29 +03:00