Commit Graph

898 Commits

Author SHA1 Message Date
Corinna Vinschen 1fc3014728 Cygwin: utils: drop 32 bit considerations
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-10-28 11:37:02 +02:00
Corinna Vinschen f51e76da0a Cygwin: regtool: drop 32 bit hint from help output
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-10-28 11:01:56 +02:00
Corinna Vinschen 1b3a0effd4 Cygwin: profiler: Fix linking when building with -DDEBUGGING
CloseHandle gets redefined to a macro calling an internal function
in debug.h when building with -DDEBUGGING, but profiler has no access
to that function.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-20 21:14:57 +02:00
Corinna Vinschen 007e23d639 Cygwin: Reorganize cygwin source dir
Create subdirs and move files accordingly:

- DevDocs:  doc files
- fhandler: fhandler sources, split fhandler.cc into base.cc and null.cc
- local_includes: local include files
- scripts:  scripts called during build
- sec:      security sources

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-05 12:02:11 +02:00
Mark Geisert aa460cc0ca Cygwin: Have gmondump support ssp-generated gmon.out
Cygwin tool ssp generates gmon.out files with different address
resolution than other tools do. Two address bytes per bucket rather than
the usual four address bytes. Gprof can deal with the difference but
gmondump can't because the latter's gmon.out header validation fails.

- Remove the offending portion of the header validation code.
- Make sure all code can handle differing address resolutions.
- Display address resolution in verbose data dumps.
- Change "rawarc" to "struct rawarc" in certain sizeof expressions to
  avoid buffer overrun faults.
- When "-v" (verbose) is specified, note when there is missing bucket
  data or rawarc data.
2022-06-10 12:12:26 +02:00
Ken Brown 30c5411d07 Cygwin: remove most occurrences of __stdcall and __cdecl
These have no effect on x86_64.  Retain a few occurrences of __cdecl
in files imported from other sources.

Also retain all occurrences of WINAPI, even though the latter is
simply a macro that expands to __stdcall.  Most of these occurrences
are associated with Windows API functions, and removing them might
make the code confusing instead of simpler.
2022-06-06 12:00:45 -04:00
Jon Turney f36dd40275
Cygwin: Drop use of loadlib.h in regtool
Link directly with RegDeleteKeyExW(), available since Vista.

(It's unclear the LoadLibrary wrapper was ever doing anything useful
here, as (i) DLL lookup in PATH was avoided as advapi32 is already
loaded into the process, and (ii) advapi32 is a 'known DLL' which is
only ever loaded from system directory)
2022-06-06 11:21:44 +01:00
Jon Turney f344134a19
Cygwin: Drop pointless loadlib.h includes in utilities
These utilities used to LoadLibrary()/GetProcAddress(), but don't
anymore.
2022-06-06 11:21:43 +01:00
Takashi Yano faf1e11592 Cygwin: pty: Fix script command crash on console in Win7.
- Previously, the command "cmd /c script -c cmd" in console of Win7
  crashes. This seems to be due to a bug (?) of AttachConsole().
  This patch adds workaround for this issue.

  Currently, pty reattaches to the console of the process which is
  predetermined by ConsoleProcessList() after temporarily attaching
  to another console. After that, the console output handle opened
  with the name "CONOUT$" may not be accessible in Win7.
  This seems to happen when the attached process does not have the
  same handle even if the console attached is the same. With this
  patch, cygwin-console-helper which is started when pty master is
  opened in console, is utilized to be a target process to which
  pty reattaches if the OS is Win7.
2022-05-15 07:25:56 +09:00
Corinna Vinschen 4f034daba7 Cygwin: utils: drop unnecessary wow64 checks
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:34:20 +02:00
Corinna Vinschen d4fa3b4abb Cygwin: config.h: stop including auto-generated tlsoffsets.h file
This was a hack to begin with.  Clean this mess up:

- Move definition of CYGTLS_PADSIZE to cygwin/config.h and drop
  local cygtls_padsize.h
- Rename CYGTLS_PADSIZE to __CYGTLS_PADSIZE__ to keep namespace
  clean.  Redefine as macro, rather than as const.
- Move struct _reent first in struct _cygtls to allow using
  __CYGTLS_PADSIZE__ as offset in __getreent().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 13:58:39 +02:00
