Changeset 1505


Ignore:
Timestamp:
Sep 12, 2004, 9:40:29 PM (21 years ago)
Author:
bird
Message:

Adding BSD stuff like there was no tomorrow.

Location:
trunk/src/emx
Files:
28 added
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    2828#define __InnoTekLIBC_backend_h__
    2929
     30#include <sys/cdefs.h>
     31#include <sys/types.h>
     32
     33__BEGIN_DECLS
     34
    3035#ifndef __LIBC_THREAD_DECLARED
    3136#define __LIBC_THREAD_DECLARED
    3237typedef struct __libc_thread *__LIBC_PTHREAD, **__LIBC_PPTHREAD;
    3338#endif
     39struct statfs;
    3440
    3541
    36 /** @group __libc_Back_thread   LIBC Backend - Threads
     42/** @defgroup __libc_Back_thread   LIBC Backend - Threads
    3743 * @{ */
    3844
     
    7581/** @} */
    7682
    77 #if defined (__cplusplus)
    78 }
     83
     84/** @defgroup __libc_Back_fh   LIBC Backend - File Handles.
     85 * @{ */
     86
     87/**
     88 * Try resolve a filehandle to a path.
     89 *
     90 * @returns 0 on success.
     91 * @returns -1 and errno on failure.
     92 * @param   fh          The file handle.
     93 * @param   pszPath     Where to store the path.
     94 * @param   cchPath     The size of he buffer pointed to by pszPath.
     95 */
     96int __libc_Back_fhToPath(int fh, char *pszPath, size_t cchPath);
     97
     98/** @} */
     99
     100
     101/** @defgroup __libc_Back_fs   LIBC Backend - File System
     102 * @{ */
     103
     104/**
     105 * Get the statistics for the filesystem which pszPath is located on.
     106 *
     107 * @returns 0 on success.
     108 * @returns -1 and errno on failure.
     109 * @param   pszPath     The path to somewhere in the filesystem.
     110 * @param   pStatFs     Where to store the obtained information.
     111 */
     112int __libc_Back_fsStat(const char *pszPath, struct statfs *pStatFs);
     113
     114/**
     115 * Get file system statistics
     116 *
     117 * @returns 0 on success.
     118 * @returns -1 and errno on failure.
     119 * @param   fh          The filehandle of any file within the mounted file system.
     120 * @param   pStatFs     Where to store the statistics.
     121 */
     122int __libc_Back_fsStatFH(int fh, struct statfs *pStatFs);
     123
     124/**
     125 * Get the statistics for all the mounted filesystems.
     126 *
     127 * @returns Number of returned statfs structs on success.
     128 * @returns Number of mounted filesystems on success if paStatFS is NULL
     129 * @returns -1 and errno on failure.
     130 * @param   paStatFs    Where to to store the statistics.
     131 * @parma   cStatFS     Number of structures the array pointed to by paStatFs can hold.
     132 * @param   fFlags      Flags, currently ignored.
     133 */
     134int __libc_Back_fsStats(struct statfs *paStatFs, unsigned cStatFs, unsigned fFlags);
     135
     136/**
     137 * Schedules all file system buffers for writing.
     138 *
     139 * See sync() for OS/2 limitations.
     140 */
     141void __libc_Back_fsSync(void);
     142
     143/** @} */
     144
     145
     146
     147/** @defgroup __libc_Back_misc   LIBC Backend - Miscellaneous
     148 * @{ */
     149
     150/**
     151 * Gets the system load averages.
     152 * The load is the average values of ready and running threads(/processes)
     153 * over the last 1, 5 and 15 minuttes.
     154 *
     155 * @returns 0 on success.
     156 * @returns -1 and errno on failure.
     157 * @param   pardAvgs    Where to store the samples.
     158 * @param   cAvgs       Number of samples to get. Max is 3.
     159 * @remark  See OS/2 limitations in getloadavg().
     160 */
     161int __libc_Back_miscLoadAvg(double *pardAvgs, unsigned cAvgs);
     162
     163/** @} */
     164
     165__END_DECLS
     166
    79167#endif
    80 
    81 #endif /* not _EMX_SYSCALLS_H */
  • trunk/src/emx/include/InnoTekLIBC/sharedpm.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1504 r1505  
    298298
    299299/**
     300 * The structure contains the system load averages.
     301 */
     302typedef struct __libc_SPMLoadAvg
     303{
     304    /** Array of the three stamples.
     305     * The entries are for 1, 5 and 15 min averages respectively.
     306     *
     307     * The samples them selfs are stored as integers and not as a
     308     * double as the interface returns. The reason is that this is smaller
     309     * and it's what both BSD and Linux is doing. The fraction part is
     310     * the lower 11 bits (this is also identical to BSD and Linux).
     311     */
     312    uint32_t                    u32Samples[3];
     313    /** Timestamp of the last update. */
     314    unsigned                    uTimestamp;
     315} __LIBC_SPMLOADAVG;
     316/** Pointer to load averages. */
     317typedef __LIBC_SPMLOADAVG *__LIBC_PSPMLOADAVG;
     318
     319
     320/**
    300321 * This is the header of the LIBC shared memory.
    301322 */
     
    336357        char                    ach[16];
    337358    };
     359
     360    /** System Load Averages. */
     361    __LIBC_SPMLOADAVG           LoadAvg;
     362
    338363    /* The rest of the block, up to cbProcess, is undefined in this version.
    339364     * Future versions of LIBC may use this area assuming it's initalized with zeros.
     
    531556
    532557/**
     558 * Get the stored load average samples.
     559 *
     560 * @returns 0 on success.
     561 * @returns -1 and errno on failure.
     562 * @param   pLoadAvg    Where to store the load average samples.
     563 * @param   puTimestamp Where to store the current timestamp.
     564 */
     565int     __libc_spmGetLoadAvg(__LIBC_PSPMLOADAVG  pLoadAvg, unsigned *puTimestamp);
     566
     567/**
     568 * Get the stored load average samples.
     569 *
     570 * @returns 0 on success.
     571 * @returns -1 and errno on failure.
     572 * @param   pLoadAvg    Where to store the load average samples.
     573 */
     574int     __libc_spmSetLoadAvg(const __LIBC_SPMLOADAVG *pLoadAvg);
     575
     576/**
    533577 * Checks the SPM memory for trouble.
    534578 *
  • trunk/src/emx/include/arpa/inet.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1504 r1505  
    5454#include <sys/types.h>
    5555#include <sys/cdefs.h>
     56
     57/*
     58 * Internet address (a structure for historical reasons)
     59 */
     60#ifndef _STRUCT_IN_ADDR_DECLARED
     61struct in_addr {
     62        u_long s_addr;
     63};
     64#define _STRUCT_IN_ADDR_DECLARED
     65#endif
     66
    5667#ifndef TCPV40HDRS
    5768int             TCPCALL inet_aton (const char *, struct in_addr *);
  • trunk/src/emx/include/dirent.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1504 r1505  
    9999} DIR;
    100100
     101#if 0 /* bird: we do it differently. */
    101102#define dirfd(dirp)     ((dirp)->dd_fd)
     103#else                        /* bird */
     104#define dirfd(dirp)     (-2) /* bird */
     105#endif                       /* bird */
    102106
    103107/* flags for opendir2 */
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.9 to 1.10
    r1504 r1505  
    358358{
    359359    /** Handle flags.
    360      * See group @ref libc_ioflags in include/emx.h.
     360     * See group @ref libc_ioflags in include/emx/io.h.
    361361     * @remark For thread safety update this atomically. */
    362362    volatile unsigned int   fFlags;
  • trunk/src/emx/include/grp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    11/* grp.h (emx+gcc) */
    22
    3 #ifndef _GRP_H
     3#ifndef _GRP_H_
     4#define _GRP_H_
    45#define _GRP_H
    56
    6 #if defined (__cplusplus)
    7 extern "C" {
     7#include <sys/cdefs.h>
     8#include <sys/_types.h>
     9
     10__BEGIN_DECLS
     11
     12#ifndef _POSIX_SOURCE
     13#define _PATH_GROUP             "/etc/group"
    814#endif
    915
    10 #if !defined (_GID_T)
    11 #define _GID_T
    12 typedef int gid_t;
     16#if !defined(_GID_T_DECLARED) && !defined(_GID_T)
     17typedef __gid_t gid_t;
     18#define _GID_T_DECLARED
     19#define _GID_T
    1320#endif
     21
     22#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T)
     23typedef __size_t size_t;
     24#define _SIZE_T_DECLARED
     25#define _SIZE_T
     26#endif
     27
    1428
    1529struct group
    1630{
    1731  char *gr_name;
     32  char *gr_passwd;
    1833  gid_t gr_gid;
    1934  char **gr_mem;
    2035};
    2136
    22 struct group *getgrgid (gid_t);
    23 struct group *getgrnam (__const__ char *);
     37struct group   *getgrgid (gid_t);
     38struct group   *getgrnam (const char *);
    2439
    25 #if defined (__cplusplus)
    26 }
     40#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
     41struct group   *getgrent(void);
     42int             setgrent(void);
     43void            endgrent(void);
     44void            setgrfile(const char *);
     45int             setgroupent(int);
     46int             getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
     47int             getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
    2748#endif
    2849
    29 #endif /* not _GRP_H */
     50#if __BSD_VISIBLE
     51const char     *group_from_gid(gid_t, int);
     52int             getgrent_r(struct group *, char *, size_t, struct group **);
     53int             setgroupent(int);
     54#endif
     55
     56__END_DECLS
     57
     58#endif /* not _GRP_H_ */
  • trunk/src/emx/include/netdb.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1504 r1505  
    3434 *
    3535 *      from: @(#)netdb.h       5.15 (Berkeley) 4/3/91
    36  *      netdb.h,v 1.6 2004/08/09 10:35:32 bird Exp
     36 *      netdb.h,v 1.7 2004/09/12 19:40:25 bird Exp
    3737 */
    3838
     
    196196#endif
    197197
     198/* New BSD Additions. */
     199int             innetgr(const char *, const char *, const char *, const char *);
     200void            setnetgrent(const char *);
     201int             getnetgrent(char **, char **, char **);
     202void            endnetgrent(void);
     203
     204
    198205
    199206/* OS2 Additions */
  • trunk/src/emx/include/netinet/in.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1504 r1505  
    106106 * Internet address (a structure for historical reasons)
    107107 */
     108#ifndef _STRUCT_IN_ADDR_DECLARED
    108109struct in_addr {
    109110        u_long s_addr;
    110111};
     112#define _STRUCT_IN_ADDR_DECLARED
     113#endif
     114
    111115
    112116/*
  • trunk/src/emx/include/pwd.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1504 r1505  
    1 /* pwd.h (emx+gcc) */
     1/*-
     2 * Copyright (c) 1989, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 * (c) UNIX System Laboratories, Inc.
     5 * All or some portions of this file are derived from material licensed
     6 * to the University of California by American Telephone and Telegraph
     7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
     8 * the permission of UNIX System Laboratories, Inc.
     9 *
     10 * Redistribution and use in source and binary forms, with or without
     11 * modification, are permitted provided that the following conditions
     12 * are met:
     13 * 1. Redistributions of source code must retain the above copyright
     14 *    notice, this list of conditions and the following disclaimer.
     15 * 2. Redistributions in binary form must reproduce the above copyright
     16 *    notice, this list of conditions and the following disclaimer in the
     17 *    documentation and/or other materials provided with the distribution.
     18 * 3. All advertising materials mentioning features or use of this software
     19 *    must display the following acknowledgement:
     20 *      This product includes software developed by the University of
     21 *      California, Berkeley and its contributors.
     22 * 4. Neither the name of the University nor the names of its contributors
     23 *    may be used to endorse or promote products derived from this software
     24 *    without specific prior written permission.
     25 *
     26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36 * SUCH DAMAGE.
     37 *
     38 *      @(#)pwd.h       8.2 (Berkeley) 1/21/94
     39 * $FreeBSD: src/include/pwd.h,v 1.15 2003/04/18 14:11:17 nectar Exp $
     40 */
    241
    3 #ifndef _PWD_H
    4 #define _PWD_H
     42/**
     43 * FreeBSD 5.2
     44 * @changed bird: some EMXisms.
     45 */
    546
    6 #if defined (__cplusplus)
    7 extern "C" {
     47#ifndef _PWD_H_
     48#define _PWD_H_
     49#define _PWD_H                          /* bird: EMX */
     50
     51#include <sys/cdefs.h>
     52#include <sys/_types.h>
     53
     54#if !defined(_GID_T_DECLARED) && !defined(_GID_T)   /* bird */
     55typedef __gid_t gid_t;
     56#define _GID_T_DECLARED
     57#define _GID_T                                      /* bird */
    858#endif
    959
    10 #if !defined (_PASSWORD_LEN)
    11 #define _PASSWORD_LEN 128
     60#if !defined(_TIME_T_DECLARED) && !defined(_TIME_T) /* bird */
     61typedef __time_t time_t;
     62#define _TIME_T_DECLARED
     63#define _TIME_T                                     /* bird */
    1264#endif
    1365
    14 #if !defined (_GID_T)
    15 #define _GID_T
    16 typedef int gid_t;
     66#if !defined(_UID_T_DECLARED) && !defined(_UID_T)   /* bird */
     67typedef __uid_t uid_t;
     68#define _UID_T_DECLARED
     69#define _UID_T                                      /* bird */
    1770#endif
    1871
    19 #if !defined (_UID_T)
    20 #define _UID_T
    21 typedef int uid_t;
     72#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird */
     73typedef __size_t size_t;
     74#define _SIZE_T_DECLARED
     75#define _SIZE_T                                     /* bird */
    2276#endif
    2377
    24 struct passwd
    25 {
    26   char *pw_name;
    27   char *pw_passwd;
    28   uid_t pw_uid;
    29   gid_t pw_gid;
    30   char *pw_age;
    31   char *pw_comment;
    32   char *pw_gecos;
    33   char *pw_dir;
    34   char *pw_shell;
     78
     79#define _PATH_PWD               "/etc"
     80#define _PATH_PASSWD            "/etc/passwd"
     81#define _PASSWD                 "passwd"
     82#define _PATH_MASTERPASSWD      "/etc/master.passwd"
     83#define _MASTERPASSWD           "master.passwd"
     84
     85#define _PATH_MP_DB             "/etc/pwd.db"
     86#define _MP_DB                  "pwd.db"
     87#define _PATH_SMP_DB            "/etc/spwd.db"
     88#define _SMP_DB                 "spwd.db"
     89
     90#define _PATH_PWD_MKDB          "/usr/sbin/pwd_mkdb"
     91
     92/* Historically, the keys in _PATH_MP_DB/_PATH_SMP_DB had the format
     93 * `1 octet tag | key', where the tag is one of the _PW_KEY* values
     94 * listed below.  These values happen to be ASCII digits.  Starting
     95 * with FreeBSD 5.1, the tag is now still a single octet, but the
     96 * upper 4 bits are interpreted as a version.  Pre-FreeBSD 5.1 format
     97 * entries are version `3' -- this conveniently results in the same
     98 * key values as before.  The new, architecture-independent entries
     99 * are version `4'.
     100 * As it happens, some applications read the database directly.
     101 * (Bad app, no cookie!)  Thus, we leave the _PW_KEY* symbols at their
     102 * old pre-FreeBSD 5.1 values so these apps still work.  Consequently
     103 * we have to do muck around a bit more to get the correct, versioned
     104 * tag, and that is what the _PW_VERSIONED macros is about.
     105 */
     106
     107#define _PW_VERSION_MASK        '0xF0'
     108#define _PW_VERSIONED(x, v)     ((unsigned char)(((x) & 0xCF) | ((v)<<4)))
     109
     110#define _PW_KEYBYNAME           '\x31'  /* stored by name */
     111#define _PW_KEYBYNUM            '\x32'  /* stored by entry in the "file" */
     112#define _PW_KEYBYUID            '\x33'  /* stored by uid */
     113#define _PW_KEYYPENABLED        '\x34'  /* YP is enabled */
     114#define _PW_KEYYPBYNUM          '\x35'  /* special +@netgroup entries */
     115
     116/* The database also contains a key to indicate the format version of
     117 * the entries therein.  There may be other, older versioned entries
     118 * as well.
     119 */
     120#define _PWD_VERSION_KEY        "\xFF" "VERSION"
     121#define _PWD_CURRENT_VERSION    '\x04'
     122
     123#define _PASSWORD_EFMT1         '_'     /* extended encryption format */
     124
     125#define _PASSWORD_LEN           128     /* max length, not counting NULL */
     126
     127struct passwd {
     128        char    *pw_name;               /* user name */
     129        char    *pw_passwd;             /* encrypted password */
     130        uid_t   pw_uid;                 /* user uid */
     131        gid_t   pw_gid;                 /* user gid */
     132        time_t  pw_change;              /* password change time */
     133        char    *pw_class;              /* user access class */
     134        char    *pw_gecos;              /* Honeywell login info */
     135        char    *pw_dir;                /* home directory */
     136        char    *pw_shell;              /* default shell */
     137        time_t  pw_expire;              /* account expiration */
     138        int     pw_fields;              /* internal: fields filled in */
    35139};
    36140
     141/* Mapping from fields to bits for pw_fields. */
     142#define _PWF(x)         (1 << x)
     143#define _PWF_NAME       _PWF(0)
     144#define _PWF_PASSWD     _PWF(1)
     145#define _PWF_UID        _PWF(2)
     146#define _PWF_GID        _PWF(3)
     147#define _PWF_CHANGE     _PWF(4)
     148#define _PWF_CLASS      _PWF(5)
     149#define _PWF_GECOS      _PWF(6)
     150#define _PWF_DIR        _PWF(7)
     151#define _PWF_SHELL      _PWF(8)
     152#define _PWF_EXPIRE     _PWF(9)
     153
     154/* XXX These flags are bogus.  With nsswitch, there are many
     155 * possible sources and they cannot be represented in a small integer.
     156 */
     157#define _PWF_SOURCE     0x3000
     158#define _PWF_FILES      0x1000
     159#define _PWF_NIS        0x2000
     160#define _PWF_HESIOD     0x3000
     161
     162__BEGIN_DECLS
     163struct passwd   *getpwnam(const char *);
     164struct passwd   *getpwuid(uid_t);
     165
     166#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
     167void             endpwent(void);
     168struct passwd   *getpwent(void);
     169void             setpwent(void);
     170int              getpwnam_r(const char *, struct passwd *, char *, size_t,
     171                    struct passwd **);
     172int              getpwuid_r(uid_t, struct passwd *, char *, size_t,
     173                    struct passwd **);
     174#endif
     175
     176#if __BSD_VISIBLE
     177int              getpwent_r(struct passwd *, char *, size_t, struct passwd **);
     178int              setpassent(int);
     179const char      *user_from_uid(uid_t, int);
     180#endif
     181
     182/* bird: emx stuff */
    37183char *getpass (__const__ char *);
    38184char *_getpass1 (__const__ char *);
    39185char *_getpass2 (__const__ char *, int);
     186__END_DECLS
    40187
    41 struct passwd *getpwuid (uid_t);
    42 struct passwd *getpwnam (__const__ char *);
     188#endif /* !_PWD_H_ */
    43189
    44 struct passwd *_getpwuid (uid_t);
    45 struct passwd *_getpwnam (__const__ char *);
    46 
    47 #if !defined (_POSIX_SOURCE) || defined(__USE_EMX)
    48 
    49 struct passwd *getpwent (void);
    50 void setpwent (void);
    51 void endpwent (void);
    52 
    53 struct passwd *_getpwent (void);
    54 void _setpwent (void);
    55 void _endpwent (void);
    56 
    57 #endif
    58 
    59 #if defined (__cplusplus)
    60 }
    61 #endif
    62 
    63 #endif /* not _PWD_H */
  • trunk/src/emx/include/stdlib.h

    • Property cvs2svn:cvs-rev changed from 1.22 to 1.23
    r1504 r1505  
    262262/** @todo int    daemon(int, int); */
    263263/** @todo char  *devname(int, int); */
    264 /** @todo int    getloadavg(double [], int); */
     264int      getloadavg(double [], int);
    265265__const char *
    266266         getprogname(void);
  • trunk/src/emx/include/sys/mount.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1504 r1505  
    535535int     fhstat(const struct fhandle *, struct stat *);
    536536int     fhstatfs(const struct fhandle *, struct statfs *);
     537#endif  /* bird */
    537538int     fstatfs(int, struct statfs *);
     539#if 0 /* bird: we don't do this. */
    538540int     getfh(const char *, fhandle_t *);
    539541#endif  /* bird */
  • trunk/src/emx/include/sys/syslimits.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1504 r1505  
    3434#ifndef LOGIN_NAME_MAX
    3535/** Max login name length including terminating NULL. */
    36 #define LOGIN_NAME_MAX  MAXLOGNAME
     36#define LOGIN_NAME_MAX  17
    3737#endif
    3838
  • trunk/src/emx/include/unistd.h

    • Property cvs2svn:cvs-rev changed from 1.16 to 1.17
    r1504 r1505  
    178178unsigned int     alarm(unsigned int);
    179179int      chdir(const char *);
    180 /** @todo int    chown(const char *, uid_t, gid_t); */
     180int      chown(const char *, uid_t, gid_t);
    181181int      close(int);
    182182char *   cuserid(char *); /* bird: emx/todo/obosolete? */
     
    203203uid_t    getuid(void);
    204204int      isatty(int);
    205 /** @todo int    link(const char *, const char *);*/
     205int      link(const char *, const char *);
    206206#ifndef _LSEEK_DECLARED
    207207#define _LSEEK_DECLARED
     
    255255/* 1003.1-2001 */
    256256#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
    257 /** @todo int    fchown(int, uid_t, gid_t); */
    258 /** @todo int    readlink(const char *, char *, int); */
     257int      fchown(int, uid_t, gid_t);
     258int      readlink(const char *, char *, int);
    259259#endif
    260260#if __POSIX_VISIBLE >= 200112
     
    270270 */
    271271#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE
    272 /** @todo int    symlink(const char * __restrict, const char * __restrict); */
     272int      symlink(const char * __restrict, const char * __restrict);
    273273#endif
    274274
     
    283283/** @todo int    getsid(pid_t _pid); */
    284284char    *getwd(char *);                 /* LEGACY: obsoleted by getcwd() */
    285 /** @todo int    lchown(const char *, uid_t, gid_t); */
     285int      lchown(const char *, uid_t, gid_t);
    286286int      lockf(int, int, off_t);
    287287/** @todo int    nice(int); */
     
    292292/** @todo int    setreuid(uid_t, uid_t); */
    293293/* void  swab(const void * __restrict, void * __restrict, ssize_t); */
    294 /** @todo void   sync(void); */
     294void     sync(void);
    295295/** @todo useconds_t     ualarm(useconds_t, useconds_t); */
    296296int      usleep(useconds_t);
     
    325325/** @todo int    des_cipher(const char *, char *, long, int); */
    326326/** @todo int    des_setkey(const char *key); */
    327 /** @todo void   endusershell(void); */
     327void     endusershell(void);
    328328/** @todo int    exect(const char *, char * const *, char * const *); */
    329329/** @todo char  *fflagstostr(u_long); */
     
    334334/** @todo int    getresgid(gid_t *, gid_t *, gid_t *); */
    335335/** @todo int    getresuid(uid_t *, uid_t *, uid_t *); */
    336 /** @todo char  *getusershell(void); */
     336char    *getusershell(void);
    337337/** @todo int    initgroups(const char *, gid_t); */
    338338/** @todo int    iruserok(unsigned long, int, const char *, const char *); */
     
    340340/** @todo int    issetugid(void); */
    341341/** @todo char  *mkdtemp(char *); */
    342 /** @todo int    mknod(const char *, mode_t, dev_t); */
     342int      mknod(const char *, mode_t, dev_t);
    343343#ifndef _MKSTEMP_DECLARED
    344344int      mkstemp(char *);
     
    374374#endif
    375375/** @todo int    setdomainname(const char *, int); */
    376 /** @todo int    setgroups(int, const gid_t *); */
     376int      setgroups(int, const gid_t *);
    377377/** @todo void   sethostid(long); */
    378378/** @todo int    sethostname(const char *, int); */
     
    387387/** @todo int    setrgid(gid_t); */
    388388/** @todo int    setruid(uid_t); */
    389 /** @todo void   setusershell(void); */
     389void     setusershell(void);
    390390/** @todo int    strtofflags(char **, u_long *, u_long *); */
    391391/** @todo int    swapon(const char *); */
     
    419419unsigned int _alarm(unsigned int);
    420420int      _chdir(const char *);
    421 /** @todo int    _chown(const char *, uid_t, gid_t); */
     421int      _chown(const char *, uid_t, gid_t);
    422422int      _close(int);
    423423char    *_cuserid(char *);
    424424int      _dup(int);
    425425int      _dup2(int, int);
    426 /** @todo int    _eaccess(const char *, int); */
     426int      _eaccess(const char *, int);
    427427int      _execl(const char *, const char *, ...);
    428428int      _execle(const char *, const char *, ...);
     
    444444uid_t    _getuid(void);
    445445int      _isatty(int);
    446 /** @todo int    _link(const char *, const char *);*/
     446int      _link(const char *, const char *);
    447447#ifndef __LSEEK_DECLARED
    448448#define __LSEEK_DECLARED
  • trunk/src/emx/src/include/namespace.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r1504 r1505  
    2929#define _statfs     _STD(statfs)
    3030#define _fstatfs    _STD(fstatfs)
     31#define nsdispatch  _nsdispatch
    3132
    3233#endif
  • trunk/src/emx/src/lib/alias/alias.smak

    • Property cvs2svn:cvs-rev changed from 1.23 to 1.24
    r1504 r1505  
    2323        _Exit                   _exit \
    2424        mempcpy                 __mempcpy \
     25        memrchr                 _memrchr \
     26        __memrchr               _memrchr \
    2527        strnlen                 __strnlen
    2628
  • trunk/src/emx/src/lib/bsd/gen/getgrent.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    4848#include <grp.h>
    4949#include <nsswitch.h>
     50#if 0
    5051#include <pthread.h>
    5152#include <pthread_np.h>
     53#else
     54#endif
    5255#include <stdio.h>
    5356#include <stdlib.h>
     
    410413
    411414        rv = files_getstate(&st);
    412         if (rv != 0) 
     415        if (rv != 0)
    413416                return (NS_UNAVAIL);
    414417        switch ((enum constants)mdata) {
     
    479482        }
    480483        rv = NS_NOTFOUND;
     484#ifndef __EMX__
    481485        while ((line = fgetln(st->fp, &linesize)) != NULL) {
     486#else
     487        char szLine[4096];
     488        while ((line = fgets(szLine, sizeof(szLine), st->fp)) != NULL) {
     489                linesize = strlen(szLine);
     490#endif
    482491                if (line[linesize-1] == '\n')
    483492                        linesize--;
     
    496505                memcpy(buffer, line, linesize);
    497506                buffer[linesize] = '\0';
    498                 rv = __gr_parse_entry(buffer, linesize, grp, 
     507                rv = __gr_parse_entry(buffer, linesize, grp,
    499508                    &buffer[linesize + 1], bufsize - linesize - 1, errnop);
    500509                if (rv & NS_TERMINATE)
     
    846855
    847856        rv = compat_getstate(&st);
    848         if (rv != 0) 
     857        if (rv != 0)
    849858                return (NS_UNAVAIL);
    850859        switch ((enum constants)mdata) {
     
    905914        void                    *discard;
    906915        size_t                   bufsize, linesize;
    907         int                      rv, stayopen, *errnop;
     916        int                      rv = 0, stayopen = 0, *errnop; /* bird: initialized to shut up GCC. */
    908917
    909918#define set_lookup_type(x, y) do {                              \
     
    10081017        }
    10091018        rv = NS_NOTFOUND;
     1019#ifndef __EMX__
    10101020        while ((line = fgetln(st->fp, &linesize)) != NULL) {
     1021#else
     1022        char szLine[4096];
     1023        while ((line = fgets(szLine, sizeof(szLine), st->fp)) != NULL) {
     1024               linesize = strlen(szLine);
     1025#endif
    10111026                if (line[linesize-1] == '\n')
    10121027                        linesize--;
     
    10181033                                st->name = malloc(p - line);
    10191034                                if (st->name == NULL) {
     1035#ifndef __EMX__
    10201036                                        syslog(LOG_ERR,
    10211037                                         "getgrent memory allocation failure");
     1038#endif
    10221039                                        *errnop = ENOMEM;
    10231040                                        rv = NS_UNAVAIL;
     
    10291046                        }
    10301047                        goto docompat;
    1031                 } 
     1048                }
    10321049                rv = __gr_match_entry(line, linesize, how, name, gid);
    10331050                if (rv != NS_SUCCESS)
     
    10441061                memcpy(buffer, line, linesize);
    10451062                buffer[linesize] = '\0';
    1046                 rv = __gr_parse_entry(buffer, linesize, grp, 
     1063                rv = __gr_parse_entry(buffer, linesize, grp,
    10471064                    &buffer[linesize + 1], bufsize - linesize - 1, errnop);
    10481065                if (rv & NS_TERMINATE)
  • trunk/src/emx/src/lib/bsd/gen/getmntinfo.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    3939
    4040#include <sys/param.h>
     41#ifndef __EMX__
    4142#include <sys/ucred.h>
     43#endif
    4244#include <sys/mount.h>
    4345#include <stdlib.h>
  • trunk/src/emx/src/lib/bsd/gen/getnetgrent.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    4646#include <string.h>
    4747#include <unistd.h>
     48#ifdef __EMX__
     49#include <netdb.h>
     50#endif
    4851
    4952#ifdef YP
     
    6164 * for now I'm satisfied just to have something that works well
    6265 * without requiring massive code changes.)
    63  * 
     66 *
    6467 * Therefore, to still permit the use of the local file and maintain
    6568 * optimum NIS performance, we allow for the following conditions:
     
    152155void
    153156setnetgrent(group)
    154         char *group;
     157        const char *group;              /* bird: added const to match prototype.. */
    155158{
    156159#ifdef YP
     
    201204                        }
    202205#else
    203                 if (netf = fopen(_PATH_NETGROUP, "r")) {
     206                if ((netf = fopen(_PATH_NETGROUP, "r"))) {
    204207#endif
    205208                        if (parse_netgrp(group))
     
    524527        char *group;
    525528{
    526         char *pos, *spos, *linep, *olinep;
     529        char *pos, *spos, *linep = NULL, *olinep = NULL; /* bird: shutting up GCC. */
    527530        int len, olen;
    528531        int cont;
  • trunk/src/emx/src/lib/bsd/gen/getpwent.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    4949#include <netdb.h>
    5050#include <nsswitch.h>
     51#ifndef __EMX__
    5152#include <pthread.h>
    5253#include <pthread_np.h>
     54#else
     55
     56#endif
    5357#include <pwd.h>
    5458#include <stdlib.h>
     
    197201                    struct passwd *, char *, size_t, int *);
    198202void
    199 setpwent(void)
     203_STD(setpwent)(void)
    200204{
    201205        static const ns_dtab dtab[] = {
     
    215219
    216220int
    217 setpassent(int stayopen)
     221_STD(setpassent)(int stayopen)
    218222{
    219223        static const ns_dtab dtab[] = {
     
    235239
    236240void
    237 endpwent(void)
     241_STD(endpwent)(void)
    238242{
    239243        static const ns_dtab dtab[] = {
     
    470474        if (*version < 3 ||
    471475            *version >= sizeof(pwdb_versions)/sizeof(pwdb_versions[0])) {
     476#ifndef __EMX__
    472477                syslog(LOG_CRIT, "Unsupported password database version %d",
    473478                    *version);
     479#endif
    474480                res->close(res);
    475481                res = NULL;
     
    531537        enum nss_lookup_type     how;
    532538        const char              *name;
    533         struct passwd           *pwd;
     539        struct passwd           *pwd = NULL;                    /* bird: shut up GCC */
    534540        char                    *buffer;
    535541        size_t                   bufsize, namesize;
    536542        uid_t                    uid;
    537543        uint32_t                 store;
    538         int                      rv, stayopen, *errnop;
     544        int                      rv, stayopen = 0, *errnop;     /* bird: shut up GCC */
    539545
    540546        name = NULL;
     
    657663
    658664static int
    659 pwdb_match_entry_v3(char *entry, size_t entrysize, enum nss_lookup_type how, 
     665pwdb_match_entry_v3(char *entry, size_t entrysize, enum nss_lookup_type how,
    660666    const char *name, uid_t uid)
    661667{
     
    671677        if (how == nss_lt_all)
    672678                return (NS_SUCCESS);
    673         if (how == nss_lt_name) 
     679        if (how == nss_lt_name)
    674680                return (strcmp(name, entry) == 0 ? NS_SUCCESS : NS_NOTFOUND);
    675681        for (p++; p < eom; p++)
     
    727733
    728734static int
    729 pwdb_match_entry_v4(char *entry, size_t entrysize, enum nss_lookup_type how, 
     735pwdb_match_entry_v4(char *entry, size_t entrysize, enum nss_lookup_type how,
    730736    const char *name, uid_t uid)
    731737{
     
    741747        if (how == nss_lt_all)
    742748                return (NS_SUCCESS);
    743         if (how == nss_lt_name) 
     749        if (how == nss_lt_name)
    744750                return (strcmp(name, entry) == 0 ? NS_SUCCESS : NS_NOTFOUND);
    745751        for (p++; p < eom; p++)
     
    9951001                } else
    9961002                        rv = 1;
    997         } 
     1003        }
    9981004        free(result);
    9991005        return (rv);
     
    10291035        enum nss_lookup_type how;
    10301036        int             *errnop, keylen, resultlen, rv, master;
    1031          
     1037       
    10321038        name = NULL;
    10331039        uid = (uid_t)-1;
     
    11871193        return (0);
    11881194enomem:
     1195#ifndef __EMX__
    11891196        syslog(LOG_ERR, "getpwent memory allocation failure");
     1197#endif
    11901198        return (-1);
    11911199}
     
    12141222        copy = malloc(n);
    12151223        if (copy == NULL) {
     1224#ifndef __EMX__
    12161225                syslog(LOG_ERR, "getpwent memory allocation failure");
     1226#endif
    12171227                return (ENOMEM);
    12181228        }
     
    14651475        enum nss_lookup_type     how;
    14661476        const char              *name;
    1467         struct passwd           *pwd;
     1477        struct passwd           *pwd = NULL;                    /* bird: shut up gcc.  */
    14681478        char                    *buffer, *pw_name;
    14691479        char                    *host, *user, *domain;
     
    14711481        uid_t                    uid;
    14721482        uint32_t                 store;
    1473         int                      rv, from_compat, stayopen, *errnop;
     1483        int                      rv, from_compat, stayopen = 0, *errnop; /* bird: shut up gcc. */
    14741484
    14751485        from_compat = 0;
     
    15931603                                st->name = strdup(&pw_name[1]);
    15941604                                if (st->name == NULL) {
     1605#ifndef __EMX__
    15951606                                        syslog(LOG_ERR,
    15961607                                         "getpwent memory allocation failure");
     1608#endif
    15971609                                        *errnop = ENOMEM;
    15981610                                        rv = NS_UNAVAIL;
     
    16251637                                setnetgrent(&pw_name[2]);
    16261638                                while (getnetgrent(&host, &user, &domain) !=
    1627                                     NULL) {
     1639                                    0) { /* bird: getnetgrent returns int not pointer. */
    16281640                                        if (user != NULL && user[0] != '\0')
    16291641                                                compat_exclude(user,
     
    16641676                st->db = NULL;
    16651677        }
    1666         if (rv == NS_SUCCESS) { 
     1678        if (rv == NS_SUCCESS) {
    16671679                if (!from_compat) {
    16681680                        pwd->pw_fields &= ~_PWF_SOURCE;
  • trunk/src/emx/src/lib/bsd/net/nsdispatch.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    8080#define _NS_PRIVATE
    8181#include <nsswitch.h>
     82#ifndef __EMX__
    8283#include <pthread.h>
     84#else  /* bird: temporary hack. */
     85#define _pthread_mutex_trylock(lock)    (*lock)
     86#define _pthread_mutex_unlock(lock)     (*lock)
     87#define _pthread_rwlock_rdlock(lock)    (*lock)
     88#define _pthread_rwlock_wrlock(lock)    (*lock)
     89#define _pthread_rwlock_unlock(lock)    (*lock)
     90#define pthread_rwlock_t                unsigned
     91#define PTHREAD_RWLOCK_INITIALIZER      0
     92#define pthread_mutex_t                 unsigned
     93#define PTHREAD_MUTEX_INITIALIZER       0
     94#endif
    8395#include <stdio.h>
    8496#include <stdlib.h>
     
    124136static  int                      __nss_builtin_handle;
    125137static  void                    *nss_builtin_handle = &__nss_builtin_handle;
     138
     139#ifdef __EMX__
     140# define syslog(level, format, ...) do { } while (0)
     141#endif
    126142
    127143/*
     
    248264{
    249265      int     cmp;
    250      
     266
    251267      cmp = strcmp(((const ns_mtab *)a)->name, ((const ns_mtab *)b)->name);
    252268      if (cmp != 0)
     
    306322
    307323
    308 /* 
     324/*
    309325 * The first time nsdispatch is called (during a process's lifetime,
    310326 * or after nsswitch.conf has been updated), nss_configure will
     
    442458        }
    443459        if (reg_fn != NULL) {
    444                 /* The placeholder is required, as a NULL handle 
     460                /* The placeholder is required, as a NULL handle
    445461                 * represents an invalid module.
    446462                 */
     
    450466                goto fin;
    451467        else {
     468#ifndef __EMX__
    452469                if (snprintf(buf, sizeof(buf), "nss_%s.so.%d", mod.name,
    453470                    NSS_MODULE_INTERFACE_VERSION) >= (int)sizeof(buf))
     
    471488                        goto fin;
    472489                }
     490#else /* bird: dlfcn.h stuff later. */
     491                buf[0] = '\0';
     492                nss_log(LOG_ERR, "%s, dynamic loading not implemented in the LIBC port yet.", mod.name);
     493                goto fin;
     494#endif
    473495        }
    474496        mod.mtab = fn(mod.name, &mod.mtabsize, &mod.unregister);
    475497        if (mod.mtab == NULL || mod.mtabsize == 0) {
     498#ifndef __EMX__
    476499                if (mod.handle != nss_builtin_handle)
    477500                        (void)dlclose(mod.handle);
     501#endif
    478502                mod.handle = NULL;
    479503                nss_log(LOG_ERR, "%s, registration failed", mod.name);
     
    499523        if (mod->unregister != NULL)
    500524                mod->unregister(mod->mtab, mod->mtabsize);
     525#ifndef __EMX__
    501526        if (mod->handle != nss_builtin_handle)
    502527                (void)dlclose(mod->handle);
     528#endif
    503529}
    504530
  • trunk/src/emx/src/lib/bsd/net/nslexer.l

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    4040#include <sys/cdefs.h>
    4141#if defined(LIBC_SCCS) && !defined(lint)
    42 static char *rcsid = 
     42static char *rcsid =
    4343  "$FreeBSD: src/lib/libc/net/nslexer.l,v 1.5 2003/04/17 14:14:22 nectar Exp $";
    4444#endif /* LIBC_SCCS and not lint */
     
    8787
    8888                        if ((p = strdup(yytext)) == NULL) {
     89#ifndef __EMX__
    8990                                syslog(LOG_ERR,
    9091                               "NSSWITCH(nslexer): memory allocation failure");
     92#endif
    9193                                return ERRORTOKEN;
    9294                        }
     
    114116        const char *msg;
    115117{
    116 
     118#ifndef __EMX__
    117119         syslog(LOG_ERR, "NSSWITCH(nslexer): %s line %d: %s at '%s'",
    118120             _PATH_NS_CONF, yylineno, msg, yytext);
     121#endif
    119122} /* _nsyyerror */
  • trunk/src/emx/src/lib/bsd/net/nsparser.y

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1504 r1505  
    128128                {
    129129                        if ($3)      /* if action == RETURN set RETURN bit */
    130                                 cursrc.flags |= $1; 
     130                                cursrc.flags |= $1;
    131131                        else         /* else unset it */
    132132                                cursrc.flags &= ~$1;
     
    160160                if ((strcasecmp(elem, NSSRC_COMPAT) == 0) ||
    161161                    (strcasecmp(curdbt.srclist[0].name, NSSRC_COMPAT) == 0)) {
     162#ifndef __EMX__
    162163                        syslog(LOG_ERR,
    163164            "NSSWITCH(nsparser): %s line %d: 'compat' used with other sources",
    164165                            _PATH_NS_CONF, lineno);
     166#endif
    165167                        return;
    166168                }
     
    168170        for (i = 0; i < curdbt.srclistsize; i++) {
    169171                if (strcasecmp(curdbt.srclist[i].name, elem) == 0) {
     172#ifndef __EMX__
    170173                        syslog(LOG_ERR,
    171174                       "NSSWITCH(nsparser): %s line %d: duplicate source '%s'",
    172175                            _PATH_NS_CONF, lineno, elem);
     176#endif
    173177                        return;
    174178                }
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.61 to 1.62
    r1504 r1505  
    696696    "__std_getpid" @718
    697697    "__std_getppid" @719
    698     "__std_getpw" @720
     698;    "__std_getpw" @720
    699699    "__std_getpwent" @721
    700700    "__std_getpwnam" @722
     
    11191119
    11201120    "___libc_SpmCheck" @1140
     1121    "___libc_Back_miscLoadAvg" @1141
     1122    "___libc_Back_fhToPath" @1142
     1123    "___libc_Back_fsStat" @1143
     1124    "___libc_Back_fsStatFH" @1144
     1125    "___libc_Back_fsStats" @1145
     1126    "_getmntinfo" @1146
     1127    "__std_fstatfs" @1147
     1128    "__std_fstatvfs" @1148
     1129    "__std_getfsstat" @1149
     1130    "__std_getloadavg" @1150
     1131    "__std_statfs" @1151
     1132    "__std_statvfs" @1152
     1133    "__std_chown" @1153
     1134    "__std_fchown" @1154
     1135    "__std_lchown" @1155
     1136    "__std_link" @1156
     1137    "__std_mknod" @1157
     1138    "__std_readlink" @1158
     1139    "__std_symlink" @1159
     1140    "___libc_Back_fsSync" @1160
     1141    "__std_sync" @1161
     1142    "_endgrent" @1162
     1143    "_getgrent" @1163
     1144    "_getgrent_r" @1164
     1145    "_getgrgid_r" @1165
     1146    "_getgrnam_r" @1166
     1147    "___gr_match_entry" @1167
     1148    "___gr_parse_entry" @1168
     1149    "__nsdbtaddsrc" @1169
     1150    "__nsdbtput" @1170
     1151    "___nsdefaultsrc" @1171
     1152    "__nsdispatch" @1172
     1153    "_setgrent" @1173
     1154    "_setgroupent" @1174
     1155    "_endnetgrent" @1175
     1156    "_endusershell" @1176
     1157    "_getnetgrent" @1177
     1158    "_getpwent_r" @1178
     1159    "_getpwnam_r" @1179
     1160    "_getpwuid_r" @1180
     1161    "_getusershell" @1181
     1162    "_innetgr" @1182
     1163    "_pwdb_versions" @1183
     1164    "___pw_match_entry" @1184
     1165    "___pw_parse_entry" @1185
     1166    "___pw_scan" @1186
     1167    "_setnetgrent" @1187
     1168    "_setusershell" @1188
     1169    "_sl_add" @1189
     1170    "_sl_find" @1190
     1171    "_sl_free" @1191
     1172    "_sl_init" @1192
     1173    "__std_setpassent" @1193
     1174    "__std_setgroups" @1194
     1175    "___libc_OS2ErrorPop" @1195
     1176    "___libc_OS2ErrorPush" @1196
     1177    "___libc_OS2ErrorSet" @1197
  • trunk/src/emx/src/lib/libc.smak

    • Property cvs2svn:cvs-rev changed from 1.44 to 1.45
    r1504 r1505  
    144144$(1): $(subst /omf/,/aout/,$(2))
    145145$(subst /omf/,/omf-log/,$(1)): $(subst /omf/,/aout-log/,$(2))
    146 $(subst /omf/,/omf-perf/,$(1)): $(subst /omf/,/aout-pref/,$(2))
     146$(subst /omf/,/omf-prof/,$(1)): $(subst /omf/,/aout-prof/,$(2))
     147
    147148endef
    148149$(foreach o,$(LIBC.OBJS.COMMON),$(eval $(call def_libc_omf_dep,$(o),$(patsubst %.obj,%.o,$(o)))))
     
    170171        @$(call FECHO,$@,EXPORTS)
    171172        $(call DO.EMXEXP,$(filter %.lib,$^),$@)
    172         sed -e "/\"___pfn/d" -e "/\"__sys_/d" -e "/\"___sys_/d" -e "/\"___libc_[a-z]/d" $@ > $@.tmp
     173        sed  -e "/\"___pfn/d" -e "/\"__sys_/d" -e "/\"___sys_/d" -e "/\"___libc_[a-z]/d" -e "/\"__nsyy/d" $@ > $@.tmp
    173174        mv -f $@.tmp $@
    174175        krx.exe src/lib/dlllegacy.cmd -e "_DLL_InitTerm" $@ src/lib/libc.def
  • trunk/src/emx/src/lib/misc/getgrgid.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1504 r1505  
    11/* getgrgid.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3#if 0
    34#include "libc-alias.h"
    45#include <string.h>
     
    1920  return &tmp_grp;
    2021}
     22#endif
  • trunk/src/emx/src/lib/misc/getgrnam.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1504 r1505  
    11/* getgrnam.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3#if 0
    34#include "libc-alias.h"
    45#include <string.h>
     
    2122  return &tmp_grp;
    2223}
     24
     25#endif
  • trunk/src/emx/src/lib/misc/getgroup.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1504 r1505  
    11/* getgroup.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */
    22
     3/*******************************************************************************
     4*   Header Files                                                               *
     5*******************************************************************************/
    36#include "libc-alias.h"
    47#include <unistd.h>
     8#include <stdlib.h>
     9#include <string.h>
    510#include <sys/types.h>
     11#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
     12#include <InnoTekLIBC/logstrict.h>
    613
    7 int _STD(getgroups) (int gidsetsize, gid_t grouplist [])
     14/*******************************************************************************
     15*   Global Variables                                                           *
     16*******************************************************************************/
     17/** Pointer to array of groups. */
     18static gid_t   *gpaGroups;
     19/** Count of groups in array. */
     20static int      gcGroups;
     21
     22int _STD(getgroups) (int gidsetlen, gid_t grouplist [])
    823{
    9   return 0;
     24    LIBCLOG_ENTER("gidsetlen=%d grouplist=%p\n", gidsetlen, (void *)grouplist);
     25    if (gcGroups)
     26    {
     27        int c = gidsetlen >= gcGroups ? gcGroups : gidsetlen;
     28        memcpy(grouplist, gpaGroups, c * sizeof(gid_t));
     29        LIBCLOG_RETURN_INT(c);
     30    }
     31
     32    LIBCLOG_RETURN_INT(0);
    1033}
     34
     35
     36int _STD(setgroups)(int ngroups, const gid_t *grouplist)
     37{
     38    LIBCLOG_ENTER("ngroups=%d grouplist=%p\n", ngroups, (void *)grouplist);
     39
     40    void *pv = realloc(gpaGroups, (ngroups + 1) * sizeof(gid_t));
     41    if (!pv)
     42        LIBCLOG_RETURN_INT(-1);
     43
     44    gpaGroups = memcpy(pv, grouplist, ngroups * sizeof(gid_t));
     45    gpaGroups[ngroups] = -1;
     46    gcGroups = ngroups;
     47
     48    LIBCLOG_RETURN_INT(0);
     49}
  • trunk/src/emx/src/lib/misc/getpwnam.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1504 r1505  
    11/* getpwnam.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    2 
     2#if 0
    33#include "libc-alias.h"
    44#include <stdlib.h>
     
    1919  return _getpw (0, name);
    2020}
     21#endif
  • trunk/src/emx/src/lib/misc/getpwuid.c

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r1504 r1505  
    11/* getpwuid.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
    2 
     2#if 0
    33#include "libc-alias.h"
    44#include <stdlib.h>
     
    1313  return _getpw (uid, NULL);
    1414}
     15
     16#endif
  • trunk/src/emx/src/lib/misc/pwd.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1504 r1505  
    11/* pwd.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
     2
     3#if 0
    24
    35#include "libc-alias.h"
     
    7173{
    7274}
     75
     76#endif
  • trunk/src/emx/src/lib/sys/sharedpm.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1504 r1505  
    866866}
    867867
     868
     869/**
     870 * Get the stored load average samples.
     871 *
     872 * @returns 0 on success.
     873 * @returns -1 and errno on failure.
     874 * @param   pLoadAvg    Where to store the load average samples.
     875 * @param   puTimestamp Where to store the current timestamp.
     876 */
     877int     __libc_spmGetLoadAvg(__LIBC_PSPMLOADAVG  pLoadAvg, unsigned *puTimestamp)
     878{
     879    __LIBC_SPMXCPTREGREC    RegRec;
     880    int                     rc;
     881    __LIBC_SPMLOADAVG       LoadAvg;
     882
     883    rc = spmRequestMutex(&RegRec);
     884    if (rc)
     885        return rc;
     886
     887    /* copy to temp buffer. */
     888    LoadAvg = gpSPMHdr->LoadAvg;
     889
     890    spmReleaseMutex(&RegRec);
     891
     892    /* copy to return buffer. */
     893    *pLoadAvg = LoadAvg;
     894    *puTimestamp = spmTimestamp();
     895
     896    return rc;
     897}
     898
     899
     900/**
     901 * Get the stored load average samples.
     902 *
     903 * @returns 0 on success.
     904 * @returns -1 and errno on failure.
     905 * @param   pLoadAvg    Where to store the load average samples.
     906 */
     907int     __libc_spmSetLoadAvg(const __LIBC_SPMLOADAVG *pLoadAvg)
     908{
     909    __LIBC_SPMXCPTREGREC    RegRec;
     910    int                     rc;
     911    __LIBC_SPMLOADAVG       LoadAvg;
     912
     913    /* copy to temp buffer. */
     914    LoadAvg = *pLoadAvg;
     915    LoadAvg.uTimestamp = spmTimestamp();
     916
     917    rc = spmRequestMutex(&RegRec);
     918    if (rc)
     919        return rc;
     920
     921    gpSPMHdr->LoadAvg = LoadAvg;
     922
     923    spmReleaseMutex(&RegRec);
     924    return rc;
     925}
    868926
    869927
Note: See TracChangeset for help on using the changeset viewer.