Remove unused copy of iolog_seekto().
This commit is contained in:
@@ -1011,78 +1011,6 @@ bad:
|
|||||||
debug_return_bool(false);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/*
|
|
||||||
* Open the I/O log files and seek to the specified point in time.
|
|
||||||
* TODO: share with logsrvd restart code
|
|
||||||
*/
|
|
||||||
static bool
|
|
||||||
iolog_seekto(int iolog_dir_fd, const char *iolog_path,
|
|
||||||
struct timespec *elapsed_time, const struct timespec *target)
|
|
||||||
{
|
|
||||||
struct timing_closure timing;
|
|
||||||
off_t pos;
|
|
||||||
int iofd;
|
|
||||||
debug_decl(iolog_seekto, SUDO_DEBUG_UTIL)
|
|
||||||
|
|
||||||
/* Open existing I/O log files. */
|
|
||||||
for (iofd = 0; iofd < IOFD_MAX; iofd++) {
|
|
||||||
iolog_files[iofd].enabled = true;
|
|
||||||
if (!iolog_open(&iolog_files[iofd], iolog_dir_fd, iofd, "r+")) {
|
|
||||||
if (errno != ENOENT) {
|
|
||||||
sudo_debug_printf(
|
|
||||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO,
|
|
||||||
"unable to open %s/%s", iolog_path, iolog_fd_to_name(iofd));
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!iolog_files[IOFD_TIMING].enabled) {
|
|
||||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
|
||||||
"missing timing file in %s", iolog_path);
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse timing file until we reach the target point. */
|
|
||||||
for (;;) {
|
|
||||||
if (iolog_read_timing_record(&iolog_files[IOFD_TIMING], &timing) != 0)
|
|
||||||
goto bad;
|
|
||||||
sudo_timespecadd(&timing.delay, elapsed_time, elapsed_time);
|
|
||||||
if (timing.event < IOFD_TIMING) {
|
|
||||||
if (!iolog_files[timing.event].enabled) {
|
|
||||||
/* Missing log file. */
|
|
||||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
|
||||||
"iofd %d referenced but not open", timing.event);
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
pos = iolog_seek(&iolog_files[timing.event], timing.u.nbytes,
|
|
||||||
SEEK_CUR);
|
|
||||||
if (pos == -1) {
|
|
||||||
sudo_debug_printf(
|
|
||||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO,
|
|
||||||
"seek(%d, %lld, SEEK_CUR", timing.event,
|
|
||||||
(long long)timing.u.nbytes);
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sudo_timespeccmp(elapsed_time, target, >=)) {
|
|
||||||
if (sudo_timespeccmp(elapsed_time, target, ==))
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Mismatch between resume point and stored log. */
|
|
||||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
|
||||||
"resume point mismatch, target [%lld, %ld], have [%lld, %ld]",
|
|
||||||
(long long)target->tv_sec, target->tv_nsec,
|
|
||||||
(long long)elapsed_time->tv_sec, elapsed_time->tv_nsec);
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
debug_return_bool(true);
|
|
||||||
bad:
|
|
||||||
debug_return_bool(false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse a timespec on the command line of the form
|
* Parse a timespec on the command line of the form
|
||||||
* seconds[,nanoseconds]
|
* seconds[,nanoseconds]
|
||||||
|
Reference in New Issue
Block a user