$search

lposix.c File Reference

#include <sys/stat.h>
#include <sys/times.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <glob.h>
#include <grp.h>
#include <libgen.h>
#include <limits.h>
#include <poll.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include "modemuncher.c"
Include dependency graph for lposix.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mytimes

Defines

#define doselection(L, i, S, F, d)   (doselection)(L,i,sizeof(S)/sizeof(*S)-1,S,F,d)
#define ENABLE_SYSLOG   1
#define lua_createtable(L, a, r)   lua_newtable(L)
#define LUA_FILEHANDLE   "FILE*"
#define lua_getfield(l, i, k)
#define lua_pushinteger   lua_pushnumber
#define lua_setfield(l, i, k)
#define MYNAME   "posix"
#define MYVERSION   MYNAME " library for " LUA_VERSION " / " VERSION
#define pushtime(L, x)   lua_pushnumber(L, ((lua_Number)x)/clk_tck)
#define set_const(key, value)

Typedefs

typedef void(* Selector )(lua_State *L, int i, const void *data)

Functions

static int aux_files (lua_State *L)
static void badoption (lua_State *L, int i, const char *what, int option)
char * crypt (const char *, const char *)
static int dir_gc (lua_State *L)
static int doselection (lua_State *L, int i, int n, const char *const S[], Selector F, const void *data)
static void FgetID (lua_State *L, int i, const void *data)
static void Fgetpasswd (lua_State *L, int i, const void *data)
static const char * filemode (int fd)
static const char * filetype (mode_t m)
static void Fpathconf (lua_State *L, int i, const void *data)
static void Fstat (lua_State *L, int i, const void *data)
static void Fsysconf (lua_State *L, int i, const void *data)
static void Ftimes (lua_State *L, int i, const void *data)
static int get_clk_id_const (const char *str)
static int get_rlimit_const (const char *str)
static int luaL_checkoption (lua_State *L, int narg, const char *def, const char *const lst[])
LUALIB_API int luaopen_posix (lua_State *L)
static int myfclose (lua_State *L)
static gid_t mygetgid (lua_State *L, int i)
static uid_t mygetuid (lua_State *L, int i)
static int Paccess (lua_State *L)
static int Pbasename (lua_State *L)
static int Pchdir (lua_State *L)
static int Pchmod (lua_State *L)
static int Pchown (lua_State *L)
static int Pclock_getres (lua_State *L)
static int Pclock_gettime (lua_State *L)
static int Pcloselog (lua_State *L)
static int Pcrypt (lua_State *L)
static int Pctermid (lua_State *L)
static int Pdir (lua_State *L)
static int Pdirname (lua_State *L)
static int Pdup (lua_State *L)
static int Perrno (lua_State *L)
static int Pexec (lua_State *L)
static int Pexecp (lua_State *L)
static int Pfdopen (lua_State *L)
static int Pfileno (lua_State *L)
static int Pfiles (lua_State *L)
static int Pfork (lua_State *L)
static int Pgetcwd (lua_State *L)
static int Pgetenv (lua_State *L)
static int Pgetgroup (lua_State *L)
static int Pgetlogin (lua_State *L)
static int Pgetpasswd (lua_State *L)
static int Pgetpid (lua_State *L)
static int Pgetrlimit (lua_State *L)
static int Pgettimeofday (lua_State *L)
static int Pglob (lua_State *L)
static int Pgmtime (lua_State *L)
static int Phostid (lua_State *L)
static int Pkill (lua_State *L)
static int Plink (lua_State *L)
static int Plocaltime (lua_State *L)
static int Pmkdir (lua_State *L)
static int Pmkfifo (lua_State *L)
static int Popenlog (lua_State *L)
static int Ppathconf (lua_State *L)
static int Ppipe (lua_State *L)
static int Ppoll (lua_State *L)
static int Preadlink (lua_State *L)
static int Prmdir (lua_State *L)
static int Psetenv (lua_State *L)
static int Psetlogmask (lua_State *L)
static int Psetpid (lua_State *L)
static int Psetrlimit (lua_State *L)
static int Psleep (lua_State *L)
static int Pstat (lua_State *L)
static int Pstrftime (lua_State *L)
static int Psysconf (lua_State *L)
static int Psyslog (lua_State *L)
static int Ptime (lua_State *L)
static int Ptimes (lua_State *L)
static int Pttyname (lua_State *L)
static int Pumask (lua_State *L)
static int Puname (lua_State *L)
static int Punlink (lua_State *L)
static int pusherror (lua_State *L, const char *info)
static int pushfile (lua_State *L, int id, const char *mode)
static void pushmode (lua_State *L, mode_t mode)
static int pushresult (lua_State *L, int i, const char *info)
static int Putime (lua_State *L)
static int Pwait (lua_State *L)
static int runexec (lua_State *L, int use_shell)

Variables

static const int Kpathconf []
static const int Krlimit []
static const int Ksysconf []
struct {
   mode_t   b
   char   c
M []
static const luaL_reg R []
static const char *const SgetID []
static const char *const Sgetpasswd []
static const char *const Spathconf []
static const char *const Srlimit []
static const char *const Sstat []
static const char *const Ssysconf []
static const char *const Stimes []

Define Documentation

#define doselection ( L,
i,
S,
F,
 )     (doselection)(L,i,sizeof(S)/sizeof(*S)-1,S,F,d)

Definition at line 123 of file lposix.c.

#define ENABLE_SYSLOG   1

Definition at line 45 of file lposix.c.

#define lua_createtable ( L,
a,
 )     lua_newtable(L)

Definition at line 66 of file lposix.c.

#define LUA_FILEHANDLE   "FILE*"

Definition at line 67 of file lposix.c.

#define lua_getfield ( l,
i,
 ) 

Definition at line 70 of file lposix.c.

#define lua_pushinteger   lua_pushnumber

Definition at line 65 of file lposix.c.

#define lua_setfield ( l,
i,
 ) 

Definition at line 69 of file lposix.c.

#define MYNAME   "posix"

Definition at line 41 of file lposix.c.

#define MYVERSION   MYNAME " library for " LUA_VERSION " / " VERSION

Definition at line 42 of file lposix.c.

#define pushtime ( L,
 )     lua_pushnumber(L, ((lua_Number)x)/clk_tck)

Definition at line 822 of file lposix.c.

#define set_const ( key,
value   ) 
Value:
lua_pushliteral(L, key);        \
        lua_pushnumber(L, value);       \
        lua_settable(L, -3)

Definition at line 1360 of file lposix.c.


Typedef Documentation

typedef void(* Selector)(lua_State *L, int i, const void *data)

Definition at line 92 of file lposix.c.


Function Documentation

static int aux_files ( lua_State *  L  )  [static]

Definition at line 253 of file lposix.c.

static void badoption ( lua_State *  L,
int  i,
const char *  what,
int  option 
) [static]

Definition at line 143 of file lposix.c.

char* crypt ( const char *  ,
const char *   
)
static int dir_gc ( lua_State *  L  )  [static]

Definition at line 273 of file lposix.c.

static int doselection ( lua_State *  L,
int  i,
int  n,
const char *const   S[],
Selector  F,
const void *  data 
) [static]

Definition at line 94 of file lposix.c.

static void FgetID ( lua_State *  L,
int  i,
const void *  data 
) [static]

Definition at line 686 of file lposix.c.

static void Fgetpasswd ( lua_State *  L,
int  i,
const void *  data 
) [static]

Definition at line 743 of file lposix.c.

static const char* filemode ( int  fd  )  [static]

Definition at line 426 of file lposix.c.

static const char* filetype ( mode_t  m  )  [static]

Definition at line 853 of file lposix.c.

static void Fpathconf ( lua_State *  L,
int  i,
const void *  data 
) [static]

Definition at line 932 of file lposix.c.

static void Fstat ( lua_State *  L,
int  i,
const void *  data 
) [static]

