Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Epics Base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lnf-da-control
Epics Base
Commits
6931273f
Commit
6931273f
authored
29 years ago
by
Jim Kowalkowski
Browse files
Options
Downloads
Patches
Plain Diff
New utilities to list PVs on an IOC and loaded applications.
parent
8d521779
No related branches found
Branches containing commit
Tags
R3.12.1.2
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dbtools/rdbapplist.c
+116
-0
116 additions, 0 deletions
src/dbtools/rdbapplist.c
src/dbtools/rdbls.c
+128
-0
128 additions, 0 deletions
src/dbtools/rdbls.c
with
244 additions
and
0 deletions
src/dbtools/rdbapplist.c
0 → 100644
+
116
−
0
View file @
6931273f
/* only runable on work station now */
#include
"PVS.h"
#include
<string.h>
#include
<stdio.h>
#include
<unistd.h>
#include
<stdlib.h>
static
int
read_pvs
(
BSDATA
*
info
,
int
serv
,
char
*
sname
);
int
main
(
int
argc
,
char
**
argv
)
{
BSDATA
info
;
int
rc
;
if
(
argc
<
2
)
{
fprintf
(
stderr
,
"usage: %s IOC-ip-address
\n
"
,
argv
[
0
]);
return
-
1
;
}
if
(
BSsetAddress
(
&
info
,
argv
[
1
])
<
0
)
{
fprintf
(
stderr
,
"Cannot determine address for %s
\n
"
,
argv
[
1
]);
return
-
1
;
}
rc
=
read_pvs
(
&
info
,
PVS_AppList
,(
char
*
)
NULL
);
if
(
rc
<
0
)
fprintf
(
stderr
,
"read of data failed horribly
\n
"
);
return
0
;
}
static
int
read_pvs
(
BSDATA
*
info
,
int
serv
,
char
*
sname
)
{
BS
*
bs
;
int
verb
,
size
,
done
,
len
,
i
,
port
,
rsize
;
char
*
buffer
;
char
ip_from
[
40
];
FILE
*
fd
;
BSgetAddressPort
(
info
,
ip_from
,
&
port
);
/* verify ioc not already added */
if
(
access
(
ip_from
,
F_OK
)
==
0
)
{
/* delete the existing file for this IOC */
unlink
(
ip_from
);
}
done
=
0
;
BSsetPort
(
info
,
PVS_TCP_PORT
);
if
((
bs
=
BSipOpenData
(
info
))
==
NULL
)
{
fprintf
(
stderr
,
"Open of socket to IOC failed
\n
"
);
return
-
1
;
}
if
(
serv
>
PVS_LAST_VERB
)
rsize
=
strlen
(
sname
)
+
1
;
else
rsize
=
0
;
if
(
BSsendHeader
(
bs
,
serv
,
rsize
)
<
0
)
{
fprintf
(
stderr
,
"Command send failed
\n
"
);
return
-
1
;
}
if
(
rsize
>
0
)
{
if
(
BSsendData
(
bs
,
sname
,
rsize
)
<
0
)
{
fprintf
(
stderr
,
"send of command name failed
\n
"
);
return
-
1
;
}
}
fd
=
stdout
;
buffer
=
(
char
*
)
malloc
(
PVS_TRANSFER_SIZE
+
2
);
while
(
done
==
0
)
{
if
(
BSreceiveHeader
(
bs
,
&
verb
,
&
size
)
<
0
)
{
fprintf
(
stderr
,
"Receive header failed
\n
"
);
done
=-
1
;
}
else
{
switch
(
verb
)
{
case
PVS_Data
:
/* read a block of names */
if
((
len
=
BSreceiveData
(
bs
,
buffer
,
size
))
<
0
)
fprintf
(
stderr
,
"Receive data failed
\n
"
);
else
fputs
(
buffer
,
fd
);
fputc
(
'\n'
,
fd
);
break
;
case
BS_Done
:
/* transfers complete */
BSclose
(
bs
);
done
=-
1
;
break
;
default:
if
(
size
>
0
)
done
=-
1
;
break
;
}
}
}
free
(
buffer
);
return
0
;
}
This diff is collapsed.
Click to expand it.
src/dbtools/rdbls.c
0 → 100644
+
128
−
0
View file @
6931273f
/* only runable on work station now */
#include
"PVS.h"
#include
<string.h>
#include
<stdio.h>
#include
<unistd.h>
#include
<stdlib.h>
static
int
read_pvs
(
BSDATA
*
info
,
int
serv
,
char
*
sname
);
int
main
(
int
argc
,
char
**
argv
)
{
BSDATA
info
;
int
rc
;
if
(
argc
<
2
)
{
fprintf
(
stderr
,
"usage: %s IOC-ip-address
\n
"
,
argv
[
0
]);
return
-
1
;
}
if
(
BSsetAddress
(
&
info
,
argv
[
1
])
<
0
)
{
fprintf
(
stderr
,
"Cannot determine address for %s
\n
"
,
argv
[
1
]);
return
-
1
;
}
rc
=
read_pvs
(
&
info
,
PVS_RecList
,(
char
*
)
NULL
);
if
(
rc
<
0
)
fprintf
(
stderr
,
"read of data failed horribly
\n
"
);
return
0
;
}
static
int
read_pvs
(
BSDATA
*
info
,
int
serv
,
char
*
sname
)
{
BS
*
bs
;
int
verb
,
size
,
done
,
len
,
i
,
port
,
rsize
;
char
*
buffer
;
char
ip_from
[
40
];
FILE
*
fd
;
BSgetAddressPort
(
info
,
ip_from
,
&
port
);
/* printf("IOC %s starting\n",ip_from); */
/* verify ioc not already added */
if
(
access
(
ip_from
,
F_OK
)
==
0
)
{
/* delete the existing file for this IOC */
unlink
(
ip_from
);
}
done
=
0
;
BSsetPort
(
info
,
PVS_TCP_PORT
);
if
((
bs
=
BSipOpenData
(
info
))
==
NULL
)
{
fprintf
(
stderr
,
"Open of socket to IOC failed
\n
"
);
return
-
1
;
}
if
(
serv
>
PVS_LAST_VERB
)
rsize
=
strlen
(
sname
)
+
1
;
else
rsize
=
0
;
if
(
BSsendHeader
(
bs
,
serv
,
rsize
)
<
0
)
{
fprintf
(
stderr
,
"Command send failed
\n
"
);
return
-
1
;
}
if
(
rsize
>
0
)
{
if
(
BSsendData
(
bs
,
sname
,
rsize
)
<
0
)
{
fprintf
(
stderr
,
"send of command name failed
\n
"
);
return
-
1
;
}
}
fd
=
stdout
;
buffer
=
(
char
*
)
malloc
(
PVS_TRANSFER_SIZE
+
2
);
while
(
done
==
0
)
{
if
(
BSreceiveHeader
(
bs
,
&
verb
,
&
size
)
<
0
)
{
fprintf
(
stderr
,
"Receive header failed
\n
"
);
done
=-
1
;
}
else
{
switch
(
verb
)
{
case
PVS_Data
:
/* read a block of names */
if
((
len
=
BSreceiveData
(
bs
,
buffer
,
size
))
<
0
)
{
fprintf
(
stderr
,
"Receive data failed
\n
"
);
}
else
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
buffer
[
i
]
==
' '
)
buffer
[
i
]
=
'\n'
;
}
buffer
[
len
]
=
'\n'
;
buffer
[
len
+
1
]
=
'\0'
;
fputs
(
buffer
,
fd
);
}
break
;
case
BS_Done
:
/* transfers complete */
BSclose
(
bs
);
done
=-
1
;
break
;
default:
if
(
size
>
0
)
done
=-
1
;
break
;
}
}
}
free
(
buffer
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment