Commit Graph

58080 Commits

Author SHA1 Message Date
ohnx 452ac99fa7 mkdos: Handle memory allocation better
In the kernel and command-line tool, don't leak allocated memory,
even if the tool returns an error.

In the command-line tool, also handle memory allocation errors
nicely by giving the user an OOM message if allocation fails.

Fixes CID 1425367 and 1425224.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2018-01-03 22:35:58 -05:00
Jérôme Duval e46e9fee6b vfs: check userland buffers before reading them. 2018-01-03 21:15:30 +01:00
ohnx 7766c048b3 libroot: Fix possible typo in printf_size.c
It appears as if there is a typo in printf_size.c; it makes
no sense to compare an unitialized variable in such a way.
Since `info->width` is referenced later on in the variable
assignment, it seems possible that the intended statement
was to place the larger of the values between `info->width`
and `info->prec` into `width`.

Fixes CID 609431.

korli: Patch applied in cddfcf2f87
was incomplete. This patch completes with what upstream did in 2004:
fa5753eede.patch

Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2018-01-03 19:42:55 +01:00
Michael Lotz 36ef138ce5 kernel: Implement WEXITED for waitid.
Previously dead teams were always returned (as needed for wait/waitpid).
Using waitid it should however be possible to omit the WEXITED flag to
only get stopped (WUNTRACED | WSTOPPED) or continued (WCONTINUED) teams.

Adjust the other caller of the _kern_wait_for_child syscall, used by the
various less specific wait* functions, to always include WEXITED. This
avoids having to special case waitid in the syscall interface or with an
extra flag.

Add a check to ensure that any of these flags is set to avoid the now
possible case of nothing being specified. This fails with B_BAD_VALUE
(EINVAL) as on other systems.
2018-01-03 01:52:52 +01:00
Michael Lotz 63e2d20137 kernel: Treat WSTOPPED synonymous to WUNTRACED.
On other systems their values are usually aliased. We defined them as
two different values, but didn't handle WSTOPPED anywhere. The check
is now simply extended to cover both bits.
2018-01-03 01:22:53 +01:00
Michael Lotz afe8d6621d kernel: Avoid double lock in wait_for_child with child == team.
When wait_for_child was called with a child argument equal to the
current team, the team was locked again to check if it was a child of
itself.

This is now handled the same way as on other systems, where this case
results in ECHILD (and not EINVAL).
2018-01-03 01:10:29 +01:00
Rene Gollent b1ab02c434 Debugger: More memory management fixes.
DwarfImageDebugInfo:
- Type name/info entries weren't being freed properly.

BaseUnit:
- The array of entries itself was being destroyed, but not the actual
  objects. Consequently none of the DIE objects were ever being freed.

CfaRuleSet:
- The register rules array wasn't being freed.

FileManager:
- References to entries weren't being released. Some more work remains to be
  done here though, as a subset of these objects still have a non-zero ref
  count in the end.
2017-12-31 17:52:59 -05:00
Augustin Cavalier 8a9e1e0d4a Removal of non-Haiku target platform logic from build system (part 1.)
Following recent changes to use libroot_build on Haiku also, it is now
actually impossible to build Haiku components on non-Haiku platforms
(BeOS R5, Dan0, BONE, Zeta), so we can remove any logic related to this.

This is only the first part; still to be removed are:
 * SetSubDirSupportedPlatformsBeOSCompatible
 * HOST_PLATFORM_BEOS_COMPATIBLE
 * TARGET_PLATFORM_BEOS_COMPATIBLE
2017-12-31 16:14:22 -05:00
Fredrik Holmqvist 1446507ce3 Remove the code to force ACPI to shutdown on CPU0
It was discussed and introduced based on docs that some systems
need this to shutdown properly. I can find no mention of this in
ACPICA or ACPI docs.
This needs to be re-evalutad, as all my shutdowns been successful
after disabling it and I can't locate where this info came from
or if it actually helped.

