util: Remove virCommandPassFDIndex()

The last use of this function was removed in commit 6d161bcc, so the
function is no longer used except as an internal implementation for
virCommandPassFD().

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jonathon Jongsma 2022-05-13 14:14:32 -05:00
parent 2e89805894
commit 43aa510c19
3 changed files with 14 additions and 44 deletions

View File

@ -2057,7 +2057,6 @@ virCommandNewArgs;
virCommandNewVAList;
virCommandNonblockingFDs;
virCommandPassFD;
virCommandPassFDIndex;
virCommandRawStatus;
virCommandRequireHandshake;
virCommandRun;

View File

@ -1020,43 +1020,6 @@ virCommandNewVAList(const char *binary, va_list list)
(flags & VIR_COMMAND_PASS_FD_CLOSE_PARENT)) \
VIR_FORCE_CLOSE(fd)
/**
* virCommandPassFDIndex:
* @cmd: the command to modify
* @fd: fd to reassign to the child
* @flags: extra flags; binary-OR of virCommandPassFDFlags
* @idx: pointer to fill with the index of the FD in the transfer set
*
* Transfer the specified file descriptor to the child, instead
* of closing it on exec. @fd must not be one of the three
* standard streams.
*
* If the flag VIR_COMMAND_PASS_FD_CLOSE_PARENT is set then fd will
* be closed in the parent no later than Run/RunAsync/Free. The parent
* should cease using the @fd when this call completes
*/
void
virCommandPassFDIndex(virCommand *cmd, int fd, unsigned int flags, size_t *idx)
{
if (!cmd) {
VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags);
return;
}
if (fd <= STDERR_FILENO) {
VIR_DEBUG("invalid fd %d", fd);
VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags);
if (!cmd->has_error)
cmd->has_error = -1;
return;
}
virCommandFDSet(cmd, fd, flags);
if (idx)
*idx = cmd->npassfd - 1;
}
/**
* virCommandPassFD:
* @cmd: the command to modify
@ -1074,7 +1037,20 @@ virCommandPassFDIndex(virCommand *cmd, int fd, unsigned int flags, size_t *idx)
void
virCommandPassFD(virCommand *cmd, int fd, unsigned int flags)
{
virCommandPassFDIndex(cmd, fd, flags, NULL);
if (!cmd) {
VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags);
return;
}
if (fd <= STDERR_FILENO) {
VIR_DEBUG("invalid fd %d", fd);
VIR_COMMAND_MAYBE_CLOSE_FD(fd, flags);
if (!cmd->has_error)
cmd->has_error = -1;
return;
}
virCommandFDSet(cmd, fd, flags);
}
/**

View File

@ -56,11 +56,6 @@ void virCommandPassFD(virCommand *cmd,
int fd,
unsigned int flags) G_GNUC_NO_INLINE;
void virCommandPassFDIndex(virCommand *cmd,
int fd,
unsigned int flags,
size_t *idx) G_GNUC_NO_INLINE;
void virCommandSetPidFile(virCommand *cmd,
const char *pidfile) ATTRIBUTE_NONNULL(2);