Commit Graph

342 Commits

Author SHA1 Message Date
Jérôme Duval 20308ad6a7 build: follow-up for hrev54993
should help with bug #16929, untested

Change-Id: Ia7b9b6cc8e84e2377d79c0edd1c278cdf74d869b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3891
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-04-30 10:42:21 +00:00
Niels Sascha Reedijk f97357a6ed Fix building on Haiku after hrev54993
Build tested on Linux.

Change-Id: I911ac42d99a0c1e94cab77dc29bf43d8f7f91093
2021-03-24 11:19:25 +00:00
Alexander von Gluck IV ca7a630e20 kits/package: Break LibsolvSolver add-on out
* BSolver is implemented by solver add-ons
* We may want to (unlikely) leverage another
  package solver in the future.
* We may want to (likely) implement a dummy
  solver when libsolv is unavailable on new
  architectures without bootstrap.
* This also makes solving missing libsolv a little
  more graceful vs the "include "libsolv.h" not
  found.

Change-Id: Iedd9d0f022fb743c4c7606bd33a4b6dbef0576f7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/819
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-07-18 18:17:48 +00:00
X512 36ef16bf08 BGradient: add Flatten, Unflatten methods
Change-Id: I861bab8ae19628d34297c294fd6ce3e5b6c82b34
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2827
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-13 15:35:38 +00:00
Adrien Destugues 1ed08f5856 Speed up BResource loading
The code to parse the resource table reads one entry at a time because
the table size isn't known. This resulted in a lot of read syscalls,
each reading just 12 bytes. Use a BBufferIO to buffer these and reduce
the number of syscalls. This helps especially when there are lot of
resources, for example in libbe with all the country flags.

It also removes some spam from strace output for all these read calls.

Change-Id: Ib165a0eacc2bc5f3d319c22c2fac4f439efbdef2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2858
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-06-01 14:09:54 +00:00
Augustin Cavalier 7a617f59fd configure & build: Add basic support for building with MSYS.
Also remove the MINGW support, as it was far too incomplete.

This *should* work under case-sensitive NTFS, but instead,
it seems #14963 occurs. So perhaps there is a GCC bug
related to case-sensitive vs. case-insensitivity after all.
2020-05-03 13:24:26 -04:00
Kyle Ambroff-Kao e1b7c1c7ac storage/SymLink: Fix Be API regression in ReadLink
After this patch, "UnitTester BSymLink" passes.

BSymLink::ReadLink() in BeOS would always return the length of the
link unless an error occurred. Before this patch, Haiku instead seemed
to emulate posix readlink() behavior, returning the number of bytes
copied into the output buffer.

BeOS also did not guarantee that the string written into the output
buffer is NULL terminated if the output buffer cannot contain the
entire link contents, but the Haiku implementation does since it is is
a basic safety issue.

This patch fixes this and updates the Haiku API docs to describe the
behavior explicitly.

Fixing this required changing behavior in bfs_read_link, which
required changes in many more places.

docs/user/storage/SymLink.dox:
src/kits/storage/SymLink.cpp:
* Don't return B_BUFFER_OVERFLOW if the provided buffer is not large
  enough to hold the link contents.
* Update documentation to clearly describe behavior.

src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp:
* Change bfs_read_link() to always return the link length. This is
  called by common_read_link in the VFS, which is called by
  _kern_read_link().

src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp:
src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp:
src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp:
src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp:
src/add-ons/kernel/file_systems/netfs/client/netfs.cpp:
src/add-ons/kernel/file_systems/nfs/nfs_add_on.c:
src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp:
src/add-ons/kernel/file_systems/reiserfs/Iterators.cpp:
src/add-ons/kernel/file_systems/reiserfs/Iterators.h:
src/add-ons/kernel/file_systems/reiserfs/Volume.cpp:
src/add-ons/kernel/file_systems/reiserfs/Volume.h:
* Update the implementation of read_link for these filesystems. Some
  of them were incorrect, and some had just copied the posix behavior of
  bfs from before this patch.
* Use user_memcpy in ext2_read_link()
* Use user_memcpy in nfs fs_read_link()
* Use user_memcpy in reiserfs StreamReader::_ReadIndirectItem and
  StreamReader::_ReadDirectItem
* Remove unused method Volume::ReadObject in reiserfs.

src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingLeafNode.cpp:
src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp:
* Update UnpackingLeafNode::ReadSymlink and
  PackageSymLink::ReadSymLink() to set the bufferSize out parameter to
  the symlink length. Both of these are called by
  packagefs_read_symlink.