See 1316462ab0 for original commit
and bug 12306 on current shutdown issue.
2017-12-31 17:43:31 +01: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
Fredrik Holmqvist 7d93e79a04 Latest ACPI update removed some essential configuration
* The global lock, needed for hw <-> os to sync, was a no op.
  This means that OS and HW could read and write to same value
  at the same time, causing garbled data and crashes. This is easiest
  to see in battery status, where battery values and OEM name would
  become garbage. It also causes instability and failure to shutdown

* ACPI used 64 bit addressing (which it normally should) on 32 bit.
  This would cause page faults as it would jump to incorrect addresses
2017-12-30 19:26:01 +01: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
ohnx e6c08856dd bin/compress: Remove.
Per #10267, "Most (ported) third-party software should be removed
from the Haiku source repository."

Since HaikuPorts already has the ncompress package, this file
should no longer exist.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Original patch missed modifying the "minimum" definition and the
src/bin/Jamfile, so I took care of that.
2017-12-29 15:33:56 -05:00
Ho Tuan Kiet 5450ee2d87 bin/media_client: return 0 on success
In MediaPlay.cpp, media_play returns non-zero value on failure but forgets to return zero on success.

Coverity CID: 1422617

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-29 15:28:38 -05:00
Ho Tuan Kiet f94f87c710 bin/pc: Mark non-returning function as void
set_var doesn't return any value yet its return type is ULONG, and Coverity freaks out about that. This patch turns that function into a void function.

Coverity CID: 603433

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-29 15:28:30 -05:00
Rene Gollent 3d9b569384 Debugger: Further work on memory leak hunting.
TeamWindow:
- Properly delete stack frame selection entries in destructor.

TeamDebugger:
- The reference to TeamDebugInfo wasn't correctly initialized to own,
  leading to TeamDebugInfo never being destroyed.

FunctionInstance:
- Also clear source code reference in destructor.

ImageDebugInfo:
- Release references to specific infos in destructor. These are acquired
  on our behalf when loading the image info, but were never released,
  leading to the latter never being freed.

DwarfManager:
- Release references to files in destructor.

FileManager:
- Release entries in various destructors.

Somewhat improves the situation in #13800, but is still far from complete,
as a thorough review of this nature hasn't ever really been done.
2017-12-28 23:22:13 -05:00
Rene Gollent 8bb774fc37 Debugger: Fix a memory leak.
TeamDebugger:
- In several cases, BReferences on thread handlers after a call to
  _GetThreadHandler() weren't correctly initialized to account for
  that function implicitly acquiring a reference on our behalf, leading
  to the reference count to spiral out of control, and consequently the
  handler would never be freed. Found while attempting to address
  #13800, likely more to come.
2017-12-27 23:52:13 -05:00
Rene Gollent 16b34a8fc7 Fix FreeBSD build.
- Recent changes to the build system appear to make the assumption
  that the GNU regex APIs are universally available. This isn't the
  case on FreeBSD, which requires libgnuregex to provide that
  functionality. This broke the host keymap build.
2017-12-27 23:06:56 -05:00
Fredrik Holmqvist 73159ec931 Make UEFI boot-platform build again
gnuefi package was replaced by gnu_efi_kernel, but build
was not updated. This is guesswork, as I couldn't track down what changed.
It finds headers, headers_arch and lib and works so should be ok.
2017-12-27 18:51:30 +01:00
Julian Harnath 4e6fbe0320 HaikuDepot: notify work status from main window
* Update the work status view with package state changes from
  MainWindow instead of PackageListView, because PackageListView
  does not always show all packages that are going to be installed
  (e.g. dependencies that are not shown when a search filter is
  active).

* Fixes the bug that prevented pending/download status to show up
  for dependencies when filters are used.
2017-12-27 15:13:34 +00:00
Augustin Cavalier 8d4324628d syslog.h: Add LOG_NFACILITIES, LOG_FACMASK, LOG_FAC.
Not in the POSIX specification, but defined (not behind any guards)
in (at least) FreeBSD, NetBSD, glibc, and macOS.

Found by miqlas and myself while working on porting GNU inetutils.
2017-12-26 17:09:26 -05:00
Augustin Cavalier 97f4f2b559 Migrate the BTextMailComponent docs to the Haiku Book. 2017-12-26 13:59:25 -05:00
Augustin Cavalier 3305611025 Mail Kit: Delete now-unused DES implementation. 2017-12-26 13:59:25 -05:00
Julian Harnath 39f49f7033 HaikuDepot: speed up package change handling
* During package population, when the repository is being
  refreshed, thousands of package change messages arrive
  in MainWindow while the PackageInfo fields are filled with
  data.

  Every such message caused a full generation of a package
  list (including applying filters to all known packages),
  which is quite slow, and caused the freezing from bug
  #13823. The list was only used temporarily to figure out
  if the package should be visible now or not.

* Instead of generating a new package list, we now only
  match the single updated PackageInfo against the current
  filters.

* Fixes #13823

* To reduce CPU usage even more, it would be better to not
  generate at all, or not subscribe to, package changes while the
  list is being initially populated, and/or to coalesce all the
  changes to each package info into one update message (instead
  of one for title, one for prominence, etc).
  Deferring subscription requires some additional thought on when
  to subscribe then, and how to avoid leaving a "hole" where
  changes would go unnoticed.
2017-12-26 17:31:59 +00:00
Augustin Cavalier 95c9effd68 Migrate the BMailComponent docs to the Haiku Book.
I've updated the docs to match the current BMailComponent, documented
new functions, and cleaned up the MailComponent.h file to at least
somewhat match our coding style.

First in a series (there are 3 more old API docs on the Mail Kit in that
"Public API" folder.)
2017-12-25 19:43:51 -05:00
Augustin Cavalier cba277f2f9 docs/apps/mail: Extract the "Writing Add-ons" guide and convert to markdown.
I guess it was at one point in Be Styled Text format, but it didn't
extract that way for me, so I had to manually recreate the styling...
2017-12-25 17:15:21 -05:00
Augustin Cavalier 6602e4b755 hey: Delete old documentation.
Superseded by Humdinger's blog post, and the Hey tutorial
from the BeOS Bible.
2017-12-25 17:15:20 -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 0d4fd77ef9 Magnify: Fix build on GCC5 (-Wambiguous-else). 2017-12-24 12:23:50 -05:00
Augustin Cavalier 726fb6c441 notification_server: Fix x86_64 build (missing parentheses). 2017-12-24 12:04:26 -05:00
Adrien Destugues ab75d3b5a8 Do not advertise libavdevice in ffmpeg build feature.
It is not actually used by our ffmpeg plugin.
2017-12-24 16:39:23 +01:00
Owen 0278976dd5 magnify: make it controllable by scripting
scripting properties:
* Info, Grid, and Stick (true/false)
* CopyImage
* MakeSquare
* Zoom (1-100)

Decreasing pixel size from the menu will half the size
until it's less than 32.

fixes #13884

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2017-12-24 12:05:09 +01:00
ohnx d2f5cd017c WebPositive: Improve CookieWindow cookie deletion
Fixes Coverity issue CID 1340122.
Also resolves two TODO items in the code: allowing the deletion
of a selection of cookies, and deleting all cookies from a site
when there are no specific cookies selected.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2017-12-24 12:04:21 +01:00
Hrishi Hiraskar 226f6c8bf1 Notification_Server: Added ability to choose position of notifications
The feature gives user ability to choose the position of notifications
out of Follow Deskbar, Lower Right, Lower Left, Upper Right and Upper
Left. Fixes #9749 - Notification_Server: add the ability to choose the
position of notifications (easy).

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2017-12-24 12:02:38 +01:00
Automatic Committer e229bf70b8 Update translations from Pootle 2017-12-23 07:32:05 +01:00
Automatic Committer 80e42f9c84 Update pci.ids from pciids.sourceforge.net 2017-12-21 05:20:13 +01:00
Augustin Cavalier d3b7157201 docs/develop: Remove obsolete "net" documents.
They've been "obsolete" since 2006, so they must be extra-obsolete
by now :-)
2017-12-20 20:42:57 -05:00
Augustin Cavalier e7b5f0a6f7 docs/ikteam: Delete most files.
The Interface Kit is long since "99% functional", so lists of modules
with what's-implemented-what's-not are not really helpful anymore.

