Last-Modified: Fri, 31 Jan 2025 00:40:48 GMT
Expires: Fri, 31 Jan 2025 00:55:48 GMT

<!DOCTYPE html>
<html lang='en'>
<head>
<title>guix - Wojtek's customized Guix</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/better-cgit-markdown-heading-color.css'/>
<link rel='shortcut icon' href='/cgit-static/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.koszko.org/guix/atom/?h=koszko' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='https://git.koszko.org/cgit-static/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/guix/'>guix</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='9a141b5bd633227ea31776b9ce7ca40928de2442'/><select name='h' onchange='this.form.submit();'>
<option value='koszko' selected='selected'>koszko</option>
<option value='koszko-scripts'>koszko-scripts</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Wojtek's customized Guix</td><td class='sub right'</td></tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=9a141b5bd633227ea31776b9ce7ca40928de2442'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=9a141b5bd633227ea31776b9ce7ca40928de2442'>tree</a><a href='/guix/commit/?id=9a141b5bd633227ea31776b9ce7ca40928de2442'>commit</a><a href='/guix/diff/?id=9a141b5bd633227ea31776b9ce7ca40928de2442'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='9a141b5bd633227ea31776b9ce7ca40928de2442'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><<pre>Tdiff --git a/gourmet/backends/db.py b/gourmet/backends/db.py
index faa6a57a..7e6d2bc6 100644
--- a/gourmet/backends/db.py
+++ b/gourmet/backends/db.py
@@ -773,9 +773,11 @@ class RecData (Pluggable):
         &quot;&quot;&quot;Return the number of rows in table that match criteria
         &quot;&quot;&quot;
         if criteria:
-            return table.count(*make_simple_select_arg(criteria,table)).execute().fetchone()[0]
+            return sqlalchemy.select(
+                sqlalchemy.func.count(criteria)).select_from(table).scalar()
         else:
-            return table.count().execute().fetchone()[0]
+            return sqlalchemy.select(
+                sqlalchemy.func.count()).select_from(table).scalar()
 
     def fetch_join (self, table1, table2, col1, col2,
                     column_names=None, sort_by=[], **criteria):
