bug-hurd
[Top][All Lists]
Advanced

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

Re: [RFC PATCH glic] hurd: Add CLOCK_MONOTONIC case in clock_gettime()


From: Sergey Bugaev
Subject: Re: [RFC PATCH glic] hurd: Add CLOCK_MONOTONIC case in clock_gettime()
Date: Fri, 3 Jan 2025 09:22:42 +0300

On Fri, Jan 3, 2025 at 5:32 AM Zhaoming Luo <zhmingluo@163.com> wrote:
> > in the latter case, you should get MIG_BAD_ID from the kernel, so you
> > can detect that.
> What's the best way to handle the MIG_BAD_ID case. I tried perror(NULL)
> but it gave my output '(ipc/mig) bad request message ID'. To be honest I
> don't think it's a very useful output. Is there a better option?

MIG_BAD_ID (in response to host_get_uptime64) means the version of
Mach in use doesn't have your work on the monotonic clock. So you
should return an appropriate Unix error, which according to POSIX
would be "EINVAL: The clock_id argument does not specify a known
clock". So either:

if (err == MIG_BAD_ID)
  {
    /* Not supported by the running kernel.  */
    errno = EINVAL;
    return -1;
  }

or you could just 'break;' out of the switch as if nothing happened,
and have the default case below do the same for you.

Sergey



reply via email to

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