summaryrefslogtreecommitdiffstats
path: root/lib/libc/db/hash
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-01-12 09:23:48 +0000
committerjasone <jasone@FreeBSD.org>2000-01-12 09:23:48 +0000
commit75903038bc52105bc7479fe5f2b75f22f10c1c50 (patch)
treec9e28eda650bbd7eaa3eb22c8d7c75d00a96a451 /lib/libc/db/hash
parent688bb99b3f790aad607b949661d0361486bbe346 (diff)
downloadFreeBSD-src-75903038bc52105bc7479fe5f2b75f22f10c1c50.zip
FreeBSD-src-75903038bc52105bc7479fe5f2b75f22f10c1c50.tar.gz
Add three-tier symbol naming in support of POSIX thread cancellation
points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
Diffstat (limited to 'lib/libc/db/hash')
-rw-r--r--lib/libc/db/hash/hash.c14
-rw-r--r--lib/libc/db/hash/hash_page.c16
2 files changed, 18 insertions, 12 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index 7d000dc..0a2f3c6 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -32,6 +32,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -128,7 +130,7 @@ __hash_open(file, flags, mode, info, dflags)
new_table = 1;
}
if (file) {
- if ((hashp->fp = open(file, flags, mode)) == -1)
+ if ((hashp->fp = _libc_open(file, flags, mode)) == -1)
RETURN_ERROR(errno, error0);
/* if the .db file is empty, and we had permission to create
@@ -137,7 +139,7 @@ __hash_open(file, flags, mode, info, dflags)
fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
new_table = 1;
- (void)fcntl(hashp->fp, F_SETFD, 1);
+ (void)_libc_fcntl(hashp->fp, F_SETFD, 1);
}
if (new_table) {
if (!(hashp = init_hash(hashp, file, (HASHINFO *)info)))
@@ -149,7 +151,7 @@ __hash_open(file, flags, mode, info, dflags)
else
hashp->hash = __default_hash;
- hdrsize = read(hashp->fp, &hashp->hdr, sizeof(HASHHDR));
+ hdrsize = _libc_read(hashp->fp, &hashp->hdr, sizeof(HASHHDR));
#if BYTE_ORDER == LITTLE_ENDIAN
swap_header(hashp);
#endif
@@ -240,7 +242,7 @@ __hash_open(file, flags, mode, info, dflags)
error1:
if (hashp != NULL)
- (void)close(hashp->fp);
+ (void)_libc_close(hashp->fp);
error0:
free(hashp);
@@ -438,7 +440,7 @@ hdestroy(hashp)
free(hashp->mapp[i]);
if (hashp->fp != -1)
- (void)close(hashp->fp);
+ (void)_libc_close(hashp->fp);
free(hashp);
@@ -507,7 +509,7 @@ flush_meta(hashp)
swap_header_copy(&hashp->hdr, whdrp);
#endif
if ((lseek(fp, (off_t)0, SEEK_SET) == -1) ||
- ((wsize = write(fp, whdrp, sizeof(HASHHDR))) == -1))
+ ((wsize = _libc_write(fp, whdrp, sizeof(HASHHDR))) == -1))
return (-1);
else
if (wsize != sizeof(HASHHDR)) {
diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c
index 2c05090..7a204ab 100644
--- a/lib/libc/db/hash/hash_page.c
+++ b/lib/libc/db/hash/hash_page.c
@@ -32,6 +32,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -537,7 +539,7 @@ __get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
else
page = OADDR_TO_PAGE(bucket);
if ((lseek(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) ||
- ((rsize = read(fd, p, size)) == -1))
+ ((rsize = _libc_read(fd, p, size)) == -1))
return (-1);
bp = (u_int16_t *)p;
if (!rsize)
@@ -608,7 +610,7 @@ __put_page(hashp, p, bucket, is_bucket, is_bitmap)
else
page = OADDR_TO_PAGE(bucket);
if ((lseek(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) ||
- ((wsize = write(fd, p, size)) == -1))
+ ((wsize = _libc_write(fd, p, size)) == -1))
/* Errno is set */
return (-1);
if (wsize != size) {
@@ -712,7 +714,8 @@ overflow_page(hashp)
#define OVMSG "HASH: Out of overflow pages. Increase page size\n"
if (offset > SPLITMASK) {
if (++splitnum >= NCACHED) {
- (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
+ (void)_libc_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) -
+ 1);
return (0);
}
hashp->OVFL_POINT = splitnum;
@@ -725,7 +728,8 @@ overflow_page(hashp)
if (free_bit == (hashp->BSIZE << BYTE_SHIFT) - 1) {
free_page++;
if (free_page >= NCACHED) {
- (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
+ (void)_libc_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) -
+ 1);
return (0);
}
/*
@@ -749,7 +753,7 @@ overflow_page(hashp)
offset++;
if (offset > SPLITMASK) {
if (++splitnum >= NCACHED) {
- (void)write(STDERR_FILENO, OVMSG,
+ (void)_libc_write(STDERR_FILENO, OVMSG,
sizeof(OVMSG) - 1);
return (0);
}
@@ -867,7 +871,7 @@ open_temp(hashp)
(void)sigprocmask(SIG_BLOCK, &set, &oset);
if ((hashp->fp = mkstemp(namestr)) != -1) {
(void)unlink(namestr);
- (void)fcntl(hashp->fp, F_SETFD, 1);
+ (void)_libc_fcntl(hashp->fp, F_SETFD, 1);
}
(void)sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
return (hashp->fp != -1 ? 0 : -1);
OpenPOWER on IntegriCloud