Commit Graph

8280 Commits

Author SHA1 Message Date
Michael Lotz
3b7b927dd0 libbnetapi: Add BNetworkRoute to replace use of route_entry.
The BNetworkRoute class manages a route_entry and the sockaddr's
associated with it. It replaces the direct use of route_entry in the
BNetworkInterface API.

Using route_entry is fragile and inconvenient as it only holds pointers
to the sockaddr's. When getting a list of routes from the kernel, each
route_entry is set up so that its pointers point into the single flat
buffer that is passed around. Creating a copy of the route_entry and
then deleting the flat buffer makes the pointers in the copy stale.
Returning these route entries therefore always lead to a use-after-free
when they were eventually used.

BNetworkRoute also takes over the code and functionallity of getting
routes from RouteSupport. The corresponding method in BNetworkRoster is
replaced by a static method in BNetworkRoute.

Also distinguish between the default route and gateway of an interface.
GetDefaultRoute() now gets the default BNetworkRoute for the interface
while GetDefaultGateway() gets the associated gateway address within
that default route. Adjust network preferences panel to this change.

Note that we currently only seem to have per interface default routes
and not an actual global default route. This was already the case before
these changes and I did not further investigate what this means.
2015-04-12 18:50:00 +02:00
Alexander von Gluck IV
9c5e234cb3 arm: Initial Cubieboard4 work
* SD cards are "blessed" with a boot0 spl and boot1 u-boot
  at fixed locations.
* Allwinner's u-boot is lacking a lot.
* Upstream u-boot should be better at some point. WIP:
  http://lists.denx.de/pipermail/u-boot/2015-January/201537.html
2015-04-11 16:53:04 -05:00
Michael Lotz
8f9d4cad45 syscalls: Remove get_stack_trace syscall again.
This reverts the other half of b959d46dbd.
2015-04-11 23:37:55 +02:00
Michael Lotz
c012e7e930 libroot: Add private __arch_get_stack_trace().
It can be used to get a stack trace of the current thread. Note that
this works by walking frame pointers and will not produce anything
useful if an application is compiled with the frame pointers omitted.

The stack base and end addresses have to be provided as arguments and
are used to check that the frame pointers fall within that range. These
values are thread specific and can be retrieved with get_thread_info().
No other sanity checks (like checking for loops in the linked list) are
done.

This is a simplified rewrite of the stack trace code from the kernel
debugger.

As this code is common to x86 and x86_64 but is not generic across
architectures I introduced x86_common as a directory to put such
sources.
2015-04-11 23:37:54 +02:00
Michael Lotz
459e651fd5 syscalls: Remove lookup_symbol syscall again.
This partially reverts b959d46dbd.
2015-04-11 11:18:51 +02:00
Michael Lotz
ebdc1d480e runtime_loader: Add imageName and exactMatch to symbol lookup.
Extend the get_nearest_symbol_at_address() private runtime_loader
export to include imageName and exactMatch arguments.

The imageName holds the SONAME of the image, if available, so cannot
neccessarily be extracted from the image path.

Whether or not there was an exact match, i.e. the symbol with its size
contains the address, is now returned in exactMatch.
2015-04-11 11:18:50 +02:00
Michael Lotz
ec0190adb0 malloc_debug: Implement allocation dump on exit in guarded heap.
When enabled (using heap_debug_dump_allocations_on_exit(true) or
MALLOC_DEBUG=e) this causes a dump of all remaining allocations when
libroot_debug is unloaded. It uses terminate_after to be called as
late as possible.

When combined with alloc stack traces this makes for a nice if a bit
crude leak checker. Note that a lot of allocations usually remain
even at that stage due to statically, lazyly and globally allocated
stuff from the various system libraries where it isn't necessarily
worth the overhead to free them when the program terminates anyway.
2015-04-10 17:04:28 +02:00
Michael Lotz
158e20e60e malloc_debug: Implement alloc/free stack traces in guarded heap.
When configured to do so (using heap_debug_set_stack_trace_depth(depth)
or MALLOC_DEBUG=s<depth>) the guarded heap now captures stack traces on
alloc and free.

A crash due to hitting a guard page or an already freed page now dumps
these stack traces. In the case of use-after-free one can therefore see
both where the allocation was done and where it was freed.

Note that there is a hardcoded maximum stack trace depth of 50 and that
the alloc stack trace takes away space from the free stack trace which
uses up the rest of that maximum.
2015-04-10 16:28:42 +02:00
Michael Lotz
b959d46dbd syscalls: Add get_stack_trace and lookup_symbol syscalls.
The get_stack_trace syscall generates a stack trace using the kernel
debugging facilities and copies the resulting return address array to
the preallocated buffer from userland. It is only possible to get a
stack trace of the current thread.

The lookup_symbol syscall can be used to look up the symbol and image
name corresponding to an address. It can be used to resolve symbols
from a stack trace generated by the get_stack_trace syscall. Only
symbols of the current team can be looked up. Note that this uses
the symbol lookup of the kernel debugger which does not support lookup
of all symbols (static functions are missing for example).

