Re: [foxboro] OM programming question
- From: "Moramarco, Leo" <lmoramar@xxxxxxxxxx>
- To: "'foxboro@xxxxxxxxxxxxx'" <foxboro@xxxxxxxxxxxxx>
- Date: Fri, 24 Sep 2004 13:39:12 -0400
If my memory serves me well, the possible reason(s) why your program crashes
could be due to the following:
1. For security reasons, only the program(PID) that opens the list should be
the one that should close it. I know that OM does not protect the apps
against this. This should be respected otherwise you may get into other
problems.
2. There are two usages of omopen/omclose; optimized and unoptimized. You
seem to be using the optimized one. This requires that you provide the same
size structure as the om_open call. The idea behind optimized omopen/omclose
is that when you first omclose the list all tags address are returned, so
that you can feed it back in to omopen for faster opening of the list
(optimized) ie: you do not! want to broadcast ever time you open the same
list of tags.
I hope this helps to finding you problem.
Regards
Leo Moramarco
Instructor, Lifetime Learing Center
Invensys Systems Canada, Foxboro Division
Phone: 514.421.8301
FaxNo: 514.421.8054
Email: Lmoramar@xxxxxxxxxx
-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] On
Behalf Of Jeremy Milum
Sent: Friday, September 24, 2004 12:03 PM
To: foxboro@xxxxxxxxxxxxx
Subject: [foxboro] OM programming question
On Fri, 24 Sep 2004 11:18:03 -0400, Mark Dumond <mdumond@xxxxxxxxxxxxxx>
wrote:
> This may open up a can of worms, but I am beginning to believe
> that using FoxAPI isn't the best method for implementing programs
> that need to read and write Foxboro data via C calls.
> I have gone back to using the old core Object Manager calls
> (which are well documented in the "Programming" section of docs),
I have written a small C program to close an OM list when given the list
number. I get a segmentation fault about 50% of the time when using this.
Does anyone see an obvious problem:
----------------------------------------------------------------------------
----------------
#include <stdlib.h>
#include <stdio.h>
#include <fox/om_user.h>
#include <fox/om_ecode.h>
void errorCheck(int);
int main(int argc, char *argv[])
{
struct header_node om_list_hdr;
struct open_var vars[1];
int ret, list;
if(argc != 2)
{
printf("\nUsage: %s list_number\n\n", argv[0]);
exit(1);
}
list = atoi(argv[1]);
om_list_hdr.task_status = OM_RW_ACCESS;
om_list_hdr.net_adr_tbl_ptr = NULL;
om_list_hdr.open_list_ptr = vars;
ret = omclose(list, &om_list_hdr, vars, NULL);
errorCheck(ret);
return(0);
}
void errorCheck(int returnValue)
{
if(returnValue != OM_SUCCESS)
{
printf("error: %d\n", returnValue);
}
}
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
foxboro mailing list: http://www.freelists.org/list/foxboro
to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
foxboro mailing list: http://www.freelists.org/list/foxboro
to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
- Follow-Ups:
- Re: [foxboro] OM programming question
- From: Jeremy Milum
Other related posts:
- » Re: [foxboro] OM programming question
- » Re: [foxboro] OM programming question
- Re: [foxboro] OM programming question
- From: Jeremy Milum