Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

7
sysutils/whowatch/DESCR Normal file
View File

@@ -0,0 +1,7 @@
Whowatch is an interactive who-like program that displays
information about the users currently logged on to the machine, in
real time. Besides standard informations (login name, tty, host,
user's process), the type of the connection (ie. telnet or ssh) is
shown. You can toggle display between users' command or idle time.
You can watch processes tree, navigate in it and send INT and KILL
signals.

View File

@@ -0,0 +1,23 @@
# $NetBSD: Makefile,v 1.18 2013/04/08 11:17:22 rodent Exp $
#
DISTNAME= whowatch-1.4
PKGREVISION= 3
CATEGORIES= sysutils
MASTER_SITES= http://wizard.ae.krakow.pl/~mike/download/ \
http://janek.ae.krakow.pl/~suszyckm/download/
MAINTAINER= rh@NetBSD.org
HOMEPAGE= http://wizard.ae.krakow.pl/~mike/\#whowatch
COMMENT= Interactive who-like program displaying real-time user information
GNU_CONFIGURE= YES
INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1
INSTALL_MAKE_FLAGS+= bindir=${DESTDIR}${PREFIX}/bin \
mandir=${DESTDIR}${PREFIX}/${PKGMANDIR}
CFLAGS.NetBSD+= -D_KMEMUSER
.include "../../devel/ncurses/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

3
sysutils/whowatch/PLIST Normal file
View File

@@ -0,0 +1,3 @@
@comment $NetBSD: PLIST,v 1.1 2001/10/31 22:54:12 zuntum Exp $
bin/whowatch
man/man1/whowatch.1

View File

@@ -0,0 +1,11 @@
$NetBSD: distinfo,v 1.6 2012/08/08 18:37:07 marino Exp $
SHA1 (whowatch-1.4.tar.gz) = 0d60c8ddb56b9bf9d2f3e1452832ccb2c862ff0c
RMD160 (whowatch-1.4.tar.gz) = da2ee1d52e2a1d5292713259e66b4e7dd39b8dfd
Size (whowatch-1.4.tar.gz) = 43084 bytes
SHA1 (patch-aa) = a42dbcd3f9a7138a6ec2e52d34e616e7113b87e2
SHA1 (patch-ab) = f66829eaf7d148df10c2ca064ed81bdedf5c9adc
SHA1 (patch-ac) = 9482d1b1759858a83b1efeaa5fc9dd9ec49043c7
SHA1 (patch-ad) = 41a9e710b8bbe427c715da5d82e77bf32a2f7a34
SHA1 (patch-ae) = ebb4f046df6ce950a320216f2d9f5238340a10b1
SHA1 (patch-proctree.c) = 54bd828dac7f3f6dfd51f869e812e0c5a3a989fd

View File

@@ -0,0 +1,19 @@
$NetBSD: patch-aa,v 1.1 2006/06/12 16:41:30 joerg Exp $
--- procinfo.h.orig 2006-06-12 16:36:59.000000000 +0000
+++ procinfo.h
@@ -1,11 +1,13 @@
#ifdef HAVE_PROCESS_SYSCTL
#include <sys/param.h>
#include <sys/sysctl.h>
+#if !defined(__DragonFly__)
#include <sys/proc.h>
+#endif
#include <sys/stat.h>
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <sys/user.h>
#endif

View File

@@ -0,0 +1,48 @@
$NetBSD: patch-ab,v 1.3 2000/10/16 01:34:39 wiz Exp $
--- screen.c.orig Tue Jun 6 20:53:24 2000
+++ screen.c
@@ -6,6 +6,7 @@
struct window info_win;
static chtype *curs_buf;
extern int screen_cols;
+int old_cur_vis = 1; /* this is the cursor mode, set to normal as default */
char *help_line[] =
{
@@ -38,7 +39,7 @@
}
wattrset(users_list.wd, A_BOLD);
- printf("\033[?25l"); /* disable cursor */
+ old_cur_vis = curs_set(0); /* disable cursor */
start_color();
init_pair(1,COLOR_CYAN,COLOR_BLACK);
@@ -58,6 +59,7 @@
cbreak();
nodelay(stdscr,TRUE);
+ keypad(info_win.wd, TRUE);
scrollok(users_list.wd,TRUE);
noecho();
}
@@ -67,7 +69,7 @@
werase(help_win.wd);
wrefresh(help_win.wd);
endwin();
- printf("\033[?25h"); /* enable cursor */
+ curs_set(old_cur_vis); /* enable cursor */
}
void cursor_on(struct window *w, int line)
@@ -116,7 +118,8 @@
if (i > w->cols) break;
if (*p < 17){
i--;
- waddnstr(w->wd, q, p - q);
+ if (p - q != 0)
+ waddnstr(w->wd, q, p - q);
wattrset(w->wd, COLOR_PAIR(*p));
q = p + 1;
}

View File

@@ -0,0 +1,84 @@
$NetBSD: patch-ac,v 1.2 2000/10/16 01:34:39 wiz Exp $
--- whowatch.c.orig Tue Jun 6 12:21:44 2000
+++ whowatch.c
@@ -20,8 +20,7 @@
#define ut_user ut_name
#endif
-enum key { ENTER=0x100, UP, DOWN, LEFT, RIGHT, DELETE, ESC, CTRL_K, CTRL_I,
- PG_DOWN, PG_UP, HOME, END };
+enum key { ENTER=KEY_MAX + 1, ESC, CTRL_K, CTRL_I};
enum State{ USERS_LIST, PROC_TREE, INIT_TREE } state;
@@ -334,30 +333,12 @@
int read_key()
{
int c;
- c = getc(stdin);
+ c = wgetch(info_win.wd);
switch (c){
case 0xD:
case 0xA: return ENTER;
case 0xB: return CTRL_K;
case 0x9: return CTRL_I;
- case 0x1B:
- getc(stdin);
- c = getc(stdin);
- switch(c) {
- case 0x41: return UP;
- case 0x42: return DOWN;
- case 0x34:
- case 0x38:
- case 0x46: return END;
- case 0x36:
- case 0x47: return PG_DOWN;
- case 0x31:
- case 0x37:
- case 0x48: return HOME;
- case 0x35:
- case 0x49: return PG_UP;
- }
- break;
default:
break;
}
@@ -420,6 +401,7 @@
signal_sent = 0;
}
switch(key){
+ case KEY_ENTER:
case ENTER:
werase(windows[state]->wd);
switch(state){
@@ -462,23 +444,23 @@
send_signal(9, pid);
tree_periodic();
break;
- case PG_DOWN:
+ case KEY_NPAGE:
page_down(windows[state], rfrsh[state]);
break;
- case PG_UP:
+ case KEY_PPAGE:
page_up(windows[state], rfrsh[state]);
break;
- case HOME:
+ case KEY_HOME:
key_home(windows[state], rfrsh[state]);
break;
- case END:
+ case KEY_END:
key_end(windows[state], rfrsh[state]);
break;
- case UP:
+ case KEY_UP:
cursor_up(windows[state]);
wrefresh(windows[state]->wd);
break;
- case DOWN:
+ case KEY_DOWN:
cursor_down(windows[state]);
wrefresh(windows[state]->wd);
break;

View File

@@ -0,0 +1,96 @@
$NetBSD: patch-ad,v 1.2 2012/08/08 18:37:07 marino Exp $
Fix LP64 support on FreeBSD/DragonFly (size_t instead of int)
Add DragonFly support -- kinfo structure is unique on DragonFly
--- procinfo.c.orig 2000-06-06 18:36:47.000000000 +0000
+++ procinfo.c
@@ -65,7 +65,7 @@ void get_info(int pid, struct procinfo *
int fill_kinfo(struct kinfo_proc *info, int pid)
{
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid };
- int len = sizeof *info;
+ size_t len = sizeof *info;
if(sysctl(mib, 4, info, &len, 0, 0) == -1)
return -1;
return len?0:-1;
@@ -83,12 +83,21 @@ void get_info(int pid, struct procinfo *
if(fill_kinfo(&info, pid) == -1) return;
+#ifdef __DragonFly__
+ p->ppid = info.kp_ppid;
+ p->tpgid = info.kp_tpgid;
+ p->euid = info.kp_svuid;
+ p->stat = info.kp_stat;
+ strncpy(p->exec_file, info.kp_comm, EXEC_FILE);
+ p->cterm = info.kp_tdev;
+#else
p->ppid = info.kp_eproc.e_ppid;
p->tpgid = info.kp_eproc.e_tpgid;
p->euid = info.kp_eproc.e_pcred.p_svuid;
p->stat = info.kp_proc.p_stat;
strncpy(p->exec_file, info.kp_proc.p_comm, EXEC_FILE);
p->cterm = info.kp_eproc.e_tdev;
+#endif
p->exec_file[EXEC_FILE] = '\0';
}
#endif
@@ -124,7 +133,8 @@ int get_term(char *tty)
int get_login_pid(char *tty)
{
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_TTY, 0};
- int len, t, el, i, pid, cndt = -1, l;
+ size_t len;
+ int t, el, i, pid, cndt = -1, l;
struct kinfo_proc *info;
struct procinfo p;
@@ -142,6 +152,17 @@ int get_login_pid(char *tty)
if(sysctl(mib, 4, info, &len, 0, 0) == -1)
return -1;
for(i = 0; i < el; i++) {
+#ifdef __DragonFly__
+ if(!(pid = info[i].kp_pid)) continue;
+ get_info(get_ppid(pid), &p);
+ if(p.cterm == -1 || p.cterm != t) {
+ cndt = pid;
+ l = strlen(info[i].kp_comm);
+ if(l > 1 && !strncmp("sh",info[i].kp_comm+l-2,2)) {
+ free(info);
+ return pid;
+ }
+#else
if(!(pid = info[i].kp_proc.p_pid)) continue;
get_info(get_ppid(pid), &p);
if(p.cterm == -1 || p.cterm != t) {
@@ -157,6 +178,7 @@ int get_login_pid(char *tty)
free(info);
return pid;
}
+#endif
}
}
free(info);
@@ -169,7 +191,8 @@ int get_login_pid(char *tty)
int get_all_info(struct kinfo_proc **info)
{
int mib[3] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
- int len, el;
+ size_t len;
+ int el;
if(sysctl(mib, 3, 0, &len, 0, 0) == -1)
return 0;
@@ -239,7 +262,11 @@ char *get_cmdline(int pid)
bzero(buf, sizeof buf);
if(fill_kinfo(&info, pid) == -1)
return "-";
+#ifdef __DragonFly__
+ memcpy(buf, info.kp_comm, sizeof buf - 1);
+#else
memcpy(buf, info.kp_proc.p_comm, sizeof buf - 1);
+#endif
if(!full_cmd) return buf;
#ifdef HAVE_LIBKVM
if(!can_use_kvm) return buf;

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-ae,v 1.1 2006/12/13 18:21:36 wiz Exp $
--- process.c.orig 2000-06-06 10:16:12.000000000 +0000
+++ process.c
@@ -74,7 +74,7 @@ void synchronize()
memset(z, 0, sizeof *z);
check_line(l);
z->line = l++;
- (struct process *) p->priv = z;
+ p->priv = z;
z->proc = p;
if (*current){
z->next = *current;

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-proctree.c,v 1.1 2012/08/08 18:37:07 marino Exp $
Add DragonFly support (kernel proc can return pid of -1, skip)
kinfo structure is unique on DragonFly
--- proctree.c.orig 2000-06-06 09:03:28.000000000 +0000
+++ proctree.c
@@ -170,8 +170,14 @@ int update_tree(void del(void*))
#ifdef HAVE_PROCESS_SYSCTL
el = get_all_info(&pi);
for(i = 0; i < el; i++) {
+#ifdef __DragonFly__
+ if (pi[i].kp_pid == -1) continue;
+ p = validate_proc(pi[i].kp_pid);
+ q = validate_proc(pi[i].kp_ppid);
+#else
p = validate_proc(pi[i].kp_proc.p_pid);
q = validate_proc(pi[i].kp_eproc.e_ppid);
+#endif
#else
d=opendir(PROCDIR);