summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Peterson <lavajoe@gentoo.org>2007-06-08 18:04:35 +0000
committerJoe Peterson <lavajoe@gentoo.org>2007-06-08 18:04:35 +0000
commit4ad2bee38456896c8a724ffa7abb849429873b2b (patch)
tree1a0c19ed8ec617ddc89d5fa6baeda2323ee705a1 /sys-apps/915resolution/files
parentRevision bump fixes security bug 181214 (diff)
downloadgentoo-2-4ad2bee38456896c8a724ffa7abb849429873b2b.tar.gz
gentoo-2-4ad2bee38456896c8a724ffa7abb849429873b2b.tar.bz2
gentoo-2-4ad2bee38456896c8a724ffa7abb849429873b2b.zip
Port to ~x86-fbsd, keyword this arch only, fix init.d file (bug #175500)
(Portage version: 2.1.2.9)
Diffstat (limited to 'sys-apps/915resolution/files')
-rw-r--r--sys-apps/915resolution/files/915resolution-0.5.3-freebsd.patch95
-rw-r--r--sys-apps/915resolution/files/digest-915resolution-0.5.3-r13
-rw-r--r--sys-apps/915resolution/files/initd-r159
3 files changed, 157 insertions, 0 deletions
diff --git a/sys-apps/915resolution/files/915resolution-0.5.3-freebsd.patch b/sys-apps/915resolution/files/915resolution-0.5.3-freebsd.patch
new file mode 100644
index 000000000000..462772940f7b
--- /dev/null
+++ b/sys-apps/915resolution/files/915resolution-0.5.3-freebsd.patch
@@ -0,0 +1,95 @@
+diff -Nru 915resolution-0.5.3/915resolution.c 915resolution-0.5.3-new/915resolution.c
+--- 915resolution-0.5.3/915resolution.c 2007-04-21 12:40:51 +0000
++++ 915resolution-0.5.3-new/915resolution.c 2007-04-21 12:40:51 +0000
+@@ -22,7 +22,17 @@
+ #include <string.h>
+ #include <sys/mman.h>
+ #include <fcntl.h>
++
++#if defined(__NetBSD__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#include "bsd_io.h"
++#elif defined(__FreeBSD__)
++#include "bsd_io.h"
++#elif defined(linux)
+ #include <sys/io.h>
++#endif
++
+ #include <unistd.h>
+ #include <assert.h>
+
+@@ -163,12 +173,26 @@
+
+
+ void initialize_system(char * filename) {
+-
+ if (!filename) {
++#if defined(__FreeBSD__)
++ int iofd = open("/dev/io", O_RDONLY);
++ if (iofd == -1) {
++ perror("Unable to obtain the proper IO permissions");
++ exit(2);
++ }
++#elif defined(__NetBSD__)
++ if (i386_iopl(3) < 0) {
++ perror("Unable to obtain the proper IO permissions");
++ exit(2);
++ }
++#elif defined(linux)
+ if (iopl(3) < 0) {
+ perror("Unable to obtain the proper IO permissions");
+ exit(2);
+ }
++#else
++#error Not ported to this operating system
++#endif
+ }
+ }
+
+diff -Nru 915resolution-0.5.3/bsd_io.h 915resolution-0.5.3-new/bsd_io.h
+--- 915resolution-0.5.3/bsd_io.h 1970-01-01 00:00:00 +0000
++++ 915resolution-0.5.3-new/bsd_io.h 2007-04-21 12:40:51 +0000
+@@ -0,0 +1,42 @@
++#include <sys/types.h>
++
++#ifndef _BSD_IO_H_
++#define _BSD_IO_H_
++
++/* Ripped out of cpufunc.h, changed args to match Linux. */
++static __inline u_int
++inl(u_int port)
++{
++ u_int data;
++
++ __asm __volatile("inl %%dx,%0" : "=a" (data) : "d" (port));
++ return (data);
++}
++
++static __inline u_char
++inb(u_int port)
++{
++ u_char data;
++
++ __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
++ return (data);
++}
++
++static __inline void
++outl(u_int data, u_int port)
++{
++ /*
++ * outl() and outw() aren't used much so we haven't looked at
++ * possible micro-optimizations such as the unnecessary
++ * assignment for them.
++ */
++ __asm __volatile("outl %0,%%dx" : : "a" (data), "d" (port));
++}
++
++static __inline void
++outb(u_char data, u_int port)
++{
++ __asm __volatile("outb %0,%1" : : "a" (data), "id" ((u_short)(port)));
++}
++
++#endif
diff --git a/sys-apps/915resolution/files/digest-915resolution-0.5.3-r1 b/sys-apps/915resolution/files/digest-915resolution-0.5.3-r1
new file mode 100644
index 000000000000..db576029788c
--- /dev/null
+++ b/sys-apps/915resolution/files/digest-915resolution-0.5.3-r1
@@ -0,0 +1,3 @@
+MD5 ed287778a53d02c31a7a6a52bc146291 915resolution-0.5.3.tar.gz 22583
+RMD160 a406c6810bbfcf94c5352ea1b1e9178af4078589 915resolution-0.5.3.tar.gz 22583
+SHA256 b64cab834b5e410bca555dc9db8e69f62f6f02496942f35ff4a68f3f27f1b542 915resolution-0.5.3.tar.gz 22583
diff --git a/sys-apps/915resolution/files/initd-r1 b/sys-apps/915resolution/files/initd-r1
new file mode 100644
index 000000000000..f63f2472aa61
--- /dev/null
+++ b/sys-apps/915resolution/files/initd-r1
@@ -0,0 +1,59 @@
+#!/sbin/runscript
+
+depend() {
+ before xdm
+}
+
+# Credit to David Leverton for this function which handily maps a bash array
+# structure to positional parameters so existing configs work :)
+# We'll deprecate arrays at some point though.
+_get_array() {
+ if [ -n "${BASH}" ] ; then
+ case "$(declare -p "$1" 2>/dev/null)" in
+ "declare -a "*)
+ echo "set -- \"\${$1[@]}\""
+ return
+ ;;
+ esac
+ fi
+
+ echo "eval set -- \"\$$1\""
+}
+
+checkconfig() {
+ if [ -z "${replace}" ]; then
+ eerror "You need to have at least one resolution to replace"
+ eerror "/etc/conf.d/915resolution"
+ return 1
+ fi
+
+ # Start with a clean log file
+ cat /dev/null > ${log:-/dev/null}
+
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Patching video BIOS with new video modes"
+
+ retval=0
+ first=0
+ eval $(_get_array replace)
+ for mode in "$@"; do
+ # If this is not the first mode, insert a separator in the log
+ if [ ${first} -ne 0 ]; then
+ echo "" >> ${log:-/dev/null}
+ echo "---" >> ${log:-/dev/null}
+ echo "" >> ${log:-/dev/null}
+ fi
+
+ # Set each mode, and remember the last bad return value if any fail
+ 915resolution ${mode} >> ${log:-/dev/null} || retval=$?
+
+ first=1
+ done
+
+ eend ${retval}
+}