user.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #ifdef __KERNEL__
  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. #ifdef UML_CONFIG_PRINTK
  24. extern int printk(const char *fmt, ...)
  25. __attribute__ ((format (printf, 1, 2)));
  26. #else
  27. static inline int printk(const char *fmt, ...)
  28. {
  29. return 0;
  30. }
  31. #endif
  32. extern int in_aton(char *str);
  33. extern size_t strlcpy(char *, const char *, size_t);
  34. extern size_t strlcat(char *, const char *, size_t);
  35. /* Copied from linux/compiler-gcc.h since we can't include it directly */
  36. #define barrier() __asm__ __volatile__("": : :"memory")
  37. #endif