Commit Graph

60225 Commits

Author SHA1 Message Date
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
Adrien Destugues
439ca67c06 PVS V519: setting the same variable twice
Change-Id: I3967f1c77c89d1aa9d040d8ff7a8593daca8f8b2
Reviewed-on: https://review.haiku-os.org/c/1603
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:38:57 +00:00
Adrien Destugues
ca72c6784d PVS V517: two times the same comparison
Change-Id: I93bfdb8cb09d61f537228c4b0a53ee603240d00d
Reviewed-on: https://review.haiku-os.org/c/1602
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:37:25 +00:00
Adrien Destugues
a6dcaa68a9 PVS V507: pointer to stack leaked to global variable
Change-Id: I56740f4b847c0b99a44e7db830bcccb20bf51cbc
Reviewed-on: https://review.haiku-os.org/c/1601
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:36:48 +00:00
Adrien Destugues
1ec8732c71 PVS V506: using pointer to deallocated stack space
Change-Id: I43f7d0208f7d644d6f4274a9a718773f7a1346a0
Reviewed-on: https://review.haiku-os.org/c/1600
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:35:56 +00:00
Adrien Destugues
11cba1646d PVS V502: missing parentheses around ternary operator
Change-Id: If3179e7b0a583f64e2d690a2f62526bd527e2964
Reviewed-on: https://review.haiku-os.org/c/1599
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:34:12 +00:00
Adrien Destugues
16d463ae1d PVS V501: redundant checks
There are some more in telnetd and agg but I'm not sure if they are
intentional, the code is so ugly there.

Change-Id: I9cc2bf8a919c3b1d6c68f2ded8622730497b0f91
Reviewed-on: https://review.haiku-os.org/c/1598
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:33:24 +00:00
Humdinger
583c561cb2 Button labels: "Ok" -> "OK"
All caps is our standard.
2019-07-16 20:26:45 +02:00
brjhaiku
ef52a3d48f btrfs: document DirectoryIterator class (no functional change)
Change-Id: Iffbd7112a9a266b65d6dd56dbd040f04e5ab58b2
Reviewed-on: https://review.haiku-os.org/c/1493
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-07-16 11:32:13 +00:00
Augustin Cavalier
72ab11b563 userlandfs: libbsd.so is referenced as "libbsd.so".
Fixes the build.
2019-07-16 00:30:21 -04:00
Augustin Cavalier
956664faec usb_audio: Cancel transfers when stopping the stream and do not queue more.
Seems to fix some KDLs caused at lower layers in the stack.
2019-07-16 00:29:02 -04:00
Augustin Cavalier
aefe4850cd USB: Rework the device speed detection code.
This is more in line with how OpenBSD and FreeBSD do this detection;
and should provide at least some support for USB 3.0+ hubs.

Potentially helps with #15001.

Change-Id: I313400b790b52fbca490c9fc8b721bedb97a64f9
2019-07-16 00:29:02 -04:00
Adrien Destugues
85965aba7a PVS-645: invalid/dangerous use of strncat.
Just don't use strncat.

Change-Id: I17efce87cf2ca7f621f98fb0c6679f48f631e98b
Reviewed-on: https://review.haiku-os.org/c/1595
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-16 00:26:41 +00:00
Adrien Destugues
0df9e45c20 Use explicit_bzero where it makes sense
PVS studio new report, warning type V597

Change-Id: Icd85aadf3ffc587806f9a24d224d0a369d4ce0e0
Reviewed-on: https://review.haiku-os.org/c/1594
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-16 00:26:41 +00:00
Humdinger
729709ba87 HaikuDepot: Improved translatability using BStringFormat
The string "(%count% more to download)" is sensitive to
different plural forms in other languages. For example, in
German one could have:
	"1 weiterer Download" and
	"12 weitere Downloads"

Change-Id: I3ab98cca6ae5066f7558e9ce22c97b6c37ec4a9c
Reviewed-on: https://review.haiku-os.org/c/1593
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-16 00:25:53 +00:00
Autocomitter
c383ef3240 Update translations from Pootle 2019-07-15 01:02:37 +00:00
Augustin Cavalier
d5aa7f00a2 usb_audio: Stop before reallocating buffers and add more error checks.
Also print strerror() for SetGlobalFormat.
2019-07-14 16:31:02 -04:00
Augustin Cavalier
553ff67585 XHCI: Print errors when transfers have non-success completion codes. 2019-07-14 14:37:00 -04:00
Augustin Cavalier
9cd2907d68 XHCI: Trace an error when we receive command events for unknown commands.
This revealed that StopEndpoint commands on QEMU were returning ...
after the semaphore timeout was already hit. Now to figure out
why that is the case...
2019-07-14 14:31:07 -04:00
Augustin Cavalier
60f15f5aa2 XHCI: Turn failure to stop the endpoint into a TRACE_ERROR. 2019-07-14 14:28:24 -04:00
Augustin Cavalier
c8375b0017 XHCI: Tweak priorities a bit more.
Put the EventThread as URGENT_PRIORITY and the downstream FinishThread
as URGENT - 1. Hopefully this will serve as a better hint to the
scheduler as to what we want to occur here.
2019-07-14 14:27:30 -04: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
b281541f9a usb_audio: Map the buffer area as B_READ_AREA/B_WRITE_AREA.
The calling userland process needs to be able to access it.
2019-07-13 23:43:14 -04:00
Augustin Cavalier
4a6a2fbfda XHCI: Increase priorities of the event and finish threads.
The "event" thread is what is woken up after interrupts, and
the "finish" thread handles the results of the "event" thread,
so prioritize them accordingly. Probably increases responsiveness
of USB input and disk devices visibly on heavily loaded systems.
2019-07-13 23:18:23 -04:00
Augustin Cavalier
f1e99f1667 XHCI: Use PRI to appease GCC2. 2019-07-13 22:59:14 -04:00
Augustin Cavalier
b3c896af1b multi_audio_test: Continue if getting buffers failed.
Don't try and read the buffers anyway, that'll lead to a page fault.
2019-07-13 22:34:54 -04:00
Augustin Cavalier
d5a29ba97c listusb: Do not try to print the port speed.
The USB3 specification changed the meaning of this field, and
it means different things depending on whether a USB 2 or 3
device is attached, so just don't print it.

Fixes listusb saying "Fullspeed" for USB3 devices. The per-device
information already prints what USB version and protocol the
device is operating on, so this was redundant anyway.
2019-07-13 19:37:19 -04:00
Augustin Cavalier
1bccd6b2f7 XHCI: Always trace non-standard port speeds. 2019-07-13 19:37:19 -04:00
Augustin Cavalier
6e2bbbb162 USB: Rename USB_SPEED_SUPER to USB_SPEED_SUPERSPEED.
For consistency's sake with the others.
2019-07-13 19:37:19 -04:00
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