X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fd.c;h=86a1f10541f8ca64ffb659d2fc637ea61865e7ff;hp=49736448a7fe3013a69596525ea4d815358bd226;hb=e8d5da94efd6cbb0aa75f57290c76d9992ff8f47;hpb=12dc519663c785a3c0be60202d0825ddb8e8d02e diff --git a/fd.c b/fd.c index 49736448..86a1f105 100644 --- a/fd.c +++ b/fd.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2006 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2006 Andre Noll , see file COPYING. */ /** \file fd.c Helper functions for file descriptor handling. */ @@ -320,9 +316,9 @@ out: * * \param fn The file name. * - * \return Non-zero iff file exists. + * \return True iff file exists. */ -int file_exists(const char *fn) +bool file_exists(const char *fn) { struct stat statbuf; @@ -459,22 +455,20 @@ again: * PROT_EXEC PROT_READ PROT_WRITE. * \param flags Exactly one of MAP_SHARED and MAP_PRIVATE. * \param fd The file to mmap from. - * \param offset Mmap start. * \param map Result pointer. * * \return Standard. * * \sa mmap(2). */ -int para_mmap(size_t length, int prot, int flags, int fd, off_t offset, - void *map) +int para_mmap(size_t length, int prot, int flags, int fd, void *map) { void **m = map; errno = EINVAL; if (!length) goto err; - *m = mmap(NULL, length, prot, flags, fd, offset); + *m = mmap(NULL, length, prot, flags, fd, (off_t)0); if (*m != MAP_FAILED) return 1; err: @@ -643,7 +637,7 @@ int mmap_full_file(const char *path, int open_mode, void **map, if (S_ISDIR(file_status.st_mode)) goto out; - ret = para_mmap(*size, mmap_prot, mmap_flags, fd, 0, map); + ret = para_mmap(*size, mmap_prot, mmap_flags, fd, map); out: if (ret < 0 || !fd_ptr) close(fd);