diff options
| author | Jonathan Perkin <jperkin@joyent.com> | 2014-11-19 02:40:25 +0000 |
|---|---|---|
| committer | Jonathan Perkin <jperkin@joyent.com> | 2014-11-19 02:40:25 +0000 |
| commit | acc1a0d84e22b494ea33388e873bf094546c8b83 (patch) | |
| tree | 4678216239c2eddf8e40bf0df02b7a26e8b2c227 /usr/src | |
| parent | 5888a38309acb9e0f70f54a424f9f8beaac2a486 (diff) | |
| download | illumos-joyent-acc1a0d84e22b494ea33388e873bf094546c8b83.tar.gz | |
OS-3568 lxbrand implement getcpu
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/lx_brand.c | 4 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/misc.c | 23 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h | 1 |
3 files changed, 26 insertions, 2 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c b/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c index 3d420c3268..7900d3aacc 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c +++ b/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c @@ -1421,7 +1421,7 @@ static struct lx_sysent sysents[] = { {"syncfs", NULL, NOSYS_NULL, 0}, /* 306 */ {"sendmmsg", NULL, NOSYS_NULL, 0}, /* 307 */ {"setns", NULL, NOSYS_NULL, 0}, /* 309 */ - {"getcpu", NULL, NOSYS_NULL, 0}, /* 309 */ + {"getcpu", lx_getcpu, 0, 3}, /* 309 */ {"process_vm_readv", NULL, NOSYS_NULL, 0}, /* 310 */ {"process_vm_writev", NULL, NOSYS_NULL, 0}, /* 311 */ {"kcmp", NULL, NOSYS_NULL, 0}, /* 312 */ @@ -1757,7 +1757,7 @@ static struct lx_sysent sysents[] = { {"tee", NULL, NOSYS_NULL, 0}, /* 315 */ {"vmsplice", NULL, NOSYS_NULL, 0}, /* 316 */ {"move_pages", NULL, NOSYS_NULL, 0}, /* 317 */ - {"getcpu", NULL, NOSYS_NULL, 0}, /* 318 */ + {"getcpu", lx_getcpu, 0, 3}, /* 318 */ {"epoll_pwait", lx_epoll_pwait, 0, 5}, /* 319 */ {"utimensat", lx_utimensat, 0, 4}, /* 320 */ {"signalfd", NULL, NOSYS_NULL, 0}, /* 321 */ diff --git a/usr/src/lib/brand/lx/lx_brand/common/misc.c b/usr/src/lib/brand/lx/lx_brand/common/misc.c index 6eb1f78ca3..0b84fe4e30 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/misc.c +++ b/usr/src/lib/brand/lx/lx_brand/common/misc.c @@ -769,6 +769,29 @@ lx_fchmod(int fildes, mode_t mode) return ((r == -1) ? -errno : r); } +/* + * We support neither the second argument (NUMA node), nor the third (obsolete + * pre-2.6.24 caching functionality which was ultimately broken). + */ +long +lx_getcpu(unsigned int *cpu, uintptr_t p2, uintptr_t p3) +{ + psinfo_t psinfo; + int procfd; + + if (cpu == NULL) + return (-EFAULT); + + if ((procfd = open("/native/proc/self/psinfo", O_RDONLY)) == -1) + return (-errno); + + if (read(procfd, &psinfo, sizeof (psinfo_t)) == -1) + return (-errno); + + *cpu = psinfo.pr_lwp.pr_onpro; + return (0); +} + long lx_getgid(void) { diff --git a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h index e2b529c64b..1b48dfd529 100644 --- a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h +++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h @@ -190,6 +190,7 @@ extern long lx_llseek(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); extern long lx_lseek(uintptr_t, uintptr_t, uintptr_t); extern long lx_sysfs(uintptr_t, uintptr_t, uintptr_t); +extern long lx_getcpu(unsigned int *, uintptr_t, uintptr_t); extern long lx_getcwd(uintptr_t, uintptr_t); extern long lx_uname(uintptr_t); extern long lx_reboot(uintptr_t, uintptr_t, uintptr_t, uintptr_t); |
