rec_close.c (56698) | rec_close.c (71579) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993, 1994 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 --- 16 unchanged lines hidden (view full) --- 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 * | 1/*- 2 * Copyright (c) 1990, 1993, 1994 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 --- 16 unchanged lines hidden (view full) --- 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 * $FreeBSD: head/lib/libc/db/recno/rec_close.c 56698 2000-01-27 23:07:25Z jasone $ | 33 * $FreeBSD: head/lib/libc/db/recno/rec_close.c 71579 2001-01-24 13:01:12Z deischen $ |
34 */ 35 36#if defined(LIBC_SCCS) && !defined(lint) 37static char sccsid[] = "@(#)rec_close.c 8.6 (Berkeley) 8/18/94"; 38#endif /* LIBC_SCCS and not lint */ 39 | 34 */ 35 36#if defined(LIBC_SCCS) && !defined(lint) 37static char sccsid[] = "@(#)rec_close.c 8.6 (Berkeley) 8/18/94"; 38#endif /* LIBC_SCCS and not lint */ 39 |
40#include "namespace.h" |
|
40#include <sys/types.h> 41#include <sys/uio.h> 42#include <sys/mman.h> 43 44#include <errno.h> 45#include <limits.h> 46#include <stdio.h> 47#include <unistd.h> | 41#include <sys/types.h> 42#include <sys/uio.h> 43#include <sys/mman.h> 44 45#include <errno.h> 46#include <limits.h> 47#include <stdio.h> 48#include <unistd.h> |
49#include "un-namespace.h" |
|
48 49#include <db.h> 50#include "recno.h" 51 52/* 53 * __REC_CLOSE -- Close a recno tree. 54 * 55 * Parameters: --- 104 unchanged lines hidden (view full) --- 160 } else { 161 iov[1].iov_base = (char *)&t->bt_bval; 162 iov[1].iov_len = 1; 163 164 status = (dbp->seq)(dbp, &key, &data, R_FIRST); 165 while (status == RET_SUCCESS) { 166 iov[0].iov_base = data.data; 167 iov[0].iov_len = data.size; | 50 51#include <db.h> 52#include "recno.h" 53 54/* 55 * __REC_CLOSE -- Close a recno tree. 56 * 57 * Parameters: --- 104 unchanged lines hidden (view full) --- 162 } else { 163 iov[1].iov_base = (char *)&t->bt_bval; 164 iov[1].iov_len = 1; 165 166 status = (dbp->seq)(dbp, &key, &data, R_FIRST); 167 while (status == RET_SUCCESS) { 168 iov[0].iov_base = data.data; 169 iov[0].iov_len = data.size; |
168 if (writev(t->bt_rfd, iov, 2) != data.size + 1) | 170 if (_writev(t->bt_rfd, iov, 2) != data.size + 1) |
169 return (RET_ERROR); 170 status = (dbp->seq)(dbp, &key, &data, R_NEXT); 171 } 172 } 173 174 /* Restore the cursor. */ 175 t->bt_cursor.rcursor = scursor; 176 177 if (status == RET_ERROR) 178 return (RET_ERROR); 179 if ((off = lseek(t->bt_rfd, (off_t)0, SEEK_CUR)) == -1) 180 return (RET_ERROR); 181 if (ftruncate(t->bt_rfd, off)) 182 return (RET_ERROR); 183 F_CLR(t, R_MODIFIED); 184 return (RET_SUCCESS); 185} | 171 return (RET_ERROR); 172 status = (dbp->seq)(dbp, &key, &data, R_NEXT); 173 } 174 } 175 176 /* Restore the cursor. */ 177 t->bt_cursor.rcursor = scursor; 178 179 if (status == RET_ERROR) 180 return (RET_ERROR); 181 if ((off = lseek(t->bt_rfd, (off_t)0, SEEK_CUR)) == -1) 182 return (RET_ERROR); 183 if (ftruncate(t->bt_rfd, off)) 184 return (RET_ERROR); 185 F_CLR(t, R_MODIFIED); 186 return (RET_SUCCESS); 187} |