Mark params as unused if Darwin libproc unavailable

This commit is contained in:
Daniel Roethlisberger 2014-11-14 01:26:37 +01:00
parent a906147943
commit 3c7fe37583

13
proc.c
View File

@ -48,7 +48,7 @@
#ifdef HAVE_DARWIN_LIBPROC #ifdef HAVE_DARWIN_LIBPROC
int int
proc_pid_for_addr(pid_t *result, struct sockaddr *dst_addr, proc_pid_for_addr(pid_t *result, struct sockaddr *dst_addr,
UNUSED socklen_t dst_addrlen) UNUSED socklen_t dst_addrlen)
{ {
pid_t *pids = NULL; pid_t *pids = NULL;
struct proc_fdinfo *fds = NULL; struct proc_fdinfo *fds = NULL;
@ -143,16 +143,13 @@ errout2:
errout1: errout1:
return ret; return ret;
} }
#else /* !HAVE_DARWIN_LIBPROC */ #else /* !HAVE_DARWIN_LIBPROC */
int int
proc_pid_for_addr(pid_t *result, UNUSED struct sockaddr *dst_addr, proc_pid_for_addr(pid_t *result, UNUSED struct sockaddr *dst_addr,
UNUSED socklen_t dst_addrlen) { UNUSED socklen_t dst_addrlen) {
*result = -1; *result = -1;
return 0; return 0;
} }
#endif /* !HAVE_DARWIN_LIBPROC */ #endif /* !HAVE_DARWIN_LIBPROC */
@ -162,9 +159,9 @@ proc_pid_for_addr(pid_t *result, UNUSED struct sockaddr *dst_addr,
* Caller must free returned path string. * Caller must free returned path string.
* Returns -1 on failure, or if unsupported on this platform. * Returns -1 on failure, or if unsupported on this platform.
*/ */
#if HAVE_DARWIN_LIBPROC
int int
proc_get_info(pid_t pid, char **path, uid_t *uid, gid_t *gid) { proc_get_info(pid_t pid, char **path, uid_t *uid, gid_t *gid) {
#if HAVE_DARWIN_LIBPROC
/* fetch process structure */ /* fetch process structure */
struct proc_bsdinfo bsd_info; struct proc_bsdinfo bsd_info;
if (proc_pidinfo(pid, PROC_PIDTBSDINFO, 0, &bsd_info, if (proc_pidinfo(pid, PROC_PIDTBSDINFO, 0, &bsd_info,
@ -187,11 +184,15 @@ proc_get_info(pid_t pid, char **path, uid_t *uid, gid_t *gid) {
} }
return 0; return 0;
}
#else /* !HAVE_DARWIN_LIBPROC */ #else /* !HAVE_DARWIN_LIBPROC */
int
proc_get_info(UNUSED pid_t pid, UNUSED char **path,
UNUSED uid_t *uid, UNUSED gid_t *gid) {
/* unsupported */ /* unsupported */
return -1; return -1;
#endif /* !HAVE_DARWIN_LIBPROC */
} }
#endif /* !HAVE_DARWIN_LIBPROC */
/* vim: set noet ft=c: */ /* vim: set noet ft=c: */