compat.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef NET_COMPAT_H
  3. #define NET_COMPAT_H
  4. struct sock;
  5. #if defined(CONFIG_COMPAT)
  6. #include <linux/compat.h>
  7. struct compat_msghdr {
  8. compat_uptr_t msg_name; /* void * */
  9. compat_int_t msg_namelen;
  10. compat_uptr_t msg_iov; /* struct compat_iovec * */
  11. compat_size_t msg_iovlen;
  12. compat_uptr_t msg_control; /* void * */
  13. compat_size_t msg_controllen;
  14. compat_uint_t msg_flags;
  15. };
  16. struct compat_mmsghdr {
  17. struct compat_msghdr msg_hdr;
  18. compat_uint_t msg_len;
  19. };
  20. struct compat_cmsghdr {
  21. compat_size_t cmsg_len;
  22. compat_int_t cmsg_level;
  23. compat_int_t cmsg_type;
  24. };
  25. int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
  26. int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
  27. #else /* defined(CONFIG_COMPAT) */
  28. /*
  29. * To avoid compiler warnings:
  30. */
  31. #define compat_msghdr msghdr
  32. #define compat_mmsghdr mmsghdr
  33. #endif /* defined(CONFIG_COMPAT) */
  34. int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *,
  35. struct sockaddr __user **, struct iovec **);
  36. struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval);
  37. asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
  38. unsigned int);
  39. asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
  40. unsigned int, unsigned int);
  41. asmlinkage long compat_sys_recvmsg(int, struct compat_msghdr __user *,
  42. unsigned int);
  43. asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
  44. unsigned int, unsigned int,
  45. struct compat_timespec __user *);
  46. asmlinkage long compat_sys_getsockopt(int, int, int, char __user *,
  47. int __user *);
  48. int put_cmsg_compat(struct msghdr*, int, int, int, void *);
  49. int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *,
  50. unsigned char *, int);
  51. int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
  52. int (*)(struct sock *, int, int, char __user *,
  53. unsigned int));
  54. int compat_mc_getsockopt(struct sock *, int, int, char __user *, int __user *,
  55. int (*)(struct sock *, int, int, char __user *,
  56. int __user *));
  57. #endif /* NET_COMPAT_H */