Skip to content

Commit

Permalink
Merge pull request grishka#46 from mymedia2/patch-2
Browse files Browse the repository at this point in the history
Add conditions for FreeBSD and GNU/Hurd
  • Loading branch information
grishka authored Jul 1, 2018
2 parents 697eea9 + c5f8db2 commit dacde29
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion audio/AudioInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "../os/windows/AudioInputWave.h"
#endif
#include "../os/windows/AudioInputWASAPI.h"
#elif defined(__linux__)
#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
#include "../os/linux/AudioInputALSA.h"
#include "../os/linux/AudioInputPulse.h"
#else
Expand Down
2 changes: 1 addition & 1 deletion audio/AudioOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "../os/windows/AudioOutputWave.h"
#endif
#include "../os/windows/AudioOutputWASAPI.h"
#elif defined(__linux__)
#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
#include "../os/linux/AudioOutputALSA.h"
#include "../os/linux/AudioOutputPulse.h"
#else
Expand Down
7 changes: 6 additions & 1 deletion os/linux/AudioInputPulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ AudioInputPulse::AudioInputPulse(std::string devID){
return;
}
mainloopApi=pa_threaded_mainloop_get_api(mainloop);
#ifndef MAXPATHLEN
char exeName[20];
#else
char exePath[MAXPATHLEN];
char exeName[MAXPATHLEN];
ssize_t lres=readlink("/proc/self/exe", exePath, sizeof(exePath));
Expand All @@ -55,7 +58,9 @@ AudioInputPulse::AudioInputPulse(std::string devID){
lres=readlink("/proc/curproc/exe", exePath, sizeof(exePath));
if(lres>0){
strcpy(exeName, basename(exePath));
}else{
}else
#endif
{
snprintf(exeName, sizeof(exeName), "Process %d", getpid());
}
context=pa_context_new(mainloopApi, exeName);
Expand Down
7 changes: 6 additions & 1 deletion os/linux/AudioOutputPulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ AudioOutputPulse::AudioOutputPulse(std::string devID){
return;
}
mainloopApi=pa_threaded_mainloop_get_api(mainloop);
#ifndef MAXPATHLEN
char exeName[20];
#else
char exePath[MAXPATHLEN];
char exeName[MAXPATHLEN];
ssize_t lres=readlink("/proc/self/exe", exePath, sizeof(exePath));
Expand All @@ -59,7 +62,9 @@ AudioOutputPulse::AudioOutputPulse(std::string devID){
lres=readlink("/proc/curproc/exe", exePath, sizeof(exePath));
if(lres>0){
strcpy(exeName, basename(exePath));
}else{
}else
#endif
{
snprintf(exeName, sizeof(exeName), "Process %d", getpid());
}
context=pa_context_new(mainloopApi, exeName);
Expand Down
4 changes: 3 additions & 1 deletion os/posix/NetworkSocketPosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void NetworkSocketPosix::SetMaxPriority(){
if(res<0){
LOGE("error setting darwin-specific net priority: %d / %s", errno, strerror(errno));
}
#else
#elif defined(__linux__)
int prio=5;
int res=setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio));
if(res<0){
Expand All @@ -64,6 +64,8 @@ void NetworkSocketPosix::SetMaxPriority(){
if(res<0){
LOGE("error setting ip tos: %d / %s", errno, strerror(errno));
}
#else
LOGI("cannot set socket priority");
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions threading.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ namespace tgvoip{
static void* ActualEntryPoint(void* arg){
Thread* self=reinterpret_cast<Thread*>(arg);
if(self->name){
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__gnu_hurd__)
pthread_setname_np(self->thread, self->name);
#else
#elif !defined(__gnu_hurd__)
pthread_setname_np(self->name);
#endif
}
Expand Down

0 comments on commit dacde29

Please sign in to comment.