Commit Graph

36 Commits

Author SHA1 Message Date
Corinna Vinschen 030d86d04d TZ: Replace unreliable isupper calls on wchars
In case the TZ variable is empty, Cygwin fetches timezone info from
Windows.  Extracting the timezone short name uses isupper on wide chars.
Replace with explicit check for A <= character <= Z to be independent
of undefined behaviour.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-25 12:13:03 +02:00
Corinna Vinschen c117793326 Add _tzset_unlocked and _tzset_unlocked_r
newlib:

	* libc/time/local.h (_tzset_unlocked_r): Add prototype.
	(_tzset_unlocked): Ditto.
	* libc/time/tzset.c (_tzset_unlocked): New function, call
	_tzset_unlocked_r.
	(tzset): Lock and call _tzset_unlocked_r.
	* libc/time/tzset_r (_tzset_unlocked_r): Remove locking and rename
	from _tzset_r.
	(_tzset_r): Lock and call _tzset_unlocked_r.

cygwin:

	* localtime.cc (tzset_unlocked): Export as _tzset_unlocked.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:08 +02:00
Corinna Vinschen fc55214612 * localtime.cc (__cygwin_gettzoffset): New function for access from
newlib.
	(__cygwin_gettzname): Ditto.
2015-01-08 09:37:16 +00:00
Corinna Vinschen 80d9bfa9a8 * localtime.cc (tzload): Fix loading latest timezone offsets into
tzinfo from zoneinfo files.  Add comment to explain what we do.
	(tzparse): Add more comments to explain in case of loading timezone
	offset from other sources.
2015-01-07 21:27:22 +00:00
Corinna Vinschen 28b4c8483e * localtime.cc (tzload): Fix leaking memory (CID 60001). 2014-06-23 13:38:06 +00:00
Corinna Vinschen 27afe3a4ab * localtime.cc: Define TM_GMTOFF and TM_ZONE based on __TM_GMTOFF and
__TM_ZONE being defined.  Throughout, write to these struct tm members
	only if CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS is true.
	* libc/strptime.cc: Ditto.
	* include/cygwin/version.h (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS):
	Define.
	(CYGWIN_VERSION_API_MINOR): Bump to 272.
2014-03-05 12:45:49 +00:00
Corinna Vinschen 3073f26d6a Throughout, keep function definitions and declarations in sync with
newlib in terms of C99 "restrict" keyword.
2013-11-25 11:38:08 +00:00
Corinna Vinschen b39bb1802a * Makefile.in (localtime_CFLAGS): Define as -fwrapv since localtime
code requires int overflows to be fully defined.
	* localtime.cc: Align a bit more to upstream code.
2013-05-14 13:34:05 +00:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Corinna Vinschen 593d0dc50f * localtime.cc (tzload): Don't change global timezone information
when called from gmtime or gmtime_r.
	(tzparse): Ditto.
2011-04-18 19:07:18 +00:00
Christopher Faylor 49808040c5 * localtime.cc (is_upper): Rename to isupper and include ctype.h to pull in
standard macro.
(lcl_is_set): Define as an enum.
(tzsetwall): Assign lcl_is_set to correct enum values.
(tzset): Ditto.  Copy as much of TZ as will fit to TZ buffer.
2010-10-30 19:22:42 +00:00
Corinna Vinschen 313c719cb8 * localtime.cc (time2): Take another stab at fixing a compiler warning. 2009-06-14 09:35:35 +00:00
Christopher Faylor b5b99c0486 * localtime.cc (time2): Take a stab at fixing a compiler warning. 2009-06-14 05:49:01 +00:00
Corinna Vinschen c3d7820d5b * localtime.cc (time2): Change "spring gap" to "spring forward gap"
in comment.
2009-06-12 15:08:43 +00:00
Corinna Vinschen 7ce08eab6c * localtime.cc (time2): Add workaround for spring gap problem. Add
explaining comment.
2009-06-12 15:06:26 +00:00
Corinna Vinschen 51291d61e2 * localtime.cc (tzload): Implement setting __tzrule's offset member
using newlib's __gettzinfo () interface also when tzload returns
	successfully.
