Commit Graph

9614 Commits

Author SHA1 Message Date
Jérôme Duval
2982d9819f fcntl.h: define O_DIRECT directly
coreutils wants to undefine O_NOCACHE, this shouldn't affect O_DIRECT though.

Change-Id: Id00316a78eb91b2c7f692bb46eca65b3a7983c6f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3398
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-20 18:23:35 +00:00
Murai Takashi
cb5156f081 LayoutBuilder.h: Fix use after free
Fix 'item' is used after delete.
Pointed out by Clang Static Analyzer.

Change-Id: I8eca3084c97b37015a2da1b96119a458d4eb9aa7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3392
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
2020-11-19 07:17:29 +00:00
Jérôme Duval
a1999d3b8a POSIX: add tcsetsid()
Change-Id: Ia8f41e417379dcaf4f976933cf91bb2de157bc72
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3376
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-17 07:53:28 +00:00
Jérôme Duval
e04970ad6f POSIX: add utmpx.h and function stubs
OpenJDK 14 assumes symbols and headers are available.

Change-Id: I21038e92afcfd2000ee95712bce874afd29611b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3371
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-17 07:46:30 +00:00
Andrew Lindesay
027d608682 HaikuDepot: LRU Cache for Icons
Only keep a fixed number of icons in memory at once.

Completes To #15370

Change-Id: I23e3a4fa7559894034f45afb3b536910ea037078
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3367
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-11-15 20:16:14 +00:00
Jérôme Duval
a9c09fcaae POSIX: lseek: support SEEK_DATA and SEEK_HOLE constants
this is queued for issue 8: https://www.austingroupbugs.net/view.php?id=415
this implementation calls the ioctl hook of the filesystem with BSD-like constants
FIOSEEKDATA and FIOSEEKHOLE. if the hook doesn't know the constants, we use the stat size
to return the last hole (as proposed in the draft spec).

Change-Id: I5d052eed87e29b70491a7ff534e244896469d03e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3385
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-11-12 10:42:11 +00:00
Jérôme Duval
fe357eb9c9 POSIX: add posix_fallocate and a preallocate syscall
the preallocate syscall will call the preallocate filesystem hook, if available.

fix #6285

Change-Id: Ifff4595548610c8e009d4e5ffb64c37e0884e62d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3382
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-11-12 10:41:21 +00:00
Jérôme Duval
b05d6f0af0 POSIX: asprintf and vasprintf are BSD/GNU extensions
fix #16259

Change-Id: Ia16bb6e1944b87b25d1a940bbdaaf6e236db1abf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3381
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-07 08:49:34 +00:00
Jérôme Duval
6878792ae4 C11: add aligned_alloc()
Change-Id: If648c0e27ed946874d393e8e33a4548b70c8ecdb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3377
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-04 21:01:42 +00:00
Jérôme Duval
b48159dce2 POSIX: add tcgetsid()
Change-Id: If58141b4e56b7fe444460b6808e33abc5ea71f37
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3374
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-11-04 06:18:17 +00:00
Jérôme Duval
7335fb0d5c in6.h: declare in6_addr with a union and extra fields
According to https://tools.ietf.org/html/rfc3493:
3.2 IPv6 Address Structure
"The structure in6_addr above is usually implemented with an embedded
union with extra fields that force the desired alignment level in a
manner similar to BSD implementations of "struct in_addr"."

Change-Id: Ibe0ee685366398c143cdf9573dcb77566a12888b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3348
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-10-23 08:13:03 +00:00
Jérôme Duval
d504f219f4 POSIX: add _SC_TTY_NAME_MAX
Change-Id: Ifa24f68535d7a4a4c5fe3f01e63fe2c87adcc429
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3340
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-10-23 07:08:03 +00:00
François Revol
ad22267906 m68k: Add missing disklabel.h for NeXT support
Currently used by fixup_next_boot_floppy.

Change-Id: I47c10657b5280f00e470a3171ad11744859ce76c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3310
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-12 06:36:15 +00:00
Leorize
e67a4284c0 libbnetapi: Disallow instantiation of BUrlRequest subclasses directly
This API change forces all creation of BUrlRequest to be done via
BUrlProtocolRoster::MakeRequest(). This allows the structure of protocol
addons to be altered without breaking ABI for client applications.

Change-Id: I1785c9136c50d19eaa9e57cb9d259ed8d88a5b56
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3080
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-10-12 06:36:00 +00:00
Adrien Destugues
62eaf4c0e1 mmc_bus: add execute_command function
For now it just forwards the command to the SDHCI controller.
The bus will gain more features and functions as work advances (tracking
which card is active, arbitration of DMA transfers, etc).

Change-Id: I094eb84f27e7789387a3f8fb65fba1e5fcfa3e8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3094
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-10-11 16:02:22 +00:00
Adrien Destugues
dedbe94e46 mmc: register devices for detected cards
Change-Id: I90891ead9a425e0e8bd25c2190fe3d430d49411b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1067
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-10-11 16:02:22 +00:00
John Scipione
7c095f4709 BeControlLook: Fix app integration drawing issues
Update BTab::DrawTab() to pass the current index, the index of the
selected tab, and the index of the first and last tabs into
BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab().
This allows you to draw tabs differently in your BTab or BControlLook
subclass in many different circumstances.

Modify BControlLook API to add indexes to DrawActiveTab() and
DrawInactiveTab() like so:

void DrawActiveTab(..., int32 index = 0, int32 selected = -1,
	int32 first = 0, int32 last = 0);
void DrawInactiveTab(..., int32 index = 0, int32 selected = -1,
	int32 first = 0, int32 last = 0);

These extra indexes are not used by HaikuControlLook which relies only
on if the tab is active or inactive to draw.

Add IndexOf(BTab* tab) method to BTabView and document it to get the
index of the current tab in BTab::DrawTab(). Also add a warning in the
BTabView::DrawTab() method not to use the position and full parameters
anymore, use BTabView::IndexOf(), BTabView::Selection(), and
BTabView::TabCount() to get the info you need.

Using a dynamic_cast to a BTabView in BeControlLook to determine if the
view is derived from a BTabView didn't work in the case of WebPositive.
Furthermore, WebPositive does custom tab drawing which needed to be
updated for alternative control look. These index parameters passed from
BTab to BeControlLook allow us to draw the tab like BeOS without relying
on a dynamic_cast to BTabView to get the info.

Reproduce the functionality described above for BTab in WebPositive's
custom tabs. Eliminate no longer needed code in favor of using indexes.
Update WebPositive custom tabs to use BControlLook::DrawTabFrame()
instead of BControlLook::DrawInactiveTab() matching the update made in
BTabView.

In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive
doesn't draw any tab background, so it expects this work to be done for
it.

Eliminate hasFrames variable from WebPositive.

Rename TabSelected(index) to UpdateSelection(index) in WebPositive to
better reflect its purpose.

Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more
selectively. Only draw border if left border is set for top and bottom tabs
or top border is set for left and right tabs. Undo no longer needed frame
manipulation border drawing workaround in HaikuControlLook::DrawTabFrame().

Draw scroll bar triangle without using DrawArrowShape().

Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in
BOutlineListView and menus distinctly from how it draws arrows in scroll
bars. Draw our distinct arrows in DrawSrollBarButtons() instead.

This fixes overflow of time edit up-down arrows in Clock prefs and the
collapse-expand arrow in Deskbar not being vertically centered.

In DrawBorders() only inset if we actually draw the border.

Fix alignment issues with DrawSliderThumb dots for example in
MediaPlayer volume knobs.

Draw using line arrays calling AddLine instead of StrokeLine in
several places.

DrawMenuBar() extends to draw final pixel which eliminates an extra
lines at the end of menu bars.

Truncate button labels better fixing a few issues for example keymap
keyboard layout button labels. Button insets has been updated a bit
to fix drawing issues with buttons missing a border.

Using a dynamic_cast to a BButton to determine if a view is a button
in BeControlLook didn't work in the case of the keymap label. Look for
B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel()
to draw the label inverted on click. Pass the B_FLAT flag from Keymap
keys when drawing using BControlLook so that the label is inverted.

Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-11 15:50:18 +00:00
Augustin Cavalier
64b46b706b headers: Adjust GCC2 stdbool to be usable by modern GCC.
musl's allocator needs to be built with GCC 8, but we need to link
it into GCC 2 libroot, which uses GCC 2 headers.
2020-10-10 16:36:59 -04:00
Jérôme Duval
06ed32b8c4 BCursor: add a constructor with bitmap and point
* enhancement #15169
* get_mouse_bitmap(): also reads the colorspace from app_server.
* docs and tests

Change-Id: Iba63f8a2789530ae596c30b92f14828f31761d98
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3292
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-08 08:23:31 +00:00
Jérôme Duval
db9d2a6f14 POSIX: add dprintf
Change-Id: I577d5283a9be04924a8dd05c3be3969b41da60db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3282
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-04 19:34:40 +00:00
Jérôme Duval
513955e6c0 GraphicsCard.h: remove declarations for dprintf and set_dprintf_enabled
Change-Id: Ie8bbfcf2f23cf0ee36dc74e76062f21c99effc96
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3281
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-03 11:52:37 +00:00
Jérôme Duval
64331e96ca kernel/x86: extend CR4 flags
Change-Id: I4861f6cd61d0daeeb2403d07e703b83cd6a00666
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3280
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-10-02 17:12:06 +00:00
Alexander G. M. Smith
a22fa0c977 package kit: Add pre-uninstall scripts feature.
Just like post-install scripts which run shortly after a package is
installed, pre-uninstall scripts are run just before a package is
removed.  Implements enhancement #13427

* Fix script exit code handling vs script launch errors.
* Bump package and repo file version numbers due to new attribute,
  unfortunately makes new .hpkg files not backwards compatible.
* Add pre-uninstall functionality, mostly cloning the post-install
  except in a few places.
* Discover that _RunQueuedScripts() is never called, a future TODO:?
* Update package documentation for pre-uninstall scripts, and use of
  the boot/post-install directory.

Change-Id: I45596255ce74bc102f6e5b606cbf83e4e4347a17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1504
Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-21 10:47:57 +00:00
CodeforEvolution
5c32512076 GNU Compatibility: Implement qsort_r
This is a version of the qsort function allowing you to pass a "cookie" to the function.

Change-Id: I60c645213b9c9590e38b112634fcac1d7969b6d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2449
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-18 06:25:20 +00:00
Jérôme Duval
e632208b79 kernel/scheduler: enable cpu load tracking after boot
when the cpufreq module is loaded, we let the scheduler update its policy.
Improve assert report
CoreEntry::GetLoad() could return more than kMaxLoad.

Change-Id: I127f9b3e8062b5996872aae30b4021b9904fa179
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3216
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-09-17 15:45:25 +00:00
Alexander von Gluck IV
0558674126 efi: fix pointer width on non-64-bit platforms
Change-Id: I041238af87df3e1e3a967216685413801fd49877
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2450
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2020-09-17 13:58:55 +00:00
Jérôme Duval
357b9d3cbb x86: identify Hygon vendor
it's a Zen-based CPU: rely on AMD support code.

Change-Id: Ia980a42457575bf8d1130d813310a285bf137691
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3217
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-15 20:43:45 +00:00
Jérôme Duval
7c1bcc9cae kernel/x86: add MSR for HWP and extended CR0 flags
Change-Id: I9e5d5421dabbdf7d4ecf6334509178f8f892591f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3215
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-09-15 20:43:17 +00:00
Jérôme Duval
22fdfc4428 kernel/cpu: add cpu_frequency()
implement on x86 with APERFMPERF.

Change-Id: Ia484854c76dee76c5447983de15800a25d791d39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3213
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-09-15 20:42:14 +00:00
Jérôme Duval
026c8b9c04 kernel/smp: add call_single_cpu()
to call a function on the target cpu. Early mechanism not available.

Change-Id: I9d049e618c319c59729d1ab53fb313b748f82315
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3212
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-09-15 20:42:14 +00:00
Jérôme Duval
eb7ac342a0 kernel/x86: detect power subfeatures
Change-Id: Id159f0d7fc7816b6a40b9cf28f53dfdbebd04a73
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3211
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-09-14 19:24:25 +00:00
Adrien Destugues
a52008cb44 tty: implement TCFLSH to flush buffers
This is probably incomplete. Is locking needed? Should we notify the
next writer (if any) that the port is writable when flushing the output?

Change-Id: I2566e2d036a61af4819894a44f57603179aa27df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2516
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-14 13:35:23 +00:00
John Scipione
fe88ae51ec AppKit: BMessage Add/Find/Get/Has/ReplaceNodeRef
This allows you to pass node_ref's around like you can entry_ref's.

Added node_ref_flatten(), node_ref_unflatten() and node_ref_swap() to
MessageUtils. These are close cousins to entry_ref_flatten(),
entry_ref_unflatten(), and entry_ref_swap() but for node_ref's.

