Commit Graph

25 Commits

Author SHA1 Message Date
Ed Maste
df9489689d libnetbsd: add emalloc and friends
These are error-checked versions of memory allocation routines used by
NetBSD code, and are being added to facilitate updates to makefs.

Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D10291
2017-04-06 14:36:08 +00:00
Eric van Gyzen
f5b9907c86 Port the getaddrinfo(1) utility from NetBSD
Submitted by:	Lohith Bellad <lohithbsd@gmail.com>
Reviewed by:	hiren (earlier rev), ae
Obtained from:	NetBSD
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9365
2017-03-20 16:44:55 +00:00
Enji Cooper
e0f389edab Improve libnetbsd compatibility with NetBSD
This change is being made to diff reduce/reduce duplication in
contrib/netbsd-tests and to facilitate further porting of software from
NetBSD

Add the following headers:
- sys/event.h:
-- sys/types.h is required for kqueue on FreeBSD, but not NetBSD.
- sys/types.h:
-- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD.
   Pull in sys/param.h to have parity with NetBSD.
- sys/wait.h:
-- Define wrusage as __wrusage for parity with NetBSD typedef.
- glob.h
-- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef.
- pthread.h:
-- Pull in pthread_np.h for _np functions defined separately on FreeBSD.

Improve compatibility with NetBSD in the following headers:

- sha1.h:
-- define SHA1_CTX as SHA_CTX
-- define SHA1Final as SHA1_Final
- sha2.h:
-- #include sha384 to pick up all of the SHA 384 bit macros and definitions.
- util.h:
-- Add sys/types.h to util.h to pollute the header for types used in
   flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them
   for the functions.

MFC after:      2 weeks
Sponsored by:   Dell EMC Isilon
2017-02-07 19:42:41 +00:00
Enji Cooper
800a0e2672 libnetbsd: add pthread.h compat header
FreeBSD has pthread_np.h, which is used for consolidating all non-POSIX
functions, but NetBSD doesn't have this concept. Make _np functions work
seamlessly when ported from NetBSD to FreeBSD
2017-01-16 18:51:27 +00:00
Enji Cooper
8a979e7ad7 libnetbsd: add sys/event.h compat header
This adds in necessary sys/types.h pollution for uintptr_t used in
sys/event.h, which according to kqueue(2) on NetBSD isn't necessary.
2017-01-15 22:00:30 +00:00
Enji Cooper
897afca52c libnetbsd: add sys/types.h header which pollutes itself with sys/param.h to
pick up NBBY, etc
2017-01-15 21:53:11 +00:00
Enji Cooper
6b9e8e4eb2 libnetbsd: add sys/wait.h compat header
This just defines wrusage to __wrusage for now (they're both structs).
2017-01-15 21:52:33 +00:00
Enji Cooper
eec0029f96 libnetbsd: more portability fixes with stdio.h and util.h
- stdio.h needs to pull in stdio.h/util.h for fparseln, not util.h
- util.h needs to #include sys/types.h for flags_to_string, etc as
  flags_to_string uses u_long, which is typedef'ed in sys/types.h on
  FreeBSD
2017-01-15 21:18:58 +00:00
Enji Cooper
9a2036bd1d Fix copy-pasted copyright
- Add Dell instead of "SRI International"
- Use standard BSD 2-clause copyright
- Remove DARPA sponsorship advertisement
2017-01-15 10:24:45 +00:00
Enji Cooper
6b0a2ac186 libnetbsd: add compat header for glob.h
This is to diff reduce unnecessary additions to
contrib/netbsd-tests/lib/libc/gen/t_glob.c
2017-01-15 10:16:20 +00:00
Enji Cooper
c3b0c094b3 libnetbsd: improve sha2.h compat with FreeBSD
Add sha384 #include to libnetbsd's copy of sha2.h to expose all of the
SHA384 support via the header.
2017-01-14 08:10:37 +00:00
Enji Cooper
59754238a2 libnetbsd: improve sha1.h compat with FreeBSD
Map SHA1_CTX to SHA_CTX and SHA1Final to SHA1_Final
2017-01-14 07:57:34 +00:00
Enji Cooper
acf26de3fa Add stdio.h #include for fparseln
fparseln on FreeBSD requires stdio.h, then libutil.h, whereas NetBSD only
requires util.h
2017-01-14 07:46:03 +00:00
Enji Cooper
7ad417dff8 Add __BIT and __BITS macros from NetBSD to help support new testcases
MFC after:	1 week
2017-01-12 09:01:14 +00:00
Marcel Moolenaar
871afaefab Include "util.h", not <util.h>. The header is in the same directory
as the C file. There may be a <util.h> on the host when compiling
on macOS or Linux, causing conflicts.
2016-10-24 17:57:46 +00:00
Marcel Moolenaar
b0928c0dbb When compiling on macOS or Linux, __dead can be defined already.
Conditionally define __dead.
2016-10-24 17:56:08 +00:00
Glen Barber
a70cba9582 First pass through library packaging.
Sponsored by:	The FreeBSD Foundation
2016-02-04 21:16:35 +00:00
Craig Rodrigues
cda9474ab7 Fix spelling error.
Reported by: junovitch
2015-11-05 01:54:38 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Enji Cooper
e51a35a50c Commit missing header for sys/time.h compat on NetBSD to unbreak the amd64/i386
build

Pointyhat to: me (forgot to svn add it sooner)
2014-11-04 02:00:07 +00:00
Enji Cooper
481e594b9b The NetBSD libc tests use several definitions/macros that aren't available in
FreeBSD

Add the missing compat definitions/macros to lib/libnetbsd so the testcases
can be compiled with libnetbsd without having to invent ad hoc #define's, or
having to convert things over to FreeBSD idioms

Reviewed by: brooks
Phabric: D993
Sponsored by: EMC / Isilon Storage Division
2014-10-22 21:04:54 +00:00
Simon J. Gerraty
4fd0d10e0f New dependencies 2013-10-13 00:22:44 +00:00
Brooks Davis
6bea876644 Add libnetbsd, a thin compatibility layer intended to allow a limited
set of NetBSD software to compile as part of the FreeBSD build with
little or no modifiction.  It is built as a static library and not
installed for general use.  Likewise, its header files are not
installed.

Sponsored by:	DARPA, AFRL
2012-12-21 20:37:38 +00:00