So you mean like (words can mix up stuff):
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char **argv)
{
char *line = NULL;
struct stat sb;
size_t len;
int fds[2];
pid_t pid;
ssize_t n;
if (pipe(fds) < 0) {
perror("pipe");
exit(1);
}
pid = fork();
if (pid < 0) {
perror("fork");
exit(1);
}
if (pid == 0) {
dup2(fds[1], STDOUT_FILENO);
close(fds[0]);
close(fds[1]);
if (fstat(STDOUT_FILENO, &sb) < 0) {
perror("fstat");
exit(1);
}
printf("child: st_dev=%u, st_ino=%llu\n", sb.st_dev, sb.st_ino);
} else {
dup2(fds[0], STDIN_FILENO);
if (fstat(fds[1], &sb) < 0) {
perror("fstat");
exit(1);
}
printf("parent: st_dev=%u, st_ino=%llu\n", sb.st_dev, sb.st_ino);
close(fds[0]);
close(fds[1]);
n = getline(&line, &len, stdin);
if (n < 0) {
fprintf(stderr, "Unexpected EOF\n");
exit(1);
}
fwrite(line, n, 1, stdout);
free(line);
wait(&pid);
}
exit(0);
}
? With M1 generation MacBook Pro I get:
$ ./test
parent: st_dev=0, st_ino=9204210306621897207
child: st_dev=0, st_ino=9204210306621897207
well, returned back safe #neovim. i did like experimenting with #helix tho and am going change my neovim configuration based on that. I’ve used vim for 25 years so pretty hard to get out of old habbits.
Some glitches that would need to be fixed before I would try it again:
set ts=2 sw=2 et
. Creating a .helix
directory for upstream projects in not always even an option.gq
) email paragraphs when responding with aerc
.tmux
. I usually open my files from command-line, not from the editor.In producing code it is not very important how fast you can write the code because 95% of time goes to QA anyway and making first functional version to actually work with real workloads. So personally I think that new editors optimize a local maximum that does not help to deliver all that much as you might first think.
@harrysintonen For uneducated person on these attacks like me, the best protection has been to stick to text based email clients :-) Haven’t had an issue to separate a phishing email from legit when I read all my email previously with mutt
and these days with aerc
.
I would have no chance to survive from these or notice them if I used Outlook/Thunderbird or similar :-)
@dpom @nnethercote Thanks, was aware of this book!
For async
in particular the real mechanics are sort of “hidden” given the frameworks that put them nicely on the plate (such as tokio
). For that it makes sense for anyone to see how it is “open-coded” just to not feel unsafe when putting weird keywords to the code.
I was a bit lost with that in particular until I read a chapter from book “Rust of Rustaceans”, which has pretty nice explanation of what it actually is: a polling interface and (usually) a thread pool (i.e. “executor”). All the syntax is semantically just macros with language level syntax to place them.
This is how I open Rust concepts. They are either new functions or code generators in some sense. If the latter I just do the exercise of open coding the generator to see what it results in.
It is quite common theme in new Rust language features that they are just code generators that produce a “normalized” subset of “plain” Rust code. By understanding this it takes a lot of magic away and helps to understand what they actually achieve.
Cool apparently got first PR to zmodem2
crate. Now I have an open source community, quality replace quantity I hope :-)