🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.lisp
25 messages
25 total messages Started by Madhu Thu, 26 Nov 2026 04:15
Re: read-file for sbcl
#68
Author: Madhu
Date: Thu, 26 Nov 2026 04:15
27 lines
1996 bytes
* steve g <87ld6gl8ah.fsf@gmail.com> :
Wrote on Wed, 25 Nov 2026 19:56:38 -0500:

> I am working on a project and came across the need to read files very
> easily. I created this package for SBCL. If you need or want a rather
> fast read-file function; Just run make, load, the compile.
>
> I know this is not a binary group, I'll try try and attach the base64.
>
> I have been using this version of file-length-by-name for quite some
> time. It seems more accurate that stat. It just uses lseek.

"more accurate" ? when are they never equal?

> The attachments should be alright. Let me know if you have any questions
> or unexpressed anger...

1. "sbcl-only" is a virtue only for claude code customers
2. if sbcl-only then why the posix c sharedlib, just use cffi for
syscalls
3. iolib uses posix for io (maybe it loses to your code because of
streams)
4. i cant imagine in 2020s linux hw where this would make a practical
difference

Re: read-file for sbcl
#70
Author: steve g
Date: Sat, 28 Nov 2026 03:31
58 lines
3330 bytes
Madhu <enometh@meer.net> writes:

> * steve g <87ld6gl8ah.fsf@gmail.com> :
> Wrote on Wed, 25 Nov 2026 19:56:38 -0500:
>
>> I am working on a project and came across the need to read files very
>> easily. I created this package for SBCL. If you need or want a rather
>> fast read-file function; Just run make, load, the compile.
>>
>> I know this is not a binary group, I'll try try and attach the base64.
>>
>> I have been using this version of file-length-by-name for quite some
>> time. It seems more accurate that stat. It just uses lseek.
>
> "more accurate" ? when are they never equal?

I do not feel like exploring memory access time.

>> The attachments should be alright. Let me know if you have any questions
>> or unexpressed anger...
>
> 1. "sbcl-only" is a virtue only for claude code customers

I do not know what claud is. Any info would be appreciated.

> 2. if sbcl-only then why the posix c sharedlib, just use cffi for
> syscalls

I use POSIX because I am not stupid. Please, you must be kinding me? I
need 23,000 lines of quicklisp code to read the size of a file.

``They'' were so pissed off at the pathname spec they could not get to a
``byte'' specifier. This was mostly do to VMS or a VAC; can't remeber.
If you happen to have a mainframe for sale I have some property for sale
in the middle of a desert (something like that).

> 3. iolib uses posix for io (maybe it loses to your code because of
> streams)

I do not know what libio is. The basic idea is to help users of sbcl to
do something simple without every one having to rewrite the same code.
You are free to not use it and stick with iolib. This doesn't bother me
any.

> 4. i cant imagine in 2020s linux hw where this would make a practical
> difference

That's what I said 20 years ago.

Stat must load lots of stuff into memory. When using lseek to get the
length of the file it is ``kinda loaded into memory'' or a cache.
Believe me my SCSI drives definitely knew the difference between cached
io and scatter brain read.


Anywho, what is this claude you speed of? Let me guess I need quicklisp.

Re: read-file for sbcl
#72
Author: steve g
Date: Sat, 28 Nov 2026 03:40
50 lines
2812 bytes
Madhu <enometh@meer.net> writes:

> * steve g <87ld6gl8ah.fsf@gmail.com> :
> Wrote on Wed, 25 Nov 2026 19:56:38 -0500:
>
>> I am working on a project and came across the need to read files very
>> easily. I created this package for SBCL. If you need or want a rather
>> fast read-file function; Just run make, load, the compile.
>>
>> I know this is not a binary group, I'll try try and attach the base64.
>>
>> I have been using this version of file-length-by-name for quite some
>> time. It seems more accurate that stat. It just uses lseek.
>
> "more accurate" ? when are they never equal?

How much memory does stat need to work?

>> The attachments should be alright. Let me know if you have any questions
>> or unexpressed anger...
>
> 1. "sbcl-only" is a virtue only for claude code customers

I do not know what clause is. I like sbcl because it is very good software.


> 2. if sbcl-only then why the posix c sharedlib, just use cffi for
> syscalls

