Commit Graph

141 Commits

Author SHA1 Message Date
Corinna Vinschen 663b4ab824 cygserver: Speed up non-debug scenario
_log/_vlog were always called so we always had a function call hit even
if we're not debugging.  Expand on the debugging macros so the decision
to call _log/_vlog is done in the caller already.  Also, make a log level
difference between syscall_printf and system_printf.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 17:55:36 +01:00
Corinna Vinschen 4dbcfeb7d0 cygserver: Small code cleanup
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 17:53:40 +01:00
Corinna Vinschen b80b2c0119 cygserver: Revamp thread sleep handling
The current implementation is a very simple approach to implement
a statically sized sleep queue.  The problem is that this code requires
a certain amount of synchronization because the slots in the queue are
used dynamically.  To top it off, the Event objects used for sync'ing
are created and destroyed on demand.  This is complicated, slow, and
error prone.

There's also a blatant bug here: The number of slots in the queue was
wrongly computed in size.  It was too small if XSI IPC was used a lot.

Make the code more robust.  Let the queue have the right size.  Every
slot is now used for a specific IPC object.  All sync objects (switched
to Semaphores) are only created when first required, but never destroyed.
This reduces the usage of a critical section to the creation of a new
sync object.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 17:53:34 +01:00
Corinna Vinschen 0b73dba4de cygserver: raise number of worker threads on demand
The number of threads in the worker pool is fixed so far.  This is a
problem in XSI IPC scenarions with an unknown number of consumers.
It doesn't make sense to make the pool very big for a start, but when
the need arises, we need to make sure we can serve the request even if
all other worker threads are in a wait state.

This patch changes threaded_queue to just add another worker thread
if all current workers are busy.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 16:18:26 +01:00
Corinna Vinschen 838eaf6674 cygserver: Only print basename of source in debug output to raise readability
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 16:12:52 +01:00
Corinna Vinschen 8d6a522877 cygserver: Seralize debug output to stdout to raise readability
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-03-24 16:12:00 +01:00
Corinna Vinschen 6e623e9320 Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause.

Everything else stays under GPLv3+.

New Linking Exception exempts resulting executables from LGPLv3 section 4.

Add CONTRIBUTORS file to keep track of licensing.

Remove 'Copyright Red Hat Inc' comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23 10:09:17 +02:00
Peter Foley e7e6119241 Rename without-mingw-progs to with-cross-bootstrap
Rename without-mingw-progs to with-cross-bootstrap, since it now
disables additional checks that are problematic for cross-compilers.

When cross-compiling a toolchain targeting cygwin, building cygwin1.dll
requires libgcc.
However, building libgcc requires the cygwin headers to be
installed.
Configuring cygwin requries the mingw-crt libraries, which require the
cygwin headers to be installed.
Work around this circular dependency by making the
--with-cross-bootstrap configure option skip cygwin's configure checks
for valid mingw-crt libraries. Cygwin will still properly link against
these libraries if they exist, but this allows configure to succeed even
if the libraries have not been built yet.
Since the mingw-crt libraries only require the cygwin headers to be
installed, this allows us to successfully configure cygwin so that we
can only install the headers without trying to build any
libraries.

winsup/ChangeLog
configure.ac: rename without-mingw-progs option to with-cross-bootstrap
configure: regenerate
winsup/cygserver/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-cross-bootstrap
configure: regenerate
winsup/cygwin/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-cross-bootstrap
configure: regenerate

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-04-04 16:39:41 +02:00
Corinna Vinschen 6436024c4c Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET, fix AC_INIT usage
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-30 14:09:19 +02:00
Peter Foley 6699e21ffb Remove misleading indentation
GCC 6.0+ warns on misleading indentation, so fix it.

winsup/cygserver/ChangeLog
* sysv_msg.cc (msgsnd): Fix misleading indentation.
* sysv_msg.cc (msgrcv): Ditto.
* sysv_sem.cc (semop): Ditto.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-03-21 20:16:01 +01:00
Corinna Vinschen 3df400dc83 winsup: Move all old CVS Changelogs into CVSChangeLogs.old dir 2016-03-19 13:59:52 +01:00
Corinna Vinschen 9ee2624240 Deprecate all winsup ChangeLog files
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-01-07 21:16:01 +01:00
Corinna Vinschen c9baa8a65b * pwdgrp.cc: Handle default fetch_user_arg_type_t in switches
throughout to silence compiler.
2015-02-23 21:00:31 +00:00
Corinna Vinschen 4c8daae24d * Makefile.in: Simplify rule to build dependencies from cygwin dir. 2015-01-28 11:46:25 +00:00
Corinna Vinschen 8d8f40361f * bsd_helper.h: Throughout, convert "struct thread" to "class thread".
* bsd_mutex.cc (_msleep): Fetch signal_arrived handle from thread's
	ipcblk.
	* process.h (class process): Drop _signal_arrived and align methods.
	(process_cache::process): Drop signal_arrived parameter.
	* process.cc (process::process): Ditto.  Drop related code.
	(process::~process): Drop closing signal_arrived handle.
	(process_cache::process): Drop signal_arrived parameter in call to
	process::process.
	(thread::dup_signal_arrived): New method duplicating thread's
	signal_arrived handle.
	(thread::close_signal_arrived): New method closing thread's
	signal_arrived handle.
	* msg.cc (client_request_msg::serve): Drop signal_arrived parameter from
	call to process_cache::process. Use thread constructor to initialize td.
	* sem.cc (client_request_sem::serve): Ditto.
	* shm.cc (client_request_shm::serve): Ditto.
2015-01-19 17:42:38 +00:00
Corinna Vinschen 0f3cacfaa5 * cygserver-config: Add -N option to allow different service name. 2014-11-06 16:36:42 +00:00
Corinna Vinschen 7e46c0af62 * configure.ac: Convert to new AC_INIT style.
* configure: Regenerate.
2014-08-15 21:24:35 +00:00
Corinna Vinschen feab3623c0 Fix typo 2014-07-16 08:30:20 +00:00
Corinna Vinschen cf06a0b18c * bsd_helper.cc (ipcexit_creat_hookthread): Delete shs in another error
case to make Coverity really happy (CID 59993).
2014-06-23 15:13:12 +00:00
Corinna Vinschen efaf85c5e6 * client.cc: Throughout, fix debug output of signed byte count value. 2014-06-23 09:17:24 +00:00
Corinna Vinschen 111727904f * bsd_mutex.cc (msleep_sync_array::~msleep_sync_array): New destructor
to make Coverity happy (CID 59838).
2014-05-19 09:52:43 +00:00
Corinna Vinschen ca6183c344 * bsd_helper.cc (ipcexit_creat_hookthread): Delete shs to make
Coverity happy (CID 59993).
	* transport_pipes.cc (transport_layer_pipes::listen): Make listen_pipe
	and connect_pipe statics to make Coverity happy (CID 60010/60011).
2014-05-19 09:49:15 +00:00
Corinna Vinschen d98d7f3973 * pwdgrp.cc (client_request_pwdgrp::pwd_serve): Add 1 to the message
length to account for the trailing NUL.
2014-04-16 09:26:41 +00:00
Corinna Vinschen b5a7cb02cd * cygserver-config: Use numeric id 18 instead of "system" in chown. 2014-04-16 08:44:58 +00:00
Corinna Vinschen d2ee481248 * process.cc (process::process): Only notice that signal_arrived is
NULL in debug output.
2014-04-07 11:19:29 +00:00
Corinna Vinschen 600afd99ab * Makefile.in (OBJS): Add pwdgrp.o.
* client.cc (client_request::handle_request): Handle
	CYGSERVER_REQUEST_PWDGRP message.
	* pwdgrp.cc: New file implementing CYGSERVER_REQUEST_PWDGRP.
2014-03-12 17:37:04 +00:00
Corinna Vinschen 681bb2f78a * Throughout, fix format specifiers in debug statements to accommodate
x86_64.
2014-03-12 16:00:48 +00:00
Corinna Vinschen 722c840b35 * setpwd.cc (client_request_setpwd::serve): Use RtlSecureZeroMemory to
delete password from memory.
2014-03-06 17:02:18 +00:00
Christopher Faylor 2a6d6db8e2 winsup/ChangeLog:
2013-11-06  Christopher Faylor  <me.cygwin2013@cgf.cx>

	* configure.ac: Detect windows headers/libs after we've figured out the
	C compiler.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.
	* configure.cygwin: Default to '.' if can't find a winsup directory.

winsup/cygserver/ChangeLog:
2013-11-06  Christopher Faylor  <me.cygwin2013@cgf.cx>

	* configure.ac: Detect windows headers/libs after we've figured out the
	C compiler.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.

winsup/cygwin/ChangeLog:
2013-11-06  Christopher Faylor  <me.cygwin2013@cgf.cx>

	* configure.ac: Detect windows headers/libs after we've figured out the
	C compiler.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.

