Lines Matching defs:len
804 &pathname[0..pathname.len() - 1],
823 if bytes.len() >= ret.sun_path.len() {
827 let sun_len = (bytes.len()
846 bytes.len(),
868 if path.len() >= ret.sun_path.len() {
872 (path.len() + 1 + offset_of!(libc::sockaddr_un, sun_path))
881 path.len(),
910 /// - sun_len <= sockaddr_un.sun_path.len() - offset_of(sockaddr_un, sun_path)
1006 fn len(&self) -> libc::socklen_t {
1012 len: Option<libc::socklen_t>,
1017 if let Some(l) = len {
1035 let su_len = len.unwrap_or(
1039 let su_len = len.unwrap_or((*addr).sa_len as libc::socklen_t);
1110 /// Some C APIs from provide `len`, and others do not. If it's provided it
1118 /// - `len`: For fixed-width types like `sockaddr_in`, it will be
1122 /// named `sockaddr_un`, then `len` must be the length of the
1127 /// `addr` must be valid for the specific type of sockaddr. `len`, if
1131 len: Option<libc::socklen_t>,
1171 fn len(&self) -> libc::socklen_t {
1185 fn len(&self) -> libc::socklen_t {
1232 fn len(&self) -> libc::socklen_t {
1289 len: Option<libc::socklen_t>,
1294 if let Some(l) = len {
1408 len: Option<libc::socklen_t>,
1413 if let Some(l) = len {
1551 if let Some(len) = l {
1552 let ulen = len as usize;
1560 ptr::copy(addr as *const u8, ssp, len as usize);
1570 (*(&mut ss as *mut libc::sockaddr_storage as *mut UnixAddr)).sun_len = len as u8;
1576 // copy it. If addr is of a variable length type and len is not
1640 fn len(&self) -> libc::socklen_t {
1643 Some(ua) => ua.len(),
1661 && self.len() >= mem::size_of::<$libc_ty>() as libc::socklen_t
1663 // Safe because family and len are validated
1673 && self.len() >= mem::size_of::<$libc_ty>() as libc::socklen_t
1675 // Safe because family and len are validated
1697 let len = unsafe {
1701 let len = self.len() as usize;
1706 len < offset_of!(libc::sockaddr_un, sun_path) ||
1707 len > mem::size_of::<libc::sockaddr_un>() {
1726 let len = unsafe {
1730 let len = self.len() as usize;
1735 len < offset_of!(libc::sockaddr_un, sun_path) ||
1736 len > mem::size_of::<libc::sockaddr_un>() {
1971 /// `family` or `len` fields may result in violating Nix's invariants.
2376 len: Option<libc::socklen_t>,
2381 if let Some(l) = len {
2489 addr.salg_type[..alg_type.len()]
2491 addr.salg_name[..alg_name.len()]
2567 unsafe fn from_raw(addr: *const libc::sockaddr, len: Option<libc::socklen_t>)
2570 if let Some(l) = len {
2607 if name.len() > MAX_KCTL_NAME {
2612 ctl_name[..name.len()].clone_from_slice(name.as_bytes());
2709 len: Option<libc::socklen_t>)
2712 if let Some(l) = len {
2788 let data_len = self.0.sdl_data.len();
2833 len: Option<libc::socklen_t>)
2836 if let Some(l) = len {
2879 len: Option<libc::socklen_t>,
2884 if let Some(l) = len {
3038 let len = None;
3040 unsafe { SockaddrStorage::from_raw(sa, len) }.unwrap();
3054 let len = Some(bytes.len() as socklen_t);
3056 unsafe { SockaddrStorage::from_raw(sa, len) }.unwrap();
3075 let len = Some(bytes.len() as socklen_t);
3078 unsafe { SockaddrStorage::from_raw(sa, len).unwrap() };
3094 let len = Some(bytes.len() as socklen_t);
3095 let _sock_addr = unsafe { SockaddrStorage::from_raw(sa, len) };
3192 SockaddrStorage::from_raw(ptr, Some(ua.len()))
3194 assert_eq!(ss.len(), ua.len());
3204 SockaddrStorage::from_raw(ptr, Some(ua.len()))
3206 assert_eq!(ss.len(), ua.len());
3215 SockaddrStorage::from_raw(ptr, Some(ua.len()))
3217 assert_eq!(ss.len(), ua.len());