Changeset 979


Ignore:
Timestamp:
Jan 11, 2004, 8:58:48 PM (22 years ago)
Author:
bird
Message:

Merged in changes from the old port (src/emx/bsd/db).

Location:
trunk/src/emx/src/lib/bsd/db
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/bsd/db/btree/bt_close.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r978 r979  
    7171        BTREE *t;
    7272        int fd;
     73
     74
     75
     76
    7377
    7478        t = dbp->internal;
     
    106110
    107111        fd = t->bt_fd;
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
    108125        free(t);
    109126        free(dbp);
    110127        return (_close(fd) ? RET_ERROR : RET_SUCCESS);
     128
    111129}
    112130
  • trunk/src/emx/src/lib/bsd/db/btree/bt_open.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r978 r979  
    213213                if ((flags & O_ACCMODE) != O_RDWR)
    214214                        goto einval;
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
    215226                if ((t->bt_fd = tmp()) == -1)
    216227                        goto err;
     228
    217229                F_SET(t, B_INMEM);
    218230        }
     
    341353                if (t->bt_fd != -1)
    342354                        (void)_close(t->bt_fd);
     355
     356
     357
     358
     359
     360
    343361                free(t);
    344362        }
     
    389407}
    390408
     409
    391410static int
    392411tmp()
     
    397416        char path[MAXPATHLEN];
    398417
    399 #ifndef __EMX__ /* bird */
    400418        if (issetugid() == 0)
    401 #endif
    402419                envtmp = getenv("TMPDIR");
    403420        (void)snprintf(path,
     
    411428        return(fd);
    412429}
     430
    413431
    414432static int
  • trunk/src/emx/src/lib/bsd/db/btree/btree.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r978 r979  
    380380#define B_DB_TXN        0x10000         /* DB_TXN specified. */
    381381        u_int32_t flags;
     382
     383
     384
    382385} BTREE;
    383386
  • trunk/src/emx/src/lib/bsd/db/db/db.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r978 r979  
    6060#define USE_OPEN_FLAGS                                                  \
    6161        (O_CREAT | O_EXCL /*| O_EXLOCK*/ | O_NONBLOCK | O_RDONLY |              \
    62          O_RDWR | /*O_SHLOCK |*/ O_TRUNC)
     62         O_RDWR | /*O_SHLOCK |*/ O_TRUNC)
    6363#else
    6464#define USE_OPEN_FLAGS                                                  \
  • trunk/src/emx/src/lib/bsd/db/hash/hash.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r978 r979  
    444444        if (hashp->fp != -1)
    445445                (void)_close(hashp->fp);
     446
     447
     448
     449
     450
     451
    446452
    447453        free(hashp);
     
    517523                if (wsize != sizeof(HASHHDR)) {
    518524                        errno = EFTYPE;
    519                         hashp->error = errno;
     525                        hashp->
    520526                        return (-1);
    521527                }
     
    548554        hashp = (HTAB *)dbp->internal;
    549555        if (flag) {
    550                 hashp->error = errno = EINVAL;
     556                hashp->
    551557                return (ERROR);
    552558        }
     
    565571        hashp = (HTAB *)dbp->internal;
    566572        if (flag && flag != R_NOOVERWRITE) {
    567                 hashp->error = EINVAL;
     573                hashp->
    568574                errno = EINVAL;
    569575                return (ERROR);
    570576        }
    571577        if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
    572                 hashp->error = errno = EPERM;
     578                hashp->
    573579                return (ERROR);
    574580        }
     
    587593        hashp = (HTAB *)dbp->internal;
    588594        if (flag && flag != R_CURSOR) {
    589                 hashp->error = errno = EINVAL;
     595                hashp->
    590596                return (ERROR);
    591597        }
    592598        if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
    593                 hashp->error = errno = EPERM;
     599                hashp->
    594600                return (ERROR);
    595601        }
     
    742748        hashp = (HTAB *)dbp->internal;
    743749        if (flag && flag != R_FIRST && flag != R_NEXT) {
    744                 hashp->error = errno = EINVAL;
     750                hashp->
    745751                return (ERROR);
    746752        }
  • trunk/src/emx/src/lib/bsd/db/hash/hash.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r978 r979  
    7373        int             ssize;          /* Segment Size */
    7474        int             sshift;         /* Segment shift */
    75         int             ovfl_point;     /* Where overflow pages are being 
     75        int             ovfl_point;     /* Where overflow pages are being
    7676                                         * allocated */
    7777        int             last_freed;     /* Last overflow page freed */
    7878        int             max_bucket;     /* ID of Maximum bucket in use */
    7979        int             high_mask;      /* Mask to modulo into entire table */
    80         int             low_mask;       /* Mask to modulo into lower half of 
     80        int             low_mask;       /* Mask to modulo into lower half of
    8181                                         * table */
    8282        int             ffactor;        /* Fill factor */
     
    8484        int             hdrpages;       /* Size of table header */
    8585        int             h_charkey;      /* value of hash(CHARKEY) */
    86 #define NCACHED 32                      /* number of bit maps and spare 
     86#define NCACHED 32                      /* number of bit maps and spare
    8787                                         * points */
    8888        int             spares[NCACHED];/* spare pages for overflow */
    89         u_int16_t       bitmaps[NCACHED];       /* address of overflow page 
     89        u_int16_t       bitmaps[NCACHED];       /* address of overflow page
    9090                                                 * bitmaps */
    9191} HASHHDR;
     
    9494        HASHHDR         hdr;            /* Header */
    9595        int             nsegs;          /* Number of allocated segments */
    96         int             exsegs;         /* Number of extra allocated 
     96        int             exsegs;         /* Number of extra allocated
    9797                                         * segments */
    9898        u_int32_t                       /* Hash function */
     
    105105        int             cbucket;        /* Current bucket */
    106106        int             cndx;           /* Index of next item on cpage */
    107         int             error;          /* Error Number -- for DBM
    108                                          * compatibility */
    109         int             new_file;       /* Indicates if fd is backing store
     107        /* bird: this used to be errno but that crashes with the errno define in errno.h and stdlib.h. */
     108        int             dbmerrno;       /* Error Number -- for DBM
     109                                         * compatability */
     110        int             new_file;       /* Indicates if fd is backing store
    110111                                         * or no */
    111         int             save_file;      /* Indicates whether we need to flush 
     112        int             save_file;      /* Indicates whether we need to flush
    112113                                         * file at
    113114                                         * exit */
    114115        u_int32_t       *mapp[NCACHED]; /* Pointers to page maps */
    115116        int             nmaps;          /* Initial number of bitmaps */
    116         int             nbufs;          /* Number of buffers left to 
     117        int             nbufs;          /* Number of buffers left to
    117118                                         * allocate */
    118119        BUFHEAD         bufhead;        /* Header of buffer lru list */
    119120        SEGMENT         *dir;           /* Hash Bucket directory */
     121
     122
     123
    120124} HTAB;
    121125
  • trunk/src/emx/src/lib/bsd/db/hash/hash_page.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r978 r979  
    6969#ifdef DEBUG
    7070#include <assert.h>
     71
     72
     73
    7174#endif
    7275#include "un-namespace.h"
     
    868871{
    869872        sigset_t set, oset;
     873
     874
     875
    870876        static char namestr[] = "_hashXXXXXX";
     877
    871878
    872879        /* Block signals; make sure file goes away at process exit. */
     
    874881        (void)_sigprocmask(SIG_BLOCK, &set, &oset);
    875882        if ((hashp->fp = mkstemp(namestr)) != -1) {
     883
     884
     885
     886
     887
     888
    876889                (void)unlink(namestr);
     890
    877891                (void)_fcntl(hashp->fp, F_SETFD, 1);
    878892        }
  • trunk/src/emx/src/lib/bsd/db/hash/ndbm.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r978 r979  
    211211
    212212        hp = (HTAB *)db->internal;
    213         return (hp->error);
     213        return (hp->
    214214}
    215215
     
    221221
    222222        hp = (HTAB *)db->internal;
    223         hp->error = 0;
     223        hp->
    224224        return (0);
    225225}
Note: See TracChangeset for help on using the changeset viewer.