67 lines
1.8 KiB
C
67 lines
1.8 KiB
C
/*
|
|
* runtime.h - Runtime function declarations for libglacier
|
|
*
|
|
* This file is part of Glacier.
|
|
*
|
|
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
|
* GNU Lesser General Public License as published by the Free Software Foundation, either
|
|
* version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* Glacier 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 Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License along with Glacier. If
|
|
* not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef GLACIERRUNTIME_H_
|
|
#define GLACIERRUNTIME_H_
|
|
|
|
/*
|
|
* gl_runtime_exists
|
|
*
|
|
* DESCRIPTION: Check if necessary runtime files exist.
|
|
* PARAMETERS: None.
|
|
* RETURNS: 1 if all files exist, 0 if any file is missing
|
|
*/
|
|
int gl_runtime_exists(void);
|
|
|
|
/*
|
|
* gl_is_process_root
|
|
*
|
|
* DESCRIPTION: Check if process is running as root.
|
|
* PARAMETERS: None.
|
|
* RETURNS: 1 if running as root, 0 otherwise
|
|
*/
|
|
int gl_is_process_root(void);
|
|
|
|
/*
|
|
* gl_get_system_profile
|
|
*
|
|
* DESCRIPTION: Get the current system profile.
|
|
* PARAMETERS: None.
|
|
* RETURNS: char* containing the system profile name
|
|
*/
|
|
char *gl_get_system_profile(void);
|
|
|
|
/*
|
|
* gl_lock_file
|
|
*
|
|
* DESCRIPTION: Locks a specified file using fcntl.
|
|
* PARAMETERS: const char *filepath - Path to the file to lock
|
|
* RETURNS: file descriptor on success, -1 on failure
|
|
*/
|
|
int gl_lock_file(const char *filepath);
|
|
|
|
/*
|
|
* gl_unlock_file
|
|
*
|
|
* DESCRIPTION: Unlocks a specified file using fcntl.
|
|
* PARAMETERS: int file_descriptor - The file descriptor of the locked file
|
|
* RETURNS: 0 on success, -1 on failure
|
|
*/
|
|
int gl_unlock_file(int file_descriptor);
|
|
|
|
#endif
|