- if (-1 == open(logfile, O_WRONLY) ) {
- if (-1 == open(logfile, O_WRONLY | O_CREAT)
- error
- else
- write header information
- write log entry
- else
- write log entry
#include <sys/types.h> #include <unistd.h> pid_t getpid(void); pid_t getppid(void);
#include <unistd.h> unsigned int sleep(unsigned int seconds)
#include <unistd.h> int usleep(useconds_t usec);
#include <unistd.h> #include <fcntl.h> int fcntl(int fd, int cmd, ... /* arg */ );
"Certain of the operations below are supported only since a particular Linux kernel version. The preferred method of checking whether the host kernel supports a particular operation is to invoke fcntl() with the desired cmd value and then test whether the call failed with EIN- VAL, indicating that the kernel does not recognize this value."