News for hackers. Stuff that matters.
Re:Basic proxy implementation using io_uring by 38 on Saturday February 17, 2024 @08:16PM (#39415182)
> basic

1300 lines...

also, the line numbers dont actually align with the lines:

https://git.kernel.dk/cgit/liburing/tree/examples/proxy.c#n1...

Re:Basic proxy implementation using io_uring by packetlost on Saturday February 17, 2024 @08:58PM (#39415394)
That's pretty small for a complete C application...
Re:Basic proxy implementation using io_uring by userbinator on Sunday February 18, 2024 @12:57AM (#39416584)
Various things that I have written in less than 1300 lines of C:

    * TCP proxy (~200)
    * Win32 GUI TOTP authenticator (~230)
    * GIF decoder (~300)
    * PNG decoder (~470)
    * JPEG decoder (~770)
    * H.261 decoder (~740)
    * H.263 decoder (~1100)
    * MPEG-1 decoder (~1100)
All of the above I would consider a "complete C application".

Edit: looks like some people just have no respect for craftsmanship.

Re:Basic proxy implementation using io_uring by rogers12 on Sunday February 18, 2024 @02:50AM (#39417073)
You should go back and add error handling to your C programs
Re:Basic proxy implementation using io_uring by userbinator on Sunday February 18, 2024 @02:56AM (#39417104)
Are you implying I don't already have error handling?

Personal insults are not acceptable here.

Re:Basic proxy implementation using io_uring by verticalscaler on Sunday February 18, 2024 @05:28AM (#39417907)
My dude, how would he know better? It is a perfectly fair assumption given the average C code base. Those numbers are unusually succinct.

You sound like you really know what you're doing, if you can, please share some of this for our edification and don't take things personally.

Re:Basic proxy implementation using io_uring by znpy on Sunday February 18, 2024 @08:07AM (#39418727)
> Are you implying I don't already have error handling?

With baseless claims, no code, no other consideration? I would not imply that, I would assume that.

Re:Basic proxy implementation using io_uring by lionkor on Sunday February 18, 2024 @04:23AM (#39417541)
post your code
Re:Basic proxy implementation using io_uring by littlestymaar on Sunday February 18, 2024 @06:20AM (#39418167)
How is a codec a complete application?
Re:Basic proxy implementation using io_uring by unmole on Sunday February 18, 2024 @06:42AM (#39418268)
Talk is cheap, show me the code.
Re:Basic proxy implementation using io_uring by znpy on Sunday February 18, 2024 @08:06AM (#39418721)
came to write the same thing. take my upvote.
Re:Basic proxy implementation using io_uring by secondcoming on Sunday February 18, 2024 @08:08AM (#39418733)
Your 200 line TCP proxy is likely to be very inefficient.

This is what things like DPDK and io_uring attempt to solve.

Re:Basic proxy implementation using io_uring by sophacles on Sunday February 18, 2024 @09:35AM (#39419392)
So your 200 line proxy... I wonder how it performs compared to this. Since LOC is a silly measure of anything, lets use it further: How many bytes/s/sloc does yours acheive compared to the io_uring one?
Re:Basic proxy implementation using io_uring by Fischgericht on Sunday February 18, 2024 @10:04AM (#39419608)
Or people have no respect for arrogant boasting.

Also, you most likely are a liar. Just the matrix tables you need for MPEG-1 are 500+ lines.

Unless of course you used 1100 lines to call ffmpeg. Then you don't need the tables.

But that being said: Yes, writing a TCP proxy in 200 lines is indeed possible. But it will use standard socket calls. You might want to read up about what io_uring is all about, and why it's worth going the extra mile.

Or, as an alternative, you could STFU :)

Re:Basic proxy implementation using io_uring by o11c on Saturday February 17, 2024 @08:49PM (#39415348)
FWIW it's about 800 lines excluding comments.

and yeah, this is why you don't abuse side-by-side divs ... actually, that's a table ... and instead just make your number unselectable (there are several ways to do this).

Re:Basic proxy implementation using io_uring by jeroenhd on Saturday February 17, 2024 @11:32PM (#39416227)
It aligns perfectly for me. Must've been mostly tested on Firefox.
Re:Basic proxy implementation using io_uring by 38 on Sunday February 18, 2024 @12:01AM (#39416357)
I am on Firefox...
Re:Basic proxy implementation using io_uring by marwis on Sunday February 18, 2024 @01:15AM (#39416673)
Doesn't work on Chrome too.

Needs .linenumbers { line-height: 12pt } but I think vertical line spacing within text node cannot be precisely controlled and is browser dependent.

Re:Basic proxy implementation using io_uring by rwiggins on Sunday February 18, 2024 @01:16AM (#39416678)
There's something super weird going on with those line numbers. They don't align for me either (Firefox on Windows 11). In the web inspector, the line numbers are rendering with Courier New as the font, whereas the code itself is `monospace`.

The weird thing is both are controlled by a single CSS rule,

    div#cgit pre {
      font-family: "Source Code Pro", "Courier New", monospace;
    }
(Changing to just `monospace` fixes it.)

I'm not sure how two elements could have different fonts with that. I'm possibly missing something obscure, but it really feels like a browser bug.

Re:Basic proxy implementation using io_uring by hddqsb on Friday February 23, 2024 @09:10AM (#39480761)
Great sleuthing, the missing piece of the puzzle is that the file contents are inside a <code> element while the line numbers are not, and <code> elements have a default font so they don't inherit the font from their parent element. Changing the selector to the following fixes the issue:

  div#cgit pre, div#cgit code { ... }
(The buggy CSS is not present in the the official cgit repository, so I assume the owner of kernel.dk is running a patched version of cgit.)