ID |
Date |
Author |
Topic |
Subject |
455
|
09 Mar 2008 |
Exaos Lee | Suggestion | New Makefile for building MIDAS | I rewrote the Makefile for MIDAS in order to make it tidy. I tested it on my box
and it works here.
1. The full file is seperated to several parts
a. initialized setup
b. environment setup
c. specify OS-specific flags
d. processing environment for building flags
e. targets
2. The file is less than 400 lines now. The original one is more than 500 lines.
3. The modified one is easy for debuging.
I tried to learn "autoconf" and "automake" in order to make building MIDAS more
compatible for various platforms. But I havn't enough time now. Hope somebody
can help it. The attached file is original named "Makefile.in" for using "autoconf".
:-) |
Attachment 1: Makefile-by-EL
|
# initialized flags
#CC =
#FC =
#LD =
CFLAGS = -g -O3 -Wall -Wuninitialized -DINCLUDE_FTPLIB
###########################################################################
## Environments setup
## Prefix
ifndef PREFIX
PREFIX = /usr/local
endif
# User defined flags for compiler
USERFLAGS =
# Do you need to compile the shared library? If so, set "1" here.
NEED_SHLIB =
# If RPATH needed ...
NEED_RPATH =
# If static ROOT libaries needed ...
NEED_LIBROOTA =
# If strlcpy.o needed ...
NEED_STRLCPY = 1
# If zlib needed ...
NEED_ZLIB =
# MIDAS max event size
MIDAS_MAX_EVENT_SIZE =
# OS specific programs included
SPECIFIC_OS_PRG =
# ..? Why it is needed?
MIDAS_PREF_FLAGS =
## installer
INSTALL = $(shell which install)
ifndef INSTALL
INSTALL = ./install.sh
else
INS_OPTS = -v -D
endif
# MXML dir
ifndef MXML_DIR
MXML_DIR = ../mxml
endif
# MySQL
MYSQL_CONFIG := $(shell which mysql_config 2> /dev/null)
ifdef MYSQL_CONFIG
MYSQLINCDIR := $(shell mysql_config --cflags | sed -e 's,^.*-I\([^ ]*\).*$$,\1,' -e s/\'//g)
NEED_MYSQL := $(shell if test -e $(MYSQLINCDIR)/mysql.h ; then echo 1; fi)
endif
###########################################################################
## Check OS Type for OS-specified flags
OSTYPE = $(shell uname | tr '[A-Z]' '[a-z]')
ifeq ($(OSTYPE), linux)
# > 2GB file support
CFLAGS += -D_LARGEFILE64_SOURCE
CFLAGS += -DOS_LINUX -fPIC -Wno-unused-function
LDFLAGS += -lutil -lpthread
NEED_ZLIB =1
SPECIFIC_OS_PRG += mlxspeaker dio
endif
ifeq ($(OSTYPE), osf1)
CFLAGS += -DOS_OSF1
FFLAGS += -nofor_main -D 40000000 -T 20000000
LDFLAGS += -lc -lbsd
endif
ifeq ($(OSTYPE), ultrix)
CFLAGS += -DOS_ULTRIX -DNO_PTY
endif
ifeq ($(OSTYPE), freebsd)
CFLAGS += -DOS_FREEBSD
LDFLAGS += -lbsd -lcompat
endif
ifeq ($(OSTYPE), darwin)
CFLAGS += -DOS_LINUX -DOS_DARWIN -DHAVE_STRLCPY -fPIC -Wno-unused-function
LDFLAGS += -lpthread
NEED_RANLIB = 1
SPECIFIC_OS_PRG += mlxspeaker
endif
ifeq ($(OSTYPE), cygwin_nt-5.1)
OSTYPE = cygwin
endif
ifeq ($(OSTYPE), cygwin)
CFLAGS += -DOS_LINUX -DOS_CYGWIN -Wno-unused-function
LDFLAGS += -lutil -lpthread
endif
ifeq ($(OSTYPE), solaris)
CFLAGS += -DOS_SOLARIS
LDFLAGS += -lsocket -lnsl
endif
###########################################################################
## Processing environment for building flags
CFLAGS += $(MIDAS_PREF_FLAGS) $(USERFLAGS)
ifdef MIDAS_MAX_EVENT_SIZE
CFLAGS += -DMAX_EVENT_SIZE=$(MIDAS_MAX_EVENT_SIZE)
endif # MIDAS_MAX_EVENT_SIZE
ifdef NEED_MYSQL
CFLAGS += -DHAVE_MYSQL $(shell $(MYSQL_CONFIG) --include)
LDFLAGS += $(shell $(MYSQL_CONFIG) --libs)
NEED_ZLIB =1
endif # NEED_MYSQL
ifdef ROOTSYS
ROOTLIBS := $(shell $(ROOTSYS)/bin/root-config --libs)
ROOTCFLAGS := $(shell $(ROOTSYS)/bin/root-config --cflags)
ifdef NEED_RPATH
ROOTLIBS += -Wl,-rpath,$(ROOTSYS)/lib
endif
ifdef NEED_LIBROOTA
ROOTLIBS := $(ROOTSYS)/lib/libRoot.a -lssl -ldl -lcrypt
endif
CFLAGS += $(ROOTCFLAGS)
endif # ROOTSYS
ifdef NEED_ZLIB
CFLAGS += -DHAVE_ZLIB
LIBS += -lz
endif # ZLIB
ifdef NEED_SHLIB
CFLAGS += -shared -fPIC
endif # SHLIB
###########################################################################
## Processing building targets
## Directories needed
INC_DIR = include
SRC_DIR = src
UTL_DIR = utils
DRV_DIR = drivers
EXM_DIR = examples
## Driectories which will be created
OS_DIR = $(OSTYPE)
LIB_DIR = $(OS_DIR)/lib
BIN_DIR = $(OS_DIR)/bin
DIRS = $(OS_DIR) $(LIB_DIR) $(BIN_DIR)
CFLAGS += -I$(INC_DIR) -I$(DRV_DIR) -I$(MXML_DIR) -L$(LIB_DIR)
## Directories for install
INSTDIR_BIN = $(PREFIX)/bin
INSTDIR_INC = $(PREFIX)/include
INSTDIR_LIB = $(PREFIX)/lib
INSTDIR_DRV = $(PREFIX)/driver
## Utilities
PROGS = mserver mhttpd mlogger odbedit mtape mhist \
mstat mcnaf mdump mhdump mchart odbhist \
melog webpaw lazylogger stripchart.tcl \
$(SPECIFIC_OS_PRG)
UTILS = $(shell for i in $(PROGS); do echo $(BIN_DIR)/$$i ; done)
## Analyzer objects
ANALYZER = $(LIB_DIR)/mana.o
ifdef CERNLIB
ANALYZER += $(LIB_DIR)/hmana.o
endif
ifdef ROOTSYS
ANALYZER += $(LIB_DIR)/rmana.o
endif
## Objects for building $(LIBMIDAS_A) and $(LIBMIDAS_SO)
OBJS_LIB_NEED = midas.o system.o mrpc.o odb.o ybos.o ftplib.o history.o alarm.o elog.o
ifndef NEED_SHLIB
OBJS_LIB_NEED += cnaf_callback.o
endif
OBJS_LIB = $(shell for i in $(OBJS_LIB_NEED) ; do echo $(LIB_DIR)/$$i ; done)
## MXML OBJS
MXML_OBJS_NEED = mxml.o
ifdef NEED_STRLCPY
MXML_OBJS_NEED += strlcpy.o
endif
MXML_OBJS = $(shell for i in $(MXML_OBJS_NEED) ; do echo $(LIB_DIR)/$$i ; done)
## Objects for install
OBJS_INS_NEED = mfe.o fal.o
OBJS_INS = $(shell for i in $(OBJS_INS_NEED) ; do echo $(LIB_DIR)/$$i ; done)
## library
LIBMIDAS_A = $(LIB_DIR)/libmidas.a
ifdef NEED_SHLIB
LIBMIDAS_SO = $(LIB_DIR)/libmidas.so
LDFLAGS += -shared -L$(LIB_DIR) -lmidas
endif
## Examples
EXAMPLES_NEED = consume produce rpc_test msgdump minife minirc odb_test
EXAMPLES = $(shell for i in $(EXAMPLES_NEED); do echo examples/$$i ; done)
## Includes
INCLUDES = $(wildcard $(INC_DIR)/*.h)
###########################################################################
CXXFLAGS = $(CFLAGS)
ifdef ROOTSYS
CXXFLAGS += -DHAVE_ROOT
endif
all: check-mxml mkdirs $(LIBMIDAS_A) $(LIBMIDAS_SO) $(ANALYZER) $(OBJS_INS) utilities
.PHONY: clean
###########################################################################
## Library objects
$(LIB_DIR)/%.o: $(SRC_DIR)/%.c $(INCLUDES)
$(CC) $(CFLAGS) -c -o $@ $<
## MXML_OBJS
$(LIB_DIR)/mxml.o: $(MXML_DIR)/mxml.c
$(CC) $(CFLAGS) -c -o $@ $<
$(LIB_DIR)/strlcpy.o: $(MXML_DIR)/strlcpy.c
$(CC) $(CFLAGS) -c -o $@ $<
## Frontend and backend framework
$(LIB_DIR)/fal.o: $(SRC_DIR)/fal.c $(INCLUDES)
$(CXX) -Dextname -DMANA_LITE -c -o $@ $< $(CFLAGS)
$(LIB_DIR)/hmana.o: $(SRC_DIR)/mana.c $(INCLUDES)
$(CC) -Dextname -DHAVE_HBOOK $(CFLAGS) -c -o $@ $<
$(LIB_DIR)/rmana.o: $(SRC_DIR)/mana.c $(INCLUDES)
$(CXX) -DUSE_ROOT $(CXXFLAGS) -c -o $@ $<
## Utilities
$(BIN_DIR)/%: $(UTL_DIR)/%.c $(INCLUDES)
$(CC) $(CFLAGS) -o $@ $< $(LIBMIDAS_A) $(LDFLAGS)
$(BIN_DIR)/mlogger: $(SRC_DIR)/mlogger.c $(LIBMIDAS_A)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(ROOTLIBS)
$(BIN_DIR)/mserver: $(SRC_DIR)/mserver.c $(INCLUDES)
$(BIN_DIR)/mhttpd: $(SRC_DIR)/mhttpd.c $(SRC_DIR)/mgd.c
$(BIN_DIR)/odbedit: $(SRC_DIR)/odbedit.c $(SRC_DIR)/cmdedit.c
$(BIN_DIR)/mcnaf: $(UTL_DIR)/mcnaf.c $(DRV_DIR)/camac/camacrpc.c
$(BIN_DIR)/mhdump: $(UTL_DIR)/mhdump.cxx
$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(ROOTLIBS)
$(BIN_DIR)/lazylogger: $(SRC_DIR)/lazylogger.c
$(BIN_DIR)/stripchart.tcl: $(UTL_DIR)/stripchart.tcl
@cp -f $< $(BIN_DIR)/$(shell basename $@)
###########################################################################
mkdirs:
@for i in $(DIRS) ; do \
echo "Making directory $$i ..." ; \
mkdir -p $$i ; \
done
... 108 more lines ...
|
454
|
07 Mar 2008 |
Konstantin Olchanski | Suggestion | RFC- ACLs for midas rpc, mserver, mhttpd access | The mhttpd host-based access control list as used by ALPHA at CERN is now committed to
SVN (revision 4135).
When accepting connection from a remote host, the remote IP address is converted to a
hostname using gethostbyaddr(). If ODB directory "/experiment/security/mhttpd hosts",
exists, access is permitted if there is an entry for the this hostname. "localhost" is
always permitted.
In other words:
1) To enable the mhttpd access control list, create an ODB directory
"/experiment/security/mhttpd hosts".
2) From this moment, only access from "localhost" is permitted.
3) All connections from remote hosts are rejected with an error written into the midas
log file: Rejecting http connection from 'ladd05.triumf.ca'.
4) To permit access from remote hosts, take the hostname from this error message and
create an entry in "mhttpd hosts": odbedit -> cd "/Experiment/Security/mhttpd hosts" ->
create INT ladd05.triumf.ca
The idea behind this is that mhttpd is running behind an SSL proxy (or an SSH tunnel)
and only accepts connections from this proxy and perhaps from selected machines in the
experiment counting room.
P.S. I considered using tcp_wrappers, but this package does not seem to contain any
simple-to-use function "bool areTheyPermitted(const char* remoteHostname);".
P.P.S. The ODB path name is in variance from Stefan's email. I committed this code
before rereading it, please let me know if I should change the ODB paths.
P.P.P.S. I will now proceed with implementing similar code for the mserver/midas rpc.
Again, the use case is very simple: all machines permitted access to the mserver are
known in advance and can be listed in the access list. All unknown machines should be
rejected.
K.O. |
453
|
07 Mar 2008 |
Stefan Ritt | Bug Report | array overflows and other bugs | > I have just compiled MIDAS svn 4132 on a fresh SuSE 10.3 x86_64 system and gcc
> found a bunch of bugs, I guess.
Ahh, great! gcc is getting more and more clever. Each time gcc is updated, it finds
a few new issues.
Indeed some are real bugs, and I will work down the list as time permits. I see
however no immediate thread (you are not using fragmented events, a transition 12
never occurs, etc.). Issue #4 from your list has to be checked by Pierre-Andre. |
452
|
07 Mar 2008 |
Randolf Pohl | Bug Report | array overflows and other bugs | Hi,
I have just compiled MIDAS svn 4132 on a fresh SuSE 10.3 x86_64 system and gcc
found a bunch of bugs, I guess.
> uname -a
Linux pc 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC x86_64 x86_64
x86_64 GNU/Linux
> gcc --version
gcc (GCC) 4.2.1 (SUSE Linux)
I see loads of warnings during compile, most of which I know from earlier
compiles:
* warning: dereferencing type-punned pointer will break strict-aliasing rules
* warning: pointer targets in passing argument 3 of 'getsockname' differ in
signedness
But then there is a new one (in fact lots of this one), and brief
inspection suggests this is a true bug with the possibility of truly
nasty consequences.
(1)=========================
src/midas.c:7398: warning: array subscript is above array bounds
Inspection of midas.c:
if (i == MAX_DEFRAG_EVENTS) {
/* no buffer available -> no first fragment received */
7398: free(defrag_buffer[i].pevent);
memset(&defrag_buffer[i].event_id, 0, sizeof(EVENT_DEFRAG_BUFFER));
cm_msg(MERROR, "bm_defragement_event",
"Received fragment without first fragment (ID %d) Ser#:%d",
pevent->event_id & 0x0FFF, pevent->serial_number);
return;
}
And midas.c line 7297:
EVENT_DEFRAG_BUFFER defrag_buffer[MAX_DEFRAG_EVENTS];
So, if(i==MAX_DEFRAG_EVENTS) free(defrag_buffer[i]).
I guess this is an off-by-one bug.
(2)==========================
src/midas.c:2958: warning: array subscript is above array bounds
for (i = 0; i < 13; i++)
2958 if (trans_name[i].transition == transition)
break;
Holy cow, hard-coded "13" in the code! Should be a #define, shouldn't it?
Now look at midas.c lines 94ff:
struct {
int transition;
char name[32];
} trans_name[] = {
{
TR_START, "START",}, {
TR_STOP, "STOP",}, {
TR_PAUSE, "PAUSE",}, {
TR_RESUME, "RESUME",}, {
TR_DEFERRED, "DEFERRED",}, {
0, "",},};
There is no trans_name[12].
The trans_name[12] shows up in line 2894 and 2790, too.
(3)=============================
mfe.c:
src/mfe.c:412: warning: array subscript is above array bounds
src/mfe.c:311: warning: array subscript is above array bounds
src/mfe.c:340: warning: array subscript is above array bounds
412: device_drv->dd(CMD_GET_DEMAND, device_drv->dd_info, i,
&device_drv->mt_buffer->channel[i].array[CMD_GET_DEMAND]);
for (cmd = CMD_GET_FIRST; cmd <= CMD_GET_LAST; cmd++) {
(..)
311: device_drv->mt_buffer->channel[current_channel].array[cmd] = value;
for (cmd = CMD_GET_FIRST; cmd <= CMD_GET_LAST; cmd++) {
(..)
340: device_drv->mt_buffer->channel[i].array[cmd] = value;
CMD_GET_DEMAND is in include/midas.h:
#define CMD_GET_DEMAND CMD_GET_DIRECT // = 20
I haven't even tried to understand mfe.c, nor did I read it.
But I suspect the thing should always be something like
....array[cmd-CMD_GET_FIRST]
so array[] is indexed from [0], not from an arbitrary number that
depends on the number of commands you insert before line 698 in
midas.h. But please could the author of this check this very carefully?
(4)=========================
src/lazylogger.c:1957: warning: array subscript is below array bounds
if ((channel < 0) && (lazyinfo[channel].hKey != 0))
That is lazyinfo[something below zero].
(5)=============================
More warnings an expert might want to have a look at:
* warning: deprecated conversion from string constant to 'char*'
* src/fal.c:106: warning: non-local variable '<anonymous struct> out_info'
uses anonymous type
* src/fal.c:3064: warning: non-local variable '<anonymous struct> eb' uses
anonymous type
I attach the full output of make.
Could someone knowledgeable please have a look at these warnings and fix them?
They make me a bit nervous when thinking about data integrity, and
there are now so many that they actually start to hide serious stuff
like the ones I presented.
Oh, I got rid of the "dereferencing type-punned pointer" thing by adding
"-fno-strict-aliasing" as a compiler flag. Was suggested on the Web. Seemed to
have worked during data taking (the data look reasonable :-). Is that a
possible fix/workaround?
Cheers,
Randolf |
Attachment 1: out.0.make
|
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/midas.o src/midas.c
src/midas.c: In function 'bm_open_buffer':
src/midas.c:4020: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/midas.c: In function 'rpc_server_connect':
src/midas.c:8259: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c:8261: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c:8263: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c:8376: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c:8378: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c:8380: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c: In function 'rpc_register_server':
src/midas.c:10533: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/midas.c: In function 'rpc_server_accept':
src/midas.c:11230: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c:11239: warning: pointer targets in passing argument 3 of 'getpeername' differ in signedness
src/midas.c: In function 'rpc_client_accept':
src/midas.c:11493: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
src/midas.c: In function 'bm_defragment_event':
src/midas.c:7398: warning: array subscript is above array bounds
src/midas.c: In function 'cm_register_deferred_transition':
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c:2958: warning: array subscript is above array bounds
src/midas.c: In function 'cm_set_transition_sequence':
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c:2894: warning: array subscript is above array bounds
src/midas.c: In function 'cm_deregister_transition':
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c:2849: warning: array subscript is above array bounds
src/midas.c: In function 'cm_register_transition':
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
src/midas.c:2790: warning: array subscript is above array bounds
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/system.o src/system.c
src/system.c: In function 'ss_suspend_init_ipc':
src/system.c:2948: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/system.c: In function 'ss_suspend':
src/system.c:3416: warning: pointer targets in passing argument 6 of 'recvfrom' differ in signedness
src/system.c:3443: warning: pointer targets in passing argument 6 of 'recvfrom' differ in signedness
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mrpc.o src/mrpc.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/odb.o src/odb.c
src/odb.c: In function 'db_open_database':
src/odb.c:891: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/odb.c: In function 'db_lock_database':
src/odb.c:1441: warning: dereferencing type-punned pointer will break strict-aliasing rules
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/ybos.o src/ybos.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/ftplib.o src/ftplib.c
src/ftplib.c: In function 'ftp_data':
src/ftplib.c:288: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
src/ftplib.c:310: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mxml.o ../mxml/mxml.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/history.o src/history.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/alarm.o src/alarm.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/elog.o src/elog.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/strlcpy.o ../mxml/strlcpy.c
rm -f linux/lib/libmidas.a
ar -crv linux/lib/libmidas.a linux/lib/midas.o linux/lib/system.o linux/lib/mrpc.o linux/lib/odb.o linux/lib/ybos.o linux/lib/ftplib.o linux/lib/mxml.o linux/lib/history.o linux/lib/alarm.o linux/lib/elog.o linux/lib/strlcpy.o
a - linux/lib/midas.o
a - linux/lib/system.o
a - linux/lib/mrpc.o
a - linux/lib/odb.o
a - linux/lib/ybos.o
a - linux/lib/ftplib.o
a - linux/lib/mxml.o
a - linux/lib/history.o
a - linux/lib/alarm.o
a - linux/lib/elog.o
a - linux/lib/strlcpy.o
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mana.o src/mana.c
g++ -DUSE_ROOT -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -pthread -m64 -I/usr/local/packages/root/pro/include -o linux/lib/rmana.o src/mana.c
src/mana.c:186: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'void add_data_dir(char*, char*)':
src/mana.c:429: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'EVENT_DEF* db_get_event_definition(short int)':
src/mana.c:484: warning: deprecated conversion from string constant to 'char*'
src/mana.c:500: warning: deprecated conversion from string constant to 'char*'
src/mana.c:505: warning: deprecated conversion from string constant to 'char*'
src/mana.c:516: warning: deprecated conversion from string constant to 'char*'
src/mana.c:518: warning: deprecated conversion from string constant to 'char*'
src/mana.c:520: warning: deprecated conversion from string constant to 'char*'
src/mana.c:522: warning: deprecated conversion from string constant to 'char*'
src/mana.c:524: warning: deprecated conversion from string constant to 'char*'
src/mana.c:526: warning: deprecated conversion from string constant to 'char*'
src/mana.c:534: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT bor(INT, char*)':
src/mana.c:1745: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT process_event(ANALYZE_REQUEST*, EVENT_HEADER*)':
src/mana.c:3230: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'void register_requests()':
src/mana.c:3465: warning: deprecated conversion from string constant to 'char*'
src/mana.c:3479: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'TCutG* cut_book(const char*)':
src/mana.c:3562: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT bevid_2_mheader(EVENT_HEADER*, DWORD*)':
src/mana.c:3864: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'void odb_load(EVENT_HEADER*)':
src/mana.c:3910: warning: deprecated conversion from string constant to 'char*'
src/mana.c:3921: warning: deprecated conversion from string constant to 'char*'
src/mana.c:3932: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'MA_FILE* ma_open(char*)':
src/mana.c:4031: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'INT analyze_run(INT, char*, char*)':
src/mana.c:4252: warning: deprecated conversion from string constant to 'char*'
src/mana.c: In function 'int main(int, char**)':
src/mana.c:5618: warning: deprecated conversion from string constant to 'char*'
src/mana.c:5682: warning: deprecated conversion from string constant to 'char*'
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/cnaf_callback.o src/cnaf_callback.c
cc -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/mfe.o src/mfe.c
src/mfe.c: In function 'scheduler':
src/mfe.c:1869: warning: pointer targets in passing argument 5 of 'db_get_value' differ in signedness
src/mfe.c:2042: warning: pointer targets in passing argument 5 of 'db_get_value' differ in signedness
src/mfe.c:2051: warning: pointer targets in passing argument 5 of 'db_get_value' differ in signedness
src/mfe.c: In function 'device_driver':
src/mfe.c:412: warning: array subscript is above array bounds
src/mfe.c: In function 'sc_thread':
src/mfe.c:311: warning: array subscript is above array bounds
src/mfe.c:340: warning: array subscript is above array bounds
g++ -Dextname -DMANA_LITE -c -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/fal.o src/fal.c
src/fal.c:65: warning: deprecated conversion from string constant to 'char*'
src/fal.c:106: warning: non-local variable '<anonymous struct> out_info' uses anonymous type
src/fal.c:118: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c:122: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void logger_init()':
src/fal.c:252: warning: deprecated conversion from string constant to 'char*'
src/fal.c:256: warning: deprecated conversion from string constant to 'char*'
src/fal.c:260: warning: deprecated conversion from string constant to 'char*'
src/fal.c:263: warning: deprecated conversion from string constant to 'char*'
src/fal.c:267: warning: deprecated conversion from string constant to 'char*'
src/fal.c:271: warning: deprecated conversion from string constant to 'char*'
src/fal.c:274: warning: deprecated conversion from string constant to 'char*'
src/fal.c:277: warning: deprecated conversion from string constant to 'char*'
src/fal.c:280: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void odb_save(char*)':
src/fal.c:335: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT ftp_open(char*, FTP_CON**)':
src/fal.c:1048: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1052: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1056: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1056: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1061: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1066: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT midas_log_open(LOG_CHN*, INT)':
src/fal.c:1194: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/fal.c: In function 'EVENT_DEF* db_get_event_definition(short int)':
src/fal.c:1321: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1337: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1347: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1349: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1351: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1353: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1355: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1357: warning: deprecated conversion from string constant to 'char*'
src/fal.c:1365: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT dump_log_open(LOG_CHN*, INT)':
src/fal.c:1582: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/fal.c: In function 'INT ascii_log_open(LOG_CHN*, INT)':
src/fal.c:1803: warning: dereferencing type-punned pointer will break strict-aliasing rules
src/fal.c: In function 'INT log_open(LOG_CHN*, INT)':
src/fal.c:2293: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2296: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2299: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2302: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2309: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT log_write(LOG_CHN*, EVENT_HEADER*)':
src/fal.c:2414: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2439: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2477: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2478: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT open_history()':
src/fal.c:2523: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2525: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2530: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2531: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2533: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2535: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2538: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2538: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2540: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2543: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2543: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2550: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2564: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2573: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2581: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2613: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2737: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2864: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void close_history()':
src/fal.c:2878: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT log_callback(INT, void**)':
src/fal.c:2983: warning: deprecated conversion from string constant to 'char*'
src/fal.c:2992: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3007: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3011: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3015: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3040: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3042: warning: deprecated conversion from string constant to 'char*'
src/fal.c: At global scope:
src/fal.c:3064: warning: non-local variable '<anonymous struct> eb' uses anonymous type
src/fal.c: In function 'INT tr_start(INT, char*)':
src/fal.c:3092: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3097: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3101: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3104: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3107: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3114: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3153: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3161: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3205: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3207: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3209: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3226: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3272: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT tr_stop(INT, char*)':
src/fal.c:3491: warning: deprecated conversion from string constant to 'char*'
src/fal.c:3496: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void add_data_dir(char*, char*)':
src/fal.c:3537: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT mana_init()':
src/fal.c:4395: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT register_equipment()':
src/fal.c:4657: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4660: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4683: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4687: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4694: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4696: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4761: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'void register_requests()':
src/fal.c:4924: warning: deprecated conversion from string constant to 'char*'
src/fal.c:4934: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'INT scheduler()':
src/fal.c:5407: warning: deprecated conversion from string constant to 'char*'
src/fal.c:5496: warning: deprecated conversion from string constant to 'char*'
src/fal.c: In function 'int main(int, char**)':
src/fal.c:5616: warning: deprecated conversion from string constant to 'char*'
cc -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/bin/mserver src/mserver.c linux/lib/libmidas.a -lutil -lpthread -lz
cc -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/bin/mhttpd src/mhttpd.c src/mgd.c linux/lib/libmidas.a -lutil -lpthread -lz -lm
g++ -g -O3 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root/pro/include -DHAVE_ZLIB -DOS_LINUX -fPIC -Wno-unused-function -o linux/bin/mlogger src/mlogger.c linux/lib/libmidas.a -L/usr/local/packages/root/pro/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread -lm -ldl -rdynamic -Wl,-rpath,/usr/local/packages/root/pro/lib -lutil -lpthread -lz
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
src/mlogger.c:78: warning: deprecated conversion from string constant to 'char*'
... 156 more lines ...
|
451
|
02 Mar 2008 |
Exaos Lee | Suggestion | Bash Script for handling an experiment code | I rearanged the files in "examples/experiment" as the attached "mtest_exp.zip". I re-write the start/stop script as the attached "daq.sh". The script "daq.sh" can be re-used for many experiments. The user only needs to provide an script "daq_env.sh" as the following containing the settings for the experiment environment.
#!/bin/sh
[ ! "$MIDASSYS" ] && MIDASSYS=/opt/MIDAS.PSI/Version/Current
[ ! "$HTTPPORT" ] && HTTPPORT=8080
[ ! "$SRVHOST" ] && SRVHOST=localhost
LOGGER=${MIDASSYS}/bin/mlogger
EXPPATH=/home/das/online/test
CODEPATH=${EXPPATH}/code
LOGGER=${MIDASSYS}/bin/mlogger
PROG_FE=${CODEPATH}/frontend
PROG_ANA=${CODEPATH}/analyzer
if [ ! "$MIDAS_EXPTAB" ]; then
MIDAS_DIR=${EXPPATH}
else
MIDAS_EXPT_NAME="test"
fi
I hope this can be helpful. There seem to be some problems such as:
1. When several experiments are defined, the $LOGGER may be not the one used for this exp.
2. The "pidof" may be not in some platforms, so this script is limited.
Hope anybody can help me to improve it for general purpose. All my best! |
Attachment 1: daq.sh
|
#!/bin/sh
DAQ_SETENV=./daq_env.sh
[ -f "${DAQ_SETENV}" ] && source ${DAQ_SETENV}
### Start ....
start()
{
#### Running mserver
pidmsrv=`pidof mserver`
if [ ! "$pidmsrv" ]; then
echo Starting mserver ...
$MIDASSYS/bin/mserver -D -m
pidmhttpd=`pidof mhttpd`
[ "$pidmhttpd" ] && kill -9 $pidmhttpd
echo Starting mhttpd ...
$MIDASSYS/bin/mhttpd -h localhost -D -p $HTTPPORT
fi
#### Change work directory
OLD_DIR=`pwd`
cd ${EXPPATH}
#### Running FE and Analyzer ...
# Options for multi experiments running ...
[ "$MIDAS_EXPTAB" ] && OPTIONS="-e $MIDAS_EXPT_NAME"
$MIDASSYS/bin/odbedit ${OPTIONS} -c clean
sleep 2
echo Starting frontend session: ${PROG_FE} ...
${PROG_FE} ${OPTIONS} -D
echo Starting analyzer session: ${PROG_ANA} ...
${PROG_ANA} ${OPTIONS} -D
sleep 1
echo Starting logger utility: mlogger ...
${LOGGER} ${OPTIONS} -D
cat <<EOF
Please point your web browser to http://localhost:$HTTPPORT
Or run: firefox http://localhost:$HTTPPORT
To look at live histograms, run: roody -Hlocalhost
EOF
#### Resume old directory
cd ${OLD_DIR}
}
### Stop ....
stop()
{
#### Kill Running sessions
pidlog=`pidof $(basename ${LOGGER})`
pidfe=` pidof $(basename ${PROG_FE})`
pidana=`pidof $(basename ${PROG_ANA})`
[ "$pidlog" ] && kill $pidlog
[ "$pidfe" ] && kill $pidfe
[ "$pidana" ] && kill $pidana
}
### Status ....
status()
{
echo "MIDAS Server (mserver): "
pid=`pidof mserver`
echo_status $pid
echo "MIDAS HTTPD Server (mhttpd): "
pid=`pidof mhttpd`
echo_status $pid
echo "Logger (${LOGGER}): "
pid=`pidof $(basename ${LOGGER})`
echo_status $pid
echo "Frontend Code ($PROG_FE): "
pid=`pidof $(basename ${PROG_FE})`
echo_status $pid
echo "Analyzer Code ($PROG_ANA): "
pid=`pidof $(basename ${PROG_ANA})`
echo_status $pid
}
echo_status()
{
if [ "$1" ]; then
echo -e "\t Running as $1."
else
echo -e "\t Not Running!"
fi
}
### Usage ....
usage()
{
echo "Usage: $0 [<start>|<stop>|<restart>|<status>]"
}
###################### Main Procedure ###########################
case "${1:-''}" in
"start")
start
;;
"stop")
stop
;;
"restart")
stop
start
;;
"status")
status
;;
*)
usage
;;
esac
######################### The END #############################
|
Attachment 2: mtest_exp.zip
|
450
|
29 Feb 2008 |
Denis Bilenko | Bug Report | NEED_SHLIB=1 is broken | Having libmidas.so is absolutely necessary for pymidas to work. If there was no such
option in Makefile pymidas users would have to build it themselves.
What I proposed though is that you change Makefile so it builds libmidas.so in
addition to (not instead of) static library. So if someone prefer to build
binaries statically they
may continue to do so. On other hand when someone needs a shared library they won't
discover that it can't be easily built. |
449
|
28 Feb 2008 |
Konstantin Olchanski | Bug Report | mhttpd: cannot attach history to elog | > From "history" pages, the "create elog" button stopped working - it takes us to the elog entry form, but
> then, the "submit" button does not create any elog entries, instead dumps us into an invalid history
> display. This is using the internal elog.
>
> This change in mhttpd.c::show_elog_new() makes it work again:
> - ("<body><form method=\"POST\" action=\"./\" enctype=\"multipart/form-data\">\n");
> + ("<body><form method=\"POST\" action=\"/EL/\" enctype=\"multipart/form-data\">\n");
This was a problem with relative URLs and it is now fixed. Svn revision 4131, fixes: delete elog, make elog from odb, make elog from history.
K.O. |
448
|
27 Feb 2008 |
Konstantin Olchanski | Bug Report | mhttpd: cannot attach history to elog | From "history" pages, the "create elog" button stopped working - it takes us to the elog entry form, but
then, the "submit" button does not create any elog entries, instead dumps us into an invalid history
display. This is using the internal elog.
This change in mhttpd.c::show_elog_new() makes it work again:
- ("<body><form method=\"POST\" action=\"./\" enctype=\"multipart/form-data\">\n");
+ ("<body><form method=\"POST\" action=\"/EL/\" enctype=\"multipart/form-data\">\n");
Problem and fix confirmed with Linux/firefox and MacOS/firefox and Safari.
K.O. |
447
|
27 Feb 2008 |
Konstantin Olchanski | Info | CAMAC register_cnaf_callback() - removed from libmidas | > > Affected files:
> > Makefile (add cnaf_callback.o)
> That's a good idea.
> To make things a bit easier, I modified the midas\examples\experiment\fronted.c to
> contain this call, so people should be guided by that. I also added cnaf_callback.c
> to the Makefile of the example frontend.
A request was made to remove cnaf_callback.o from libmidas as it creates a unwanted dependency on the CAMAC
hardware driver when libmidas.so is used in programs that do not use CAMAC.
After looking around, it appears that removing cnaf_callback.o from libmidas would not break anything critical,
other than CAMAC frontends that would fail to link with an obvious and easy to fix error.
I am leaving cnaf_callback.o in the Makefile - so it will be built and placed in linux/lib/cnaf_callback.o for anybody
who wants to use it.
svn revision 4130.
K.O. |
446
|
27 Feb 2008 |
Konstantin Olchanski | Bug Report | NEED_SHLIB=1 is broken | --- Makefile (revision 4129)
+++ Makefile (working copy)
- $(LIB_DIR)/mxml.o $(LIB_DIR)/cnaf_callback.o \
+ $(LIB_DIR)/mxml.o \
> i.e. remove cnaf_callback.o which causes the link errors.
Hi, Denis - I confirm that cnaf_callback.c is only used by MIDAS frontends that implement CAMAC
functions and that it should not required for building the MIDAS library. I am now looking at removing
it from libmidas.
> I propose that libmidas.so is built by default, so when something breaks it won't go unnoticed
We have been through this before and decided that shared libraries are bad and we do not want to use
them. The option for building libmidas.so was preserved, though.
Not to refight old wars, on reason against using shared libraries was version skew - one could never be
sure what version of midas is being used - depending on the PATH, LD_LIBRARY_PATH, rpath settings,
etc. There were other reasons, perhaps practical, perhaps with the mserver.
The main problem with "just build it", is that then the rest of midas will link against it bringing back all
the problems we solved by going away from using shared libraries.
So back to your proposal about building libmidas.so - can you look and see if you can do the Python
bindings with a statically linked midas library?
I know it is possible with Perl bindings - perl creates it's own shared library containing perl api glue
linked against a foreign static library libfoo.a , so in theory, the shared library is not needed.
But perhaps, Python do things differently...
K.O. |
445
|
26 Feb 2008 |
Denis Bilenko | Bug Report | NEED_SHLIB=1 is broken | I have the exact same problem with midas rev. 4129.
`make NEED_SHLIB=1` doesn't work.
To fix it apply this patch to Makefile
Index: Makefile
===================================================================
--- Makefile (revision 4129)
+++ Makefile (working copy)
@@ -270,7 +270,7 @@
OBJS = $(LIB_DIR)/midas.o $(LIB_DIR)/system.o $(LIB_DIR)/mrpc.o \
$(LIB_DIR)/odb.o $(LIB_DIR)/ybos.o $(LIB_DIR)/ftplib.o \
- $(LIB_DIR)/mxml.o $(LIB_DIR)/cnaf_callback.o \
+ $(LIB_DIR)/mxml.o \
$(LIB_DIR)/history.o $(LIB_DIR)/alarm.o $(LIB_DIR)/elog.o
ifdef NEED_STRLCPY
i.e. remove cnaf_callback.o which causes the link errors.
I propose that libmidas.so is built by default, so when something breaks it won't go unnoticed. |
444
|
21 Feb 2008 |
Konstantin Olchanski | Bug Report | potential memory corruption in odb,c:extract_key() | > It looks like ODB function extract_key() will overwrite the array pointed to by "key_name" if given an odb
> path with very long names (as seems to happen when redirection explodes in the Safari web browser, via
> db_get_value(TRUE) via mhttpd "start program" button). All callers of this function seem to provide 256
> byte strings, so the problem would not show up in normal use - only when abnormal odb paths are being
> parsed. Proposed solution is to add a "length" argument to this function. (Actually ODB path elements
> should be restricted to NAME_LENGTH (32 bytes), right?). K.O.
This is fixed in svn revision 4129.
K.O. |
443
|
21 Feb 2008 |
Konstantin Olchanski | Info | mhttpd history display updates | > You misspelled one ODB entry:
> Line 9014:
> sprintf(str, "/History/Display/%s/Label", path);
>
> Line 9028:
> sprintf(str, "/History/Display/%s/Labels", path);
> ---^
>
> I wonder how you could have tested that code for 1/2 year without noticing this error.
> I fixed and committed it.
It turns out that the program was tested as originally committed. With the above
modification, it corrupts ODB - originally, it used the wrong array element size to create
the wrong array. Corrected, it creates the right array with the wrong size, then
subsequent db_set_data_index() happily corrupts ODB.
Fix for mhttpd committed as svn revision 4128.
Fix for ODB corruption committed at svn revision 4129 (also fixes extract_key())
K.O. |
442
|
21 Feb 2008 |
Stefan Ritt | Bug Report | mhttpd safari 3.0.4 redirect problem | > /* start command */
> if (*getparam("Start")) {
> /* for NT: close reply socket before starting subprocess */
> - redirect2("?cmd=programs");
> + redirect2("/?cmd=programs");
The second version won't work if mhttpd is run under an Apache proxy. Assume the proxy redirects
http://proxy.ca/midas
to
http://daq.ca:8080
If you now do a redirect to "/?cmd=programs", you will end up at
http://proxy.ca/?cmd=programs
which is now what you want. I tried to put a "./?cmd=programs", and that bings you to
http://proxy.ca/midas/./?cmd=programs
which is correctly redirected to
http://daq.ca:8080/?cmd=programs
I tried with the windows version (ughhh) of Safari and it worked for me. So give it a try, the change is committed.
> ODB corruption happens here:
>
> sprintf(str, "/Programs/%s/Start command", name);
> - db_get_value(hDB, 0, str, command, &size, TID_STRING, TRUE);
> + db_get_value(hDB, 0, str, command, &size, TID_STRING, FALSE);
> if (command[0]) {
> ss_system(command);
>
> It looks like db_get_value() would corrupt ODB if given funny "str". When Safari explodes,
> funny strings are generated.
What happes is an endless redirect from xxxx -> xxxx?cmd=Programs. So in the end you have
http://url.ca?cmd=programs?cmd=programs?cmd=programs?cmd=programs....
and in the end you get a stack overflow, which busts all.
> The simple fix is to replace "TRUE" with "FALSE", then at least db_get_value() does not try to make bogus
> entries in ODB.
I changed both butting FALSE there and adding
if (strchr(name, '?'))
*strchr(name, '?') = 0;
which keeps the URL short.
So for me it looks fine at the moment, but I cannot guarantee that everything works, so keep an eye open on that. |
441
|
19 Feb 2008 |
Maggie Lee | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | Thank you for your help =)
Since SYSBIN_DIR is defined as /usr/local/bin in the Makefile and it exists in my computer, so I deleted the -D in the Makefile and tried to "make install" again and the
error message becomes:
...
... Installing programs and utilities to /usr/local/bin
...
/bin/sh: -c: line 2: syntax error: unexpected end of file
make: *** [install] Error 2
Can anyone help me solve this problem?
> > I forgot to mention that, the following (and similar) lines:
> > install -v -D -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
> > are changed into
> > install -v -d -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
> >
> > since -D is an illegal option for install. I am not sure whether -D in Linux means the same thing for -d in MacOSX install.
>
> -D under linux means:
>
> -D create all leading components of DEST except the last, then
> copy SOURCE to DEST; useful in the 1st format
>
> This means if you install the first time, and eithe SYSBIN_DIR or `basename is not existing, it will be created on-the-fly from
> the install program. If OSX does not support this, you somehow have to crate these subdirectories manually. |
440
|
19 Feb 2008 |
Petr Nomokonov | Info | Frontend - Backend c onnection | Backend computer with SLC4.4 Linux did'not work as mserver because some security
protection under iptables service (could not connect with frontend computers).
The connection established if to make ( under root ) iptables disable
by command: service iptables stop, or much more gently
just to accept mserver port with command (under root):
iptables -I INPUT -p tcp --dport 1175 -j ACCEPT
( in /etc/service
midas 1175/tcp #Midas server)
To check which ports is open
it is possible to use the command: "netstat -n" to see digital numbers of ports. |
439
|
19 Feb 2008 |
Stefan Ritt | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | > I forgot to mention that, the following (and similar) lines:
> install -v -D -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
> are changed into
> install -v -d -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
>
> since -D is an illegal option for install. I am not sure whether -D in Linux means the same thing for -d in MacOSX install.
-D under linux means:
-D create all leading components of DEST except the last, then
copy SOURCE to DEST; useful in the 1st format
This means if you install the first time, and eithe SYSBIN_DIR or `basename is not existing, it will be created on-the-fly from
the install program. If OSX does not support this, you somehow have to crate these subdirectories manually. |
438
|
19 Feb 2008 |
Maggie Lee | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | I forgot to mention that, the following (and similar) lines:
install -v -D -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
are changed into
install -v -d -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
since -D is an illegal option for install. I am not sure whether -D in Linux means the same thing for -d in MacOSX install.
> > While executing "make install" under MacOS 10.4.7, you may encounter errors about "dio". It is the
> > problem of "Makefile". I did some change to it and attach the diff file here.
>
> Thank you very much for your instructions for installing Midas on MacOSX.
> I followed your instructions to change the Makefile but I still get the following error message:
>
> ...
> ... Installing programs and utilities to /usr/local/bin
> ...
> install: darwin/bin/lazylogger exists but is not a directory
> install: darwin/bin/mchart exists but is not a directory
> install: darwin/bin/mcnaf exists but is not a directory
> install: darwin/bin/mdump exists but is not a directory
> install: darwin/bin/melog exists but is not a directory
> install: darwin/bin/mhdump exists but is not a directory
> install: darwin/bin/mhist exists but is not a directory
> install: darwin/bin/mhttpd exists but is not a directory
> install: darwin/bin/mlogger exists but is not a directory
> install: darwin/bin/mlxspeaker exists but is not a directory
> install: darwin/bin/mserver exists but is not a directory
> install: darwin/bin/mstat exists but is not a directory
> install: darwin/bin/mtape exists but is not a directory
> install: darwin/bin/odbedit exists but is not a directory
> install: darwin/bin/odbhist exists but is not a directory
> install: darwin/bin/stripchart.tcl exists but is not a directory
> install: darwin/bin/webpaw exists but is not a directory
> make: *** [install] Error 71
>
> Could you help me solve this problem? Thank you in advance =) |
437
|
19 Feb 2008 |
Maggie Lee | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | > While executing "make install" under MacOS 10.4.7, you may encounter errors about "dio". It is the
> problem of "Makefile". I did some change to it and attach the diff file here.
Thank you very much for your instructions for installing Midas on MacOSX.
I followed your instructions to change the Makefile but I still get the following error message:
...
... Installing programs and utilities to /usr/local/bin
...
install: darwin/bin/lazylogger exists but is not a directory
install: darwin/bin/mchart exists but is not a directory
install: darwin/bin/mcnaf exists but is not a directory
install: darwin/bin/mdump exists but is not a directory
install: darwin/bin/melog exists but is not a directory
install: darwin/bin/mhdump exists but is not a directory
install: darwin/bin/mhist exists but is not a directory
install: darwin/bin/mhttpd exists but is not a directory
install: darwin/bin/mlogger exists but is not a directory
install: darwin/bin/mlxspeaker exists but is not a directory
install: darwin/bin/mserver exists but is not a directory
install: darwin/bin/mstat exists but is not a directory
install: darwin/bin/mtape exists but is not a directory
install: darwin/bin/odbedit exists but is not a directory
install: darwin/bin/odbhist exists but is not a directory
install: darwin/bin/stripchart.tcl exists but is not a directory
install: darwin/bin/webpaw exists but is not a directory
make: *** [install] Error 71
Could you help me solve this problem? Thank you in advance =) |
436
|
18 Feb 2008 |
Jimmy Ngai | Bug Report | Analyzer cannot run as Daemon | Hi All,
I'm testing MIDAS SVN rev-4113 on Scientific Linux 5.1 (i386) and the Analyzer
can't start as Daemon. What I mean "can't" is that it stops running
immediately without leaving any error messages. However, it can run offline or
without becoming a Daemon. I have tested with ROOT 5.14e/5.16/5.18 and
the "Experiment" example coming with MIDAS and this problem always happens.
Any ideas?
Best Regards,
Jimmy |
|