summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Cygwin: fork: add PROCESS_VM_OPERATION to child process permissionsCorinna Vinschen2019-02-182-1/+14
| | | | | | ...on parent process. This is required for successful mmap propagation. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: passwd/group: allow specifying "." as local computernameCorinna Vinschen2019-02-161-1/+9
| | | | | | | Convenience only. The resulting passwd/group antry is still fully qualified. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: bump version to 3.0.1Corinna Vinschen2019-02-161-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: passwd/group: store account name case correct, take 2cygwin-3_0_0-releaseCorinna Vinschen2019-02-131-18/+23
| | | | | | | | | | The solution from commit 9a3cc77b2afc52a2faa5e4daeb59dfd4506c0693 didn't work for foreign domain accounts. Rather than calling LookupAccountSid we now use the info when we fetch it anyway via LDAP or Net*GetInfo. Only in case of domain groups we have to add an LDAP call explicitly. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: ldap.cc: fix formattingCorinna Vinschen2019-02-131-3/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: passwd/group: rename get_group_name to get_account_nameCorinna Vinschen2019-02-132-3/+2
| | | | | | The function is the same for user and grou accounts. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: passwd/group: raise local name buffer sizeCorinna Vinschen2019-02-131-1/+1
| | | | | | | | Make sure a domain+username fits into the local name buffer. The former buffer size didn't take adding a domain name to a really_really_long_user_name into account. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: passwd/group: store account name case correctCorinna Vinschen2019-02-132-0/+14
| | | | | | | | | | | | | When looking up valid accounts by name, LookupAccountName returns a SID and a case-correct domain name. However, the name was input and LookupAccountName is case-insensitive, so the name is not necessarily written the same way as in SAM or AD. Fix that by doing a reverse lookup on the just fetched SID. This fetches the account name in the correct case. Override the incoming name with the case correct name from LookupAccountSid. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: uinfo.cc: fix formattingCorinna Vinschen2019-02-131-16/+16
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: forkables: update doc, add release notesMichael Haubenwallner2019-02-113-11/+30
|
* AArch32: Fix the build for M class semihostingTamar Christina2019-02-111-1/+3
| | | | | | | | | | | | | | The M class cores don't support Semihosting v2 mixed mode, but we were accidentally using the new immediates for it. My last patch changed the immediates which broke the build because doing a full multi-lib build including M architectures now results in an assembler error instead of silently doing the wrong thing. This fixes the issue by changing the defines around such that According to the specs any M class build uses the normal semihosting instructions. Regtested on arm-none-eabi and no issues, using a build with m class multilibs too.
* Cygwin: disk device: stop using SetFilePointerCorinna Vinschen2019-02-091-3/+6
| | | | | | | This is a really old and crappy API, as the previous commit shows. Use NtQueryInformationFile(FilePositionInformation) here instead. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: execve: fix setting O_APPEND file offset for native childCorinna Vinschen2019-02-092-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | dtable::set_file_pointers_for_exec is called from child_info_spawn::worker to move the file position of O_APPEND files to EOF if the child is a native child. However, this only works correctly for the first O_APPEND file descriptor: - set_file_pointers_for_exec calls SetFilePointer. The higher 4 bytes of the desired file offset are given to SetFilePointer as pointer to a DWORD value. On return, SetFilePointer returns the higher 4 bytes of the new file position in this DWORD. - So for the second and subsequent descriptors the higher 4 byte of the file position depend on what the actual file position of the previous file has been set to: - If the file is > 2 Gigs, the high offset will not be 0 anymore. - If the desciptor points to a non-seekable file (i.e., a pipe or socket), SetFilePosition returns an error and sets the high position to -1. Fix this by calling SetFilePointerEx instead, which does not modify the incoming position value. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: change CURR_CHILD_INFO_MAGIC according to previous patchCorinna Vinschen2019-02-081-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fix child getting another pid after spawnveCorinna Vinschen2019-02-084-9/+16
| | | | | | | | | | | | | | | | | | | When calling spawnve, in contrast to execve, the parent has to create the pid for the child. With the old technique this was simply the Windows pid, but now we have to inform the child about its new pid. Add a cygpid member to class child_info_spawn. Set it in child_info_spawn::worker, just prior to calling CreateProcess rather than afterwards. Overwrite cygheap->pid in child_info_spawn::handle_spawn before calling pinfo::thisproc. Make sure pinfo::thisproc knows the pid is already set by setting the handle argument to INVALID_HANDLE_VALUE. Also set procinfo->dwProcessId to myself_initial.dwProcessId instead of to myself_initial.pid for clarity. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* AArch32: Add support for HLT to Mixed Mode modelsTamar Christina2019-02-082-7/+13
| | | | | | | | | | | | | | | | | | | | | The Semihosting v2 protocol requires us to output the Armv8-a HLT instruction when in mixed mode (SEMIHOST_V2_MIXED_MODE), however it also requires this to be done for Armv7-a and earlier architectures. The HLT instruction is defined in the undefined encoding space for older architectures but simulators such as QEMU already trap on it [1] for all architectures and is a requirement for semihosting v2 [2]. Unfortunately the GAS restricts the use of HLT to Armv8-a which requires us to use the instruction encodings we want directly in crt0. This patch does this, I have not updated newlib/libc/* as that is quite out of date already. A proper sync is needed in order to get things back in sync. A different patch for this would be best. [1] https://github.com/qemu/qemu/commit/19a6e31c9d2701ef648b70ddcfc3bf64cec8c37e [2] https://developer.arm.com/docs/100863/latest/the-semihosting-interface
* forkables: hardlink without WRITE_ATTRIBUTES firstMichael Haubenwallner2019-02-071-24/+48
| | | | | | | | | | | | When the current process has renamed (to bin) a readonly dll, we get STATUS_TRANSACTION_NOT_ACTIVE for unknown reason when subsequently creating the forkable hardlink. A workaround is to open the original file with FILE_WRITE_ATTRIBUTES access, but that fails with permission denied for users not owning the original file. * forkable.cc (dll::create_forkable): Retry hardlink creation using the original file's handle opened with FILE_WRITE_ATTRIBUTES access when the first attempt fails with STATUS_TRANSACTION_NOT_ACTIVE.
* forkables: inline dll_list::forkables_supportedMichael Haubenwallner2019-02-076-12/+10
| | | | And LONG fits better for shared_info member forkable_hardlink_support.
* forkables: simplify disabling via shmMichael Haubenwallner2019-02-075-148/+65
| | | | | | | | | | | * Rename cygwin_shared->prefer_forkable_hardlinks to forkable_hardlink_support, with values 0 for Unknown, 1 for Supported, -1 for Unsupported. Upon first dll loaded ever, dll_list::forkable_ntnamesize checks the /var/run/cygfork directory to both exist and reside on NTFS, setting cygwin_shared->forkable_hardlink_support accordingly. * Replace enum forkables_needs by bool forkables_created: Set to True by request_forkables after creating forkable hardlinks.
* forkables: use dynloaded dll's IndexNumber as dirnameMichael Haubenwallner2019-02-071-25/+8
|
* forkables: Document hardlink creation at forktime.Michael Haubenwallner2019-02-072-0/+46
| | | | | * faq-api.xml: Mention hardlink creation by fork. * highlights.xml: Describe hardlink creation.
* forkables: Keep hardlinks disabled via shared mem.Michael Haubenwallner2019-02-073-2/+16
| | | | | | | | | | | | | | | | | | | | | | | To avoid the need for each process to check the filesystem to detect that hardlink creation is impossible or disabled, cache this fact in shared memory. Removing cygfork directory while in use does disable hardlinks creation. To (re-)enable hardlinks creation, the cygfork directory has to exist before the first cygwin process does fork. * forkable.cc (dll_list::forkable_ntnamesize): Short cut forkables needs to impossible when disabled via shared memory. (dll_list::update_forkables_needs): When detecting hardlink creation as impossible (not on NTFS) while still (we are the first one checking) enabled via shared memory, disable the shared memory value. (dll_list::request_forkables): Disable the shared memory value when hardlinks creation became disabled, that is when the cygfork directory was removed. * include/cygwin/version.h: Bump CYGWIN_VERSION_SHARED_DATA 6. * shared_info.h (struct shared_info): Add member prefer_forkable_hardlinks. Update CURR_SHARED_MAGIC. * shared.cc (shared_info::initialize): Initialize prefer_forkable_hardlinks to 1 (Yes).
* forkables: On fork failure, retry with hardlinks.Michael Haubenwallner2019-02-078-33/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support in-cygwin package managers, the fork() implementation must not rely on .exe and .dll files to stay in their original location, as the package manager's job is to replace these files. Instead, when the first fork try fails, and we have NTFS, we use hardlinks to the original binaries in /var/run/cygfork/ to create the child process during the second fork try, along the main.exe.local file to enable the "DotLocal Dll Redirection" feature for the dlls. The (probably few) users that need an update-safe fork manually have to create the /var/run/cygfork/ directory for now, using: mkdir --mode=a=rwxt /var/run/cygfork * child_info.h: Bump CURR_CHILD_INFO_MAGIC. (enum child_status): Add _CI_SILENTFAIL flag. (struct child_info): Add silentfail setter and getter. * winsup.h (child_copy): Add bool silentfail parameter. * cygheap.cc: Pass silentfail parameter to child_copy. * dcrt0.cc: Ditto. * dll_init.h (struct dll): Define public inline method forkedntname. (struct dll_list): Declare private method find_by_forkedntname. * dll_init.cc (struct dll_list): Implement find_by_forkedntname. (dll_list::alloc): Use find_by_forkedntname when in load after fork. (dll_list::load_after_fork_impl): Load dlls using dll::forkedntname. * fork.cc (frok::parent): Set silentfail child info flag. Pass silentfail parameter to child_copy. Use forkedntname of dlls.main_executable. (fork): When first dofork run failed and did not use forkables, run dofork again with_forkables set to true. (child_copy): Use debug_printf if silentfail is true, system_printf otherwise.
* forkables: Create forkable hardlinks, yet unused.Michael Haubenwallner2019-02-077-5/+1207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation to protect fork() against dll- and exe-updates, create hardlinks to the main executable and each loaded dll in subdirectories of /var/run/cygfork/, if that one exists on the NTFS file system. The directory names consist of the user sid, the main executable's NTFS IndexNumber, and the most recent LastWriteTime of all involved binaries (dlls and main executable). Next to the main.exe hardlink we create the empty file main.exe.local to enable dll redirection. The name of the mutex to synchronize hardlink creation/cleanup also is assembled from these directory names, to allow for synchronized cleanup of even orphaned hardlink directories. The hardlink to each dynamically loaded dll goes into another directory, named using the NTFS IndexNumber of the dll's original directory. * Makefile.in (DLL_OFILES): Add forkable.o. * dll_init.h (struct dll): Declare member variables fbi, fii, forkable_ntname. Declare methods nominate_forkable, create_forkable. (struct dll_list): Declare enum forkables_needs. Declare member variables forkables_dirx_size, forkables_dirx_ntname, forkables_mutex_name, forkables_mutex. Declare private methods forkable_ntnamesize, prepare_forkables_nomination, update_forkables_needs, update_forkables, create_forkables, denominate_forkables, close_mutex, try_remove_forkables, set_forkables_inheritance, request_forkables. Declare public static methods ntopenfile, read_fii, read_fbi. Declare public methods release_forkables, cleanup_forkables. Define public inline method setup_forkables. * dll_init.cc (dll_list::alloc): Allocate memory to hold the name of the hardlink in struct dll member forkable_ntname. Initialize struct dll members fbi, fii. (dll_list::load_after_fork): Call release_forkables method. * fork.cc: Rename public fork function to static dofork, add with_forkables as bool pointer parameter. Add new fork function calling dofork. (struct frok): Add bool pointer member with_forkables, add as constructor parameter. (frok::parent): Call dlls.setup_forkables before CreateProcessW, dlls.release_forkables afterwards. * pinfo.cc (pinfo::exit): Call dlls.cleanup_forkables. * syscalls.cc (_unlink_nt): Rename public unlink_nt function to static _unlink_nt, with 'shareable' as additional argument. (unlink_nt): New, wrap _unlink_nt for original behaviour. (unlink_nt_shareable): New, wrap _unlink_nt to keep a binary file still loadable while removing one of its hardlinks. * forkable.cc: New file. Implement static functions mkdirs, rmdirs, rmdirs_synchronized, stat_real_file_once, format_IndexNumber, rootname, sidname, exename, lwtimename. Define static array forkable_nameparts. (struct dll): Implement nominate_forkable, create_forkable. (struct dll_list): Implement static methods ntopenfile, read_fii, read_fbi. Implement forkable_ntnamesize,
* dll_list: Track main executable and cygwin1.dll.Michael Haubenwallner2019-02-073-9/+36
| | | | | | | | | | | | | | | | | | | | | | Even for the main executable and cygwin1.dll store the file name as full NT path. Create the child process using the main executable's file name converted from the full NT path stored before. * dll_init.cc (dll_list::alloc): Search for DLL_SELF type entry with module name like for DLL_LINK, use full NT path to search for DLL_LOAD type only. For DLL_SELF type do not indicate having a destructor to be called. (dll_list::find): Ignore DLL_SELF type entries. (dll_list::init): Ditto. Call track_self method. (dll_list::track_self): New. (dll_list::load_after_fork): Call track_self method. * dll_init.h (enum dll_type): Add DLL_SELF, for the main executable and cygwin1.dll. (struct dll_list): Declare private method track_self. Declare member variable main_executable. * fork.cc (frok::parent): Use ntname from dlls.main_executable to create child process, converted to short path using dll_list::buffered_shortname.
* dll_list: Store dll file name as full NT path.Michael Haubenwallner2019-02-073-69/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Store loaded dll's file name as full NT path. * dll_init.h (struct dll): Rename member variable name to ntname. (struct dll_list): Declare private static member variable nt_max_path_buffer. Declare public static methods form_ntname, form_shortname. Define public static methods nt_max_path_buf, buffered_shortname. (dll_list::operator []): Use PCWCHAR rather than const PWCHAR. (dll_list::find_by_modname): Ditto. * dll_init.cc (in_load_after_fork): Define earlier in file. (struct dll_list): Rename member variable name to ntname. Define nt_max_path_buffer variable. Implement static methods form_ntname, form_shortname. (dll_list::operator []): Use PCWCHAR rather than const PWCHAR. (dll_list::find_by_modname): Ditto. (reserve_at): Ditto. (release_at): Ditto. (dll_list::alloc): Use nt_max_path_buf method instead of local buffer. Store module file name as full NT path, convert using the form_ntname static method. (dll_list::load_after_fork): Call load_after_fork_impl only when reload_on_fork is set. * fork.cc (frok::child): Call dlls.load_after_fork even without need to dynamically load dlls. (frok::parent): Move syscall_printf into the retry loop.
* Cygwin: unlink: allow fallback from POSIX to default methodCorinna Vinschen2019-02-061-1/+5
| | | | | | | | | Trying to delete in-use executables and DLLs using FILE_DISPOSITION_POSIX_SEMANTICS returns STATUS_CANNOT_DELETE. Fall back to the former method if that error occurs to allow unlinking these files. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: proc fd: fix handling of pipes, sockets, etcCorinna Vinschen2019-02-053-7/+15
| | | | | | | | | | | | | | | | | | | The symlink target of /proc/PID/fd files pointing to pipes and sockets are just artificial filenames referencing the object using some internal number. The pipe open code expects a path specifying process pid and the internal number so it access the right process and pipe. - Set the posix path of the pipe to the simple pipe name only, as it shows up in /proc/PID/fd. A /proc/self prefix is just as wrong as a /dev/fd prefix. - Revert thinko in fhandler_pipe::open expecting the name as /proc/self/fd/... In fact this should never happen. - Fix up the path before re-opening the pipe instead. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: proc fd: fix a copy/paste bug calling file_pathconvCorinna Vinschen2019-02-051-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: proc fd: pass along open mode when reopening fileCorinna Vinschen2019-02-054-6/+6
| | | | | | | | The reopen code neglected to pass along the requested open mode correctly. This may end up reopening the file with incorrect access mask, or duplicating the wrong pipe handle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fork: terminate child process unconditionally in error caseCorinna Vinschen2019-02-051-3/+6
| | | | | | | Move TerminateProcess call into cleanup code to make sure child doesn't linger in some border cases. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* fork: remove cygpid.N sharedmem on fork failureMichael Haubenwallner2019-02-051-1/+4
| | | | | | | | | | When fork finally fails although both CreateProcess and creating the "cygpid.N" shared memory section succeeded, we have to release that shared memory section as well - before releasing the process handle. Otherways we leave an orphan "cygpid.N" shared memory section, and any subsequent cygwin process receiving the same PID fails to initialize. * fork.cc (frok::parent): Call child.allow_remove in cleanup code.
* Cygwin: timerfd: drop outdated TODO commentCorinna Vinschen2019-02-041-1/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fix typoCorinna Vinschen2019-02-022-2/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: tweak Cygwin PID change release noteCorinna Vinschen2019-02-022-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: kill(1): introduce a -W optionCorinna Vinschen2019-02-024-20/+59
| | | | | | Allow to kill processes using Windows PIDs on the command line. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: spawn: create and maintain winpid symlinksCorinna Vinschen2019-02-022-5/+26
| | | | | | | | | | | | - If the execve'ed process is a non-Cygwin process, we have to create the matching winpid symlink and remove the old one ourselves. - If we spawn a child, the winpid symlink has to be maintained by the child process, otherwise it disappears if the parent process exits. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: pinfo: simplify create_winpid_symlinkCorinna Vinschen2019-02-022-6/+5
| | | | | | | | The arguments are not used anyway, so drop them. When called, procinfo->dwProcessId is already set right, so we don't have to access myself_initial. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: kill(1): revert casts required for 32 bit to avoid spurious warningsCorinna Vinschen2019-02-021-2/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Makefile.in: Fix previous version info generation fixCorinna Vinschen2019-02-021-3/+4
| | | | | | | Commit 231ad6941f9ade7bde67d27929da5a776ebd9457 looks good... as long as you never build Cygwin from scratch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: kill(1): disallow killing process using raw Windows PIDCorinna Vinschen2019-02-021-19/+22
| | | | | | | | | This may end up killing the wrong process. Only allow Cygwin PID. Slightly clean up code: Remove outdated W95 considerations. Fix a bug in commandline argument processing. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: processes: fix handling of native Windows processesCorinna Vinschen2019-02-023-5/+11
| | | | | | | | | | | | | | Since commit b5e1003722cb14235c4f166be72c09acdffc62ea, native Windows processes not started by Cygwin processes don't have a Cygwin PID anymore. This breaks ps -W and kill -f <WINPID>. Introduce MAX_PID (65536 for now). Cygwin processes as well as native Windows processes started from a Cygwin process get a PID < MAX_PID. All other native Windows processes get a faked Cygwin PID >= MAX_PID. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Makefile.in: Fix another dependency problem in version infoCorinna Vinschen2019-02-021-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: processes: use dedicated Cygwin PID rather than Windows PIDCorinna Vinschen2019-02-0111-156/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the Windows PID as Cygwin PID has a few drawbacks: - the PIDs on Windows get reused quickly. Some POSIX applications choke on that, so we need extra code to avoid too quick PID reuse. - The code to avoid PID reuse keeps parent process handles and (depending on a build option) child processes open unnecessarily. - After an execve, the process has a split personality: Its Windows PID is a new PID, while its Cygwin PID is the PID of the execve caller process. This requires to keep two procinfo shared sections open, the second just to redirect process info requests to the first, correct one. This patch changes the way Cygwin PIDs are generated: - Cygwin PIDs are generated independently of the Windows PID, in a way expected by POSIX processes. The PIDs are created incrementally in the range between 2 and 65535, round-robin. - On startup of the first Cygwin process, choose a semi-random start PID for the first process in the lower PID range to make the PIDs slightly unpredictable. This may not be necessary but it seems kind of inviting to know that the first Cygwin process always starts with PID 2. - Every process not only creates the shared procinfo section, but also a symlink in the NT namespace, symlinking the Windows PID to the Cygwin PID. This drops the need for the extra procinfo section after execve. - Don't keep other process handles around unnecessarily. - Simplify the code creating/opening the shared procinfo section and make a clear distinction between interfaces getting a Cygwin PID and interfaces getting a Windows PID. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: remove outdated vfork docCorinna Vinschen2019-02-011-36/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: /proc: don't exit prematurely from /proc/PID/statusCorinna Vinschen2019-02-011-3/+2
| | | | | | | | | If a process is just exiting, requesting memory info may fail with STATUS_PROCESS_IS_TERMINATING. Right now the code just bails out if fetching mem info fails. However, the rest of the info is still valuable for procps, so just carry on. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Add pthread exception handling patch to release notesCorinna Vinschen2019-02-011-1/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* scandir: Add support for struct dirent::d_typeSebastian Huber2019-02-011-1/+4
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* a) Use strcoll() in opendir() and alphasort()ache2019-02-011-3/+4
| | | | | | | | | | | | | | | | | as POSIX 2008 requires. It also matches now how our 'ls' works for years. b) Remove comment expressed 2 fears: 1) One just simple describe how strcoll() works in _any_ context, not for directories only. Are we plan to remove strcoll() from everything just because it is little more complex than strcmp()? I doubt, and directories give nothing different here. Moreover, strcoll() used in 'ls' for years and nobody complaints yet. 2) Plain wrong statement about undefined strcoll() behaviour. strcoll() always gives predictable results, falling back to strcmp() on any trouble, see strcoll(3). No objections from -current list discussion.
* scandir(3) previously used st_sizedas2019-02-011-53/+31
| | | | | | | | | | | | | | to obtain an initial estimate of the array length needed to store all the directory entries. Although BSD has historically guaranteed that st_size is the size of the directory file, POSIX does not, and more to the point, some recent filesystems such as ZFS use st_size to mean something else. The fix is to not stat the directory at all, set the initial array size to 32 entries, and realloc it in powers of 2 if that proves insufficient. PR: 113668