]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Include config.h early for _GNU_SOURCE with musl libc
authorNatanael Copa <ncopa@alpinelinux.org>
Wed, 29 Jan 2014 14:23:49 +0000 (14:23 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 29 Jan 2014 16:15:52 +0000 (16:15 +0000)
This fixes various compile errors when building with musl libc. For
example:

In file included from start.c:66:0:
monitor.h:38:12: error: 'NAME_MAX' undeclared here (not in a function)
  char name[NAME_MAX+1];
            ^
start.c: In function 'setup_signal_fd':
start.c:202:2: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
  if (sigfillset(&mask) ||
  ^

...

In file included from freezer.c:36:0:
monitor.h:39:12: error: 'NAME_MAX' undeclared here (not in a function)
  char name[NAME_MAX+1];
            ^
...

In file included from cgroup.c:45:0:
conf.h:87:13: error: 'IFNAMSIZ' undeclared here (not in a function)
  char veth1[IFNAMSIZ]; /* needed for deconf */
             ^
cgroup.c: In function 'find_cgroup_subsystems':
cgroup.c:230:3: error: implicit declaration of function 'strdup' [-Werror=implicit-function-declaration]
   (*kernel_subsystems)[kernel_subsystems_count] = strdup(line);
   ^
...

In file included from conf.c:65:0:
conf.h:87:13: error: 'IFNAMSIZ' undeclared here (not in a function)
  char veth1[IFNAMSIZ]; /* needed for deconf */
             ^
In file included from conf.c:66:0:
conf.c: In function 'run_buffer':
log.h:263:9: error: implicit declaration of function 'strsignal' [-Werror=implicit-function-declaration]
  struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT;  \
         ^
...

af_unix.c: In function 'lxc_abstract_unix_send_credential':
af_unix.c:208:9: error: variable 'cred' has initializer but incomplete type
  struct ucred cred = {
         ^
af_unix.c:209:3: error: unknown field 'pid' specified in initializer
   .pid = getpid(),
   ^
af_unix.c:209:3: error: excess elements in struct initializer [-Werror]
af_unix.c:209:3: error: (near initialization for 'cred') [-Werror]
af_unix.c:210:3: error: unknown field 'uid' specified in initializer
   .uid = getuid(),
   ^
af_unix.c:210:3: error: excess elements in struct initializer [-Werror]
af_unix.c:210:3: error: (near initialization for 'cred') [-Werror]
af_unix.c:211:3: error: unknown field 'gid' specified in initializer
   .gid = getgid(),
   ^

and more...

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/af_unix.c
src/lxc/cgmanager.c
src/lxc/cgroup.c
src/lxc/conf.c
src/lxc/freezer.c
src/lxc/lxc_start.c
src/lxc/lxc_unshare.c
src/lxc/start.c

index 830b941df0574abc5e8d1d28e8353e0064c44d3d..c1ed2ba4b3321109aa7c5f2e1306a772e81b02b6 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+#include "config.h"
+
 #include <stddef.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#define __USE_GNU
 #include <sys/socket.h>
-#undef __USE_GNU
 #include <sys/un.h>
 
 #include "log.h"
index 29c0e99052ada914ea39e4b01030cb2f55600a0b..0fb57cf64f710be1d798e589bcd3a052d6c7dc13 100644 (file)
@@ -20,9 +20,9 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <stdio.h>
-#undef _GNU_SOURCE
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
@@ -39,7 +39,6 @@
 #include <net/if.h>
 
 #include "error.h"
-#include "config.h"
 #include "commands.h"
 #include "list.h"
 #include "conf.h"
index bf5dfe3eb59efbac73451931a03be982b1d52882..a44982af0ce2d65f8c745d5c68b0a11f78b0063e 100644 (file)
@@ -20,9 +20,9 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <stdio.h>
-#undef _GNU_SOURCE
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
@@ -39,7 +39,6 @@
 #include <net/if.h>
 
 #include "error.h"
-#include "config.h"
 #include "commands.h"
 #include "list.h"
 #include "conf.h"
index 7dc1fefee7193a344a331ea2e61b6f4f3987e31d..06307b735305d6ed693e6f4f808e1f64ddb66c12 100644 (file)
@@ -20,9 +20,9 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <stdio.h>
-#undef _GNU_SOURCE
 #include <stdlib.h>
 #include <stdarg.h>
 #include <errno.h>
@@ -60,7 +60,6 @@
 #include "network.h"
 #include "error.h"
 #include "parse.h"
-#include "config.h"
 #include "utils.h"
 #include "conf.h"
 #include "log.h"
index c33a727d5f01e0019a66e79bcbf996da392328bb..89c7fab4ea3a3669077bba79bd63a298c555cea9 100644 (file)
@@ -20,9 +20,9 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <stdio.h>
-#undef _GNU_SOURCE
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
index 4b6b1f75b14bdac94970ef14d444a6e614b72242..19ebea028339557b37a8eb48b9af13af8e3e0373 100644 (file)
@@ -20,9 +20,9 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <stdio.h>
-#undef _GNU_SOURCE
 #include <libgen.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -48,7 +48,6 @@
 #include "conf.h"
 #include "cgroup.h"
 #include "utils.h"
-#include "config.h"
 #include "confile.h"
 #include "arguments.h"
 
index 792bfd9ae2ee10907b6711c6c2beef2e4095920a..a591d0aa772ff183db0968217ed8e3de750330eb 100644 (file)
@@ -20,9 +20,9 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#define _GNU_SOURCE
+#include "config.h"
+
 #include <stdio.h>
-#undef _GNU_SOURCE
 #include <errno.h>
 #include <getopt.h>
 #include <libgen.h>
@@ -39,7 +39,6 @@
 
 #include "caps.h"
 #include "cgroup.h"
-#include "config.h"
 #include "error.h"
 #include "log.h"
 #include "namespace.h"
index 5808c89cfa6659739d50586215a72551c81684b6..423bdd5b797a23d193c1432f9163015c5e8ad77d 100644 (file)
@@ -24,7 +24,6 @@
 #include "config.h"
 
 #include <stdio.h>
-#undef _GNU_SOURCE
 #include <string.h>
 #include <stdlib.h>
 #include <dirent.h>