On Tue, 15 Mar 2011 08:57:24 -0600 Andrew Johnson <[email protected]> wrote
about Re: epics on FreeBSD: broadcast problem:
Hi Andrew,
AJ> I certainly want to fold back any necessary changes into Base, and I
AJ> can forward any other substantive changes to Janet who manages
AJ> extensions and MEDM. We don't currently have an active maintainer for
AJ> FreeBSD which is why the code that we do have for it didn't work
AJ> properly for you. Please send me a patch file and I'll take a look.
Ok, I have repeated everything with a clean system now to find out what is
actually needed and working. For the epics base I have just the change
Jeff recommended to get the broadcast working:
---
diff --git a/src/libCom/osi/os/freebsd/osdSock.h b/src/libCom/osi/os/freebsd/osdSock.h
index 0b9e515..8c270b7 100644
--- a/src/libCom/osi/os/freebsd/osdSock.h
+++ b/src/libCom/osi/os/freebsd/osdSock.h
@@ -77,7 +77,11 @@ typedef socklen_t osiSocklen_t;
# define SHUT_RDWR 2
#endif
-#define ifreq_size(pifreq) (sizeof(pifreq->ifr_name))
+#if BSD4_4
+# define ifreq_size(pifreq) (pifreq->ifr_addr.sa_len + sizeof(pifreq->ifr_name))
+#else
+# define ifreq_size(pifreq) sizeof(*pifreq)
+#endif
#endif /*osdSockH*/
---
For the extensions I had to add the following directories in configure/os/CONFIG_SITE.freebsd-x86_64.freebsd-x86_64 to get medm compiled (X11 and MOTIF paths):
---
ahvbuildbox-fbsd64# cat CONFIG_SITE.freebsd-x86_64.freebsd-x86_64
#
# CONFIG_SITE.freebsd-x86_64.freebsd-x86_64,v 1.1 2006/12/04 22:28:29 jba Exp
#
# Site Specific Configuration Information
# Only the local epics system manager should modify this file
# Where to find utilities/libraries
# If you do not have a certain product,
# leave the line empty.
#
X11_LIB = /usr/local/lib
X11_INC = /usr/local/include
MOTIF_INC = $(X11_INC)
MOTIF_LIB = $(X11_LIB)
---
For x86 platform (32bit), the file was missing completely, so I created it:
---
ahvbuildbox-fbsd32# cat CONFIG_SITE.freebsd-x86.freebsd-x86
#
# CONFIG_SITE.freebsd-x86.freebsd-x86
#
# Site Specific Configuration Information
# Only the local epics system manager should modify this file
# Where to find utilities/libraries
# If you do not have a certain product,
# leave the line empty.
#
X11_LIB = /usr/local/lib
X11_INC = /usr/local/include
MOTIF_INC = $(X11_INC)
MOTIF_LIB = $(X11_LIB)
---
For both files, I chose the default directories that you get by installing Xorg and OpenMotif via FreeBSD's port collection (which should be the standard case).
Finally, for the gateway extension I noticed that it was compiling fine on the 64bit target, but gave me errors when compiling on 32bit. These errors were caused by wrong type casting in gateResources.cc:
---
/usr/bin/g++ -c -D_POSIX_THREADS -D_X86_ -DUNIX -D_BSD_SOURCE -Dfreebsd -D_REENTRANT -O3 -Wall -DSTAT_PVS -DRATE_STATS -DCONTROL_PVS -DCAS_DIAGNOSTICS -DHANDLE_EXCEPTIONS -DUSE_DENYFROM -MMD -I. -I../O.Common -I. -I.. -I/opt/epics/epics/include/os/freebsd -I/opt/epics/epics/include -I/opt/epics/epics/include/os/freebsd -I/opt/epics/epics/include -I/opt/epics/epics/src/cas/generic ../gateResources.cc
../gateResources.cc: In function 'char* timeStamp()':
../gateResources.cc:58: error: invalid conversion from 'long int*' to 'time_t*'
../gateResources.cc:58: error: initializing argument 1 of 'time_t time(time_t*)'
../gateResources.cc:59: error: invalid conversion from 'long int*' to 'const time_t*'
../gateResources.cc:59: error: initializing argument 1 of 'tm* localtime(const time_t*)'
gmake[1]: *** [gateResources.o] Error 1
gmake[1]: Leaving directory `/root/epics/extensions/src/gateway2_0_4_0/O.freebsd-x86'
gmake: *** [install.freebsd-x86] Error 2
---
I fixed this by replacing "long" type with "time_t". This way it compiled for me without errors on 32bit and 64bit, but I don't know if this is the proper fix for all platforms:
---
diff --git a/src/gateway2_0_4_0/gateResources.cc b/src/gateway2_0_4_0/gateResources.cc
index 5e74cdd..2fa2f21 100644
--- a/src/gateway2_0_4_0/gateResources.cc
+++ b/src/gateway2_0_4_0/gateResources.cc
@@ -51,13 +51,13 @@ gateResources* global_resources;
// should copy it to a safe place e.g. strcpy(savetime,timestamp());
char *timeStamp(void)
{
- static char timeStampStr[16];
- long now;
+ static char timeStampStr[20];
+ time_t now;
struct tm *tblock;
time(&now);
tblock=localtime(&now);
- strftime(timeStampStr,20,"%b %d %H:%M:%S",tblock);
+ strftime(timeStampStr,sizeof(timeStampStr),"%b %d %H:%M:%S",tblock);
return timeStampStr;
}
---
cu
Gerrit
- References:
- epics on FreeBSD: broadcast problem Gerrit Kühn
- Re: epics on FreeBSD: broadcast problem Gerrit Kühn
- Navigate by Date:
- Prev:
New "model 3" motor driver for Parker ACR controllers Mark Rivers
- Next:
PyEpics 3.1.0 Matt Newville
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: epics on FreeBSD: broadcast problem Andrew Johnson
- Next:
Asyn record DBD Rod Nussbaumer
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|