diff options
author | Toomas Soome <tsoome@me.com> | 2017-08-08 12:43:04 +0300 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2017-12-04 12:04:49 -0500 |
commit | e34d2eb7802a6af2e2219818b08b2c2ac88a1c81 (patch) | |
tree | 86c4126c54c2fb2d71efcc8d5c95b5fab7dcdf80 /usr/src | |
parent | 13ddffeef026c03c1ddee21119335c00d6b7f3ae (diff) | |
download | illumos-gate-e34d2eb7802a6af2e2219818b08b2c2ac88a1c81.tar.gz |
8839 madv: error: variable 'rc' set but not used
Reviewed by: Yuri Pankov <yuripv@gmx.com>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/madv/common/madv.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/usr/src/lib/madv/common/madv.c b/usr/src/lib/madv/common/madv.c index 5656a1fec1..756825ee34 100644 --- a/usr/src/lib/madv/common/madv.c +++ b/usr/src/lib/madv/common/madv.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <strings.h> @@ -676,9 +674,6 @@ shmat(int shmid, const void *shmaddr, int shmflag) struct shmid_ds mds; #ifdef MADVDEBUG int rc; -#else - /* LINTED */ - int rc; #endif if (!shmatfunc) { @@ -703,16 +698,21 @@ shmat(int shmid, const void *shmaddr, int shmflag) * Apply advice if specified and shmat succeeded. */ if (advice >= 0 && result != (void *)-1) { +#ifdef MADVDEBUG /* First determine segment size */ rc = shmctl(shmid, IPC_STAT, &mds); - MADVPRINT(4, (stderr, "shmctl rc %d errno %d\n", - strerror(errno))); - + MADVPRINT(4, (stderr, "shmctl rc %d errno %d\n", rc, errno)); rc = memcntl(result, mds.shm_segsz, MC_ADVISE, (caddr_t)(intptr_t)advice, 0, 0); MADVPRINT(1, (stderr, "shmat advice: 0x%x 0x%x %d, rc %d errno %d\n", result, mds.shm_segsz, advice, rc, errno)); +#else + /* First determine segment size */ + (void) shmctl(shmid, IPC_STAT, &mds); + (void) memcntl(result, mds.shm_segsz, MC_ADVISE, + (caddr_t)(intptr_t)advice, 0, 0); +#endif } return (result); @@ -727,12 +727,6 @@ mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos) static caddr_t (*mmapfunc)() = NULL; caddr_t result; int advice = -1; -#ifdef MADVDEBUG - int rc; -#else - /* LINTED */ - int rc; -#endif if (!mmapfunc) { mmapfunc = (caddr_t (*)()) dlsym(RTLD_NEXT, "mmap"); @@ -759,11 +753,18 @@ mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos) * Apply advice if specified and mmap succeeded. */ if (advice >= 0 && result != MAP_FAILED) { +#ifdef MADVDEBUG + int rc; + rc = memcntl(result, len, MC_ADVISE, (caddr_t)(intptr_t)advice, 0, 0); MADVPRINT(1, (stderr, "mmap advice: 0x%x 0x%x %d, rc %d errno %d\n", result, len, advice, rc, errno)); +#else + (void) memcntl(result, len, MC_ADVISE, + (caddr_t)(intptr_t)advice, 0, 0); +#endif } return (result); @@ -779,12 +780,6 @@ mmap64(caddr_t addr, size_t len, int prot, int flags, int fd, off64_t pos) static caddr_t (*mmap64func)(); caddr_t result; int advice = -1; -#ifdef MADVDEBUG - int rc; -#else - /* LINTED */ - int rc; -#endif if (!mmap64func) { mmap64func = (caddr_t (*)()) dlsym(RTLD_NEXT, "mmap64"); @@ -811,10 +806,16 @@ mmap64(caddr_t addr, size_t len, int prot, int flags, int fd, off64_t pos) * Apply advice if specified and mmap succeeded. */ if (advice >= 0 && result != MAP_FAILED) { +#ifdef MADVDEBUG + int rc; + rc = memcntl(result, len, MC_ADVISE, (caddr_t)advice, 0, 0); MADVPRINT(1, (stderr, "mmap64 advice: 0x%x 0x%x %d, rc %d errno %d\n", result, len, advice, rc, errno)); +#else + (void) memcntl(result, len, MC_ADVISE, (caddr_t)advice, 0, 0); +#endif } return (result); |