Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* 
0003  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
0004  */
0005 
0006 #ifndef __USER_H__
0007 #define __USER_H__
0008 
0009 #include <generated/asm-offsets.h>
0010 
0011 /*
0012  * The usual definition - copied here because the kernel provides its own,
0013  * fancier, type-safe, definition.  Using that one would require
0014  * copying too much infrastructure for my taste, so userspace files
0015  * get less checking than kernel files.
0016  */
0017 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
0018 
0019 /* This is to get size_t and NULL */
0020 #ifndef __UM_HOST__
0021 #include <linux/types.h>
0022 #else
0023 #include <stddef.h>
0024 #include <sys/types.h>
0025 #endif
0026 
0027 extern void panic(const char *fmt, ...)
0028     __attribute__ ((format (printf, 1, 2)));
0029 
0030 /* Requires preincluding include/linux/kern_levels.h */
0031 #define UM_KERN_EMERG   KERN_EMERG
0032 #define UM_KERN_ALERT   KERN_ALERT
0033 #define UM_KERN_CRIT    KERN_CRIT
0034 #define UM_KERN_ERR KERN_ERR
0035 #define UM_KERN_WARNING KERN_WARNING
0036 #define UM_KERN_NOTICE  KERN_NOTICE
0037 #define UM_KERN_INFO    KERN_INFO
0038 #define UM_KERN_DEBUG   KERN_DEBUG
0039 #define UM_KERN_CONT    KERN_CONT
0040 
0041 #ifdef UML_CONFIG_PRINTK
0042 #define printk(...) _printk(__VA_ARGS__)
0043 extern int _printk(const char *fmt, ...)
0044     __attribute__ ((format (printf, 1, 2)));
0045 #else
0046 static inline int printk(const char *fmt, ...)
0047 {
0048     return 0;
0049 }
0050 #endif
0051 
0052 extern int in_aton(char *str);
0053 extern size_t strlcpy(char *, const char *, size_t);
0054 extern size_t strlcat(char *, const char *, size_t);
0055 
0056 /* Copied from linux/compiler-gcc.h since we can't include it directly */
0057 #define barrier() __asm__ __volatile__("": : :"memory")
0058 
0059 #endif