History log of /haiku/src/system/libroot/os/driver_settings.cpp
Revision Date Author Comments
# 18f35e4e 07-May-2023 Murai Takashi <tmurai01@gmail.com>

libroot/os/driver_settings.cpp: fix memory leak

Fix leakage of memory allocated to 'text' when new_settings() fails
in load_driver_settings() at line 767.

Pointed out by Clang Static Analyzer.

Change-Id: I5888e2377c4da63040d5a66199f04aebd2034728
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6382
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 2770bfe8 09-Oct-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

driver_settings: use B_DEFINE_WEAK_ALIAS to define a weak alias


# af435dd1 09-Dec-2020 X512 <danger_mail@list.ru>

libroot: remove delete_driver_settings

It is not present in BeOS R5 and it just call unload_driver_settings.

Replace delete_driver_settings usages with unload_driver_settings.
Keep the symbol on x86 for binary compatibility.

Change-Id: I1382710e3a4cb5c65d1249ea0e5880891e6800e4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3485
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 4a1d8b1a 16-Jul-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

PVS V575: strange values passed to well known functions

Change-Id: Id6008d93777f860d0b341bcd012fe6f86c99cf35
Reviewed-on: https://review.haiku-os.org/c/1610
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>


# 1e6dd3fe 24-Apr-2015 Murai Takashi <tmurai01@gmail.com>

Fix GCC 5 maybe-uninitialized warnings.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

Fixes #12020


# 1736cb1d 14-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

driver_settings: fix allocating an empty settings

I misread the condition and broke this in 0687a01. Thanks to Axel for
reviewing!
* Refactor the code again to move all the error checking at the top of
the function, to make it easier to read.


# bcb793d3 14-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Fix driver_settings in kernel mode outside of drivers.

The API allows to create driver settings which are not added to the
global list, however those were left partially uninitialized, and there
was no way to cleanly delete them.

Tag such unattached settings with a ref_count of -1, and have
delete_driver_settings check for this and handle the case correctly.

Note: #10494 comment 2 says the settings for packagefs shouldn't be
added to the kernel driver settings list, which is why I went with this
solution. An alternative would be always using the list and the
reference counting, but I don't know what the consequences are.

Fixes #10494.


# 0687a01b 14-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

driver_settings: don't strdup(NULL)

* This is not allowed by strdup POSIX specs and GCC may use its builtin
strdup which doesn't check for it.
* also refactor parse_driver_settings_string to create the
settings_handle using settings_new, to reduce code duplication.


# 3aeed660 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# c7cb9b2f 17-Dec-2013 Jonathan Schleifer <js@webkeks.org>

delete_driver_settings.cpp: Get rid of the weak alias.

As weak aliases are not supported on OS X, this caused problems when
building Haiku on OS X, as this file is also used for the host tools.

Signed-off-by: Axel Dörfler <axeld@pinc-software.de>


# efe9df37 19-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

driver settings: Add load_driver_settings_file()

Allows loading an already opened driver settings file (by FD).


# cf09345c 19-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

driver settings: Remove dead load_driver_settings_from_path()

load_driver_settings() supports being passed an absolute path.


# de49e349 04-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add symbol versioning for find_directory()

Should already have been done back when the semantics for the
B_COMMON_*DIRECTORY constants was changed.

Currently old and new version behave the same. So this is just a
contingency measure ATM.


# 4b7e2196 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 81b45e48 29-Feb-2012 John Scipione <jscipione@gmail.com>

Fix build on Mac OS X 10.6 gcc2 and gcc4 and 10.7 gcc4 by adding some Mac OS X specific files that implement missing *at() functions.
Mac OS X 10.7 generates a gcc2 cross-compiler that fails when assigning NULL to a static method pointer so is still broken.
Added a weak attribute in driver_settings.cpp.
Move futimesat() from fs.cpp to fs_darwin.cpp since it is implimented on FreeBSD.
Implemented eaccess(), for the AT_EACCESS flag of faccessat()
Fix configure script to correctly detect case-sensitive file system


