summaryrefslogtreecommitdiffstats
path: root/runtime/copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/copy.c')
-rw-r--r--runtime/copy.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/runtime/copy.c b/runtime/copy.c
index f4b35106..6e2313f6 100644
--- a/runtime/copy.c
+++ b/runtime/copy.c
@@ -1,7 +1,8 @@
-#ifndef _COPY_C_
+#ifndef _COPY_C_ /* -*- linux-c -*- */
#define _COPY_C_
-/* -*- linux-c -*- */
+#include "string.c"
+
/** @file copy.c
* @brief Functions to copy from user space.
*/
@@ -98,6 +99,18 @@ _stp_strncpy_from_user(char *dst, const char __user *src, long count)
return res;
}
+void _stp_string_from_user (String str, const char __user *src, long count)
+{
+ long res;
+ if (count > STP_STRING_SIZE - str->len - 1)
+ count = STP_STRING_SIZE - str->len - 1;
+ __stp_strncpy_from_user(str->buf + str->len, src, count, res);
+ if (res > 0) {
+ str->len += res;
+ str->buf[str->len] = '\0';
+ }
+}
+
/** Copy a block of data from user space.
*
* If some data could not be copied, this function will pad the copied