Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ for Linux, written on the kernel's own system-call interface.
openkal = "0.23.0"

[target.'cfg(os = "linux")'.dependencies]
openkal-linux = "0.24.1"
openkal-linux = "0.24.2"
```

## Why it does not use a C library
Expand Down Expand Up @@ -227,7 +227,9 @@ and later) instead of polling.

A unit is a process group, and its use is the sum over the entries of /proc
whose group is the unit's --- every program in it, including those its members
started; one read per program on the machine, made only when a caller asks.
started. Every visible program's group is queried; resident memory is read for
matching programs. If the group query is refused, the same /proc record supplies
both membership and memory. Nothing is retained between observations.
`KAL_PROCESS_PROP_JOB_USAGE` is claimed.

**A limit on a unit is supervised.** `kal_process_job_limit` starts, with the
Expand Down
2 changes: 1 addition & 1 deletion mcpp.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
namespace = "mcpplibs"
name = "openkal-linux"
version = "0.24.1"
version = "0.24.2"
description = "The reference implementation of openkal for Linux, written on the kernel's own system-call interface so that it can be placed beneath a C library as well as above one."
license = "Apache-2.0"

Expand Down
6 changes: 6 additions & 0 deletions src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,12 @@ kal_u32 members_of(okl_long unit, okl_u64& memory) {
if (name[0] < '1' || name[0] > '9') continue;
okl_long pid = 0;
for (const char* c = name; *c; ++c) pid = pid * 10 + (*c - '0');
// Most visible programs belong to other units. Ask for the group
// before opening a record whose memory will then be discarded.
// A denied or unavailable query keeps the record-reading path;
// even a positive query is checked again in that same RSS record.
const okl_long group = okl::sys(okl::nr_getpgid, pid);
if (!okl::failed(group) && group != unit) continue;
char b[1024];
const okl_long len = read_stat(pid, b);
if (len <= 0) continue;
Expand Down
4 changes: 2 additions & 2 deletions src/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ enum : okl_long {
// openkal 0.13: whether a node may be started
nr_fchmodat = 268,
// openkal 0.11: the directory a started program runs in, and the unit it joins
nr_fchdir = 81, nr_setpgid = 109, nr_rt_sigaction = 13,
nr_fchdir = 81, nr_setpgid = 109, nr_getpgid = 121, nr_rt_sigaction = 13,
// openkal.net and openkal.datagram
nr_socket = 41, nr_connect = 42, nr_accept = 43, nr_sendto = 44,
nr_recvfrom = 45, nr_shutdown = 48, nr_bind = 49, nr_listen = 50,
Expand Down Expand Up @@ -223,7 +223,7 @@ enum : okl_long {
// openkal 0.13: whether a node may be started
nr_fchmodat = 53,
// openkal 0.11: the directory a started program runs in, and the unit it joins
nr_fchdir = 50, nr_setpgid = 154, nr_rt_sigaction = 134,
nr_fchdir = 50, nr_setpgid = 154, nr_getpgid = 155, nr_rt_sigaction = 134,
// openkal.net and openkal.datagram
nr_socket = 198, nr_connect = 203, nr_accept = 202, nr_sendto = 206,
nr_recvfrom = 207, nr_shutdown = 210, nr_bind = 200, nr_listen = 201,
Expand Down
Loading