this repo has no description
1
fork

Configure Feed

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

Support proc info PROC_PIDTBSDINFO

+51
+51
src/kernel/emulation/linux/misc/proc_info.c
··· 80 80 static long _proc_pidinfo_regionpathinfo(int32_t pid, uint64_t arg, void* buffer, int32_t bufsize); 81 81 static long _proc_pidinfo_shortbsdinfo(int32_t pid, void* buffer, int32_t bufsize); 82 82 static long _proc_pidonfo_uniqinfo(int32_t pid, void* buffer, int32_t bufsize); 83 + static long _proc_pidinfo_tbsdinfo(int32_t pid, void* buffer, int32_t bufsize); 84 + static long _proc_pidinfo_pidthreadinfo(int32_t pid, void* buffer, int32_t bufsize); 83 85 84 86 long _proc_pidinfo(int32_t pid, uint32_t flavor, uint64_t arg, void* buffer, int32_t bufsize) 85 87 { ··· 101 103 { 102 104 return _proc_pidonfo_uniqinfo(pid, buffer, bufsize); 103 105 } 106 + case PROC_PIDTBSDINFO: 107 + { 108 + return _proc_pidinfo_tbsdinfo(pid, buffer, bufsize); 109 + } 110 + /* Not implemented yet 111 + case PROC_PIDTHREADINFO: 112 + { 113 + return _proc_pidinfo_pidthreadinfo(pid, buffer, bufsize); 114 + } 115 + */ 104 116 default: 105 117 { 106 118 __simple_printf("sys_proc_info(): Unsupported pidinfo flavor: %d\n", ··· 179 191 180 192 #endif 181 193 return 1; 194 + } 195 + 196 + static long _proc_pidinfo_tbsdinfo(int32_t pid, void* buffer, int32_t bufsize) 197 + { 198 + struct proc_bsdinfo* info = (struct proc_bsdinfo*) buffer; 199 + 200 + if (bufsize < sizeof(*info)) 201 + return -ENOSPC; 202 + 203 + struct proc_bsdshortinfo shortinfo; 204 + int err = _proc_pidinfo_shortbsdinfo(pid, &shortinfo, sizeof(shortinfo)); 205 + 206 + if (err < 0) 207 + return err; 208 + 209 + memset(info, 0, sizeof(*info)); 210 + info->pbi_flags = shortinfo.pbsi_flags; 211 + info->pbi_status = shortinfo.pbsi_status; 212 + // info->pbi_xstatus 213 + info->pbi_pid = shortinfo.pbsi_pid; 214 + info->pbi_ppid = shortinfo.pbsi_ppid; 215 + info->pbi_uid = shortinfo.pbsi_uid; 216 + info->pbi_gid = shortinfo.pbsi_gid; 217 + info->pbi_ruid = shortinfo.pbsi_ruid; 218 + info->pbi_rgid = shortinfo.pbsi_rgid; 219 + info->pbi_svuid = shortinfo.pbsi_svuid; 220 + info->pbi_svgid = shortinfo.pbsi_svgid; 221 + info->pbi_pgid = shortinfo.pbsi_pgid; 222 + // info->pbi_nice 223 + // info->pbi_start 224 + 225 + memcpy(info->pbi_comm, shortinfo.pbsi_comm, sizeof(info->pbi_comm)); 226 + 227 + return err; 228 + } 229 + 230 + static long _proc_pidinfo_pidthreadinfo(int32_t pid, void* buffer, int32_t bufsize) 231 + { 232 + // TODO 182 233 } 183 234 184 235 static long _proc_pidinfo_shortbsdinfo(int32_t pid, void* buffer, int32_t bufsize)