The one (rather lengthy) file describing the unit testing system
set up by the IKTeam is indeed useful, so keep that.
2017-12-20 20:28:57 -05:00
Augustin Cavalier c42868a015 docs: Remove old "Mail Preferences" documentation.
Actually based on old BeOS documentation and long surpassed by
the Haiku User Guide.
2017-12-20 20:11:40 -05:00
Augustin Cavalier 6c179d73ad Icon Guidelines: Delete from tree, they live in the "website" repo now.
Previously when we used Drupal, the icon guidelines there "shadowed"
the ones in this tree. Now that the git-based website reigns supreme,
we should not keep two copies around. I've chosen to preserve
the one in the website repository and trash this one because the icon
guidelines primarily target artists, not programmers (as just about
all other docs in this directory do.)
2017-12-20 20:09:55 -05:00
Augustin Cavalier add916a765 Restore the "GPL licensing not permitted" in GLUT license headers.
It was originally there but was removed erroneously. The emails in which
we received permission to relicense stated this restriction explicitly.
2017-12-20 19:35:55 -05:00
Augustin Cavalier 04c3bd6cf1 Team: Defer adding the team to parent and hash until just before starting.
Previously I had intended to take the simpler route and just lock the
already-inserted team before setting the io_context (as in prior commits),
but after hearing some reports from users that some other seemingly
unrelated KDLs had possibly cleared up after the first iteration of
that fix, I decided to go with this route instead.

Now we do not insert the team into the parent and hash and send the
notification until just before the team's main thread is actually started;
i.e. we now initialize not only io_context but also the team's args, VM
address space, and user data (and if creation of any of these fails
we do not inset the team into the hash at all.)

Since the team structure was not locked at all while this initialization
was taking place, any number of race-dependent bugs could have been
caused by this on multicore systems.
2017-12-19 22:47:31 -05:00
Augustin Cavalier 4ecdf1e195 team: Only lock while actually setting io_context, not while creating it.
Thanks Ingo for the review!
2017-12-19 20:51:01 -05:00
Andrew Lindesay d483b4d0b5 HaikuDepot : More Backend Communications Improvements
Fixes for x86_64 build (tests)
2017-12-20 00:14:37 +01:00
Andrew Lindesay 1065ea343d HaikuDepot : More Backend Communications Improvements
Fixes for x86_64 build (additional)
2017-12-19 23:26:21 +01:00
Andrew Lindesay 29f98e1f33 HaikuDepot : More Backend Communications Improvements
Fixes for x86_64 build.
2017-12-19 22:47:04 +01:00
Andrew Lindesay 0df6decf1b HaikuDepot : More Backend Communications Improvements
Added missing files from prior commit.
2017-12-19 21:50:31 +01:00
Adrien Destugues 197c659920 libnetwork: re-introduce gethostbyname_r and gethostbyaddr_r
These are needed by existing openjdk package. Let's keep them until we
get the OpenJDK build working again and can remove the requirement.
2017-12-19 21:22:14 +01:00
Andrew Lindesay 3094fef308 HaikuDepot : More Backend Communications Improvements
* Further improves the logging and provides some
  basic performance numbers.
* Moves the bulk-load logic out of the data-model
  class.
* Introduces a state-machine for the bulk-load
  process so that it will be more easily able to be
  shifted to non-blocking IO when the HTTP libraries
  can do that.
* Implements concurrent loading of the bulk-data to
  hopefully improve lead time for icons and meta-data.
* Loads data to a temporary file and then moves to the
  final location in order to avoid partially written
  data in the cache.
* Handles situations where no network is available;
  prevents attempt to access the network.
* Allows bulk-load processes to be cancelled when the
  application quits.
* Introduces command-line arguments to help simulate
  scenarios to help with testing performance and
  network absence.
* Implements ordered insert and binary search in the
  'List' class + basic unit test.
2017-12-19 20:56:53 +01:00
Augustin Cavalier 11b65332b4 kernel/team: Lock the team while modifying the io_context.
Second part of the fix for #13861. Thanks Ingo for the review!
2017-12-17 22:27:44 -05:00