[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] tools/libxs: Track whether we're using a socket or file



commit 046efe529e82b8b999d8453d4ea49cb817c3f9b5
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Jun 28 19:40:27 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Jul 23 15:11:27 2024 +0100

    tools/libxs: Track whether we're using a socket or file
    
    It will determine whether to use writev() or sendmsg().
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
 tools/libs/store/xs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index 60f83ff198..3b3ee3d780 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -65,6 +65,9 @@ struct xs_stored_msg {
 struct xs_handle {
        /* Communications channel to xenstore daemon. */
        int fd;
+
+       bool is_socket; /* is @fd a file or socket? */
+
        Xentoolcore__Active_Handle tc_ah; /* for restrict */
 
        /*
@@ -297,7 +300,9 @@ static struct xs_handle *get_handle(const char *connect_to)
        if (stat(connect_to, &buf) != 0)
                goto err;
 
-       if (S_ISSOCK(buf.st_mode))
+       h->is_socket = S_ISSOCK(buf.st_mode);
+
+       if (h->is_socket)
                h->fd = get_socket(connect_to);
        else
                h->fd = get_dev(connect_to);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.