Technorama

An omnibus of tech posts by s Futurologist on software development primarily.

Sunday, 19 July 2015

 

errno considered harmful

POSIX functions such as open() and read() return -1 in case of error, and then set a thread-specific errno global. Makes code checking awkward, better to just return the error code directly.

But what about functions such as opendir() and readdir() which return pointers? They should be modified to take params, and return int!

int opendir_s(const char *name, DIR * dir);

int readdir_s(DIR * dirp, struct dirent * entry);

Note, there is readdir_r which does return int already, but there isn't a matching opendir_s

regular opendir() and readdir() should be depreciated in favour of safer versions.


 

Signed values considered wasteful

Signed values considered wasteful

POSIX APIs are quite wasteful.

on a 32bit system "int" in C programming language is a signed twos compliment number. Most POSIX APIs return -1 in case of error, this means that the largest number representable is 2^31 -1. eg lseek off_t (which is also 32bit int). This is wasteful, because there only needs to be one error value, or even allowing up to 1024 error codes would have been fine.

so off_t could have been unsigned: 0 ... 4294967296
4294967296: Error code, check errno
0...4294967295: Normal range.

This isn't as bad as the 7bit email limitaiton, which means 1/8th of everyone's bandwidth is wasted. Its time we had SMTP2 rolled out.. with PGP signing default too. These things will come... eventualy.

So the POSIX standard would need to have:

#define EERROR32 (4294967296)
#define EERROR64 (18446744073709551616)

#if CPU32BIT
#define ERROR EERROR32
#else
#define EERROR EERROR64
#endif

Of course, 32bit machines still have lseek64, so would need to use EERROR64

What is the best solution?

Of course, the POSIX standard won't be changed, its all too well established. This is a legacy hangover.

Wednesday, 24 June 2015

 

PGP email subjects not encrypted or signed

I find the fact that PGP email subject lines are not encrypted or signed surprising. Massive loophole!


Tuesday, 2 June 2015

 

JCDecaux advert displays running GNU+Linux

JCDecaux advert displays running GNU+Linux

London Victoria station


Monday, 1 June 2015

 

Mobitans Fraud mobileacademy.com

Mobitrans fraud.

This company twice signed me up to their spam service and deducted cash via EE direct debit.

The only way this fraud can be stopped is if we report to mobile provider and PhonePayPlus regulator.


Mobitrans are now refusing to promptly refund the fraud.


They are hiding their address in The Netherlands on their website and domain name. 

Call Mobitrans support center on 02087790598 Mon-Fri 7am-9pm or email supportUK@mobileacademy.com


Monday, 18 May 2015

 

National Rail app defect

Time format in latest Android app has been broken for last 6 months.
National Rail can you sort out?


Saturday, 16 May 2015

 

0800 buster - don't use it, it cuts you off after 30 mins

Avoid using 0800 Buster service, 01209 630 800 because it will cut you off if you are on the line more than 30 mins.

Archives

February 2003   March 2003   April 2003   August 2004   September 2004   December 2004   May 2005   June 2005   December 2006   January 2007   February 2007   March 2007   April 2007   July 2007   August 2007   September 2007   October 2007   November 2007   December 2007   January 2008   February 2008   March 2008   April 2008   May 2008   June 2008   July 2008   August 2008   September 2008   October 2008   November 2008   December 2008   January 2009   February 2009   March 2009   April 2009   September 2009   November 2009   December 2009   January 2010   April 2010   September 2010   October 2010   November 2010   December 2010   January 2011   February 2011   March 2011   April 2011   May 2011   June 2011   July 2011   August 2011   September 2011   October 2011   November 2011   December 2011   January 2012   February 2012   March 2012   April 2012   May 2012   June 2012   July 2012   October 2012   December 2012   March 2013   May 2013   August 2013   September 2013   October 2013   November 2013   March 2014   May 2014   June 2014   July 2014   September 2014   October 2014   December 2014   January 2015   February 2015   March 2015   April 2015   May 2015   June 2015   July 2015  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]