Получение пользователя, но не 100%

This commit is contained in:
Alexander Zhirov 2025-08-29 02:33:55 +03:00
parent bc02ac8518
commit 2876a45a85
Signed by: alexander
GPG key ID: C8D8BE544A27C511
3 changed files with 159 additions and 1 deletions

View file

@ -2,6 +2,7 @@ module app;
import dfanotify; // твой модуль сверху
import depoll; // новый модуль для epoll
import event_actor;
import core.sys.posix.fcntl : O_RDONLY, O_LARGEFILE;
import core.stdc.errno : errno;
@ -277,7 +278,16 @@ void main(string[] args)
foreach (ev; events)
{
auto pname = eventProcessName(ev.pid);
writeln("pid = ", ev.pid, "\tproc = ", pname, "\tmask = ", maskToStr(ev.mask));
// writeln("pid = ", ev.pid, "\tproc = ", pname, "\tmask = ", maskToStr(ev.mask));
writefln("[%s] pid = %s proc = %s mask = %s",
(tag == TAG_PRE) ? "PRE" : "NOTIF",
ev.pid, pname,
maskToStr(ev.mask)
);
auto actor = eventActorFromPid(ev.pid);
writeln("user=", actor.user, " uid=", actor.uid,
" ruid=", actor.ruid, "(", actor.ruser, ")",
" euid=", actor.euid, "(", actor.euser, ")");
if (tag == TAG_PRE && (ev.isOpenPerm || ev.isAccessPerm))
{
@ -329,6 +339,10 @@ void main(string[] args)
// snag --config ... create --comment "CLOSE_WRITE - <name>" ...
writefln(" -> HANDLE CLOSE_WRITE for: %s", ev.name);
}
else if (ev.isMoved)
{
writefln(" -> HANDLE MOVED for: %s", ev.name);
}
else if (ev.isModify)
{
writefln(" -> HANDLE MODIFY for: %s", ev.name);