Changeset 1454 for trunk/src/emx/include


Ignore:
Timestamp:
Sep 4, 2004, 8:22:38 AM (21 years ago)
Author:
bird
Message:

Joined with the fork() tree from netlabs.cvs.

Location:
trunk/src/emx/include
Files:
5 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/386/builtin.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1453 r1454  
    77#define _I386_BUILTIN_H
    88
    9 #if defined (__cplusplus)
    10 extern "C" {
    11 #endif
     9#include <sys/cdefs.h>
     10#include <stdint.h>
     11
     12__BEGIN_DECLS
     13
    1214
    1315static __inline__ signed char __cxchg (__volatile__ signed char *p,
     
    4042}
    4143
     44
     45/**
     46 * Performs an atomical xchg on an unsigned int.
     47 * @returns old value.
     48 * @param   pu      Pointer to the value to update.
     49 * @param   u       The new value.
     50 */
     51static __inline__ unsigned __atomic_xchg(__volatile__ unsigned *pu, unsigned u)
     52{
     53    __asm__ __volatile__ ("xchgl %0, %1" : "=m" (*pu), "=r" (u) : "1" (u));
     54    return u;
     55}
     56
     57/**
     58 * Performs an atomical xchg on an 16-bit unsigned integer.
     59 *
     60 * @returns old value.
     61 * @param   pu16    Pointer to the value to update.
     62 * @param   u16     The new value.
     63 */
     64static inline uint16_t __atomic_xchg_word(volatile uint16_t *pu16, uint16_t u16)
     65{
     66    __asm__ __volatile__ ("xchgw %0, %1" : "=m" (*pu16), "=r" (u16) : "1" (u16));
     67    return u16;
     68}
     69
    4270/**
    4371 * Atomically sets a bit and return the old one.
    4472 *
    45  * @returns 1 if the bit was set, 0 if it was clear.
     73 * @returns 1 if the bwit was set, 0 if it was clear.
    4674 * @param   pv      Pointer to base of bitmap.
    4775 * @param   uBit    Bit in question.
     
    89117                           "0"  (uBit));
    90118    return uBit;
     119}
     120
     121
     122/**
     123 * Atomically add a 32-bit unsigned value to another.
     124 *
     125 * @param   pu      Pointer to the value to add to.
     126 * @param   uAdd    The value to add to *pu.
     127 */
     128static __inline__ void __atomic_add(__volatile__ unsigned *pu, unsigned uAdd)
     129{
     130    __asm__ __volatile__("lock addl %1, %0"
     131                         : "=m" (*pu)
     132                         : "r" (uAdd));
     133}
     134
     135/**
     136 * Atomically subtract a 32-bit unsigned value from another.
     137 *
     138 * @param   pu      Pointer to the value to subtract from.
     139 * @param   uAdd    The value to subtract from *pu.
     140 */
     141static __inline__ void __atomic_sub(__volatile__ unsigned *pu, unsigned uSub)
     142{
     143    __asm__ __volatile__("lock subl %1, %0"
     144                         : "=m" (*pu)
     145                         : "r" (uSub));
    91146}
    92147
     
    148203
    149204/**
     205 * Atomically increments a 16-bit unsigned value if less than max.
     206 *
     207 * @returns New value.
     208 * @returns Current value | 0xffff0000 if current value is less or equal to u16Min.
     209 * @param   pu16    Pointer to the value to increment.
     210 * @param   u16Max  *pu16 must not be above this value after the incrementation.
     211 */
     212static inline unsigned __atomic_increment_word_max(volatile uint16_t *pu16, uint16_t u16Max)
     213{
     214    unsigned rc;
     215    __asm__ __volatile__("movw  (%1), %%ax\n\t"
     216                         "1:\n\t"
     217                         "movw  %%ax, %%bx\n\t"
     218                         "cmpw  %%dx, %%ax\n\t"
     219                         "jb    2f\n\t"
     220                         "orl   $0xffff0000, %%ebx\n\t"
     221                         "jmp   3f\n"
     222                         "2:\n\t"
     223                         "incw  %%bx\n\t"
     224                         "lock  cmpxchgw %%bx, (%1)\n\t"
     225                         "jz    3f\n\t"
     226                         "jmp   1b\n\t"
     227                         "3:"
     228                         : "=b" (rc)
     229                         : "r"  (pu16),
     230                           "d"  (u16Max)
     231                         : "%eax");
     232    return rc;
     233}
     234
     235
     236/**
    150237 * Atomically decrements a 32-bit unsigned value if greater than a min.
    151238 *
     
    180267
    181268
     269/**
     270 * Atomically decrements a 16-bit unsigned value if greater than a min.
     271 *
     272 * @returns New value.
     273 * @returns Current value | 0xffff0000 if current value is less or equal to u16Min.
     274 * @param   pu16    Pointer to the  value to decrement.
     275 * @param   u16Min  *pu16 must not be below this value after the decrementation.
     276 */
     277static inline unsigned __atomic_decrement_word_min(volatile uint16_t *pu16, uint16_t u16Min)
     278{
     279    unsigned rc;
     280    __asm__ __volatile__("movw  (%1), %%ax\n"
     281                         "1:\n\t"
     282                         "movw  %%ax, %%bx\n\t"
     283                         "cmpw  %%dx, %%ax\n\t"
     284                         "ja    2f\n\t"
     285                         "orl   $0xffff0000, %%ebx\n\t"
     286                         "jmp   3f\n"
     287                         "2:\n\t"
     288                         "decw  %%bx\n\t"
     289                         "lock  cmpxchgw %%bx, (%1)\n\t"
     290                         "jz    3f\n\t"
     291                         "jmp   1b\n"
     292                         "3:"
     293                         : "=b" (rc)
     294                         : "r"  (pu16),
     295                           "d"  (u16Min)
     296                         : "%eax");
     297    return rc;
     298}
     299
     300
    182301#define __ROTATE_FUN(F,I,T) \
    183302  static __inline__ T F (T value, int shift) \
     
    356475}
    357476
    358 #if defined (__cplusplus)
    359 }
    360 #endif
    361 
     477__END_DECLS
    362478#endif /* not _I386_BUILTIN_H */
  • trunk/src/emx/include/InnoTekLIBC/logstrict.h

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1453 r1454  
    179179#define __LIBC_LOG_GRP_ENV          15
    180180
     181/** Shared Process Database and LIBC Shared Memory APIs. */
     182#define __LIBC_LOG_GRP_SPM          24
     183/** Fork APIs. */
     184#define __LIBC_LOG_GRP_FORK         25
    181185/** Backend IO APIs. */
    182186#define __LIBC_LOG_GRP_BACK_IO      26
    183 
    184187/** Init/Term APIs and Events. */
    185188#define __LIBC_LOG_GRP_INITTERM     27
     
    204207/** Posix thread APIs. */
    205208#define __LIBC_LOG_GRP_PTHREAD      36
     209/** Posix thread APIs. */
     210#define __LIBC_LOG_GRP_DOSEX        37
    206211
    207212/** @todo complete this */
    208 #define __LIBC_LOG_GRP_MAX          36
     213#define __LIBC_LOG_GRP_MAX          37
    209214/** @} */
    210215
  • trunk/src/emx/include/ctype.h

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r1453 r1454  
    1 /*
    2     Locale support implementation through OS/2 Unicode API.
    3     Copyright (c) 2003 InnoTek Systemberatung GmbH
    4 
    5     For conditions of distribution and use, see the file COPYING.
    6 
    7     Character type querying.
    8 */
     1/* ctype.h,v 1.14 2004/09/04 06:22:16 bird Exp */
     2/** @file
     3 *
     4 * InnoTek LIBC - Character type querying.
     5 *
     6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
     7 *
     8 *
     9 * This program is free software; you can redistribute it and/or modify
     10 * it under the terms of the GNU General Public License as published by
     11 * the Free Software Foundation; either version 2 of the License, or
     12 * (at your option) any later version.
     13 *
     14 * This program is distributed in the hope that it will be useful,
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 * GNU General Public License for more details.
     18 *
     19 * You should have received a copy of the GNU General Public License
     20 * along with This program; if not, write to the Free Software
     21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     22 *
     23 */
    924
    1025#ifndef _CTYPE_H_
     
    1227
    1328#include <sys/cdefs.h>
    14 #include <sys/locale.h>
     29
     30#if !defined(__InnoTekLIBC_locale_h__)
     31__BEGIN_DECLS
     32/**
     33 * Simplified Ctype structure for inline functions.
     34 */
     35extern struct
     36{
     37    /** All uppercased characters. */
     38    unsigned char   auchUpper[256];
     39    /** All lowercased characters. */
     40    unsigned char   auchLower[256];
     41    /** Bit flags for every character (for isXXX() function series). */
     42    unsigned short  ausfType[256];
     43} __libc_GLocaleCtype;
     44
     45/**
     46 * Simplified Default Ctype structure for inline functions.
     47 */
     48extern const struct
     49{
     50    /** Bit flags for every character (for isXXX() function series). */
     51    unsigned short  ausfType[256];
     52} __libc_GLocaleCtypeDefault;
     53__END_DECLS
     54#endif /* !__InnoTekLIBC_locale_h__ */
     55
     56
     57/** Bit masks for the ausfType member of __libc_GLocaleCtype
     58 *  and __libc_GLocaleCtypeDefault
     59 *
     60 * @remark These have identical values to the CT_* to speed up setlocale().
     61 * @{
     62 */
     63#define __UPPER     0x0001      /** Upper case alphabetic character. */
     64#define __LOWER     0x0002      /** Lower case alphabetic character. */
     65#define __DIGIT     0x0004      /** Digits 0-9. */
     66#define __SPACE     0x0008      /** White space and line ends. */
     67#define __PUNCT     0x0010      /** Punctuation marks. */
     68#define __CNTRL     0x0020      /** Control and format characters. */
     69#define __BLANK     0x0040      /** Space and tab. */
     70#define __XDIGIT    0x0080      /** Hex digits. */
     71#define __ALPHA     0x0100      /** Letters and linguistic marks. */
     72#define __ALNUM     0x0200      /** Alphanumeric. */
     73#define __GRAPH     0x0400      /** All except controls and space. */
     74#define __PRINT     0x0800      /** Everything except controls. */
     75#define __NUMBER    0x1000      /** Integral number. */
     76#define __SYMBOL    0x2000      /** Symbol. */
     77#define __ASCII     0x8000      /** In standard ASCII set. */
     78/** @} */
     79
    1580
    1681__BEGIN_DECLS
     
    51116#define isalpha(c)  __istype((c), (__UPPER)|(__LOWER))
    52117#define iscntrl(c)  __istype((c), (__CNTRL))
    53 #define isdigit(c)  __istype((c), (__DIGIT))
    54118#define isgraph(c)  __istype((c), (__PUNCT)|(__UPPER)|(__LOWER)|(__DIGIT))
    55119#define islower(c)  __istype((c), (__LOWER))
     
    58122#define isspace(c)  __istype((c), (__SPACE))
    59123#define isupper(c)  __istype((c), (__UPPER))
    60 #define isxdigit(c) __istype((c), (__XDIGIT))
     124#ifdef __UNIX_CHAR_CLASS__
     125/* BSD and some other UNIXes have non-standard definitions of these two at least. */
     126#define isdigit(c)  __isctype((c),(__DIGIT))
     127#define isxdigit(c) __isctype((c),(__XDIGIT))
     128#else
     129#define isdigit(c)  __istype((c),(__DIGIT))
     130#define isxdigit(c) __istype((c),(__XDIGIT))
     131#endif
     132#define tolower(c)  __tolower(c)
    61133#define toupper(c)  __toupper(c)
    62 #define tolower(c)  __tolower(c)
    63134
    64135#if __XSI_VISIBLE
     
    81152__BEGIN_DECLS
    82153static inline int __istype(int _c, unsigned _f)
    83 { return __locale_ctype.cflags [_c & 0xff] & (_f); }
     154{ return (__libc_GLocaleCtype.ausfType[_c & 0xff] & (_f)) != 0; }
     155static inline int __isctype(int _c, unsigned _f)
     156{ return (__libc_GLocaleCtypeDefault.ausfType[_c & 0xff] & (_f)) != 0; }
    84157static inline int __toupper(int _c)
    85 { return __locale_ctype.upcase [_c & 0xff]; }
     158{ return __libc_GLocaleCtype.auchUpper[_c & 0xff]; }
    86159static inline int __tolower(int _c)
    87 { return __locale_ctype.locase [_c & 0xff]; }
     160{ return __libc_GLocaleCtype.auchLower[_c & 0xff]; }
    88161__END_DECLS
    89162
     
    92165__BEGIN_DECLS
    93166int __istype(int, unsigned);
     167int __isctype(int, unsigned);
    94168int __toupper(int);
    95169int __tolower(int);
  • trunk/src/emx/include/emx/asm386.h

    • Property cvs2svn:cvs-rev changed from 1.8 to 1.9
    r1453 r1454  
    3939#define LABEL(name)     LABEL0(name)
    4040
    41 #define ALIGN   .align  2, 0x90
     41#define ALIGN   .align  4, 0x90
    4242
    4343#define SET_ERRNO_CONST(x) \
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.8 to 1.9
    r1453 r1454  
    44#define _EMX_IO_H
    55
    6 #if defined (__cplusplus)
    7 extern "C" {
    8 #endif
    9 
     6#include <sys/cdefs.h>
    107#include <sys/types.h>
     8#include <InnoTekLIBC/fork.h>
     9
     10__BEGIN_DECLS
    1111
    1212#if !defined (NULL)
     
    1919
    2020/** @defgroup   libc_ioflags    Low Level I/O Flags
     21 *
    2122 * These low level I/O flags are kept in the fFlags member of the LIBCFH
    2223 * structure. The O_* flags are defined in sys/fcntl.h, the F_* flags are
    23  * internal to LIBC and defined in emx/io.h.
     24 * internal to LIBC and defined in emx/io.h (they should've been decorated
     25 * with the usual prefix but it's already EMX legacy), and the FD_* flag(s)
     26 * is(/are) defined
     27 *
    2428 * @{
    2529 */
     
    4347/*      free        0x00004000 */
    4448/*      O_NOCTTY    0x00008000 */
    45 #define F_EOF       0x01000000
    46 #define F_TERMIO    0x02000000
    47 #define F_WRCRPEND  0x04000000
    48 #define F_CRLF      0x08000000
    49 /** Filetype mask. */
    50 #define F_TYPEMASK  0xf0000000
     49#define F_EOF       0x00100000
     50#define F_TERMIO    0x00200000
     51#define F_WRCRPEND  0x00400000
     52#define F_CRLF      0x00800000
    5153/** Type - Regular file. */
    52 #define F_FILE      0x10000000
     54#define F_FILE      0x01000000
    5355/** Type - Characater device. */
    54 #define F_DEV       0x20000000
     56#define F_DEV       0x02000000
    5557/** Type - Pipe. */
    56 #define F_PIPE      0x30000000
     58#define F_PIPE      0x03000000
    5759/** Type - Socket. */
    58 #define F_SOCKET    0x40000000
     60#define F_SOCKET    0x04000000
     61/*      FD_CLOEXEC  0x10000000 (when shifted) */
     62/** The shift for the file descriptor part of __LIBC_FH::fFlags. */
     63#define __LIBC_FH_FDFLAGS_SHIFT     28
     64
     65/** File status/open flag mask. */
     66#define __LIBC_FH_OFLAGS_MASK       0x00ffffff
     67/** File handle type mask. */
     68#define __LIBC_FH_TYPEMASK          0x0f000000
     69/** File descriptor flags mask. */
     70#define __LIBC_FH_FDFLAGS_MASK      0xf0000000
     71
    5972/** @} */
    6073
     
    179192extern struct fdvec         _fdvec_head;
    180193
    181 #if defined (_SYS_RMUTEX_H)
     194#if defined (_SYS_FMUTEX_H)
    182195
    183196/* This semaphore (defined in app/stdio.c) protects _streamv[].  Only
     
    188201   _newstream(), _setmore(), and freopen(). */
    189202
    190 extern _rmutex _streamv_rmutex;
    191 
    192 #define STREAMV_LOCK    _rmutex_checked_request (&_streamv_rmutex, _FMR_IGNINT)
    193 #define STREAMV_UNLOCK  _rmutex_checked_release (&_streamv_rmutex)
     203extern _fmutex _streamv_fmutex;
     204
     205#define STREAMV_LOCK    _fmutex_checked_request(&_streamv_fmutex, _FMR_IGNINT)
     206#define STREAMV_UNLOCK  _fmutex_checked_release(&_streamv_fmutex)
    194207
    195208#define STREAM_LOCK(f) \
    196   (_rmutex_request (&(f)->__u.__rsem, _FMR_IGNINT) != 0 \
     209  (_fmutex_request(&(f)->__u.__fsem, _FMR_IGNINT) != 0 \
    197210   ? abort () : (void)0)
    198211
    199212#define STREAM_UNLOCK(f) \
    200   (_rmutex_release (&(f)->__u.__rsem) != 0 ? abort () : (void)0)
     213  (_fmutex_release(&(f)->__u.__fsem) != 0 ? abort() : (void)0)
    201214
    202215#define STREAM_LOCK_NOWAIT(f) \
    203   (_rmutex_request (&(f)->__u.__rsem, _FMR_NOWAIT) == 0)
    204 
    205 #define STREAM_UNLOCKED(f) _rmutex_available (&(f)->__u.__rsem)
    206 
    207 #endif /* defined (_SYS_RMUTEX_H) */
     216  (_fmutex_request(&(f)->__u.__fsem, _FMR_NOWAIT) == 0)
     217
     218#define STREAM_UNLOCKED(f) _fmutex_available(&(f)->__u.__fsem)
     219
     220#endif /* defined (_SYS_FMUTEX_H) */
    208221
    209222struct __libc_FileHandle;
     223
     224/**
     225 * Filehandle type.
     226 */
     227typedef enum __libc_FileHandleType
     228{
     229    /** Anything which is supported by the OS/2 file API.
     230     * (not used at present as those handles doesn't need special ops). */
     231    enmFH_File,
     232    /** Socket handle (BSD 4.3 stack). */
     233    enmFH_Socket43,
     234    /** Socket handle (BSD 4.4 stack). */
     235    enmFH_Socket44
     236} __LIBC_FHTYPE;
    210237
    211238/**
     
    216243{
    217244    /** Handle type. */
    218     enum
    219     {
    220         /** Anything which is supported by the OS/2 file API.
    221          * (not used at present as those handles doesn't need special ops). */
    222         enmFH_File,
    223         /** Socket handle. */
    224         enmFH_Socket
    225     }   enmType;
    226 
     245    __LIBC_FHTYPE       enmType;
    227246    /** Close operation.
    228247     * @returns 0 on success.
     
    269288     * @param   pFH         Pointer to the handle structure to operate on.
    270289     * @param   fh          It's associated filehandle.
    271      * @param   iIOControl  Which file file control operation to perform.
     290     * @param   iRequest    Which file file descriptior request to perform.
    272291     * @param   iArg        Argument which content is specific to each
    273      *                      iIOControl operation.
     292     *                      iRequest operation.
    274293     * @param   prc         Where to store the value which upon success is
    275294     *                      returned to the caller.
    276295     */
    277     int (*pfnFileControl)(struct __libc_FileHandle *pFH, int fh, int iIOControl, int iArg, int *prc);
     296    int (*pfnFileControl)(struct __libc_FileHandle *pFH, int fh, int iRequest, int iArg, int *prc);
    278297    /** I/O Control operation.
    279298     * @returns 0 on success.
     
    303322     */
    304323    int (*pfnSelect)(int cFHs, struct fd_set *pRead, struct fd_set *pWrite, struct fd_set *pExcept, struct timeval *tv, int *prc);
    305 
    306 } LIBCFHOPS, *PLIBCFHOPS/*, const * PCLIBCFHOPS*/;
    307 
     324    /** Fork notification - parent context.
     325     * If NULL it's assumed that no notifiction is needed.
     326     *
     327     * @returns 0 on success.
     328     * @returns OS/2 error code or negated errno on failure.
     329     * @param   pFH             Pointer to the handle structure to operate on.
     330     * @param   fh              It's associated filehandle.
     331     * @param   pForkHandle     The fork handle.
     332     * @param   enmOperation    The fork operation.
     333     */
     334    int (*pfnForkParent)(struct __libc_FileHandle *pFH, int fh, __LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation);
     335    /** Fork notification - child context.
     336     * Only the __LIBC_FORK_OP_FORK_CHILD operation is forwarded atm.
     337     * If NULL it's assumed that no notifiction is needed.
     338     *
     339     * @returns 0 on success.
     340     * @returns OS/2 error code or negated errno on failure.
     341     * @param   pFH             Pointer to the handle structure to operate on.
     342     * @param   fh              It's associated filehandle.
     343     * @param   pForkHandle     The fork handle.
     344     * @param   enmOperation    The fork operation.
     345     */
     346    int (*pfnForkChild)(struct __libc_FileHandle *pFH, int fh, __LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation);
     347
     348} __LIBC_FHOPS;
     349/** Pointer to file handle operations. */
     350typedef __LIBC_FHOPS *__LIBC_PFHOPS;
     351/** Pointer to const file handle operations. */
     352typedef const __LIBC_FHOPS *__LIBC_PCFHOPS;
    308353
    309354/**
     
    313358{
    314359    /** Handle flags.
    315      * Previously represented by _files / *fd_vec->flags.
     360     * See group @ref libc_ioflags in include/emx.h.
    316361     * @remark For thread safety update this atomically. */
    317     unsigned int    fFlags;
     362    volatile unsigned int   fFlags;
    318363
    319364    /** Lookahead. (whoever uses that?)
    320365     * Previously represented by _files / *fd_vec->flags.
    321366     * @remark For thread safety update this atomically. */
    322     int             iLookAhead;
     367    volatile int            iLookAhead;
    323368
    324369    /** Pointer to the operations one can perform on the handle.
    325370     * Only for special handles not supported by the OS/2 file API. */
    326     PLIBCFHOPS      pOps;
    327 
    328 } LIBCFH, *PLIBCFH;
     371    __LIBC_PCFHOPS          pOps;
     372
     373} __LIBC_FH;
     374/** Pointer to filehandle. */
     375typedef __LIBC_FH *__LIBC_PFH;
     376/* fixme!! */
     377#define LIBCFH __LIBC_FH
     378#define PLIBCFH __LIBC_PFH
     379
    329380
    330381int     __libc_FHEnsureHandles(int fh);
    331382int     __libc_FHMoreHandles(void);
    332 int     __libc_FHAllocate(int fh, unsigned fFlags, int cb, PLIBCFHOPS pOps, PLIBCFH *ppFH, int *pfh);
     383int     __libc_FHAllocate(int fh, unsigned fFlags, int cb, __LIBC_PCFHOPS pOps, PLIBCFH *ppFH, int *pfh);
    333384int     __libc_FHClose(int fh);
    334385PLIBCFH __libc_FH(int fh);
     
    359410
    360411
    361 #if defined (__cplusplus)
    362 }
    363 #endif
     412__END_DECLS
    364413
    365414#endif /* not _EMX_IO_H */
  • trunk/src/emx/include/emx/locale.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r1453 r1454  
    1 /*
    2     Locale support implementation through OS/2 Unicode API.
    3     Copyright (c) 2003 InnoTek Systemberatung GmbH
    4 
    5     For conditions of distribution and use, see the file COPYING.
    6 
    7     Internal header file.
    8 */
    9 
    10 #ifndef _local_private_h_
    11 #define _local_private_h_
    12 
    13 #include <sys/types.h>
    14 #include <uconv.h>
    15 
    16 int __to_ucs (UconvObject uconv_obj, const unsigned char *sbcs, size_t len,
    17   UniChar *ucs);
    18 int __from_ucs (UconvObject uconv_obj, UniChar c, unsigned char *sbcs,
    19   size_t len);
    20 void __convert_codepage (const char *cp, UniChar *ucp);
    21 void __do_Unicode (UconvObject *uconv, char *s, void *arg,
    22    int (*xform) (UniChar *, void *));
    23 
    24 #endif
    25 
     1/* dead */
  • trunk/src/emx/include/emx/umalloc.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1453 r1454  
    1313#include <sys/builtin.h>
    1414#include <sys/fmutex.h>
    15 #include <sys/rmutex.h>
    1615#include <sys/uflags.h>
    1716
     
    688687     because the heap is probably not in a consistent state. */
    689688
    690   _rmutex rsem;
     689  _fmutex fsem;
    691690
    692691  /* This member is used for various purposes by _uheapchk():
     
    756755void *  __libc_HimemDefaultAlloc(Heap_t Heap, size_t *pcb, int *pfClean);
    757756void    __libc_HimemDefaultRelease(Heap_t Heap, void *pv, size_t cb);
     757#if 0
     758int     __libc_HimemDefaultExpand(Heap_t Heap, void *pvBase, size_t cbOld, size_t *pcbNew, int *pfClean);
     759void    __libc_HimemDefaultShrink(Heap_t Heap, void *pvBase, size_t cbOld, size_t *pcbNew);
     760#endif
    758761int     __libc_HasHighMem(void);
    759762/** @} */
     
    773776static __inline__ void _um_heap_lock (Heap_t h)
    774777{
    775   _rmutex_checked_request (&h->rsem, _FMR_IGNINT);
     778  _fmutex_checked_request (&h->fsem, _FMR_IGNINT);
    776779}
    777780
     
    779782static __inline__ void _um_heap_unlock (Heap_t h)
    780783{
    781   _rmutex_checked_release (&h->rsem);
     784  _fmutex_checked_release (&h->fsem);
    782785}
    783786
  • trunk/src/emx/include/locale.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1453 r1454  
    11/*
    2     Locale support implementation through OS/2 Unicode API.
    3     Copyright (c) 2003 InnoTek Systemberatung GmbH
     2 * Copyright (c) 1991, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *    notice, this list of conditions and the following disclaimer in the
     12 *    documentation and/or other materials provided with the distribution.
     13 * 3. All advertising materials mentioning features or use of this software
     14 *    must display the following acknowledgement:
     15 *      This product includes software developed by the University of
     16 *      California, Berkeley and its contributors.
     17 * 4. Neither the name of the University nor the names of its contributors
     18 *    may be used to endorse or promote products derived from this software
     19 *    without specific prior written permission.
     20 *
     21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31 * SUCH DAMAGE.
     32 *
     33 *      @(#)locale.h    8.1 (Berkeley) 6/2/93
     34 * $FreeBSD: src/include/locale.h,v 1.7 2002/10/09 09:19:27 tjr Exp $
     35 */
    436
    5     For conditions of distribution and use, see the file COPYING.
     37/** @file
     38 * FreeBSD 5.1
     39 * @changed bird: removed unsupported values and added comments to lconv.
     40 * @changed bird: Changed the LC_* values to match those unidef.h sets.
     41 */
    642
    7     POSIX locale implementation.
    8 */
     43#ifndef _LOCALE_H_
     44#define _LOCALE_H_
    945
    10 #ifndef _LOCALE_H
    11 #define _LOCALE_H
     46struct lconv {
     47        char    *decimal_point;         /** non-monetary decimal point */
     48        char    *thousands_sep;         /** non-monetary thousands separator */
     49        char    *grouping;              /** non-monetary size of grouping */
     50        char    *int_curr_symbol;       /** international currency symbol and separator */
     51        char    *currency_symbol;       /** local currency symbol */
     52        char    *mon_decimal_point;     /** monetary decimal point */
     53        char    *mon_thousands_sep;     /** monetary thousands separator */
     54        char    *mon_grouping;          /** monetary size of grouping */
     55        char    *positive_sign;         /** non-negative values sign */
     56        char    *negative_sign;         /** negative values sign */
     57        char    int_frac_digits;        /** number of fractional digits - int currency */
     58        char    frac_digits;            /** number of fractional digits - local currency */
     59        char    p_cs_precedes;          /** (non-neg curr sym) 1-precedes, 0-succeeds */
     60        char    p_sep_by_space;         /** (non-neg curr sym) 1-space, 0-no space */
     61        char    n_cs_precedes;          /** (neg curr sym) 1-precedes, 0-succeeds */
     62        char    n_sep_by_space;         /** (neg curr sym) 1-space, 0-no space */
     63        char    p_sign_posn;            /** positioning of non-negative monetary sign */
     64        char    n_sign_posn;            /** positioning of negative monetary sign */
     65#if 0 /* bird: we don't have this information (it's C99 stuff btw). */
     66        char    int_p_cs_precedes;
     67        char    int_n_cs_precedes;
     68        char    int_p_sep_by_space;
     69        char    int_n_sep_by_space;
     70        char    int_p_sign_posn;
     71        char    int_n_sign_posn;
     72#endif
     73};
    1274
    13 #if defined (__cplusplus)
    14 extern "C" {
     75#ifndef NULL
     76#define NULL    0
    1577#endif
    1678
    17 /* lconv and categories */
    18 #include <sys/locale.h>
     79#define LC_ALL          (-1) /* bird: was 0 */
     80#define LC_COLLATE      0    /* bird: was 1 */
     81#define LC_CTYPE        1    /* bird: was 2 */
     82#define LC_MONETARY     2    /* bird: was 3 */
     83#define LC_NUMERIC      3    /* bird: was 4 */
     84#define LC_TIME         4    /* bird: was 5 */
     85#define LC_MESSAGES     5    /* bird: was 6 */
    1986
    20 /* Set current locale, if __locale is not NULL. Returns previous locale. */
    21 extern char *setlocale (int category, __const__ char *locale);
    22 /* Get information about current locale. */
    23 extern struct lconv *localeconv (void);
     87#define _LC_LAST        6    /* bird: was 7 */          /* marks end */
    2488
    25 #if defined (__cplusplus)
    26 }
    27 #endif
     89#include <sys/cdefs.h>
    2890
    29 #endif /* not _LOCALE_H */
     91__BEGIN_DECLS
     92struct lconv    *localeconv(void);
     93char            *setlocale(int, const char *);
     94__END_DECLS
     95
     96#endif /* _LOCALE_H_ */
  • trunk/src/emx/include/os2emx.h

    • Property cvs2svn:cvs-rev changed from 1.17 to 1.18
    r1453 r1454  
    14161416
    14171417
     1418#if 0 /* -pedantic generates annoying warnings here */
    14181419typedef struct _FTIME
    14191420{
     
    14221423  USHORT hours   : 5;
    14231424} FTIME;
     1425#else
     1426typedef struct _FTIME
     1427{
     1428  unsigned twosecs : 5;
     1429  unsigned minutes : 6;
     1430  unsigned hours   : 5;
     1431} FTIME;
     1432#endif
    14241433typedef FTIME *PFTIME;
    14251434
     1435#if 0 /* -pedantic generates annoying warnings here */
    14261436typedef struct _FDATE
    14271437{
     
    14301440  USHORT year  : 7;
    14311441} FDATE;
     1442#else
     1443typedef struct _FDATE
     1444{
     1445  unsigned day   : 5;
     1446  unsigned month : 4;
     1447  unsigned year  : 7;
     1448} FDATE;
     1449#endif
    14321450typedef FDATE *PFDATE;
    14331451
     
    80688086#define MLE_RGB                         1
    80698087
     8088#define MLE_INDEX                       0
     8089#define MLE_RGB                         1
     8090
    80708091#define MLS_WORDWRAP                    0x0001
    80718092#define MLS_BORDER                      0x0002
     
    1331513336
    1331613337
     13338#ifdef INCL_EXAPIS
     13339
     13340/** Allocate memory at given location. */
     13341#define OBJ_LOCATION    0x01000000
     13342/** The allocated memory object should be duplicated/opened in forked process. */
     13343#define OBJ_FORK        0x02000000
     13344
     13345/**
     13346 * Extended DosAllocMem().
     13347 *
     13348 * @returns See DosAllocMem().
     13349 * @param   ppv     Where to store the address of the allocated memory.
     13350 *                  If OBJ_LOCATION is specified in the flFlags *ppv will be the
     13351 *                  address the object must be allocated at.
     13352 * @param   cb      Number of bytes to allocate.
     13353 * @param   flFlags Allocation flags. This API supports the same flags as DosAllocMem()
     13354 *                  but adds OBJ_FORK and OBJ_LOCATION.
     13355 *                  If OBJ_FORK is specified the object will be automatically
     13356 *                  duplicated in the new process.
     13357 *                  If OBJ_LOCATION is specified the object will be allocated
     13358 *                  at the address specified by *ppv.
     13359 * @remark  The memory must be freed with DosFreeMemEx()!
     13360 */
     13361APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flFlags);
     13362
     13363/**
     13364 * Extended DosAllocSharedMem().
     13365 *
     13366 * @returns See DosAllocSharedMem().
     13367 * @param   ppv     Where to store the address of the allocated memory.
     13368 * @param   pszName Name of the shared memory. (optional)
     13369 * @param   cb      Number of bytes to allocate.
     13370 * @param   flFlags Allocation flags. This API supports the same flags as DosAllocSharedMem()
     13371 *                  but adds OBJ_FORK.
     13372 *                  If OBJ_FORK is specified the object will be automatically
     13373 *                  be opened in a forked() process.
     13374 * @remark  The memory must be freed with DosFreeMemEx()!
     13375 */
     13376APIRET APIENTRY DosAllocSharedMemEx(PPVOID ppv, PCSZ pszName, ULONG cb, ULONG flFlags);
     13377
     13378/**
     13379 * Extended DosGetSharedMem().
     13380 *
     13381 * @returns See DosGetSharedMem().
     13382 * @param   pv      The address of the shared memory.
     13383 * @param   flFlags Allocation flags. This API supports the same flags as DosGetSharedMem()
     13384 *                  but adds OBJ_FORK. If OBJ_FORK is specified the object will
     13385 *                  be automatically be opened in a forked() process.
     13386 * @remark  The memory must be freed with DosFreeMemEx()!
     13387 */
     13388APIRET APIENTRY DosGetSharedMemEx(PVOID pv, ULONG flFlags);
     13389
     13390/**
     13391 * Extended DosGetNamedSharedMem().
     13392 *
     13393 * @returns See DosGetNamedSharedMem().
     13394 * @param   pv      The address of the shared memory.
     13395 * @param   flFlags Allocation flags. This API supports the same flags as DosGetNamedSharedMem()
     13396 *                  but adds OBJ_FORK. If OBJ_FORK is specified the object will
     13397 *                  be automatically be opened in a forked() process.
     13398 * @remark  The memory must be freed with DosFreeMemEx()!
     13399 */
     13400APIRET APIENTRY DosGetNamedSharedMemEx(PPVOID ppv, PCSZ pszName, ULONG flFlags);
     13401
     13402/**
     13403 * Free memory allocated by DosAllocMemEx.
     13404 *
     13405 * @returns See DosFreeMem().
     13406 * @param   pv  Address of the memory to free.
     13407 */
     13408APIRET APIENTRY DosFreeMemEx(PVOID pv);
     13409
     13410/**
     13411 * Extended DosCreateEventSem() which will make sure the created semaphore is
     13412 * opened in a forked process with the same handle.
     13413 */
     13414APIRET APIENTRY DosCreateEventSemEx(PSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState);
     13415/**
     13416 * Extended DosCreateMutexSem() which will make sure the created semaphore is
     13417 * opened in a forked process with the same handle.
     13418 */
     13419APIRET APIENTRY DosCreateMutexSemEx(PSZ pszName, PHMTX phmtx, ULONG flAttr, BOOL32 fState);
     13420/**
     13421 * Extended DosOpenEventSem() which will make sure the opened semaphore is
     13422 * opened in a forked process with the same handle.
     13423 */
     13424APIRET APIENTRY DosOpenEventSemEx(PSZ pszName, PHEV phev);
     13425/**
     13426 * Extended DosOpenMutexSem() which will make sure the opened semaphore is
     13427 * opened in a forked process with the same handle.
     13428 */
     13429APIRET APIENTRY DosOpenMutexSemEx(PSZ pszName, PHMTX phmtx);
     13430/**
     13431 * Close semaphore opened or created using the extended APIs.
     13432 * @returns see DosCloseMutexSem().
     13433 * @param   hmtx    Handle to the mutex semaphore which is to be closed.
     13434 */
     13435APIRET APIENTRY DosCloseMutexSemEx(HMTX hmtx);
     13436/**
     13437 * Close semaphore opened or created using the extended APIs.
     13438 * @returns see DosCloseEventSem().
     13439 * @param   hev     Handle to the event semaphore which is to be closed.
     13440 */
     13441APIRET APIENTRY DosCloseEventSemEx(HEV hev);
     13442
     13443#ifdef INCL_EXAPIS_MAPPINGS
     13444
     13445#define DosAllocMem(a, b, c)       DosAllocMemEx((a),(b),(c) | OBJ_FORK)
     13446#define DosAllocSharedMem(a,b,c,d) DosAllocSharedMemEx((a),(b),(c),(d) | OBJ_FORK)
     13447#define DosFreeMem(a)              DosFreeMemEx((a))
     13448
     13449#define DosCreateMutexSem(a,b,c,d) DosCreateMutexSemEx((a),(b),(c),(d))
     13450#define DosCreateEventSem(a,b,c,d) DosCreateEventSemEx((a),(b),(c),(d))
     13451#define DosOpenMutexSem(a,b)       DosOpenMutexSemEx((a),(b))
     13452#define DosOpenEventSem(a,b)       DosOpenEventSemEx((a),(b))
     13453#define DosCloseMutexSem(a)        DosCloseMutexSemEx((a))
     13454#define DosCloseEventSem(a)        DosCloseEventSemEx((a))
     13455
     13456#endif /* INCL_EXAPIS_MAPPINGS */
     13457
     13458
     13459#endif /* INCL_EXAPIS */
     13460
     13461
    1331713462/* ------------------------------ THE END --------------------------------- */
    1331813463
  • trunk/src/emx/include/stdio.h

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r1453 r1454  
    197197    union
    198198    {
    199 #if defined (_SYS_RMUTEX_H)
    200         _rmutex   __rsem;
    201 #endif
    202         char      __rsem_ersatz[16];
     199#if defined (_SYS_FMUTEX_H)
     200        _fmutex   __fsem;
     201#endif
     202        char      __rsem_ersatz[8];
    203203    } __u;
    204204    /** Pointer to the stream vector which thie FILE belongs to.
  • trunk/src/emx/include/sys/fcntl.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1453 r1454  
    274274/* Open flags.
    275275   As stated in the FreeBSD part, there is supposidly a limited number of bits
    276    available. We'll try keep in suitable for 16bit just in case (don't care to
    277    check what we use right now).
     276   available. We'll try keep it suitable for 16bit just in case (don't care to
     277   check what we use right now) because that'll enable us to share a 32-bit flag
     278   variable per handle to both status (O_*) flags and descriptor (FD_*) flags.
     279
    278280   When we've disabled a few BSD flags and leave out KERNEL stuff the following
    279281   bits are available:
  • trunk/src/emx/include/sys/locale.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1453 r1454  
    1 /*
    2     Locale support implementation through OS/2 Unicode API.
    3     Copyright (c) 2003 InnoTek Systemberatung GmbH
    4 
    5     For conditions of distribution and use, see the file COPYING.
    6 
    7     Private header file for locale support.
    8 */
    9 
    10 #ifndef __SYS_LOCALE_H__
    11 #define __SYS_LOCALE_H__
    12 
    13 /* To avoid conflicts with unidef.h we should use same values as there. */
    14 #define LC_ALL                  (-1)
    15 #define LC_COLLATE              0
    16 #define LC_CTYPE                1
    17 #define LC_NUMERIC              2
    18 #define LC_MONETARY             3
    19 #define LC_TIME                 4
    20 #define LC_MESSAGES             5
    21 #define __LC_COUNT 6
    22 
    23 /* Bit masks for __locale_global.ctype -
    24    !NOTE! - these have identical values to the CT_* to speed up setlocale(). */
    25 #define __UPPER     0x0001      /* Upper case alphabetic character. */
    26 #define __LOWER     0x0002      /* Lower case alphabetic character. */
    27 #define __DIGIT     0x0004      /* Digits 0-9. */
    28 #define __SPACE     0x0008      /* White space and line ends. */
    29 #define __PUNCT     0x0010      /* Punctuation marks. */
    30 #define __CNTRL     0x0020      /* Control and format characters. */
    31 #define __BLANK     0x0040      /* Space and tab. */
    32 #define __XDIGIT    0x0080      /* Hex digits. */
    33 #define __ALPHA     0x0100      /* Letters and linguistic marks. */
    34 #define __ALNUM     0x0200      /* Alphanumeric. */
    35 #define __GRAPH     0x0400      /* All except controls and space. */
    36 #define __PRINT     0x0800      /* Everything except controls. */
    37 #define __NUMBER    0x1000      /* Integral number. */
    38 #define __SYMBOL    0x2000      /* Symbol. */
    39 #define __ASCII     0x8000      /* In standard ASCII set. */
    40 
    41 /* Locale information structure. */
    42 struct lconv
    43 {
    44   char *decimal_point;          /* non-monetary decimal point */
    45   char *thousands_sep;          /* non-monetary thousands separator */
    46   char *grouping;               /* non-monetary size of grouping */
    47   char *int_curr_symbol;        /* international currency symbol and separator */
    48   char *currency_symbol;        /* local currency symbol */
    49   char *mon_decimal_point;      /* monetary decimal point */
    50   char *mon_thousands_sep;      /* monetary thousands separator */
    51   char *mon_grouping;           /* monetary size of grouping */
    52   char *positive_sign;          /* non-negative values sign */
    53   char *negative_sign;          /* negative values sign */
    54   char int_frac_digits;         /* number of fractional digits - int currency */
    55   char frac_digits;             /* number of fractional digits - local currency */
    56   char p_cs_precedes;           /* (non-neg curr sym) 1-precedes, 0-succeeds */
    57   char p_sep_by_space;          /* (non-neg curr sym) 1-space, 0-no space */
    58   char n_cs_precedes;           /* (neg curr sym) 1-precedes, 0-succeeds */
    59   char n_sep_by_space;          /* (neg curr sym) 1-space, 0-no space */
    60   char p_sign_posn;             /* positioning of non-negative monetary sign */
    61   char n_sign_posn;             /* positioning of negative monetary sign */
    62   /** @todo C99
    63 char     int_n_cs_precedes
    64 char     int_n_sep_by_space
    65 char     int_n_sign_posn
    66 char     int_p_cs_precedes
    67 char     int_p_sep_by_space
    68 char     int_p_sign_posn
    69   */
    70 };
    71 
    72 
    73 #ifdef __INTERNAL_DEFS
    74 
    75 #include <uconv.h>
    76 
    77 /* This structure keeps the time formatting rules. */
    78 struct __locale_time
    79 {
    80   char *smonths [12];           /* Short month names */
    81   char *lmonths [12];           /* Long month names */
    82   char *swdays [7];             /* Short weekday names */
    83   char *lwdays [7];             /* Long weekday names */
    84   char *date_time_fmt;          /* Date and time format */
    85   char *date_fmt;               /* Date format */
    86   char *time_fmt;               /* Time format */
    87   char *am, *pm;                /* AM and PM strings */
    88 };
    89 
    90 /* There is one global object of this type that contains integral
    91    information about last selected (with setlocale()) locale.
    92    The locale information itself is split into parts to avoid linking
    93    unused data into programs that use just the "C" locale and just
    94    a few functions that use locale data (such as strdate()). */
    95 struct __locale_global
    96 {
    97   /* Lock for multi-threaded operations. */
    98   signed char /* _smutex */ lock; /* Avoid including builtin.h & smutex.h */
    99   /* Category names. */
    100   char *name [__LC_COUNT + 1];
    101 };
    102 
    103 /* This structure contains the uppercase/lowercase tables. */
    104 struct __locale_ctype
    105 {
    106   /* Bit flags for every character (for isXXX() function series) */
    107   unsigned short cflags [256];
    108   /* All uppercased characters */
    109   unsigned char upcase [256];
    110   /* All lowercased characters */
    111   unsigned char locase [256];
    112   /* MBCS prefixes. Two bits per character. */
    113   unsigned char mbcsprefix [256/4];
    114   /* The converter object to convert to and from selected codepage
    115      (used with MBCS codepages only) */
    116   UconvObject uconv;
    117   /* The locale object. */
    118   LocaleObject locale;
    119   /* Non-zero if there are any MBCS prefix characters in codepage */
    120   char mbcs;
    121 };
    122 
    123 struct __locale_collate
    124 {
    125   /* Character weight for SBCS codepages */
    126   unsigned char weight [256];
    127   /* MBCS prefixes. Two bits per character. */
    128   unsigned char mbcsprefix [256/4];
    129   /* The converter object to convert to and from selected codepage
    130      (used with MBCS codepages only) */
    131   UconvObject uconv;
    132   /* The locale object. */
    133   LocaleObject locale;
    134   /* Non-zero if there are any MBCS prefix characters in codepage */
    135   char mbcs;
    136 };
    137 
    138 /* Handy macros for working with (__locale_ctype|__locale_collate).mbcsprefix */
    139 #define SET_MBCS_PREFIX(s,c,v) \
    140   s [((unsigned char)c) >> 2] |= (v) << (2 * ((c) & 3))
    141 #define LEN_MBCS_PREFIX(s,c) \
    142   ((s [((unsigned char)c) >> 2] >> (2 * ((c & 3) ^ 3))) & 3)
    143 #define IS_MBCS_PREFIX(s,c) \
    144   (LEN_MBCS_PREFIX(s.mbcsprefix,c) != 1)
    145 #define CHK_MBCS_PREFIX(s,c,v) \
    146   ((v = LEN_MBCS_PREFIX(s.mbcsprefix,c)) > 1)
    147 
    148 /* A static constant string denoting the "C" locale. */
    149 extern const char __locale_C[2];
    150 
    151 /* Global locale information. */
    152 extern struct __locale_global __locale;
    153 /* String collation information. */
    154 extern struct __locale_collate __locale_collate;
    155 /* Character case conversion tables. */
    156 extern struct __locale_ctype __locale_ctype;
    157 /* Locale information structure. */
    158 extern struct lconv __locale_lconv;
    159 /* Date / time formatting rules. */
    160 extern struct __locale_time __locale_time;
    161 
    162 /* Convert a string to Unicode, apply some transform and convert back. */
    163 extern void __do_Unicode (UconvObject *uconv, char *s, void *arg,
    164   int (*xform) (UniChar *, void *));
    165 /* Convert a MBCS character to Unicode; returns number of bytes in MBCS char. */
    166 extern int __to_ucs (UconvObject, const unsigned char *, size_t, UniChar *);
    167 /* Convert a Unicode character to MBCS */
    168 extern int __from_ucs (UconvObject, UniChar, unsigned char *, size_t);
    169 
    170 #else
    171 
    172 /* Simplified extern definitions for inline functions usage */
    173 
    174 /* Character case conversion tables. */
    175 extern struct
    176 {
    177   unsigned short cflags [256];
    178   unsigned char upcase [256];
    179   unsigned char locase [256];
    180 } __locale_ctype;
    181 
    182 #endif /* __INTERNAL_DEFS */
    183 
    184 #endif /* __SYS_LOCALE_H__ */
     1/* dead */
  • trunk/src/emx/include/sys/resource.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1453 r1454  
    1 /* sys/resource.h (emx+gcc) */
     1/*
     2 * Copyright (c) 1982, 1986, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *    notice, this list of conditions and the following disclaimer in the
     12 *    documentation and/or other materials provided with the distribution.
     13 * 3. All advertising materials mentioning features or use of this software
     14 *    must display the following acknowledgement:
     15 *      This product includes software developed by the University of
     16 *      California, Berkeley and its contributors.
     17 * 4. Neither the name of the University nor the names of its contributors
     18 *    may be used to endorse or promote products derived from this software
     19 *    without specific prior written permission.
     20 *
     21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31 * SUCH DAMAGE.
     32 *
     33 *      @(#)resource.h  8.4 (Berkeley) 1/9/95
     34 * $FreeBSD: src/sys/sys/resource.h,v 1.19 2003/02/16 13:30:29 phk Exp $
     35 */
     36
     37/** @file
     38 * FreeBSD 5.1
     39 */
     40
     41#ifndef _SYS_RESOURCE_H_
     42#define _SYS_RESOURCE_H_
     43
     44/*
     45 * Process priority specifications to get/setpriority.
     46 */
     47#define PRIO_MIN        -20
     48#define PRIO_MAX        20
     49#ifdef _KERNEL
     50#define PRIO_TOTAL      (PRIO_MAX - PRIO_MIN)
     51#endif /* _KERNEL */
     52
     53#define PRIO_PROCESS    0
     54#define PRIO_PGRP       1
     55#define PRIO_USER       2
     56
     57/*
     58 * Resource utilization information.
     59 */
     60
     61#define RUSAGE_SELF     0
     62#define RUSAGE_CHILDREN -1
     63
     64struct rusage {
     65        struct timeval ru_utime;        /* user time used */
     66        struct timeval ru_stime;        /* system time used */
     67        long    ru_maxrss;              /* max resident set size */
     68#define ru_first        ru_ixrss
     69        long    ru_ixrss;               /* integral shared memory size */
     70        long    ru_idrss;               /* integral unshared data " */
     71        long    ru_isrss;               /* integral unshared stack " */
     72        long    ru_minflt;              /* page reclaims */
     73        long    ru_majflt;              /* page faults */
     74        long    ru_nswap;               /* swaps */
     75        long    ru_inblock;             /* block input operations */
     76        long    ru_oublock;             /* block output operations */
     77        long    ru_msgsnd;              /* messages sent */
     78        long    ru_msgrcv;              /* messages received */
     79        long    ru_nsignals;            /* signals received */
     80        long    ru_nvcsw;               /* voluntary context switches */
     81        long    ru_nivcsw;              /* involuntary " */
     82#define ru_last         ru_nivcsw
     83};
     84
     85/*
     86 * Resource limits
     87 */
     88#define RLIMIT_CPU      0               /* cpu time in milliseconds */
     89#define RLIMIT_FSIZE    1               /* maximum file size */
     90#define RLIMIT_DATA     2               /* data size */
     91#define RLIMIT_STACK    3               /* stack size */
     92#define RLIMIT_CORE     4               /* core file size */
     93#define RLIMIT_RSS      5               /* resident set size */
     94#define RLIMIT_MEMLOCK  6               /* locked-in-memory address space */
     95#define RLIMIT_NPROC    7               /* number of processes */
     96#define RLIMIT_NOFILE   8               /* number of open files */
     97#define RLIMIT_SBSIZE   9               /* maximum size of all socket buffers */
     98#define RLIMIT_VMEM     10              /* virtual process size (inclusive of mmap) */
     99
     100#define RLIM_NLIMITS    11              /* number of resource limits */
     101
     102#define RLIM_INFINITY   ((rlim_t)(((u_quad_t)1 << 63) - 1))
     103
     104
     105/*
     106 * Resource limit string identifiers
     107 */
     108
     109#ifdef _RLIMIT_IDENT
     110static char *rlimit_ident[] = {
     111        "cpu",
     112        "fsize",
     113        "data",
     114        "stack",
     115        "core",
     116        "rss",
     117        "memlock",
     118        "nproc",
     119        "nofile",
     120        "sbsize",
     121        "vmem",
     122};
     123#endif
     124
     125struct orlimit {
     126        int32_t rlim_cur;               /* current (soft) limit */
     127        int32_t rlim_max;               /* maximum value for rlim_cur */
     128};
     129
     130struct rlimit {
     131        rlim_t  rlim_cur;               /* current (soft) limit */
     132        rlim_t  rlim_max;               /* maximum value for rlim_cur */
     133};
     134
     135/* Load average structure. */
     136struct loadavg {
     137        fixpt_t ldavg[3];
     138        long    fscale;
     139};
     140
     141#define CP_USER         0
     142#define CP_NICE         1
     143#define CP_SYS          2
     144#define CP_INTR         3
     145#define CP_IDLE         4
     146#define CPUSTATES       5
     147
     148#ifdef _KERNEL
     149extern struct loadavg averunnable;
     150extern long cp_time[CPUSTATES];
     151
     152int     dosetrlimit(struct thread *, u_int, struct rlimit *);
     153
     154#else
     155#include <sys/cdefs.h>
     156
     157__BEGIN_DECLS
     158int     getpriority(int, int);
     159int     getrlimit(int, struct rlimit *);
     160int     getrusage(int, struct rusage *);
     161int     setpriority(int, int, int);
     162int     setrlimit(int, const struct rlimit *);
     163__END_DECLS
     164
     165#endif  /* _KERNEL */
     166#endif  /* !_SYS_RESOURCE_H_ */
  • trunk/src/emx/include/sys/rmutex.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1453 r1454  
    11/* sys/rmutex.h (emx+gcc) */
    2 
    3 /* _rmutex semaphores are registered _fmutex semaphores.  They are a
    4    bit bigger than _fmutex metaphores but they are inherited by child
    5    processes created with fork().  Shared _rmutex semaphores behave
    6    like _fmutex semaphores, ie, they are not registered and therefore
    7    not inherited by child processes created with fork().  (As malloc()
    8    uses _rmutex semaphores, we have to support shared semaphores
    9    anyway.) */
    102
    113/* This header requires <sys/builtin.h> and <sys/fmutex.h>. */
     
    146#define _SYS_RMUTEX_H
    157
    16 #if defined (__cplusplus)
    17 extern "C" {
    18 #endif
     8#warning "_rmutex is obsoleted. use _fmutex!"
    199
    20 /* See also <emx/io.h> and /emx/test/internal.c. */
    21 typedef struct __rmutex
    22 {
    23   struct __rmutex *next;
    24   struct __rmutex *prev;
    25   _fmutex fm;
    26   unsigned char flags;
    27   unsigned short count;
    28 } _rmutex;
     10#define _rmutex             _fmutex
     11#define _rmutex_request     _fmutex_request
     12#define _rmutex_release     _fmutex_release
     13#define _rmutex_close       _fmutex_close
     14#define _rmutex_create      _fmutex_create
     15#define _rmutex_open        _fmutex_open
     16#define _rmutex_available   _fmutex_available
     17#define _rmutex_dummy       _fmutex_dummy
     18#define _rmutex_checked_request _fmutex_checked_request
     19#define _rmutex_checked_release _fmutex_checked_release
     20#define _rmutex_checked_close   _fmutex_checked_close
     21#define _rmutex_checked_create  _fmutex_checked_create
     22#define _rmutex_checked_open    _fmutex_checked_open
    2923
    3024
    31 static __inline__ unsigned _rmutex_request (_rmutex *sem, unsigned flags)
    32 {
    33   return _fmutex_request (&sem->fm, flags);
    34 }
    35 
    36 
    37 static __inline__ unsigned _rmutex_release (_rmutex *sem)
    38 {
    39   return _fmutex_release (&sem->fm);
    40 }
    41 
    42 
    43 static __inline__ int _rmutex_available (_rmutex *sem)
    44 {
    45   return _fmutex_available (&sem->fm);
    46 }
    47 
    48 
    49 unsigned _rmutex_close (_rmutex *);
    50 unsigned _rmutex_create (_rmutex *, unsigned);
    51 unsigned _rmutex_open (_rmutex *);
    52 void _rmutex_dummy (_rmutex *);
    53 
    54 
    55 static __inline__ void _rmutex_checked_release (_rmutex *sem)
    56 {
    57   _fmutex_checked_release (&sem->fm);
    58 }
    59 
    60 
    61 static __inline__ void _rmutex_checked_request (_rmutex *sem, unsigned flags)
    62 {
    63   _fmutex_checked_request (&sem->fm, flags);
    64 }
    65 
    66 
    67 void _rmutex_checked_close (_rmutex *);
    68 void _rmutex_checked_create (_rmutex *, unsigned);
    69 void _rmutex_checked_open (_rmutex *);
    70 
    71 #if defined (__cplusplus)
    72 }
    73 #endif
    74 
    7525#endif /* not _SYS_RMUTEX_H */
  • trunk/src/emx/include/unistd.h

    • Property cvs2svn:cvs-rev changed from 1.15 to 1.16
    r1453 r1454  
    183183int      dup(int);
    184184int      dup2(int, int);
    185 /** @todo int    eaccess(const char *, int); */
     185int      eaccess(const char *, int);
    186186int      execl(const char *, const char *, ...);
    187187int      execle(const char *, const char *, ...);
Note: See TracChangeset for help on using the changeset viewer.