Quoting Natanael Copa ([email protected]): > 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 <[email protected]>
Note I'm not convinced that dropping the __USE_GNU from around the sys/socket.h include is not going to break something, but if it does we'll see it at the next build. Acked-by: Serge E. Hallyn <[email protected]> > --- > src/lxc/af_unix.c | 4 ++-- > src/lxc/cgmanager.c | 5 ++--- > src/lxc/cgroup.c | 5 ++--- > src/lxc/conf.c | 5 ++--- > src/lxc/freezer.c | 4 ++-- > src/lxc/lxc_start.c | 5 ++--- > src/lxc/lxc_unshare.c | 5 ++--- > src/lxc/start.c | 1 - > 8 files changed, 14 insertions(+), 20 deletions(-) > > diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c > index 830b941..c1ed2ba 100644 > --- a/src/lxc/af_unix.c > +++ b/src/lxc/af_unix.c > @@ -20,14 +20,14 @@ > * 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" > diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c > index 29c0e99..0fb57cf 100644 > --- a/src/lxc/cgmanager.c > +++ b/src/lxc/cgmanager.c > @@ -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" > diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c > index fd60155..fb8b341 100644 > --- a/src/lxc/cgroup.c > +++ b/src/lxc/cgroup.c > @@ -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" > diff --git a/src/lxc/conf.c b/src/lxc/conf.c > index 71b3407..ccfbb8e 100644 > --- a/src/lxc/conf.c > +++ b/src/lxc/conf.c > @@ -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" > diff --git a/src/lxc/freezer.c b/src/lxc/freezer.c > index c33a727..89c7fab 100644 > --- a/src/lxc/freezer.c > +++ b/src/lxc/freezer.c > @@ -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> > diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c > index 4b6b1f7..19ebea0 100644 > --- a/src/lxc/lxc_start.c > +++ b/src/lxc/lxc_start.c > @@ -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" > > diff --git a/src/lxc/lxc_unshare.c b/src/lxc/lxc_unshare.c > index 792bfd9..a591d0a 100644 > --- a/src/lxc/lxc_unshare.c > +++ b/src/lxc/lxc_unshare.c > @@ -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" > diff --git a/src/lxc/start.c b/src/lxc/start.c > index 5808c89..423bdd5 100644 > --- a/src/lxc/start.c > +++ b/src/lxc/start.c > @@ -24,7 +24,6 @@ > #include "config.h" > > #include <stdio.h> > -#undef _GNU_SOURCE > #include <string.h> > #include <stdlib.h> > #include <dirent.h> > -- > 1.8.5.3 > > _______________________________________________ > lxc-devel mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-devel _______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