</pre>
t;)
+#define FUNC_NAME s_scm_mount
+{
+  int err;
+  char *c_source, *c_target, *c_type, *c_data;
+  unsigned long c_flags;
+
+  c_source = scm_to_locale_string (source);
+  c_target = scm_to_locale_string (target);
+  c_type = scm_to_locale_string (type);
+  c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_ulong (flags);
+
+  if (SCM_UNBNDP (data) || scm_is_false (data))
+    c_data = NULL;
+  else
+    c_data = scm_to_locale_string (data);
+
+  err = mount (c_source, c_target, c_type, c_flags, c_data);
+  if (err != 0)
+    err = errno;
+
+  free (c_source);
+  free (c_target);
+  free (c_type);
+
+  if (c_data != NULL)
+    free (c_data);
+
+  if (err != 0)
+    {
+      errno = err;
+      SCM_SYSERROR;
+    }
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_umount, &quot;umount&quot;, 1, 0, 0,
+	    (SCM target),
+	    &quot;Unmount the file system on @var{target}.&quot;)
+#define FUNC_NAME s_scm_umount
+{
+  int err;
+  char *c_target;
+
+  c_target = scm_to_locale_string (target);
+
+  err = umount (c_target);
+  if (err != 0)
+    err = errno;
+
+  free (c_target);
+
+  if (err != 0)
+    {
+      errno = err;
+      SCM_SYSERROR;
+    }
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+/* Linux&apos;s module installation syscall.  See `kernel/module.c&apos; in Linux;
+   the function itself is part of the GNU libc.
+
+   Load the LEN bytes at MODULE as a kernel module, with arguments from
+   ARGS, a space-separated list of options.  */
+extern long init_module (void *module, unsigned long len, const char *args);
+
+/* Load a kernel module from FD.  FLAGS must be a bitwise or of
+   MODULE_INIT_* constants.  The GNU libc doesn&apos;t provide a wrapper for
+   this one so we use &apos;syscall&apos;.  */
+static int
+finit_module (int fd, const char *args, int flags)
+{
+  return syscall (SYS_finit_module, fd, args, flags);
+}
+
+
+SCM_DEFINE (scm_load_linux_module, &quot;load-linux-module&quot;, 1, 1, 0,
+	    (SCM data, SCM options),
+	    &quot;Load the Linux kernel module whose contents are in bytevector &quot;
+	    &quot;DATA (the contents of a @code{.ko} file), with the arguments &quot;
+	    &quot;from the OPTIONS string.&quot;)
+#define FUNC_NAME s_scm_load_linux_module
+{
+  long err;
+  void *c_data;
+  unsigned long c_len;
+  char *c_options;
+
+  SCM_VALIDATE_BYTEVECTOR (SCM_ARG1, data);
+
+  c_data = SCM_BYTEVECTOR_CONTENTS (data);
+  c_len = SCM_BYTEVECTOR_LENGTH (data);
+  c_options =
+    scm_to_locale_string (SCM_UNBNDP (options) ? scm_nullstr : options);
+
+  err = init_module (c_data, c_len, c_options);
+
+  free (c_options);
+
+  if (err != 0)
+    SCM_SYSERROR;
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_load_linux_module_fd, &quot;load-linux-module/fd&quot;, 1, 2, 0,
+	    (SCM fd, SCM options, SCM flags),
+	    &quot;Load the Linux kernel module from the file at FD, &quot;
+	    &quot;with the arguments from the OPTIONS string, and &quot;
+            &quot;optionally the given FLAGS.&quot;)
+#define FUNC_NAME s_scm_load_linux_module_fd
+{
+  long err;
+  int c_fd, c_flags;
+  char *c_options;
+
+  c_fd = scm_to_int (fd);
+  c_options =
+    scm_to_locale_string (SCM_UNBNDP (options) ? scm_nullstr : options);
+  c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_int (flags);
+
+  err = finit_module (c_fd, c_options, c_flags);
+
+  free (c_options);
+
+  if (err != 0)
+    SCM_SYSERROR;
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+
+/* Rebooting, halting, and all that.  */
+
+#include &lt;sys/reboot.h&gt;
+
+SCM_VARIABLE_INIT (flag_RB_AUTOBOOT, &quot;RB_AUTOBOOT&quot;,
+		   scm_from_int (RB_AUTOBOOT));
+SCM_VARIABLE_INIT (flag_RB_HALT_SYSTEM, &quot;RB_HALT_SYSTEM&quot;,
+		   scm_from_int (RB_HALT_SYSTEM));
+SCM_VARIABLE_INIT (flag_RB_ENABLE_CAD, &quot;RB_ENABLE_CAD&quot;,
+		   scm_from_int (RB_ENABLE_CAD));
+SCM_VARIABLE_INIT (flag_RB_DISABLE_CAD, &quot;RB_DISABLE_CAD&quot;,
+		   scm_from_int (RB_DISABLE_CAD));
+SCM_VARIABLE_INIT (flag_RB_POWER_OFF, &quot;RB_POWER_OFF&quot;,
+		   scm_from_int (RB_POWER_OFF));
+SCM_VARIABLE_INIT (flag_RB_SW_SUSPEND, &quot;RB_SW_SUSPEND&quot;,
+		   scm_from_int (RB_SW_SUSPEND));
+SCM_VARIABLE_INIT (flag_RB_KEXEC, &quot;RB_KEXEC&quot;,
+		   scm_from_int (RB_KEXEC));
+
+SCM_DEFINE (scm_reboot, &quot;reboot&quot;, 0, 1, 0,
+	    (SCM command),
+	    &quot;Reboot the system.  @var{command} must be one of the @code{RB_} &quot;
+	    &quot;constants; if omitted, @var{RB_AUTOBOOT} is used, thus &quot;
+	    &quot;performing a hard reset.&quot;)
+#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 &lt;linux/if.h&gt;.  */
+
+#include &lt;linux/if.h&gt;
+#include &lt;linux/sockios.h&gt;
+#include &quot;libguile/socket.h&quot;
+
+SCM_VARIABLE_INIT (flag_IFF_UP, &quot;IFF_UP&quot;,
+		   scm_from_int (IFF_UP));
+SCM_VARIABLE_INIT (flag_IFF_BROADCAST, &quot;IFF_BROADCAST&quot;,
+		   scm_from_int (IFF_BROADCAST));
+SCM_VARIABLE_INIT (flag_IFF_DEBUG, &quot;IFF_DEBUG&quot;,
+		   scm_from_int (IFF_DEBUG));
+SCM_VARIABLE_INIT (flag_IFF_LOOPBACK, &quot;IFF_LOOPBACK&quot;,
+		   scm_from_int (IFF_LOOPBACK));
+SCM_VARIABLE_INIT (flag_IFF_POINTOPOINT, &quot;IFF_POINTOPOINT&quot;,
+		   scm_from_int (IFF_POINTOPOINT));
+SCM_VARIABLE_INIT (flag_IFF_NOTRAILERS, &quot;IFF_NOTRAILERS&quot;,
+		   scm_from_int (IFF_NOTRAILERS));
+SCM_VARIABLE_INIT (flag_IFF_RUNNING, &quot;IFF_RUNNING&quot;,
+		   scm_from_int (IFF_RUNNING));
+SCM_VARIABLE_INIT (flag_IFF_NOARP, &quot;IFF_NOARP&quot;,
+		   scm_from_int (IFF_NOARP));
+SCM_VARIABLE_INIT (flag_IFF_PROMISC, &quot;IFF_PROMISC&quot;,
+		   scm_from_int (IFF_PROMISC));
+SCM_VARIABLE_INIT (flag_IFF_ALLMULTI, &quot;IFF_ALLMULTI&quot;,
+		   scm_from_int (IFF_ALLMULTI));
+
+SCM_DEFINE (scm_set_network_interface_address, &quot;set-network-interface-address&quot;,
+	    3, 0, 0,
+	    (SCM socket, SCM name, SCM address),
+	    &quot;Configure network interface @var{name}.&quot;)
+#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 (&amp;ifr, 0, sizeof ifr);
+  c_name = scm_to_locale_string (name);
+  c_address = scm_to_sockaddr (address, &amp;sa_len);
+
+  strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1);
+  memcpy (&amp;ifr.ifr_addr, c_address, sa_len);
+
+  err = ioctl (fd, SIOCSIFADDR, &amp;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, &quot;set-network-interface-flags&quot;,
+	    3, 0, 0,
+	    (SCM socket, SCM name, SCM flags),
+	    &quot;Change the flags of network interface @var{name} to &quot;
+	    &quot;@var{flags}.&quot;)
+#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 (&amp;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, &amp;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, &quot;network-interface-flags&quot;,
+	    2, 0, 0,
+	    (SCM socket, SCM name),
+	    &quot;Return the flags of network interface @var{name}.&quot;)
+#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 (&amp;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, &amp;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 ()
 {
</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