* Use user_memcpy

src/add-ons/kernel/file_systems/netfs/client/netfs.cpp:
* netfs seems mostly unimplemented. Added a FIXME note for future
  implementers so that they know to implement the correct behavior.

src/system/libroot/posix/unistd/link.c:
* readlinkat() was just wrapping _kern_read_link() because before this
  patch it had expected posix behavior. But now it does not, so we
  need to return the number of bytes written to the output
  buffer.

src/build/libroot/fs.cpp:
* Update _kern_read_link() in the compatibility code to emulate the
  Haiku behavior on the host system. This is done by using an
  intermediate buffer that is guaranteed to fit the link contents and
  returning its length. The intermediate buffer is copied into the
  output buffer until there is no more room.

src/tests/kits/storage/SymLinkTest.cpp:
* This patch also resolves some test failures similar to those
  resolved in ee8cf35f0 which fixed tests for BNode. The tests were
  failing because Haiku's error checking is just better.

  BeOS allowed constructing a BSymLink with BSymLink(BDirectory*,
  const char*) with the entry name of "". The same is true of the
  equivilant SetTo() method. The BSymLink object will appear valid
  until you attempt to use it by, for example, calling the ReadLink
  method, which will return B_BAD_VALUE.

  Haiku does a more appropriate thing and returns B_ENTRY_NOT_FOUND,
  for this constructor and the equivilant SetTo(BDirectory*, const
  char*) method. This patch fixes these test assertions to match Haiku
  behavior.

docs/develop/file_systems/overview.txt:
* Add notes for future filesystem driver implementers to call this
  mistake when implementing fs_vnode_ops::read_symlink.

docs/user/drivers/fs_interface.dox:
* Fix documentation for fs_vnode_ops::read_symlink

Change-Id: I8bcb8b2a0c9333059c84ace15844c32d4efeed9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2502
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-04-30 10:13:41 +00:00
Simon South a7536efa8b BKeymap: Add unit tests and fix issues
Add a preliminary set of unit tests for BKeymap and fix these issues:

* BKeymap::operator=() caused a crash by allocating a zero-byte array to hold
  the other object's character data.
* BKeymap::SetToCurrent() and SetToDefault() leaked memory by not freeing an
  existing character array before allocating a new one.
* BKeymap::SetToCurrent() incorrectly determined the size of the current
  keymap's character array, causing GetChars() to fail whenever the current
  keymap was loaded. Now SetToCurrent() uses the _get_key_map() private
  function, which accurately reports the size of the array.

This commit also updates a Jamfile by replacing a use of "UseHeaders" to
include private header files with the more concise and expressive
"UsePrivateHeaders".

Change-Id: If6f71b209f1bd395be57835c4dd89f0e3f845994
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1724
Reviewed-by: Ryan Leavengood <leavengood@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-08-20 07:49:49 +00:00
CodeforEvolution 2846db2e99 Implement is_app_showing_modal_window()
Also do some cleanup in private headers, I can't imagine why the build
libraries would need this function.

Change-Id: Ib08810b6efe4738dad596a735d741582a3781b28
Reviewed-on: https://review.haiku-os.org/c/1670
Reviewed-by: Ryan Leavengood <leavengood@gmail.com>
2019-08-03 00:41:10 +00:00
Augustin Cavalier 1e8a3588cd libbe_build: Use a copy of the BLocker sources.
My upcoming changes to use our "futexes" instead of semaphores
will obviously not work on non-Haiku platforms, so we now
need a copy of this class in libbe_build.
2019-07-27 18:33:47 -04:00
John Scipione fdc59e4e7e fs_darwin fix warning: '&&' within '||'
place parentheses around the '&&' expression to silence this warning

