]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_shared.c
Turned on the defogger (Don't apply fog to UI. Check notrippy == true)
[xonotic/darkplaces.git] / sys_shared.c
index d527632533e0362e812c4aa0294f75e208110c93..0db4c03479474e7fd81432ecb3f708d9e546111c 100644 (file)
@@ -18,6 +18,9 @@
 #pragma comment(lib, "winmm.lib")
 #endif
 #else
+# ifdef __FreeBSD__
+#  include <sys/sysctl.h>
+# endif
 # include <unistd.h>
 # include <fcntl.h>
 # include <sys/time.h>
@@ -498,7 +501,12 @@ static const char *Sys_FindExecutableName(void)
        static char exenamebuf[MAX_OSPATH+1];
        ssize_t n = -1;
 #if defined(__FreeBSD__)
-       n = readlink("/proc/curproc/file", exenamebuf, sizeof(exenamebuf)-1);
+       int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
+       size_t exenamebuflen = sizeof(exenamebuf)-1;
+       if (sysctl(mib, 4, exenamebuf, &exenamebuflen, NULL, 0) == 0)
+       {
+               n = exenamebuflen;
+       }
 #elif defined(__linux__)
        n = readlink("/proc/self/exe", exenamebuf, sizeof(exenamebuf)-1);
 #endif
@@ -630,7 +638,7 @@ void Sys_MakeProcessNice (void)
                return;
        Con_DPrintf("Process is becoming 'nice'...\n");
        if(setpriority(PRIO_PROCESS, 0, 19))
-               Con_Printf("Failed to raise nice level to %d\n", 19);
+               Con_Errorf("Failed to raise nice level to %d\n", 19);
        isnice = true;
 }
 void Sys_MakeProcessMean (void)
@@ -641,7 +649,7 @@ void Sys_MakeProcessMean (void)
                return;
        Con_DPrintf("Process is becoming 'mean'...\n");
        if(setpriority(PRIO_PROCESS, 0, nicelevel))
-               Con_Printf("Failed to lower nice level to %d\n", nicelevel);
+               Con_Errorf("Failed to lower nice level to %d\n", nicelevel);
        isnice = false;
 }
 #else