posix.cfg: Added support for 'llseek()', which is obsolescent since glibc version 2.28

This commit is contained in:
orbitcowboy 2022-02-09 08:34:35 +01:00
parent 2c7948102a
commit 09da69b1c7
2 changed files with 55 additions and 0 deletions

View File

@ -3418,6 +3418,29 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<valid>0:2</valid> <valid>0:2</valid>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/lseek64.3.html -->
<!-- loff_t llseek(int fd, loff_t offset, int whence); -->
<function name="llseek">
<returnValue type="loff_t"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:2</valid>
</arg>
<!-- Note: Since glibc 2.28, this function symbol is no longer available to newly linked applications. -->
<warn severity="style" reason="Obsolescent" alternatives="lseek64"/>
</function>
<!-- int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); --> <!-- int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); -->
<function name="nanosleep"> <function name="nanosleep">
<returnValue type="int"/> <returnValue type="int"/>
@ -5429,6 +5452,8 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<podtype name="id_t" sign="s"/> <podtype name="id_t" sign="s"/>
<podtype name="blkcnt_t" sign="s"/> <podtype name="blkcnt_t" sign="s"/>
<podtype name="off_t" sign="s"/> <podtype name="off_t" sign="s"/>
<podtype name="loff_t" sign="s" size="8"/>
<podtype name="off64_t" sign="s" size="8"/>
<podtype name="fsblkcnt_t" sign="u"/> <podtype name="fsblkcnt_t" sign="u"/>
<podtype name="fsfilcnt_t" sign="u"/> <podtype name="fsfilcnt_t" sign="u"/>
<podtype name="ino_t" sign="u"/> <podtype name="ino_t" sign="u"/>

View File

@ -29,6 +29,36 @@
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
// Note: Since glibc 2.28, this function symbol is no longer available to newly linked applications.
void invalidFunctionArg_llseek(int fd, loff_t offset, int origin)
{
// cppcheck-suppress llseekCalled
// cppcheck-suppress invalidFunctionArg
(void)llseek(-1, offset, SEEK_SET);
// cppcheck-suppress llseekCalled
// cppcheck-suppress invalidFunctionArg
(void)llseek(fd, offset, -1);
// cppcheck-suppress llseekCalled
// cppcheck-suppress invalidFunctionArg
(void)llseek(fd, offset, 3);
// cppcheck-suppress llseekCalled
// cppcheck-suppress invalidFunctionArg
(void)llseek(fd, offset, 42+SEEK_SET);
// cppcheck-suppress llseekCalled
// cppcheck-suppress invalidFunctionArg
(void)llseek(fd, offset, SEEK_SET+42);
// No invalidFunctionArg warning is expected for
// cppcheck-suppress llseekCalled
(void)llseek(0, offset, origin);
// cppcheck-suppress llseekCalled
(void)llseek(fd, offset, origin);
// cppcheck-suppress llseekCalled
(void)llseek(fd, offset, SEEK_SET);
// cppcheck-suppress llseekCalled
(void)llseek(fd, offset, SEEK_CUR);
// cppcheck-suppress llseekCalled
(void)llseek(fd, offset, SEEK_END);
}
void invalidFunctionArg_lseek64(int fd, off_t offset, int origin) void invalidFunctionArg_lseek64(int fd, off_t offset, int origin)
{ {