compat.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
  25. extern 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. extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
  34. extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int);
  35. extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
  36. extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
  37. unsigned, unsigned);
  38. extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
  39. extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
  40. unsigned, unsigned,
  41. struct compat_timespec __user *);
  42. extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
  43. extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
  44. extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
  45. extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
  46. int (*)(struct sock *, int, int, char __user *, unsigned int));
  47. extern int compat_mc_getsockopt(struct sock *, int, int, char __user *,
  48. int __user *, int (*)(struct sock *, int, int, char __user *,
  49. int __user *));
  50. #endif /* NET_COMPAT_H */