Added B_NODE_REF_TYPE to TypeConstants.h in the Support Kit.

Added B_NODE_REF_TYPE to Debugger and ByteOrder in Support Kit,
B_NODE_REF_TYPE is treated the same as a B_REF_TYPE (entry_ref).

Add documentation for new NodeRef methods and B_NODE_REF_TYPE.

Change-Id: I32c6ed276bf1a7894a835b9fc9de5a882c35883c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3182
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:18:09 +00:00
Preetpal Kaur
02ad22d6c8 Input: declare BString to get the Mouse Name
Change-Id: I3476f58839202a6fd8c93e325a15045963a9b7b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3125
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
Preetpal Kaur
37d793236c Added get_set_mulitple_mouse_type() functions
Change-Id: I95f85a15a77c3a548bb672cb966ae7b13fcefcc8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3127
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
John Scipione
d9385a9d38 IK: align BTextView text rect/fix alignment
Recalculate line breaks in FrameResized() if word-wrap is on, otherwise
only move the text rect into position. StyledEdit was recalculating line
breaks before on resize (we have to in this mode) and the frame offset
updates for non-wrapping text views are inexpensive. This makes resizing
text view's work like StyledEdit everywhere.

Scroll to cursor when word-wrap setting changes if text view is editable.
If you are viewing a long document changing word-wrap can move the cursor
quite far, so scroll back to it.

Fix _ActualTabWidth() pen location for right and center-aligned text views
so that tabs widths are calculated correctly.

Reset fTextRect horizontal limits to bounds minus insets in
_RecalculateLineBreaks(), then grow fTextRect based on alignment when
wrap is off.

Fixing insets also fixes right and center-aligned BTextViews.
Left-aligned text view's grow right, right-aligned ones grow left,
and center-aligned ones grow out.

Make extra scrolling space for all aligned text views go the other way
from how it did in hrev24130 (and on left-aligned text view's too) so
that half the text is visible when you edit past the end or before the
beginnning of a text view instead of none of it.

Fixes #1651 #12608 #13796 #15189

Do not _RecalculateLineBreaks() if text view bounds are invalid.
In SetText() detect invalid text view bounds and resize the view to the
width and height of the first line. Then recalculate line breaks.
This fixes BAlert text view size issues.

Fixes #16481 (regression from hrev54496.)

Remove useless and heavy computation. There is no point in computing line
breaks for a 10px wide text view and it takes a long time because it needs
a lot of linebreaks. The view eventually gets laid out properly.

Fixes #5582 (which was not locale-related, after all.)

Only apply default insets if text rect is set to bounds. This ensures
that apps that manipulate the text rect can continue to do so without
the default insets interfering while apps that don't can benefit
from the defaults. If you want to set the text rect to bounds and
not use the default insets you must override the default by calling
SetInsets(). This prevent the default insets from being applied once
apps have changed the text rect fixing a bug in Icon-O-Matic where the
text rect insets were being applied incorrectly.

Fixes #16488 (regression from hrev54496.)

Reduce left and right insets inside text views from full label spacing
to half label spacing. Unify padding between BTextControl and BTextView.

Move fLayoutData->UpdateInsets() to private BTextView::_UpdateInsets()
because we need access to BTextView member variables when deciding
whether or not to add the default padding or not.

_UpdateInsets() changes:
* Don't update insets if BTextView::SetInsets() was called.
* Don't add default insets unless fTextRect is set to view Bounds().
* Do not set the right and bottom insets to left and top if negative,
  set them to 0 like we do to left and top -- DeskCalc bug otherwise.

Fixes #15688

Other BTextView fixes:
* Replace max_c and min_c with std::max and std::min respectively.
* Remove scrolling from one instance of BTextView::SetText() as it
  produced undesired results while editing a scrolled text view.
* Add default insets in _UpdateInsets()
* Fix scrolling when entering and deleting text so that some part of
  the text is always visible. Make visible scroll width depend on font
  size.
* Allow scrolling to a negative offset in x but not y. This allows you
  to scroll the entire contents of right and centered-aligned text views
  whose content does not fit in the box.
* Change _Refresh() to take an offset instead of a bool so that you can
  scroll to any offset.
* Replace TextLength() with fText->Length() in a couple of places.

TextControl changes:
* Set text rect in BTextControl::DoLayout().
* Remove AlignTextRect() from TextInput.

Fix the following problems in apps:

ScreenSaver: Set text rect in PreviewView::AddPreview().
Tracker: Set "Edit name" text view insets to 2. Tweek text rect position
  to be on top of label in icon, mini-icon, and list mode. Add a TODO that
  the text rect is a pixel off from the name on some files.
Mail: Remove _AlignTextRect() and FrameResized() from AddressTextControl.
  Use default insets on the text view, defaults are fine here.
DeskCalc: Set insets based on font size in ExpressionTextView
  SetTextRect() instead of manipulating the text rect.
  Remove _CheckTextRect() and related methods from InputTextView.
Icon-O-Matic: Remove _CheckTextRect() and related methods from InputTextView.
WebPositive: Remove _AlignTextRect() and FrameResized() from URLTextView
  and call SetInsets().
StyledEdit: Word-wrap and FrameResized() changes ported to BTextView.

Fixes #16476 #16480 #16488 (regressions from hrev54496.)

Change-Id: Ifeca6077f8815ccd86d5a3880f99556298aaf0fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3152
Reviewed-by: John Scipione <jscipione@gmail.com>
2020-09-07 22:10:36 +00:00
Niels Sascha Reedijk
331889d067 Kernel/Threads: remove limit on number of dead threads in a team
When a thread is created, it is expected that some other thread (usually the
creating thread) will want to make sure it completes. This is done using the
pthread_join() or wait_for_thread() calls.

It is possible that threads end before another thread waits for its completion.
That's why there is a dead thread list for each team, which holds thread ids
and their exit status so that a call to pthread_join() or wait_for_thread() in
the future can complete succesfully.

The dead thread list was limited to 32 threads per team. If there would be
more, the oldest thread would be kicked off. This could cause issues in
situations where a team would create more than 32 threads, and would start
waiting for their result after they have finished. Some of the calls would fail
because the threads would no longer be in the dead list.

This specifically caused problems for cargo (the Rust package manager), which
could depending on the number of dependencies, could create more than 32
threads. See: https://github.com/nielx/rust/issues/3

This change removes the limit of dead threads within a team. Note that there is
a risk that a badly written program that does not detach or joins its threads
can make this an endless list, but the impact is relatively small (dead threads
only occupy a bit of kernel memory).

Change-Id: I0135dd54e10ee48a529f23228d21237d4f1a74e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3178
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-01 21:04:46 +00:00
Adrien Destugues
41853a8bbf locale kit: allow creating a catalog without entry_ref
The catalogs are loaded from separate files, so there is no need to have
an app entry_ref to load them, just a MIME type is enough.

The implementation is a bit simplified: only the default catalog format
is allowed (unlike when loading from entry_ref, where extra catalog
formats can be added in add-ons).

Unrelated cleanup: remove unused code to load catalogs from attributes
of an application. We considered this when designing the locale kit, but
using resources or separate files works better.

Use this in Cortex, where some strings are in a static library, so they
don't have an associated executable or library or add-on to identify
them. The code in Cortex is not complete localization, several parts
should use StringForRate, BStringFormat, etc.

Change-Id: I09be22b1f50891250c4497c51e1db8dcee279140
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3172
Reviewed-by: Kacper Kasper <kacperkasper@gmail.com>
2020-09-01 18:14:57 +00:00
Michael Lotz
75a10a74e8 kernel/vm: Make vm_copy_area take page protections into account.
When copying an area with vm_copy_area only the new protection would be
applied and any possibly existing page protections on the source area
were ignored.

For areas with stricter area protection than page protection, this lead
to faults when accessing the copy. In the opposite case it lead to too
relaxed protection. The currently only user of vm_copy_area is
fork_team which goes through all areas of the parent and copies them to
the new team. Hence page protections were ignored on all forked teams.

Remove the protection argument and instead always carry over the source
area protection and duplicate the page protections when present.

Also make sure to take the page protections into account for deciding
whether or not the copy is writable and therefore needs to have copy on
write semantics.

Change-Id: I52f295f2aaa66e31b4900b754343b3be9a19ba30
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3166
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-08-23 00:55:58 +00:00
Alexander von Gluck IV
21258e2674 riscv64: Fill in some missing CPU defines, advance build further
Change-Id: Id050fad59ede444f2eab7eca681c6ec44612aaf9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3160
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: François Revol <revol@free.fr>
2020-08-19 16:11:32 +00:00
François Revol
425515d0ac m68k: really add fenv from musl-1.1.24
Somehow the first review merged only the commit log.

FreeBSD doesn't have m68k anyway, so use fenv from musl with as less
changes as possible.

Change-Id: I6372af6679e6773fbb6bf4c8b5b30512971a97a6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3161
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2020-08-19 15:23:47 +00:00
John Scipione
22758f1690 Revert "IK: align BTextView text rect/fix alignment"
This reverts commit a9b301871d.

hrev54496

Change-Id: Ife3c834ad98d330f04976d9adf3b1553e7aca034
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3153
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-08-19 03:38:41 +00:00
Michael Lotz
4df4ae2e80 kernel/x86: Enable machine check exceptions if supported.
This enables generation of exceptions that are due to uncorrected
hardware errors. The exception handlers were already in place and will
now actually trigger kernel panics.

Note that this is the simplest form of MCE "handling" and does not add
anything of the broader machine check architecture (MCA) that also allow
reporting of corrected errors. As MCEs are generally hard to decode due
to their hardware specifity, this merely makes such problems more
obvious.

Might help to discern hardware issues in cases that would otherwise just
triple fault and cause a reboot.

Change-Id: I9e3a2640458f7c562066478d0ca90e3a46c3a325
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3155
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-08-18 06:54:53 +00:00
rofl0r
7de1ebe0d6 netdb.h: fix prototype of gethostbyaddr()
first parameter should be const void*, in line with freebsd and linux etc.

https://xref.landonf.org/source/xref/freebsd-current/include/netdb.h#232

Change-Id: I5e953e8e7e49a6f09cd1143de6ca57eb98f77d73
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3147
Reviewed-by: Michael Lotz <mmlr@mlotz.ch>
2020-08-17 00:08:02 +00:00
Adrien Destugues
6d9c0146a5 BGradient: fix assignment operator, add copy constructor
The BGradient class is a bit strange as it can store any gradient on its
own, butonly the subclasses allow to set some of the fields.

In the asignment operator, the non-base data (which is in an union) was
not copied over.

More importantly, the missing copy constructor led to the default
implementation being used, and BList (used for the color stops) was
being copied using its default copy constructor, resulting in the two
BGradient (original and copy) poinitng to the same stops data. Heap
corruption resulted whenever one of them was deleted.

Having a working copy ocnstructor fixes this. The alternative is making
the copy constructor private or protected to make sure gradients are not
copied, since normally you'd copy only the subclasses, preserving the
C++ type. However there is nothing enforcing that, and manipulating a
BGradient copied from a subclass works just fine.

Change-Id: I28e733eb8a2970b76ae623eabb75ef8435f508af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3144
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-08-11 20:46:34 +00:00
John Scipione
a9b301871d IK: align BTextView text rect/fix alignment
Preserve passed in text rect in fTextRext (unless in layout)
and create an internal version fAlignedTextRect which is used
in place of fTextRect. fAlignedTextRext is aligned to fit the
text rect bounds and grows to fit. fAlignedTextRect always grows
vertically but only grows horizontally if wrap is off.

Left-aligned text view's grow right, right-aligned ones grow left,
and center center aligned ones grow out.

Set fTextRect to bounds in _DoLayout().

Reduce left and right padding inside text views from full label
spacing to half label spacing. Unify padding between BTextControl
and BTextView.

Fixing padding also fixes right and center-aligned BTextViews.

Undo extra scrolling for non-left text views from hrev24130 fixing
a scrolling left and right with mouse bug when it shouldn't.

Replace max_c and min_c with std::max and std::min respectively.

Remove scrolling from one instance of BTextView::SetText as it
produced undesired results while editing a scrolled text view.

Set text rect in BTextControl::DoLayout() and ScreenSaver
PreviewView::AddPreview().

Don't add padding if BTextView::SetInsets() is called. Set insets
to 0 in Tracker "Edit name" setting which prevents default padding
from being added. This is so that when you rename a file in Tracker
the TextView appears on top of the file name text with no padding.

80 char limit fixes.

Fixes #1651 #12608 #13796 #15189 #15688

Change-Id: I8c6106effc612f49aff374f29742471628b5df86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3054
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-08-06 11:51:15 +00:00
Adrien Destugues
1bad1ff34a Prepare for ICU update
- libicule and libiculx do not exist anymore in newer ICU versions
  (harfbuzz replaces them), but we didn't actually use them, so remove
  them from the build feature and from the package dependencies
- Add namespace usage marcos since the newer ICU packages put ICU things
  in a namespace, making it easier to have multiple versions of ICU used
  side by side.

No functional change intended, but this makes it possible to build the
code with either ICU 57 (for gcc2) or 66 (for other architectures).
2020-08-02 11:58:14 +02:00
Michael Lotz
2555f33549 Cleanup: Various comment and whitespace fixes.
Change-Id: I37c3e3346813efc595df651421b7e8ff4fbf3339
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2845
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-08-01 19:23:27 +00:00
Michael Lotz
b3bd66961a libroot/kernel: Implement MADV_FREE madvise() extension.
It allows an application to signal that it no longer needs the data in
the given address range and the underlying pages can be discarded and
reused elsewhere. This is finer grained than working with full areas
or mappings at a time and enables unmapping sections of partially used
mappings without giving up its address space.

Compared with punching holes into a mapping by "mapping over" with
PROT_NONE and MAP_NORESERVE, this has the obvious advantage of not
producing a lot of unused extra areas and saves the corresponding
resources. It is also a lot "lighter" of an operation than cutting
existing areas.

This introduces madvise() alongside the existing posix_madvise() to
allow for OS specific extensions. The constants for both functions are
aliased, the POSIX_MADV_* being a subset of the MADV_* ones without the
non-POSIX extensions. Internally posix_madvise() simply calls madvise().

MADV_FREE is commonly supported in other OSes with various subtle
semantic differences as to when pages are actually freed/cleared and how
or whether the pages are counted against the memory use of a process.
In the variant implemented here, pages are always immediately discarded
and memory counting is not altered. This behaviour should be considered
an implementation detail and may be altered later. The actual unmap and
discard could for example be delayed until pages are needed elsewhere to
reduce overhead in case of repeated discarding and remapping.

Note that MADV_FREE doesn't really align with the rest of the madvise()
API as it works like a command (i.e. discard these pages) and does not
add an attribute to the pages in the given range (i.e. mark these pages
for quick access from now on). As such, an MADV_FREE does not need to be
undone by setting a different advice later on, unlike how the other
flags work. This discrepancy may be the reason why it is not part of
POSIX.

Change-Id: Icc093379125a43e465dc4409d8f5ae0f64e107e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2844
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-08-01 19:23:27 +00:00
Michael Lotz
8e74e30784 kernel/vm: Add discard_address_range that discards pages.
Pages in the given range are unmapped and freed without getting written
back anywhere. It can be used whenever a caller does not care about the
data in the given range anymore and wants to reduce page pressure.

Change-Id: I8bcce68fab278efef710d3714677e1d463504a56
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2843
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-08-01 19:23:27 +00:00
Adrien Destugues
4bfc0072e3 limits.h: ncrease ARG_MAX
The limit was set when creating limits.h back in hrev88. It seems to be
used only in glob(). The limit is quite low by today standards and
prevents building icu 67.

I guess the liit was put at 32K because that's what BeOS did, but I see
no reason to keep it that way.

Change-Id: I74f95d9b56891dd90c79b7ced35ca8d1ec81d6ab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3117
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-08-01 17:37:01 +00:00
Adrien Destugues
bd3b7c3f90 Make space for AVX-512 registers in x86 arch_thread.
Should fix #16382

Change-Id: Ib1445e3c08036a8c959eae54adcf0f0c27bcf22d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3031
Reviewed-by: Rene Gollent <rene@gollent.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-07-17 11:17:20 +00:00
Adrien Destugues
2ad7efd4b5 Build fix. 2020-07-14 19:33:20 +02: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
X512
4399ec510d BPicture: add fill rule support
Change-Id: I068e1c2e8659f7b90c6d7c7331a8bb25ae343fe9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2922
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-07-12 19:44:43 +00:00
X512
90ab1a44ad BPicture: add gradient support
Fixes #9680.

Change-Id: I0013326559cc40ff26cf7b44794c0b32aea832ba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2829
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2020-07-12 19:44:43 +00:00
Augustin Cavalier
4639c4e898 headers: Add exp10 declarations to gnu/math.h.
These are GNU extensions so they need to be behind _GNU_SOURCE.

Fixes #16371.
2020-07-07 20:48:58 -04:00
Alexander von Gluck IV
3853f36288 radeon_hd: Cram in a bunch of new PCIID's
Change-Id: Ifbd82ef7bfc2c39b2aeb5c25be177421cd22d246
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2920
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-07-06 06:39:11 +00:00
Augustin Cavalier
b022a5e224 BScrollView: Ask the BScrollBars what their preferred sizes are.
This replaces the use of the hard-coded scroll bar size constants
and instead asks the scrollbars for their preferred sizes directly.

Right now, this is a giant no-op since BScrollBar just returns
the same hard-coded size when asked. The next commit will, however,
change that.
2020-07-05 18:37:48 -04:00
Augustin Cavalier
9fe3529f3e BScrollBar: Remove DISABLE_ON_WINDOW_DEACTIVATION constant.
It was always enabled, and disabling it would break ABI.
If we want to make it disable-able, it needs to be a setting,
but I don't really see a reason for that.
2020-07-05 18:37:48 -04:00
Augustin Cavalier
e9815ed8b6 BScrollBar: Move SCROLL_BAR_{...}_KNOB_SIZE constants into the source.
They were not used anywhere else in the tree anyway. Resolves a TODO.
2020-07-05 18:37:48 -04:00
Alexander von Gluck IV
89fd39f42a efi: Refactor CPU code to be arch-specific
* Migrate some platform agnostic architecture code into
  boot/arch from efi/arch. This helps to avoid conflicts
  between kernel and boot sources as well.
* Conflicts between arch_cpu in efi and kernel code means
  bootcode really should *never* directly use kernel arch
  headers. (other platforms don't, which is why they don't
  have this same issue)
* We carefully thread any needed kernel headers (namely
  assembly helper macros) into the bootloader headers without
  mixing in the whole conflicting kernel/arch headers.
* ARM now properly get its cpu init code called, and we
  progress further into the EFI bootloader.

Change-Id: If67ec9758b5ce68563ebd9eb45d5196401911c67
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2975
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-04 21:04:20 +00:00
X512
d9d96260e0 BMenu: speed up deleting items
Fixes #16336.

Change-Id: Ie941f45f363f6fe94062fc3acb8bd3bb876c1f1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2976
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-07-04 16:49:55 +00:00
Augustin Cavalier
8da1468de6 arpa/nameser.h: Fix build on GCC8.
ssize_t comes from sys/types.h.
2020-07-03 15:30:00 -04:00
Augustin Cavalier
4a230cfc6c SPARC: Remove ancient BSD arch headers.
None of these were used; they were all imported with the original
root Haiku commit, and they are totally unrelated to PulkoMandy's
new SPARC work. Plus, they were also under a BSD Advertising Clause
license.
2020-07-03 15:13:24 -04:00
Augustin Cavalier
657f041aee fnmatch: Replace BSD implementation with musl one.
The BSD implementation was under the Advertising Clause,
so we might as well take the opportunity to replace the
implementation entirely with musl's.

Header also rewritten to be a Haiku one; the constants
are left unchanged of course.
2020-07-03 15:09:33 -04:00
Augustin Cavalier
6996e5b271 headers: More removal of the BSD Advertising Clause.
Taken from FreeBSD; some minor cleanup elsewhere.

udp.h rewritten entirely as it contained no copyrightable
material and bears little resemblance to BSD's.
2020-07-03 15:00:37 -04:00
Augustin Cavalier
ebffd73fc5 arpa/nameser.h: Cleanup.
* Remove functions not even FreeBSD defines.
 * Remove dependency on unnecessary headers.
 * Update copyright headers to match FreeBSD's; includes
   removal of the advertising clause.
 * Move some private structs to netresolv port_before.

Unfortunately, it seems musl implements very little of this file,
so we may wind up sticking with netresolv for its implementation.
2020-07-03 14:27:17 -04:00
Augustin Cavalier
2ed1a36d4b resolv.h & netdb.h: Clean up and simplify.
* Remove all functions and a number of constants that neither
   glibc nor musl define or support (and even FreeBSD does not
   declare a good number of these anymore.)
 * Redeclare the primary flags in terms of (1 << X) instead
   of raw 0x... for readability (the constants at the end
   do NOT match up to their definitions in glibc, musl, and BSDs!)
 * Remove usage of unneeded headers, and __BEGIN/END_DECLS.
 * Replace non-Haiku license headers with the ones from FreeBSD,
   which notably contain a removal of the advertising clause.

ABIs remain unchanged, but a small set of applications that
use these esoteric APIs may not compile anymore (are there
any remaining?)
2020-07-02 19:33:51 -04:00
Kacper Kasper
97bd6fe8d4 app_server: Implement more composition modes
* Use agg::comp_op classes to blend pixels.
* Subpixel path not implemented.
* Needed by WebKit.
* Implements #10274.

Change-Id: I07b0002196fd0a05fc100bd9f6d703c33cadc85b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2932
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-29 14:07:42 +00:00
X512
8fbce87334 BMenu: implement scripting
Fixes #15540.

Change-Id: I965d04bcbb6db41cc7a744d18fa3c9ffab2a81f1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2941
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-24 14:08:16 +00:00
Augustin Cavalier
17dab0d52b inet.h: Remove "cidr" functions.
These are not in the standard and are not declared by glibc at all.
The symbols remain for any applications that are still using them,
for now.\

Change-Id: Ie6b4a6b5ec3231c304e05ce9cb38c67d9ee51ad7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2942
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-06-22 16:02:31 +00:00
Preetpal Kaur
13b45a2ea3 Integrate PadBlocker in input preferences
- Import padblocker sources
- Add slider to set padblocking time
- Generates PadBlocker settings

Fixes #11673

Change-Id: Ic88416215aabb1ae6aba79ff41cb55a7f0f8008d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1590
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-22 15:08:48 +00:00
CodeforEvolution
29ae0e0f61 wacom: SMAP Fixes and Refactoring
Utilize user_memcpy and IS_USER_ADDRESS when necessary to prevent SMAP violations.
Also add a "wacom_device_header" struct to more easily share data between the wacom
kernel driver and input_server addon.

Should fix #14589

Change-Id: Ie2784020b21523f82fd450a2db2de60ccf9d6620
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2783
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-20 18:26:45 +00:00
Leorize
b927cf6822 docs: Add documentation for BUrlProtocolListener
Change-Id: I6fb6092d31e9ff94a1c9466240b375b9b88f2d8f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2929
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-06-20 18:13:33 +00:00
Axel Dörfler
93845aec95 block_cache: Change signature of *_etc() functions
* This allows file systems to retrieve the actual error code on a
  failure, and report it to the user.
* All affected file systems have been adjusted to the API change.
  This is a binary incompatible change.

Change-Id: Id73392aaf9c6cb7d643ff9adcb8bf80f3037874c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2913
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-20 18:10:03 +00:00
Michael Lotz
31cee26cfe kernel: Whitespace cleanup only. 2020-06-13 23:24:27 +02:00
X512
8301c4980b AutoDeleter: add operator [] for ArrayDeleter
Change-Id: I015951053050b58e73fd71e4abb104a0755416f7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2890
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-06-09 08:10:42 +00:00
Jérôme Duval
9495126984 kernel/x86_64: AVX support
xsave or xsavec are supported.
breaks vregs compatibility.
change the thread structure object cache alignment to 64
the xsave fpu_state size isn't defined, it is for instance 832 here, thus I picked 1024.

Change-Id: I4a0cab0bc42c1d37f24dcafb8259f8ff24a330d2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2849
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-03 06:16:48 +00:00
Adrien Destugues
6b0e92ebd4 libshared: move md5 to BPrivate namespace
Otherwise it clashes with the implementation in OpenSSL which uses the
same names but now has a different ABI.

Change-Id: I5cb3ff97d7b28de978cdcbd8a06f25f65fb53784
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2854
Reviewed-by: Kyle Ambroff-Kao <kyle@ambroffkao.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-06-02 06:51:58 +00:00
Augustin Cavalier
cf5cb76ffa build: Add BufferIO stub header. 2020-06-02 00:03:18 -04: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
0d7d1fccff libroot: Implement the general case of posix_spawn using load_image.
The goal here is to avoid potentially expensive fork()ing.

The time for a fork() is (for a process with no real heap usage
and thus few areas) 300-400us on my system. load_image() takes
3000us (3ms) or so, but this of course includes exec() time.

Overall, for compiling HaikuDepot (with a tweaked jam to use
posix_spawn on Haiku, not just on Linux) there is a slight
decrease in time:

before:
real 1m21.727s
user 1m2.131s
sys  0m43.029s

after:
real 1m19.472s
user 1m1.752s
sys  0m41.740s

Which is probably within the realm of "noise", so more benchmarks
are needed. Likely if we tweak our jam usage to not need as many
shells when running commands, this would be a much more noticeable
change.

Change-Id: I217f2476b1ed9aa18322b3c2bc8986571d89549a
2020-05-30 01:19:48 -04:00
Michael Lotz
a6926d4287 kernel/vm: Introduce and use VMAddressSpace::AreaRangeIterator.
It iterates over all areas intersecting a given address range and
removes the need for manually skipping uninteresting initial areas. It
uses VMAddressSpace::FindClosestArea() to efficiently find the starting
area.

This speeds up the two iterations in unmap_address_range and one in
wait_if_address_range_is_wired and resolves a TODO in the latter hinting
at such a solution.

Change-Id: Iba1d39942db4e4b27e17706be194496f9d4279ed
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2841
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-30 02:29:41 +00:00
Michael Lotz
a626bdab77 kernel/vm: Remove linear search from _get_next_area_info.
This introduces VMAddressSpace::FindClosestArea() that can be used to
find the closest area to a given address in either direction. This is
now trivial and efficient since both kernel and user address spaces use
a binary search tree.

Using FindClosestArea() getting multiple area infos is sped up
dramatically as it removes the need for a linear search from the first
area to the one given in the cookie on each successive invocation.

Change-Id: I227da87d915f6f3d3ef88bfeb6be5d4c97c3baaa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2840
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-30 02:29:41 +00:00
Michael Lotz
621f53700f AVLTree: Add convenience LeftMost/RightMost with no arguments.
They return the left and right most nodes of the entire tree, i.e.
starting from the root node.

Change-Id: I651a9db6d12308aef4c2ed71484958428e58c9bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2838
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-30 01:47:40 +00:00
Michael Lotz
4986a9a3fd Revert "kernel: Remove the B_KERNEL_AREA protection flag."
This reverts parts of hrev52546 that removed the B_KERNEL_AREA
protection flag and replaced it with an address space comparison.

Checking for areas in the kernel address space inside a user address
space does not work, as areas can only ever belong to one address space.
This rendered these checks ineffective and allowed to unmap, delete or
resize kernel managed areas from their respective userland teams.

That protection was meant to be applied to the team user data area which
was introduced to reduce the kernel to userland overhead by directly
sharing some data between the two. It was intended to be set up in such
a manner that this is safe on the kernel side and the B_KERNEL_AREA flag
was introduced specifically for this purpose.

Incidentally the actual application of the B_KERNEL_AREA flag on the
team user data area was apparently forgotten in the original commit.

The absence of that protection allowed applications to induce KDLs by
modifying the user area and generating a signal for example.

This change restores the B_KERNEL_AREA flag and also applies it to the
team user data area.

Change-Id: I993bb1cf7c6ae10085100db7df7cc23fe66f4edd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2836
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-30 01:47:40 +00:00
Michael Lotz
428bc69ab8 VMCache: Factor out a _FreePageRange method.
The code in the Resize and Rebase methods was identical except for the
iterator.

Change-Id: I9f6b3c2c09af0c26778215bd627fed030c4d46f1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2835
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-30 01:47:40 +00:00
Michael Lotz
57656b93b6 kernel/locks: Implement lock switching for recursive_lock.
This allows switching from another recursive_lock, mutex or read-locked
rw_lock analogous to the switching possibilities already in mutex.

With this, recursive_locks can be used in more complex situations where
previously only mutexes would work.

Also add debugger command to dump a recursive_lock.

Change-Id: Ibeeae1b42c543d925dec61a3b257e1f3df7f8934
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2834
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-30 01:47:40 +00:00
Michael Lotz
d750211a65 bootloader: Split memory map handling into add/remove passes.
The memory map may be unordered and include overlapping ranges. To make
sure that nothing gets included as usable that should actually be
excluded, first scan for all usable ranges and add them, then remove
anything unusable from these ranges again.

To calculate the amount of unusable memory, count the total after the
first pass and then subtract the total after the second. This way, only
unusable ranges that actually overlap physical memory (and therefore
reduce the amount of usable memory) get excluded.

Note that the explicit ignore of the ACPI reclaim memory is subsumed by
the above. We still don't want to add this region to the usable memory
map, as that would allow the kernel to allocate pages into that region,
possibly corrupting ACPI tables before they were used. We also don't
want to add it as an allocated range, as it is not guaranteed that ACPI
is done with the tables before the unused bootloader ranges are freed in
the kernel.

Also add the missing unusable memory amount from ignoring the first MiB
of memory in the EFI loader.

May fix #16056 although it is not certain that graphics memory ranges
are actually included in the memory map.

Change-Id: Ie7991d2c4dcd988edac2995b3a7efc509fa0f4a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2814
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-26 04:04:35 +00:00
François Revol
8a9a366fef strings.h: s/inline/__inline__/
As suggested by http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Inline.html

This should fix building things like NBDkit.

Change-Id: I1da7fc140dd8451ff2ddaf599fe4e951401d0cb3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2794
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-05-24 13:59:57 +00:00
Alexander von Gluck IV
a742970be5 Fix build of Haiku on gcc10 host
Change-Id: Iea16a7d07a32497c4f228739945356b5c8be9897
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2540
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-21 01:35:10 +00:00
Adrien Destugues
d9ef4f90bb Remove GPL-licensed implementation of MD5
APE reader was using a GPL licensed version of MD5. A similar
implementation in the public domain was available in libnetapi, which I
moved to libshared so the APE reader can use it (and made some fixes,
missing const mainly). It only needs a small wrapper to use it easily
from C++ in a way compatible with the previous implementation.

Part of #13814.
2020-05-17 19:06:59 +02:00
Augustin Cavalier
e54b2d7cf2 kernel/lock: Fix build under non-KDEBUG.
I forgot to change MUTEX_INITIALIZER following removal of the
unused field.

Change-Id: I011c023ae00bb4576c8bcecf83546892fef3a77e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2719
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-17 03:36:04 +00:00
Augustin Cavalier
fd161d7bf2 kernel/locks: Remove ignore_unlock_count and fix races in lock timeout.
As far as I can tell, there is no reason to ignore unlocks, ever;
if no threads are waiting, then mutex_unlock() will act appropriately.
So all we need to do is increment the lock's count here,
as we are relinquishing our request for locking.

On the other hand, if we did not find our structure in the lock,
that means we own the lock; so to return with an error from here
without changing the count would result in a deadlock, as the lock
would then be ours, despite our error code implying otherwise.

Additionally, take care of part of the case where we have woken up
by mutex_destroy(), by setting thread to NULL and checking for it
in that case. There is still a race here, however.

May fix #16044, as it appears there is a case where ACPICA
calls this with a timeout of 0 (we should make this be
a mutex_trylock, anyway.)

Change-Id: I98215df218514c70ac1922bc3a6f10e01087e44b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2716
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-17 00:22:15 +00:00
X512
ec43e4f4c2 AutoDeleter: do not allow copy
Change-Id: Ieab0fea46fc23c446bbaca407e3e80a4a7901896
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2704
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-16 18:23:09 +00:00
Michael Lotz
d6ddb118f3 kernel/vm: Whitespace cleanup only. 2020-05-10 23:55:25 +02:00
Augustin Cavalier
0b5d48563d fs_shell: Prevent inclusion of BSD headers; fix DeviceOpener. 2020-05-10 12:44:46 -04:00
Jérôme Duval
c74c347353 kernel/x86: detect xsave subfeatures
Change-Id: Ida635441faaea4fb060e9f77ca3f4f167dc4bfe4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2617
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-05-10 15:49:48 +00:00
X512
db3a94141a SeparatorItem: support horizontal layout
This is required for BMenuBar based toolbars.

Fixes #15785.

Change-Id: I8d108694b481e408e5c56e23a697c8e7829343dc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2316
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-05-10 15:45:27 +00:00
Suhel Mehta
d72239d23d Move DeviceOpener class to a separate file.
It is used by several of the filesystems, so it seems a good idea to
move it to the shared/ directory.

UFS2, BFS, XFS, EXT2 and EXFAT are adjusted.

Change-Id: I493e37a1e7d3ae24251469f82befd985a3c1dbdd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2489
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-05-10 08:29:31 +00:00
Augustin Cavalier
9304fbae8a uchar.h: Remove duplicate definition of mbrtoc32. 2020-05-09 16:15:55 -04:00
Adrien Destugues
aa272ca35c Package Kit: reduce identifer/base-url confusion
For historical reasons, the package kit has an "url" field that is not
actually meant to be used as an URL. Rename it in the API and user
facing output as "identifier" to make it clear what the file is used
for. This change preserves the "url" key in on-disk and online storage
(hpkr files, stored settings, etc) in an attempt to not break anything.

Fix one remaining misuse of the "url" field as an URL in
get_package_dependencies.

Add an unit test showing that BUrl does parse "tab" URIs properly (there
is just a protocol and a path segment).

Change-Id: I339ce526e5798d42d78ae650855d7e988dbb4a1a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2542
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-09 20:04:50 +00:00
Adrien Destugues
22337d8f4b uchar.h: char16_t must be uint_least16_t
We attempted to make it a 32bit char type, but that is actually not allowed
unless we also make uint_least16_t a 32bit type. And even then, we
wouldn't be allowed to store or handle values wider than 16bit.

Comply more closely to the standard. As a result, mbtoc16r is not
implemented. c16rtomb is implemented by casting the char to 32bit, which
isn't really correct either (I think you're supposed to be able to feed
the two halves of a > 16bit codepoint in two separate calls and get a
meaningful result out?)