I do not understand wht software should be written to work on all
platforms. IOCTL is implementation specific.

> 3. iolib uses posix for io (maybe it loses to your code because of
> streams)

I do not use quicklisp unless I'm trying to figure out what people are
talking about.

> 4. i cant imagine in 2020s linux hw where this would make a practical
> difference


That is what I said 20 years ago. My SCSI disk drivers definitely knew
the difference.


anywho, How do I find out more about this CLAUD. I am thinking about writing
another rule system for constraints.

In anycase You are welcome to use the software.
Re: read-file for sbcl
#75
Author: George Neuner
Date: Sat, 28 Nov 2026 05:11
43 lines
2648 bytes
On Thu, 26 Nov 2026 09:45:59 +0530, Madhu <enometh@meer.net> wrote:


>* steve g <87ld6gl8ah.fsf@gmail.com> :
>Wrote on Wed, 25 Nov 2026 19:56:38 -0500:
>
>> I am working on a project and came across the need to read files very
>> easily. I created this package for SBCL. If you need or want a rather
>> fast read-file function; Just run make, load, the compile.
>>
>> I know this is not a binary group, I'll try try and attach the base64.
>>
>> I have been using this version of file-length-by-name for quite some
>> time. It seems more accurate that stat. It just uses lseek.
>
>"more accurate" ? when are they never equal?

I have never found them different, but ...


lseek() is not guaranteed to work with special files - only open(),
close() and stat() are guaranteed for them.

lseek() may work for special files currently - or it may work in
whatever disto Steve happens to be using ... but it is not guaranteed
by any documentation, and it may not continue to work in the future.

I wouldn't rely on it.

Also you can stat() a file without opening it.


>> The attachments should be alright. Let me know if you have any questions
>> or unexpressed anger...
>
>1. "sbcl-only" is a virtue only for claude code customers
>2. if sbcl-only then why the posix c sharedlib, just use cffi for
>syscalls
>3. iolib uses posix for io (maybe it loses to your code because of
>streams)
>4. i cant imagine in 2020s linux hw where this would make a practical
>difference
>
Re: read-file for sbcl
#76
Author: tfb
Date: Sat, 28 Nov 2026 08:30
8 lines
1368 bytes
steve g <Sgonedes1977@gmail.com> wrote:
>
> Stat must load lots of stuff into memory

This is confused in a whole new way.

-- 
tfeb.org/computer/
Re: read-file for sbcl
#77
Author: Alexander Schreiber
Date: Sat, 28 Nov 2026 11:34
71 lines
3721 bytes
steve g <Sgonedes1977@gmail.com> wrote:
> Madhu <enometh@meer.net> writes:
>
>> * steve g <87ld6gl8ah.fsf@gmail.com> :
>> Wrote on Wed, 25 Nov 2026 19:56:38 -0500:
>>
>>> I am working on a project and came across the need to read files very
>>> easily. I created this package for SBCL. If you need or want a rather
>>> fast read-file function; Just run make, load, the compile.
>>>
>>> I know this is not a binary group, I'll try try and attach the base64.
>>>
>>> I have been using this version of file-length-by-name for quite some
>>> time. It seems more accurate that stat. It just uses lseek.
>>
>> "more accurate" ? when are they never equal?
>
> I do not feel like exploring memory access time.
>
>>> The attachments should be alright. Let me know if you have any questions
>>> or unexpressed anger...
>>
>> 1. "sbcl-only" is a virtue only for claude code customers
>
> I do not know what claud is. Any info would be appreciated.

LLM based AI system, great for slopping stuff together, not great for
actually writing good software especially if skill and judgement are
lacking in the operator.

>> 2. if sbcl-only then why the posix c sharedlib, just use cffi for
>> syscalls
>
> I use POSIX because I am not stupid. Please, you must be kinding me? I
> need 23,000 lines of quicklisp code to read the size of a file.

What ... are you doing? In SBCL with the sb-posix module (and all of that
is about 3300 lines of Lisp, which includes win32 support as well as tests)
getting the size of the file via sb-posix via libc via the kernel is just
one line: (sb-posix:stat-size (sb-posix:stat "/etc/hosts"))

>> 4. i cant imagine in 2020s linux hw where this would make a practical
>> difference
>
> That's what I said 20 years ago.
>
> Stat must load lots of stuff into memory.