Definition at line 865 of file lposix.c.

static void Fsysconf ( lua_State *  L,
int  i,
const void *  data 
) [static]

Definition at line 959 of file lposix.c.

static void Ftimes ( lua_State *  L,
int  i,
const void *  data 
) [static]

Definition at line 824 of file lposix.c.

static int get_clk_id_const ( const char *  str  )  [static]

Definition at line 1211 of file lposix.c.

static int get_rlimit_const ( const char *  str  )  [static]

Definition at line 1082 of file lposix.c.

static int luaL_checkoption ( lua_State *  L,
int  narg,
const char *  def,
const char *const   lst[] 
) [static]

Definition at line 56 of file lposix.c.

LUALIB_API int luaopen_posix ( lua_State *  L  ) 

version

Definition at line 1365 of file lposix.c.

static int myfclose ( lua_State *  L  )  [static]

Definition at line 372 of file lposix.c.

static gid_t mygetgid ( lua_State *  L,
int  i 
) [static]

Definition at line 164 of file lposix.c.

static uid_t mygetuid ( lua_State *  L,
int  i 
) [static]

Definition at line 149 of file lposix.c.

static int Paccess ( lua_State *  L  )  [static]

access(path,[mode])

Definition at line 353 of file lposix.c.

static int Pbasename ( lua_State *  L  )  [static]

basename(path)

Definition at line 189 of file lposix.c.

static int Pchdir ( lua_State *  L  )  [static]

chdir(path)

Definition at line 314 of file lposix.c.

static int Pchmod ( lua_State *  L  )  [static]

chmod(path,mode)

Definition at line 653 of file lposix.c.

static int Pchown ( lua_State *  L  )  [static]

chown(path,uid,gid)

Definition at line 666 of file lposix.c.

static int Pclock_getres ( lua_State *  L  )  [static]

Definition at line 1225 of file lposix.c.

static int Pclock_gettime ( lua_State *  L  )  [static]

Definition at line 1236 of file lposix.c.

static int Pcloselog ( lua_State *  L  )  [static]

closelog()

Definition at line 1009 of file lposix.c.

static int Pcrypt ( lua_State *  L  )  [static]

crypt(string,salt)

Definition at line 1036 of file lposix.c.

static int Pctermid ( lua_State *  L  )  [static]

ctermid()

Definition at line 728 of file lposix.c.

static int Pdir ( lua_State *  L  )  [static]

dir([path])

Definition at line 211 of file lposix.c.

static int Pdirname ( lua_State *  L  )  [static]

dirname(path)

Definition at line 200 of file lposix.c.

static int Pdup ( lua_State *  L  )  [static]

dup(old,[new])

Definition at line 440 of file lposix.c.

static int Perrno ( lua_State *  L  )  [static]

errno([n])

Definition at line 180 of file lposix.c.

static int Pexec ( lua_State *  L  )  [static]

exec(path,[args])

Definition at line 485 of file lposix.c.

static int Pexecp ( lua_State *  L  )  [static]

execp(path,[args])

Definition at line 491 of file lposix.c.

static int Pfdopen ( lua_State *  L  )  [static]

fdopen(fd, mode)

Definition at line 415 of file lposix.c.

static int Pfileno ( lua_State *  L  )  [static]

fileno(filehandle)

Definition at line 408 of file lposix.c.

static int Pfiles ( lua_State *  L  )  [static]

files([path])

Definition at line 280 of file lposix.c.

static int Pfork ( lua_State *  L  )  [static]

fork()

Definition at line 497 of file lposix.c.

static int Pgetcwd ( lua_State *  L  )  [static]

getcwd()

Definition at line 298 of file lposix.c.

static int Pgetenv ( lua_State *  L  )  [static]

getenv([name])

Definition at line 602 of file lposix.c.

static int Pgetgroup ( lua_State *  L  )  [static]

getgroup(name|id)

Definition at line 784 of file lposix.c.

static int Pgetlogin ( lua_State *  L  )  [static]

getlogin()