2009-04-14 12:08:07 +00:00
Christopher Faylor cb7e1879ee * localtime.cc (increment_overflow): Mark as non-inline to prevent compiler
from complaining about the very thing we're trying to test.
* ntea.cc (read_ea): Reorganize to avoid a new compiler warning/error.
* sched.cc (sched_rr_get_interval): Ditto.
* select.cc (peek_serial): Ditto.
* libc/rexec.cc (ruserpass): Ditto.
* posix_ipc.cc (ipc_names): Make static to avoid a compiler warning
(and it's the right thing to do anyway).
2008-09-11 05:43:11 +00:00
Christopher Faylor b13e6864f5 Remove unneeded header files from source files throughout. 2008-04-07 18:45:59 +00:00
Corinna Vinschen ea5bc3721f * localtime.cc (tzset): Guard by a muto for thread safety. 2007-12-11 16:14:24 +00:00
Corinna Vinschen 4b93ac1f7f * localtime.cc (tzset): Call tzsetwall only if it hasn't been
called before.
2007-12-11 15:01:31 +00:00
Corinna Vinschen e9ff75192a * localtime.cc (tzsetwall): Don't set TZ. 2007-08-01 13:26:56 +00:00
Corinna Vinschen 19e7c3a068 * libc: Add subdirectory.
* Makefile.in (VPATH): Add libc subdir.
	(DLL_OFILES): Add strptime.o and timelocal.o.
	* cygwin.din: Export timelocal and timegm.
	* localtime.cc: Define STD_INSPIRED unconditionally.
	* include/cygwin/time.h (timelocal): Add declaration.
	(timegm): Ditto.
	* include/cygwin/version.h: Bump API minor version.
	* libc/strptime.cc: New file.
	* libc/timelocal.cc: New file.
	* libc/timelocal.h: New file.
2005-11-18 17:48:23 +00:00
Christopher Faylor 0c55f6ed60 Eliminate (void) cast on standalone function calls throughout. 2005-07-06 20:05:03 +00:00
Corinna Vinschen d0578adf88 * localtime.cc: Implement setting __tzrule's offset member using
newlib's __gettzinfo () interface.
	(__tzrule): Remove.
	(timezone): Define as long according to POSIX.
2005-02-23 22:17:28 +00:00
Corinna Vinschen 2d7606a594 * localtime.cc: Temporary implementation of setting __tzrule's offset
member to be used by strftime.
	(__tzrule): New global variable.
	(tzparse): Set __tzrule's offset member appropriately.
2005-02-19 19:58:38 +00:00
Christopher Faylor 6946073e78 * localtime.cc (localtime_r): Call tzset.
* Makefile.in: Make version.h/cygwin.din version check a warning since it is
not foolproof.
* cygheap.h (CYGHEAPSIZE): Bump size down.
* cygtls.h (_threadinfo::stacklock): New element.
(_threadinfo::pop): Make regparm.
(_threadinfo::lock): New function.
(_threadinfo::unlock): New function.
* cygtls.cc (_threadinfo::push): Wait for a lock on the stack before performing
the operation.
(_threadinfo::pop): Move to another file.
* cygwin.din: More SIGFE changes.
* exceptions.cc (try_to_debug): Always display messages on console.
(handle_exceptions): Unwind stack only when actually about to call sig_send.
(setup_handler): Lock stack prior to performing any operations.
* gendef (_sigfe): Ditto.
(_sigbe): Ditto.
(_threadinfo::pop): Ditto.  Move here.
* gen_tlsoffsets: Generate positive offsets.
* tlsoffsets.h: Regenerate.
2004-02-08 19:59:27 +00:00
Christopher Faylor 2e008fb91f Change use of BOOL, TRUE, FALSE to bool, true, false, as appropriate,
throughout.
* tty.cc (tty::common_init): Remove call to SetKernelObjectSecurity and edit
some comments.
* cygheap.h (init_cygheap::ctty): Add new element.
* devices.in (device::parse): Remove special handling for /dev/tty.
* devices.cc: Regenerate.
* dtable.cc (build_fh_pc): Don't reset /dev/tty device.  Let the device opener
do that.
* fhandler_termios.cc (tty_min::set_ctty): Redefine to _pinfo class.
* fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Avoid setting
noninherit flag for ctty.
* tty.h: Move BOOLs to bools.
(tty_min::set_ctty): Redeclare to _pinfo class.
* pinfo.cc (_pinfo::set_ctty): Define new function based on tty_min::set_ctty.
Change first argument from tty number to tty_min class.
* pinfo.h (_pinfo::set_ctty): Declare.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Reflect move of
set_ctty to _pinfo class.
* fhandler_tty.cc (fhandler_tty_slave::open): Treat FH_TTY specially.  Use
saved cygheap value if it exists.  Otherwise convert to real device and save on
first time open.
(fhandler_tty_common::dup): Potentially set controlling tty if duping a slave
tty.
* syscalls.cc (setsid): Close controlling tty in cygheap.
* tty.cc: Change some BOOLs to bools.
2003-12-07 22:37:12 +00:00
Corinna Vinschen cb766c47bb * include/tzfile.h: Remove duplicate definition of TM_SUNDAY.
* localtime.cc: Point TZDIR to the /usr/share/zoneinfo directory used
	by the tzcode package.
2003-12-01 10:39:17 +00:00
Pierre Humblet 63f5d32954 2002-12-19 Pierre Humblet <pierre.humblet@ieee.org>
* localtime.cc (tzsetwall): Set lcl_is_set and lcl_TZname
        in the Cygwin specific part of the routine.
2002-12-20 03:40:00 +00:00
Christopher Faylor f0227ea3c7 More GNUify non-GNU formatted functions calls throughout. 2002-09-23 00:31:31 +00:00
Corinna Vinschen 795b46cf8f * localtime.cc (tzsetwall): Use wildabbr if generated timezone name
length < 3.
2002-05-07 13:18:44 +00:00
Christopher Faylor 4b31ae795b Fix up comments. 2001-12-19 20:10:03 +00:00
Christopher Faylor bc6ed54986 * autoload.cc (wsock_init): Reorganize slightly to accomodate a new compiler. 2001-10-13 01:35:15 +00:00
Christopher Faylor 57c89867f5 Move appropriate variables to NO_COPY segment, throughout. 2001-09-06 05:17:22 +00:00
Christopher Faylor 08b78edf5a Remove initialization of static or global values to zero, throughout. This
just needlessly grows the size of the DLL.
* tty.cc (tty::alive): Make inuse handle non-inheriting on open, just for
thread safety.
2001-09-06 04:41:59 +00:00
Corinna Vinschen 09ff05f7f9 * localtime.c: Changed whole file to become C++ clean. Rename to
localtime.cc.
        * localtime.cc (tzload): Preserve errno.
2001-07-25 21:58:21 +00:00
Renamed from winsup/cygwin/localtime.c (Browse further)