robertdavidgraham / masscan

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.
GNU Affero General Public License v3.0
22.97k stars 3.02k forks source link

make install cc -g -ggdb -Wall -O2 -c src/pixie-threads.c -o tmp/pixie-threads.o src/pixie-threads.c:51:5: error: call to undeclared function 'pthread_setschedprio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 51 | pthread_setschedprio(thread, max_prio_for_policy); | ^ src/pixie-threads.c:51:5: note: did you mean 'pthread_setschedparam'? /data/data/com.termux/files/usr/include/pthread.h:348:5: note: 'pthread_setschedparam' declared here 348 | int pthread_setschedparam(pthread_t #762

Open Qs2255 opened 4 months ago

Qs2255 commented 4 months ago

make install cc -g -ggdb -Wall -O2 -c src/pixie-threads.c -o tmp/pixie-threads.o src/pixie-threads.c:51:5: error: call to undeclared function 'pthread_setschedprio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 51 | pthread_setschedprio(thread, max_prio_for_policy); | ^ src/pixie-threads.c:51:5: note: did you mean 'pthread_setschedparam'? /data/data/com.termux/files/usr/include/pthread.h:348:5: note: 'pthread_setschedparam' declared here 348 | int pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param* _Nonnull __param); | ^ 1 error generated. make: *** [Makefile:116: tmp/pixie-threads.o] Error 1

johnzxlin commented 4 months ago

Edit your pixie thread.c file in src folder

Replace this

pthread_t thread = pthread_self();
pthread_attr_t thAttr;
int policy = 0;
int max_prio_for_policy = 0;

pthread_attr_init(&thAttr);
pthread_attr_getschedpolicy(&thAttr, &policy);
max_prio_for_policy = sched_get_priority_max(policy);

pthread_setschedprio(thread, max_prio_for_policy);
pthread_attr_destroy(&thAttr);
return;

TO THIS (BELOW)

int policy; struct sched_param param;

pthread_getschedparam(pthread_self(), &policy, &param);
param.sched_priority = sched_get_priority_max(policy);
pthread_setschedparam(pthread_self(), policy, &param);

return;