UNIX system Call function errno return value collection (in updating)

Source: Internet
Author: User

When UNIX system-level functions encounter errors, they typically return-1, and set the global integer variable errno to indicate what went wrong.

Read the Redis source code, found that if the system-level function error when the errno more familiar with the program to write a lot. So, while learning Apue and Csapp, the common system-level functions of their own encountered in the error when the return of the errno summed up (otherwise each perror once, good tired ah = =), will continue to find time to update the learning progress ~

Echild:

#include <sys/types.h><sys/wait.h>intint options);

If the calling process has no child processes, then Waitpid returns-1 and sets errno to Echild

Einter:

#include <sys/types.h><sys/wait.h>intint options);

If the Waitpid function is interrupted by a signal, then it returns-1 and sets errno to Eintr

EINVAL:

#include <unistd.h>
long sysconf (int name); long pathconf (constcharint name); log fpathconf (int int name);

If the name parameter is not a suitable constant, all 3 functions return-1, and the errno is set to Einval

Espipe:

#include <unistd.h>offt_t lseek (intint whence);

If the file descriptor points to a pipe, FIFO, or network socket, because these files cannot set an offset, Lseek returns-1, and errno is set to Espipe

UNIX system Call function errno return value collection (in updating)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.