Skip to content
Open
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
4 changes: 2 additions & 2 deletions qiling/os/freebsd/syscall.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from qiling import Qiling
from qiling.arch.x86_const import *
from qiling.os.freebsd.const import *
from qiling.os.posix.const import ENOENT
from qiling.os.posix.const_mapping import get_errno_class
from qiling.os.posix.syscall.unistd import ql_syscall_getcwd
from qiling.os.posix.syscall.stat import ql_syscall_newfstatat

Expand Down Expand Up @@ -89,7 +89,7 @@ def ql_syscall___sysctl(ql: Qiling, name: int, namelen: int, old: int, oldlenp:

ql.mem.write_ptr(oldlenp, out_len, 4, signed=True)

return -ENOENT
return -get_errno_class(ql.arch.type, ql.os.type).ENOENT.value

if vecs[0] == CTL_KERN:
if vecs[1] == KERN_OSRELDATE:
Expand Down
5 changes: 3 additions & 2 deletions qiling/os/linux/futex.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from gevent.event import Event
from queue import Queue

from qiling.os.posix.const_mapping import get_errno_class

class QlLinuxFutexManagement:

FUTEX_BITSET_MATCH_ANY = 0xffffffff
Expand All @@ -21,14 +23,13 @@ def wait_list(self):
return self._wait_list

def futex_wait(self, ql, uaddr, t, val, bitset=FUTEX_BITSET_MATCH_ANY):
EAGAIN = 11
def _sched_wait_event(cur_thread):
ql.log.debug(f"Wait for notifications.")
event.wait()
uaddr_value = ql.unpack32(ql.mem.read(uaddr, 4))
if uaddr_value != val:
ql.log.debug(f"uaddr: {hex(uaddr_value)} != {hex(val)}")
return -EAGAIN
return -get_errno_class(ql.arch.type, ql.os.type).EAGAIN.value
ql.emu_stop()
if uaddr not in self.wait_list.keys():
self.wait_list[uaddr] = Queue()
Expand Down
Loading