Mark Geisert 3976513b99 Cygwin: Fix gmondump formatting goofs
The rewrite of %X to %p was malhandled.  Fix that/them.
2022-03-17 10:14:23 +01:00
Corinna Vinschen 35ba7d147d Cygwin: getconf: align -a output to glibc getconf
glibc getconf doesn't print "undefined" for undefined values
in -a output.  It just prints the empty string.  Do it the
same way.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-03-02 22:15:02 +01:00
Corinna Vinschen b794f2c603 Cygwin: drop support for systems not supporting RFC 4646 locales
i. e. Vista/2008.  This drops support for the sr_CS locale.

Regenerate LC_MESSAGES and LC_TIME ERA data from more recent Linux

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen 548f124698 Cygwin: update cygcheck OS information
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-21 18:33:35 +02:00
Ken Brown 9b0841aa78 Cygwin: statically link the tools in winsup/utils/mingw
This fixes the problem reported here:

  https://cygwin.com/pipermail/cygwin-developers/2021-September/012375.html
2021-09-17 21:38:07 -04:00
Corinna Vinschen 88c0276358 Cygwin: Allow using CFLAGS also for C++ files
This was used before switching to automake to allow easy tweaking
of optimization and debugging settings from the command line during
testing.  Reenable.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-26 22:21:53 +02:00
Corinna Vinschen 3ca80b360c Cygwin: dumper: fix up GCC pragma for g++ 11.2
The GCC diagnostic ignored "-Wstringop-overflow" pragma doesn't work
as expected anymore.  Use the still working expression.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-26 22:15:49 +02:00
Corinna Vinschen 8169e39abf Cygwin: C++17: register keyword is deprecated
The register keyword was already deprecated with C++11, but
with C++17 it has been entirely removed.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-26 22:14:11 +02:00
Mark Geisert 94ead7b76d Cygwin: More profiler format + small issue fixes
Make sure to cast to ulong all DWORD values displayed with format "%lu".
More instances are fixed here than in either my earlier unused patch or
Corinna's patch. I decided to use typedef..ulong for more compact code.

Address jturney's reported small issues:
- Remove explicit external ref for cygwin_internal() as it is already
  provided by <sys/cygwin.h>.
- Leave intact ref for cygwin_dll_path[] as it is required by function(s)
  in path.cc that profiler uses. Added comment to that effect.
- Delete existing main() wrapper. Rename main2() to main(). This because
  profiler is now a Cygwin program and doesn't need to dynamically load
  cygwin1.dll.
- Documentation issues will be addressed in a separate xml patch.

