I am attempting to make a port of ctune [https://github.com/An7ar35/ctune], an nCurses Internet Radio player written in C.
This seems to be worthwhile, because audio/gradio and audio/curseradio are both currently nonfunctional due to API changes in underlying libraries, and are based on inactive projects. I tested ctune on a Linux install and it seems to be both functional, low-resource and fast. It also includes support for sndio output. First steps, getting the program to build, having solved a few type errors I have run into the following issue: [ 23%] Building C object plugins/output/pulseaudio/CMakeFiles/ctune_plugin_pulseaudio.dir/__/__/__/src/datastructure/CircularBuffer.c.o cd /home/chris/Downloads/build/ctune/plugins/output/pulseaudio && /usr/bin/cc -Dctune_plugin_pulseaudio_EXPORTS -I/home/chris/Downloads/build/ctune/libraries -I/usr/local/include -I/home/chris/Downloads/build/ctune/generated-src -Wextra -O2 -std=gnu99 -fPIC -MD -MT plugins/output/pulseaudio/CMakeFiles/ctune_plugin_pulseaudio.dir/__/__/__/src/datastructure/CircularBuffer.c.o -MF CMakeFiles/ctune_plugin_pulseaudio.dir/__/__/__/src/datastructure/CircularBuffer.c.o.d -o CMakeFiles/ctune_plugin_pulseaudio.dir/__/__/__/src/datastructure/CircularBuffer.c.o -c /home/chris/Downloads/build/ctune/src/datastructure/CircularBuffer.c /home/chris/Downloads/build/ctune/src/datastructure/CircularBuffer.c:36:17: warning: call to undeclared function 'syscall'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] long fd = syscall( __NR_memfd_create, name, flags ); ^ /home/chris/Downloads/build/ctune/src/datastructure/CircularBuffer.c:36:26: error: use of undeclared identifier '__NR_memfd_create' long fd = syscall( __NR_memfd_create, name, flags ); ^ 1 warning and 1 error generated. *** Error 1 in . (plugins/output/pulseaudio/CMakeFiles/ctune_plugin_pulseaudio.dir/build.make:107 'plugins/output/pulseaudio/CMakeFiles/ctune_plugin_pulseaudio.dir/__/__/__/src/datastructure/CircularBuffer.c.o') *** Error 2 in . (CMakeFiles/Makefile2:504 'plugins/output/pulseaudio/CMakeFiles/ctune_plugin_pulseaudio.dir/all') *** Error 2 in /home/chris/Downloads/build/ctune (Makefile:139 'all') Pulseaudio is installed on my machine because other progams I run require it . The relevant lines of the file causing the above issue are: (src/datastructure/CircularBuffer.c) #include "CircularBuffer.h" #include <errno.h> #include <string.h> #include <limits.h> #include <sys/mman.h> #include <sys/syscall.h> #include <unistd.h> #include "logger/src/Logger.h" /** * [PRIVATE] Gets a string representation of the error enum val for pthread returns * @param i Error enum integer val * @return String */ static const char * CircularBuffer_getPThreadErrStr( int i ) { switch( i ) { case 0 : return "OK"; case EINVAL : return "EINVAL"; case EBUSY : return "EBUSY"; case EAGAIN : return "EAGAIN"; case EDEADLK: return "EDEADLK"; case EPERM : return "EPERM"; default : return "UNKNOWN"; } } /** * [PRIVATE] Gets a file descriptor for an anonymous file residing in memory (replica of https://man7.org/> * @param name Name of file * @param flags Flags * @return File descriptor (-1 or error) */ static int CircularBuffer_memfd_create( const char * name, unsigned int flags ) { long fd = syscall( __NR_memfd_create, name, flags ); int cast = 0; if( fd >= 0 ) { if( fd <= INT_MAX ) { cast = (int) fd; } else { CTUNE_LOG( CTUNE_LOG_ERROR, "[CircularBuffer_memfd_create( \"%s\", %d )] Failed cast long->int (%ld)", name, flags, fd ); cast = -1; } } return cast; } Can anyone offer some assistance in resolving this 'undeclared function' issue please? How does one declare the 'syscall' function here, and why is it not needed on the Linux platform? Do we have an equivalent for the Linux macro syscall __NR_memfd_create (which seems also to be aliased as SYS_memfd_create)? -- Chris Billington