Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Oct 2010 22:57:39 -0700
From:      Devin Teske <dteske@vicor.com>
To:        Garrett Cooper <gcooper@FreeBSD.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: sysrc -- a sysctl(8)-like utility for managing /etc/rc.conf et. al.
Message-ID:  <6BB51EB3-E1F5-46FB-8C24-4351FAC320DA@vicor.com>
In-Reply-To: <AANLkTi=FGuRF1sOQCNG-JT28tPibuNjQHv4e_-mkgYJg@mail.gmail.com>
References:  <1286397912.27308.40.camel@localhost.localdomain> <AANLkTikoohMo5ng-RM3tctTH__P6cqhQpm=FPhSE9mMg@mail.gmail.com> <51B4504F-5AA4-47C5-BF23-FA51DE5BC8C8@vicor.com> <AANLkTim=BLkd229vdEst8U0ugpq3UsHPxjZZp2qaJxH-@mail.gmail.com> <238E0B24-AA12-4684-9651-84DA665BE893@vicor.com> <AANLkTinCxd9aDbr7GifEdeOpdcW4d%2B4ZcQWF0TK_mC=8@mail.gmail.com> <9BBDE5CB-F755-44DB-915A-1C90B9DE3482@vicor.com> <AANLkTi=FGuRF1sOQCNG-JT28tPibuNjQHv4e_-mkgYJg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Oct 10, 2010, at 5:15 PM, Garrett Cooper wrote:

> On Sun, Oct 10, 2010 at 3:49 PM, Devin Teske <dteske@vicor.com> wrote:
>=20
>> Hmmm, sysctl(9) is lock-free, which might imply that both sysctl(8) =
and
>> sysctl(3) are also lock-free, and proposed sysrc(8) is lock-free, so =
might
>> that imply that the atomicity tests would fare the same for all of =
the
>> above?
>=20
> .../sys/kern/kern_sysctl.c says otherwise (look for the comment above
> the sysctllock declaration). The locking is just hidden from the
> developer/end-user.
>=20
>> Here's what I'm thinking we should do to solve this...
>> Since the atomicity of the write operation is anything-but singular
>> (meaning, it takes incrementally larger blocks of time to write =
larger
>> amounts of data, increasing the risk-curve for failure to occur by =
two
>> operations coinciding at the same time -- I'm truly sorry, my wife =
has me
>> helping her with her business statistics II course, forgive me, I'll
>> clarify).
>=20
> ...
>=20
> I think I said it before, but yes.. I completely agree with the
> atomicity approach. I prefer `mktemp /tmp/XXXXXX' because it would do
> nothing more than potentially clutter up /tmp if the operation fails
> for whatever reason (instead of /etc), and it's less of a security
> concern. I suppose that's less of a problem though, because if someone
> has the ability to write to /etc, then all bets are off, but the
> clutter part is a bit annoying..

I checked out mktemp(1)... just what the doctor ordered for preventing =
race-conditions. And it's in the base FreeBSD distribution even back as =
far as FreeBSD-4.11 (likely much further; but that's what I checked).



> ...
>=20
> I would just hold to this statement in /etc/defaults/rc.conf:
>=20
> # All arguments must be in double or single quotes.
>=20
> and also state:
>=20
> "this tool functions based on the idea that the rc.conf files are
> simply written, and can be evaluated as standalone configuration data.
> Anything that doesn't conform to these requirements isn't guaranteed
> to work with the tool in all cases"

Simpler is indeed better ^_^


>=20
> Thanks!
> -Garrett
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to =
"freebsd-hackers-unsubscribe@freebsd.org"

--
Cheers,
Devin Teske

-> CONTACT INFORMATION <-
Business Solutions Consultant II
FIS - fisglobal.com
510-735-5650 Mobile
510-621-2038 Office
510-621-2020 Office Fax
909-477-4578 Home/Fax
devin.teske@fisglobal.com

-> LEGAL DISCLAIMER <-
This message  contains confidential  and proprietary  information
of the sender,  and is intended only for the person(s) to whom it
is addressed. Any use, distribution, copying or disclosure by any
other person  is strictly prohibited.  If you have  received this
message in error,  please notify  the e-mail sender  immediately,
and delete the original message without making a copy.

-> FUN STUFF <-
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GAT/CS d(+) s: a- C++(++++) UB++++$ P++(++++) L++(++++) !E--- W++ N? o? =
K- w O
M+ V- PS+ PE Y+ PGP- t(+) 5? X+(++) R>++ tv(+) b+(++) DI+(++) D(+) G+>++ =
e>+ h
r>++ y+=20
------END GEEK CODE BLOCK------
http://www.geekcode.com/

-> END TRANSMISSION <-




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6BB51EB3-E1F5-46FB-8C24-4351FAC320DA>