winsup/utils/ChangeLog:
2013-11-06  Christopher Faylor  <me.cygwin2013@cgf.cx>

	* configure.ac: Detect windows headers/libs after we've figured out the
	C compiler.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.
2013-11-07 00:19:52 +00:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Christopher Faylor 065b05f2df * Makefile.in: Remove old from CFLAGS and move C*FLAGS so that they can be
manipulated by Makefile.common.
2012-11-28 03:23:41 +00:00
Christopher Faylor d4f4d1d0d6 ChangeLog:
2012-11-26  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* configure.ac: Rename from configure.in.
	* configure.in: Delete.
	* configure: Regenerate.

cygserver/ChangeLog:
2012-11-26  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* configure.ac: Rename from configure.in.
	* configure.in: Delete.
	* configure: Regenerate.

cygwin/ChangeLog:
2012-11-26  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* configure.ac: Rename from configure.in.
	* configure.in: Delete.
	* configure: Regenerate.

doc/ChangeLog:
2012-11-26  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* configure.ac: Rename from configure.in.
	* configure.in: Delete.
	* configure: Regenerate.

lsaauth/ChangeLog:
2012-11-26  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* configure.ac: Rename from configure.in.
	* configure.in: Delete.
	* configure: Regenerate.

testsuite/ChangeLog:
2012-11-26  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* configure.ac: Rename from configure.in.
	* configure.in: Delete.
	* configure: Regenerate.

utils/ChangeLog:
2012-11-26  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* configure.ac: Rename from configure.in.
	* configure.in: Delete.
	* configure: Regenerate.
2012-11-26 19:50:45 +00:00
Corinna Vinschen 6f125cff2b * transport_pipes.cc (pipe_instance_lock_once): Remove.
(pipe_instance_lock): Remove.
	(pipe_instance): Remove.
	(initialise_pipe_instance_lock): Remove.
	(transport_layer_pipes::accept): Drop entire pipe_instance handling.
	(transport_layer_pipes::close): Ditto.
2012-11-26 12:33:07 +00:00
Corinna Vinschen 5ed0628cf0 * cygserver.cc (main): Call listen right after creating the
transport.
	* transport_pipes.cc (transport_layer_pipes::listen): Create
	first instance of the named pipe here.  Connect the client side
	to block it for further use by the system.
	(transport_layer_pipes::accept): Don't handle first pipe instance
	here.  Change debug output accordingly.
2012-11-23 15:19:41 +00:00
Christopher Faylor 2e488e9543 cygwin/ChangeLog:
2012-11-23  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* Makefile.in: Use explicit path to mkdir.

lsaauth/ChangeLog:
2012-11-23  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* Makefile.in: Use /bin/mkdir to make directories.

testsuite/ChangeLog:
2012-11-23  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* Makefile.in: Remove old Makefile.common'isms.  Don't rely on
	in-build tools.
2012-11-23 14:52:07 +00:00
Corinna Vinschen 102bf65058 * sysv_sem.cc (semundo_clear): Move condition to break from
inner loop to the right spot.
2012-11-23 14:32:02 +00:00
Christopher Faylor 4c36016b57 ChangeLog:
2012-11-12  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* Makefile.common: Revamp for new configury.  Add default compilation
	targets, include .E processing.  Add magic for allowing "CFLAGS" to
	control optimization options in "CXXFLAGS".
	* configure.cygwin: New include for Cygwin configure.in's.
	* acinclude.m4: Delete old definitions.  Implement AC_WINDOWS_HEADERS,
	AC_WINDOWS_LIBS, AC_CYGWIN_INCLUDES, target_builddir, winsup_srcdir.
	* aclocal.m4: Regenerate.
	* autogen.sh: New file.
	* ccwrap: New script.
	* c++wrap: New script.
	* config.guess: New script.
	* config.sub: New script.
	* configure: Regenerate.
	* configure.in: Eliminate LIB_AC_PROG_* calls in favor of standard.
	Delete ancient target test.
	* install-sh: New script.

cygserver/ChangeLog:
2012-11-12  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* Makefile.in: Revamp for new configury.
	* configure.in: Revamp for new configury.
	* aclocal.m4: Regenerate.
	* configure: Ditto.
	* autogen.sh: New script.

cygwin/ChangeLog:
2012-11-22  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* select.cc (select): Don't return -1 when we've timed out after
	looping.

