TODO: exg-- patch
TODO: selection_beg/end should set screen, or so
+ - enable --mlock option for urxvt with frills on
+ systems supporting it (patch by Russell Harmon).
- urxvt did not compile without frills enabled
(analysed by Matthew Rosewarne).
http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
+=head3 I want 256 colors
+
+Are you sure you need 256 colors? 88 colors should be enough for most
+purposes. If you really need more, there is an unsupported patch for
+it in the doc directory, but please do not ask for it to be applied.
+
=head1 RXVT-UNICODE TECHNICAL REFERENCE
The rest of this document describes various technical aspects of
=head1 SYNOPSIS
-B<@@RXVT_NAME@@d> [-q|--quiet] [-o|--opendisplay] [-f|--fork]
+B<@@RXVT_NAME@@d> [-q|--quiet] [-o|--opendisplay] [-f|--fork] [-m|--mlock]
B<@@RXVT_NAME@@d> -q -o -f # for .xsession use
This makes B<@@RXVT_NAME@@d> fork after it has bound itself to its control
socket.
+=item B<-m>, B<--mlock>
+
+This makes B<@@RXVT_NAME@@d> call mlockall(2) on itself. This locks
+B<@@RXVT_NAME@@d> in RAM and prevents it from being swapped out to disk,
+at the cost of consuming a lot more memory on most operating systems.
+
+Note: In order to use this feature, your system administrator must have set
+your user's RLIMIT_MEMLOCK to a size greater than or equal to the size of the
+B<@@RXVT_NAME@@d> binary (or to unlimited). See F</etc/security/limits.conf>.
+
+Note 2: There is a known bug in glibc (possibly fixed in 2.8 and later
+versions) where calloc returns non-zeroed memory when mlockall is in
+effect. If you experience crashes or other odd behaviour while using
+--mlock, try it without it.
+
=back
=head1 EXAMPLES
#include <sys/socket.h>
#include <sys/un.h>
+#if defined(ENABLE_FRILLS) && defined(_POSIX_MEMLOCK) && _POSIX_MEMLOCK > 0
+# define ENABLE_MLOCK 1
+#endif
+
+#if ENABLE_MLOCK
+# include <sys/mman.h>
+#endif
+
#include <cerrno>
#include "rxvt.h"
}
int opt_fork, opt_opendisplay, opt_quiet;
+#if ENABLE_MLOCK
+int opt_lock;
+#endif
int
main (int argc, const char *const *argv)
opt_opendisplay = 1;
else if (!strcmp (argv [i], "-q") || !strcmp (argv [i], "--quiet"))
opt_quiet = 1;
+#if ENABLE_MLOCK
+ else if (!strcmp (argv [i], "-m") || !strcmp (argv [i], "--mlock"))
+ opt_lock = 1;
+#endif
else
{
rxvt_log ("%s: unknown option '%s', aborting.\n", argv [0], argv [i]);
free (sockname);
+ pid_t pid = 0;
if (opt_fork)
{
- pid_t pid = fork ();
+ pid = fork ();
+ }
+#if ENABLE_MLOCK
+ // Optionally preform a mlockall so this process does not get swapped out.
+ if (opt_lock && pid == 0)
+ if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
+ perror("unable to lock into ram");
+#endif
+
+ if (opt_fork)
+ {
if (pid < 0)
{
rxvt_log ("unable to fork daemon, aborting.\n");