CernVM-FS  2.10.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 "util/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)
 
ssize_t platform_readahead (int filedes)
 
int platform_invalidate_kcache (const int fd, const off_t offset, const off_t length)
 
std::string platform_libname (const std::string &base_name)
 
std::string platform_getexepath ()
 
struct timespec platform_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 ()
 

Macro Definition Documentation

#define MNT_DETACH   0x00000002

Definition at line 56 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 41 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 201 of file platform_linux.h.

typedef pthread_spinlock_t platform_spinlock

Spinlocks are not necessarily part of pthread on all platforms.

Definition at line 142 of file platform_linux.h.

typedef struct stat64 platform_stat64

Definition at line 207 of file platform_linux.h.

Function Documentation

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 182 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 270 of file platform_linux.h.

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

Here is the caller graph for this function:

std::string platform_getexepath ( )
inline

Definition at line 310 of file platform_linux.h.

pthread_t platform_gettid ( )
inline

pthread_self() is not necessarily an unsigned long.

Definition at line 163 of file platform_linux.h.

Referenced by anonymous_namespace{crypto_util.cc}::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 off_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 301 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 261 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 306 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 266 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 254 of file platform_linux.h.

Referenced by PosixSetMeta().

Here is the caller graph for this function:

uint64_t platform_memsize ( )
inline

Definition at line 348 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 336 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 43 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:

ssize_t platform_readahead ( int  filedes)
inline

Definition at line 274 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 342 of file platform_linux.h.

Referenced by RepositoryTag::SetGenericName().

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 247 of file platform_linux.h.

int platform_sigwait ( const int  signum)
inline

Definition at line 165 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 148 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 144 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 152 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 156 of file platform_linux.h.

struct timespec platform_time_with_clock ( int  clock)

Definition at line 320 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_umount ( const char *  mountpoint,
const bool  lazy 
)
inline

Definition at line 58 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 134 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: