Commit Graph

7668 Commits

Author SHA1 Message Date
Michael Lotz
dcc56bf748 BNetEndpoint: Fix socket leak and reduce Accept() overhead.
When using the copy constructor of BNetEndpoint the socket of the
original endpoint gets dup'ed. The Accept() method later directly reset
the fSocket member of the newly created BNetEndpoint to the socket
returned by accept(). The socket dup'ed by the copy constructor was
therefore leaked.

Of course dup'ing the socket and copying the local and remote addresses
is superfluous in the accept case, as these members all get set to new
values. To reduce that overhead there is now a new private constructor
that directly gets the final socket and remote and local address.
2013-11-24 22:36:29 +01:00
Ingo Weinhold
2b76973fa2 mimeset: Use TextSnifferAddon when using a custom MIME DB
That addresses the problem that packaged text files aren't correctly
identified (ticket #9972). All concerned packages have to be rebuilt,
of course.
2013-11-22 12:24:13 +01:00
Ingo Weinhold
6140f897d4 TextSnifferAddon: Use MIME DB directly
A DatabaseLocation is passed to the constructor and used to verify that
the sniffed MIME type is installed instead of BMimeType::IsInstalled().
This makes the add-on independent of the default MIME DB.
2013-11-22 12:24:13 +01:00
Ingo Weinhold
85835e4186 registrar: Move more classes to libstorage_kit_mime.a
Move MimeSnifferAddon, MimeSnifferAddonManager, and TextSnifferAddon to
libstorage_kit_mime.a, so we can reuse them.
2013-11-22 12:24:12 +01:00
Ingo Weinhold
62b164bd71 BPathFinder: Add BPackageResolvableExpression initialization
Add a constructor and a SetTo() method with a
BPackageResolvableExpression parameter instead of a path. The path of
the package satisfying the expression is used.

The new functionality lives in libpackage as it uses the package kit.
2013-11-21 13:29:21 +01:00
Ingo Weinhold
ee8e91583e BPackageManager::UserInteractionHandler: Make non-abstract
Most of the hooks don't strictly need a non-empty implementation. The
defaults now simply throw exceptions in those that do. This allows the
class to be instantiated, which is useful when a BPackageManager is only
used for finding packages.
2013-11-21 13:29:21 +01:00
Ingo Weinhold
6722e1ae43 BPackageManager: Add mandatory constructor parameters
Require the installation interface and the user interaction handle to
be passed to the constructor. Formerly, derived classes set them
manually in their constructors. This makes using the class without
having to subclass it possible.
2013-11-21 13:29:20 +01:00
Ingo Weinhold
88706cfaa5 package kit: Add API for parsing resolvable expression strings
* Add BPackageInfo::ParseResolvableExpressionString().
* Add BPackageResolvableExpression constructor and SetTo() taking an
  expression string.
2013-11-21 13:29:20 +01:00
Ingo Weinhold
c04f3a625a boot loader: Add safe mode blacklist submenu
It's a browser for the system package content, where entries can be
selected to blacklist them. The selected entries are removed from the
packagefs instance in the boot loader, so that e.g. selected drivers
won't be picked up. The paths are also added to the safe mode driver
settings and will be interpreted when the system packagefs instance is
mounted by the kernel.
2013-11-20 16:00:35 +01:00
Ingo Weinhold
6c7abe9829 boot loader: Menu[Item] API improvements
* Make Menu and MenuItem polymorphic.
* MenuItem:
  - Make SetMarked() virtual, so it can be overridden.
  - Add SetSubmenu() and Supermenu().
  - Delete the submenu in the destructor.
* Menu:
  - Add Entered()/Exited() hooks. They frame the time the user navigates
    the menu or any of its submenus. The hooks allow for subclasses
    populating their item list dynamically.
  - Add SortItems().
* Update boot loader menu copyright text to include 2013, now that it is
  over soon. :-)
2013-11-20 16:00:34 +01:00
Ingo Weinhold
435fb01509 DoublyLinkedList: Add Sort() 2013-11-20 16:00:34 +01:00
Ingo Weinhold
7e7f482590 SinglyLinkedList: Missing include 2013-11-20 16:00:34 +01:00
Ingo Weinhold
3a7e0b0014 packagefs: Support blacklisting entries in packages
In each installation location, it is now possible to create a settings
file "packages" that allows to blacklist entries contained in packages.
The format is:

Package <package name> {
	EntryBlacklist {
		<entry path>
		...
	}
}
...

<package name> is the base name (no version) of the respective package
(e.g. "haiku"), <entry path> is an installation location relative path
(e.g. "add-ons/Translators/FooTranslator").

Blacklisted entries will be ignored by packagefs, i.e. they won't appear
in the file system. This addresses the issue that it may be necessary to
remove a problematic file (e.g. driver, add-on, or library), which would
otherwise require editing the containing package file.

