#
314447 |
|
01-Mar-2017 |
emaste |
MFC r313774: localtime: return NULL if time_t out of range of struct tm
Previously we would truncate tm.tm_year for any time_t corresponding to a year that does not fit in int. This issue was discovered because it caused the bash-static build to fail when linking with LLD.
As reported by Rafael EspĂndola:
Configure has
AC_FUNC_MKTIME
which expands to a test of mktime that fails with the freebsd implementation. Given that, bash compiles a mktime.o file that defines just mktime and uses localtime. That goes in a .a file that is before libc.
The freebsd libc defines mktime in localtime.o, which also defines localtime among other functions.
When lld sees an undefined reference to mktime from libc, it uses the bash provided one and then tries to find a definition of localtime. It is found on libc's localtime.o, but now we have a duplicated error.
The reason it works with bfd is that bash doesn't use mktime directly and the undefined reference from libc is resolved to the libc implementation. It would also fail to link if bash itself directly used mktime.
The bash-static configure test verifies that, for many values of t, either localtime(t) returns NULL or mktime(localtime(t)) == t. This test failed when localtime returned a truncated tm_year.
This was fixed in tzcode in 2004 but has persisted in our tree since rS2708.
Sponsored by: The FreeBSD Foundation
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
289027 |
|
08-Oct-2015 |
rodrigc |
Merge: commit 400ecf36bb0b73f6390f9641e6cb8bbfb91a5cfd Author: Paul Eggert <eggert@cs.ucla.edu> Date: Fri Oct 12 07:53:12 2012 -0700
Assume C89.
https://github.com/eggert/tz/commit/400ecf36bb0b73f6390f9641e6cb8bbfb91a5cfd
|
#
274365 |
|
11-Nov-2014 |
ngie |
Revert WiP to contrib/tzcode accidentally committed with r274364
|
#
274364 |
|
11-Nov-2014 |
ngie |
Add baud rate support to telnet(1)
This implements part of RFC-2217
It's based off a patch originally written by Sujal Patel at Isilon, and contributions from other Isilon employees.
PR: 173728 Phabric: D995 Reviewed by: markj, markm MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
|
#
226828 |
|
27-Oct-2011 |
trociny |
Fix a memory leak in tzload().
Reported by: valgrind Reviewed by: kib MFC after: 3 days
|
#
225677 |
|
19-Sep-2011 |
kib |
Do not overallocate on the stack. Threaded code might use custom stack size.
Reported by: many Tested by: Jeremie Le Hen <jeremie@le-hen.org> (previous version) Reviewed by: jilles Approved by: re (bz) MFC after: 2 weeks
|
#
214411 |
|
27-Oct-2010 |
edwin |
Sync code with tzcode2010m
asctime.c: * Set errno to EINVAL and return "??? ??? ?? ??:??:?? ????\n" if asctime_r is called with a NULL struct tm pointer. (Note that asctime_r is called by ctime_r and asctime; asctime is called by ctime.)
localtime.c: * Set errno to EINVAL and return WRONG if time1 is called with a NULL struct tm pointer; avoid dereference if a NULL struct tm pointer is passed to timelocal, timegm, or timeoff. (Note that time1 is called by mktime, timegm, and timeoff; mktime is called by timelocal.) * more core-avoidance work * Change to set timezone and altzone based on time types with greatest transition times (for the benefit of Asia/Seoul).
zic.8: * Warning about case-sensitivity of names, but not of abbrevations
zic.c: * Conditionally output extra types with most-recently-use offsets last (for use by systems with pre-2011 versions of localtime.c, helping to ensure that globals "altzone and "timezone" get set correctly).
The code has been running for nearly four weeks on my laptop running FreeBSD 8.1 without a problem.
MFC after: 1 month
|
#
204333 |
|
25-Feb-2010 |
edwin |
Copy lib/libc/stdtime to contrib/tzcode/stdtime for the proper split of contributed code and FreeBSD specific code.
|
#
201669 |
|
06-Jan-2010 |
jhb |
Use _pthread_once() rather than _once() for localtime() and gmtime(). These methods are only invoked when __isthreaded is true at which point it is safe to use _pthread_once() directly.
MFC after: 1 week
|
#
201270 |
|
30-Dec-2009 |
jhb |
Use _once() to initialize the pthread key for thread-local storage to hold the results of gmtime() instead of using a pthread mutex directly.
MFC after: 1 week
|
#
200797 |
|
21-Dec-2009 |
jhb |
Use _once() to initialize the pthread key for thread-local storage to hold the results of localtime() instead of using a pthread mutex directly.
MFC after: 1 week
|
#
199607 |
|
20-Nov-2009 |
jhb |
Replace gmt_is_set and the gmt_mutex lock with a pthread_once_t variable and an init routine run on the first invocation via _once().
MFC after: 1 week
|
#
197189 |
|
14-Sep-2009 |
edwin |
Improve the way failure of pthread_key_create() gets detected.
PR: threads/138603 Submitted by: Mikulas Patocka MFC after: 1 week
|
#
194783 |
|
23-Jun-2009 |
edwin |
Remove duplicate if-statement on gmt_is_set in gmtsub().
MFC after: 1 week
|
#
192625 |
|
23-May-2009 |
edwin |
MFV of tzcode2009e:
Upgrade of the tzcode from 2004a to 2009e.
Changes are numerous, but include...
- New format of the output of zic, which supports both 32 and 64 bit time_t formats.
- zdump on 64 bit platforms will actually produce some output instead of doing nothing for a looooooooong time.
- linux_base-fX, with X >= at least 8, will work without problems related to the local time again.
The original patch, based on the 2008e, has been running for a long time on both my laptop and desktop machine and have been tested by other people.
After the installation of this code and the running of zic(8), you need to run tzsetup(8) again to install the new datafile.
Approved by: wollman@ for usr.sbin/zic MFC after: 1 month
|
#
177824 |
|
01-Apr-2008 |
davidxu |
Normally, we are often reading local time rather than setting time zone, replace mutex with rwlock, this should eliminate lock contention in most cases.
|
#
174766 |
|
19-Dec-2007 |
imp |
Reduce lock contention for simple cases.
# this really should be done with pthread_once, but I've debugged this code.
Reviewed by: arch@
|
#
166102 |
|
18-Jan-2007 |
imp |
On FreeBSD/arm, any value > 50 bits will result in a rediculously huge number being returned for mktime and timegm calls. Choose 48 because that works well. This does reduce the dynamic range of tm_year from about 2 billion years down to "only" about 9 million years. Please contact me if this restriction poses a problem.
Due to the complexity of the code, I admit that I didn't trace down what, exactly, was overflowing with longer bits. This fixes software that we run on the embedded systems we have.
|
#
134231 |
|
23-Aug-2004 |
peter |
struct tm.tm_year is listed as 'years since 1900', and is signed. On 64 bit systems, years roughly -2^31 through 2^31 can be represented in time_t without any trouble. 32 bit time_t systems only range from roughly 1902 through 2038. As a consequence, none of the date munging code for all the various calendar tweaks before then is present. There are other problems including the fact that there was no 'year zero' and so on. So rather than get excited about trying to figure out when the calendar jumped by two weeks etc, simply disallow negative (ie: prior to 1900) years.
This happens to have an important side effect. If you bzero a 'struct tm', it corresponds to 'Jan 0, 1900, 00:00 GMT'. This happens to be representable (after canonification) in 64 bit time_t space. Zero tm structs are generally an error and mktime normally returns -1 for them. Interestingly, it tries to canonify the 'jan 0' to 'dec 31, 1899', ie: year -1. This conveniently trips the negative year test above, which means we can trivially detect the null 'tm' struct.
This actually tripped up code at work. :-/ (Don't ask)
|
#
130461 |
|
14-Jun-2004 |
stefanf |
Merge changes from the tzcode2004a import. Wherever possible I tried to bring us closer to the vendor branch.
Requested by: wollman
|
#
130332 |
|
11-Jun-2004 |
kensmith |
Change defualt time zone from GMT to UTC. This will not be MFC-ed, and was done before 5-STABLE on purpose...
|
#
130244 |
|
08-Jun-2004 |
stefanf |
Remove a couple of casts added for an ancient Sun compiler.
Approved by: das (mentor)
|
#
111010 |
|
16-Feb-2003 |
nectar |
Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go). Only warnings that could be fixed without changing the generated object code and without restructuring the source code have been handled.
Reviewed by: /sbin/md5
|
#
107648 |
|
05-Dec-2002 |
peter |
Do not guarantee an overflow of tm_year when doing the binary search in localtime/mktime/tmcomp and friends on ia64.
Approved by: re
|
#
107480 |
|
01-Dec-2002 |
peter |
Replace rev 1.33 with a real fix. The problem was integer overflows when trying to store the year in a signed int. The maximum time_t on ia64 is around 292 billion years in the future, but 'int' and struct tm.tm_year can only represent then ext 2.1 billion years or so.
This solves the problem of mktime/localtime looping on ia64. Unfortunately, the standards say that tm_year is an 'int', so we are still stuck with a y2147483647 bug. bash2's configure script looks for bugs in mktime() and fails on ia64 because of this. However, mktime() on FreeBSD fails the test normally anyway so this is no big loss.
This change does not affect any other platforms besides ia64.
Approved by: re
|
#
102885 |
|
03-Sep-2002 |
peter |
Fix a nasty bug exposed by mktime() when time_t is significantly bigger than 32 bits. It was trying to figure out things like the day of week of when time_t is roughly 2^62 etc. Make a better guess for the starting point for the binary search that works on both 32 and 64 bit types. I have been using this for a while now.
|
#
97423 |
|
28-May-2002 |
alfred |
Remove use of __P() (actually P()) from code now that it's no longer available.
|
#
95989 |
|
03-May-2002 |
wollman |
Fix fd leak. Threads people: does the call above to `access' need to be underscored as well?
PR: 37717 Submitted by: fred@clift.org (slightly modified by me)
|
#
92986 |
|
22-Mar-2002 |
obrien |
Fix the style of the SCM ID's. I believe have made all of libc .c's as consistent as possible.
|
#
92889 |
|
21-Mar-2002 |
obrien |
Remove 'register' keyword.
|
#
77785 |
|
05-Jun-2001 |
wollman |
Don't mung the user's tm_sec field if we don't need to. (Belt-and-suspenders version.)
PR: bin/27630 Submitted by: Arthur David Olson <ado@nci.nih.gov> Obtained from: Timezone mailing-list <tz@elsie.nci.nih.gov> MFC after: 1 month
|
#
72524 |
|
15-Feb-2001 |
tegge |
Don't depend on lcl_mutex being a recursive mutex.
Reviewed by: deischen
|
#
71579 |
|
24-Jan-2001 |
deischen |
Remove _THREAD_SAFE and make libc thread-safe by default by adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in.
Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo
Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo.
Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible.
Remove uneeded includes of <errno.h> from a few files.
Add $FreeBSD$ to a few files in order to pass commitprep.
Approved by: -arch
|
#
57822 |
|
08-Mar-2000 |
cracauer |
Temporary cosmetic change to prevent gcc-2.95.2 from doing an optimization that generates code our current as doesn't understand.
The result is bad code that damages dynamic symbol locations at runtime. Ouch. See PR bin/16862 and discussion in -current.
This change will be backed out when gcc and gas are back in sync.
PR: Fixes bin/16862, but not the underlying problem. Submitted by: bde Approved by: jdk
|
#
56698 |
|
27-Jan-2000 |
jasone |
Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(), just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo().
Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().
Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid().
Make thread cancellation fully POSIX-compliant.
Suggested by: deischen
|
#
55837 |
|
12-Jan-2000 |
jasone |
Add three-tier symbol naming in support of POSIX thread cancellation points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
|
#
42989 |
|
21-Jan-1999 |
wollman |
Merge from vendor branch: timezone file structure changes and doco. Fix localtime.c to deal with new magic number field.
Obtained from: ftp://elsie.nci.nih.gov/pub/tzcode1999a.tar.gz
|
#
42293 |
|
04-Jan-1999 |
dt |
Make ctime_r, asctime_r, gmtime_r, and localtime_r available in libc.
|
#
39327 |
|
16-Sep-1998 |
imp |
Replace memory leaking instances of realloc with non-leaking reallocf. In some cases replace if (a == null) a = malloc(x); else a = realloc(a, x); with simple reallocf(a, x). Per ANSI-C, this is guaranteed to be the same thing.
I've been running these on my system here w/o ill effects for some time. However, the CTM-express is at part 6 of 34 for the CAM changes, so I've not been able to do a build world with the CAM in the tree with these changes. Shouldn't impact anything, but...
|
#
35331 |
|
20-Apr-1998 |
phk |
Add a #ifdef _THREAD_SAFE around ctime_r
|
#
35285 |
|
19-Apr-1998 |
phk |
ctime_r and asctime_r are not implemented. prototypes in time.h do not match POSIX.
PR: 6345 Reviewed by: phk Submitted by: Dmitry Khrustalev <dima@xyzzy.machaon.ru>
|
#
35026 |
|
04-Apr-1998 |
jb |
Change in name of the static initializer define.
|
#
33527 |
|
17-Feb-1998 |
julian |
Submitted by: Jeremy Allison (jallison@whistle.com) fix a slight confusion about which draft of threads we are supporting. this allows something as big and ugly as samba to be compiled with libc_r and still work! our user-level pthreads seems amazingly robust!
|
#
24253 |
|
25-Mar-1997 |
imp |
Back out 1.14 until I reproduce trouble reports
|
#
24195 |
|
24-Mar-1997 |
imp |
Don't open the tz file if we're running setuid or setgid to prevent infomration leakage.
Submitted by: Julian Assange
|
#
22315 |
|
05-Feb-1997 |
julian |
Submitted by: John Birrell uthreads update from the author.
|
#
21659 |
|
13-Jan-1997 |
wollman |
When attempting to load a `lastditch' timezone (e.g., because the load of the user's timezone failed), don't bail if the specified timezone doesn't have an offset; in this case it isn't going to. (Perhaps it would be better to change the caller to always supply one, but this is quick and clean and fixes the bug in the easiest possible way.)
Should be in 2.2. Fixes (properly) PR#1740.
|
#
19636 |
|
11-Nov-1996 |
hsu |
Parameters for localtime_r() and gmtime_r() definitions changed. Parameters for pthread_getspecific() call changed. pthread_keycreate() renamed to pthread_key_create().
|
#
18834 |
|
09-Oct-1996 |
wollman |
Require that a timezone specified via the TZ envariable be a regular file (and not a directory or a device which might also be readable). Closes PR#1740.
|
#
17706 |
|
20-Aug-1996 |
julian |
Submitted by: John Birrell <cimaxp1!jb@werple.net.au>
Here are the diffs for libc_r to get it one step closer to P1003.1c These make most of the thread/mutex/condvar structures opaque to the user. There are three functions which have been renamed with _np suffixes because they are extensions to P1003.1c (I did them for JAVA, which needs to suspend/resume threads and also start threads suspended).
I've created a new header (pthread_np.h) for the non-POSIX stuff.
The egrep tags stuff in /usr/src/lib/libc_r/Makefile that I uncommented doesn't work. I think its best to delete it. I don't think libc_r needs tags anyway, 'cause most of the source is in libc which does have tags.
also:
Here's the first batch of man pages for the thread functions. The diff to /usr/src/lib/libc_r/Makefile removes some stuff that was inherited from /usr/src/lib/libc/Makefile that should only be done with libc.
also:
I should have sent this diff with the pthread(3) man page. It allows people to type
make -DWANT_LIBC_R world
to get libc_r built with the rest of the world. I put this in the pthread(3) man page. The default is still not to build libc_r.
also: The diff attached adds a pthread(3) man page to /usr/src/share/man/man3. The idea is that without libc_r installed, this man page will give people enough info to know that they have to build libc_r.
|
#
17209 |
|
18-Jul-1996 |
wollman |
Merge the recently-imported tzcode96h distribution (libc portion). The part that does zic(8)/zdump(8) is still yet to be imported (but the old zic and zdump will work just fine with these header files and the data format has not changed).
|
#
15927 |
|
27-May-1996 |
scrappy |
Removed false copyrights...
|
#
15923 |
|
27-May-1996 |
scrappy |
Added in appropriate Berkeley copyright and RCS Id: string
Closes PR#doc/536
|
#
13545 |
|
21-Jan-1996 |
julian |
Reviewed by: julian and (hsu?) Submitted by: John Birrel(L?)
changes for threadsafe operations
|
#
9936 |
|
05-Aug-1995 |
wollman |
The European Commission went out and invented a new sort of summer-time changeover, so we have to extend the format of timezone files (in a backward- compatible way, of course). This probably means that libc needs a minor version number bump before 2.2 is released (or maybe not).
|
#
8870 |
|
30-May-1995 |
rgrimes |
Remove trailing whitespace.
|
#
2713 |
|
13-Sep-1994 |
wollman |
Port to FreeBSD. Not ready for inclusion in libc just yet, but here so we can compile zic.
|
#
2711 |
|
13-Sep-1994 |
wollman |
This commit was generated by cvs2svn to compensate for changes in r2710, which included commits to RCS files with non-trunk default branches.
|
#
2710 |
|
13-Sep-1994 |
wollman |
One more try, and if it doesn't work this time I'm giving up. (Check in original localtime.c.)
|
#
2708 |
|
13-Sep-1994 |
wollman |
The rest of tzcode94g from Arthur David Olson.
Obtained From: Arthur David Olson, ftp://elsie.nci.nih.gov/pub/tzcode94g.tar.gz
|