Re: ___strtok undeclared...problem

Dr. Werner Fink (werner@suse.de)
Fri, 15 Mar 1996 13:55:31 +0100


> Date: Fri, 15 Mar 1996 09:36:22 +0100
> From: Tomas Andersson <f91-tan@nada.kth.se>
>
> Dear Kernel,
>
> forgive me for mailing this question to this "high traffic" list, but it
> is somewhat related to the kernel, at least it deals with stuff in the
> kernel source tree. And this problem has been bugging me for days.
>
> Quickly when upgrading your kernel you find out you need the new procps.
> However I can not compile the procps-0.99 release (i can use the binaries of
> course, but I want to be able to compile).
>
> bash# make
> gcc -O6 -m486 -I. -Wall -c ps.c
> /usr/include/asm/string.h: In function `strtok':
> In file included from ps.c:29:
> /usr/include/asm/string.h:356: `___strtok' undeclared (first use this function)
>
> There you have it.
>
> I did the following...
>
> cd /usr/include
> find . -follow -type f -print | xargs egrep ___strtok
> find: ./uit: No such file or directory
> ./linux/string.h:extern char * ___strtok;
> ./linux/modules/ksyms.ver:#define ___strtok _set_ver(___strtok, 8b55d69c)
> ./asm/string.h: :"=b" (__res),"=S" (___strtok)
> ./asm/string.h: :"0" (___strtok),"1" (s),"g" (ct)
> ./asm/string-486.h: :"=b" (__res),"=S" (___strtok)
> ./asm/string-486.h: :"0" (___strtok),"1" (s),"g" (ct)
>
> It shows that <linux/string.h> includes <asm/string.h> so I change
> #include <asm/string.h> to #include <linux/string.h> in "ps.c" and
> in the other source files that includes <asm/string.h>. However, this
> only postpones the problem to linking when ___strtok isn't found.
> I which library should (is) ___strtok be defined?
>
> /Tomas Andersson f91-tan@nada.kth.se
>

It's defined in linux/lib/string.c for only linking against the kernel.
If you using <linux/string.h> or <asm/string.h> you should
declare `char * ___strtok = NULL;' before doing such nasty things ...

Werner <werner@suse.de>