summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Remove __P and convert to ANSI prototypes.obrien2019-02-011-7/+4
| | | | * Fix SCM ID's.
* Clean up the vcs ID stringsjhb2019-02-011-3/+2
| | | | | | | | | | | | | | | | | | | in libc's gen/ directory. - Move CSRG IDs into __SCCSID(). - When a file has been copied, consistently use 'From: <tag>' for strings referencing the version of the source file copied from in the license block comment. - Some of the 'From:' tags were using $FreeBSD$ that was being expanded on each checkout. Fix those to hardcode the FreeBSD tag from the file that was copied at the time of the copy. - When multiple strings are present list them in "chronological" order, so CSRG (__SCCSID) before FreeBSD (__FBSDID). If a file came from OtherBSD and contains a CSRG ID from the OtherBSD file, use the order CSRG -> OtherBSD -> FreeBSD. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D15831
* Renumber copyright clause 4imp2019-02-011-1/+1
| | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
* scandir: Update copyright notice from FreeBSDSebastian Huber2019-02-011-3/+3
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* General further adoption of SPDX licensing ID tags.pfg2019-02-011-0/+2
| | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point.
* Cygwin: x86_64: pthreads: Install exception handler after switching stackCorinna Vinschen2019-01-301-0/+2
| | | | | | | | | | After creating a pthread, the stack gets moved to the desired memory location. While the 32 bit thread wrapper copies the exception handler information to the new stack (so we have at least *some* exception handler present), the x86_64 code didn't perform any exception handler magic. Fix that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: document W10 1803 per-directory case-sensitivity behaviourCorinna Vinschen2019-01-301-0/+33
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fork: fix child process permissions, take 2Corinna Vinschen2019-01-303-17/+8
| | | | | | | | | | | | | VirtualQueryEx, called by fixup_mmaps_after_fork, requires PROCESS_QUERY_INFORMATION permissions per MSDN. However, testing shows that PROCESS_QUERY_LIMITED_INFORMATION is sufficient when running the same code on Windows 8.1 or Windows 10. Fix the code to give the forked child always PROCESS_QUERY_INFORMATION perms on Windows Vista/7 and respective server releases. Revert now unneeded patch to check_token_membership as well. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: raise: change to call pthread_killCorinna Vinschen2019-01-302-1/+7
| | | | | | | | | | | POSIX requires that raise(3) is equivalent to pthread_kill(pthread_self(), sig); in multi-threaded applications. Our raise just called kill(sig). Fix that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: execve: reduce parent handle to non-inheritable SYNCHRONIZECorinna Vinschen2019-01-292-8/+25
| | | | | | | | | Keeping an inheritable handle open results in that handle being spilled over into grandchild processes, which is not desired. Duplicate original parent handle into a non-inheritable one with minimal SYNCHRONIZE permissions and close the original handle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fork/exec: fix child process permissionsCorinna Vinschen2019-01-295-8/+38
| | | | | | | | | | | - Exec'ed/spawned processes don't need PROCESS_DUP_HANDLE. Remove that permission from the parent handle. - PROCESS_QUERY_LIMITED_INFORMATION doesn't work for Windows 7 if the process is started as a service. Add PROCESS_QUERY_INFORMATION for pre-Windows 8 in that case. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Makefile.in: Improve dependency for version infoCorinna Vinschen2019-01-291-1/+6
| | | | | | | | | | | | The version info only depends on the object files. This results in the version info not being rebuild immediately if a source file is changed. Rather, the version info is only rebuilt on the next make run. Fix that by making the version info build rule dependent on the source files. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: procfd: improve debug outputCorinna Vinschen2019-01-281-2/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: disable unused funcs and lsaauth subdirCorinna Vinschen2019-01-283-3/+11
| | | | | | If S4U proves to be usable alone, remove this code entirely. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: spawn: revert incorrect restriction of permissionsCorinna Vinschen2019-01-271-2/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: fork: restrict parent handle perms and drop handle after useCorinna Vinschen2019-01-273-3/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: use Kerberos/MsV1_0 S4U authentication by defaultCorinna Vinschen2019-01-268-79/+353
| | | | | | | | | | | | | - This simple and official method replaces cyglsa and "create token" methods. No network share access, same as before. - lsaauth and create_token are disabled now. If problems crop up, they can be easily reactivated. If no problems crop up, they can be removed in a while, together with the lsaauth subdir. - Bump Cygwin version to 3.0. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: uname: Raise size of utsname fields and revamp uname(2) outputCorinna Vinschen2019-01-268-7/+92
| | | | | | | | | | | | | | | | New format: sysname: CYGWIN_NT-${osversion}-${os_build_number}[-WOW64] nodename: `gethostname` release: ${cygwin_version}-${API minor}.${arch}[.snap] version: YYYY-MM-DD HH:MM UTC machine: ${arch} _GNU_SOURCE: domainname: `getdomainname` !_GNU_SOURCE: __domainname: `getdomainname` Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: netdb.h: fix __GNU_VISIBLE testsCorinna Vinschen2019-01-261-3/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: create_token: Return NULL, not INVALID_HANDLE_VALUECorinna Vinschen2019-01-262-5/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: syscalls.cc: fix formattingCorinna Vinschen2019-01-261-5/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: lsaauth: Drop outdated test for loading Secur32.dllCorinna Vinschen2019-01-261-6/+0
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: work with password-less user switch as wellCorinna Vinschen2019-01-243-21/+39
| | | | | | | | | | The previous patch failed with password-less auth because in that case the return code from get_server_groups wasn't tested. Fix that. Also make sure that get_server_groups does not check if the account is disabled or locked out when just fetching the group list for initgroups or getgrouplist. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: seteuid: refuse changing uid to disabled or locked out userCorinna Vinschen2019-01-242-0/+18
| | | | | | | | | | | | So far seteuid could change uid to any existing account, given sufficient permissions of the caller. This is kind of bad since it disallows admins to refuse login to disabled or locked out accounts. Add check for the account's UF_ACCOUNTDISABLE or UF_LOCKOUT flags and don't let the user in, if one of the flags is set. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: net: unify gethostname/getdomainnameCorinna Vinschen2019-01-241-41/+36
| | | | | | | Use info from same source (GetNetworkParams). Also move getdomainname near gethostname in source. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: gethostname: fix fetching hostname from non-winsock functionCorinna Vinschen2019-01-242-1/+3
| | | | | | | | | If gethostname() fails we call GetComputerNameEx with ComputerNameDnsFullyQualified. This is wrong, gethostname should return the hostname only, not the FQDN. Fix this by calling GetComputerNameEx with ComputerNameDnsHostname. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: version: Use UTC timestamp as build timeCorinna Vinschen2019-01-241-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: cygthread: set thread name before calling thread funcCorinna Vinschen2019-01-232-2/+4
| | | | | | | | | When reusing a cygthread, the stub method fails to set the thread name to the new name. The name is only set when actually creating the thread. Fix that by moving the SetThreadName call right in front of the thread function call. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Use nanf() instead of nan() in single-precision float libm math functionsJozef Lawrynowicz2019-01-234-4/+4
| | | | | This patch reduces code size for a few single-precision float math functions, by using nanf() instead of nan() where required.
* Use HUGE_VALF instead of HUGE_VAL in single-precision float libm math functionsJozef Lawrynowicz2019-01-2316-18/+18
| | | | | This patch replaces instances of "(float).*HUGE_VAL" with a direct usage of HUGE_VALF, which is also defined in math.h.
* Remove HUGE_VAL definition from libm math functionsJozef Lawrynowicz2019-01-2331-186/+0
| | | | | | This patch removes the definitions of HUGE_VAL from some of the float math functions. HUGE_VAL is defined in newlib/libc/include/math.h, so it is not necessary to have a further definition in the math functions.
* Remove matherr, and SVID and X/Open math library configurationsJozef Lawrynowicz2019-01-2390-2350/+433
| | | | Default math library configuration is now IEEE