Skip to content

Commit

Permalink
Create /proc/ish and populate /proc/ish/version
Browse files Browse the repository at this point in the history
  • Loading branch information
saagarjha committed Dec 26, 2021
1 parent f2d0489 commit a2df244
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ @interface AppDelegate ()

@property BOOL exiting;
@property NSString *unameVersion;
@property NSString *ishVersion;
@property NSString *unameHostname;
@property SCNetworkReachabilityRef reachability;

Expand Down Expand Up @@ -265,10 +266,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

#if !ISH_LINUX
self.unameVersion = [NSString stringWithFormat:@"iSH %@ (%@)",
self.ishVersion = [NSString stringWithFormat:@"iSH %@ (%@)",
[NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
[NSBundle.mainBundle objectForInfoDictionaryKey:(NSString *) kCFBundleVersionKey]];
extern const char *uname_version;
uname_version = self.unameVersion.UTF8String;
extern const char *proc_ish_version;
proc_ish_version = self.ishVersion.UTF8String;
// this defaults key is set when taking app store screenshots
self.unameHostname = [NSUserDefaults.standardUserDefaults stringForKey:@"hostnameOverride"];
extern const char *uname_hostname_override;
Expand Down
1 change: 1 addition & 0 deletions fs/proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct proc_children {

extern struct proc_dir_entry proc_root;
extern struct proc_dir_entry proc_pid;
extern struct proc_children proc_ish_children;

mode_t_ proc_entry_mode(struct proc_entry *entry);
void proc_entry_getname(struct proc_entry *entry, char *buf);
Expand Down
14 changes: 14 additions & 0 deletions fs/proc/ish.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "fs/proc.h"
#include <sys/stat.h>

const char *proc_ish_version = "";

static int proc_ish_show_version(struct proc_entry *UNUSED(entry), struct proc_data *buf) {
proc_printf(buf, "%s\n", proc_ish_version);
return 0;
}

struct proc_children proc_ish_children = PROC_CHILDREN({
{"version", .show = proc_ish_show_version},
});

1 change: 1 addition & 0 deletions fs/proc/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static int proc_show_mounts(struct proc_entry *UNUSED(entry), struct proc_data *

// in alphabetical order
struct proc_dir_entry proc_root_entries[] = {
{"ish", S_IFDIR, .children = &proc_ish_children},
{"meminfo", .show = proc_show_meminfo},
{"mounts", .show = proc_show_mounts},
{"self", S_IFLNK, .readlink = proc_readlink_self},
Expand Down
6 changes: 5 additions & 1 deletion iSH.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
49302D8E277669D300C9885A /* ish.c in Sources */ = {isa = PBXBuildFile; fileRef = 49302D8D277669D300C9885A /* ish.c */; };
497F6CF5254E5EA500C82F46 /* float80-test.c in Sources */ = {isa = PBXBuildFile; fileRef = 497F6C5A254E5C7E00C82F46 /* float80-test.c */; };
497F6CF6254E5EA500C82F46 /* float80.c in Sources */ = {isa = PBXBuildFile; fileRef = 497F6C66254E5C7F00C82F46 /* float80.c */; };
497F6CF7254E5EA500C82F46 /* fpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 497F6C5D254E5C7E00C82F46 /* fpu.c */; };
Expand Down Expand Up @@ -377,6 +378,7 @@
/* Begin PBXFileReference section */
408A2639236440F8008A4E81 /* iOSFS.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iOSFS.m; sourceTree = "<group>"; };
408A263B23644102008A4E81 /* iOSFS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iOSFS.h; sourceTree = "<group>"; };
49302D8D277669D300C9885A /* ish.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ish.c; sourceTree = "<group>"; };
494D03F72727DAC6004F0CCE /* xcode-ninja.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "xcode-ninja.sh"; sourceTree = "<group>"; };
497F6BDA254E5C0D00C82F46 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = "<group>"; };
497F6BDB254E5C0D00C82F46 /* path.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = path.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -737,9 +739,10 @@
497F6BF1254E5C0D00C82F46 /* proc */ = {
isa = PBXGroup;
children = (
497F6BF4254E5C0D00C82F46 /* entry.c */,
49302D8D277669D300C9885A /* ish.c */,
497F6BF2254E5C0D00C82F46 /* pid.c */,
497F6BF3254E5C0D00C82F46 /* root.c */,
497F6BF4254E5C0D00C82F46 /* entry.c */,
);
path = proc;
sourceTree = "<group>";
Expand Down Expand Up @@ -1952,6 +1955,7 @@
497F6D36254E5EA600C82F46 /* user.c in Sources */,
497F6D37254E5EA600C82F46 /* vdso.c in Sources */,
497F6D38254E5EA600C82F46 /* darwin.c in Sources */,
49302D8E277669D300C9885A /* ish.c in Sources */,
497F6D39254E5EA600C82F46 /* linux.c in Sources */,
497F6D3A254E5EA600C82F46 /* fifo.c in Sources */,
497F6D3B254E5EA600C82F46 /* sync.c in Sources */,
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ if get_option('kernel') == 'ish'

'fs/proc.c',
'fs/proc/entry.c',
'fs/proc/ish.c',
'fs/proc/root.c',
'fs/proc/pid.c',

Expand Down

0 comments on commit a2df244

Please sign in to comment.