author | Alberto Bertogli
<albertito@gmail.com> 2004-07-22 12:50:32 UTC |
committer | Alberto Bertogli
<albertito@gmail.com> 2007-07-15 13:16:57 UTC |
parent | 1e1c8c0c040fa9af22df757f1c9f3a3753c715e3 |
libjio.h | +1 | -0 |
unix.c | +12 | -0 |
diff --git a/libjio.h b/libjio.h index 52b74db..f4477b4 100644 --- a/libjio.h +++ b/libjio.h @@ -114,6 +114,7 @@ ssize_t jwrite(struct jfs *fs, const void *buf, size_t count); ssize_t jpwrite(struct jfs *fs, const void *buf, size_t count, off_t offset); ssize_t jwritev(struct jfs *fs, const struct iovec *vector, int count); int jtruncate(struct jfs *fs, off_t length); +off_t jlseek(struct jfs *fs, off_t offset, int whence); /* ANSI C stdio wrappers */ struct jfs *jfopen(const char *path, const char *mode); diff --git a/unix.c b/unix.c index 7ae5d0e..03bd9b6 100644 --- a/unix.c +++ b/unix.c @@ -169,3 +169,15 @@ int jtruncate(struct jfs *fs, off_t length) return rv; } +/* lseek wrapper */ +off_t jlseek(struct jfs *fs, off_t offset, int whence) +{ + int rv; + + pthread_mutex_lock(&(fs->lock)); + rv = lseek(fs->fd, offset, whence); + pthread_mutex_unlock(&(fs->lock)); + + return rv; +} +