Related to #15990 but we may want an actual implementation?

Change-Id: If8198675c27dd2aa412bc44d12d3df4e31d3e8c7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2623
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-09 19:29:28 +00:00
Augustin Cavalier
a20a26e264 Versioning: Add BETA_2 and PRE_BETA_3 constants.
* PRE_BETA_3 is now the default in master.
2020-05-08 23:30:15 -04:00
Michael Lotz
b94221f3b2 mmap: Use MAP_NORESERVE to request overcommit, not PROT_NONE.
This reverts hrev54120 and instead adds the commonly supported
MAP_NORESERVE flag to request overcommit.

Using PROT_NONE for overcommit is problematic as the protection of
individual pages can still be changed via mprotect to make them
accessible, but that won't change the commitment. An application
using such a pattern may then unexpectedly run into out of memory
conditions on random writes into the address space.

With MAP_NORESERVE the overcommit can explicitly be requested by
applications that want to reserve address space without producing
memory pressure.

Change-Id: Id213d2245c5e23103e8e0857f7902e0cd8a2c65d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2611
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-05-09 02:57:48 +00:00
Michael Lotz
4e2b49bc0c kernel/vm: Implement swap adoption for cut_area middle case.
Rename MovePageRange to Adopt and group it with Resize/Rebase as it
covers the third, middle cut case.

Implement VMAnonymousCache::Adopt() to actually adopt swap pages. This
has to recreate swap blocks instead of taking them over from the source
cache as the cut offset or base offset between the caches may not be
swap block aligned. This means that adoption may fail due to memory
shortage in allocating the swap blocks.

For the middle cut case it is therefore now possible to have the adopt
fail in which case the previous cache restore logic is applied. Since
the readoption of the pages from the second cache can fail for the same
reason, there is a slight chance that we can't restore and lose pages.
For now, just panic in such a case and add a TODO to free memory and
retry.

Change-Id: I9a661f00c8f03bbbea2fe6dee90371c68d7951e6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2588
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-08 21:56:56 +00:00
Hamish Morrison
c6657ffe02 Resize caches in all cases when cutting areas
* Adds VMCache::MovePageRange() and VMCache::Rebase() to facilitate
  this.

Applied on top of hrev45098 and rebased with the hrev45564 page_num_t to
off_t change included.

Change-Id: Ie61bf43696783e3376fb4144ddced3781aa092ba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2581
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-08 21:56:56 +00:00
Adrien Destugues
2dc597d50d Optimize ffs() implementation
- Use gcc builtin
- Define as a static inline function in the .h so no function call overhead is needed
- Keep the function in libroot for backwards compatibility
- Remove a duplicate implementation in the freebsd compatibility layer

gcc2 does not document the builtin, but it is in fact already available
there as well.

Fixes #3281.

Change-Id: I94f8a2548637aa70e85febbfab06f07c1a427005
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2605
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-08 14:01:53 +00:00
Adrien Destugues
20f2ebae4b Remove MouseDownThread and its usages
This code comes from an old Be Newsletter and since then the API
received the addition of SetMouseEventMask. In several places the
MouseDownThread was misused: it would spawn a new thread on every mouse
click and not clear the previous one. This could for example lead to
BSpinner skipping values if you clicked it at the right speed.

There are functional changes in BSpinner, before it updated for the
first time 100ms after mouse down, and then as you moved the mouse
around the button, now it activates immediately on first click and then
every 200ms (which may be a bit short). In other places, no functional
changes intended.

Change-Id: Ie600dc68cbb87d1e237633953e5189918bf36575
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2599
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-07 22:08:23 +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
Adrien Destugues
d0e1eb7a7b mark abort() function as noreturn.
It was not specified as such before C11, but that's only because there
was no C standard way to do it until then.

Fixes #15955.

Change-Id: Ied7b7fd94988ed7724460917aebc859b74eaa585
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2558
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-03 15:42:41 +00:00
Adrien Destugues
5c2709cdd5 Firstbootprompt: remove flags from languages.
http://www.flagsarenotlanguages.com

Add some other icons to make the window a bit more spicy as suggested by
Axel.

Change-Id: I859cefc7f5cb99f9a5465902c9d471f0b9857b71
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2527
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-02 00:53:01 +00:00
Jérôme Duval
97f2b91169 smbios: add module to match SMBios vendor and product
Change-Id: Ib7848da1c22c42a1a9030891159f4e852c6c1ecd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2503
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-04-27 07:38:40 +00:00
Jérôme Duval
1baf45b64b wmi: add ACPI WMI implementation
add a WMI Asus driver, to control keyboard backlight brightness.

Change-Id: Ib86f70b4a407178b0a1f532269387a55915cc460
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2485
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-04-20 14:56:59 +00:00
Jérôme Duval
526752bc02 acpi: add ACPI_DEVICE_UID_ITEM
Change-Id: I6f1dba7d9d757859375e2339141ba92559d5cf9b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2484
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2020-04-20 14:56:59 +00:00
X512
b29db8ebbb AutoDeleter: add Get method for FileDescriptorCloser
This allows to use FileDescriptorCloser as unique pointer for file descriptor.

Change-Id: I4c768fafba6ed35658b2fdb075b9b547f53bc8da
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2495
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-04-20 14:56:16 +00:00
Adrien Destugues
5bbf7f1be0 Actually handle more than 3 mouse buttons
The code in input_server was pretty much all set for this, but there was
no way to configure the extra buttons. Add them to the mouse view in
Input preferences (up to 5 buttons are handled now)

Define a new B_MOUSE_BUTTON(n) macro to generate the bitmask for a given
button (numbered from 1).

Change-Id: I9091082277937d89b08464ff474e7bbb5db82401
Reviewed-on: https://review.haiku-os.org/c/haiku/+/180
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-04-18 18:20:37 +00:00
X512
47102c0742 Interface Kit: introduce B_TRANSPARENT_BACKGROUND flag
BeOS didn't support transparent views. As documented in the Be Book,
SetViewColor(B_TRANSPARENT_COLOR) only effect is to not fill the
invalidated areas with the view color before calling Draw() (it avoids
flickering, especially when combined with B_FULL_UPDATE_ON_RESIZE).

A previous change made B_TRANSPARENT_COLOR actually make the view
transparent (that is, additionally to the above, the underlying view is
drawn before the transparent children), but it creates compatibility
issues.

In order to keep the API compatible with BeOS, the new behavior is now
enabled explicitly using the B_TRANSPARENT_VIEW flag. This also opens
for future developments like allowing a view color with an alpha
channel (not supported yet).

Adjust programs that require transparent views.

Fixes #15744, #15745.
Helps with #15645.

Change-Id: I529574ea23db0a23579521b263bc8d572775e35a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2275
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-04-16 00:59:37 +00:00
Niels Sascha Reedijk
4b918abdb0 Package Kit: internationalize strings that may be displayed to the user
This fixes #14525.

Change-Id: I25810a4e12caed7aa47717e278591b1716b6198c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2329
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2020-04-13 09:00:10 +00:00
Jérôme Duval
01990a00e8 i2c: add acquire_bus/release_bus hooks
Change-Id: I9f55bb824f264175ae5830a2853a1897e3a00139
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2470
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-04-12 16:55:52 +00:00
John Scipione
1482b250a7 IK: Update scroll bars for alternative control look
Scroll bars should look and work identically to before on
HaikuControlLook.

Add DrawScrollBarButton() and DrawScrollBarThumb() and
DrawScrollBarBorder() methods. These methods are used to draw scroll
bars in a generic way so that they can be drawn differently by alternative
control look's (e.g. BeControlLook). Also it gives us back drawing of
scroll bar knobs.  However the knob setting is not exposed in the
interface in this commit.

These methods are in addition to the 2 existing DrawScrollBarBackground()
methods that draw the scroll bar background. One draws the area above and
below the thumb and the other is called by the first to actually draw the
area.

The rest of the drawing besides the backgrounds was being done in
BScrollBar before. To draw the scroll bar arrows and thumb we were recyling
other ControlLook methods, while this worked well enough on HaikuControlLook
it wasn't flexible enough for alternative control looks.

DrawScrollBarButton() is used to draw the four scroll buttons and is
typically (so far) used in combination with DrawArrowShape().

DrawScrollBarThumb() draws the scroll bar thumb.

DrawScrollBarBorder() draws a 1px border around the entire scroll bar,
potentially B_KEYBOARD_NAVIGATION_COLOR if focused (although this is
feature not currently used.)

Draw unscrollable scroll bars as if they were disabled including the
buttons with their arrow shapes, background, and thumb.

Add FBC backwords compatibility macros in ControlLook.cpp

Change-Id: I9237c5ce45d17d674785111d51de951e5686306b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/351
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-04-11 16:57:54 +00:00
Jérôme Duval
b9d640760e acpi: add ACPI_DEVICE_HANDLE_ITEM
type is acpi_handle, to be used with the ACPI bus manager

Change-Id: Ibbdd81a21bdd57fc651f7a7238e3676033204857
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2456
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-04-10 11:25:39 +00:00
Jérôme Duval
ec325c48dc i2c: interfaces for busses, bus_manager, peripherals.
Change-Id: I9c3e92cb1c1833eaadc73fa30fc8757c14c79292
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2455
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-04-10 11:25:39 +00:00
Jérôme Duval
8f6d605714 acpi: add walk_namespace bus and device method
Change-Id: I03fa43e0ba9b37f6db43f6ff16bbca892684cc49
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2446
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-04-10 11:25:39 +00:00
Jérôme Duval
b5dba2e4ad acpi: add ACPI_DEVICE_ADDR_ITEM and ACPI_DEVICE_CID_ITEM for device nodes
ACPI_DEVICE_HID_ITEM is now optional, instead of an empty string.

Change-Id: I352ffaaad377659f650a0b8c0d56e40a68b739c3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2420
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-04-10 11:25:39 +00:00
Jérôme Duval
08bc0cc9ca device_manager: add find_child_node
to find a node in the hierarchy.

Change-Id: Iee858f21ce134569bf25fccbef9fe18ea8787e9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2419
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-04-10 11:25:39 +00:00
Adrien Destugues
61557c8240 BListView: do not spawn a thread on every mouse click.
That's a bad idea. The drag and drop tracking could get confused enough
to crash app_server (possibly because of calling InitiateDrag multiple
times?)

Fixes #14983.
2020-04-04 11:50:07 +02:00
Jérôme Duval
c4f5ebc3df PCI: add set_powerstate and get_powerstate hooks
Change-Id: I8e32b5fccba3461cdb1b0c6e81b15705b2be1c57
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2447
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-04-02 13:31:56 +00:00
X512
bf9093e794 Efi: fix headers for 32 bit platforms
Change-Id: Id43bfcbfc24b1adb8f6e9fff587c6df9b62910f2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2413
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-03-28 20:03:37 +00:00
Jérôme Duval
bed01fe356 AreaKeeper.h: move to headers/private/kernel
Change-Id: I9ae2b9a6243809a618c0520a26e064ce3c5be2b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2410
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-03-23 16:38:01 +00:00
Jérôme Duval
e2a1fdf983 PCI: add subclasses for data acquisition
Change-Id: Ic4326300e4be0d9dccb4a1c8c50c0118318f62d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2386
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
2020-03-23 15:38:52 +00:00
Jérôme Duval
11f8b65a79 boot_loader: load intel microcode update data file
Previous version of the patch was broken by the EFI refactoring.

Change-Id: I6dd125100b22b2461c531bfd8f81b3dd28e2b751
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2409
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-03-23 15:33:34 +00:00
waddlesplash
6f857fa9fb Revert "boot_loader: load intel microcode update data file"
This reverts commit a732059324.

It broke the build on most boot platforms (including EFI.)
2020-03-23 10:09:21 -04:00
Jérôme Duval
a732059324 boot_loader: load intel microcode update data file
Change-Id: I323a57cc0b1f05ad7b60b6a141d068a3e618ee4d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2263
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-03-23 06:16:28 +00:00
X512
8152128002 Fix clang warning "mismatched-tags"
Change-Id: I00f26e27d8ac24a46b528ea7ed47b92c2967ff2e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2390
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-03-23 01:30:23 +00:00
Jérôme Duval
d8e1fd6eda virtio: add clear_feature hook.
Change-Id: I282ffc65a7bd692145626ab4272c5df4a792e9d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2383
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-03-21 17:16:45 +00:00
Jérôme Duval
56bb1bd5c9 kernel: load cpu microcode update if loaded by the bootloader
add optional fields for microcode in kernel_args.

Change-Id: Ic5fb54cf6c9f489a2d1cdda00f63980c11dcdaeb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2264
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-03-16 06:41:16 +00:00
Augustin Cavalier
5c31a5242c kernel_cpp: Dynamic exception specifications were deprecated in C++11. 2020-03-15 17:47:09 -04:00
Augustin Cavalier
74592da9a0 headers: Remove libroot_lock.h.
Not used (the one file that included it did not actually use it),
and no longer needed with the introduction of user_mutex.
2020-03-14 15:18:01 -04:00
Adrien Destugues
22ec64553f intel_extreme: some minor fixes
- Cleanup HEAD_MODE constants. These should be completely removed, now
  that we have a proper notion of pipes and displays. But the DPMS code
  still uses them, for now.
- Fix the ie_pipe command where width and height were swapped and
  missing a +1 to show the actual videomode values
2020-03-13 15:42:03 +01:00
Jérôme Duval
1b16a232eb acpi_battery: support for _BIX method.
change int types to uint32, as it's more correct.

Change-Id: Iae7043abe4c8b8a121548fe6d6a809f1bd879c8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2334
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-03-10 13:14:09 +00:00
Adrien Destugues
168aff90a7 intel_extreme: program the DPLL_SEL register on SandyBridge
We need to assign PLLs to pipes and transcoders. The assignments on
previous generations were fixed, but now it's up to us to set it up.

Do the simplest thing for now: assign PLL1 to pipe A and PLL2 to pipe B.
2020-03-08 16:01:43 +01:00
Augustin Cavalier
96d5cadcdb atomizer: Remove.
Not used by anything at all, and not included in the build.
Even the BeOS engineer who created it wrote in a Be Newsletter
that he was uncertain how useful it was, which is why BeOS
did not ship it as a kernel add-on...
2020-03-07 17:50:21 -05:00
Augustin Cavalier
1728b8c777 kernel: Rework ConditionVariableEntry destruction.
It is no longer an error to destroy a ConditionVariableEntry
that is still attached to a ConditionVariable; it will
now be implicitly detached in that case.

This makes ConditionVariableEntrys much eaiser to use
from an API standpoint.

Change-Id: I03c676d3a198aa885de733d3e1729b15f80de031
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2301
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-03-07 21:27:05 +00:00
Jérôme Duval
cffa2c68a8 PCI: update subclasses and capabilities, add usb4 programming interface
from https://pcisig.com/sites/default/files/files/PCI_Code-ID_r_1_12__v9_Jan_2020.pdf

Change-Id: I0a9ec565c742f4ee230759be0834aff5b7ffcb97
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2307
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-03-03 19:12:39 +00:00
John Scipione
2e08685b99 BMenu: Rename FrameMoved and FrameResized variable names
No functional change. lowercase_with_underscore file names are not
in-line with Haiku's style guidelines.

Change-Id: I254c975ee60168963ca4039a61dc428c05e0e6ba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2306
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-03-03 10:56:05 +00:00
Augustin Cavalier
dda8e77b8e headers: Move B_KERNEL_{EXECUTE,STACK}_AREA into KernelExport.h.
There is no good reason to put them in a private header.
No functional change (but drivers now have access
to these constants.)

Change-Id: I7ac00a120ab44fbc110bc858dfd87d69d0061135
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2294
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
2020-03-01 21:12:49 +00:00
Augustin Cavalier
171057c06a clipping.h: Rewrite copyright header to use the "new" style.
Also trim trailing spaces.

