CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
platform_linux.h File Reference
#include <sys/types.h>
#include <sys/xattr.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <mntent.h>
#include <pthread.h>
#include <signal.h>
#include <sys/file.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include "file_watcher.h"
#include "smalloc.h"
Include dependency graph for platform_linux.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define platform_sighandler_t   sighandler_t
 
#define MNT_DETACH   0x00000002
 

Typedefs

typedef pthread_spinlock_t platform_spinlock
 
typedef struct dirent64 platform_dirent64
 
typedef struct stat64 platform_stat64
 

Functions

std::vector< std::string > platform_mountlist ()
 
bool platform_umount (const char *mountpoint, const bool lazy)
 
bool platform_umount_lazy (const char *mountpoint)
 
int platform_spinlock_init (platform_spinlock *lock, int pshared)
 
int platform_spinlock_destroy (platform_spinlock *lock)
 
int platform_spinlock_trylock (platform_spinlock *lock)
 
void platform_spinlock_unlock (platform_spinlock *lock)
 
pthread_t platform_gettid ()
 
int platform_sigwait (const int signum)
 
bool platform_allow_ptrace (const pid_t pid)
 
platform_dirent64platform_readdir (DIR *dirp)
 
int platform_stat (const char *path, platform_stat64 *buf)
 
int platform_lstat (const char *path, platform_stat64 *buf)
 
int platform_fstat (int filedes, platform_stat64 *buf)
 
bool platform_getxattr (const std::string &path, const std::string &name, std::string *value)
 
bool platform_setxattr (const std::string &path, const std::string &name, const std::string &value)
 
bool platform_lsetxattr (const std::string &path, const std::string &name, const std::string &value)
 
ssize_t platform_lgetxattr (const char *path, const char *name, void *value, size_t size)
 
ssize_t platform_llistxattr (const char *path, char *list, size_t size)
 
void platform_disable_kcache (int filedes)
 
int platform_readahead (int filedes)
 
int platform_invalidate_kcache (const int fd, const off_t offset, const size_t length)
 
std::string platform_libname (const std::string &base_name)
 
std::string platform_getexepath ()
 
struct timespec _time_with_clock (int clock)
 
uint64_t platform_monotonic_time ()
 
uint64_t platform_monotonic_time_ns ()
 
uint64_t platform_realtime_ns ()
 
uint64_t platform_memsize ()
 
file_watcher::FileWatcherplatform_file_watcher ()
 

Macro Definition Documentation

#define MNT_DETACH   0x00000002

Definition at line 61 of file platform_linux.h.

Referenced by platform_umount(), and platform_umount_lazy().

#define platform_sighandler_t   sighandler_t

This file is part of the CernVM File System.

Linux specific system/library calls.

Definition at line 46 of file platform_linux.h.

Referenced by CachePlugin::MainProcessRequests().

Typedef Documentation

typedef struct dirent64 platform_dirent64

File system functions, ensure 64bit versions.

Definition at line 204 of file platform_linux.h.

typedef pthread_spinlock_t platform_spinlock

Spinlocks are not necessarily part of pthread on all platforms.

Definition at line 145 of file platform_linux.h.

typedef struct stat64 platform_stat64

Definition at line 210 of file platform_linux.h.

Function Documentation

struct timespec _time_with_clock ( int  clock)

Definition at line 323 of file platform_linux.h.

Referenced by platform_monotonic_time(), platform_monotonic_time_ns(), and platform_realtime_ns().

Here is the call graph for this function:

Here is the caller graph for this function:

bool platform_allow_ptrace ( const pid_t  pid)
inline

Grants a PID capabilites for ptrace() usage

Parameters
PIDthe PID of the process to be granted ptrace()-access (may be ignored)
Returns
true when successful

Definition at line 185 of file platform_linux.h.

Referenced by Watchdog::Spawn().

Here is the caller graph for this function:

void platform_disable_kcache ( int  filedes)
inline

Definition at line 273 of file platform_linux.h.

Referenced by cipher::Key::CreateFromFile(), MainCheck(), and cipher::Key::SaveToFile().

Here is the caller graph for this function:

file_watcher::FileWatcher* platform_file_watcher ( )
inline

Definition at line 354 of file platform_linux.h.

Referenced by MountPoint::CreateResolvConfWatcher().

Here is the caller graph for this function:

std::string platform_getexepath ( )
inline

Definition at line 313 of file platform_linux.h.

pthread_t platform_gettid ( )
inline

pthread_self() is not necessarily an unsigned long.

Definition at line 166 of file platform_linux.h.

Referenced by LibGlobals::CallbackLibcryptoThreadId(), and CallbackLibcryptoThreadId().

Here is the caller graph for this function:

