From e34d2eb7802a6af2e2219818b08b2c2ac88a1c81 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Tue, 8 Aug 2017 12:43:04 +0300 Subject: [PATCH] 8839 madv: error: variable 'rc' set but not used Reviewed by: Yuri Pankov Reviewed by: Gary Mills Approved by: Dan McDonald --- usr/src/lib/madv/common/madv.c | 41 +++++++++++++++++++++-------------------- 1 file 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 #include #include @@ -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); -- 2.11.4.GIT