Module Name: src
Committed By: riastradh
Date: Wed Feb 25 15:11:08 UTC 2015
Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
Log Message:
Add kstrtol.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/common/include/linux/kernel.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.4 src/sys/external/bsd/common/include/linux/kernel.h:1.5
--- src/sys/external/bsd/common/include/linux/kernel.h:1.4 Wed Jul 16 20:59:57 2014
+++ src/sys/external/bsd/common/include/linux/kernel.h Wed Feb 25 15:11:07 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: kernel.h,v 1.4 2014/07/16 20:59:57 riastradh Exp $ */
+/* $NetBSD: kernel.h,v 1.5 2015/02/25 15:11:07 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -164,4 +164,16 @@ scnprintf(char *buf, size_t size, const
return ret;
}
+static inline int
+kstrtol(const char *s, unsigned base, long *vp)
+{
+ long long v;
+
+ v = strtoll(s, NULL, base);
+ if (v < LONG_MIN || LONG_MAX < v)
+ return -ERANGE;
+ *vp = v;
+ return 0;
+}
+
#endif /* _LINUX_KERNEL_H_ */