Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 19 Feb 2001 09:04:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 19 Feb 2001 09:04:16 -0500 Received: from sphinx.mythic-beasts.com ([195.82.107.246]:32524 "EHLO sphinx.mythic-beasts.com") by vger.kernel.org with ESMTP id ; Mon, 19 Feb 2001 09:04:11 -0500 Date: Mon, 19 Feb 2001 14:04:04 +0000 (GMT) From: Matthew Kirkwood To: Linux Kernel List Subject: sendfile from char device? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm looking for a fast way to initialise a file to zeroes (without holes) and reckoned that sendfile from /dev/zero would be the way to go. But, unfortunately, sendfile (in 2.2 and 2.4) appears not to support sendfile(2)ing a device: $ cat foo.c main() { if(sendfile(1, 0, 0, 1024) < 0) perror("failed"); } $ cc foo.c $ ./a.out /dev/null $ ./a.out /tmp/test failed: Invalid argument I haven't played the printk game, but it looks like it may be tripping up on the fact that devices don't support locks. Or is it the lack of a ->readpage() method on /dev/zero? Matthew. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/