This is meant to be used in situations where more elaborate stack trace
generation, like done in the userland debugging helpers, is not possible
due to constraints.
2015-04-10 16:00:49 +02:00
Michael Lotz
e01de52283 More whitespace cleanup all over the place. 2015-04-10 15:05:14 +02:00
Michael Lotz
e25776bd83 Whitespace cleanup only. 2015-04-08 12:56:58 +02:00
Janus
85b350edda BColumnListView: BRow height is proportional to font size.
* Add a BRow default constructor that use font size to compute height.
* Min height size for Title and Row are decoupled.
* The font ratio for Title and Row are decoupled.
* For small font use min height (set to usual 16.0).
* Better baseline formula.
* Fixes #11944.
2015-04-05 16:58:00 +00:00
Alexander von Gluck IV
b1ad5660b2 arm: Prevent bcm283X inclusion from breaking other boards
* Move *_BASE into board_config.h to prevent conflicts
2015-04-04 17:44:32 -05:00
Michael Lotz
121655e9ee malloc_debug: Add default alignment option.
This allows for something similar as was implemented in 217f090 but
makes it optional and configurable.

The MALLOC_DEBUG environment variable now can take "a<size>" to set
the default alignment to the specified size. Note that not all
alignments may be supported depending on the heap implementation.
2015-04-04 22:55:57 +02:00
Michael Lotz
5ae3af6cc5 SupportDefs: Add B_SCN* counterparts for some more types.
Namely for [s]size_t, [{phys|generic}_]addr_t and off_t.
2015-04-04 22:55:57 +02:00
Michael Lotz
a05bfeb4a9 Whitespace cleanup only. 2015-04-04 22:55:56 +02:00
Stephan Aßmus
53094e2fa1 StringForSize.h: Fixed header guard comment at EOF 2015-04-04 22:45:41 +02:00
Fredrik Holmqvist
251eb00d51 Use B_PRId32. 2015-04-01 20:18:00 +02:00
Axel Dörfler
1aaa0c2142 Package Kit: FetchFileJob now contains package size.
* So that you know how much already was, and still has to be downloaded.
* Automatic whitespace cleanup.
* The link in FetchFileJob.h did not fetch the correct header under
  Haiku anymore (since the addition of the private headers to the
  image).
2015-03-31 13:40:42 +02:00
Michael Lotz
ffba66060b UserlandFS: Make 64 bit clean and enable build for x86_64.
I did not bother to fix the BeOS kernel emulation, so this part is
still left out of the x86_64 build.
2015-03-29 16:25:17 +02:00
Alexander von Gluck IV
c6a4fee579 loader/u-boot: Use FDT serial info to create uart
* drop my fdt tests
* we have to call fdt parsing code *after* cpu_init (why?)
* pass fdt pointer to all FDT support calls to avoid confusion
  once we get into the kernel land
* look for PL011 compatible uart and use it
* Add some saftey checks to serial putc code to avoid null*
* fdt_node_check_compatible returns 0 on success not 1
* fdt_get_device_reg needs to add the SOC base to the result
* fdt_get_device_reg might need to add the second range cell
  instead of reg?
2015-03-28 15:52:16 -05:00
Jérôme Duval
4a9c56f6c7 x86_64: fenv.c needs __weak_reference()
* the weak symbol feenableexcept wasn't available.
2015-03-27 20:16:57 +01:00
Axel Dörfler
687d0bc272 DriverSettingsMessageAdapter: fixed converter signature.
* The ConvertFromDriverSettings() method missed the current value
  index.
* Completed unit tests, and enabled them all.
2015-03-27 13:25:28 +01:00
Axel Dörfler
3d7aaa308c Network: added notify settings updated method.
* And call it from the DNS client -- this is the only add-on that does
  not trigger a configuration or settings update, so we have to notify
  the changes manually.
2015-03-27 13:25:27 +01:00
Axel Dörfler
8bc3ecb054 Added BTextControl::TextLength() method. 2015-03-27 13:24:09 +01:00
Axel Dörfler
d26777c4e4 Network: added BNetworkSettingsListener.
* Same as the configuration listener, just for SettingsUpdated().
* This is now broadcasted to all list items, too.
2015-03-27 13:24:07 +01:00
Axel Dörfler
f7ccc9af85 BNetworkSettings: added const, server IsRunning() method.
* Get{Interface|Network|Service}() methods are now const.
* Added variants of Interface(), and Service() that are const.
* Added new BNetworkServiceSettings::IsRunning() convenience method that
  reflects the status quo rather than the settings.
2015-03-27 13:24:07 +01:00
Axel Dörfler
c3ef93915b net_server: Clients can now check if a service is running.
* Using the new kMsgIsServiceRunning command.
2015-03-27 13:23:01 +01:00
Axel Dörfler
1f94cdcdff BNetworkServiceSettings: Added missing functions/constructor. 2015-03-27 13:23:00 +01:00
Axel Dörfler
7ca40f60bc BNetworkSettings: made service stuff writable.
* And added the ability to disable a service without losing its
  configuration.
