errno

EWOULDBLOCK equivalent errno under Windows Perl

G'day Stackoverflowers, I'm the author of Perl's autodie pragma, which changes Perl's built-ins to throw exceptions on failure. It's similar to Fatal, but with lexical scope, an extensible exception model, more intelligent return checking, and much, much nicer error messages. It will be replacing the Fatal module in future releases of...

Unit testing error conditions - EINTR

In short, how do you unit test an error condition such as EINTR on a system call. One particular example I'm working on, which could be a case all by itself, is whether it's necessary to call fclose again when it returns EOF with (errno==EINTR). The behavior depends on the implementation of fclose: // Given an open FILE *fp while (fclo...

to throw, to return or to errno?

i am creating a system. What i want to know is if a msg is unsupported what should it do? should i throw saying unsupported msg? should i return 0 or -1? or should i set an errno (base->errno_). Some messages i wouldnt care if there was an error (such as setBorderColour). Others i would (addText or perhaps save if i create a save cmd). ...

Is there a way to use errno safely in a multi-threaded application?

If you are writing a multi-threaded application that uses system/library calls that make use of errno to indicate the error type, is there a safe way to use errno? If not, is there some other way to indicate the type of error that occurred rather than just that an error has occurred? ...

How to know what the errno means ?

When calling execl(...) I get an errno=2. What does it mean ? How can I know the meaning of this errno ? ...

Access to errno from Python?

I am stuck with a fairly complex Python module that does not return useful error codes (it actually fails disturbingly silently). However, the underlying C library it calls sets errno. Normally errno comes in over OSError attributes, but since I don't have an exception, I can't get at it. Using ctypes, libc.errno doesn't work because e...

Is there a Windows equivalent of EDQUOT?

I'm porting some C++ code from UNIX to Windows which detects the occurrence of the EDQUOT error, which indicates that there was an unsuccessful attempt to exceed the current user's disk quota. Visual Studio's <errno.h> doesn't have an EDQUOT, although I know that Windows has disk quota functionality. Visual Studio's <errno.h> does have a...

Where can I see the list of functions that interact with errno?

In the book "The C Programming Language" it says: "Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly. In addition, the integer expression errno (declared in <errno.h>) may contain an error number that gives further information about the mo...

Python Exception handling

C has perror and errno, which print and store the last error encountered. This is convenient when doing file io as I do not have to fstat() every file that fails as an argument to fopen() to present the user with a reason why the call failed. I was wondering what is the proper way to grab errno when gracefully handling the IOError excep...

MySQL Creating tables with Foreign Keys giving errno: 150

I am trying to create a table in MySQL with two foreign keys, which reference the primary keys in 2 other tables, but I am getting an errno: 150 error and it will not create the table. Here is the SQL for all 3 tables: CREATE TABLE role_groups ( `role_group_id` int(11) NOT NULL `AUTO_INCREMENT`, `name` varchar(20), `description` ...

How to detect if errno_t is defined?

I'm compiling code using gcc that comes from Visual C++ 2008. The code is using errno_t, but in some versions of gcc headers including <errno.h> doesn't define the type. How do I detect if the type is defined? Is there a define that signals that the type was defined? In the case it isn't defined I'd like to provide the typedef to let the...

How to convert errno in UNIX to corresponding string?

Is there any function in UNIX to the convert errno to its corresponding string for e.g. EIDRM to "EIDRM". Its very annoying to debug to check for errors with these integer errnos. ...

Troubles with errno.h

I'm working with Rad Hat 8.0, trying to make changes to the kernel, and I'm at the compilation stage. I have a header in include/linux where I define wrapper functions, and they use errno. I included errno.h using #include <errno.h>. When I try to compile, it tells me "errno.h no such file or directory". When I try #include <linux/er...

In which include file EPERM (returned by pthread_mutex_unlock) error code is declared?

Can anyone give me the right direction for this, as I am not able to find the declaration of EPERM in either pthread.h or errno.h (on openSUSE Linux). I found this in asm-generic/errno-base.h but is this the right one? Why its not in errno.h? Thanks ...

What does this error mean? - httperf: connection failed with unexpected error 105

Does anyone know what this httperf error means? Is this having a negative effect on my tests? httperf: connection failed with unexpected error 105 ...

[C] Why return a negative errno? (e.g. return -EIO)

Another simple example: if (wpa_s->mlme.ssid_len == 0) return -EINVAL; Why the unary minus? Is this (usually) done for functions that return >0 on success and <(=)0 on failure, or is there some other reason? ...

detecting loops in symbolic links (c programming)

I'm looking to detect loops in symbolic links in a C program: $ ln -s self self $ ln -s a b $ ln -s b a Here's what I've got so far: #include <sys/stat.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <errno.h> int main(int argc, char *argv[]) { struct stat buffer; int status; if (argc != 2) { ...

Odd socket() error -- returns -1, but errno=ERROR_SUCCESS

I'm developing a dedicated game server on a linux machine, in C/C++ (mixed). I have the following snippet of code: int sockfd=socket(AI_INET, SOCK_DGRAM, 0); if(sockfd==-1) { int err=errno; fprintf(stderr,"%s",strerror(err)); exit(1); } My problem here, is that socket is returning -1 (implying a failure) and the error stri...

Symbolic errno to String

Is there a command-line tool that will take a symbolic errno such as EINVAL and print the corresponding string, Invalid argument? I would like to avoid having to find that EINVAL is value 22 on my system and then using$ perror 22. Ideally I could write something like $ errorcommand EINVAL Invalid argument $ ...

Access C global variable 'errno' from C#

Is it possible to access the "errno" variable in C# when P/Invoking? This is similar to Win32 GetLastError(). ...