]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/util-linux-buildfix.patch
util-linux: Build fixes for new kernel headers.
[ipfire-2.x.git] / src / patches / util-linux-buildfix.patch
1 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=392236
2
3 diff -ru util-linux-2.12r/fdisk/llseek.c util-linux-2.12r-new/fdisk/llseek.c
4 --- util-linux-2.12r/fdisk/llseek.c 2003-07-14 07:13:33.000000000 +1000
5 +++ util-linux-2.12r-new/fdisk/llseek.c 2006-10-13 15:50:09.000000000 +1000
6 @@ -14,30 +14,23 @@
7
8 #ifdef __linux__
9
10 -#ifdef HAVE_LLSEEK
11 -#include <syscall.h>
12 -
13 -#else /* HAVE_LLSEEK */
14 +#include <sys/syscall.h>
15 +#ifndef HAVE_LLSEEK
16
17 #if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
18
19 #define my_llseek lseek
20
21 #else
22 -#include <linux/unistd.h> /* for __NR__llseek */
23 -
24 -static int _llseek (unsigned int, unsigned long,
25 - unsigned long, long long *, unsigned int);
26
27 -#ifdef __NR__llseek
28 +#ifdef SYS__llseek
29
30 -static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
31 - unsigned long, offset_low,long long *,result,
32 - unsigned int, origin)
33 +#define _llseek(fd, offset_high, offset_low, result, origin) \
34 + syscall(SYS__llseek, fd, offset_high, offset_low, result, origin)
35
36 #else
37
38 -/* no __NR__llseek on compilation machine - might give it explicitly */
39 +/* no SYS__llseek on compilation machine - might give it explicitly */
40 static int _llseek (unsigned int fd, unsigned long oh,
41 unsigned long ol, long long *result,
42 unsigned int origin) {
43 diff -ru util-linux-2.12r/fdisk/sfdisk.c util-linux-2.12r-new/fdisk/sfdisk.c
44 --- util-linux-2.12r/fdisk/sfdisk.c 2005-01-05 08:31:57.000000000 +1000
45 +++ util-linux-2.12r-new/fdisk/sfdisk.c 2006-10-13 15:48:42.000000000 +1000
46 @@ -48,7 +48,7 @@
47 #include <sys/ioctl.h>
48 #include <sys/stat.h>
49 #include <sys/utsname.h>
50 -#include <linux/unistd.h> /* _syscall */
51 +#include <sys/syscall.h>
52 #include "nls.h"
53 #include "common.h"
54
55 @@ -177,9 +177,8 @@
56 #endif
57
58 #ifndef use_lseek
59 -static __attribute__used
60 -_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
61 - loff_t *, res, unsigned int, wh);
62 +#define _llseek(fd, hi, lo, res, wh) \
63 + syscall(SYS__llseek, fd, hi, lo, res, wh)
64 #endif
65
66 static int
67 diff -ru util-linux-2.12r/lib/my_reboot.c util-linux-2.12r-new/lib/my_reboot.c
68 --- util-linux-2.12r/lib/my_reboot.c 1999-07-09 12:56:36.000000000 +1000
69 +++ util-linux-2.12r-new/lib/my_reboot.c 2006-10-13 20:46:42.000000000 +1000
70 @@ -23,10 +23,11 @@
71 #else /* no USE_LIBC */
72
73 /* direct syscall version */
74 -#include <linux/unistd.h>
75 +#include <sys/syscall.h>
76
77 -#ifdef _syscall3
78 -_syscall3(int, reboot, int, magic, int, magic_too, int, cmd);
79 +#ifdef SYS_reboot
80 +#define reboot(magic, magic2, cmd) \
81 + syscall(SYS_reboot, magic, magic2, cmd)
82 #else
83 /* Let us hope we have a 3-argument reboot here */
84 extern int reboot(int, int, int);
85 diff -ru util-linux-2.12r/misc-utils/setterm.c util-linux-2.12r-new/misc-utils/setterm.c
86 --- util-linux-2.12r/misc-utils/setterm.c 2003-10-18 02:17:51.000000000 +1000
87 +++ util-linux-2.12r-new/misc-utils/setterm.c 2006-10-13 20:54:06.000000000 +1000
88 @@ -119,14 +119,13 @@
89
90 #if __GNU_LIBRARY__ < 5
91 #ifndef __alpha__
92 -# include <linux/unistd.h>
93 -#define __NR_klogctl __NR_syslog
94 -_syscall3(int, klogctl, int, type, char*, buf, int, len);
95 +# include <sys/syscall.h>
96 +#define klogctl(type, buf, len) \
97 + syscall(SYS_syslog, type, buf, len)
98 #else /* __alpha__ */
99 #define klogctl syslog
100 #endif
101 #endif
102 -extern int klogctl(int type, char *buf, int len);
103
104 /* Constants. */
105
106 diff -ru util-linux-2.12r/mount/swapon.c util-linux-2.12r-new/mount/swapon.c
107 --- util-linux-2.12r/mount/swapon.c 2004-12-22 19:50:19.000000000 +1000
108 +++ util-linux-2.12r-new/mount/swapon.c 2006-10-13 16:08:19.000000000 +1000
109 @@ -82,11 +82,11 @@
110 #else
111 /* We want a swapon with two args, but have an old libc.
112 Build the kernel call by hand. */
113 -#include <linux/unistd.h>
114 -static
115 -_syscall2(int, swapon, const char *, path, int, flags);
116 -static
117 -_syscall1(int, swapoff, const char *, path);
118 +#include <sys/syscall.h>
119 +#define swapon(path, flags) \
120 + syscall(SYS_swapon, path, flags)
121 +#define swapoff(path) \
122 + syscall(SYS_swapoff, path)
123 #endif
124 #else
125 /* just do as libc says */
126 diff -ru util-linux-2.12r/mount/umount.c util-linux-2.12r-new/mount/umount.c
127 --- util-linux-2.12r/mount/umount.c 2005-09-11 04:07:38.000000000 +1000
128 +++ util-linux-2.12r-new/mount/umount.c 2006-10-13 20:43:22.000000000 +1000
129 @@ -37,14 +37,13 @@
130 #else /* MNT_FORCE */
131
132 /* Does the present kernel source know about umount2? */
133 -#include <linux/unistd.h>
134 -#ifdef __NR_umount2
135 +#include <sys/syscall.h>
136 +#ifdef SYS_umount2
137
138 -static int umount2(const char *path, int flags);
139 +#define umount2(path, flags) \
140 + syscall(SYS_umount2, path, flags)
141
142 -_syscall2(int, umount2, const char *, path, int, flags);
143 -
144 -#else /* __NR_umount2 */
145 +#else /* SYS_umount2 */
146
147 static int
148 umount2(const char *path, int flags) {
149 @@ -52,7 +51,7 @@
150 errno = ENOSYS;
151 return -1;
152 }
153 -#endif /* __NR_umount2 */
154 +#endif /* SYS_umount2 */
155
156 #if !defined(MNT_FORCE)
157 /* dare not try to include <linux/mount.h> -- lots of errors */
158 diff -ru util-linux-2.12r/partx/partx.c util-linux-2.12r-new/partx/partx.c
159 --- util-linux-2.12r/partx/partx.c 2004-08-24 06:13:27.000000000 +1000
160 +++ util-linux-2.12r-new/partx/partx.c 2006-10-13 21:01:34.000000000 +1000
161 @@ -338,10 +338,9 @@
162 #endif
163
164 #ifdef NEED__llseek
165 -#include <linux/unistd.h> /* _syscall */
166 -static
167 -_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
168 - long long *, res, uint, wh);
169 +#include <sys/syscall.h>
170 +#define _llseek(fd, hi, lo, res, wh) \
171 + syscall(SYS__llseek, fd, hi, lo, res, wh)
172 #endif
173
174 static int
175 diff -ru util-linux-2.12r/sys-utils/dmesg.c util-linux-2.12r-new/sys-utils/dmesg.c
176 --- util-linux-2.12r/sys-utils/dmesg.c 2004-05-05 02:38:12.000000000 +1000
177 +++ util-linux-2.12r-new/sys-utils/dmesg.c 2006-10-13 21:05:10.000000000 +1000
178 @@ -29,7 +29,7 @@
179 * Only function 3 is allowed to non-root processes.
180 */
181
182 -#include <linux/unistd.h>
183 +#include <sys/syscall.h>
184 #include <stdio.h>
185 #include <getopt.h>
186 #include <stdlib.h>
187 @@ -38,8 +38,8 @@
188 #if __GNU_LIBRARY__ < 5
189
190 #ifndef __alpha__
191 -# define __NR_klogctl __NR_syslog
192 - static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
193 +# define klogctl(type, b, len) \
194 + syscall(SYS_syslog, type, b, len)
195 #else /* __alpha__ */
196 #define klogctl syslog
197 #endif