#
9708b080 |
| 22-Nov-2024 |
Augustin Cavalier <waddlesplash@gmail.com> |
KPath: Use a default buffer size of B_PATH_NAME_LENGTH without + 1.
B_PATH_NAME_LENGTH == PATH_MAX, and PATH_MAX is inclusive of the final NULL terminator, so we don't need a + 1 here.
The original
KPath: Use a default buffer size of B_PATH_NAME_LENGTH without + 1.
B_PATH_NAME_LENGTH == PATH_MAX, and PATH_MAX is inclusive of the final NULL terminator, so we don't need a + 1 here.
The original KPath default was to not use + 1, but that was changed in 42e3c6f97874f37701385e7027c77e4366d7c450 due to all the consumers that did.
But all those consumers are wrong, it appears; they should just be using the default length instead. So now we do that.
show more ...
|
#
90bf90fa |
| 11-Feb-2020 |
waddlesplash <waddlesplash@gmail.com> |
kernel: Move memset of KPath buffer to after NULL check.
|
#
d29d80eb |
| 09-Feb-2020 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel: Initialize allocated KPath buffers to 0.
KPaths are most commonly used in the VFS syscall paths, and so they are typically user_memcpy'd to/from userland. In the "to" case this is not really
kernel: Initialize allocated KPath buffers to 0.
KPaths are most commonly used in the VFS syscall paths, and so they are typically user_memcpy'd to/from userland. In the "to" case this is not really necessary (but it should be so small of a performance difference as to not matter), but in the "from" case, we must always clear the buffer we received from the allocator, so as not to leak information to userland.
Part of #14961.
show more ...
|
#
42e3c6f9 |
| 11-Jul-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
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
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
show more ...
|
#
a07f133e |
| 17-Dec-2018 |
Augustin Cavalier <waddlesplash@gmail.com> |
KPath: Prevent setting a KPath to itself causing use-after-free.
SetTo frees the buffer before setting it to the new one, but if KPath sets itself to ... itself, then it will of course try to access
KPath: Prevent setting a KPath to itself causing use-after-free.
SetTo frees the buffer before setting it to the new one, but if KPath sets itself to ... itself, then it will of course try to access the buffer again.
Spotted by clang-analyzer (amidst quite a few false positives, so this doesn't seem like an especially good rabbit hole to go down right now.)
show more ...
|
#
655aae6a |
| 30-Apr-2017 |
Axel Dörfler <axeld@pinc-software.de> |
KPathTest: Fix build for GCC 5.
* Also fixed a warning in KPath. * Sorry, again!
|
#
e9843da3 |
| 30-Apr-2017 |
Axel Dörfler <axeld@pinc-software.de> |
KPath: Added LAZY_ALLOC flag.
* This allows KPath to not allocate a buffer when initialized without path. * Added test cases for this. * Added test for LockBuffer(). * Enhanced tests to allow buil
KPath: Added LAZY_ALLOC flag.
* This allows KPath to not allocate a buffer when initialized without path. * Added test cases for this. * Added test for LockBuffer(). * Enhanced tests to allow building them in debug mode. * Moved calling vfs_normalize_path() into own private method. * Improved error codes; B_NO_MEMORY is now only returned if the allocation actually failed. * If used with LAZY_ALLOC, Path() and LockBuffer() are now allowed to return a NULL path.
show more ...
|
#
f94671c3 |
| 30-Apr-2017 |
Axel Dörfler <axeld@pinc-software.de> |
KPath.Adopt(): Fixed path length.
* Issue was hidden due to inappropriate test values; changed test to uncover it.
|
#
eac83fb3 |
| 30-Apr-2017 |
Axel Dörfler <axeld@pinc-software.de> |
KPath: Replaced booleans with flags field.
* No functional change intended; I chose the flags in a way that it should still work even if I missed a reference.
|
#
e1b4aed0 |
| 30-Apr-2017 |
Axel Dörfler <axeld@pinc-software.de> |
KPath: Fixed Normalize() return code, changed Leaf().
* Normalize() now returns the error code that vfs_normalize_path() returns. * Leaf() now returns "" instead of "/" for the root. It's not used
KPath: Fixed Normalize() return code, changed Leaf().
* Normalize() now returns the error code that vfs_normalize_path() returns. * Leaf() now returns "" instead of "/" for the root. It's not used outside of KPath. * Adapted RemoveLeaf() to deal with this correctly. * "KPath = string" no longer changes the buffer size. * Added missing operator tests for =, ==, and !=.
show more ...
|
#
4be51875 |
| 29-Apr-2017 |
Axel Dörfler <axeld@pinc-software.de> |
KPath.Adopt() fixed incorrect path/buffer length.
* The other object was left in an inconsistent state. * This lets the unit test for Adopt() pass.
|
#
3582d4fe |
| 29-Apr-2017 |
Axel Dörfler <axeld@pinc-software.de> |
Minor style cleanup.
|
#
25a7b01d |
| 05-May-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Merge branch 'master' into package-management
Additional changes: * Add src/system/kernel/lib/zlib, which builds a kernel version of zlib, needed by packagefs. * BuildFeatures: Add a build feature
Merge branch 'master' into package-management
Additional changes: * Add src/system/kernel/lib/zlib, which builds a kernel version of zlib, needed by packagefs. * BuildFeatures: Add a build feature "gcc2" to allow for easier checks. * Referenceable.cpp: Include <OS.h> instead of <debugger.h>. The latter is not needed and prevents building for the build platform. * zlib/zutil.h: Fix gcc 2 build. We really should use the external package instead.
Conflicts: .gitignore build/jam/BuildSetup build/jam/FileRules build/jam/FloppyBootImage build/jam/HaikuImage build/jam/ImageRules build/jam/KernelRules build/jam/NetBootArchive build/jam/OptionalBuildFeatures build/jam/OptionalLibPackages build/jam/OptionalPackageDependencies build/jam/OptionalPackages build/scripts/build_haiku_image configure data/bin/installoptionalpackage data/system/boot/Bootscript headers/os/app/Message.h headers/os/package/PackageInfo.h headers/os/package/PackageInfoAttributes.h headers/os/package/PackageInfoSet.h headers/os/package/PackageRoster.h headers/os/package/PackageVersion.h headers/os/package/hpkg/PackageInfoAttributeValue.h headers/os/storage/FindDirectory.h headers/os/storage/Node.h headers/os/support/StringList.h headers/private/system/directories.h src/add-ons/kernel/drivers/audio/ac97/es1370/Jamfile src/add-ons/kernel/file_systems/packagefs/AttributeIndex.cpp src/add-ons/kernel/file_systems/packagefs/Jamfile src/add-ons/kernel/file_systems/packagefs/Package.cpp src/add-ons/kernel/file_systems/packagefs/Package.h src/add-ons/kernel/file_systems/packagefs/PackageDomain.cpp src/add-ons/kernel/file_systems/packagefs/PackageDomain.h src/add-ons/kernel/file_systems/packagefs/PackageFSRoot.cpp src/add-ons/kernel/file_systems/packagefs/PackageLinkDirectory.cpp src/add-ons/kernel/file_systems/packagefs/PackageLinkDirectory.h src/add-ons/kernel/file_systems/packagefs/PackageLinkSymlink.cpp src/add-ons/kernel/file_systems/packagefs/PackageLinkSymlink.h src/add-ons/kernel/file_systems/packagefs/PackageLinksDirectory.cpp src/add-ons/kernel/file_systems/packagefs/PackageNode.h src/add-ons/kernel/file_systems/packagefs/ResolvableFamily.cpp src/add-ons/kernel/file_systems/packagefs/Version.cpp src/add-ons/kernel/file_systems/packagefs/Version.h src/add-ons/kernel/file_systems/packagefs/Volume.cpp src/add-ons/kernel/file_systems/packagefs/Volume.h src/add-ons/kernel/file_systems/packagefs/kernel_interface.cpp src/add-ons/kernel/file_systems/userlandfs/shared/driver_settings.c src/apps/deskbar/BarApp.cpp src/apps/deskbar/BarMenuBar.cpp src/apps/deskbar/BarMenuBar.h src/apps/deskbar/BarView.cpp src/apps/deskbar/BarView.h src/apps/deskbar/BarWindow.cpp src/apps/deskbar/BarWindow.h src/apps/deskbar/DeskbarMenu.cpp src/apps/deskbar/DeskbarMenu.h src/apps/deskbar/DeskbarUtils.cpp src/apps/deskbar/DeskbarUtils.h src/apps/deskbar/ExpandoMenuBar.cpp src/apps/deskbar/ExpandoMenuBar.h src/apps/deskbar/TeamMenu.cpp src/apps/processcontroller/ProcessController.cpp src/apps/remotedesktop/RemoteDesktop.cpp src/bin/bash/config-top.h src/bin/finddir.c src/bin/package/Jamfile src/bin/package/command_add.cpp src/bin/package/command_create.cpp src/bin/package/command_list.cpp src/bin/package_repo/command_list.cpp src/bin/pkgman/command_refresh.cpp src/build/libbe/support/Jamfile src/build/libpackage/Jamfile src/build/libroot/Jamfile src/build/libroot/fs.cpp src/build/libroot/remapped_functions.h src/kits/locale/MutableLocaleRoster.cpp src/kits/opengl/GLRendererRoster.cpp src/kits/package/PackageInfo.cpp src/kits/package/PackageInfoSet.cpp src/kits/package/PackageRoster.cpp src/kits/package/PackageVersion.cpp src/kits/package/RepositoryCache.cpp src/kits/package/hpkg/PackageWriterImpl.cpp src/kits/package/hpkg/ReaderImplBase.cpp src/kits/package/hpkg/WriterImplBase.cpp src/kits/print/PrintTransport.cpp src/kits/print/Printer.cpp src/kits/screensaver/ScreenSaverRunner.cpp src/kits/support/StringList.cpp src/kits/tracker/ContainerWindow.cpp src/kits/tracker/DeskWindow.cpp src/kits/tracker/PoseView.cpp src/libs/print/libprint/Transport.cpp src/preferences/printers/AddPrinterDialog.cpp src/preferences/screensaver/ScreenSaverWindow.cpp src/servers/debug/DebugServer.cpp src/servers/input/AddOnManager.cpp src/servers/media_addon/MediaAddonServer.cpp src/system/boot/Jamfile src/system/boot/loader/Jamfile src/system/boot/loader/loader.cpp src/system/boot/loader/vfs.cpp src/system/kernel/fs/vfs.cpp src/system/kernel/fs/vfs_boot.cpp src/system/libroot/os/find_directory.cpp src/system/runtime_loader/runtime_loader.cpp src/tools/package/Jamfile
show more ...
|
#
11c9f9a1 |
| 18-Nov-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Merge branch 'master' into x86_64
Conflicts: build/jam/FloppyBootImage build/jam/OptionalBuildFeatures build/jam/OptionalPackages headers/private/shared/cpu_type.h src/bin/ps.c src/bin/sysinfo
Merge branch 'master' into x86_64
Conflicts: build/jam/FloppyBootImage build/jam/OptionalBuildFeatures build/jam/OptionalPackages headers/private/shared/cpu_type.h src/bin/ps.c src/bin/sysinfo.cpp src/kits/tracker/PoseView.cpp src/preferences/appearance/DecorSettingsView.cpp src/preferences/virtualmemory/Settings.cpp src/servers/input/AddOnManager.cpp src/servers/input/InputServer.cpp src/servers/input/InputServerMethod.cpp src/system/boot/Jamfile src/system/boot/platform/raspberrypi_arm/mmu.cpp src/system/boot/platform/u-boot/arch/arm/Jamfile src/system/kernel/arch/x86/arch_cpu.cpp src/system/kernel/arch/x86/arch_thread.cpp src/system/kernel/cache/block_cache.cpp src/system/kernel/vm/VMAnonymousCache.cpp
show more ...
|
#
17c270bd |
| 08-Nov-2012 |
François Revol <revol@free.fr> |
Merge branch 'master' into sam460ex
|
#
9abf4591 |
| 07-Nov-2012 |
czeidler <haiku@clemens-zeidler.de> |
Ok there are some more, thanks Rene.
|
#
71d45a0f |
| 07-Nov-2012 |
czeidler <haiku@clemens-zeidler.de> |
Coding style.
|
#
bd5bd2c6 |
| 27-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Normalize() didn't update fPathLength correctly. This did probably screw up module image paths in module_init_post_boot_device(). Not sure whether it also could cause #2776.
git-svn-id: file:///srv
Normalize() didn't update fPathLength correctly. This did probably screw up module image paths in module_init_post_boot_device(). Not sure whether it also could cause #2776.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27760 a95241bf-73f2-0310-859d-f6bbb57e9c96
show more ...
|
#
e8d3eff9 |
| 26-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* vfs_normalize_path() and _user_normalize_path() use a common helper function (normalize_path()), now. There was some code duplication before. * Added "bool traverseLink" parameter to vfs_normal
* vfs_normalize_path() and _user_normalize_path() use a common helper function (normalize_path()), now. There was some code duplication before. * Added "bool traverseLink" parameter to vfs_normalize_path(). When true and the leaf component is a symlink, it will be resolved. * KPath: - Added similar leaf link traversal parameter to SetTo() and SetPath(). - Added Normalize(). - Added DetachBuffer(), which returns the object's current buffer and unsets itself.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27751 a95241bf-73f2-0310-859d-f6bbb57e9c96
show more ...
|
#
ea26d9f0 |
| 15-May-2008 |
Stephan Aßmus <superstippi@gmx.de> |
Honour 80 char/line limit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25508 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
56bbbbc9 |
| 08-May-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Added Adopt() method that steals the other path's buffer. * Fixed operator=(): the second argument of SetTo() is a boolean (normalize), not the length of the buffer.
git-svn-id: file:///srv/svn
* Added Adopt() method that steals the other path's buffer. * Fixed operator=(): the second argument of SetTo() is a boolean (normalize), not the length of the buffer.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25382 a95241bf-73f2-0310-859d-f6bbb57e9c96
show more ...
|
#
23a60f42 |
| 08-May-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Reordered includes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25376 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5fce1ce7 |
| 07-May-2008 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
The second parameter of KPath::SetTo() is a bool, not a size_t. Reported by Marc Flerackers. Thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25338 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3532662e |
| 15-Jul-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added RemoveLeaf() leaf method. Very handy for recursive directory iteration code using a single KPath object.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21606 a95241bf-73f2-0310-859d-f6bb
Added RemoveLeaf() leaf method. Very handy for recursive directory iteration code using a single KPath object.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21606 a95241bf-73f2-0310-859d-f6bbb57e9c96
show more ...
|
#
0d4c16e0 |
| 05-Mar-2006 |
Axel Dörfler <axeld@pinc-software.de> |
* Reduced the stack usage of most of the I/O paths - there were several places that put one or more full paths on the stack before, which could cause some problems under certain conditions. * Cle
* Reduced the stack usage of most of the I/O paths - there were several places that put one or more full paths on the stack before, which could cause some problems under certain conditions. * Cleaned up KPath, ie. use size_t instead of int32 where appropriate, added license.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16585 a95241bf-73f2-0310-859d-f6bbb57e9c96
show more ...
|