source: trunk/kStuff/kHlp/Bare/kHlpBareProcess.c@ 3599

Last change on this file since 3599 was 3599, checked in by bird, 18 years ago

Built on linux.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1/* $Id: kHlpBareProcess.c 3599 2007-10-04 19:09:39Z 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_DARWIN \
34 || K_OS == K_OS_FREEBSD \
35 || K_OS == K_OS_LINUX \
36 || K_OS == K_OS_NETBSD \
37 || K_OS == K_OS_OPENBSD \
38 || K_OS == K_OS_SOLARIS
39# include <k/kHlpSys.h>
40
41#elif K_OS == K_OS_OS2
42# define INCL_BASE
43# define INCL_ERRORS
44# include <os2.h>
45#elif K_OS == K_OS_WINDOWS
46# include <Windows.h>
47#else
48# error "port me"
49#endif
50
51
52/**
53 * Terminate the process.
54 *
55 * @param rc The exit status.
56 */
57void kHlpExit(int rc)
58{
59 for (;;)
60 {
61#if K_OS == K_OS_DARWIN \
62 || K_OS == K_OS_FREEBSD \
63 || K_OS == K_OS_LINUX \
64 || K_OS == K_OS_NETBSD \
65 || K_OS == K_OS_OPENBSD \
66 || K_OS == K_OS_SOLARIS
67 kHlpSys_exit(rc);
68
69#elif K_OS == K_OS_OS2
70 DosExit(EXIT_PROCESS, rc);
71
72#elif K_OS == K_OS_WINDOWS
73 TerminateProcess(GetCurrentProcess(), rc);
74
75#else
76# error "Port me"
77#endif
78 kHlpAssert(!"Impossible");
79 }
80}
81
Note: See TracBrowser for help on using the repository browser.