blob: 4fa82c055aab8d53576b06787aa1033644a16697 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Jeff Dike9c8d6382007-11-14 17:00:31 -08002 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Licensed under the GPL
4 */
5
6#ifndef __USER_H__
7#define __USER_H__
8
Al Viro9e636452011-08-18 20:01:49 +01009#include <generated/asm-offsets.h>
Jeff Dike9c8d6382007-11-14 17:00:31 -080010
Jeff Dike24fa6c02007-05-06 14:51:09 -070011/*
12 * The usual definition - copied here because the kernel provides its own,
13 * fancier, type-safe, definition. Using that one would require
14 * copying too much infrastructure for my taste, so userspace files
15 * get less checking than kernel files.
16 */
17#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
18
Jeff Dike42daba32007-10-16 01:26:47 -070019/* This is to get size_t */
20#ifdef __KERNEL__
Paolo 'Blaisorblade' Giarrussoc2f239d2007-05-06 14:51:52 -070021#include <linux/types.h>
Jeff Dike42daba32007-10-16 01:26:47 -070022#else
23#include <stddef.h>
24#endif
Paolo 'Blaisorblade' Giarrussoc2f239d2007-05-06 14:51:52 -070025
Paolo 'Blaisorblade' Giarrusso9cf85b32006-04-10 22:53:31 -070026extern void panic(const char *fmt, ...)
27 __attribute__ ((format (printf, 1, 2)));
Jeff Dike9c8d6382007-11-14 17:00:31 -080028
29#ifdef UML_CONFIG_PRINTK
Paolo 'Blaisorblade' Giarrusso9cf85b32006-04-10 22:53:31 -070030extern int printk(const char *fmt, ...)
31 __attribute__ ((format (printf, 1, 2)));
Jeff Dike9c8d6382007-11-14 17:00:31 -080032#else
33static inline int printk(const char *fmt, ...)
34{
35 return 0;
36}
37#endif
38
Linus Torvalds1da177e2005-04-16 15:20:36 -070039extern int in_aton(char *str);
Paolo 'Blaisorblade' Giarrussoc2f239d2007-05-06 14:51:52 -070040extern size_t strlcpy(char *, const char *, size_t);
41extern size_t strlcat(char *, const char *, size_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Al Viro05c46db2011-08-18 20:04:59 +010043/* Copied from linux/compiler-gcc.h since we can't include it directly */
44#define barrier() __asm__ __volatile__("": : :"memory")
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#endif