X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fd.c;h=ae5ef41379d94ea009e6647e62989c74e84cf2b8;hp=7079b51cc95c683af1187f0b4af1412b07e40950;hb=8f69a1302a52163c61142531c4a6944510c3ec12;hpb=767a4a54c967bc4b80bd14d02e89fe91acd848dd diff --git a/fd.c b/fd.c index 7079b51c..ae5ef413 100644 --- a/fd.c +++ b/fd.c @@ -419,34 +419,6 @@ void para_fd_set(int fd, fd_set *fds, int *max_fileno) *max_fileno = PARA_MAX(*max_fileno, fd); } -/** - * Paraslash's wrapper for fgets(3). - * - * \param line Pointer to the buffer to store the line. - * \param size The size of the buffer given by \a line. - * \param f The stream to read from. - * - * \return Unlike the standard fgets() function, an integer value - * is returned. On success, this function returns 1. On errors, -E_FGETS - * is returned. A zero return value indicates an end of file condition. - */ -__must_check int para_fgets(char *line, int size, FILE *f) -{ -again: - if (fgets(line, size, f)) - return 1; - if (feof(f)) - return 0; - if (!ferror(f)) - return -E_FGETS; - if (errno != EINTR) { - PARA_ERROR_LOG("%s\n", strerror(errno)); - return -E_FGETS; - } - clearerr(f); - goto again; -} - /** * Paraslash's wrapper for mmap. * @@ -455,22 +427,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: @@ -639,7 +609,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);