Date: Wed, 13 Nov 2002 10:04:57 -0500 From: Hiten Pandya <hiten@angelica.unixdaemons.com> To: current@FreeBSD.org Subject: blimitd fixes (was: ports broken by KSE changes) Message-ID: <20021113100457.A41441@angelica.unixdaemons.com>
next in thread | raw e-mail | index | archive | help
--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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021113100457.A41441>