Compiling cpulimit: warning: implicit declaration of function 'basename'

opendaddy at hushmail.com opendaddy at hushmail.com
Wed Mar 11 13:44:59 UTC 2015


Hi!

Anybody know how to fix these cpulimit (https://github.com/opsengine/cpulimit/) build warnings?

They seem to make cpulimit prevent processes from getting more than 2% CPU.

# gmake
cd src && gmake all
gmake[1]: Entering directory '/root/cpulimit/src'
cc -c list.c -Wall -g -D_GNU_SOURCE
cc -c process_iterator.c -Wall -g -D_GNU_SOURCE
cc -c process_group.c -Wall -g -D_GNU_SOURCE
process_group.c:64:15: warning: implicit declaration of function 'basename'
      is invalid in C99 [-Wimplicit-function-declaration]
                if (strncmp(basename(proc.command), process_name, str...
                            ^
process_group.c:64:15: warning: incompatible integer to pointer conversion
      passing 'int' to parameter of type 'const char *' [-Wint-conversion]
                if (strncmp(basename(proc.command), process_name, str...
                            ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/string.h:100:26: note: passing argument to parameter here
int      strncmp(const char *, const char *, size_t) __pure;
                             ^
2 warnings generated.
cc -o cpulimit cpulimit.c list.o process_iterator.o process_group.o -lkvm -Wall -g -D_GNU_SOURCE
gmake[1]: Leaving directory '/root/cpulimit/src'
cd tests && gmake all
gmake[1]: Entering directory '/root/cpulimit/tests'
cc -o busy busy.c -lpthread -Wall -g
cc -I../src -o process_iterator_test process_iterator_test.c ../src/list.o ../src/process_iterator.o ../src/process_group.o -lkvm -lpthread -Wall -g
gmake[1]: Leaving directory '/root/cpulimit/tests'

Thanks!

O.D.



More information about the freebsd-questions mailing list