RE: mmap text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Valdis,

> On Tue, 31 Mar 2015 17:11:33 +0530, Ssagarr Patil said:
>> Hi,
>
>> while (loop) {
>>         /* get the current file size of output file */
>>         filesize = lseek(outfd, 0, SEEK_END);
>>
>>         /* Increase file size */
>>         ftruncate(outfd, (off_t)filesize + (off_t)buf.size
>
>
> Are you sure you want to do these two *every time* through the loop?
>
>>             /* mmap destination file */
>>             if((dest = mmap(0, buf.size, PROT_WRITE, MAP_SHARED, outfd, filesize)) == (void *) -1) {
>
> Similarly here - usually the *entire* file gets mmap'ed.
>
> Also, what did perror() output? (probably nothing, since you stuck a printf
> in front of it, which probably reset errno on you).
>
>>     memcpy(dest, src, size);
>>     munmap(dest);
>
> You're not going to achieve faster throughput by adding to the syscall
> overhead.
>
any pointers on avoiding syscall this then ?

Regards,
Sagar

 		 	   		  
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux