# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= whowatch VERSION= 1.8.6 REVISION= 2 KEYWORDS= sysutils VARIANTS= standard SDESC[standard]= Display information logged on users HOMEPAGE= https://github.com/mtsuszycki/whowatch CONTACT= nobody DOWNLOAD_GROUPS= main SITES[main]= https://github.com/mtsuszycki/whowatch/releases/download/whowatch-1.8.6/ DISTFILE[1]= whowatch-1.8.6.tar.gz:main DF_INDEX= 1 SPKGS[standard]= single OPTIONS_AVAILABLE= none OPTIONS_STANDARD= none NOT_FOR_OPSYS= sunos netbsd USES= ncurses LICENSE= GPLv2+:single LICENSE_TERMS= single:{{FILESDIR}}/LICENSE LICENSE_FILE= GPLv2+:{{WRKSRC}}/COPYING LICENSE_SCHEME= solo FPC_EQUIVALENT= sysutils/whowatch MUST_CONFIGURE= gnu CPPFLAGS= -I{{NCURSESINC}} LDFLAGS= -ltinfo post-patch: ${REINPLACE_CMD} -e "s|utmp|utmpx|g" ${WRKSRC}/configure [FILE:397:descriptions/desc.single] Whowatch is an interactive who-like program that displays information about the users currently logged on to the machine. In addition to standard information (login name, tty, host, user's process), the type of the connection (telnet or ssh) is shown. You can toggle display between the users' commands or idle times. You can watch the process tree, navigate in it, and send INT and KILL signals. [FILE:100:distinfo] 9bdf0338850fd66036cb4db1f7a61b35f502158c315981f7176d8f834a0b5a02 141801 whowatch-1.8.6.tar.gz [FILE:42:manifests/plist.single] bin/whowatch share/man/man1/whowatch.1.gz [FILE:527:patches/patch-configure] --- configure.orig 2013-10-07 12:11:45 UTC +++ configure @@ -4897,6 +4897,7 @@ else /* end confdefs.h. */ #include #include +#include #include int main() @@ -4948,7 +4949,7 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; }; $as_echo "#define HAVE_PROCESS_SYSCTL 1" >>confdefs.h - +HAVE_PROCESS_SYSCTL=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } [FILE:252:patches/patch-src_proc__plugin.c] --- src/proc_plugin.c.orig 2018-04-11 06:10:50 UTC +++ src/proc_plugin.c @@ -33,7 +33,6 @@ #if defined(HAVE_LIBKVM) && defined(HAVE_STDINT_H) && defined(HAVE_KVM_H) #include #include -kvm_t *kd; extern int can_use_kvm; #endif [FILE:267:patches/patch-src_procinfo.h] --- src/procinfo.h.orig 2018-04-11 06:10:50 UTC +++ src/procinfo.h @@ -1,6 +1,9 @@ #ifdef HAVE_PROCESS_SYSCTL #include #include +#ifdef __DragonFly__ +#include +#endif #include #include #endif [FILE:336:patches/patch-src_proctree.c] --- src/proctree.c.orig 2018-04-11 06:10:50 UTC +++ src/proctree.c @@ -172,6 +172,7 @@ int update_tree(void del(void*)) #ifdef HAVE_PROCESS_SYSCTL el = get_all_info(&pi); for(i = 0; i < el; i++) { + if (pi[i].kinfo_pid < 1) continue; p = validate_proc(pi[i].kinfo_pid, ' '); q = validate_proc(pi[i].kinfo_ppid, ' '); #else [FILE:635:patches/patch-src_proctree.h] --- src/proctree.h.orig 2018-04-11 06:10:50 UTC +++ src/proctree.h @@ -46,6 +46,15 @@ extern int num_proc; #define kinfo_tdev kp_eproc.e_tdev #endif #else +# if defined __DragonFly__ + #define kinfo_pid kp_pid + #define kinfo_ppid kp_ppid + #define kinfo_tpgid kp_tpgid + #define kinfo_svuid kp_svuid + #define kinfo_stat kp_stat + #define kinfo_comm kp_comm + #define kinfo_tdev kp_tdev +# else #define kinfo_pid ki_pid #define kinfo_ppid ki_ppid #define kinfo_tpgid ki_tpgid @@ -53,4 +62,5 @@ extern int num_proc; #define kinfo_stat ki_stat #define kinfo_comm ki_comm #define kinfo_tdev ki_tdev +# endif #endif [FILE:2755:patches/patch-src_ulist.c] --- src/ulist.c.orig 2018-04-11 06:10:50 UTC +++ src/ulist.c @@ -48,21 +48,17 @@ void update_line(int line) /* * Create new user structure and fill it */ -struct user_t *alloc_user(struct utmp *entry) +struct user_t *alloc_user(struct utmpx *entry) { struct user_t *u; int ppid; u = calloc(1, sizeof *u); if(!u) errx(1, "Cannot allocate memory."); - strncpy(u->name, entry->ut_user, UT_NAMESIZE); - strncpy(u->tty, entry->ut_line, UT_LINESIZE); - strncpy(u->host, entry->ut_host, UT_HOSTSIZE); -#ifdef HAVE_UTPID + strncpy(u->name, entry->ut_user, sizeof(entry->ut_user)); + strncpy(u->tty, entry->ut_line, sizeof(entry->ut_line)); + strncpy(u->host, entry->ut_host, sizeof(entry->ut_host)); u->pid = entry->ut_pid; -#else - u->pid = get_login_pid(u->tty); -#endif if((ppid = get_ppid(u->pid)) == -1) strncpy(u->parent, "can't access", sizeof u->parent); else strncpy(u->parent, get_name(ppid), sizeof u->parent - 1); @@ -70,7 +66,7 @@ struct user_t *alloc_user(struct utmp *e return u; } -static struct user_t* new_user(struct utmp *ut) +static struct user_t* new_user(struct utmpx *ut) { struct user_t *u; u = alloc_user(ut); @@ -108,21 +104,13 @@ void uredraw(struct wdgt *w) */ void read_utmp(void) { - int fd, i; - static struct utmp entry; + static struct utmpx *entry; struct user_t *u; - if ((fd = open(UTMP_FILE ,O_RDONLY)) == -1) err_exit(1, "Cannot open utmp"); - while((i = read(fd, &entry,sizeof entry)) > 0) { - if(i != sizeof entry) errx(1, "Error reading " UTMP_FILE ); -#ifdef HAVE_USER_PROCESS - if(entry.ut_type != USER_PROCESS) continue; -#else - if(!entry.ut_name[0]) continue; -#endif - u = new_user(&entry); + while ((entry = getutxent()) != NULL) { + if(entry->ut_type != USER_PROCESS) continue; + u = new_user(entry); } - close(fd); return; } @@ -176,31 +164,23 @@ static void check_wtmp(struct wdgt *w) static int wtmp_fd; struct user_t *u; struct list_head *h; - struct utmp entry; + struct utmpx entry; int i, changed = 0; if(!wtmp_fd) open_wtmp(&wtmp_fd); while((i = read(wtmp_fd, &entry, sizeof entry)) > 0){ if (i < sizeof entry) prg_exit("Error reading wtmp"); /* user just logged in */ -#ifdef HAVE_USER_PROCESS if(entry.ut_type == USER_PROCESS) { -#else - if(entry.ut_user[0]) { -#endif u = new_user(&entry); changed = 1; continue; } -#ifdef HAVE_DEAD_PROCESS if(entry.ut_type != DEAD_PROCESS) continue; -#else -// if(entry.ut_line[0]) continue; -#endif /* user just logged out */ list_for_each(h, &users_l) { u = list_entry(h, struct user_t, head); - if(strncmp(u->tty, entry.ut_line, UT_LINESIZE)) + if(strncmp(u->tty, entry.ut_line, sizeof(entry.ut_line))) continue; udel(u, w); changed = 1; [FILE:680:patches/patch-src_ulist.h] --- src/ulist.h.orig 2018-04-11 06:10:50 UTC +++ src/ulist.h @@ -3,7 +3,13 @@ #endif #ifndef WTMP_FILE +# ifdef __FreeBSD__ +#define WTMP_FILE "/var/log/utx.log" +# elif defined __DragonFly__ +#define WTMP_FILE "/var/log/wtmpx" +# else #define WTMP_FILE "/var/log/wtmp" +# endif #endif #define LOGIN 1 @@ -16,11 +22,11 @@ struct user_t { struct list_head head; - char name[UT_NAMESIZE + 1]; - char tty[UT_LINESIZE + 1]; + char name[sizeof(((struct utmpx *)0)->ut_user)]; + char tty[sizeof(((struct utmpx *)0)->ut_line)]; int pid; char parent[16]; - char host[UT_HOSTSIZE + 1]; + char host[sizeof(((struct utmpx *)0)->ut_host)]; int line; }; [FILE:331:patches/patch-src_whowatch.c] --- src/whowatch.c.orig 2018-04-11 06:10:50 UTC +++ src/whowatch.c @@ -437,6 +437,10 @@ int main(int argc, char **argv) tv.tv_sec -= (after.tv_sec - before.tv_sec); if(retval > 0) { key = getkey(); + if(key == KBD_MORE) { + usleep(10000); + key = getkey(); + } key_action(key); } if(tv.tv_sec <= 0) { [FILE:408:patches/patch-src_whowatch.h] --- src/whowatch.h.orig 2013-10-07 12:11:29 UTC +++ src/whowatch.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -216,3 +216,6 @@ int getkey(); /* term.c */ void term_raw(); +/* forgotten */ +void info_reg(struct wdgt *); +void scr_crsr_jmp(struct wdgt *w, int l); [FILE:735:files/LICENSE] whowatch - console, interactive, process and users monitoring tool Copyright Michal Suszycki, Jan Bobrowski and others. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . [FILE:897:dragonfly/patch-src_plist.c] DragonFly pids go to 1 million, so allocate an extra character --- src/plist.c.orig 2018-04-11 06:10:50 UTC +++ src/plist.c @@ -152,12 +152,12 @@ static char *prepare_line(struct wdgt *w offset = snprintf(w->mwin->gbuf, w->mwin->gbsize, "\x6%4d ", p->line + 1); if (offset < 0) return ""; if(show_owner) - snprintf(w->mwin->gbuf+offset, w->mwin->gbsize-offset ,"\x3%5d %c%c \x3%-8s \x2%s \x3%s", + snprintf(w->mwin->gbuf+offset, w->mwin->gbsize-offset ,"\x3%6d %c%c \x3%-8s \x2%s \x3%s", p->proc->pid, get_state_color(state), state, get_owner_name(proc_pid_uid(p->proc->pid)), tree, get_cmdline(p->proc->pid)); else - snprintf(w->mwin->gbuf+offset, w->mwin->gbsize-offset,"\x3%5d %c%c \x2%s \x3%s", + snprintf(w->mwin->gbuf+offset, w->mwin->gbsize-offset,"\x3%6d %c%c \x2%s \x3%s", p->proc->pid, get_state_color(state), state, tree, get_cmdline(p->proc->pid));