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
ac2fffa6
Kaydet (Commit)
ac2fffa6
authored
Eyl 28, 2005
tarafından
Gürer Özen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
dökümante et, register/remove/list çalışsın, binding güncelle
üst
5487fe1f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
4 deletions
+49
-4
comar.py
comard/bindings/comar.py
+18
-2
libcomar.c
comard/bindings/libcomar.c
+26
-1
libcomar.h
comard/bindings/libcomar.h
+1
-0
job.c
comard/src/job.c
+4
-1
No files found.
comard/bindings/comar.py
Dosyayı görüntüle @
ac2fffa6
...
...
@@ -65,11 +65,23 @@ class Link:
If there isn't any data waiting at connection, this function
immediately returns None. If there is data, returned value
is a tuple of three
items: (command, id, data
)
is a tuple of three
or four items: (command, id, data, package
)
Command is a reply code defined at the start of this class.
ID is the original id value from the request sent to the comard.
Data is the return value in string format.
Last item package is only available in RESULT replies and indicates
which package's script that the reply came from.
Reply code meanings:
RESULT: Operation successful.
FAIL: Called script had a problem while trying to perform operation.
DENIED: You aren't allowed to do that operation.
ERROR: Comar had a problem while trying to perform operation.
RESULT_START: Class is implemented by multiple scripts, and their
result will follow.
RESULT_END: All of the class' scripts run.
NOTIFY: You got a notification event.
"""
fds
=
select
.
select
([
self
.
sock
],
[],
[],
0
)
...
...
@@ -89,7 +101,11 @@ class Link:
raise
Error
(
'Connection closed'
)
else
:
data
=
None
return
(
cmd
,
head
[
1
],
data
)
if
cmd
==
self
.
RESULT
:
t
=
data
.
split
(
' '
,
1
)
return
(
cmd
,
head
[
1
],
t
[
0
],
t
[
1
])
else
:
return
(
cmd
,
head
[
1
],
data
)
def
read_cmd
(
self
):
"""Read a reply from comard.
...
...
comard/bindings/libcomar.c
Dosyayı görüntüle @
ac2fffa6
...
...
@@ -51,6 +51,7 @@ struct comar_struct {
unsigned
char
*
buffer
;
size_t
max
;
size_t
size
;
char
*
pakname
;
};
comar_t
*
...
...
@@ -204,17 +205,41 @@ comar_read(comar_t *com, int *cmdp, unsigned int *idp, char **strp)
*
strp
=
NULL
;
size
=
get_data_size
(
head
);
if
(
size
)
{
buf
=
malloc
(
size
+
1
);
if
(
size
>=
com
->
max
)
{
if
(
0
==
com
->
max
)
{
com
->
max
=
size
+
1
;
}
else
{
while
(
com
->
max
<
size
)
com
->
max
*=
2
;
}
com
->
buffer
=
realloc
(
com
->
buffer
,
com
->
max
);
}
len
=
0
;
buf
=
com
->
buffer
;
while
(
len
<
size
)
{
len
+=
recv
(
com
->
sock
,
buf
+
len
,
size
-
len
,
0
);
}
buf
[
size
]
=
'\0'
;
if
(
*
cmdp
==
COMAR_RESULT
)
{
char
*
t
;
t
=
strchr
(
buf
,
' '
);
if
(
t
)
{
*
t
=
'\0'
;
com
->
pakname
=
buf
;
*
strp
=
t
+
1
;
}
return
1
;
}
*
strp
=
buf
;
}
return
1
;
}
char
*
comar_package_name
(
comar_t
*
com
)
{
return
com
->
pakname
;
}
void
comar_disconnect
(
comar_t
*
com
)
{
...
...
comard/bindings/libcomar.h
Dosyayı görüntüle @
ac2fffa6
...
...
@@ -65,6 +65,7 @@ int comar_send_finish(comar_t *com);
int
comar_send
(
comar_t
*
com
,
unsigned
int
id
,
int
cmd
,
...);
int
comar_wait
(
comar_t
*
com
,
int
timeout
);
int
comar_read
(
comar_t
*
com
,
int
*
cmdp
,
unsigned
int
*
idp
,
char
**
strp
);
char
*
comar_package_name
(
comar_t
*
com
);
void
comar_disconnect
(
comar_t
*
com
);
...
...
comard/src/job.c
Dosyayı görüntüle @
ac2fffa6
...
...
@@ -59,7 +59,10 @@ send_result(int cmd, const char *data, size_t size)
{
ipc_start
(
cmd
,
chan
,
chan_id
,
0
);
if
(
CMD_RESULT
==
cmd
)
{
ipc_pack_arg
(
bk_app
,
strlen
(
bk_app
));
if
(
bk_app
)
ipc_pack_arg
(
bk_app
,
strlen
(
bk_app
));
else
ipc_pack_arg
(
"comar"
,
5
);
}
if
(
data
)
{
if
(
size
==
0
)
size
=
strlen
(
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment