Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "sig"
-
fork() can fail: this is important
Ah, fork(). The way processes make more processes. Well, one of them, anyway. It seems I have another story to tell about it.
It can fail. Got that? Are you taking this seriously? You should. fork can fail. Just like malloc, it can fail. Neither of them fail often, but when they do, you can't just ignore it. You have to do something intelligent about it.
People seem to know that fork will return 0 if you're the child and some positive number if you're the parent -- that number is the child's pid. They sock this number away and then use it later.
Guess what happens when you don't test for failure? Yep, that's right, you probably treat "-1" (fork's error result) as a pid.
That's the beginning of the pain. The true pain comes later when it's time to send a signal. Maybe you want to shut down a child process.
Do you kill(pid, signal)? Maybe you do kill(pid, 9).
Do you know what happens when pid is -1? You really should. It's Important. Yes, with a capital I.
...
...
...
Here, I'll paste from the kill(2) man page on my Linux box.
If pid equals -1, then sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init), ...
See that? Killing "pid -1" is equivalent to massacring every other process you are permitted to signal. If you're root, that's probably everything. You live and init lives, but that's it. Everything else is gone gone gone.
Do you have code which manages processes? Have you ever found a machine totally dead except for the text console getty/login (which are respawned by init, naturally) and the process manager? Did you blame the oomkiller in the kernel?
It might not be the guilty party here. Go see if you killed -1.
Unix: just enough potholes and bear traps to keep an entire valley going.
Source: https://rachelbythebay.com/w/2014/...12 -
I now know another person's password without even wanting to.
He was sitting in the row in front of me, logging into our course page and then *brrrrraaaaapppp* - ran his index finger along the top number row and hit enter.
1234567890
I don't even know what to say.13 -
Just tested my GPU code vs my non-GPU code.
Its a simple game of life implementation. My test is on a 80 x 40 grid running for 100,000 cycles.
The normal code took 117 seconds.
The CUDA code took 2 seconds.
Holy fuck this is terrifying.3 -
Finished the hacktober fest yesterday.. fastest 5 PRs I've ever made on my repos, I actually forgot to sign up at the beginning of the month.. I pity those who are following me.9
-
When you see what worked for someone else with a similar issue on GitHub and run it.
Trust me, I hope I know what I'm doing too.1 -
I'm addicted to the Visual Studio shortcut ctrl+K - ctrl+D to automatically format my code and hate it when I pull down the latest version and it's not formatted properly. 😲5
-
Can anyone recommend a nice set of DnD dice for a gift? It's for my boyfriend's younger sister. She's just getting into it and we're all playing on her birthday.
There's cheap sets everywhere and I'd like to get her something of nice quality.8 -
sudo rm -rf *
Just started out on linux, learning the ins and outs. All I wanted to do was remove two directories. Thankfully it was a fresh install, didn't lose anything important.
A valuable lesson was learned that day. 😂2 -
Head of department is building a bitcoin rig with my manager friday afternoon in his office using tools from the IT one month after degrading me publicly and giving me an official warning in writing to respect working hours so cutting me off from my bonuses and promotions.1
-
So, if I was to emigrate, should I come to your country?
I'll finish my bachelors in Comp Sci next May and Ireland isn't really livable right now with property rental prices. Time to look elsewhere I think.18 -
Quickly delete a double record in the production database with a script, just forgot the where statement...2
-
Currently working on a GUI config generator using MFC in VS.
Firstly, fuck sake Microsoft. Why can't I just use a normal string? The amount of times I've had to do god awful conversions to/from CString using their numerous typedefs L, _T and don't even get me started on LPCTSTR, LPCWSTR... It's just ugly and tedious. I've gotten used to it and all but still, ugh.
Secondly, some of the functions are just stupid. Want to disable a control? Hmm, we'll there's a function called EnableWindow, but no DisableWindow. How did I do it before? Oh, so to disable the control it's EnableWindow(FALSE). Of course it is, duh. Why am I so stupid?
Let's use the GetWindowText function. Simples. CString something_txt = GetWindowText().
Nope, it takes the CString as a parameter and copies it into that rather than just returning the text. Now one line becomes two. I get that this is a really small semantic thing but it irks me.
I just want to go back to my fedora partition. Wah.
PS: I'm sure there's good reasons for what I'm ranting about, but I really don't care. I just need to rant about my frustrations. 😂1 -
A shitty internet connection and visual studio make the best of fucking friends. This is going on a half hour now.
Had to switch to my windows partition for a project and I'm not happy.
Cry for me Fedora. -
Not a rant but a question/style.
What do you prefer and why?:
if(condition)
vs
if (condition == true)
and
if (!condition)
vs
if (condition == false)
vs
if (condition != true)17 -
So I call my sig other on the phone. At the start of the conversation I, for fun, make the sound of a goat.
me: ba a a a
other: really?
me: What?
other: horny old goat?
me: FFS, Freudian Farm Sounds...1 -
Fucking group projects fuck them oh so much fucking fuck fuck fuck.
What's that? You want to basically ignore the spec and do something else? Fuck.
Wait, let's not use the great resources given to us? Fucking fuck.
Oh, you're just going to ignore the fact that everyone else disagrees with you? Fuckity fuck fuck.
I am so angry. You don't get to railroad your team.
You fucker. Ugh. -
!rant
Avatar request: separate colour choice for beard.
... I'm not exactly in the 99%, but my beard hair isn't the same colour as my head hair. 😂5 -
Not learning to unit test as I was embarrassed that'd I'd missed it in college.
Now, thanks to a great ruby module I've taken this year, I'm leaning towards TDD. I really enjoy it. -
I spent the last 1.5 hours trying to optimize delivery of two 8.0KB JS files. It didn't work, at all tried like everything I could find. At the end I initialized it in angular json and made it load regardless. Made me realize that it is not made for optimization.1
-
How do you know ML and AI has gone too far? You rely on the algorithm instead of the obvious.
Google will translate comments, etc. At times when you click on an English video to language around your location. This is so obvious, if I didn't understand English if would not have clicked on the video!!
#BringBackThePreMLdevs -
!rant with a l'il rant at the end.
Anyone have any Android games they would recommend? I just want something to help me unwind, without being baited every 10 minutes into buying upgrades or coins or whatever.
In app transactions have ruined Android games for me. It drives me insane, but, I still would like something for when I'm not bothered to boot up my ps4 and spend hours living in The Witcher.4 -
Was using an open source piece of software for data storage and visualisation to work with the loggers my company makes. When importing old data for historical views, some of the csv imports would fail without any specific error messages.
It took me a couple of hours but after looking at their csv parser and making my own little one to test with, I eventually found out that it was all down to the way datatime (I think it was?) in java deals with DST, which apparently was to just fuck shit up.
Anyhow, a few simple lines added into the parser later and it all works just fine.
Was super proud of that one as it was the first time I actually looked somewhat good in front of my senior dev. -
Is the current humble book bundle of any use? Dev ops by Packt. Lots of docker and kubernetes stuff.
https://humblebundle.com/books/...1 -
!rant
Tablet recommendations? I know this isn't really the place to ask but I trust you devs.
I'm just about to start back college and I'd like to have a light carry around for days I don't need my laptop. I love my 17" Dell, it's a beast and that's why I bought it but damn it's overkill for taking notes and running little things through a bash terminal. A tablet and keyboard seems like a nice idea.
Ideally, I wanna run Linux. But I'm not sure if there's a commercial tablet that facilitates OS changes easily out of the box.
No iPad. Not an apple fan, and it's just not what I'm after.
The MS surface seems pretty good, but I haven't looked too deeply into replacing the OS.
I just want a nice Linux tablet. I dunno.
Thanks!5 -
Statically linking to qt5 is quickly driving me fucking insane.
I've a list of unresolved dependencies during linking longer than a really long fucking list. Ugh.
Cmake, why can't you save me?
Think I'll just go back to dynamic and build on each needed system.1 -
!rant
Just did some really satisfying refactoring. Much happier with my work now. Its a little cli app to poll M-bus devices and write the data to file if the user wants. Can scan the whole range, search for specific devices and VIFE codes, parse an input file for lots of the previous data and one or two other things.
How's everyone's else's weekend? -
!rant
Soooo, badges. They seem to have some prevalence in the open source community. I'd love to earn some from fedora. One day!
Anyone have any fun ones to show off?2 -
Okay, so, I have a functional snort agent instance, and it's spewing out alerts in it's "brilliant" unified2 log format.
I'm able to dump the log contents using the "u2spewfoo" utility (wtf even is that name lol... Unified2... something foo) but... It gives me... data. With no actual hint as to *what* rule made it log this. What is it that it found?
All I see are IDs and numbers and timings and stuff... How do I get this
(Event)
sensor id: 0 event id: 5540 event second: 1621329398 event microsecond: 388969
sig id: 366 gen id: 1 revision: 7 classification: 29
priority: 3 ip source: *src-ip* ip destination: *my-ip*
src port: 8 dest port: 0 protocol: 1 impact_flag: 0 blocked: 0
mpls label: 0 vland id: 0 policy id: 0
into information like "SYN flood from src-ip to destination-ip" -
It always blows my mind how a silly idea / hunch tries settling down in your head very close to your regular bedtime and before you realise you can hear the birds chirping and sunshine hitting your window pane.
It’s unhealthy and should not be encouraged whatsoever.
But I guess this is the sort of involvement and craziness that separates us from rest of the professional world.2