From owner-freebsd-current Wed Nov 13 7: 5: 5 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B3F4A37B401 for ; Wed, 13 Nov 2002 07:05:02 -0800 (PST) Received: from angelica.unixdaemons.com (angelica.unixdaemons.com [209.148.64.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 16ABC43E42 for ; Wed, 13 Nov 2002 07:05:02 -0800 (PST) (envelope-from hiten@angelica.unixdaemons.com) Received: from angelica.unixdaemons.com (hiten@localhost.unixdaemons.com [127.0.0.1]) by angelica.unixdaemons.com (8.12.5/8.12.1) with ESMTP id gADF4v06042351 for ; Wed, 13 Nov 2002 10:04:57 -0500 (EST) X-Authentication-Warning: angelica.unixdaemons.com: Host hiten@localhost.unixdaemons.com [127.0.0.1] claimed to be angelica.unixdaemons.com Received: (from hiten@localhost) by angelica.unixdaemons.com (8.12.5/8.12.1/Submit) id gADF4vom042350 for current@FreeBSD.org; Wed, 13 Nov 2002 10:04:57 -0500 (EST) (envelope-from hiten) Date: Wed, 13 Nov 2002 10:04:57 -0500 From: Hiten Pandya To: current@FreeBSD.org Subject: blimitd fixes (was: ports broken by KSE changes) Message-ID: <20021113100457.A41441@angelica.unixdaemons.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tThc/1wpZn/ma/RB" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-Operating-System: FreeBSD i386 X-Public-Key: http://www.pittgoth.com/~hiten/pubkey.asc X-URL: http://www.unixdaemons.com/~hiten X-PGP: http://pgp.mit.edu:11371/pks/lookup?search=Hiten+Pandya&op=index Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi there. I have tried and fix some of the ports which were reported by Kris, as _not working on -current_. I also checked the bento logs, and here it is. More mails will follow up as I write more fixes. I donno why, but no one bumped __FreeBSD_version, when Dr. Kirk made the change to sys/user.h: removal of struct kp_eproc from struct user. So, I have just used the version 500000 and 500023 in my patches. Note: This only applies to -current. "blimitd" users: http://www.unixdaemons.com/~hiten/work/ports/blimitd-patches Cheers. -- Hiten Pandya (hiten@unixdaemons.com, hiten@uk.FreeBSD.org) http://www.unixdaemons.com/~hiten/ --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=blimitd-patches --- config.h Sat Aug 4 15:11:31 2001 +++ config.h.new Wed Oct 23 16:46:47 2002 @@ -13,7 +13,7 @@ #define SYSLOG_IDENT "blimitd" /* location of pid file */ -#define PID_FILE _PATH_VARRUN ## "blimitd.pid" +#define PID_FILE _PATH_VARRUN "blimitd.pid" /* how often to check for infringements (in seconds). NB warnings can't be * sent more frequently than this figure either */ --- kill.c Sat Aug 4 15:11:31 2001 +++ kill.c.new Fri Oct 25 04:53:40 2002 @@ -143,6 +143,7 @@ */ /* copy the session structure to our address space */ +#if __FreeBSD_version <= 500023 if (kvm_read(kd, (unsigned long)processes[0].kp_eproc.e_tsess, &tty_session, sizeof(tty_session)) != sizeof(tty_session)) { syslog(LOG_ERR, "kvm_read failed (%s:%d): %s", __FILE__, __LINE__, kvm_geterr(kd)); goto failure; @@ -162,7 +163,36 @@ /* success? well possibly..we don't actually check the process went */ return_value = 1; } +#else /* if __FreeBSD_version >= 500023 */ + if (kvm_read(kd, (unsigned long) processes[0].ki_paddr->p_session, &tty_session, + sizeof(tty_session)) != sizeof(tty_session)) { + syslog(LOG_ERR, "kvm_read failed (%s:%d): %s", + __FILE__, __LINE__, kvm_geterr(kd)); + goto failure; + } + + /* copy the session leader's structp proc to our address space */ + if (processes[0].ki_kiflag & KI_SLEADER) { + if (kvm_read(kd, (unsigned long)tty_session.s_leader, + &session_leader, sizeof(session_leader)) != + sizeof(session_leader)) { + syslog(LOG_ERR, "kvm_read failed (%s:%d): %s", + __FILE__, __LINE__, kvm_geterr(kd)); + goto failure; + } + /* send a hangup signal to the shell */ + if (kill(session_leader.p_pid, SIGHUP) != 0) { + syslog(LOG_ERR, "kill failed (%s:%d): %m", __FILE__, + __LINE__); + goto failure; + } else { + /* success? well possibly.. we don't know actually + * check where the process went */ + return_value = 1; + } + } +#endif /* we skip to here if things fail so we always close the kvm interface. * we could have used massive if staements or do/while(0) and break but * we didn't */ --tThc/1wpZn/ma/RB-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message