Lines Matching refs:fd
47 static int getFileStartAndLength(int fd, off_t *start_, size_t *length_)
55 start = lseek(fd, 0L, SEEK_CUR);
56 end = lseek(fd, 0L, SEEK_END);
57 (void) lseek(fd, start, SEEK_SET);
78 * everything from fd's current offset on.
83 int sysLoadFileInShmem(int fd, MemMapping* pMap)
91 if (getFileStartAndLength(fd, &start, &length) < 0)
98 actual = read(fd, memPtr, length);
112 * Map a file (from fd's current offset) into a shared, read-only memory
118 int sysMapFileInShmem(int fd, MemMapping* pMap)
126 if (getFileStartAndLength(fd, &start, &length) < 0)
129 memPtr = mmap(NULL, length, PROT_READ, MAP_FILE | MAP_SHARED, fd, start);
132 fd, (int) start, strerror(errno));
143 * Map part of a file (from fd's current offset) into a shared, read-only
149 int sysMapFileSegmentInShmem(int fd, off_t start, long length,
160 if (getFileStartAndLength(fd, &dummy, &fileLength) < 0)
175 fd, actualStart);
178 (int) actualLength, fd, (int) actualStart, strerror(errno));