Skip to content

Commit

Permalink
Merge pull request #166 from emkey1/507
Browse files Browse the repository at this point in the history
B508 Changes
  • Loading branch information
emkey1 authored Dec 31, 2023
2 parents 6028ba8 + 096026c commit fe21c7c
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 20 deletions.
7 changes: 4 additions & 3 deletions fs/fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ int fd_close(struct fd *fd) {
if (fd->mount)
mount_release(fd->mount);
free(fd);
// fd = NULL; // KLUGE?
}
return err;
}
Expand Down Expand Up @@ -161,7 +162,7 @@ struct fd *f_get(fd_t f) {
static fd_t f_install_start(struct fd *fd, fd_t start) {
assert(start >= 0);
struct fdtable *table = current->files;
unsigned size = rlimit(RLIMIT_NOFILE_);
unsigned size = (unsigned)rlimit(RLIMIT_NOFILE_);
if (size > table->size)
size = table->size;

Expand Down Expand Up @@ -341,8 +342,8 @@ dword_t sys_fcntl(fd_t f, dword_t cmd, dword_t arg) {
if (err >= 0) {
flock32.type = flock.type;
flock32.whence = flock.whence;
flock32.start = flock.start;
flock32.len = flock.len;
flock32.start = (unsigned)flock.start;
flock32.len = (unsigned)flock.len;
flock32.pid = flock.pid;
if (user_write(arg, &flock32, sizeof(flock32)))
return _EFAULT;
Expand Down
8 changes: 8 additions & 0 deletions fs/proc/ish.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ bool (*set_user_default)(const char *name, char *buffer, size_t size);
bool (*remove_user_default)(const char *name);
char *(*get_documents_directory)(void);

extern char* printHostInfo(void);

static int proc_ish_show_colors(struct proc_entry *UNUSED(entry), struct proc_data *buf) {
proc_printf(buf,
"\x1B[30m" "iSH" "\x1B[39m "
Expand Down Expand Up @@ -297,6 +299,11 @@ static int proc_ish_show_uidevice(struct proc_entry *UNUSED(entry), struct proc_
return 0;
}

static int proc_ish_show_host_info(struct proc_entry *UNUSED(entry), struct proc_data *buf) {
proc_printf(buf, "%s", printHostInfo());
return 0;
}

struct proc_children proc_ish_children = PROC_CHILDREN({
{"BAT0", .show = proc_ish_show_battery},
{"BAT0_capacity", .show = proc_ish_show_battery_capacity},
Expand All @@ -306,6 +313,7 @@ struct proc_children proc_ish_children = PROC_CHILDREN({
{".defaults", S_IFDIR, .readdir = proc_ish_underlying_defaults_readdir},
{"defaults", S_IFDIR, .readdir = proc_ish_defaults_readdir},
{"documents", .show = proc_ish_show_documents},
{"host_info", .show = proc_ish_show_host_info}, // Add host hardware related information
{"ips", .show = proc_ish_show_ips},
{"version", .show = proc_ish_show_version},
});
32 changes: 18 additions & 14 deletions iSH-AOK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
5D8CFA862B1198B300D50E57 /* RTCDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D8CFA842B1198B300D50E57 /* RTCDevice.m */; };
5D8CFA872B1198B300D50E57 /* RTCDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D8CFA842B1198B300D50E57 /* RTCDevice.m */; };
5DA0A8342AAE21D000397280 /* BatteryStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DA0A8332AAE21D000397280 /* BatteryStatus.m */; };
5DABED382B41E2150078F3FB /* hostinfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DABED372B41E2150078F3FB /* hostinfo.m */; };
5DABED392B41E2150078F3FB /* hostinfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DABED372B41E2150078F3FB /* hostinfo.m */; };
5DD383EB2AAE33330013A847 /* UIDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DD383EA2AAE33330013A847 /* UIDevice.m */; };
BB0F552E239F8A790032A2A1 /* Icons.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB0F552D239F8A790032A2A1 /* Icons.plist */; };
BB10E5C9248DBAAC009C7A74 /* libarchive.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BB10E5C8248DBAA1009C7A74 /* libarchive.a */; platformFilter = ios; };
Expand Down Expand Up @@ -599,13 +601,13 @@
5D8ACEFB284CE096003C50D3 /* sys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sys.h; sourceTree = "<group>"; };
5D8ACEFC284CE096003C50D3 /* sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sys.c; sourceTree = "<group>"; };
5D8C94D3287E53AD0095EDEE /* fp_sync.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fp_sync.c; sourceTree = "<group>"; };
5D8CEFF92894C81400D24ED8 /* resource_locking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource_locking.h; sourceTree = "<group>"; };
5D8CFA842B1198B300D50E57 /* RTCDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RTCDevice.m; sourceTree = "<group>"; };
5D8CFA882B1198DB00D50E57 /* RTCDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCDevice.h; sourceTree = "<group>"; };
5D9897CE28B6B953003D3670 /* AppStore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = AppStore.xcconfig; sourceTree = "<group>"; };
5D9897CF28B6B953003D3670 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
5DA0A8332AAE21D000397280 /* BatteryStatus.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BatteryStatus.m; sourceTree = "<group>"; };
5DA0A8352AAE224100397280 /* BatteryStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BatteryStatus.h; sourceTree = "<group>"; };
5DABED372B41E2150078F3FB /* hostinfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = hostinfo.m; sourceTree = "<group>"; };
5DD383EA2AAE33330013A847 /* UIDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIDevice.m; sourceTree = "<group>"; };
5DD383EC2AAE33920013A847 /* UIDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDevice.h; sourceTree = "<group>"; };
650B337222EA235C00B4C03E /* PasteboardDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasteboardDevice.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1145,8 +1147,8 @@
BB7D933C2087C2880008DA78 /* kernel */ = {
isa = PBXGroup;
children = (
5D8CEFF92894C81400D24ED8 /* resource_locking.h */,
497F6C9F254E5C9800C82F46 /* calls.c */,
5DABED372B41E2150078F3FB /* hostinfo.m */,
497F6C7B254E5C9700C82F46 /* calls.h */,
497F6C82254E5C9700C82F46 /* elf.h */,
497F6C7D254E5C9700C82F46 /* epoll.c */,
Expand Down Expand Up @@ -2105,6 +2107,7 @@
497F6D2C254E5EA600C82F46 /* mmap.c in Sources */,
497F6D2D254E5EA600C82F46 /* poll.c in Sources */,
497F6D2E254E5EA600C82F46 /* ptrace.c in Sources */,
5DABED392B41E2150078F3FB /* hostinfo.m in Sources */,
497F6D2F254E5EA600C82F46 /* random.c in Sources */,
497F6D30254E5EA600C82F46 /* resource.c in Sources */,
497F6D31254E5EA600C82F46 /* signal.c in Sources */,
Expand Down Expand Up @@ -2150,6 +2153,7 @@
5D8ACEFD284CE096003C50D3 /* sys.c in Sources */,
BB28C7BA268975AA00BDC834 /* iOSFS.m in Sources */,
BB28C7BC268975B000BDC834 /* PasteboardDevice.m in Sources */,
5DABED382B41E2150078F3FB /* hostinfo.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -2572,7 +2576,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -2598,7 +2602,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -2633,7 +2637,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -2657,7 +2661,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK";
Expand All @@ -2682,7 +2686,7 @@
CODE_SIGN_ENTITLEMENTS = app/FileProvider/iSHFileProvider.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
INFOPLIST_FILE = app/FileProvider/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK.FileProvider";
Expand Down Expand Up @@ -2793,7 +2797,7 @@
CODE_SIGN_ENTITLEMENTS = app/FileProvider/iSHFileProvider.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
INFOPLIST_FILE = app/FileProvider/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK.FileProvider";
Expand All @@ -2811,7 +2815,7 @@
CODE_SIGN_ENTITLEMENTS = iSHFileProviderRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
INFOPLIST_FILE = app/FileProvider/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK.FileProvider";
Expand Down Expand Up @@ -2914,7 +2918,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK";
Expand All @@ -2929,7 +2933,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK";
Expand Down Expand Up @@ -2957,7 +2961,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -2980,7 +2984,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK";
Expand All @@ -3005,7 +3009,7 @@
CODE_SIGN_ENTITLEMENTS = app/FileProvider/iSHFileProvider.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 508;
DEVELOPMENT_TEAM = UYU5FM4LQ4;
INFOPLIST_FILE = app/FileProvider/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = "app.ish.iSH-AOK.FileProvider";
Expand Down
149 changes: 149 additions & 0 deletions kernel/hostinfo.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
//
// hostinfo.m
// iSH-AOK
//
// Created by Michael Miller on 12/25/23.
//

#import <Foundation/Foundation.h>
#import <sys/utsname.h>

NSString* translateDeviceIdentifier(NSString *identifier) {
NSDictionary<NSString *, NSString *> *deviceNames = @{
// iPhones with 64-bit Processors
@"arm64": @"iDevice Simulator (ARM)",
@"x86_64": @"iDevice Simulator (x86_64)",
@"iPhone6,1": @"iPhone 5S (GSM)",
@"iPhone6,2": @"iPhone 5S (Global)",
@"iPhone7,1": @"iPhone 6 Plus",
@"iPhone7,2": @"iPhone 6",
@"iPhone8,1": @"iPhone 6s",
@"iPhone8,2": @"iPhone 6s Plus",
@"iPhone8,4": @"iPhone SE (GSM)",
@"iPhone9,1": @"iPhone 7",
@"iPhone9,2": @"iPhone 7 Plus",
@"iPhone9,3": @"iPhone 7",
@"iPhone9,4": @"iPhone 7 Plus",
@"iPhone10,1" : @"iPhone 8",
@"iPhone10,2": @"iPhone 8 Plus",
@"iPhone10,3": @"iPhone X Global",
@"iPhone10,4": @"iPhone 8",
@"iPhone10,5": @"iPhone 8 Plus",
@"iPhone10,6": @"iPhone X GSM",
@"iPhone11,2": @"iPhone XS",
@"iPhone11,4": @"iPhone XS Max",
@"iPhone11,6": @"iPhone XS Max Global",
@"iPhone11,8": @"iPhone XR",
@"iPhone12,1": @"iPhone 11",
@"iPhone12,3": @"iPhone 11 Pro",
@"iPhone12,5": @"iPhone 11 Pro Max",
@"iPhone12,8": @"iPhone SE 2nd Gen",
@"iPhone13,1": @"iPhone 12 Mini",
@"iPhone13,2": @"iPhone 12",
@"iPhone13,3": @"iPhone 12 Pro",
@"iPhone13,4": @"iPhone 12 Pro Max",
@"iPhone14,2": @"iPhone 13 Pro",
@"iPhone14,3": @"iPhone 13 Pro Max",
@"iPhone14,4": @"iPhone 13 Mini",
@"iPhone14,5": @"iPhone 13",
@"iPhone14,6": @"iPhone SE 3rd Gen",
@"iPhone14,7": @"iPhone 14",
@"iPhone14,8": @"iPhone 14 Plus",
@"iPhone15,2": @"iPhone 14 Pro",
@"iPhone15,3": @"iPhone 14 Pro Max",
@"iPhone15,4": @"iPhone 15",
@"iPhone15,5": @"iPhone 15 Plus",
@"iPhone16,1": @"iPhone 15 Pro",
@"iPhone16,2": @"iPhone 15 Pro Max",
// iPads with 64-bit Processors
@"iPad4,1": @"iPad Air (WiFi)",
@"iPad4,2": @"iPad Air (GSM+CDMA)",
@"iPad4,3": @"1st Gen iPad Air (China)",
@"iPad4,4": @"iPad mini Retina (WiFi)",
@"iPad4,5": @"iPad mini Retina (GSM+CDMA)",
@"iPad4,6": @"iPad mini Retina (China)",
@"iPad4,7": @"iPad mini 3 (WiFi)",
@"iPad4,8": @"iPad mini 3 (GSM+CDMA)",
@"iPad4,9": @"iPad Mini 3 (China)",
@"iPad5,1": @"iPad mini 4 (WiFi)",
@"iPad5,2": @"4th Gen iPad mini (WiFi+Cellular)",
@"iPad5,3": @"iPad Air 2 (WiFi)",
@"iPad5,4": @"iPad Air 2 (Cellular)",
@"iPad6,3": @"iPad Pro (9.7 inch, WiFi)",
@"iPad6,4": @"iPad Pro (9.7 inch, WiFi+LTE)",
@"iPad6,7": @"iPad Pro (12.9 inch, WiFi)",
@"iPad6,8": @"iPad Pro (12.9 inch, WiFi+LTE)",
@"iPad7,3": @"iPad Pro 10.5-inch 2nd Gen",
@"iPad7,4": @"iPad Pro 10.5-inch 2nd Gen",
@"iPad7,5": @"iPad 6th Gen (WiFi)",
@"iPad7,6": @"iPad 6th Gen (WiFi+Cellular)",
@"iPad7,11": @"iPad 7th Gen 10.2-inch (WiFi)",
@"iPad7,12": @"iPad 7th Gen 10.2-inch (WiFi+Cellular)",
@"iPad8,1": @"iPad Pro 11 inch 3rd Gen (WiFi)",
@"iPad8,2": @"iPad Pro 11 inch 3rd Gen (1TB, WiFi)",
@"iPad8,3": @"iPad Pro 11 inch 3rd Gen (WiFi+Cellular)",
@"iPad8,4": @"iPad Pro 11 inch 3rd Gen (1TB, WiFi+Cellular)",
@"iPad8,5": @"iPad Pro 12.9 inch 3rd Gen (WiFi)",
@"iPad8,6": @"iPad Pro 12.9 inch 3rd Gen (1TB, WiFi)",
@"iPad8,7": @"iPad Pro 12.9 inch 3rd Gen (WiFi+Cellular)",
@"iPad8,8": @"iPad Pro 12.9 inch 3rd Gen (1TB, WiFi+Cellular)",
@"iPad8,9": @"iPad Pro 11 inch 4th Gen (WiFi)",
@"iPad8,10": @"iPad Pro 11 inch 4th Gen (WiFi+Cellular)",
@"iPad8,11": @"iPad Pro 12.9 inch 4th Gen (WiFi)",
@"iPad8,12": @"iPad Pro 12.9 inch 4th Gen (WiFi+Cellular)",
@"iPad11,1": @"iPad mini 5th Gen (WiFi)",
@"iPad11,2": @"iPad mini 5th Gen",
@"iPad11,3": @"iPad Air 3rd Gen (WiFi)",
@"iPad11,4": @"iPad Air 3rd Gen",
@"iPad11,6": @"iPad 8th Gen (WiFi)",
@"iPad11,7": @"iPad 8th Gen (WiFi+Cellular)",
@"iPad12,1": @"iPad 9th Gen (WiFi)",
@"iPad12,2": @"iPad 9th Gen (WiFi+Cellular)",
@"iPad14,1": @"iPad mini 6th Gen (WiFi)",
@"iPad14,2": @"iPad mini 6th Gen (WiFi+Cellular)",
@"iPad13,1": @"iPad Air 4th Gen (WiFi)",
@"iPad13,2": @"iPad Air 4th Gen (WiFi+Cellular)",
@"iPad13,4": @"iPad Pro 11 inch 3rd Gen (WiFi)",
@"iPad13,5": @"iPad Pro 11 inch 3rd Gen (WiFi+Cellular US)",
@"iPad13,6": @"iPad Pro 11 inch 3rd Gen (WiFi+Cellular Global)",
@"iPad13,7": @"iPad Pro 11 inch 3rd Gen (WiFi+Cellular China)",
@"iPad13,8": @"iPad Pro 12.9 inch 5th Gen",
@"iPad13,9": @"iPad Pro 12.9 inch 5th Gen",
@"iPad13,10": @"iPad Pro 12.9 inch 5th Gen",
@"iPad13,11": @"iPad Pro 12.9 inch 5th Gen",
@"iPad13,16": @"iPad Air 5th Gen (WiFi)",
@"iPad13,17": @"iPad Air 5th Gen (WiFi+Cellular)",
@"iPad13,18": @"iPad 10th Gen",
@"iPad13,19": @"iPad 10th Gen",
@"iPad14,3": @"iPad Pro 11 inch 4th Gen",
@"iPad14,4": @"iPad Pro 11 inch 4th Gen",
@"iPad14,5": @"iPad Pro 12.9 inch 6th Gen",
@"iPad14,6": @"iPad Pro 12.9 inch 6th Gen",
};

NSString *deviceName = deviceNames[identifier];
if (deviceName) {
return deviceName;
} else {
return identifier; // Return the original identifier if no mapping is found
}
}

char* printHostInfo(void) {
struct utsname systemInfo;
uname(&systemInfo);

NSString *machineIdentifier = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
NSString *translatedMachine = translateDeviceIdentifier(machineIdentifier);

// Create an NSString with formatted device info
NSString *deviceInfo = [NSString stringWithFormat:@"Host OS Name: %s\nHost OS Release: %s\nHost OS Version: %s\nHost Hardware: %@\n",
systemInfo.sysname, // Operating system name (e.g., Darwin)
systemInfo.release, // Operating system release (e.g., 20.3.0)
systemInfo.version, // Operating system version
translatedMachine]; // Translated hardware identifier

// Convert NSString to C-string
char *cString = strdup([deviceInfo UTF8String]);
return cString;
}
6 changes: 3 additions & 3 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@ void signal_delivery_stop(int sig, struct siginfo_ *info) {
lock(&current->sighand->lock, 0);
}

void receive_signals(void) { // Should this function have a check for critical_region_count? -mke
//nanosleep(&lock_pause, NULL);
void receive_signals(void) {
lock(&current->group->lock, 0);
bool was_stopped = current->group->stopped;
unlock(&current->group->lock);
Expand Down Expand Up @@ -739,7 +738,8 @@ static int kill_group(pid_t_ pgid, dword_t sig) {
}
struct tgroup *tgroup;
int err = _EPERM;
while((task_ref_cnt_get(current, 0)) || (locks_held_count(current))) { // Wait for now, task is in one or more critical sections, and/or has locks
struct task* foo = current; // Debugging
while((task_ref_cnt_get(current, 0) > 1) || (locks_held_count(current))) { // Wait for now, task is in one or more critical sections, and/or has locks
nanosleep(&lock_pause, NULL);
}
list_for_each_entry(&pid->pgroup, tgroup, pgroup) {
Expand Down

0 comments on commit fe21c7c

Please sign in to comment.