compat.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. int put_cmsg_compat(struct msghdr*, int, int, int, void *);
  38. int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *,
  39. unsigned char *, int);
  40. int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
  41. int (*)(struct sock *, int, int, char __user *,
  42. unsigned int));
  43. int compat_mc_getsockopt(struct sock *, int, int, char __user *, int __user *,
  44. int (*)(struct sock *, int, int, char __user *,
  45. int __user *));
  46. #endif /* NET_COMPAT_H */