syscalls: support identifiers iteration
authorDmitry Selyutin <ghostmansd@gmail.com>
Tue, 19 Sep 2023 17:13:21 +0000 (20:13 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 19 Sep 2023 18:30:03 +0000 (21:30 +0300)
src/openpower/syscalls/__init__.py

index 053e45f3d10fcb2b3213614ca327f92430c70b69..569655d27f81ace89f142da478c758bf0684f59e 100644 (file)
@@ -54,6 +54,12 @@ class Dispatcher:
 
         return super().__init__()
 
+    def __iter__(self):
+        identifiers = sorted(map(int, filter(str.isnumeric, self.__guest)))
+        for identifier in identifiers:
+            entry = self.__guest[str(identifier)][1][0]
+            yield (identifier, entry)
+
     def __getitem__(self, identifier):
         if not isinstance(identifier, int):
             raise ValueError(identifier)