Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/include/linux Add kstrtol.



details:   https://anonhg.NetBSD.org/src/rev/d83da36b4f3b
branches:  trunk
changeset: 336321:d83da36b4f3b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 25 15:11:07 2015 +0000

description:
Add kstrtol.

diffstat:

 sys/external/bsd/common/include/linux/kernel.h |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 1cb658f6a75e -r d83da36b4f3b sys/external/bsd/common/include/linux/kernel.h
--- a/sys/external/bsd/common/include/linux/kernel.h    Wed Feb 25 15:01:03 2015 +0000
+++ b/sys/external/bsd/common/include/linux/kernel.h    Wed Feb 25 15:11:07 2015 +0000
@@ -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 @@
        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_ */



Home | Main Index | Thread Index | Old Index