this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use modprobe to load the kernel module

+13 -39
+13 -39
src/dyld/darling.c
··· 845 845 846 846 int loadKernelModule() 847 847 { 848 - int fd; 849 - // We need to check two paths due to DKMS 850 - // Ubuntu overrides our dkms.conf and forces the modules into the updates folder 851 - char miscpath[128], updatespath[128]; 852 - char* path; 853 - int errno_updatespath; 854 - struct utsname name; 855 - 856 - if (isModuleLoaded()) 857 - return 0; 858 - 859 - uname(&name); 860 - snprintf(miscpath, sizeof(miscpath), "/lib/modules/%s/kernel/misc/darling-mach.ko", name.release); 861 - snprintf(updatespath, sizeof(updatespath), "/lib/modules/%s/updates/dkms/darling-mach.ko", name.release); 848 + FILE* fp; 849 + char output[1024]; 862 850 863 - // Since miscpath is the normal location we check for it last 864 - if(access(updatespath, F_OK) == 0) 865 - { 866 - path = updatespath; 867 - } 868 - else if (errno_updatespath = errno, access(miscpath, F_OK) == 0) 869 - { 870 - path = miscpath; 871 - } 872 - else 851 + if ((fp = popen("/sbin/modprobe darling-mach", "r")) == NULL) 873 852 { 874 - fprintf(stderr, "Cannot find the darling-mach kernel module at %s: %s\n", updatespath, strerror(errno_updatespath)); 875 - fprintf(stderr, "Cannot find the darling-mach kernel module at %s: %s\n", miscpath, strerror(errno)); 853 + fprintf(stderr, "Failed to run modprobe\n"); 876 854 return 1; 877 855 } 878 856 879 - fd = open(path, O_RDONLY); 880 - if (fd < 0) 857 + while (fgets(output, sizeof(output), fp) != NULL) 881 858 { 882 - fprintf(stderr, "Cannot open the darling-mach kernel module at %s: %s\n", path, strerror(errno)); 883 - return 1; 859 + printf("%s", output); 884 860 } 885 861 886 - if (syscall(SYS_finit_module, fd, "", 0)) 862 + if (WEXITSTATUS(pclose(fp)) == 0) 887 863 { 888 - fprintf(stderr, "Cannot load the darling-mach kernel module: %s\n", strerror(errno)); 864 + fprintf(stderr, "Loaded kernel module successfully\n"); 865 + return 0; 866 + } 867 + else 868 + { 869 + fprintf(stderr, "Failed to load the kernel module\n"); 889 870 return 1; 890 871 } 891 - 892 - fprintf(stderr, "Loaded kernel module: %s\n", path); 893 - 894 - 895 - close(fd); 896 - 897 - return 0; 898 872 } 899 873 900 874 int unloadKernelModule()