Commit Graph

2593 Commits

Author SHA1 Message Date
Yaakov Selkowitz ec86124748 string: fix strverscmp doc inclusion
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-19 11:52:02 -05:00
Yaakov Selkowitz 59e09b6419 string: add strverscmp
The actual implementation is from musl (MIT license).

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-19 08:16:42 -05:00
Thomas Preud'homme 0c081aa62c Fix guard for siginfo_t and pthread_t definition
Commit 8a3b3bb4d7 changed the guard on
some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
some use of siginfo_t and pthread_t became visible under configurations
where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
because the definition of those types are still unavailable.

This commit make those type definition visible for __POSIX_VISIBLE
configurations. This requires moving the siginfo_t definition out of the
RTEMS specific definitions in sys/signal.h while still guarding it
against cygwin case.
2017-06-19 13:00:05 +02:00
Corinna Vinschen 14ea06212b Revert "Don't overread or write memory returned by _DTOA_R"
This reverts commit efaef1bba2.
2017-06-19 12:57:16 +02:00
Yaakov Selkowitz dde6af6f82 Export XSI sigpause
There are two common sigpause variants, both of which take an int argument.
If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version,
which removes the given signal from the process's signal mask; otherwise
you get the BSD version, which sets the process's signal mask to the given
value.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 14:23:52 -05:00
Joel Sherrill 40ca6f02ed newlib/MAINTAINERS: Add OS maintainers section and myself for RTEMS and Write After Approval. 2017-06-14 13:44:02 -05:00
Yaakov Selkowitz 8a3b3bb4d7 Feature test macros overhaul: signal.h (part 3)
Notably, sigaction and friends are POSIX, but the form of sigpause
currently provided is BSD.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 10:18:15 -05:00
Yaakov Selkowitz c347bb6469 stdio.h: guard function macros with !__cplusplus
While POSIX allows these functions to also be defined as macros in C, in
C++ this is not allowed, and prevents these names (particularly feof) from
being used in a custom namespace.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-06-14 10:18:14 -05:00
Aditya Upadhyay 35cd6863fb ccoshl: Align formatting to upstream
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-14 10:36:38 +02:00
Aditya Upadhyay ed82849b8f Importing ccoshl.c from netbsd.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-13 10:41:06 +02:00
Sebastian Huber 0fbd27dd1e Remove FreeBSD specifics from RTEMS <arpa/inet.h>
For whatever reason FreeBSD renames several functions provided by
<arpa/inet.h> and uses weak references to provide the standard function
names.  This causes problems on targets lacking proper support for weak
references.  We do not need this function renaming on RTEMS.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-12 08:41:24 +02:00
Silviu Baranga efaef1bba2 Don't overread or write memory returned by _DTOA_R
Don't over-read memory returned by _DTOA_R, and never write to it
since the result might be a string literal.

For example, when doing:
  swprintf(tt, 20, L"%.*f", 6, 0.0);

we will get back "0".

Instead, write the result returned by _DTOA_R to the output buffer.
After this, write the 0 chars directly to the the output buffer
(if there are any). This also has the (marginal) advantage that
we read/write less memory overall.
2017-06-09 15:30:47 +02:00
Sebastian Huber e9085e0ccd Fix RTEMS ioctl() declaration
Using uint32_t for ioctl_command_t does not work well on 64-bit targets.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:20 +02:00
Sebastian Huber dc93d7adff Update FreeBSD revision of RTEMS <sys/bitset.h>
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:20 +02:00
Sebastian Huber fd5d052d40 Fix some RTEMS CPUSET(9) macros
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:19 +02:00
Sebastian Huber c29f5b219d Fix RTEMS CPU_EQUAL_S()
According to the FreeBSD man page BIT_CMP() returns true in case the two
sets are NOT equal.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-07 15:46:19 +02:00
Sebastian Huber ffcaf32108 Add myself to Write After Approval 2017-06-07 14:36:51 +02:00
Prakhar Bahuguna 21ff2cf930 Fix minor issues in memchr NEON implementation 2017-06-07 12:16:15 +02:00
Kito Cheng beb17b264b Print sign of NaN values. 2017-06-07 11:50:31 +02:00
Sebastian Huber d70983ea1b Add de-facto standard <sys/ioctl.h> for RTEMS
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:42:08 -04:00
Sebastian Huber fa88e93d3d Add some POSIX header files for RTEMS
Add the POSIX header files

  * arpa/inet.h
  * net/if.h
  * netdb.h
  * netinet/in.h
  * netinet/tcp.h
  * sys/socket.h
  * sys/syslog.h
  * sys/uio.h
  * sys/un.h
  * syslog.h
  * termios.h

