[go: up one dir, main page]

|
|
Log in / Subscribe / Register

Making EPERM friendlier

Making EPERM friendlier

Posted Jan 20, 2013 15:44 UTC (Sun) by andreasb (guest, #80258)
In reply to: Making EPERM friendlier by justincormack
Parent article: Making EPERM friendlier

Setting a flag wouldn't work, I think. The main application might set the flag, but some library it has linked in might also make a syscall and get confused by the errno values.


to post comments

Making EPERM friendlier

Posted Jan 20, 2013 18:59 UTC (Sun) by akeane (guest, #85436) [Link]

It would if the flag was a #define directive the C lib header files picked up and you had a set of parallel syscalls in the kernel, behold:

_open is the normal one
__open_ret_32 is the OMG MORE ERROR CODEZ!!!

So, you need a set of extra syscalls in the kernel to add more info to the ret value, (luckily this will add even more lines of code and complexity to the kernel, what could go wrong? yay!)

and a switch in the C lib:

cc -o my_earthly_soul p_audio.cs -DOMGMOREERRNOSSUCKA

But this is assuming that anybody actually goes around checking error codes in this modern era; no one really bothers anyway; if it's a real problem and not just the kernel nagging at you then something else will break properly later on and you get a nice SEGV which you can blame on a third party device driver.

It also becomes increasing difficult to add additional lines of error checking code when you reach a certain age, and your monocle has seen better days (also you waste valuable bytes on your winchester disk)

I stand by my assertion that only two ERR codes are necessary in your typical unix warez:

fd = open("~/Music/a-dreadful-din.mp1");

#ifdef YOUNG_PERSON
if(fd == E:-) )
return cool;

if(fd == E:-( ))
return opens_gonna_hate;
#endif

#ifdef MOI

if(fd == EAKEANE) /* Clearly a measure of success */
{
/* Remove rubbish modern so-called "music" */
unlink("~/Music");

/* Check for errors from unlink? nah... */
return heh!;
}

if(fd == EGETOFFMYLAWN)
unlink("~"); /* There's probably some bad music there somewhere */

#endif



Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds