gnu.cfg: Added support for semtimedop().

This commit is contained in:
orbitcowboy 2022-05-01 11:41:51 +02:00
parent 63e58b9051
commit 85f44d36dd
2 changed files with 37 additions and 0 deletions

View File

@ -92,6 +92,34 @@
<valid>0:</valid>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man2/semop.2.html -->
<!-- int semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout); -->
<function name="semtimedop">
<noreturn>false</noreturn>
<returnValue type="int"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="out">
<not-null/>
<not-uninit/>
<not-bool/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<!-- If the timeout argument is NULL, then semtimedop() behaves exactly like semop() -->
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- void * __builtin_assume_aligned (const void *exp, size_t align, ...) -->
<!-- This function can have either two or three arguments, if it has three, the third argument should have integer type. -->
<function name="__builtin_assume_aligned">

View File

@ -16,11 +16,20 @@
#include <sys/types.h>
#include <pwd.h>
#include <sys/mman.h>
#include <sys/sem.h>
#include <wchar.h>
#ifndef __CYGWIN__
#include <sys/epoll.h>
#endif
int nullPointer_semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout)
{
(void) semtimedop(semid, sops, nsops, NULL); // If the timeout argument is NULL, then semtimedop() behaves exactly like semop().
(void) semtimedop(semid, sops, nsops, timeout);
// cppcheck-suppress nullPointer
return semtimedop(semid, NULL, nsops, timeout);
}
void *nullPointer_mempcpy(void *dest, const void *src, size_t n)
{
// cppcheck-suppress nullPointer