From edd99b9e84b8aff243bfe5bd74269d5227192aff Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Sun, 28 May 2006 15:45:32 +0000 Subject: teach opencvs about the dlimit keyword in CVSROOT/config. put some trace messages in place while im here. --- usr.bin/cvs/config.c | 15 ++++++++++++++- usr.bin/cvs/includes.h | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/usr.bin/cvs/config.c b/usr.bin/cvs/config.c index a9c6dd45695..f9f7c678a78 100644 --- a/usr.bin/cvs/config.c +++ b/usr.bin/cvs/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.2 2006/05/27 21:10:53 joris Exp $ */ +/* $OpenBSD: config.c,v 1.3 2006/05/28 15:45:31 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * @@ -29,9 +29,12 @@ cvs_parse_configfile(void) int i; FILE *fp; size_t len; + struct rlimit rl; const char *errstr; char *p, *buf, *lbuf, *opt, *val, fpath[MAXPATHLEN]; + cvs_log(LP_TRACE, "cvs_parse_configfile()"); + i = snprintf(fpath, sizeof(fpath), "%s/%s", current_cvsroot->cr_dir, CVS_PATH_CONFIG); if (i == -1 || i >= (int)sizeof(fpath)) @@ -74,6 +77,16 @@ cvs_parse_configfile(void) if (errstr != NULL) fatal("cvs_parse_configfile: %s: %s", val, errstr); + } else if (!strcmp(opt, "dlimit")) { + if (getrlimit(RLIMIT_DATA, &rl) != -1) { + rl.rlim_cur = (int)strtonum(val, 0, INT_MAX, + &errstr); + if (errstr != NULL) + fatal("cvs_parse_configfile: %s: %s", + val, errstr); + rl.rlim_cur = rl.rlim_cur * 1024; + (void)setrlimit(RLIMIT_DATA, &rl); + } } else { cvs_log(LP_ERR, "ignoring unknown option '%s'", opt); } diff --git a/usr.bin/cvs/includes.h b/usr.bin/cvs/includes.h index 29c3b169464..08552485174 100644 --- a/usr.bin/cvs/includes.h +++ b/usr.bin/cvs/includes.h @@ -1,4 +1,4 @@ -/* $OpenBSD: includes.h,v 1.4 2006/01/06 13:14:24 xsa Exp $ */ +/* $OpenBSD: includes.h,v 1.5 2006/05/28 15:45:31 joris Exp $ */ /* * Copyright (c) 2005 Xavier Santolaria * All rights reserved. @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3