| 1 | /* $Id: kHlpBareProcess.c 3573 2007-08-31 04:09:23Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | * kHlpBare - Process Management
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | /*
|
|---|
| 7 | * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of kStuff.
|
|---|
| 10 | *
|
|---|
| 11 | * kStuff is free software; you can redistribute it and/or
|
|---|
| 12 | * modify it under the terms of the GNU Lesser General Public
|
|---|
| 13 | * License as published by the Free Software Foundation; either
|
|---|
| 14 | * version 2.1 of the License, or (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * kStuff is distributed in the hope that it will be useful,
|
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 19 | * Lesser General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU Lesser General Public
|
|---|
| 22 | * License along with kStuff; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | /*******************************************************************************
|
|---|
| 28 | * Header Files *
|
|---|
| 29 | *******************************************************************************/
|
|---|
| 30 | #include <k/kHlpProcess.h>
|
|---|
| 31 | #include <k/kHlpAssert.h>
|
|---|
| 32 |
|
|---|
| 33 | #if K_OS == K_OS_OS2
|
|---|
| 34 | # define INCL_BASE
|
|---|
| 35 | # define INCL_ERRORS
|
|---|
| 36 | # include <os2.h>
|
|---|
| 37 | #elif K_OS == K_OS_WINDOWS
|
|---|
| 38 | # include <Windows.h>
|
|---|
| 39 | #else
|
|---|
| 40 | # error "port me"
|
|---|
| 41 | #endif
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | /**
|
|---|
| 45 | * Terminate the process.
|
|---|
| 46 | *
|
|---|
| 47 | * @param rc The exit status.
|
|---|
| 48 | */
|
|---|
| 49 | void kHlpExit(int rc)
|
|---|
| 50 | {
|
|---|
| 51 | for (;;)
|
|---|
| 52 | {
|
|---|
| 53 | #if K_OS == K_OS_OS2
|
|---|
| 54 | DosExit(EXIT_PROCESS, rc);
|
|---|
| 55 |
|
|---|
| 56 | #elif K_OS == K_OS_WINDOWS
|
|---|
| 57 | TerminateProcess(GetCurrentProcess(), rc);
|
|---|
| 58 |
|
|---|
| 59 | #else
|
|---|
| 60 | # error "Port me"
|
|---|
| 61 | #endif
|
|---|
| 62 | kHlpAssert(!"Impossible");
|
|---|
| 63 | }
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|