sendmsg socket system call parameters in bionic libc (android)

419 Views Asked by At

I was going through the bionic libc socket system calls and noticed something confusing. The android/bionic/libc/include/sys/socket.h has a system call declaration for sendmsg as

__socketcall int sendmsg (int, const struct msghdr*, int);

Whereas in other places /android/bionic/libc/SYSCALLS.TXT the system call declaration for sendmsg in #sockets and #sockets for x86 has

int sendmsg(int, const struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64

int sendmsg:socketcall:16(int, const struct msghdr*, unsigned int) x86

Why is there a change in the declaration of flags datatype (int in socket.h and unsigned int in SYSCALLS.TXT). Even in the kernel system calls in kernel/net/socket.c the system call is defined as

SYSCALL_DEFINE3(sendmsg,int,fd,struct user_msghdr __user*,msg,unsigned int,flags) { }

The flag is declared as unsigned int. Only in the libc's include/sys/socket.h the flag is int. Can you please explain the reason why is it like that. What will happen if I change the declaration into 'unsigned int' in socket.h

0

There are 0 best solutions below