########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1998-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
typeset base_str
command=warp
USAGE=$'
[-?
@(#)$Id: warp (AT&T Labs Research) 1999-11-19 $
]
[+NAME?warp - execute a command in a different time frame]
[+DESCRIPTION?\bwarp\b executes a dynamically linked \acommand\a
in a different time frame by intercepting time related system calls
and modifying the times seen by \acommand\a using the formula:]{
[+time = time + warp + (time - base) * (factor - 1)?]
}
[+?where \awarp\a is \adate-now\a, \abase\a is \adate\a by default, and
\afactor\a is 1 by default. Command argument date specifications
support common conventions:]{
[+yesterday?]
[+next week?]
[+50 days?]
[+2000-02-28+00:00?]
[+feb 28 2000?]
[+#\aseconds\a?A \btime_t\b value in \aseconds\a since the epoch.]
}
[b:base?Set the base or starting date to \adate\a. Useful for repeating
a set of tests.]:[date:=date]
[f:factor?Set the warped clock to tick at \afactor\a seconds per real second.]:
[factor:=1]
[n!:exec?Execute \acommand\a. \b--noexec\b shows how \acommand\a would be
invoked but does not execute.]
[t:trace?Trace each intercepted system call on the standard error.]
[+DETAILS?\bwarp\b executes \acommand\a with optional \aargs\a, or \bsh\b(1) if
\acommand\a is omitted. All processes executed by \acommand\a are
warped in the same time frame. Time progresses for \acommand\a and its
children at the rate of \afactor\a times the system clock. Any files
created by \acommand\a or its children will appear newer than \adate\a
to \acommand\a and its children, but will actually be in the normal
time frame for non-warped commands.]
[+?Processes are warped by intercepting system calls with a dll that is
preloaded at process startup before \amain\a() is called. The
interception mechanism may involve the environment on some systems;
in those cases commands like \benv\b(1) that clear the enviroment
before execution may defeat the \bwarp\b intercepts. The intercepted
system calls are:]{
[+alarm?]
[+fstat?]
[+getitimer?]
[+gettimeofday?]
[+lstat?]
[+poll?]
[+select?]
[+setitimer?]
[+stat?]
[+time?]
[+times?]
[+utime?]
[+utimes?]
}
[+?Also intercepted are the \b_\b and \b_libc_\b name permutations of the
calls, as well as any 32-bit and 64-bit versions, and the abominable
System V \bx\b versions of the \bstat\b(2) family. \bwarp\b ignores
calls not present in a particular host system. In addition, \bwarp\b
only works on dynamically linked executables that have neither set-uid
set-uid nor set-gid permissions. It may not have the intended effect
on programs written in a language or linked with a language runtime
that hides or mangles system call library symbols, or that
directly emit system call instruction sequences rather than using
the corresponding library functions, or that dynamically link
libraries outside of the scope of the \bwarp\b intercepts.]
[+?Multi-process client-server applications may misbehave if the \bwarp\b
environment between the related processes is not kept in sync.]
date [ command [ arg ... ] ]
[+ENVIRONMENT?\bwarp\b is implemented by three components: the \bwarp\b script,
located on \b$PATH\b; the \bwarp\b dll (shared library), located either
depending on local compilation system conventions; and the \bast\b
\bdate\b(1) command, located on \b$PATH\b, that supports conversion
versions of the \bwarp\b dll. In all cases the \bwarp\b script handles
the dll search.]
[+EXAMPLES?]{
[+$ date -f %K?1998-03-11+13:41]
[+$ warp 2000-02-29+12::30::30 date -f %K?2000-02-29+12:30]
[+$ warp "2 years" date -f %K?2000-01-01+00:00]
[+$ PS1="(warp) " warp -f $((60*60*24)) 2000-02-29+12::30::30?#
interactive \bsh\b(1) where 1 warped day passes for each
real second.]
}
[+SEE ALSO?\b3d\b(1), \bdate\b(1), \benv\b(1), \bie\b(1), \bsh\b(1),
\btrace\b(1), \bstat\b(2)]
'
;;
*) ARGV0=""
USAGE='b:[base]f:[factor]nt date [ command [ arg ... ] ]'
;;
esac
n) show=print ;;
*) exit 2 ;;
esac
done
shift $OPTIND-1
case $# in
esac
'}
IFS=:
if test -f $dll
then break
fi
done
case $1 in
;;
+([0-9]))
;;
;;
esac
shift
;;
+([0-9]))
;;
;;
esac
fi
case $# in
*) if test -x "$1"
then command=$1
else command=$(whence $1)
fi
shift
;;
esac
env="WARP='$opt$warp' LD_PRELOAD='$root/$prefix$suffix${LD_PRELOAD:+ $LD_PRELOAD}' DYLD_INSERT_LIBRARIES='$root/$prefix$suffix${DYLD_INSERT_LIBRARIES:+ $DYLD_INSERT_LIBRARIES}'"
case $_RLDN32_LIST in
*) env="$env:$_RLDN32_LIST" ;;
esac
;;
case $_RLD64_LIST in
*) env="$env:$_RLD64_LIST" ;;
esac
case $_RLDN32_LIST in
*) env="$env:$_RLDN32_LIST" ;;
esac
case $_RLD_LIST in
*) env="$env:$_RLD_LIST" ;;
esac
case $_RLD64_LIST in
*) env="$env:$_RLD64_LIST" ;;
esac
case $_RLDN32_LIST in
*) env="$env:$_RLDN32_LIST" ;;
esac
case $_RLD_LIST in
*) env="$env:$_RLD_LIST" ;;
esac
case $_RLD64_LIST in
*) env="$env:$_RLD64_LIST" ;;
esac
case $_RLDN32_LIST in
*) env="$env:$_RLDN32_LIST" ;;
esac
case $_RLD_LIST in
*) env="$env:$_RLD_LIST" ;;
esac
;;
case $_RLD_LIST in
*) env="$env:$_RLD_LIST" ;;
esac
esac
fi
;;
esac
: engage
esac