|
AT&T Labs Research warp command
Glenn Fowler <gsf@research.att.com>
AT&T Labs Research - Florham Park NJ
warp(1)
executes a dynamically linked command in a different time frame.
It intercepts time related system calls and modifies the times seen by
the command using the formula:
time' = time + warp + (time - base) * (factor - 1)
where:
-
time'
The logical system time seen by the command process.
-
time
The physical system time.
-
warp
A fixed offset from the physical system time
(i.e., the warp.)
-
base
The physical system time when
warp
was first applied to the process or any ancestor process.
-
factor
The rate of logical time change with respect to the physical clock
(i.e., the warp factor.)
warp,
base,
and
factor
are inherited by children of warped processes so that a child process
is warped in the same time frame as its parent.
Time progresses for warped processes at the rate of
factor
times the physical system clock.
Any files created by a warped process
will appear to be in the warped logical time frame
for that process but will appear in physical system time frame
for non-warped processes.
Statically-linked, set-uid or set-gid commands are not warped.
warp
[
-b
base
] [
-f
factor
] [
-n
] [
-t
]
date
[
command
[
arg
...
] ]
The components of the warp formula are set as follows:
the warp offset
warp
is
date-now,
base
is
date
by default,
and
factor
is 1 by default.
Command argument date specifications support common conventions:
yesterday
next week
50 days
2000-02-28/00:00
feb 28 2000
Absolute seconds since the epoch, a.k.a.
time_t
values, are represented by
#seconds.
The
-n
option shows how
command
would be executed without actually executing it.
The
-t
option traces each intercepted system call.
warp
executes
command
with optional
args,
or
$SHELL
if
command
is omitted.
$ date -f %Y-%m-%d/%H:%M
1998-03-11/13:41
$ warp 2000-02-29/12:30:30 date -f %Y-%m-%d/%H:%M
2000-02-29/12:30
$ date -f %Y-%m-%d/%H:%M
1998-03-11/13:44
$ warp '2 years' date
2000-01-01/00:00
# get a shell where 1 logical day passes for each physical second
$ PS1='(warp) ' warp -f $(60*60*24) 2000-02-29/12:30:30
(warp) date -f %Y-%m-%d/%H:%M
2000-03-07/18:58
(warp) sleep 1
(warp) date -f %Y-%m-%d/%H:%M
2000-03-19/18:58
As mentioned above, processes are warped by intercepting
systems calls with a shared library
that is preloaded at process startup before
main()
is called.
The intercepted system calls are:
alarm(2),
fstat(2),
getitimer(2),
gettimeofday(2),
lstat(2),
poll(2),
select(2),
setitimer(2),
stat(2),
time(2),
times(2),
utime(2),
utimes(2).
Also intercepted are the `_' and `_libc_' name permutations of the calls,
as well as any 32-bit and 64-bit versions, and the abominable System V
`x' versions of the
stat(2)
family.
warp
ignores calls not present in a particular host system.
warp
only works on dynamically linked executables that have neither set-uid
nor set-gid permissions.
The
warp
implementation consists of three components:
the
warp
script, located in one of the directories in the
PATH
environment variable,
the warp shared library
libwarp.so,
located in
../lib
relative to the directories in the
PATH
environment variable,
and the
ast
date(1)
command, located in one of the directories in the
PATH
environment variable,
that supports conversion to/from
time_t
values (seconds since the epoch) at the shell level.
Systems like
sgi.mips3
that support multiple a.out formats may have multiple versions of
libwarp.so.
warp
is part of the
ast-open
package posted at the
AT&T Software Technology
download site.
|
|
Glenn Fowler |
|
|
Information and Software Systems Research |
|
|
AT&T Labs Research |
|
|
Florham Park NJ |
|
|
March 13, 2009 |
|