bool platform_getxattr ( const std::string &  path,
const std::string &  name,
std::string *  value 
)
inline
int platform_invalidate_kcache ( const int  fd,
const off_t  offset,
const size_t  length 
)
inline

Advises the kernel to evict the given file region from the page cache.

Note: Pages containing the data at offset and offset + length are NOT evicted by the kernel. This means that a few pages are not purged when offset and length are not exactly on page boundaries. See below:

     offset                                  length
       |                                        |

+------—+-—|-—+------—+------—+------—+--—|—+------—+ | | | | xxxxxxx | xxxxxxx | xxxxxxx | | | | | | | | xxxxxxx | xxxxxxx | xxxxxxx | | | | +------—+-—|-—+------—+------—+------—+--—|—+------—+ 0 4096 | 8192 12288 16384 20480 | 24576 28672

git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/mm/fadvise.c#n115

TODO(rmeusel): figure out a clever way how to align offset and length

Parameters
fdfile descriptor whose page cache should be (partially) evicted
offsetstart offset of the pages to be evicted
lengthnumber of bytes to be evicted

Definition at line 304 of file platform_linux.h.

Referenced by FileIngestionSource::Close().

Here is the caller graph for this function:

ssize_t platform_lgetxattr ( const char *  path,
const char *  name,
void *  value,
size_t  size 
)
inline

Definition at line 264 of file platform_linux.h.

Referenced by XattrList::CreateFromFile().

Here is the caller graph for this function:

std::string platform_libname ( const std::string &  base_name)
inline

Definition at line 309 of file platform_linux.h.

Referenced by loader::LoadLibrary(), and main().

Here is the caller graph for this function:

ssize_t platform_llistxattr ( const char *  path,
char *  list,
size_t  size 
)
inline

Definition at line 269 of file platform_linux.h.

Referenced by XattrList::CreateFromFile().

Here is the caller graph for this function:

bool platform_lsetxattr ( const std::string &  path,
const std::string &  name,
const std::string &  value 
)
inline

Definition at line 257 of file platform_linux.h.

Referenced by PosixSetMeta().

Here is the caller graph for this function:

uint64_t platform_memsize ( )
inline

Definition at line 349 of file platform_linux.h.

Referenced by PluginRamCache::Create(), IngestionPipeline::IngestionPipeline(), and FileSystem::SetupRamCacheMgr().

Here is the caller graph for this function:

uint64_t platform_monotonic_time_ns ( )
inline

Definition at line 339 of file platform_linux.h.

Referenced by HighPrecisionTimer::~HighPrecisionTimer().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector<std::string> platform_mountlist ( )
inline

Definition at line 48 of file platform_linux.h.

Referenced by IsMountPoint(), anonymous_namespace{cmd_enter.cc}::RemoveUnderlay(), and auto_umount::UmountOnCrash().

Here is the caller graph for this function:

int platform_readahead ( int  filedes)
inline

Definition at line 277 of file platform_linux.h.

Referenced by sqlite::Database< DerivedT >::FileReadAhead().

Here is the caller graph for this function:

uint64_t platform_realtime_ns ( )
inline

Definition at line 344 of file platform_linux.h.

Referenced by receiver::CommitProcessor::Process().

Here is the call graph for this function:

Here is the caller graph for this function:

bool platform_setxattr ( const std::string &  path,
const std::string &  name,
const std::string &  value 
)
inline

Definition at line 250 of file platform_linux.h.

int platform_sigwait ( const int  signum)
inline

Definition at line 168 of file platform_linux.h.

Referenced by WaitForSignal().

Here is the call graph for this function:

Here is the caller graph for this function:

int platform_spinlock_destroy ( platform_spinlock lock)
inline

Definition at line 151 of file platform_linux.h.

Referenced by Watchdog::~Watchdog().

Here is the caller graph for this function:

int platform_spinlock_init ( platform_spinlock lock,
int  pshared 
)
inline

Definition at line 147 of file platform_linux.h.

Referenced by Watchdog::Watchdog().

Here is the caller graph for this function:

int platform_spinlock_trylock ( platform_spinlock lock)
inline

Definition at line 155 of file platform_linux.h.

Referenced by Watchdog::SendTrace().

Here is the caller graph for this function:

void platform_spinlock_unlock ( platform_spinlock lock)
inline

Definition at line 159 of file platform_linux.h.

bool platform_umount ( const char *  mountpoint,
const bool  lazy 
)
inline

Definition at line 63 of file platform_linux.h.

Referenced by auto_umount::UmountOnCrash().

Here is the caller graph for this function:

bool platform_umount_lazy ( const char *  mountpoint)
inline

Definition at line 137 of file platform_linux.h.

Referenced by publish::CmdEnter::CleanupSession(), and anonymous_namespace{cmd_enter.cc}::RemoveUnderlay().

Here is the caller graph for this function: