[asterisk-bugs] [JIRA] Created: (ASTERISK-20240) Incorrect work of __ast_rwlock_timed[rd|wr]lock() functions on OpenBSD

Egor Gorlin (JIRA) noreply at issues.asterisk.org
Thu Aug 16 06:27:07 CDT 2012


Incorrect work of __ast_rwlock_timed[rd|wr]lock() functions on OpenBSD
----------------------------------------------------------------------

                 Key: ASTERISK-20240
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20240
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/Portability
         Environment: Open BSD, Mac OS X and similar
            Reporter: Egor Gorlin


I faced problem with {{pthread_rwlock_timed\[rd|wr\]lock()}} in my project: these functions are not implemented on OpenBSD/MacOS and similar systems.
Luckily i found the solution in Asterisk (dev/Asterisk/main/lock.c) but it seems to be implemented incorrectly.

In {{pthread_rwlock_timed\[rd|wr\]lock()}} second argument is {{const struct timespec *abs_timeout}}, which represents time since UNIX epoch till timeout.
In {{__ast_rwlock_timed\[rd|wr\]lock()}} implementation for OpenBSD this argument is treated as relative timeout:
difference between {{ast_tvnow()}} and {{struct timeval _start}} is compared to {{abs_timeout}}. That's incorrect.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list