Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on musl #3206

Open
wants to merge 3 commits into
base: 2.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/emc/rs274ngc/interp_o_word.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,15 @@ void Interp::loop_to_beginning(setup_pointer settings)
settings->sequence_number = 0;
}

// Prevent any possibility of the Posix version of basename(3) being used
// (possibly altering the argument). Therefore, local reimplementation
// of the *GNU version* of basename(3).
static const char *thebasename(const char *filename)
{
const char *p = strrchr(filename, '/');
return p ? p + 1 : filename;
}

//
// TESTME!!! MORE THOROUGHLY !!!KL
//
Expand All @@ -545,8 +554,9 @@ int Interp::control_back_to( block_pointer block, // pointer to block
FILE *newFP;
offset_map_iterator it;
offset_pointer op;
logOword("Entered:%s %s", name,basename(block->o_name));
it = settings->offset_map.find(basename(block->o_name));
const char *obasename = thebasename(block->o_name);
logOword("Entered:%s %s", name, obasename);
it = settings->offset_map.find(obasename);

// #1 already defined
if (it != settings->offset_map.end()) {
Expand Down Expand Up @@ -609,8 +619,8 @@ int Interp::control_back_to( block_pointer block, // pointer to block
free(dirname);
}

settings->skipping_o = basename(block->o_name); // start skipping
settings->skipping_to_sub = basename(block->o_name); // start skipping
settings->skipping_o = obasename; // start skipping
settings->skipping_to_sub = obasename; // start skipping
settings->skipping_start = settings->sequence_number;
return INTERP_OK;
}
Expand Down
3 changes: 1 addition & 2 deletions src/emc/task/backtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ void backtrace(int signo)
name_buf[readlink("/proc/self/exe", name_buf, 511)]=0;
int child_pid = fork();
if (!child_pid) {
fclose(stderr);
stderr = freopen(filename, "a", stderr);
freopen(filename, "a", stderr);
dup2(2,1); // child: redirect output to stderr
fprintf(stdout,"stack trace for %s pid=%s signal=%d\n",name_buf,pid_buf, signo);
execlp("gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "bt", name_buf, pid_buf, NULL);
Expand Down
1 change: 1 addition & 0 deletions src/hal/user_comps/xhc-whb04b-6/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// system includes
#include <stdint.h>
#include <ostream>
#include <sys/time.h>

// forward declarations
struct libusb_device_handle;
Expand Down
1 change: 1 addition & 0 deletions src/libnml/buffer/tcpmem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C" {
#include <arpa/inet.h> /* inet_ntoa */
#include <sys/socket.h>
#include <sys/time.h> /* struct timeval */
#include <sys/types.h> /* u_short */
#include <netinet/in.h> /* sockaddr_in */
#include <netdb.h>
#include <math.h> /* fmod() */
Expand Down
6 changes: 3 additions & 3 deletions src/rtapi/uspace_rtapi_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ static void configure_memory()
res = mlockall(MCL_CURRENT | MCL_FUTURE);
if(res < 0) perror("mlockall");

#ifdef __linux__
#ifdef __GLIBC__
/* Turn off malloc trimming.*/
if (!mallopt(M_TRIM_THRESHOLD, -1)) {
rtapi_print_msg(RTAPI_MSG_WARN,
Expand Down Expand Up @@ -1050,8 +1050,8 @@ int Posix::task_start(int task_id, unsigned long int period_nsec)
#endif
CPU_ZERO(&cpuset);
CPU_SET(rt_cpu_number, &cpuset);
if((ret = pthread_attr_setaffinity_np(&attr, sizeof(cpuset), &cpuset)) != 0)
return -ret;
if(0 != pthread_setaffinity_np(task->thr, sizeof(cpuset), &cpuset))
rtapi_print("ERROR: failed to set thread scheduling affinity (%s)", strerror(errno));
}
}
if((ret = pthread_create(&task->thr, &attr, &wrapper, reinterpret_cast<void*>(task))) != 0)
Expand Down
Loading