- 13 9月, 2018 11 次提交
-
-
由 Rich Felker 提交于
libc.h was intended to be a header for access to global libc state and related interfaces, but ended up included all over the place because it was the way to get the weak_alias macro. most of the inclusions removed here are places where weak_alias was needed. a few were recently introduced for hidden. some go all the way back to when libc.h defined CANCELPT_BEGIN and _END, and all (wrongly implemented) cancellation points had to include it. remaining spurious users are mostly callers of the LOCK/UNLOCK macros and files that use the LFS64 macro to define the awful *64 aliases. in a few places, new inclusion of libc.h is added because several internal headers no longer implicitly include libc.h. declarations for __lockfile and __unlockfile are moved from libc.h to stdio_impl.h so that the latter does not need libc.h. putting them in libc.h made no sense at all, since the macros in stdio_impl.h are needed to use them correctly anyway.
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
commits leading up to this one have moved the vast majority of libc-internal interface declarations to appropriate internal headers, allowing them to be type-checked and setting the stage to limit their visibility. the ones that have not yet been moved are mostly namespace-protected aliases for standard/public interfaces, which exist to facilitate implementing plain C functions in terms of POSIX functionality, or C or POSIX functionality in terms of extensions that are not standardized. some don't quite fit this description, but are "internally public" interfacs between subsystems of libc. rather than create a number of newly-named headers to declare these functions, and having to add explicit include directives for them to every source file where they're needed, I have introduced a method of wrapping the corresponding public headers. parallel to the public headers in $(srcdir)/include, we now have wrappers in $(srcdir)/src/include that come earlier in the include path order. they include the public header they're wrapping, then add declarations for namespace-protected versions of the same interfaces and any "internally public" interfaces for the subsystem they correspond to. along these lines, the wrapper for features.h is now responsible for the definition of the hidden, weak, and weak_alias macros. this means source files will no longer need to include any special headers to access these features. over time, it is my expectation that the scope of what is "internally public" will expand, reducing the number of source files which need to include *_impl.h and related headers down to those which are actually implementing the corresponding subsystems, not just using them.
-
由 Rich Felker 提交于
it's already included in all places where these are needed, and aside from __tls_get_addr, they're all implementation internals.
-
由 Rich Felker 提交于
this is a helper function from strftime that's also used by wcsftime.
-
由 Rich Felker 提交于
this function was added later for strftime use and the existence of time_impl.h as the appropriate place for it seems to have been overlooked.
-
由 Rich Felker 提交于
obviously the type "should be" const, but it inherited non-const from the standard nl_langinfo_l.
-
由 Rich Felker 提交于
get rid of a gratuitous translation unit and call frame between asctime_r and the actual implementation of the function. this is the way gmtime_r and localtime_r are already done.
-
由 Rich Felker 提交于
-
- 28 8月, 2018 1 次提交
-
-
由 A. Wilcox 提交于
This manifests itself in mktime if tm_isdst = 1 and the current TZ= is a POSIX timezone specification. mktime would see that tm_isdst was set to 0 by __secs_to_zone, and subtract 'oppoff' (dst_off) - gmtoff from the resultant time. This meant that mktime returned a time that was exactly double the GMT offset of the desired timezone when tm_isdst was = 1.
-
- 08 8月, 2018 1 次提交
-
-
由 Rich Felker 提交于
the sign character produced came from the sign of tm_gmtoff/3600 as an integer division, which is zero for negative offsets smaller in magnitude than 3600. instead of printing the hours and minutes as separate fields, print them as a single value of the form hours*100+minutes, which naturally has the correct sign.
-
- 27 6月, 2018 1 次提交
-
-
由 Daniel Sabogal 提交于
the expression (tm->__tm_gmtoff)/3600 has type long. use %+.2ld instead.
-
- 08 4月, 2018 1 次提交
-
-
由 Samuel Holland 提交于
Commit 8a6bd730 added support for padding specifier extensions to strftime, but did not modify wcsftime. In the process, it added a parameter to __strftime_fmt_1 in strftime.c, but failed to update the prototype in wcsftime.c. This was found by compiling musl with LTO: src/time/wcsftime.c:7:13: warning: type of '__strftime_fmt_1' does \ not match original declaration [-Wlto-type-mismatch] Fix the prototype of __strftime_fmt_1 in wcsftime.c, and generate the 'pad' argument the same way as it is done in strftime.
-
- 07 2月, 2018 1 次提交
-
-
由 Rich Felker 提交于
it's unclear from the specification whether the word "consumes" in "consumes more than four bytes to represent a year" refers just to significant places or includes leading zeros due to field width padding. however the examples in the rationale indicate that the latter was the intent. in particular, the year 270 is shown being formatted by %+5Y as +0270 rather than 00270. previously '+' prefixing was implemented just by comparing the year against 10000. instead, count the number of significant digits and padding bytes to be added, and use the total to determine whether to apply the '+' prefix. based on testing by Dennis Wölfing.
-
- 06 2月, 2018 1 次提交
-
-
由 Rich Felker 提交于
the code to strip initial sign and leading zeros inadvertently stripped all the zeros and the subsequent '-' separating the month. instead, only strip sign characters from the very first position, and only strip zeros when they are followed by another digit. based on testing by Dennis Wölfing.
-
- 10 1月, 2018 1 次提交
-
-
由 Jens Gustedt 提交于
In all cases this is just a change from two volatile int to one.
-
- 15 12月, 2017 1 次提交
-
-
由 Natanael Copa 提交于
notes by maintainer: both C and POSIX use the term UTC to specify related functionality, despite POSIX defining it as something more like UT1 or historical (pre-UTC) GMT without leap seconds. neither specifies the associated string for %Z. old choice of "GMT" violated principle of least surprise for users and some applications/tests. use "UTC" instead.
-
- 12 12月, 2017 1 次提交
-
-
由 Timo Teräs 提交于
notes added by maintainer: the '-' specifier allows default padding to be suppressed, and '_' allows padding with spaces instead of the default (zeros). these extensions seem to be included in several other implementations including FreeBSD and derivatives, and Solaris. while portable software should not depend on them, time format strings are often exposed to the user for configurable time display. reportedly some python programs also use and depend on them.
-
- 10 11月, 2017 1 次提交
-
-
由 Rich Felker 提交于
commit a6054e3c changed this function not to take an argument, but the weak definition used by timer_create was not updated to match. reported by Pascal Cuoq.
-
- 21 6月, 2017 1 次提交
-
-
由 Rich Felker 提交于
POSIX requires ctime_r return a null pointer on failure, which can occur if the input time_t value is not representable in broken down form. based on patch by Alexander Monakov.
-
- 16 6月, 2017 1 次提交
-
-
由 Rich Felker 提交于
ctime passes the result from localtime directly to asctime. But in case of error, localtime returns 0. This causes an error (NULL pointer dereference) in asctime. based on patch by Omer Anson.
-
- 15 6月, 2017 1 次提交
-
-
由 A. Wilcox 提交于
POSIX defines getdate error #5 as: "An I/O error is encountered while reading the template file." POSIX defines getdate error #7 as: "There is no line in the template that matches the input." This change correctly disambiguates between the two error conditions.
-
- 22 3月, 2017 3 次提交
-
-
由 Julien Ramseier 提交于
in this case, a potentially-uninitialized or unrelated existing value in tm_year was being used. instead use 0 if %y was not present.
-
由 Julien Ramseier 提交于
string pointer was not advanced after matching.
-
由 Julien Ramseier 提交于
tm_yday range is 0-365 while %j is 1-366
-
- 16 3月, 2017 1 次提交
-
-
由 Rich Felker 提交于
the time of day at which daylight time switches over is specified in local time in the dst state prior to the transition. the code for handling this wrongly assumed it needed to switch whether dst or standard offset is applied to the transition time when the dst end date is before the dst start date (souther hemisphere summer), but in fact the end transition time should always be adjusted for dst, and the start transition time should always be adjusted for standard time.
-
- 03 1月, 2017 1 次提交
-
-
由 Rich Felker 提交于
commit 583ea835 fixed the case where tm_year is negative but the resulting year (offset by 1900) was still positive, which is always the case for time_t values that fit in 32 bits, but not for arbitrary inputs. based on an earlier patch by Julien Ramseier which was overlooked at the time the previous fix was applied.
-
- 08 11月, 2016 2 次提交
-
-
由 Daniel Sabogal 提交于
the overflow check for years+100 did not account for the extra year computed from the remaining months. instead, perform this check after obtaining the final number of years.
-
由 Hannu Nyman 提交于
Fix parsing of the < > quoted time zone names. Compare the correct character instead of repeatedly comparing the first character.
-
- 21 10月, 2016 1 次提交
-
-
由 Rich Felker 提交于
accessing an object of type const char *restrict as if it had type char * is not defined.
-
- 20 10月, 2016 1 次提交
-
-
由 Daniel Sabogal 提交于
posix requires that EINVAL be returned if the first parameter specifies the cpu-time clock of the calling thread (CLOCK_THREAD_CPUTIME_ID). linux returns ENOTSUP instead so we handle this.
-
- 07 10月, 2016 1 次提交
-
-
由 Szabolcs Nagy 提交于
-
- 08 7月, 2016 1 次提交
-
-
由 Rich Felker 提交于
the FIXME comment here was overlooked at the time locale support was added.
-
- 28 1月, 2016 1 次提交
-
-
由 Rich Felker 提交于
these changes are motivated by a functionally similar patch by Hauke Mehrtens to address the needs of the new mips vdso clock_gettime, which wrongly fails with ENOSYS rather than falling back to making a syscall for clock ids it cannot handle from userspace. in the process of preparing to handle that case, it was noticed that the old clock_gettime use of the vdso was actually wrong with respect to error handling -- the tail call to the vdso function failed to set errno and instead returned an error code. since tail calls to vdso are no longer possible and since the plain syscall code is now needed as a fallback path anyway, it does not make sense to use a function pointer to call the plain syscall code path. instead, it's inlined at the end of the main clock_gettime function. the new code also avoids the need to test for initialization of the vdso function pointer by statically initializing it to a self-init function, and eliminates redundant loads from the volatile pointer object. finally, the use of a_cas_p on an object of type other than void *, which is not permitted aliasing, is replaced by using an object with the correct type and casting the value.
-
- 15 10月, 2015 1 次提交
-
-
由 Rich Felker 提交于
strftime results are unspecified in this case, but should not invoke undefined behaviour. tm_wday, tm_yday, tm_mon and tm_year fields were used in signed int arithmetic that could overflow. based on patch by Szabolcs Nagy.
-
- 09 10月, 2015 1 次提交
-
-
由 Rich Felker 提交于
as found and reported by Brian Mastenbrook, the expressions 400*qc_cycles and years+100 in __secs_to_tm were both subject to integer overflow for extreme values of the input t. this patch by Szabolcs Nagy fixes the code by switching to larger types, and matches the original intent I had in mind when writing this code.
-
- 24 9月, 2015 1 次提交
-
-
由 Szabolcs Nagy 提交于
The value of *size is not relevant in case of failure, but it's better not to copy garbage from the stack into it. (The compiler cannot see through the syscall, so optimization was not affected by the unspecified value).
-
- 14 8月, 2015 1 次提交
-
-
由 Natanael Copa 提交于
tm_gmtoff is a nonstandard field, but on historical systems which have this field, it stores the offset of the local time zone from GMT or UTC. this is the opposite of the POSIX extern long timezone object and the offsets used in POSIX-form TZ strings, which represent the offset from local time to UTC. previously we were storing these negated offsets in tm_gmtoff too. programs which only used this field indirectly via strftime were not affected since strftime performed the negation for presentation. however, some programs and libraries accesse tm_gmtoff directly and were obtaining negated time zone offsets.
-