@@ -19,12 +19,12 @@ def _constant_mapping(bits: int, d_map: Mapping[str, int], ret: MutableSequence[
19
19
return b_map [bits ]
20
20
21
21
for val , sym in b_map .items ():
22
- if val & bits != 0 :
22
+ if val & bits :
23
23
bits ^= val
24
24
ret .append (sym )
25
25
26
- if bits != 0 :
27
- ret .append (str ( bits ) )
26
+ if bits :
27
+ ret .append (f' { bits :#x } ' )
28
28
29
29
return " | " .join (ret )
30
30
@@ -225,12 +225,12 @@ def open_flags_mapping(flags, arch):
225
225
arm64_open_flags = arm_open_flags
226
226
227
227
mapping_dict = {
228
- QL_ARCH .X86 : linux_open_flags ,
229
- QL_ARCH .X8664 : linux_open_flags ,
230
- QL_ARCH .ARM : arm_open_flags ,
231
- QL_ARCH .ARM64 : arm64_open_flags ,
232
- QL_ARCH .MIPS : mips_open_flags ,
233
- QL_OS .MACOS : mac_open_flags ,
228
+ QL_ARCH .X86 : linux_open_flags ,
229
+ QL_ARCH .X8664 : linux_open_flags ,
230
+ QL_ARCH .ARM : arm_open_flags ,
231
+ QL_ARCH .ARM64 : arm64_open_flags ,
232
+ QL_ARCH .MIPS : mips_open_flags ,
233
+ QL_OS .MACOS : mac_open_flags ,
234
234
}[arch ]
235
235
236
236
ret = ["O_RDONLY" ]
@@ -279,43 +279,44 @@ def mmap_prot_mapping(prots):
279
279
280
280
def socket_type_mapping (t , arch ):
281
281
socket_type_map = {
282
- QL_ARCH .X86 : linux_socket_types ,
283
- QL_ARCH .X8664 : linux_socket_types ,
284
- QL_ARCH .ARM : arm_socket_types ,
285
- QL_ARCH .ARM_THUMB : arm_socket_types ,
286
- QL_ARCH .ARM64 : arm_socket_types ,
287
- QL_ARCH .MIPS : mips_socket_types ,
288
- QL_OS .MACOS : linux_socket_types ,
282
+ QL_ARCH .X86 : linux_socket_types ,
283
+ QL_ARCH .X8664 : linux_socket_types ,
284
+ QL_ARCH .ARM : arm_socket_types ,
285
+ QL_ARCH .ARM_THUMB : arm_socket_types ,
286
+ QL_ARCH .ARM64 : arm_socket_types ,
287
+ QL_ARCH .MIPS : mips_socket_types ,
288
+ QL_OS .MACOS : linux_socket_types ,
289
289
}[arch ]
290
290
291
291
# https://code.woboq.org/linux/linux/net/socket.c.html#1363
292
292
t &= SOCK_TYPE_MASK
293
+
293
294
return _constant_mapping (t , socket_type_map , single_mapping = True )
294
295
295
296
296
297
def socket_domain_mapping (p , arch ):
297
298
socket_domain_map = {
298
- QL_ARCH .X86 : linux_socket_domain ,
299
- QL_ARCH .X8664 : linux_socket_domain ,
300
- QL_ARCH .ARM : arm_socket_domain ,
301
- QL_ARCH .ARM_THUMB : arm_socket_domain ,
302
- QL_ARCH .ARM64 : arm_socket_domain ,
303
- QL_ARCH .MIPS : mips_socket_domain ,
304
- QL_OS .MACOS : macos_socket_domain ,
299
+ QL_ARCH .X86 : linux_socket_domain ,
300
+ QL_ARCH .X8664 : linux_socket_domain ,
301
+ QL_ARCH .ARM : arm_socket_domain ,
302
+ QL_ARCH .ARM_THUMB : arm_socket_domain ,
303
+ QL_ARCH .ARM64 : arm_socket_domain ,
304
+ QL_ARCH .MIPS : mips_socket_domain ,
305
+ QL_OS .MACOS : macos_socket_domain ,
305
306
}[arch ]
306
307
307
308
return _constant_mapping (p , socket_domain_map , single_mapping = True )
308
309
309
310
310
311
def socket_level_mapping (t , arch ):
311
312
socket_level_map = {
312
- QL_ARCH .X86 : linux_socket_level ,
313
- QL_ARCH .X8664 : linux_socket_level ,
314
- QL_ARCH .ARM : arm_socket_level ,
315
- QL_ARCH .ARM_THUMB : arm_socket_level ,
316
- QL_ARCH .ARM64 : arm_socket_level ,
317
- QL_ARCH .MIPS : mips_socket_level ,
318
- QL_OS .MACOS : linux_socket_level ,
313
+ QL_ARCH .X86 : linux_socket_level ,
314
+ QL_ARCH .X8664 : linux_socket_level ,
315
+ QL_ARCH .ARM : arm_socket_level ,
316
+ QL_ARCH .ARM_THUMB : arm_socket_level ,
317
+ QL_ARCH .ARM64 : arm_socket_level ,
318
+ QL_ARCH .MIPS : mips_socket_level ,
319
+ QL_OS .MACOS : linux_socket_level ,
319
320
}[arch ]
320
321
321
322
return _constant_mapping (t , socket_level_map , single_mapping = True )
@@ -337,13 +338,13 @@ def socket_ip_option_mapping(t, arch):
337
338
338
339
def socket_option_mapping (t , arch ):
339
340
socket_option_map = {
340
- QL_ARCH .X86 : linux_socket_options ,
341
- QL_ARCH .X8664 : linux_socket_options ,
342
- QL_ARCH .ARM : arm_socket_options ,
343
- QL_ARCH .ARM_THUMB : arm_socket_options ,
344
- QL_ARCH .ARM64 : arm_socket_options ,
345
- QL_ARCH .MIPS : mips_socket_options ,
346
- QL_OS .MACOS : linux_socket_options ,
341
+ QL_ARCH .X86 : linux_socket_options ,
342
+ QL_ARCH .X8664 : linux_socket_options ,
343
+ QL_ARCH .ARM : arm_socket_options ,
344
+ QL_ARCH .ARM_THUMB : arm_socket_options ,
345
+ QL_ARCH .ARM64 : arm_socket_options ,
346
+ QL_ARCH .MIPS : mips_socket_options ,
347
+ QL_OS .MACOS : linux_socket_options ,
347
348
}[arch ]
348
349
349
350
return _constant_mapping (t , socket_option_map , single_mapping = True )
0 commit comments