mirror of
https://github.com/wolfcw/libfaketime.git
synced 2026-05-17 00:26:16 +03:00
Merge pull request #350 from a1346054/fixes
Simple maintenance improvements
This commit is contained in:
2
.github/workflows/make-test.yml
vendored
2
.github/workflows/make-test.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
- master
|
||||
- develop
|
||||
schedule:
|
||||
- cron: '30 9 * * *'
|
||||
- cron: '30 9 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,4 +14,3 @@ src/libfaketime.dylib.1
|
||||
src/libfaketime.1.dylib
|
||||
src/core
|
||||
src/faketime
|
||||
|
||||
|
||||
@@ -16,6 +16,6 @@ script:
|
||||
- if [ "$TRAVIS_ARCH" = ppc64le ]; then
|
||||
FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX -DFORCE_PTHREAD_NONVER" make;
|
||||
else
|
||||
FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX" make;
|
||||
FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX" make;
|
||||
fi
|
||||
- make test
|
||||
|
||||
@@ -114,7 +114,7 @@ int main (int argc, char **argv)
|
||||
bool fake_pid = false;
|
||||
const char *pid_val;
|
||||
|
||||
while(curr_opt < argc)
|
||||
while (curr_opt < argc)
|
||||
{
|
||||
if (0 == strcmp(argv[curr_opt], "-m"))
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ struct ft_shared_s
|
||||
* When advancing time linearly with each time(), etc. call, the calls are
|
||||
* counted here */
|
||||
uint64_t ticks;
|
||||
/* Index of timstamp to be loaded from file */
|
||||
/* Index of timestamp to be loaded from file */
|
||||
uint64_t file_idx;
|
||||
/* System time Faketime started at */
|
||||
struct system_time_s start_time;
|
||||
|
||||
@@ -268,7 +268,7 @@ static sem_t *shared_sem = NULL;
|
||||
/** Data shared among faketime-spawned processes */
|
||||
static struct ft_shared_s *ft_shared = NULL;
|
||||
|
||||
/** Storage format for timestamps written to file. Big endian.*/
|
||||
/** Storage format for timestamps written to file. Big endian. */
|
||||
struct saved_timestamp
|
||||
{
|
||||
int64_t sec;
|
||||
@@ -335,7 +335,7 @@ static struct timespec user_faked_time_timespec = {0, -1};
|
||||
static bool user_faked_time_set = false;
|
||||
static char user_faked_time_saved[BUFFERLEN] = {0};
|
||||
|
||||
/* Fractional user offset provided through FAKETIME env. var.*/
|
||||
/* Fractional user offset provided through FAKETIME env. var. */
|
||||
static struct timespec user_offset = {0, -1};
|
||||
/* Speed up or slow down clock */
|
||||
static double user_rate = 1.0;
|
||||
@@ -750,7 +750,7 @@ static bool load_time(struct timespec *tp)
|
||||
|
||||
if ((sizeof(stss[0]) * (ft_shared->file_idx + 1)) > infile_size)
|
||||
{
|
||||
/* we are out of timstamps to replay, return to faking time by rules
|
||||
/* we are out of timestamps to replay, return to faking time by rules
|
||||
* using last timestamp from file as the user provided timestamp */
|
||||
timespec_from_saved(&user_faked_time_timespec, &stss[(infile_size / sizeof(stss[0])) - 1 ]);
|
||||
|
||||
@@ -1842,7 +1842,7 @@ timer_settime_common(timer_t_or_int timerid, int flags,
|
||||
}
|
||||
else if (dont_fake)
|
||||
{
|
||||
/* cast away constness*/
|
||||
/* cast away constness */
|
||||
new_real_pt = (struct itimerspec *)new_value;
|
||||
}
|
||||
else
|
||||
@@ -2484,7 +2484,7 @@ parse_modifiers:
|
||||
else if (NULL != (tmp_time_fmt = strchr(user_faked_time, 'i')))
|
||||
{
|
||||
double tick_inc = atof(tmp_time_fmt + 1);
|
||||
/* increment time with every time() call*/
|
||||
/* increment time with every time() call */
|
||||
user_per_tick_inc.tv_sec = floor(tick_inc);
|
||||
user_per_tick_inc.tv_nsec = (tick_inc - user_per_tick_inc.tv_sec) * SEC_TO_nSEC ;
|
||||
user_per_tick_inc_set = true;
|
||||
@@ -2811,7 +2811,7 @@ static void ftpl_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* load file only if reading timstamps from it is not finished yet */
|
||||
/* load file only if reading timestamps from it is not finished yet */
|
||||
if ((tmp_env = getenv("FAKETIME_LOAD_FILE")) != NULL)
|
||||
{
|
||||
int infile = -1;
|
||||
@@ -2966,7 +2966,7 @@ int read_config_file()
|
||||
(faketimerc = fopen("/etc/faketimerc", "rt")) != NULL)
|
||||
{
|
||||
static char line[BUFFERLEN];
|
||||
while(fgets(line, BUFFERLEN, faketimerc) != NULL)
|
||||
while (fgets(line, BUFFERLEN, faketimerc) != NULL)
|
||||
{
|
||||
if ((strlen(line) > 1) && (line[0] != ' ') &&
|
||||
(line[0] != '#') && (line[0] != ';'))
|
||||
@@ -3174,7 +3174,7 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
case FT_START_AT: /* User-specified offset */
|
||||
if (user_per_tick_inc_set)
|
||||
{
|
||||
/* increment time with every time() call*/
|
||||
/* increment time with every time() call */
|
||||
next_time(tp, &user_per_tick_inc);
|
||||
}
|
||||
else
|
||||
@@ -3631,7 +3631,7 @@ int pthread_cond_timedwait_common(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
CLOCK_MONOTONIC. */
|
||||
#ifndef __ARM_ARCH
|
||||
#ifndef FORCE_MONOTONIC_FIX
|
||||
if(clk_id == CLOCK_MONOTONIC)
|
||||
if (clk_id == CLOCK_MONOTONIC)
|
||||
timespecadd(&faketime, &tdiff_actual, &tp);
|
||||
else
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user