DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 65OCS9m23034142 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 65OCS9m23034142 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=B7vshMAg X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5B9A4BA2E14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1782304087; bh=L/SfnVaiTbyqlqIGZqgw7UXLgLtqQrSGiEo0gmLjYss=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=B7vshMAgEUhECswXnTjEAJAX2on9nFb3hNgCeoqLZfbIqwcv/NjgJ0in42Zc9x0ng NamZqhpx+2c/smFhOqMW1G5WF9w+27kZRMwYOTk40IrOIGUNhnd74Vx3p6y/jGlQT1 y9/2cgZ1lkRkgDEU6RWQ/B47U/lgJrinJw5kMSfg= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B535F4BA2E05 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B535F4BA2E05 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782304039; cv=none; b=bFzvoS50zPkZUhZ/wY7BdYx9RV6Uhk47xbq9pPno3q6cvozd0ikmLhuGco5QgbUVVq0smnXS0nqHsGj7UqiJqsi34NPc4qD9h31rb5vXYHCCYtX0zXW//a15Xi2FH/1lFKUyaPQ6GepklzjZeuBB8k3HKQZ/fGc1u379/6tXO5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782304039; c=relaxed/simple; bh=M9M8DmAlvB43XR8CIt30WvXWvtBq74rBq6kqrhSyfCI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=l6f4xwlja0hhJJdjIsaxZnxKueLzyOmpsmk9RtzOZLVeyxID8kfSSs+87QV3K1pKypINFL1K3HIwAm4TjG73OlhY6UupaHgVCD/wlXqrUvz3YbiOD/5kbdupRD9xx3RUIA0e98CKwzJ7V2gv8TE73RSO9e/t/tB0aoQ2iCvFBRU= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=nrubsig.org header.i=@nrubsig.org header.a=rsa-sha256 header.s=dreamhost header.b=NFtW3Vrs DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B535F4BA2E05 X-Sender-Id: dreamhost|x-authsender|gisburn AT nrubsig DOT org X-Sender-Id: dreamhost|x-authsender|gisburn AT nrubsig DOT org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|gisburn AT nrubsig DOT org X-MailChannels-Auth-Id: dreamhost X-Attack-Bottle: 436986cd5428ced5_1782304037573_279414574 X-MC-Loop-Signature: 1782304037572:4066690987 X-MC-Ingress-Time: 1782304037572 X-Gm-Message-State: AOJu0Yz0J0ViekJhFcSLToyWjvbp5FWRREzYmSAwsJV/T6VfMEhFP7BY 4LZSGSjytm7XZweAqmIxFDKZgzqF4ENcuMqeXV36C+1uA/qQcjN8YWARU3CQcJ03VrsZXR01a40 kuxMOWwaBu4SSOzJSp9yy57H8WWmT/q4= X-Received: by 2002:a05:6000:41e6:b0:461:d369:ece6 with SMTP id ffacd0b85a97d-46662806a6fmr29086197f8f.30.1782304035761; Wed, 24 Jun 2026 05:27:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 24 Jun 2026 14:26:37 +0200 X-Gmail-Original-Message-ID: X-Gm-Features: AVVi8CdunI8nQpqdyfIygoldUmu0tan3cNIsZK5VhpVgW1-iHYuPGLmI944-MZo Message-ID: Subject: Re: Cygwin sparse file support: Please support fcntl(..., F_FREESP, ...) To: cygwin AT cygwin DOT com X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Roland Mainz via Cygwin Reply-To: Roland Mainz Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 65OCS9m23034142 On Sat, Feb 15, 2025 at 4:14 PM Cedric Blancher via Cygwin wrote: > Could Cygwin 3.6 please support fcntl(...,F_FREESP,...) and > cntl(...,F_FREESP64,...), as specified in > https://docs.oracle.com/cd/E19253-01/816-5167/fcntl-2/index.html > > Lots of older software from Solaris, SUPER/UX, CrayOS use F_FREESP for > punching a hole into a file, and IMO it'll be nice if this works for > Cygwin out of the box. 1. Ced: Could you please check whether the prototype code works for you ? If "yes" then I'll make a patch for cygwin.dll based on this... 2. Takashi: What do you think ? The API comes from Solaris, and is implememted by at least FreeBSD, Unicos, SUPER/UX, etc. and is usually used by database and HPC software. Prototype patch: ---- snip ---- #ifndef F_FREESP #define F_FREESP 15 #endif #ifndef F_ALLOCSP #define F_ALLOCSP 16 #endif /* FIXME: This should use a |struct flock| like Solaris/FreeBSD |fnctl()| */ int fcntl_sparse_space_management_emulate(int fd, int cmd, off_t offset, off_t len) { off_t file_size; off_t end; file_size = lseek(fd, 0, SEEK_END); if (file_size == (off_t)-1) return -1; if (len == 0) end = file_size; else end = offset + len; switch (cmd) { case F_FREESP: if (offset >= file_size) return 0; if (end >= file_size) { return ftruncate(fd, offset); } else { if (fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset, end - offset) == -1) { return -1; } } return 0; case F_ALLOCSP: if (len == 0) { return 0; } if (fallocate(fd, 0, offset, len) == -1) { return -1; } return 0; default: errno = EINVAL; return -1; } } ---- snip ---- ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland DOT mainz AT nrubsig DOT org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple