Skip to content

Commit 09602d5

Browse files
committed
Auto merge of #2236 - devnexen:solarish_update, r=JohnTitor
solaris based systems update basis to do cpu affinity with some illumos specifics.
2 parents fe472cc + 68ec7f2 commit 09602d5

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ fn test_solarish(target: &str) {
730730
"sys/loadavg.h",
731731
"sys/mman.h",
732732
"sys/mount.h",
733+
"sys/pset.h",
733734
"sys/resource.h",
734735
"sys/socket.h",
735736
"sys/stat.h",

src/unix/solarish/illumos.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,12 @@ extern "C" {
3737
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
3838

3939
pub fn mincore(addr: ::caddr_t, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
40+
41+
pub fn pset_bind_lwp(
42+
pset: ::psetid_t,
43+
id: ::id_t,
44+
pid: ::pid_t,
45+
opset: *mut ::psetid_t,
46+
) -> ::c_int;
47+
pub fn pset_getloadavg(pset: ::psetid_t, load: *mut ::c_double, num: ::c_int) -> ::c_int;
4048
}

src/unix/solarish/mod.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub type wchar_t = ::c_int;
2525
pub type nfds_t = ::c_ulong;
2626
pub type projid_t = ::c_int;
2727
pub type zoneid_t = ::c_int;
28+
pub type psetid_t = ::c_int;
29+
pub type processorid_t = ::c_int;
2830

2931
pub type suseconds_t = ::c_long;
3032
pub type off_t = ::c_long;
@@ -988,6 +990,9 @@ pub const FILENAME_MAX: ::c_uint = 1024;
988990
pub const L_tmpnam: ::c_uint = 25;
989991
pub const TMP_MAX: ::c_uint = 17576;
990992

993+
pub const GRND_NONBLOCK: ::c_int = 0x0001;
994+
pub const GRND_RANDOM: ::c_int = 0x0002;
995+
991996
pub const O_RDONLY: ::c_int = 0;
992997
pub const O_WRONLY: ::c_int = 1;
993998
pub const O_RDWR: ::c_int = 2;
@@ -1112,6 +1117,15 @@ pub const P_CTID: idtype_t = 13;
11121117
pub const P_CPUID: idtype_t = 14;
11131118
pub const P_PSETID: idtype_t = 15;
11141119

1120+
pub const PS_NONE: ::c_int = -1;
1121+
pub const PS_QUERY: ::c_int = -2;
1122+
pub const PS_MYID: ::c_int = -3;
1123+
pub const PS_SOFT: ::c_int = -4;
1124+
pub const PS_HARD: ::c_int = -5;
1125+
pub const PS_QUERY_TIME: ::c_int = -6;
1126+
pub const PS_SYSTEM: ::c_int = 1;
1127+
pub const PS_PRIVATE: ::c_int = 2;
1128+
11151129
pub const UTIME_OMIT: c_long = -2;
11161130
pub const UTIME_NOW: c_long = -1;
11171131

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

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

26092625
pub fn ucred_size() -> ::size_t;
2626+
2627+
pub fn pset_create(newpset: *mut ::psetid_t) -> ::c_int;
2628+
pub fn pset_destroy(pset: ::psetid_t) -> ::c_int;
2629+
pub fn pset_assign(pset: ::psetid_t, cpu: ::processorid_t, opset: *mut psetid_t) -> ::c_int;
2630+
pub fn pset_info(
2631+
pset: ::psetid_t,
2632+
tpe: *mut ::c_int,
2633+
numcpus: *mut ::c_uint,
2634+
cpulist: *mut processorid_t,
2635+
) -> ::c_int;
2636+
pub fn pset_bind(
2637+
pset: ::psetid_t,
2638+
idtype: ::idtype_t,
2639+
id: ::id_t,
2640+
opset: *mut psetid_t,
2641+
) -> ::c_int;
2642+
pub fn pset_list(pset: *mut psetid_t, numpsets: *mut ::c_uint) -> ::c_int;
2643+
pub fn pset_setattr(pset: psetid_t, attr: ::c_uint) -> ::c_int;
2644+
pub fn pset_getattr(pset: psetid_t, attr: *mut ::c_uint) -> ::c_int;
26102645
}
26112646

26122647
mod compat;

0 commit comments

Comments
 (0)