Index: head/sysutils/psmisc/Makefile =================================================================== --- head/sysutils/psmisc/Makefile (revision 152842) +++ head/sysutils/psmisc/Makefile (revision 152843) @@ -1,35 +1,35 @@ # New ports collection makefile for: psmisc # Date created: 10 March 1998 # Whom: rantapaa@uswest.net # # $FreeBSD$ # PORTNAME= psmisc -PORTVERSION= 21.8 +PORTVERSION= 21.9 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= psmisc MAINTAINER= pav@FreeBSD.org COMMENT= A port of the Linux pstree, killall and pidof commands GNU_CONFIGURE= yes CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL} CONFIGURE_ARGS= --disable-nls USE_GMAKE= yes USE_GETOPT_LONG=yes CONFLICTS= pstree-2.* \ pidof-* PLIST_FILES= bin/killall \ bin/pidof \ bin/pstree bin/pstree.x11 MAN1= pstree.1 killall.1 post-install: @${LN} -sf killall ${PREFIX}/bin/pidof .include Property changes on: head/sysutils/psmisc/Makefile ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.19 \ No newline at end of property +1.20 \ No newline at end of property Index: head/sysutils/psmisc/distinfo =================================================================== --- head/sysutils/psmisc/distinfo (revision 152842) +++ head/sysutils/psmisc/distinfo (revision 152843) @@ -1,3 +1,3 @@ -MD5 (psmisc-21.8.tar.gz) = d6276e071c10ddf4b0d98856e5573e1a -SHA256 (psmisc-21.8.tar.gz) = 495463860415171d9019798ed4fdf5848ffe93f8a380662a39dd2690a04717ed -SIZE (psmisc-21.8.tar.gz) = 227997 +MD5 (psmisc-21.9.tar.gz) = 7b21b6bb1e35e7e68b952e86f85c0a1c +SHA256 (psmisc-21.9.tar.gz) = 90fd6844a4a527021d2ef3efada0fc5384d0778a09dce91ab11effed4ce34a44 +SIZE (psmisc-21.9.tar.gz) = 232172 Property changes on: head/sysutils/psmisc/distinfo ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.5 \ No newline at end of property +1.6 \ No newline at end of property Index: head/sysutils/psmisc/files/patch-src-killall.c =================================================================== --- head/sysutils/psmisc/files/patch-src-killall.c (revision 152842) +++ head/sysutils/psmisc/files/patch-src-killall.c (revision 152843) @@ -1,160 +1,160 @@ ---- src/killall.c.orig Tue Sep 20 05:31:38 2005 -+++ src/killall.c Wed Nov 16 17:40:13 2005 +--- src/killall.c.orig Thu Dec 1 22:32:19 2005 ++++ src/killall.c Thu Jan 5 23:32:33 2006 @@ -59,35 +59,31 @@ quiet = 0, wait_until_dead = 0, process_group = 0, ignore_case = 0, pidof; +/* + * This is the implementation from 21.5, as the one in 21.6 and newer uses + * Linux specific functions getline() and rpmatch() + */ static int ask (char *name, pid_t pid) { - int res; - size_t len; - char *line; - - line = NULL; - len = 0; - - do { - printf (_("Kill %s(%s%d) ? (y/N) "), name, process_group ? "pgid " : "", - pid); - fflush (stdout); - - if (getline (&line, &len, stdin) < 0) - return 0; - /* Check for default */ - if (line[0] == '\n') { - free(line); - return 0; - } - res = rpmatch(line); - if (res >= 0) { - free(line); - return res; + int ch, c; + + do + { + printf (_("Kill %s(%s%d) ? (y/n) "), name, process_group ? "pgid " : "", + pid); + fflush (stdout); + do + if ((ch = getchar ()) == EOF) + exit (0); + while (ch == '\n' || ch == '\t' || ch == ' '); + do + if ((c = getchar ()) == EOF) + exit (0); + while (c != '\n'); } - } while(1); - /* Never should get here */ + while (ch != 'y' && ch != 'n' && ch != 'Y' && ch != 'N'); + return ch == 'y' || ch == 'Y'; } static int @@ -267,7 +263,7 @@ } #endif /*WITH_SELINUX*/ /* load process name */ - if (asprintf (&path, PROC_BASE "/%d/stat", pid_table[i]) < 0) + if (asprintf (&path, PROC_BASE "/%d/status", pid_table[i]) < 0) continue; if (!(file = fopen (path, "r"))) { @@ -275,72 +271,13 @@ continue; } free (path); -- okay = fscanf (file, "%*d (%[^)]", comm) == 1; +- okay = fscanf (file, "%*d (%15[^)]", comm) == 1; + okay = fscanf (file, "%s", comm) == 1; (void) fclose (file); if (!okay) continue; got_long = 0; command = NULL; /* make gcc happy */ length = strlen (comm); - if (length == COMM_LEN - 1) - { - if (asprintf (&path, PROC_BASE "/%d/cmdline", pid_table[i]) < 0) - continue; - if (!(file = fopen (path, "r"))) { - free (path); - continue; - } - free (path); - while (1) { - /* look for actual command so we skip over initial "sh" if any */ - char *p; - int cmd_size = 128; - command_buf = (char *)malloc (cmd_size); - if (!command_buf) - exit (1); - - /* 'cmdline' has arguments separated by nulls */ - for (p=command_buf; ; p++) { - int c; - if (p == (command_buf + cmd_size)) - { - int cur_size = cmd_size; - cmd_size *= 2; - command_buf = (char *)realloc(command_buf, cmd_size); - if (!command_buf) - exit (1); - p = command_buf + cur_size; - } - c = fgetc(file); - if (c == EOF || c == '\0') { - *p = '\0'; - break; - } else { - *p = c; - } - } - if (strlen(command_buf) == 0) { - okay = 0; - break; - } - p = strrchr(command_buf,'/'); - p = p ? p+1 : command_buf; - if (strncmp(p, comm, COMM_LEN-1) == 0) { - okay = 1; - command = p; - break; - } - } - (void) fclose(file); - if (exact && !okay) - { - if (verbose) - fprintf (stderr, _("skipping partial match %s(%d)\n"), comm, - pid_table[i]); - continue; - } - got_long = okay; - } /* mach by process name */ for (j = 0; j < names; j++) { @@ -372,7 +309,7 @@ } else { - if (asprintf (&path, PROC_BASE "/%d/exe", pid_table[i]) < 0) + if (asprintf (&path, PROC_BASE "/%d/file", pid_table[i]) < 0) continue; if (stat (path, &st) < 0) @@ -697,7 +634,7 @@ fprintf (stderr, _("Maximum number of names is %d\n"), MAX_NAMES); exit (1); } - if (stat("/proc/self/stat", &isproc)==-1) + if (stat("/proc/curproc/status", &isproc)==-1) { fprintf (stderr, _("%s is empty (not mounted ?)\n"), PROC_BASE); exit (1); Property changes on: head/sysutils/psmisc/files/patch-src-killall.c ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.3 \ No newline at end of property +1.4 \ No newline at end of property Index: head/sysutils/psmisc/files/patch-src-pstree.c =================================================================== --- head/sysutils/psmisc/files/patch-src-pstree.c (revision 152842) +++ head/sysutils/psmisc/files/patch-src-pstree.c (revision 152843) @@ -1,105 +1,109 @@ ---- src/pstree.c.orig Tue Oct 11 05:18:48 2005 -+++ src/pstree.c Wed Nov 16 17:31:59 2005 +--- src/pstree.c.orig Fri Nov 25 23:14:48 2005 ++++ src/pstree.c Thu Jan 5 23:34:36 2006 @@ -590,7 +590,7 @@ { if (!(path = malloc (strlen (PROC_BASE) + strlen (de->d_name) + 10))) exit (2); - sprintf (path, "%s/%d/stat", PROC_BASE, pid); + sprintf (path, "%s/%d/status", PROC_BASE, pid); if ((file = fopen (path, "r")) != NULL) { empty = 0; -@@ -608,90 +608,10 @@ +@@ -608,95 +608,8 @@ perror (path); exit (1); } - fread(readbuf, BUFSIZ, 1, file) ; - if (ferror(file) == 0) - { - memset(comm, '\0', COMM_LEN+1); - tmpptr = strrchr(readbuf, ')'); /* find last ) */ - /* We now have readbuf with pid and cmd, and tmpptr+2 - * with the rest */ - /*printf("readbuf: %s\n", readbuf);*/ - if (sscanf(readbuf, "%*d (%15[^)]", comm) == 1) - { - /*printf("tmpptr: %s\n", tmpptr+2);*/ - if (sscanf(tmpptr+2, "%*c %d", &ppid) == 1) - { -/* - if (fscanf - (file, "%d (%s) %c %d", &dummy, comm, (char *) &dummy, - &ppid) == 4) - */ - { - DIR *taskdir; - struct dirent *dt; - char *taskpath; - char *threadname; - int thread; - - if (!(taskpath = malloc(strlen(path) + 10))) { - exit (2); - } - sprintf (taskpath, "%s/task", path); - - if ((taskdir=opendir(taskpath))!=0) { - /* if we have this dir, we're on 2.6 */ - if (!(threadname = malloc(strlen(comm) + 3))) { - exit (2); - } - sprintf(threadname,"{%s}",comm); - while ((dt = readdir(taskdir)) != NULL) { - if ((thread=atoi(dt->d_name)) !=0) { - if (thread != pid) { -#ifdef WITH_SELINUX -- add_proc(threadname, thread, pid, st.st_uid, NULL, 0, scontext); +- if (print_args) +- add_proc(threadname, thread, pid, st.st_uid, threadname, strlen(threadname)+1, scontext); +- else +- add_proc(threadname, thread, pid, st.st_uid, NULL, 0, scontext); -#else /*WITH_SELINUX*/ -- add_proc(threadname, thread, pid, st.st_uid, NULL, 0); +- if (print_args) +- add_proc(threadname, thread, pid, st.st_uid, threadname, strlen(threadname)+1); +- else +- add_proc(threadname, thread, pid, st.st_uid, NULL, 0); -#endif /*WITH_SELINUX*/ - } - } - } - free(threadname); - (void) closedir(taskdir); - } - free(taskpath); - } - - if (!print_args) -#ifdef WITH_SELINUX - add_proc(comm, pid, ppid, st.st_uid, NULL, 0, scontext); -#else /*WITH_SELINUX*/ - add_proc (comm, pid, ppid, st.st_uid, NULL, 0); -#endif /*WITH_SELINUX*/ - else - { - sprintf (path, "%s/%d/cmdline", PROC_BASE, pid); - if ((fd = open (path, O_RDONLY)) < 0) - { - perror (path); - exit (1); - } - if ((size = read (fd, buffer, (size_t) output_width)) < 0) - { - perror (path); - exit (1); - } - (void) close (fd); - if (size) - buffer[size++] = 0; -#ifdef WITH_SELINUX - add_proc(comm, pid, ppid, st.st_uid, buffer, size, scontext); -#else /*WITH_SELINUX*/ - add_proc (comm, pid, ppid, st.st_uid, buffer, size); -#endif /*WITH_SELINUX*/ - } - } - } + if (fscanf(file, "%s %*d %d", comm, &ppid) == 2) { + add_proc(comm,pid,ppid,st.st_uid,NULL,0); } -+ (void) fclose (file); } - free (path); Property changes on: head/sysutils/psmisc/files/patch-src-pstree.c ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.2 \ No newline at end of property +1.3 \ No newline at end of property