Change-Id: I598dfa2c69f584eaa004211339c73a26dd93af93
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2296
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-03-01 18:20:56 +00:00
Jérôme Duval
84195a491f kernel/x86: add a compiler level memory barrier to wbinvd
Change-Id: Id96e37b83110f413a2b30f2967921ce90f31dd94
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2272
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-02-25 04:43:41 +00:00
Alexander von Gluck IV
71680f7b7d efi: Cleanup arch_mmu, drop extra arch_timer.h
Change-Id: I0d6d2f8db2bc86c08d5ba2648f1cf46d85b54a5e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2267
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2020-02-22 22:15:08 +00:00
Alexander von Gluck IV
d2986cb6d0 system/boot: More cleanup and shuffling
* arm efi additions
* cleanup some cpu headers which were oddly
  split between efi and bios_ia32
* Move calculate_cpu_conversion_factor over to
  arch_timer since it is timerish, and x86 only
* Drop some duplicated code from efi start. Move
  hpet init code into efi timer/hpet code

Change-Id: Ia4264a5690ba8c09417b06788febc4f572f111ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2259
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-02-22 14:37:45 +00:00
Alexander von Gluck IV
04f1baa771 EFI: Make our haiku_loader architecture agnostic
* This is the bulk of the work. Anything else should be
  minor cleanups and tweaking.
* riscv64 isn't a viable EFI platform yet.. just acting
  as a stand-in to test a non-x86 EFI haiku_loader

Change-Id: Ib03de81e2b562e693987b86d7b4318209fb1c792
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2256
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-02-21 14:29:22 +00:00
Jérôme Duval
073e295aa6 kernel/x86: stores cpu number in TSC_AUX if rdtscp is available
On modern x86, one can use __rdtscp to get the current cpu in userland.

Change-Id: I1767e379606230a75e4622637c7a5aed9cdf9ab0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2248
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-02-17 17:26:39 +00:00
Jérôme Duval
9c9a810c41 Media Kit: BBufferCache: if not reclaimed, only mark the buffer for deletion
hrev53379 clears the buffer cache for disconnected clients, and also delete buffers.
This is too early (see #15263, media_addon_server crash), and should only happen
after the buffer is recycled. This can be resolved by abusing the fFlags field of
BBuffer to mark the buffer for deletion, and mark the buffer to be reclaimed.
Some BBuffers don't reside in the SharedBufferList, so we have to mark them as to
be reclaimed. For those in the SharedBufferList, call a new RemoveBuffer(), which
can check whether the buffer is still to be reclaimed. For reclaimed BBuffers,
delete them right away, others can be marked for deletion.
fixes #15606 #15263, possibly #15433

Change-Id: I66e94138e7e10a40d4c48e2ac042f816c79f5aab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2245
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Ryan Leavengood <leavengood@gmail.com>
2020-02-16 08:38:49 +00:00
Jérôme Duval
1a836b9e04 kernel: x86: add some more cpuid flags.
Change-Id: If81c8e38c4e5a8347b5818440a7516298be585bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2242
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-02-14 14:25:43 +00:00
Alexander von Gluck IV
d38ba84d44 efi: Add quirks for some unicorn Apple EFI protocols
* grub and linux do the same thing.
* Based on MIT code here:
  https://github.com/0xbb/apple_set_os.efi/blob/master/apple_set_os.c

Change-Id: I299b3721197c5cdd4406d313d8769d4923f7edb4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2239
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-02-12 14:30:58 +00:00
Fredrik Holmqvist
0d932a49ad Revert "loader: fetch all potential boot partitions for boot device."
This reverts commit e888217124.

Change-Id: I06be82ac863f615796d9edc86f5ef903b8123a9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2231
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-02-08 17:38:38 +00:00
Adrien Destugues
a206dcc221 usb hid: implement horizontal scrollwheel
- Fix USB_hid_page_consumer.h: some values are skipped in the spec so
  our defines were off
- Handle the horizontal wheel on my mouse which is declared as a
  CON_AC_PAN, but otherwise works just like the vertical wheel
- Input server and interface kit already handle the events properly
  (they were available for serial mice already).

Change-Id: Ie0080ebb27e9478bcfe9f9dc5fd2a936ae05a848
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2201
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-02-06 00:10:10 +00:00
Ryan Leavengood
e10de1ecf5 Visually align shortcuts in menus
In a menu, we use the right side both for submenu arrows and shortcuts.
As a result, when an entry has both a shortcut and a submenu, its
shortcut is not aligned with others, and this does not look so nice.

The spacing for the arrow appears only if there is a submenu in any of
the items in the parent menu.

Change-Id: If91fdcdad36abb0141fb05d1f59141f89540c1db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/355
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Ryan Leavengood <leavengood@gmail.com>
2020-02-04 23:06:54 +00:00
X512
958d3f4375 BeBuild: set default visibility for _EXPORT
This is required for building shared libraries with hidden by default symbol
visiblility such as mesa.

Change-Id: I7150629aaea61d7c9b6e641d32913c5cc7c96543
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2159
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-30 00:32:32 +00:00
Alexander von Gluck IV
e53e22439c efi/types: Only set ms_abi on x86
* Upstreamed to Fuchsia via:
  https://fuchsia-review.googlesource.com/c/fuchsia/+/358320

Change-Id: I3232cc1a5bf6194d5f2fa82f13668ca089faca92
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2174
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-01-30 00:21:54 +00:00
Alexander von Gluck IV
15fb7d88e9 riscv64: Add missing (slightly modified) fenv.h from FreeBSD
* A few tips for future folks follows.
* fenv.h gets wrapped in our buildtools
* If anything in the arch fenv.h "doesn't work" buildtools
  will silently fail early on (autotools HAVE_FENV_H)

Change-Id: Icae064fde42af3bbed5ea2eadfaa8c18c677e6a6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2164
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-28 11:48:42 +00:00
Adrien Destugues
ec4e9ea8bc intel_extreme: remove unhandled generation defines
- 7xx (1st gen) has no driver in Haiku or is handled by the intel_810 driver
- PowerVR has no driver in Haiku

So there is no point in having those in the intel_extreme driver.

While I'm at it, fix the video timing/resolution constraints for
sanitize_video_mode.
2020-01-27 13:58:52 +01:00
Adrien Destugues
670af4fc7b More build fixes. 2020-01-25 21:35:34 +01:00
Adrien Destugues
696d127d12 Live update of Input preferences device list
- Implement watch_input_devices in input_server, as it was TODO. For
  now, only one watcher is allowed at a time.
- Use it in Input preferences to get notified about added and removed
  devices and update the device list accordingly.

Change-Id: I52018af53738e68271d6d63b5bea31fd7cab1b3b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2041
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-25 11:58:48 +00:00
Adrien Destugues
c5e9dd9b68 Fix btrfs_shell build
The hacks to still use actual system headers for zlib didn't quite work.

- Define Z_SOLO, which makes zlib build without any system include
- Remove use of std::max and #include <algorithm> from AVLTree
- Do not include DebugSupport.h because it uses system headers
- Do not include uuid.h and define just what we need

Now it's possible to compile the btrfs_shell on Linux.

Change-Id: I74a14b5f6804db45ab5a9f582ab493d696376fd3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2098
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-25 11:58:15 +00:00
Andrej Antunovikj
7b4d924f98 cpu: Extract shared x86 code from efi & bios_ia32
This issue was initially detected by PVS Studio (issue number V547) and fixed
as part of Google Code-in 2019.

The initial problem was the calculate_cpu_conversion_factor function
which had been copied in the BIOS and EFI versions of the boot code.
Further investigation led to more duplicated or very similar functions
being identified.

Introduce an arch_cpu.h for the x86 boot platform to group these things
in a single place, and adjust the BIOS and EFI code to call into that.
Note that the BIOS and EFI code is still a little platform specific,
ideally there should be a boot_arch_cpu_init() function for each
architecture as already done for openfirmware and u-boot.

Also remove some irrelevant comments from copypasted files for other
architectures, as that was filling my git grep with useless noise.

Change-Id: I16d815f0bf015cec0b4e03cc14f3cc447c7164c5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1985
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-25 11:56:46 +00:00
Zotyamester
edad811b96 Game Kit: rewrite GameSound and GameSoundDefs headers
Change-Id: I5efee795a73a9637f34ed8ffa4fbeeda09eb7a88
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2104
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-25 11:43:02 +00:00
Ra-V2
e9d6c3150e Game Kit: rewrite StreamingGameSound.h
Change-Id: Ibd5d77236dc14ca605b0925c1177e64ca9e5a5d3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2113
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-25 11:42:41 +00:00
Adrien Destugues
eacbae702d agg: fix build. 2020-01-22 19:25:16 +01:00
Panagiotis Vasilopoulos
f0b6c6a24b Game Kit: rewrite DirectWindow, FileGameSound and SimpleGameSound headers
Change-Id: I45687f8164dbc915a0cb6ca1bf4c0211761cb098
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2108
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-01-22 00:33:44 +00:00
Ra-V2
1773f0767e agg: agg_curves.h: initialize m_distance_tolerance_square
fix PVS 730

Change-Id: I8dfe11d3f31cc6ef67b96955009c5a57eb5a427d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1997
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-01-22 00:29:58 +00:00
Adrien Destugues
2de6164042 Add missing fenv.h for sparc.
Borrowed from FreeBSD with some changes to get it building.
Now we need to rebuild the gcc package...

Change-Id: I6b8dfd7fb6ca912c76e2ff10fbe01ad583a09aec
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2131
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-22 00:25:19 +00:00
Adrien Destugues
1808b553a2 intel_extreme: do not reprogram transcoded/output mapping on ibex point
Another try to fix #15628
2020-01-19 11:04:31 +01:00
PulkoMandy
56f9c76088 sparc: boot mmu support
Get enough of the mmu working to be able to allocate memory.

Unlike on PowerPC, we get both address and size as 64bit values. So
adjust of_region to allow this.

Also unlike the PPC port, we do not drive the hardware directly, instead we
rely on the openboot primitives to manage the translation table. This
allows staying independant of the hardware, which is a good idea at
least for the bootloader (we can do actual hardware things in the
kernel)

Change-Id: Ifa57619d3a09b8f707e1f8640d8b4f71bb717e2a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1482
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2020-01-18 03:32:29 +00:00
PulkoMandy
959588394d openfirmware: more fixes for 64bit systems.
Gets call-method working for sparc, and fix more places where we
accidentally truncate 64bit values or sign-extend 32 bit ones.

Change-Id: Ic79c55ffa8d2b475858def1639004412f17dd0c1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1986
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2020-01-18 03:29:27 +00:00
Raheem Idowu
e8faedae57 Game Kit: rewrite PushGameSound and WindowScreen headers
Part of #1576

Change-Id: Iafdc88bcf13e9c07fa148cb7980b54f5ee98be50
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2086
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-01-11 02:26:06 +00:00
Augustin Cavalier
dda1013cdb posix/math: Use the GCC built-ins when possible for isnan(), etc.
glibc does the same. Technically, some of these builtins did
not exist / did not work before GCC 4.4, but the source tree
cannot be compiled with a version that old anyway.

x86_64 and _x86 need to keep the old functions for now, of
course; but all other architectures can probably feel free
to drop the s_isnan, etc. functions from their glibc.

This will make upcoming patches easier...

Change-Id: Ifb76ea74076553228c9741a8ee3ecb0e1cf736a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2076
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-01-06 07:44:30 +00:00
Adrien Destugues
2beddbfd46 intel_extreme: fix pipe and plane size registers
- The name for the registers were swapped
- The width and height were also swapped in one of them
- Remove some old #if 0 code that touched these registers but has been
  disabled for a while.
2020-01-05 10:11:37 +01:00
Adrien Destugues
abcbfac601 intel_extreme: use the panel fitter for generation 4 devices
LVDS panels must really be driven at their native resolution, otherwise
they will simply not work. This means we should basically never touch
the video timings on that side. We need to only set the source size in
the pipe configuration, and let the panel fitter figure out the scaling.

On my G45 laptop, this allows me to use non-native resolutions on the
laptop display. This also means when booting with a VGA display
connected, I do get a valid display on the internal panel (using the VGA
resolution). VGA still gets "out of range", so we're still not setting
up something there.

If I switch to VGA display in the BIOS, I get a working picture there
and garbage on the internal display, which is progress (before I would
get a black screen on the internal display)

Fixes #12723.
2020-01-05 10:11:37 +01:00
Augustin Cavalier
d2f7af0edc Revert "deprecate gets and tmpnam"
This reverts commit 92e9211d7b.

It broke the build, and apparently cannot be fixed until GCC
has been patched.
2020-01-04 15:26:08 -05:00
Adrien Destugues
92e9211d7b deprecate gets and tmpnam
For #15515

As mentionned in the ticket, we may also want to hide the symbols
altogether from libroot for newer API/ABI versions, unless we still want
to provide C89/C99/C++98/C++11 compatibility, in which case we still
need them around.

Change-Id: I0ee267fb6c4c2f4bae9b1ba6f68e2bcefc399a7f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2061
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-01-03 03:35:04 +00:00
Alexander von Gluck IV
485b5cf8bc efi: Refactor our EFI code to use fuchsia's cleaner EFI headers.
* Drop gnu-efi

Change-Id: Ib601fc8ced49b18281b6b98cf861a5aef1b9c065
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2026
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-22 10:59:34 +00:00
Jérôme Duval
feeb4b5d93 RosterPrivate: add IsShutDownInProgress()
enable to check whether a shutdown process is in progress.

Change-Id: I8efdddb3caa80e9fd188f202b6e92a888a7608e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2042
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-12-21 20:32:31 +00:00
Kacper Kasper
c67dde0f2c app_server: Add tiled bitmap drawing routines
Change-Id: I9a7bd967f2cc95d815a66707b764cf5e33b3f8ed
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1962
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-09 12:22:28 +00:00
Adrien Destugues
69f814cded BFileGameSound: allow initializing from a BDataIO
There is no reason to not allow this, and it makes it possible to load
data from eg. a BResource instead of a file, which is very useful.

Remove some unused members in the class and dead code, and fix style
issues.

Change-Id: I94cbd0c13c469ea80f55028cf33dfde2de4365ef
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2001
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-12-09 12:00:17 +00:00
Adrien Destugues
af3d90a597 Attempt to fix gcc8 build. 2019-12-05 20:14:08 +01:00
Adrien Destugues
b819569ef4 usb_video.h: build fixes
- Remove duplicate and otherwise unused lendian_bitfield.h
- Adjust listusb jamfile to use lendian_bitfield.h
- Fix various typos in usb_video.h and restore some fields to make
  listusb happy
2019-12-05 18:28:12 +01:00
brjhaiku
f57d609e9b USB_Video.h: add more definitions from the spec.
fixes #5940

Change-Id: Idb9ae8dfdaa9f0fab43be3767bf97e1c87245940
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1022
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-05 10:55:29 +00:00
Ynoga
09b40d1634 ppc: Minor tweaks to get the arch compile again (WIP)
- Factor in types changes (introduction of intptr_t)
- Align JamFiles syntax with in progress architectures (arm/sparc)
- Xorriso doesn't support much of the mkisofs options (anymore ?)
- (After a correct bootstrap) one should be able to build @minimum-raw and haiku-boot-cd again
Change-Id: I4f779ad8f2210389fa9b7f7c0a98c3652a64c257
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1983
Reviewed-by: François Revol <revol@free.fr>
2019-12-04 18:34:31 +00:00
Adrien Destugues
edc5a2174e BGeolocation: add position to country mapping
Using the geonames.org API, so we will need an API key for it (similar
to the one used for MLS, deployed by the buildbot)

The unit tests uses the "demo" user, which is restricted to 20000 API
call credits and often expired. But we cannot use our secret key here as
it would need to be available to anyone running the test. If we ever get
to automate running the tests on a buildserver we could probably make it
use the secret username known by our buildbot instead.

Change-Id: Ia16880db82555ce85505ad28e1c623f692f46be0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1873
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2019-12-03 08:01:14 +00:00
Adrien Destugues
70cdd7d4f5 BCountry: add SetTo and InitCheck.
Change-Id: I5fbc2a1c0e735d6edeb23672017bb64d1b3f4390
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1872
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-02 12:32:15 +00:00
Alexander von Gluck IV
b482adb1bc kernel/boot/efi: Continue breaking apart arch-specific code; hpet
* Move x86 hpet behind timer interface.
  * Add a few if x86,x86_64 macros to start.cpp.

Change-Id: I583ec1b064785182e6d48dfbcd91b1bb2ead4b44
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1929
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2019-11-26 21:34:43 +00:00
Augustin Cavalier
cb29eafe25 headers/build: Replace StackOrHeapArray with a reference to the main one.
The files were identical. No functional change.
2019-11-23 12:57:03 -05:00
John Scipione
fb3493dfef BControlLook: Move tab frame drawing into DrawTabFrame()
The tab frame is drawn behind the tabs.

Create a new DrawTabFrame method in BControlLook and HaikuControlLook
that draws the tab frame background.

Until now we've been reusing the DrawInactiveTab method to draw the tab frame
in BTabView. While this works on HaikuControlLook, it doesn't work on other
ControlLook's (such as BeControlLook) that draw their tab frame differently.

Add FBC method to preserve binary compatibility on gcc2 and gcc4.

Move DrawTabFrame method to where _ReservedControlLook1 was in header.

Set rect to area of tab frame in TabView instead of doing the
calculation in HaikuControlLook so that others may benefit.

Change-Id: I513e238914f6d680f495659b6ec902df15555015
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1936
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-22 23:24:05 +00:00
Jaroslaw Pelczar
016cc66803 Remove arch_get_caller
Use the gcc builtin instead, which generates more efficient code (it
saves a function call) and means less platform specific code to write
for us.

Change-Id: I1d55b5703027b2ea4ecde2438ea306bd4850eb32
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1859
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-10-19 17:03:05 +00:00
brjhaiku
7868a011b8 fixed btrfs_shell
Change-Id: I792661b62d896f105690500403650b174a649de6
2019-10-08 18:57:27 +02:00
Jérôme Duval
bc6dc61fb9 USB_hid: VR Controls definitions. 2019-10-08 16:56:51 +02:00
Jérôme Duval
c84296d0ad USB_hid: fix include guard. 2019-10-07 21:58:17 +02:00
Alexander von Gluck IV
7c32619c7f boot/platform: Break x86 code away from core EFI code
Change-Id: I88afad6d071e8b577c23da9c60392c60b3726514
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1895
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-10-03 14:05:49 +00:00
Niels Sascha Reedijk
88dc9ee1b1 Remove MultiChannelControl.h
This class is not implemented in our code. It is not documented in the BeBook.

Change-Id: Id3a48dbd2039005f69998567dcc26548612f3e9f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1876
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-09-20 23:59:30 +00:00
Kacper Kasper
827f75a766 Add missing include in bsd/sys/link_elf.h
* Doesn't build without it.

Change-Id: Ia8671f1545fee6684278e688d0a16a1147e78842
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1866
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-09-18 03:40:47 +00:00
Augustin Cavalier
cf344027f8 kernel: Add padding in mutex fields for equivalent KDEBUG/non-KDEBUG sizing.
Non-KDEBUG kernels and kernel add-ons use atomic operations to acquire
and release the locks inline, so non-KDEBUG kernels/addons are only
compatible with other non-KDEBUG kernels/addons.

Following this change, though, KDEBUG kernels/addons should be able
to run under non-KDEBUG kernels/addons, too, since they always call
into the actual kernel functions and do not inline anything of
consequence.
2019-09-13 22:02:52 -04:00
Jaroslaw Pelczar
b3a12553f8 arm64: Implement IRQ masking for kernel
Signed-off-by: Jaroslaw Pelczar <jarek@jpelczar.com>
Change-Id: I05e41f8cd28834e4bcc9f02b4694a640f460cd17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1856
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-09-13 23:07:02 +00:00
Jérôme Duval
be06cb25e9 libroot: make API version available.
Change-Id: I370d5c8e9b4f076e7f115ca6c87bc7f943d36c17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1850
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-09-13 13:38:08 +00:00
Jérôme Duval
af0281a8c2 POSIX: add a few constants for sysconf.
Change-Id: I400efdbccc97b287844917e21d8e08e26029f2f8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1839
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-09-07 15:04:14 +00:00
Michael Lotz
9a2911ca8c virtio: Rework queue_dequeue to return a boolean.
It previously returned the cookie directly, which made it impossible
to distinguish between a NULL cookie and the function not having
anything to dequeue. This lead to some code setting a cookie that was
not actually used.

Return the dequeue status as a boolean and provide the cookie with an
optionally handed in pointer instead and adjust all users.

Change-Id: Iaac1726ac4bc7ae42bb96b8f0915852b6def5822
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1814
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-09-02 14:30:29 +00:00
Jaroslaw Pelczar
1761cb8e6f arm64: Add more headers for code compilation
This makes ARM64 target compile more files. This patch is one of
series of patches to support new architecture, as fixes in many
places are required just to compile the code.

Signed-off-by: Jaroslaw Pelczar <jarek@jpelczar.com>
Change-Id: Ia060612733cd3a0fcb781fec449da164ed635b8e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1807
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-09-01 03:02:49 +00:00
Jaroslaw Pelczar
ef21ae46d9 arm64: Update license in headers
Signed-off-by: Jaroslaw Pelczar <jarek@jpelczar.com>
Change-Id: I545722b4f499addf7be557d85ee90f9847f3bcd7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1804
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-09-01 03:02:49 +00:00
Augustin Cavalier
a9be0efb2e kernel/fs: Add support for setting custom VMCaches in vnodes.
This adds one (private) VFS function, and checks in all usages of
the vnode->cache as a VMVnodeCache that it really is one. (Generic
usages, for the moment just the ReleaseRef() calls in vnode
destruction, are intentionally not touched.)

This will be used by ramfs to set the cache from its own,
so that map_file() calls on a ramfs can work.
2019-08-31 20:38:18 -04:00
Augustin Cavalier
731be7dde1 Relicense all of Ingo's BSD/MIT+advertising clause'd code as plain MIT.
Via email:
> I'm fine with re-licensing all code using BSD license + advertising
> clause to MIT license.
2019-08-30 18:27:35 -04:00
Augustin Cavalier
47a21c5c89 s/Haiku License/MIT License/g.
They are the same thing.
2019-08-30 18:16:02 -04:00
Augustin Cavalier
12eb0e5d89 libroot: Add a private __look_up_in_path function.
Refactored out of execvpe. Originally I did this for my attempted
change to posix_spawn, but that change turned out to be wrong and
actually not that beneficial. This bit seems potentially useful,
though, so here it is.
2019-08-30 16:24:09 -04:00
Jaroslaw Pelczar
1f52c921e2 ARM64: Initial changes so we can compile GCC toolchain
Signed-off-by: Jaroslaw Pelczar <jarek@jpelczar.com>
Change-Id: I0859d0619d601efd003472e2846d2f980ee2e457
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1799
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-08-30 19:05:16 +00:00
Adrien Destugues
03d334bbdf build fixes.
sys/types.h cannot incliude endian.h because that creates circular
include dependencies.

Add proper multiarch grist to libcolumnlistview.
2019-08-27 20:51:51 +02:00
Adrien Destugues
261430c5ae Clarify endianness defines. 2019-08-27 17:44:57 +02:00
Augustin Cavalier
26e0b0c8d6 kernel/x86_64: Add errata patching.
The patched errata are only the AMD ones FreeBSD patches
(it seems there are no Intel errata that can be patched
this way, they are all in microcode updates ... or can't
be patched in the CPU at all.)

This also seems to be roughly the point in the boot that
FreeBSD patches these, too, despite how "critical" some
of them seem.

Change-Id: I9065f8d025332418a21c2cdf39afd7d29405edcc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1740
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2019-08-27 10:03:39 +00:00
Jessica Hamilton
d7818b5aae sys/types: include endian.h, and fix endian definitions.
* Defining LITTLE/BIG_ENDIAN as 0 breaks some feature test macros,
  particularly in autoconf. Checking with FreeBSD, their macros
  define a non-zero value as well.

References:
- https://github.com/freebsd/freebsd/blob/master/sys/x86/include/endian.h
- http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/c.m4#n1584
Change-Id: I61b0bbad74e2bf5248464a5c15e504b9f45bea7f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1526
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-08-27 10:02:45 +00:00
Simon South
b9d9c282fd input_server: Notify apps of new key map
Define a new message, B_KEY_MAP_LOADED, that is broadcast to applications by
the Input Server each time a key map is loaded. This allows apps that cache
key-map data to know when their copy has become stale.

Change InputServer::HandleGetSetKeyMap() so it returns an error in the event
loading even the system (fallback) key map fails.

Change-Id: Icc6c884f695ca59c687d83c680bb2fb467dd90cc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1741
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-08-27 06:49:37 +00:00
Augustin Cavalier
8a0c9d52c6 OS: Rename B_USER_CLONEABLE_AREA to B_CLONEABLE_AREA.
It now lives in OS.h. The idea is that this will now be
accessible to userland applications, so userland memory
is protected from access by other processes, just as
kernel memory is.

No functional change (the constants are still the same,
though I've changed some to use shifts to make clear
which bits are allocated are which are unused.)
2019-08-10 15:51:41 -04:00
PulkoMandy
d5cd4a9d51 openfirmware: adjust for 64bit
Sparcv9 runs Openboot in 64 bit mode, which means the cell size is
64bit. Use intptr_t where appropriate to make the open firmware calls
work.

Beware, some values are still 32bit, this matters for example for
of_getprop, if you get 32bits into a 64bit variables it will be in the
MSB of it (big endian only weakness...) and confuse things. See for
example in console.cpp, where the input and output handles are retrieved
as 32bit values. It seems wise to check the expected size when using
of_getprop in these cases, instead of just checking for errors.

Change-Id: Ie72ebc4afe7c6d7602a47478f0bfb6b8247004b8
Reviewed-on: https://review.haiku-os.org/c/1369
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-08-10 17:59:04 +00:00
Ryan Leavengood
b711002d34 HaikuDepot: Set package state when loading single package
Without this, even installed packages still get an "Install" button.

Fixes #14821.

This was implemented by adding BPackageRoster::IsPackageActive. I decided to
have this take a location since GetActivePackages also did, but as noted in my
TODO comment, I think this is awkward.

It would also be nice to show the user they have a different version of a
particular package, but that would require some changes to IsPackageActive.

Change-Id: Iab0d35eb6b671a17711b0214b15164d296927e5a
Reviewed-on: https://review.haiku-os.org/c/1694
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-08-08 07:09:35 +00:00
Augustin Cavalier
2c588b031f kernel: Properly separate and handle THREAD_BLOCK_TYPE_USER.
Consider this scenario:
 * A userland thread puts its ID into some structure so that it
   can be woken up later, sets its wait_status to initiate the
   begin of the wait, and then calls _user_block_thread.
 * A second thread finishes whatever task the first thread
   intended to wait for, reads the ID almost immediately
   after it was written, and calls _user_unblock_thread.
 * _user_unblock_thread was called so soon that the first
   thread is not yet blocked on the _user_block_thread block,
   but is instead blocked on e.g. the thread's main mutex.
 * The first thread's thread_block() call returns B_OK.
   As in this example it was inside mutex_lock, it thinks
   that it now owns the mutex.
 * But it doesn't own the mutex, and so (until yesterday)
   all sorts of mayhem and then a random crash occurs, or
   (after yesterday) an assert-failure is tripped that
   the thread does not own the mutex it expected to.

The above scenario is not a hypothetical, but is in fact the
exact scenario behind the strange panics in #15211.

The solution is to only have _user_unblock_thread actually
unblock threads that were blocked by _user_block_thread,
so I've introduced a new BLOCK_TYPE to differentiate these.
While I'm at it, remove the BLOCK_TYPE_USER_BASE, which was
never used (and now never will be.) If we want to differentiate
different consumers of _user_block_thread for debugging
purposes, we should use the currently-unused "object"
argument to thread_block, instead of cluttering the
relatively-clean block type debugging code with special
types.

One final note: The race condition which was the case of
this bug does not, in fact, imply a deadlock on the part
of the rw_lock here. The wait_status is protected by the
thread's mutex, which is acquired by both _user_block_thread
and _user_unblock_thread, and so if _user_unblock_thread
succeeds faster than _user_block_thread can initiate
the block, it will just see that wait_status is already
<= 0 and return immediately.

Fixes #15211.
2019-08-05 22:31:02 -04:00
Alexander von Gluck IV
6c331fc7e1 kit/package: Error on short file read
* It's safe to assume that if the file is shorter than
  the provided header, things will go poorly.
* Avoids a random vauge ReadBuffer error.
* This doesn't fix #15230, but makes the issue clearer.

Change-Id: I3471e6de384a0c9be94049ad891c01be980f7846
Reviewed-on: https://review.haiku-os.org/c/1679
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-08-05 15:07:24 +00:00
Augustin Cavalier
37eda488be kernel/condition_variable: Granularize locking.
Before this commit, *all* ConditionVariable operations (yes, all;
even Wait, Notify, etc.) went through a single spinlock, that also
protected the sConditionVariableHash. This obviously does not scale
so well with core count, to say the least!

With this commit, we add spinlocks to each Variable and Entry.
This makes locking somewhat more complicated (and nuanced; see
inline comment), but the trade-off seems completely worth it:

(compile HaikuDepot in VMware, 2 cores)
before
real 1m20.219s
user 1m5.619s
sys  0m40.724s

after
real 1m12.667s
user 0m57.684s
sys  0m37.251s

The more cores there are, the more of an optimization this will
likely prove to be. But 10%-across-the-board is not bad to say
the least.

Change-Id: I1e40a997fff58a79e987d7cdcafa8f7358e1115a
2019-08-03 11:24:34 -04: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
Adrien Destugues
103741882a PVS V542: operator precedence issue accross macro expansion
In CodyCam, we attempt to cast the result of this macro to const char*.
However, the ternary operator has lower priority than the cast so it
doesn't work as expected.

Add some protective parentheses here.

Change-Id: I5e9875187cec67b9534b1bbe58d82217c6cd5524
Reviewed-on: https://review.haiku-os.org/c/1667
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-31 02:13:01 +00:00
Adrien Destugues
4950607607 Add a features.h to auto enable _DEFAULT_SOURCE
Unless __STRICT_ANSI__ is defined (as it is when running the compiler in
--std=c89 or --std=c99, but not when running it without any specific
args), we can enable these by default and behave like most other
systems. I don't know why no one has done this yet despite suggesting it
multiple times and people prefer to #define _BSD_SOURCE manually
everywhere.

Remove all places in our Jamfiles and sources where it had been defined.
_DEFAULT_SOURCE is now enabled by default for all sources of Haiku, since we
let the compiler use GNU extensions (no strict C standard specified on
command line)

Use _DEFAULT_SOURCE as the define name to match current versions of
glibc. Enable it if _BSD_SOURCE is #defined in compiler flags, for
backward compatibility.

Change-Id: I6db04da5f6db437723cdfba3478f5094a69d7727
Reviewed-on: https://review.haiku-os.org/c/1633
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-07-29 20:26:46 +00:00
Adrien Destugues
b0890e034b PVS V501: comparing number with itself
I assume the intent was the same as in other similar functions above.

Change-Id: I887cd73d846680a5a5ec5c90f678ad4b12122eb3
Reviewed-on: https://review.haiku-os.org/c/1655
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-07-28 10:16:43 +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
Augustin Cavalier
3c2901a976 libroot: Expose the internal mutex_lock for private consumption. 2019-07-27 18:32:18 -04:00
Zoltán Mizsei
3ddf0bbc29 BSD: Use elf.h from os/kernel
Platform-dependant defines for Elf_*

Change-Id: Ib86554eb497d20e60ad7c75de4321d5b516ad88c
Reviewed-on: https://review.haiku-os.org/c/1635
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-27 15:19:31 +00:00
Adrien Destugues
58db38ed74 bsd/sys/param.h: add NBBY define
This defines the number of bits in a byte and is used in tnftpd.
Once this is merged, some patches to tnftpd can be removed.

Change-Id: Ie2d0c61ce1371daeeb8549281f4210147fb77197
Reviewed-on: https://review.haiku-os.org/c/1642
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-22 23:43:04 +00:00
Murai Takashi
319c399d61 PVS V739: EOF compared with a value of the char type.
Change-Id: Icfaff590359381fbdd3bbd7993dab92111da3ed1
Reviewed-on: https://review.haiku-os.org/c/1618
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-21 15:47:48 +00:00
Adrien Destugues
194c483884 Move SettingsHandler to libshared
It's used by both Tracker and Codycam and others might find it useful.

Change-Id: I585d3a1bdc7f8fce7d36bedf6867464cd541ba2e
Reviewed-on: https://review.haiku-os.org/c/1637
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-21 15:47:48 +00:00
Calvin Buckley
f093894af1 Fix Zen-based (family 0x8f) CPU naming
Previously, it identified all Zen CPUs as Ryzen 7. Since the model
and stepping information consist of microarchitecture information
and don't carry the model number, use the parse_amd based name,
which will remove any unnecessary details from the returned name.

Fixes #15153.

Change-Id: I1a20bf35a60b2fdd20d4cc90ec2dd95fd0e6439d
Reviewed-on: https://review.haiku-os.org/c/1634
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-20 16:07:58 +00:00
CodeforEvolution
e1a822a95f Conform putenv to POSIX standards
Discovered this while working on VLC, checked with other online sources too.

Change-Id: I114c20babda0ff0e90d0eeee299d8483700166bd
Reviewed-on: https://review.haiku-os.org/c/1628
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-20 16:02:00 +00:00
Augustin Cavalier
1f39d6dd11 arch_user_debugger: Restore the use of size_t for dr7.
The prior change broke the build with some cryptic "invalid
instruction mov" messages. So it must have been correct before.
2019-07-18 20:36:13 -04:00
Zoltán Mizsei
c6fd6cbba4 Import link.h and link_elf.h from FreeBSD master
Add _D_BSD_SOURCE guarding
Change-Id: I6eefe207b5e7e645cd3aec3b1981aae59793fa98
Reviewed-on: https://review.haiku-os.org/c/1620
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-17 22:17:49 +00:00
Adrien Destugues
a216132469 PVS V784: fix size of DR7 register
Even on 64bit CPUs it's a 32bit register.

Change-Id: I9a4de6eec225de19a90d70fae1382b662e530629
Reviewed-on: https://review.haiku-os.org/c/1625
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-17 22:17:22 +00:00
Adrien Destugues
22817d221a PVS V591: non void functions must return something
Change-Id: I1f4276bc32afab75cf857c143d2bdb4fc3b578b1
Reviewed-on: https://review.haiku-os.org/c/1612
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-17 01:57:50 +00:00
Adrien Destugues
12d046d024 PVS V547: always false conditions
Change-Id: I389c081331b1c5ef67bef9ffcac9055573e1ebf5
Reviewed-on: https://review.haiku-os.org/c/1605
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-17 01:48:25 +00:00
Adrien Destugues
fcf7cbe79e PVS V522: null pointer dereferences
Change-Id: Iaa753ef3a93c36031789a85f87e569fc410d3304
Reviewed-on: https://review.haiku-os.org/c/1604
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:44:32 +00:00
Kacper Kasper
17c9e98743 TextView: add shortcuts for wordwise delete
Change-Id: Ie67f6255c3f5d9d8ccc6699ed42dd71ae593fa16
Reviewed-on: https://review.haiku-os.org/c/1573
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-14 14:14:39 +00:00
Augustin Cavalier
39665db167 kernel/vm: Inline the VMArea::name string.
B_OS_NAME_LENGTH is 32, char* is 8 (on x64), and this structure
has quite a lot of pointers in it so it is not like we really
needed to save those 24 bytes. Hitting malloc() in here is not
so great, especially because we usually have B_DONT_LOCK_KERNEL_SPACE
turned on, so just inline and avoid it.

Change-Id: I5c94955324cfda08972895826b61748c3b69096a
2019-07-13 13:42:49 -04:00
Adrien Destugues
727e49c611 Media Kit: remove MediaExtractor::Source
The idea was that the Media Extractor could wrap the original source
given by BMediaTrack, but all operations on the data go through
MediaExtractor anyway.
We could probably move ownership of the BDataIO completely into
MediaExtractor instead.

Change-Id: I846b34b543fb983e60f6adf86cb17e835303267b
Reviewed-on: https://review.haiku-os.org/c/1587
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00:00
Adrien Destugues
076b19023f elf2aout: import from FreeBSD
The sparc openboot implementation can run executables in the a.out
format. We used to generate these using objcopy, but this does not work
anymore as binutils is deprecating a.out format support.

- Import elf2aout from FreeBSD
- Add some missing bits to our elf.h and have a copy of it in the build
  headers so it can be used to build elf2aout for the host platform
  (tested for Linux)
- Use it to generate the sparc haiku_loader
- Adjust the bootloader linker script to have two "program headers": one
  that is not loadable and contains the ELF headers, and the second one
  that is loadable and contains the actual code and data. Unlike
  objcopy, elf2aout relies only on the program headers to know what to
  put in its output file (sections are ignored), so this is required
  otherwise we end up with the ELF header nested inside the a.out file,
  and everything offset from the expected load address as a result.

Confirmed that this allows to build the loader and run it as far as
before, so I'm back to needing to implement some MMU support now.

FreeBSD commit: 7551d83c353e040b32c6ac205e577dbc5f2c8955

Change-Id: I90b48e578fa7f148aeddd8c5998fdddc5cfa73fa
Reviewed-on: https://review.haiku-os.org/c/1557
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-13 01:29:05 +00:00
Augustin Cavalier
394fba6684 unistd.h: POSIX_THREAD_ATTR_STACKADDR was implemented back in March. 2019-07-11 23:05:27 -04:00
Augustin Cavalier
42e3c6f978 KPath: Use an object_cache for the path buffers in the normal case.
This was (following the packagefs changes) the number-one (by call
count) consumer of malloc() during the boot -- 52866 calls, and 100%
of them either 1024 or 1025 bytes!

Virtually all of these are ephemeral (indeed, the object_cache
stats after a boot with this patch shows there is only a single slab
of 64 buffers allocated, and most of them unused), so this is
probably a significant performance boost.

Change-Id: I659f5707510cbfeafa735d35eea7b92732ead666
2019-07-11 22:52:10 -04:00