Yeah, it has to read an entire block from storage (512/4096 bytes depending
on details). All because the inode on ext4 by default is an absolutely massive
256 bytes. And that assumes fully cold caches.

> When using lseek to get the
> length of the file it is ``kinda loaded into memory'' or a cache.

About that ... where do you think the kernel gets the size of the file?
And how do you think that informations "gets kinda loaded in memory" (and
that phrase is quite telling)? Yes, the kernel reads the inode from disk.
Although in reality, is has done so when you opened the file for lseek(2)
so for the stat call it already has that data.

> Believe me my SCSI drives definitely knew the difference between cached
> io and scatter brain read.

Because cached IO (at the OS level) doesn't touch the drive.

Kind regards,
           Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
Re: read-file for sbcl
#79
Author: tfb
Date: Sat, 28 Nov 2026 12:51
13 lines
1816 bytes
Alexander Schreiber <als@usenet.thangorodrim.de> wrote:

> Yeah, it has to read an entire block from storage (512/4096 bytes depending
> on details). All because the inode on ext4 by default is an absolutely massive
> 256 bytes. And that assumes fully cold caches.

Right.  And *you're about to read the inode anyway* since you're about to
read the file.  So the marginal cost of stat() is utterly negligible.  Oh,
and by the way, to get to the point where you can call lseek() *you've also
read the inode*!

-- 
tfeb.org/computer/
Re: read-file for sbcl
#80
Author: Madhu
Date: Sat, 28 Nov 2026 14:47
21 lines
2312 bytes
* tfb <11eeio5$2i30h$1@dont-email.me> :
Wrote on Sat, 28 Nov 2026 12:51:17 -0000 (UTC):
> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>> Yeah, it has to read an entire block from storage (512/4096 bytes depending
>> on details). All because the inode on ext4 by default is an absolutely massive
>> 256 bytes. And that assumes fully cold caches.
> Right.  And *you're about to read the inode anyway* since you're about to
> read the file.  So the marginal cost of stat() is utterly negligible.  Oh,
> and by the way, to get to the point where you can call lseek() *you've also
> read the inode*!

I haven't had problems since I got nvme, but my earlier laptop I had a 1
TB 3.5' "Western Digital Black (SMR)" stat times were an issue and I had
to patch programs that eagerly `stat'ed stuff.

zsh startup on a cold cache takes 15 seconds (.2 sec on a mirror "zfs
filesystem" with nvme) and directories with say 40,000 files take
minutes to dired. tracing performace at the syscall level didn't show
anything, i suspect it's some firmware black magic that's delaying
things which I don't know how to measure
Re: read-file for sbcl
#81
Author: Alexander Schreiber
Date: Sat, 28 Nov 2026 16:58
44 lines
3282 bytes
Madhu <enometh@meer.net> wrote:
>
> * tfb <11eeio5$2i30h$1@dont-email.me> :
> Wrote on Sat, 28 Nov 2026 12:51:17 -0000 (UTC):
>> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>>> Yeah, it has to read an entire block from storage (512/4096 bytes depending
>>> on details). All because the inode on ext4 by default is an absolutely massive
>>> 256 bytes. And that assumes fully cold caches.
>> Right.  And *you're about to read the inode anyway* since you're about to
>> read the file.  So the marginal cost of stat() is utterly negligible.  Oh,
>> and by the way, to get to the point where you can call lseek() *you've also
>> read the inode*!
>
> I haven't had problems since I got nvme, but my earlier laptop I had a 1
> TB 3.5' "Western Digital Black (SMR)" stat times were an issue and I had
> to patch programs that eagerly `stat'ed stuff.

SMR is the problem here. Specifically, device-managed SMR where the host
OS is not aware of the cheerfully-breaking-various-assumptions hilarity
going on on the other side of the disk interface.