and their dependencies for RTEMS.  The origin of these files is the
latest FreeBSD.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:41:33 -04:00
Sebastian Huber 0b915d6be0 FreeBSD compatibility for RTEMS <sys/cpuset.h>
Make the RTEMS <sys/cpuset.h> compatible with the latest FreeBSD
version.

Fix the CPU_COPY() parameter order, see also:

https://devel.rtems.org/ticket/3023

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:36:27 -04:00
Sebastian Huber 764eda728f Add __bitcount*() to RTEMS <machine/types.h>
Use a dedicated header file <machine/_bitcount.h> to avoid cyclic header
dependencies in future changes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:35:38 -04:00
Sebastian Huber 2693c1db69 Move ARM access.c from machine to sys
The implementation of the POSIX access() function is nothing machine
specific like memcpy(), etc.  Move it back to the system domain.  This
avoids problems due to the include search order of the Newlib/GCC build
which picks up machine includes before system includes.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:34:53 -04:00
Sebastian Huber 0008601042 Increase MSIZE for RTEMS
Increase the MSIZE for RTEMS to be in line with the latest FreeBSD
version.  The legacy network stack of RTEMS will provides its own
definition.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:33:59 -04:00
Sebastian Huber 2efb117047 FreeBSD compatibility for RTEMS <sys/param.h>
Update the RTEMS <machine/param.h> and <sys/param.h> to be compatible
with the latest FreeBSD version.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:33:40 -04:00
Sebastian Huber 15b59a15b4 Add generic <machine/_align.h> for RTEMS
It uses __BIGGEST_ALIGNMENT__ which is available in recent GCC and
LLVM/clang.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-05-25 12:33:02 -04:00
Kito Cheng c23fbc3aed Add __packed to struct ldieee
- We don't want any padding in struct ldieee, otherwise the offset
   might wrong in most compiler.
2017-04-18 12:25:35 +02:00
Corinna Vinschen bdb017b30c newlib: remove __infinity{f,ld} constants
previous commit 4c90db7bc8 introduced
a compile time error because libm/common/s_infconst.c used the remove
__fmath, __dmath, and __ldmath union types.

Since this is very old, and unused for a very long time, just drop the
file and thus the __infinity constants entirely.

Exception: Cygwin exports __infinity from the beginning.  There's a very,
VERY low probability that any existing executable or lib still uses this
constant, but we just keep it in for backward compat, nevertheless.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-04-18 12:17:26 +02:00
Jeff Johnston 4c90db7bc8 Remove legacy unions which are no longer used
- remove __fmath, __dmath, and __ldmath unions
2017-04-17 19:22:19 -04:00
Prakhar Bahuguna c47c9bdc1b Optimise memchr for NEON-enabled processors 2017-04-06 18:19:20 +02:00
Sebastian Huber eb14d0cc64 Add BSD-specific reallocarray()
It is available in FreeBSD, NetBSD and OpenBSD, but not in glibc.  It is
used for example by OpenSSH.
2017-04-04 12:19:18 +02:00
imp 7c4ae7770e Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-04-04 12:16:05 +02:00
cem 6c6ea2e457 queue.3: Document existing QMD_* macros
Feedback from:	bapt, bdrewery, emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D3983
2017-04-04 12:16:05 +02:00
cem 5e36b70104 queue(3): Enhance queue debugging macros
Split the QUEUE_MACRO_DEBUG into QUEUE_MACRO_DEBUG_TRACE and
QUEUE_MACRO_DEBUG_TRASH.

Add the debug macrso QMD_IS_TRASHED() and QMD_SLIST_CHECK_PREVPTR().

Document these in queue.3.

Reviewed by:	emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D3984
2017-04-04 12:16:05 +02:00
mckusick 9998bd4b7c Add two new macros, SLIST_CONCAT and LIST_CONCAT
Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the
queue.h header file and in the queue.3 manual page that they are O(n) so
should be used only in low-usage paths with short lists (otherwise an
STAILQ or TAILQ should be used).

Reviewed by: kib
2017-04-04 12:16:05 +02:00
hselasky 218c5e7d72 Make the <sys/queue.h> fully usable within C++
Make the system queue header file fully usable within C++ programs by
adding macros to define class lists.

This change is backwards compatible for all use within C and C++
programs. Only C++ programs will have added support to use the queue
macros within classes. Previously the queue macros could only be used
within structures.

The queue.3 manual page has been updated to describe the new
functionality and some alphabetic sorting has been done while
at it.

Differential Revision:	https://reviews.freebsd.org/D2745
PR:			200827 (exp-run)
MFC after:		2 weeks
2017-04-04 12:16:05 +02:00
hselasky 73603c98aa Pass macro arguments properly.
MFC after:	1 week
2017-04-04 12:16:05 +02:00
hselasky d3f9311fff Fix order of arguments in the TRACEBUF_INITIALIZER
Fix order of arguments in the TRACEBUF_INITIALIZER macro so that we can
define QUEUE_MACRO_DEBUG to debug list problems.

