Changeset 2745
- Timestamp:
- Jul 26, 2006, 9:23:03 PM (19 years ago)
- Location:
- trunk/libc/include/klibc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/include/klibc/backend.h
r2744 r2745 7 7 * 8 8 * 9 * This file is part of InnoTekLIBC.10 * 11 * InnoTekLIBC is free software; you can redistribute it and/or modify12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or9 * 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 14 14 * (at your option) any later version. 15 15 * 16 * InnoTekLIBC is distributed in the hope that it will be useful,16 * kLIBC is distributed in the hope that it will be useful, 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * 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 License22 * along with InnoTekLIBC; if not, write to the Free Software19 * 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 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 24 * 25 25 */ 26 26 27 #ifndef __ InnoTekLIBC_backend_h__28 #define __ InnoTekLIBC_backend_h__27 #ifndef __klibc_backend_h__ 28 #define __klibc_backend_h__ 29 29 30 30 #include <stdarg.h> … … 1054 1054 int __libc_Back_processSetPriority(int iWhich, id_t idWho, int iPrio); 1055 1055 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 */ 1064 int __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 */ 1074 int __libc_Back_processSetResourceLimit(int iResId, const struct rlimit *pLimit); 1056 1075 1057 1076 /** When this flag is set, the exec / spawn backend will handle hash bang scripts. */ … … 1313 1332 1314 1333 #endif 1334 -
trunk/libc/include/klibc/logstrict.h
r2744 r2745 2 2 /** @file 3 3 * 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 22 31 #include <sys/cdefs.h> 23 32 #include <sys/types.h> /* size_t */ 24 33 #include <sys/param.h> /* NULL */ 25 34 26 /** @defgroup __libc_log Debug Logging and Strict CheckingFeatures35 /** @defgroup __libc_log Logging and Strictness Features 27 36 * 28 37 * The logging feature is not accessible unless DEBUG_LOGGING is #defined. … … 45 54 46 55 47 /*******************************************************************************48 * Defined Constants And Macros *49 *******************************************************************************/50 56 /** 51 57 * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use … … 53 59 */ 54 60 #ifndef __LIBC_LOG_INSTANCE 55 # define __LIBC_LOG_INSTANCE NULL61 # define __LIBC_LOG_INSTANCE NULL 56 62 #endif 57 63 … … 62 68 */ 63 69 #ifndef __LIBC_LOG_GROUP 64 # define __LIBC_LOG_GROUP 065 # 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" 66 72 #endif 67 73 … … 74 80 /** Macro to log a function entry. */ 75 81 #ifdef DEBUG_LOGGING 76 # define LIBCLOG_ENTER(...) \82 # define LIBCLOG_ENTER(...) \ 77 83 unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 78 84 #else 79 # define LIBCLOG_ENTER(...) //...85 # define LIBCLOG_ENTER(...) //... 80 86 #endif 81 87 82 88 /** Macro to log a generic message within a function entered by LIBCLOG_ENTER(). */ 83 89 #ifdef DEBUG_LOGGING 84 # define LIBCLOG_MSG(...) \90 # define LIBCLOG_MSG(...) \ 85 91 __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 86 92 #else 87 # define LIBCLOG_MSG(...) ((void)0)93 # define LIBCLOG_MSG(...) ((void)0) 88 94 #endif 89 95 90 96 /** Macro to log a generic message within a function. */ 91 97 #ifdef DEBUG_LOGGING 92 # define LIBCLOG_MSG2(...) \98 # define LIBCLOG_MSG2(...) \ 93 99 __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 94 100 #else 95 # define LIBCLOG_MSG2(...) ((void)0)101 # define LIBCLOG_MSG2(...) ((void)0) 96 102 #endif 97 103 98 104 /** Macro to log an user error within a function entered by LIBCLOG_ENTER(). */ 99 105 #ifdef DEBUG_LOGGING 100 # define LIBCLOG_ERROR(...) \106 # define LIBCLOG_ERROR(...) \ 101 107 __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 102 108 #else 103 # define LIBCLOG_ERROR(...) ((void)0)109 # define LIBCLOG_ERROR(...) ((void)0) 104 110 #endif 105 111 106 112 /** Macro to log an user error within a function. */ 107 113 #ifdef DEBUG_LOGGING 108 # define LIBCLOG_ERROR2(...) \114 # define LIBCLOG_ERROR2(...) \ 109 115 __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 110 116 #else 111 # define LIBCLOG_ERROR2(...) ((void)0)117 # define LIBCLOG_ERROR2(...) ((void)0) 112 118 #endif 113 119 114 120 /** Macro to check for and log an user error within a function entered by LIBCLOG_ENTER(). */ 115 121 #ifdef DEBUG_LOGGING 116 # define LIBCLOG_ERROR_CHECK(expr, ...) \122 # define LIBCLOG_ERROR_CHECK(expr, ...) \ 117 123 (!(expr) ? __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) ) 118 124 #else 119 # define LIBCLOG_ERROR_CHECK(expr, ...) ((void)0)125 # define LIBCLOG_ERROR_CHECK(expr, ...) ((void)0) 120 126 #endif 121 127 122 128 /** Macro to check for and log an user error within a function. */ 123 129 #ifdef DEBUG_LOGGING 124 # define LIBCLOG_ERROR2_CHECK(expr, ...) \130 # define LIBCLOG_ERROR2_CHECK(expr, ...) \ 125 131 (!(expr) ? __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) ) 126 132 #else 127 # define LIBCLOG_ERROR2_CHECK(expr, ...) ((void)0)133 # define LIBCLOG_ERROR2_CHECK(expr, ...) ((void)0) 128 134 #endif 129 135 130 136 /** Macro to log a raw message. */ 131 137 #ifdef DEBUG_LOGGING 132 # define LIBCLOG_RAW(string, maxlen) \138 # define LIBCLOG_RAW(string, maxlen) \ 133 139 __libc_LogRaw(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, string, maxlen) 134 140 #else 135 # define LIBCLOG_RAW(...) ((void)0)141 # define LIBCLOG_RAW(...) ((void)0) 136 142 #endif 137 143 138 144 /** Macro to leave a function entered by LIBCLOG_ENTER(). */ 139 145 #ifdef DEBUG_LOGGING 140 # define LIBCLOG_LEAVE(...) \146 # define LIBCLOG_LEAVE(...) \ 141 147 __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__) 142 148 #else 143 # define LIBCLOG_LEAVE(...) ((void)0)149 # define LIBCLOG_LEAVE(...) ((void)0) 144 150 #endif 145 151 … … 167 173 /** Macro to leave a function entered by LIBCLOG_ENTER() on user error. */ 168 174 #ifdef DEBUG_LOGGING 169 # define LIBCLOG_ERROR_LEAVE(...) \175 # define LIBCLOG_ERROR_LEAVE(...) \ 170 176 __libc_LogErrorLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 171 177 #else 172 # define LIBCLOG_ERROR_LEAVE(...) ((void)0)178 # define LIBCLOG_ERROR_LEAVE(...) ((void)0) 173 179 #endif 174 180 … … 313 319 */ 314 320 #ifdef __LIBC_STRICT 315 # define LIBC_ASSERT(expr) ((expr) ? (void)0 \321 # define LIBC_ASSERT(expr) ((expr) ? (void)0 \ 316 322 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, NULL)) 317 323 #else 318 # define LIBC_ASSERT(expr) ((void)0)324 # define LIBC_ASSERT(expr) ((void)0) 319 325 #endif 320 326 … … 323 329 */ 324 330 #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) 328 334 #endif 329 335 … … 333 339 */ 334 340 #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 \ 336 342 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \ 337 343 "Memory buffer at %p of %d bytes isn't readable!\n", (pv), (cb))) 338 344 #else 339 # define LIBC_ASSERT_MEM_R(pv, cb) ((void)0)345 # define LIBC_ASSERT_MEM_R(pv, cb) ((void)0) 340 346 #endif 341 347 … … 345 351 */ 346 352 #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 \ 348 354 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \ 349 355 "Memory buffer at %p of %d bytes isn't readable and writable!\n", (pv), (cb))) 350 356 #else 351 # define LIBC_ASSERT_MEM_RW(pv, cb) ((void)0)357 # define LIBC_ASSERT_MEM_RW(pv, cb) ((void)0) 352 358 #endif 353 359 … … 356 362 */ 357 363 #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 \ 359 365 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \ 360 366 "String at %p isn't readable!\n", (psz))) 361 367 #else 362 # define LIBC_ASSERT_STR(psz) ((void)0)368 # define LIBC_ASSERT_STR(psz) ((void)0) 363 369 #endif 364 370 … … 368 374 */ 369 375 #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 \ 371 377 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \ 372 378 "String at %p of maximum %d bytes isn't readable!\n", (psz), (cchMax))) 373 379 #else 374 # define LIBC_ASSERT_NSTR(psz, cchMax) ((void)0)380 # define LIBC_ASSERT_NSTR(psz, cchMax) ((void)0) 375 381 #endif 376 382 … … 381 387 */ 382 388 #ifdef __LIBC_STRICT 383 # define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \389 # define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \ 384 390 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, \ 385 391 __VA_ARGS__)) 386 392 #else 387 # define LIBC_ASSERTM(expr, ...) ((void)0)393 # define LIBC_ASSERTM(expr, ...) ((void)0) 388 394 #endif 389 395 … … 393 399 */ 394 400 #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) 398 404 #endif 399 405 … … 403 409 */ 404 410 #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 \ 406 412 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \ 407 413 __VA_ARGS__)) 408 414 #else 409 # define LIBC_ASSERTM_MEM_R(pv, cb, ...) ((void)0)415 # define LIBC_ASSERTM_MEM_R(pv, cb, ...) ((void)0) 410 416 #endif 411 417 … … 415 421 */ 416 422 #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 \ 418 424 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \ 419 425 __VA_ARGS__)) 420 426 #else 421 # define LIBC_ASSERTM_MEM_RW(pv, cb, ...) ((void)0)427 # define LIBC_ASSERTM_MEM_RW(pv, cb, ...) ((void)0) 422 428 #endif 423 429 … … 426 432 */ 427 433 #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 \ 429 435 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \ 430 436 __VA_ARGS__)) 431 437 #else 432 # define LIBC_ASSERTM_STR(psz, ...) ((void)0)438 # define LIBC_ASSERTM_STR(psz, ...) ((void)0) 433 439 #endif 434 440 … … 438 444 */ 439 445 #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 \ 441 447 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \ 442 448 __VA_ARGS__)) 443 449 #else 444 # define LIBC_ASSERTM_NSTR(psz, cchMax, ...) ((void)0)450 # define LIBC_ASSERTM_NSTR(psz, cchMax, ...) ((void)0) 445 451 #endif 446 452 … … 451 457 452 458 453 /*******************************************************************************454 * Structures and Typedefs *455 *******************************************************************************/456 459 /** Logging group. */ 457 460 typedef struct __libc_log_group … … 476 479 477 480 478 /*******************************************************************************479 * External Functions *480 *******************************************************************************/481 481 __BEGIN_DECLS 482 482 483 /** 483 484 * Create a logger. -
trunk/libc/include/klibc/thread.h
r2744 r2745 2 2 /** @file 3 3 * 4 * LIBC Thread Handling.4 * kLIBC - Thread Management. 5 5 * 6 6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * 9 * This file is part of InnoTekLIBC.10 * 11 * InnoTekLIBC is free software; you can redistribute it and/or modify12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or9 * 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 14 14 * (at your option) any later version. 15 15 * 16 * InnoTekLIBC is distributed in the hope that it will be useful,16 * kLIBC is distributed in the hope that it will be useful, 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * 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 License22 * along with InnoTekLIBC; if not, write to the Free Software19 * 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 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 24 * 25 25 */ 26 26 27 #ifndef __ InnoTekLIBC_thread_h__28 #define __ InnoTekLIBC_thread_h__27 #ifndef __klibc_thread_h__ 28 #define __klibc_thread_h__ 29 29 30 30 /*******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.