ssd: fix building when SYS_ioprio_set is missing

Older glibc's might not provide this.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2011-11-09 00:09:58 -05:00
parent f46626dcfc
commit 16661d02e9

View File

@ -107,12 +107,17 @@ static char *changeuser, *ch_root, *ch_dir;
extern char **environ; extern char **environ;
#ifdef __linux__ #if !defined(SYS_ioprio_set) && defined(__NR_ioprio_set)
# define SYS_ioprio_set __NR_ioprio_set
#endif
static inline int ioprio_set(int which, int who, int ioprio) static inline int ioprio_set(int which, int who, int ioprio)
{ {
#ifdef SYS_ioprio_set
return syscall(SYS_ioprio_set, which, who, ioprio); return syscall(SYS_ioprio_set, which, who, ioprio);
} #else
return 0;
#endif #endif
}
static void static void
free_schedulelist(void) free_schedulelist(void)
@ -1150,13 +1155,10 @@ start_stop_daemon(int argc, char **argv)
strerror(errno)); strerror(errno));
} }
/* Only linux suports setting an IO priority */
#ifdef __linux__
if (ionicec != -1 && if (ionicec != -1 &&
ioprio_set(1, mypid, ionicec | ioniced) == -1) ioprio_set(1, mypid, ionicec | ioniced) == -1)
eerrorx("%s: ioprio_set %d %d: %s", applet, eerrorx("%s: ioprio_set %d %d: %s", applet,
ionicec, ioniced, strerror(errno)); ionicec, ioniced, strerror(errno));
#endif
if (ch_root && chroot(ch_root) < 0) if (ch_root && chroot(ch_root) < 0)
eerrorx("%s: chroot `%s': %s", eerrorx("%s: chroot `%s': %s",