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/sys
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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 */
Note: See TracChangeset for help on using the changeset viewer.