Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
S
scom
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
scom
Commits
d9ac281e
Kaydet (Commit)
d9ac281e
authored
Eki 11, 2007
tarafından
Gökmen Göksel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
comments fix, remote profiles may store the ap macs ;)
üst
f5994f66
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
258 additions
and
257 deletions
+258
-257
model.xml
comar/etc/model.xml
+1
-0
acl.c
comar/src/acl.c
+27
-27
data.c
comar/src/data.c
+89
-89
job.c
comar/src/job.c
+12
-12
log.c
comar/src/log.c
+13
-13
model.c
comar/src/model.c
+42
-42
notify.c
comar/src/notify.c
+4
-4
process.c
comar/src/process.c
+18
-18
rpc_unix.c
comar/src/rpc_unix.c
+20
-20
utility.c
comar/src/utility.c
+32
-32
No files found.
comar/etc/model.xml
Dosyayı görüntüle @
d9ac281e
...
...
@@ -295,6 +295,7 @@
<method
name=
"setRemote"
profile=
"package"
>
<instance>
name
</instance>
<argument>
remote
</argument>
<argument>
apmac
</argument>
</method>
<method
name=
"setNameService"
profile=
"package"
>
<instance>
name
</instance>
...
...
comar/src/acl.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -122,11 +122,11 @@ add_group(iks *tag, int level, struct acl_class *ac)
static
void
add_groups
(
iks
*
tag
,
int
class_no
,
int
level
,
struct
acl_class
*
ac
)
{
·
/*!
·
Searches 'tag' in 'group' and 'class' tags, calls add_group function with found tags
·
level and acl_class is passed to add_group
·
\sa add_group
·
*/
/*!
Searches 'tag' in 'group' and 'class' tags, calls add_group function with found tags
level and acl_class is passed to add_group
\sa add_group
*/
iks
*
x
;
// global permissions
...
...
@@ -146,11 +146,11 @@ add_groups(iks *tag, int class_no, int level, struct acl_class *ac)
static
void
set_class
(
iks
*
model
,
int
class_no
)
{
·
/*!
·
Allocates memory for all found 'group's in 'model' @see count_groups()
·
Then add_groups is called and acl_class is put in node table
·
\sa add_groups
·
*/
/*!
Allocates memory for all found 'group's in 'model' @see count_groups()
Then add_groups is called and acl_class is put in node table
\sa add_groups
*/
struct
acl_class
*
ac
;
int
nr_groups
=
0
;
...
...
@@ -174,10 +174,10 @@ set_class(iks *model, int class_no)
void
acl_init
(
void
)
{
·
/*!
·
Loads /etc/comar/security-policy.xml file
·
For all classes in model.xml file, look in security-policy if theres a match
·
*/
/*!
Loads /etc/comar/security-policy.xml file
For all classes in model.xml file, look in security-policy if theres a match
*/
iks
*
policy
;
iks
*
model
;
...
...
@@ -211,10 +211,10 @@ acl_init(void)
static
int
check_acl
(
int
node
,
struct
Creds
*
cred
)
{
·
/*!
·
Checks if cred->uid user is capable to perform the action,
·
@return Returns 1 if capable, 0 otherwise
·
*/
/*!
Checks if cred->uid user is capable to perform the action,
@return Returns 1 if capable, 0 otherwise
*/
gid_t
gids
[
64
];
int
nr_gids
=
64
;
...
...
@@ -253,11 +253,11 @@ check_acl(int node, struct Creds *cred)
int
acl_is_capable
(
int
cmd
,
int
node
,
struct
Creds
*
cred
)
{
·
/*!
·
Checks if cred->uid user is capable executing command cmd.
·
Root is always capable, only CMD_CALL commands are allowed here
·
@return Returns 1 if allowed, 0 otherwise
·
*/
/*!
Checks if cred->uid user is capable executing command cmd.
Root is always capable, only CMD_CALL commands are allowed here
@return Returns 1 if allowed, 0 otherwise
*/
if
(
cred
->
uid
==
0
)
return
1
;
...
...
@@ -274,10 +274,10 @@ acl_is_capable(int cmd, int node, struct Creds *cred)
int
acl_can_connect
(
struct
Creds
*
cred
)
{
·
/*!
·
Checks if user with user id cred->uid can connect comar.
·
@return Returns 1 if can connect, 0 otherwise
·
*/
/*!
Checks if user with user id cred->uid can connect comar.
@return Returns 1 if can connect, 0 otherwise
*/
gid_t
gids
[
64
];
int
nr_gids
=
64
;
...
...
comar/src/data.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -28,10 +28,10 @@
static
int
check_db_format
(
void
)
{
·
/*!
·
Checks db format.
·
@return returns 0 if db is Model db or App db, 1 else
·
*/
/*!
Checks db format.
@return returns 0 if db is Model db or App db, 1 else
*/
FILE
*
f
;
size_t
len
;
...
...
@@ -70,13 +70,13 @@ static char *code_lock_name;
int
db_init
(
void
)
{
·
/*!
·
Checks comar db directory and db format, creates if not exists.
·
Also checks code/lock file
·
@return Returns 0 on success, \n Returns -1 on error, \n Returns -2 if db type is not app or model \n
·
Returns -3 if code/lock name is not set ( either theres something wrong with data dir,
·
or memory allocation error )
·
*/
/*!
Checks comar db directory and db format, creates if not exists.
Also checks code/lock file
@return Returns 0 on success, \n Returns -1 on error, \n Returns -2 if db type is not app or model \n
Returns -3 if code/lock name is not set ( either theres something wrong with data dir,
or memory allocation error )
*/
struct
stat
fs
;
size_t
size
;
...
...
@@ -126,15 +126,15 @@ struct databases {
static
int
open_database
(
DB_ENV
*
env
,
DB
**
dbp
,
const
char
*
name
)
{
·
/*!
·
Creates a DB structure that is the handle for a Berkeley DB database
·
and opens it as a standalone, sorted - balanced tree structured DB.
·
env is the environment, and dbp is db type ( model, app, code or profile )
·
with 'name' file name
·
@return Returns -1 if can not create database \n
·
Returns -2 if can not open database \n
·
Returns 0 otherwise \n
·
*/
/*!
Creates a DB structure that is the handle for a Berkeley DB database
and opens it as a standalone, sorted - balanced tree structured DB.
env is the environment, and dbp is db type ( model, app, code or profile )
with 'name' file name
@return Returns -1 if can not create database \n
Returns -2 if can not open database \n
Returns 0 otherwise \n
*/
int
e
;
DB
*
db
;
...
...
@@ -158,18 +158,18 @@ open_database(DB_ENV *env, DB **dbp, const char *name)
static
int
open_env
(
struct
databases
*
db
,
int
which
)
{
·
/*!
·
Creates DB_ENV structure with db_home directory set to
·
comar db dir. After creating enviroment, opens database
·
with created env and specified DB type (type is 'which' in this case)
·
@return Returns -1 if can not create database environment \n
·
Returns -2 if can not open database environment. \n
·
Returns -3 if which is a model db, and db could not be created or opened \n
·
Returns -4 if which is a app db, and db could not be created or opened \n
·
Returns -5 if which is a code db, and db could not be created or opened \n
·
Returns -6 if which is a profile db, and db could not be created or opened \n
·
Returns 0 otherwise
·
*/
/*!
Creates DB_ENV structure with db_home directory set to
comar db dir. After creating enviroment, opens database
with created env and specified DB type (type is 'which' in this case)
@return Returns -1 if can not create database environment \n
Returns -2 if can not open database environment. \n
Returns -3 if which is a model db, and db could not be created or opened \n
Returns -4 if which is a app db, and db could not be created or opened \n
Returns -5 if which is a code db, and db could not be created or opened \n
Returns -6 if which is a profile db, and db could not be created or opened \n
Returns 0 otherwise
*/
int
e
;
...
...
@@ -241,13 +241,13 @@ get_data(DB *db, const char *name, size_t *sizep, int *errorp)
static
int
put_data
(
DB
*
db
,
const
char
*
name
,
const
char
*
data
,
size_t
size
)
{
·
/*!
·
Puts "name and 'size of name'" as first pair, and
·
"data and size" as second pair to DB. \n
·
DBT is key/data pair structure of berkeley db
·
@return This function can return a non-zero error for errors specified for \n
·
other Berkeley DB and C library or system functions. or DB_RUNRECOVERY
·
*/
/*!
Puts "name and 'size of name'" as first pair, and
"data and size" as second pair to DB. \n
DBT is key/data pair structure of berkeley db
@return This function can return a non-zero error for errors specified for \n
other Berkeley DB and C library or system functions. or DB_RUNRECOVERY
*/
DBT
pair
[
2
];
...
...
@@ -276,11 +276,11 @@ del_data(DB *db, const char *name)
static
char
*
make_key
(
int
node_no
,
const
char
*
app
)
{
·
/*!
/*!
This function looks for node_no numbered record in node table
·
and makes a key formatted like: path/app
·
@return returns the key
·
*/
and makes a key formatted like: path/app
@return returns the key
*/
const
char
*
path
;
char
*
key
;
...
...
@@ -300,11 +300,11 @@ make_key(int node_no, const char *app)
static
int
append_item
(
DB
*
db
,
const
char
*
key
,
const
char
*
item
)
{
·
/*!
·
If theres no such record, put it in db
·
@return If item is already in db returns -1 \n
·
Returns 0 normally
·
*/
/*!
If theres no such record, put it in db
@return If item is already in db returns -1 \n
Returns 0 normally
*/
char
*
t
,
*
s
;
char
*
old
;
...
...
@@ -352,9 +352,9 @@ append_item(DB *db, const char *key, const char *item)
int
db_put_script
(
int
node_no
,
const
char
*
app
,
const
char
*
buffer
,
size_t
size
)
{
·
/**
·
@return -1 or -2 on error, 0 normally
·
*/
/**
@return -1 or -2 on error, 0 normally
*/
struct
databases
db
;
int
e
,
ret
=
-
1
;
...
...
@@ -380,10 +380,10 @@ out:
int
db_del_app
(
const
char
*
app
)
{
·
/*!
/*!
Delete app application from app, model and code databases
·
\sa db_delete_code del_data
·
*/
\sa db_delete_code del_data
*/
struct
databases
db
;
char
*
list
,
*
list2
,
*
t
,
*
s
;
...
...
@@ -445,9 +445,9 @@ int
db_get_apps
(
int
node_no
,
char
**
bufferp
)
{
/*!
·
Fetches data of node 'node_no' and writes it to bufferp
·
@return Returns -1 on error, 0 otherwise
·
*/
Fetches data of node 'node_no' and writes it to bufferp
@return Returns -1 on error, 0 otherwise
*/
struct
databases
db
;
int
e
,
ret
=
-
1
;
...
...
@@ -486,11 +486,11 @@ out:
static
char
*
make_code_key
(
int
node_no
,
const
char
*
app
)
{
·
/*!
·
Key path will be in format: cfg_data_dir/code/script.py
·
@return Returns the key, or 0 on allocation error
·
\sa cfg.c
·
*/
/*!
Key path will be in format: cfg_data_dir/code/script.py
@return Returns the key, or 0 on allocation error
\sa cfg.c
*/
const
char
*
path
;
char
*
key
;
...
...
@@ -516,11 +516,11 @@ make_code_key(int node_no, const char *app)
static
int
lock_code_db
(
int
is_exclusive
)
{
·
/*!
·
Locks the lock file for reading or writing
·
if is_exclusive is true, lock for writing, otherwise, lock for reading
·
@return Returns file descriptor to lock file, -1 on error
·
*/
/*!
Locks the lock file for reading or writing
if is_exclusive is true, lock for writing, otherwise, lock for reading
@return Returns file descriptor to lock file, -1 on error
*/
int
fd
;
...
...
@@ -550,12 +550,12 @@ unlock_code_db(int fd)
int
db_load_code
(
int
node_no
,
const
char
*
app
,
char
**
bufferp
)
{
·
/*!
·
Loads the code numbered 'node_no' in node table, and assigns bufferp to its address
·
@return Returns -1 on allocation error @see make_code_key \n
·
Returns -2 if can not load code @see load_code
·
\sa make_code_key load_file
·
*/
/*!
Loads the code numbered 'node_no' in node table, and assigns bufferp to its address
@return Returns -1 on allocation error @see make_code_key \n
Returns -2 if can not load code @see load_code
\sa make_code_key load_file
*/
char
*
key
;
char
*
code
;
...
...
@@ -577,11 +577,11 @@ db_load_code(int node_no, const char *app, char **bufferp)
int
db_save_code
(
int
node_no
,
const
char
*
app
,
const
char
*
buffer
)
{
·
/*!
·
@return Returns -1 on file path error \n
·
Returns -2 on write error \n
·
Returns 0 normally
·
*/
/*!
@return Returns -1 on file path error \n
Returns -2 on write error \n
Returns 0 normally
*/
char
*
key
;
int
fd
;
...
...
@@ -601,12 +601,12 @@ db_save_code(int node_no, const char *app, const char *buffer)
int
db_delete_code
(
int
node_no
,
const
char
*
app
)
{
·
/*!
/*!
Deletes code numbered 'node_no' in node table from filesystem·
·
@return Returns -1 on allocation error @see make_code_key \n
·
Returns -2 on error unlinking file
·
Returns 0 otherwise
·
*/
@return Returns -1 on allocation error @see make_code_key \n
Returns -2 on error unlinking file
Returns 0 otherwise
*/
char
*
key
;
int
fd
;
...
...
@@ -723,12 +723,12 @@ struct databases *blaa = NULL;
struct
pack
*
db_get_profile
(
int
node_no
,
const
char
*
app
,
const
char
*
inst_key
,
const
char
*
inst_value
)
{
·
/*!
·
From node_no, app, inst_key and inst_value, this function first makes a profile key
·
with format node/app/instance=value. Then gets this key from profile db
·
and returns a pointer to a package structure carrying its data and size
·
@return Returns a pointer to data pack
·
*/
/*!
From node_no, app, inst_key and inst_value, this function first makes a profile key
with format node/app/instance=value. Then gets this key from profile db
and returns a pointer to a package structure carrying its data and size
@return Returns a pointer to data pack
*/
struct
databases
db
;
struct
pack
*
p
=
NULL
;
...
...
comar/src/job.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -59,9 +59,9 @@ job_send_result(int cmd, const char *data, size_t size)
static
int
do_register
(
int
node
,
const
char
*
app
,
const
char
*
fname
)
{
·
/*!
/*!
Register script by first testing it by compiling.
·
If it compiles well, put script. \sa db_put_script csl_compile
If it compiles well, put script. \sa db_put_script csl_compile
*/
char
*
buf
;
...
...
@@ -150,12 +150,12 @@ do_event(const char *event, int node, const char *app, struct pack *p)
static
int
do_execute
(
int
node
,
const
char
*
app
,
struct
pack
*
pak
)
{
·
/*!
/*!
Load the app code and execute it with python/c api @see csl.c
·
If execution lasts more than 6 seconds, logs this information @see log_info
·
Returns 0 on a successfull call, returns error returned by csl execute function otherwise
·
\sa csl.c
·
*/
If execution lasts more than 6 seconds, logs this information @see log_info
Returns 0 on a successfull call, returns error returned by csl execute function otherwise
\sa csl.c
*/
struct
timeval
start
,
end
;
unsigned
long
msec
;
...
...
@@ -234,9 +234,9 @@ exec_proc(void)
static
int
do_call
(
int
node
,
struct
pack
*
pak
)
{
·
/*!
/*!
Get scripts and run them, send results and return
·
@return Returns 0
@return Returns 0
*/
struct
pack
*
p
=
NULL
;
...
...
@@ -362,9 +362,9 @@ do_dump_profile(void)
static
void
job_proc
(
void
)
{
·
/*!
·
Listen for incoming requests and process the commands.
·
*/
/*!
Listen for incoming requests and process the commands.
*/
struct
ipc_struct
ipc
;
struct
pack
*
p
;
...
...
comar/src/log.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -47,11 +47,11 @@ pidstamp(FILE *f)
static
void
log_print
(
const
char
*
fmt
,
va_list
ap
,
int
error
)
{
·
/*!
/*!
Writes log to file (cfg_log_file_name) or stdout according to cfg_log_* options
·
comar version, process id, timestamp and errors(if any) are written
·
\sa cfg.c
·
*/
comar version, process id, timestamp and errors(if any) are written
\sa cfg.c
*/
if
(
cfg_log_console
)
{
pidstamp
(
stdout
);
...
...
@@ -89,10 +89,10 @@ log_start(void)
void
log_error
(
const
char
*
fmt
,
...)
{
·
/*!
·
Same as log_info, if this function is called instead, writes
·
information as an 'error' to log file
·
*/
/*!
Same as log_info, if this function is called instead, writes
information as an 'error' to log file
*/
va_list
ap
;
...
...
@@ -105,11 +105,11 @@ log_error(const char *fmt, ...)
void
log_info
(
const
char
*
fmt
,
...)
{
·
/*!
·
Prints log info of variable arguments with log_print function.
·
Console or file usage depends on cfg_log_* options
·
\sa log_print cfg.c
·
*/
/*!
Prints log info of variable arguments with log_print function.
Console or file usage depends on cfg_log_* options
\sa log_print cfg.c
*/
va_list
ap
;
...
...
comar/src/model.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -64,10 +64,10 @@ hash_string(const unsigned char *str, int len)
static
int
prepare_tables
(
int
max_nodes
,
size_t
str_size
)
{
·
/*!
·
@return Returns 0 if successfully allocates memory for nodes, node table and paths,
·
-1 otherwise
·
*/
/*!
@return Returns 0 if successfully allocates memory for nodes, node table and paths,
-1 otherwise
*/
nodes
=
calloc
(
max_nodes
,
sizeof
(
struct
node
));
node_table
=
calloc
(
TABLE_SIZE
,
sizeof
(
struct
node
*
));
...
...
@@ -80,10 +80,10 @@ prepare_tables(int max_nodes, size_t str_size)
static
int
add_node
(
int
parent_no
,
const
char
*
path
,
int
type
)
{
·
/*!
·
parent_no is depth of node. adds node with path and type (method)
·
to node table
·
*/
/*!
parent_no is depth of node. adds node with path and type (method)
to node table
*/
struct
node
*
n
;
int
val
;
...
...
@@ -115,11 +115,11 @@ static char *path_ptr = NULL;
static
char
*
build_path
(
iks
*
g
,
iks
*
o
,
iks
*
m
)
{
·
/*!
·
Returns the 'name' attr of 'g' iks node (group)
·
if 'm' is given, returns it as group.object.method (names)
·
if 'o' is given, returns group.object (names)
·
*/
/*!
Returns the 'name' attr of 'g' iks node (group)
if 'm' is given, returns it as group.object.method (names)
if 'o' is given, returns group.object (names)
*/
if
(
path_ptr
)
{
path_ptr
+=
strlen
(
path_ptr
)
+
1
;
...
...
@@ -170,12 +170,12 @@ build_arg(int no, int is_instance, const char *name)
int
model_init
(
void
)
{
·
/*!
·
This function parses model.xml file (cfg_model_file)
·
Converts model.xml's access levels and flags to ACL levels and
·
flags, and loads into memory before deleting dom tree
·
\sa cfg.c
·
*/
/*!
This function parses model.xml file (cfg_model_file)
Converts model.xml's access levels and flags to ACL levels and
flags, and loads into memory before deleting dom tree
\sa cfg.c
*/
iks
*
model
;
iks
*
grp
,
*
obj
,
*
met
;
...
...
@@ -335,10 +335,10 @@ model_lookup_class(const char *path)
int
model_lookup_method
(
const
char
*
path
)
{
·
/*!
/*!
Lookup a method in node table.
·
@return If found, returns its number in table, returns -1 otherwise·
·
*/
@return If found, returns its number in table, returns -1 otherwise·
*/
struct
node
*
n
;
int
val
;
...
...
@@ -356,10 +356,10 @@ model_lookup_method(const char *path)
int
model_lookup_notify
(
const
char
*
path
)
{
·
/*!
·
If specified path's record in node table has a type of 'notify'
·
returns its number in table, returns -1 otherwise
·
*/
/*!
If specified path's record in node table has a type of 'notify'
returns its number in table, returns -1 otherwise
*/
struct
node
*
n
;
int
val
;
...
...
@@ -377,10 +377,10 @@ model_lookup_notify(const char *path)
int
model_parent
(
int
node_no
)
{
·
/*!
/*!
if node_no numbered record in node table is a method, returns its parent number
·
else returns node_no
·
*/
else returns node_no
*/
struct
node
*
n
;
...
...
@@ -414,9 +414,9 @@ model_get_path(int node_no)
int
model_has_argument
(
int
node_no
,
const
char
*
argname
)
{
·
/*!
·
@return Returns 1 if argname is found in node table, 0 otherwise
·
*/
/*!
@return Returns 1 if argname is found in node table, 0 otherwise
*/
struct
node
*
n
;
int
max
,
i
;
...
...
@@ -491,11 +491,11 @@ model_acl_set(int node_no, void *acldata)
void
model_acl_get
(
int
node_no
,
void
**
acldatap
,
unsigned
int
*
levelp
)
{
·
/*!
·
This function gets 'acldata' and 'level' from node table, from record numbered 'node_no'
·
\param acldatap is pointer to acldata
·
\param levelp is pointer to level
·
*/
/*!
This function gets 'acldata' and 'level' from node table, from record numbered 'node_no'
\param acldatap is pointer to acldata
\param levelp is pointer to level
*/
struct
node
*
n
;
...
...
@@ -513,11 +513,11 @@ model_acl_get(int node_no, void **acldatap, unsigned int *levelp)
int
model_next_class
(
int
*
class_nop
)
{
·
/*!
·
Scans node table for class tags
·
@return If found, returns 1 and sets the node number to given argument (class_nop) \n
·
Returns 0 if no classes found
·
*/
/*!
Scans node table for class tags
@return If found, returns 1 and sets the node number to given argument (class_nop) \n
Returns 0 if no classes found
*/
int
no
;
struct
node
*
n
;
...
...
comar/src/notify.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -20,10 +20,10 @@
void
*
notify_alloc
(
void
)
{
·
/*!
·
Allocates memory for notifies and returns pointer to allocated memory
·
Returns Null on error.
·
*/
/*!
Allocates memory for notifies and returns pointer to allocated memory
Returns Null on error.
*/
int
size
;
...
...
comar/src/process.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -100,10 +100,10 @@ proc_get_rpc(void)
static
struct
ProcChild
*
add_child
(
pid_t
pid
,
int
to
,
int
from
,
const
char
*
desc
)
{
·
/*!
·
Adds a child process with given arguments to process
·
@return Returns added child process
·
*/
/*!
Adds a child process with given arguments to process
@return Returns added child process
*/
int
i
;
...
...
@@ -148,10 +148,10 @@ rem_child(int nr)
static
void
stop_children
(
void
)
{
·
/*!
·
Send SIGTERM to all child processes, wait for 3 seconds
·
if they resist, kill'em all
·
*/
/*!
Send SIGTERM to all child processes, wait for 3 seconds
if they resist, kill'em all
*/
struct
timeval
start
;
struct
timeval
cur
;
...
...
@@ -229,11 +229,11 @@ proc_finish(void)
struct
ProcChild
*
proc_fork
(
void
(
*
child_func
)(
void
),
const
char
*
desc
)
{
·
/*!
·
Child process fork function, child process continues from child_func
·
\param desc is description, process name
·
@return Returns Null on error
·
*/
/*!
Child process fork function, child process continues from child_func
\param desc is description, process name
@return Returns Null on error
*/
pid_t
pid
;
int
fdr
[
2
],
fdw
[
2
];
...
...
@@ -310,11 +310,11 @@ proc_setup_fds(fd_set *fds)
int
proc_select_fds
(
fd_set
*
fds
,
int
max
,
struct
ProcChild
**
senderp
,
int
*
cmdp
,
size_t
*
sizep
,
int
timeout
)
{
·
/*!
·
Listen incoming requests with 'select()'
·
Sets command, data size and returns 1 if there's something to listen
·
Returns 0 otherwise
·
*/
/*!
Listen incoming requests with 'select()'
Sets command, data size and returns 1 if there's something to listen
Returns 0 otherwise
*/
unsigned
int
ipc
;
struct
timeval
tv
,
*
tvptr
;
...
...
comar/src/rpc_unix.c
Dosyayı görüntüle @
d9ac281e
...
...
@@ -104,11 +104,11 @@ get_size(const unsigned char *buf)
static
int
create_pipe
(
const
char
*
pipe_name
)
{
·
/*!
·
Creates a pipe, with listen. length of the queue is 5
·
@return Returns -2 if can't assign address to socket \n
·
Returns -3 if can't listen requests
·
*/
/*!
Creates a pipe, with listen. length of the queue is 5
@return Returns -2 if can't assign address to socket \n
Returns -3 if can't listen requests
*/
struct
sockaddr_un
name
;
size_t
size
;
...
...
@@ -143,10 +143,10 @@ create_pipe(const char *pipe_name)
static
int
get_peer
(
int
sock
,
struct
Creds
*
cred
)
{
·
/*!
·
Gets options of sock, and fills cred according to these options
·
@return Returns 0. Returns -1 on error.
·
*/
/*!
Gets options of sock, and fills cred according to these options
@return Returns 0. Returns -1 on error.
*/
// NOTE: this implementation requires a linux kernel
struct
{
pid_t
pid
;
...
...
@@ -256,9 +256,9 @@ get_arg(struct arg_s *args, char **argp, size_t *sizep)
static
int
write_rpc
(
struct
connection
*
c
,
unsigned
int
cmd
,
int
id
,
const
char
*
buffer
,
size_t
size
)
{
·
/*!
·
Checks the command cmd, and sends c's socket the answer
·
*/
/*!