The settings file is not not "live". Changes take effect only after
reboot (respectively when remounting the concerned packagefs volume).
2013-11-19 15:30:34 +01:00
Ingo Weinhold
2fdd1d9ef1 khash: Move string hash functions to own header/source file
Unlike khash they shouldn't be phased out (only renamed).
2013-11-19 15:08:34 +01:00
Ingo Weinhold
efe9df3791 driver settings: Add load_driver_settings_file()
Allows loading an already opened driver settings file (by FD).
2013-11-19 15:06:30 +01:00
Ingo Weinhold
0eb197d40c BPathFinder: Coding style improvements 2013-11-19 02:05:36 +01:00
Ingo Weinhold
22e92014f0 s/B_FIND_PATH_IMAGE_PACKAGE_PATH/B_FIND_PATH_PACKAGE_PATH/
It doesn't only work for image files, so make the name more general.
2013-11-19 02:05:35 +01:00
Stefano Ceccherini
0bc615438a Style fixes.
Style fixes pointed out by Axel. I'm rusty, and it shows.
Hope I got it right.
Also moved get_route() into BPrivate.
2013-11-18 20:01:35 +01:00
Stefano Ceccherini
41d4206692 Added family parameter to the GetRoutes() API.
Moved common code to a private file.
2013-11-18 10:13:26 +01:00
Ingo Weinhold
94fb954c53 find_path*(): Support user specific home directory
No longer hard-code the home directory path. Instead ask
find_directory(), so we get the correct one for the current user.
2013-11-18 01:50:49 +01:00
Ingo Weinhold
8a3fe6d1bf Add private __getenv_reentrant()
A reentrant variant of getenv().
2013-11-17 19:11:02 +01:00
Ingo Weinhold
c39c9283aa Add get_architectures() and C++ versions
* get_architectures() returns the primary and the secondary
  architectures in one array. That turned out to be convenient.
* Add C++ versions for get[_secondary]_architectures(), returning a
  BStringList.
2013-11-17 02:09:37 +01:00
Ingo Weinhold
60b39cd741 Add get_*architecture() API, extend find_path*() API
* Add get_architecture(), get_primary_architecture(),
  get_secondary_architectures(), guess_architecture_for_path() to get
  the caller's architecture, the primary architecture, all secondary
  architectures, or the architecture associated with a specified path
  respectively.
* Rename the find_path*() functions to find_path*_etc() and add an
  optional architecture parameter. Add simplified find_path*()
  functions.
* BPathFinder: Add FindPath[s]() versions with an architecture
  parameter.
2013-11-17 02:09:36 +01:00
Ingo Weinhold
cf7e2ad812 runtime loader: Export get_executable_architecture() function
Given a path of an ELF file, it tries to determine its architecture.
2013-11-17 02:09:36 +01:00
Stefano Ceccherini
905f910e53 Network route API: Second try (WIP).
Implement BNetworkRoster::GetRoutes() and BNetworkInterface::GetRoutes().
Also implement BNetworkInterface::GetDefaultGateway().
There is code duplication at the moment, and the api only supports IPV4.
2013-11-16 13:29:32 +01:00
John Scipione
1c776bfe37 Lock screensaver window directly
By passing the window pointer to ScreenSaverRunner contructor and using that
to lock the window when drawing instead of getting the window from the
Window() method of the view. This is safer.
2013-11-15 21:27:13 -05:00
Stefano Ceccherini
0074cea398 Implement BNetworkRoster::GetNextRoute()
Implement BNetworkRoster::GetNextRoute() and used it in Network preflet.
2013-11-15 21:59:28 +01:00
Adrien Destugues
564e256649 Various fixes to Services Kit
* Remove useless dummy protocol loop in UrlRequest
 * Stop HTTP requests before deleting the socket and other things the
loop may still be using
 * Deletion of items from the authentication map wasn't working
 * Remove some debug traces
2013-11-15 16:32:18 +01:00
John Scipione
d34a680c04 Screen Saver: fix race condition
Start the screensaver in the window thread instead of the runner
thread so that there is no lock contention for the window lock in
the runner thread when the saver starts.

The view that gets drawn into is assumed to have been prepared before
being passed to the runner thread, and this assumption has been made
true for the screensaver preview and screen_blanker apps.

Eliminate fHasStarted and the corresponding HasStarted() method in
ScreenSaverRunner as they are no longer needed.

Drawing still happens in the runner thread, and still needs to lock
the window thread potentially causing contention, yet, there
is a timeout here so the contention won't freeze the screensaver window,
only delay drawing the screensaver.

Drawing could be moved to the window thread via message passing to avoid
lock contention with the window but this would defeat a big part of the
purpose of having a separate rendering thread.