Change-Id: Ie6152d2371ed65f57e6e75c9541263a5e1511513
Reviewed-on: https://review.haiku-os.org/c/1532
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-06-25 06:47:10 +00:00
Augustin Cavalier 204ec4dec6 build: Use the main ByteOrder.h.
The only differences between the two were whitespace and then the
GCC4 builtin byteswap functions.
2019-03-26 19:13:01 -04:00
Augustin Cavalier 1d91b37193 build: Fixes to support building in paths with spaces in them.
Now that HAIKU_TOP is a relative path, nearly all paths Jam actually
has to deal with will never contain spaces, so this is now feasible.
Only one issue remains after this commit (namely, setting
HOST_BUILD_COMPATIBILITY_LIB_DIR.)
2019-01-09 19:18:28 -05:00
Augustin Cavalier 9effbd7e00 Remove some unused cruft from the early days.
These lines were added in 2002...
2018-12-15 20:26:13 -05:00
Augustin Cavalier 807304b100 build: Add basic support for MinGW hosts.
This doesn't fully work yet (the FS code in libroot_build
needs to be adapted, as some of the symlink-related calls
are not available on MinGW), but it gets much further than
the "Cygwin" target did.
2018-11-23 16:24:25 -05:00
Augustin Cavalier 37c106060a build: Remove support for cross-building from Cygwin and SunOS.
These have been broken for a long time. Some Cygwin changes that
are relevant on MinGW are kept here, but users on Windows who
want to build Haiku should probably use WSL at this point.

However, now that we are using relative paths and don't need
to worry about drive path kludges, it's actually possible to
get some host tools built on MinGW. Changes for that coming.
2018-11-23 15:40:50 -05:00
CodeforEvolution 106ae4ec35 Remove Curl, Switch to NetApi in Package Kit
Change-Id: I92213ab60dc987175c323d1d9ed11ac8b3517f2f
Reviewed-on: https://review.haiku-os.org/475
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-09-29 17:23:52 +00:00
Adrien Destugues 1147b9a49d Haiku does provide strchrnul.
Fixes #14386.
2018-08-23 08:15:28 +02:00
Adrien Destugues 8d1f13817f libsolv: #define _GNU_SOURCE from command line
On Haiku host, we need _GNU_SOURCE defined when stdio.h is included
to use fopencookie. We did that in libsolv sources, but we now include
stdio from BeOSBuildCompatibility.h which is included from the command
line. So set _GNU_SOURCE from command line as well.
2018-08-07 20:50:56 +02:00
Jessica Hamilton 77c8afb47f libroot_build: don't define system_time() on Haiku host.
* On x86_64, this was causing an infinite loop between
  libroot & libroot_build in the host unzip tool.
2018-06-16 10:08:56 +00:00
Jessica Hamilton d284524815 libroot_build: replace void* with addr_t for hidden functions.
* Using attribute visibility hidden doesn't get applied if a
  function returns a non-class pointer type, so the functions
  weren't being hidden for gcc4+ builds, resulting in stack
  overflows. Using addr_t, which should be the same size as
  void* works around this restriction.
2018-06-16 10:08:56 +00:00
Augustin Cavalier 648f0d5f08 libroot_build: Properly remap fs_attr_* functions.
This was done using macros before, which isn't the way we have things set up.
In theory that method should work, however if not all consumers include the
libroot_build headers properly, then it breaks in subtle but confusing ways,
which is not what we want at all.

Thanks to Jessica for advice.

Change-Id: Idd45df5547daecf8239932957088da03ddfccf87
2018-04-29 17:25:18 +00:00
John Scipione 940a3a2322 Revert "build/libgnuregex: Remove."
This reverts commit ca087b0532.

Mac OS X requires libgnuregex for Keymap
2018-02-16 16:45:11 -08:00
Augustin Cavalier 03544bf000 libroot_build: Full passthrough to system attributes.
As it turns out, using the xattr emulation layer plus "libgnu"
causes some strange mixups at package build time, and so packages
built with it were winding up with no attributes at all.

So I've just bitten the bullet and written a full passthrough layer
to the system attributes. Verified using a full build of haiku.hpkg
this time ... after a lot of painful debugging of symlink mixups.

Hopefully I am finally rid of this plague...
2017-12-30 16:35:51 -05:00
Augustin Cavalier 699b4bbab9 libroot_build: *Actually* fix attribute usage on Haiku.
To quote jscipione (from 95e8362c52),
"Let me tell you a story about a bug" -- though this tale spans a much
lesser time than that one did.

In 5e19679ea3, I enabled libroot_build for
Haiku, instead of using the system libroot as we had before. There were
a number of bugs introduced along with this that I hadn't fixed (and there
may be more after this), but most of the obvious ones (crashes on x86_64...)
were fixed shortly enough.

Attribute usage, though, was a different story. Unlike most of the POSIX
calls in libroot, which were aliasing system functions no matter what the
platform, the attribute calls were not, as they are specific to Haiku.

