Changeset 2745


Ignore:
Timestamp:
Jul 26, 2006, 9:23:03 PM (19 years ago)
Author:
bird
Message:

wrappers for the old headers. Cleaned up the moved headers. added get/setrlimit backend stuff.

Location:
trunk/libc/include/klibc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/include/klibc/backend.h

    r2744 r2745  
    77 *
    88 *
    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 General Public License as published by
    13  * the Free Software Foundation; either version 2 of the License, or
     9 * This file is part of kLIBC.
     10 *
     11 * kLIBC 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
    1414 * (at your option) any later version.
    1515 *
    16  * InnoTek LIBC is distributed in the hope that it will be useful,
     16 * kLIBC is distributed in the hope that it will be useful,
    1717 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1818 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  *
    21  * You should have received a copy of the GNU General Public License
    22  * along with InnoTek LIBC; if not, write to the Free Software
     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 kLIBC; if not, write to the Free Software
    2323 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2424 *
    2525 */
    2626
    27 #ifndef __InnoTekLIBC_backend_h__
    28 #define __InnoTekLIBC_backend_h__
     27#ifndef __klibc_backend_h__
     28#define __klibc_backend_h__
    2929
    3030#include <stdarg.h>
     
    10541054int __libc_Back_processSetPriority(int iWhich, id_t idWho, int iPrio);
    10551055
     1056/**
     1057 * Get limits on the consumption of a variety of resources.
     1058 *
     1059 * @returns 0 on success.
     1060 * @returns Negated errno on failure.
     1061 * @param   iResId      The resource id.
     1062 * @param   pLimit      Where to store the resource limits.
     1063 */
     1064int __libc_Back_processGetResourceLimit(int iResId, struct rlimit *pLimit);
     1065
     1066/**
     1067 * set limits on the consumption of a variety of resources.
     1068 *
     1069 * @returns 0 on success.
     1070 * @returns Negated errno on failure.
     1071 * @param   iResId      The resource id.
     1072 * @param   pLimit      The new resource limits.
     1073 */
     1074int __libc_Back_processSetResourceLimit(int iResId, const struct rlimit *pLimit);
    10561075
    10571076/** When this flag is set, the exec / spawn backend will handle hash bang scripts. */
     
    13131332
    13141333#endif
     1334
  • trunk/libc/include/klibc/logstrict.h

    r2744 r2745  
    22/** @file
    33 *
    4  * InnoTek LIBC - Debug Logging and Strict Checking Features.
    5  *
    6  * InnoTek Systemberatung GmbH
    7  *
    8  * Copyright (c) 2004 InnoTek Systemberatung GmbH
    9  * Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net>
    10  * Author: knut st. osmundsen <bird-srcspam@anduin.net>
    11  *
    12  * All Rights Reserved
    13  *
    14  */
    15 
    16 #ifndef __InnoTekLIBC_LOG_H__
    17 #define __InnoTekLIBC_LOG_H__
    18 
    19 /*******************************************************************************
    20 *   Header Files                                                               *
    21 *******************************************************************************/
     4 * kLIBC - Logging and Strictness Feature.
     5 *
     6 * Copyright (c) 2004 InnoTek Systemberatung GmbH (?)
     7 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
     8 *
     9 *
     10 * This file is part of kLIBC.
     11 *
     12 * kLIBC is free software; you can redistribute it and/or modify
     13 * it under the terms of the GNU Lesser General Public License as published
     14 * by the Free Software Foundation; either version 2 of the License, or
     15 * (at your option) any later version.
     16 *
     17 * kLIBC is distributed in the hope that it will be useful,
     18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20 * GNU Lesser General Public License for more details.
     21 *
     22 * You should have received a copy of the GNU Lesser General Public License
     23 * along with kLIBC; if not, write to the Free Software
     24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     25 *
     26 */
     27
     28#ifndef __klibc_LOG_H__
     29#define __klibc_LOG_H__
     30
    2231#include <sys/cdefs.h>
    2332#include <sys/types.h>                  /* size_t */
    2433#include <sys/param.h>                  /* NULL */
    2534
    26 /** @defgroup   __libc_log      Debug Logging and Strict Checking Features
     35/** @defgroup   __libc_log      Logging and Strictness Features
    2736 *
    2837 * The logging feature is not accessible unless DEBUG_LOGGING is #defined.
     
    4554
    4655
    47 /*******************************************************************************
    48 *   Defined Constants And Macros                                               *
    49 *******************************************************************************/
    5056/**
    5157 * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use
     
    5359 */
    5460#ifndef __LIBC_LOG_INSTANCE
    55 #define __LIBC_LOG_INSTANCE NULL
     61# define __LIBC_LOG_INSTANCE NULL
    5662#endif
    5763
     
    6268 */
    6369#ifndef __LIBC_LOG_GROUP
    64 #define __LIBC_LOG_GROUP    0
    65 #error "__LIBC_LOG_GROUP must be defined before including InnoTekLIBC/log.h"
     70# define __LIBC_LOG_GROUP    0
     71# error "__LIBC_LOG_GROUP must be defined before including klibc/log.h"
    6672#endif
    6773
     
    7480/** Macro to log a function entry. */
    7581#ifdef DEBUG_LOGGING
    76 #define LIBCLOG_ENTER(...) \
     82# define LIBCLOG_ENTER(...) \
    7783    unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    7884#else
    79 #define LIBCLOG_ENTER(...)      //...
     85# define LIBCLOG_ENTER(...)      //...
    8086#endif
    8187
    8288/** Macro to log a generic message within a function entered by LIBCLOG_ENTER(). */
    8389#ifdef DEBUG_LOGGING
    84 #define LIBCLOG_MSG(...) \
     90# define LIBCLOG_MSG(...) \
    8591    __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    8692#else
    87 #define LIBCLOG_MSG(...)        ((void)0)
     93# define LIBCLOG_MSG(...)        ((void)0)
    8894#endif
    8995
    9096/** Macro to log a generic message within a function. */
    9197#ifdef DEBUG_LOGGING
    92 #define LIBCLOG_MSG2(...) \
     98# define LIBCLOG_MSG2(...) \
    9399    __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    94100#else
    95 #define LIBCLOG_MSG2(...)       ((void)0)
     101# define LIBCLOG_MSG2(...)       ((void)0)
    96102#endif
    97103
    98104/** Macro to log an user error within a function entered by LIBCLOG_ENTER(). */
    99105#ifdef DEBUG_LOGGING
    100 #define LIBCLOG_ERROR(...) \
     106# define LIBCLOG_ERROR(...) \
    101107    __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
    102108#else
    103 #define LIBCLOG_ERROR(...)      ((void)0)
     109# define LIBCLOG_ERROR(...)      ((void)0)
    104110#endif
    105111
    106112/** Macro to log an user error within a function. */
    107113#ifdef DEBUG_LOGGING
    108 #define LIBCLOG_ERROR2(...) \
     114# define LIBCLOG_ERROR2(...) \
    109115    __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
    110116#else
    111 #define LIBCLOG_ERROR2(...)     ((void)0)
     117# define LIBCLOG_ERROR2(...)     ((void)0)
    112118#endif
    113119
    114120/** Macro to check for and log an user error within a function entered by LIBCLOG_ENTER(). */
    115121#ifdef DEBUG_LOGGING
    116 #define LIBCLOG_ERROR_CHECK(expr, ...) \
     122# define LIBCLOG_ERROR_CHECK(expr, ...) \
    117123    (!(expr) ? __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
    118124#else
    119 #define LIBCLOG_ERROR_CHECK(expr, ...) ((void)0)
     125# define LIBCLOG_ERROR_CHECK(expr, ...) ((void)0)
    120126#endif
    121127
    122128/** Macro to check for and log an user error within a function. */
    123129#ifdef DEBUG_LOGGING
    124 #define LIBCLOG_ERROR2_CHECK(expr, ...) \
     130# define LIBCLOG_ERROR2_CHECK(expr, ...) \
    125131    (!(expr) ? __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
    126132#else
    127 #define LIBCLOG_ERROR2_CHECK(expr, ...) ((void)0)
     133# define LIBCLOG_ERROR2_CHECK(expr, ...) ((void)0)
    128134#endif
    129135
    130136/** Macro to log a raw message. */
    131137#ifdef DEBUG_LOGGING
    132 #define LIBCLOG_RAW(string, maxlen) \
     138# define LIBCLOG_RAW(string, maxlen) \
    133139    __libc_LogRaw(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, string, maxlen)
    134140#else
    135 #define LIBCLOG_RAW(...)        ((void)0)
     141# define LIBCLOG_RAW(...)        ((void)0)
    136142#endif
    137143
    138144/** Macro to leave a function entered by LIBCLOG_ENTER(). */
    139145#ifdef DEBUG_LOGGING
    140 #define LIBCLOG_LEAVE(...) \
     146# define LIBCLOG_LEAVE(...) \
    141147    __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    142148#else
    143 #define LIBCLOG_LEAVE(...)      ((void)0)
     149# define LIBCLOG_LEAVE(...)      ((void)0)
    144150#endif
    145151
     
    167173/** Macro to leave a function entered by LIBCLOG_ENTER() on user error. */
    168174#ifdef DEBUG_LOGGING
    169 #define LIBCLOG_ERROR_LEAVE(...) \
     175# define LIBCLOG_ERROR_LEAVE(...) \
    170176    __libc_LogErrorLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
    171177#else
    172 #define LIBCLOG_ERROR_LEAVE(...)      ((void)0)
     178# define LIBCLOG_ERROR_LEAVE(...)      ((void)0)
    173179#endif
    174180
     
    313319 */
    314320#ifdef __LIBC_STRICT
    315 #define LIBC_ASSERT(expr) ((expr) ? (void)0 \
     321# define LIBC_ASSERT(expr) ((expr) ? (void)0 \
    316322    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, NULL))
    317323#else
    318 #define LIBC_ASSERT(expr) ((void)0)
     324# define LIBC_ASSERT(expr) ((void)0)
    319325#endif
    320326
     
    323329 */
    324330#ifdef __LIBC_STRICT
    325 #define LIBC_ASSERT_FAILED() __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", NULL)
    326 #else
    327 #define LIBC_ASSERT_FAILED() ((void)0)
     331# define LIBC_ASSERT_FAILED() __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", NULL)
     332#else
     333# define LIBC_ASSERT_FAILED() ((void)0)
    328334#endif
    329335
     
    333339 */
    334340#ifdef __LIBC_STRICT
    335 #define LIBC_ASSERT_MEM_R(pv, cb) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
     341# define LIBC_ASSERT_MEM_R(pv, cb) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
    336342    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
    337343                       "Memory buffer at %p of %d bytes isn't readable!\n", (pv), (cb)))
    338344#else
    339 #define LIBC_ASSERT_MEM_R(pv, cb) ((void)0)
     345# define LIBC_ASSERT_MEM_R(pv, cb) ((void)0)
    340346#endif
    341347
     
    345351 */
    346352#ifdef __LIBC_STRICT
    347 #define LIBC_ASSERT_MEM_RW(pv, cb) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
     353# define LIBC_ASSERT_MEM_RW(pv, cb) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
    348354    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
    349355                       "Memory buffer at %p of %d bytes isn't readable and writable!\n", (pv), (cb)))
    350356#else
    351 #define LIBC_ASSERT_MEM_RW(pv, cb) ((void)0)
     357# define LIBC_ASSERT_MEM_RW(pv, cb) ((void)0)
    352358#endif
    353359
     
    356362 */
    357363#ifdef __LIBC_STRICT
    358 #define LIBC_ASSERT_STR(psz) (__libc_StrictStringR((psz), ~0) ? (void)0 \
     364# define LIBC_ASSERT_STR(psz) (__libc_StrictStringR((psz), ~0) ? (void)0 \
    359365    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
    360366                       "String at %p isn't readable!\n", (psz)))
    361367#else
    362 #define LIBC_ASSERT_STR(psz) ((void)0)
     368# define LIBC_ASSERT_STR(psz) ((void)0)
    363369#endif
    364370
     
    368374 */
    369375#ifdef __LIBC_STRICT
    370 #define LIBC_ASSERT_NSTR(psz, cchMax) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
     376# define LIBC_ASSERT_NSTR(psz, cchMax) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
    371377    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
    372378                       "String at %p of maximum %d bytes isn't readable!\n", (psz), (cchMax)))
    373379#else
    374 #define LIBC_ASSERT_NSTR(psz, cchMax) ((void)0)
     380# define LIBC_ASSERT_NSTR(psz, cchMax) ((void)0)
    375381#endif
    376382
     
    381387 */
    382388#ifdef __LIBC_STRICT
    383 #define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \
     389# define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \
    384390    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, \
    385391                       __VA_ARGS__))
    386392#else
    387 #define LIBC_ASSERTM(expr, ...) ((void)0)
     393# define LIBC_ASSERTM(expr, ...) ((void)0)
    388394#endif
    389395
     
    393399 */
    394400#ifdef __LIBC_STRICT
    395 #define LIBC_ASSERTM_FAILED(...) __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", __VA_ARGS__)
    396 #else
    397 #define LIBC_ASSERTM_FAILED(...) ((void)0)
     401# define LIBC_ASSERTM_FAILED(...) __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", __VA_ARGS__)
     402#else
     403# define LIBC_ASSERTM_FAILED(...) ((void)0)
    398404#endif
    399405
     
    403409 */
    404410#ifdef __LIBC_STRICT
    405 #define LIBC_ASSERTM_MEM_R(pv, cb, ...) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
     411# define LIBC_ASSERTM_MEM_R(pv, cb, ...) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
    406412    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
    407413                       __VA_ARGS__))
    408414#else
    409 #define LIBC_ASSERTM_MEM_R(pv, cb, ...) ((void)0)
     415# define LIBC_ASSERTM_MEM_R(pv, cb, ...) ((void)0)
    410416#endif
    411417
     
    415421 */
    416422#ifdef __LIBC_STRICT
    417 #define LIBC_ASSERTM_MEM_RW(pv, cb, ...) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
     423# define LIBC_ASSERTM_MEM_RW(pv, cb, ...) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
    418424    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
    419425                       __VA_ARGS__))
    420426#else
    421 #define LIBC_ASSERTM_MEM_RW(pv, cb, ...) ((void)0)
     427# define LIBC_ASSERTM_MEM_RW(pv, cb, ...) ((void)0)
    422428#endif
    423429
     
    426432 */
    427433#ifdef __LIBC_STRICT
    428 #define LIBC_ASSERTM_STR(psz, ...) (__libc_StrictStringR((psz), ~0) ? (void)0 \
     434# define LIBC_ASSERTM_STR(psz, ...) (__libc_StrictStringR((psz), ~0) ? (void)0 \
    429435    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
    430436                       __VA_ARGS__))
    431437#else
    432 #define LIBC_ASSERTM_STR(psz, ...) ((void)0)
     438# define LIBC_ASSERTM_STR(psz, ...) ((void)0)
    433439#endif
    434440
     
    438444 */
    439445#ifdef __LIBC_STRICT
    440 #define LIBC_ASSERTM_NSTR(psz, cchMax, ...) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
     446# define LIBC_ASSERTM_NSTR(psz, cchMax, ...) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
    441447    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
    442448                       __VA_ARGS__))
    443449#else
    444 #define LIBC_ASSERTM_NSTR(psz, cchMax, ...) ((void)0)
     450# define LIBC_ASSERTM_NSTR(psz, cchMax, ...) ((void)0)
    445451#endif
    446452
     
    451457
    452458
    453 /*******************************************************************************
    454 *   Structures and Typedefs                                                    *
    455 *******************************************************************************/
    456459/** Logging group. */
    457460typedef struct __libc_log_group
     
    476479
    477480
    478 /*******************************************************************************
    479 *   External Functions                                                         *
    480 *******************************************************************************/
    481481__BEGIN_DECLS
     482
    482483/**
    483484 * Create a logger.
  • trunk/libc/include/klibc/thread.h

    r2744 r2745  
    22/** @file
    33 *
    4  * LIBC Thread Handling.
     4 * kLIBC - Thread Management.
    55 *
    66 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
    77 *
    88 *
    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 General Public License as published by
    13  * the Free Software Foundation; either version 2 of the License, or
     9 * This file is part of kLIBC.
     10 *
     11 * kLIBC 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
    1414 * (at your option) any later version.
    1515 *
    16  * InnoTek LIBC is distributed in the hope that it will be useful,
     16 * kLIBC is distributed in the hope that it will be useful,
    1717 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1818 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  *
    21  * You should have received a copy of the GNU General Public License
    22  * along with InnoTek LIBC; if not, write to the Free Software
     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 kLIBC; if not, write to the Free Software
    2323 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2424 *
    2525 */
    2626
    27 #ifndef __InnoTekLIBC_thread_h__
    28 #define __InnoTekLIBC_thread_h__
     27#ifndef __klibc_thread_h__
     28#define __klibc_thread_h__
    2929
    3030/*******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.