[Libreoffice-commits] .: sal/prj sal/systools

Jesús Corrius jcorrius at kemper.freedesktop.org
Wed Dec 8 11:30:22 PST 2010


 sal/prj/build.lst                   |    3 
 sal/prj/d.lst                       |    1 
 sal/systools/win32/kill/kill.cxx    |  393 ------------------------------------
 sal/systools/win32/kill/makefile.mk |   64 -----
 4 files changed, 1 insertion(+), 460 deletions(-)

New commits:
commit 8eece270e084718f8eae96494872aee61dce9eab
Author: Jesús Corrius <jesus at softcatala.org>
Date:   Wed Dec 8 20:29:21 2010 +0100

    Remove obsolete Windows kill utility

diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index 638252a..cafca8a 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -6,14 +6,13 @@ sa	sal\cpprt								nmake	-	u	sa_cpprt sa_util sa_inc NULL
 sa	sal\rtl\source							nmake	-	all	sa_rtl sa_tc.u sa_inc NULL
 sa	sal\textenc								nmake	-	all	sa_textenc sa_tc.u sa_inc NULL
 sa	sal\systools\win32\uwinapi				nmake	-	n	sa_uwinapi sa_inc NULL
-sa	sal\systools\win32\kill					nmake	-	n	sa_kill sa_uwinapi.n sa_inc NULL
 sa	sal\systools\win32\onlineupdate			nmake	-	n	sa_onlineupdate sa_uwinapi.n sa_inc NULL
 sa	sal\osl\w32								nmake	-	n	sa_osln sa_inc NULL
 sa	sal\osl\os2								nmake	-	p	sa_oslp sa_inc NULL
 sa  sal\qa                                  nmake   -   all sa_qa sa_util NULL
 sa	sal\osl\unx								nmake	-	u	sa_oslu sa_tc.u sa_inc NULL
 sa	sal\osl\all								nmake	-	all	sa_oslall sa_tc.u sa_inc NULL
-sa	sal\util								nmake	-	all	sa_util sa_tc.u sa_oslall sa_uwinapi.n sa_kill.n sa_onlineupdate.n sa_osln.n sa_oslp.p sa_oslu.u sa_rtl sa_textenc NULL
+sa	sal\util								nmake	-	all	sa_util sa_tc.u sa_oslall sa_uwinapi.n sa_onlineupdate.n sa_osln.n sa_oslp.p sa_oslu.u sa_rtl sa_textenc NULL
 sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL
 sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL
 sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL
diff --git a/sal/prj/d.lst b/sal/prj/d.lst
index d73af4a..3639f86 100644
--- a/sal/prj/d.lst
+++ b/sal/prj/d.lst
@@ -23,7 +23,6 @@ symlink: %_DEST%\lib%_EXT%\libuno_sal.dylib.3 %_DEST%\lib%_EXT%\libuno_sal.dylib
 
 ..\%__SRC%\slb\sal.lib %_DEST%\lib%_EXT%\xsal.lib
 
-..\%__SRC%\bin\kill.exe %_DEST%\bin%_EXT%\kill.exe
 ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
 ..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT%\*.lib
 ..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
