robertdavidgraham / masscan

TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Masscan Termux - pixie-threads.c call to undeclared function 'pthread_setschedprio'

iodn opened this issue · comments

commented

Hello,

I'm encountering an issue while trying to compile Masscan on four different mobile phones. Both make and clang are installed on the devices. However, I'm consistently facing the same error, and I'm unsure about its meaning.

~/masscan $ make
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

Additional Information:

Masscan version: 1.3.9-integration
Operating system: Android aarch64

I would appreciate any assistance or insights into resolving this compilation issue. If anyone has encountered a similar problem or has suggestions on how to proceed, your help would be invaluable.

Thank you!

commented

I managed to resolve the issue by making a temporary update to the file /data/data/com.termux/files/usr/include/pthread.h. I modified line 372, replacing the conditional block:

#if __ANDROID_API__ >= 28
int pthread_setschedprio(pthread_t __pthread, int __priority) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */

with:

int pthread_setschedprio(pthread_t __pthread, int __priority);

After this tweak, Masscan successfully compiled on my Android device.