(I would have linked message-ids of Corinna's and Jon's messages for
proper theading but I no longer have their original emails and the mail
archives don't show msgids any more.)
2021-08-03 10:05:50 +02:00
Mark Geisert 99a4b087d4 Cygwin: Make gmondump conform to its doc + adjust doc
The doc for gmondump says 1 or more FILENAME are expected, but 0 is
handled. That's an oversight. Make invocation with 0 FILENAMEs print a
one-line help message.

Reword the beginning of profiler's description doc to clarify target's
child processes are run but only optionally profiled.
2021-08-03 10:00:56 +02:00
Corinna Vinschen ad8730cc91 Cygwin: utils: refresh tzmap.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28 22:19:37 +02:00
Corinna Vinschen 4f999b4eab Cygwin: utils: tzmap-from-unicode.org: enforce sorting order for LANG=C
Generating the tzmap.h file requires to use the default sorting order.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28 22:18:38 +02:00
Corinna Vinschen bf8f2a95df Cygwin: profiler: Fix formatting warnings
DWORD has different types on 32 and 64 bit.  Use a common cast to
unsigned long to use %lu format for DWORD values throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-21 10:07:22 +02:00
Mark Geisert ff9c2b3ab9
Cygwin: updates to wire in profiler, gmondump
These are updates to wire into the build tree the new tools profiler and
gmondump, and to supply documentation for the tools.

The documentation for profiler and ssp now mention each other but do not
discuss their similarities or differences.  That will be handled in a
future update to the "Profiling Cygwin Programs" section of the Cygwin
User's Guide, to be supplied.
2021-07-19 13:29:34 +01:00
Mark Geisert 4ad5b0ca31
Cygwin: New tool: gmondump
This new tool was formerly part of 'profiler' but was spun out thanks to
Jon T's reasonable review comment.  Gmondump is more of a debugging tool
than something users might have need for.  Users would more likely use
gprof to make use of symbolic info like function names and source line
numbers.
2021-07-19 13:29:13 +01:00
Mark Geisert 9bd6c0b2b1
Cygwin: New tool: profiler
The new tool formerly known as cygmon is renamed to 'profiler'.  For the
name I considered 'ipsampler' and could not think of any others.  I'm open
to a different name if any is suggested.

I decided that a discussion of the pros and cons of this profiler vs the
existing ssp should probably be in the "Profiling Cygwin Programs" section
of the Cygwin User's Guide rather than in the help for either.  That
material will be supplied at some point.

CONTEXT buffers are made child-specific and thus thread-specific since
there is one profiler thread for each child program being profiled.

The SetThreadPriority() warning comment has been expanded.

chmod() works on Cygwin so the "//XXX ineffective" comment is gone.

I decided to make the "sample all executable sections" and "sample
dynamically generated code" suggestions simply expanded comments for now.

The profiler program is now a Cygwin exe rather than a native exe.
2021-07-19 13:28:37 +01:00
Jon Turney 9a231073a5
Cygwin: Define PSAPI_VERSION as 1 before including psapi.h
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building utils since 48a76190 (and is the default in w32api
>= 9.0.0)

In order for the built executables to run on Windows Vista, we must also
define PSAPI_VERSION as 1 (otherwise '#define GetModuleFileNameExA
K32GetModuleFileNameExA' causes a 'The procedure entry point
K32GetModuleFilenameExA could not be located in the dynamic link library
kernel32.dll' error at run time).

Also drop uneeded psapi.h from dlfcn.cc (31ddf45d), resource.cc
(34a6eeab) and ps.cc (1def2148).
2021-07-09 13:24:08 +01:00
Corinna Vinschen fd84f6cf51 Cygwin: utils: enable -idirafter to fetch Cygwin headers from mingw sources
Get rid of the last dreaded relative paths pointing to the cygwin dir.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26 11:01:32 +02:00
Corinna Vinschen 48a76190e8 Cygwin: utils: set _WIN32_WINNT and NTDDI_VERSION via Makefile
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26 11:01:32 +02:00
Jon Turney a9c8050c36
Cygwin: Ensure PSAPI_VERSION is 1 when building ldd
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building ldd, which gets PSAPI_VERSION=2.

This causes K32GetModuleFileNameEx to be used for GetModuleFileNameEx,
which isn't available on Windows Vista.

Define PSAPI_VERSION as 1 for the built executable to work on Windows
Vista.
2021-05-22 16:06:51 +01:00
Christian Franke c0949782b7 Cygwin: utils: chattr: Allow to clear all attributes with '='.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
2021-05-21 12:56:59 +02:00
Corinna Vinschen 6462a0844d Cygwin: utils: ldd: use GetFinalPathNameByHandleW
drop replacement function GetFileNameFromHandle which was
only required pre-Vista.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-20 23:07:05 +02:00
Corinna Vinschen 8c6c9b097d Cygwin: utils: avoid warning when building path_testsuite-path.o
Avoid this warning:

[...]/winsup/utils/mingw/../path.cc:569:1: warning: 'void read_mounts() ' defined but not used [-Wunused-function]
  569 | read_mounts ()
      | ^~~~~~~~~~~

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-20 22:47:44 +02:00
Corinna Vinschen 3053632389 Cygwin: utils: chattr: do not default to CWD
Drop the unexpected behaviour to run chattr in the CWD if no file has
been specified on the command line.  Bail out with usage info instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-20 22:39:25 +02:00
Corinna Vinschen f8eecf22db Cygwin: utils: chattr: fix recursive behaviour
chattr [mode] dir

incorrectly recurses one level into the given directory, even if the
--recursive option has not been used.  This patch adds a test to avoid
this bug.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-20 22:32:37 +02:00
Christian Franke cb674a4ad1 Cygwin: utils: chattr: Improve option parsing, fix some messages.
Allow multiple characters also in first '-mode' argument.
Use '-H' instead of '-h' for '--help' to fix ambiguity with
hidden attribute.  Fix help and usage texts and documentation.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
2021-05-20 22:29:58 +02:00
Jon Turney 71e8b45007
Get rid of relative include paths in strace.cc 2021-05-10 14:41:41 +01:00
Jon Turney b8bd9d1b01
Move source files used in utils/mingw/ into that subdirectory
Move all the source files used in utils/mingw/ into that subdirectory,
so the built objects are in the expected place.

(path.cc requires some more unpicking, and even then there is genuinely
some shared code, so use a trivial file which includes the real path.cc
so the object file is generated where expected)
2021-05-10 14:41:40 +01:00
Jon Turney 9ce70bf450
Unpick cygpath TESTSUITE
Rather than having testsuite.h do various things, depending on defines,
just have it do one thing, and then explicitly redirect to test stubs in
path.cc when building test.
2021-05-10 14:41:39 +01:00
Corinna Vinschen cf25b55902 Cygwin: automake: change @INCLUDES@ to @AM_CPPFLAGS@ to avoid warnings
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-29 11:28:14 +02:00
Corinna Vinschen 84ffbfeb10 Cygwin: automake: fix warning in terms of the `ps' target
We are building a ps executable, but the rule to build the target
collides with an auto-generated, documentation-related `ps' rule.

Work around that by naming the executable "cygps" at build time
and use a transform rule to rename it at installation time.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-29 11:24:53 +02:00
Corinna Vinschen a26779fae0 Cygwin: drop all generated autotools files
- add autotool files generated under winsup to .gitignore

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-04-29 11:16:38 +02:00
Jon Turney 247ce0ca3a
Cygwin: Use automake (v5)
v2:
* Include tzmap.h in BUILT_SOURCES
* Make per-file flags appear after user-supplied CXXFLAGS, so they can
override optimization level.
* Correct .o files used to define symbols exported by libm.a
* Drop gcrt0.o mistakenly included in libgmon.a
* Add missing line continuations in GMON_FILES value

v3:
* use per-file flags for .c compilation
* override C{XX,}FLAGS, as they are set on the command line by top-level make

v4:
* Drop -Wno-error=write-strings from path_testsuite CXXFLAGS

v5:
* Update for changes in master
- Add -fno-threadsafe-statics to CXX flags
- Add hypotl.cc
- Remove fenv.cc (in favour of newlib), add fenv.c stub
- Add proc.5 manpage rules
2021-04-27 16:49:56 +01:00
Corinna Vinschen 604bb7126e
Cygwin: Fix remaining warnings building path testsuite 2020-12-02 15:31:58 +00:00
Jon Turney 0d0f06416a
Cygwin: Fix building of utils testsuite
Avoid referencing undefined max_mount_entry.
2020-12-02 15:31:57 +00:00
Jon Turney dc93f7ef2d
Cygwin: Remove recursive configure
There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.

The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.

Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.

Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.

Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory.  (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).

Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.

Remove generated configure and aclocal.m4 in subdirectories.
2020-11-20 15:56:11 +00:00
Jon Turney cbf8fe6dca
Cygwin: Fix 'make check' in utils
This has a test of the path translation code used in various utilities
(mount, cygpath, strace).

MOUNT_BINARY is replaced with the absence of MOUNT_TEXT since 26e0b37e.
The issys member of mnt_t struct was removed in b677a99b.

> $ make check
[...]
> total tests: 63
> pass       : 63 (100.0%)
> fail       : 0 (0.0%)
2020-11-18 16:26:36 +00:00
Jon Turney 7d5efba796
Cygwin: Drop duplicate C++ flags used to build utils
'-fno-exceptions -fno-rtti' are already present in the compile command
COMPILE.cc set by Makefile.common, so we don't need to add them to
CXXFLAGS as well.
2020-11-18 16:26:35 +00:00
Jon Turney 7fa743ca94
Cygwin: Restore setting CC and CXX Makefile variables
b55e3f19 was a bit too aggressive in dropping, rather than just
un-exporting these Makefile variables.  We need to set these to the
configured host compiler if we are cross-compiling, otherwise they
default to the build compiler.

Also export CC to the mkvers.sh script (which requires it since
4eca5e6a).  It's unclear why we can't just cause windres to use the
build 'cpp' as the pre-processor there.
2020-10-28 15:23:56 +00:00