HNHacker News
TopNewBestAskShowJobs

bhawks

2,274 karma · joined October 7, 2016

submissionscomments
bhawks··on In-Memory Filesystems in Rust
Posix file system semantics are very complex. An in memory implementation is likely to have quality gaps that make it sub optimal. If you want fast tests /tmp is likely to be backed by tmpfs in memory. If you are paranoid you can use /dev/shm to be explicit about your desire.

Going this route means you're going to leverage all the well tested Linux VFS code and your tests will execute with higher fidelity.

bhawks··on The issue of anti-cheat on Linux (2024)
Sadly I would imagine that this would give the legal department nightmares.
bhawks··on Why are anime catgirls blocking my access to the Linux kernel?
Can't wait to sign into my web browser with my driver's license.
bhawks··on Carbon Language: An experimental successor to C++
Since interop is such a big design goal I wonder if fn was chosen after analyzing the impact of alternative keywords present in large c++ code based that would impact interop in a negative way (eg requiring more escaping).
bhawks··on Writing memory efficient C structs
Optimizing struct layouts is cool. but if your motivation is to pack more monsters in your game definitely consider transposing your row oriented monster struct into a column oriented entity using Entity Component System.

Example framework:

https://github.com/skypjack/entt?tab=readme-ov-file

It has benefits besides memory/cache optimizations. It organizes logic in a much more composable way that is friendly for reuse.

bhawks··on What is going on in Unix with errno's limited nature
A whole separate register?

That is quite expensive. Obviously you need to physically add the register to the chip.

After that the real work comes. You need to change your ISA to make the register addressible by machine code. Pdp11 had 8 general purpose registers so they used 3 bits everywhere to address the registers. Now we need 4 sometimes. Many op codes can work on 2 registers, so we need to use 8 out of 16 bits to address both where before we only needed 6. Also pdp11 had fixed 16 bits for instruction encoding so either we change it to 18 bit instructions or do more radical changes on the ISA.

This quickly spirals into significant amounts of work versus encoding results and error values into the same register.

Classic worse is better example.

bhawks··on Better Error Handling
Typed try/catch was tried in Java. The typing was not well liked and people voted with their feet to untyped exceptions. Euphoria turned to misery and golang emerged with returning errors explicitly. Overall I would say that the return value and error value shouldn't be split as in Golang. A result type that forces the user to account for the error when accessing the return is a much better approach. The compiler should make it fast.
bhawks··on JEP 506: Scoped Values final for Java 25
Implicit parameter smuggling by any mechanism is just too much magic in my experience. Golang's context.Context solves the same problem, but explicitly in a way that has been widely adopted through their language ecosystem.

That said - in Java I do think it would be near impossible for the ecosystem to adopt a similar mechanic, so from a practical standpoint this may be the only way to reliably propagate context.

bhawks··on Tariffs, Saving, and Investment
The uncertainty is not in the US.

The uncertainty is in the global reserve currency that is used to price every transaction and structure terms of every contract.

The tariff panic is the straw that broke the back of an already over stressed, over leveraged system.

If equities are doing 'well' it's because some of the really strong companies may be able to persevere through all the chaos. I don't think most people will be able to predict which companies those will be.

With money itself broken I wouldn't want to hold onto too much physical cash or bonds. There will be many sovereign defaults (or money printing - which is just as much of a default). Gold and bitcoin will still exist after we get through this chaotic period and therefore many people are rotating into those assets.

bhawks··on My Own Private Binary: An Idiosyncratic Introduction to Linux Kernel Modules
| For example, one time while working on my kernel module, I accidentally put --i instead of ++i in the iterator of my for loop. I inserted that module into my kernel to test it, and my mouse cursor disappeared, and my music stopped playing … and then it was time to reboot my computer

Id recommend using QEmu for the type of work the author is doing. It makes iteration much faster.

