64 bit maths and privileges

Peter Naulls peter at chocky.org
Sat Aug 31 05:56:56 PDT 2002

In message <Pine.LNX.4.21.0208311305480.32291-100000 at chiark.greenend.org.uk>
          Theo Markettos <theo at markettos.org.uk> wrote:

> Firstly, I need to do some shuffling around with 5 byte times (adds,
> subtracts and multiplies).  Rather than attempt to do this manually, is
> there any 64 bit integer support in UnixLib?  I could use 'long long', but
> that would break Norcroft compatibility.  It would be much easier to do it
> in assembler, yet it would be nicer if there was a library of such
> functions, rather than handcrafting them for each case required.  Does
> such a thing exist, or should I write one?

There's no such thing in Unixlib.  There are a variety of 64-bit
libraries out there, but importing one just for that function does seem
overkill.   I suggest the easiest thing is to use long long, and have
that not defined for a Norcroft build.  This may or may not be

> Secondly, currently settimeofday() returns EPERM, as it should do if a
> non-root user was calling it.  Are there any plans for UnixLib to impose
> any security on programs using it - or shall I just allow them to go their
> potentially destructive way as if logged in as root?

There's no effective way to do this, really.  If a program wants to
change the time, then I don't see any real issues (as long as it's a
clock or something :-)

 Peter Naulls - peter at chocky.org
 Homepage                     -  http://www.chocky.org/
 RISC OS C Programming        -  http://www.riscos.info/
 Unix Programs on RISC OS     -  http://www.chocky.org/unix/
Drobe - http://www.drobe.co.uk/ - Quality, Regular RISC OS News and Views

More information about the gcc mailing list