diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-12-12 20:51:40 +0100 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-12-12 20:51:40 +0100 |
commit | d2ce18b5dfdc1736a99b4e2d731119cc4880e197 (patch) | |
tree | 607fde84028de51d9919b33176408ab09a08b251 /os/os-solaris.h | |
parent | 6f7024e49e41fafcb838acbebf0c31fbcf35132f (diff) | |
download | fio-d2ce18b5dfdc1736a99b4e2d731119cc4880e197.tar.gz fio-d2ce18b5dfdc1736a99b4e2d731119cc4880e197.tar.bz2 |
CPU set creation and destruction can fail on some platforms
Check for that and error out if necessary.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'os/os-solaris.h')
-rw-r--r-- | os/os-solaris.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/os/os-solaris.h b/os/os-solaris.h index de948952..6b44ec09 100644 --- a/os/os-solaris.h +++ b/os/os-solaris.h @@ -74,8 +74,30 @@ static inline int fio_set_odirect(int fd) #define fio_cpu_clear(mask, cpu) pset_assign(*(mask), (cpu), PS_NONE) #define fio_cpu_set(mask, cpu) pset_assign(*(mask), (cpu), PS_MYID) -#define fio_cpuset_init(td) pset_create(&(td)->o.cpumask) -#define fio_cpuset_exit(td) pset_destroy((td)->o.cpumask) + +static inline int fio_cpuset_init(os_cpu_mask_t *mask) +{ + int ret; + + if (pset_create(mask) < 0) { + ret = errno; + return -1; + } + + return 0; +} + +static inline int fio_cpuset_exit(os_cpu_mask_t *mask) +{ + int ret; + + if (pset_destroy(*mask) < 0) { + ret = errno; + return -1; + } + + return 0; +} /* * Should be enough, not aware of what (if any) restrictions Solaris has |