From 55a030a179fdfd1e887d95d5c0050004bee27fcf Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 30 Aug 2005 00:27:35 +0000 Subject: 2005-08-29 Martin Hunt * list.c (_stp_copy_argv_from_user): Move to here. * copy.c (_stp_copy_argv_from_user): Delete. * runtime.h: Always include copy.h. --- runtime/ChangeLog | 6 ++++++ runtime/copy.c | 33 --------------------------------- runtime/list.c | 36 ++++++++++++++++++++++++++++++++++++ runtime/runtime.h | 1 + 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 014ba13b..727862b4 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,9 @@ +2005-08-29 Martin Hunt + + * list.c (_stp_copy_argv_from_user): Move to here. + * copy.c (_stp_copy_argv_from_user): Delete. + * runtime.h: Always include copy.h. + 2005-08-25 Roland McGrath * loc2c-runtime.h (deref_string): Rewritten using deref. diff --git a/runtime/copy.c b/runtime/copy.c index ef5f094d..71f69335 100644 --- a/runtime/copy.c +++ b/runtime/copy.c @@ -141,38 +141,5 @@ _stp_copy_from_user (char *dst, const char __user *src, unsigned long count) return __copy_from_user_inatomic(dst, src, count); } -/** Copy an argv from user space to a List. - * - * @param list A list. - * @param argv Source argv, in user space. - * @return number of elements in list - * - * @b Example: - * @include argv.c - */ - -int _stp_copy_argv_from_user (MAP list, char __user *__user *argv) -{ - char str[128]; - char __user *vstr; - int len; - - if (argv) - argv++; - - while (argv != NULL) { - if (get_user (vstr, argv)) - break; - - if (vstr == NULL) - break; - - len = _stp_strncpy_from_user(str, vstr, 128); - str[len] = 0; - _stp_list_add_str (list, str); - argv++; - } - return list->num; -} /** @} */ #endif /* _COPY_C_ */ diff --git a/runtime/list.c b/runtime/list.c index 4643634b..c504ed36 100644 --- a/runtime/list.c +++ b/runtime/list.c @@ -10,6 +10,7 @@ #endif #include "map.c" +#include "copy.c" /********************** List Functions *********************/ /** @file list.c @@ -123,5 +124,40 @@ inline int _stp_list_size(MAP map) { return map->num; } + +/** Copy an argv from user space to a List. + * + * @param list A list. + * @param argv Source argv, in user space. + * @return number of elements in list + * + * @b Example: + * @include argv.c + */ + +int _stp_copy_argv_from_user (MAP list, char __user *__user *argv) +{ + char str[128]; + char __user *vstr; + int len; + + if (argv) + argv++; + + while (argv != NULL) { + if (get_user (vstr, argv)) + break; + + if (vstr == NULL) + break; + + len = _stp_strncpy_from_user(str, vstr, 128); + str[len] = 0; + _stp_list_add_str (list, str); + argv++; + } + return list->num; +} + /** @} */ #endif /* _LIST_C_ */ diff --git a/runtime/runtime.h b/runtime/runtime.h index 44873ee9..5e77505b 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -59,6 +59,7 @@ static struct #include "print.c" #include "string.c" #include "arith.c" +#include "copy.c" /************* Module Stuff ********************/ int probe_start(void); -- cgit