linux: Add more debug messages for newfstatat syscall

This commit is contained in:
EnderIce2 2024-10-16 02:11:36 +03:00
parent acabadaaab
commit 547ae94f80
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -2902,10 +2902,11 @@ static long linux_newfstatat(SysFrm *, int dirfd, const char *pathname,
if (pPathname == nullptr || pStatbuf == nullptr) if (pPathname == nullptr || pStatbuf == nullptr)
return -linux_EFAULT; return -linux_EFAULT;
debug("%s %#lx %#lx", pPathname, pathname, statbuf); debug("\"%s\" %#lx %#lx", pPathname, pathname, statbuf);
if (fs->PathIsAbsolute(pPathname)) if (fs->PathIsAbsolute(pPathname))
{ {
debug("path \"%s\" is absolute", pPathname);
struct kstat nstat = KStatToStat(*pStatbuf); struct kstat nstat = KStatToStat(*pStatbuf);
int ret = fdt->usr_stat(pPathname, &nstat); int ret = fdt->usr_stat(pPathname, &nstat);
*pStatbuf = StatToKStat(nstat); *pStatbuf = StatToKStat(nstat);
@ -2916,6 +2917,7 @@ static long linux_newfstatat(SysFrm *, int dirfd, const char *pathname,
{ {
case linux_AT_FDCWD: case linux_AT_FDCWD:
{ {
debug("dirfd is AT_FDCWD for \"%s\"", pPathname);
FileNode *node = fs->GetByPath(pPathname, pcb->CWD); FileNode *node = fs->GetByPath(pPathname, pcb->CWD);
if (!node) if (!node)
return -linux_ENOENT; return -linux_ENOENT;
@ -2927,12 +2929,14 @@ static long linux_newfstatat(SysFrm *, int dirfd, const char *pathname,
} }
default: default:
{ {
debug("dirfd is %d for \"%s\"", dirfd, pPathname);
auto it = fdt->FileMap.find(dirfd); auto it = fdt->FileMap.find(dirfd);
if (it == fdt->FileMap.end()) if (it == fdt->FileMap.end())
ReturnLogError(-linux_EBADF, "Invalid fd %d", dirfd); ReturnLogError(-linux_EBADF, "Invalid fd %d", dirfd);
vfs::FileDescriptorTable::Fildes &fildes = it->second; vfs::FileDescriptorTable::Fildes &fildes = it->second;
FileNode *node = fs->GetByPath(pPathname, fildes.Node); FileNode *node = fs->GetByPath(pPathname, fildes.Node);
debug("node: %s", node->GetPath().c_str());
if (!node) if (!node)
return -linux_ENOENT; return -linux_ENOENT;