Initially I had completely forgot about them, and it wasn't until a few days
later when I noticed that I had an "attributes" directory in my generated
that I realized that the "generic" attribute layer was being used on Haiku.
I attempted a fix for this in 5e19679ea3,
thinking that would clear the problem up, but I didn't actually run a test
beyond seeing that my BuildConfig had been updated properly. In fact,
BuildSetup was hard-wired to not even pass that definition through on
Haiku, and so that commit had in effect caused nothing.

My initial "fix" of just changing BuildSetup then caused a build failure,
as while libroot_build itself compiled, it ran into errors whenever attributes
were used, because in letting the real libroot's attribute calls shine
through, I had bypassed libroot_build's FD emulation/shim layer.

Then I tried and failed at three separate attempts to solve this with code:
 - a version of the "fs_attr_...h" interface for Haiku. This proved possible
   in theory, but in practice I would need to reimplement a lot of attribute
   handling code in it, because all I had access to from there was syscalls.

 - a version of "fs_attr_untyped" that bypassed its reimplementations of
   the "fs*attr" functions for the libroot ones, only using the FD shim layer.
   This proved possibly not even theoretically possible because it would have
   caused preprocessor hell in some of the build headers, and also assumptions
   about how attributes are read were totally different.

 - a completely new "fs_attr_haiku" that was a completely new interface to
   the fs*attr functions. This proved practically impossible because of the
   need to include structures from the system libroot to call out to readdir,
   etc. that attempts to solve would also have caused preprocessor hell.

Then I realized that the Linux xattr emulation library, which I'd used
as a reference when attempting the first solution, was shipped by default
as a system library in all builds of Haiku ... and so I could just tell
fs_attr_untyped to use the Linux xattr handler, and then link against libgnu.

So that is how I arrived at this strange and decidedly unorthodox solution
to a problem of my own creation.
2017-12-29 21:26:00 -05:00
Augustin Cavalier ca087b0532 build/libgnuregex: Remove.
It was needed on macOS for a time when BUrl used regexes for parsing.
Now it does not, and so we can remove libshared's RegExp from build
libshared, and thus also libgnuregex.
2017-12-24 12:27:47 -05:00
Augustin Cavalier 2c2516b9b6 libhaikucompat: Delete.
Was decoupled from the build since the switch to use libroot_build
even on Haiku.
2017-12-18 18:06:12 -05:00
Augustin Cavalier 503ef6d4dd build: Correct libroot_build's usage of xattrs on a Haiku host.
Implemented by just not defining the functions at all and letting
the Haiku ones shine through. In the future, though, we should wrap
them properly.

(Between the switch to libroot_build and this commit, libroot_build
was using the generic attribute emulation layer on Haiku ... whoops.)
2017-12-14 19:36:14 -05:00
Augustin Cavalier 5e19679ea3 build: Use libroot_build on Haiku.
Previously we just used the system libroot, which of course meant
that when libroot's ABI changed, the build broke. Now we use the full
libroot_build that we do on non-Haiku platforms. The logic for "BeOS-compatible
but not Haiku" does not really apply anymore, so it has been gutted where
appropriate (and libhaikucompat has been decoupled from the build.)

The only caveat here is the change to Errors.h -- we really should be using
the system's one where I included the one from the tree, but for whatever
reason, GCC2 refused to handle the #include_next properly.

Fixes the build breakage of Haiku-on-Haiku by my prior commits (sorry).
2017-12-13 19:47:39 -05:00
Augustin Cavalier 6aff37d1c7 Move SHA256 class to libroot instead of linking libshared into libroot.
Discussed with PulkoMandy and on the haiku-commits mailing list.

Thanks to @jessicah for compile-testing and fixing 2 small issues I missed.
2017-10-03 20:18:26 -04:00
Rene Gollent e7b5894981 Update FreeBSD case for libsolv build. 2017-09-24 15:32:59 -04:00
Adrien Destugues 3ec7701779 NaturalCompare: implement using locale kit
The non-locale aware version is kept in src/build/libshared for use on
the host system and in packagefs (kernel add-on). In both cases, ICU is
not available.

Fixes #8192
2017-05-29 14:04:44 +02:00
Augustin Cavalier b6f76ebe71 s/OpenBeOS License/MIT License/ universally, as they're the same thing.
Fixes #8681.
2017-02-09 22:09:56 -05:00
Adrien Destugues 2c26ad4b39 move BUrl to the support kit
It is used by the media kit, which created a dependency from libmedia to
libbnetapi to openssl.
It is not entirely specific to the network kit, there are some use cases
that don't involve network at all.
2016-12-29 16:38:53 +01:00
Jessica Hamilton 4419d699ec partitioning: pass along reference to parent when uninitializing.
* Fixes problems with setting the partition name after uninitializing
  a partition in DriveSetup. Previously, UninitializeJob() was
  followed by SetStringJob(), but the kernel was updating the
  change counter for the parent partition when uninitializing a
  partition, leading to SetStringJob() having an incorrect change
  counter for the parent partition. Now the parent change counter
  will be correct when SetStringJob() runs.
