[gccsdk] Syslog: DoggySoft vs. Unix

Graham Shaw gdshaw at sagitta.demon.co.uk
Thu May 24 13:22:52 PDT 2007


In article <84dfa9e74e.ajw498 at caramel.cp15.org>,
   Alex Waugh <alex at alexwaugh.com> wrote:
> Adam <lists at snowstone.org.uk> wrote:

> > Hi All,
> > 
> > Having been reading Graham Shaw's new book on UnixLib, I've been
> > fiddling with the GCC implimentation of syslog (in the past I've used
> > the RISC OS syslog SWIs). How are the different priority schemes
> > rationalised? For instance, the DoggySoft help file says:
> > 
> > Is there some way of rationalising the two which I've missed, or am I
> > just going about things the wrong way?

> The syslog code in UnixLib is derived from the BSD code, and so uses the
> same priorities as BSD. This limits the number of priorities available.

As I see it there are three ways these schemes could reasonably be
rationalised:

1. The UnixLib constants could be changed.

>From my (admittedly brief) skim through the POSIX spec I can't see
anything that would prevent this.  You need to be able to OR the severity
and facility to obtain the priority, but an int is wide enough to
accommodate both.

OTOH, 'unusual' interpretations of the POSIX spec do carry some risk (and
it is a fairly safe bet that someone, somewhere has tried to store the
priority in a char).

2. The conventions for the RISC OS module could be changed.

Making retrospective changes to a module API is not to be undertaken
lightly, and it would be necessary to achieve a platform-wide consensus
which is always difficult.

OTOH, I would not be totally surprised if the majority of SysLog-using
programs are ports that work through UnixLib, in which case it could be
argued that we would merely be formalising a change that to a large extent
has already happened.

(Or, to put this another way, an argument against changing module API on
these grounds certainly can't be used to defend the status quo.)

3. UnixLib could automatically convert BSD severities into RISC OS
severities before logging the message.

This would be very easy to do technically.  The main drawback is the
potential for confusion: seeing a different value appear in the logfile
from the one you used in the program would certainly violate the
'principle of least surprise'.

My view: I don't have one, except to say that any of the above would be
better than the current situation (where the two different conventions are
mixed).

-- 
Graham Shaw (http://www.sagitta.demon.co.uk/graham/)
The RISC OS Packaging Project (http://www.riscpkg.org/)
The RISC OS Toolkit (http://rtk.riscos.org.uk/)




More information about the gcc mailing list