Revision ffcc6e24 cmdutils.c

View differences:

cmdutils.c
41 41
#if CONFIG_NETWORK
42 42
#include "libavformat/network.h"
43 43
#endif
44
#if HAVE_SYS_RESOURCE_H
45
#include <sys/resource.h>
46
#endif
44 47

  
45 48
#undef exit
46 49

  
......
257 260
    return 0;
258 261
}
259 262

  
263
int opt_timelimit(const char *opt, const char *arg)
264
{
265
#if HAVE_SYS_RESOURCE_H
266
    int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
267
    struct rlimit rl = { lim, lim + 1 };
268
    if (setrlimit(RLIMIT_CPU, &rl))
269
        perror("setrlimit");
270
#else
271
    fprintf(stderr, "Warning: -%s not implemented on this OS\n", opt);
272
#endif
273
    return 0;
274
}
275

  
260 276
void set_context_opts(void *ctx, void *opts_ctx, int flags)
261 277
{
262 278
    int i;

Also available in: Unified diff