Skip to content

Commit 0546d42

Browse files
linux: add VSOCK struct and constants
Add struct sockaddr_vm and VMADDR_ constants to use VSOCK on Linux. VSOCK is present since Linux 3.9 Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
1 parent ce7e3a7 commit 0546d42

File tree

1 file changed

+15
-0
lines changed
  • src/unix/linux_like/linux

1 file changed

+15
-0
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,14 @@ s! {
474474
pub cookie: u32,
475475
pub len: u32
476476
}
477+
478+
pub struct sockaddr_vm {
479+
pub svm_family: ::sa_family_t,
480+
pub svm_reserved1: ::c_ushort,
481+
pub svm_port: ::c_uint,
482+
pub svm_cid: ::c_uint,
483+
pub svm_zero: [u8; 4]
484+
}
477485
}
478486

479487
s_no_extra_traits!{
@@ -2000,6 +2008,13 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
20002008
pub const ALG_OP_DECRYPT: ::c_int = 0;
20012009
pub const ALG_OP_ENCRYPT: ::c_int = 1;
20022010

2011+
// uapi/linux/vm_sockets.h
2012+
pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF;
2013+
pub const VMADDR_CID_HYPERVISOR: ::c_uint = 0;
2014+
pub const VMADDR_CID_RESERVED: ::c_uint = 1;
2015+
pub const VMADDR_CID_HOST: ::c_uint = 2;
2016+
pub const VMADDR_PORT_ANY: ::c_uint = 0xFFFFFFFF;
2017+
20032018
// uapi/linux/inotify.h
20042019
pub const IN_ACCESS: u32 = 0x0000_0001;
20052020
pub const IN_MODIFY: u32 = 0x0000_0002;

0 commit comments

Comments
 (0)