TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why Unix's lseek() has that name instead of seek()

43 pointsby adunkover 1 year ago

3 comments

mkoryakover 1 year ago
I wish the article did more to explain why &quot;the naming for fstat&#x2F;lstat not consistent with fseek&#x2F;lseek&quot;.<p>I understand it&#x27;s not written for people like me, but here I am reading it
评论 #38870462 未加载
jiveturkeyover 1 year ago
spoiler: the `l` is for long. the previous `seek()` took an int.<p>i rather enjoy the exposition of the article. he weaved the story nicely rather than just blurt out the answer. the utoronto unix blog in general is enjoyable.
评论 #38870911 未加载
评论 #38873089 未加载
评论 #38872456 未加载
mannyvover 1 year ago
Even back then the unix abstractions were breaking down.<p>The problem with lseek is pretty simple: how do you know if a file size is bigger than your int? You can do a stat, but that means stat should return a long, but if all you have are ints then what do you do? Make a signed negative value an offset off of the end of an int?<p>These little problems exist everywhere in the bowels of stuff, and they&#x27;re sort of fun design problems to think about.<p>And the problem is that these were small machines, where everything counts. There was no point wasting some bytes and cycles with typeof metadata.