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/270ee9781bea
branches:  trunk
changeset: 806463:270ee9781bea
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 dff3bdb5e8b9 -r 270ee9781bea 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