aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/texinfo.scm
diff options
context:
space:
mode:
authorMatthew James Kraai <kraai@ftbfs.org>2021-06-06 08:07:36 -0700
committerMathieu Othacehe <othacehe@gnu.org>2021-07-08 16:18:10 +0200
commit64b8e004fd0e49e82c58faefaff14d82b7905a4c (patch)
tree9eae1e3e05c28803e5fc7ed40040002f94f5a4cc /gnu/packages/texinfo.scm
parentf670c11c5b7f5799d0838caa2af07e88f489f625 (diff)
downloadguix-64b8e004fd0e49e82c58faefaff14d82b7905a4c.tar.gz
guix-64b8e004fd0e49e82c58faefaff14d82b7905a4c.zip
gnu: xkbcomp: Update to 1.4.5.
* gnu/packages/xorg.scm (xkbcomp): Update to 1.4.5. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/packages/texinfo.scm')
0 files changed, 0 insertions, 0 deletions
NAME + + +/* Rebooting, halting, and all that. */ + +#include <sys/reboot.h> + +SCM_VARIABLE_INIT (flag_RB_AUTOBOOT, "RB_AUTOBOOT", + scm_from_int (RB_AUTOBOOT)); +SCM_VARIABLE_INIT (flag_RB_HALT_SYSTEM, "RB_HALT_SYSTEM", + scm_from_int (RB_HALT_SYSTEM)); +SCM_VARIABLE_INIT (flag_RB_ENABLE_CAD, "RB_ENABLE_CAD", + scm_from_int (RB_ENABLE_CAD)); +SCM_VARIABLE_INIT (flag_RB_DISABLE_CAD, "RB_DISABLE_CAD", + scm_from_int (RB_DISABLE_CAD)); +SCM_VARIABLE_INIT (flag_RB_POWER_OFF, "RB_POWER_OFF", + scm_from_int (RB_POWER_OFF)); +SCM_VARIABLE_INIT (flag_RB_SW_SUSPEND, "RB_SW_SUSPEND", + scm_from_int (RB_SW_SUSPEND)); +SCM_VARIABLE_INIT (flag_RB_KEXEC, "RB_KEXEC", + scm_from_int (RB_KEXEC)); + +SCM_DEFINE (scm_reboot, "reboot", 0, 1, 0, + (SCM command), + "Reboot the system. @var{command} must be one of the @code{RB_} " + "constants; if omitted, @var{RB_AUTOBOOT} is used, thus " + "performing a hard reset.") +#define FUNC_NAME s_scm_reboot +{ + int c_command; + + if (SCM_UNBNDP (command)) + c_command = RB_AUTOBOOT; + else + c_command = scm_to_int (command); + + reboot (c_command); + + return SCM_UNSPECIFIED; /* likely unreached */ +} +#undef FUNC_NAME + +/* Linux network interfaces. See <linux/if.h>. */ + +#include <linux/if.h> +#include <linux/sockios.h> +#include "libguile/socket.h" + +SCM_VARIABLE_INIT (flag_IFF_UP, "IFF_UP", + scm_from_int (IFF_UP)); +SCM_VARIABLE_INIT (flag_IFF_BROADCAST, "IFF_BROADCAST", + scm_from_int (IFF_BROADCAST)); +SCM_VARIABLE_INIT (flag_IFF_DEBUG, "IFF_DEBUG", + scm_from_int (IFF_DEBUG)); +SCM_VARIABLE_INIT (flag_IFF_LOOPBACK, "IFF_LOOPBACK", + scm_from_int (IFF_LOOPBACK)); +SCM_VARIABLE_INIT (flag_IFF_POINTOPOINT, "IFF_POINTOPOINT", + scm_from_int (IFF_POINTOPOINT)); +SCM_VARIABLE_INIT (flag_IFF_NOTRAILERS, "IFF_NOTRAILERS", + scm_from_int (IFF_NOTRAILERS)); +SCM_VARIABLE_INIT (flag_IFF_RUNNING, "IFF_RUNNING", + scm_from_int (IFF_RUNNING)); +SCM_VARIABLE_INIT (flag_IFF_NOARP, "IFF_NOARP", + scm_from_int (IFF_NOARP)); +SCM_VARIABLE_INIT (flag_IFF_PROMISC, "IFF_PROMISC", + scm_from_int (IFF_PROMISC)); +SCM_VARIABLE_INIT (flag_IFF_ALLMULTI, "IFF_ALLMULTI", + scm_from_int (IFF_ALLMULTI)); + +SCM_DEFINE (scm_set_network_interface_address, "set-network-interface-address", + 3, 0, 0, + (SCM socket, SCM name, SCM address), + "Configure network interface @var{name}.") +#define FUNC_NAME s_scm_set_network_interface_address +{ + char *c_name; + struct ifreq ifr; + struct sockaddr *c_address; + size_t sa_len; + int fd, err; + + socket = SCM_COERCE_OUTPORT (socket); + SCM_VALIDATE_OPFPORT (1, socket); + fd = SCM_FPORT_FDES (socket); + + memset (&ifr, 0, sizeof ifr); + c_name = scm_to_locale_string (name); + c_address = scm_to_sockaddr (address, &sa_len); + + strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1); + memcpy (&ifr.ifr_addr, c_address, sa_len); + + err = ioctl (fd, SIOCSIFADDR, &ifr); + if (err != 0) + err = errno; + + free (c_name); + free (c_address); + + if (err != 0) + { + errno = err; + SCM_SYSERROR; + } + + return SCM_UNSPECIFIED; +} +#undef FUNC_NAME + +SCM_DEFINE (scm_set_network_interface_flags, "set-network-interface-flags", + 3, 0, 0, + (SCM socket, SCM name, SCM flags), + "Change the flags of network interface @var{name} to " + "@var{flags}.") +#define FUNC_NAME s_scm_set_network_interface_flags +{ + struct ifreq ifr; + char *c_name; + int fd, err; + + socket = SCM_COERCE_OUTPORT (socket); + SCM_VALIDATE_OPFPORT (1, socket); + fd = SCM_FPORT_FDES (socket); + + memset (&ifr, 0, sizeof ifr); + c_name = scm_to_locale_string (name); + strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1); + ifr.ifr_flags = scm_to_short (flags); + + err = ioctl (fd, SIOCSIFFLAGS, &ifr); + if (err != 0) + err = errno; + + free (c_name); + + if (err != 0) + { + errno = err; + SCM_SYSERROR; + } + + return SCM_UNSPECIFIED; +} +#undef FUNC_NAME + +SCM_DEFINE (scm_network_interface_flags, "network-interface-flags", + 2, 0, 0, + (SCM socket, SCM name), + "Return the flags of network interface @var{name}.") +#define FUNC_NAME s_scm_network_interface_flags +{ + struct ifreq ifr; + char *c_name; + int fd, err; + + socket = SCM_COERCE_OUTPORT (socket); + SCM_VALIDATE_OPFPORT (1, socket); + fd = SCM_FPORT_FDES (socket); + + memset (&ifr, 0, sizeof ifr); + c_name = scm_to_locale_string (name); + strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1); + + err = ioctl (fd, SIOCGIFFLAGS, &ifr); + if (err != 0) + err = errno; + + free (c_name); + + if (err != 0) + { + errno = err; + SCM_SYSERROR; + } + + return scm_from_short (ifr.ifr_flags); +} +#undef FUNC_NAME +#endif + void scm_init_posix () {