Definition at line 736 of file lposix.c.

static int Pgetpasswd ( lua_State *  L  )  [static]

getpasswd(name|id,[sel])

Definition at line 765 of file lposix.c.

static int Pgetpid ( lua_State *  L  )  [static]

getpid([options])

Definition at line 705 of file lposix.c.

static int Pgetrlimit ( lua_State *  L  )  [static]

getrlimit(resource)

Definition at line 1118 of file lposix.c.

static int Pgettimeofday ( lua_State *  L  )  [static]

Definition at line 1132 of file lposix.c.

static int Pglob ( lua_State *  L  )  [static]

glob(pattern)

Definition at line 233 of file lposix.c.

static int Pgmtime ( lua_State *  L  )  [static]

Definition at line 1183 of file lposix.c.

static int Phostid ( lua_State *  L  )  [static]

hostid()

Definition at line 711 of file lposix.c.

static int Pkill ( lua_State *  L  )  [static]

kill(pid,[sig])

Definition at line 542 of file lposix.c.

static int Plink ( lua_State *  L  )  [static]

link(old,new,[symbolic])

Definition at line 333 of file lposix.c.

static int Plocaltime ( lua_State *  L  )  [static]

Definition at line 1154 of file lposix.c.

static int Pmkdir ( lua_State *  L  )  [static]

mkdir(path)

Definition at line 307 of file lposix.c.

static int Pmkfifo ( lua_State *  L  )  [static]

mkfifo(path)

Definition at line 461 of file lposix.c.

static int Popenlog ( lua_State *  L  )  [static]

openlog(ident, [option], [facility])

Definition at line 978 of file lposix.c.

static int Ppathconf ( lua_State *  L  )  [static]

pathconf([path,options])

Definition at line 945 of file lposix.c.

static int Ppipe ( lua_State *  L  )  [static]

pipe()

Definition at line 398 of file lposix.c.

static int Ppoll ( lua_State *  L  )  [static]

poll(filehandle, timeout)

Definition at line 503 of file lposix.c.

static int Preadlink ( lua_State *  L  )  [static]

readlink(path)

Definition at line 342 of file lposix.c.

static int Prmdir ( lua_State *  L  )  [static]

rmdir(path)

Definition at line 320 of file lposix.c.

static int Psetenv ( lua_State *  L  )  [static]

setenv(name,value,[over])

Definition at line 585 of file lposix.c.

static int Psetlogmask ( lua_State *  L  )  [static]

setlogmask(priority...)

Definition at line 1015 of file lposix.c.

static int Psetpid ( lua_State *  L  )  [static]

setpid(option,...)

Definition at line 549 of file lposix.c.

static int Psetrlimit ( lua_State *  L  )  [static]

setrlimit(resource,soft[,hard])

Definition at line 1091 of file lposix.c.

static int Psleep ( lua_State *  L  )  [static]

sleep(seconds)

Definition at line 577 of file lposix.c.

static int Pstat ( lua_State *  L  )  [static]

stat(path,[options])

Definition at line 891 of file lposix.c.

static int Pstrftime ( lua_State *  L  )  [static]

Definition at line 1247 of file lposix.c.

static int Psysconf ( lua_State *  L  )  [static]

sysconf([options])

Definition at line 971 of file lposix.c.

static int Psyslog ( lua_State *  L  )  [static]

syslog(priority, message)

Definition at line 1000 of file lposix.c.

static int Ptime ( lua_State *  L  )  [static]

Definition at line 1145 of file lposix.c.

static int Ptimes ( lua_State *  L  )  [static]

times([options])

Definition at line 845 of file lposix.c.

static int Pttyname ( lua_State *  L  )  [static]

ttyname([fd])

Definition at line 720 of file lposix.c.

static int Pumask ( lua_State *  L  )  [static]

umask([mode])

Definition at line 631 of file lposix.c.

static int Puname ( lua_State *  L  )  [static]

uname([string])

Definition at line 900 of file lposix.c.

static int Punlink ( lua_State *  L  )  [static]

unlink(path)

Definition at line 327 of file lposix.c.

static int pusherror ( lua_State *  L,
const char *  info 
) [static]

Definition at line 125 of file lposix.c.

static int pushfile ( lua_State *  L,
int  id,
const char *  mode 
) [static]

Definition at line 379 of file lposix.c.

static void pushmode ( lua_State *  L,
mode_t  mode 
) [static]

Definition at line 82 of file lposix.c.

static int pushresult ( lua_State *  L,
int  i,
const char *  info 
) [static]

Definition at line 136 of file lposix.c.

static int Putime ( lua_State *  L  )  [static]

utime(path,[mtime,atime])

Definition at line 675 of file lposix.c.

static int Pwait ( lua_State *  L  )  [static]

wait([pid])

Definition at line 513 of file lposix.c.

static int runexec ( lua_State *  L,
int  use_shell 
) [static]

Definition at line 468 of file lposix.c.


Variable Documentation

mode_t b

Definition at line 74 of file lposix.c.

char c

Definition at line 74 of file lposix.c.

const int Kpathconf[] [static]
Initial value:
{
        _PC_LINK_MAX, _PC_MAX_CANON, _PC_MAX_INPUT, _PC_NAME_MAX, _PC_PATH_MAX,
        _PC_PIPE_BUF, _PC_CHOWN_RESTRICTED, _PC_NO_TRUNC, _PC_VDISABLE,
        -1
}

Definition at line 925 of file lposix.c.

const int Krlimit[] [static]
Initial value:
{
        RLIMIT_CORE, RLIMIT_CPU, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_MEMLOCK,
        RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_RSS, RLIMIT_STACK,
        -1
}

Definition at line 1068 of file lposix.c.

const int Ksysconf[] [static]
Initial value:
{
        _SC_ARG_MAX, _SC_CHILD_MAX, _SC_CLK_TCK, _SC_NGROUPS_MAX, _SC_STREAM_MAX,
        _SC_TZNAME_MAX, _SC_OPEN_MAX, _SC_JOB_CONTROL, _SC_SAVED_IDS, _SC_VERSION,
        -1
}

Definition at line 952 of file lposix.c.

struct { ... } M[] [static]
const luaL_reg R[] [static]

Definition at line 1292 of file lposix.c.

const char* const SgetID[] [static]
Initial value:
{
        "egid", "euid", "gid", "uid", "pgrp", "pid", "ppid", NULL
}

Definition at line 700 of file lposix.c.

const char* const Sgetpasswd[] [static]
Initial value:
{
        "name", "uid", "gid", "dir", "shell", "gecos", "passwd", NULL
}

Definition at line 759 of file lposix.c.

const char* const Spathconf[] [static]
Initial value:
{
        "link_max", "max_canon", "max_input", "name_max", "path_max",
        "pipe_buf", "chown_restricted", "no_trunc", "vdisable",
        NULL
}

Definition at line 938 of file lposix.c.

const char* const Srlimit[] [static]
Initial value:
{
        "core", "cpu", "data", "fsize", "memlock",
        "nofile", "nproc", "rss", "stack",
        NULL
}

Definition at line 1075 of file lposix.c.

const char* const Sstat[] [static]
Initial value:
{
        "mode", "ino", "dev", "nlink", "uid", "gid",
        "size", "atime", "mtime", "ctime", "type",
        NULL
}

Definition at line 884 of file lposix.c.

const char* const Ssysconf[] [static]
Initial value:
{
        "arg_max", "child_max", "clk_tck", "ngroups_max", "stream_max",
        "tzname_max", "open_max", "job_control", "saved_ids", "version",
        NULL
}

Definition at line 964 of file lposix.c.

const char* const Stimes[] [static]
Initial value:
{
        "utime", "stime", "cutime", "cstime", "elapsed", NULL
}

Definition at line 840 of file lposix.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


roslua
Author(s): Tim Niemueller
autogenerated on Tue Mar 5 12:26:19 2013