bhawks··on The Guardian flourishes without a paywall
The temporarily embarrassed millionaire meme is a punchline to a joke (look at those stupid greedy people they don't know how stupid they are).

Inheritance taxes don't sit well for many reasons that are actually interesting to discuss

+ People's desire to support friends, families and personal interests is a core reason for an individual to work beyond individual self sufficiency. This makes it very easy to empathize with the millionaire impacted by gift / inheritance taxes that may never be applied to you.

+ Taxes have already been paid on this money - double dipping is very easy to cast as unfair.

+ Clumsy implementations of these types of taxes create situations where small family owned farms and businesses need to be liquidated to cover taxes causing more pain and disruption for families.

+ The constant slippery slope of taxes initially targeted at 'the rich' but over time effecting more and more people due to combinations of inflation and revenue seeking.

+ The simple fact that if the US just seized all the wealth of 800+ billionaires today - it would only be worth 6.2 trillion dollars [1], which doesn't even cover the 6.8 trillion dollars the government spent in 2024. So what do we do next year?

Do we need more revenue? Are we getting the revenue the right way (aka is everyone paying their fair share)? Maybe... But there is certainly a spending problem too.

1: https://inequality.org/article/billionaire-wealth-keeps-grow...

bhawks··on Tokio and Prctl = Nasty Bug
Calling setsid in pre_exec isn't exactly correct, you'd do this to daemonize a process in order to prevent it from getting signals from the process which spawned you exited or its terminal disconnected.

If you read exit(3) you'll see that you also need a controlling terminal for the kernel to send SIGHUP to the processes in your foreground process group.

In python it'd look roughly like:

  master, slave = os.openpty()

  # ensure we can call setsid successfully

  try:

    pid = os.fork()

    if pid > 0:

      os.close(master)

      os.close(slave)

      sys.exit(0)

  finally:

    sys.exit(1)

  os.setsid()
  # we are now session leader and process group leader

  fcntl.ioctl(master, termios.TIOCSCTTY, 0)
  # we now have a controlling pty - closing master will send us a SIGHUP

  os.close(slave)

  # go start spawning subprocesses - if _this_ process is killed, they will receive SIGHUPs. Unless they take themselves out of your session or the foreground process group.
bhawks··on Tokio and Prctl = Nasty Bug
Normally I'd stay away from job control posix APIs - but since HyperQueue is a job control system, it might be appropriate if the worker was a session leader. If it dies than all its subprocesses would receive SIGHUP - which is fatal by default.

Generally you'd use this functionality to implement something like sshd or an interactive shell. HQ seems roughly analogous.

https://notes.shichao.io/apue/ch9/#sessions

bhawks··on OpenAI says Chinese rivals using its work for their AI
So it is fine for OpenAI to train on data from artists and other creators who don't want their works used that way and are also hurt by AI making copycat works.... But it is bad when another AI company does the same.

This is the weakest argument ever and frankly they should be embarrassed even typing it out.

bhawks··on Ross Ulbricht granted a full pardon
The most prolific drug dealers who sold on silk road have served their sentences and are out of prison.

Ross was given a life sentence without possibility of parole an incomparable sentence in relation to all other parties that were involved.

bhawks··on Show HN: I built open source file sharing solution using AWS S3
Magic Wormhole gives you secure file transmission for free.

Give one of the implementations a try: https://github.com/psanford/wormhole-william

bhawks··on Biggest shell programs
There are plenty of contexts where you won't have a compiler today - embedded (optimize for space) and very security hardened deployments (minimize attack surface).

Historically people used to sell compilers - so minimizing installation to dev machines probably was a savings (and in those times space was at a premium everywhere).

That said - I am with you, give me any other programming language besides shell!

bhawks··on Traits are a local maximum
Files exist in a different universe of abstractions from language features. Heck a language should work in a universe where files don't exist at all.

A file is a stream of bytes that a process can get by giving the os a string (name) that has all sorts of encoding/decoding rules that rely on runtime state.

bhawks··on DOJ will push Google to sell off Chrome
This feels like a feel good headline for DoJ that doesn't materially impact the Search/Ads ecosystem nor improve things for the end consumer.

Chromium exists - literally as a baseline for several other corporations to build a browser.

If you wanted to do something meaningful - you must separate search and ads, everything else is rearranging deck chairs on the Titanic.

bhawks··on Improving Steam Client Stability on Linux
There exists a ton of working code that does not fiddle with setenv and now would have memory leaks if they don't change their code? Plus I would now need to test if my stdlib requires freeing memory or not because if I try to free on an older libc it is not going to work out well. I don't think the value works out.

From a hygiene perspective - freeing the return of another API is an anti pattern. If you need the caller to release objects there should provide a FooLib_bar_destory(bar) or similar.

bhawks··on Improving Steam Client Stability on Linux
Yes the proper way to do that is execve, not by changing global variables in your parent process. https://man7.org/linux/man-pages/man2/execve.2.html

Using setenv is mostly always a hack that relies on a bunch of assumptions that could easily change and be hard to debug.

bhawks··on Improving Steam Client Stability on Linux
FWIW the decision to leak memory on Mac actually goes back ~26 years to FreeBSD - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=5604 which OSX inherited. I would not be surprised that Windows setenv has BSD roots due to licensing.

26 years ago people knew this API was broken but didn't fix it due to inertia of breaking buggy programs further.

There really shouldn't be a need to change your own process's envvars. For subprocesses just use the proper exec function. For anything else there should be a clear API to call rather than changing a global variable and hoping some code far away from yours rereads it and handles things correctly.

bhawks··on Improving Steam Client Stability on Linux
1) java shell starts 2) read getenv into a java hashmap 3) evaluate shell input - any sets update the hashmap, any gets read from the hashmap 4) when you get to a point where you need to exec a process you use the hashmap to pass envvars into process builder - which is going to call execvpe for you.

So yeah you definitely could (there'd be other reasons why java wouldn't be a good choice).

TBH reading that folks were calling setenv before an exec to propagate env vars to a child made me sad. I would guess that other use cases were leveraging environ as a poor man's global variable - which is also unfortunate.

bhawks··on Ask HN: How do you add guard rails in LLM response without breaking streaming?
One of the things I love about gen ai is that all it's problems are solved with using more gen ai.
bhawks··on Google must open Android for third-party stores, rules Epic judge
The browser should have been the distribution mechanism and user agent sandbox for mobile apps. Unfortunately both OS platforms owned their own browsers and would benefit from controlling app distribution under the guise of protecting app quality.

It is also exceedingly ironic that browsers played such a key role in wrestling control from the dominant windows platform to the benefit of Apple and Google.

bhawks··on Fukushima Reactor: TEPCO robot aims to extract nuclear fuel
Spending nearly 1/6th of Japan's GDP to clean up 0.45% of the nuclear waste dumped into the ocean is worth consideration. If the earthquake had happened 20 years earlier (nothing on tectonic timescales) this wouldn't be up to much discussion.

If you were to commit such a large amount of cash - a reparation for the disaster - would you spend it all on this?

bhawks··on How economical is your local Taco Bell?
Even the rural and poor parts of California can't have cheap taco bell.
bhawks··on Facebook uses Australian adults public photos/posts to train AI, without opt-out
Western society today, but it didn't start this way.

The nanny state is really only a couple decades old.

Government has realized it can take significant powers if it can convince a subset of the populace that it is the only way to protect them from some type of harm.

bhawks··on Facebook uses Australian adults public photos/posts to train AI, without opt-out
According to the article there is no law in Australia regarding this - but EU and US (probably specifically California) laws cause them to offer the option to citizens of those countries.
bhawks··on Consent-O-Matic – automatically fills ubiquitous pop-ups with your preferences
What if the goal of the site is to monetize views so it is economically viable to produce content?

Then GP's point towards 'it should work better' implies it works over the long-term and not a single interaction.

I find ads frustrating as well, but it is a powerful monetization strategy and that doesn't have a substitute.

← PreviousPage 2 of 17Next →