Section: Linux Simple I/O Library (2)
Updated: 21 December 2018
Index Return to Main Contents


liblinux -- Linux Simple I/O Library: Linux System Call Wrapper Module  


#include <libsimpleio/liblinux.h>

void LINUX_detach(int32_t *error);

void LINUX_drop_privileges(const char *username, int32_t *error);

void LINUX_openlog(const char *id, int32_t options, int32_t facility,
  int32_t *error);

void LINUX_syslog(int32_t priority, const char *msg, int32_t *error);

void LINUX_strerror(int32_t error, char *buf, int32_t bufsize);

void LINUX_poll(int32_t numfiles, int32_t *files, int32_t *events,
  int32_t *results, int32_t timeout, int32_t *error);

void LINUX_usleep(int32_t microseconds, int32_t *error);

void LINUX_command(const char *cmd, int32_t *status, int32_t *error);

Link with -lsimpleio.  


These functions wrap certain useful Linux system calls for use by other programming languages such as Ada, C#, Java, and Pascal. They are provided for the convenience of devlopers using libsimpleio with those langauges. For the C programming language, they offer no particular benefit over the regular system call wrappers.

All functions return either 0 (upon success) or an errno value (upon failure) in *error.

LINUX_detach() detaches the calling process from its controlling terminal and continues execution in the background.

LINUX_drop_privileges() allows a process started by the superuser to drop its privileges to those of the user specified by the username parameter.

LINUX_openlog() opens a connection to the syslog message logger. The options and facility parameters accept the same values as the openlog() system library function.

LINUX_syslog() transmits a text message supplied in the msg parameter to the syslog message logger. The priority parameter accepts the same values as the syslog() system library function.

LINUX_strerror() retrieves the error message for the errno value passed in the error parameter. A destination buffer address and size must be passed in the buf and bufsize parameters.

LINUX_poll() waits for events on an set of file descriptors. The number of file descriptors is passed in the numfiles parameter. An array of file descriptors is passed in the files parameter. An array of requested events, using the same values as the poll() system library function, is passed in the events parameter. The results for each file descriptor, also using the same values as the poll() system library function, will be returned in the results parameter. A timeout in milliseconds may be passed in the timeout parameter. A timeout of zero indicates an immediate return without waiting at all. A timeout of -1 indicates waiting forever. If the timeout expires without any event on any file descriptor occurring, then error will be set to EAGAIN.

LINUX_usleep() causes the calling program to sleep for the period indicated by microseconds, by calling the usleep() system library function.

LINUX_command() passes the shell command string specified by the cmd parameter to the system() system library function for execution. The return value from the shell command will be returned in status.  


libsimpleio(2), libadc(2), libdac(2), libevent(2), libgpio(2),
libhidraw(2), libi2c(2), libipv4(2), liblinx(2), libpwm(2),
libserial(2), libspi(2), libstream(2), libwatchdog(2)  


Philip Munts, President, Munts AM Corp dba Munts Technologies




This document was created by man2html, using the manual pages.
Time: 09:41:20 GMT, December 21, 2018