lxip: provide strncpy and strstr (for ipconfig)

This commit is contained in:
Christian Helmuth 2016-10-17 11:15:06 +02:00
parent 2f0d90e0e1
commit 4bc34f73f3
2 changed files with 31 additions and 0 deletions

View File

@ -466,6 +466,7 @@ DUMMY(-1, static_key_enabled)
DUMMY(-1, static_key_slow_dec)
DUMMY(-1, static_key_slow_inc)
DUMMY(-1, strcat)
DUMMY(-1, strsep)
DUMMY(-1, strncpy_from_user)
DUMMY(-1, synchronize_rcu_expedited)
DUMMY(-1, sysctl_igmp_max_msf)

View File

@ -166,6 +166,12 @@ char *strcpy(char *to, const char *from)
}
char *strncpy(char *dst, const char* src, size_t n)
{
return Genode::strncpy(dst, src, n);
}
char *strchr(const char *p, int ch)
{
char c;
@ -247,6 +253,30 @@ size_t strlcpy(char *dest, const char *src, size_t size)
}
/* from linux/lib/string.c */
char *strstr(char const *s1, char const *s2)
{
size_t l1, l2;
l2 = strlen(s2);
if (!l2)
return (char *)s1;
l1 = strlen(s1);
while (l1 >= l2) {
l1--;
if (!memcmp(s1, s2, l2))
return (char *)s1;
s1++;
}
return NULL;
}
void *memset(void *s, int c, size_t n)
{
return Genode::memset(s, c, n);
}
void *memcpy(void *d, const void *s, size_t n)
{
return Genode::memcpy(d, s, n);