> zsh startup on a cold cache takes 15 seconds (.2 sec on a mirror "zfs
> filesystem" with nvme) and directories with say 40,000 files take
> minutes to dired. tracing performace at the syscall level didn't show
> anything, i suspect it's some firmware black magic that's delaying
> things which I don't know how to measure

I suspect a big part here might be implicit writes caused by reads
(atime updates) - those normally tiny (one block) writes would be
massively amplified inside the drive due to the need to rewrite an
entire block (with sizes of e.g. 256M) due to the device-managed SMR.
And since the implicit writes are triggered by the kernel (well, FS
driver) and the write amplification happens inside the drive, all you'd
see at the syscall border are some weird massive latency spikes.

Device-managed SMR is just bad. Host-managed SMR however is fine when
used with a suitable storage system (e.g. the drive is backing storage
for HDFS with 256M block size).

Kind regards,
           Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
Re: read-file for sbcl
#82
Author: tfb
Date: Sat, 28 Nov 2026 20:19
11 lines
1742 bytes
Alexander Schreiber <als@usenet.thangorodrim.de> wrote:

> I suspect a big part here might be implicit writes caused by reads
> (atime updates)

Not a rhetorical question: don't all modern systems default to the
equivalent of the noatime NFS mount option?  I'd assumed they did, but may
well be wrong.

-- 
tfeb.org/computer/
Re: read-file for sbcl
#83
Author: Alexander Schreiber
Date: Sat, 28 Nov 2026 23:37
21 lines
1978 bytes
tfb <tfb@work.it.out> wrote:
> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>
>> I suspect a big part here might be implicit writes caused by reads
>> (atime updates)
>
> Not a rhetorical question: don't all modern systems default to the
> equivalent of the noatime NFS mount option?  I'd assumed they did, but may
> well be wrong.

So Linux, NetBSD (and thus, by implication, OpenBSD) and FreeBSD all offer
a "noatime" mount option to turn off the default of updating atime. It
was traditionally used for filesystems on less durable media (e.g. root
on CF card for some routers) to reduce media wear, but I suspect it would
also help if one is stuck with SMR drives.

Kind regards,
           Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
Re: read-file for sbcl
#85
Author: Madhu
Date: Sun, 29 Nov 2026 01:56
28 lines
2580 bytes
* Alexander Schreiber <slrn11gmpdu.1opg5.als@mordor.angband.thangorodrim.de> :
Wrote on Sun, 29 Nov 2026 00:37:34 +0100:
> tfb <tfb@work.it.out> wrote:
>> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>>
>>> I suspect a big part here might be implicit writes caused by reads
>>> (atime updates)
>>
>> Not a rhetorical question: don't all modern systems default to the
>> equivalent of the noatime NFS mount option?  I'd assumed they did, but may
>> well be wrong.
>
> So Linux, NetBSD (and thus, by implication, OpenBSD) and FreeBSD all offer
> a "noatime" mount option to turn off the default of updating atime. It
> was traditionally used for filesystems on less durable media (e.g. root
> on CF card for some routers) to reduce media wear, but I suspect it would
> also help if one is stuck with SMR drives.

In my casse atime writes are not the problem as I've always used
`noatime' to mount all filesystems. (relatime on tmpfs)

AFAICT The firmware delay shennigans don't depend disk writes, they
happen on reads, and on readonly pools too.  (It may be a zfs thing, I
haven't tried ext4 to try to reproduce the problem on that
hardware. (messy home directory is messy)


Re: read-file for sbcl
#86
Author: steve g
Date: Sun, 29 Nov 2026 23:29
65 lines
3268 bytes
Alexander Schreiber <als@usenet.thangorodrim.de> writes:

> What ... are you doing? In SBCL with the sb-posix module (and all of that
> is about 3300 lines of Lisp, which includes win32 support as well as tests)
> getting the size of the file via sb-posix via libc via the kernel is just
> one line: (sb-posix:stat-size (sb-posix:stat "/etc/hosts"))


Again I am using LSEEK to preload the cache. _This is implementation
specific_. If you enabled the caching option in your linux kernel, This
will probably work a bit better.


>>> 4. i cant imagine in 2020s linux hw where this would make a practical
>>> difference
>>
>> That's what I said 20 years ago.
>>
>> Stat must load lots of stuff into memory.
>
> Yeah, it has to read an entire block from storage (512/4096 bytes depending
> on details).

Linux likes number 4096.

> All because the inode on ext4 by default is an absolutely massive
> 256 bytes. And that assumes fully cold caches.

ext2 is much faster.

>> When using lseek to get the
>> length of the file it is ``kinda loaded into memory'' or a cache.
>

> About that ... where do you think the kernel gets the size of the file?

from the inode?

> And how do you think that informations "gets kinda loaded in memory" (and
> that phrase is quite telling)?

Ummm? Like I said there is a kerel option for caching. Maybe the kernel?

> Yes, the kernel reads the inode from disk.
> Although in reality, is has done so when you opened the file for
> lseek(2)

Correct.

> so for the stat call it already has that data.


stat uses memory that I do not need.

>> Believe me my SCSI drives definitely knew the difference between cached
>> io and scatter brain read.

> Because cached IO (at the OS level) doesn't touch the drive.

SCSI drives run on their own bios before loading the operating system.
This is usually done in the SCSI bios. it depends on your scsi
disk controller.

Anyways, why do you care? Fucking children.
Re: read-file for sbcl
#87
Author: steve g
Date: Sun, 29 Nov 2026 23:39
30 lines
2837 bytes
Madhu <enometh@meer.net> writes:

> * tfb <11eeio5$2i30h$1@dont-email.me> :
> Wrote on Sat, 28 Nov 2026 12:51:17 -0000 (UTC):
>> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>>> Yeah, it has to read an entire block from storage (512/4096 bytes depending
>>> on details). All because the inode on ext4 by default is an absolutely massive
>>> 256 bytes. And that assumes fully cold caches.
>> Right.  And *you're about to read the inode anyway* since you're about to
>> read the file.  So the marginal cost of stat() is utterly negligible.  Oh,
>> and by the way, to get to the point where you can call lseek() *you've also
>> read the inode*!
>
> I haven't had problems since I got nvme, but my earlier laptop I had a 1
> TB 3.5' "Western Digital Black (SMR)" stat times were an issue and I had
> to patch programs that eagerly `stat'ed stuff.


Are you shitting me? A fucking labtop! Let me guess you did not get your
hardisk drives from japan because you did not know any better. I usually
have to wait a week to get those scsi drives. I will admit, they are
cost effective (to me at least assuming they have any extras). they do
work in a labtop, they also fit in the machine's frame; but it is
japanese so throw it out for some bullshit indian/chinese made drives
that actually cost money for better advertising.

I find your attitude offensive.

I hope you have fun in your next coorporate meeting. I hear that the
japanese can be quite aggressive.
Re: read-file for sbcl
#88
Author: steve g
Date: Sun, 29 Nov 2026 23:41
49 lines
3730 bytes
Alexander Schreiber <als@usenet.thangorodrim.de> writes:

> Madhu <enometh@meer.net> wrote:
>>
>> * tfb <11eeio5$2i30h$1@dont-email.me> :
>> Wrote on Sat, 28 Nov 2026 12:51:17 -0000 (UTC):
>>> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>>>> Yeah, it has to read an entire block from storage (512/4096 bytes depending
>>>> on details). All because the inode on ext4 by default is an absolutely massive
>>>> 256 bytes. And that assumes fully cold caches.
>>> Right.  And *you're about to read the inode anyway* since you're about to
>>> read the file.  So the marginal cost of stat() is utterly negligible.  Oh,
>>> and by the way, to get to the point where you can call lseek() *you've also
>>> read the inode*!
>>
>> I haven't had problems since I got nvme, but my earlier laptop I had a 1
>> TB 3.5' "Western Digital Black (SMR)" stat times were an issue and I had
>> to patch programs that eagerly `stat'ed stuff.
>
> SMR is the problem here. Specifically, device-managed SMR where the host
> OS is not aware of the cheerfully-breaking-various-assumptions hilarity
> going on on the other side of the disk interface.
>
>> zsh startup on a cold cache takes 15 seconds (.2 sec on a mirror "zfs
>> filesystem" with nvme) and directories with say 40,000 files take
>> minutes to dired. tracing performace at the syscall level didn't show
>> anything, i suspect it's some firmware black magic that's delaying
>> things which I don't know how to measure
>
> I suspect a big part here might be implicit writes caused by reads
> (atime updates)


THANK YOU! like duh. `` I need nano-second timestamps". fucking children.


> - those normally tiny (one block) writes would be
> massively amplified inside the drive due to the need to rewrite an
> entire block (with sizes of e.g. 256M) due to the device-managed SMR.
> And since the implicit writes are triggered by the kernel (well, FS
> driver) and the write amplification happens inside the drive, all you'd
> see at the syscall border are some weird massive latency spikes.

> Device-managed SMR is just bad. Host-managed SMR however is fine when
> used with a suitable storage system (e.g. the drive is backing storage
> for HDFS with 256M block size).
>
> Kind regards,
>            Alex.
Re: read-file for sbcl
#89
Author: steve g
Date: Sun, 29 Nov 2026 23:43
13 lines
1906 bytes
tfb <tfb@work.it.out> writes:

> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>
>> I suspect a big part here might be implicit writes caused by reads
>> (atime updates)
>
> Not a rhetorical question: don't all modern systems default to the
> equivalent of the noatime NFS mount option?  I'd assumed they did, but may
> well be wrong.

You fucking idiot. No. A mounted drive? Do you actually need the kernel
to hold your fucking hand when you piss.
Re: read-file for sbcl
#90
Author: steve g
Date: Sun, 29 Nov 2026 23:45
33 lines
2966 bytes
Madhu <enometh@meer.net> writes:

> * Alexander Schreiber <slrn11gmpdu.1opg5.als@mordor.angband.thangorodrim.de> :
> Wrote on Sun, 29 Nov 2026 00:37:34 +0100:
>> tfb <tfb@work.it.out> wrote:
>>> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>>>
>>>> I suspect a big part here might be implicit writes caused by reads
>>>> (atime updates)
>>>
>>> Not a rhetorical question: don't all modern systems default to the
>>> equivalent of the noatime NFS mount option?  I'd assumed they did, but may
>>> well be wrong.
>>
>> So Linux, NetBSD (and thus, by implication, OpenBSD) and FreeBSD all offer
>> a "noatime" mount option to turn off the default of updating atime. It
>> was traditionally used for filesystems on less durable media (e.g. root
>> on CF card for some routers) to reduce media wear, but I suspect it would
>> also help if one is stuck with SMR drives.
>
> In my casse atime writes are not the problem as I've always used
> `noatime' to mount all filesystems. (relatime on tmpfs)
>
> AFAICT The firmware delay shennigans don't depend disk writes, they
> happen on reads, and on readonly pools too.  (It may be a zfs thing, I
> haven't tried ext4 to try to reproduce the problem on that
> hardware. (messy home directory is messy)


Mounting the filesystem? Have you ever tried using a SCSI disk drive
with raw partition and let the fucking disc controller do it's fucking
job?
Re: read-file for sbcl
#91
Author: steve g
Date: Sun, 29 Nov 2026 23:58
45 lines
2804 bytes
George Neuner <gneuner2@comcast.net> writes:

>
> lseek() is not guaranteed to work with special files - only open(),
> close() and stat() are guaranteed for them.
>
> lseek() may work for special files currently - or it may work in
> whatever disto Steve happens to be using ... but it is not guaranteed
> by any documentation, and it may not continue to work in the future.
>
> I wouldn't rely on it.

I appreciate that; I am rather used to this. What do you use to
determine the file size on EXT2?

> Also you can stat() a file without opening it.


Please read lskeek (2).


``

     lseek()  allows  the file offset to be set beyond the end of the file (but
     this does not change the size of the file).  If data is later  written  at
     this point, subsequent reads of the data in the gap (a "hole") return null
     bytes ('\0') until data is actually written into the gap.



RETURN VALUE
     Upon  successful completion, lseek() returns the resulting offset location
     as measured in bytes from the beginning of the file.  On error, the  value
     (off_t) -1 is returned and errno is set to indicate the error.
''

anywayz needed some gestalt therapy. You 2 are worth every penny :)
Seriously you guys could provide actually implementation stuff or just
complain. What is wrong with it? It was written by me.


The real issue is having an executable stack and loading an executable,
stored past the end of the file, and loading it directly into a stack
function! I though that was rather cool when I was 13.
Re: read-file for sbcl
#96
Author: steve
Date: Mon, 30 Nov 2026 03:05
9 lines
1657 bytes
tfb wrote:
> steve g <Sgonedes1977@gmail.com> wrote:
>>
>> Stat must load lots of stuff into memory
> 
> This is confused in a whole new way.
> 

stat uses it's own header file. this is lots of stuff.
Re: read-file for sbcl
#97
Author: tfb
Date: Mon, 30 Nov 2026 07:02
9 lines
1445 bytes
steve <loft@centurylink.net> wrote:

> stat uses it's own header file. this is lots of stuff.
> 

Oh my word.

-- 
tfeb.org/computer/
Re: read-file for sbcl
#99
Author: Alexander Schreiber
Date: Mon, 30 Nov 2026 10:04
113 lines
5214 bytes
steve g <Sgonedes1977@gmail.com> wrote:
> Alexander Schreiber <als@usenet.thangorodrim.de> writes:
>
>> What ... are you doing? In SBCL with the sb-posix module (and all of that
>> is about 3300 lines of Lisp, which includes win32 support as well as tests)
>> getting the size of the file via sb-posix via libc via the kernel is just
>> one line: (sb-posix:stat-size (sb-posix:stat "/etc/hosts"))
>
>
> Again I am using LSEEK to preload the cache.

What for? Just calling lseek(2) merely positions the file pointer, it does
not read through the entire file to that position - that would be both silly
and wasteful. The only I/O lseek triggers is maybe some metadata I/O to read
the block pointers.

> _This is implementation
> specific_. If you enabled the caching option in your linux kernel, This
> will probably work a bit better.

"enable the caching option in your kernel" What? In Linux, the buffer cache
is always on. There are ways to explicitly circumvent it (i.e. direct I/O)
if needed, but it is not something that has to be explicitly enabled.

>>>> 4. i cant imagine in 2020s linux hw where this would make a practical
>>>> difference
>>>
>>> That's what I said 20 years ago.
>>>
>>> Stat must load lots of stuff into memory.
>>
>> Yeah, it has to read an entire block from storage (512/4096 bytes depending
>> on details).
>
> Linux likes number 4096.

No, it does not "like number 4096". The standard page size on both i386 and
amd64 is 4096 bytes. And the 512/4096 was a reference to block device native
block sizes, which used to be mostly 512 bytes for typical machines, but
these days the larger HDDs generally have 4096 byte blocks - but still do
emulate 512 byte sectors.

>> All because the inode on ext4 by default is an absolutely massive
>> 256 bytes. And that assumes fully cold caches.
>
> ext2 is much faster.

The benchmarks I've seen very clearly say otherwise, except in some corner
cases.

>>> When using lseek to get the
>>> length of the file it is ``kinda loaded into memory'' or a cache.
>>
>
>> About that ... where do you think the kernel gets the size of the file?
>
> from the inode?

Full marks for that one.

>> And how do you think that informations "gets kinda loaded in memory" (and
>> that phrase is quite telling)?
>
> Ummm? Like I said there is a kerel option for caching. Maybe the kernel?

The kernel does caching by default. Turning it off requires extra action and
even then can't be done for the whole machine.

>> Yes, the kernel reads the inode from disk.
>> Although in reality, is has done so when you opened the file for
>> lseek(2)
>
> Correct.
>
>> so for the stat call it already has that data.
>
>
> stat uses memory that I do not need.

Seriously? The information held in the in-memory structure for stat is a
bunch of bytes. I assume you also run your system with a.out binaries
instead of ELF because the ELF dynamic symbol resolution wastes memory?

>
>>> Believe me my SCSI drives definitely knew the difference between cached
>>> io and scatter brain read.
>
>> Because cached IO (at the OS level) doesn't touch the drive.
>
> SCSI drives run on their own bios before loading the operating system.

All somewhat modern drives (and I cheerfully include IDE in that set) run
their own firmware on the drive controllers. And any kind of SCSI controller
BIOS stops running the moment the Linux kernel boots - this is not DOS.

> This is usually done in the SCSI bios. it depends on your scsi
> disk controller.

And the purpose of that is mostly to make the drives available for the BIOS
so the system can boot off them - a similiar setup is done for EFI. Once the
OS kernel has booted, that stops (yes, the OS _can_ use EFI I/O services,
but that usually means performance sucks badly, so that's only done in edge
cases).

> Anyways, why do you care?

Because, kind Sir, you seem to be spouting nonsense.

Kind regards,
            Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
Re: read-file for sbcl
#98
Author: Alexander Schreiber
Date: Mon, 30 Nov 2026 10:06
40 lines
2862 bytes
steve g <Sgonedes1977@gmail.com> wrote:
> Madhu <enometh@meer.net> writes:
>
>> * tfb <11eeio5$2i30h$1@dont-email.me> :
>> Wrote on Sat, 28 Nov 2026 12:51:17 -0000 (UTC):
>>> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>>>> Yeah, it has to read an entire block from storage (512/4096 bytes depending
>>>> on details). All because the inode on ext4 by default is an absolutely massive
>>>> 256 bytes. And that assumes fully cold caches.
>>> Right.  And *you're about to read the inode anyway* since you're about to
>>> read the file.  So the marginal cost of stat() is utterly negligible.  Oh,
>>> and by the way, to get to the point where you can call lseek() *you've also
>>> read the inode*!
>>
>> I haven't had problems since I got nvme, but my earlier laptop I had a 1
>> TB 3.5' "Western Digital Black (SMR)" stat times were an issue and I had
>> to patch programs that eagerly `stat'ed stuff.
>
>
> Are you shitting me? A fucking labtop! Let me guess you did not get your
> hardisk drives from japan because you did not know any better. I usually
> have to wait a week to get those scsi drives. I will admit, they are
> cost effective (to me at least assuming they have any extras). they do
> work in a labtop, they also fit in the machine's frame; but it is
> japanese so throw it out for some bullshit indian/chinese made drives
> that actually cost money for better advertising.

Ah, the situation becomes clear. "steve g" is a troll that somehow fell
through a time warp and reached us from - wild guess - the early 1990s
or so.

> I find your attitude offensive.

And I find your trolling hilarious.

SCNR,
    Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
Re: read-file for sbcl
#100
Author: Alexander Schreiber
Date: Mon, 30 Nov 2026 10:08
42 lines
3071 bytes
steve g <Sgonedes1977@gmail.com> wrote:
> Madhu <enometh@meer.net> writes:
>
>> * Alexander Schreiber <slrn11gmpdu.1opg5.als@mordor.angband.thangorodrim.de> :
>> Wrote on Sun, 29 Nov 2026 00:37:34 +0100:
>>> tfb <tfb@work.it.out> wrote:
>>>> Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
>>>>
>>>>> I suspect a big part here might be implicit writes caused by reads
>>>>> (atime updates)
>>>>
>>>> Not a rhetorical question: don't all modern systems default to the
>>>> equivalent of the noatime NFS mount option?  I'd assumed they did, but may
>>>> well be wrong.
>>>
>>> So Linux, NetBSD (and thus, by implication, OpenBSD) and FreeBSD all offer
>>> a "noatime" mount option to turn off the default of updating atime. It
>>> was traditionally used for filesystems on less durable media (e.g. root
>>> on CF card for some routers) to reduce media wear, but I suspect it would
>>> also help if one is stuck with SMR drives.
>>
>> In my casse atime writes are not the problem as I've always used
>> `noatime' to mount all filesystems. (relatime on tmpfs)
>>
>> AFAICT The firmware delay shennigans don't depend disk writes, they
>> happen on reads, and on readonly pools too.  (It may be a zfs thing, I
>> haven't tried ext4 to try to reproduce the problem on that
>> hardware. (messy home directory is messy)
>
>
> Mounting the filesystem? Have you ever tried using a SCSI disk drive
> with raw partition and let the fucking disc controller do it's fucking
> job?

My, my. Somebody clearly has forgotten to take their dried frog pills.
Again. Consider yourself reminded.

SCNR,
    Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
Re: read-file for sbcl
#101
Author: Alexander Schreiber
Date: Mon, 30 Nov 2026 10:16
15 lines
1518 bytes
steve g <Sgonedes1977@gmail.com> wrote:
>
> anywayz needed some gestalt therapy. You 2 are worth every penny :)

Please provide a suitable address for our invoices. Thank you very much.

> I though that was rather cool when I was 13.

And you clearly haven't aged a day since then - at last your brain hasn't.

SCNR,
   Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison
Re: read-file for sbcl
#102
Author: tfb
Date: Mon, 30 Nov 2026 19:52
11 lines
1625 bytes
Alexander Schreiber <als@usenet.thangorodrim.de> wrote:
> 
> Please provide a suitable address for our invoices. Thank you very much.
> 

Did we agree a rate?  I forget: I have to confess to having had too much to
drink at the last board meeting.


-- 
tfeb.org/computer/
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads