Hello community,
here is the log from the commit of package perl-Proc-ProcessTable for
openSUSE:Factory checked in at 2019-02-25 17:50:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Proc-ProcessTable (Old)
and /work/SRC/openSUSE:Factory/.perl-Proc-ProcessTable.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Proc-ProcessTable"
Mon Feb 25 17:50:58 2019 rev:12 rq:672857 version:0.56
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Proc-ProcessTable/perl-Proc-ProcessTable.changes
2018-02-09 15:47:13.916067969 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Proc-ProcessTable.new.28833/perl-Proc-ProcessTable.changes
2019-02-25 17:51:01.122764190 +0100
@@ -1,0 +2,10 @@
+Fri Feb 8 06:24:36 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to 0.56
+ see /usr/share/doc/packages/perl-Proc-ProcessTable/Changes
+
+ 0.56 2019-02-07
+ * Testing support for mswin32
+ * minor fix for FreeBSD
+
+-------------------------------------------------------------------
Old:
----
Proc-ProcessTable-0.55.tar.gz
New:
----
Proc-ProcessTable-0.56.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Proc-ProcessTable.spec ++++++
--- /var/tmp/diff_new_pack.KUa6sX/_old 2019-02-25 17:51:01.974763726 +0100
+++ /var/tmp/diff_new_pack.KUa6sX/_new 2019-02-25 17:51:01.974763726 +0100
@@ -1,7 +1,7 @@
#
# spec file for package perl-Proc-ProcessTable
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,19 +12,19 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: perl-Proc-ProcessTable
-Version: 0.55
+Version: 0.56
Release: 0
#Upstream: Artistic-1.0 or GPL-1.0+
%define cpan_name Proc-ProcessTable
Summary: Perl extension to access the unix process table
-License: (Artistic-1.0 or GPL-1.0+) and GPL-2.0
+License: (Artistic-1.0 OR GPL-1.0-or-later) AND GPL-2.0-only
Group: Development/Libraries/Perl
-Url: http://search.cpan.org/dist/Proc-ProcessTable/
+Url: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/J/JW/JWB/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -40,11 +40,11 @@
find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644
%build
-%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
-%{__make} %{?_smp_mflags}
+perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
+make %{?_smp_mflags}
%check
-%{__make} test
+make test
%install
%perl_make_install
++++++ Proc-ProcessTable-0.55.tar.gz -> Proc-ProcessTable-0.56.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/Changes
new/Proc-ProcessTable-0.56/Changes
--- old/Proc-ProcessTable-0.55/Changes 2017-02-21 01:03:40.000000000 +0100
+++ new/Proc-ProcessTable-0.56/Changes 2019-02-07 23:33:58.000000000 +0100
@@ -334,3 +334,6 @@
* Fixed bug in Linux occurring if process name is empty (RT#106571)
* Added missing includes on AIX (RT#39748)
* Some minor changes on tests and documentation
+0.56 2019-02-07
+ * Testing support for mswin32
+ * minor fix for FreeBSD
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/MANIFEST
new/Proc-ProcessTable-0.56/MANIFEST
--- old/Proc-ProcessTable-0.55/MANIFEST 2018-02-01 23:02:42.000000000 +0100
+++ new/Proc-ProcessTable-0.56/MANIFEST 2019-02-07 23:34:06.000000000 +0100
@@ -18,7 +18,6 @@
README.hpux
README.cygwin
PORTING
-TODO
example.pl
Process/Makefile.PL
Process/Process.pm
@@ -60,8 +59,8 @@
os/NetBSD.c
os/NetBSD.h
os/OpenBSD.c
-os/cygwin.c
-os/cygwin.h
+os/MSWin32.c
+os/MSWin32.h
t/process.t
hints/svr4.pl
hints/svr5.pl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/META.json
new/Proc-ProcessTable-0.56/META.json
--- old/Proc-ProcessTable-0.55/META.json 2018-02-01 23:02:41.000000000
+0100
+++ new/Proc-ProcessTable-0.56/META.json 2019-02-07 23:34:06.000000000
+0100
@@ -4,13 +4,13 @@
"Jonathan Swartz <[email protected]>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter
version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter
version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Proc-ProcessTable",
"no_index" : {
@@ -43,6 +43,6 @@
"url" : "https://github.com/jwbargsten/perl-proc-processtable"
}
},
- "version" : "0.55",
- "x_serialization_backend" : "JSON::PP version 2.27400_02"
+ "version" : "0.56",
+ "x_serialization_backend" : "JSON::PP version 2.97001"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/META.yml
new/Proc-ProcessTable-0.56/META.yml
--- old/Proc-ProcessTable-0.55/META.yml 2018-02-01 23:02:41.000000000 +0100
+++ new/Proc-ProcessTable-0.56/META.yml 2019-02-07 23:34:06.000000000 +0100
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version
2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -22,5 +22,5 @@
Storable: '0'
resources:
repository: https://github.com/jwbargsten/perl-proc-processtable
-version: '0.55'
+version: '0.56'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/ProcessTable.pm
new/Proc-ProcessTable-0.56/ProcessTable.pm
--- old/Proc-ProcessTable-0.55/ProcessTable.pm 2018-02-01 23:02:07.000000000
+0100
+++ new/Proc-ProcessTable-0.56/ProcessTable.pm 2019-02-07 23:32:07.000000000
+0100
@@ -18,7 +18,7 @@
@EXPORT = qw(
);
-$VERSION = '0.55';
+$VERSION = '0.56';
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/README
new/Proc-ProcessTable-0.56/README
--- old/Proc-ProcessTable-0.55/README 2017-02-21 01:03:40.000000000 +0100
+++ new/Proc-ProcessTable-0.56/README 2019-02-07 23:32:07.000000000 +0100
@@ -19,7 +19,7 @@
======
This is BETA software; it seems to work, but use at your own risk :)
-Currently works on darwin, nonstop-ux, Cygwin on Windows, linux,
+Currently works on darwin, nonstop-ux, Windows (both native MSWin32 and
Cygwin), linux,
solaris, aix, hpux, freebsd, irix, dec_osf, bsdi, netbsd, unixware 7.x,
SunOS and openbsd. Please see the "README.osname" files for details on
individual os implementations. Please see the file PORTING if you are
@@ -27,9 +27,7 @@
TODO for a list of issues that need to be addressed (and send me
patches!).
-Please note that the Cygwin/windows port requires the Cygwin
-environment to work (available from http://cygwin.com/), and that the
-code for the port is derived from Cygwin code and is therefore covered
+Please note that the Windows port is derived from Cygwin code and is therefore
covered
by the Cygwin license (http://cygwin.com/licensing.html).
Multithread support is now available for Solaris; please see
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/hints/cygwin.pl
new/Proc-ProcessTable-0.56/hints/cygwin.pl
--- old/Proc-ProcessTable-0.55/hints/cygwin.pl 2017-02-20 19:38:46.000000000
+0100
+++ new/Proc-ProcessTable-0.56/hints/cygwin.pl 2019-02-07 23:32:07.000000000
+0100
@@ -1 +1,3 @@
-symlink "os/cygwin.c", "OS.c" || die "Could not link os/cygwin.c to os/OS.c\n";
+symlink "os/MSWin32.c", "OS.c" || die "Could not link os/MSWin32.c to OS.c\n";
+
+$self->{DEFINE} .= " -DUSE_CYGWIN";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/os/FreeBSD-kvm.h
new/Proc-ProcessTable-0.56/os/FreeBSD-kvm.h
--- old/Proc-ProcessTable-0.55/os/FreeBSD-kvm.h 2018-01-27 09:27:42.000000000
+0100
+++ new/Proc-ProcessTable-0.56/os/FreeBSD-kvm.h 2019-02-07 23:32:07.000000000
+0100
@@ -13,7 +13,7 @@
/* We need to pass in a cap for ignore, lower for store on object */
/* We can just lc these! */
-static char Defaultformat[] = "iiiiiiiisssssssssssssissiiiiiiiiiiiiiiVV";
+static char Defaultformat[] = "iiiiiiiisssssssssssssissiiiuiiiiiiiiiiVV";
/* Mapping of field to type */
static char* Fields[] = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/os/MSWin32.c
new/Proc-ProcessTable-0.56/os/MSWin32.c
--- old/Proc-ProcessTable-0.55/os/MSWin32.c 1970-01-01 01:00:00.000000000
+0100
+++ new/Proc-ProcessTable-0.56/os/MSWin32.c 2019-02-07 23:32:07.000000000
+0100
@@ -0,0 +1,396 @@
+/*
+
+ Adapted from ps.cc by J Robert Ray <[email protected]>
+
+
+ ps.cc
+
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include <stdio.h>
+#include <windows.h>
+#include <time.h>
+#include <stdlib.h>
+#include <tlhelp32.h>
+#include <psapi.h>
+
+#ifdef USE_CYGWIN
+#include <getopt.h>
+#include <unistd.h>
+#include <pwd.h>
+#include <sys/cygwin.h>
+#else
+#include <sddl.h>
+#endif
+
+#include "os/MSWin32.h"
+
+
+#ifdef USE_CYGWIN
+typedef DWORD (WINAPI *GETMODULEFILENAME)(
+ HANDLE hProcess,
+ HMODULE hModule,
+ LPTSTR lpstrFileName,
+ DWORD nSize
+);
+#endif
+
+typedef HANDLE (WINAPI *CREATESNAPSHOT)(
+ DWORD dwFlags,
+ DWORD th32ProcessID
+);
+
+typedef BOOL (WINAPI *PROCESSWALK)(
+ HANDLE hSnapshot,
+ LPPROCESSENTRY32 lppe
+);
+
+#ifdef USE_CYGWIN
+typedef struct external_pinfo external_pinfo;
+
+GETMODULEFILENAME myGetModuleFileNameEx;
+#endif
+
+CREATESNAPSHOT myCreateToolhelp32Snapshot;
+PROCESSWALK myProcess32First;
+PROCESSWALK myProcess32Next;
+
+static int init_win_result = FALSE;
+
+extern void bless_into_proc(char* , char**, ...);
+
+#ifdef USE_CYGWIN
+// Win95 functions
+static DWORD WINAPI GetModuleFileNameEx95 (
+ HANDLE hProcess,
+ HMODULE hModule,
+ LPTSTR lpstrFileName,
+ DWORD n
+)
+{
+ HANDLE h;
+ DWORD pid = (DWORD) hModule;
+ PROCESSENTRY32 proc;
+
+ h = myCreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
+ if (!h)
+ return 0;
+
+ proc.dwSize = sizeof (proc);
+ if (myProcess32First(h, &proc))
+ do
+ if (proc.th32ProcessID == pid)
+ {
+ CloseHandle (h);
+ strcpy (lpstrFileName, proc.szExeFile);
+ return 1;
+ }
+ while (myProcess32Next (h, &proc));
+ CloseHandle (h);
+ return 0;
+}
+#endif
+
+int
+init_win ()
+{
+ HMODULE h;
+
+#ifdef USE_CYGWIN
+ OSVERSIONINFO os_version_info;
+
+ memset (&os_version_info, 0, sizeof os_version_info);
+ os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+ GetVersionEx (&os_version_info);
+
+ if (os_version_info.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ {
+ h = LoadLibrary ("psapi.dll");
+ if (!h)
+ return 0;
+ myGetModuleFileNameEx = (GETMODULEFILENAME) GetProcAddress (h,
"GetModuleFileNameExA");
+ if (!myGetModuleFileNameEx)
+ return 0;
+ return 1;
+ }
+#endif
+
+ h = GetModuleHandle("KERNEL32.DLL");
+ myCreateToolhelp32Snapshot = (CREATESNAPSHOT)GetProcAddress (h,
"CreateToolhelp32Snapshot");
+ myProcess32First = (PROCESSWALK)GetProcAddress (h, "Process32First");
+ myProcess32Next = (PROCESSWALK)GetProcAddress (h, "Process32Next");
+ if (!myCreateToolhelp32Snapshot || !myProcess32First || !myProcess32Next)
+ return 0;
+
+#ifdef USE_CYGWIN
+ myGetModuleFileNameEx = GetModuleFileNameEx95;
+#endif
+ return 1;
+}
+
+#define FACTOR (0x19db1ded53ea710LL)
+#define NSPERSEC 10000000LL
+
+/* Convert a Win32 time to "UNIX" format. */
+static long
+to_time_t (FILETIME *ptr)
+{
+ /* A file time is the number of 100ns since jan 1 1601
+ stuffed into two long words.
+ A time_t is the number of seconds since jan 1 1970. */
+
+ long rem;
+ long long x = ((long long) ptr->dwHighDateTime << 32) +
((unsigned)ptr->dwLowDateTime);
+ x -= FACTOR; /* number of 100ns between 1601 and 1970 */
+ rem = x % ((long long)NSPERSEC);
+ rem += (NSPERSEC / 2);
+ x /= (long long) NSPERSEC; /* number of 100ns in a second */
+ x += (long long) (rem / NSPERSEC);
+ return x;
+}
+
+#ifdef USE_CYGWIN
+
+void
+OS_get_table()
+{
+ external_pinfo *p;
+ int uid;
+ cygwin_getinfo_types query = CW_GETPINFO;
+ char ch;
+ int pid;
+ char *pstate;
+ char pname[MAX_PATH];
+ char uname[128];
+ char *fields;
+
+ uid = getuid ();
+
+ (void) cygwin_internal (CW_LOCK_PINFO, 1000);
+
+ if (query == CW_GETPINFO && !init_win_result)
+ query = CW_GETPINFO;
+
+ for (pid = 0;
+ (p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID));
+ pid = p->pid)
+ {
+ pstate = " ";
+ if (p->process_state & PID_STOPPED)
+ pstate = "stopped";
+ else if (p->process_state & PID_TTYIN)
+ pstate = "ttyin";
+ else if (p->process_state & PID_TTYOU)
+ pstate = "ttyout";
+#ifdef PID_ORPHANED
+ if (p->process_state & (PID_ORPHANED | PID_EXITED))
+#else
+ if (p->process_state & PID_EXITED)
+#endif
+ strcpy (pname, "<defunct>");
+ else if (p->ppid)
+ {
+ char *s;
+ pname[0] = '\0';
+ cygwin_conv_path((CCP_RELATIVE|CCP_WIN_A_TO_POSIX), p->progname,
pname, PATH_MAX);
+ s = strchr (pname, '\0') - 4;
+ if (s > pname && strcasecmp (s, ".exe") == 0)
+ *s = '\0';
+ }
+ else if (query == CW_GETPINFO)
+ {
+ FILETIME ct, et, kt, ut;
+ HANDLE h = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ FALSE, p->dwProcessId);
+ if (!h)
+ continue;
+ if (!myGetModuleFileNameEx (h, myProcess32First ? p->dwProcessId :
NULL, pname, MAX_PATH))
+ strcpy (pname, "*** unknown ***");
+ if (GetProcessTimes (h, &ct, &et, &kt, &ut))
+ p->start_time = to_time_t (&ct);
+ CloseHandle (h);
+ }
+
+ {
+ struct passwd *pw;
+
+ if ((pw = getpwuid (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
+ p->uid32 : p->uid)))
+ strcpy (uname, pw->pw_name);
+ else
+ sprintf (uname, "%u", (unsigned)
+ (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
+ p->uid32 : p->uid));
+ }
+
+ if (query == CW_GETPINFO) {
+ fields = "iiiiisiis";
+ } else {
+ fields = "iiiiisIis";
+ }
+
+ bless_into_proc(fields, Fields,
+
+ p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? p->uid32 : p->uid,
+ p->pid,
+ p->ppid,
+ p->pgid,
+ p->dwProcessId,
+ pname,
+ p->start_time,
+ p->ctty,
+ pstate
+ );
+
+ }
+ (void) cygwin_internal (CW_UNLOCK_PINFO);
+}
+
+#else
+
+static void get_process_owner(HANDLE process, char string_sid[184], char
user_name[256], char domain_name[255])
+{
+ HANDLE process_token;
+ PTOKEN_USER token_user;
+ DWORD token_user_size;
+ char *string_sid_ptr;
+ size_t string_sid_len;
+ DWORD user_name_size;
+ DWORD domain_name_size;
+ SID_NAME_USE sid_type;
+
+ string_sid[0] = 0;
+ user_name[0] = 0;
+ domain_name[0] = 0;
+
+ if (!OpenProcessToken (process, TOKEN_QUERY, &process_token))
+ return;
+
+ if (!GetTokenInformation (process_token, TokenUser, NULL, 0,
&token_user_size) && GetLastError () != ERROR_INSUFFICIENT_BUFFER)
+ {
+ CloseHandle (process_token);
+ return;
+ }
+
+ token_user = malloc (token_user_size);
+ if (!token_user)
+ {
+ CloseHandle (process_token);
+ return;
+ }
+
+ if (!GetTokenInformation (process_token, TokenUser, token_user,
token_user_size, &token_user_size))
+ {
+ free (token_user);
+ CloseHandle (process_token);
+ return;
+ }
+
+ if (ConvertSidToStringSidA (token_user->User.Sid, &string_sid_ptr))
+ {
+ string_sid_len = strlen (string_sid_ptr);
+ if (string_sid_len < 184)
+ memcpy (string_sid, string_sid_ptr, string_sid_len+1);
+ LocalFree (string_sid_ptr);
+ }
+
+ user_name_size = 256;
+ domain_name_size = 256;
+ if (!LookupAccountSidA (NULL, token_user->User.Sid, user_name,
&user_name_size, domain_name, &domain_name_size, &sid_type) && GetLastError ()
== ERROR_NONE_MAPPED)
+ {
+ strcpy (user_name, "NONE_MAPPED");
+ strcpy (domain_name, "NONE_MAPPED");
+ }
+
+ free (token_user);
+ CloseHandle (process_token);
+}
+
+static unsigned long get_uid_from_string_sid(char *string_sid)
+{
+ char *uid_ptr;
+ char *ptr;
+
+ uid_ptr = strrchr (string_sid, '-');
+ if (!uid_ptr)
+ return 0;
+
+ uid_ptr++;
+
+ for (ptr = uid_ptr; *ptr; ptr++)
+ if (*ptr < '0' || *ptr > '9')
+ return 0;
+
+ return strtoul (uid_ptr, NULL, 10);
+}
+
+void
+OS_get_table()
+{
+ HANDLE proc;
+ HANDLE snapshot;
+ PROCESSENTRY32 proc_entry;
+ FILETIME ct, et, kt, ut;
+ char string_sid[184];
+ char user_name[256];
+ char domain_name[256];
+ unsigned long uid;
+ long start_time;
+
+ if (!init_win_result)
+ return;
+
+ snapshot = myCreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
+ if (!snapshot)
+ return;
+
+ proc_entry.dwSize = sizeof (proc_entry);
+ if (myProcess32First (snapshot, &proc_entry))
+ do
+ {
+ uid = 0;
+ start_time = 0;
+
+ proc = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE,
proc_entry.th32ProcessID);
+ if (proc)
+ {
+ if (GetProcessTimes (proc, &ct, &et, &kt, &ut))
+ start_time = to_time_t (&ct);
+ get_process_owner (proc, string_sid, user_name, domain_name);
+ CloseHandle (proc);
+ }
+
+ uid = get_uid_from_string_sid (string_sid);
+
+ bless_into_proc ("pppslsss", Fields,
+ uid,
+ proc_entry.th32ProcessID,
+ proc_entry.th32ParentProcessID,
+ proc_entry.szExeFile,
+ start_time,
+ string_sid,
+ user_name,
+ domain_name
+ );
+ }
+ while (myProcess32Next (snapshot, &proc_entry));
+
+ CloseHandle (snapshot);
+}
+
+#endif
+
+char*
+OS_initialize()
+{
+ init_win_result = init_win();
+
+ return NULL;
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/os/MSWin32.h
new/Proc-ProcessTable-0.56/os/MSWin32.h
--- old/Proc-ProcessTable-0.55/os/MSWin32.h 1970-01-01 01:00:00.000000000
+0100
+++ new/Proc-ProcessTable-0.56/os/MSWin32.h 2019-02-07 23:32:07.000000000
+0100
@@ -0,0 +1,21 @@
+static char *Fields[] = {
+ "uid",
+ "pid",
+ "ppid",
+#ifdef USE_CYGWIN
+ "pgid",
+ "winpid",
+#endif
+ "fname",
+ "start",
+#ifdef USE_CYGWIN
+ "ttynum",
+ "state",
+#endif
+
+#ifndef USE_CYGWIN
+ "sid",
+ "user_name",
+ "domain_name",
+#endif
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/os/cygwin.c
new/Proc-ProcessTable-0.56/os/cygwin.c
--- old/Proc-ProcessTable-0.55/os/cygwin.c 2017-02-21 01:03:40.000000000
+0100
+++ new/Proc-ProcessTable-0.56/os/cygwin.c 1970-01-01 01:00:00.000000000
+0100
@@ -1,286 +0,0 @@
-/*
-
- Adapted from ps.cc by J Robert Ray <[email protected]>
-
-
- ps.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <windows.h>
-#include <time.h>
-#include <getopt.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <sys/cygwin.h>
-#include <tlhelp32.h>
-#include <psapi.h>
-
-#include "os/cygwin.h"
-
-typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
- HANDLE hProcess, // handle to the process
- HMODULE * lphModule, // array to receive the module handles
- DWORD cb, // size of the array
- LPDWORD lpcbNeeded // receives the number of bytes returned
-);
-
-typedef DWORD (WINAPI *GETMODULEFILENAME)(
- HANDLE hProcess,
- HMODULE hModule,
- LPTSTR lpstrFileName,
- DWORD nSize
-);
-
-typedef HANDLE (WINAPI *CREATESNAPSHOT)(
- DWORD dwFlags,
- DWORD th32ProcessID
-);
-
-// Win95 functions
-typedef BOOL (WINAPI *PROCESSWALK)(
- HANDLE hSnapshot,
- LPPROCESSENTRY32 lppe
-);
-
-typedef struct external_pinfo external_pinfo;
-
-ENUMPROCESSMODULES myEnumProcessModules;
-GETMODULEFILENAME myGetModuleFileNameEx;
-CREATESNAPSHOT myCreateToolhelp32Snapshot;
-PROCESSWALK myProcess32First;
-PROCESSWALK myProcess32Next;
-
-static int init_win_result = FALSE;
-
-static BOOL WINAPI dummyprocessmodules (
- HANDLE hProcess, // handle to the process
- HMODULE * lphModule, // array to receive the module handles
- DWORD cb, // size of the array
- LPDWORD lpcbNeeded // receives the number of bytes returned
-)
-{
- lphModule[0] = (HMODULE) *lpcbNeeded;
- *lpcbNeeded = 1;
- return 1;
-}
-
-static DWORD WINAPI GetModuleFileNameEx95 (
- HANDLE hProcess,
- HMODULE hModule,
- LPTSTR lpstrFileName,
- DWORD n
-)
-{
- HANDLE h;
- DWORD pid = (DWORD) hModule;
- PROCESSENTRY32 proc;
-
- h = myCreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
- if (!h)
- return 0;
-
- proc.dwSize = sizeof (proc);
- if (myProcess32First(h, &proc))
- do
- if (proc.th32ProcessID == pid)
- {
- CloseHandle (h);
- strcpy (lpstrFileName, proc.szExeFile);
- return 1;
- }
- while (myProcess32Next (h, &proc));
- CloseHandle (h);
- return 0;
-}
-
-int
-init_win ()
-{
- OSVERSIONINFO os_version_info;
- HMODULE h;
-
- memset (&os_version_info, 0, sizeof os_version_info);
- os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (&os_version_info);
-
- if (os_version_info.dwPlatformId == VER_PLATFORM_WIN32_NT)
- {
- h = LoadLibrary ("psapi.dll");
- if (!h)
- return 0;
- myEnumProcessModules = (ENUMPROCESSMODULES) GetProcAddress (h,
"EnumProcessModules");
- myGetModuleFileNameEx = (GETMODULEFILENAME) GetProcAddress (h,
"GetModuleFileNameExA");
- if (!myEnumProcessModules || !myGetModuleFileNameEx)
- return 0;
- return 1;
- }
-
- h = GetModuleHandle("KERNEL32.DLL");
- myCreateToolhelp32Snapshot = (CREATESNAPSHOT)GetProcAddress (h,
"CreateToolhelp32Snapshot");
- myProcess32First = (PROCESSWALK)GetProcAddress (h, "Process32First");
- myProcess32Next = (PROCESSWALK)GetProcAddress (h, "Process32Next");
- if (!myCreateToolhelp32Snapshot || !myProcess32First || !myProcess32Next)
- return 0;
-
- myEnumProcessModules = dummyprocessmodules;
- myGetModuleFileNameEx = GetModuleFileNameEx95;
- return 1;
-}
-
-static char *
-start_time (external_pinfo *child)
-{
- time_t st = child->start_time;
- time_t t = time (NULL);
- static char stime[40] = {'\0'};
- char now[40];
-
- strncpy (stime, ctime (&st) + 4, 15);
- strcpy (now, ctime (&t) + 4);
-
- if ((t - st) < (24 * 3600))
- return (stime + 7);
-
- stime[6] = '\0';
-
- return stime;
-}
-
-#define FACTOR (0x19db1ded53ea710LL)
-#define NSPERSEC 10000000LL
-
-/* Convert a Win32 time to "UNIX" format. */
-long __stdcall
-to_time_t (FILETIME *ptr)
-{
- /* A file time is the number of 100ns since jan 1 1601
- stuffed into two long words.
- A time_t is the number of seconds since jan 1 1970. */
-
- long rem;
- long long x = ((long long) ptr->dwHighDateTime << 32) +
((unsigned)ptr->dwLowDateTime);
- x -= FACTOR; /* number of 100ns between 1601 and 1970 */
- rem = x % ((long long)NSPERSEC);
- rem += (NSPERSEC / 2);
- x /= (long long) NSPERSEC; /* number of 100ns in a second */
- x += (long long) (rem / NSPERSEC);
- return x;
-}
-
-void
-OS_get_table()
-{
- external_pinfo *p;
- int uid;
- cygwin_getinfo_types query = CW_GETPINFO;
- char ch;
- int pid;
- char *pstate;
- char pname[MAX_PATH];
- HMODULE hm[1000];
- char uname[128];
- char *fields;
-
- uid = getuid ();
-
- (void) cygwin_internal (CW_LOCK_PINFO, 1000);
-
- if (query == CW_GETPINFO && !init_win_result)
- query = CW_GETPINFO;
-
- for (pid = 0;
- (p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID));
- pid = p->pid)
- {
- pstate = " ";
- if (p->process_state & PID_STOPPED)
- pstate = "stopped";
- else if (p->process_state & PID_TTYIN)
- pstate = "ttyin";
- else if (p->process_state & PID_TTYOU)
- pstate = "ttyout";
-#ifdef PID_ORPHANED
- if (p->process_state & (PID_ORPHANED | PID_EXITED))
-#else
- if (p->process_state & PID_EXITED)
-#endif
- strcpy (pname, "<defunct>");
- else if (p->ppid)
- {
- char *s;
- pname[0] = '\0';
- cygwin_conv_path((CCP_RELATIVE|CCP_WIN_A_TO_POSIX), p->progname,
pname, PATH_MAX);
- s = strchr (pname, '\0') - 4;
- if (s > pname && strcasecmp (s, ".exe") == 0)
- *s = '\0';
- }
- else if (query == CW_GETPINFO)
- {
- DWORD n;
- FILETIME ct, et, kt, ut;
- HANDLE h = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
- FALSE, p->dwProcessId);
- if (!h)
- continue;
- n = p->dwProcessId;
- if (!myEnumProcessModules (h, hm, sizeof (hm), &n))
- n = 0;
- if (!n || !myGetModuleFileNameEx (h, hm[0], pname, MAX_PATH))
- strcpy (pname, "*** unknown ***");
- if (GetProcessTimes (h, &ct, &et, &kt, &ut))
- p->start_time = to_time_t (&ct);
- CloseHandle (h);
- }
-
- {
- struct passwd *pw;
-
- if ((pw = getpwuid (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
- p->uid32 : p->uid)))
- strcpy (uname, pw->pw_name);
- else
- sprintf (uname, "%u", (unsigned)
- (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
- p->uid32 : p->uid));
- }
-
- if (query == CW_GETPINFO) {
- fields = "iiiiisiis";
- } else {
- fields = "iiiiisIis";
- }
-
- bless_into_proc(fields, Fields,
-
- p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? p->uid32 : p->uid,
- p->pid,
- p->ppid,
- p->pgid,
- p->dwProcessId,
- pname,
- p->start_time,
- p->ctty,
- pstate
- );
-
- }
- (void) cygwin_internal (CW_UNLOCK_PINFO);
-}
-
-char*
-OS_initialize()
-{
- init_win_result = init_win();
-
- return NULL;
-}
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/os/cygwin.h
new/Proc-ProcessTable-0.56/os/cygwin.h
--- old/Proc-ProcessTable-0.55/os/cygwin.h 2017-02-20 19:38:46.000000000
+0100
+++ new/Proc-ProcessTable-0.56/os/cygwin.h 1970-01-01 01:00:00.000000000
+0100
@@ -1,11 +0,0 @@
-static char *Fields[] = {
- "uid",
- "pid",
- "ppid",
- "pgid",
- "winpid",
- "fname",
- "start",
- "ttynum",
- "state",
-};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Proc-ProcessTable-0.55/t/process.t
new/Proc-ProcessTable-0.56/t/process.t
--- old/Proc-ProcessTable-0.55/t/process.t 2017-02-21 01:03:40.000000000
+0100
+++ new/Proc-ProcessTable-0.56/t/process.t 2019-02-07 23:32:07.000000000
+0100
@@ -2,8 +2,8 @@
# `make test'. After `make install' it should work as `perl test.pl'
use strict;
-use Test;
-BEGIN { plan tests => 3 }
+use Test::More;
+use Config;
# check wether ProcProcessTable is there
use Proc::ProcessTable;
@@ -32,6 +32,9 @@
}
+plan skip_all => 'This test needs real fork() implementation' if
$Config{d_pseudofork} || !$Config{d_fork};
+plan tests => 3;
+
# fork a child process
my $child_pid = fork;