Re: svn commit: r367813 - head/lib/libutil

2020-11-25 Thread Stefan Esser
Am 19.11.20 um 00:20 schrieb Brooks Davis: On Thu, Nov 19, 2020 at 12:05:51AM +0100, Stefan Esser wrote: Am 18.11.20 um 23:14 schrieb Jessica Clarke: Why not? There could easily be code out there calling getenv in a multi-threaded context so this is inadequate as a replacement. Yes it's

Re: svn commit: r367813 - head/lib/libutil

2020-11-25 Thread Stefan Esser
Am 19.11.20 um 01:37 schrieb Mateusz Guzik: On 11/19/20, Stefan Esser wrote: [...] I just wanted to provide an implementation of this functionality to be used in a number of programs where other developers had expressed interest in such a feature (and one of these programs has been worked on

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Mateusz Guzik
On 11/19/20, Stefan Esser wrote: > Am 18.11.20 um 23:39 schrieb Jessica Clarke: >> On 18 Nov 2020, at 22:32, Stefan Esser wrote: >>> >>> Am 18.11.20 um 22:40 schrieb Mateusz Guzik: > +{ > + static const int localbase_oid[2] = {CTL_USER, USER_LOCALBASE}; There is no use for this to

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Stefan Esser
Am 18.11.20 um 23:39 schrieb Jessica Clarke: On 18 Nov 2020, at 22:32, Stefan Esser wrote: Am 18.11.20 um 22:40 schrieb Mateusz Guzik: +{ + static const int localbase_oid[2] = {CTL_USER, USER_LOCALBASE}; There is no use for this to be static. Why not? This makes it part of the

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Brooks Davis
On Thu, Nov 19, 2020 at 12:05:51AM +0100, Stefan Esser wrote: > Am 18.11.20 um 23:14 schrieb Jessica Clarke: > > On 18 Nov 2020, at 21:52, Stefan Esser wrote: > >> Am 18.11.20 um 22:15 schrieb Jessica Clarke: > >>> On 18 Nov 2020, at 19:44, Stefan E??er wrote: > +/* > +

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Stefan Esser
Am 18.11.20 um 23:14 schrieb Jessica Clarke: On 18 Nov 2020, at 21:52, Stefan Esser wrote: Am 18.11.20 um 22:15 schrieb Jessica Clarke: On 18 Nov 2020, at 19:44, Stefan Eßer wrote: + /* +* Check for some other thread already having +* set

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Jessica Clarke
On 18 Nov 2020, at 22:32, Stefan Esser wrote: > > Am 18.11.20 um 22:40 schrieb Mateusz Guzik: >>> +{ >>> + static const int localbase_oid[2] = {CTL_USER, USER_LOCALBASE}; >> There is no use for this to be static. > > Why not? This makes it part of the constant initialized data of > the

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Stefan Esser
Am 18.11.20 um 22:40 schrieb Mateusz Guzik: +{ + static const int localbase_oid[2] = {CTL_USER, USER_LOCALBASE}; There is no use for this to be static. Why not? This makes it part of the constant initialized data of the library, which is more efficient under run-time and memory space

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Jessica Clarke
On 18 Nov 2020, at 21:52, Stefan Esser wrote: > Am 18.11.20 um 22:15 schrieb Jessica Clarke: >> On 18 Nov 2020, at 19:44, Stefan Eßer wrote: >>> + /* >>> +* Check for some other thread already having >>> +* set localbase - this should use atomic ops. >>> +

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Stefan Esser
Am 18.11.20 um 22:27 schrieb Jessica Clarke: On 18 Nov 2020, at 21:15, Jessica Clarke wrote: On 18 Nov 2020, at 19:44, Stefan Eßer wrote: + /* +* Check for some other thread already having +* set localbase - this should use atomic ops. +

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Stefan Esser
Am 18.11.20 um 22:15 schrieb Jessica Clarke: On 18 Nov 2020, at 19:44, Stefan Eßer wrote: + /* +* Check for some other thread already having +* set localbase - this should use atomic ops. +* The amount of memory allocated above

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Jessica Clarke
On 18 Nov 2020, at 21:40, Mateusz Guzik wrote: > > On 11/18/20, Stefan Eßer wrote: >> Author: se >> Date: Wed Nov 18 19:44:30 2020 >> New Revision: 367813 >> URL: https://svnweb.freebsd.org/changeset/base/367813 >> >> Log: >> Add function getlocalbase() to libutil. >> >> This function

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Mateusz Guzik
On 11/18/20, Stefan Eßer wrote: > Author: se > Date: Wed Nov 18 19:44:30 2020 > New Revision: 367813 > URL: https://svnweb.freebsd.org/changeset/base/367813 > > Log: > Add function getlocalbase() to libutil. > > This function returns the path to the local software base directory, by >

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Jessica Clarke
On 18 Nov 2020, at 21:15, Jessica Clarke wrote: > > On 18 Nov 2020, at 19:44, Stefan Eßer wrote: >> +/* >> + * Check for some other thread already having >> + * set localbase - this should use atomic ops. >> + * The amount of memory allocated

Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Jessica Clarke
On 18 Nov 2020, at 19:44, Stefan Eßer wrote: > + /* > + * Check for some other thread already having > + * set localbase - this should use atomic ops. > + * The amount of memory allocated above may leak, > + * if a parallel update