title: sendmsg socket system call parameters in bionic libc (android)
body: <p>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 </p>
  
  <p>__socketcall int sendmsg (int, const struct msghdr*, int);</p>
  
  <p>Whereas in other places /android/bionic/libc/SYSCALLS.TXT the system call declaration for sendmsg in #sockets and #sockets for x86 has</p>
  
  <p>int sendmsg(int, const struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64</p>
  
  <p>int sendmsg:socketcall:16(int, const struct msghdr*, unsigned int) x86</p>
  
  <p>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 </p>
  
  <p>SYSCALL_DEFINE3(sendmsg,int,fd,struct user_msghdr __user*,msg,unsigned int,flags) {
  }</p>
  
  <p>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</p>