Commit Graph

60346 Commits

Author SHA1 Message Date
Augustin Cavalier
b1ea5557ec USB: Remove USB_SPEED_WIRELESS.
It doesn't belong after SUPER, as it's really an extension of USB 2.0
(Linux puts it after HIGHSPEED indeed, as "USB 2.5".) If we eventually
want to support it, we can add it there.
2019-07-13 19:37:19 -04:00
Augustin Cavalier
e06f640862 Installer: Ignore cache directories.
Fixes #15145.
2019-07-13 15:54:47 -04:00
Augustin Cavalier
39681c5c0f BootManager: Lock installation to "Intel" partition types only.
It seems no other OS calls these "Intel" partition types, but instead
MBR partition types. Perhaps we should change this, too?

At any rate, this solves #13260 by blocking installation on GPT
drives altogether.
2019-07-13 15:08:15 -04:00
Augustin Cavalier
14cbb958bd kernel/vfs: Unlock KPath buffers after copying them.
Otherwise we will call UnlockBuffer() when we potentially never
called LockBuffer().

Fixes #15157.
2019-07-13 13:46:19 -04: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
ca68cae76f PluginManager: remove unneeded buffering.
The plugin manager was attempting to buffer the IOs. However, the ffmpeg
plugin already handles this (it reads in 64K chunks, the same size as
the buffer here, so this buffering was effectively useless), and the
media extractor already runs the decoding in a separate thread thanks to
the chunk cache. So, we do not need an extra level of buffering here.

We should leave any extra buffering to the upper layers (BMediaTrack or
Media Extractor), if it's needed, as they would have much more control
on the creation of the data io object.

Change-Id: I65b67919da107c8b910dd08f8cdb8e3745af92c7
Reviewed-on: https://review.haiku-os.org/c/1588
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00: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
9b3aa126ba ffmpeg AVFormatReader: some cleanups.
- Stop using deprecated APIs
- Use BMediaFormat::Clear
- Remove hack for Protracker MOD as we have since got a MIME sniffing rule
- Clarify some comments and fix typos

Change-Id: Id495188cc44dc5af2820fe2a5236a983605b53c4
Reviewed-on: https://review.haiku-os.org/c/1586
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00:00
Augustin Cavalier
e1b5172126 slab_private: Use malloc_etc/free_etc instead of the block allocator.
Under normal circumstances (slab allocator) this change is a no-op
because malloc_etc just calls block_alloc unconditionally. Under
the debug or guarded heap, this makes allocations go through that
instead.
2019-07-12 22:26:05 -04:00
PulkoMandy
c90c06ef59 sparc: documentation about the boot process and useful commands
I didn't do anything with sparc for a few weeks (you don't want this
machine running when temperatures already are over 30°...), and I wastd
some time finding back some of the useful information, such as commands
to boot and debug, load and execution address of the bootloader program,
etc. So let's keep these in the documentation directory.

Change-Id: I293e0eea3063d410d66f9b2397c2cf0bdbfc6753
Reviewed-on: https://review.haiku-os.org/c/1581
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-13 01:29:05 +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
19d1cffe33 FileTypes: Prevent a potential snprintf overflow. 2019-07-12 21:22:28 -04:00
Augustin Cavalier
fa146526b6 kernel/system_info: Avoid malloc() in _user_get_cpu_info.
This is called 15-30 times per second (15 by Pulse, 30 by ActivityMonitor),
so we want to keep it as low-profile as is possible.
2019-07-12 21:22:09 -04:00
Augustin Cavalier
6d336fda4a block_cache: Compute the timeout dynamically based on write speeds.
We now record how long it takes to write a block (on average), and then
utilize this information to reduce the timeout write thread's timeout
(to 2 * block_count * average_block_time, so we don't completely
congest the drive.) Remove the "TODO" about the I/O scheduler;
this new logic will be just fine even under an I/O scheduler.

Note that this change goes both ways: while faster writes mean more
writes and quicker, slower writes will increase the timeout before
we do another one also. This then also guards against queueing
another write while one is already in progress, which was
not handled before.

Tested in KVM. Even on a SATA-backed spinning HDD, this reduces
the timeout to around *200ms* on average (!!), so a 10x improvement.
On a ramdisk, it reduces the timeout to *10-30ms* (!!!) on average,
so a 100-200x improvement, so this change will benefit everyone
but SSDs especially.

Since BFS inode and journal writes always go through the block_cache,
this very dramatically improves inode-related write performance.
The "stop and start" stutters when emptying or moving items to Trash
seem totally gone, among a lot of other things.

Change-Id: I41f46a6432ce1f50f896a853abdfe22dde0ba327
2019-07-12 21:19:47 -04:00
Augustin Cavalier
9d06690ede userland: Pass more sizes with ioctls where we can.
No "functional" change intended.
2019-07-11 23:41:52 -04:00
Augustin Cavalier
4c9e8f77e4 BootManager: Take explicit instead of implicit reference.
Passing a type& to a va-args turns it into a pointer as per
the Itanium ABI; but we shouldn't rely on such trickery.
Explicitly capture a reference to it instead.
2019-07-11 23:40:41 -04:00
Augustin Cavalier
1418cade55 file_systems: Pass size argument to ioctl in a lot more places. 2019-07-11 23:26:02 -04: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
Simon South
9b72c3a089 kernel: Specify buffer size in certain ioctl calls.
In cases where scsi_periph checks the size of the buffer supplied to an
ioctl call (functionality added in commit ff4af513e1) this information
needs to be provided by the caller to avoid failure.

Fixes #15094.

Change-Id: I37f2776edbe977e9825ec1837fb763a3b2aa7220
Reviewed-on: https://review.haiku-os.org/c/1584
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-12 02:19:00 +00:00
Augustin Cavalier
f4e3bb1cc6 kernel/team: Avoid allocating memory in _user_get_extended_team_info.
Terminal calls this multiple times a second per open tab, so it
was spamming up my malloc logs. I don't see any reason this 60-byte
structure needs to be on the heap; so, leave it on the stack instead.

Change-Id: I3f1ac14fe9bfec39cd0d5668c68f84467450b0c0
Reviewed-on: https://review.haiku-os.org/c/1580
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-12 02:00:47 +00:00
Augustin Cavalier
0e6ece91c8 block_cache: Use an object_cache for the cache_notifications.
cache_listeners are (following packagefs changes) the second-most
allocated object during the boot process, with 20799 on a
*minimum* image. Since they are used so extensively in BFS I/O,
making them object_cached for both performance and memory reasons
seems to make a lot of sense.

Change-Id: I6ef6c3e811c0c4189fea45ee7920131796c9e7c8
Reviewed-on: https://review.haiku-os.org/c/1577
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-12 02:00:27 +00:00
Augustin Cavalier
7a2f744859 block_cache: Free up blocks more aggressively on low memory conditions.
Only keep a single block when there is a "critical" low resource state.
Also don't bother doing anything if there are no unused blocks.

Change-Id: Ibfcbd8cb0beb1446083ca83030ea8e81c59a9628
Reviewed-on: https://review.haiku-os.org/c/1576
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-12 02:00:27 +00:00
Murai Takashi
c91c69752b bin/setdecor: Fix -Wformat=
Change-Id: I8c50ec470098817fb17c626964e6e8158323550e
Reviewed-on: https://review.haiku-os.org/c/1517
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-07-11 21:36:29 +00:00
Murai Takashi
103e774d46 media-add-ons/usb_webcam: Fix -Wformat=
Change-Id: I85734ac3b01beb6e6a69ebda5050715c1fa1342d
Reviewed-on: https://review.haiku-os.org/c/1562
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-11 21:32:52 +00:00
Augustin Cavalier
d387d8c5f4 packagefs: Use an object_cache in the TwoKeyAVLTree also.
TwoKeyAVLTree in packagefs is used for indexing. On a stock nightly,
just after boot there are 3 TwoKeyAVLTrees with just over 28000 items
each. So, this is another significant load off the generic allocator.
2019-07-10 00:33:55 -04:00
Augustin Cavalier
86e43bdf58 kernel: Add missing error checks to MemoryManager::_AllocateChunks. 2019-07-09 22:43:25 -04:00
Augustin Cavalier
d230b5fdd3 packagefs: Use object caches for the most used node classes.
Slab statistics from KDL show that on a stock nightly image
(i.e. no additional packages besides the standards installed)
there are 43848 *objects* (not bytes) in the PackageNodeAttribute
cache, and 25090 in the PackageFile cache, so this seems more than
worth it.

The last commit seems to reduce memory usage at boot by about 1%,
this commit seems to not affect it at all; but it is a significant
performance optimization and on systems with more packages installed
the effect may be very noticeable.

Change-Id: I676a642ed6003f82b14396e1f02684575d899362
2019-07-09 22:38:59 -04:00
Augustin Cavalier
71e255cd31 packagefs: Remove PackageDataV1 from PackageData.
Now that we never access V1 packages in here, we don't need this.
This saves *24* bytes off the size of the class, which is
extremely significant as not only every PackageFile instance
has an instance of this class, but every PackageNode does too;
so the savings from this change is probably in the MB.
2019-07-08 23:29:40 -04:00
Jérôme Duval
ed9a502a9a console: allow one user at a time.
Fixes #15142.

Change-Id: I203cb62a6640fcd5f674eeaf4aa1145e1e831ca6
Reviewed-on: https://review.haiku-os.org/c/1566
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-08 22:01:44 +00:00
Augustin Cavalier
2f6dc2bb79 kernel: Commit missing change to team.h.
If the buildbots were working, I would have been informed of this
about an hour after I committed it last night. But it seems they aren't.
Maybe kallisti5 will have some more incentive to work on that?
2019-07-08 17:58:43 -04:00
Jérôme Duval
d2e519391f Messenger: style fix.
Change-Id: I5b1b7e745de91bd1bedbbbe13faf848fdd284785
Reviewed-on: https://review.haiku-os.org/c/1565
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-07-08 18:53:48 +00:00
Augustin Cavalier
5c97129ce3 kernel/team: Remove team_get_team_struct, add team_geteuid.
Thanks to Axel for the review.
2019-07-07 22:51:09 -04:00
Augustin Cavalier
05901d8963 kernel/cpu: Only root can enable or disable CPUs. 2019-07-04 17:00:28 -04:00
Augustin Cavalier
6f0aa00c6b kernel/user_debugger: Add missing permissions checks.
Part of #14961.
2019-07-04 16:54:50 -04:00
Augustin Cavalier
a90e9ba7b9 kernel/team: Create a team_get_team_struct() function and utilize it.
Cleans up some lock/get/unlock sequences, and makes it possible
for external consumers to get team structs (which will be necessary
for permissions checks.)
2019-07-04 16:54:33 -04:00
Augustin Cavalier
6f6cba7c16 kernel/system_profiler: Do not allow non-root users access.
The single-team profiler can still be used without root access.
Part of #14961.
2019-07-04 16:41:36 -04:00
Augustin Cavalier
ebb0db62d1 kits: Only export private dummy copy constructors for R5 ABI.
Fixes #546 (after all these years!)
2019-07-04 15:24:23 -04:00
Augustin Cavalier
45dcac89df usb_hid: Fix copy/paste error in HIDReport.
Spotted by Coverity.
2019-07-04 12:39:31 -04:00
waddlesplash
8b19fb0f55 Partially revert "XHCI: Set the TRB_3_ENT_BIT on the final Link TRB, also."
This reverts commit 63895cb5f2.

This does go against the specification, and on a very small set of
XHCI hardware, seems to break booting (#15137). So, let's revert it;
the buggy hardware it potentially helped will just have to deal with
it.
2019-07-03 20:51:05 -04:00
Adrien Destugues
b11f8cb28c tty driver: build fix. 2019-07-02 22:45:47 +02:00
Alexander von Gluck IV
5965cdf80b glibc/riscv64: Add native missing sqrt functions from BSD
Change-Id: I7dbbb5be0dd56b2a0b5148a4f7f81c66b76e9632
Reviewed-on: https://review.haiku-os.org/c/1554
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-02 13:34:46 +00:00
Alexander von Gluck IV
f1f452b3cf libroot/os: Fix missing time funcs on riscv64
Change-Id: I291ebc949d63860e20eb609e4d3d2f600309d4e9
Reviewed-on: https://review.haiku-os.org/c/1553
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-02 13:34:22 +00:00
John Scipione
a9d549c969 BFS: Set -std=c++11 in bfs_shell c++flags for gcc >= 3
Required for use of non-static data member

clang complains about this line in CheckVisitor.cpp:
memset(&Control().stats, 0, sizeof(check_control::stats));

some explination:
https://stackoverflow.com/questions/29359661/clang-error-invalid-use-of-non-static-data-member
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html

Referencing a non-static data member inside a struct was retroactively
made undefined in C++98 and only allowed on C++11 even though gcc
permits the code to compile.

No change to functionality intended.

Thanks Jérôme and waddlesplash

Change-Id: Ic6bc332cf2796c709584488c60a067cd341bf894
Reviewed-on: https://review.haiku-os.org/c/1503
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-02 10:52:02 +00:00
Alexander von Gluck IV
0dbb417d43 3rdparty/docker/bootstrap: Fix defaults to be more generic and engine selection
Change-Id: I8a1e3c6bd641ea08a5a06985389269d708d94655
2019-07-01 14:07:03 -05:00
Adrien Destugues
e399a8832d usb_serial: don't allow Service() on a closed device.
- In Service, check that the device is open.
- In Close, clear dangling pointers to more easily spot problems and
avoid risk of accessing freed memory.

Change-Id: I970c4b8b8ec14db448388f74fc275634801c359a
Reviewed-on: https://review.haiku-os.org/c/1551
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-07-01 03:01:07 +00:00
Adrien Destugues
865a165f1c legacy tty driver: share common files with the new implementation
Let's make it easier to keep them in sync for now.

Change-Id: Ic0f1488c7f7da7770db56c25d07fb3ead5e3649e
Reviewed-on: https://review.haiku-os.org/c/1550
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-01 03:01:07 +00:00
Fabio Tomat
46aa215360 Friulian keymap
Change-Id: Ib766f88b21d40c8a014d85d097bb557bca3c235d
Reviewed-on: https://review.haiku-os.org/c/1548
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-01 03:00:36 +00:00
Murai Takashi
749c57a325 drivers/input/wacom: Fix -Wformat=
Change-Id: I164aa8e0ad7e0c19f7e59d7b6e36877fde9f2877
Reviewed-on: https://review.haiku-os.org/c/1547
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-06-30 09:17:08 +00:00
Murai Takashi
20c352526a drivers/audio/emuxki: Fix -Wformat=
Change-Id: I2ab8be10ed9f020b139f81d8826dc20d83fa1e4e
Reviewed-on: https://review.haiku-os.org/c/1542
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-06-30 09:16:53 +00:00