-
Notifications
You must be signed in to change notification settings - Fork 557
Add GNU/Hurd support #1931
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
Add GNU/Hurd support #1931
Changes from 19 commits
71fbe04
e968bca
1a2f4b4
e508100
add2bfd
d553bc4
5342430
75a023f
82a1eaf
1d32344
20fafa5
4a7b3a8
e9104c3
74e0732
4b7f231
062963d
0b2c044
13110e3
a80ea2b
588c4c0
0998b1e
bfb93cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "netif.h" | ||
#include "common/io/io.h" | ||
|
||
#include <net/if.h> | ||
#include <stdio.h> | ||
|
||
#define FF_STR_INDIR(x) #x | ||
#define FF_STR(x) FF_STR_INDIR(x) | ||
|
||
bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result) | ||
{ | ||
// Based on netif_linux.c before 5e770dc8b019702ca458cc0cad46161ebec608a4 | ||
FILE* FF_AUTO_CLOSE_FILE netRoute = fopen("/proc/route", "r"); | ||
|
||
if (!netRoute) return false; | ||
|
||
// skip first line | ||
FF_UNUSED(fscanf(netRoute, "%*[^\n]\n")); | ||
unsigned long long destination; //, gateway, flags, refCount, use, metric, mask, mtu, ... | ||
while (fscanf(netRoute, "%" FF_STR(IF_NAMESIZE) "s%llx%*[^\n]", result->ifName, &destination) == 2) | ||
{ | ||
if (destination != 0) continue; | ||
result->ifIndex = if_nametoindex(result->ifName); | ||
// TODO: Get the preferred source address | ||
return true; | ||
} | ||
result->ifName[0] = '0'; | ||
return false; | ||
} | ||
|
||
bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result) | ||
{ | ||
// TODO: AF_INET6 | ||
return false; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ const char* ffDetectInitSystem(FFInitSystemResult* result) | |
|
||
if (instance.config.general.detectVersion) | ||
{ | ||
#if __linux__ && !__ANDROID__ | ||
#if (defined(__linux__) && !defined(__ANDROID__)) || defined(__GNU__) | ||
if (ffStrbufEqualS(&result->name, "systemd")) | ||
{ | ||
ffBinaryExtractStrings(result->exe.chars, extractSystemdVersion, &result->version, (uint32_t) strlen("systemd 0.0 running in x")); | ||
|
@@ -84,6 +84,20 @@ const char* ffDetectInitSystem(FFInitSystemResult* result) | |
ffStrbufSubstrAfterLastC(&result->version, ' '); | ||
} | ||
} | ||
else if (ffStrbufEqualS(&result->name, "guile")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would not add this as it is just misleading and wrong Instead it would be better to try to support shepherd instead but this can be done in a followup at a later time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't use guix. Google said that guile is a programing language. Is guile here the name of guile interpreter process? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the main shepherd program is a guile script that starts with
Right now the guile version is being detected which is not the version of the initsystem. There is also a minor problem that on non-linux systems
I guess this can be detected by checking if the line starts with I'll see if I can make this work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We did similar special handling for python. Perhaps we can use the same logic. |
||
{ | ||
// TODO: guile is actually shepherd | ||
if (ffProcessAppendStdOut(&result->version, (char* const[]) { | ||
ffStrbufEndsWithS(&result->exe, "/guile") ? result->exe.chars : "guile", | ||
"--version", | ||
NULL, | ||
}) == NULL && result->version.length) | ||
{ | ||
// guile (GNU Guile) 3.0.9 | ||
ffStrbufSubstrBeforeFirstC(&result->version, '\n'); | ||
ffStrbufSubstrAfterLastC(&result->version, ' '); | ||
} | ||
} | ||
#elif __APPLE__ | ||
if (ffStrbufEqualS(&result->name, "launchd")) | ||
{ | ||
|
Uh oh!
There was an error while loading. Please reload this page.