Limit theorems for sojourns of stochastic processes