Skip to content

Commit 83e357b

Browse files
committed
Refactored utsname
1 parent e40665c commit 83e357b

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

qiling/os/posix/syscall/utsname.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@
33
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
#
55

6+
from qiling import Qiling
67

7-
from qiling.const import *
8-
from qiling.os.linux.thread import *
9-
from qiling.const import *
10-
from qiling.os.posix.filestruct import *
11-
from qiling.os.filestruct import *
12-
from qiling.os.posix.const_mapping import *
13-
from qiling.exception import *
8+
def ql_syscall_uname(ql: Qiling, buf: int):
9+
UTSLEN = 65
1410

15-
def ql_syscall_uname(ql, address, *args, **kw):
16-
buf = b''
17-
buf += b'QilingOS'.ljust(65, b'\x00')
18-
buf += b'ql_vm'.ljust(65, b'\x00')
19-
buf += b'99.0-RELEASE'.ljust(65, b'\x00')
20-
buf += b'QilingOS 99.0-RELEASE r1'.ljust(65, b'\x00')
21-
buf += b'ql_processor'.ljust(65, b'\x00')
22-
buf += b''.ljust(65, b'\x00')
23-
ql.mem.write(address, buf)
24-
regreturn = 0
25-
return regreturn
11+
fields = (
12+
b'QilingOS', # sysname
13+
b'ql_vm', # nodename
14+
b'99.0-RELEASE', # release
15+
b'QilingOS 99.0-RELEASE r1', # version
16+
b'ql_processor', # machine
17+
b'' # domainname
18+
)
19+
20+
for i, f in enumerate(fields):
21+
ql.mem.write(buf + i * UTSLEN, f.ljust(UTSLEN, b'\x00'))
22+
23+
return 0

0 commit comments

Comments
 (0)