| 1 | /* $Id: on_exit.c 2254 2005-07-17 12:25:44Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | *
|
|---|
| 4 | * LIBC on_exit().
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 2005 knut st. osmundsen <[email protected]>
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of InnoTek LIBC.
|
|---|
| 10 | *
|
|---|
| 11 | * InnoTek LIBC is free software; you can redistribute it and/or modify
|
|---|
| 12 | * it under the terms of the GNU Lesser General Public License as published
|
|---|
| 13 | * by the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | * (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * InnoTek LIBC 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
|
|---|
| 19 | * GNU Lesser General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU Lesser General Public License
|
|---|
| 22 | * along with InnoTek LIBC; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | /*******************************************************************************
|
|---|
| 29 | * Header Files *
|
|---|
| 30 | *******************************************************************************/
|
|---|
| 31 | #include "libc-alias.h"
|
|---|
| 32 | #include <stdlib.h>
|
|---|
| 33 | #include <InnoTekLIBC/atexit.h>
|
|---|
| 34 | #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM
|
|---|
| 35 | #include <InnoTekLIBC/logstrict.h>
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | int _STD(on_exit)(void (*pfnCallback)(int iExit, void *pvUser), void *pvUser)
|
|---|
| 39 | {
|
|---|
| 40 | LIBCLOG_ENTER("pfnCallback=%p pvUser=%p\n", (void *)pfnCallback, pvUser);
|
|---|
| 41 | __LIBC_PATEXIT pCur = __libc_atexit_new();
|
|---|
| 42 | if (pCur)
|
|---|
| 43 | {
|
|---|
| 44 | pCur->u.OnExit.pfnCallback = pfnCallback;
|
|---|
| 45 | pCur->u.OnExit.pvUser = pvUser;
|
|---|
| 46 | pCur->enmType = __LIBC_ATEXITTYPE_ONEXIT;
|
|---|
| 47 | LIBCLOG_RETURN_INT(0);
|
|---|
| 48 | }
|
|---|
| 49 | LIBCLOG_ERROR_RETURN_INT(-1);
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|