Changeset 979
- Timestamp:
- Jan 11, 2004, 8:58:48 PM (22 years ago)
- 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
to1.2
r978 r979 71 71 BTREE *t; 72 72 int fd; 73 #ifdef __EMX__ 74 char *tempname; 75 int r; 76 #endif /* __EMX__ */ 73 77 74 78 t = dbp->internal; … … 106 110 107 111 fd = t->bt_fd; 112 #ifdef __EMX__ 113 tempname = t->tempname; 114 free(t); 115 free(dbp); 116 r = _close(fd) ? RET_ERROR : RET_SUCCESS; 117 if (tempname != NULL) { 118 int e = errno; 119 (void)unlink (tempname); 120 free (tempname); 121 errno = e; 122 } 123 return r; 124 #else /* not __EMX__ */ 108 125 free(t); 109 126 free(dbp); 110 127 return (_close(fd) ? RET_ERROR : RET_SUCCESS); 128 #endif 111 129 } 112 130 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/db/btree/bt_open.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r978 r979 213 213 if ((flags & O_ACCMODE) != O_RDWR) 214 214 goto einval; 215 #ifdef __EMX__ 216 { 217 char namestr[] = "btXXXXXX"; 218 char absname[MAXPATHLEN]; 219 if ((t->bt_fd = mkstemp (namestr)) == -1) 220 goto err; 221 setmode (t->bt_fd, O_BINARY); 222 if (_abspath (absname, namestr, sizeof (absname)) == 0) 223 t->tempname = strdup (absname); 224 } 225 #else /* not __EMX__ */ 215 226 if ((t->bt_fd = tmp()) == -1) 216 227 goto err; 228 #endif /* not __EMX__ */ 217 229 F_SET(t, B_INMEM); 218 230 } … … 341 353 if (t->bt_fd != -1) 342 354 (void)_close(t->bt_fd); 355 #ifdef __EMX__ 356 if (t->tempname != NULL) { 357 (void)unlink(t->tempname); 358 free(t->tempname); 359 } 360 #endif /* __EMX__ */ 343 361 free(t); 344 362 } … … 389 407 } 390 408 409 #ifndef __EMX__ /* bird */ 391 410 static int 392 411 tmp() … … 397 416 char path[MAXPATHLEN]; 398 417 399 #ifndef __EMX__ /* bird */400 418 if (issetugid() == 0) 401 #endif402 419 envtmp = getenv("TMPDIR"); 403 420 (void)snprintf(path, … … 411 428 return(fd); 412 429 } 430 #endif /*!EMX*/ 413 431 414 432 static int -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/db/btree/btree.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r978 r979 380 380 #define B_DB_TXN 0x10000 /* DB_TXN specified. */ 381 381 u_int32_t flags; 382 #ifdef __EMX__ 383 char *tempname; /* Name of temporary file */ 384 #endif /* __EMX__ */ 382 385 } BTREE; 383 386 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/db/db/db.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r978 r979 60 60 #define USE_OPEN_FLAGS \ 61 61 (O_CREAT | O_EXCL /*| O_EXLOCK*/ | O_NONBLOCK | O_RDONLY | \ 62 O_RDWR | /*O_SHLOCK |*/ O_TRUNC )62 O_RDWR | /*O_SHLOCK |*/ O_TRUNC | O_BINARY) 63 63 #else 64 64 #define USE_OPEN_FLAGS \ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/db/hash/hash.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r978 r979 444 444 if (hashp->fp != -1) 445 445 (void)_close(hashp->fp); 446 #ifdef __EMX__ 447 if (hashp->tempname != NULL) { 448 (void)unlink (hashp->tempname); 449 free (hashp->tempname); 450 } 451 #endif /* __EMX__ */ 446 452 447 453 free(hashp); … … 517 523 if (wsize != sizeof(HASHHDR)) { 518 524 errno = EFTYPE; 519 hashp-> error = errno;525 hashp->dbmerrno = errno; /* bird: errno */ 520 526 return (-1); 521 527 } … … 548 554 hashp = (HTAB *)dbp->internal; 549 555 if (flag) { 550 hashp-> error = errno = EINVAL;556 hashp->dbmerrno = errno = EINVAL; /* bird: errno */ 551 557 return (ERROR); 552 558 } … … 565 571 hashp = (HTAB *)dbp->internal; 566 572 if (flag && flag != R_NOOVERWRITE) { 567 hashp-> error = EINVAL;573 hashp->dbmerrno = EINVAL; /* bird: errno */ 568 574 errno = EINVAL; 569 575 return (ERROR); 570 576 } 571 577 if ((hashp->flags & O_ACCMODE) == O_RDONLY) { 572 hashp-> error = errno = EPERM;578 hashp->dbmerrno = errno = EPERM; /* bird: errno */ 573 579 return (ERROR); 574 580 } … … 587 593 hashp = (HTAB *)dbp->internal; 588 594 if (flag && flag != R_CURSOR) { 589 hashp-> error = errno = EINVAL;595 hashp->dbmerrno = errno = EINVAL; /* bird: errno */ 590 596 return (ERROR); 591 597 } 592 598 if ((hashp->flags & O_ACCMODE) == O_RDONLY) { 593 hashp-> error = errno = EPERM;599 hashp->dbmerrno = errno = EPERM; /* bird: errno */ 594 600 return (ERROR); 595 601 } … … 742 748 hashp = (HTAB *)dbp->internal; 743 749 if (flag && flag != R_FIRST && flag != R_NEXT) { 744 hashp-> error = errno = EINVAL;750 hashp->dbmerrno = errno = EINVAL; /* bird: errno */ 745 751 return (ERROR); 746 752 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/db/hash/hash.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r978 r979 73 73 int ssize; /* Segment Size */ 74 74 int sshift; /* Segment shift */ 75 int ovfl_point; /* Where overflow pages are being 75 int ovfl_point; /* Where overflow pages are being 76 76 * allocated */ 77 77 int last_freed; /* Last overflow page freed */ 78 78 int max_bucket; /* ID of Maximum bucket in use */ 79 79 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 81 81 * table */ 82 82 int ffactor; /* Fill factor */ … … 84 84 int hdrpages; /* Size of table header */ 85 85 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 87 87 * points */ 88 88 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 90 90 * bitmaps */ 91 91 } HASHHDR; … … 94 94 HASHHDR hdr; /* Header */ 95 95 int nsegs; /* Number of allocated segments */ 96 int exsegs; /* Number of extra allocated 96 int exsegs; /* Number of extra allocated 97 97 * segments */ 98 98 u_int32_t /* Hash function */ … … 105 105 int cbucket; /* Current bucket */ 106 106 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 110 111 * or no */ 111 int save_file; /* Indicates whether we need to flush 112 int save_file; /* Indicates whether we need to flush 112 113 * file at 113 114 * exit */ 114 115 u_int32_t *mapp[NCACHED]; /* Pointers to page maps */ 115 116 int nmaps; /* Initial number of bitmaps */ 116 int nbufs; /* Number of buffers left to 117 int nbufs; /* Number of buffers left to 117 118 * allocate */ 118 119 BUFHEAD bufhead; /* Header of buffer lru list */ 119 120 SEGMENT *dir; /* Hash Bucket directory */ 121 #ifdef __EMX__ 122 char *tempname; /* Name of temporary file */ 123 #endif /* __EMX__ */ 120 124 } HTAB; 121 125 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/db/hash/hash_page.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r978 r979 69 69 #ifdef DEBUG 70 70 #include <assert.h> 71 #endif 72 #ifdef __EMX__ 73 #include <io.h> 71 74 #endif 72 75 #include "un-namespace.h" … … 868 871 { 869 872 sigset_t set, oset; 873 #ifdef __EMX__ 874 char namestr[] = "hsXXXXXX"; 875 #else /* not __EMX__ */ 870 876 static char namestr[] = "_hashXXXXXX"; 877 #endif /* not __EMX__ */ 871 878 872 879 /* Block signals; make sure file goes away at process exit. */ … … 874 881 (void)_sigprocmask(SIG_BLOCK, &set, &oset); 875 882 if ((hashp->fp = mkstemp(namestr)) != -1) { 883 #ifdef __EMX__ 884 char absname[_MAX_PATH]; 885 setmode (hashp->fp, O_BINARY); 886 if (_abspath (absname, namestr, sizeof (absname)) == 0) 887 hashp->tempname = strdup (absname); 888 #else /* not __EMX__ */ 876 889 (void)unlink(namestr); 890 #endif /* not __EMX__ */ 877 891 (void)_fcntl(hashp->fp, F_SETFD, 1); 878 892 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/db/hash/ndbm.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r978 r979 211 211 212 212 hp = (HTAB *)db->internal; 213 return (hp-> error);213 return (hp->dbmerrno); /* bird: errno */ 214 214 } 215 215 … … 221 221 222 222 hp = (HTAB *)db->internal; 223 hp-> error = 0;223 hp->dbmerrno = 0; /* bird: errno */ 224 224 return (0); 225 225 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.