2016-12-23 18:53:15 +13:00
François Revol 28fb504bb8 Style fix, also fixes an indentation warning 2016-12-02 05:33:18 +01:00
Adrien Destugues 1e59399fd9 libgnuregex: fix debug build.
Add missing "printchar.c", which is only used in DEBUG mode. The
function was recovered from original regex sources.

Note that the gnu regexp library is deprecated, and so is its
replacement, gnu rx. GNU suggests using the regex implementation from
the glibc, but that one isn't as portable.

Thanks to Andrew Lindesay for the investigations and initial patch!

Fixes #12952.
2016-10-16 11:34:15 +02:00
Augustin Cavalier 82f44f2db1 libbe_build: Fix the new "network" Jamfile.
Was introduced in fa2dd9c45f, but was
causing weird problems (leaving stray '.o's around the tree.) The problem
was that it didn't have a space before the semicolon on the "SubDir" line,
which also ate the following UseHeaders directive, which also meant
that running "jam" inside a subdirectory was broken between that commit
and this one.
2016-06-19 19:11:50 -04:00
Andrew Lindesay fa2dd9c45f BPackageInfo::Parser: Validate URL strings.
Fixes #12710.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
I fixed the modifications to the Jamfiles in src/bin, they were all wrong
in the patch.
2016-06-18 18:40:07 -04:00
Jonathan Schleifer 456150599a
Add __clang__ to a few #ifdefs 2015-11-07 23:02:53 +01:00
Rene Gollent c5271e6b51 makebootable: Fix various build problems.
- Add jamfile for a build variant of libuuid.
- Adjust the build version of makebootable to link to that instead, as it would
  otherwise link in the target platform's version of libuuid_kernel, which
  wasn't necessarily compatible with the build platform's objects (i.e. when
  building a 32-bit Haiku image on a 64-bit host OS), and would consequently
  fail.
2015-10-08 18:57:21 -04:00
Adrien Destugues 209cd3dd4f Remove second half of useless condition.
Thanks to Ingo for reviewing!
2015-07-26 20:31:10 +02:00
Adrien Destugues 58164f4a49 PVS 122,123: useless checks. 2015-07-26 16:57:10 +02:00
Adrien Destugues 69ee6a6d62 PVS 78-85: useless checks
* These were always true, so remove them.
2015-07-26 16:57:01 +02:00
Axel Dörfler e711e6e42f Moved BJob, and JobQueue into the support kit.
* Put it in the BSupportKit namespace, following the style introduced
  with the package kit for now.
* The BSupportKit::BJob class no longer knows about the package kit's
  Context class. However, the BPackageKit::BJob class does.
* Due to the namespace juggling, a lot of files had to be touched.
* The JobQueue class remains private.
* Due to the way Haiku is built on itself, you cannot build this change
  under Haiku with an older release.
2015-05-21 21:37:01 +02:00
Adrien Destugues 487d015ab7 PVS43: two if with same condition in BBitmap::SetBits 2015-05-01 08:08:39 +02:00
Paweł Dziepak 2e2c9bd3d0 os/support: implement atomic_*() using GCC builtin helpers
If GCC knows what these functions are actually doing the resulting
code can be optimized better what is especially noticeable in case of
invocations of atomic_{or,and}() that ignore the result. Obviously,
everything is inlined what also improves performance.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2014-08-25 23:05:07 +02:00
Ingo Weinhold 05b565f4f2 Add private BDataPositionIOWrapper
Implements the BPositionIO interface on top of a BDataIO, requiring the
{Read,Write}At() accesses to be sequential.
2014-07-13 17:57:56 +02:00
Ingo Weinhold c55a06055f Add private class BFdIO
Simple BPositionIO implementation using the POSIX API on a FD. In effect
similar to BFile, but more easily ported to kernel and boot loader (and
the FD is reusable).
2014-07-12 15:40:21 +02:00
Ingo Weinhold b3263ad3e1 Switch package kit to BZlibCompressionAlgorithm
... and remove the Zlib{Compressor,Decompressor} API.
2014-06-30 21:55:41 +02:00