# 9d6e5fdb 29-Feb-2012 John Scipione <jscipione@gmail.com>

Fix build by adding some Mac OS X specific files that implement fs function missing on that OS. The functions are stubbed out currently and have not been implemented. However, it does build now. I also added a weak attribute in driver_settings.cpp that I have no idea what does but was necessary to fix the build.


# d2a423e4 29-Dec-2011 Philippe Saint-Pierre <stpere@gmail.com>

driver_settings: Replace type of bufferSize from size_t to ssize_t

At various locations, checks are made so that bufferSize is >= 0, which never
occurs. CID 4197.


# 37c83f4e 16-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the check for B_BUFFER_OVERFLOW more flexible.


# 323b6546 21-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Filtered flat import of Oliver's svn package management branch

Bring the changes that aren't package management related and the ones
that are but don't take effect as long as they are ignored by the build
system into the master.

Summary of changes:
* Introduce private header <directories.h> with constants for a good
deal of paths that should usually be retrieved via find_directory().
* Replace hard-coded paths by using find_directory() or the
<directories.h> constants (e.g. in drivers and the kernel).
* Add find_directory() constants needed for package management.
* Add __HAIKU_ABI_NAME and B_HAIKU_ABI_NAME macros.
* src/apps/deskbar: BeMenu.* -> DeskbarMenu.*,
DeskBarUtils.* -> DeskbarUtils.*
* Change deskbar menu settings directory from ~/config/be to
~/config/settings/deskbar.
* Other smaller cleanups, changes, and fixes.


# b795c9ce 16-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the check for B_BUFFER_OVERFLOW more flexible.


# 3dfd9cb9 16-Jun-2011 Oliver Tappe <zooey@hirschkaefer.de>

Flat commit of all changes from package-management branch in svn


# a5270963 03-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed put_parameter() return type to void. The value was always true and
never checked anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40094 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec349ca3 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

If there is an error opening the file (negative id) there is no need for close. CID 3474.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39975 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 85db3873 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

find_directory.c, driver_settings.c: Converted to C++.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37256 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1736cb1d596076b3f727bbe501b15be4ada7b769 14-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

driver_settings: fix allocating an empty settings

I misread the condition and broke this in 0687a01. Thanks to Axel for
reviewing!
* Refactor the code again to move all the error checking at the top of
the function, to make it easier to read.


# bcb793d37b1e20d0329ea5bafa5095198fa8f7d2 14-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Fix driver_settings in kernel mode outside of drivers.

The API allows to create driver settings which are not added to the
global list, however those were left partially uninitialized, and there
was no way to cleanly delete them.

Tag such unattached settings with a ref_count of -1, and have
delete_driver_settings check for this and handle the case correctly.

Note: #10494 comment 2 says the settings for packagefs shouldn't be
added to the kernel driver settings list, which is why I went with this
solution. An alternative would be always using the list and the
reference counting, but I don't know what the consequences are.

Fixes #10494.


# 0687a01b53e495083e03aaa50bb223269575b11c 14-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

driver_settings: don't strdup(NULL)

* This is not allowed by strdup POSIX specs and GCC may use its builtin
strdup which doesn't check for it.
* also refactor parse_driver_settings_string to create the
settings_handle using settings_new, to reduce code duplication.


# 3aeed6607cd07762c0e709633c012b3a632dbad9 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# c7cb9b2f595838104e085124b79cd7983aa11d34 17-Dec-2013 Jonathan Schleifer <js@webkeks.org>

delete_driver_settings.cpp: Get rid of the weak alias.

As weak aliases are not supported on OS X, this caused problems when
building Haiku on OS X, as this file is also used for the host tools.

Signed-off-by: Axel Dörfler <axeld@pinc-software.de>


# efe9df37915b8fe394c273e13042681d7015e682 19-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

