userspace: net sockets are kernel objects
Any data structure declaration tagged with __net_socket will end up in the kernel object table with type K_OBJ_NET_SOCKET. These all correspond to objects which are associated with socket file descriptors and can handle the socket vtable API. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
5960119f16
commit
299ec8f1b5
3 changed files with 20 additions and 3 deletions
|
@ -132,11 +132,17 @@
|
|||
#define __syscall
|
||||
#endif /* #ifndef ZTEST_UNITTEST */
|
||||
|
||||
/* Used as a sentinel by parse_syscalls.py to identify what API structs
|
||||
* define driver subsystems.
|
||||
/* Definitions for struct declaration tags. These are sentinel values used by
|
||||
* parse_syscalls.py to gather a list of names of struct declarations that
|
||||
* have these tags applied for them.
|
||||
*/
|
||||
|
||||
/* Indicates this is a driver subsystem */
|
||||
#define __subsystem
|
||||
|
||||
/* Indicates this is a network socket object */
|
||||
#define __net_socket
|
||||
|
||||
#ifndef BUILD_ASSERT
|
||||
/* Compile-time assertion that makes the build to fail.
|
||||
* Common implementation swallows the message.
|
||||
|
|
|
@ -80,6 +80,10 @@ from collections import OrderedDict
|
|||
#
|
||||
# - The third items is a boolean indicating whether this item can be
|
||||
# dynamically allocated with k_object_alloc()
|
||||
#
|
||||
# Key names in all caps do not correspond to a specific data type but instead
|
||||
# indicate that objects of its type are of a family of compatible data
|
||||
# structures
|
||||
|
||||
# Regular dictionaries are ordered only with Python 3.6 and
|
||||
# above. Good summary and pointers to official documents at:
|
||||
|
@ -97,6 +101,7 @@ kobjects = OrderedDict([
|
|||
("k_timer", (None, False, True)),
|
||||
("z_thread_stack_element", (None, False, False)),
|
||||
("device", (None, False, False)),
|
||||
("NET_SOCKET", (None, False, False)),
|
||||
("sys_mutex", (None, True, False)),
|
||||
("k_futex", (None, True, False))
|
||||
])
|
||||
|
@ -118,6 +123,9 @@ subsystems = [
|
|||
#};
|
||||
]
|
||||
|
||||
# Names of all structs tagged with __net_socket, found by parse_syscalls.py
|
||||
net_sockets = [ ]
|
||||
|
||||
def subsystem_to_enum(subsys):
|
||||
return "K_OBJ_DRIVER_" + subsys[:-11].upper()
|
||||
|
||||
|
@ -402,6 +410,8 @@ def analyze_die_struct(die):
|
|||
type_env[offset] = KobjectType(offset, name, size)
|
||||
elif name in subsystems:
|
||||
type_env[offset] = KobjectType(offset, name, size, api=True)
|
||||
elif name in net_sockets:
|
||||
type_env[offset] = KobjectType(offset, "NET_SOCKET", size)
|
||||
else:
|
||||
at = AggregateType(offset, name, size)
|
||||
type_env[offset] = at
|
||||
|
@ -919,6 +929,7 @@ def parse_subsystems_list_file(path):
|
|||
with open(path, "r") as fp:
|
||||
subsys_list = json.load(fp)
|
||||
subsystems.extend(subsys_list["__subsystem"])
|
||||
net_sockets.extend(subsys_list["__net_socket"])
|
||||
|
||||
def parse_args():
|
||||
global args
|
||||
|
|
|
@ -40,7 +40,7 @@ __syscall\s+ # __syscall attribute, must be first
|
|||
[)] # Closing parenthesis
|
||||
''', regex_flags)
|
||||
|
||||
struct_tags = ["__subsystem"]
|
||||
struct_tags = ["__subsystem", "__net_socket"]
|
||||
|
||||
tagged_struct_decl_template = r'''
|
||||
%s\s+ # tag, must be first
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue