compat.h 2.1 KB

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