<commit_before>/*
 * Copyright © 2015 <NAME> <<EMAIL>>.
 * Copyright © 2015 Proxmox Server Solutions GmbH
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * --
 *
 * This stop-hook unmounts everything in the container's namespace, and thereby
 * waits for all calls commands to finish. This is useful when one needs to be
 * sure that network filesystems are finished unmounting in the namespace
 * before continuing with other tasks. Without this hook the cleanup of mounts
 * is done by the kernel in the background after all the references to the
 * namespaces are gone.
 */

#define _GNU_SOURCE    /* setns */
#include <stdio.h>     /* fdopen, getmntent, endmntent */
#include <stdlib.h>    /* malloc, qsort */
#include <unistd.h>    /* close */
#include <string.h>    /* strcmp, strncmp, strdup, strerror */
#include <sched.h>     /* setns */
#include <sys/mount.h> /* umount2 */
#include <sys/types.h> /* openat, open */
#include <sys/stat.h>  /* openat, open */
#include <fcntl.h>     /* openat, open */
#include <mntent.h>    /* getmntent, endmntent */
#include <errno.h>     /* errno */

#include <../src/config.h>

#if IS_BIONIC
#include <../src/include/lxcmntent.h>
#else
#include <mntent.h>
#endif

#ifndef O_PATH
#define O_PATH      010000000
#endif

/* Define setns() if missing from the C library */
#ifndef HAVE_SETNS
static inline int setns(int fd, int nstype)
{
#ifdef __NR_setns<commit_msg>Don't include mntent when lxcmntent is used<commit_after>/*
 * Copyright © 2015 <NAME> <<EMAIL>>.
 * Copyright © 2015 Proxmox Server Solutions GmbH
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * --
 *
 * This stop-hook unmounts everything in the container's namespace, and thereby
 * waits for all calls commands to finish. This is useful when one needs to be
 * sure that network filesystems are finished unmounting in the namespace
 * before continuing with other tasks. Without this hook the cleanup of mounts
 * is done by the kernel in the background after all the references to the
 * namespaces are gone.
 */

#define _GNU_SOURCE    /* setns */
#include <stdio.h>     /* fdopen, getmntent, endmntent */
#include <stdlib.h>    /* malloc, qsort */
#include <unistd.h>    /* close */
#include <string.h>    /* strcmp, strncmp, strdup, strerror */
#include <sched.h>     /* setns */
#include <sys/mount.h> /* umount2 */
#include <sys/types.h> /* openat, open */
#include <sys/stat.h>  /* openat, open */
#include <fcntl.h>     /* openat, open */
#include <errno.h>     /* errno */

#include <../src/config.h>

#if IS_BIONIC
#include <../src/include/lxcmntent.h>
#else
#include <mntent.h>
#endif

#ifndef O_PATH
#define O_PATH      010000000
#endif

/* Define setns() if missing from the C library */
#ifndef HAVE_SETNS
static inline int setns(int fd, int nstype)
{
#ifdef __NR_setns
{'fraction_non_alphanumeric': 0.10298507462686567, 'fraction_numerical': 0.014925373134328358, 'mean_word_length': 3.51290684624018, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7358832', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1189, 'n_words': 521}