driver settings: Add load_driver_settings_file()

Allows loading an already opened driver settings file (by FD).


# cf09345cf599db2bfa9482211e6479ba8b2b1e6b 19-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

driver settings: Remove dead load_driver_settings_from_path()

load_driver_settings() supports being passed an absolute path.


# de49e34927ea27d282f6e85c866db5073df379af 04-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add symbol versioning for find_directory()

Should already have been done back when the semantics for the
B_COMMON_*DIRECTORY constants was changed.

Currently old and new version behave the same. So this is just a
contingency measure ATM.


# 4b7e219688450694efc9d1890f83f816758c16d3 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 81b45e484a2f71f1235d48ab743c20357f070593 29-Feb-2012 John Scipione <jscipione@gmail.com>

Fix build on Mac OS X 10.6 gcc2 and gcc4 and 10.7 gcc4 by adding some Mac OS X specific files that implement missing *at() functions.
Mac OS X 10.7 generates a gcc2 cross-compiler that fails when assigning NULL to a static method pointer so is still broken.
Added a weak attribute in driver_settings.cpp.
Move futimesat() from fs.cpp to fs_darwin.cpp since it is implimented on FreeBSD.
Implemented eaccess(), for the AT_EACCESS flag of faccessat()
Fix configure script to correctly detect case-sensitive file system


# 9d6e5fdb651066357cf4e24f10c42238ad08d0b7 29-Feb-2012 John Scipione <jscipione@gmail.com>

Fix build by adding some Mac OS X specific files that implement fs function missing on that OS. The functions are stubbed out currently and have not been implemented. However, it does build now. I also added a weak attribute in driver_settings.cpp that I have no idea what does but was necessary to fix the build.


# d2a423e4993cc8d6264126bad89d9ee65ea075e0 29-Dec-2011 Philippe Saint-Pierre <stpere@gmail.com>

driver_settings: Replace type of bufferSize from size_t to ssize_t

At various locations, checks are made so that bufferSize is >= 0, which never
occurs. CID 4197.


# 37c83f4e8f0fa07ed8aba7d581fba6e5240f6533 16-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the check for B_BUFFER_OVERFLOW more flexible.


# 323b65468e5836bb27a5e373b14027d902349437 21-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Filtered flat import of Oliver's svn package management branch

Bring the changes that aren't package management related and the ones
that are but don't take effect as long as they are ignored by the build
system into the master.

Summary of changes:
* Introduce private header <directories.h> with constants for a good
deal of paths that should usually be retrieved via find_directory().
* Replace hard-coded paths by using find_directory() or the
<directories.h> constants (e.g. in drivers and the kernel).
* Add find_directory() constants needed for package management.
* Add __HAIKU_ABI_NAME and B_HAIKU_ABI_NAME macros.
* src/apps/deskbar: BeMenu.* -> DeskbarMenu.*,
DeskBarUtils.* -> DeskbarUtils.*
* Change deskbar menu settings directory from ~/config/be to
~/config/settings/deskbar.
* Other smaller cleanups, changes, and fixes.


# b795c9ce72dbd063cd30fcc051c7044153725d9f 16-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the check for B_BUFFER_OVERFLOW more flexible.


# 3dfd9cb95ce45f59160d50975210bc55e3fc0709 16-Jun-2011 Oliver Tappe <zooey@hirschkaefer.de>

Flat commit of all changes from package-management branch in svn


# a5270963e56808aa3b9efefe513f2de4a51b6ef8 03-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed put_parameter() return type to void. The value was always true and
never checked anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40094 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ec349ca3bb25180a0604c48f66b83dd3f8329f57 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

If there is an error opening the file (negative id) there is no need for close. CID 3474.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39975 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 85db3873a90753e45b82e249fb1030768610c390 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

find_directory.c, driver_settings.c: Converted to C++.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37256 a95241bf-73f2-0310-859d-f6bbb57e9c96