[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: termio constants on kfreebsd



Hi all!

  Disabling partx is *not* enough for util-linux to build on
kfreebsd. Below is a full patch that gets me a building + functioning
agetty as well (as far as I can tell).

Regards

    Christoph

Christoph Egger <christoph@debian.org> writes:
> Robert Millan <rmh@debian.org> writes:
>> El 8 de gener de 2012 21:30, Christoph Egger <christoph@debian.org> ha escrit:
>>> What to do with the rest? Conditionally defining all of them to 0?
>>
>> On my experience this works most of the time.  I'd make sure that
>> getty didn't break after this change, though.
>
> Here's a patch. I'll test it and add it to the bug report or something
> like that

--- util-linux-2.20.1/debian/rules
+++ util-linux-2.20.1/debian/rules
@@ -32,9 +32,9 @@
 version := $(shell sed -e '1{;s|^util-linux (\(.*\))\ .*|\1|;q;}' debian/changelog)
 Upstream := $(shell sed 's/^.*(\(.*\)-.*).*/\1/; q' debian/changelog)
 
-CONFOPTS= --enable-raw --enable-rdev --enable-partx --with-slang
+CONFOPTS= --enable-raw --enable-rdev --with-slang
 ifeq ($(DEB_HOST_ARCH_OS),linux)
-CONFOPTS += --with-selinux --enable-libmount-mount
+CONFOPTS += --with-selinux --enable-libmount-mount --enable-partx
 endif
 
 build: build-arch build-indep
--- util-linux-2.20.1.orig/term-utils/agetty.c
+++ util-linux-2.20.1/term-utils/agetty.c
@@ -10,6 +10,7 @@
  *
  * This program is freely distributable.
  */
+
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -39,6 +40,12 @@
 #include "c.h"
 #include "widechar.h"
 
+#if defined(__FreeBSD_kernel__)
+#include <pty.h>
+#include <sys/param.h>
+#endif
+
+
 #ifdef __linux__
 #  include <sys/kd.h>
 #  include <sys/param.h>
@@ -66,6 +73,10 @@
 #  endif
 #endif
 
+#ifdef __FreeBSD_kernel__
+#define USE_SYSLOG
+#endif
+
 /* If USE_SYSLOG is undefined all diagnostics go to /dev/console. */
 #ifdef USE_SYSLOG
 #  include <syslog.h>
@@ -980,6 +991,11 @@
        if (tcgetattr(STDIN_FILENO, tp) < 0)
                log_err("%s: tcgetattr: %m", tty);
 
+
+#if defined(__FreeBSD_kernel__)
+     login_tty (0);
+#endif
+
        /*
         * Detect if this is a virtual console or serial/modem line.
         * In case of a virtual console the ioctl TIOCMGET fails and
@@ -1141,6 +1157,46 @@
        /* Sane setting, allow eight bit characters, no carriage return delay
         * the same result as `stty sane cr0 pass8'
         */
+#ifndef IUCLC
+# define IUCLC 0
+#endif
+#ifndef NL0
+# define NL0 0
+#endif
+#ifndef CR0
+# define CR0 0
+#endif
+#ifndef BS0
+# define BS0 0
+#endif
+#ifndef VT0
+# define VT0 0
+#endif
+#ifndef FF0
+# define FF0 0
+#endif
+#ifndef OLCUC
+# define OLCUC 0
+#endif
+#ifndef OFILL
+# define OFILL 0
+#endif
+#ifndef NLDLY
+# define NLDLY 0
+#endif
+#ifndef CRDLY
+# define CRDLY 0
+#endif
+#ifndef BSDLY
+# define BSDLY 0
+#endif
+#ifndef VTDLY
+# define VTDLY 0
+#endif
+#ifndef FFDLY
+# define FFDLY 0
+#endif
+
        tp->c_iflag |=  (BRKINT | ICRNL | IMAXBEL);
        tp->c_iflag &= ~(IGNBRK | INLCR | IGNCR | IXOFF | IUCLC | IXANY | ISTRIP);
        tp->c_oflag |=  (OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0);
--- util-linux-2.20.1.orig/term-utils/Makefile.am
+++ util-linux-2.20.1/term-utils/Makefile.am
@@ -23,6 +23,7 @@
 sbin_PROGRAMS += agetty
 dist_man_MANS += agetty.8
 agetty_SOURCES = agetty.c
+agetty_LDADD = -lutil
 if !HAVE_LANGINFO
 agetty_SOURCES += $(top_srcdir)/lib/langinfo.c
 endif

-- 
9FED 5C6C E206 B70A 5857  70CA 9655 22B9 D49A E731
Debian Developer | Lisp Hacker | CaCert Assurer


Reply to: