add __rec_fd, to return a file descriptor
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 25 May 1993 00:48:53 +0000 (16:48 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 25 May 1993 00:48:53 +0000 (16:48 -0800)
SCCS-vsn: lib/libc/db/recno/extern.h 5.5
SCCS-vsn: lib/libc/db/recno/rec_open.c 5.20

usr/src/lib/libc/db/recno/extern.h
usr/src/lib/libc/db/recno/rec_open.c

index ab8ac5b..eadf5cf 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)extern.h    5.4 (Berkeley) %G%
+ *     @(#)extern.h    5.5 (Berkeley) %G%
  */
 
 #include "../btree/extern.h"
  */
 
 #include "../btree/extern.h"
@@ -12,6 +12,7 @@
 int     __rec_close __P((DB *));
 int     __rec_delete __P((const DB *, const DBT *, u_int));
 int     __rec_dleaf __P((BTREE *, PAGE *, int));
 int     __rec_close __P((DB *));
 int     __rec_delete __P((const DB *, const DBT *, u_int));
 int     __rec_dleaf __P((BTREE *, PAGE *, int));
+int     __rec_fd __P((const DB *));
 int     __rec_fmap __P((BTREE *, recno_t));
 int     __rec_fout __P((BTREE *));
 int     __rec_fpipe __P((BTREE *, recno_t));
 int     __rec_fmap __P((BTREE *, recno_t));
 int     __rec_fout __P((BTREE *));
 int     __rec_fpipe __P((BTREE *, recno_t));
index fd4599f..3569f41 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_open.c 5.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)rec_open.c 5.20 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -156,6 +156,7 @@ slow:                       if ((t->bt_rfp = fdopen(rfd, "r")) == NULL)
        /* Use the recno routines. */
        dbp->close = __rec_close;
        dbp->del = __rec_delete;
        /* Use the recno routines. */
        dbp->close = __rec_close;
        dbp->del = __rec_delete;
+       dbp->fd = __rec_fd;
        dbp->get = __rec_get;
        dbp->put = __rec_put;
        dbp->seq = __rec_seq;
        dbp->get = __rec_get;
        dbp->put = __rec_put;
        dbp->seq = __rec_seq;
@@ -185,3 +186,18 @@ err:       sverrno = errno;
        errno = sverrno;
        return (NULL);
 }
        errno = sverrno;
        return (NULL);
 }
+
+int
+__rec_fd(dbp)
+       const DB *dbp;
+{
+       BTREE *t;
+
+       t = dbp->internal;
+
+       if (ISSET(t, R_INMEM)) {
+               errno = ENOENT;
+               return (-1);
+       }
+       return (t->bt_rfd);
+}