This fixes #10125 and #4260
2013-11-14 23:30:26 -05:00
John Scipione
5d023095c2 ScreenSaverRunner: Suspend() and Resume() return status_t 2013-11-14 23:30:13 -05:00
John Scipione
e22c01af03 Screen Saver: style fixes 2013-11-14 23:30:10 -05:00
John Scipione
6f33360fac BPopUpMenu style fixes for documentation, no functional change intended 2013-11-11 19:27:45 -05:00
Ingo Weinhold
e5f6591382 VM: vm_memset_physical(): Correct length parameter type 2013-11-11 22:27:52 +01:00
Jérôme Duval
847ab5a734 acpi: EcGpeHandler() should return ACPI_REENABLE_GPE.
* this clears the GPE if level triggered and possibly enables the GPE.
See AcpiEvFinishGpe() and AcpiEvGpeDispatch().
2013-11-11 18:59:38 +01:00
Jérôme Duval
a0f124211a scsi: define SCSI_DEVICE_MAX_LUN_COUNT to set a custom max lun count.
* virtio_scsi can have 16384 luns, though we cap at 256 as our scsi_ccb
only uses uchar as a type for target_lun and target_id members.
* minor code cleanup in scsi_scan_bus().
2013-11-09 13:09:20 +01:00
Axel Dörfler
547cd462f8 trim: Added is_called_via_syscall() function.
* And use it in get_trim_data_from_user(), formerly known as copy_*().
* This fixes differentiating between user and kernel buffers.
2013-11-07 19:06:13 +01:00
Axel Dörfler
99086aa323 trim: Target SCSI UNMAP command instead of WRITE SAME.
* The UNMAP command is theoretically much faster, as it can get many block
  ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
  to trim.
* Updated BFS code to collect array ranges to fully support the new
  fs_trim_data possibilities.
2013-11-07 19:03:47 +01:00
Axel Dörfler
960c56aea5 This gets the trim command as WRITE SAME operation to SCSI
* Neither hardware nor driver to test it; AHCI/IDE support is next
  on the table.
2013-11-07 19:03:35 +01:00
Axel Dörfler
29a8450843 Added B_TRIM_DEVICE ioctl. 2013-11-07 19:01:24 +01:00
John Scipione
ef92b3dd4c BMenuBar: Update param names related to docs.
No functional change intended.

Renamed title => name in regular constructors,
      No right or wrong here but consistant now.
Renamed data => archive in Achive constructor,
      Ditto.
2013-11-06 19:26:19 -05:00
John Scipione
45e17d3d42 Update BView::DrawAfterChildren() param name
... from r to updateRect, no functional change intended.

Also a tiny change to the param description in the docs.
2013-11-06 13:14:53 -05:00
John Scipione
9a9ebda459 BMenu: Some style fixes related to docs
Mostly just making the variable names match between the
header and source.

No functional change intended.
2013-11-06 12:21:58 -05:00
Ingo Weinhold
8afbcbeb6f Add class BPathFinder
It's a more convenient C++ wrapper for the new find_path*() C functions.
2013-11-05 21:40:43 +01:00
Ingo Weinhold
986e4abce4 Add new API find_path[s](), find_path_for_path()
The new functions are meant to replace many uses of find_directory():
* find_paths() is supposed to be used when the directories of a certain
  kind in all installation directories are needed (e.g. font
  directories, add-on directory, etc.). Using this API makes code
  robust wrt addition or removal of installation locations.
* find_path() is supposed to be used when files/directories associated
  with a loaded program, library, or add-on need to be found (e.g. data
  files or global settings).
* find_path_for_path() is similar to find_path(), but it starts from a
  given path instead of an image.
2013-11-05 21:40:43 +01:00
Ingo Weinhold
a712cdd0b1 image.h: Add B_{APP,CURRENT}_IMAGE_SYMBOL macros
* Those can be used in cases where a pointer to an image symbol is
  required.
* Adjust BResources::SetToImage() accordingly.
2013-11-05 21:40:43 +01:00
Ingo Weinhold
a05e0af507 BeBuild.h: Fix B_DEFINE_WEAK_ALIAS for use in C++ code 2013-11-05 21:40:42 +01:00
John Scipione
c2c1ce1dc5 Style fixes to HttpRequest 2013-11-04 20:16:26 -05:00
John Scipione
f1e63b05cb Style fixes to HttpForm 2013-11-04 20:16:05 -05:00
Jérôme Duval
e2183a14c4 Increased kernel stack size by another page for 64-bit
* USB boot now works on x86_64 with PM.
2013-11-04 18:53:49 +01:00
Jérôme Duval
daf95c6d8c acpi: use acpi_event_handler instead of interrupt_handler. 2013-10-30 22:29:37 +01:00