Re: RFC: API change for sema_timedwait

From: John Baldwin (jhb_at_FreeBSD.org)
Date: 06/14/04

  • Next message: Nate Lawson: "ACPI mpsafe patch"
    To: freebsd-arch@FreeBSD.org
    Date: Mon, 14 Jun 2004 13:21:42 -0400
    
    

    On Saturday 12 June 2004 03:15 pm, John Polstra wrote:
    > Before 5.x becomes -stable, I'd like to change the API of
    > sema_timedwait(9). This function is used in only 3 places in the
    > kernel, all in "dev/ips/ips_commands.c".
    >
    > Currently, sema_timedwait returns 0 if the operation fails due to a
    > timeout. On success, it returns a non-zero value. This is precisely
    > the opposite of the standard convention in the kernel, where 0 means
    > success and a non-zero value (taken from <sys/errno.h>) means failure.
    > The convention exists because most functions can succeed in only one
    > way but can fail in several different ways.
    >
    > The reason I care about this is because I'd like to add new functions
    > sema_wait_sig() and sema_timedwait_sig() which can be interrupted
    > by a signal. Then sema_timedwait_sig could fail in two different
    > ways: as a result of a timeout or as a result of a signal. If these
    > functions returned proper errno values on failure, it would be easy to
    > distinguish between the two failure cases.
    >
    > This change would also make the return values of sema_timedwait,
    > sema_wait_sig, and sema_timedwait_sig consistent with the analogous
    > condition variable operations cv_timedwait, cv_wait_sig, and
    > cv_timedwait_sig and with tsleep and msleep.
    >
    > Does this change sound OK to you folks?

    Sounds ok to me.

    -- 
    John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
    "Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Nate Lawson: "ACPI mpsafe patch"

    Relevant Pages

    • Re: RFC: API change for sema_timedwait
      ... John Polstra wrote: ... sema_timedwait returns 0 if the operation fails due to a ... as a result of a timeout or as a result of a signal. ... > distinguish between the two failure cases. ...
      (freebsd-arch)
    • Re: RFC: API change for sema_timedwait
      ... > result of a timeout or as a result of a signal. ... > returned proper errno values on failure, it would be easy to distinguish ... > between the two failure cases. ... > Does this change sound OK to you folks? ...
      (freebsd-arch)
    • Re: Staph -- another thing to consider.
      ... As far as I can see, there's no timeout check when you submit ... always- have to allow for failure on the server side. ... i don't know i didn't write ajax probably someone who skipped ... os...if there was internal security there viruses or whatevere ...
      (alt.gathering.rainbow)
    • Re: Staph -- another thing to consider.
      ... As far as I can see, there's no timeout check when you submit ... always- have to allow for failure on the server side. ... which runs on the browser. ... anything more of PC programming except PERL... ...
      (alt.gathering.rainbow)
    • Re: Resume from swsusp stopped working with 2.6.14 and 2.6.15-rc1
      ... That's enough to debug failure quickly. ... better chance if it mentioned a short, fixed timeout. ... But my first post in this thread *did* include the printk() you ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)