2015-03-27 13:22:30 +01:00
Axel Dörfler
d1f0b8db1d Network: fixed top item creation, sort entries.
* Need a way to access the NetworkWindow object from a static
  method in order to sort all entries correctly, though.
2015-03-27 13:22:29 +01:00
Axel Dörfler
5274e9b004 Network: added interface list item.
* Added BNetworkInterfaceListItem that can be used by interface protocol
  add-ons to represent their functionality in the list view.
* It will automatically update itself on changes, and will show the
  specified label, and address, if any, as well as indicate whether or
  not the family has been disabled (which doesn't work perfectly yet,
  as IFF_AUTO_CONFIGURED is on the interface level).
* Therefore, the interface list item will no longer show the address,
  but the type of the device instead.
* Introduced the BNetworkConfigurationListener interface that is used
  to broadcast network updates to.
2015-03-27 13:22:28 +01:00
Axel Dörfler
b00dcbcad2 BNetworkSettings: added some convenience methods.
* From InterfaceAddressView: FindFirstAddress(), and IsAutoConfigure().
* Removed some debug leftovers in InterfaceAddressView, too.
2015-03-27 13:22:27 +01:00
Axel Dörfler
e4f4658a1b BNetworkSettings: made interface settings writable.
* It also makes use of the new driver settings converter mechanism.
2015-03-27 13:21:51 +01:00
Axel Dörfler
3211cbcd15 DriverSettingsMessageAdapter: optional field converter.
* You can now optionally specify a converter that does the actual
  message to settings conversion, and vice versa.
* This allows for more sophisticated and custom conversions.
2015-03-27 13:21:50 +01:00
Axel Dörfler
07addd7ef5 Network: broadcast updates, remove apply button.
* Network now monitors all network, and network settings changes, and
  will notify all add-ons about those changes.
* Removed the global apply button. Instead, the static IP configuration
  now got that button. All other changes will be instant.
2015-03-27 13:21:49 +01:00
Axel Dörfler
f16f9ee4ee Moved more functionality from net_server to NetworkSettings.
* Added (still incomplete) helper classes for the settings messages.
* The net_server now uses these classes for its interfaces, and services.
* Renamed service_address to service_connection, as that better matches
  what it is used for.
2015-03-27 13:21:49 +01:00
Axel Dörfler
7a9c00732a BMessage: add default parameter to GetString()/GetBool().
* It's likely that you want NULL/false when the data is not available
  so you can now leave out the default value in that case.
2015-03-27 13:21:48 +01:00
Axel Dörfler
2864e4da5e Network: added global settings.
* NetworkWindow now manages a single BNetworkSettings object
  that is shared with all add-ons.
2015-03-27 13:21:48 +01:00
Axel Dörfler
db6d25ceba NetworkInterface.h: honor 80 character limit. 2015-03-27 13:21:47 +01:00
Axel Dörfler
d880e2d91f BNetworkSettings: added Get*() by name methods. 2015-03-27 13:21:46 +01:00
Axel Dörfler
fd55fb6615 Moved net_server's settings to libbnetapi.
* As experimental API class BNetworkSettings.
* Added add/remove methods for interfaces, and services, too.
* Moved the conversion of the wireless networks into the settings class,
  too, so that it only gives out converted ones (but accepts both
  variants).
2015-03-27 13:21:46 +01:00
Axel Dörfler
3401ff7c2f BNetworkSettingsAddOn: added missing destructor. 2015-03-27 13:08:44 +01:00
Axel Dörfler
f6c7cf44b5 Network: integrated former hardware view from add-on.
* The interfaces logic is within the main application, so is the
  new interface view.
* Disabling/renegotiating does not work yet.
* Reveals a bug in some interface code; when you click on an ethernet
  device first, there is no place for the wireless menu. When you then
  press on a wireless device, it crashes in BMenuField code.
  In the other direction, there is then an empty space.
* Fixed list item width reporting.
2015-03-27 13:08:44 +01:00
Axel Dörfler
021ff1ca46 Network: no need for public constants. 2015-03-27 13:08:42 +01:00
Axel Dörfler
77db25ddc7 Network: moved add-on headers to the correct position.
* Ie. they've moved to headers/os/add-ons/network_settings now.
2015-03-27 13:08:41 +01:00
Axel Dörfler
0690387cd2 BServer/BApplication: added constructor for looper name.
* Added an extra looperName argument to the private BApplication
  constructor that BServer is using.
* This is now used to fix the ugliness that gave the registrar
  a different looper name, and even saves a string comparison.
2015-03-26 21:47:24 +00:00
Axel Dörfler
b7a87fd137 find_paths_etc(): added user/system only flags.
* B_FIND_PATHS_(USER|SYSTEM)_ONLY cause only the specified paths
  to be included in the result list.
2015-03-26 21:47:22 +00:00
Dario Casalinuovo
fc601b54ff TMap/Tlist: set various methods as const.
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2015-03-17 21:50:18 +01:00
John Scipione
2c3505de79 PictureDataWriter: Style fixes only
No functional change intended
2015-03-16 20:19:52 -04:00