diff --git a/sal/systools/win32/kill/kill.cxx b/sal/systools/win32/kill/kill.cxx
deleted file mode 100644
index 9740e8c..0000000
--- a/sal/systools/win32/kill/kill.cxx
+++ /dev/null
@@ -1,393 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <tchar.h>
-
-#ifdef _MSC_VER
-#pragma warning(push,1) // disable warnings within system headers
-#endif
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <tlhelp32.h>
-#include <psapi.h>
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#include <signal.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sal/macros.h>
-
-#ifndef SIGNULL
-#define SIGNULL	0
-#endif
-
-#ifndef SIGKILL
-#define SIGKILL	9
-#endif
-
-#include <signal.h>
-
-#define MAX_MODULES	1024
-
-/////////////////////////////////////////////////////////////////////////////
-// Determines if a returned handle value is valid
-/////////////////////////////////////////////////////////////////////////////
-
-static inline bool IsValidHandle( HANDLE handle )
-{
-    return INVALID_HANDLE_VALUE != handle && NULL != handle;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Retrieves function adress in another process
-/////////////////////////////////////////////////////////////////////////////
-
-#define GetProcAddressEx( hProcess, hModule, lpProcName ) GetProcAddress( hModule, lpProcName )
-
-/////////////////////////////////////////////////////////////////////////////
-// Raises a signal in an other process
-/////////////////////////////////////////////////////////////////////////////
-
-static DWORD SignalToExceptionCode( int signal )
-{
-    switch ( signal )
-    {
-    case SIGSEGV:
-        return EXCEPTION_ACCESS_VIOLATION;
-    case SIGFPE:
-        return EXCEPTION_FLT_INVALID_OPERATION;
-    case SIGILL:
-        return EXCEPTION_ILLEGAL_INSTRUCTION;
-    case SIGINT:
-        return CONTROL_C_EXIT;
-    case SIGBREAK:
-        return CONTROL_C_EXIT;
-    default:
-        return 0;
-    }
-}
-
-static BOOL RaiseSignalEx( HANDLE hProcess, int sig )
-{
-    DWORD	dwProcessId = GetProcessId( hProcess );
-
-    HANDLE	hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
-    HANDLE	hThread = 0;
-    BOOL fSuccess = FALSE;
-
-    if ( IsValidHandle(hSnapshot) )
-    {
-        THREADENTRY32	te;
-
-        te.dwSize = sizeof(te);
-        fSuccess = Thread32First( hSnapshot, &te );
-        while ( fSuccess )
-        {
-            if ( te.th32OwnerProcessID == dwProcessId )
-            {
-                hThread = OpenThread( 
-                    THREAD_SUSPEND_RESUME | THREAD_QUERY_INFORMATION |
-                    THREAD_GET_CONTEXT | THREAD_SET_CONTEXT,
-                    FALSE, te.th32ThreadID );
-                if ( IsValidHandle(hThread) )
-                    break;
-            }
-
-            fSuccess = Thread32Next( hSnapshot, &te );
-        }
-
-        CloseHandle( hSnapshot );
-    }
-
-    if ( fSuccess )
-    {
-        CONTEXT	aContext;
-
-        if ( SuspendThread( hThread ) != (DWORD)-1 )
-        {
-            ZeroMemory( &aContext, sizeof(aContext) );
-            aContext.ContextFlags = CONTEXT_FULL;
-            
-            fSuccess = GetThreadContext( hThread, &aContext );
-
-            if ( fSuccess )
-            {
-                if ( sig )
-                {
-                    DWORD	dwStackBuffer[] =
-                    {
-                        aContext.Eip,
-                        SignalToExceptionCode( sig ),
-                        EXCEPTION_NONCONTINUABLE,
-                        0,
-                        0
-                    };
-
-                    aContext.Esp -= sizeof(dwStackBuffer);
-                    WriteProcessMemory( hProcess, (LPVOID)aContext.Esp, dwStackBuffer, sizeof(dwStackBuffer), NULL );
-                    aContext.Eip = (DWORD)GetProcAddressEx( hProcess, GetModuleHandleA("KERNEL32"), "RaiseException" );
-                }
-                else
-                {
-                    aContext.Ecx = aContext.Eax = aContext.Ebx = aContext.Edx = aContext.Esi = aContext.Edi = 0;
-                }
-
-                fSuccess = SetThreadContext( hThread, &aContext );
-            }
-
-            fSuccess = ResumeThread( hThread ) && fSuccess;
-
-            DWORD	dwLastError = GetLastError();
-            CloseHandle( hThread );
-            SetLastError( dwLastError );
-
-            return fSuccess;
-        }
-    }
-
-    return FALSE;
-}
-/////////////////////////////////////////////////////////////////////////////
-// Command line parameter parsing
-/////////////////////////////////////////////////////////////////////////////
-
-static void ParseCommandArgs( LPDWORD lpProcesses, LPDWORD lpdwNumProcesses, int *pSig )
-{
-    typedef struct _SignalEntry
-    {
-        LPCTSTR lpSignalName;
-        int iSignalValue;
-    } SignalEntry;
-
-    #define SIG_ENTRY( signal ) { TEXT(#signal), SIG##signal }
-
-    static SignalEntry SupportedSignals[] =
-    {
-        SIG_ENTRY( NULL ),
-        SIG_ENTRY( SEGV ),
-        SIG_ENTRY( ILL ),
-        SIG_ENTRY( FPE ),
-        SIG_ENTRY( INT ),
-        SIG_ENTRY( BREAK ),
-        SIG_ENTRY( TERM ),
-        SIG_ENTRY( ABRT ),
-        SIG_ENTRY( KILL )
-    };
-
-    const int NumSupportedSignals = SAL_N_ELEMENTS(SupportedSignals);
-
-    DWORD	dwMaxProcesses = *lpdwNumProcesses;
-    int		argc = __argc;
-    TCHAR	**argv = __targv;
-
-    *lpdwNumProcesses = 0;
-
-    for ( int argn = 1; argn < argc; argn++ )
-    {
-        if ( 0 == lstrcmpi( argv[argn], TEXT("-l") ) ||
-             0 == lstrcmpi( argv[argn], TEXT("/l") ) )
-
-        {
-            for ( int n = 0; n < NumSupportedSignals; n++ )
-            {
-                _tprintf( _T("%s "), SupportedSignals[n] );
-            }
-            _tprintf( _T("\n") );
-            ExitProcess( 0 );
-        }
-        else if ( 0 == lstrcmpi( argv[argn], TEXT("-?") ) ||
-                  0 == lstrcmpi( argv[argn], TEXT("/?") ) ||
-                  0 == lstrcmpi( argv[argn], TEXT("-h") ) ||
-                  0 == lstrcmpi( argv[argn], TEXT("/h") ) ||
-                  0 == lstrcmpi( argv[argn], TEXT("--help") ) )
-        {
-            _tprintf(  
-                _T("Terminates a process by sending a signal.\n\n")
-                _T("Usage: kill [ -l ] [ -signal ] pid ...\n\n")
-                _T("-l        Lists supported signals\n")
-                _T("-signal   Sends the specified signal to the given processes.\n")
-                _T("          signal can be a numeric value specifying the signal number\n")
-                _T("          or a string listed by the -l parameter. If no signal is\n")
-                _T("          given SIGTERM (-TERM) is used.\n")
-                _T("pid       Process id(s) or executables names(s) of processes to \n")
-                _T("          signal or terminate.\n\n")
-                );
-            ExitProcess( 0 );
-        }
-        else if ( argv[argn] && ( *argv[argn] == '-' || *argv[argn] == '/' ) )
-        {
-            LPCTSTR	argsig = CharNext( argv[argn] );
-
-            int	n;
-            for ( n = 0; n < NumSupportedSignals; n++ )
-            {
-                _TCHAR *endptr = NULL;
-
-                if ( 0 == lstrcmpi( SupportedSignals[n].lpSignalName, argsig ) || 
-                     _tcstoul( argsig, &endptr, 0 ) == static_cast< unsigned >(SupportedSignals[n].iSignalValue) && (!endptr || !*endptr) )
-                {
-                    *pSig = SupportedSignals[n].iSignalValue;
-                    break;
-                }
-            }
-
-            if ( n >= NumSupportedSignals )
-            {
-                _ftprintf( stderr,  
-                    _T("kill: Illegal argument %s\n")
-                    _T("Type 'kill --help' to show allowed syntax.\n") 
-                    _T("Type 'kill -l' to show supported signals.\n"), 
-                    argv[argn] );
-                ExitProcess( 0 );
-            }
-        }
-        else
-        {
-            unsigned long value = 0;
-            _TCHAR	*endptr = NULL;
-            
-            value = _tcstoul( argv[argn], &endptr, 0 );
-
-            if ( !endptr || !*endptr ) 
-            {
-                if ( *lpdwNumProcesses < dwMaxProcesses )
-                {
-                    *(lpProcesses++) = value;
-                    (*lpdwNumProcesses)++;
-                }
-            }
-            else
-            {
-                HANDLE	hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
-
-                if ( IsValidHandle( hSnapshot ) )
-                {
-                    PROCESSENTRY32	pe;
-
-                    pe.dwSize = sizeof(pe);
-                    BOOL fSuccess = Process32First( hSnapshot, &pe );
-
-                    while ( fSuccess )
-                    {
-                        if ( 0 == lstrcmpi( argv[argn], pe.szExeFile ) )
-                        {
-                            if ( *lpdwNumProcesses < dwMaxProcesses )
-                            {
-                                *(lpProcesses++) = pe.th32ProcessID;
-                                (*lpdwNumProcesses)++;
-                            }
-                        }
-                        fSuccess = Process32Next( hSnapshot, &pe );
-                    }
-
-                    CloseHandle( hSnapshot );
-                }
-            }
-        }
-    }
-
-    if ( !*lpdwNumProcesses )
-    {
-        _ftprintf( stderr, 
-            _T("kill: No process specified.\n")
-            _T("Use kill --help to show allowed syntax.\n") 
-            );
-        ExitProcess( 0 );
-    }
-
-}
-
-void OutputSystemMessage( DWORD dwErrorCode )
-{
-    LPVOID lpMsgBuf;
-    FormatMessageA(
-                    FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                    FORMAT_MESSAGE_FROM_SYSTEM |
-                    FORMAT_MESSAGE_IGNORE_INSERTS,
-                    NULL,
-                    dwErrorCode,
-                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
-                    (LPSTR)&lpMsgBuf,
-                    0,
-                    NULL
-                );
-
-    printf( (LPSTR)lpMsgBuf );
-    LocalFree( lpMsgBuf );
-}
-
-int _tmain()
-{
-    DWORD	dwProcessIds[1024];
-    DWORD	nProcesses = SAL_N_ELEMENTS(dwProcessIds);
-    int		sig = SIGTERM;
-
-
-    ParseCommandArgs( dwProcessIds, &nProcesses, &sig );
-
-    for ( ULONG n = 0; n < nProcesses; n++ )
-    {
-        HANDLE	hProcess;
-
-        _tprintf( _T("Sending signal to process id %d..."), dwProcessIds[n] );
-        hProcess = OpenProcess( PROCESS_TERMINATE | PROCESS_CREATE_THREAD | SYNCHRONIZE |
-            PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ,
-            FALSE, dwProcessIds[n] );
-
-        if ( IsValidHandle( hProcess ) )
-        {
-            if ( SIGKILL == sig )
-                TerminateProcess( hProcess, 255 );
-            else
-            {
-                if ( RaiseSignalEx( hProcess, sig ) )
-                    _tprintf( _T("OK\n") );
-                else
-                {
-                    OutputSystemMessage( GetLastError() );
-                }
-            }
-
-            CloseHandle( hProcess );
-        }
-        else
-        {
-            OutputSystemMessage( GetLastError() );
-        }
-    }
-
-    return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/systools/win32/kill/makefile.mk b/sal/systools/win32/kill/makefile.mk
deleted file mode 100644
index 3bb961b..0000000
--- a/sal/systools/win32/kill/makefile.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org 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 Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org.  If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=kill
-LIBTARGET=NO
-DYNAMIC_CRT=
-ENABLE_EXCEPTIONS=TRUE
-TARGETTYPE=CUI
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE :  settings.mk
-
-.IF "$(COM)"=="GCC"
-CDEFS=-D_WIN32_WINNT=0x0501
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-# --- Files --------------------------------------------------------
-
-UWINAPILIB=
-
-OBJFILES=\
-    $(OBJ)$/kill.obj
-    
-APP1NOSAL=TRUE
-APP1OBJS=$(OBJFILES)
-APP1TARGET=$(TARGET)
-
-STDLIB1=
-
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE :	target.mk


More information about the Libreoffice-commits mailing list