[v2,2/3] linux-user: support netlink protocol NETLINK_KOBJECT_UEVENT
diff mbox

Message ID 1463936181-23683-3-git-send-email-laurent@vivier.eu
State New
Headers show

Commit Message

Laurent Vivier May 22, 2016, 4:56 p.m. UTC
This is the protocol used by udevd to manage kernel events.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
v2: Check domain before opening socket

 linux-user/syscall.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3f1b2cc..ff63bf5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2679,7 +2679,8 @@  static abi_long do_socket(int domain, int type, int protocol)
     }
 
     if (domain == PF_NETLINK &&
-        protocol != NETLINK_ROUTE) {
+        !(protocol == NETLINK_ROUTE ||
+          protocol == NETLINK_KOBJECT_UEVENT)) {
         return -EPFNOSUPPORT;
     }
 
@@ -2701,6 +2702,9 @@  static abi_long do_socket(int domain, int type, int protocol)
             case NETLINK_ROUTE:
                 fd_trans_register(ret, &target_netlink_route_trans);
                 break;
+            case NETLINK_KOBJECT_UEVENT:
+                /* nothing to do: messages are strings */
+                break;
             default:
                 g_assert_not_reached();
             }