compat.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
  36. unsigned int);
  37. asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
  38. unsigned int, unsigned int);
  39. asmlinkage long compat_sys_recvmsg(int, struct compat_msghdr __user *,
  40. unsigned int);
  41. asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
  42. unsigned int, unsigned int,
  43. struct compat_timespec __user *);
  44. asmlinkage long compat_sys_getsockopt(int, int, int, char __user *,
  45. int __user *);
  46. int put_cmsg_compat(struct msghdr*, int, int, int, void *);
  47. int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *,
  48. unsigned char *, int);
  49. int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
  50. int (*)(struct sock *, int, int, char __user *,
  51. unsigned int));
  52. int compat_mc_getsockopt(struct sock *, int, int, char __user *, int __user *,
  53. int (*)(struct sock *, int, int, char __user *,
  54. int __user *));
  55. #endif /* NET_COMPAT_H */