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@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
master commit: 046efe529e
master date: 2024-07-23 15:11:27 +0100
This commit is contained in:
Andrew Cooper authored and Jan Beulich committed 2024-11-25 11:53:35 +01:00
1 parent 97fded1c09
commit c991b585c4
1 file changed
+7 -1
+7 -1
View File
@@ -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 */
/*
@@ -140,6 +143,7 @@ static void *read_thread(void *arg);
struct xs_handle {
int fd;
bool is_socket; /* is @fd a file or socket? */
Xentoolcore__Active_Handle tc_ah; /* for restrict */
XEN_TAILQ_HEAD(, struct xs_stored_msg) reply_list;
XEN_TAILQ_HEAD(, struct xs_stored_msg) watch_list;
@@ -300,7 +304,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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.