michael@146: Index: makedefs michael@495: --- makedefs.orig 2011-01-16 22:02:31.000000000 +0100 michael@495: +++ makedefs 2011-01-21 09:43:55.000000000 +0100 michael@495: @@ -153,6 +153,8 @@ michael@146: ;; michael@495: FreeBSD.8*) SYSTYPE=FREEBSD8 michael@146: ;; michael@495: + FreeBSD.9*) SYSTYPE=FREEBSD9 michael@146: + ;; michael@146: OpenBSD.2*) SYSTYPE=OPENBSD2 michael@146: ;; michael@146: OpenBSD.3*) SYSTYPE=OPENBSD3 michael@146: Index: src/util/file_limit.c michael@495: --- src/util/file_limit.c.orig 2003-10-22 20:48:36.000000000 +0200 michael@495: +++ src/util/file_limit.c 2011-01-21 09:43:55.000000000 +0100 michael@146: @@ -80,12 +80,21 @@ michael@146: void set_file_limit(off_t limit) michael@146: { michael@146: #ifdef USE_ULIMIT michael@146: +#ifdef USE_SOFTLIMITONLY michael@146: +#error "USE_ULIMIT and USE_SOFTLIMITONLY are mutual exclusive" michael@146: +#endif michael@146: if (ulimit(UL_SETFSIZE, limit / ULIMIT_BLOCK_SIZE) < 0) michael@146: msg_fatal("ulimit: %m"); michael@146: #else michael@146: struct rlimit rlim; michael@146: michael@146: +#ifdef USE_SOFTLIMITONLY michael@146: + if (getrlimit(RLIMIT_FSIZE, &rlim) < 0) michael@146: + rlim.rlim_max = RLIM_INFINITY; michael@146: + rlim.rlim_cur = limit; michael@146: +#else michael@146: rlim.rlim_cur = rlim.rlim_max = limit; michael@146: +#endif michael@146: if (setrlimit(RLIMIT_FSIZE, &rlim) < 0) michael@146: msg_fatal("setrlimit: %m"); michael@146: #ifdef SIGXFSZ michael@146: Index: src/util/msg_syslog.c michael@495: --- src/util/msg_syslog.c.orig 2006-06-15 20:07:16.000000000 +0200 michael@495: +++ src/util/msg_syslog.c 2011-01-21 09:43:55.000000000 +0100 michael@146: @@ -50,6 +50,11 @@ michael@146: #include michael@146: #include michael@146: #include michael@146: +#ifdef USE_SOFTLIMITONLY michael@146: +#include michael@146: +#include michael@146: +#include michael@146: +#endif michael@146: michael@146: /* Application-specific. */ michael@146: michael@146: @@ -144,6 +149,9 @@ michael@146: michael@146: static void msg_syslog_print(int level, const char *text) michael@146: { michael@146: +#ifdef USE_SOFTLIMITONLY michael@146: + struct rlimit save, rlim; michael@146: +#endif michael@146: static int log_level[] = { michael@146: LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT, michael@146: }; michael@146: @@ -154,6 +162,15 @@ michael@146: if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0]))) michael@146: msg_panic("msg_syslog_print: invalid severity level: %d", level); michael@146: michael@146: +#ifdef USE_SOFTLIMITONLY michael@146: + if (getrlimit(RLIMIT_FSIZE, &save) < 0) { michael@146: + save.rlim_cur = RLIM_INFINITY; michael@146: + save.rlim_max = RLIM_INFINITY; michael@146: + } michael@146: + rlim.rlim_cur = save.rlim_max; michael@146: + rlim.rlim_max = save.rlim_max; michael@146: + (void)setrlimit(RLIMIT_FSIZE, &rlim); michael@146: +#endif michael@146: if (level == MSG_INFO) { michael@146: syslog(syslog_facility | log_level[level], "%.*s", michael@146: (int) MSG_SYSLOG_RECLEN, text); michael@146: @@ -161,6 +178,9 @@ michael@146: syslog(syslog_facility | log_level[level], "%s: %.*s", michael@146: severity_name[level], (int) MSG_SYSLOG_RECLEN, text); michael@146: } michael@146: +#ifdef USE_SOFTLIMITONLY michael@146: + (void)setrlimit(RLIMIT_FSIZE, &save); michael@146: +#endif michael@146: } michael@146: michael@146: /* msg_syslog_init - initialize */ michael@146: Index: src/util/sys_defs.h michael@495: --- src/util/sys_defs.h.orig 2011-01-17 15:44:25.000000000 +0100 michael@495: +++ src/util/sys_defs.h 2011-01-21 09:43:55.000000000 +0100 michael@495: @@ -25,7 +25,7 @@ michael@146: */ michael@146: #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \ michael@495: || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ michael@495: - || defined(FREEBSD8) \ michael@495: + || defined(FREEBSD8) || defined(FREEBSD9) \ michael@146: || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ michael@146: || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ michael@495: || defined(OPENBSD5) \ michael@495: @@ -117,6 +117,10 @@ michael@495: #define HAS_CLOSEFROM michael@495: #endif michael@495: michael@495: +#if (__FreeBSD_version < 800000 && __FreeBSD_version >= 702104) || (__FreeBSD_version >= 800100) michael@495: +#define HAS_CLOSEFROM michael@146: +#endif michael@495: + michael@495: /* OpenBSD version is year+month */ michael@146: michael@495: #if OpenBSD >= 199805 /* XXX */