/*
   vdev: a virtual device manager for *nix
   Copyright (C) 2023  Aitor C.Z.

   This program is dual-licensed: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3 or later as 
   published by the Free Software Foundation. For the terms of this 
   license, see LICENSE.GPLv3+ or <http://www.gnu.org/licenses/>.

   You are free to use this program under the terms of the GNU General
   Public License, 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.

   Alternatively, you are free to use this program under the terms of the 
   Internet Software Consortium License, but WITHOUT ANY WARRANTY; without
   even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   For the terms of this license, see LICENSE.ISC or 
   <http://www.isc.org/downloads/software-support-policy/isc-license/>.
*/

#ifndef _VDEV_MISC_H_
#define _VDEV_MISC_H_

#include "util.h"
#include <stdbool.h>

C_LINKAGE_BEGIN

char *strncpy_t(char *out, size_t outsz, const char *in, size_t insz);
/* fanotify OPEN target: basename "login" (any path) or /usr/bin/Xorg — see vdevd/os/linux.c */
bool vdev_fanotify_path_is_login_or_xorg(const char *exe_path);
/* DMI chassis: third-party dmidecode-chassis-type-builtin, then dmidecode pipeline. */
bool vdev_dmi_chassis_type_is_tower_or_desktop(void);
void itoa10_safe(int val, char *str);
/* Double-fork, new session, close inherited fds, stdio to /dev/null; parents exit. */
void vdev_detach_session(void);
   
C_LINKAGE_END

#endif // _VDEV_MISC_H_ 
