Skip to content

Commit

Permalink
solaris based systems update
Browse files Browse the repository at this point in the history
basis to do cpu affinity with some illumos specifics.
  • Loading branch information
devnexen committed Jun 12, 2021
1 parent da79cd0 commit 68ec7f2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ fn test_solarish(target: &str) {
"sys/loadavg.h",
"sys/mman.h",
"sys/mount.h",
"sys/pset.h",
"sys/resource.h",
"sys/socket.h",
"sys/stat.h",
Expand Down
8 changes: 8 additions & 0 deletions src/unix/solarish/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ extern "C" {
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;

pub fn mincore(addr: ::caddr_t, len: ::size_t, vec: *mut ::c_char) -> ::c_int;

pub fn pset_bind_lwp(
pset: ::psetid_t,
id: ::id_t,
pid: ::pid_t,
opset: *mut ::psetid_t,
) -> ::c_int;
pub fn pset_getloadavg(pset: ::psetid_t, load: *mut ::c_double, num: ::c_int) -> ::c_int;
}
35 changes: 35 additions & 0 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub type wchar_t = ::c_int;
pub type nfds_t = ::c_ulong;
pub type projid_t = ::c_int;
pub type zoneid_t = ::c_int;
pub type psetid_t = ::c_int;
pub type processorid_t = ::c_int;

pub type suseconds_t = ::c_long;
pub type off_t = ::c_long;
Expand Down Expand Up @@ -988,6 +990,9 @@ pub const FILENAME_MAX: ::c_uint = 1024;
pub const L_tmpnam: ::c_uint = 25;
pub const TMP_MAX: ::c_uint = 17576;

pub const GRND_NONBLOCK: ::c_int = 0x0001;
pub const GRND_RANDOM: ::c_int = 0x0002;

pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1;
pub const O_RDWR: ::c_int = 2;
Expand Down Expand Up @@ -1112,6 +1117,15 @@ pub const P_CTID: idtype_t = 13;
pub const P_CPUID: idtype_t = 14;
pub const P_PSETID: idtype_t = 15;

pub const PS_NONE: ::c_int = -1;
pub const PS_QUERY: ::c_int = -2;
pub const PS_MYID: ::c_int = -3;
pub const PS_SOFT: ::c_int = -4;
pub const PS_HARD: ::c_int = -5;
pub const PS_QUERY_TIME: ::c_int = -6;
pub const PS_SYSTEM: ::c_int = 1;
pub const PS_PRIVATE: ::c_int = 2;

pub const UTIME_OMIT: c_long = -2;
pub const UTIME_NOW: c_long = -1;

Expand Down Expand Up @@ -2227,6 +2241,8 @@ extern "C" {
pub fn labs(i: ::c_long) -> ::c_long;
pub fn rand() -> ::c_int;
pub fn srand(seed: ::c_uint);
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
pub fn getrandom(bbuf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;

pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn settimeofday(tp: *const ::timeval, tz: *const ::c_void) -> ::c_int;
Expand Down Expand Up @@ -2607,6 +2623,25 @@ extern "C" {
pub fn ucred_getpflags(ucred: *const ucred_t, flags: ::c_uint) -> ::c_uint;

pub fn ucred_size() -> ::size_t;

pub fn pset_create(newpset: *mut ::psetid_t) -> ::c_int;
pub fn pset_destroy(pset: ::psetid_t) -> ::c_int;
pub fn pset_assign(pset: ::psetid_t, cpu: ::processorid_t, opset: *mut psetid_t) -> ::c_int;
pub fn pset_info(
pset: ::psetid_t,
tpe: *mut ::c_int,
numcpus: *mut ::c_uint,
cpulist: *mut processorid_t,
) -> ::c_int;
pub fn pset_bind(
pset: ::psetid_t,
idtype: ::idtype_t,
id: ::id_t,
opset: *mut psetid_t,
) -> ::c_int;
pub fn pset_list(pset: *mut psetid_t, numpsets: *mut ::c_uint) -> ::c_int;
pub fn pset_setattr(pset: psetid_t, attr: ::c_uint) -> ::c_int;
pub fn pset_getattr(pset: psetid_t, attr: *mut ::c_uint) -> ::c_int;
}

mod compat;
Expand Down

0 comments on commit 68ec7f2

Please sign in to comment.