Commit graph

116 commits

Author SHA1 Message Date
rfm
6f94c90d98 fix leak 2024-06-18 12:03:01 +01:00
rfm
4d0b00776c Memory leak improvments 2024-06-18 11:23:15 +01:00
rfm
67c53d6598 No exception when closing a file more than once 2024-06-10 11:51:47 +01:00
Litherum
e39309a7e9 -[NSFileHandle initWithFileDescriptor:] logs a message each time fstat() doesn't succeed on UNIX
fstat() on UNIX isn't guaranteed to always succeed, even if the file handle is valid. Special files may or may not support fstat() in the kernel.

(For context, I'm working on a Vulkan application. Vulkan has facilities to send certain objects across processes by representing the objects as file descriptors. These file descriptors still need to be close()d, which makes them good candidates for wrapping an NSFileHandle around them, but they do not support fstat(). I'm creating multiple of these each frame in the application, which means the line "unable to get status of descriptor" appears very often in the terminal while my application is running.)
2024-06-09 14:17:29 -07:00
rfm
90e0460466 acceidentally missed from earlier commit 2024-02-13 15:04:23 +00:00
rfm
2df0df5450 move tcp tune code to be shared between windows and unix 2024-01-30 15:26:34 +00:00
rfm
46e7064393 Stream debug and event handling improvements 2024-01-30 15:08:31 +00:00
Riccardo Mottola
72e8335bd9 check for a valid file and check for ftruncate() result and throw exception in case 2023-09-18 23:40:13 +02:00
Richard Frith-Macdonald
e3b7fa5720 Fix for possible crash after instance deallocated 2023-06-15 10:21:39 +01:00
Richard Frith-Macdonald
a5a1ef0413 Ignorew writabel descriptor when we have nothng to write 2023-05-04 09:59:31 +01:00
Richard Frith-Macdonald
12c88716d0 indentation tweaks 2021-05-19 11:06:10 +01:00
Richard Frith-Macdonald
8b8fe60070 break out of loop if write fails 2021-05-15 17:53:44 +01:00
Richard Frith-Macdonald
ed9bb899a7 Support writing large chunks of data over tls on windows 2021-05-15 16:10:23 +01:00
Frederik Seiffert
b05481a8c8 Don't resurrect GSFileHandle singletons.
It seems to be no longer possible to call -retain from -dealloc with the latest libobjc2, which was causing the tests to fail.

We are also throwing an exception in this case, which would need to be specifically caught in order for the resurrection to be of value to users, so this simply removes the -retain call and resets the singleton variables to nil in order to not have invalid pointers and for the singletons to be re-created on subsequent access.
2021-03-26 13:17:36 +01:00
Gregory John Casamento
753c907938 Fix address for FSF and License name in all headers in base 2019-12-09 18:36:00 -05:00
Richard Frith-Macdonald
2425c42ace Cosmetic tweaks to match coding style 2019-06-06 14:16:30 +01:00
Frederik Seiffert
9f01876102 Added option to specify Android asset reading mode. 2019-05-24 09:29:24 +02:00
Frederik Seiffert
3b60b1a8be Added support for asset loading on Android.
Requires passing the activity's AssetManager object from Java to GNUstep by calling +[NSBundle setJavaAssetManager:withJNIEnv:], which then enables the following features:

- NSBundle main bundle resource paths support for Android assets, e.g. for pathForResource:ofType:, URLForResource:ofType: and related methods.
- NSBundle main bundle info dictionary support if Info.plist exists in Android assets.
- -initWithContentsOfFile: and related methods support for reading Android assets from main bundle in various classes (e.g. NSData, NSDictionary, NSArray, etc.).
- NSFileManager fileExistsAtPath:(isDirectory:) and isReadableFileAtPath: return YES for main bundle asset / asset directory paths.
- NSFileHandle support for reading Android assets from main bundle.
- NSDirectoryEnumerator support for enumerating Android assets from main bundle. Note that recursion into subdirectories is currently not supported by the native Android asset manager API (see https://issuetracker.google.com/issues/37002833).

Also adds support for automatic NSProcessInfo initialization on Android with a fake executable path "/data/data/<app identifier>/exe" (as Android apps don't have a real executable path), and tweaks main bundle initialization to allow that path. Main bundle resource paths are prefixed by "/data/data/<app identifier>/Resources".
2019-05-23 15:44:07 +02:00
Richard Frith-Macdonald
890eaa9d32 don't copy address info ifg getpeername fails 2018-02-04 10:10:57 +00:00
Richard Frith-Macdonald
78087d0aa4 tweak to keep checker happy 2018-02-04 08:28:51 +00:00
Richard Frith-Macdonald
3884a82c7a comment on why descriptor is NOT leaked 2018-01-30 07:36:53 +00:00
Richard Frith-MacDonald
62d2bcbabc changes for use of _WIN32 define on windows
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39492 72102866-910b-0410-8b05-ffd578937521
2016-03-09 13:16:16 +00:00
Richard Frith-MacDonald
d3aab9bc45 win32 standard io fixup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39454 72102866-910b-0410-8b05-ffd578937521
2016-03-04 18:06:01 +00:00
Richard Frith-MacDonald
d91dd0b821 File handle deallocation fix suggested by David
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38937 72102866-910b-0410-8b05-ffd578937521
2015-08-28 09:21:45 +00:00
Richard Frith-MacDonald
2ef7040ac3 Add Yavor's lfs patch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38010 72102866-910b-0410-8b05-ffd578937521
2014-07-25 10:38:20 +00:00
Richard Frith-MacDonald
218565e3d0 New option to control delay between shutdown and fianl close
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37418 72102866-910b-0410-8b05-ffd578937521
2013-11-27 17:05:32 +00:00
Richard Frith-MacDonald
fab72a3218 Try to cope with failure of remote end to respond to tls shutdown.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37417 72102866-910b-0410-8b05-ffd578937521
2013-11-27 12:26:33 +00:00
Richard Frith-MacDonald
33c451f902 try to ensure all data is written on socket shutdown
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37402 72102866-910b-0410-8b05-ffd578937521
2013-11-23 14:46:48 +00:00
Richard Frith-MacDonald
22e7f7bae9 fix for delay in tls write
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37397 72102866-910b-0410-8b05-ffd578937521
2013-11-22 16:33:46 +00:00
Richard Frith-MacDonald
4803d56747 revert
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37391 72102866-910b-0410-8b05-ffd578937521
2013-11-21 16:45:01 +00:00
Richard Frith-MacDonald
12f935a8e4 Reorganise a bit to ensure that TLS is properly shut down before the network
connection it relies on is closed.  Needed in case information is buffered
in the TLS layer and needs flushing to the remote end before shutdown.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37390 72102866-910b-0410-8b05-ffd578937521
2013-11-21 15:13:14 +00:00
Richard Frith-MacDonald
163a0d9601 Fix for singleton stdin,stdout,stderr retention
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37289 72102866-910b-0410-8b05-ffd578937521
2013-10-27 05:42:40 +00:00
Richard Frith-MacDonald
f46a145ba4 quicker resource cleanup on handshake failure
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37273 72102866-910b-0410-8b05-ffd578937521
2013-10-24 13:35:32 +00:00
Richard Frith-MacDonald
f4270e4e0f test code for network send/receive buffers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37253 72102866-910b-0410-8b05-ffd578937521
2013-10-18 07:30:49 +00:00
David Chisnall
a725079d00 Fix a bug whereby the singleton NSFileHandle instances (stdin, stdout, stderr) are autoreleased and become dangling pointers on exit.
Reported on Stack Overflow:
http://stackoverflow.com/questions/19389749/why-gnustep-nsrunloop-quits-immediately-with-arc



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37245 72102866-910b-0410-8b05-ffd578937521
2013-10-16 13:08:38 +00:00
Richard Frith-MacDonald
ed09c55959 leak detection improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37003 72102866-910b-0410-8b05-ffd578937521
2013-08-22 15:44:54 +00:00
Richard Frith-MacDonald
3f773a24fc improve system error messages
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35764 72102866-910b-0410-8b05-ffd578937521
2012-10-30 13:35:00 +00:00
Richard Frith-MacDonald
0be505308d simplification, including use of strtoull() everywhere
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35503 72102866-910b-0410-8b05-ffd578937521
2012-09-03 13:36:45 +00:00
Niels Grewe
ee4052bf6d Compatibility improvements for QNX.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35451 72102866-910b-0410-8b05-ffd578937521
2012-08-26 08:55:49 +00:00
Richard Frith-MacDonald
32fc733268 changes to support alternative header locations
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34290 72102866-910b-0410-8b05-ffd578937521
2011-12-15 09:42:39 +00:00
Richard Frith-MacDonald
d0807c3dec retry after interrupts
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34111 72102866-910b-0410-8b05-ffd578937521
2011-11-02 17:19:37 +00:00
Richard Frith-MacDonald
37f430d9d9 tidyup private api
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34029 72102866-910b-0410-8b05-ffd578937521
2011-10-19 15:25:38 +00:00
Richard Frith-MacDonald
eb8b275c1f internal workaround for clang namespace pollution.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33993 72102866-910b-0410-8b05-ffd578937521
2011-10-14 15:46:13 +00:00
Richard Frith-MacDonald
fbdcab1d55 solaris thread-saff errrno fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33983 72102866-910b-0410-8b05-ffd578937521
2011-10-14 11:40:34 +00:00
Richard Frith-MacDonald
fcd8fefb9a tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33980 72102866-910b-0410-8b05-ffd578937521
2011-10-14 09:34:35 +00:00
Richard Frith-MacDonald
9e781c5714 tweak for reporting error code of connection failure
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33977 72102866-910b-0410-8b05-ffd578937521
2011-10-13 13:39:35 +00:00
Richard Frith-MacDonald
9b24a41871 build new private functions on win32
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33975 72102866-910b-0410-8b05-ffd578937521
2011-10-12 16:31:30 +00:00
Richard Frith-MacDonald
364fb1ec98 networking portability for for solaris
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33951 72102866-910b-0410-8b05-ffd578937521
2011-10-08 16:29:19 +00:00
Richard Frith-MacDonald
afc6974925 Provisional IPv6 support added.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33933 72102866-910b-0410-8b05-ffd578937521
2011-10-03 16:03:19 +00:00
Richard Frith-MacDonald
ae8059e5c1 use errno.h for thread safety
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33028 72102866-910b-0410-8b05-ffd578937521
2011-05-12 16:08:10 +00:00