ddos/set_proc_limit.c
author Markus Bröker <mbroeker@largo.dyndns.tv>
Sun, 10 May 2009 18:44:50 +0200
changeset 90 d494813f9e5b
parent 77 49e0babccb23
permissions -rw-r--r--
cppdatabase added cppdatabase stores data in a file and retrieves it back committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
/**
77
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 68
diff changeset
     2
 * ddos/set_limit.c
68
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
 * Copyright (C) 2008 Markus Broeker
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
 */
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
#include <sys/resource.h>
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
int set_proc_limit (int processes)
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
{
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
    struct rlimit rlim;
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
    rlim.rlim_cur = processes;
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
    rlim.rlim_max = processes + 24;
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
    return setrlimit (RLIMIT_NPROC, &rlim);
d549894aa6a9 Trivial Changes
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
}