bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Server writing: observations and questions


From: Neal H Walfield
Subject: Re: Server writing: observations and questions
Date: Fri, 5 Jan 2001 18:03:06 -0500
User-agent: Mutt/1.2.5i

On Wed, Jan 03, 2001 at 01:24:20AM -0500, Neal H Walfield wrote:
> > > When implementing the client, the expected results can be obtained from
> > > the server, however, if an invalid port, i.e. server, is used, perror
> > > cannot decode errno:
> > 
> > Ah, yes.  Those are the MIG_* error codes, which aren't defined in the
> > normal way using mach/error.h's format.  You can fix strerror in libc.
> 
> What is the correct way to do this?  I have taken a look at libc and
> found a bunch of err_*.sub files.  Is there some documentation on how to
> go about adding to these?

For those interested, I found glibc/mach/mach/error.h to be very helpful
in my endeavors.  What I discovered however, is that the error strings
that I was looking for are, in fact, defined.  I am making calls to
mach_msg, which does not set errno.  What I was doing initially was:

  err = mach_msg (...);
  if (err)
    {
      perror ("mach_msg");
      return 1;
    }

Obviously wrong.  Given the symantics of mach_msg, what is the correct
way to handle this?

  err = mach_msg (...);
  if (err)
    {
      fprintf (stderr, "mach_msg: %s\n", strerror (err));
      return 1;
    }

Or maybe assigning or errno?

I have not seen this enough to know what the Right Way is.

Thanks.

Attachment: pgpttUXSr8XO8.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]