2012-11-22  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* Makefile.in: Revamp for new configury.
	(datarootdir): Add variable setting.
	(winver_stamp): Accommodate changes to mkvers.sh setting.
	(libc.a): Fix race when libm.a might not have been built yet.
	* configure.in: Revamp for new configury.
	* aclocal.m4: Regenerate.
	* configure: Ditto.
	* autogen.sh: New script.
	* mkvers.sh: Find include directives via CFLAGS and friends rather than
	assuming that w32api lives nearby.

utils/ChangeLog:
2012-11-12  Christopher Faylor  <me.cygwin2012@cgf.cx>

	* aclocal.m4: Regenerate.
	* configure: Ditto.
	* autogen.sh: New script.
	* configure.in: Revamp for new configury.
	* Makefile.in: Revamp for new configury.  Rename ALL_* to just *.
	Always use "VERBOSE" setting.
	(MINGW_CXX): Don't include CFLAGS in definition.
	(all): Define target first, before everything else so that it is the
	default.
	(ps.exe): Don't add useless -lcygwin.
	(ldh.exe): For consistency, add to existing MINGW_LDFLAGS rather than
	redefining them.
	(cygcheck.exe): Always include -lz for MINGW_LDFLAGS.  Don't try to
	figure out where to find it.
	(dumper.exe): Simplify check.  Assume libraries are installed rather
	than trying to retrieve from source tree.
	(install): Just use /bin/mkdir to create directories.
	(Makefile): Regenerate when standard dependencies change.
	* dump_setup.cc: Always include zlib.h.  Remove accommodations for it
	possibly not existing.
	* parse_pe.cc: Add define which allows building with installed
	binutils package.
	* dumper.cc: Ditto.
2012-11-23 13:22:47 +00:00
Corinna Vinschen 0f93784fcc * bsd_helper.cc (adjust_identity_info): Fix typo in log message. 2012-10-25 08:08:39 +00:00
Corinna Vinschen 847a5f899b * woutsup.h: Just include winlean.h. 2012-07-19 17:56:46 +00:00
Christopher Faylor a1b22837ae * client.cc: Revert sigproc.h inclusion since it was fixed elsewhere. 2012-03-19 20:52:55 +00:00
Corinna Vinschen 971d94e260 * client.cc: Include sigproc.h if __INSIDE_CYGWIN__ is defined. 2012-03-19 19:25:01 +00:00
Christopher Faylor 548dc6a14d * client.cc: Remove unneeded #include "sigproc.h". 2012-03-19 17:47:05 +00:00
Corinna Vinschen ab9108200f * transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
Always use cygwin_internal to fetch installation key.
2012-02-14 14:12:11 +00:00
Corinna Vinschen 9e9bc3a4e4 * cygserver.cc (print_usage): Align output to utilities in utils
directory.
	(print_version): Ditto.
2011-10-10 15:48:54 +00:00
Yaakov Selkowitz 28c2fbeed8 * sysv_shm.cc (ACCESSPERMS): Remove to fix redefined warning, as
this is now defined in <sys/stat.h>.
2011-08-19 01:41:49 +00:00
Corinna Vinschen 4bd8eb7d1b * configure.in: Remove AC_ALLOCA test and test for __builtin_memset.
* configure: Regenerate.
2011-02-07 16:22:02 +00:00
Christopher Faylor c0f1ded4c4 * transport_pipes.cc: Include ntdef.h to accommodate cygerrno.h. 2010-04-20 03:44:38 +00:00
Corinna Vinschen 969afaf753 * Makefile.in (cygserver.exe): Link with -static to avoid linking
against cygstdc++-6.dll due to references to __cxa_pure_virtual.
2009-11-16 08:50:07 +00:00
Corinna Vinschen 1636ce3b32 * transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
Check cygwin_internal for returning 0 rather than for != 0.
	(transport_layer_pipes::accept): Add debug output.
	(transport_layer_pipes::connect): Ditto.
2009-11-06 13:11:52 +00:00
Corinna Vinschen b079a89e25 * transport_pipes.h (PIPE_NAME_PREFIX): New define.
(PIPE_NAME_SUFFIX): Ditto.
	(class transport_layer_pipes): Convert _pipe_name from char pointer
	to wchar_t array.
	* transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
	Accommodate the fact that _pipe_name is a wchar_t array, rather than
	a char pointer.
	(transport_layer_pipes::transport_layer_pipes): Initialize _pipe_name
	with variable pipe name based in installation key fetched from Cygwin
	DLL.
	(transport_layer_pipes::accept): Call CreateNamedPipeW explicitely.
	(transport_layer_pipes::connect): Call CreateFileW and WaitNamedPipeW
	explicitely.
2009-10-31 13:24:43 +00:00