Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add definitions for afunix.h #968

Open
wants to merge 1 commit into
base: 0.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ std = []
d3dkmthk = []
#mmos
#shared
afunix = []
basetsd = []
bcrypt = []
bthdef = []
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static
("d3dkmthk", &["basetsd", "d3dukmdt", "minwindef", "ntdef", "windef"], &[]),
// mmos
// shared
("afunix", &["minwindef", "winnt", "ws2def"], &[]),
("basetsd", &[], &[]),
("bcrypt", &["minwindef", "winnt"], &["bcrypt"]),
("bthdef", &["bthsdpdef", "guiddef", "minwindef", "ntdef"], &[]),
Expand Down
10 changes: 10 additions & 0 deletions src/shared/afunix.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use shared::minwindef::DWORD;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! I came up with practically the same patch without knowing you add a MR.

I think you should add the common top header:

// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
//! Definitions for the AF_UNIX socket address family.

use shared::ws2def::{ADDRESS_FAMILY, IOC_VENDOR};
use um::winnt::CHAR;
pub const UNIX_PATH_MAX: usize = 108;
STRUCT!{struct SOCKADDR_UN {
sun_family: ADDRESS_FAMILY,
sun_path: [CHAR; UNIX_PATH_MAX],
}}
pub type PSOCKETADDR_UN = *mut SOCKADDR_UN;
pub const SIO_AF_UNIX_GETPEERPID: DWORD = _WSAIOR!(IOC_VENDOR, 256);
1 change: 1 addition & 0 deletions src/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
//! Headers shared between user mode and kernel mode
#[cfg(feature = "afunix")] pub mod afunix;
#[cfg(feature = "basetsd")] pub mod basetsd;
#[cfg(feature = "bcrypt")] pub mod bcrypt;
#[cfg(feature = "bthdef")] pub mod bthdef;
Expand Down
6 changes: 6 additions & 0 deletions tests/structs_x86.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#![cfg(all(windows, target_arch = "x86"))]
extern crate winapi;
use std::mem::{size_of, align_of};
#[cfg(feature = "afunix")] #[test]
fn shared_afunix() {
use winapi::shared::afunix::*;
assert_eq!(size_of::<SOCKADDR_UN>(), 110);
assert_eq!(align_of::<SOCKADDR_UN>(), 2);
}
#[cfg(feature = "bcrypt")] #[test]
fn shared_bcrypt() {
use winapi::shared::bcrypt::*;
Expand Down
6 changes: 6 additions & 0 deletions tests/structs_x86_64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#![cfg(all(windows, target_arch = "x86_64"))]
extern crate winapi;
use std::mem::{size_of, align_of};
#[cfg(feature = "afunix")] #[test]
fn shared_afunix() {
use winapi::shared::afunix::*;
assert_eq!(size_of::<SOCKADDR_UN>(), 110);
assert_eq!(align_of::<SOCKADDR_UN>(), 2);
}
#[cfg(feature = "bcrypt")] #[test]
fn shared_bcrypt() {
use winapi::shared::bcrypt::*;
Expand Down