MFC after:	1 week
2017-04-04 12:16:05 +02:00
lstewart a36e348a9f Add new FOREACH_FROM variants for queue(3)
Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can
optionally start the traversal from a previously found element by
passing the element in as "var". Passing a NULL "var" retains the same
semantics as the regular FOREACH macros.

Kudos to phk for suggesting the "FROM" suffix instead of my original
proposal.

Reviewed by:	jhb (previous version), rpaulo
MFC after:	1 week
2017-04-04 12:16:05 +02:00
imp d3e919b42a Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-04-04 11:44:03 +02:00
avg 3abc66ec6b don't use C99 static array indices with older GCC versions
For example, the FreeBSD GCC (4.2.1) has a spotty support for that
feature.  If the static keyword is used with an unnamed array parameter
in a function declaration, then the compilation fails with:
error: static or type qualifiers in abstract declarator

The feature does work if the parameter is named.
So, the restriction introduced in this commit can be removed when all
affected function prototypes have the workaround.

MFC after:	1 week
Sponsored by:	Panzura
2017-04-04 11:44:03 +02:00
pfg 7b07f11b1f Addition of clang nullability qualifiers.
For consistency with the qualifiers added in r310977, define a new
qualifier _Null_unspecified which is also defined in clang 3.7+.

Add two new macros:
__NULLABILITY_PRAGMA_PUSH
__NULLABILITY_PRAGMA_POP

These are for use in headers when we want avoid noisy warnings if
some pointers are left without nullability annotations.

These are added with way ahead of their first use to teach the GCC
ports headers of their existance before their first use.
2017-04-04 11:44:03 +02:00
pfg e1563a05b7 Remove unused __gnu_inline() attribute.
This was meant to be used by a future FORTIFY_SOURCE implementation.
Probably for good, FORTIFY_SOURCE and this particular GCCism were never
well supported by clang or other compilers. Furthermore, the technology
has long since been replaced by either static checkers, sanitizers, or
even just the strong stack protector that was enabled by default.

Drop __gnu_inline to avoid cluttering the headers.

MFC after:	5 days
2017-04-04 11:44:03 +02:00
pfg 81c121c487 Addition of clang nullability qualifiers.
Add two new qualifiers for use by the static checkers:

_Nonnull
The _Nonnull nullability qualifier indicates that null is not a meaningful
value for a value of the _Nonnull pointer type.

_Nullable
The _Nullable nullability qualifier indicates that a value of the
_Nullable pointer type can be null.

These were introduced in Clang 3.7. For more information, see:
http://clang.llvm.org/docs/AttributeReference.html#nonnull

We add these now without using them so that the GCC ports have time to
pick up the header change.

Hinted by:	Android Bionic libc [1]
Also seen in:	Apple's Libc-1158.20.4

[1]
baa2a973bd
2017-04-04 11:44:03 +02:00
asomers 84a6dba57e Fix C++ includability of crypto headers with static array sizes
C99 allows array function parameters to use the static keyword for their
sizes. This tells the compiler that the parameter will have at least the
specified size, and calling code will fail to compile if that guarantee is
not met. However, this syntax is not legal in C++.

This commit reverts r300824, which worked around the problem for
sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can
be used in headers as a static array size, but will still compile in C++
mode.

Reviewed by:	cem, ed
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D8277

fix a typo in __STDC_VERSION__ in __min_size requirements

MFC after:	1 week
Sponsored by:	Panzura
2017-04-04 11:44:02 +02:00
dim e0dabc0e8d Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling for C++.
It clashes with the one in libc++'s <atomic> header.

(Previously, the _Atomic() macro was defined in <stdatomic.h>, which is
only for use with C11, but for various reasons it was moved to its
current location in r251804.)

Discussed with:	bdrewery, ed
MFC after:	2 weeks
2017-04-04 11:43:49 +02:00
pfg 086730fb14 Rename __sentinel to __null_sentinel
GCC 5 uses a conflicting __sentinel definition in include/c++/bits/stl_algo.h

Reported by:	matteo
2017-04-04 11:41:13 +02:00
Sebastian Huber f70d9ae6ad Use enum __packed in favour of -fshort-enums
Some architectures like ARM encode the short enum option state in the
object file and the linker checks that this option is consistent for all
objects of an executable.  In case applications use -fno-short-enums,
then this leads to linker warnings.  Use the enum __packed attribute for
the relevent enums to avoid the -fshort-enums compiler option.  This
attribute is at least available on GCC, LLVM/clang and the Intel
compiler.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-04-03 10:26:33 +02:00
Catherine Moore 571c69656a Use .syntax unified instead of .syntax divided. 2017-03-30 17:18:12 +02:00