user.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __USER_H__
  6. #define __USER_H__
  7. #include <generated/asm-offsets.h>
  8. /*
  9. * The usual definition - copied here because the kernel provides its own,
  10. * fancier, type-safe, definition. Using that one would require
  11. * copying too much infrastructure for my taste, so userspace files
  12. * get less checking than kernel files.
  13. */
  14. #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
  15. /* This is to get size_t */
  16. #ifndef __UM_HOST__
  17. #include <linux/types.h>
  18. #else
  19. #include <stddef.h>
  20. #endif
  21. extern void panic(const char *fmt, ...)
  22. __attribute__ ((format (printf, 1, 2)));
  23. /* Requires preincluding include/linux/kern_levels.h */
  24. #define UM_KERN_EMERG KERN_EMERG
  25. #define UM_KERN_ALERT KERN_ALERT
  26. #define UM_KERN_CRIT KERN_CRIT
  27. #define UM_KERN_ERR KERN_ERR
  28. #define UM_KERN_WARNING KERN_WARNING
  29. #define UM_KERN_NOTICE KERN_NOTICE
  30. #define UM_KERN_INFO KERN_INFO
  31. #define UM_KERN_DEBUG KERN_DEBUG
  32. #define UM_KERN_CONT KERN_CONT
  33. #ifdef UML_CONFIG_PRINTK
  34. extern int printk(const char *fmt, ...)
  35. __attribute__ ((format (printf, 1, 2)));
  36. #else
  37. static inline int printk(const char *fmt, ...)
  38. {
  39. return 0;
  40. }
  41. #endif
  42. extern int in_aton(char *str);
  43. extern size_t strlcpy(char *, const char *, size_t);
  44. extern size_t strlcat(char *, const char *, size_t);
  45. /* Copied from linux/compiler-gcc.h since we can't include it directly */
  46. #define barrier() __asm__ __volatile__("": : :"memory")
  47. #endif